preproc.c: fix %?/%?? support and address memory leaks
[nasm.git] / aclocal.m4
blob5159c11c59430b5b7f0f9c833dfdc237abb67c74
1 dnl --------------------------------------------------------------------------
2 dnl PA_ADD_CFLAGS()
3 dnl
4 dnl Attempt to add the given option to CFLAGS, if it doesn't break compilation
5 dnl --------------------------------------------------------------------------
6 AC_DEFUN(PA_ADD_CFLAGS,
7 [AC_MSG_CHECKING([if $CC accepts $1])
8  pa_add_cflags__old_cflags="$CFLAGS"
9  CFLAGS="$CFLAGS $1"
10  AC_TRY_LINK([#include <stdio.h>],
11  [printf("Hello, World!\n");],
12  AC_MSG_RESULT([yes]),
13  AC_MSG_RESULT([no])
14  CFLAGS="$pa_add_cflags__old_cflags")])
16 dnl --------------------------------------------------------------------------
17 dnl PA_WORKING_STDBOOL
18 dnl
19 dnl See if we have a working <stdbool.h> and bool support; in particular,
20 dnl OpenWatcom 1.8 has a broken _Bool type that we don't want to use.
21 dnl --------------------------------------------------------------------------
22 AC_DEFUN(PA_WORKING_BOOL,
23 [AC_MSG_CHECKING([if $CC has a working bool type])
24  AC_COMPILE_IFELSE(
25  [
26 #ifndef __cplusplus
27 #include <stdbool.h>
28 #endif
29 int foo(bool x, int y)
31         return x+y;
33  ],
34  [AC_MSG_RESULT([yes])
35   AC_DEFINE(HAVE_WORKING_BOOL, 1,
36     [Define to 1 if your compiler has a correct implementation of bool])],
37  [AC_MSG_RESULT([no])])