]>
Commit | Line | Data |
---|---|---|
fa522425 FC |
1 | dnl |
2 | dnl AUTHOR: Francesco Chemolli | |
3 | dnl | |
4 | dnl SQUID Web Proxy Cache http://www.squid-cache.org/ | |
5 | dnl ---------------------------------------------------------- | |
6 | dnl Squid is the result of efforts by numerous individuals from | |
7 | dnl the Internet community; see the CONTRIBUTORS file for full | |
8 | dnl details. Many organizations have provided support for Squid's | |
9 | dnl development; see the SPONSORS file for full details. Squid is | |
10 | dnl Copyrighted (C) 2001 by the Regents of the University of | |
11 | dnl California; see the COPYRIGHT file for full details. Squid | |
12 | dnl incorporates software developed and/or copyrighted by other | |
13 | dnl sources; see the CREDITS file for full details. | |
14 | dnl | |
15 | dnl This program is free software; you can redistribute it and/or modify | |
16 | dnl it under the terms of the GNU General Public License as published by | |
17 | dnl the Free Software Foundation; either version 2 of the License, or | |
18 | dnl (at your option) any later version. | |
19 | dnl | |
20 | dnl This program is distributed in the hope that it will be useful, | |
21 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | dnl GNU General Public License for more details. | |
24 | dnl | |
25 | dnl You should have received a copy of the GNU General Public License | |
26 | dnl along with this program; if not, write to the Free Software | |
27 | dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
28 | ||
29 | dnl save main environment variables to variables to the namespace defined by the | |
30 | dnl first argument (prefix) | |
31 | dnl e.g. SQUID_SAVEFLAGS([foo]) will save CFLAGS to foo_CFLAGS etc. | |
32 | dnl Saved variables are: | |
33 | dnl CFLAGS, CXXFLAGS, LDFLAGS, LIBS plus any variables specified as | |
34 | dnl second argument | |
35 | AC_DEFUN([SQUID_STATE_SAVE],[ | |
36 | $1_CFLAGS="${CFLAGS}" | |
37 | $1_CXXFLAGS="${CXXFLAGS}" | |
38 | $1_LDFLAGS="${LDFLAGS}" | |
39 | $1_LIBS="${LIBS}" | |
40 | $1_squid_saved_vars="$2" | |
41 | for squid_util_var_tosave in $2 | |
42 | do | |
43 | squid_util_var_tosave2="$1_${squid_util_var_tosave}" | |
44 | eval "${squid_util_var_tosave2}=\"${squid_util_var_tosave}\"" | |
45 | done | |
46 | ]) | |
47 | ||
48 | dnl commit the state changes: deleting the temporary state defined in SQUID_STATE_SAVE | |
49 | dnl with the same prefix. It's not necessary to specify the extra variables passed | |
50 | dnl to SQUID_STATE_SAVE again, they will be automatically reclaimed. | |
51 | AC_DEFUN([SQUID_STATE_COMMIT],[ | |
52 | unset $1_CFLAGS | |
53 | unset $1_$CXXFLAGS | |
54 | unset $1_LDFLAGS | |
55 | unset $1_LIBS | |
56 | for squid_util_var_tosave in $$1_squid_saved_vars | |
57 | do | |
58 | unset ${squid_util_var_tosave2} | |
59 | done | |
60 | ]) | |
61 | ||
62 | dnl rollback state to the call of SQUID_STATE_SAVE with the same namespace argument. | |
63 | dnl all temporary state will be cleared, including the custom variables specified | |
64 | dnl at call time. It's not necessary to explicitly name them, they will be automatically | |
65 | dnl cleared. | |
66 | AC_DEFUN([SQUID_STATE_ROLLBACK],[ | |
67 | CFLAGS="${$1_CFLAGS}" | |
68 | CXXFLAGS="${$1_CXXFLAGS}" | |
69 | LDFLAGS="${$1_LDFLAGS}" | |
70 | LIBS="${$1_LIBS}" | |
71 | for squid_util_var_tosave in $$1_squid_saved_vars | |
72 | do | |
73 | squid_util_var_tosave2="$1_${squid_util_var_tosave}" | |
74 | eval "${squid_util_var_tosave}=\$${squid_util_var_tosave2}" | |
75 | done | |
76 | SQUID_STATE_COMMIT($1) | |
77 | ]) | |
78 |