nasm/autoconf/m4/pa_add_flags.m4
H. Peter Anvin b0121dc312 autoconf: use librarized autoconf setup
I have been setting up a cross-project librarized autoconf setup; use
it for NASM as well.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-22 18:17:16 -08:00

21 lines
856 B
Plaintext

dnl --------------------------------------------------------------------------
dnl PA_ADD_FLAGS(variable, flag [,actual_flag])
dnl
dnl Attempt to add the given option to CPPFLAGS, if it doesn't break
dnl compilation. If the option to be tested is different than the
dnl option that should actually be added, add the option to be
dnl actually added as a second argument.
dnl --------------------------------------------------------------------------
AC_DEFUN([PA_ADD_FLAGS],
[AC_MSG_CHECKING([if $CC accepts $2])
pa_add_flags__old_flags="$$1"
$1="$$1 $2"
AC_TRY_LINK(AC_INCLUDES_DEFAULT,
[printf("Hello, World!\n");],
[AC_MSG_RESULT([yes])
$1="$pa_add_flags__old_flags ifelse([$3],[],[$2],[$3])"
AC_DEFINE(PA_SYM([$1_],[$2]), 1,
[Define to 1 if compiled with the `$2' compiler flag])],
[AC_MSG_RESULT([no])
$1="$pa_add_flags__old_flags"])])