--- /dev/null
+# -*- autoconf -*-
+
+cat <<EOF
+
+Low level compiling/preprocessing macros.
+
+EOF
+
+# Since the macros which compile are required by most tests, check
+# them first. But remember that looking for a compiler is even more
+# primitive, so check those first.
+
+
+## ------------ ##
+## C keywords. ##
+## ------------ ##
+
+# GCC supports `const', `volatile', and `inline'.
+AT_CHECK_MACRO([C keywords],
+[[AC_PROG_CC
+AC_C_CONST
+AC_C_INLINE
+AC_C_VOLATILE
+case "$GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile" in
+ yes,*no*)
+ AC_MSG_ERROR([failed to detect `const', `inline' or `volatile' support]);;
+esac]])
+
+
+
+## --------------------------- ##
+## AC_PROG_CPP with warnings. ##
+## --------------------------- ##
+
+
+# It's Ok for strict preprocessors to produce warnings.
+
+AT_SETUP([AC_PROG_CPP with warnings])
+
+AT_DATA([mycpp],
+[[#! /bin/sh
+echo noise >&2
+exec ${1+"$@"}
+]])
+
+chmod +x mycpp
+
+_AT_CHECK_AC_MACRO(
+[AC_PROG_CPP
+# If the preprocessor is not strict, just ignore
+test "x$ac_c_preproc_warn_flag" = xyes &&
+ AC_MSG_ERROR([preprocessor has no warning option], 77)
+CPP="./mycpp $CPP"
+AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
+
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_IO_H */
+#define HAVE_STDIO_H 1
+])
+
+AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl
+
+
+## ------------------------------ ##
+## AC_PROG_CPP without warnings. ##
+## ------------------------------ ##
+
+AT_SETUP([AC_PROG_CPP without warnings])
+
+AT_DATA([mycpp],
+[[#! /bin/sh
+/lib/cpp ${1+"$@"}
+exit 0
+]])
+
+chmod +x mycpp
+
+_AT_CHECK_AC_MACRO(
+[# Ignore if /lib/cpp doesn't work
+/lib/cpp </dev/null >/dev/null 2>&1 ||
+ AC_MSG_ERROR([preprocessor doesn't work], 77)
+CPP=./mycpp
+AC_PROG_CPP
+test "x$ac_c_preproc_warn_flag" != xyes &&
+ AC_MSG_ERROR([failed to detect preprocessor warning option])
+AC_CHECK_HEADERS(stdio.h autoconf_io.h)])
+
+AT_CHECK_DEFINES(
+[/* #undef HAVE_AUTOCONF_IO_H */
+#define HAVE_STDIO_H 1
+])
+
+AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl
+
+
+
+## ------------------ ##
+## AC_TRY_LINK_FUNC. ##
+## ------------------ ##
+
+AT_CHECK_MACRO([AC_TRY_LINK_FUNC],
+[AC_TRY_LINK_FUNC(exit,,
+ [AC_MSG_ERROR([cannot find `exit'])])
+AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this,
+ [AC_MSG_ERROR([found a nonexistent function])])])
])
AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl
-
-
-
-
-
-## ------------- ##
-## Base macros. ##
-## ------------- ##
-
-
-AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
-
-AT_DATA(configure.in,
-[[AC_INIT
-rm -rf header file link command
-touch header.in file.in link.in command.in
-case $what_to_test in
- header) AC_CONFIG_HEADERS(header:header.in);;
- file) AC_CONFIG_FILES(file:file.in);;
- command) AC_CONFIG_COMMANDS(command:command.in, [cp command.in command]);;
- link) AC_CONFIG_LINKS(link:link.in);;
-esac
-AC_OUTPUT
-]])
-
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
-
-# Create a header
-AT_CHECK([./configure what_to_test=header], 0, ignore)
-AT_CHECK([ls header file command link 2>/dev/null], [], [header
-])
-
-# Create a file
-AT_CHECK([./configure what_to_test=file], 0, ignore)
-AT_CHECK([ls header file command link 2>/dev/null], [], [file
-])
-
-# Execute a command
-AT_CHECK([./configure what_to_test=command], 0, ignore)
-AT_CHECK([ls header file command link 2>/dev/null], [], [command
-])
-
-# Create a link
-AT_CHECK([./configure what_to_test=link], 0, ignore)
-AT_CHECK([ls header file command link 2>/dev/null], [], [link
-])
-
-AT_CLEANUP(header file link command header.in file.in link.in command.in configure config.status)
-
-
-
-## ------------------------------------------------------ ##
-## Check that config.status detects missing input files. ##
-## ------------------------------------------------------ ##
-
-AT_SETUP([missing templates])
-
-AT_DATA(configure.in,
-[[AC_INIT
-AC_CONFIG_FILES([nonexistent])
-AC_OUTPUT
-]])
-
-AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([./configure], 1, ignore,
-[[config.status: error: cannot find input file `nonexistent.in'
-]])
-# Make sure that the output file doesn't exist
-AT_CHECK([test -f nonexistent], 1)
-
-AT_CLEANUP(configure config.status config.log config.cache config.h defs)
cat <<\EOF
-Torturing config.status.
+Testing config.status.
## ---------------------------------------------------------------- ##
## This section of torture tests is trying to make Autoconf produce ##
EOF
-dnl The value used as a big value for AC_DEFINE.
-dnl Don't use sh active chars here, below it is also used in a sh
-dnl assignment.
-define(Big_Value,
-[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
+## ---------------------------------------------- ##
+## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
+## ---------------------------------------------- ##
-define(DEFINE_Description,
-[Define to a long string if your `Autoconf' works properly.])
+AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
-# AT_DUMMY_VAR(NUMBER)
-# --------------------
-# Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
-# so that the check for user name space invasion does not complain
-# of the new variables defined.
-#
-# Note that you should not use the name ac_dummy, because it will be
-# turned into ac_uummy during the construction of config.status. Yes,
-# this is admittedly a bug, but it would be too hard to fix this.
-# There is really no point in AC_DEFINE a var named ac_d.*.
-define(AT_DUMMY_VAR,
-[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
+AT_DATA(configure.in,
+[[AC_INIT
+rm -rf header file link command
+touch header.in file.in link.in command.in
+case $what_to_test in
+ header) AC_CONFIG_HEADERS(header:header.in);;
+ file) AC_CONFIG_FILES(file:file.in);;
+ command) AC_CONFIG_COMMANDS(command:command.in, [cp command.in command]);;
+ link) AC_CONFIG_LINKS(link:link.in);;
+esac
+AC_OUTPUT
+]])
-dnl This call was quite delicate to write because we didn't want to
-dnl produce the 100 commands by hand. Be very careful if you want to
-dnl touch something.
+AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+# Create a header
+AT_CHECK([./configure what_to_test=header], 0, ignore)
+AT_CHECK([ls header file command link 2>/dev/null], [], [header
+])
+# Create a file
+AT_CHECK([./configure what_to_test=file], 0, ignore)
+AT_CHECK([ls header file command link 2>/dev/null], [], [file
+])
-## ------------------------- ##
-## Torturing config.status. ##
-## ------------------------- ##
+# Execute a command
+AT_CHECK([./configure what_to_test=command], 0, ignore)
+AT_CHECK([ls header file command link 2>/dev/null], [], [command
+])
-## Require 100 AC_DEFINE and AC_SUBST with a significantly big value.
-## This is mostly to check that Autoconf produces portable sed scripts
-## in config.status. sed is used to skip the first two lines
-## `Generated by...'.
+# Create a link
+AT_CHECK([./configure what_to_test=link], 0, ignore)
+AT_CHECK([ls header file command link 2>/dev/null], [], [link
+])
+
+AT_CLEANUP(header file link command header.in file.in link.in command.in configure config.status)
-AT_SETUP(config.status under extreme conditions)
-AT_DATA(dummy.in,
-[m4_for(AT_Count, 1, 100,
-[@AT_DUMMY_VAR(AT_Count)@
-])])
+
+## ------------------------------------------------------ ##
+## Check that config.status detects missing input files. ##
+## ------------------------------------------------------ ##
+
+AT_SETUP([missing templates])
AT_DATA(configure.in,
-[AC_INIT
-AC_CONFIG_HEADERS(config.h:config.hin)
-AC_CONFIG_FILES(dummy)
-[define]([AC_DEFUBST_VALUE], Big_Value)
-dnl The following 4 lines are a transfert from AT_DUMMY_VAR in Autotest
-dnl to AC_DUMMY_VAR in Autoconf.
-[define]([AC_DUMMY_VAR],
-changequote({{, }})dnl
-[defn({{AT_DUMMY_VAR}})]dnl
-changequote([, ]))
-m4_for(AT_Count, 1, 100,
-[AC_DEFUBST(AT_Count)
-])
+[[AC_INIT
+AC_CONFIG_FILES([nonexistent])
AC_OUTPUT
-])
-
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([../autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])
-AT_CHECK([./configure], 0, ignore)
+]])
-# Checking that AC_DEFINE worked properly.
-AT_DATA(expout,
-[m4_for(AT_Count, 1, 100,
-[
-/* DEFINE_Description */
-[#define] AT_DUMMY_VAR(AT_Count) "Big_Value"
-])])
-AT_CHECK([sed -n -e '3,$ p' config.h], 0, expout)
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK([./configure], 1, ignore,
+[[config.status: error: cannot find input file `nonexistent.in'
+]])
+# Make sure that the output file doesn't exist
+AT_CHECK([test -f nonexistent], 1)
-# Checking that AC_SUBST worked properly.
-AT_DATA(expout,
-[m4_for(AT_Count, 1, 100,
-[Big_Value
-])])
+AT_CLEANUP(configure config.status config.log config.cache config.h defs)
-AT_CLEANUP(dummy)
# (ii) correctly passes them to `config.status', which we check by
# running `config.status --recheck'.
-AT_SETUP(command line interface)
+AT_SETUP([command line interface])
AT_DATA(configure.in,
[[AC_INIT
AT_CHECK([sed -e 's/ $//' defs], 0, expout)
AT_CLEANUP(configure config.status config.log config.cache config.h defs)
+
+
+
+## ------------------------- ##
+## Torturing config.status. ##
+## ------------------------- ##
+
+## Require 100 AC_DEFINE and AC_SUBST with a significantly big value.
+## This is mostly to check that Autoconf produces portable sed scripts
+## in config.status. sed is used to skip the first two lines
+## `Generated by...'.
+
+dnl The value used as a big value for AC_DEFINE.
+dnl Don't use sh active chars here, below it is also used in a sh
+dnl assignment.
+define([Big_Value],
+[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
+
+define([DEFINE_Description],
+[Define to a long string if your `Autoconf' works properly.])
+
+
+# AT_DUMMY_VAR(NUMBER)
+# --------------------
+# Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
+# so that the check for user name space invasion does not complain
+# of the new variables defined.
+#
+# Note that you should not use the name ac_dummy, because it will be
+# turned into ac_uummy during the construction of config.status. Yes,
+# this is admittedly a bug, but it would be too hard to fix this.
+# There is really no point in AC_DEFINE a var named ac_d.*.
+define([AT_DUMMY_VAR],
+[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
+
+dnl This call was quite delicate to write because we didn't want to
+dnl produce the 100 commands by hand. Be very careful if you want to
+dnl touch something.
+
+
+AT_SETUP([Torturing config.status])
+
+AT_DATA(dummy.in,
+[m4_for(AT_Count, 1, 100,
+[@AT_DUMMY_VAR(AT_Count)@
+])])
+
+AT_DATA(configure.in,
+[AC_INIT
+AC_CONFIG_HEADERS(config.h:config.hin)
+AC_CONFIG_FILES(dummy)
+[define]([AC_DEFUBST_VALUE], Big_Value)
+dnl The following 4 lines are a transfert from AT_DUMMY_VAR in Autotest
+dnl to AC_DUMMY_VAR in Autoconf.
+[define]([AC_DUMMY_VAR],
+changequote({{, }})dnl
+[defn({{AT_DUMMY_VAR}})]dnl
+changequote([, ]))
+m4_for(AT_Count, 1, 100,
+[AC_DEFUBST(AT_Count)
+])
+AC_OUTPUT
+])
+
+AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK([../autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK([./configure], 0, ignore)
+
+# Checking that AC_DEFINE worked properly.
+AT_DATA(expout,
+[m4_for(AT_Count, 1, 100,
+[
+/* DEFINE_Description */
+[#define] AT_DUMMY_VAR(AT_Count) "Big_Value"
+])])
+AT_CHECK([sed -n -e '3,$ p' config.h], 0, expout)
+
+# Checking that AC_SUBST worked properly.
+AT_DATA(expout,
+[m4_for(AT_Count, 1, 100,
+[Big_Value
+])])
+
+AT_CLEANUP(dummy)