2
0

distcheck-configure-flags-subpkg.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 AM_DISTCHECK_CONFIGURE_FLAGS and DISTCHECK_CONFIGURE_FLAGS
  17. # are not honored in a subpackage Makefile.am, but the flags from
  18. # AM_DISTCHECK_CONFIGURE_FLAGS and DISTCHECK_CONFIGURE_FLAGS are
  19. # passed down to the configure script of the subpackage. This is
  20. # explicitly documented in the manual.
  21. . test-init.sh
  22. cat >> configure.ac << 'END'
  23. AC_CONFIG_SUBDIRS([subpkg])
  24. if test $dc != ok || test $am_dc != ok; then
  25. AC_MSG_ERROR([dc=$dc am_dc=$dc])
  26. fi
  27. AC_OUTPUT
  28. END
  29. mkdir subpkg
  30. sed <configure.ac >subpkg/configure.ac \
  31. -e 's/^AC_INIT.*/AC_INIT([subpkg], [2.0])/' \
  32. -e '/^AC_CONFIG_SUBDIRS/d' \
  33. cat configure.ac
  34. cat subpkg/configure.ac
  35. dc=KO am_dc=KO; export dc am_dc
  36. cat > Makefile.am << 'END'
  37. AM_DISTCHECK_CONFIGURE_FLAGS = am_dc=ok
  38. DISTCHECK_CONFIGURE_FLAGS = dc=ok
  39. END
  40. : > subpkg/Makefile.am
  41. $ACLOCAL
  42. $AUTOMAKE
  43. $AUTOCONF
  44. cd subpkg
  45. $ACLOCAL
  46. $AUTOMAKE
  47. $AUTOCONF
  48. cd ..
  49. # For debugging.
  50. $FGREP 'DISTCHECK_CONFIGURE_FLAGS' Makefile.in subpkg/Makefile.in
  51. grep '^AM_DISTCHECK_CONFIGURE_FLAGS =' Makefile.in
  52. grep '^DISTCHECK_CONFIGURE_FLAGS =' Makefile.in
  53. $EGREP '^(AM_)?DISTCHECK_CONFIGURE_FLAGS' subpkg/Makefile.in && exit 1
  54. ./configure dc=ok am_dc=ok
  55. # Flags in $(DISTCHECK_CONFIGURE_FLAGS) and $(AM_DISTCHECK_CONFIGURE_FLAGS)
  56. # should be passed down to the subpackage configure when "make distcheck"
  57. # is run from the top-level package ...
  58. $MAKE distcheck
  59. # ... but not when "make distcheck" is run from the subpackage.
  60. cd subpkg
  61. run_make -e FAIL -M distcheck
  62. grep '^configure:.* dc=KO am_dc=KO' output
  63. :