]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
add #line, fix AC_SUBST_FILE
authorDavid MacKenzie <djm@djmnet.org>
Thu, 25 Aug 1994 03:45:07 +0000 (03:45 +0000)
committerDavid MacKenzie <djm@djmnet.org>
Thu, 25 Aug 1994 03:45:07 +0000 (03:45 +0000)
13 files changed:
NEWS
TODO
acgeneral.m4
acspecific.m4
autoconf.in
autoconf.sh
autoconf.texi
bin/autoconf.in
doc/autoconf.texi
doc/install.texi
install.texi
lib/autoconf/general.m4
lib/autoconf/specific.m4

diff --git a/NEWS b/NEWS
index f987e5c364f90d75526fd7aa06f7fb42c8862c38..ed02b191c6bb3e8068fe0026ac03229e924bafd4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,8 @@ Major changes in release 2.0:
 * AC_MSG_CHECKING and AC_MSG_RESULT to print test results, on a single line,
   whether or not the test succeeds.  They obsolete AC_CHECKING and AC_VERBOSE.
 * AC_SUBST_FILE, to insert one file into another.
+* AC_SUBST_DEFAULT, to copy a variable from the configure environment into
+  Makefiles with a default fallback value.
 
 ** Changed macros:
 * Many macros renamed, but old names are accepted for backward compatibility.
@@ -35,6 +37,8 @@ Major changes in release 2.0:
 * AC_OUTPUT allows the optional environment variable CONFIG_STATUS to
   override the file name "config.status".
 * AC_OUTPUT and AC_CONFIG_HEADER allow you to override the input-file names.
+* AC_OUTPUT automatically substitutes the values of CFLAGS, CXXFLAGS, and
+  LDFLAGS from the environment, with default values.
 * AC_PROG_INSTALL looks for install.sh in the directory specified by
   AC_CONFIG_AUXDIR, or srcdir or srcdir/.. or srcdir/../.. by default.
 * AC_DEFINE and AC_DEFINE_UNQUOTED are more robust and smaller.
diff --git a/TODO b/TODO
index 3c0ccb9df7686b24a8bd1e7feddc646657495005..e3abf95ca06c700ea6a07f9e4a727c3c8b4537c2 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,7 +6,7 @@ Required for 2.0:
 
 ------------------------------------------------------------------------------
 
-* Add AC_{INCLUDE,LIB}_DIR?  (Noah Friedman's suggestion.)
+* Try it on Emacs configure.in, and adapt that to use the new features.
 
 ------------------------------------------------------------------------------
 
index 29dc5c45aa777b04967b98a84e0d256732ca6ea0..462383f80851761cff2d1c374dd428a4777f58b4 100644 (file)
@@ -363,14 +363,14 @@ fi
 ])dnl
 dnl
 dnl Try to have only one #! line, so the script doesn't look funny.
-dnl AC_BINSH()
-AC_DEFUN(AC_BINSH,
+dnl AC_INIT_BINSH()
+AC_DEFUN(AC_INIT_BINSH,
 [#!/bin/sh
 ])dnl
 dnl
 dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR)
 AC_DEFUN(AC_INIT,
-[AC_REQUIRE([AC_BINSH])dnl
+[AC_REQUIRE([AC_INIT_BINSH])dnl
 AC_INIT_NOTICE
 AC_INIT_PARSE_ARGS
 AC_INIT_PREPARE($1)])dnl
@@ -479,6 +479,9 @@ AC_SUBST(LIBS)dnl
 AC_SUBST(prefix)dnl
 AC_SUBST(exec_prefix)dnl
 AC_SUBST(DEFS)dnl
+AC_SUBST_DEFAULT(CFLAGS, -g)dnl
+AC_SUBST_DEFAULT(CXXFLAGS, -g)dnl
+AC_SUBST_DEFAULT(LDFLAGS, )dnl
 ])dnl
 dnl
 dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
