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);
34 }], ac_cv_func_vsnprintf_c99=yes, ac_cv_func_vsnprintf_c99=no, ac_cv_func_vsnprintf_c99=no)])
35 dnl Note that the default is to be pessimistic in the case of cross compilation.
36 dnl If you know that the target has a C99 vsnprintf(), you can get around this
37 dnl by setting ac_func_vsnprintf_c99 to yes, as described in the Autoconf manual.
38 if test $ac_cv_func_vsnprintf_c99 = yes; then
39 AC_DEFINE(HAVE_C99_VSNPRINTF, 1,
40 [Define if you have a version of the vsnprintf function
41 with semantics as specified by the ISO C99 standard.])
43 ])# AC_FUNC_VSNPRINTF_C99
46 dnl @synopsis AC_FUNC_SNPRINTF_C99
48 dnl Check whether there is a snprintf() function with C99 semantics installed.
50 AC_DEFUN([AC_FUNC_SNPRINTF_C99],
51 [AC_CACHE_CHECK(for C99 snprintf,
52 ac_cv_func_snprintf_c99,
64 r = snprintf(buffer, 5, "1234567");
69 r = snprintf(buffer, 0, "1234567");
74 r = snprintf(NULL, 0, "1234567");
87 }], ac_cv_func_snprintf_c99=yes, ac_cv_func_snprintf_c99=no, ac_cv_func_snprintf_c99=no)])
88 dnl Note that the default is to be pessimistic in the case of cross compilation.
89 dnl If you know that the target has a C99 snprintf(), you can get around this
90 dnl by setting ac_func_snprintf_c99 to yes, as described in the Autoconf manual.
91 if test $ac_cv_func_snprintf_c99 = yes; then
92 AC_DEFINE(HAVE_C99_SNPRINTF, 1,
93 [Define if you have a version of the snprintf function
94 with semantics as specified by the ISO C99 standard.])
96 ])# AC_FUNC_SNPRINTF_C99
99 dnl @synopsis AC_FUNC_PRINTF_UNIX98
101 dnl Check whether the printf() family supports Unix98 %n$ positional parameters
103 AC_DEFUN([AC_FUNC_PRINTF_UNIX98],
104 [AC_CACHE_CHECK(whether printf supports positional parameters,
105 ac_cv_func_printf_unix98,
114 sprintf (buffer, "%2\$d %3\$d %1\$d", 1, 2, 3);
115 if (strcmp ("2 3 1", buffer) == 0)
118 }], ac_cv_func_printf_unix98=yes, ac_cv_func_printf_unix98=no, ac_cv_func_printf_unix98=no)])
119 dnl Note that the default is to be pessimistic in the case of cross compilation.
120 dnl If you know that the target printf() supports positional parameters, you can get around
121 dnl this by setting ac_func_printf_unix98 to yes, as described in the Autoconf manual.
122 if test $ac_cv_func_printf_unix98 = yes; then
123 AC_DEFINE(HAVE_UNIX98_PRINTF, 1,
124 [Define if your printf function family supports positional parameters
125 as specified by Unix98.])
127 ])# AC_FUNC_PRINTF_UNIX98
129 # Checks the location of the XML Catalog
131 # JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
132 # Defines XMLCATALOG and XML_CATALOG_FILE substitutions
133 AC_DEFUN([JH_PATH_XML_CATALOG],
135 # check for the presence of the XML catalog
136 AC_ARG_WITH([xml-catalog],
137 AC_HELP_STRING([--with-xml-catalog=CATALOG],
138 [path to xml catalog to use]),,
139 [with_xml_catalog=/etc/xml/catalog])
140 jh_found_xmlcatalog=true
141 XML_CATALOG_FILE="$with_xml_catalog"
142 AC_SUBST([XML_CATALOG_FILE])
143 AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
144 if test -f "$XML_CATALOG_FILE"; then
145 AC_MSG_RESULT([found])
147 jh_found_xmlcatalog=false
148 AC_MSG_RESULT([not found])
151 # check for the xmlcatalog program
152 AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
153 if test "x$XMLCATALOG" = xno; then
154 jh_found_xmlcatalog=false
157 if $jh_found_xmlcatalog; then
158 ifelse([$1],,[:],[$1])
160 ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2])
164 # Checks if a particular URI appears in the XML catalog
166 # JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
167 AC_DEFUN([JH_CHECK_XML_CATALOG],
169 AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
170 AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
171 if $jh_found_xmlcatalog && \
172 AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
173 AC_MSG_RESULT([found])
177 AC_MSG_RESULT([not found])
179 [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])],
185 # signed.m4 serial 1 (gettext-0.10.40)
186 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
187 dnl This file is free software, distributed under the terms of the GNU
188 dnl General Public License. As a special exception to the GNU General
189 dnl Public License, this file may be distributed as part of a program
190 dnl that contains a configuration script generated by Autoconf, under
191 dnl the same distribution terms as the rest of that program.
193 dnl From Bruno Haible.
195 AC_DEFUN([bh_C_SIGNED],
197 AC_CACHE_CHECK([for signed], bh_cv_c_signed,
198 [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
199 if test $bh_cv_c_signed = no; then
201 [Define to empty if the C compiler doesn't support this keyword.])
206 # longlong.m4 serial 4
207 dnl Copyright (C) 1999-2003 Free Software Foundation, Inc.
208 dnl This file is free software, distributed under the terms of the GNU
209 dnl General Public License. As a special exception to the GNU General
210 dnl Public License, this file may be distributed as part of a program
211 dnl that contains a configuration script generated by Autoconf, under
212 dnl the same distribution terms as the rest of that program.
214 dnl From Paul Eggert.
216 # Define HAVE_LONG_LONG if 'long long' works.
218 AC_DEFUN([jm_AC_TYPE_LONG_LONG],
220 AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
221 [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
222 [long long llmax = (long long) -1;
223 return ll << i | ll >> i | llmax / ll | llmax % ll;],
224 ac_cv_type_long_long=yes,
225 ac_cv_type_long_long=no)])
226 if test $ac_cv_type_long_long = yes; then
227 AC_DEFINE(HAVE_LONG_LONG, 1,
228 [Define if you have the 'long long' type.])
233 # longdouble.m4 serial 1 (gettext-0.11.6)
234 dnl Copyright (C) 2002 Free Software Foundation, Inc.
235 dnl This file is free software, distributed under the terms of the GNU
236 dnl General Public License. As a special exception to the GNU General
237 dnl Public License, this file may be distributed as part of a program
238 dnl that contains a configuration script generated by Autoconf, under
239 dnl the same distribution terms as the rest of that program.
241 dnl From Bruno Haible.
242 dnl Test whether the compiler supports the 'long double' type.
243 dnl Prerequisite: AC_PROG_CC
245 AC_DEFUN([gt_TYPE_LONGDOUBLE],
247 AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
248 [if test "$GCC" = yes; then
249 gt_cv_c_long_double=yes
252 /* The Stardent Vistra knows sizeof(long double), but does not support it. */
253 long double foo = 0.0;
254 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
255 int array [2*(sizeof(long double) >= sizeof(double)) - 1];
257 gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
259 if test $gt_cv_c_long_double = yes; then
260 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
266 # wchar_t.m4 serial 1 (gettext-0.11.6)
267 dnl Copyright (C) 2002 Free Software Foundation, Inc.
268 dnl This file is free software, distributed under the terms of the GNU
269 dnl General Public License. As a special exception to the GNU General
270 dnl Public License, this file may be distributed as part of a program
271 dnl that contains a configuration script generated by Autoconf, under
272 dnl the same distribution terms as the rest of that program.
274 dnl From Bruno Haible.
275 dnl Test whether <stddef.h> has the 'wchar_t' type.
276 dnl Prerequisite: AC_PROG_CC
278 AC_DEFUN([gt_TYPE_WCHAR_T],
280 AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
281 [AC_TRY_COMPILE([#include <stddef.h>
282 wchar_t foo = (wchar_t)'\0';], ,
283 gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
284 if test $gt_cv_c_wchar_t = yes; then
285 AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
291 dnl Copyright (C) 2003 Free Software Foundation, Inc.
292 dnl This file is free software, distributed under the terms of the GNU
293 dnl General Public License. As a special exception to the GNU General
294 dnl Public License, this file may be distributed as part of a program
295 dnl that contains a configuration script generated by Autoconf, under
296 dnl the same distribution terms as the rest of that program.
298 dnl From Bruno Haible.
299 dnl Test whether <wchar.h> has the 'wint_t' type.
300 dnl Prerequisite: AC_PROG_CC
302 AC_DEFUN([gt_TYPE_WINT_T],
304 AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
305 [AC_TRY_COMPILE([#include <wchar.h>
306 wint_t foo = (wchar_t)'\0';], ,
307 gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
308 if test $gt_cv_c_wint_t = yes; then
309 AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
314 # intmax_t.m4 serial 1
315 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
316 dnl This file is free software, distributed under the terms of the GNU
317 dnl General Public License. As a special exception to the GNU General
318 dnl Public License, this file may be distributed as part of a program
319 dnl that contains a configuration script generated by Autoconf, under
320 dnl the same distribution terms as the rest of that program.
322 dnl From Paul Eggert.
326 # Define intmax_t to 'long' or 'long long'
327 # if it is not already defined in <stdint.h> or <inttypes.h>.
329 AC_DEFUN([jm_AC_TYPE_INTMAX_T],
331 dnl For simplicity, we assume that a header file defines 'intmax_t' if and
332 dnl only if it defines 'uintmax_t'.
333 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
334 AC_REQUIRE([jm_AC_HEADER_STDINT_H])
335 if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
336 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
337 test $ac_cv_type_long_long = yes \
338 && ac_type='long long' \
340 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
341 [Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
343 AC_DEFINE(HAVE_INTMAX_T, 1,
344 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
348 dnl An alternative would be to explicitly test for 'intmax_t'.
350 AC_DEFUN([gt_AC_TYPE_INTMAX_T],
352 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
353 AC_REQUIRE([jm_AC_HEADER_STDINT_H])
354 AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
358 #if HAVE_STDINT_H_WITH_UINTMAX
361 #if HAVE_INTTYPES_H_WITH_UINTMAX
362 #include <inttypes.h>
364 ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
365 if test $gt_cv_c_intmax_t = yes; then
366 AC_DEFINE(HAVE_INTMAX_T, 1,
367 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
369 AC_REQUIRE([jm_AC_TYPE_LONG_LONG])
370 test $ac_cv_type_long_long = yes \
371 && ac_type='long long' \
373 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
374 [Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
379 # stdint_h.m4 serial 3 (gettext-0.11.6)
380 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
381 dnl This file is free software, distributed under the terms of the GNU
382 dnl General Public License. As a special exception to the GNU General
383 dnl Public License, this file may be distributed as part of a program
384 dnl that contains a configuration script generated by Autoconf, under
385 dnl the same distribution terms as the rest of that program.
387 dnl From Paul Eggert.
389 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
390 # doesn't clash with <sys/types.h>, and declares uintmax_t.
392 AC_DEFUN([jm_AC_HEADER_STDINT_H],
394 AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
396 [#include <sys/types.h>
397 #include <stdint.h>],
398 [uintmax_t i = (uintmax_t) -1;],
399 jm_ac_cv_header_stdint_h=yes,
400 jm_ac_cv_header_stdint_h=no)])
401 if test $jm_ac_cv_header_stdint_h = yes; then
402 AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
403 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
404 and declares uintmax_t. ])
409 # inttypes_h.m4 serial 5 (gettext-0.11.6)
410 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
411 dnl This file is free software, distributed under the terms of the GNU
412 dnl General Public License. As a special exception to the GNU General
413 dnl Public License, this file may be distributed as part of a program
414 dnl that contains a configuration script generated by Autoconf, under
415 dnl the same distribution terms as the rest of that program.
417 dnl From Paul Eggert.
419 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
420 # doesn't clash with <sys/types.h>, and declares uintmax_t.
422 AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
424 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
426 [#include <sys/types.h>
427 #include <inttypes.h>],
428 [uintmax_t i = (uintmax_t) -1;],
429 jm_ac_cv_header_inttypes_h=yes,
430 jm_ac_cv_header_inttypes_h=no)])
431 if test $jm_ac_cv_header_inttypes_h = yes; then
432 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
433 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
434 and declares uintmax_t. ])