Skip to content

Commit d938610

Browse files
committed
Updating various .m4 files
1 parent 72ac94d commit d938610

File tree

3 files changed

+294
-211
lines changed

3 files changed

+294
-211
lines changed

m4/ax_restore_flags.m4

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,52 @@
11
# ===========================================================================
2-
# http://www.gnu.org/software/autoconf-archive/ax_restore_flags.html
2+
# https://www.gnu.org/software/autoconf-archive/ax_restore_flags.html
33
# ===========================================================================
44
#
55
# SYNOPSIS
66
#
7-
# AX_RESTORE_FLAGS()
7+
# AX_RESTORE_FLAGS([namespace])
88
#
99
# DESCRIPTION
1010
#
11-
# Restore common compilation flags from temporary variables
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)
1226
#
1327
# LICENSE
1428
#
1529
# 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>
1633
#
1734
# Copying and distribution of this file, with or without modification, are
1835
# permitted in any medium without royalty provided the copyright notice
1936
# and this notice are preserved. This file is offered as-is, without any
2037
# warranty.
2138

22-
#serial 3
39+
#serial 7
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+
])
2347

24-
AC_DEFUN([AX_RESTORE_FLAGS], [
25-
CPPFLAGS="${CPPFLAGS_save}"
26-
CFLAGS="${CFLAGS_save}"
27-
CXXFLAGS="${CXXFLAGS_save}"
28-
OBJCFLAGS="${OBJCFLAGS_save}"
29-
LDFLAGS="${LDFLAGS_save}"
30-
LIBS="${LIBS_save}"
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)])
3152
])

m4/ax_save_flags.m4

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,71 @@
11
# ===========================================================================
2-
# http://www.gnu.org/software/autoconf-archive/ax_save_flags.html
2+
# https://www.gnu.org/software/autoconf-archive/ax_save_flags.html
33
# ===========================================================================
44
#
55
# SYNOPSIS
66
#
7-
# AX_SAVE_FLAGS()
7+
# AX_SAVE_FLAGS([NAMESPACE])
88
#
99
# DESCRIPTION
1010
#
11-
# Save common compilation flags into temporary variables
11+
# Save common compilation flags into temporary variables.
12+
#
13+
# Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS,
14+
# OBJCFLAGS.
15+
#
16+
# By default these flags are saved to a global (empty) namespace, but user
17+
# could specify a specific NAMESPACE to AX_SAVE_FLAGS macro and latter
18+
# restore it by using AX_RESTORE_FLAGS(NAMESPACE).
19+
#
20+
# AX_SAVE_FLAGS(mypackage)
21+
# CPPFLAGS="-Imypackagespath ${CPPFLAGS}"
22+
# dnl .. do some detection ...
23+
# AX_RESTORE_FLAGS(mypackage)
1224
#
1325
# LICENSE
1426
#
1527
# Copyright (c) 2009 Filippo Giunchedi <filippo@esaurito.net>
28+
# Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University
29+
# Copyright (c) 2011 Russ Allbery <rra@stanford.edu>
30+
# Copyright (c) 2013 Bastien ROUCARIES <roucaries.bastien+autoconf@gmail.com>
1631
#
1732
# Copying and distribution of this file, with or without modification, are
1833
# permitted in any medium without royalty provided the copyright notice
1934
# and this notice are preserved. This file is offered as-is, without any
2035
# warranty.
2136

22-
#serial 3
37+
#serial 8
38+
39+
# list of flag to save
40+
AC_DEFUN([_AX_SAVE_FLAGS_LIST],[dnl
41+
[CCASFLAGS],dnl
42+
[CFLAGS],dnl
43+
[CPPFLAGS],dnl
44+
[CXXFLAGS],dnl
45+
[ERLCFLAGS],dnl
46+
[FCFLAGS],dnl
47+
[FCLIBS],dnl
48+
[FFLAGS],dnl
49+
[FLIBS],dnl
50+
[GCJFLAGS],dnl
51+
[JAVACFLAGS],dnl
52+
[LDFLAGS],dnl
53+
[LIBS],dnl
54+
[OBJCFLAGS],dnl
55+
[OBJCXXFLAGS],dnl
56+
[UPCFLAGS],dnl
57+
[VALAFLAGS]dnl
58+
])
59+
60+
# save one flag in name space
61+
AC_DEFUN([_AX_SAVE_ONE_FLAG],[
62+
AS_VAR_PUSHDEF([_ax_save_flag_var], [$2[]_$1[]_ax_save_flags])
63+
AS_VAR_COPY(_ax_save_flag_var, $2[])
64+
AS_VAR_POPDEF([_ax_save_flag_var])
65+
])
2366

24-
AC_DEFUN([AX_SAVE_FLAGS], [
25-
CPPFLAGS_save="${CPPFLAGS}"
26-
CFLAGS_save="${CFLAGS}"
27-
CXXFLAGS_save="${CXXFLAGS}"
28-
OBJCFLAGS_save="${OBJCFLAGS}"
29-
LDFLAGS_save="${LDFLAGS}"
30-
LIBS_save="${LIBS}"
67+
AC_DEFUN([AX_SAVE_FLAGS],[dnl
68+
m4_foreach([FLAG], dnl
69+
[_AX_SAVE_FLAGS_LIST()], dnl
70+
[_AX_SAVE_ONE_FLAG([$1],FLAG)])
3171
])

0 commit comments

Comments
 (0)