]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* aclang.m4 (_AC_PROG_PREPROC_WORKS_IFELSE): No longer use the
authorAkim Demaille <akim@epita.fr>
Fri, 11 May 2001 15:54:43 +0000 (15:54 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 11 May 2001 15:54:43 +0000 (15:54 +0000)
`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.

ChangeLog
aclang.m4
lib/autoconf/c.m4
lib/autoconf/fortran.m4
lib/autoconf/lang.m4
tests/compile.at

index 21e7eee3ee1287308773877d34bb96dc534df58c..e95aa811a08347522a4018d536d71c272eaf9c1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-05-11  Akim Demaille  <akim@epita.fr>
+
+       * 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  <akim@epita.fr>
 
        * tests/compile.at (AC_PROG_CPP via CC): New.
index 7534144a57584ddfbe87cf40d45f12dc327b55eb..2aa4e6e396debb5778500b2f65b272a21cdb556f 100644 (file)
--- 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 <assert.h>
-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 <ac_nonexistent.h>]])],
-[# 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 <assert.h>
+                     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 <ac_nonexistent.h>]])],
+                     [# 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
index 7534144a57584ddfbe87cf40d45f12dc327b55eb..2aa4e6e396debb5778500b2f65b272a21cdb556f 100644 (file)
@@ -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 <assert.h>
-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 <ac_nonexistent.h>]])],
-[# 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 <assert.h>
+                     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 <ac_nonexistent.h>]])],
+                     [# 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
index 7534144a57584ddfbe87cf40d45f12dc327b55eb..2aa4e6e396debb5778500b2f65b272a21cdb556f 100644 (file)
@@ -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 <assert.h>
-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 <ac_nonexistent.h>]])],
-[# 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 <assert.h>
+                     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 <ac_nonexistent.h>]])],
+                     [# 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
index 7534144a57584ddfbe87cf40d45f12dc327b55eb..2aa4e6e396debb5778500b2f65b272a21cdb556f 100644 (file)
@@ -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 <assert.h>
-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 <ac_nonexistent.h>]])],
-[# 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 <assert.h>
+                     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 <ac_nonexistent.h>]])],
+                     [# 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
index 234f78f9ba470c73902b7374d3950c3743d5966e..64b4b8f10b255777c70db44a303033a6f7b6da66 100644 (file)
@@ -171,6 +171,7 @@ AT_SETUP([AC_PROG_CPP without warnings])
 # Ignore if /lib/cpp doesn't work
 AT_CHECK([/lib/cpp </dev/null || exit 77], [], [ignore], [ignore])
 
+# A cpp which exit status is meaningless.
 AT_DATA([mycpp],
 [[#! /bin/sh
 /lib/cpp ${1+"$@"}
@@ -212,30 +213,27 @@ AT_DATA([mycc],
 echo "Annoying copyright message" >&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(