mfx_acc.m4 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. # acc.m4 serial 1 (ucl-1.03)
  2. # /***********************************************************************
  3. # // standard ACC macros
  4. # ************************************************************************/
  5. AC_DEFUN([mfx_ACC_CHECK_ENDIAN], [
  6. 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. ])#
  8. AC_DEFUN([mfx_ACC_CHECK_HEADERS], [
  9. AC_HEADER_TIME
  10. 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])
  11. ])#
  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)
  14. ])#
  15. AC_DEFUN([mfx_ACC_CHECK_SIZEOF], [
  16. AC_CHECK_SIZEOF(short)
  17. AC_CHECK_SIZEOF(int)
  18. AC_CHECK_SIZEOF(long)
  19. AC_CHECK_SIZEOF(long long)
  20. AC_CHECK_SIZEOF(__int16)
  21. AC_CHECK_SIZEOF(__int32)
  22. AC_CHECK_SIZEOF(__int64)
  23. AC_CHECK_SIZEOF(void *)
  24. AC_CHECK_SIZEOF(char *)
  25. AC_CHECK_SIZEOF(size_t)
  26. AC_CHECK_SIZEOF(ptrdiff_t)
  27. ])#
  28. # /***********************************************************************
  29. # // Check for ACC_conformance
  30. # ************************************************************************/
  31. AC_DEFUN([mfx_ACC_ACCCHK], [
  32. mfx_tmp=$1
  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"
  36. AC_MSG_CHECKING([whether your compiler passes the ACC conformance test])
  37. AC_LANG_CONFTEST([AC_LANG_PROGRAM(
  38. [[#define ACC_CONFIG_NO_HEADER 1
  39. #include "acc/acc.h"
  40. #include "acc/acc_incd.h"
  41. #undef ACCCHK_ASSERT
  42. #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT_HEADER(expr)
  43. #include "acc/acc_chk.ch"
  44. #undef ACCCHK_ASSERT
  45. static void test_acc_compile_time_assert(void) {
  46. #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
  47. #include "acc/acc_chk.ch"
  48. #undef ACCCHK_ASSERT
  49. }
  50. #undef NDEBUG
  51. #include <assert.h>
  52. static int test_acc_run_time_assert(int r) {
  53. #define ACCCHK_ASSERT(expr) assert(expr);
  54. #include "acc/acc_chk.ch"
  55. #undef ACCCHK_ASSERT
  56. return r;
  57. }
  58. ]], [[
  59. test_acc_compile_time_assert();
  60. if (test_acc_run_time_assert(1) != 1) return 1;
  61. ]]
  62. )])
  63. mfx_tmp=FAILED
  64. _AC_COMPILE_IFELSE([], [mfx_tmp=yes])
  65. rm -f conftest.$ac_ext conftest.$ac_objext
  66. CPPFLAGS=$mfx_save_CPPFLAGS
  67. AC_MSG_RESULT([$mfx_tmp])
  68. case x$mfx_tmp in
  69. xpassed | xyes) ;;
  70. *)
  71. AC_MSG_NOTICE([])
  72. AC_MSG_NOTICE([Your compiler failed the ACC conformance test - for details see ])
  73. AC_MSG_NOTICE([`config.log'. Please check that log file and consider sending])
  74. AC_MSG_NOTICE([a patch or bug-report to <${PACKAGE_BUGREPORT}>.])
  75. AC_MSG_NOTICE([Thanks for your support.])
  76. AC_MSG_NOTICE([])
  77. AC_MSG_ERROR([ACC conformance test failed. Stop.])
  78. dnl AS_EXIT
  79. ;;
  80. esac
  81. ])# mfx_ACC_ACCCHK
  82. # /***********************************************************************
  83. # // Check for ACC_conformance
  84. # ************************************************************************/
  85. AC_DEFUN([mfx_MINIACC_ACCCHK], [
  86. mfx_tmp=$1
  87. mfx_save_CPPFLAGS=$CPPFLAGS
  88. dnl in Makefile.in $(INCLUDES) will be before $(CPPFLAGS), so we mimic this here
  89. test "X$mfx_tmp" = "X" || CPPFLAGS="$mfx_tmp $CPPFLAGS"
  90. AC_MSG_CHECKING([whether your compiler passes the ACC conformance test])
  91. AC_LANG_CONFTEST([AC_LANG_PROGRAM(
  92. [[#define ACC_CONFIG_NO_HEADER 1
  93. #define ACC_WANT_ACC_INCD_H 1
  94. #include $2
  95. #define ACC_WANT_ACC_CHK_CH 1
  96. #undef ACCCHK_ASSERT
  97. #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT_HEADER(expr)
  98. #include $2
  99. #define ACC_WANT_ACC_CHK_CH 1
  100. #undef ACCCHK_ASSERT
  101. #define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
  102. static void test_acc_compile_time_assert(void) {
  103. #include $2
  104. }
  105. #undef NDEBUG
  106. #include <assert.h>
  107. #define ACC_WANT_ACC_CHK_CH 1
  108. #undef ACCCHK_ASSERT
  109. #define ACCCHK_ASSERT(expr) assert(expr);
  110. static int test_acc_run_time_assert(int r) {
  111. #include $2
  112. return r;
  113. }
  114. ]], [[
  115. test_acc_compile_time_assert();
  116. if (test_acc_run_time_assert(1) != 1) return 1;
  117. ]]
  118. )])
  119. mfx_tmp=FAILED
  120. _AC_COMPILE_IFELSE([], [mfx_tmp=yes])
  121. rm -f conftest.$ac_ext conftest.$ac_objext
  122. CPPFLAGS=$mfx_save_CPPFLAGS
  123. AC_MSG_RESULT([$mfx_tmp])
  124. case x$mfx_tmp in
  125. xpassed | xyes) ;;
  126. *)
  127. AC_MSG_NOTICE([])
  128. AC_MSG_NOTICE([Your compiler failed the ACC conformance test - for details see ])
  129. AC_MSG_NOTICE([`config.log'. Please check that log file and consider sending])
  130. AC_MSG_NOTICE([a patch or bug-report to <${PACKAGE_BUGREPORT}>.])
  131. AC_MSG_NOTICE([Thanks for your support.])
  132. AC_MSG_NOTICE([])
  133. AC_MSG_ERROR([ACC conformance test failed. Stop.])
  134. dnl AS_EXIT
  135. ;;
  136. esac
  137. ])# mfx_MINIACC_ACCCHK