Previous: Particular Programs, Up: Alternative Programs


5.2.2 Generic Program and File Checks

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:/usr/libexec:/usr/sbin:/usr/etc:/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.

— Macro: AC_CHECK_PROG (variable, prog-to-check-for, value-if-found, [value-if-not-found], [path], [reject])

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.

— Macro: AC_CHECK_PROGS (variable, progs-to-check-for, [value-if-not-found], [path])

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.

— Macro: AC_CHECK_TARGET_TOOL (variable, prog-to-check-for, [value-if-not-found], [path])

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 the system type, 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.

— Macro: AC_CHECK_TOOL (variable, prog-to-check-for, [value-if-not-found], [path])

Like AC_CHECK_PROG, but first looks for prog-to-check-for with a prefix of the host type as determined by AC_CANONICAL_HOST, followed by a dash (see Canonicalizing). For example, if the user runs `configure --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.

In the future, when cross-compiling this macro will only accept program names that are prefixed with the host type. For more information, see Specifying the system type.

— Macro: AC_CHECK_TARGET_TOOLS (variable, progs-to-check-for, [value-if-not-found], [path])

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.

— Macro: AC_CHECK_TOOLS (variable, progs-to-check-for, [value-if-not-found], [path])

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.

In the future, when cross-compiling this macro will not accept program names that are not prefixed with the host type.

— Macro: AC_PATH_PROG (variable, prog-to-check-for, [value-if-not-found], [path])

Like AC_CHECK_PROG, but set variable to the absolute name of prog-to-check-for if found.

— Macro: AC_PATH_PROGS (variable, progs-to-check-for, [value-if-not-found], [path])

Like AC_CHECK_PROGS, but if any of progs-to-check-for are found, set variable to the absolute name of the program found.

— Macro: AC_PATH_TARGET_TOOL (variable, prog-to-check-for, [value-if-not-found], [path])

Like AC_CHECK_TARGET_TOOL, but set variable to the absolute name of the program if it is found.

— Macro: AC_PATH_TOOL (variable, prog-to-check-for, [value-if-not-found], [path])

Like AC_CHECK_TOOL, but set variable to the absolute name of the program if it is found.

In the future, when cross-compiling this macro will not accept program names that are not prefixed with the host type.