maint: update copyright dates for 2017
[autoconf.git] / tests / statesave.m4
blob64b15b4f00554d570e26a152cac2569dbcfe27b1
1 # statesave.m4 serial 2
3 # Copyright (C) 2000-2017 Free Software Foundation, Inc.
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.
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.
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 # AC_STATE_SAVE(FILE)
19 # -------------------
20 # Save the shell variables and directory listing.  AT_CHECK_ENV uses these to
21 # confirm that no test modifies variables outside the Autoconf namespace or
22 # leaves temporary files.  AT_CONFIG_CMP uses the variable dumps to confirm
23 # that tests have the same side effects regardless of caching.
25 # The sed script duplicates uniq functionality (thanks to 'info sed
26 # uniq' for the recipe), in order to avoid a MacOS 10.5 bug where
27 # readdir can list a file multiple times in a rapidly changing
28 # directory, while avoiding yet another fork.
29 m4_defun([AC_STATE_SAVE],
30 [(set) 2>&1 | sort >state-env.$1
31 ls | sed '/^at-/d;/^state-/d;/^config\./d
32   h
33   :b
34   $b
35   N
36   /^\(.*\)\n\1$/ {
37     g
38     bb
39   }
40   $b
41   P
42   D' >state-ls.$1
43 ])# AC_STATE_SAVE