autoconf: Particular Programs

1 
1 5.2.1 Particular Program Checks
1 -------------------------------
1 
1 These macros check for particular programs--whether they exist, and in
1 some cases whether they support certain features.
1 
1  -- Macro: AC_PROG_AWK
1      Check for `gawk', `mawk', `nawk', and `awk', in that order, and
1      set output variable `AWK' to the first one that is found.  It
1      tries `gawk' first because that is reported to be the best
1      implementation.  The result can be overridden by setting the
1      variable `AWK' or the cache variable `ac_cv_prog_AWK'.
1 
1      Using this macro is sufficient to avoid the pitfalls of traditional
1      `awk' (⇒Limitations of Usual Tools awk.).
1 
1  -- Macro: AC_PROG_GREP
1      Look for the best available `grep' or `ggrep' that accepts the
1      longest input lines possible, and that supports multiple `-e'
1      options.  Set the output variable `GREP' to whatever is chosen.
1      ⇒Limitations of Usual Tools grep, for more information about
1      portability problems with the `grep' command family.  The result
1      can be overridden by setting the `GREP' variable and is cached in
1      the `ac_cv_path_GREP' variable.
1 
1  -- Macro: AC_PROG_EGREP
1      Check whether `$GREP -E' works, or else look for the best available
1      `egrep' or `gegrep' that accepts the longest input lines possible.
1      Set the output variable `EGREP' to whatever is chosen.  The result
1      can be overridden by setting the `EGREP' variable and is cached in
1      the `ac_cv_path_EGREP' variable.
1 
1  -- Macro: AC_PROG_FGREP
1      Check whether `$GREP -F' works, or else look for the best available
1      `fgrep' or `gfgrep' that accepts the longest input lines possible.
1      Set the output variable `FGREP' to whatever is chosen.  The result
1      can be overridden by setting the `FGREP' variable and is cached in
1      the `ac_cv_path_FGREP' variable.
1 
1  -- Macro: AC_PROG_INSTALL
1      Set output variable `INSTALL' to the name of a BSD-compatible
1      `install' program, if one is found in the current `PATH'.
1      Otherwise, set `INSTALL' to `DIR/install-sh -c', checking the
1      directories specified to `AC_CONFIG_AUX_DIR' (or its default
1      directories) to determine DIR (⇒Output).  Also set the
1      variables `INSTALL_PROGRAM' and `INSTALL_SCRIPT' to `${INSTALL}'
1      and `INSTALL_DATA' to `${INSTALL} -m 644'.
1 
1      `@INSTALL@' is special, as its value may vary for different
1      configuration files.
1 
1      This macro screens out various instances of `install' known not to
1      work.  It prefers to find a C program rather than a shell script,
1      for speed.  Instead of `install-sh', it can also use `install.sh',
1      but that name is obsolete because some `make' programs have a rule
1      that creates `install' from it if there is no makefile.  Further,
1      this macro requires `install' to be able to install multiple files
1      into a target directory in a single invocation.
1 
1      Autoconf comes with a copy of `install-sh' that you can use.  If
1      you use `AC_PROG_INSTALL', you must include either `install-sh' or
1      `install.sh' in your distribution; otherwise `configure' produces
1      an error message saying it can't find them--even if the system
1      you're on has a good `install' program.  This check is a safety
1      measure to prevent you from accidentally leaving that file out,
1      which would prevent your package from installing on systems that
1      don't have a BSD-compatible `install' program.
1 
1      If you need to use your own installation program because it has
1      features not found in standard `install' programs, there is no
1      reason to use `AC_PROG_INSTALL'; just put the file name of your
1      program into your `Makefile.in' files.
1 
1      The result of the test can be overridden by setting the variable
1      `INSTALL' or the cache variable `ac_cv_path_install'.
1 
1  -- Macro: AC_PROG_MKDIR_P
1      Set output variable `MKDIR_P' to a program that ensures that for
1      each argument, a directory named by this argument exists, creating
1      it and its parent directories if needed, and without race
1      conditions when two instances of the program attempt to make the
1      same directory at nearly the same time.
1 
1      This macro uses the `mkdir -p' command if possible.  Otherwise, it
1      falls back on invoking `install-sh' with the `-d' option, so your
1      package should contain `install-sh' as described under
1      `AC_PROG_INSTALL'.  An `install-sh' file that predates Autoconf
1      2.60 or Automake 1.10 is vulnerable to race conditions, so if you
1      want to support parallel installs from different packages into the
1      same directory you need to make sure you have an up-to-date
1      `install-sh'.  In particular, be careful about using `autoreconf
1      -if' if your Automake predates Automake 1.10.
1 
11      This macro is related to the `AS_MKDIR_P' macro (⇒Programming
      in M4sh), but it sets an output variable intended for use in
1      other files, whereas `AS_MKDIR_P' is intended for use in scripts
1      like `configure'.  Also, `AS_MKDIR_P' does not accept options, but
1      `MKDIR_P' supports the `-m' option, e.g., a makefile might invoke
1      `$(MKDIR_P) -m 0 dir' to create an inaccessible directory, and
1      conversely a makefile should use `$(MKDIR_P) -- $(FOO)' if FOO
1      might yield a value that begins with `-'.  Finally, `AS_MKDIR_P'
1      does not check for race condition vulnerability, whereas
1      `AC_PROG_MKDIR_P' does.
1 
1      `@MKDIR_P@' is special, as its value may vary for different
1      configuration files.
1 
1      The result of the test can be overridden by setting the variable
1      `MKDIR_P' or the cache variable `ac_cv_path_mkdir'.
1 
1  -- Macro: AC_PROG_LEX
1      If `flex' is found, set output variable `LEX' to `flex' and
1      `LEXLIB' to `-lfl', if that library is in a standard place.
1      Otherwise set `LEX' to `lex' and `LEXLIB' to `-ll', if found.  If
1      neither variant is available, set `LEX' to `:'; for packages that
1      ship the generated `file.yy.c' alongside the source `file.l', this
1      default allows users without a lexer generator to still build the
1      package even if the timestamp for `file.l' is inadvertently
1      changed.
1 
1      Define `YYTEXT_POINTER' if `yytext' defaults to `char *' instead
1      of to `char []'.  Also set output variable `LEX_OUTPUT_ROOT' to
1      the base of the file name that the lexer generates; usually
1      `lex.yy', but sometimes something else.  These results vary
1      according to whether `lex' or `flex' is being used.
1 
1      You are encouraged to use Flex in your sources, since it is both
1      more pleasant to use than plain Lex and the C source it produces
1      is portable.  In order to ensure portability, however, you must
1      either provide a function `yywrap' or, if you don't use it (e.g.,
1      your scanner has no `#include'-like feature), simply include a
1      `%noyywrap' statement in the scanner's source.  Once this done,
1      the scanner is portable (unless _you_ felt free to use nonportable
1      constructs) and does not depend on any library.  In this case, and
1      in this case only, it is suggested that you use this Autoconf
1      snippet:
1 
1           AC_PROG_LEX
1           if test "x$LEX" != xflex; then
1             LEX="$SHELL $missing_dir/missing flex"
1             AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
1             AC_SUBST([LEXLIB], [''])
1           fi
1 
1      The shell script `missing' can be found in the Automake
1      distribution.
1 
1      Remember that the user may have supplied an alternate location in
1      `LEX', so if Flex is required, it is better to check that the user
1      provided something sufficient by parsing the output of `$LEX
1      --version' than by simply relying on `test "x$LEX" = xflex'.
1 
1      To ensure backward compatibility, Automake's `AM_PROG_LEX' invokes
1      (indirectly) this macro twice, which causes an annoying but benign
1      "`AC_PROG_LEX' invoked multiple times" warning.  Future versions
1      of Automake will fix this issue; meanwhile, just ignore this
1      message.
1 
1      As part of running the test, this macro may delete any file in the
1      configuration directory named `lex.yy.c' or `lexyy.c'.
1 
1      The result of this test can be influenced by setting the variable
1      `LEX' or the cache variable `ac_cv_prog_LEX'.
1 
1  -- Macro: AC_PROG_LN_S
1      If `ln -s' works on the current file system (the operating system
1      and file system support symbolic links), set the output variable
1      `LN_S' to `ln -s'; otherwise, if `ln' works, set `LN_S' to `ln',
1      and otherwise set it to `cp -pR'.
1 
1      If you make a link in a directory other than the current
1      directory, its meaning depends on whether `ln' or `ln -s' is used.
1      To safely create links using `$(LN_S)', either find out which form
1      is used and adjust the arguments, or always invoke `ln' in the
1      directory where the link is to be created.
1 
1      In other words, it does not work to do:
1           $(LN_S) foo /x/bar
1 
1      Instead, do:
1 
1           (cd /x && $(LN_S) foo bar)
1 
1  -- Macro: AC_PROG_RANLIB
1      Set output variable `RANLIB' to `ranlib' if `ranlib' is found, and
1      otherwise to `:' (do nothing).
1 
1  -- Macro: AC_PROG_SED
1      Set output variable `SED' to a Sed implementation that conforms to
1      Posix and does not have arbitrary length limits.  Report an error
11      if no acceptable Sed is found.  ⇒Limitations of Usual Tools
      sed, for more information about portability problems with Sed.
1 
1      The result of this test can be overridden by setting the `SED'
1      variable and is cached in the `ac_cv_path_SED' variable.
1 
1  -- Macro: AC_PROG_YACC
1      If `bison' is found, set output variable `YACC' to `bison -y'.
1      Otherwise, if `byacc' is found, set `YACC' to `byacc'.  Otherwise
1      set `YACC' to `yacc'.  The result of this test can be influenced
1      by setting the variable `YACC' or the cache variable
1      `ac_cv_prog_YACC'.
1