Next: Generic Programs, Up: Alternative Programs
These macros check for particular programs—whether they exist, and in some cases whether they support certain features.
Check for
gawk,mawk,nawk, andawk, in that order, and set output variableAWKto the first one that is found. It triesgawkfirst because that is reported to be the best implementation.
On AIX the default
grepsilently truncates long lines on the input before matching. This macro looks for gnu Grep or else the best availablegreporggrepin the user's$PATH, which accepts the longest input lines possible. Set the output variableGREPto whatever is chosen.
Check whether
$GREP -Eworks, or else search the user's$PATHforegrep, andgegrep, in that order, and set output variableEGREPto the one which accepts the longest input lines.
Check whether
$GREP -Fworks, or else search the user's$PATHforfgrep, andgfgrep, in that order, and set output variableFGREPto the one which accepts the longest input lines.
Set output variable
INSTALLto the path of a BSD-compatibleinstallprogram, if one is found in the currentPATH. Otherwise, setINSTALLto `dir/install-sh -c', checking the directories specified toAC_CONFIG_AUX_DIR(or its default directories) to determine dir (see Output). Also set the variablesINSTALL_PROGRAMandINSTALL_SCRIPTto `${INSTALL}' andINSTALL_DATAto `${INSTALL} -m 644'.This macro screens out various instances of
installknown not to work. It prefers to find a C program rather than a shell script, for speed. Instead of install-sh, it can also use install.sh, but that name is obsolete because some make programs have a rule that creates install from it if there is no Makefile.Autoconf comes with a copy of install-sh that you can use. If you use
AC_PROG_INSTALL, you must include either install-sh or install.sh in your distribution, or configure will produce an error message saying it can't find them—even if the system you're on has a goodinstallprogram. This check is a safety measure to prevent you from accidentally leaving that file out, which would prevent your package from installing on systems that don't have a BSD-compatibleinstallprogram.If you need to use your own installation program because it has features not found in standard
installprograms, there is no reason to useAC_PROG_INSTALL; just put the file name of your program into your Makefile.in files.
If
flexis found, set output variableLEXto `flex' andLEXLIBto -lfl, if that library is in a standard place. Otherwise setLEXto `lex' andLEXLIBto -ll.Define
YYTEXT_POINTERifyytextis a `char *' instead of a `char []'. Also set output variableLEX_OUTPUT_ROOTto the base of the file name that the lexer generates; usually lex.yy, but sometimes something else. These results vary according to whetherlexorflexis being used.You are encouraged to use Flex in your sources, since it is both more pleasant to use than plain Lex and the C source it produces is portable. In order to ensure portability, however, you must either provide a function
yywrapor, if you don't use it (e.g., your scanner has no `#include'-like feature), simply include a `%noyywrap' statement in the scanner's source. Once this done, the scanner is portable (unless you felt free to use nonportable constructs) and does not depend on any library. In this case, and in this case only, it is suggested that you use this Autoconf snippet:AC_PROG_LEX if test "$LEX" != flex; then LEX="$SHELL $missing_dir/missing flex" AC_SUBST(LEX_OUTPUT_ROOT, lex.yy) AC_SUBST(LEXLIB, '') fiThe shell script missing can be found in the Automake distribution.
To ensure backward compatibility, Automake's
AM_PROG_LEXinvokes (indirectly) this macro twice, which will cause an annoying but benign “AC_PROG_LEXinvoked multiple times” warning. Future versions of Automake will fix this issue; meanwhile, just ignore this message.As part of running the test, this macro may delete any file in the configuration directory named lex.yy.c or lexyy.c.
If `ln -s' works on the current file system (the operating system and file system support symbolic links), set the output variable
LN_Sto `ln -s'; otherwise, if `ln' works, setLN_Sto `ln', and otherwise set it to `cp -p'.If you make a link in a directory other than the current directory, its meaning depends on whether `ln' or `ln -s' is used. To safely create links using `$(LN_S)', either find out which form is used and adjust the arguments, or always invoke
lnin the directory where the link is to be created.In other words, it does not work to do:
$(LN_S) foo /x/barInstead, do:
(cd /x && $(LN_S) foo bar)
Set output variable
RANLIBto `ranlib' ifranlibis found, and otherwise to `:' (do nothing).