@@ -539,7 +542,7 @@ AC_DEFUN(AC_CONFIG_HEADER,
 dnl
 dnl AC_REVISION(REVISION-INFO)
 AC_DEFUN(AC_REVISION,
-[AC_REQUIRE([AC_BINSH])dnl
+[AC_REQUIRE([AC_INIT_BINSH])dnl
 [# From configure.in] translit([$1], $")])dnl
 dnl
 dnl Subroutines of AC_PREREQ.
@@ -866,18 +869,8 @@ s%@$1@%[$]$1%g
 divert(AC_DIVERSION_NORMAL)dnl
 ])])dnl
 dnl
-dnl AC_SUBST_FILE(VARIABLE, FILE)
+dnl AC_SUBST_FILE(VARIABLE)
 AC_DEFUN(AC_SUBST_FILE,
-[if test -f $2; then
-  echo using $2 for $1)
-  AC_INSERT_FILE($1, $2)
-elif test -f ${srcdir}/$2; then
-  echo using ${srcdir}/$2 for $1)
-  AC_INSERT_FILE($1, ${srcdir}/$2)
-fi
-])dnl
-dnl Internal subroutine of AC_SUBST_FILE.
-AC_DEFUN(AC_INSERT_FILE,
 [ifdef([AC_SUBST_$1], ,
 [define([AC_SUBST_$1], )dnl
 divert(AC_DIVERSION_SED)dnl
@@ -886,6 +879,12 @@ s%@$1@%%g
 divert(AC_DIVERSION_NORMAL)dnl
 ])])dnl
 dnl
+dnl AC_SUBST_DEFAULT(VARIABLE [, DEFAULT-VALUE])
+AC_DEFUN(AC_SUBST_DEFAULT,
+[$1=${$1-"$2"}
+AC_SUBST($1)dnl
+])dnl
+dnl
 dnl
 dnl ### Printing messages
 dnl
@@ -1120,6 +1119,7 @@ dnl              ACTION-IF-NOT-FOUND])
 AC_DEFUN(AC_EGREP_CPP,
 [AC_REQUIRE_CPP()dnl
 cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
 #include "confdefs.h"
 [$2]
 EOF
@@ -1150,6 +1150,7 @@ dnl             ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
 AC_DEFUN(AC_TRY_LINK,
 [dnl We use return because because C++ requires a prototype for exit.
 cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
 #include "confdefs.h"
 [$1]
 int main() { return 0; }
@@ -1179,6 +1180,7 @@ $4
 ])
 else
 cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
 #include "confdefs.h"
 [$1]
 EOF
@@ -1196,6 +1198,7 @@ dnl AC_TRY_CPP(INCLUDES, ACTION-IF-TRUE [, ACTION-IF-FALSE])
 AC_DEFUN(AC_TRY_CPP,
 [AC_REQUIRE_CPP()dnl
 cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
 #include "confdefs.h"
 [$1]
 EOF
@@ -1219,12 +1222,12 @@ dnl
 dnl AC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
 AC_DEFUN(AC_CHECK_HEADER,
 [dnl Do the transliteration at runtime so arg 1 can be a shell variable.
-ac_var=`echo "$1" | tr './' '__'`
+ac_safe=`echo "$1" | tr './' '__'`
 AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(ac_cv_header_$ac_var,
-[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_var=yes",
-  eval "ac_cv_header_$ac_var=no")])dnl
-if eval "test \"`echo '$ac_cv_header_'$ac_var`\" = yes"; then
+AC_CACHE_VAL(ac_cv_header_$ac_safe,
+[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
+  eval "ac_cv_header_$ac_safe=no")])dnl
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   AC_MSG_RESULT(yes)
   ifelse([$2], , :, [$2])
 else
@@ -1393,6 +1396,7 @@ do
 done
 
 ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
 
 ifdef([AC_LIST_HEADERS],
 [trap 'rm -fr $1 AC_LIST_HEADERS conftest*; exit 1' 1 2 15],
index 7b1b0c76fad6d5ce20afc09e491e773d756bacbe..8a35e9930322b1e1a7c34cf1257714bed7e29ff1 100644 (file)
@@ -309,8 +309,8 @@ AC_CACHE_VAL(ac_cv_path_install,
   test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"])dnl
   INSTALL="$ac_cv_path_install"
 fi
-dnl We do this instead of AC_SUBST, to get relative paths right.
-ac_given_INSTALL=$INSTALL
+dnl We do special magic for INSTALL instead of AC_SUBST, to get
+dnl relative paths right. 
 AC_MSG_RESULT($INSTALL)
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -407,21 +407,20 @@ fi
 ])dnl
 dnl
 AC_DEFUN(AC_HEADER_MAJOR,
-[AC_MSG_CHECKING([for major, minor and makedev header])
-AC_CACHE_VAL(ac_cv_header_major,
-[AC_TRY_LINK([#include <sys/types.h>],
-[return makedev(0, 0);], ac_cv_header_major=sys/types.h, ac_cv_header_major=no)
-if test $ac_cv_header_major = no; then
-AC_CHECK_HEADER(sys/mkdev.h, ac_cv_header_major=sys/mkdev.h)
-fi
-if test $ac_cv_header_major = no; then
-AC_CHECK_HEADER(sys/sysmacros.h, ac_cv_header_major=sys/sysmacros.h)
-fi])dnl
-AC_MSG_RESULT($ac_cv_header_major)
-case "$ac_cv_header_major" in
-sys/mkdev.h) AC_DEFINE(MAJOR_IN_MKDEV) ;;
-sys/sysmacros.h) AC_DEFINE(MAJOR_IN_SYSMACROS) ;;
-esac
+[AC_MSG_CHECKING(whether sys/types.h defines makedev)
+AC_CACHE_VAL(ac_cv_header_sys_types_h_makedev,
+[AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);],
+  ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
+])dnl
+AC_MSG_RESULT($ac_cv_header_sys_types_h_makedev)
+
+if test $ac_cv_header_sys_types_h_makedev = no; then
+AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)])
+
+  if test $ac_cv_header_sys_mkdev_h = no; then
+AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)])
+  fi
+fi
 ])dnl
 dnl
 AC_DEFUN(AC_HEADER_DIRENT,
index 5fb733c12b9ed54c27dc3b81a72c04018eb2b016..ac8e87b4c31df602e6ed3fc50dd9aec81f232c7a 100644 (file)
@@ -111,10 +111,17 @@ if grep "${pattern}" $tmpout > /dev/null 2>&1; then
   status=1
 fi
 
-case $# in
-  0) cat $tmpout > configure; chmod +x configure ;;
-  1) cat $tmpout ;;
-esac
+if test $# -eq 0; then
+  exec > configure; chmod +x configure
+fi
+
+# Put the real line numbers into configure to make config.log more helpful.
+awk '
+/__LINE__/ { printf "%d:", NR + 1 }
+           { print }
+' $tmpout | sed '
+/__LINE__/s/^\([0-9][0-9]*\):\(.*\)__LINE__\(.*\)$/\2\1\3/
+'
 
 rm -f $tmpout
 exit $status
