+2000-07-10 Steven G. Johnson <stevenj@alum.mit.edu>
+
+ Improve --help documentation of important environment variables.
+
+ * acgeneral.m4 (_AC_INIT_HELP): Direct reader to descriptions
+ of useful variables at the end of the --help.
+ (AC_ARG_VAR): Emphasize use of environment variables to override
+ and/or help the configure script. Ensure that a given variable
+ is only documented once in the --help.
+ (AC_CHECK_LIB): Call AC_ARG_VAR to document and register the
+ LDFLAGS variable, and...
+ (AC_CHECK_HEADER): do the same for the CPPFLAGS variable.
+ * aclang.m4 (AC_PROG_CC): Call AC_ARG_VAR to document and register
+ the CC and CFLAGS variables, and do the same for...
+ (AC_PROG_CXX): CXX and CXXFLAGS, and...
+ (AC_PROG_F77): F77 and FFLAGS.
+
2000-07-10 Akim Demaille <akim@epita.fr>
* Makefile.am (wget-update): New target.
Usage: $[0] [[OPTION]]... [[VAR=VALUE]]...
[To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE.
+VAR=VALUE. See below for descriptions of useful variables.
Defaults for the options are specified in brackets.
# AC_ARG_VAR(VARNAME, DOCUMENTATION)
# ----------------------------------
# Register VARNAME as a variable configure should remember, and
-# document it in `configure --help'.
+# document it in `configure --help' (but only once).
AC_DEFUN([AC_ARG_VAR],
[AC_DIVERT_PUSH([HELP_VAR])dnl
AC_EXPAND_ONCE([
-Some influent environment variables:
+Some relevant environment variables, which you can use to override the
+choices made by the configure script or to help it to find libraries and
+programs with nonstandard names/locations:
])[]dnl
-AC_HELP_STRING([$1], [$2], [ ])
+ifdef([AC_ARG_VAR_$1],,[AC_HELP_STRING([$1], [$2], [ ])
+define([AC_ARG_VAR_$1])])dnl
AC_DIVERT_POP()dnl
dnl Register if set and not yet registered.
dnl If there are envvars given as arguments, they are already set,
AC_DEFUN([AC_CHECK_LIB],
[AH_CHECK_LIB([$1])dnl
AC_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])dnl
+AC_ARG_VAR([LDFLAGS], [linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>])
AC_CACHE_CHECK([for $2 in -l$1], ac_Lib,
[ac_check_lib_save_LIBS=$LIBS
LIBS="-l$1 $5 $LIBS"
# ----------------------------------------------------------------------
AC_DEFUN([AC_CHECK_HEADER],
[AC_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
+AC_ARG_VAR([CPPFLAGS], [C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>])
AC_CACHE_CHECK([for $1], ac_Header,
[AC_TRY_CPP([#include <$1>
],
AC_DEFUN([AC_PROG_CC],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(C)
-AC_ARG_VAR([CFLAGS], [Extra flags for the C compiler])
+AC_ARG_VAR([CC], [C compiler command])
+AC_ARG_VAR([CFLAGS], [C compiler flags])
ifval([$1],
[AC_CHECK_TOOLS(CC, [$1])],
[
AC_DEFUN([AC_PROG_CXX],
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_LANG_PUSH(C++)
+AC_ARG_VAR([CXX], [C++ compiler command])
+AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
AC_CHECK_TOOLS(CXX,
[$CCC m4_default([$1],
[g++ c++ gpp aCC CC cxx cc++ cl KCC RCC xlC_r xlC])],
AC_DEFUN([AC_PROG_F77],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(Fortran 77)
+AC_ARG_VAR([F77], [Fortran 77 compiler command])
+AC_ARG_VAR([FFLAGS], [Fortran 77 compiler flags])
AC_CHECK_TOOLS(F77,
[m4_default([$1],
[g77 f77 xlf cf77 pgf77 fl32 fort77 f90 xlf90 f95 lf95 fc])])
AC_DEFUN([AC_PROG_CC],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(C)
-AC_ARG_VAR([CFLAGS], [Extra flags for the C compiler])
+AC_ARG_VAR([CC], [C compiler command])
+AC_ARG_VAR([CFLAGS], [C compiler flags])
ifval([$1],
[AC_CHECK_TOOLS(CC, [$1])],
[
AC_DEFUN([AC_PROG_CXX],
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_LANG_PUSH(C++)
+AC_ARG_VAR([CXX], [C++ compiler command])
+AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
AC_CHECK_TOOLS(CXX,
[$CCC m4_default([$1],
[g++ c++ gpp aCC CC cxx cc++ cl KCC RCC xlC_r xlC])],
AC_DEFUN([AC_PROG_F77],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(Fortran 77)
+AC_ARG_VAR([F77], [Fortran 77 compiler command])
+AC_ARG_VAR([FFLAGS], [Fortran 77 compiler flags])
AC_CHECK_TOOLS(F77,
[m4_default([$1],
[g77 f77 xlf cf77 pgf77 fl32 fort77 f90 xlf90 f95 lf95 fc])])
AC_DEFUN([AC_PROG_CC],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(C)
-AC_ARG_VAR([CFLAGS], [Extra flags for the C compiler])
+AC_ARG_VAR([CC], [C compiler command])
+AC_ARG_VAR([CFLAGS], [C compiler flags])
ifval([$1],
[AC_CHECK_TOOLS(CC, [$1])],
[
AC_DEFUN([AC_PROG_CXX],
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_LANG_PUSH(C++)
+AC_ARG_VAR([CXX], [C++ compiler command])
+AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
AC_CHECK_TOOLS(CXX,
[$CCC m4_default([$1],
[g++ c++ gpp aCC CC cxx cc++ cl KCC RCC xlC_r xlC])],
AC_DEFUN([AC_PROG_F77],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(Fortran 77)
+AC_ARG_VAR([F77], [Fortran 77 compiler command])
+AC_ARG_VAR([FFLAGS], [Fortran 77 compiler flags])
AC_CHECK_TOOLS(F77,
[m4_default([$1],
[g77 f77 xlf cf77 pgf77 fl32 fort77 f90 xlf90 f95 lf95 fc])])
Usage: $[0] [[OPTION]]... [[VAR=VALUE]]...
[To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE.
+VAR=VALUE. See below for descriptions of useful variables.
Defaults for the options are specified in brackets.
# AC_ARG_VAR(VARNAME, DOCUMENTATION)
# ----------------------------------
# Register VARNAME as a variable configure should remember, and
-# document it in `configure --help'.
+# document it in `configure --help' (but only once).
AC_DEFUN([AC_ARG_VAR],
[AC_DIVERT_PUSH([HELP_VAR])dnl
AC_EXPAND_ONCE([
-Some influent environment variables:
+Some relevant environment variables, which you can use to override the
+choices made by the configure script or to help it to find libraries and
+programs with nonstandard names/locations:
])[]dnl
-AC_HELP_STRING([$1], [$2], [ ])
+ifdef([AC_ARG_VAR_$1],,[AC_HELP_STRING([$1], [$2], [ ])
+define([AC_ARG_VAR_$1])])dnl
AC_DIVERT_POP()dnl
dnl Register if set and not yet registered.
dnl If there are envvars given as arguments, they are already set,
AC_DEFUN([AC_CHECK_LIB],
[AH_CHECK_LIB([$1])dnl
AC_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])dnl
+AC_ARG_VAR([LDFLAGS], [linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>])
AC_CACHE_CHECK([for $2 in -l$1], ac_Lib,
[ac_check_lib_save_LIBS=$LIBS
LIBS="-l$1 $5 $LIBS"
# ----------------------------------------------------------------------
AC_DEFUN([AC_CHECK_HEADER],
[AC_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
+AC_ARG_VAR([CPPFLAGS], [C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>])
AC_CACHE_CHECK([for $1], ac_Header,
[AC_TRY_CPP([#include <$1>
],
AC_DEFUN([AC_PROG_CC],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(C)
-AC_ARG_VAR([CFLAGS], [Extra flags for the C compiler])
+AC_ARG_VAR([CC], [C compiler command])
+AC_ARG_VAR([CFLAGS], [C compiler flags])
ifval([$1],
[AC_CHECK_TOOLS(CC, [$1])],
[
AC_DEFUN([AC_PROG_CXX],
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_LANG_PUSH(C++)
+AC_ARG_VAR([CXX], [C++ compiler command])
+AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])
AC_CHECK_TOOLS(CXX,
[$CCC m4_default([$1],
[g++ c++ gpp aCC CC cxx cc++ cl KCC RCC xlC_r xlC])],
AC_DEFUN([AC_PROG_F77],
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_LANG_PUSH(Fortran 77)
+AC_ARG_VAR([F77], [Fortran 77 compiler command])
+AC_ARG_VAR([FFLAGS], [Fortran 77 compiler flags])
AC_CHECK_TOOLS(F77,
[m4_default([$1],
[g77 f77 xlf cf77 pgf77 fl32 fort77 f90 xlf90 f95 lf95 fc])])