libvirt/gnulib/m4/include_next.m4
Jim Meyering 130426c659 update from gnulib
* gnulib/lib/inet_ntop.h: Remove file.
* gnulib/m4/onceonly_2_57.m4: Remove file.
* build-aux/useless-if-before-free: Update.
* build-aux/vc-list-files: Update.
* gnulib/lib/.cvsignore: Update.
* gnulib/lib/Makefile.am: Update.
* gnulib/lib/fseeko.c: Update.
* gnulib/lib/getaddrinfo.c: Update.
* gnulib/lib/getdelim.c: Update.
* gnulib/lib/inet_ntop.c: Update.
* gnulib/lib/inet_ntop.h: Update.
* gnulib/lib/poll.c: Update.
* gnulib/lib/snprintf.c: Update.
* gnulib/lib/stdlib.in.h: Update.
* gnulib/lib/string.in.h: Update.
* gnulib/lib/sys_socket.in.h: Update.
* gnulib/lib/sys_stat.in.h: Update.
* gnulib/lib/vasnprintf.c: Update.
* gnulib/lib/vasprintf.c: Update.
* gnulib/lib/wchar.in.h: Update.
* gnulib/m4/arpa_inet_h.m4: Update.
* gnulib/m4/extensions.m4: Update.
* gnulib/m4/gnulib-common.m4: Update.
* gnulib/m4/gnulib-comp.m4: Update.
* gnulib/m4/include_next.m4: Update.
* gnulib/m4/inet_ntop.m4: Update.
* gnulib/m4/netinet_in_h.m4: Update.
* gnulib/m4/onceonly_2_57.m4: Update.
* gnulib/m4/physmem.m4: Update.
* gnulib/m4/snprintf.m4: Update.
* gnulib/m4/stdint.m4: Update.
* gnulib/m4/stdio_h.m4: Update.
* gnulib/m4/stdlib_h.m4: Update.
* gnulib/m4/string_h.m4: Update.
* gnulib/m4/strndup.m4: Update.
* gnulib/m4/sys_select_h.m4: Update.
* gnulib/m4/sys_socket_h.m4: Update.
* gnulib/m4/sys_stat_h.m4: Update.
* gnulib/m4/vasnprintf.m4: Update.
* gnulib/tests/Makefile.am: Update.
* gnulib/tests/test-fseeko.c: Update.
* gnulib/tests/test-getaddrinfo.c: Update.
* gnulib/tests/test-getdelim.c: Update.
* gnulib/tests/test-getline.c: Update.
* gnulib/tests/test-lseek.c: Update.
* gnulib/tests/test-snprintf.c: Update.
* gnulib/tests/test-sys_stat.c: Update.
* gnulib/tests/test-vasnprintf.c: Update.
* gnulib/tests/test-vasprintf.c: Update.
2008-04-29 19:52:26 +00:00

111 lines
3.8 KiB
Plaintext

# 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.
dnl From Paul Eggert and Derek Price.
AC_DEFUN([gl_INCLUDE_NEXT],
[
AC_LANG_PREPROC_REQUIRE()
AC_CACHE_CHECK([whether the preprocessor supports include_next],
[gl_cv_have_include_next],
[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])
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
dnl to use @INCLUDE_NEXT@ instead.
AC_DEFINE([HAVE_INCLUDE_NEXT], 1,
[Define if your compiler supports the #include_next directive.])
INCLUDE_NEXT=include_next
else
INCLUDE_NEXT=include
fi
AC_SUBST([INCLUDE_NEXT])
])
# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
# ------------------------------------------
# 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.
# That way, a header file with the following line:
# #@INCLUDE_NEXT@ @NEXT_FOO_H@
# behaves (after sed substitution) as if it contained
# #include_next <foo.h>
# even if the compiler does not support 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])
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
AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
else
AC_CACHE_CHECK(
[absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
m4_quote(m4_defn([gl_next_header])),
[AS_VAR_PUSHDEF([gl_header_exists],
[ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
if test AS_VAR_GET(gl_header_exists) = yes; then
AC_LANG_CONFTEST(
[AC_LANG_SOURCE(
[[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
)])
dnl eval is necessary to expand ac_cpp.
dnl Ultrix and Pyramid sh refuse to redirect output of eval,
dnl so use subshell.
AS_VAR_SET([gl_next_header],
['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
s#^/[^/]#//&#
p
q
}'`'"'])
else
AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
fi
AS_VAR_POPDEF([gl_header_exists])])
fi
AC_SUBST(
AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
[AS_VAR_GET([gl_next_header])])
AS_VAR_POPDEF([gl_next_header])])
])