# Sanitize the environment used for tests.
AT_PREPARE_TESTS(
-[# These variables should not be inherited from the
-# parent environment.
-AS_UNSET([CONFIG_SITE])
+[# MAKEFLAGS should not be inherited from the parent environment.
AS_UNSET([MAKEFLAGS])
+# We do not want to read any external config.site file.
+# If CONFIG_SITE is not set, autoconf will look for config.site in
+# $prefix/share and $prefix/etc.
+AS_IF([test -e nonexistent],
+ [AS_ERROR([something named 'nonexistent' exists in the test directory])])
+CONFIG_SITE=`pwd`/nonexistent/config.site
+export CONFIG_SITE
+
# Ensure MAKE is set to a useful value. Unlike the above, we *do*
# want to inherit this variable from the parent environment and/or
# our command line.
# - ac_cv_env_(any of the above)_(set|value)
# - ac_cv_c_compiler_gnu, ac_cv_cxx_compiler_gnu
# - ac_cv_c_decl_report, ac_cv_cxx_decl_report
-# - ac_cv_prog_c_*, ac_cv_prog_cxx_*, ac_cv_prog_ac_ct_(CC|CXX)
-# - ac_cv_prog_CPP, ac_cv_prog_CXXCPP
+# - ac_cv_prog_c_*, ac_cv_prog_cxx_*,
+# - ac_cv_prog_(ac_ct_)?(CC|CXX|CPP|CXXCPP)
# + other ac_cv_c_* are renamed to ac_cv_cxx_*
# + OPENMP_CFLAGS is renamed to OPENMP_CXXFLAGS
# vary:NAME (where NAME is any identifier): ignore ac_cv_NAME
/^ac_cv_env_CXXFLAGS_value=/ d
/^ac_cv_env_GXX_set=/ d
/^ac_cv_env_GXX_value=/ d
- /^ac_cv_prog_ac_ct_CC=/ d
- /^ac_cv_prog_ac_ct_CXX=/ d
+ /^ac_cv_prog_CC=/ d
+ /^ac_cv_prog_CXX=/ d
/^ac_cv_prog_CPP=/ d
/^ac_cv_prog_CXXCPP=/ d
+ /^ac_cv_prog_ac_ct_CC=/ d
+ /^ac_cv_prog_ac_ct_CXX=/ d
+ /^ac_cv_prog_ac_ct_CPP=/ d
+ /^ac_cv_prog_ac_ct_CXXCPP=/ d
/^ac_cv_c_compiler_gnu=/ d
/^ac_cv_cxx_compiler_gnu=/ d
/^ac_cv_c_decl_report=/ d
])
# AT_CHECK_MACRO(MACRO, [MACRO-USE], [ADDITIONAL-CMDS],
-# [AUTOCONF-FLAGS], [TEST-PARAMETERS])
+# [AUTOCONF-FLAGS], [TEST-PARAMETERS], [PRETEST-CMDS])
# -----------------------------------------------------
# Create a minimalist configure.ac running the macro named MACRO
# (using the code in MACRO-USE if that argument is not empty,
# If ADDITIONAL-CMDS are present, they are executed after the first
# pair of tests (with the C compiler, in native mode).
#
+# If PRETEST-CMDS are present, they are executed immediately after
+# AT_SETUP; use this if the test needs to be skipped conditionally,
+# for example.
+#
# If TEST-PARAMETERS are present, they should be a space-separated
# list of modifiers to how the test is carried out. Currently
# the following modifiers are defined:
# may legitimately vary between the C tests and the C++ tests.
m4_define([AT_CHECK_MACRO],
[AT_SETUP([$1])
+m4_n([$6])dnl
# C compiler, native mode.
AT_CONFIGURE_AC([m4_default([$2], [$1])])
# their paces as much as the autogenerated AT_CHECK_MACRO invocation
# used to, back when AC_PROG_LEX took no arguments.
-AT_CHECK_MACRO([AC_PROG_LEX with yywrap], [AC_PROG_LEX([yywrap])])
AT_CHECK_MACRO([AC_PROG_LEX with noyywrap], [AC_PROG_LEX([noyywrap])])
+AT_CHECK_MACRO([AC_PROG_LEX with yywrap], [AC_PROG_LEX([yywrap])],
+ [], [], [],
+[# Skip this test on OSes where there is no -ll nor -lfl.
+
+AT_DATA([configure.ac],
+[[AC_INIT([lexlib-probe], [1])
+AC_PROG_CC
+AC_SEARCH_LIBS([yywrap], [l fl], [], [AS_EXIT(77)])
+AC_OUTPUT
+]])
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+])
+
+
AT_SETUP([AC_PROG_LEX in legacy mode])
AT_CONFIGURE_AC([[AC_PROG_LEX]])