index 5fb733c12b9ed54c27dc3b81a72c04018eb2b016..ac8e87b4c31df602e6ed3fc50dd9aec81f232c7a 100644 (file)
@@ -111,10 +111,17 @@ if grep "${pattern}" $tmpout > /dev/null 2>&1; then
   status=1
 fi
 
-case $# in
-  0) cat $tmpout > configure; chmod +x configure ;;
-  1) cat $tmpout ;;
-esac
+if test $# -eq 0; then
+  exec > configure; chmod +x configure
+fi
+
+# Put the real line numbers into configure to make config.log more helpful.
+awk '
+/__LINE__/ { printf "%d:", NR + 1 }
+           { print }
+' $tmpout | sed '
+/__LINE__/s/^\([0-9][0-9]*\):\(.*\)__LINE__\(.*\)$/\2\1\3/
+'
 
 rm -f $tmpout
 exit $status
index 2dc90eb802b3bb838099bb3f68f8b71627a81e75..e44e7db1eacddc652f045c92f4fd6a94b315fcf0 100644 (file)
@@ -1026,26 +1026,26 @@ Then, in the code, use a test like this:
 @example
 @group
 #if STDC_HEADERS || HAVE_STRING_H
-#include <string.h>
+# include <string.h>
 /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
-#if !STDC_HEADERS && HAVE_MEMORY_H
-#include <memory.h>
-#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif /* not STDC_HEADERS and HAVE_MEMORY_H */
 #else /* not STDC_HEADERS and not HAVE_STRING_H */
-#include <strings.h>
+# include <strings.h>
 /* memory.h and strings.h conflict on some systems.  */
