]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* aclang.m4 (_AC_PROG_PREPROC_WORKS): Rename and extend as...
authorAkim Demaille <akim@epita.fr>
Fri, 27 Apr 2001 10:35:22 +0000 (10:35 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 27 Apr 2001 10:35:22 +0000 (10:35 +0000)
(_AC_PROG_PREPROC_WORKS_IFELSE): this.
Adjust to admit
(AC_PROG_CPP, AC_PROG_CXXCPP): Use it.
Reported by Daniel Carroll.

ChangeLog
acgeneral.m4
aclang.m4
lib/autoconf/c.m4
lib/autoconf/fortran.m4
lib/autoconf/general.m4
lib/autoconf/lang.m4

index b30de21a6afdcf98a68041302083cb364a633df7..0860f71374e5c3d11641e8d41577b55ef8e73daf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-04-27  Akim Demaille  <akim@epita.fr>
+
+       * aclang.m4 (_AC_PROG_PREPROC_WORKS): Rename and extend as...
+       (_AC_PROG_PREPROC_WORKS_IFELSE): this.
+       Adjust to admit
+       (AC_PROG_CPP, AC_PROG_CXXCPP): Use it.
+       Reported by Daniel Carroll.
+
 2001-04-26  Pavel Roskin  <proski@gnu.org>
 
        * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Use two backslashes
index 15e74203f02d8cc377640c880995c5b91dbea724..6c5396709c33065bf44714aa25a7d0a7cc7f9a20 100644 (file)
@@ -2715,12 +2715,11 @@ m4_popdef([AC_Lib_Name])dnl
 # ----------------------------------------------------------------
 # Try to preprocess PROGRAM.
 #
+# This macro can be used during the selection of a preprocessor.
 # Run cpp and set ac_cpp_err to "yes" for an error, to
 # "$ac_(c,cxx)_preproc_warn_flag" if there are warnings or to "" if
 # neither warnings nor errors have been detected.  eval is necessary
 # to expand ac_cpp.
-#
-# This macro can be used during the selection of a preprocessor.
 AC_DEFUN([_AC_PREPROC_IFELSE],
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
 if _AC_EVAL_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null; then
index 3d7464dc71bc7b160c423ed7d7709841fcdaa08f..6789dbc3fa31aefe57ac2f53cf2c88e96d80c020 100644 (file)
--- a/aclang.m4
+++ b/aclang.m4
@@ -804,33 +804,36 @@ AC_DEFUN([AC_LANG_PREPROC(C)],
 [AC_REQUIRE([AC_PROG_CPP])])
 
 
-# _AC_PROG_PREPROC_WORKS
-# ----------------------
+# _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT)
+# -----------------------------------------------
 # Check if $ac_cpp is a working preprocessor that can flag absent
-# includes either by the exit status or by warnings
-# 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],
-[# Use a header file that comes with gcc, so configuring glibc
+# includes either by the exit status or by warnings.
+# 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_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe
 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <assert.h>
 Syntax error]])],
-[# Now check whether non-existent headers can be detected and how
-# Skip if ac_cpp_err is not empty - ac_cpp is broken
-if test -z "$ac_cpp_err"; then
-  _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])],
-  [# cannot detect missing includes at all
-ac_cpp_err=yes],
-  [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
-    ac_cpp_err=])
-fi])])# _AC_PROG_PREPROC_WORKS
+[# 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_PROG_CPP
@@ -856,22 +859,17 @@ 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
-      if test -z "$ac_cpp_err"; then
-        break
-      fi
+      _AC_PROG_PREPROC_WORKS_IFELSE([break])
     done
     ac_cv_prog_CPP=$CPP
   ])dnl
   CPP=$ac_cv_prog_CPP
 else
-  _AC_PROG_PREPROC_WORKS
   ac_cv_prog_CPP=$CPP
 fi
 AC_MSG_RESULT([$CPP])
-if test -n "$ac_cpp_err"; then
-  AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+                    [AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])])
 AC_SUBST(CPP)dnl
 AC_LANG_POP(C)dnl
 ])# AC_PROG_CPP
@@ -1071,22 +1069,17 @@ 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()
-      if test -z "$ac_cpp_err"; then
-        break
-      fi
+      _AC_PROG_PREPROC_WORKS_IFELSE([break])
     done
     ac_cv_prog_CXXCPP=$CXXCPP
   ])dnl
   CXXCPP=$ac_cv_prog_CXXCPP
 else
-  _AC_PROG_PREPROC_WORKS()
   ac_cv_prog_CXXCPP=$CXXCPP
 fi
 AC_MSG_RESULT([$CXXCPP])
