From: Akim Demaille Date: Fri, 11 May 2001 15:54:43 +0000 (+0000) Subject: * aclang.m4 (_AC_PROG_PREPROC_WORKS_IFELSE): No longer use the X-Git-Tag: autoconf-2.50~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5d0e4f28b1d058f5d43ee770897cb645cec4d9e;p=thirdparty%2Fautoconf.git * aclang.m4 (_AC_PROG_PREPROC_WORKS_IFELSE): No longer use the `maybe' strategy: first try cpp's exit status, then its stderr. (AC_PROG_CPP, AC_PROG_CXXCPP): Adjust. * tests/compile.at (AC_PROG_CPP via CC): Simplify mycc. Remove unrelated code. --- diff --git a/ChangeLog b/ChangeLog index 21e7eee3e..e95aa811a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-05-11 Akim Demaille + + * aclang.m4 (_AC_PROG_PREPROC_WORKS_IFELSE): No longer use the + `maybe' strategy: first try cpp's exit status, then its stderr. + (AC_PROG_CPP, AC_PROG_CXXCPP): Adjust. + * tests/compile.at (AC_PROG_CPP via CC): Simplify mycc. + Remove unrelated code. + 2001-05-10 Akim Demaille * tests/compile.at (AC_PROG_CPP via CC): New. diff --git a/aclang.m4 b/aclang.m4 index 7534144a5..2aa4e6e39 100644 --- a/aclang.m4 +++ b/aclang.m4 @@ -832,29 +832,32 @@ AC_DEFUN([AC_LANG_PREPROC(C)], # Set ac_cpp_err to a non-empty value if the preprocessor failed. # This macro is for all languages, not only C. AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE], -[# We don't know yet if stderr is the criterion (vs exit status). -ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe - -# Use a header file that comes with gcc, so configuring glibc -# with a fresh cross-compiler works. -# On the NeXT, cc -E runs the code through the compiler's parser, -# not just through cpp. "Syntax error" is here to catch this case. -_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include -Syntax error]])], -[# OK, works on sane cases. Now check whether non-existent headers can -# be detected and how. -_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], -[# Broken: cannot detect missing includes. -m4_default([$2], :)], -[# OK, detects failures. How? -if test "x$ac_cpp_err" = xmaybe; then - ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=yes -else - ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag= -fi -$1])], - [# Broken: fails on valid input. -m4_default([$2], :)])])# _AC_PROG_PREPROC_WORKS_IFELSE +[ac_preproc_ok=false +for ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include + Syntax error]])], + [], + [# Broken: fails on valid input. +continue]) + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], + [# Broken: success on invalid input. +continue], + [# Passes both tests. +ac_preproc_ok=: +break]) + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +AS_IF([$ac_preproc_ok], [$1], [$2])])# _AC_PROG_PREPROC_WORKS_IFELSE # AC_PROG_CPP @@ -878,7 +881,8 @@ if test -z "$CPP"; then # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do - _AC_PROG_PREPROC_WORKS_IFELSE([break]) + # break 2 since there is a loop in there. + _AC_PROG_PREPROC_WORKS_IFELSE([break 2]) done ac_cv_prog_CPP=$CPP ])dnl @@ -1085,7 +1089,8 @@ if test -z "$CXXCPP"; then # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do - _AC_PROG_PREPROC_WORKS_IFELSE([break]) + # break 2 since there is a loop in there. + _AC_PROG_PREPROC_WORKS_IFELSE([break 2]) done ac_cv_prog_CXXCPP=$CXXCPP ])dnl diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 7534144a5..2aa4e6e39 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -832,29 +832,32 @@ AC_DEFUN([AC_LANG_PREPROC(C)], # Set ac_cpp_err to a non-empty value if the preprocessor failed. # This macro is for all languages, not only C. AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE], -[# We don't know yet if stderr is the criterion (vs exit status). -ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe - -# Use a header file that comes with gcc, so configuring glibc -# with a fresh cross-compiler works. -# On the NeXT, cc -E runs the code through the compiler's parser, -# not just through cpp. "Syntax error" is here to catch this case. -_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include -Syntax error]])], -[# OK, works on sane cases. Now check whether non-existent headers can -# be detected and how. -_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], -[# Broken: cannot detect missing includes. -m4_default([$2], :)], -[# OK, detects failures. How? -if test "x$ac_cpp_err" = xmaybe; then - ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=yes -else - ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag= -fi -$1])], - [# Broken: fails on valid input. -m4_default([$2], :)])])# _AC_PROG_PREPROC_WORKS_IFELSE +[ac_preproc_ok=false +for ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include + Syntax error]])], + [], + [# Broken: fails on valid input. +continue]) + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], + [# Broken: success on invalid input. +continue], + [# Passes both tests. +ac_preproc_ok=: +break]) + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +AS_IF([$ac_preproc_ok], [$1], [$2])])# _AC_PROG_PREPROC_WORKS_IFELSE # AC_PROG_CPP @@ -878,7 +881,8 @@ if test -z "$CPP"; then # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do - _AC_PROG_PREPROC_WORKS_IFELSE([break]) + # break 2 since there is a loop in there. + _AC_PROG_PREPROC_WORKS_IFELSE([break 2]) done ac_cv_prog_CPP=$CPP ])dnl @@ -1085,7 +1089,8 @@ if test -z "$CXXCPP"; then # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do - _AC_PROG_PREPROC_WORKS_IFELSE([break]) + # break 2 since there is a loop in there. + _AC_PROG_PREPROC_WORKS_IFELSE([break 2]) done ac_cv_prog_CXXCPP=$CXXCPP ])dnl diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index 7534144a5..2aa4e6e39 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -832,29 +832,32 @@ AC_DEFUN([AC_LANG_PREPROC(C)], # Set ac_cpp_err to a non-empty value if the preprocessor failed. # This macro is for all languages, not only C. AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE], -[# We don't know yet if stderr is the criterion (vs exit status). -ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe - -# Use a header file that comes with gcc, so configuring glibc -# with a fresh cross-compiler works. -# On the NeXT, cc -E runs the code through the compiler's parser, -# not just through cpp. "Syntax error" is here to catch this case. -_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include -Syntax error]])], -[# OK, works on sane cases. Now check whether non-existent headers can -# be detected and how. -_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], -[# Broken: cannot detect missing includes. -m4_default([$2], :)], -[# OK, detects failures. How? -if test "x$ac_cpp_err" = xmaybe; then - ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=yes -else - ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag= -fi -$1])], - [# Broken: fails on valid input. -m4_default([$2], :)])])# _AC_PROG_PREPROC_WORKS_IFELSE +[ac_preproc_ok=false +for ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include + Syntax error]])], + [], + [# Broken: fails on valid input. +continue]) + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], + [# Broken: success on invalid input. +continue], + [# Passes both tests. +ac_preproc_ok=: +break]) + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +AS_IF([$ac_preproc_ok], [$1], [$2])])# _AC_PROG_PREPROC_WORKS_IFELSE # AC_PROG_CPP @@ -878,7 +881,8 @@ if test -z "$CPP"; then # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do - _AC_PROG_PREPROC_WORKS_IFELSE([break]) + # break 2 since there is a loop in there. + _AC_PROG_PREPROC_WORKS_IFELSE([break 2]) done ac_cv_prog_CPP=$CPP ])dnl @@ -1085,7 +1089,8 @@ if test -z "$CXXCPP"; then # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do - _AC_PROG_PREPROC_WORKS_IFELSE([break]) + # break 2 since there is a loop in there. + _AC_PROG_PREPROC_WORKS_IFELSE([break 2]) done ac_cv_prog_CXXCPP=$CXXCPP ])dnl diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4 index 7534144a5..2aa4e6e39 100644 --- a/lib/autoconf/lang.m4 +++ b/lib/autoconf/lang.m4 @@ -832,29 +832,32 @@ AC_DEFUN([AC_LANG_PREPROC(C)], # Set ac_cpp_err to a non-empty value if the preprocessor failed. # This macro is for all languages, not only C. AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE], -[# We don't know yet if stderr is the criterion (vs exit status). -ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe - -# Use a header file that comes with gcc, so configuring glibc -# with a fresh cross-compiler works. -# On the NeXT, cc -E runs the code through the compiler's parser, -# not just through cpp. "Syntax error" is here to catch this case. -_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include -Syntax error]])], -[# OK, works on sane cases. Now check whether non-existent headers can -# be detected and how. -_AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], -[# Broken: cannot detect missing includes. -m4_default([$2], :)], -[# OK, detects failures. How? -if test "x$ac_cpp_err" = xmaybe; then - ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag=yes -else - ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag= -fi -$1])], - [# Broken: fails on valid input. -m4_default([$2], :)])])# _AC_PROG_PREPROC_WORKS_IFELSE +[ac_preproc_ok=false +for ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include + Syntax error]])], + [], + [# Broken: fails on valid input. +continue]) + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include ]])], + [# Broken: success on invalid input. +continue], + [# Passes both tests. +ac_preproc_ok=: +break]) + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +AS_IF([$ac_preproc_ok], [$1], [$2])])# _AC_PROG_PREPROC_WORKS_IFELSE # AC_PROG_CPP @@ -878,7 +881,8 @@ if test -z "$CPP"; then # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do - _AC_PROG_PREPROC_WORKS_IFELSE([break]) + # break 2 since there is a loop in there. + _AC_PROG_PREPROC_WORKS_IFELSE([break 2]) done ac_cv_prog_CPP=$CPP ])dnl @@ -1085,7 +1089,8 @@ if test -z "$CXXCPP"; then # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do - _AC_PROG_PREPROC_WORKS_IFELSE([break]) + # break 2 since there is a loop in there. + _AC_PROG_PREPROC_WORKS_IFELSE([break 2]) done ac_cv_prog_CXXCPP=$CXXCPP ])dnl diff --git a/tests/compile.at b/tests/compile.at index 234f78f9b..64b4b8f10 100644 --- a/tests/compile.at +++ b/tests/compile.at @@ -171,6 +171,7 @@ AT_SETUP([AC_PROG_CPP without warnings]) # Ignore if /lib/cpp doesn't work AT_CHECK([/lib/cpp &2 if test "$1" != "-E"; then exec cc $* +elif test "$2" = "-traditional-cpp"; then + exec cc $* else - if test "$2" = "-traditional-cpp"; then - exec cc $* - else - exec /lib/cpp ${1+"$@"} - fi + exec /lib/cpp ${1+"$@"} fi ]]) chmod +x mycc +# We go through the following contortions, in order to have the +# configure script go down the same codepaths as it would during a +# normal CPP selection check. If we explicitly set CPP, it goes down +# a different codepath. _AT_CHECK_AC_MACRO( -[[# We go through the following contortions, in order to -# have the configure script go down the same codepaths -# as it would during a normal CPP selection check. If -# we explicitly set CPP, it goes down a different codepath. -CC=mycc +[[CC=./mycc AC_PROG_CPP # The test $CC compiler should have been selected. -test "$CPP" != "mycc -E" && +test "$CPP" != "$CC -E" && AC_MSG_ERROR([error messages on stderr cause the preprocessor selection to fail]) -# 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) + +# Exercise CPP. AC_CHECK_HEADERS(stdio.h autoconf_io.h)]]) AT_CHECK_DEFINES(