-#ifndef strchr
-#define strchr index
-#endif
-#ifndef strrchr
-#define strrchr rindex
-#endif
-#ifndef memcpy
-#define memcpy(d, s, n) bcopy ((s), (d), (n))
-#endif
-#ifndef memcmp
-#define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
-#endif
+# ifndef strchr
+#  define strchr index
+# endif
+# ifndef strrchr
+#  define strrchr rindex
+# endif
+# ifndef memcpy
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+# endif
+# ifndef memcmp
+#  define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
+# endif
 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
 @end group
 @end example
@@ -1217,19 +1217,19 @@ rather than choke on it.
 @group
 /* AIX requires this to be the first thing in the file.  */
 #ifdef __GNUC__
-#define alloca __builtin_alloca
+# define alloca __builtin_alloca
 #else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not HAVE_ALLOCA_H */
-#ifdef _AIX
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else /* not HAVE_ALLOCA_H */
+#  ifdef _AIX
  #pragma alloca
-#else /* not _AIX */
-#ifndef alloca /* predefined by HP cc +Olibcalls */
+#  else /* not _AIX */
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
 char *alloca ();
-#endif /* not defined(alloca) */
-#endif /* not _AIX */
-#endif /* not HAVE_ALLOCA_H */
+#   endif /* not defined(alloca) */
+#  endif /* not _AIX */
+# endif /* not HAVE_ALLOCA_H */
 #endif /* not __GNUC__ */
 @end group
 @end example
@@ -2314,13 +2314,43 @@ LIBS="$LIBS -ltermcap"
 @end example
 @end defmac
 
-@defmac AC_SUBST_FILE (@var{variable}, @var{file})
+@defmac AC_SUBST_DEFAULT (@var{variable}, @var{default-value})
+@maindex SUBST_DEFAULT
+Like @code{AC_SUBST}, but if @var{variable} is not set in the
+environment when @code{configure} is run, give it the value
+@var{default-value}.  @var{default-value} is evaluated in shell double
+quotes, so it may refer to other variables or even the output of a
+command.  As an example, Autoconf automatically calls this macro like this:
+
+@example
+AC_SUBST_DEFAULT(CFLAGS, -g)dnl
+AC_SUBST_DEFAULT(CXXFLAGS, -g)dnl
+AC_SUBST_DEFAULT(LDFLAGS, )dnl
+@end example
+@end defmac
+
+@defmac AC_SUBST_FILE (@var{variable})
 @maindex SUBST_FILE
-Substitute the contents of the file @file{@var{srcdir}/@var{file}} into
-@file{Makefile} variable @var{variable} when creating the output files
-(typically one or more @file{Makefile}s).  This macro is useful for
-inserting @file{Makefile} fragments for particular host or tartet types
-into @file{Makefile}s.
+Substitute the contents of the file named by shell variable
+@var{variable} into @file{Makefile} variable @var{variable} when
+creating the output files (typically one or more @file{Makefile}s).
+This macro is useful for inserting @file{Makefile} fragments containing
+special dependencies or other @code{make} directives for particular host
+or target types into @file{Makefile}s.
+
+For example, @file{configure.in} could contain:
+
+@example
+AC_SUBST_FILE(host_frag)dnl
+host_frag=$srcdir/conf/sun4.mh
+@end example
+
+@noindent
+and then a @file{Makefile.in} could contain:
+
+@example
+@@host_frag@@
+@end example
 @end defmac
 
 @node Printing Messages, Language Choice, Setting Variables, General Purpose Macros
@@ -3219,11 +3249,34 @@ The top-level source code directory for the package.  In the top-level
 directory, this is the same as @code{srcdir}.
 @end defvar
 
+@defvar CFLAGS
+Debugging, optimization, header file search directory, and other
+miscellaneous options for the C compiler.  The default value is
+@samp{-g} if it is not set in the environment when @code{configure} runs.
+@code{configure} uses this variable when compiling programs to test
+for C features.
+@end defvar
+
+@defvar CXXFLAGS
+Debugging, optimization, header file search directory, and other
+miscellaneous options for the C++ compiler.  The default value is
+@samp{-g} if it is not set in the environment when @code{configure} runs.
+@code{configure} uses this variable when compiling programs to test
+for C++ features.
+@end defvar
+
 @defvar DEFS
 @samp{-D} options to pass to the C compiler.  If @code{AC_CONFIG_HEADER}
 is called, @code{configure} replaces @samp{@@DEFS@@} with
