autoconf: add success/failure code options to PA_ADD_*FLAGS

Allow code to be executed in the success or failure scenatios of
PA_ADD_*FLAGS.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2020-07-09 19:25:41 -07:00
parent e8d6bbacd4
commit 89563d78b2
3 changed files with 9 additions and 7 deletions

View File

@ -1,9 +1,9 @@
dnl --------------------------------------------------------------------------
dnl PA_ADD_CFLAGS(variable, flag [,actual_flag])
dnl PA_ADD_CFLAGS(variable, flag [,actual_flag [,success [,failure]]]])
dnl
dnl Attempt to add the given option to xFLAGS, 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_CFLAGS], [PA_ADD_FLAGS(CFLAGS, [$1], [$2])])
AC_DEFUN([PA_ADD_CFLAGS], [PA_ADD_FLAGS(CFLAGS, [$1], [$2], [$3], [$4])])

View File

@ -1,5 +1,5 @@
dnl --------------------------------------------------------------------------
dnl PA_ADD_FLAGS(variable, flag [,actual_flag])
dnl PA_ADD_FLAGS(variable, flag [,actual_flag [,success [,failure]]])
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
@ -15,6 +15,8 @@ AC_DEFUN([PA_ADD_FLAGS],
[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])],
[Define to 1 if compiled with the `$2' compiler flag])
$4],
[AC_MSG_RESULT([no])
$1="$pa_add_flags__old_flags"])])
$1="$pa_add_flags__old_flags"
$5])])

View File

@ -1,9 +1,9 @@
dnl --------------------------------------------------------------------------
dnl PA_ADD_LDFLAGS(variable, flag [,actual_flag])
dnl PA_ADD_LDFLAGS(variable, flag [,actual_flag [,success [,failure]]]])
dnl
dnl Attempt to add the given option to xFLAGS, 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_LDFLAGS], [PA_ADD_FLAGS(LDFLAGS, [$1], [$2])])
AC_DEFUN([PA_ADD_LDFLAGS], [PA_ADD_FLAGS(LDFLAGS, [$1], [$2], [$3], [$4])])