autoconf: Preset Output Variables

1 
1 4.8.1 Preset Output Variables
1 -----------------------------
1 
1 Some output variables are preset by the Autoconf macros.  Some of the
1 Autoconf macros set additional output variables, which are mentioned in
1 the descriptions for those macros.  ⇒Output Variable Index, for a
11 complete list of output variables.  ⇒Installation Directory
 Variables, for the list of the preset ones related to installation
1 directories.  Below are listed the other preset ones, many of which are
1 precious variables (⇒Setting Output Variables, `AC_ARG_VAR').
1 
1    The preset variables which are available during `config.status'
1 (⇒Configuration Actions) may also be used during `configure'
1 tests.  For example, it is permissible to reference `$srcdir' when
1 constructing a list of directories to pass via option `-I' during a
1 compiler feature check.  When used in this manner, coupled with the
1 fact that `configure' is always run from the top build directory, it is
1 sufficient to use just `$srcdir' instead of `$top_srcdir'.
1 
1  -- Variable: CFLAGS
1      Debugging and optimization options for the C compiler.  If it is
1      not set in the environment when `configure' runs, the default
1      value is set when you call `AC_PROG_CC' (or empty if you don't).
1      `configure' uses this variable when compiling or linking programs
1      to test for C features.
1 
1      If a compiler option affects only the behavior of the preprocessor
1      (e.g., `-DNAME'), it should be put into `CPPFLAGS' instead.  If it
1      affects only the linker (e.g., `-LDIRECTORY'), it should be put
1      into `LDFLAGS' instead.  If it affects only the compiler proper,
1      `CFLAGS' is the natural home for it.  If an option affects
1      multiple phases of the compiler, though, matters get tricky.  One
1      approach to put such options directly into `CC', e.g., `CC='gcc
1      -m64''.  Another is to put them into both `CPPFLAGS' and
1      `LDFLAGS', but not into `CFLAGS'.
1 
1      However, remember that some `Makefile' variables are reserved by
1      the GNU Coding Standards for the use of the "user"--the person
1      building the package.  For instance, `CFLAGS' is one such variable.
1 
1      Sometimes package developers are tempted to set user variables
1      such as `CFLAGS' because it appears to make their job easier.
1      However, the package itself should never set a user variable,
1      particularly not to include switches that are required for proper
1      compilation of the package.  Since these variables are documented
1      as being for the package builder, that person rightfully expects
1      to be able to override any of these variables at build time.  If
1      the package developer needs to add switches without interfering
1      with the user, the proper way to do that is to introduce an
1      additional variable.  Automake makes this easy by introducing
11      `AM_CFLAGS' (⇒Flag Variables Ordering (automake)Flag
      Variables Ordering.), but the concept is the same even if Automake