-@samp{-DHAVE_CONFIG_H}, since the contents of @code{DEFS} would be
-redundant.
+@samp{-DHAVE_CONFIG_H} instead.
+@end defvar
+
+@defvar LDFLAGS
+Stripping, library search directories, and other miscellaneous options
+for the linker.  The default value is empty if it is not set in the
+environment when @code{configure} runs.
+@code{configure} uses this variable when linking programs to test
+for C features.
 @end defvar
 
 @defvar LIBS
index 5fb733c12b9ed54c27dc3b81a72c04018eb2b016..ac8e87b4c31df602e6ed3fc50dd9aec81f232c7a 100644 (file)
@@ -111,10 +111,17 @@ if grep "${pattern}" $tmpout > /dev/null 2>&1; then
   status=1
 fi
 
-case $# in
-  0) cat $tmpout > configure; chmod +x configure ;;
-  1) cat $tmpout ;;
-esac
+if test $# -eq 0; then
+  exec > configure; chmod +x configure
+fi
+
+# Put the real line numbers into configure to make config.log more helpful.
+awk '
+/__LINE__/ { printf "%d:", NR + 1 }
+           { print }
+' $tmpout | sed '
+/__LINE__/s/^\([0-9][0-9]*\):\(.*\)__LINE__\(.*\)$/\2\1\3/
+'
 
 rm -f $tmpout
 exit $status
index 2dc90eb802b3bb838099bb3f68f8b71627a81e75..e44e7db1eacddc652f045c92f4fd6a94b315fcf0 100644 (file)
@@ -1026,26 +1026,26 @@ Then, in the code, use a test like this:
 @example
 @group
 #if STDC_HEADERS || HAVE_STRING_H
-#include <string.h>
+# include <string.h>
 /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
-#if !STDC_HEADERS && HAVE_MEMORY_H
-#include <memory.h>
-#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif /* not STDC_HEADERS and HAVE_MEMORY_H */
 #else /* not STDC_HEADERS and not HAVE_STRING_H */
-#include <strings.h>
+# include <strings.h>
 /* memory.h and strings.h conflict on some systems.  */
-#ifndef strchr
-#define strchr index
-#endif
-#ifndef strrchr
-#define strrchr rindex
-#endif
-#ifndef memcpy
-#define memcpy(d, s, n) bcopy ((s), (d), (n))
-#endif
-#ifndef memcmp
-#define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
-#endif
+# ifndef strchr
+#  define strchr index
+# endif
+# ifndef strrchr
+#  define strrchr rindex
+# endif
+# ifndef memcpy
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+# endif
+# ifndef memcmp
+#  define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
+# endif
 #endif /* not STDC_HEADERS and not HAVE_STRING_H */
 @end group
 @end example
@@ -1217,19 +1217,19 @@ rather than choke on it.
 @group
 /* AIX requires this to be the first thing in the file.  */
 #ifdef __GNUC__
-#define alloca __builtin_alloca
+# define alloca __builtin_alloca
 #else /* not __GNUC__ */
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else /* not HAVE_ALLOCA_H */
-#ifdef _AIX
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else /* not HAVE_ALLOCA_H */
+#  ifdef _AIX
  #pragma alloca
-#else /* not _AIX */
-#ifndef alloca /* predefined by HP cc +Olibcalls */
+#  else /* not _AIX */
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
 char *alloca ();
-#endif /* not defined(alloca) */
-#endif /* not _AIX */
-#endif /* not HAVE_ALLOCA_H */
+#   endif /* not defined(alloca) */
+#  endif /* not _AIX */
+# endif /* not HAVE_ALLOCA_H */
 #endif /* not __GNUC__ */
 @end group
 @end example
@@ -2314,13 +2314,43 @@ LIBS="$LIBS -ltermcap"
 @end example
 @end defmac
 
