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