nasm/aclocal.m4
H. Peter Anvin 52e8646d17 configure: enable additional code cleanliness warnings
We are supposed to handle compiling on a "C90 plus long long"
compiler, so make gcc (our most common development platform compiler)
complain when we don't.

However, suppress the complaints about the Microsoft definitions of
the <inttypes.h> strings.

From master branch checkin 25da6eaf43,
except that -Wwrite-strings is omitted; making the code base
-Wwrite-strings clean is going to take additional work.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2016-03-04 11:14:35 -08:00

40 lines
1.3 KiB
Plaintext

dnl --------------------------------------------------------------------------
dnl PA_ADD_CFLAGS()
dnl
dnl Attempt to add the given option to CFLAGS, if it doesn't break compilation
dnl --------------------------------------------------------------------------
AC_DEFUN(PA_ADD_CFLAGS,
[AC_MSG_CHECKING([if $CC accepts $1])
pa_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_TRY_LINK([#include <stdio.h>],
[printf("Hello, World!\n");],
AC_MSG_RESULT([yes])
CFLAGS="$pa_add_cflags__old_cflags ifelse([$2],[],[$1],[$2])",
AC_MSG_RESULT([no])
CFLAGS="$pa_add_cflags__old_cflags")])
dnl --------------------------------------------------------------------------
dnl PA_WORKING_STDBOOL
dnl
dnl See if we have a working <stdbool.h> and bool support; in particular,
dnl OpenWatcom 1.8 has a broken _Bool type that we don't want to use.
dnl --------------------------------------------------------------------------
AC_DEFUN(PA_WORKING_BOOL,
[AC_MSG_CHECKING([if $CC has a working bool type])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#ifndef __cplusplus
#include <stdbool.h>
#endif
int foo(bool x, int y)
{
return x+y;
}
])],
[AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_WORKING_BOOL, 1,
[Define to 1 if your compiler has a correct implementation of bool])],
[AC_MSG_RESULT([no])])
])