Second attempt to work around an AIX 5.3, 6.1 compiler bug with include_next.
authorEric Blake <ebb9@byu.net>
Thu, 21 May 2009 14:48:12 +0000 (16:48 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 21 May 2009 14:48:12 +0000 (16:48 +0200)
ChangeLog
lib/math.in.h
m4/include_next.m4
modules/math

index 89a4882..857a52b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-05-21  Eric Blake  <ebb9@byu.net>
+            Bruno Haible  <bruno@clisp.org>
+
+       Second attempt to work around an AIX 5.3, 6.1 compiler bug with
+       include_next. Fix of 2008-11-20 commit.
+       * m4/include_next.m4 (gl_CHECK_NEXT_HEADERS): Also set
+       NEXT_AS_FIRST_DIRECTIVE_FOO_H.
+       * lib/math.in.h: Use NEXT_AS_FIRST_DIRECTIVE_MATH_H instead of
+       NEXT_MATH_H.
+       * modules/math (Makefile.am): Substitute NEXT_AS_FIRST_DIRECTIVE_MATH_H
+       instead of NEXT_MATH_H.
+
 2009-05-21  Bruno Haible  <bruno@clisp.org>
 
        Avoid redefinition warnings for SIZE_MAX.
index a0efefd..8d8cdc1 100644 (file)
@@ -22,7 +22,7 @@
 #endif
 
 /* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_MATH_H@
+#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
 
 #ifndef _GL_MATH_H
 #define _GL_MATH_H
index d6101fe..c31052f 100644 (file)
@@ -1,4 +1,4 @@
-# include_next.m4 serial 12
+# include_next.m4 serial 13
 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -104,8 +104,14 @@ EOF
 # For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
 # '<foo.h>'; otherwise define it to be
 # '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
+# Also, if #include_next works as first preprocessing directive in a file,
+# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
+# be
+# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
 # That way, a header file with the following line:
 #      #@INCLUDE_NEXT@ @NEXT_FOO_H@
+# or
+#      #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 # behaves (after sed substitution) as if it contained
 #      #include_next <foo.h>
 # even if the compiler does not support include_next.
@@ -167,5 +173,15 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
      AC_SUBST(
        AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
        [AS_VAR_GET([gl_next_header])])
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'gl_HEADER_NAME'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
+     fi
+     AC_SUBST(
+       AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
+       [$gl_next_as_first_directive])
      AS_VAR_POPDEF([gl_next_header])])
 ])
index 44163e0..039de46 100644 (file)
@@ -22,7 +22,7 @@ math.h: math.in.h
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''NEXT_MATH_H''@|$(NEXT_MATH_H)|g' \
+             -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
              -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \
              -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \
              -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \