1
dnl @synopsis AC_FUNC_VSNPRINTF_C99
3
dnl Check whether there is a vsnprintf() function with C99 semantics installed.
5
AC_DEFUN([AC_FUNC_VSNPRINTF_C99],
6
[AC_CACHE_CHECK(for C99 vsnprintf,
7
ac_cv_func_vsnprintf_c99,
20
r = vsnprintf(buffer, 5, s, args);
26
/* AIX 5.1 and Solaris seems to have a half-baked vsnprintf()
27
implementation. The above will return 7 but if you replace
28
the size of the buffer with 0, it borks! */
30
r = vsnprintf(buffer, 0, s, args);
44
}], ac_cv_func_vsnprintf_c99=yes, ac_cv_func_vsnprintf_c99=no, ac_cv_func_vsnprintf_c99=no)])
45
dnl Note that the default is to be pessimistic in the case of cross compilation.
46
dnl If you know that the target has a C99 vsnprintf(), you can get around this
47
dnl by setting ac_func_vsnprintf_c99 to yes, as described in the Autoconf manual.
48
if test $ac_cv_func_vsnprintf_c99 = yes; then
49
AC_DEFINE(HAVE_C99_VSNPRINTF, 1,
50
[Define if you have a version of the vsnprintf function
51
with semantics as specified by the ISO C99 standard.])
53
])# AC_FUNC_VSNPRINTF_C99
56
dnl @synopsis AC_FUNC_SNPRINTF_C99
58
dnl Check whether there is a snprintf() function with C99 semantics installed.
60
AC_DEFUN([AC_FUNC_SNPRINTF_C99],
61
[AC_CACHE_CHECK(for C99 snprintf,
62
ac_cv_func_snprintf_c99,
74
r = snprintf(buffer, 5, "1234567");
79
r = snprintf(buffer, 0, "1234567");
84
r = snprintf(NULL, 0, "1234567");
97
}], ac_cv_func_snprintf_c99=yes, ac_cv_func_snprintf_c99=no, ac_cv_func_snprintf_c99=no)])
98
dnl Note that the default is to be pessimistic in the case of cross compilation.
99
dnl If you know that the target has a C99 snprintf(), you can get around this
100
dnl by setting ac_func_snprintf_c99 to yes, as described in the Autoconf manual.
101
if test $ac_cv_func_snprintf_c99 = yes; then
102
AC_DEFINE(HAVE_C99_SNPRINTF, 1,
103
[Define if you have a version of the snprintf function
104
with semantics as specified by the ISO C99 standard.])
106
])# AC_FUNC_SNPRINTF_C99
109
dnl @synopsis AC_FUNC_PRINTF_UNIX98
111
dnl Check whether the printf() family supports Unix98 %n$ positional parameters
113
AC_DEFUN([AC_FUNC_PRINTF_UNIX98],
114
[AC_CACHE_CHECK(whether printf supports positional parameters,
115
ac_cv_func_printf_unix98,
124
sprintf (buffer, "%2\$d %3\$d %1\$d", 1, 2, 3);
125
if (strcmp ("2 3 1", buffer) == 0)
128
}], ac_cv_func_printf_unix98=yes, ac_cv_func_printf_unix98=no, ac_cv_func_printf_unix98=no)])
129
dnl Note that the default is to be pessimistic in the case of cross compilation.
130
dnl If you know that the target printf() supports positional parameters, you can get around
131
dnl this by setting ac_func_printf_unix98 to yes, as described in the Autoconf manual.
132
if test $ac_cv_func_printf_unix98 = yes; then
133
AC_DEFINE(HAVE_UNIX98_PRINTF, 1,
134
[Define if your printf function family supports positional parameters
135
as specified by Unix98.])
137
])# AC_FUNC_PRINTF_UNIX98
139
# Checks the location of the XML Catalog
141
# JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
142
# Defines XMLCATALOG and XML_CATALOG_FILE substitutions
143
AC_DEFUN([JH_PATH_XML_CATALOG],
145
# check for the presence of the XML catalog
146
AC_ARG_WITH([xml-catalog],
147
AC_HELP_STRING([--with-xml-catalog=CATALOG],
148
[path to xml catalog to use]),,
149
[with_xml_catalog=/etc/xml/catalog])
150
jh_found_xmlcatalog=true
151
XML_CATALOG_FILE="$with_xml_catalog"
152
AC_SUBST([XML_CATALOG_FILE])
153
AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
154
if test -f "$XML_CATALOG_FILE"; then
155
AC_MSG_RESULT([found])
157
jh_found_xmlcatalog=false
158
AC_MSG_RESULT([not found])
161
# check for the xmlcatalog program
162
AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
163
if test "x$XMLCATALOG" = xno; then
164
jh_found_xmlcatalog=false
167
if $jh_found_xmlcatalog; then
168
ifelse([$1],,[:],[$1])
170
ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
174
# Checks if a particular URI appears in the XML catalog
176
# JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
177
AC_DEFUN([JH_CHECK_XML_CATALOG],
179
AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
180
AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
181
if $jh_found_xmlcatalog && \
182
AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
183
AC_MSG_RESULT([found])
187
AC_MSG_RESULT([not found])
189
[AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
195
# signed.m4 serial 1 (gettext-0.10.40)
196
dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
197
dnl This file is free software, distributed under the terms of the GNU
198
dnl General Public License. As a special exception to the GNU General
199
dnl Public License, this file may be distributed as part of a program
200
dnl that contains a configuration script generated by Autoconf, under
201
dnl the same distribution terms as the rest of that program.
203
dnl From Bruno Haible.
205
AC_DEFUN([bh_C_SIGNED],
207
AC_CACHE_CHECK([for signed], bh_cv_c_signed,
208
[AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
209
if test $bh_cv_c_signed = no; then
211
[Define to empty if the C compiler doesn't support this keyword.])
216
# longlong.m4 serial 4
217
dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
218
dnl This file is free software, distributed under the terms of the GNU
219
dnl General Public License. As a special exception to the GNU General
220
dnl Public License, this file may be distributed as part of a program
221
dnl that contains a configuration script generated by Autoconf, under
222
dnl the same distribution terms as the rest of that program.
224
dnl From Paul Eggert.
226
# Define HAVE_LONG_LONG if 'long long' works.
228
AC_DEFUN([jm_AC_TYPE_LONG_LONG],
230
AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
231
[AC_TRY_LINK([long long ll = 1LL; int i = 63;],
232
[long long llmax = (long long) -1;
233
return ll << i | ll >> i | llmax / ll | llmax % ll;],
234
ac_cv_type_long_long=yes,
235
ac_cv_type_long_long=no)])
236
if test $ac_cv_type_long_long = yes; then
237
AC_DEFINE(HAVE_LONG_LONG, 1,
238
[Define if you have the 'long long' type.])
243
# longdouble.m4 serial 1 (gettext-0.11.6)
244
dnl Copyright (C) 2002 Free Software Foundation, Inc.
245
dnl This file is free software, distributed under the terms of the GNU
246
dnl General Public License. As a special exception to the GNU General
247
dnl Public License, this file may be distributed as part of a program
248
dnl that contains a configuration script generated by Autoconf, under
249
dnl the same distribution terms as the rest of that program.
251
dnl From Bruno Haible.
252
dnl Test whether the compiler supports the 'long double' type.
253
dnl Prerequisite: AC_PROG_CC
255
AC_DEFUN([gt_TYPE_LONGDOUBLE],
257
AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
258
[if test "$GCC" = yes; then
259
gt_cv_c_long_double=yes
262
/* The Stardent Vistra knows sizeof(long double), but does not support it. */
263
long double foo = 0.0;
264
/* On Ultrix 4.3 cc, long double is 4 and double is 8. */
265
int array [2*(sizeof(long double) >= sizeof(double)) - 1];
267
gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
269
if test $gt_cv_c_long_double = yes; then
270
AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
276
# wchar_t.m4 serial 1 (gettext-0.11.6)
277
dnl Copyright (C) 2002 Free Software Foundation, Inc.
278
dnl This file is free software, distributed under the terms of the GNU
279
dnl General Public License. As a special exception to the GNU General
280
dnl Public License, this file may be distributed as part of a program
281
dnl that contains a configuration script generated by Autoconf, under
282
dnl the same distribution terms as the rest of that program.
284
dnl From Bruno Haible.
285
dnl Test whether <stddef.h> has the 'wchar_t' type.
286
dnl Prerequisite: AC_PROG_CC
288
AC_DEFUN([gt_TYPE_WCHAR_T],
290
AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
291
[AC_TRY_COMPILE([#include <stddef.h>
292
wchar_t foo = (wchar_t)'\0';], ,
293
gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
294
if test $gt_cv_c_wchar_t = yes; then
295
AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
301
dnl Copyright (C) 2003 Free Software Foundation, Inc.
302
dnl This file is free software, distributed under the terms of the GNU
303
dnl General Public License. As a special exception to the GNU General
304
dnl Public License, this file may be distributed as part of a program
305
dnl that contains a configuration script generated by Autoconf, under
306
dnl the same distribution terms as the rest of that program.
308
dnl From Bruno Haible.
309
dnl Test whether <wchar.h> has the 'wint_t' type.
310
dnl Prerequisite: AC_PROG_CC
312
AC_DEFUN([gt_TYPE_WINT_T],
314
AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
315
[AC_TRY_COMPILE([#include <wchar.h>
316
wint_t foo = (wchar_t)'\0';], ,
317
gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
318
if test $gt_cv_c_wint_t = yes; then
319
AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
324
# intmax_t.m4 serial 1
325
dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
326
dnl This file is free software, distributed under the terms of the GNU
327
dnl General Public License. As a special exception to the GNU General
328
dnl Public License, this file may be distributed as part of a program
329
dnl that contains a configuration script generated by Autoconf, under
330
dnl the same distribution terms as the rest of that program.
332
dnl From Paul Eggert.
336
# Define intmax_t to 'long' or 'long long'
337
# if it is not already defined in <stdint.h> or <inttypes.h>.
339
AC_DEFUN([jm_AC_TYPE_INTMAX_T],
341
dnl For simplicity, we assume that a header file defines 'intmax_t' if and
342
dnl only if it defines 'uintmax_t'.
343
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
344
AC_REQUIRE([jm_AC_HEADER_STDINT_H])
345
if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
346
AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
347
test $ac_cv_type_long_long = yes \
348
&& ac_type='long long' \
350
AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
351
[Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
353
AC_DEFINE(HAVE_INTMAX_T, 1,
354
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
358
dnl An alternative would be to explicitly test for 'intmax_t'.
360
AC_DEFUN([gt_AC_TYPE_INTMAX_T],
362
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
363
AC_REQUIRE([jm_AC_HEADER_STDINT_H])
364
AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
368
#if HAVE_STDINT_H_WITH_UINTMAX
371
#if HAVE_INTTYPES_H_WITH_UINTMAX
372
#include <inttypes.h>
374
], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
375
if test $gt_cv_c_intmax_t = yes; then
376
AC_DEFINE(HAVE_INTMAX_T, 1,
377
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
379
AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
380
test $ac_cv_type_long_long = yes \
381
&& ac_type='long long' \
383
AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
384
[Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
389
# stdint_h.m4 serial 3 (gettext-0.11.6)
390
dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
391
dnl This file is free software, distributed under the terms of the GNU
392
dnl General Public License. As a special exception to the GNU General
393
dnl Public License, this file may be distributed as part of a program
394
dnl that contains a configuration script generated by Autoconf, under
395
dnl the same distribution terms as the rest of that program.
397
dnl From Paul Eggert.
399
# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
400
# doesn't clash with <sys/types.h>, and declares uintmax_t.
402
AC_DEFUN([jm_AC_HEADER_STDINT_H],
404
AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
406
[#include <sys/types.h>
407
#include <stdint.h>],
408
[uintmax_t i = (uintmax_t) -1;],
409
jm_ac_cv_header_stdint_h=yes,
410
jm_ac_cv_header_stdint_h=no)])
411
if test $jm_ac_cv_header_stdint_h = yes; then
412
AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
413
[Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
414
and declares uintmax_t. ])
419
# inttypes_h.m4 serial 5 (gettext-0.11.6)
420
dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
421
dnl This file is free software, distributed under the terms of the GNU
422
dnl General Public License. As a special exception to the GNU General
423
dnl Public License, this file may be distributed as part of a program
424
dnl that contains a configuration script generated by Autoconf, under
425
dnl the same distribution terms as the rest of that program.
427
dnl From Paul Eggert.
429
# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
430
# doesn't clash with <sys/types.h>, and declares uintmax_t.
432
AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
434
AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
436
[#include <sys/types.h>
437
#include <inttypes.h>],
438
[uintmax_t i = (uintmax_t) -1;],
439
jm_ac_cv_header_inttypes_h=yes,
440
jm_ac_cv_header_inttypes_h=no)])
441
if test $jm_ac_cv_header_inttypes_h = yes; then
442
AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
443
[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
444
and declares uintmax_t. ])