1 2AC_DEFUN([mfx_ACC_CHECK_ENDIAN], [ 3AC_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 6AC_DEFUN([mfx_ACC_CHECK_HEADERS], [ 7AC_HEADER_TIME 8AC_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/stat.h sys/time.h sys/types.h sys/wait.h]) 9])# 10 11AC_DEFUN([mfx_ACC_CHECK_FUNCS], [ 12AC_CHECK_FUNCS(access alloca atexit atoi atol chmod chown ctime difftime fstat gettimeofday gmtime localtime longjmp lstat memcmp memcpy memmove memset mktime qsort raise setjmp signal snprintf strcasecmp strchr strdup strerror strftime stricmp strncasecmp strnicmp strrchr strstr time umask utime vsnprintf) 13])# 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 31 32# /*********************************************************************** 33# // Check for ACC_conformance 34# ************************************************************************/ 35 36AC_DEFUN([mfx_ACC_ACCCHK], [ 37mfx_tmp=$1 38mfx_save_CPPFLAGS=$CPPFLAGS 39dnl in Makefile.in $(INCLUDES) will be before $(CPPFLAGS), so we mimic this here 40test "X$mfx_tmp" = "X" || CPPFLAGS="$mfx_tmp $CPPFLAGS" 41 42AC_MSG_CHECKING([whether your compiler passes the ACC conformance test]) 43 44AC_LANG_CONFTEST([AC_LANG_PROGRAM( 45[[#define ACC_CONFIG_NO_HEADER 1 46#include "acc/acc.h" 47#include "acc/acc_incd.h" 48#undef ACCCHK_ASSERT 49#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT_HEADER(expr) 50#include "acc/acc_chk.ch" 51#undef ACCCHK_ASSERT 52static void test_acc_compile_time_assert(void) { 53#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr) 54#include "acc/acc_chk.ch" 55#undef ACCCHK_ASSERT 56} 57#undef NDEBUG 58#include <assert.h> 59static int test_acc_run_time_assert(int r) { 60#define ACCCHK_ASSERT(expr) assert(expr); 61#include "acc/acc_chk.ch" 62#undef ACCCHK_ASSERT 63return r; 64} 65]], [[ 66test_acc_compile_time_assert(); 67if (test_acc_run_time_assert(1) != 1) return 1; 68]] 69)]) 70 71mfx_tmp=FAILED 72_AC_COMPILE_IFELSE([], [mfx_tmp=yes]) 73rm -f conftest.$ac_ext conftest.$ac_objext 74 75CPPFLAGS=$mfx_save_CPPFLAGS 76 77AC_MSG_RESULT([$mfx_tmp]) 78case x$mfx_tmp in 79 xpassed | xyes) ;; 80 *) 81 AC_MSG_NOTICE([]) 82 AC_MSG_NOTICE([Your compiler failed the ACC conformance test - for details see ]) 83 AC_MSG_NOTICE([`config.log'. Please check that log file and consider sending]) 84 AC_MSG_NOTICE([a patch or bug-report to <${PACKAGE_BUGREPORT}>.]) 85 AC_MSG_NOTICE([Thanks for your support.]) 86 AC_MSG_NOTICE([]) 87 AC_MSG_ERROR([ACC conformance test failed. Stop.]) 88dnl AS_EXIT 89 ;; 90esac 91])# mfx_ACC_ACCCHK 92 93 94# /*********************************************************************** 95# // Check for ACC_conformance 96# ************************************************************************/ 97 98AC_DEFUN([mfx_MINIACC_ACCCHK], [ 99mfx_tmp=$1 100mfx_save_CPPFLAGS=$CPPFLAGS 101dnl in Makefile.in $(INCLUDES) will be before $(CPPFLAGS), so we mimic this here 102test "X$mfx_tmp" = "X" || CPPFLAGS="$mfx_tmp $CPPFLAGS" 103 104AC_MSG_CHECKING([whether your compiler passes the ACC conformance test]) 105 106AC_LANG_CONFTEST([AC_LANG_PROGRAM( 107[[#define ACC_CONFIG_NO_HEADER 1 108#define ACC_WANT_ACC_INCD_H 1 109#include $2 110 111#define ACC_WANT_ACC_CHK_CH 1 112#undef ACCCHK_ASSERT 113#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT_HEADER(expr) 114#include $2 115 116#define ACC_WANT_ACC_CHK_CH 1 117#undef ACCCHK_ASSERT 118#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr) 119static void test_acc_compile_time_assert(void) { 120#include $2 121} 122 123#undef NDEBUG 124#include <assert.h> 125#define ACC_WANT_ACC_CHK_CH 1 126#undef ACCCHK_ASSERT 127#define ACCCHK_ASSERT(expr) assert(expr); 128static int test_acc_run_time_assert(int r) { 129#include $2 130return r; 131} 132]], [[ 133test_acc_compile_time_assert(); 134if (test_acc_run_time_assert(1) != 1) return 1; 135]] 136)]) 137 138mfx_tmp=FAILED 139_AC_COMPILE_IFELSE([], [mfx_tmp=yes]) 140rm -f conftest.$ac_ext conftest.$ac_objext 141 142CPPFLAGS=$mfx_save_CPPFLAGS 143 144AC_MSG_RESULT([$mfx_tmp]) 145case x$mfx_tmp in 146 xpassed | xyes) ;; 147 *) 148 AC_MSG_NOTICE([]) 149 AC_MSG_NOTICE([Your compiler failed the ACC conformance test - for details see ]) 150 AC_MSG_NOTICE([`config.log'. Please check that log file and consider sending]) 151 AC_MSG_NOTICE([a patch or bug-report to <${PACKAGE_BUGREPORT}>.]) 152 AC_MSG_NOTICE([Thanks for your support.]) 153 AC_MSG_NOTICE([]) 154 AC_MSG_ERROR([ACC conformance test failed. Stop.]) 155dnl AS_EXIT 156 ;; 157esac 158])# mfx_MINIACC_ACCCHK 159 160 161 162# serial 1 163 164AC_DEFUN([mfx_PROG_CPPFLAGS], [ 165AC_MSG_CHECKING([whether the C preprocessor needs special flags]) 166 167AC_LANG_CONFTEST([AC_LANG_PROGRAM( 168[[#include <limits.h> 169#if (32767 >= 4294967295ul) || (65535u >= 4294967295ul) 170# include "your C preprocessor is broken 1" 171#elif (0xffffu == 0xfffffffful) 172# include "your C preprocessor is broken 2" 173#elif (32767 >= ULONG_MAX) || (65535u >= ULONG_MAX) 174# include "your C preprocessor is broken 3" 175#endif 176]], [[ ]] 177)]) 178 179mfx_save_CPPFLAGS=$CPPFLAGS 180mfx_tmp=ERROR 181for mfx_arg in "" -no-cpp-precomp 182do 183 CPPFLAGS="$mfx_arg $mfx_save_CPPFLAGS" 184 _AC_COMPILE_IFELSE([], 185[mfx_tmp=$mfx_arg 186break]) 187done 188CPPFLAGS=$mfx_save_CPPFLAGS 189rm -f conftest.$ac_ext conftest.$ac_objext 190case x$mfx_tmp in 191 x) 192 AC_MSG_RESULT([none needed]) ;; 193 xERROR) 194 AC_MSG_RESULT([ERROR]) 195 AC_MSG_ERROR([your C preprocessor is broken - for details see config.log]) 196 ;; 197 *) 198 AC_MSG_RESULT([$mfx_tmp]) 199 CPPFLAGS="$mfx_tmp $CPPFLAGS" 200 ;; 201esac 202])# mfx_PROG_CPPFLAGS 203 204 205 206# serial 3 207 208AC_DEFUN([mfx_CHECK_HEADER_SANE_LIMITS_H], [ 209AC_CACHE_CHECK([whether limits.h is sane], 210mfx_cv_header_sane_limits_h, 211[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <limits.h> 212#if (32767 >= 4294967295ul) || (65535u >= 4294967295ul) 213# if defined(__APPLE__) && defined(__GNUC__) 214# error "your preprocessor is broken - use compiler option -no-cpp-precomp" 215# else 216# include "your preprocessor is broken" 217# endif 218#endif 219#define MFX_0xffff 0xffff 220#define MFX_0xffffffffL 4294967295ul 221#if !defined(CHAR_BIT) || (CHAR_BIT != 8) 222# include "error CHAR_BIT" 223#endif 224#if !defined(UCHAR_MAX) 225# include "error UCHAR_MAX 1" 226#endif 227#if !defined(USHRT_MAX) 228# include "error USHRT_MAX 1" 229#endif 230#if !defined(UINT_MAX) 231# include "error UINT_MAX 1" 232#endif 233#if !defined(ULONG_MAX) 234# include "error ULONG_MAX 1" 235#endif 236#if !defined(SHRT_MAX) 237# include "error SHRT_MAX 1" 238#endif 239#if !defined(INT_MAX) 240# include "error INT_MAX 1" 241#endif 242#if !defined(LONG_MAX) 243# include "error LONG_MAX 1" 244#endif 245#if (UCHAR_MAX < 1) 246# include "error UCHAR_MAX 2" 247#endif 248#if (USHRT_MAX < 1) 249# include "error USHRT_MAX 2" 250#endif 251#if (UINT_MAX < 1) 252# include "error UINT_MAX 2" 253#endif 254#if (ULONG_MAX < 1) 255# include "error ULONG_MAX 2" 256#endif 257#if (UCHAR_MAX < 0xff) 258# include "error UCHAR_MAX 3" 259#endif 260#if (USHRT_MAX < MFX_0xffff) 261# include "error USHRT_MAX 3" 262#endif 263#if (UINT_MAX < MFX_0xffff) 264# include "error UINT_MAX 3" 265#endif 266#if (ULONG_MAX < MFX_0xffffffffL) 267# include "error ULONG_MAX 3" 268#endif 269#if (USHRT_MAX > UINT_MAX) 270# include "error USHRT_MAX vs UINT_MAX" 271#endif 272#if (UINT_MAX > ULONG_MAX) 273# include "error UINT_MAX vs ULONG_MAX" 274#endif 275]], [[ 276#if (USHRT_MAX == MFX_0xffff) 277{ typedef char a_short2a[1 - 2 * !(sizeof(short) == 2)]; } 278#elif (USHRT_MAX >= MFX_0xffff) 279{ typedef char a_short2b[1 - 2 * !(sizeof(short) > 2)]; } 280#endif 281#if (UINT_MAX == MFX_0xffff) 282{ typedef char a_int2a[1 - 2 * !(sizeof(int) == 2)]; } 283#elif (UINT_MAX >= MFX_0xffff) 284{ typedef char a_int2b[1 - 2 * !(sizeof(int) > 2)]; } 285#endif 286#if (ULONG_MAX == MFX_0xffff) 287{ typedef char a_long2a[1 - 2 * !(sizeof(long) == 2)]; } 288#elif (ULONG_MAX >= MFX_0xffff) 289{ typedef char a_long2b[1 - 2 * !(sizeof(long) > 2)]; } 290#endif 291#if (USHRT_MAX == MFX_0xffffffffL) 292{ typedef char a_short4a[1 - 2 * !(sizeof(short) == 4)]; } 293#elif (USHRT_MAX >= MFX_0xffffffffL) 294{ typedef char a_short4b[1 - 2 * !(sizeof(short) > 4)]; } 295#endif 296#if (UINT_MAX == MFX_0xffffffffL) 297{ typedef char a_int4a[1 - 2 * !(sizeof(int) == 4)]; } 298#elif (UINT_MAX >= MFX_0xffffffffL) 299{ typedef char a_int4b[1 - 2 * !(sizeof(int) > 4)]; } 300#endif 301#if (ULONG_MAX == MFX_0xffffffffL) 302{ typedef char a_long4a[1 - 2 * !(sizeof(long) == 4)]; } 303#elif (ULONG_MAX >= MFX_0xffffffffL) 304{ typedef char a_long4b[1 - 2 * !(sizeof(long) > 4)]; } 305#endif 306]])], 307[mfx_cv_header_sane_limits_h=yes], 308[mfx_cv_header_sane_limits_h=no])]) 309]) 310 311# /*********************************************************************** 312# // standard 313# ************************************************************************/ 314 315AC_DEFUN([mfx_LZO_CHECK_ENDIAN], [ 316AC_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.])]) 317])# 318 319 320# /*********************************************************************** 321# // 322# ************************************************************************/ 323 324dnl more types which are not yet covered by ACC 325 326AC_DEFUN([mfx_CHECK_SIZEOF], [ 327AC_CHECK_SIZEOF(__int32) 328AC_CHECK_SIZEOF(intmax_t) 329AC_CHECK_SIZEOF(uintmax_t) 330AC_CHECK_SIZEOF(intptr_t) 331AC_CHECK_SIZEOF(uintptr_t) 332 333AC_CHECK_SIZEOF(float) 334AC_CHECK_SIZEOF(double) 335AC_CHECK_SIZEOF(long double) 336 337AC_CHECK_SIZEOF(dev_t) 338AC_CHECK_SIZEOF(fpos_t) 339AC_CHECK_SIZEOF(mode_t) 340AC_CHECK_SIZEOF(off_t) 341AC_CHECK_SIZEOF(ssize_t) 342AC_CHECK_SIZEOF(time_t) 343])# 344 345 346 347AC_DEFUN([mfx_CHECK_LIB_WINMM], [ 348if test "X$GCC" = Xyes; then 349case $host_os in 350cygwin* | mingw* | pw32*) 351 test "X$LIBS" != "X" && LIBS="$LIBS " 352 LIBS="${LIBS}-lwinmm" ;; 353*) 354 ;; 355esac 356fi 357])# 358 359#serial 6 360 361dnl From Paul Eggert. 362 363# Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim, 364# if it exists. 365 366AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC], 367 [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim], 368 ac_cv_struct_st_mtim_nsec, 369 [ac_save_CPPFLAGS="$CPPFLAGS" 370 ac_cv_struct_st_mtim_nsec=no 371 # tv_nsec -- the usual case 372 # _tv_nsec -- Solaris 2.6, if 373 # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1 374 # && !defined __EXTENSIONS__) 375 # st__tim.tv_nsec -- UnixWare 2.1.2 376 for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do 377 CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val" 378 AC_TRY_COMPILE([#include <sys/types.h> 379#include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;], 380 [ac_cv_struct_st_mtim_nsec=$ac_val; break]) 381 done 382 CPPFLAGS="$ac_save_CPPFLAGS"]) 383 384 if test $ac_cv_struct_st_mtim_nsec != no; then 385 AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec, 386 [Define to be the nanoseconds member of struct stat's st_mtim, 387 if it exists.]) 388 fi 389 ] 390) 391