autogen.sh 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. # remove all but the first line
  26. sed_cmd="sed -e '2,\$d'"
  27. # take text after the last space
  28. sed_cmd="${sed_cmd} -e 's/.* //'"
  29. # strip "-pre" or "-rc" at the end
  30. sed_cmd="${sed_cmd} -e 's/-.*//'"
  31. # prepend 0 to every token
  32. sed_cmd="${sed_cmd} -e 's/\\([^.][^.]*\\)/0\\1/g'"
  33. # strip leading 0 from long tokens
  34. sed_cmd="${sed_cmd} -e 's/0\\([^.][^.]\\)/\\1/g'"
  35. # add .00.00 for short version strings
  36. sed_cmd="${sed_cmd} -e 's/\$/.00.00/'"
  37. # remove dots
  38. sed_cmd="${sed_cmd} -e 's/\\.//g'"
  39. # leave only 6 leading digits
  40. sed_cmd="${sed_cmd} -e 's/\\(......\\).*/\\1/'"
  41. gettext_ver=`$GETTEXTIZE --version | eval ${sed_cmd}`
  42. if test -z "$gettext_ver"; then
  43. echo "Cannot determine version of gettext" >&2
  44. exit 1
  45. fi
  46. if test "$gettext_ver" -lt 01038; then
  47. echo "Don't use gettext older than 0.10.38" >&2
  48. exit 1
  49. fi
  50. rm -rf intl
  51. if test "$gettext_ver" -ge 01100; then
  52. if test "$gettext_ver" -lt 01105; then
  53. echo "Upgrade gettext to at least 0.11.5 or downgrade to 0.10.40" >&2
  54. exit 1
  55. fi
  56. $AUTOPOINT --force || exit 1
  57. else
  58. $GETTEXTIZE --copy --force || exit 1
  59. if test -e po/ChangeLog~; then
  60. rm -f po/ChangeLog
  61. mv po/ChangeLog~ po/ChangeLog
  62. fi
  63. fi
  64. # Generate po/POTFILES.in
  65. $XGETTEXT --keyword=_ --keyword=N_ --keyword=gettext_ui --output=- \
  66. `find . -name '*.[ch]'` | sed -ne '/^#:/{s/#://;s/:[0-9]*/\
  67. /g;s/ //g;p;}' | \
  68. grep -v '^$' | sort | uniq | grep -v 'regex.c' >po/POTFILES.in
  69. ACLOCAL_INCLUDES="-I m4"
  70. # Some old version of GNU build tools fail to set error codes.
  71. # Check that they generate some of the files they should.
  72. $ACLOCAL $ACLOCAL_INCLUDES $ACLOCAL_FLAGS
  73. test -f aclocal.m4 || \
  74. { echo "aclocal failed to generate aclocal.m4" >&2; exit 1; }
  75. $AUTOHEADER || exit 1
  76. test -f config.h.in || \
  77. { echo "autoheader failed to generate config.h.in" >&2; exit 1; }
  78. $AUTOCONF || exit 1
  79. test -f configure || \
  80. { echo "autoconf failed to generate configure" >&2; exit 1; }
  81. # Workaround for Automake 1.5 to ensure that depcomp is distributed.
  82. if test "`$AUTOMAKE --version|awk '{print $NF;exit}'`" = '1.5' ; then
  83. $AUTOMAKE -a src/Makefile
  84. fi
  85. $AUTOMAKE -a
  86. test -f Makefile.in || \
  87. { echo "automake failed to generate Makefile.in" >&2; exit 1; }
  88. cd vfs/samba
  89. date -u >include/stamp-h.in
  90. $AUTOHEADER
  91. test -f include/config.h.in || \
  92. { echo "autoheader failed to generate vfs/samba/include/config.h.in" >&2; exit 1; }
  93. $AUTOCONF
  94. test -f configure || \
  95. { echo "autoconf failed to generate vfs/samba/configure" >&2; exit 1; }
  96. ) || exit 1
  97. if test -x $srcdir/configure.mc; then
  98. $srcdir/configure.mc "$@"
  99. else
  100. $srcdir/configure --cache-file=config.cache --enable-maintainer-mode "$@"
  101. fi