Debian Codegraph @

tests/statesave.m4

raw
1 # statesave.m4 serial 3
2
3 # Copyright (C) 2000-2017, 2020-2026 Free Software Foundation, Inc.
4
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18
19 # AC_STATE_SAVE_ENV(FILE)
20 # -----------------------
21 # Save all shell variables' current settings into 'state-env.FILE'.
22 # Shell variables whose values contain newlines may cause problems.
23 m4_defun([AC_STATE_SAVE_ENV],
24 [(set) 2>&1 | sort >state-env.$1
25 ])
26
27
28 # AC_STATE_SAVE_DIR(FILE)
29 # -----------------------
30 # Save the current directory listing into 'state-ls.FILE'.
31 # Files whose names begin with 'at-' or 'state-' are skipped.
32 # Files whose names contain newlines may cause problems.
33 #
34 # The sed script duplicates uniq functionality (thanks to 'info sed
35 # uniq' for the recipe), in order to avoid a Mac OS 10.5 bug where
36 # readdir can list a file multiple times in a rapidly changing
37 # directory, while avoiding yet another fork.
38 m4_defun([AC_STATE_SAVE_DIR],
39 [(set) 2>&1 | sort >state-env.$1
40 ls | sed '/^at-/d;/^state-/d;/^config\./d
41 h
42 :b
43 $b
44 N
45 /^\(.*\)\n\1$/ {
46 g
47 bb
48 }
49 $b
50 P
51 D' >state-ls.$1
52 ])
53
54
55 # AC_STATE_SAVE(FILE)
56 # -------------------
57 # Save the shell variables and directory listing. AT_CHECK_ENV uses these to
58 # confirm that no test modifies variables outside the Autoconf namespace or
59 # leaves temporary files. AT_CONFIG_CMP uses the variable dumps to confirm
60 # that tests have the same side effects regardless of caching.
61 m4_defun([AC_STATE_SAVE],
62 [AC_STATE_SAVE_ENV($@)AC_STATE_SAVE_DIR($@)])