autogen.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #! /bin/sh
  2. # Run this to generate all the initial makefiles, etc.
  3. # Don't ignore errors.
  4. set -e
  5. # Make it possible to specify path in the environment
  6. : ${AUTOCONF=autoconf}
  7. : ${AUTOHEADER=autoheader}
  8. : ${AUTOMAKE=automake}
  9. : ${ACLOCAL=aclocal}
  10. : ${GETTEXTIZE=gettextize}
  11. : ${AUTOPOINT=autopoint}
  12. : ${XGETTEXT=xgettext}
  13. srcdir=`dirname $0`
  14. test -z "$srcdir" && srcdir=.
  15. (
  16. # Some shells don't propagate "set -e" to subshells.
  17. set -e
  18. cd "$srcdir"
  19. # The autoconf cache (version after 2.52) is not reliable yet.
  20. rm -rf autom4te.cache vfs/samba/autom4te.cache
  21. if test ! -d config; then
  22. mkdir config
  23. fi
  24. # Ensure that gettext is reasonably new.
  25. gettext_ver=`$GETTEXTIZE --version | \
  26. sed '2,$d; # remove all but the first line
  27. s/.* //; # take text after the last space
  28. s/-.*//; # strip "-pre" or "-rc" at the end
  29. s/\([^.][^.]*\)/0\1/g; # prepend 0 to every token
  30. s/0\([^.][^.]\)/\1/g; # strip leading 0 from long tokens
  31. s/$/.00.00/; # add .00.00 for short version strings
  32. s/\.//g; # remove dots
  33. s/\(......\).*/\1/; # leave only 6 leading digits
  34. '`
  35. if test -z "$gettext_ver"; then
  36. echo "Cannot determine version of gettext" 2>&1
  37. exit 1
  38. fi
  39. if test "$gettext_ver" -lt 01038; then
  40. echo "Don't use gettext older than 0.10.38" 2>&1
  41. exit 1
  42. fi
  43. rm -rf intl
  44. if test "$gettext_ver" -ge 01100; then
  45. if test "$gettext_ver" -lt 01105; then
  46. echo "Upgrade gettext to at least 0.11.5 or downgrade to 0.10.40" 2>&1
  47. exit 1
  48. fi
  49. $AUTOPOINT --force || exit 1
  50. else
  51. $GETTEXTIZE --copy --force || exit 1
  52. if test -e po/ChangeLog~; then
  53. rm -f po/ChangeLog
  54. mv po/ChangeLog~ po/ChangeLog
  55. fi
  56. fi
  57. # Generate po/POTFILES.in
  58. $XGETTEXT --keyword=_ --keyword=N_ --output=- `find . -name '*.[ch]'` | \
  59. sed -ne '/^#:/{s/#://;s/:[0-9]*/\n/g;s/ //g;p;}' | \
  60. grep -v '^$' | sort | uniq | grep -v 'regex.c' >po/POTFILES.in
  61. ACLOCAL_INCLUDES="-I m4"
  62. # Some old version of GNU build tools fail to set error codes.
  63. # Check that they generate some of the files they should.
  64. $ACLOCAL $ACLOCAL_INCLUDES $ACLOCAL_FLAGS
  65. test -f aclocal.m4 || \
  66. { echo "aclocal failed to generate aclocal.m4" 2>&1; exit 1; }
  67. $AUTOHEADER || exit 1
  68. test -f config.h.in || \
  69. { echo "autoheader failed to generate config.h.in" 2>&1; exit 1; }
  70. $AUTOCONF || exit 1
  71. test -f configure || \
  72. { echo "autoconf failed to generate configure" 2>&1; exit 1; }
  73. # Workaround for Automake 1.5 to ensure that depcomp is distributed.
  74. $AUTOMAKE -a src/Makefile
  75. $AUTOMAKE -a
  76. test -f Makefile.in || \
  77. { echo "automake failed to generate Makefile.in" 2>&1; exit 1; }
  78. cd vfs/samba
  79. date -u >include/stamp-h.in
  80. $AUTOHEADER
  81. test -f include/config.h.in || \
  82. { echo "autoheader failed to generate vfs/samba/include/config.h.in" 2>&1; exit 1; }
  83. $AUTOCONF
  84. test -f configure || \
  85. { echo "autoconf failed to generate vfs/samba/configure" 2>&1; exit 1; }
  86. ) || exit 1
  87. if test -x $srcdir/configure.mc; then
  88. $srcdir/configure.mc "$@"
  89. else
  90. $srcdir/configure --cache-file=config.cache --enable-maintainer-mode "$@"
  91. fi