aafd363865aa73e776837f0a947a35ca6cbfaed6
[awesomized/libmemcached] / m4 / ax_restore_flags.m4
1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_restore_flags.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_RESTORE_FLAGS([namespace])
8 #
9 # DESCRIPTION
10 #
11 # Restore common compilation flags from temporary variables.
12 #
13 # Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
14 # OBJCFLAGS.
15 #
16 # By default these flags are restored to a global (empty) namespace, but
17 # user could restore from specific NAMESPACE by using
18 # AX_RESTORE_FLAGS(NAMESPACE) macro.
19 #
20 # Typical usage is like:
21 #
22 # AX_SAVE_FLAGS(mypackage)
23 # CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
24 # dnl ... do some detection ...
25 # AX_RESTORE_FLAGS(mypackage)
26 #
27 # LICENSE
28 #
29 # Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
30 # Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
31 # Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
32 # Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
33 #
34 # Copying and distribution of this file, with or without modification, are
35 # permitted in any medium without royalty provided the copyright notice
36 # and this notice are preserved. This file is offered as-is, without any
37 # warranty.
38
39 #serial 6
40
41 # save one flag in name space
42 AC_DEFUN([_AX_RESTORE_ONE_FLAG],[dnl
43 AS_VAR_PUSHDEF([_ax_restore_flag_var], [$2[]_$1[]_ax_save_flags])
44 AS_VAR_COPY($2[],_ax_restore_flag_var)
45 AS_VAR_POPDEF([_ax_restore_flag_var])
46 ])
47
48 AC_DEFUN([AX_RESTORE_FLAGS], [dnl
49 m4_foreach([FLAG], dnl
50 [_AX_SAVE_FLAGS_LIST()], dnl
51 [_AX_RESTORE_ONE_FLAG([$1],FLAG)])
52 ])