1 dnl @synopsis AC_FUNC_VSNPRINTF_C99 2 dnl 3 dnl Check whether there is a vsnprintf() function with C99 semantics installed. 4 dnl 5 AC_DEFUN([AC_FUNC_VSNPRINTF_C99], 6 [AC_CACHE_CHECK(for C99 vsnprintf, 7 ac_cv_func_vsnprintf_c99, 8 [AC_TRY_RUN( 9 [#include <stdio.h> 10 #include <stdarg.h> 11 12 int 13 doit(char * s, ...) 14 { 15 char buffer[32]; 16 va_list args; 17 int r; 18 19 va_start(args, s); 20 r = vsnprintf(buffer, 5, s, args); 21 va_end(args); 22 23 if (r != 7) 24 exit(1); 25 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! */ 29 va_start(args, s); 30 r = vsnprintf(buffer, 0, s, args); 31 va_end(args); 32 33 if (r != 7) 34 exit(1); 35 36 exit(0); 37 } 38 39 int 40 main(void) 41 { 42 doit("1234567"); 43 exit(1); 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.]) 52 fi 53 ])# AC_FUNC_VSNPRINTF_C99 54 55 56 dnl @synopsis AC_FUNC_SNPRINTF_C99 57 dnl 58 dnl Check whether there is a snprintf() function with C99 semantics installed. 59 dnl 60 AC_DEFUN([AC_FUNC_SNPRINTF_C99], 61 [AC_CACHE_CHECK(for C99 snprintf, 62 ac_cv_func_snprintf_c99, 63 [AC_TRY_RUN( 64 [#include <stdio.h> 65 #include <stdarg.h> 66 67 int 68 doit() 69 { 70 char buffer[32]; 71 va_list args; 72 int r; 73 74 r = snprintf(buffer, 5, "1234567"); 75 76 if (r != 7) 77 exit(1); 78 79 r = snprintf(buffer, 0, "1234567"); 80 81 if (r != 7) 82 exit(1); 83 84 r = snprintf(NULL, 0, "1234567"); 85 86 if (r != 7) 87 exit(1); 88 89 exit(0); 90 } 91 92 int 93 main(void) 94 { 95 doit(); 96 exit(1); 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.]) 105 fi 106 ])# AC_FUNC_SNPRINTF_C99 107 108 109 dnl @synopsis AC_FUNC_PRINTF_UNIX98 110 dnl 111 dnl Check whether the printf() family supports Unix98 %n$ positional parameters 112 dnl 113 AC_DEFUN([AC_FUNC_PRINTF_UNIX98], 114 [AC_CACHE_CHECK(whether printf supports positional parameters, 115 ac_cv_func_printf_unix98, 116 [AC_TRY_RUN( 117 [#include <stdio.h> 118 119 int 120 main (void) 121 { 122 char buffer[128]; 123 124 sprintf (buffer, "%2\$d %3\$d %1\$d", 1, 2, 3); 125 if (strcmp ("2 3 1", buffer) == 0) 126 exit (0); 127 exit (1); 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.]) 136 fi 137 ])# AC_FUNC_PRINTF_UNIX98 138 139 # Checks the location of the XML Catalog 140 # Usage: 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], 144 [ 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]) 156 else 157 jh_found_xmlcatalog=false 158 AC_MSG_RESULT([not found]) 159 fi 160 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 165 fi 166 167 if $jh_found_xmlcatalog; then 168 ifelse([$1],,[:],[$1]) 169 else 170 ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2]) 171 fi 172 ]) 173 174 # Checks if a particular URI appears in the XML catalog 175 # Usage: 176 # JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 177 AC_DEFUN([JH_CHECK_XML_CATALOG], 178 [ 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]) 184 ifelse([$3],,,[$3 185 ])dnl 186 else 187 AC_MSG_RESULT([not found]) 188 ifelse([$4],, 189 [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])], 190 [$4]) 191 fi 192 ]) 193 194 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. 202 203 dnl From Bruno Haible. 204 205 AC_DEFUN([bh_C_SIGNED], 206 [ 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 210 AC_DEFINE(signed, , 211 [Define to empty if the C compiler doesn't support this keyword.]) 212 fi 213 ]) 214 215 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. 223 224 dnl From Paul Eggert. 225 226 # Define HAVE_LONG_LONG if 'long long' works. 227 228 AC_DEFUN([jm_AC_TYPE_LONG_LONG], 229 [ 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.]) 239 fi 240 ]) 241 242 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. 250 251 dnl From Bruno Haible. 252 dnl Test whether the compiler supports the 'long double' type. 253 dnl Prerequisite: AC_PROG_CC 254 255 AC_DEFUN([gt_TYPE_LONGDOUBLE], 256 [ 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 260 else 261 AC_TRY_COMPILE([ 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]; 266 ], , 267 gt_cv_c_long_double=yes, gt_cv_c_long_double=no) 268 fi]) 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.]) 271 fi 272 ]) 273 274 275 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. 283 284 dnl From Bruno Haible. 285 dnl Test whether <stddef.h> has the 'wchar_t' type. 286 dnl Prerequisite: AC_PROG_CC 287 288 AC_DEFUN([gt_TYPE_WCHAR_T], 289 [ 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.]) 296 fi 297 ]) 298 299 300 # wint_t.m4 serial 1 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. 307 308 dnl From Bruno Haible. 309 dnl Test whether <wchar.h> has the 'wint_t' type. 310 dnl Prerequisite: AC_PROG_CC 311 312 AC_DEFUN([gt_TYPE_WINT_T], 313 [ 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.]) 320 fi 321 ]) 322 323 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. 331 332 dnl From Paul Eggert. 333 334 AC_PREREQ(2.13) 335 336 # Define intmax_t to 'long' or 'long long' 337 # if it is not already defined in <stdint.h> or <inttypes.h>. 338 339 AC_DEFUN([jm_AC_TYPE_INTMAX_T], 340 [ 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' \ 349 || ac_type='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.]) 352 else 353 AC_DEFINE(HAVE_INTMAX_T, 1, 354 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) 355 fi 356 ]) 357 358 dnl An alternative would be to explicitly test for 'intmax_t'. 359 360 AC_DEFUN([gt_AC_TYPE_INTMAX_T], 361 [ 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, 365 [AC_TRY_COMPILE([ 366 #include <stddef.h> 367 #include <stdlib.h> 368 #if HAVE_STDINT_H_WITH_UINTMAX 369 #include <stdint.h> 370 #endif 371 #if HAVE_INTTYPES_H_WITH_UINTMAX 372 #include <inttypes.h> 373 #endif 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>.]) 378 else 379 AC_REQUIRE([jm_AC_TYPE_LONG_LONG]) 380 test $ac_cv_type_long_long = yes \ 381 && ac_type='long long' \ 382 || ac_type='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.]) 385 fi 386 ]) 387 388 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. 396 397 dnl From Paul Eggert. 398 399 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, 400 # doesn't clash with <sys/types.h>, and declares uintmax_t. 401 402 AC_DEFUN([jm_AC_HEADER_STDINT_H], 403 [ 404 AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, 405 [AC_TRY_COMPILE( 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. ]) 415 fi 416 ]) 417 418 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. 426 427 dnl From Paul Eggert. 428 429 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, 430 # doesn't clash with <sys/types.h>, and declares uintmax_t. 431 432 AC_DEFUN([jm_AC_HEADER_INTTYPES_H], 433 [ 434 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, 435 [AC_TRY_COMPILE( 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. ]) 445 fi 446 ]) 447 448 449 m4_include(acglib.m4)dnl 450 m4_include(glib/libcharset/codeset.m4)dnl 451 m4_include(glib/libcharset/glibc21.m4)dnl 452 m4_include(m4macros/glib-gettext.m4)dnl 453