summaryrefslogtreecommitdiffstats
path: root/gl/m4/absolute-header.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/absolute-header.m4')
-rw-r--r--gl/m4/absolute-header.m444
1 files changed, 44 insertions, 0 deletions
diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4
new file mode 100644
index 0000000..c649df0
--- /dev/null
+++ b/gl/m4/absolute-header.m4
@@ -0,0 +1,44 @@
1# absolute-header.m4 serial 6
2dnl Copyright (C) 2006 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Derek Price.
8
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
14# in config.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.
19AC_DEFUN([gl_ABSOLUTE_HEADER],
20[AC_LANG_PREPROC_REQUIRE()dnl
21AC_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]))[[>]])])
31dnl eval is necessary to expand ac_cpp.
32dnl 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 |
35sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;s#^/[^/]#//&#;p;q;}'`])
36 fi
37 AS_VAR_POPDEF([ac_header_exists])dnl
38 ])dnl
39 AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
40 ["AS_VAR_GET(gl_absolute_header)"],
41 [Define this to an absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.])
42 AS_VAR_POPDEF([gl_absolute_header])dnl
43])dnl
44])# gl_ABSOLUTE_HEADER