-if test -n "$ac_cpp_err"; then
-  AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+              [AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])])
 AC_SUBST(CXXCPP)dnl
 AC_LANG_POP(C++)dnl
 ])# AC_PROG_CXXCPP
index 3d7464dc71bc7b160c423ed7d7709841fcdaa08f..6789dbc3fa31aefe57ac2f53cf2c88e96d80c020 100644 (file)
@@ -804,33 +804,36 @@ AC_DEFUN([AC_LANG_PREPROC(C)],
 [AC_REQUIRE([AC_PROG_CPP])])
 
 
-# _AC_PROG_PREPROC_WORKS
-# ----------------------
+# _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT)
+# -----------------------------------------------
 # Check if $ac_cpp is a working preprocessor that can flag absent
-# includes either by the exit status or by warnings
-# 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],
-[# Use a header file that comes with gcc, so configuring glibc
+# includes either by the exit status or by warnings.
+# 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_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe
 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <assert.h>
 Syntax error]])],
-[# Now check whether non-existent headers can be detected and how
-# Skip if ac_cpp_err is not empty - ac_cpp is broken
-if test -z "$ac_cpp_err"; then
-  _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])],
-  [# cannot detect missing includes at all
-ac_cpp_err=yes],
-  [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
-    ac_cpp_err=])
-fi])])# _AC_PROG_PREPROC_WORKS
+[# 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_PROG_CPP
@@ -856,22 +859,17 @@ 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
-      if test -z "$ac_cpp_err"; then
-        break
-      fi
+      _AC_PROG_PREPROC_WORKS_IFELSE([break])
     done
     ac_cv_prog_CPP=$CPP
   ])dnl
   CPP=$ac_cv_prog_CPP
 else
-  _AC_PROG_PREPROC_WORKS
   ac_cv_prog_CPP=$CPP
 fi
 AC_MSG_RESULT([$CPP])
-if test -n "$ac_cpp_err"; then
-  AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+                    [AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])])
 AC_SUBST(CPP)dnl
 AC_LANG_POP(C)dnl
 ])# AC_PROG_CPP
@@ -1071,22 +1069,17 @@ 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()
-      if test -z "$ac_cpp_err"; then
-        break
-      fi
+      _AC_PROG_PREPROC_WORKS_IFELSE([break])
     done
     ac_cv_prog_CXXCPP=$CXXCPP
   ])dnl
   CXXCPP=$ac_cv_prog_CXXCPP
 else
-  _AC_PROG_PREPROC_WORKS()
   ac_cv_prog_CXXCPP=$CXXCPP
 fi
 AC_MSG_RESULT([$CXXCPP])
-if test -n "$ac_cpp_err"; then
-  AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+              [AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])])
 AC_SUBST(CXXCPP)dnl
 AC_LANG_POP(C++)dnl
 ])# AC_PROG_CXXCPP
index 3d7464dc71bc7b160c423ed7d7709841fcdaa08f..6789dbc3fa31aefe57ac2f53cf2c88e96d80c020 100644 (file)
@@ -804,33 +804,36 @@ AC_DEFUN([AC_LANG_PREPROC(C)],
 [AC_REQUIRE([AC_PROG_CPP])])
 
 
-# _AC_PROG_PREPROC_WORKS
-# ----------------------
+# _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT)
+# -----------------------------------------------
 # Check if $ac_cpp is a working preprocessor that can flag absent
-# includes either by the exit status or by warnings
-# 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],
-[# Use a header file that comes with gcc, so configuring glibc
+# includes either by the exit status or by warnings.
+# 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_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe
 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <assert.h>
 Syntax error]])],
-[# Now check whether non-existent headers can be detected and how
-# Skip if ac_cpp_err is not empty - ac_cpp is broken
-if test -z "$ac_cpp_err"; then
-  _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])],
-  [# cannot detect missing includes at all
-ac_cpp_err=yes],
-  [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
-    ac_cpp_err=])
-fi])])# _AC_PROG_PREPROC_WORKS
+[# 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_PROG_CPP
@@ -856,22 +859,17 @@ 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
-      if test -z "$ac_cpp_err"; then
-        break
-      fi
+      _AC_PROG_PREPROC_WORKS_IFELSE([break])
     done
     ac_cv_prog_CPP=$CPP
   ])dnl
   CPP=$ac_cv_prog_CPP
 else
-  _AC_PROG_PREPROC_WORKS
   ac_cv_prog_CPP=$CPP
 fi
 AC_MSG_RESULT([$CPP])
