diff options
author | Bastien ROUCARIÈS <roucaries.bastien@gmail.com> | 2013-10-01 22:29:22 +0200 |
---|---|---|
committer | Bastien ROUCARIÈS <roucaries.bastien@gmail.com> | 2013-10-05 14:04:41 +0200 |
commit | ef9fa9a9fa48f4480aab7f57b4b3fd1328413938 (patch) | |
tree | c219fb4d14cc883735f77fa6bbbfbc1d6f7a3d47 /m4/ax_switch_flags.m4 | |
parent | d039aa765f44be6cc9d145d03ff033b08a728b27 (diff) | |
download | autoconf-archive-ef9fa9a9fa48f4480aab7f57b4b3fd1328413938.tar.gz |
Improve save/restore flags
Add generic list of flags to save/restore
Add a namespace prefix in order to nest save/restore
Diffstat (limited to 'm4/ax_switch_flags.m4')
-rw-r--r-- | m4/ax_switch_flags.m4 | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/m4/ax_switch_flags.m4 b/m4/ax_switch_flags.m4 new file mode 100644 index 0000000..1a31ee1 --- /dev/null +++ b/m4/ax_switch_flags.m4 @@ -0,0 +1,46 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_restore_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_SWITCH_FLAGS(newnamespace,[oldnamespace]) +# +# DESCRIPTION +# +# Switch common compilation flags from temporary variables +# between two compilation namespace. +# +# 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(beginprogram) +# CPPFLAGS="-Imypackagespath ${CPPFLAGS}" +# AX_SWITCH_FLAGS(mypackage,beginprogram) +# +# 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 1 + +AC_DEFUN([AX_SWITCH_FLAGS], [ + AC_REQUIRE(AX_SAVE_FLAGS) + AC_REQUIRE(AX_RESTORE_FLAGS) + AS_IF([test "X$1" = "X"], AC_MSG_ERROR(newnamespace is empty)] + AX_SAVE_FLAGS($1[]) + AX_RESTORE_FLAGS($2[]) +]) |