From: Akim Demaille Date: Tue, 19 Sep 2000 10:37:57 +0000 (+0000) Subject: * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): New macro. X-Git-Tag: autoconf-2.50~627 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a096ddee16bde114d4be99f42ec69dd7a6ce9c1d;p=thirdparty%2Fautoconf.git * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): New macro. (AT_TEST_MACRO): Use it. * tests/semantics.m4 (AC_PROG_CPP with warnings, AC_PROG_CPP without warnings): New tests. --- diff --git a/ChangeLog b/ChangeLog index f5eae4303..5e115f44c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-09-19 Pavel Roskin + + * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): New macro. + (AT_TEST_MACRO): Use it. + * tests/semantics.m4 (AC_PROG_CPP with warnings, AC_PROG_CPP + without warnings): New tests. + 2000-09-18 RĂ¼diger Kuhlmann * acgeneral.m4 (_AC_OUTPUT_SUBDIRS): Check for configure.gnu diff --git a/tests/atspecific.m4 b/tests/atspecific.m4 index 0e714f11f..81194808d 100644 --- a/tests/atspecific.m4 +++ b/tests/atspecific.m4 @@ -71,24 +71,21 @@ define(_m4_foreach, ## ---------------------------------------- ## - -# AT_TEST_MACRO(NAME-OF-THE-MACRO, [MACRO-USE], [ADDITIONAL-CMDS]) -# ---------------------------------------------------------------- +# _AT_CHECK_AC_MACRO(AC-BODY) +# --------------------------- # Create a minimalist configure.in running the macro named # NAME-OF-THE-MACRO, check that autoconf runs on that script, # and that the shell runs correctly the configure. # TOP_SRCDIR is needed to set the auxdir (some macros need `install-sh', # `config.guess' etc.). -AT_DEFINE(AT_TEST_MACRO, -[AT_SETUP([$1]) - -dnl Produce the configure.in -AT_DATA(configure.in, +AT_DEFINE([_AT_CHECK_AC_MACRO], +[dnl Produce the configure.in +AT_DATA([configure.in], [AC_INIT AC_CONFIG_AUX_DIR($top_srcdir) AC_CONFIG_HEADER(config.h:config.hin) AC_ENV_SAVE(expout) -ifelse([$2],,[$1], [$2]) +$1 AC_ENV_SAVE(env-after) AC_OUTPUT ]) @@ -97,8 +94,8 @@ dnl FIXME: Here we just don't consider the stderr from Autoconf. dnl Maybe some day we could be more precise and filter out warnings. dnl The problem is that currently some warnings are spread on several dnl lines, so grepping -v warning is not enough. -AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0,, ignore) -AT_CHECK([../autoheader --autoconf-dir .. -l $at_srcdir], 0,, ignore) +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0,, ignore) +AT_CHECK([autoheader --autoconf-dir .. -l $at_srcdir], 0,, ignore) AT_CHECK([top_srcdir=$top_srcdir ./configure], 0, ignore, ignore) test -n "$at_verbose" && echo "--- config.log" && cat config.log @@ -107,9 +104,23 @@ dnl which case `env-after' is probably missing. Don't check it then. if test -f env-after; then AT_CHECK([cat env-after], 0, expout) fi +])# _AT_CHECK_AC_MACRO + + +# AT_TEST_MACRO(NAME-OF-THE-MACRO, [MACRO-USE], [ADDITIONAL-CMDS]) +# ---------------------------------------------------------------- +# Create a minimalist configure.in running the macro named +# NAME-OF-THE-MACRO, check that autoconf runs on that script, +# and that the shell runs correctly the configure. +# TOP_SRCDIR is needed to set the auxdir (some macros need `install-sh', +# `config.guess' etc.). +AT_DEFINE([AT_TEST_MACRO], +[AT_SETUP([$1]) + +_AT_CHECK_AC_MACRO([ifelse([$2],,[$1], [$2])]) $3 AT_CLEANUP(configure config.status config.log config.cache config.hin config.h env-after)dnl -])dnl AT_TEST_MACRO +])# AT_TEST_MACRO @@ -121,6 +132,6 @@ AT_CLEANUP(configure config.status config.log config.cache config.hin config.h e # but those of automatically checked features (STDC_HEADERS etc.). # AT_CHECK_HEADER is a better name, but too close from AC_CHECK_HEADER. AT_DEFINE(AT_CHECK_DEFINES, -[AT_CHECK([fgrep '#' config.h | grep -v 'STDC_HEADERS'],, [$1])]) +[AT_CHECK([[fgrep '#' config.h | grep -v 'STDC_HEADERS']],, [$1])]) divert(0)dnl diff --git a/tests/semantics.m4 b/tests/semantics.m4 index 497dce6bc..0d783bb78 100644 --- a/tests/semantics.m4 +++ b/tests/semantics.m4 @@ -309,6 +309,69 @@ case "$GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile" in esac]]) +## ------------- ## +## AC_PROG_CPP. ## +## ------------- ## + + +# It's Ok for strict preprocessors to produce warnings. + +AT_SETUP([AC_PROG_CPP with warnings]) + +AT_DATA([mycpp], +[[#! /bin/sh +${1+"$@"} +err_code=$? +echo noise >&2 +exit $err_code +]]) + +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 && exit 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 + + +# Non-strict preprocessors work if they produce no 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 2>&1 || exit 77 +CPP=./mycpp +AC_PROG_CPP +test "x$ac_c_preproc_warn_flag" != xyes && exit 1 +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 + + + ## ------------- ##