changeset 9123:72496d26ba38

Fix the include_next test so that it rejects AIX 4.3 xlc.
author Bruno Haible <bruno@clisp.org>
date Wed, 25 Jul 2007 08:11:26 +0000
parents f547a45baada
children 770eea366530
files ChangeLog m4/include_next.m4
diffstat 2 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-07-25  Peter O'Gorman  <peter@pogma.com>
+            Bruno Haible  <bruno@clisp.org>
+
+	* m4/include_next.m4 (gl_INCLUDE_NEXT): Test whether #include_next
+	really works. Needed because AIX 4.3 "xlc -E" doesn't understand
+	#include_next, gives a diagnostic about it, but reports no error in
+	the exit code.
+	Reported by Gary V. Vaughan <gary@thewrittenword.com>.
+
 2007-07-24  Ben Pfaff  <blp@gnu.org>
 
 	Improve name: "count-one-bits" is better than "popcount".
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -1,4 +1,4 @@
-# include_next.m4 serial 3
+# include_next.m4 serial 4
 dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,9 +11,31 @@
   AC_LANG_PREPROC_REQUIRE()
   AC_CACHE_CHECK([whether the preprocessor supports include_next],
     [gl_cv_have_include_next],
-    [AC_PREPROC_IFELSE([#include_next <stddef.h>],
+    [rm -rf conftestd1 conftestd2
+     mkdir conftestd1 conftestd2
+     cat <<EOF > conftestd1/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
+EOF
+     cat <<EOF > conftestd2/conftest.h
+#ifndef DEFINED_IN_CONFTESTD1
+#error "include_next test doesn't work"
+#endif
+#define DEFINED_IN_CONFTESTD2
+EOF
+     save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2"
+     AC_COMPILE_IFELSE([#include <conftest.h>],
        [gl_cv_have_include_next=yes],
-       [gl_cv_have_include_next=no])])
+       [gl_cv_have_include_next=no])
+     CPPFLAGS="$save_CPPFLAGS"
+     rm -rf conftestd1 conftestd2
+    ])
   if test $gl_cv_have_include_next = yes; then
 
     dnl FIXME: Remove HAVE_INCLUDE_NEXT and update everything that uses it