local.m4 20 KB

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