2 # Convenience script for regenerating all autogeneratable files that are
3 # omitted from the version control repository. In particular, this script
4 # also regenerates all aclocal.m4, config.h.in, Makefile.in, configure files
5 # with new versions of autoconf or automake.
7 # This script requires autoconf-2.60..2.65 and automake-1.11.1 in the PATH.
8 # It also requires either
9 # - the GNULIB_TOOL environment variable pointing to the gnulib-tool script
10 # in a gnulib checkout, or
11 # - the git program in the PATH and an internet connection.
13 # - the bison program,
14 # - the gperf program,
15 # - the groff program,
16 # - the makeinfo program from the texinfo package,
19 # Copyright (C) 2003-2010 Free Software Foundation, Inc.
21 # This program is free software: you can redistribute it and/or modify
22 # it under the terms of the GNU General Public License as published by
23 # the Free Software Foundation; either version 3 of the License, or
24 # (at your option) any later version.
26 # This program is distributed in the hope that it will be useful,
27 # but WITHOUT ANY WARRANTY; without even the implied warranty of
28 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 # GNU General Public License for more details.
31 # You should have received a copy of the GNU General Public License
32 # along with this program. If not, see <http://www.gnu.org/licenses/>.
34 # Usage: ./autogen.sh [--quick] [--skip-gnulib]
36 # Usage after a first-time git clone / cvs checkout: ./autogen.sh
37 # Usage after a git clone / cvs update: ./autogen.sh --quick
38 # This uses an up-to-date gnulib checkout.
39 # (The gettext-0.18.1 release was prepared using gnulib commit
40 # 74d509383fe30bb5511a978b52e4f8ecae37826b from 2010-06-03.)
42 # Usage from a released tarball: ./autogen.sh --quick --skip-gnulib
43 # This does not use a gnulib checkout.
49 --quick) quick=true; shift;;
50 --skip-gnulib) skip_gnulib=true; shift;;
55 # The tests in gettext-tools/tests are not meant to be executable, because
56 # they have a TESTS_ENVIRONMENT that specifies the shell explicitly.
58 if ! $skip_gnulib; then
59 if test -z "$GNULIB_TOOL"; then
60 # Check out gnulib in a subdirectory 'gnulib'.
61 if test -d gnulib; then
62 (cd gnulib && git pull)
64 git clone git://git.savannah.gnu.org/gnulib.git
66 # Now it should contain a gnulib-tool.
67 if test -f gnulib/gnulib-tool; then
68 GNULIB_TOOL=`pwd`/gnulib/gnulib-tool
70 echo "** warning: gnulib-tool not found" 1>&2
73 # Skip the gnulib-tool step if gnulib-tool was not found.
74 if test -n "$GNULIB_TOOL"; then
76 if test -f gettext-runtime/gnulib-m4/gnulib-cache.m4; then
77 mv -f gettext-runtime/gnulib-m4/gnulib-cache.m4 gettext-runtime/gnulib-m4/gnulib-cache.m4~
79 GNULIB_MODULES_RUNTIME_FOR_SRC='
99 GNULIB_MODULES_RUNTIME_OTHER='
105 $GNULIB_TOOL --dir=gettext-runtime --lib=libgrt --source-base=gnulib-lib --m4-base=gnulib-m4 --no-libtool --local-dir=gnulib-local --local-symlink \
106 --import $GNULIB_MODULES_RUNTIME_FOR_SRC $GNULIB_MODULES_RUNTIME_OTHER
107 # In gettext-runtime/libasprintf:
108 if test -f gettext-runtime/libasprintf/gnulib-m4/gnulib-cache.m4; then
109 mv -f gettext-runtime/libasprintf/gnulib-m4/gnulib-cache.m4 gettext-runtime/libasprintf/gnulib-m4/gnulib-cache.m4~
111 GNULIB_MODULES_LIBASPRINTF='
115 GNULIB_MODULES_LIBASPRINTF_OTHER='
117 $GNULIB_TOOL --dir=gettext-runtime/libasprintf --source-base=. --m4-base=gnulib-m4 --lgpl=2 --makefile-name=Makefile.gnulib --libtool --local-dir=gnulib-local --local-symlink \
118 --import $GNULIB_MODULES_LIBASPRINTF $GNULIB_MODULES_LIBASPRINTF_OTHER
120 if test -f gettext-tools/gnulib-m4/gnulib-cache.m4; then
121 mv -f gettext-tools/gnulib-m4/gnulib-cache.m4 gettext-tools/gnulib-m4/gnulib-cache.m4~
123 GNULIB_MODULES_TOOLS_FOR_SRC='
161 libunistring-optional
197 unilbrk/ulc-width-linebreaks
217 # Common dependencies of GNULIB_MODULES_TOOLS_FOR_SRC and GNULIB_MODULES_TOOLS_FOR_LIBGREP.
218 GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES='
242 GNULIB_MODULES_TOOLS_OTHER='
252 $GNULIB_TOOL --dir=gettext-tools --lib=libgettextlib --source-base=gnulib-lib --m4-base=gnulib-m4 --tests-base=gnulib-tests --makefile-name=Makefile.gnulib --libtool --with-tests --local-dir=gnulib-local --local-symlink \
253 --import --avoid=hash-tests $GNULIB_MODULES_TOOLS_FOR_SRC $GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES $GNULIB_MODULES_TOOLS_OTHER
254 # In gettext-tools/libgrep:
255 if test -f gettext-tools/libgrep/gnulib-m4/gnulib-cache.m4; then
256 mv -f gettext-tools/libgrep/gnulib-m4/gnulib-cache.m4 gettext-tools/libgrep/gnulib-m4/gnulib-cache.m4~
258 GNULIB_MODULES_TOOLS_FOR_LIBGREP='
261 $GNULIB_TOOL --dir=gettext-tools --macro-prefix=grgl --lib=libgrep --source-base=libgrep --m4-base=libgrep/gnulib-m4 --makefile-name=Makefile.gnulib --local-dir=gnulib-local --local-symlink \
262 --import `for m in $GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES; do if test \`$GNULIB_TOOL --extract-applicability $m\` != all; then echo --avoid=$m; fi; done` $GNULIB_MODULES_TOOLS_FOR_LIBGREP
263 # In gettext-tools/libgettextpo:
264 if test -f gettext-tools/libgettextpo/gnulib-m4/gnulib-cache.m4; then
265 mv -f gettext-tools/libgettextpo/gnulib-m4/gnulib-cache.m4 gettext-tools/libgettextpo/gnulib-m4/gnulib-cache.m4~
267 # This is a subset of the GNULIB_MODULES_FOR_SRC.
268 GNULIB_MODULES_LIBGETTEXTPO='
285 libunistring-optional
296 unilbrk/ulc-width-linebreaks
310 GNULIB_MODULES_LIBGETTEXTPO_OTHER='
312 $GNULIB_TOOL --dir=gettext-tools --source-base=libgettextpo --m4-base=libgettextpo/gnulib-m4 --macro-prefix=gtpo --makefile-name=Makefile.gnulib --libtool --local-dir=gnulib-local --local-symlink \
313 --import $GNULIB_MODULES_LIBGETTEXTPO $GNULIB_MODULES_LIBGETTEXTPO_OTHER
317 # Fetch config.guess, config.sub.
318 if test -n "$GNULIB_TOOL"; then
319 for file in config.guess config.sub; do
320 $GNULIB_TOOL --copy-file build-aux/$file; chmod a+x build-aux/$file
323 for file in config.guess config.sub; do
324 wget -q --timeout=5 -O build-aux/$file.tmp "http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/${file};hb=HEAD" \
325 && mv build-aux/$file.tmp build-aux/$file \
326 && chmod a+x build-aux/$file
330 (cd gettext-runtime/libasprintf
331 ../../build-aux/fixaclocal aclocal -I ../../m4 -I ../m4 -I gnulib-m4
333 autoheader && touch config.h.in
334 automake --add-missing --copy
338 ../build-aux/fixaclocal aclocal -I m4 -I ../m4 -I gnulib-m4
340 autoheader && touch config.h.in
341 automake --add-missing --copy
342 # Rebuilding the PO files and manual pages is only rarely needed.
344 ./configure --disable-java --disable-native-java --disable-csharp \
345 && (cd po && make update-po) \
346 && (cd intl && make) && (cd gnulib-lib && make) && (cd src && make) \
347 && (cd man && make update-man1 all) \
352 cp -p gettext-runtime/ABOUT-NLS gettext-tools/ABOUT-NLS
354 (cd gettext-tools/examples
355 ../../build-aux/fixaclocal aclocal -I ../../gettext-runtime/m4 -I ../../m4
357 automake --add-missing --copy
358 # Rebuilding the examples PO files is only rarely needed.
360 ./configure && (cd po && make update-po) && make distclean
365 ../build-aux/fixaclocal aclocal -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
367 autoheader && touch config.h.in
368 test -d intl || mkdir intl
369 automake --add-missing --copy
370 # Rebuilding the PO files, manual pages, documentation, test files is only rarely needed.
372 ./configure --disable-java --disable-native-java --disable-csharp --disable-openmp \
373 && (cd po && make update-po) \
374 && (cd intl && make) && (cd gnulib-lib && make) && (cd libgrep && make) && (cd src && make) \
375 && (cd man && make update-man1 all) \
376 && (cd doc && make all) \
377 && (cd tests && make update-expected) \
382 build-aux/fixaclocal aclocal -I m4