-if test -n "$ac_cpp_err"; then
-  AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+                    [AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])])
 AC_SUBST(CPP)dnl
 AC_LANG_POP(C)dnl
 ])# AC_PROG_CPP
@@ -1071,22 +1069,17 @@ 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()
-      if test -z "$ac_cpp_err"; then
-        break
-      fi
+      _AC_PROG_PREPROC_WORKS_IFELSE([break])
     done
     ac_cv_prog_CXXCPP=$CXXCPP
   ])dnl
   CXXCPP=$ac_cv_prog_CXXCPP
 else
-  _AC_PROG_PREPROC_WORKS()
   ac_cv_prog_CXXCPP=$CXXCPP
 fi
 AC_MSG_RESULT([$CXXCPP])
-if test -n "$ac_cpp_err"; then
-  AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+              [AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])])
 AC_SUBST(CXXCPP)dnl
 AC_LANG_POP(C++)dnl
 ])# AC_PROG_CXXCPP
index 15e74203f02d8cc377640c880995c5b91dbea724..6c5396709c33065bf44714aa25a7d0a7cc7f9a20 100644 (file)
@@ -2715,12 +2715,11 @@ m4_popdef([AC_Lib_Name])dnl
 # ----------------------------------------------------------------
 # Try to preprocess PROGRAM.
 #
+# This macro can be used during the selection of a preprocessor.
 # Run cpp and set ac_cpp_err to "yes" for an error, to
 # "$ac_(c,cxx)_preproc_warn_flag" if there are warnings or to "" if
 # neither warnings nor errors have been detected.  eval is necessary
 # to expand ac_cpp.
-#
-# This macro can be used during the selection of a preprocessor.
 AC_DEFUN([_AC_PREPROC_IFELSE],
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
 if _AC_EVAL_STDERR([$ac_cpp conftest.$ac_ext]) >/dev/null; then
index 3d7464dc71bc7b160c423ed7d7709841fcdaa08f..6789dbc3fa31aefe57ac2f53cf2c88e96d80c020 100644 (file)
@@ -804,33 +804,36 @@ AC_DEFUN([AC_LANG_PREPROC(C)],
 [AC_REQUIRE([AC_PROG_CPP])])
 
 
-# _AC_PROG_PREPROC_WORKS
-# ----------------------
+# _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT)
+# -----------------------------------------------
 # Check if $ac_cpp is a working preprocessor that can flag absent
-# includes either by the exit status or by warnings
-# 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],
-[# Use a header file that comes with gcc, so configuring glibc
+# includes either by the exit status or by warnings.
+# 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_[]_AC_LANG_ABBREV[]_preproc_warn_flag=maybe
 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <assert.h>
 Syntax error]])],
-[# Now check whether non-existent headers can be detected and how
-# Skip if ac_cpp_err is not empty - ac_cpp is broken
-if test -z "$ac_cpp_err"; then
-  _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])],
-  [# cannot detect missing includes at all
-ac_cpp_err=yes],
-  [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
-    ac_cpp_err=])
-fi])])# _AC_PROG_PREPROC_WORKS
+[# 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_PROG_CPP
@@ -856,22 +859,17 @@ 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
-      if test -z "$ac_cpp_err"; then
-        break
-      fi
+      _AC_PROG_PREPROC_WORKS_IFELSE([break])
     done
     ac_cv_prog_CPP=$CPP
   ])dnl
   CPP=$ac_cv_prog_CPP
 else
-  _AC_PROG_PREPROC_WORKS
   ac_cv_prog_CPP=$CPP
 fi
 AC_MSG_RESULT([$CPP])
-if test -n "$ac_cpp_err"; then
-  AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+                    [AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])])
 AC_SUBST(CPP)dnl
 AC_LANG_POP(C)dnl
 ])# AC_PROG_CPP
@@ -1071,22 +1069,17 @@ 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()
-      if test -z "$ac_cpp_err"; then
-        break
-      fi
+      _AC_PROG_PREPROC_WORKS_IFELSE([break])
     done
     ac_cv_prog_CXXCPP=$CXXCPP
   ])dnl
   CXXCPP=$ac_cv_prog_CXXCPP
 else
-  _AC_PROG_PREPROC_WORKS()
   ac_cv_prog_CXXCPP=$CXXCPP
 fi
 AC_MSG_RESULT([$CXXCPP])
-if test -n "$ac_cpp_err"; then
-  AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
-fi
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+              [AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])])
 AC_SUBST(CXXCPP)dnl
 AC_LANG_POP(C++)dnl
 ])# AC_PROG_CXXCPP