1dnl Serial 3 mfx/m4/acc.m4
2
3AC_DEFUN([mfx_ACC_CHECK_ENDIAN], [
4AC_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.])])
5])
6
7AC_DEFUN([mfx_ACC_CHECK_HEADERS], [
8AC_HEADER_TIME
9AC_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])
10])
11
12AC_DEFUN([mfx_ACC_CHECK_FUNCS], [
13AC_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)
14])
15
16AC_DEFUN([mfx_ACC_CHECK_SIZEOF], [
17AC_CHECK_SIZEOF(short)
18AC_CHECK_SIZEOF(int)
19AC_CHECK_SIZEOF(long)
20
21AC_CHECK_SIZEOF(long long)
22AC_CHECK_SIZEOF(__int16)
23AC_CHECK_SIZEOF(__int32)
24AC_CHECK_SIZEOF(__int64)
25
26AC_CHECK_SIZEOF(void *)
27AC_CHECK_SIZEOF(size_t)
28AC_CHECK_SIZEOF(ptrdiff_t)
29])
30
31AC_DEFUN([mfx_ACC_ACCCHK], [
32mfx_tmp=$1
33mfx_save_CPPFLAGS=$CPPFLAGS
34dnl in Makefile.in $(INCLUDES) will be before $(CPPFLAGS), so we mimic this here
35test "X$mfx_tmp" = "X" || CPPFLAGS="$mfx_tmp $CPPFLAGS"
36
37AC_MSG_CHECKING([whether your compiler passes the ACC conformance test])
38
39AC_LANG_CONFTEST([AC_LANG_PROGRAM(
40[[#define ACC_CFG_NO_CONFIG_HEADER 1
41#include "acc/acc.h"
42#include "acc/acc_incd.h"
43
44#undef  ACCCHK_ASSERT
45#define ACCCHK_ASSERT(expr)     ACC_COMPILE_TIME_ASSERT_HEADER(expr)
46#include "acc/acc_chk.ch"
47
48#undef  ACCCHK_ASSERT
49#define ACCCHK_ASSERT(expr)     ACC_COMPILE_TIME_ASSERT(expr)
50static void test_acc_compile_time_assert(void) {
51#include "acc/acc_chk.ch"
52}
53
54#undef NDEBUG
55#include <assert.h>
56#undef  ACCCHK_ASSERT
57#define ACCCHK_ASSERT(expr)     assert(expr);
58static int test_acc_run_time_assert(int r) {
59#include "acc/acc_chk.ch"
60return r;
61}
62]], [[
63test_acc_compile_time_assert();
64if (test_acc_run_time_assert(1) != 1) return 1;
65]]
66)])
67
68mfx_tmp=FAILED
69_AC_COMPILE_IFELSE([], [mfx_tmp=yes])
70rm -f conftest.$ac_ext conftest.$ac_objext
71
72CPPFLAGS=$mfx_save_CPPFLAGS
73
74AC_MSG_RESULT([$mfx_tmp])
75case x$mfx_tmp in
76  xpassed | xyes) ;;
77  *)
78    AC_MSG_NOTICE([])
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.])
83    AC_MSG_NOTICE([])
84    AC_MSG_ERROR([ACC conformance test failed. Stop.])
85dnl    AS_EXIT
86    ;;
87esac
88])
89
90dnl Serial 3 mfx/m4/acc_miniacc.m4
91
92AC_DEFUN([mfx_MINIACC_ACCCHK], [
93mfx_tmp=$1
94mfx_save_CPPFLAGS=$CPPFLAGS
95dnl in Makefile.in $(INCLUDES) will be before $(CPPFLAGS), so we mimic this here
96test "X$mfx_tmp" = "X" || CPPFLAGS="$mfx_tmp $CPPFLAGS"
97
98AC_MSG_CHECKING([whether your compiler passes the ACC conformance test])
99
100AC_LANG_CONFTEST([AC_LANG_PROGRAM(
101[[#define ACC_CFG_NO_CONFIG_HEADER 1
102#define ACC_WANT_ACC_INCD_H 1
103#include $2
104
105#undef  ACCCHK_ASSERT
106#define ACCCHK_ASSERT(expr)     ACC_COMPILE_TIME_ASSERT_HEADER(expr)
107#define ACC_WANT_ACC_CHK_CH 1
108#include $2
109
110#undef  ACCCHK_ASSERT
111#define ACCCHK_ASSERT(expr)     ACC_COMPILE_TIME_ASSERT(expr)
112static void test_acc_compile_time_assert(void) {
113#define ACC_WANT_ACC_CHK_CH 1
114#include $2
115}
116
117#undef NDEBUG
118#include <assert.h>
119#undef  ACCCHK_ASSERT
120#define ACCCHK_ASSERT(expr)     assert(expr);
121static int test_acc_run_time_assert(int r) {
122#define ACC_WANT_ACC_CHK_CH 1
123#include $2
124return r;
125}
126]], [[
127test_acc_compile_time_assert();
128if (test_acc_run_time_assert(1) != 1) return 1;
129]]
130)])
131
132mfx_tmp=FAILED
133_AC_COMPILE_IFELSE([], [mfx_tmp=yes])
134rm -f conftest.$ac_ext conftest.$ac_objext
135
136CPPFLAGS=$mfx_save_CPPFLAGS
137
138AC_MSG_RESULT([$mfx_tmp])
139case x$mfx_tmp in
140  xpassed | xyes) ;;
141  *)
142    AC_MSG_NOTICE([])
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.])
147    AC_MSG_NOTICE([])
148    AC_MSG_ERROR([ACC conformance test failed. Stop.])
149dnl    AS_EXIT
150    ;;
151esac
152])
153
154dnl Serial 2 mfx/m4/cppflags.m4
155
156AC_DEFUN([mfx_PROG_CPPFLAGS], [
157AC_MSG_CHECKING([whether the C preprocessor needs special flags])
158
159AC_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"
167#endif
168]], [[ ]]
169)])
170
171mfx_save_CPPFLAGS=$CPPFLAGS
172mfx_tmp=ERROR
173for mfx_arg in "" -no-cpp-precomp
174do
175  CPPFLAGS="$mfx_arg $mfx_save_CPPFLAGS"
176  _AC_COMPILE_IFELSE([],
177[mfx_tmp=$mfx_arg
178break])
179done
180CPPFLAGS=$mfx_save_CPPFLAGS
181rm -f conftest.$ac_ext conftest.$ac_objext
182case x$mfx_tmp in
183  x)
184    AC_MSG_RESULT([none needed]) ;;
185  xERROR)
186    AC_MSG_RESULT([ERROR])
187    AC_MSG_ERROR([your C preprocessor is broken - for details see config.log])
188    ;;
189  *)
190    AC_MSG_RESULT([$mfx_tmp])
191    CPPFLAGS="$mfx_tmp $CPPFLAGS"
192    ;;
193esac
194])
195
196dnl Serial 16  -*- Autoconf -*-
197# Enable extensions on systems that normally disable them.
198
199# Copyright (C) 2003, 2006-2017 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.
203
204# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
205# Autoconf.  Perhaps we can remove this once we can assume Autoconf
206# 2.70 or later everywhere, but since 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.
209
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
213# the fix is
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])
218#      or
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.
223
224# AC_USE_SYSTEM_EXTENSIONS
225# ------------------------
226# Enable extensions on systems that normally disable them,
227# typically due to standards-conformance issues.
228#
229# Remember that #undef in AH_VERBATIM gets replaced with #define by
230# AC_DEFINE.  The goal here is to define all known feature-enabling
231# macros, then, if reports of conflicts are made, disable macros that
232# cause problems on some platforms (such as __EXTENSIONS__).
233AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
234[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
235AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
236
237  AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
238  if test "$MINIX" = yes; then
239    AC_DEFINE([_POSIX_SOURCE], [1],
240      [Define to 1 if you need to in order for 'stat' and other
241       things to work.])
242    AC_DEFINE([_POSIX_1_SOURCE], [2],
243      [Define to 2 if the system does not provide POSIX.1 features
244       except with this defined.])
245    AC_DEFINE([_MINIX], [1],
246      [Define to 1 if on MINIX.])
247    AC_DEFINE([_NETBSD_SOURCE], [1],
248      [Define to 1 to make NetBSD features available.  MINIX 3 needs this.])
249  fi
250
251dnl Use a different key than __EXTENSIONS__, as that name broke existing
252dnl configure.ac when using autoheader 2.62.
253  AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
254[/* Enable extensions on AIX 3, Interix.  */
255#ifndef _ALL_SOURCE
256# undef _ALL_SOURCE
257#endif
258/* Enable general extensions on macOS.  */
259#ifndef _DARWIN_C_SOURCE
260# undef _DARWIN_C_SOURCE
261#endif
262/* Enable GNU extensions on systems that have them.  */
263#ifndef _GNU_SOURCE
264# undef _GNU_SOURCE
265#endif
266/* Enable OpenBSD extensions on NetBSD.  */
267#ifndef _OPENBSD_SOURCE
268# undef _OPENBSD_SOURCE
269#endif
270/* Enable threading extensions on Solaris.  */
271#ifndef _POSIX_PTHREAD_SEMANTICS
272# undef _POSIX_PTHREAD_SEMANTICS
273#endif
274/* Enable extensions specified by ISO/IEC TS 18661-5:2014.  */
275#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
276# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
277#endif
278/* Enable extensions specified by ISO/IEC TS 18661-1:2014.  */
279#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
280# undef __STDC_WANT_IEC_60559_BFP_EXT__
281#endif
282/* Enable extensions specified by ISO/IEC TS 18661-2:2015.  */
283#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
284# undef __STDC_WANT_IEC_60559_DFP_EXT__
285#endif
286/* Enable extensions specified by ISO/IEC TS 18661-4:2015.  */
287#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
288# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
289#endif
290/* Enable extensions specified by ISO/IEC TS 18661-3:2015.  */
291#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
292# undef __STDC_WANT_IEC_60559_TYPES_EXT__
293#endif
294/* Enable extensions specified by ISO/IEC TR 24731-2:2010.  */
295#ifndef __STDC_WANT_LIB_EXT2__
296# undef __STDC_WANT_LIB_EXT2__
297#endif
298/* Enable extensions specified by ISO/IEC 24747:2009.  */
299#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
300# undef __STDC_WANT_MATH_SPEC_FUNCS__
301#endif
302/* Enable extensions on HP NonStop.  */
303#ifndef _TANDEM_SOURCE
304# undef _TANDEM_SOURCE
305#endif
306/* Enable X/Open extensions if necessary.  HP-UX 11.11 defines
307   mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
308   whether compiling with -Ae or -D_HPUX_SOURCE=1.  */
309#ifndef _XOPEN_SOURCE
310# undef _XOPEN_SOURCE
311#endif
312/* Enable general extensions on Solaris.  */
313#ifndef __EXTENSIONS__
314# undef __EXTENSIONS__
315#endif
316])
317  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
318    [ac_cv_safe_to_define___extensions__],
319    [AC_COMPILE_IFELSE(
320       [AC_LANG_PROGRAM([[
321#         define __EXTENSIONS__ 1
322          ]AC_INCLUDES_DEFAULT])],
323       [ac_cv_safe_to_define___extensions__=yes],
324       [ac_cv_safe_to_define___extensions__=no])])
325  test $ac_cv_safe_to_define___extensions__ = yes &&
326    AC_DEFINE([__EXTENSIONS__])
327  AC_DEFINE([_ALL_SOURCE])
328  AC_DEFINE([_DARWIN_C_SOURCE])
329  AC_DEFINE([_GNU_SOURCE])
330  AC_DEFINE([_OPENBSD_SOURCE])
331  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
332  AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__])
333  AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__])
334  AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__])
335  AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__])
336  AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__])
337  AC_DEFINE([__STDC_WANT_LIB_EXT2__])
338  AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__])
339  AC_DEFINE([_TANDEM_SOURCE])
340  AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
341    [ac_cv_should_define__xopen_source],
342    [ac_cv_should_define__xopen_source=no
343     AC_COMPILE_IFELSE(
344       [AC_LANG_PROGRAM([[
345          #include <wchar.h>
346          mbstate_t x;]])],
347       [],
348       [AC_COMPILE_IFELSE(
349          [AC_LANG_PROGRAM([[
350             #define _XOPEN_SOURCE 500
351             #include <wchar.h>
352             mbstate_t x;]])],
353          [ac_cv_should_define__xopen_source=yes])])])
354  test $ac_cv_should_define__xopen_source = yes &&
355    AC_DEFINE([_XOPEN_SOURCE], [500])
356])# AC_USE_SYSTEM_EXTENSIONS
357
358# gl_USE_SYSTEM_EXTENSIONS
359# ------------------------
360# Enable extensions on systems that normally disable them,
361# typically due to standards-conformance issues.
362AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
363[
364  dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
365  dnl gnulib does not need it. But if it gets required by third-party macros
366  dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
367  dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
368  dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
369  dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
370  AC_REQUIRE([AC_GNU_SOURCE])
371
372  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
373])
374
375dnl Serial 4 mfx/m4/limits.m4
376
377AC_DEFUN([mfx_CHECK_HEADER_SANE_LIMITS_H], [
378AC_CACHE_CHECK([whether limits.h is sane],
379mfx_cv_header_sane_limits_h,
380[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <limits.h>
381#if (32767 >= 4294967295ul) || (65535u >= 4294967295ul)
382#  if defined(__APPLE__) && defined(__GNUC__)
383#    error "your preprocessor is broken - use compiler option -no-cpp-precomp"
384#  else
385#    include "your preprocessor is broken"
386#  endif
387#endif
388#define MFX_0xffff          0xffff
389#define MFX_0xffffffffL     4294967295ul
390#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
391#  include "error CHAR_BIT"
392#endif
393#if !defined(UCHAR_MAX)
394#  include "error UCHAR_MAX 1"
395#endif
396#if !defined(USHRT_MAX)
397#  include "error USHRT_MAX 1"
398#endif
399#if !defined(UINT_MAX)
400#  include "error UINT_MAX 1"
401#endif
402#if !defined(ULONG_MAX)
403#  include "error ULONG_MAX 1"
404#endif
405#if !defined(SHRT_MAX)
406#  include "error SHRT_MAX 1"
407#endif
408#if !defined(INT_MAX)
409#  include "error INT_MAX 1"
410#endif
411#if !defined(LONG_MAX)
412#  include "error LONG_MAX 1"
413#endif
414#if (UCHAR_MAX < 1)
415#  include "error UCHAR_MAX 2"
416#endif
417#if (USHRT_MAX < 1)
418#  include "error USHRT_MAX 2"
419#endif
420#if (UINT_MAX < 1)
421#  include "error UINT_MAX 2"
422#endif
423#if (ULONG_MAX < 1)
424#  include "error ULONG_MAX 2"
425#endif
426#if (UCHAR_MAX < 0xff)
427#  include "error UCHAR_MAX 3"
428#endif
429#if (USHRT_MAX < MFX_0xffff)
430#  include "error USHRT_MAX 3"
431#endif
432#if (UINT_MAX < MFX_0xffff)
433#  include "error UINT_MAX 3"
434#endif
435#if (ULONG_MAX < MFX_0xffffffffL)
436#  include "error ULONG_MAX 3"
437#endif
438#if (USHRT_MAX > UINT_MAX)
439#  include "error USHRT_MAX vs UINT_MAX"
440#endif
441#if (UINT_MAX > ULONG_MAX)
442#  include "error UINT_MAX vs ULONG_MAX"
443#endif
444]], [[
445#if (USHRT_MAX == MFX_0xffff)
446{ typedef char a_short2a[1 - 2 * !(sizeof(short) == 2)]; }
447#elif (USHRT_MAX >= MFX_0xffff)
448{ typedef char a_short2b[1 - 2 * !(sizeof(short) > 2)]; }
449#endif
450#if (UINT_MAX == MFX_0xffff)
451{ typedef char a_int2a[1 - 2 * !(sizeof(int) == 2)]; }
452#elif (UINT_MAX >= MFX_0xffff)
453{ typedef char a_int2b[1 - 2 * !(sizeof(int) > 2)]; }
454#endif
455#if (ULONG_MAX == MFX_0xffff)
456{ typedef char a_long2a[1 - 2 * !(sizeof(long) == 2)]; }
457#elif (ULONG_MAX >= MFX_0xffff)
458{ typedef char a_long2b[1 - 2 * !(sizeof(long) > 2)]; }
459#endif
460#if !defined(_CRAY1) /* CRAY PVP systems */
461#if (USHRT_MAX == MFX_0xffffffffL)
462{ typedef char a_short4a[1 - 2 * !(sizeof(short) == 4)]; }
463#elif (USHRT_MAX >= MFX_0xffffffffL)
464{ typedef char a_short4b[1 - 2 * !(sizeof(short) > 4)]; }
465#endif
466#endif /* _CRAY1 */
467#if (UINT_MAX == MFX_0xffffffffL)
468{ typedef char a_int4a[1 - 2 * !(sizeof(int) == 4)]; }
469#elif (UINT_MAX >= MFX_0xffffffffL)
470{ typedef char a_int4b[1 - 2 * !(sizeof(int) > 4)]; }
471#endif
472#if (ULONG_MAX == MFX_0xffffffffL)
473{ typedef char a_long4a[1 - 2 * !(sizeof(long) == 4)]; }
474#elif (ULONG_MAX >= MFX_0xffffffffL)
475{ typedef char a_long4b[1 - 2 * !(sizeof(long) > 4)]; }
476#endif
477]])],
478[mfx_cv_header_sane_limits_h=yes],
479[mfx_cv_header_sane_limits_h=no])])
480])
481
482dnl Serial 2 mfx/m4/lzo.m4
483
484AC_DEFUN([mfx_LZO_CHECK_ENDIAN], [
485AC_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.])])
486])
487
488dnl Serial 3 mfx/m4/lzo_lzochk.m4
489
490AC_DEFUN([mfx_LZO_LZOCHK], [
491mfx_tmp=$1
492mfx_save_CPPFLAGS=$CPPFLAGS
493dnl in Makefile.in $(INCLUDES) will be before $(CPPFLAGS), so we mimic this here
494test "X$mfx_tmp" = "X" || CPPFLAGS="$mfx_tmp $CPPFLAGS"
495
496AC_MSG_CHECKING([whether your compiler passes the LZO conformance test])
497
498AC_LANG_CONFTEST([AC_LANG_PROGRAM(
499[[#include <limits.h>
500#include <stddef.h>
501#define LZO_CFG_NO_CONFIG_HEADER 1
502#define LZO_WANT_ACC_INCD_H 1
503$2
504#include $3
505
506#undef  LZOCHK_ASSERT
507#define LZOCHK_ASSERT(expr)     LZO_COMPILE_TIME_ASSERT_HEADER(expr)
508#define LZO_WANT_ACC_CHK_CH 1
509#include $3
510
511#undef  LZOCHK_ASSERT
512#define LZOCHK_ASSERT(expr)     LZO_COMPILE_TIME_ASSERT(expr)
513static void test_lzo_compile_time_assert(void) {
514#define LZO_WANT_ACC_CHK_CH 1
515#include $3
516}
517
518#undef NDEBUG
519#include <assert.h>
520#undef  LZOCHK_ASSERT
521#define LZOCHK_ASSERT(expr)     assert(expr);
522static int test_lzo_run_time_assert(int r) {
523#define LZO_WANT_ACC_CHK_CH 1
524#include $3
525return r;
526}
527]], [[
528test_lzo_compile_time_assert();
529if (test_lzo_run_time_assert(1) != 1) return 1;
530]]
531)])
532
533mfx_tmp=FAILED
534_AC_COMPILE_IFELSE([], [mfx_tmp=yes])
535rm -f conftest.$ac_ext conftest.$ac_objext
536
537CPPFLAGS=$mfx_save_CPPFLAGS
538
539AC_MSG_RESULT([$mfx_tmp])
540case x$mfx_tmp in
541  xpassed | xyes) ;;
542  *)
543    AC_MSG_NOTICE([])
544    AC_MSG_NOTICE([Your compiler failed the LZO conformance test - for details see ])
545    AC_MSG_NOTICE([`config.log'. Please check that log file and consider sending])
546    AC_MSG_NOTICE([a patch or bug-report to <${PACKAGE_BUGREPORT}>.])
547    AC_MSG_NOTICE([Thanks for your support.])
548    AC_MSG_NOTICE([])
549    AC_MSG_ERROR([LZO conformance test failed. Stop.])
550dnl    AS_EXIT
551    ;;
552esac
553])
554
555dnl Serial 2 mfx/m4/mfx.m4
556
557AC_DEFUN([mfx_CHECK_SIZEOF], [
558AC_CHECK_SIZEOF(__int32)
559AC_CHECK_SIZEOF(intmax_t)
560AC_CHECK_SIZEOF(uintmax_t)
561AC_CHECK_SIZEOF(intptr_t)
562AC_CHECK_SIZEOF(uintptr_t)
563
564AC_CHECK_SIZEOF(float)
565AC_CHECK_SIZEOF(double)
566AC_CHECK_SIZEOF(long double)
567
568AC_CHECK_SIZEOF(dev_t)
569AC_CHECK_SIZEOF(fpos_t)
570AC_CHECK_SIZEOF(mode_t)
571AC_CHECK_SIZEOF(off_t)
572AC_CHECK_SIZEOF(ssize_t)
573AC_CHECK_SIZEOF(time_t)
574])#
575
576AC_DEFUN([mfx_CHECK_LIB_WINMM], [
577if test "X$GCC" = Xyes; then
578case $host_os in
579cygwin* | mingw* | pw32*)
580     test "X$LIBS" != "X" && LIBS="$LIBS "
581     LIBS="${LIBS}-lwinmm" ;;
582esac
583fi
584])
585
586dnl Serial 2 mfx/m4/nrv.m4
587
588AC_DEFUN([mfx_NRV_CHECK_ENDIAN], [
589AC_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.])])
590])
591# Checks for stat-related time functions.
592
593# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2017 Free Software
594# Foundation, Inc.
595
596# This file is free software; the Free Software Foundation
597# gives unlimited permission to copy and/or distribute it,
598# with or without modifications, as long as this notice is preserved.
599
600dnl From Paul Eggert.
601
602# st_atim.tv_nsec - Linux, Solaris, Cygwin
603# st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE
604# st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE
605# st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
606
607# st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway)
608# st_birthtim - Cygwin 1.7.0+
609
610AC_DEFUN([gl_STAT_TIME],
611[
612  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
613  AC_CHECK_HEADERS_ONCE([sys/time.h])
614
615  AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
616    [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
617       [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
618       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
619          [[
620            #include <sys/types.h>
621            #include <sys/stat.h>
622            #if HAVE_SYS_TIME_H
623            # include <sys/time.h>
624            #endif
625            #include <time.h>
626            struct timespec ts;
627            struct stat st;
628          ]],
629          [[
630            st.st_atim = ts;
631          ]])],
632          [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
633          [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
634     if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
635       AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1],
636         [Define to 1 if the type of the st_atim member of a struct stat is
637          struct timespec.])
638     fi],
639    [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
640       [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
641          [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
642             [#include <sys/types.h>
643              #include <sys/stat.h>])],
644          [#include <sys/types.h>
645           #include <sys/stat.h>])],
646       [#include <sys/types.h>
647        #include <sys/stat.h>])],
648    [#include <sys/types.h>
649     #include <sys/stat.h>])
650])
651
652# Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.)
653# and NTFS (Cygwin).
654# There was a time when this field was named st_createtime (21 June
655# 2002 to 16 July 2002) But that window is very small and applied only
656# to development code, so systems still using that configuration are
657# not supported.  See revisions 1.10 and 1.11 of FreeBSD's
658# src/sys/ufs/ufs/dinode.h.
659#
660AC_DEFUN([gl_STAT_BIRTHTIME],
661[
662  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
663  AC_CHECK_HEADERS_ONCE([sys/time.h])
664  AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [],
665    [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [],
666      [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [],
667         [#include <sys/types.h>
668          #include <sys/stat.h>])],
669       [#include <sys/types.h>
670        #include <sys/stat.h>])],
671    [#include <sys/types.h>
672     #include <sys/stat.h>])
673])
674
675dnl Serial 2 mfx/m4/ucl.m4
676
677AC_DEFUN([mfx_UCL_CHECK_ENDIAN], [
678AC_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.])])
679])
680