1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-20 11:01:20 +03:00

absolute-header: Make the macro usable in more situations.

This commit is contained in:
Bruno Haible
2010-05-16 23:41:33 +02:00
parent 5b4b2b8fd8
commit 0bc56a3096
2 changed files with 44 additions and 25 deletions

View File

@@ -1,3 +1,10 @@
2010-05-16 Bruno Haible <bruno@clisp.org>
absolute-header: Make the macro usable in more situations.
* m4/absolute-header.m4 (gl_ABSOLUTE_HEADER_ONE): New macro, extracted
from gl_ABSOLUTE_HEADER.
(gl_ABSOLUTE_HEADER): Use it. Fix comment.
2010-05-16 James Youngman <jay@gnu.org> 2010-05-16 James Youngman <jay@gnu.org>
doc: update users.txt doc: update users.txt

View File

@@ -1,4 +1,4 @@
# absolute-header.m4 serial 11 # absolute-header.m4 serial 12
dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,7 @@ dnl From Derek Price.
# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...) # gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
# --------------------------------------- # ---------------------------------------
# Find the absolute name of a header file, assuming the header exists. # Find the absolute name of a header file, testing first if the header exists.
# If the header were sys/inttypes.h, this macro would define # If the header were sys/inttypes.h, this macro would define
# ABSOLUTE_SYS_INTTYPES_H to the `""' quoted absolute name of sys/inttypes.h # ABSOLUTE_SYS_INTTYPES_H to the `""' quoted absolute name of sys/inttypes.h
# in config.h # in config.h
@@ -31,7 +31,27 @@ m4_foreach_w([gl_HEADER_NAME], [$1],
[ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl
AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl
if test AS_VAR_GET(ac_header_exists) = yes; then if test AS_VAR_GET(ac_header_exists) = yes; then
AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])]) gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME]))
fi
AS_VAR_POPDEF([ac_header_exists])dnl
])dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])),
["AS_VAR_GET(gl_absolute_header)"],
[Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.])
AS_VAR_POPDEF([gl_absolute_header])dnl
])dnl
])# gl_ABSOLUTE_HEADER
# gl_ABSOLUTE_HEADER_ONE(HEADER)
# ------------------------------
# Like gl_ABSOLUTE_HEADER, except that:
# - it assumes that the header exists,
# - it uses the current CPPFLAGS,
# - it does not cache the result,
# - it is silent.
AC_DEFUN([gl_ABSOLUTE_HEADER_ONE],
[
AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])])
dnl AIX "xlc -E" and "cc -E" omit #line directives for header files dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
dnl that contain only a #include of other header files and no dnl that contain only a #include of other header files and no
dnl non-comment tokens of their own. This leads to a failure to dnl non-comment tokens of their own. This leads to a failure to
@@ -46,20 +66,12 @@ m4_foreach_w([gl_HEADER_NAME], [$1],
dnl eval is necessary to expand gl_absname_cpp. dnl eval is necessary to expand gl_absname_cpp.
dnl Ultrix and Pyramid sh refuse to redirect output of eval, dnl Ultrix and Pyramid sh refuse to redirect output of eval,
dnl so use subshell. dnl so use subshell.
AS_VAR_SET(gl_absolute_header, AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]),
[`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | [`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ sed -n '\#/$1#{
s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# s#.*"\(.*/$1\)".*#\1#
s#^/[^/]#//&# s#^/[^/]#//&#
p p
q q
}'`]) }'`])
fi ])
AS_VAR_POPDEF([ac_header_exists])dnl
])dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])),
["AS_VAR_GET(gl_absolute_header)"],
[Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.])
AS_VAR_POPDEF([gl_absolute_header])dnl
])dnl
])# gl_ABSOLUTE_HEADER