3 AT_BANNER([Semantics.])
8 ## -------------------------------- ##
9 ## Members of the AC_CHECK family. ##
10 ## -------------------------------- ##
15 # Well, I can't imagine a system where `cos' is neither in libc, nor
16 # in libm. Nor can I imagine a lib more likely to exists than libm.
17 # But there are systems without libm, on which we don't want to have
18 # this test fail, so exit successfully if `cos' is in libc.
19 AT_CHECK_MACRO([AC_CHECK_LIB],
20 [AC_TRY_LINK_FUNC(cos,
21 [AC_MSG_ERROR([`cos' is in `libc'], 77)])
24 [AC_MSG_ERROR([cannot find `cos' in `libm'])])
26 # No kidding, using variables was broken in 2.50 :(
28 AC_CHECK_LIB(m, $ac_sin,,
29 [AC_MSG_ERROR([cannot find `\$ac_sin' (= `$ac_sin') in `libm'])])
32 AC_CHECK_LIB($ac_m, acos,,
33 [AC_MSG_ERROR([cannot find `acos' in `\$ac_m' (= `$ac_m')])])
36 AC_CHECK_LIB($ac_m, $ac_asin,,
37 [AC_MSG_ERROR([cannot find `\$ac_asin' (= `$ac_asin') in `\$ac_m' (= `$at_m')])])
39 # But if the bug is in the caching mechanism, then be sure we
40 # correctly detect failures.
42 AC_CHECK_LIB(m, cossack,
43 [AC_MSG_ERROR([found `cossack' in `libm'])])
45 # No kidding, using variables was broken in 2.50 :(
47 AC_CHECK_LIB(m, $ac_sinner,
48 [AC_MSG_ERROR([found `\$ac_sinner' (= `$ac_sinner') in `libm'])])
51 AC_CHECK_LIB($ac_m, acossack,
52 [AC_MSG_ERROR([found `acossack' in `\$ac_m' (= `$ac_m')])])
55 AC_CHECK_LIB($ac_m, $ac_asinner,
56 [AC_MSG_ERROR([found `\$ac_asinner' (= `$ac_asinner') in `\$ac_m' (= `$at_m')])])
63 # Check that it performs the correct actions:
64 # Must define NEED_NO_DECL, but not NEED_YES_DECL.
65 AT_CHECK_MACRO([AC_CHECK_DECLS],
66 [[AC_CHECK_DECLS([yes, no],,,
69 [#define HAVE_DECL_NO 0
70 #define HAVE_DECL_YES 1
76 # Check that it performs the correct actions:
77 # Must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
78 AT_CHECK_MACRO([AC_CHECK_FUNCS],
79 [AC_CHECK_FUNCS(printf autoconf_ftnirp)],
81 [/* #undef HAVE_AUTOCONF_FTNIRP */
88 # Check that it performs the correct actions: autoconf_ftnirp.c must
89 # be compiled, and must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP
90 # FIXME: Maybe check the traces?
91 AT_SETUP([AC_REPLACE_FUNCS])
98 [AC_CONFIG_FILES(config.libobjs:config.in)
99 AC_REPLACE_FUNCS(printf autoconf_ftnirp)])
101 AT_CHECK_AUTOCONF([-W obsolete])
106 [/* #undef HAVE_AUTOCONF_FTNIRP */
107 #define HAVE_PRINTF 1
110 AT_CHECK([sed 's/ */ /g;s/^ //;s/ $//' config.libobjs], [],
114 AT_CLEANUP([config.libobjs])
119 # Check that it performs the correct actions:
120 # Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H.
121 AT_CHECK_MACRO([AC_CHECK_HEADERS],
122 [AC_CHECK_HEADERS(stdio.h autoconf_io.h)],
124 [/* #undef HAVE_AUTOCONF_IO_H */
125 #define HAVE_STDIO_H 1
131 # Check that it performs the correct actions.
132 # Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO.
133 AT_CHECK_MACRO([AC_CHECK_MEMBERS],
134 [[AC_CHECK_MEMBERS([struct yes_s.yes, struct yes_s.no],,,
135 [struct yes_s { int yes ;} ;])]],
137 [/* #undef HAVE_STRUCT_YES_S_NO */
138 #define HAVE_STRUCT_YES_S_YES 1
144 AT_CHECK_MACRO([AC_CHECK_SIZEOF],
145 [[AC_CHECK_SIZEOF(char)
146 AC_CHECK_SIZEOF(charchar,,
148 typedef char charchar[2];]])
149 AC_CHECK_SIZEOF(charcharchar)
151 # Exercize the code used when cross-compiling
153 AC_CHECK_SIZEOF(unsigned char)
154 AC_CHECK_SIZEOF(ucharchar,,
156 typedef unsigned char ucharchar[2];]])
157 AC_CHECK_SIZEOF(ucharcharchar)]],
159 [#define SIZEOF_CHAR 1
160 #define SIZEOF_CHARCHAR 2
161 #define SIZEOF_CHARCHARCHAR 0
162 #define SIZEOF_UCHARCHAR 2
163 #define SIZEOF_UCHARCHARCHAR 0
164 #define SIZEOF_UNSIGNED_CHAR 1
170 # Check that it performs the correct actions.
171 # Must define HAVE_STRUCT_YES_S, HAVE_INT, but not HAVE_STRUCT_NO_S.
172 # `int' and `struct yes_s' are both checked to test both the compiler
173 # builtin types, and defined types.
174 AT_CHECK_MACRO([AC_CHECK_TYPES],
175 [[AC_CHECK_TYPES([int, struct yes_s, struct no_s],,,
176 [struct yes_s { int yes ;} ;])]],
179 /* #undef HAVE_STRUCT_NO_S */
180 #define HAVE_STRUCT_YES_S 1
186 # Check that we properly dispatch properly to the old implementation
188 AT_SETUP([AC_CHECK_TYPES: backward compatibility])
190 AT_DATA(configure.ac,
192 define([_AC_CHECK_TYPE_NEW], [NEW])
193 define([_AC_CHECK_TYPE_OLD], [OLD])
195 AC_CHECK_TYPE(ptrdiff_t)
196 AC_CHECK_TYPE(ptrdiff_t, int)
197 AC_CHECK_TYPE(quad, long long)
198 AC_CHECK_TYPE(table_42, [int[42]])
200 AC_CHECK_TYPE(uint8_t, uint65536_t)
201 AC_CHECK_TYPE(a,b,c,d)
207 AT_CHECK([[sed -e '/^#(cut-from-here/,/^#to-here)/!d' -e '/^#/d' configure]],
222 # FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to
223 # open AH_TEMPLATE to `configure.ac', which is not yet the case.
224 AT_CHECK_MACRO([AC_CHECK_FILES],
225 [touch at-exists1 at-exists2
226 ac_exists2=at-exists2
227 ac_missing2=at-missing2
228 AC_CHECK_FILES(at-exists1 at-missing1 $ac_exists2 $ac_missing2)
229 rm at-exists1 at-exists2],
231 [#define HAVE_AT_EXISTS1 1
232 /* #undef HAVE_AT_MISSING1 */
237 ## ------------------------------ ##
238 ## AC_CHECK_PROG & AC_PATH_PROG. ##
239 ## ------------------------------ ##
242 # AT_CHECK_PROGS_PREPARE
243 # ----------------------
244 # Create a sub directory `path' with 6 subdirs which all 7 contain
245 # an executable `tool'. `6' contains a `better' tool.
246 m4_define([AT_CHECK_PROGS_PREPARE],
249 cat >path/tool <<\EOF
260 cp path/tool path/6/better])
263 # -------------------------------- #
264 # AC_CHECK_PROG & AC_CHECK_PROGS. #
265 # -------------------------------- #
267 AT_SETUP([AC_CHECK_PROG & AC_CHECK_PROGS])
269 AT_CHECK_PROGS_PREPARE
271 AT_DATA(configure.ac,
274 p="1${ac_path_separator}2${ac_path_separator}3${ac_path_separator}4${ac_path_separator}5${ac_path_separator}6"
275 path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
278 AC_CHECK_PROG(TOOL1, tool, found, not-found, $path)
279 test "$TOOL1" = found || fail=:
281 # Yes, the semantics of this macro is weird.
282 AC_CHECK_PROG(TOOL2, tool,, not-found, $path)
283 test "$TOOL2" = not-found || fail=:
285 AC_CHECK_PROG(TOOL3, tool, tool, not-found, $path, $pwd/path/1/tool)
286 test "$TOOL3" = $pwd/path/2/tool || fail=:
288 AC_CHECK_PROG(TOOL4, better, better, not-found, $path, $pwd/path/1/tool)
289 test "$TOOL4" = better || fail=:
291 # When a tool is not found, and no value is given for not-found,
292 # the variable is left empty.
293 AC_CHECK_PROGS(TOOL5, missing,, $path)
294 test -z "$TOOL5" || fail=:
296 AC_CHECK_PROGS(TOOL6, missing tool better,, $path)
297 test "$TOOL6" = tool || fail=:
299 # No AC-OUTPUT, we don't need config.status.
301 AC_MSG_ERROR([[CHECK_PROG failed]])
311 # ------------------------------ #
312 # AC_PATH_PROG & AC_PATH_PROGS. #
313 # ------------------------------ #
315 AT_SETUP(AC_PATH_PROG & AC_PATH_PROGS)
317 AT_CHECK_PROGS_PREPARE
319 AT_DATA(configure.ac,
322 p="1${ac_path_separator}2${ac_path_separator}3${ac_path_separator}4${ac_path_separator}5${ac_path_separator}6"
323 path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
326 AC_PATH_PROG(TOOL1, tool, not-found, $path)
327 test "$TOOL1" = $pwd/path/1/tool || fail=:
329 AC_PATH_PROG(TOOL2, better, not-found, $path)
330 test "$TOOL2" = $pwd/path/6/better || fail=:
332 # When a tool is not found, and no value is given for not-found,
333 # the variable is left empty.
334 AC_PATH_PROGS(TOOL3, missing,, $path)
335 test -z "$TOOL3" || fail=:
337 AC_PATH_PROGS(TOOL4, missing tool better,, $path)
338 test "$TOOL4" = $pwd/path/1/tool || fail=:
340 # No AC-OUTPUT, we don't need config.status.
342 AC_MSG_ERROR([[PATH_PROG failed]])
359 AT_SETUP([AC_PATH_XTRA])
361 _AT_CHECK_AC_MACRO([AC_PATH_XTRA])
363 # Check X_DISPLAY_MISSING.
364 AT_CHECK_CONFIGURE([--without-x])
366 [#define X_DISPLAY_MISSING 1
372 ## ------------------------------- ##
373 ## Obsolete non-updatable macros. ##
374 ## ------------------------------- ##
377 AT_CHECK_MACRO([AC_SYS_RESTARTABLE_SYSCALLS], , ,[-W no-obsolete])
378 AT_CHECK_MACRO([AC_FUNC_WAIT3], , ,[-W no-obsolete])