Next: Files, Previous: Particular Programs, Up: Existing Tests [Contents][Index]
These macros are used to find programs not covered by the “particular”
test macros. If you need to check the behavior of a program as well as
find out whether it is present, you have to write your own test for it
(see Writing Tests). By default, these macros use the environment
variable PATH
. If you need to check for a program that might not
be in the user’s PATH
, you can pass a modified path to use
instead, like this:
AC_PATH_PROG([INETD], [inetd], [/usr/libexec/inetd], [$PATH$PATH_SEPARATOR/usr/libexec$PATH_SEPARATOR]dnl [/usr/sbin$PATH_SEPARATOR/usr/etc$PATH_SEPARATOR/etc])
You are strongly encouraged to declare the variable passed to
AC_CHECK_PROG
etc. as precious. See Setting Output Variables,
AC_ARG_VAR
, for more details.
Check whether program prog-to-check-for exists in path. If
it is found, set variable to value-if-found, otherwise to
value-if-not-found, if given. Always pass over reject (an
absolute file name) even if it is the first found in the search path; in
that case, set variable using the absolute file name of the
prog-to-check-for found that is not reject. If
variable was already set, do nothing. Calls AC_SUBST
for
variable. The result of this test can be overridden by setting the
variable variable or the cache variable
ac_cv_prog_variable
.
Check for each program in the blank-separated list
progs-to-check-for existing in the path. If one is found, set
variable to the name of that program. Otherwise, continue
checking the next program in the list. If none of the programs in the
list are found, set variable to value-if-not-found; if
value-if-not-found is not specified, the value of variable
is not changed. Calls AC_SUBST
for variable. The result of
this test can be overridden by setting the variable variable or the
cache variable ac_cv_prog_variable
.
Like AC_CHECK_PROG
, but first looks for prog-to-check-for
with a prefix of the target type as determined by
AC_CANONICAL_TARGET
, followed by a dash (see Canonicalizing).
If the tool cannot be found with a prefix, and if the build and target
types are equal, then it is also searched for without a prefix.
As noted in Specifying Target Triplets, the
target is rarely specified, because most of the time it is the same
as the host: it is the type of system for which any compiler tool in
the package produces code. What this macro looks for is,
for example, a tool (assembler, linker, etc.) that the
compiler driver (gcc
for the GNU C Compiler)
uses to produce objects, archives or executables.
Like AC_CHECK_PROG
, but first looks for prog-to-check-for
with a prefix of the host type as specified by --host, followed by a
dash. For example, if the user runs
‘configure --build=x86_64-gnu --host=i386-gnu’, then this call:
AC_CHECK_TOOL([RANLIB], [ranlib], [:])
sets RANLIB
to i386-gnu-ranlib if that program exists in
path, or otherwise to ‘ranlib’ if that program exists in
path, or to ‘:’ if neither program exists.
When cross-compiling, this macro will issue a warning if no program prefixed with the host type could be found. For more information, see Specifying Target Triplets.
Like AC_CHECK_TARGET_TOOL
, each of the tools in the list
progs-to-check-for are checked with a prefix of the target type as
determined by AC_CANONICAL_TARGET
, followed by a dash
(see Canonicalizing). If none of the tools can be found with a
prefix, and if the build and target types are equal, then the first one
without a prefix is used. If a tool is found, set variable to
the name of that program. If none of the tools in the list are found,
set variable to value-if-not-found; if value-if-not-found
is not specified, the value of variable is not changed. Calls
AC_SUBST
for variable.
Like AC_CHECK_TOOL
, each of the tools in the list
progs-to-check-for are checked with a prefix of the host type as
determined by AC_CANONICAL_HOST
, followed by a dash
(see Canonicalizing). If none of the tools can be found with a
prefix, then the first one without a prefix is used. If a tool is found,
set variable to the name of that program. If none of the tools in
the list are found, set variable to value-if-not-found; if
value-if-not-found is not specified, the value of variable
is not changed. Calls AC_SUBST
for variable.
When cross-compiling, this macro will issue a warning if no program prefixed with the host type could be found. For more information, see Specifying Target Triplets.
Like AC_CHECK_PROG
, but set variable to the absolute
name of prog-to-check-for if found. The result of this test
can be overridden by setting the variable variable. A positive
result of this test is cached in the ac_cv_path_variable
variable.
Like AC_CHECK_PROGS
, but if any of progs-to-check-for
are found, set variable to the absolute name of the program
found. The result of this test can be overridden by setting the
variable variable. A positive result of this test is cached in
the ac_cv_path_variable
variable.
This macro was introduced in Autoconf 2.62. If variable is not
empty, then set the cache variable ac_cv_path_variable
to
its value. Otherwise, check for each program in the blank-separated
list progs-to-check-for existing in path. For each program
found, execute feature-test with ac_path_variable
set to the absolute name of the candidate program. If no invocation of
feature-test sets the shell variable
ac_cv_path_variable
, then action-if-not-found is
executed. feature-test will be run even when
ac_cv_path_variable
is set, to provide the ability to
choose a better candidate found later in path; to accept the
current setting and bypass all further checks, feature-test can
execute ac_path_variable_found=:
.
Note that this macro has some subtle differences from
AC_CHECK_PROGS
. It is designed to be run inside
AC_CACHE_VAL
, therefore, it should have no side effects. In
particular, variable is not set to the final value of
ac_cv_path_variable
, nor is AC_SUBST
automatically
run. Also, on failure, any action can be performed, whereas
AC_CHECK_PROGS
only performs
variable=value-if-not-found
.
Here is an example, similar to what Autoconf uses in its own configure
script. It will search for an implementation of m4
that
supports the indir
builtin, even if it goes by the name
gm4
or is not the first implementation on PATH
.
AC_CACHE_CHECK([for m4 that supports indir], [ac_cv_path_M4], [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4], [[m4out=`echo 'changequote([,])indir([divnum])' | $ac_path_M4` test "x$m4out" = x0 \ && ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]], [AC_MSG_ERROR([could not find m4 that supports indir])])]) AC_SUBST([M4], [$ac_cv_path_M4])
Like AC_CHECK_TARGET_TOOL
, but set variable to the absolute
name of the program if it is found.
Like AC_CHECK_TOOL
, but set variable to the absolute
name of the program if it is found.
When cross-compiling, this macro will issue a warning if no program prefixed with the host type could be found. For more information, see Specifying Target Triplets.
Next: Files, Previous: Particular Programs, Up: Existing Tests [Contents][Index]