121
147
# Note: This macro assumes that the header file is not empty after
122
148
# preprocessing, i.e. it does not only define preprocessor macros but also
123
149
# provides some type/enum definitions or function/variable declarations.
151
# This macro also checks whether each header exists, by invoking
152
# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument.
124
153
AC_DEFUN([gl_CHECK_NEXT_HEADERS],
155
gl_NEXT_HEADERS_INTERNAL([$1], [check])
158
# gl_NEXT_HEADERS(HEADER1 HEADER2 ...)
159
# ------------------------------------
160
# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist.
161
# This is suitable for headers like <stddef.h> that are standardized by C89
162
# and therefore can be assumed to exist.
163
AC_DEFUN([gl_NEXT_HEADERS],
165
gl_NEXT_HEADERS_INTERNAL([$1], [assume])
168
# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS.
169
AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
126
171
AC_REQUIRE([gl_INCLUDE_NEXT])
127
172
AC_REQUIRE([AC_CANONICAL_HOST])
128
AC_CHECK_HEADERS_ONCE([$1])
175
[AC_CHECK_HEADERS_ONCE([$1])
178
dnl FIXME: gl_next_header and gl_header_exists must be used unquoted
179
dnl until we can assume autoconf 2.64 or newer.
130
180
m4_foreach_w([gl_HEADER_NAME], [$1],
131
181
[AS_VAR_PUSHDEF([gl_next_header],
132
[gl_cv_next_]m4_defn([gl_HEADER_NAME]))
182
[gl_cv_next_]m4_defn([gl_HEADER_NAME]))
133
183
if test $gl_cv_have_include_next = yes; then
134
AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
184
AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
137
[absolute name of <]m4_defn([gl_HEADER_NAME])[>],
138
m4_defn([gl_next_header]),
139
[AS_VAR_PUSHDEF([gl_header_exists],
140
[ac_cv_header_]m4_defn([gl_HEADER_NAME]))
141
if test AS_VAR_GET(gl_header_exists) = yes; then
144
[[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
146
dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
147
dnl that contain only a #include of other header files and no
148
dnl non-comment tokens of their own. This leads to a failure to
149
dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
150
dnl and others. The workaround is to force preservation of comments
151
dnl through option -C. This ensures all necessary #line directives
152
dnl are present. GCC supports option -C as well.
154
aix*) gl_absname_cpp="$ac_cpp -C" ;;
155
*) gl_absname_cpp="$ac_cpp" ;;
157
dnl eval is necessary to expand gl_absname_cpp.
158
dnl Ultrix and Pyramid sh refuse to redirect output of eval,
160
AS_VAR_SET([gl_next_header],
161
['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
162
sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
163
s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
169
AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
171
AS_VAR_POPDEF([gl_header_exists])])
187
[absolute name of <]m4_defn([gl_HEADER_NAME])[>],
188
m4_defn([gl_next_header]),
189
[m4_if([$2], [check],
190
[AS_VAR_PUSHDEF([gl_header_exists],
191
[ac_cv_header_]m4_defn([gl_HEADER_NAME]))
192
if test AS_VAR_GET(gl_header_exists) = yes; then
193
AS_VAR_POPDEF([gl_header_exists])
197
[[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
199
dnl AIX "xlc -E" and "cc -E" omit #line directives for header
200
dnl files that contain only a #include of other header files and
201
dnl no non-comment tokens of their own. This leads to a failure
202
dnl to detect the absolute name of <dirent.h>, <signal.h>,
203
dnl <poll.h> and others. The workaround is to force preservation
204
dnl of comments through option -C. This ensures all necessary
205
dnl #line directives are present. GCC supports option -C as well.
207
aix*) gl_absname_cpp="$ac_cpp -C" ;;
208
*) gl_absname_cpp="$ac_cpp" ;;
210
dnl eval is necessary to expand gl_absname_cpp.
211
dnl Ultrix and Pyramid sh refuse to redirect output of eval,
213
AS_VAR_SET(gl_next_header,
214
['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
215
sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
216
s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
223
AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
174
229
AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
175
[AS_VAR_GET([gl_next_header])])
230
[AS_VAR_GET(gl_next_header)])
176
231
if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
177
232
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
178
233
gl_next_as_first_directive='<'gl_HEADER_NAME'>'
180
235
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
181
gl_next_as_first_directive=AS_VAR_GET([gl_next_header])
236
gl_next_as_first_directive=AS_VAR_GET(gl_next_header)
184
239
AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
185
240
[$gl_next_as_first_directive])
186
241
AS_VAR_POPDEF([gl_next_header])])
244
# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE;
245
# this fallback is safe for all earlier autoconf versions.
246
m4_define_default([AC_LANG_DEFINES_PROVIDED])