autohdr4.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  2. # Copyright (C) 2003-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 rebuild rules for AC_CONFIG_HEADERS.
  17. # (This should also work without GNU Make.)
  18. required=cc
  19. . test-init.sh
  20. cat >>configure.ac <<'EOF'
  21. AC_PROG_CC
  22. AC_SUBST([BOT], [bot])
  23. AC_CONFIG_HEADERS([defs.h config.h:sub1/config.top:sub2/config.${BOT}],,
  24. [BOT=$BOT])
  25. AC_CONFIG_FILES([sub3/Makefile])
  26. AC_OUTPUT
  27. EOF
  28. mkdir sub1 sub2 sub3
  29. : > sub1/config.top
  30. echo '#define NAME "grepme1"' >sub2/config.bot
  31. cat > Makefile.am <<'END'
  32. SUBDIRS = sub3
  33. .PHONY: test-prog-updated
  34. test-prog-updated:
  35. is_newest sub3/run$(EXEEXT) sub2/config.bot
  36. END
  37. cat > sub3/Makefile.am <<'END'
  38. noinst_PROGRAMS = run
  39. END
  40. cat >sub3/run.c <<'EOF'
  41. #include <defs.h>
  42. #include <config.h>
  43. #include <stdio.h>
  44. int main (void)
  45. {
  46. puts (NAME); /* from config.h */
  47. puts (PACKAGE); /* from defs.h */
  48. }
  49. EOF
  50. $ACLOCAL
  51. $AUTOCONF
  52. $AUTOHEADER
  53. $AUTOMAKE
  54. # Do not reject slow dependency extractors: we need dependency tracking.
  55. ./configure --enable-dependency-tracking
  56. $MAKE
  57. # Sanity check.
  58. cross_compiling || sub3/run | grep grepme1 || exit 1
  59. $sleep
  60. echo '#define NAME "grepme2"' > sub2/config.bot
  61. $MAKE
  62. cross_compiling || sub3/run | grep grepme2 || exit 1
  63. $MAKE test-prog-updated
  64. $MAKE distcheck
  65. :