-@defmac AC_SUBST_FILE (@var{variable}, @var{file})
+@defmac AC_SUBST_DEFAULT (@var{variable}, @var{default-value})
+@maindex SUBST_DEFAULT
+Like @code{AC_SUBST}, but if @var{variable} is not set in the
+environment when @code{configure} is run, give it the value
+@var{default-value}.  @var{default-value} is evaluated in shell double
+quotes, so it may refer to other variables or even the output of a
+command.  As an example, Autoconf automatically calls this macro like this:
+
+@example
+AC_SUBST_DEFAULT(CFLAGS, -g)dnl
+AC_SUBST_DEFAULT(CXXFLAGS, -g)dnl
+AC_SUBST_DEFAULT(LDFLAGS, )dnl
+@end example
+@end defmac
+
+@defmac AC_SUBST_FILE (@var{variable})
 @maindex SUBST_FILE
-Substitute the contents of the file @file{@var{srcdir}/@var{file}} into
-@file{Makefile} variable @var{variable} when creating the output files
-(typically one or more @file{Makefile}s).  This macro is useful for
-inserting @file{Makefile} fragments for particular host or tartet types
-into @file{Makefile}s.
+Substitute the contents of the file named by shell variable
+@var{variable} into @file{Makefile} variable @var{variable} when
+creating the output files (typically one or more @file{Makefile}s).
+This macro is useful for inserting @file{Makefile} fragments containing
+special dependencies or other @code{make} directives for particular host
+or target types into @file{Makefile}s.
+
+For example, @file{configure.in} could contain:
+
+@example
+AC_SUBST_FILE(host_frag)dnl
+host_frag=$srcdir/conf/sun4.mh
+@end example
+
+@noindent
+and then a @file{Makefile.in} could contain:
+
+@example
+@@host_frag@@
+@end example
 @end defmac
 
 @node Printing Messages, Language Choice, Setting Variables, General Purpose Macros
@@ -3219,11 +3249,34 @@ The top-level source code directory for the package.  In the top-level
 directory, this is the same as @code{srcdir}.
 @end defvar
 
+@defvar CFLAGS
+Debugging, optimization, header file search directory, and other
+miscellaneous options for the C compiler.  The default value is
+@samp{-g} if it is not set in the environment when @code{configure} runs.
+@code{configure} uses this variable when compiling programs to test
+for C features.
+@end defvar
+
+@defvar CXXFLAGS
+Debugging, optimization, header file search directory, and other
+miscellaneous options for the C++ compiler.  The default value is
+@samp{-g} if it is not set in the environment when @code{configure} runs.
+@code{configure} uses this variable when compiling programs to test
+for C++ features.
+@end defvar
+
 @defvar DEFS
 @samp{-D} options to pass to the C compiler.  If @code{AC_CONFIG_HEADER}
 is called, @code{configure} replaces @samp{@@DEFS@@} with
-@samp{-DHAVE_CONFIG_H}, since the contents of @code{DEFS} would be
-redundant.
+@samp{-DHAVE_CONFIG_H} instead.
+@end defvar
+
+@defvar LDFLAGS
+Stripping, library search directories, and other miscellaneous options
+for the linker.  The default value is empty if it is not set in the
+environment when @code{configure} runs.
+@code{configure} uses this variable when linking programs to test
+for C features.
 @end defvar
 
 @defvar LIBS
index 77775845bb79200a6eab5f49b5c2f277440ee422..3621783adb52805c6b26378ff66d9d18cba66764 100644 (file)
@@ -66,20 +66,13 @@ the @code{configure} script does not know about.  You can give
 environment.  Using a Bourne-compatible shell, you can do that on the
 command line like this:
 @example
-CC=c89 LIBS=-lposix ./configure
+CC=c89 CFLAGS=-O2 LDFLAGS=-s LIBS=-lposix ./configure
 @end example
 
 @noindent
 Or on systems that have the @code{env} program, you can do it like this:
 @example
-env CC=c89 LIBS=-lposix ./configure
-@end example
-
-@noindent
-To select different optimizing or debugging options, you can override
-the @samp{make} variables @code{CFLAGS} and @code{LDFLAGS}:
-@example
-make CFLAGS=-O2 LDFLAGS=-s
+env CC=c89 CFLAGS=-O2 LDFLAGS=-s LIBS=-lposix ./configure
 @end example
 
 @node Build Directory
index 77775845bb79200a6eab5f49b5c2f277440ee422..3621783adb52805c6b26378ff66d9d18cba66764 100644 (file)
@@ -66,20 +66,13 @@ the @code{configure} script does not know about.  You can give
 environment.  Using a Bourne-compatible shell, you can do that on the
 command line like this:
 @example
