| 1 |
dnl Checks for common headers and functions |
| 2 |
dnl |
| 3 |
dnl Version: 20241013 |
| 4 |
|
| 5 |
dnl Function to test if a certain feature was disabled |
| 6 |
AC_DEFUN([AX_COMMON_ARG_DISABLE], |
| 7 |
[AC_ARG_ENABLE( |
| 8 |
[$1], |
| 9 |
[AS_HELP_STRING( |
| 10 |
[--disable-$1], |
| 11 |
[$3])], |
| 12 |
[ac_cv_enable_$2=$enableval], |
| 13 |
[ac_cv_enable_$2="yes"])dnl |
| 14 |
|
| 15 |
AC_CACHE_CHECK( |
| 16 |
[whether to disable $3], |
| 17 |
[ac_cv_enable_$2], |
| 18 |
[ac_cv_enable_$2="yes"])dnl |
| 19 |
]) |
| 20 |
|
| 21 |
dnl Function to test if a certain feature was enabled |
| 22 |
AC_DEFUN([AX_COMMON_ARG_ENABLE], |
| 23 |
[AC_ARG_ENABLE( |
| 24 |
[$1], |
| 25 |
[AS_HELP_STRING( |
| 26 |
[--enable-$1], |
| 27 |
[$3 @<:@default=$4@:>@])], |
| 28 |
[ac_cv_enable_$2=$enableval], |
| 29 |
[ac_cv_enable_$2=$4])dnl |
| 30 |
|
| 31 |
AC_CACHE_CHECK( |
| 32 |
[whether to enable $3], |
| 33 |
[ac_cv_enable_$2], |
| 34 |
[ac_cv_enable_$2=$4])dnl |
| 35 |
]) |
| 36 |
|
| 37 |
dnl Function to test if the location of a certain feature was provided |
| 38 |
AC_DEFUN([AX_COMMON_ARG_WITH], |
| 39 |
[AC_ARG_WITH( |
| 40 |
[$1], |
| 41 |
[AS_HELP_STRING( |
| 42 |
[--with-$1[[=$5]]], |
| 43 |
[$3 @<:@default=$4@:>@])], |
| 44 |
[ac_cv_with_$2=$withval], |
| 45 |
[ac_cv_with_$2=$4])dnl |
| 46 |
|
| 47 |
AC_CACHE_CHECK( |
| 48 |
[whether to use $3], |
| 49 |
[ac_cv_with_$2], |
| 50 |
[ac_cv_with_$2=$4])dnl |
| 51 |
]) |
| 52 |
|
| 53 |
dnl Function to detect whether shared library support should be disabled |
| 54 |
AC_DEFUN([AX_COMMON_CHECK_DISABLE_SHARED_LIBS], |
| 55 |
[AX_COMMON_ARG_DISABLE( |
| 56 |
[shared-libs], |
| 57 |
[shared_libs], |
| 58 |
[disable shared library support]) |
| 59 |
]) |
| 60 |
|
| 61 |
dnl Function to detect whether debug output should be enabled |
| 62 |
AC_DEFUN([AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT], |
| 63 |
[AX_COMMON_ARG_ENABLE( |
| 64 |
[debug-output], |
| 65 |
[debug_output], |
| 66 |
[enable debug output], |
| 67 |
[no]) |
| 68 |
|
| 69 |
AS_IF( |
| 70 |
[test "x$ac_cv_enable_debug_output" != xno ], |
| 71 |
[AC_DEFINE( |
| 72 |
[HAVE_DEBUG_OUTPUT], |
| 73 |
[1], |
| 74 |
[Define to 1 if debug output should be used.]) |
| 75 |
|
| 76 |
ac_cv_enable_debug_output=yes]) |
| 77 |
]) |
| 78 |
|
| 79 |
dnl Function to detect whether static executables support should be enabled |
| 80 |
AC_DEFUN([AX_COMMON_CHECK_ENABLE_STATIC_EXECUTABLES], |
| 81 |
[AX_COMMON_ARG_ENABLE( |
| 82 |
[static-executables], |
| 83 |
[static_executables], |
| 84 |
[build static executables (binaries)], |
| 85 |
[no]) |
| 86 |
|
| 87 |
AS_IF( |
| 88 |
[test "x$ac_cv_enable_static_executables" != xno], |
| 89 |
[STATIC_LDFLAGS="-all-static"; |
| 90 |
|
| 91 |
AC_SUBST( |
| 92 |
[STATIC_LDFLAGS]) |
| 93 |
|
| 94 |
ac_cv_enable_static_executables=yes |
| 95 |
enable_shared=no]) |
| 96 |
]) |
| 97 |
|
| 98 |
dnl Function to detect whether verbose output should be enabled |
| 99 |
AC_DEFUN([AX_COMMON_CHECK_ENABLE_VERBOSE_OUTPUT], |
| 100 |
[AX_COMMON_ARG_ENABLE( |
| 101 |
[verbose-output], |
| 102 |
[verbose_output], |
| 103 |
[enable verbose output], |
| 104 |
[no]) |
| 105 |
|
| 106 |
AS_IF( |
| 107 |
[test "x$ac_cv_enable_verbose_output" != xno ], |
| 108 |
[AC_DEFINE( |
| 109 |
[HAVE_VERBOSE_OUTPUT], |
| 110 |
[1], |
| 111 |
[Define to 1 if verbose output should be used.]) |
| 112 |
|
| 113 |
ac_cv_enable_verbose_output=yes]) |
| 114 |
]) |
| 115 |
|
| 116 |
dnl Function to detect whether wide character type support should be enabled |
| 117 |
AC_DEFUN([AX_COMMON_CHECK_ENABLE_WIDE_CHARACTER_TYPE], |
| 118 |
[AX_COMMON_ARG_ENABLE( |
| 119 |
[wide-character-type], |
| 120 |
[wide_character_type], |
| 121 |
[enable wide character type support], |
| 122 |
[no]) |
| 123 |
]) |
| 124 |
|
| 125 |
dnl Function to detect whether WINAPI support should be enabled |
| 126 |
AC_DEFUN([AX_COMMON_CHECK_ENABLE_WINAPI], |
| 127 |
[AX_COMMON_ARG_ENABLE( |
| 128 |
[winapi], |
| 129 |
[winapi], |
| 130 |
[enable WINAPI support for cross-compilation], |
| 131 |
[auto-detect]) |
| 132 |
|
| 133 |
AS_IF( |
| 134 |
[test "x$ac_cv_enable_winapi" = xauto-detect], |
| 135 |
[ac_common_check_winapi_target_string="$target" |
| 136 |
|
| 137 |
AS_IF( |
| 138 |
[test "x$ac_common_check_winapi_target_string" = x], |
| 139 |
[ac_common_check_winapi_target_string="$host"]) |
| 140 |
|
| 141 |
AS_CASE( |
| 142 |
[$ac_common_check_winapi_target_string], |
| 143 |
[*mingw*],[AC_MSG_NOTICE( |
| 144 |
[detected MinGW enabling WINAPI support for cross-compilation]) |
| 145 |
ac_cv_enable_winapi=yes], |
| 146 |
[*msys*],[AC_MSG_NOTICE( |
| 147 |
[detected MSYS enabling WINAPI support for cross-compilation]) |
| 148 |
ac_cv_enable_winapi=yes], |
| 149 |
[*],[ac_cv_enable_winapi=no]) |
| 150 |
]) |
| 151 |
]) |
| 152 |
|
| 153 |
dnl Function to detect whether printf conversion specifier "%jd" is available |
| 154 |
AC_DEFUN([AX_COMMON_CHECK_FUNC_PRINTF_JD], |
| 155 |
[AC_MSG_CHECKING( |
| 156 |
[whether printf supports the conversion specifier "%jd"]) |
| 157 |
|
| 158 |
SAVE_CFLAGS="$CFLAGS" |
| 159 |
CFLAGS="$CFLAGS -Wall -Werror" |
| 160 |
AC_LANG_PUSH(C) |
| 161 |
|
| 162 |
dnl First try to see if compilation and linkage without a parameter succeeds |
| 163 |
AC_LINK_IFELSE( |
| 164 |
[AC_LANG_PROGRAM( |
| 165 |
[[#include <stdio.h>]], |
| 166 |
[[printf( "%jd" ); ]] )], |
| 167 |
[ac_cv_cv_have_printf_jd=no], |
| 168 |
[ac_cv_cv_have_printf_jd=yes]) |
| 169 |
|
| 170 |
dnl Second try to see if compilation and linkage with a parameter succeeds |
| 171 |
AS_IF( |
| 172 |
[test "x$ac_cv_cv_have_printf_jd" = xyes], |
| 173 |
[AC_LINK_IFELSE( |
| 174 |
[AC_LANG_PROGRAM( |
| 175 |
[[#include <sys/types.h> |
| 176 |
#include <stdio.h>]], |
| 177 |
[[printf( "%jd", (off_t) 10 ); ]] )], |
| 178 |
[ac_cv_cv_have_printf_jd=yes], |
| 179 |
[ac_cv_cv_have_printf_jd=no]) |
| 180 |
]) |
| 181 |
|
| 182 |
dnl Third try to see if the program runs correctly |
| 183 |
AS_IF( |
| 184 |
[test "x$ac_cv_cv_have_printf_jd" = xyes], |
| 185 |
[AC_RUN_IFELSE( |
| 186 |
[AC_LANG_PROGRAM( |
| 187 |
[[#include <sys/types.h> |
| 188 |
#include <stdio.h>]], |
| 189 |
[[char string[ 3 ]; |
| 190 |
if( snprintf( string, 3, "%jd", (off_t) 10 ) < 0 ) return( 1 ); |
| 191 |
if( ( string[ 0 ] != '1' ) || ( string[ 1 ] != '0' ) ) return( 1 ); ]] )], |
| 192 |
[ac_cv_cv_have_printf_jd=yes], |
| 193 |
[ac_cv_cv_have_printf_jd=no], |
| 194 |
[ac_cv_cv_have_printf_jd=undetermined]) |
| 195 |
]) |
| 196 |
|
| 197 |
AC_LANG_POP(C) |
| 198 |
CFLAGS="$SAVE_CFLAGS" |
| 199 |
|
| 200 |
AS_IF( |
| 201 |
[test "x$ac_cv_cv_have_printf_jd" = xyes], |
| 202 |
[AC_MSG_RESULT( |
| 203 |
[yes]) |
| 204 |
AC_DEFINE( |
| 205 |
[HAVE_PRINTF_JD], |
| 206 |
[1], |
| 207 |
[Define to 1 whether printf supports the conversion specifier "%jd".]) ], |
| 208 |
[AC_MSG_RESULT( |
| 209 |
[$ac_cv_cv_have_printf_jd]) |
| 210 |
]) |
| 211 |
]) |
| 212 |
|
| 213 |
dnl Function to detect whether printf conversion specifier "%zd" is available |
| 214 |
AC_DEFUN([AX_COMMON_CHECK_FUNC_PRINTF_ZD], |
| 215 |
[AC_MSG_CHECKING( |
| 216 |
[whether printf supports the conversion specifier "%zd"]) |
| 217 |
|
| 218 |
SAVE_CFLAGS="$CFLAGS" |
| 219 |
CFLAGS="$CFLAGS -Wall -Werror" |
| 220 |
AC_LANG_PUSH(C) |
| 221 |
|
| 222 |
dnl First try to see if compilation and linkage without a parameter succeeds |
| 223 |
AC_LINK_IFELSE( |
| 224 |
[AC_LANG_PROGRAM( |
| 225 |
[[#include <stdio.h>]], |
| 226 |
[[printf( "%zd" ); ]] )], |
| 227 |
[ac_cv_cv_have_printf_zd=no], |
| 228 |
[ac_cv_cv_have_printf_zd=yes]) |
| 229 |
|
| 230 |
dnl Second try to see if compilation and linkage with a parameter succeeds |
| 231 |
AS_IF( |
| 232 |
[test "x$ac_cv_cv_have_printf_zd" = xyes], |
| 233 |
[AC_LINK_IFELSE( |
| 234 |
[AC_LANG_PROGRAM( |
| 235 |
[[#include <sys/types.h> |
| 236 |
#include <stdio.h>]], |
| 237 |
[[printf( "%zd", (size_t) 10 ); ]] )], |
| 238 |
[ac_cv_cv_have_printf_zd=yes], |
| 239 |
[ac_cv_cv_have_printf_zd=no]) |
| 240 |
]) |
| 241 |
|
| 242 |
dnl Third try to see if the program runs correctly |
| 243 |
AS_IF( |
| 244 |
[test "x$ac_cv_cv_have_printf_zd" = xyes], |
| 245 |
[AC_RUN_IFELSE( |
| 246 |
[AC_LANG_PROGRAM( |
| 247 |
[[#include <sys/types.h> |
| 248 |
#include <stdio.h>]], |
| 249 |
[[char string[ 3 ]; |
| 250 |
if( snprintf( string, 3, "%zd", (size_t) 10 ) < 0 ) return( 1 ); |
| 251 |
if( ( string[ 0 ] != '1' ) || ( string[ 1 ] != '0' ) ) return( 1 ); ]] )], |
| 252 |
[ac_cv_cv_have_printf_zd=yes], |
| 253 |
[ac_cv_cv_have_printf_zd=no], |
| 254 |
[ac_cv_cv_have_printf_zd=undetermined]) |
| 255 |
]) |
| 256 |
|
| 257 |
AC_LANG_POP(C) |
| 258 |
CFLAGS="$SAVE_CFLAGS" |
| 259 |
|
| 260 |
AS_IF( |
| 261 |
[test "x$ac_cv_cv_have_printf_zd" = xyes], |
| 262 |
[AC_MSG_RESULT( |
| 263 |
[yes]) |
| 264 |
AC_DEFINE( |
| 265 |
[HAVE_PRINTF_ZD], |
| 266 |
[1], |
| 267 |
[Define to 1 whether printf supports the conversion specifier "%zd".]) ], |
| 268 |
[AC_MSG_RESULT( |
| 269 |
[$ac_cv_cv_have_printf_zd]) |
| 270 |
]) |
| 271 |
]) |
| 272 |
|
| 273 |
dnl Function to detect if common dependencies are available |
| 274 |
AC_DEFUN([AX_COMMON_CHECK_LOCAL], |
| 275 |
[dnl Headers included in common/common.h |
| 276 |
AS_IF( |
| 277 |
[test "x$ac_cv_enable_winapi" = xyes], |
| 278 |
[AC_CHECK_HEADERS([windows.h]) |
| 279 |
|
| 280 |
AS_IF( |
| 281 |
[test "x$ac_cv_header_windows_h" = xno], |
| 282 |
[AC_MSG_FAILURE( |
| 283 |
[Missing header: windows.h header is required to compile with winapi support], |
| 284 |
[1]) |
| 285 |
]) |
| 286 |
]) |
| 287 |
|
| 288 |
AS_IF( |
| 289 |
[test "x$ac_cv_enable_winapi" = xno], |
| 290 |
[AC_CHECK_HEADERS([libintl.h]) |
| 291 |
]) |
| 292 |
|
| 293 |
dnl Headers included in common/types.h |
| 294 |
AC_CHECK_HEADERS([limits.h]) |
| 295 |
|
| 296 |
dnl Headers included in common/memory.h and common/narrow_string.h |
| 297 |
AC_CHECK_HEADERS([stdlib.h string.h]) |
| 298 |
|
| 299 |
dnl Headers included in common/wide_string.h |
| 300 |
AC_CHECK_HEADERS([wchar.h wctype.h]) |
| 301 |
|
| 302 |
dnl File stream functions used in common/file_stream.h |
| 303 |
AC_CHECK_FUNCS([fclose feof fgets fopen fread fseeko fseeko64 fwrite vfprintf]) |
| 304 |
|
| 305 |
AS_IF( |
| 306 |
[test "x$ac_cv_func_fclose" != xyes], |
| 307 |
[AC_MSG_FAILURE( |
| 308 |
[Missing function: fclose], |
| 309 |
[1]) |
| 310 |
]) |
| 311 |
|
| 312 |
AS_IF( |
| 313 |
[test "x$ac_cv_func_feof" != xyes], |
| 314 |
[AC_MSG_FAILURE( |
| 315 |
[Missing function: feof], |
| 316 |
[1]) |
| 317 |
]) |
| 318 |
|
| 319 |
AS_IF( |
| 320 |
[test "x$ac_cv_func_fgets" != xyes], |
| 321 |
[AC_MSG_FAILURE( |
| 322 |
[Missing function: fgets], |
| 323 |
[1]) |
| 324 |
]) |
| 325 |
|
| 326 |
AS_IF( |
| 327 |
[test "x$ac_cv_func_fopen" != xyes], |
| 328 |
[AC_MSG_FAILURE( |
| 329 |
[Missing function: fopen], |
| 330 |
[1]) |
| 331 |
]) |
| 332 |
|
| 333 |
AS_IF( |
| 334 |
[test "x$ac_cv_func_fread" != xyes], |
| 335 |
[AC_MSG_FAILURE( |
| 336 |
[Missing function: fread], |
| 337 |
[1]) |
| 338 |
]) |
| 339 |
|
| 340 |
AS_IF( |
| 341 |
[test "x$ac_cv_func_fseeko" != xyes && test "x$ac_cv_func_fseeko64" != xyes], |
| 342 |
[AC_MSG_FAILURE( |
| 343 |
[Missing function: fseeko and fseeko64], |
| 344 |
[1]) |
| 345 |
]) |
| 346 |
|
| 347 |
AS_IF( |
| 348 |
[test "x$ac_cv_func_fwrite" != xyes], |
| 349 |
[AC_MSG_FAILURE( |
| 350 |
[Missing function: fwrite], |
| 351 |
[1]) |
| 352 |
]) |
| 353 |
|
| 354 |
AS_IF( |
| 355 |
[test "x$ac_cv_func_vfprintf" != xyes], |
| 356 |
[AC_MSG_FAILURE( |
| 357 |
[Missing function: vfprintf], |
| 358 |
[1]) |
| 359 |
]) |
| 360 |
|
| 361 |
AS_IF( |
| 362 |
[test "x$ac_cv_enable_wide_character_type" != xno], |
| 363 |
[AC_CHECK_FUNCS([fgetws]) |
| 364 |
|
| 365 |
AS_IF( |
| 366 |
[test "x$ac_cv_func_fgetws" != xyes], |
| 367 |
[AC_MSG_FAILURE( |
| 368 |
[Missing function: fgetws], |
| 369 |
[1]) |
| 370 |
]) |
| 371 |
]) |
| 372 |
|
| 373 |
dnl Memory functions used in common/memory.h |
| 374 |
AC_CHECK_FUNCS([free malloc memcmp memcpy memset realloc]) |
| 375 |
|
| 376 |
AS_IF( |
| 377 |
[test "x$ac_cv_func_free" != xyes], |
| 378 |
[AC_MSG_FAILURE( |
| 379 |
[Missing function: free], |
| 380 |
[1]) |
| 381 |
]) |
| 382 |
|
| 383 |
AS_IF( |
| 384 |
[test "x$ac_cv_func_malloc" != xyes], |
| 385 |
[AC_MSG_FAILURE( |
| 386 |
[Missing function: malloc], |
| 387 |
[1]) |
| 388 |
]) |
| 389 |
|
| 390 |
AS_IF( |
| 391 |
[test "x$ac_cv_func_memcmp" != xyes], |
| 392 |
[AC_MSG_FAILURE( |
| 393 |
[Missing function: memcmp], |
| 394 |
[1]) |
| 395 |
]) |
| 396 |
|
| 397 |
AS_IF( |
| 398 |
[test "x$ac_cv_func_memcpy" != xyes], |
| 399 |
[AC_MSG_FAILURE( |
| 400 |
[Missing function: memcpy], |
| 401 |
[1]) |
| 402 |
]) |
| 403 |
|
| 404 |
AS_IF( |
| 405 |
[test "x$ac_cv_func_memset" != xyes], |
| 406 |
[AC_MSG_FAILURE( |
| 407 |
[Missing function: memset], |
| 408 |
[1]) |
| 409 |
]) |
| 410 |
|
| 411 |
AS_IF( |
| 412 |
[test "x$ac_cv_func_realloc" != xyes], |
| 413 |
[AC_MSG_FAILURE( |
| 414 |
[Missing function: realloc], |
| 415 |
[1]) |
| 416 |
]) |
| 417 |
|
| 418 |
dnl Narrow character string functions used in common/narrow_string.h |
| 419 |
AC_CHECK_FUNCS([memchr memrchr snprintf sscanf strcasecmp strchr strlen strncasecmp strncmp strncpy strnicmp strrchr strstr vsnprintf]) |
| 420 |
|
| 421 |
AS_IF( |
| 422 |
[test "x$ac_cv_func_memchr" != xyes && test "x$ac_cv_func_strchr" != xyes], |
| 423 |
[AC_MSG_FAILURE( |
| 424 |
[Missing functions: memchr and strchr], |
| 425 |
[1]) |
| 426 |
]) |
| 427 |
|
| 428 |
AS_IF( |
| 429 |
[test "x$ac_cv_func_memcmp" != xyes && test "x$ac_cv_func_strncmp" != xyes], |
| 430 |
[AC_MSG_FAILURE( |
| 431 |
[Missing functions: memcmp and strncmp], |
| 432 |
[1]) |
| 433 |
]) |
| 434 |
|
| 435 |
AS_IF( |
| 436 |
[test "x$ac_cv_func_memcpy" != xyes && test "x$ac_cv_func_strncpy" != xyes], |
| 437 |
[AC_MSG_FAILURE( |
| 438 |
[Missing functions: memcpy and strncpy], |
| 439 |
[1]) |
| 440 |
]) |
| 441 |
|
| 442 |
AS_IF( |
| 443 |
[test "x$ac_cv_func_memrchr" = xyes], |
| 444 |
[AC_CHECK_DECLS([memrchr]) |
| 445 |
|
| 446 |
AS_IF( |
| 447 |
[test "x$ac_cv_decl_memrchr" != xyes], |
| 448 |
[ac_cv_func_memrchr=no]) |
| 449 |
]) |
| 450 |
|
| 451 |
AS_IF( |
| 452 |
[test "x$ac_cv_func_memrchr" != xyes && test "x$ac_cv_func_strrchr" != xyes], |
| 453 |
[AC_MSG_FAILURE( |
| 454 |
[Missing functions: strrchr and memrchr], |
| 455 |
[1]) |
| 456 |
]) |
| 457 |
|
| 458 |
AS_IF( |
| 459 |
[test "x$ac_cv_func_snprintf" != xyes], |
| 460 |
[AC_MSG_FAILURE( |
| 461 |
[Missing function: snprintf], |
| 462 |
[1]) |
| 463 |
]) |
| 464 |
|
| 465 |
AS_IF( |
| 466 |
[test "x$ac_cv_func_sscanf" != xyes], |
| 467 |
[AC_MSG_FAILURE( |
| 468 |
[Missing function: sscanf], |
| 469 |
[1]) |
| 470 |
]) |
| 471 |
|
| 472 |
AS_IF( |
| 473 |
[test "x$ac_cv_func_strlen" != xyes], |
| 474 |
[AC_MSG_FAILURE( |
| 475 |
[Missing function: strlen], |
| 476 |
[1]) |
| 477 |
]) |
| 478 |
|
| 479 |
AS_IF( |
| 480 |
[test "x$ac_cv_func_strcasecmp" != xyes && test "x$ac_cv_func_strncasecmp" != xyes && test "x$ac_cv_func_strnicmp" != xyes], |
| 481 |
[AC_MSG_FAILURE( |
| 482 |
[Missing functions: strncasecmp, strcasecmp and strnicmp], |
| 483 |
[1]) |
| 484 |
]) |
| 485 |
|
| 486 |
AS_IF( |
| 487 |
[test "x$ac_cv_func_strstr" != xyes], |
| 488 |
[AC_MSG_FAILURE( |
| 489 |
[Missing function: strstr], |
| 490 |
[1]) |
| 491 |
]) |
| 492 |
|
| 493 |
AS_IF( |
| 494 |
[test "x$ac_cv_func_vsnprintf" != xyes], |
| 495 |
[AC_MSG_FAILURE( |
| 496 |
[Missing function: vsnprintf], |
| 497 |
[1]) |
| 498 |
]) |
| 499 |
|
| 500 |
dnl Wide character string functions used in common/wide_string.h |
| 501 |
AS_IF( |
| 502 |
[test "x$ac_cv_enable_wide_character_type" != xno], |
| 503 |
[AC_CHECK_FUNCS([swprintf towlower wcscasecmp wcschr wcslen wcsncasecmp wcsncmp wcsncpy wcsnicmp wcsrchr wcsstr wmemchr wmemcmp wmemcpy wmemrchr]) |
| 504 |
|
| 505 |
AS_IF( |
| 506 |
[test "x$ac_cv_func_swprintf" != xyes], |
| 507 |
[AC_MSG_FAILURE( |
| 508 |
[Missing function: swprintf], |
| 509 |
[1]) |
| 510 |
]) |
| 511 |
|
| 512 |
AS_IF( |
| 513 |
[test "x$ac_cv_func_wmemchr" != xyes && test "x$ac_cv_func_wcschr" != xyes], |
| 514 |
[AC_MSG_FAILURE( |
| 515 |
[Missing functions: wmemchr and wcschr], |
| 516 |
[1]) |
| 517 |
]) |
| 518 |
|
| 519 |
AS_IF( |
| 520 |
[test "x$ac_cv_func_wmemcmp" != xyes && test "x$ac_cv_func_wcsncmp" != xyes], |
| 521 |
[AC_MSG_FAILURE( |
| 522 |
[Missing functions: wmemcmp and wcsncmp], |
| 523 |
[1]) |
| 524 |
]) |
| 525 |
|
| 526 |
AS_IF( |
| 527 |
[test "x$ac_cv_func_wmemcpy" != xyes && test "x$ac_cv_func_wcsncpy" != xyes], |
| 528 |
[AC_MSG_FAILURE( |
| 529 |
[Missing functions: wmemcpy and wcsncpy], |
| 530 |
[1]) |
| 531 |
]) |
| 532 |
|
| 533 |
AS_IF( |
| 534 |
[test "x$ac_cv_func_wmemrchr" != xyes && test "x$ac_cv_func_wcsrchr" != xyes], |
| 535 |
[AC_MSG_FAILURE( |
| 536 |
[Missing functions: wmemrchr and wcsrchr], |
| 537 |
[1]) |
| 538 |
]) |
| 539 |
|
| 540 |
AS_IF( |
| 541 |
[test "x$ac_cv_func_wcslen" != xyes], |
| 542 |
[AC_MSG_FAILURE( |
| 543 |
[Missing function: wcslen], |
| 544 |
[1]) |
| 545 |
]) |
| 546 |
|
| 547 |
AS_IF( |
| 548 |
[test "x$ac_cv_func_wcsncasecmp" != xyes && test "x$ac_cv_func_wcscasecmp" != xyes && test "x$ac_cv_func_wcsnicmp" != xyes && test "x$ac_cv_func_towlower" != xyes], |
| 549 |
[AC_MSG_FAILURE( |
| 550 |
[Missing functions: wcsncasecmp, wcscasecmp, wcsnicmp and towlower], |
| 551 |
[1]) |
| 552 |
]) |
| 553 |
|
| 554 |
AS_IF( |
| 555 |
[test "x$ac_cv_func_wcsstr" != xyes], |
| 556 |
[AC_MSG_FAILURE( |
| 557 |
[Missing function: wcsstr], |
| 558 |
[1]) |
| 559 |
]) |
| 560 |
]) |
| 561 |
|
| 562 |
dnl Check for printf conversion specifier support |
| 563 |
AX_COMMON_CHECK_FUNC_PRINTF_JD |
| 564 |
AX_COMMON_CHECK_FUNC_PRINTF_ZD |
| 565 |
]) |
| 566 |
|
| 567 |
dnl Function to test if a library with a specific definition is available |
| 568 |
AC_DEFUN([AX_CHECK_LIB_DEFINITION], |
| 569 |
[AC_CACHE_CHECK( |
| 570 |
[if `$2' is defined], |
| 571 |
[ac_cv_$1_definition_$2], |
| 572 |
[AC_LANG_PUSH(C) |
| 573 |
AC_LINK_IFELSE( |
| 574 |
[AC_LANG_PROGRAM( |
| 575 |
[[#include <$1.h>]], |
| 576 |
[[int test = $2; |
| 577 |
|
| 578 |
return( 0 ); ]] |
| 579 |
)], |
| 580 |
[ac_cv_$1_definition_$2=yes], |
| 581 |
[ac_cv_$1_definition_$2=no]) |
| 582 |
AC_LANG_POP(C)]) |
| 583 |
|
| 584 |
AS_IF( |
| 585 |
[test "x$ac_cv_$1_definition_$2" != xyes], |
| 586 |
[ac_cv_$1=no]) |
| 587 |
]) |
| 588 |
|
| 589 |
dnl Function to test if a library with specific definitions is available |
| 590 |
AC_DEFUN([AX_CHECK_LIB_DEFINITIONS], |
| 591 |
[m4_foreach( |
| 592 |
[definition], |
| 593 |
[$2], |
| 594 |
[AX_CHECK_LIB_DEFINITION( |
| 595 |
[$1], |
| 596 |
[definition]) |
| 597 |
]) |
| 598 |
]) |
| 599 |
|
| 600 |
dnl Function to test if a library with specific functions is available |
| 601 |
AC_DEFUN([AX_CHECK_LIB_FUNCTIONS], |
| 602 |
[m4_foreach( |
| 603 |
[function], |
| 604 |
[$3], |
| 605 |
[AC_CHECK_LIB( |
| 606 |
[$2], |
| 607 |
[function], |
| 608 |
[ac_cv_$1_dummy=yes], |
| 609 |
[ac_cv_$1=no]) |
| 610 |
]) |
| 611 |
]) |
| 612 |
|
| 613 |
dnl Function to check if an user specified library directory exists |
| 614 |
AC_DEFUN([AX_CHECK_LIB_DIRECTORY_EXISTS], |
| 615 |
[AS_IF( |
| 616 |
[test -d "$ac_cv_with_$1"], |
| 617 |
[CFLAGS="$CFLAGS -I${ac_cv_with_$1}/include" |
| 618 |
LDFLAGS="$LDFLAGS -L${ac_cv_with_$1}/lib"], |
| 619 |
[AC_MSG_FAILURE( |
| 620 |
[no such directory: $ac_cv_with_$1], |
| 621 |
[1]) |
| 622 |
]) |
| 623 |
]) |
| 624 |
|
| 625 |
dnl Function to warn if no supported library was found in an user specified directory |
| 626 |
AC_DEFUN([AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE], |
| 627 |
[AS_IF( |
| 628 |
[test "x$ac_cv_$1" != xyes && test "x$ac_cv_with_$1" != x && test "x$ac_cv_with_$1" != xauto-detect && test "x$ac_cv_with_$1" != xyes], |
| 629 |
[AC_MSG_FAILURE( |
| 630 |
[unable to find supported $1 in directory: $ac_cv_with_$1], |
| 631 |
[1]) |
| 632 |
]) |
| 633 |
]) |
| 634 |
|