cond42.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/sh
  2. nfig
  3. # Copyright (C) 2008-2017 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 2, or (at your option)
  8. # 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 <http://www.gnu.org/licenses/>.
  17. # Ensure an error with inconsistent state of conditionals in configure.ac.
  18. # This shouldn't happen with user input, as _AM_COND_* are not documented,
  19. # but better to be safe.
  20. . test-init.sh
  21. cat >>configure.ac <<'END'
  22. AM_CONDITIONAL([COND], [:])
  23. # The next line is needed so that cond-if.m4 is pulled in.
  24. AM_COND_IF([COND])
  25. _AM_COND_IF([COND])
  26. AC_OUTPUT
  27. END
  28. edit_configure_ac ()
  29. {
  30. sed "$@" < configure.ac >configure.tmp
  31. mv -f configure.tmp configure.ac
  32. rm -rf autom4te*.cache
  33. }
  34. : >Makefile.am
  35. $ACLOCAL
  36. AUTOMAKE_fails
  37. grep '^configure\.ac:8:.* condition stack' stderr
  38. edit_configure_ac 's/_AM_COND_IF/_AM_COND_ELSE/'
  39. AUTOMAKE_fails
  40. grep '^configure\.ac:7:.* else without if' stderr
  41. edit_configure_ac 's/_AM_COND_ELSE/_AM_COND_ENDIF/'
  42. AUTOMAKE_fails
  43. grep '^configure\.ac:7:.* endif without if' stderr
  44. edit_configure_ac 's/\(_AM_COND_ENDIF\).*/_AM_COND_IF\
  45. _AM_COND_ENDIF/'
  46. AUTOMAKE_fails
  47. grep '^configure\.ac:7:.* not enough arguments.* _AM_COND_IF' stderr
  48. grep '^configure\.ac:8:.* not enough arguments.* _AM_COND_ENDIF' stderr
  49. test 2 -eq $($FGREP -c 'not enough arguments' stderr)
  50. :