2939bddcca4e07d7da3f4f5bfc78da48004758dd
[awesomized/libmemcached] / m4 / ax_switch_flags.m4
1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_switch_flags.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_SWITCH_FLAGS(newnamespace,[oldnamespace])
8 #
9 # DESCRIPTION
10 #
11 # Switch common compilation flags from temporary variables between two
12 # compilation namespace.
13 #
14 # Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
15 # OBJCFLAGS.
16 #
17 # By default these flags are restored to a global (empty) namespace, but
18 # user could restore from specific NAMESPACE by using
19 # AX_RESTORE_FLAGS(NAMESPACE) macro.
20 #
21 # Typical usage is like:
22 #
23 # AX_SAVE_FLAGS(beginprogram)
24 # CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
25 # AX_SWITCH_FLAGS(mypackage,beginprogram)
26 #
27 # LICENSE
28 #
29 # Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
30 # Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
31 # Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
32 #
33 # Copying and distribution of this file, with or without modification, are
34 # permitted in any medium without royalty provided the copyright notice
35 # and this notice are preserved. This file is offered as-is, without any
36 # warranty.
37
38 #serial 2
39
40 AC_DEFUN([AX_SWITCH_FLAGS], [
41 AC_REQUIRE(AX_SAVE_FLAGS)
42 AC_REQUIRE(AX_RESTORE_FLAGS)
43 AS_IF([test "X$1" = "X"], AC_MSG_ERROR(newnamespace is empty)]
44 AX_SAVE_FLAGS($1[])
45 AX_RESTORE_FLAGS($2[])
46 ])