bootstrap 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #! /bin/sh
  2. # This script helps bootstrap automake, when checked out from git.
  3. #
  4. # Copyright (C) 2002-2017 Free Software Foundation, Inc.
  5. # Originally written by Pavel Roskin <proski@gnu.org> September 2002.
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2, or (at your option)
  10. # any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. # Since Automake uses itself in its build process, we can't simply run
  20. # 'autoreconf -i' which would require Automake to already be
  21. # installed.
  22. # Don't ignore failures.
  23. set -e
  24. # Set program basename.
  25. me=`echo "$0" | sed 's,^.*/,,'`
  26. # Let user choose which version of autoconf, autom4te and perl to use.
  27. : ${AUTOCONF=autoconf}
  28. export AUTOCONF # might be used by aclocal and/or automake
  29. : ${AUTOM4TE=autom4te}
  30. export AUTOM4TE # ditto
  31. : ${PERL=perl}
  32. # Variables to substitute.
  33. VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
  34. PACKAGE=automake
  35. datadir=.
  36. # This should be automatically updated by the 'update-copyright'
  37. # rule of our Makefile.
  38. RELEASE_YEAR=2017
  39. # Override SHELL. This is required on DJGPP so that Perl's system()
  40. # uses bash, not COMMAND.COM which doesn't quote arguments properly.
  41. # It's not used otherwise.
  42. if test -n "$DJDIR"; then
  43. BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe
  44. else
  45. BOOTSTRAP_SHELL=/bin/sh
  46. fi
  47. # Read the rule for calculating APIVERSION and execute it.
  48. apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac`
  49. eval "$apiver_cmd"
  50. # Sanity checks.
  51. if test -z "$VERSION"; then
  52. echo "$me: cannot find VERSION" >&2
  53. exit 1
  54. fi
  55. if test -z "$APIVERSION"; then
  56. echo "$me: cannot find APIVERSION" >&2
  57. exit 1
  58. fi
  59. # Make a dummy versioned directory for aclocal.
  60. rm -rf aclocal-$APIVERSION
  61. mkdir aclocal-$APIVERSION
  62. if test -d automake-$APIVERSION; then
  63. find automake-$APIVERSION -exec chmod u+wx '{}' ';'
  64. fi
  65. rm -rf automake-$APIVERSION
  66. # Can't use "ln -s lib automake-$APIVERSION", that would create a
  67. # lib.exe stub under DJGPP 2.03.
  68. mkdir automake-$APIVERSION
  69. cp -rf lib/* automake-$APIVERSION
  70. dosubst ()
  71. {
  72. rm -f $2
  73. in=`echo $1 | sed 's,^.*/,,'`
  74. sed -e "s%@APIVERSION@%$APIVERSION%g" \
  75. -e "s%@PACKAGE@%$PACKAGE%g" \
  76. -e "s%@PERL@%$PERL%g" \
  77. -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
  78. -e "s%@VERSION@%$VERSION%g" \
  79. -e "s%@datadir@%$datadir%g" \
  80. -e "s%@RELEASE_YEAR@%$RELEASE_YEAR%g" \
  81. -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \
  82. $1 > $2
  83. chmod a-w $2
  84. }
  85. # Create temporary replacement for lib/Automake/Config.pm.
  86. dosubst automake-$APIVERSION/Automake/Config.in \
  87. automake-$APIVERSION/Automake/Config.pm
  88. # Overwrite amversion.m4.
  89. dosubst m4/amversion.in m4/amversion.m4
  90. # Create temporary replacement for aclocal and automake.
  91. for p in bin/aclocal bin/automake; do
  92. dosubst $p.in $p.tmp
  93. $PERL -w bin/gen-perl-protos $p.tmp > $p.tmp2
  94. mv -f $p.tmp2 $p.tmp
  95. done
  96. # Create required makefile snippets.
  97. $PERL ./gen-testsuite-part > t/testsuite-part.tmp
  98. chmod a-w t/testsuite-part.tmp
  99. mv -f t/testsuite-part.tmp t/testsuite-part.am
  100. # Run the autotools. Bail out if any warning is triggered.
  101. # Use '-I' here so that our own *.m4 files in m4/ gets included,
  102. # not copied, in aclocal.m4.
  103. $PERL ./bin/aclocal.tmp -Wall -Werror -I m4 \
  104. --automake-acdir=m4 --system-acdir=m4/acdir
  105. $AUTOCONF -Wall -Werror
  106. $PERL ./bin/automake.tmp -Wall -Werror
  107. # Remove temporary files and directories.
  108. rm -rf aclocal-$APIVERSION automake-$APIVERSION
  109. rm -f bin/aclocal.tmp bin/automake.tmp