1 dnl Serial 2 mfx/m4/acc.m4
3 AC_DEFUN([mfx_ACC_CHECK_ENDIAN], [
4 AC_C_BIGENDIAN([AC_DEFINE(ACC_ABI_BIG_ENDIAN,1,[Define to 1 if your machine is big endian.])],[AC_DEFINE(ACC_ABI_LITTLE_ENDIAN,1,[Define to 1 if your machine is little endian.])])
7 AC_DEFUN([mfx_ACC_CHECK_HEADERS], [
9 AC_CHECK_HEADERS([assert.h ctype.h dirent.h errno.h fcntl.h float.h limits.h malloc.h memory.h setjmp.h signal.h stdarg.h stddef.h stdint.h stdio.h stdlib.h string.h strings.h time.h unistd.h utime.h sys/mman.h sys/resource.h sys/stat.h sys/time.h sys/types.h sys/wait.h])
12 AC_DEFUN([mfx_ACC_CHECK_FUNCS], [
13 AC_CHECK_FUNCS(access alloca atexit atoi atol chmod chown clock_getcpuclockid clock_getres clock_gettime ctime difftime fstat getenv getpagesize getrusage gettimeofday gmtime isatty localtime longjmp lstat memcmp memcpy memmove memset mkdir mktime mmap mprotect munmap qsort raise rmdir setjmp signal snprintf strcasecmp strchr strdup strerror strftime stricmp strncasecmp strnicmp strrchr strstr time umask utime vsnprintf)
16 AC_DEFUN([mfx_ACC_CHECK_SIZEOF], [
17 AC_CHECK_SIZEOF(short)
21 AC_CHECK_SIZEOF(long long)
22 AC_CHECK_SIZEOF(__int16)
23 AC_CHECK_SIZEOF(__int32)
24 AC_CHECK_SIZEOF(__int64)
26 AC_CHECK_SIZEOF(void *)
27 AC_CHECK_SIZEOF(size_t)
28 AC_CHECK_SIZEOF(ptrdiff_t)
31 AC_DEFUN([mfx_ACC_ACCCHK], [
33 mfx_save_CPPFLAGS=$CPPFLAGS
34 dnl in Makefile.in $(INCLUDES) will be before $(CPPFLAGS), so we mimic this here
35 test "X$mfx_tmp" = "X" || CPPFLAGS="$mfx_tmp $CPPFLAGS"
37 AC_MSG_CHECKING([whether your compiler passes the ACC conformance test])
39 AC_LANG_CONFTEST([AC_LANG_PROGRAM(
40 [[#define ACC_CONFIG_NO_HEADER 1
42 #include "acc/acc_incd.h"
45 #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT_HEADER(expr)
46 #include "acc/acc_chk.ch"
49 #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
50 static void test_acc_compile_time_assert(void) {
51 #include "acc/acc_chk.ch"
57 #define ACCCHK_ASSERT(expr) assert(expr);
58 static int test_acc_run_time_assert(int r) {
59 #include "acc/acc_chk.ch"
63 test_acc_compile_time_assert();
64 if (test_acc_run_time_assert(1) != 1) return 1;
69 _AC_COMPILE_IFELSE([], [mfx_tmp=yes])
70 rm -f conftest.$ac_ext conftest.$ac_objext
72 CPPFLAGS=$mfx_save_CPPFLAGS
74 AC_MSG_RESULT([$mfx_tmp])
79 AC_MSG_NOTICE([Your compiler failed the ACC conformance test - for details see ])
80 AC_MSG_NOTICE([`config.log'. Please check that log file and consider sending])
81 AC_MSG_NOTICE([a patch or bug-report to <${PACKAGE_BUGREPORT}>.])
82 AC_MSG_NOTICE([Thanks for your support.])
84 AC_MSG_ERROR([ACC conformance test failed. Stop.])
90 dnl Serial 2 mfx/m4/acc_miniacc.m4
92 AC_DEFUN([mfx_MINIACC_ACCCHK], [
94 mfx_save_CPPFLAGS=$CPPFLAGS
95 dnl in Makefile.in $(INCLUDES) will be before $(CPPFLAGS), so we mimic this here
96 test "X$mfx_tmp" = "X" || CPPFLAGS="$mfx_tmp $CPPFLAGS"
98 AC_MSG_CHECKING([whether your compiler passes the ACC conformance test])
100 AC_LANG_CONFTEST([AC_LANG_PROGRAM(
101 [[#define ACC_CONFIG_NO_HEADER 1
102 #define ACC_WANT_ACC_INCD_H 1
106 #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT_HEADER(expr)
107 #define ACC_WANT_ACC_CHK_CH 1
111 #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
112 static void test_acc_compile_time_assert(void) {
113 #define ACC_WANT_ACC_CHK_CH 1
120 #define ACCCHK_ASSERT(expr) assert(expr);
121 static int test_acc_run_time_assert(int r) {
122 #define ACC_WANT_ACC_CHK_CH 1
127 test_acc_compile_time_assert();
128 if (test_acc_run_time_assert(1) != 1) return 1;
133 _AC_COMPILE_IFELSE([], [mfx_tmp=yes])
134 rm -f conftest.$ac_ext conftest.$ac_objext
136 CPPFLAGS=$mfx_save_CPPFLAGS
138 AC_MSG_RESULT([$mfx_tmp])
143 AC_MSG_NOTICE([Your compiler failed the ACC conformance test - for details see ])
144 AC_MSG_NOTICE([`config.log'. Please check that log file and consider sending])
145 AC_MSG_NOTICE([a patch or bug-report to <${PACKAGE_BUGREPORT}>.])
146 AC_MSG_NOTICE([Thanks for your support.])
148 AC_MSG_ERROR([ACC conformance test failed. Stop.])
154 dnl Serial 2 mfx/m4/cppflags.m4
156 AC_DEFUN([mfx_PROG_CPPFLAGS], [
157 AC_MSG_CHECKING([whether the C preprocessor needs special flags])
159 AC_LANG_CONFTEST([AC_LANG_PROGRAM(
160 [[#include <limits.h>
161 #if (32767 >= 4294967295ul) || (65535u >= 4294967295ul)
162 # include "your C preprocessor is broken 1"
163 #elif (0xffffu == 0xfffffffful)
164 # include "your C preprocessor is broken 2"
165 #elif (32767 >= ULONG_MAX) || (65535u >= ULONG_MAX)
166 # include "your C preprocessor is broken 3"
171 mfx_save_CPPFLAGS=$CPPFLAGS
173 for mfx_arg in "" -no-cpp-precomp
175 CPPFLAGS="$mfx_arg $mfx_save_CPPFLAGS"
176 _AC_COMPILE_IFELSE([],
180 CPPFLAGS=$mfx_save_CPPFLAGS
181 rm -f conftest.$ac_ext conftest.$ac_objext
184 AC_MSG_RESULT([none needed]) ;;
186 AC_MSG_RESULT([ERROR])
187 AC_MSG_ERROR([your C preprocessor is broken - for details see config.log])
190 AC_MSG_RESULT([$mfx_tmp])
191 CPPFLAGS="$mfx_tmp $CPPFLAGS"
196 dnl Serial 10 -*- Autoconf -*-
197 # Enable extensions on systems that normally disable them.
199 # Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
200 # This file is free software; the Free Software Foundation
201 # gives unlimited permission to copy and/or distribute it,
202 # with or without modifications, as long as this notice is preserved.
204 # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
205 # Autoconf. Perhaps we can remove this once we can assume Autoconf
206 # 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
207 # enough in this area it's likely we'll need to redefine
208 # AC_USE_SYSTEM_EXTENSIONS for quite some time.
210 # If autoconf reports a warning
211 # warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
212 # or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
214 # 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
215 # but always AC_REQUIREd,
216 # 2) to ensure that for each occurrence of
217 # AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
219 # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
220 # the corresponding gnulib module description has 'extensions' among
221 # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
222 # invocation occurs in gl_EARLY, not in gl_INIT.
224 # AC_USE_SYSTEM_EXTENSIONS
225 # ------------------------
226 # Enable extensions on systems that normally disable them,
227 # typically due to standards-conformance issues.
228 # Remember that #undef in AH_VERBATIM gets replaced with #define by
229 # AC_DEFINE. The goal here is to define all known feature-enabling
230 # macros, then, if reports of conflicts are made, disable macros that
231 # cause problems on some platforms (such as __EXTENSIONS__).
232 AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
233 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
234 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
236 AC_REQUIRE([AC_CANONICAL_HOST])
238 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
239 if test "$MINIX" = yes; then
240 AC_DEFINE([_POSIX_SOURCE], [1],
241 [Define to 1 if you need to in order for `stat' and other
243 AC_DEFINE([_POSIX_1_SOURCE], [2],
244 [Define to 2 if the system does not provide POSIX.1 features
245 except with this defined.])
246 AC_DEFINE([_MINIX], [1],
247 [Define to 1 if on MINIX.])
250 dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
251 dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already
255 AC_DEFINE([_XOPEN_SOURCE], [500],
256 [Define to 500 only on HP-UX.])
260 AH_VERBATIM([__EXTENSIONS__],
261 [/* Enable extensions on AIX 3, Interix. */
265 /* Enable general extensions on MacOS X. */
266 #ifndef _DARWIN_C_SOURCE
267 # undef _DARWIN_C_SOURCE
269 /* Enable GNU extensions on systems that have them. */
273 /* Enable threading extensions on Solaris. */
274 #ifndef _POSIX_PTHREAD_SEMANTICS
275 # undef _POSIX_PTHREAD_SEMANTICS
277 /* Enable extensions on HP NonStop. */
278 #ifndef _TANDEM_SOURCE
279 # undef _TANDEM_SOURCE
281 /* Enable general extensions on Solaris. */
282 #ifndef __EXTENSIONS__
283 # undef __EXTENSIONS__
286 AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
287 [ac_cv_safe_to_define___extensions__],
290 # define __EXTENSIONS__ 1
291 ]AC_INCLUDES_DEFAULT])],
292 [ac_cv_safe_to_define___extensions__=yes],
293 [ac_cv_safe_to_define___extensions__=no])])
294 test $ac_cv_safe_to_define___extensions__ = yes &&
295 AC_DEFINE([__EXTENSIONS__])
296 AC_DEFINE([_ALL_SOURCE])
297 AC_DEFINE([_DARWIN_C_SOURCE])
298 AC_DEFINE([_GNU_SOURCE])
299 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
300 AC_DEFINE([_TANDEM_SOURCE])
301 ])# AC_USE_SYSTEM_EXTENSIONS
303 # gl_USE_SYSTEM_EXTENSIONS
304 # ------------------------
305 # Enable extensions on systems that normally disable them,
306 # typically due to standards-conformance issues.
307 AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
309 dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
310 dnl gnulib does not need it. But if it gets required by third-party macros
311 dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
312 dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
313 dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
314 dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
315 AC_REQUIRE([AC_GNU_SOURCE])
317 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
320 dnl Serial 4 mfx/m4/limits.m4
322 AC_DEFUN([mfx_CHECK_HEADER_SANE_LIMITS_H], [
323 AC_CACHE_CHECK([whether limits.h is sane],
324 mfx_cv_header_sane_limits_h,
325 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <limits.h>
326 #if (32767 >= 4294967295ul) || (65535u >= 4294967295ul)
327 # if defined(__APPLE__) && defined(__GNUC__)
328 # error "your preprocessor is broken - use compiler option -no-cpp-precomp"
330 # include "your preprocessor is broken"
333 #define MFX_0xffff 0xffff
334 #define MFX_0xffffffffL 4294967295ul
335 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
336 # include "error CHAR_BIT"
338 #if !defined(UCHAR_MAX)
339 # include "error UCHAR_MAX 1"
341 #if !defined(USHRT_MAX)
342 # include "error USHRT_MAX 1"
344 #if !defined(UINT_MAX)
345 # include "error UINT_MAX 1"
347 #if !defined(ULONG_MAX)
348 # include "error ULONG_MAX 1"
350 #if !defined(SHRT_MAX)
351 # include "error SHRT_MAX 1"
353 #if !defined(INT_MAX)
354 # include "error INT_MAX 1"
356 #if !defined(LONG_MAX)
357 # include "error LONG_MAX 1"
360 # include "error UCHAR_MAX 2"
363 # include "error USHRT_MAX 2"
366 # include "error UINT_MAX 2"
369 # include "error ULONG_MAX 2"
371 #if (UCHAR_MAX < 0xff)
372 # include "error UCHAR_MAX 3"
374 #if (USHRT_MAX < MFX_0xffff)
375 # include "error USHRT_MAX 3"
377 #if (UINT_MAX < MFX_0xffff)
378 # include "error UINT_MAX 3"
380 #if (ULONG_MAX < MFX_0xffffffffL)
381 # include "error ULONG_MAX 3"
383 #if (USHRT_MAX > UINT_MAX)
384 # include "error USHRT_MAX vs UINT_MAX"
386 #if (UINT_MAX > ULONG_MAX)
387 # include "error UINT_MAX vs ULONG_MAX"
390 #if (USHRT_MAX == MFX_0xffff)
391 { typedef char a_short2a[1 - 2 * !(sizeof(short) == 2)]; }
392 #elif (USHRT_MAX >= MFX_0xffff)
393 { typedef char a_short2b[1 - 2 * !(sizeof(short) > 2)]; }
395 #if (UINT_MAX == MFX_0xffff)
396 { typedef char a_int2a[1 - 2 * !(sizeof(int) == 2)]; }
397 #elif (UINT_MAX >= MFX_0xffff)
398 { typedef char a_int2b[1 - 2 * !(sizeof(int) > 2)]; }
400 #if (ULONG_MAX == MFX_0xffff)
401 { typedef char a_long2a[1 - 2 * !(sizeof(long) == 2)]; }
402 #elif (ULONG_MAX >= MFX_0xffff)
403 { typedef char a_long2b[1 - 2 * !(sizeof(long) > 2)]; }
405 #if !defined(_CRAY1) /* CRAY PVP systems */
406 #if (USHRT_MAX == MFX_0xffffffffL)
407 { typedef char a_short4a[1 - 2 * !(sizeof(short) == 4)]; }
408 #elif (USHRT_MAX >= MFX_0xffffffffL)
409 { typedef char a_short4b[1 - 2 * !(sizeof(short) > 4)]; }
412 #if (UINT_MAX == MFX_0xffffffffL)
413 { typedef char a_int4a[1 - 2 * !(sizeof(int) == 4)]; }
414 #elif (UINT_MAX >= MFX_0xffffffffL)
415 { typedef char a_int4b[1 - 2 * !(sizeof(int) > 4)]; }
417 #if (ULONG_MAX == MFX_0xffffffffL)
418 { typedef char a_long4a[1 - 2 * !(sizeof(long) == 4)]; }
419 #elif (ULONG_MAX >= MFX_0xffffffffL)
420 { typedef char a_long4b[1 - 2 * !(sizeof(long) > 4)]; }
423 [mfx_cv_header_sane_limits_h=yes],
424 [mfx_cv_header_sane_limits_h=no])])
427 dnl Serial 2 mfx/m4/lzo.m4
429 AC_DEFUN([mfx_LZO_CHECK_ENDIAN], [
430 AC_C_BIGENDIAN([AC_DEFINE(LZO_ABI_BIG_ENDIAN,1,[Define to 1 if your machine is big endian.])],[AC_DEFINE(LZO_ABI_LITTLE_ENDIAN,1,[Define to 1 if your machine is little endian.])])
433 dnl Serial 2 mfx/m4/mfx.m4
435 AC_DEFUN([mfx_CHECK_SIZEOF], [
436 AC_CHECK_SIZEOF(__int32)
437 AC_CHECK_SIZEOF(intmax_t)
438 AC_CHECK_SIZEOF(uintmax_t)
439 AC_CHECK_SIZEOF(intptr_t)
440 AC_CHECK_SIZEOF(uintptr_t)
442 AC_CHECK_SIZEOF(float)
443 AC_CHECK_SIZEOF(double)
444 AC_CHECK_SIZEOF(long double)
446 AC_CHECK_SIZEOF(dev_t)
447 AC_CHECK_SIZEOF(fpos_t)
448 AC_CHECK_SIZEOF(mode_t)
449 AC_CHECK_SIZEOF(off_t)
450 AC_CHECK_SIZEOF(ssize_t)
451 AC_CHECK_SIZEOF(time_t)
454 AC_DEFUN([mfx_CHECK_LIB_WINMM], [
455 if test "X$GCC" = Xyes; then
457 cygwin* | mingw* | pw32*)
458 test "X$LIBS" != "X" && LIBS="$LIBS "
459 LIBS="${LIBS}-lwinmm" ;;
464 dnl Serial 2 mfx/m4/nrv.m4
466 AC_DEFUN([mfx_NRV_CHECK_ENDIAN], [
467 AC_C_BIGENDIAN([AC_DEFINE(NRV_ABI_BIG_ENDIAN,1,[Define to 1 if your machine is big endian.])],[AC_DEFINE(NRV_ABI_LITTLE_ENDIAN,1,[Define to 1 if your machine is little endian.])])
469 # Checks for stat-related time functions.
471 # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2011 Free Software
474 # This file is free software; the Free Software Foundation
475 # gives unlimited permission to copy and/or distribute it,
476 # with or without modifications, as long as this notice is preserved.
478 dnl From Paul Eggert.
480 # st_atim.tv_nsec - Linux, Solaris, Cygwin
481 # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE
482 # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE
483 # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
485 # st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway)
486 # st_birthtim - Cygwin 1.7.0+
488 AC_DEFUN([gl_STAT_TIME],
490 AC_REQUIRE([AC_C_INLINE])
491 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
492 AC_CHECK_HEADERS_ONCE([sys/time.h])
494 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
495 [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
496 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
497 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
499 #include <sys/types.h>
500 #include <sys/stat.h>
502 # include <sys/time.h>
511 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
512 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
513 if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
514 AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1],
515 [Define to 1 if the type of the st_atim member of a struct stat is
518 [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
519 [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
520 [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
521 [#include <sys/types.h>
522 #include <sys/stat.h>])],
523 [#include <sys/types.h>
524 #include <sys/stat.h>])],
525 [#include <sys/types.h>
526 #include <sys/stat.h>])],
527 [#include <sys/types.h>
528 #include <sys/stat.h>])
531 # Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.)
533 # There was a time when this field was named st_createtime (21 June
534 # 2002 to 16 July 2002) But that window is very small and applied only
535 # to development code, so systems still using that configuration are
536 # not supported. See revisions 1.10 and 1.11 of FreeBSD's
537 # src/sys/ufs/ufs/dinode.h.
539 AC_DEFUN([gl_STAT_BIRTHTIME],
541 AC_REQUIRE([AC_C_INLINE])
542 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
543 AC_CHECK_HEADERS_ONCE([sys/time.h])
544 AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [],
545 [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [],
546 [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [],
547 [#include <sys/types.h>
548 #include <sys/stat.h>])],
549 [#include <sys/types.h>
550 #include <sys/stat.h>])],
551 [#include <sys/types.h>
552 #include <sys/stat.h>])
555 dnl Serial 2 mfx/m4/ucl.m4
557 AC_DEFUN([mfx_UCL_CHECK_ENDIAN], [
558 AC_C_BIGENDIAN([AC_DEFINE(UCL_ABI_BIG_ENDIAN,1,[Define to 1 if your machine is big endian.])],[AC_DEFINE(UCL_ABI_LITTLE_ENDIAN,1,[Define to 1 if your machine is little endian.])])