-CC=c89 LIBS=-lposix ./configure
+CC=c89 CFLAGS=-O2 LDFLAGS=-s LIBS=-lposix ./configure
 @end example
 
 @noindent
 Or on systems that have the @code{env} program, you can do it like this:
 @example
-env CC=c89 LIBS=-lposix ./configure
-@end example
-
-@noindent
-To select different optimizing or debugging options, you can override
-the @samp{make} variables @code{CFLAGS} and @code{LDFLAGS}:
-@example
-make CFLAGS=-O2 LDFLAGS=-s
+env CC=c89 CFLAGS=-O2 LDFLAGS=-s LIBS=-lposix ./configure
 @end example
 
 @node Build Directory
index 29dc5c45aa777b04967b98a84e0d256732ca6ea0..462383f80851761cff2d1c374dd428a4777f58b4 100644 (file)
@@ -363,14 +363,14 @@ fi
 ])dnl
 dnl
 dnl Try to have only one #! line, so the script doesn't look funny.
-dnl AC_BINSH()
-AC_DEFUN(AC_BINSH,
+dnl AC_INIT_BINSH()
+AC_DEFUN(AC_INIT_BINSH,
 [#!/bin/sh
 ])dnl
 dnl
 dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR)
 AC_DEFUN(AC_INIT,
-[AC_REQUIRE([AC_BINSH])dnl
+[AC_REQUIRE([AC_INIT_BINSH])dnl
 AC_INIT_NOTICE
 AC_INIT_PARSE_ARGS
 AC_INIT_PREPARE($1)])dnl
@@ -479,6 +479,9 @@ AC_SUBST(LIBS)dnl
 AC_SUBST(prefix)dnl
 AC_SUBST(exec_prefix)dnl
 AC_SUBST(DEFS)dnl
+AC_SUBST_DEFAULT(CFLAGS, -g)dnl
+AC_SUBST_DEFAULT(CXXFLAGS, -g)dnl
+AC_SUBST_DEFAULT(LDFLAGS, )dnl
 ])dnl
 dnl
 dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE])
@@ -539,7 +542,7 @@ AC_DEFUN(AC_CONFIG_HEADER,
 dnl
 dnl AC_REVISION(REVISION-INFO)
 AC_DEFUN(AC_REVISION,
-[AC_REQUIRE([AC_BINSH])dnl
+[AC_REQUIRE([AC_INIT_BINSH])dnl
 [# From configure.in] translit([$1], $")])dnl
 dnl
 dnl Subroutines of AC_PREREQ.
@@ -866,18 +869,8 @@ s%@$1@%[$]$1%g
 divert(AC_DIVERSION_NORMAL)dnl
 ])])dnl
 dnl
-dnl AC_SUBST_FILE(VARIABLE, FILE)
+dnl AC_SUBST_FILE(VARIABLE)
 AC_DEFUN(AC_SUBST_FILE,
-[if test -f $2; then
-  echo using $2 for $1)
-  AC_INSERT_FILE($1, $2)
-elif test -f ${srcdir}/$2; then
-  echo using ${srcdir}/$2 for $1)
-  AC_INSERT_FILE($1, ${srcdir}/$2)
-fi
-])dnl
-dnl Internal subroutine of AC_SUBST_FILE.
-AC_DEFUN(AC_INSERT_FILE,
 [ifdef([AC_SUBST_$1], ,
 [define([AC_SUBST_$1], )dnl
 divert(AC_DIVERSION_SED)dnl
@@ -886,6 +879,12 @@ s%@$1@%%g
 divert(AC_DIVERSION_NORMAL)dnl
 ])])dnl
 dnl
+dnl AC_SUBST_DEFAULT(VARIABLE [, DEFAULT-VALUE])
+AC_DEFUN(AC_SUBST_DEFAULT,
+[$1=${$1-"$2"}
+AC_SUBST($1)dnl
+])dnl
+dnl
 dnl
 dnl ### Printing messages
 dnl
