distcheck-configure-flags-am.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #! /bin/sh
  2. # Copyright (C) 2011-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Check support for AM_DISTCHECK_CONFIGURE_FLAGS at "make distcheck"
  17. # time, and its interactions with DISTCHECK_CONFIGURE_FLAGS.
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_ARG_ENABLE([success], [], [success=$enableval], [success=no])
  21. AS_IF([test $success = yes && test "$sentence" = 'it works :-)'],
  22. [:],
  23. [AC_MSG_ERROR([success='$success', sentence='$sentence'])])
  24. AC_OUTPUT
  25. END
  26. unset sentence
  27. cat > Makefile.am << 'END'
  28. AM_DISTCHECK_CONFIGURE_FLAGS = $(dc_flags1) $(dc_flags2)
  29. dc_flags1 = --enable-success sentence='it works :-)'
  30. dc_flags2 =
  31. END
  32. $ACLOCAL
  33. $AUTOMAKE
  34. $FGREP '$(DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
  35. $FGREP '$(AM_DISTCHECK_CONFIGURE_FLAGS)' Makefile.in
  36. grep 'DISTCHECK_CONFIGURE_FLAGS.*AM_DISTCHECK_CONFIGURE_FLAGS' Makefile.in \
  37. && exit 1
  38. $AUTOCONF
  39. ./configure --enable-success sentence='it works :-)'
  40. # The configure call in "make distcheck" should honour
  41. # $(AM_DISTCHECK_CONFIGURE_FLAGS).
  42. $MAKE distcheck
  43. # $(DISTCHECK_CONFIGURE_FLAGS) takes precedence over
  44. # $(AM_DISTCHECK_CONFIGURE_FLAGS)
  45. cat >> Makefile.am << 'END'
  46. dc_flags2 += --disable-success
  47. END
  48. $AUTOMAKE Makefile
  49. ./config.status Makefile
  50. run_make -e FAIL -M distcheck
  51. grep "^configure:.* success='no', sentence='it works :-)'" output
  52. $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="--enable-success=yes"
  53. :