X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=m4%2Finclude_next.m4;h=a842e2a23682bd0bea8a73ea22b58533c33ad97c;hb=48e27cbb6cc9e12006de6edfcafa69aafedadc85;hp=4dc84c958c7b4e0149c034a1a6ae313514f18871;hpb=e52fa80b73cf84d7e5472aeb43ead4e25dbd5989;p=gnulib.git diff --git a/m4/include_next.m4 b/m4/include_next.m4 index 4dc84c958..a842e2a23 100644 --- a/m4/include_next.m4 +++ b/m4/include_next.m4 @@ -1,5 +1,5 @@ -# include_next.m4 serial 3 -dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc. +# include_next.m4 serial 6 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,9 +11,31 @@ AC_DEFUN([gl_INCLUDE_NEXT], AC_LANG_PREPROC_REQUIRE() AC_CACHE_CHECK([whether the preprocessor supports include_next], [gl_cv_have_include_next], - [AC_PREPROC_IFELSE([#include_next ], + [rm -rf conftestd1 conftestd2 + mkdir conftestd1 conftestd2 + cat < conftestd1/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < 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 ], [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 @@ -41,12 +63,15 @@ AC_DEFUN([gl_INCLUDE_NEXT], # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". # Use `""', not `<>', so that the /// cannot be confused with a C99 comment. +# Note: This macro assumes that the header file is not empty after +# preprocessing, i.e. it does not only define preprocessor macros but also +# provides some type/enum definitions or function/variable declarations. AC_DEFUN([gl_CHECK_NEXT_HEADERS], [ AC_REQUIRE([gl_INCLUDE_NEXT]) AC_CHECK_HEADERS_ONCE([$1]) - AC_FOREACH([gl_HEADER_NAME], [$1], + m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME]))) if test $gl_cv_have_include_next = yes; then