1 # absolute-header.m4 serial 7
2 dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
9 # gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
10 # ---------------------------------------
11 # Find the absolute name of a header file, assuming the header exists.
12 # If the header were sys/inttypes.h, this macro would define
13 # ABSOLUTE_SYS_INTTYPES_H to the `""' quoted absolute name of sys/inttypes.h
15 # (e.g. `#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
16 # The three "///" are to pacify Sun C 5.8, which otherwise would say
17 # "warning: #include of /usr/include/... may be non-portable".
18 # Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
19 AC_DEFUN([gl_ABSOLUTE_HEADER],
20 [AC_LANG_PREPROC_REQUIRE()dnl
21 AC_FOREACH([gl_HEADER_NAME], [$1],
22 [AS_VAR_PUSHDEF([gl_absolute_header],
23 [gl_cv_absolute_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
24 AC_CACHE_CHECK([absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
25 m4_quote(m4_defn([gl_absolute_header])),
26 [AS_VAR_PUSHDEF([ac_header_exists],
27 [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
28 AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl
29 if test AS_VAR_GET(ac_header_exists) = yes; then
30 AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])])
31 dnl eval is necessary to expand ac_cpp.
32 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
33 AS_VAR_SET(gl_absolute_header,
34 [`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
35 sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
36 s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
42 AS_VAR_POPDEF([ac_header_exists])dnl
44 AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
45 ["AS_VAR_GET(gl_absolute_header)"],
46 [Define this to an absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.])
47 AS_VAR_POPDEF([gl_absolute_header])dnl
49 ])# gl_ABSOLUTE_HEADER