statesave.m4 1.5 KB

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