2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Merge branch 'ondrej/autoconf-use-more-convenience-macros-from-autoconf-archive' into 'master'

Use couple more autoconf convenience macros to cleanup configure.ac

See merge request isc-projects/bind9!2054
This commit is contained in:
Ondřej Surý
2019-06-19 07:21:10 -04:00
8 changed files with 1131 additions and 200 deletions

4
aclocal.m4 vendored
View File

@@ -288,9 +288,13 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
m4_include([m4/ax_check_compile_flag.m4])
m4_include([m4/ax_check_link_flag.m4])
m4_include([m4/ax_check_openssl.m4])
m4_include([m4/ax_posix_shell.m4])
m4_include([m4/ax_pthread.m4])
m4_include([m4/ax_restore_flags.m4])
m4_include([m4/ax_save_flags.m4])
m4_include([m4/libtool.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])

880
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -80,33 +80,32 @@ AC_ARG_ENABLE(buffer_useinline,
fi,
AC_DEFINE([ISC_BUFFER_USEINLINE], [1]))
AC_ARG_ENABLE(warn_shadow,
AS_HELP_STRING([--enable-warn-shadow],
[turn on -Wshadow when compiling]))
AC_ARG_ENABLE([warn_shadow],
[AS_HELP_STRING([--enable-warn-shadow],
[turn on -Wshadow when compiling])])
AC_ARG_ENABLE(warn_error,
AS_HELP_STRING([--enable-warn-error],
[turn on -Werror when compiling]))
AC_ARG_ENABLE([warn_error],
[AS_HELP_STRING([--enable-warn-error],
[turn on -Werror when compiling])])
AC_ARG_ENABLE([developer],
[AS_HELP_STRING([--enable-developer],
[enable developer build settings])])
AC_ARG_ENABLE(developer,
AS_HELP_STRING([--enable-developer],
[enable developer build settings]))
XTARGETS=
case "$enable_developer" in
yes)
STD_CDEFINES="$STD_CDEFINES -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1"
test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
test "${enable_querytrace+set}" = set || enable_querytrace=yes
test "${with_cmocka+set}" = set || with_cmocka=yes
test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
test "${enable_symtable+set}" = set || enable_symtable=all
test "${enable_warn_error+set}" = set || enable_warn_error=yes
test "${enable_warn_shadow+set}" = set || enable_warn_shadow=yes
test "${with_zlib+set}" = set || with_zlib=yes
XTARGETS='${XTARGETS}'
;;
esac
AC_SUBST(XTARGETS)
AS_IF([test "$enable_developer" = "yes"],
[STD_CDEFINES="$STD_CDEFINES -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1"
test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
test "${enable_querytrace+set}" = set || enable_querytrace=yes
test "${with_cmocka+set}" = set || with_cmocka=yes
test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes
test "${enable_symtable+set}" = set || enable_symtable=all
test "${enable_warn_error+set}" = set || enable_warn_error=yes
test "${enable_warn_shadow+set}" = set || enable_warn_shadow=yes
test "${with_zlib+set}" = set || with_zlib=yes
XTARGETS='${XTARGETS}'
])
AC_SUBST([XTARGETS])
AC_ARG_ENABLE([fuzzing],
[AS_HELP_STRING([--enable-fuzzing=<afl|libfuzzer>],
@@ -757,9 +756,8 @@ CRYPTO=OpenSSL
#
AX_CHECK_OPENSSL([:],[AC_MSG_FAILURE([OpenSSL/LibreSSL not found])])
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
save_LDFLAGS="$LDFLAGS"
AX_SAVE_FLAGS([openssl])
CFLAGS="$CFLAGS $OPENSSL_INCLUDES"
LIBS="$LIBS $OPENSSL_LIBS"
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
@@ -862,9 +860,7 @@ AS_CASE([$enable_fips_mode],
[], [AC_MSG_FAILURE([OpenSSL FIPS mode requested but not available.])])],
[no], [AC_MSG_RESULT([no])])
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"
AX_RESTORE_FLAGS([openssl])
AC_SUBST([OPENSSL_INCLUDES])
AC_SUBST([OPENSSL_LIBS])
@@ -1458,53 +1454,31 @@ AC_CHECK_LIB(scf, smf_enable_instance)
# Additional compiler settings.
#
MKDEPCC="$CC"
MKDEPCFLAGS="-M"
AS_CASE([$host],
[*-solaris*],[
AS_IF([test "$GCC" != "yes"],
[MKDEPCFLAGS="-xM"])])
if test "X$GCC" = "Xyes"; then
STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"
AC_MSG_CHECKING(if "$CC" supports -fno-strict-aliasing)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror -fno-strict-aliasing"
AC_TRY_COMPILE(,, [FNOSTRICTALIASING=yes],[FNOSTRICTALIASING=no])
CFLAGS="$SAVE_CFLAGS"
if test "yes" = "$FNOSTRICTALIASING"; then
AC_MSG_RESULT(yes)
STD_CWARNINGS="$STD_CWARNINGS -fno-strict-aliasing"
else
AC_MSG_RESULT(no)
fi
#
# turn off delete null pointer checks
#
AC_MSG_CHECKING(if "$CC" supports -fno-delete-null-pointer-checks)
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror -fno-delete-null-pointer-checks"
AC_TRY_COMPILE(,, [FNODELETENULLPOINTERCHECKS=yes],
[FNODELETENULLPOINTERCHECKS=no])
CFLAGS="$SAVE_CFLAGS"
if test "yes" = "$FNODELETENULLPOINTERCHECKS"; then
AC_MSG_RESULT(yes)
STD_CWARNINGS="$STD_CWARNINGS -fno-delete-null-pointer-checks"
else
AC_MSG_RESULT(no)
fi
if test "X$enable_warn_shadow" = Xyes; then
STD_CWARNINGS="$STD_CWARNINGS -Wshadow"
fi
if test "X$enable_warn_error" = Xyes; then
STD_CWARNINGS="$STD_CWARNINGS -Werror"
fi
else
case $host in
*-solaris*)
MKDEPCFLAGS="-xM"
;;
esac
fi
AS_IF([test "$GCC" = "yes"],
[STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith"]
)
AC_SUBST(MKDEPCC)
AC_SUBST(MKDEPCFLAGS)
AC_SUBST(MKDEPPROG)
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing],
[STD_CWARNINGS="$STD_CWARNINGS -fno-strict-aliasing"])
AX_CHECK_COMPILE_FLAG([-fno-delete-null-pointer-checks],
[STC_CWARNINGS="$STD_CWARNINGS -fno-delete-null-pointer-checks"])
AS_IF([test "$enable_warn_shadow" = "yes"],
[AX_CHECK_COMPILE_FLAG([-Wshadow],
[STD_CWARNINGS="$STD_CWARNINGS -Wshadow"])])
AS_IF([test "$enable_warn_error" = "yes"],
[AX_CHECK_COMPILE_FLAG([-Werror],
[STD_CWARNINGS="$STD_CWARNINGS -Werror"])])
AC_SUBST([MKDEPCC])
AC_SUBST([MKDEPCFLAGS])
AC_SUBST([MKDEPPROG])
#
# -lxnet buys us one big porting headache... standards, gotta love 'em.
@@ -1841,12 +1815,12 @@ AS_IF([test "$enable_linux_caps" = "yes"],
[],
[AC_MSG_ERROR(m4_normalize([sys/capability.h header is required for Linux capabilities support.
Either install libcap or use --disable-linux-caps.]))])
save_LIBS="$LIBS"
AX_SAVE_FLAGS([cap])
AC_SEARCH_LIBS([cap_set_proc], [cap],
[LIBCAP_LIBS="$ac_cv_search_cap_set_proc"],
[AC_MSG_ERROR(m4_normalize([libcap is required for Linux capabilities support.
Either install libcap or use --disable-linux-caps.]))])
LIBS="$save_LIBS"],
AX_RESTORE_FLAGS([cap])],
[AC_MSG_RESULT([no])])
AC_SUBST([LIBCAP_LIBS])
@@ -1916,7 +1890,7 @@ AC_CHECK_HEADERS(
)],
[AC_MSG_RESULT([no])],
[ISC_ATOMIC_LIBS="-latomic"
save_LIBS="$LIBS"
AX_SAVE_FLAGS([atomic])
LIBS="$LIBS $ISC_ATOMIC_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
@@ -1925,7 +1899,7 @@ AC_CHECK_HEADERS(
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
LIBS="$save_LIBS"
AX_RESTORE_FLAGS([atomic])
])
],
[AC_MSG_FAILURE([stdatomic.h header found, but compilation failed, please fix your toolchain.])]
@@ -1946,7 +1920,7 @@ AC_CHECK_HEADERS(
)],
[AC_MSG_RESULT([no])],
[ISC_ATOMIC_LIBS="-latomic"
save_LIBS="$LIBS"
AX_SAVE_FLAGS([atomic])
LIBS="$LIBS $ISC_ATOMIC_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
@@ -1955,7 +1929,7 @@ AC_CHECK_HEADERS(
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([libatomic needed, but linking with -latomic failed, please fix your toolchain.])])
LIBS="$save_LIBS"
AX_RESTORE_FLAGS([atomic])
])
],
[AC_MSG_RESULT([__sync builtins])
@@ -2280,10 +2254,7 @@ AS_CASE([$with_libidn2],
[yes], [PKG_CHECK_MODULES([LIBIDN2], [libidn2],
[AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])])],
[no], [],
[*], [save_CFLAGS="$CFLAGS"
save_CPPFLAGS="$CPPFLAGS"
save_LDFLAGS="$LDFLAGS"
save_LIBS="$LIBS"
[*], [AX_SAVE_FLAGS([libidn2])
LIBIDN2_CFLAGS="-I$with_libidn2/include"
LIBIDN2_LDFLAGS="-L$with_libidn2/lib"
CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
@@ -2296,10 +2267,7 @@ AS_CASE([$with_libidn2],
[LIBIDN2_LIBS="$ac_cv_search_idn2_to_ascii_lz"
AC_DEFINE([HAVE_LIBIDN2], [1], [Define if libidn2 was found])],
[AC_MSG_ERROR([libidn2 requested, but not found])])
CFLAGS="$save_CFLAGS"
CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"])
AX_RESTORE_FLAGS([libidn2])])
AC_SUBST([LIBIDN2_CFLAGS])
AC_SUBST([LIBIDN2_LDFLAGS])
AC_SUBST([LIBIDN2_LIBS])
@@ -2342,24 +2310,15 @@ AC_SUBST([KYUA])
# Check for -Wl,--wrap= support
#
save_LDFLAGS=$LDFLAGS
LDFLAGS="--wrap=printf"
LD_WRAP_TESTS=false
enable_ld_wrap=no
AC_MSG_CHECKING([for linker support for --wrap option])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdio.h>], [__wrap_printf("success"); return (0);])],
[enable_ld_wrap=yes
LD_WRAP_TESTS=true
AC_DEFINE([LD_WRAP], [1], [define if the linker supports --wrap option])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AX_CHECK_LINK_FLAG([--wrap],
[enable_ld_wrap=yes
LD_WRAP_TESTS=true
AC_DEFINE([LD_WRAP], [1], [define if the linker supports --wrap option])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# AM_CONDITIONAL([LD_WRAP], [test $enable_ld_wrap = yes])
AC_SUBST([LD_WRAP_TESTS])
LDFLAGS=$save_LDFLAGS
#
# Check for i18n
#

View File

@@ -0,0 +1,53 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS

53
m4/ax_check_link_flag.m4 Normal file
View File

@@ -0,0 +1,53 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the linker or gives an error.
# (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
# when the check is done. The check is thus made with the flags: "LDFLAGS
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
# issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_LINK_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AC_DEFUN([AX_CHECK_LINK_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
ax_check_save_flags=$LDFLAGS
LDFLAGS="$LDFLAGS $4 $1"
AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
LDFLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_LINK_FLAGS

View File

@@ -0,0 +1,53 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_preproc_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_PREPROC_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's
# preprocessor or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the preprocessor's default
# flags when the check is done. The check is thus made with the flags:
# "CPPFLAGS EXTRA-FLAGS FLAG". This can for example be used to force the
# preprocessor to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_PREPROC_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{COMPILE,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 6
AC_DEFUN([AX_CHECK_PREPROC_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]cppflags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG preprocessor accepts $1], CACHEVAR, [
ax_check_save_flags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $4 $1"
AC_PREPROC_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
CPPFLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_PREPROC_FLAGS

52
m4/ax_restore_flags.m4 Normal file
View File

@@ -0,0 +1,52 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_restore_flags.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_RESTORE_FLAGS([namespace])
#
# DESCRIPTION
#
# Restore common compilation flags from temporary variables.
#
# Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
# OBJCFLAGS.
#
# By default these flags are restored to a global (empty) namespace, but
# user could restore from specific NAMESPACE by using
# AX_RESTORE_FLAGS(NAMESPACE) macro.
#
# Typical usage is like:
#
# AX_SAVE_FLAGS(mypackage)
# CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
# dnl ... do some detection ...
# AX_RESTORE_FLAGS(mypackage)
#
# LICENSE
#
# Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
# Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
# Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
# Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
# save one flag in name space
AC_DEFUN([_AX_RESTORE_ONE_FLAG],[dnl
AS_VAR_PUSHDEF([_ax_restore_flag_var], [$2[]_$1[]_ax_save_flags])
AS_VAR_COPY($2[],_ax_restore_flag_var)
AS_VAR_POPDEF([_ax_restore_flag_var])
])
AC_DEFUN([AX_RESTORE_FLAGS], [dnl
m4_foreach([FLAG], dnl
[_AX_SAVE_FLAGS_LIST()], dnl
[_AX_RESTORE_ONE_FLAG([$1],FLAG)])
])

71
m4/ax_save_flags.m4 Normal file
View File

@@ -0,0 +1,71 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_save_flags.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_SAVE_FLAGS([NAMESPACE])
#
# DESCRIPTION
#
# Save common compilation flags into temporary variables.
#
# Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
# OBJCFLAGS.
#
# By default these flags are saved to a global (empty) namespace, but user
# could specify a specific NAMESPACE to AX_SAVE_FLAGS macro and latter
# restore it by using AX_RESTORE_FLAGS(NAMESPACE).
#
# AX_SAVE_FLAGS(mypackage)
# CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
# dnl .. do some detection ...
# AX_RESTORE_FLAGS(mypackage)
#
# LICENSE
#
# Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
# Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
# Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
# Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 8
# list of flag to save
AC_DEFUN([_AX_SAVE_FLAGS_LIST],[dnl
[CCASFLAGS],dnl
[CFLAGS],dnl
[CPPFLAGS],dnl
[CXXFLAGS],dnl
[ERLCFLAGS],dnl
[FCFLAGS],dnl
[FCLIBS],dnl
[FFLAGS],dnl
[FLIBS],dnl
[GCJFLAGS],dnl
[JAVACFLAGS],dnl
[LDFLAGS],dnl
[LIBS],dnl
[OBJCFLAGS],dnl
[OBJCXXFLAGS],dnl
[UPCFLAGS],dnl
[VALAFLAGS]dnl
])
# save one flag in name space
AC_DEFUN([_AX_SAVE_ONE_FLAG],[
AS_VAR_PUSHDEF([_ax_save_flag_var], [$2[]_$1[]_ax_save_flags])
AS_VAR_COPY(_ax_save_flag_var, $2[])
AS_VAR_POPDEF([_ax_save_flag_var])
])
AC_DEFUN([AX_SAVE_FLAGS],[dnl
m4_foreach([FLAG], dnl
[_AX_SAVE_FLAGS_LIST()], dnl
[_AX_SAVE_ONE_FLAG([$1],FLAG)])
])