1      is not used.
1 
1  -- Variable: configure_input
1      A comment saying that the file was generated automatically by
1      `configure' and giving the name of the input file.  `AC_OUTPUT'
1      adds a comment line containing this variable to the top of every
1      makefile it creates.  For other files, you should reference this
1      variable in a comment at the top of each input file.  For example,
1      an input shell script should begin like this:
1 
1           #!/bin/sh
1           # @configure_input@
1 
1      The presence of that line also reminds people editing the file
1      that it needs to be processed by `configure' in order to be used.
1 
1  -- Variable: CPPFLAGS
1      Preprocessor options for the C, C++, Objective C, and Objective C++
1      preprocessors and compilers.  If it is not set in the environment
1      when `configure' runs, the default value is empty.  `configure'
1      uses this variable when preprocessing or compiling programs to
1      test for C, C++, Objective C, and Objective C++ features.
1 
1      This variable's contents should contain options like `-I', `-D',
1      and `-U' that affect only the behavior of the preprocessor.
1      Please see the explanation of `CFLAGS' for what you can do if an
1      option affects other phases of the compiler as well.
1 
1      Currently, `configure' always links as part of a single invocation
1      of the compiler that also preprocesses and compiles, so it uses
1      this variable also when linking programs.  However, it is unwise to
1      depend on this behavior because the GNU Coding Standards do not
1      require it and many packages do not use `CPPFLAGS' when linking
1      programs.
1 
1      ⇒Special Chars in Variables, for limitations that `CPPFLAGS'
1      might run into.
1 
1  -- Variable: CXXFLAGS
1      Debugging and optimization options for the C++ compiler.  It acts
1      like `CFLAGS', but for C++ instead of C.
1 
1  -- Variable: DEFS
1      `-D' options to pass to the C compiler.  If `AC_CONFIG_HEADERS' is
1      called, `configure' replaces `@DEFS@' with `-DHAVE_CONFIG_H'
1      instead (⇒Configuration Headers).  This variable is not
1      defined while `configure' is performing its tests, only when
1      creating the output files.  ⇒Setting Output Variables, for
1      how to check the results of previous tests.
1 
1  -- Variable: ECHO_C
1  -- Variable: ECHO_N
1  -- Variable: ECHO_T
1      How does one suppress the trailing newline from `echo' for
1      question-answer message pairs?  These variables provide a way:
1 
1           echo $ECHO_N "And the winner is... $ECHO_C"
1           sleep 100000000000
1           echo "${ECHO_T}dead."
1 
1      Some old and uncommon `echo' implementations offer no means to
1      achieve this, in which case `ECHO_T' is set to tab.  You might not
1      want to use it.
1 
1  -- Variable: ERLCFLAGS
1      Debugging and optimization options for the Erlang compiler.  If it
1      is not set in the environment when `configure' runs, the default
1      value is empty.  `configure' uses this variable when compiling
1      programs to test for Erlang features.
1 
1  -- Variable: FCFLAGS
1      Debugging and optimization options for the Fortran compiler.  If it
1      is not set in the environment when `configure' runs, the default
1      value is set when you call `AC_PROG_FC' (or empty if you don't).
1      `configure' uses this variable when compiling or linking programs
1      to test for Fortran features.
1 
1  -- Variable: FFLAGS
1      Debugging and optimization options for the Fortran 77 compiler.
1      If it is not set in the environment when `configure' runs, the
1      default value is set when you call `AC_PROG_F77' (or empty if you
1      don't).  `configure' uses this variable when compiling or linking
1      programs to test for Fortran 77 features.
1 
1  -- Variable: LDFLAGS
1      Options for the linker.  If it is not set in the environment when
1      `configure' runs, the default value is empty.  `configure' uses
1      this variable when linking programs to test for C, C++, Objective
1      C, Objective C++, Fortran, and Go features.
1 
1      This variable's contents should contain options like `-s' and `-L'
1      that affect only the behavior of the linker.  Please see the
1      explanation of `CFLAGS' for what you can do if an option also
1      affects other phases of the compiler.
1 
1      Don't use this variable to pass library names (`-l') to the
1      linker; use `LIBS' instead.
1 
1  -- Variable: LIBS
1      `-l' options to pass to the linker.  The default value is empty,
1      but some Autoconf macros may prepend extra libraries to this
1      variable if those libraries are found and provide necessary
1      functions, see ⇒Libraries.  `configure' uses this variable
1      when linking programs to test for C, C++, Objective C, Objective
1      C++, Fortran, and Go features.
1 
1  -- Variable: OBJCFLAGS
1      Debugging and optimization options for the Objective C compiler.
1      It acts like `CFLAGS', but for Objective C instead of C.
1 
1  -- Variable: OBJCXXFLAGS
1      Debugging and optimization options for the Objective C++ compiler.
1      It acts like `CXXFLAGS', but for Objective C++ instead of C++.
1 
1  -- Variable: GOFLAGS
1      Debugging and optimization options for the Go compiler.  It acts
1      like `CFLAGS', but for Go instead of C.
1 
1  -- Variable: builddir
1      Rigorously equal to `.'.  Added for symmetry only.
1 
1  -- Variable: abs_builddir
1      Absolute name of `builddir'.
1 
1  -- Variable: top_builddir
1      The relative name of the top level of the current build tree.  In
1      the top-level directory, this is the same as `builddir'.
1 
1  -- Variable: top_build_prefix
1      The relative name of the top level of the current build tree with
1      final slash if nonempty.  This is the same as `top_builddir',
1      except that it contains zero or more runs of `../', so it should
1      not be appended with a slash for concatenation.  This helps for
1      `make' implementations that otherwise do not treat `./file' and
1      `file' as equal in the toplevel build directory.
1 
1  -- Variable: abs_top_builddir
1      Absolute name of `top_builddir'.
1 
1  -- Variable: srcdir
1      The name of the directory that contains the source code for that
1      makefile.
1 
1  -- Variable: abs_srcdir
1      Absolute name of `srcdir'.
1 
1  -- Variable: top_srcdir
1      The name of the top-level source code directory for the package.
1      In the top-level directory, this is the same as `srcdir'.
1 
1  -- Variable: abs_top_srcdir
1      Absolute name of `top_srcdir'.
1