bootstrap 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/sh
  2. #
  3. # bootstrap - update generated files by invoking autoreconf, autogen and perl
  4. # Copyright (C) 2015-2017 Alex Vong
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License
  8. # as published by the Free Software Foundation; either version 2
  9. # of the License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software Foundation,
  18. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. # Process this file with autoconf to produce a configure script.
  20. # Use error
  21. set -e
  22. ERR_MISSING=127
  23. # Obtain DIRNAME by tranforming `foo/bar' to `foo/'
  24. # Otherwise, assume it is the current working directory
  25. case "$0" in
  26. */*)
  27. DIRNAME=`printf '%s' "$0" | sed -e 's/\/[^\/]*$/\//g'`
  28. ;;
  29. *)
  30. DIRNAME='./'
  31. ;;
  32. esac
  33. # Change to the script's directory
  34. cd "$DIRNAME"
  35. # Prepare the missing script
  36. chmod +x missing
  37. # Generate man page
  38. ./missing perl < /dev/null
  39. chmod +x build-aux/manpage.pl
  40. mkdir doc > /dev/null 2>&1 || true
  41. build-aux/manpage.pl > doc/mlucas.1
  42. # Invoke autogen
  43. cd am
  44. ../missing autogen main.def
  45. # Invoke autotools
  46. cd ..
  47. ./missing autoreconf -vfi
  48. # Make sure host has patch installed
  49. patch < /dev/null > /dev/zero 2>&1 || \
  50. {
  51. cat <<'EOF' >&2
  52. WARNING: 'patch' is missing on your system.
  53. You should need it to patch files generated by the autotools.
  54. The 'patch' program is part of the GNU patch package:
  55. <http://www.gnu.org/software/patch>
  56. EOF
  57. exit $ERR_MISSING
  58. }
  59. # Patch the generated missing script
  60. cp missing missing.orig
  61. patch -p1 -N \
  62. < patch/0001-missing-add-autoreconf-autogen-and-perl-as-supported.patch \
  63. || true
  64. if test -f missing.rej
  65. then
  66. rm -f missing missing.rej
  67. mv missing.orig missing
  68. else
  69. rm -f missing.orig
  70. fi