From: David MacKenzie Date: Thu, 25 Aug 1994 03:45:07 +0000 (+0000) Subject: add #line, fix AC_SUBST_FILE X-Git-Tag: fsf-origin~531 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3f2d21c674e21e286bc2ca452ce656ce2d5308a;p=thirdparty%2Fautoconf.git add #line, fix AC_SUBST_FILE --- diff --git a/NEWS b/NEWS index f987e5c36..ed02b191c 100644 --- 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 3c0ccb9df..e3abf95ca 100644 --- 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. ------------------------------------------------------------------------------ diff --git a/acgeneral.m4 b/acgeneral.m4 index 29dc5c45a..462383f80 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -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} < conftest.${ac_ext} < conftest.${ac_ext} < conftest.${ac_ext} <], 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], diff --git a/acspecific.m4 b/acspecific.m4 index 7b1b0c76f..8a35e9930 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -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 ], -[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 ], [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, diff --git a/autoconf.in b/autoconf.in index 5fb733c12..ac8e87b4c 100644 --- a/autoconf.in +++ b/autoconf.in @@ -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 diff --git a/autoconf.sh b/autoconf.sh index 5fb733c12..ac8e87b4c 100644 --- a/autoconf.sh +++ b/autoconf.sh @@ -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 diff --git a/autoconf.texi b/autoconf.texi index 2dc90eb80..e44e7db1e 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -1026,26 +1026,26 @@ Then, in the code, use a test like this: @example @group #if STDC_HEADERS || HAVE_STRING_H -#include +# include /* An ANSI string.h and pre-ANSI memory.h might conflict. */ -#if !STDC_HEADERS && HAVE_MEMORY_H -#include -#endif /* not STDC_HEADERS and HAVE_MEMORY_H */ +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif /* not STDC_HEADERS and HAVE_MEMORY_H */ #else /* not STDC_HEADERS and not HAVE_STRING_H */ -#include +# include /* 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 -#else /* not HAVE_ALLOCA_H */ -#ifdef _AIX +# if HAVE_ALLOCA_H +# include +# 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 diff --git a/bin/autoconf.in b/bin/autoconf.in index 5fb733c12..ac8e87b4c 100644 --- a/bin/autoconf.in +++ b/bin/autoconf.in @@ -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 diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 2dc90eb80..e44e7db1e 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -1026,26 +1026,26 @@ Then, in the code, use a test like this: @example @group #if STDC_HEADERS || HAVE_STRING_H -#include +# include /* An ANSI string.h and pre-ANSI memory.h might conflict. */ -#if !STDC_HEADERS && HAVE_MEMORY_H -#include -#endif /* not STDC_HEADERS and HAVE_MEMORY_H */ +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif /* not STDC_HEADERS and HAVE_MEMORY_H */ #else /* not STDC_HEADERS and not HAVE_STRING_H */ -#include +# include /* 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 -#else /* not HAVE_ALLOCA_H */ -#ifdef _AIX +# if HAVE_ALLOCA_H +# include +# 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 diff --git a/doc/install.texi b/doc/install.texi index 77775845b..3621783ad 100644 --- a/doc/install.texi +++ b/doc/install.texi @@ -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 diff --git a/install.texi b/install.texi index 77775845b..3621783ad 100644 --- a/install.texi +++ b/install.texi @@ -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 diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 29dc5c45a..462383f80 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -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} < conftest.${ac_ext} < conftest.${ac_ext} < conftest.${ac_ext} <], 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], diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 7b1b0c76f..8a35e9930 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -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 ], -[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 ], [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,