@@ -1120,6 +1119,7 @@ dnl              ACTION-IF-NOT-FOUND])
 AC_DEFUN(AC_EGREP_CPP,
 [AC_REQUIRE_CPP()dnl
 cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
 #include "confdefs.h"
 [$2]
 EOF
@@ -1150,6 +1150,7 @@ dnl             ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
 AC_DEFUN(AC_TRY_LINK,
 [dnl We use return because because C++ requires a prototype for exit.
 cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
 #include "confdefs.h"
 [$1]
 int main() { return 0; }
@@ -1179,6 +1180,7 @@ $4
 ])
 else
 cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
 #include "confdefs.h"
 [$1]
 EOF
@@ -1196,6 +1198,7 @@ dnl AC_TRY_CPP(INCLUDES, ACTION-IF-TRUE [, ACTION-IF-FALSE])
 AC_DEFUN(AC_TRY_CPP,
 [AC_REQUIRE_CPP()dnl
 cat > conftest.${ac_ext} <<EOF
+#line __LINE__ "configure"
 #include "confdefs.h"
 [$1]
 EOF
@@ -1219,12 +1222,12 @@ dnl
 dnl AC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
 AC_DEFUN(AC_CHECK_HEADER,
 [dnl Do the transliteration at runtime so arg 1 can be a shell variable.
-ac_var=`echo "$1" | tr './' '__'`
+ac_safe=`echo "$1" | tr './' '__'`
 AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(ac_cv_header_$ac_var,
-[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_var=yes",
-  eval "ac_cv_header_$ac_var=no")])dnl
-if eval "test \"`echo '$ac_cv_header_'$ac_var`\" = yes"; then
+AC_CACHE_VAL(ac_cv_header_$ac_safe,
+[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes",
+  eval "ac_cv_header_$ac_safe=no")])dnl
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   AC_MSG_RESULT(yes)
   ifelse([$2], , :, [$2])
 else
@@ -1393,6 +1396,7 @@ do
 done
 
 ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
 
 ifdef([AC_LIST_HEADERS],
 [trap 'rm -fr $1 AC_LIST_HEADERS conftest*; exit 1' 1 2 15],
index 7b1b0c76fad6d5ce20afc09e491e773d756bacbe..8a35e9930322b1e1a7c34cf1257714bed7e29ff1 100644 (file)
@@ -309,8 +309,8 @@ AC_CACHE_VAL(ac_cv_path_install,
   test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"])dnl
   INSTALL="$ac_cv_path_install"
 fi
-dnl We do this instead of AC_SUBST, to get relative paths right.
-ac_given_INSTALL=$INSTALL
+dnl We do special magic for INSTALL instead of AC_SUBST, to get
+dnl relative paths right. 
 AC_MSG_RESULT($INSTALL)
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -407,21 +407,20 @@ fi
 ])dnl
 dnl
 AC_DEFUN(AC_HEADER_MAJOR,
-[AC_MSG_CHECKING([for major, minor and makedev header])
-AC_CACHE_VAL(ac_cv_header_major,
-[AC_TRY_LINK([#include <sys/types.h>],
-[return makedev(0, 0);], ac_cv_header_major=sys/types.h, ac_cv_header_major=no)
-if test $ac_cv_header_major = no; then
-AC_CHECK_HEADER(sys/mkdev.h, ac_cv_header_major=sys/mkdev.h)
-fi
-if test $ac_cv_header_major = no; then
-AC_CHECK_HEADER(sys/sysmacros.h, ac_cv_header_major=sys/sysmacros.h)
-fi])dnl
-AC_MSG_RESULT($ac_cv_header_major)
-case "$ac_cv_header_major" in
-sys/mkdev.h) AC_DEFINE(MAJOR_IN_MKDEV) ;;
-sys/sysmacros.h) AC_DEFINE(MAJOR_IN_SYSMACROS) ;;
-esac
+[AC_MSG_CHECKING(whether sys/types.h defines makedev)
+AC_CACHE_VAL(ac_cv_header_sys_types_h_makedev,
+[AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);],
+  ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)
+])dnl
+AC_MSG_RESULT($ac_cv_header_sys_types_h_makedev)
+
+if test $ac_cv_header_sys_types_h_makedev = no; then
+AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)])
+
+  if test $ac_cv_header_sys_mkdev_h = no; then
+AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)])
+  fi
+fi
 ])dnl
 dnl
 AC_DEFUN(AC_HEADER_DIRENT,