diff --git a/ChangeLog b/ChangeLog index 359bc75f..fb795d6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-01-16 Akim Demaille + + When default headers are used, check for their presence. + Suggested by Jim. + + * acgeneral.m4 (_AC_INIT_DEFAULTS): Don't define + ac_includes_default, since... + (_AC_INCLUDES_DEFAULT_REQUIREMENTS): this new macro does. + (AC_INCLUDES_DEFAULT): Require the former when default includes + are used. + (AC_CHECK_MEMBERS, _AC_CHECK_TYPE_NEW): Don't require + AC_HEADERS_STDC, that's a job for stupendous AC_INCLUDES_DEFAULT. + * acfunctions.m4 (AC_FUNC_MALLOC): Check for stdlib.h. + 2001-01-15 Akim Demaille * doc/autoconf.texi: Normalize sh samples. diff --git a/acfunctions.m4 b/acfunctions.m4 index eb3c29e7..d69d0448 100644 --- a/acfunctions.m4 +++ b/acfunctions.m4 @@ -713,6 +713,7 @@ fi # Is `malloc (0)' properly handled? AC_DEFUN([AC_FUNC_MALLOC], [AC_REQUIRE([AC_HEADER_STDC])dnl +AC_CHECK_HEADERS(stdlib.h) AC_CACHE_CHECK([for working malloc], ac_cv_func_malloc_works, [AC_TRY_RUN( [#if STDC_HEADERS || HAVE_STDLIB_H @@ -1432,7 +1433,7 @@ AU_ALIAS([AC_UTIME_NULL], [AC_FUNC_UTIME_NULL]) # ------------- AC_DEFUN([AC_FUNC_VFORK], [AC_REQUIRE([AC_TYPE_PID_T])dnl -AC_CHECK_HEADERS(vfork.h) +AC_CHECK_HEADERS(unistd.h vfork.h) AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, [AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */ #include diff --git a/acgeneral.m4 b/acgeneral.m4 index e48fd1e4..34033e1d 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -808,36 +808,7 @@ ac_exeext= # By default assume that objects files use an extension of .o. Only # change it if the script calls AC_OBJEXT. ac_objext=o -# Factoring default headers for most tests. -dnl If ever you change this variable, please keep autoconf.texi in sync. -ac_includes_default="\ -#include -#include -#include -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#else -# if HAVE_STRINGS_H -# include -# endif -#endif -#if HAVE_INTTYPES_H -# include -#endif -#if HAVE_UNISTD_H -# include -#endif" + m4_divert_pop()dnl ])# _AC_INIT_DEFAULTS @@ -2264,60 +2235,54 @@ AC_DEFUN([AC_TRY_COMMAND], # macros. It is easier to document, to extend, and to understand than # having specific defaults for each macro. -# Of course, one would like to issue these default headers only if -# they were used, i.e.., AC_INCLUDES_DEFAULT was called, and the -# default `branch' was run. Unfortunately AC_INCLUDES_DEFAULT is -# called unquoted, so it is unsafe to try to divert from there. -# Therefore, the following *is* buggy, but this is the kind of -# tradeoff we accept in order to improve configure. - -# See _AC_INIT_PREPARE to see the value of `ac_includes_default'. +# _AC_INCLUDES_DEFAULT_REQUIREMENTS +# --------------------------------- +# Required when AC_INCLUDES_DEFAULT uses its default branch. +AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS], +[m4_divert_text([DEFAULTS], +[# Factoring default headers for most tests. +dnl If ever you change this variable, please keep autoconf.texi in sync. +ac_includes_default="\ +#include +#include +#include +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#else +# if HAVE_STRINGS_H +# include +# endif +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_UNISTD_H +# include +#endif" +])dnl +AC_REQUIRE([AC_HEADER_STDC])dnl +AC_CHECK_HEADERS(stdlib.h string.h memory.h strings.h inttypes.h unistd.h) +]) # AC_INCLUDES_DEFAULT([INCLUDES]) # ------------------------------- # If INCLUDES is empty, expand in default includes, otherwise in # INCLUDES. -# -# The end-of-line after `$[1]' below is meant, and it is actually -# because this new line is meant that we don't use m4_default. The -# problem is that this macro is used *unquoted* in AC_TRY_COMPILE -# etc. It is used unquoted because unfortunately (this is a real -# pain), AC_TRY_COMPILE is over quoting some of its arguments. This -# is a sad decision. -# -# Still, there are calls such as this -# -# AC_TRY_COMPILE(AC_INCLUDES_DEFAULT([#include ]), -# AC_BLAH_BLAH..) -# -# Because AC_INCLUDES_DEFAULT *has* to be unquoted, after evaluation, -# if there were no end of line, you'd get -# -# AC_TRY_COMPILE(#include , -# AC_BLAH_BLAH, -# AC_MORE_BLAH_BLAH) -# -# i.e. the first argument given to AC_TRY_COMPILE is -# -# #include , -# AC_BLAH_BLAH -# -# (note how the comma was swallowed because of the comment mark) and -# the second is -# -# AC_MORE_BLAH_BLAH -# -# so all the arguments are shifted. -# -# Because I don't see any backward compatible means to fix the -# brokenness of AC_TRY_COMPILE, we are doomed to leave a extra new -# line here. -m4_define([AC_INCLUDES_DEFAULT], -[m4_ifval([$1], [$1 -], - [$ac_includes_default])]) - +AC_DEFUN([AC_INCLUDES_DEFAULT], +[m4_default([$1], [AC_REQUIRE([_AC_INCLUDES_DEFAULT_REQUIREMENTS])dnl +$ac_includes_default])]) @@ -2338,7 +2303,6 @@ AC_DEFUN([AC_CHECK_MEMBER], [AC_FATAL([$0: requires literal arguments])])dnl m4_if(m4_regexp([$1], [\.]), -1, [AC_FATAL([$0: Did not see any dot in `$1'])])dnl -AC_REQUIRE([AC_HEADER_STDC])dnl AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl dnl Extract the aggregate name, and the member name AC_CACHE_CHECK([for $1], ac_Member, @@ -3231,8 +3195,7 @@ AC_DEFINE_UNQUOTED(AC_TR_CPP(sizeof_$1), $AC_TR_SH([ac_cv_sizeof_$1]), # variable, we just use a cast to avoid warnings from the compiler. # Suggested by Paul Eggert. m4_define([_AC_CHECK_TYPE_NEW], -[AC_REQUIRE([AC_HEADER_STDC])dnl -AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl +[AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl AC_CACHE_CHECK([for $1], ac_Type, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])], [if (($1 *) 0) diff --git a/configure b/configure index 167b94ee..6859e15f 100755 --- a/configure +++ b/configure @@ -131,41 +131,6 @@ ac_cr_alnum=$ac_cr_az$ac_cr_AZ$ac_cr_09 ac_tr_sh="sed y%*+%pp%;s%[^_$ac_cr_alnum]%_%g" ac_tr_cpp="sed y%*$ac_cr_az%P$ac_cr_AZ%;s%[^_$ac_cr_alnum]%_%g" -# By default always use an empty string as the executable extension. -# Only change it if the script calls AC_EXEEXT. -ac_exeext= -# By default assume that objects files use an extension of .o. Only -# change it if the script calls AC_OBJEXT. -ac_objext=o -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#include -#include -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#else -# if HAVE_STRINGS_H -# include -# endif -#endif -#if HAVE_INTTYPES_H -# include -#endif -#if HAVE_UNISTD_H -# include -#endif" ac_unique_file="acgeneral.m4" # Initialize some variables set by options. @@ -246,7 +211,7 @@ do ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && - { { echo "$as_me:249: error: invalid feature name: $ac_feature" >&5 + { { echo "$as_me:214: error: invalid feature name: $ac_feature" >&5 echo "$as_me: error: invalid feature name: $ac_feature" >&2;} { (exit 1); exit; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` @@ -256,7 +221,7 @@ echo "$as_me: error: invalid feature name: $ac_feature" >&2;} ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && - { { echo "$as_me:259: error: invalid feature name: $ac_feature" >&5 + { { echo "$as_me:224: error: invalid feature name: $ac_feature" >&5 echo "$as_me: error: invalid feature name: $ac_feature" >&2;} { (exit 1); exit; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` @@ -439,7 +404,7 @@ echo "$as_me: error: invalid feature name: $ac_feature" >&2;} ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && - { { echo "$as_me:442: error: invalid package name: $ac_package" >&5 + { { echo "$as_me:407: error: invalid package name: $ac_package" >&5 echo "$as_me: error: invalid package name: $ac_package" >&2;} { (exit 1); exit; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` @@ -453,7 +418,7 @@ echo "$as_me: error: invalid package name: $ac_package" >&2;} ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && - { { echo "$as_me:456: error: invalid package name: $ac_package" >&5 + { { echo "$as_me:421: error: invalid package name: $ac_package" >&5 echo "$as_me: error: invalid package name: $ac_package" >&2;} { (exit 1); exit; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` @@ -477,7 +442,7 @@ echo "$as_me: error: invalid package name: $ac_package" >&2;} | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { { echo "$as_me:480: error: unrecognized option: $ac_option + -*) { { echo "$as_me:445: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2;} @@ -488,7 +453,7 @@ Try \`$0 --help' for more information." >&2;} ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$ac_cr_alnum]" >/dev/null && - { { echo "$as_me:491: error: invalid variable name: $ac_envvar" >&5 + { { echo "$as_me:456: error: invalid variable name: $ac_envvar" >&5 echo "$as_me: error: invalid variable name: $ac_envvar" >&2;} { (exit 1); exit; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` @@ -497,10 +462,10 @@ echo "$as_me: error: invalid variable name: $ac_envvar" >&2;} *) # FIXME: should be removed in autoconf 3.0. - { echo "$as_me:500: WARNING: you should use --build, --host, --target" >&5 + { echo "$as_me:465: WARNING: you should use --build, --host, --target" >&5 echo "$as_me: WARNING: you should use --build, --host, --target" >&2;} expr "x$ac_option" : ".*[^-._$ac_cr_alnum]" >/dev/null && - { echo "$as_me:503: WARNING: invalid host type: $ac_option" >&5 + { echo "$as_me:468: WARNING: invalid host type: $ac_option" >&5 echo "$as_me: WARNING: invalid host type: $ac_option" >&2;} : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; @@ -510,7 +475,7 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { { echo "$as_me:513: error: missing argument to $ac_option" >&5 + { { echo "$as_me:478: error: missing argument to $ac_option" >&5 echo "$as_me: error: missing argument to $ac_option" >&2;} { (exit 1); exit; }; } fi @@ -524,7 +489,7 @@ do case $ac_val in [\\/$]* | ?:[\\/]* ) ;; NONE ) ;; - *) { { echo "$as_me:527: error: expected an absolute path for --$ac_var: $ac_val" >&5 + *) { { echo "$as_me:492: error: expected an absolute path for --$ac_var: $ac_val" >&5 echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2;} { (exit 1); exit; }; };; esac @@ -540,7 +505,7 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - { echo "$as_me:543: WARNING: If you wanted to set the --build type, don't use --host. + { echo "$as_me:508: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&5 echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2;} @@ -568,11 +533,11 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { { echo "$as_me:571: error: cannot find sources in $ac_confdir or .." >&5 + { { echo "$as_me:536: error: cannot find sources in $ac_confdir or .." >&5 echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2;} { (exit 1); exit; }; } else - { { echo "$as_me:575: error: cannot find sources in $srcdir" >&5 + { { echo "$as_me:540: error: cannot find sources in $srcdir" >&5 echo "$as_me: error: cannot find sources in $srcdir" >&2;} { (exit 1); exit; }; } fi @@ -698,7 +663,7 @@ if test "$ac_init_help" = "recursive"; then echo $ac_configure --help else - { echo "$as_me:701: WARNING: no configuration information is in $ac_subdir" >&5 + { echo "$as_me:666: WARNING: no configuration information is in $ac_subdir" >&5 echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2;} fi cd $ac_popdir @@ -779,7 +744,7 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:782: loading cache $cache_file" >&5 + { echo "$as_me:747: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; @@ -787,7 +752,7 @@ echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { echo "$as_me:790: creating cache $cache_file" >&5 + { echo "$as_me:755: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -803,30 +768,30 @@ for ac_var in `(set) 2>&1 | eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:806: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { echo "$as_me:771: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_suggest_removing_cache=: ;; ,set) - { echo "$as_me:810: WARNING: \`$ac_var' was not set in the previous run" >&5 + { echo "$as_me:775: WARNING: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: WARNING: \`$ac_var' was not set in the previous run" >&2;} ac_suggest_removing_cache=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:816: WARNING: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:781: WARNING: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: WARNING: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:818: WARNING: former value: $ac_old_val" >&5 + { echo "$as_me:783: WARNING: former value: $ac_old_val" >&5 echo "$as_me: WARNING: former value: $ac_old_val" >&2;} - { echo "$as_me:820: WARNING: current value: $ac_new_val" >&5 + { echo "$as_me:785: WARNING: current value: $ac_new_val" >&5 echo "$as_me: WARNING: current value: $ac_new_val" >&2;} ac_suggest_removing_cache=: fi;; esac done if $ac_suggest_removing_cache; then - { echo "$as_me:827: WARNING: changes in the environment can compromise the build" >&5 + { echo "$as_me:792: WARNING: changes in the environment can compromise the build" >&5 echo "$as_me: WARNING: changes in the environment can compromise the build" >&2;} - { echo "$as_me:829: WARNING: consider removing $cache_file and starting over" >&5 + { echo "$as_me:794: WARNING: consider removing $cache_file and starting over" >&5 echo "$as_me: WARNING: consider removing $cache_file and starting over" >&2;} fi @@ -860,7 +825,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:863: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 + { { echo "$as_me:828: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit; }; } fi @@ -880,7 +845,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:883: checking for a BSD compatible install" >&5 +echo "$as_me:848: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -929,7 +894,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:932: result: $INSTALL" >&5 +echo "$as_me:897: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -940,7 +905,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo "$as_me:943: checking whether build environment is sane" >&5 +echo "$as_me:908: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 @@ -963,7 +928,7 @@ if ( # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - { { echo "$as_me:966: error: ls -t appears to fail. Make sure there is not a broken + { { echo "$as_me:931: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} @@ -976,14 +941,14 @@ then # Ok. : else - { { echo "$as_me:979: error: newly created file is older than distributed files! + { { echo "$as_me:944: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit; }; } fi rm -f conftest* -echo "$as_me:986: result: yes" >&5 +echo "$as_me:951: result: yes" >&5 echo "${ECHO_T}yes" >&6 if test "$program_transform_name" = s,x,x,; then program_transform_name= @@ -1004,7 +969,7 @@ test "$program_suffix" != NONE && # sed with no file args requires a program. test -z "$program_transform_name" && program_transform_name="s,x,x," -echo "$as_me:1007: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:972: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then @@ -1024,11 +989,11 @@ fi rm -f conftestmake fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:1027: result: yes" >&5 + echo "$as_me:992: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:1031: result: no" >&5 + echo "$as_me:996: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -1038,7 +1003,7 @@ PACKAGE=autoconf VERSION=2.49c if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { { echo "$as_me:1041: error: source directory already configured; run \"make distclean\" there first" >&5 + { { echo "$as_me:1006: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit; }; } fi @@ -1052,78 +1017,78 @@ cat >>confdefs.h <&5 +echo "$as_me:1020: checking for working aclocal" >&5 echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (aclocal --version) < /dev/null > /dev/null 2>&1; then ACLOCAL=aclocal - echo "$as_me:1062: result: found" >&5 + echo "$as_me:1027: result: found" >&5 echo "${ECHO_T}found" >&6 else ACLOCAL="$SHELL $missing_dir/missing aclocal" - echo "$as_me:1066: result: missing" >&5 + echo "$as_me:1031: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi -echo "$as_me:1070: checking for working autoconf" >&5 +echo "$as_me:1035: checking for working autoconf" >&5 echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoconf --version) < /dev/null > /dev/null 2>&1; then AUTOCONF=autoconf - echo "$as_me:1077: result: found" >&5 + echo "$as_me:1042: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOCONF="$SHELL $missing_dir/missing autoconf" - echo "$as_me:1081: result: missing" >&5 + echo "$as_me:1046: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi -echo "$as_me:1085: checking for working automake" >&5 +echo "$as_me:1050: checking for working automake" >&5 echo $ECHO_N "checking for working automake... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (automake --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake - echo "$as_me:1092: result: found" >&5 + echo "$as_me:1057: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOMAKE="$SHELL $missing_dir/missing automake" - echo "$as_me:1096: result: missing" >&5 + echo "$as_me:1061: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi -echo "$as_me:1100: checking for working autoheader" >&5 +echo "$as_me:1065: checking for working autoheader" >&5 echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoheader --version) < /dev/null > /dev/null 2>&1; then AUTOHEADER=autoheader - echo "$as_me:1107: result: found" >&5 + echo "$as_me:1072: result: found" >&5 echo "${ECHO_T}found" >&6 else AUTOHEADER="$SHELL $missing_dir/missing autoheader" - echo "$as_me:1111: result: missing" >&5 + echo "$as_me:1076: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi -echo "$as_me:1115: checking for working makeinfo" >&5 +echo "$as_me:1080: checking for working makeinfo" >&5 echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (makeinfo --version) < /dev/null > /dev/null 2>&1; then MAKEINFO=makeinfo - echo "$as_me:1122: result: found" >&5 + echo "$as_me:1087: result: found" >&5 echo "${ECHO_T}found" >&6 else MAKEINFO="$SHELL $missing_dir/missing makeinfo" - echo "$as_me:1126: result: missing" >&5 + echo "$as_me:1091: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi @@ -1132,7 +1097,7 @@ AUTOTEST_PATH=.. # Extract the first word of "expr", so it can be a program name with args. set dummy expr; ac_word=$2 -echo "$as_me:1135: checking for $ac_word" >&5 +echo "$as_me:1100: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EXPR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1159,10 +1124,10 @@ fi EXPR=$ac_cv_path_EXPR if test -n "$EXPR"; then - echo "$as_me:1162: result: $EXPR" >&5 + echo "$as_me:1127: result: $EXPR" >&5 echo "${ECHO_T}$EXPR" >&6 else - echo "$as_me:1165: result: no" >&5 + echo "$as_me:1130: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1174,7 +1139,7 @@ for ac_prog in gm4 gnum4 m4 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1177: checking for $ac_word" >&5 +echo "$as_me:1142: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_M4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1201,10 +1166,10 @@ fi M4=$ac_cv_path_M4 if test -n "$M4"; then - echo "$as_me:1204: result: $M4" >&5 + echo "$as_me:1169: result: $M4" >&5 echo "${ECHO_T}$M4" >&6 else - echo "$as_me:1207: result: no" >&5 + echo "$as_me:1172: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1212,7 +1177,7 @@ fi done test -n "$M4" || M4="m4" -echo "$as_me:1215: checking whether m4 supports frozen files" >&5 +echo "$as_me:1180: checking whether m4 supports frozen files" >&5 echo $ECHO_N "checking whether m4 supports frozen files... $ECHO_C" >&6 if test "${ac_cv_prog_gnu_m4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1224,10 +1189,10 @@ if test x"$M4" != x; then esac fi fi -echo "$as_me:1227: result: $ac_cv_prog_gnu_m4" >&5 +echo "$as_me:1192: result: $ac_cv_prog_gnu_m4" >&5 echo "${ECHO_T}$ac_cv_prog_gnu_m4" >&6 if test x"$ac_cv_prog_gnu_m4" != xyes; then - { { echo "$as_me:1230: error: GNU m4 1.4 is required" >&5 + { { echo "$as_me:1195: error: GNU m4 1.4 is required" >&5 echo "$as_me: error: GNU m4 1.4 is required" >&2;} { (exit 1); exit; }; } fi @@ -1239,7 +1204,7 @@ for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1242: checking for $ac_word" >&5 +echo "$as_me:1207: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1261,10 +1226,10 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$as_me:1264: result: $AWK" >&5 + echo "$as_me:1229: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else - echo "$as_me:1267: result: no" >&5 + echo "$as_me:1232: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1272,25 +1237,25 @@ fi done # Generating man pages. -echo "$as_me:1275: checking for working help2man" >&5 +echo "$as_me:1240: checking for working help2man" >&5 echo $ECHO_N "checking for working help2man... $ECHO_C" >&6 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (help2man --version) < /dev/null > /dev/null 2>&1; then HELP2MAN=help2man - echo "$as_me:1282: result: found" >&5 + echo "$as_me:1247: result: found" >&5 echo "${ECHO_T}found" >&6 else HELP2MAN="$SHELL $missing_dir/missing help2man" - echo "$as_me:1286: result: missing" >&5 + echo "$as_me:1251: result: missing" >&5 echo "${ECHO_T}missing" >&6 fi # We use a path for perl so the #! line in autoscan will work. # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 -echo "$as_me:1293: checking for $ac_word" >&5 +echo "$as_me:1258: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PERL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1318,17 +1283,17 @@ fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then - echo "$as_me:1321: result: $PERL" >&5 + echo "$as_me:1286: result: $PERL" >&5 echo "${ECHO_T}$PERL" >&6 else - echo "$as_me:1324: result: no" >&5 + echo "$as_me:1289: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$PERL" != no; then PERLSCRIPTS=autoscan else - { echo "$as_me:1331: WARNING: autoscan will not be built since perl is not found" >&5 + { echo "$as_me:1296: WARNING: autoscan will not be built since perl is not found" >&5 echo "$as_me: WARNING: autoscan will not be built since perl is not found" >&2;} fi @@ -1344,7 +1309,7 @@ fi # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:1347: checking for a BSD compatible install" >&5 +echo "$as_me:1312: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -1393,7 +1358,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:1396: result: $INSTALL" >&5 +echo "$as_me:1361: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -1548,7 +1513,7 @@ sed '/^$/d' confdefs.h >&5 : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:1551: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:1516: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<\_ACEOF #! /bin/sh @@ -1710,7 +1675,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:1713: error: ambiguous option: $1 + { { echo "$as_me:1678: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -1737,12 +1702,12 @@ Try \`$0 --help' for more information." >&2;} 'tests/atconfig' ) CONFIG_FILES="$CONFIG_FILES tests/atconfig" ;; # This is an error. - -*) { { echo "$as_me:1740: error: unrecognized option: $1 + -*) { { echo "$as_me:1705: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit; }; } ;; - *) { { echo "$as_me:1745: error: invalid argument: $1" >&5 + *) { { echo "$as_me:1710: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit; }; };; esac @@ -1944,7 +1909,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:1947: creating $ac_file" >&5 + { echo "$as_me:1912: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -1965,7 +1930,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]* | ?:[\\/]*) # Absolute - test -f "$f" || { { echo "$as_me:1968: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:1933: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit; }; } echo $f;; @@ -1978,7 +1943,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $ac_given_srcdir/$f else # /dev/null tree - { { echo "$as_me:1981: error: cannot find input file: $f" >&5 + { { echo "$as_me:1946: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit; }; } fi;; diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 2b03bd83..e89f534f 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2672,6 +2672,9 @@ Most generic macros provide the following default set of includes: @end group @end example +If the default includes are used, then Autoconf will automatically check +for the presence of these headers, i.e., you don't need to run +@code{AC_HEADERS_STDC}, nor check for @file{stdlib.h} etc. @node Alternative Programs, Libraries, Common Behavior, Existing Tests @section Alternative Programs diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index eb3c29e7..d69d0448 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -713,6 +713,7 @@ fi # Is `malloc (0)' properly handled? AC_DEFUN([AC_FUNC_MALLOC], [AC_REQUIRE([AC_HEADER_STDC])dnl +AC_CHECK_HEADERS(stdlib.h) AC_CACHE_CHECK([for working malloc], ac_cv_func_malloc_works, [AC_TRY_RUN( [#if STDC_HEADERS || HAVE_STDLIB_H @@ -1432,7 +1433,7 @@ AU_ALIAS([AC_UTIME_NULL], [AC_FUNC_UTIME_NULL]) # ------------- AC_DEFUN([AC_FUNC_VFORK], [AC_REQUIRE([AC_TYPE_PID_T])dnl -AC_CHECK_HEADERS(vfork.h) +AC_CHECK_HEADERS(unistd.h vfork.h) AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, [AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */ #include diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index e48fd1e4..34033e1d 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -808,36 +808,7 @@ ac_exeext= # By default assume that objects files use an extension of .o. Only # change it if the script calls AC_OBJEXT. ac_objext=o -# Factoring default headers for most tests. -dnl If ever you change this variable, please keep autoconf.texi in sync. -ac_includes_default="\ -#include -#include -#include -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#else -# if HAVE_STRINGS_H -# include -# endif -#endif -#if HAVE_INTTYPES_H -# include -#endif -#if HAVE_UNISTD_H -# include -#endif" + m4_divert_pop()dnl ])# _AC_INIT_DEFAULTS @@ -2264,60 +2235,54 @@ AC_DEFUN([AC_TRY_COMMAND], # macros. It is easier to document, to extend, and to understand than # having specific defaults for each macro. -# Of course, one would like to issue these default headers only if -# they were used, i.e.., AC_INCLUDES_DEFAULT was called, and the -# default `branch' was run. Unfortunately AC_INCLUDES_DEFAULT is -# called unquoted, so it is unsafe to try to divert from there. -# Therefore, the following *is* buggy, but this is the kind of -# tradeoff we accept in order to improve configure. - -# See _AC_INIT_PREPARE to see the value of `ac_includes_default'. +# _AC_INCLUDES_DEFAULT_REQUIREMENTS +# --------------------------------- +# Required when AC_INCLUDES_DEFAULT uses its default branch. +AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS], +[m4_divert_text([DEFAULTS], +[# Factoring default headers for most tests. +dnl If ever you change this variable, please keep autoconf.texi in sync. +ac_includes_default="\ +#include +#include +#include +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#else +# if HAVE_STRINGS_H +# include +# endif +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_UNISTD_H +# include +#endif" +])dnl +AC_REQUIRE([AC_HEADER_STDC])dnl +AC_CHECK_HEADERS(stdlib.h string.h memory.h strings.h inttypes.h unistd.h) +]) # AC_INCLUDES_DEFAULT([INCLUDES]) # ------------------------------- # If INCLUDES is empty, expand in default includes, otherwise in # INCLUDES. -# -# The end-of-line after `$[1]' below is meant, and it is actually -# because this new line is meant that we don't use m4_default. The -# problem is that this macro is used *unquoted* in AC_TRY_COMPILE -# etc. It is used unquoted because unfortunately (this is a real -# pain), AC_TRY_COMPILE is over quoting some of its arguments. This -# is a sad decision. -# -# Still, there are calls such as this -# -# AC_TRY_COMPILE(AC_INCLUDES_DEFAULT([#include ]), -# AC_BLAH_BLAH..) -# -# Because AC_INCLUDES_DEFAULT *has* to be unquoted, after evaluation, -# if there were no end of line, you'd get -# -# AC_TRY_COMPILE(#include , -# AC_BLAH_BLAH, -# AC_MORE_BLAH_BLAH) -# -# i.e. the first argument given to AC_TRY_COMPILE is -# -# #include , -# AC_BLAH_BLAH -# -# (note how the comma was swallowed because of the comment mark) and -# the second is -# -# AC_MORE_BLAH_BLAH -# -# so all the arguments are shifted. -# -# Because I don't see any backward compatible means to fix the -# brokenness of AC_TRY_COMPILE, we are doomed to leave a extra new -# line here. -m4_define([AC_INCLUDES_DEFAULT], -[m4_ifval([$1], [$1 -], - [$ac_includes_default])]) - +AC_DEFUN([AC_INCLUDES_DEFAULT], +[m4_default([$1], [AC_REQUIRE([_AC_INCLUDES_DEFAULT_REQUIREMENTS])dnl +$ac_includes_default])]) @@ -2338,7 +2303,6 @@ AC_DEFUN([AC_CHECK_MEMBER], [AC_FATAL([$0: requires literal arguments])])dnl m4_if(m4_regexp([$1], [\.]), -1, [AC_FATAL([$0: Did not see any dot in `$1'])])dnl -AC_REQUIRE([AC_HEADER_STDC])dnl AC_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl dnl Extract the aggregate name, and the member name AC_CACHE_CHECK([for $1], ac_Member, @@ -3231,8 +3195,7 @@ AC_DEFINE_UNQUOTED(AC_TR_CPP(sizeof_$1), $AC_TR_SH([ac_cv_sizeof_$1]), # variable, we just use a cast to avoid warnings from the compiler. # Suggested by Paul Eggert. m4_define([_AC_CHECK_TYPE_NEW], -[AC_REQUIRE([AC_HEADER_STDC])dnl -AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl +[AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl AC_CACHE_CHECK([for $1], ac_Type, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])], [if (($1 *) 0) diff --git a/tests/semantics.at b/tests/semantics.at index 6d4adf80..2273fe79 100644 --- a/tests/semantics.at +++ b/tests/semantics.at @@ -103,7 +103,13 @@ AC_CHECK_SIZEOF(ucharchar,, typedef unsigned char ucharchar[2];]]) AC_CHECK_SIZEOF(ucharcharchar)]], [AT_CHECK_DEFINES( -[#define SIZEOF_CHAR 1 +[#define HAVE_INTTYPES_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_UNISTD_H 1 +#define SIZEOF_CHAR 1 #define SIZEOF_CHARCHAR 2 #define SIZEOF_CHARCHARCHAR 0 #define SIZEOF_UCHARCHAR 2