Imported Upstream version 0.18.1.1
[platform/upstream/gettext.git] / autogen.sh
1 #!/bin/sh
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.
6 #
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.
12 # It also requires
13 #   - the bison program,
14 #   - the gperf program,
15 #   - the groff program,
16 #   - the makeinfo program from the texinfo package,
17 #   - perl.
18
19 # Copyright (C) 2003-2010 Free Software Foundation, Inc.
20 #
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.
25 #
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.
30 #
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/>.
33
34 # Usage: ./autogen.sh [--quick] [--skip-gnulib]
35 #
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.)
41 #
42 # Usage from a released tarball:             ./autogen.sh --quick --skip-gnulib
43 # This does not use a gnulib checkout.
44
45 quick=false
46 skip_gnulib=false
47 while :; do
48   case "$1" in
49     --quick) quick=true; shift;;
50     --skip-gnulib) skip_gnulib=true; shift;;
51     *) break ;;
52   esac
53 done
54
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.
57
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)
63     else
64       git clone git://git.savannah.gnu.org/gnulib.git
65     fi
66     # Now it should contain a gnulib-tool.
67     if test -f gnulib/gnulib-tool; then
68       GNULIB_TOOL=`pwd`/gnulib/gnulib-tool
69     else
70       echo "** warning: gnulib-tool not found" 1>&2
71     fi
72   fi
73   # Skip the gnulib-tool step if gnulib-tool was not found.
74   if test -n "$GNULIB_TOOL"; then
75     # In gettext-runtime:
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~
78     fi
79     GNULIB_MODULES_RUNTIME_FOR_SRC='
80       atexit
81       basename
82       closeout
83       error
84       getopt-gnu
85       gettext-h
86       havelib
87       memmove
88       progname
89       propername
90       relocatable-prog
91       sigpipe
92       stdbool
93       stdio
94       stdlib
95       strtoul
96       unlocked-io
97       xalloc
98     '
99     GNULIB_MODULES_RUNTIME_OTHER='
100       gettext-runtime-misc
101       csharpcomp-script
102       java
103       javacomp-script
104     '
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~
110     fi
111     GNULIB_MODULES_LIBASPRINTF='
112       alloca
113       errno
114     '
115     GNULIB_MODULES_LIBASPRINTF_OTHER='
116     '
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
119     # In gettext-tools:
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~
122     fi
123     GNULIB_MODULES_TOOLS_FOR_SRC='
124       alloca-opt
125       atexit
126       backupfile
127       basename
128       binary-io
129       bison-i18n
130       byteswap
131       c-ctype
132       c-strcase
133       c-strcasestr
134       c-strstr
135       clean-temp
136       closeout
137       copy-file
138       csharpcomp
139       csharpexec
140       error
141       error-progname
142       execute
143       fd-ostream
144       file-ostream
145       filename
146       findprog
147       fnmatch
148       fopen
149       fstrcmp
150       full-write
151       fwriteerror
152       gcd
153       getline
154       getopt-gnu
155       gettext-h
156       hash
157       html-styled-ostream
158       iconv
159       javacomp
160       javaexec
161       libunistring-optional
162       localcharset
163       locale
164       localename
165       lock
166       memmove
167       memset
168       minmax
169       obstack
170       open
171       openmp
172       ostream
173       pipe
174       pipe-filter-ii
175       progname
176       propername
177       relocatable-prog
178       relocatable-script
179       sh-quote
180       sigpipe
181       sigprocmask
182       stdbool
183       stdio
184       stdlib
185       stpcpy
186       stpncpy
187       strcspn
188       strerror
189       strpbrk
190       strtol
191       strtoul
192       styled-ostream
193       sys_select
194       sys_stat
195       sys_time
196       term-styled-ostream
197       unilbrk/ulc-width-linebreaks
198       uniname/uniname
199       unistd
200       unistr/u8-mbtouc
201       unistr/u8-uctomb
202       unistr/u16-mbtouc
203       uniwidth/width
204       unlocked-io
205       vasprintf
206       wait-process
207       write
208       xalloc
209       xconcat-filename
210       xmalloca
211       xerror
212       xsetenv
213       xstriconv
214       xstriconveh
215       xvasprintf
216     '
217     # Common dependencies of GNULIB_MODULES_TOOLS_FOR_SRC and GNULIB_MODULES_TOOLS_FOR_LIBGREP.
218     GNULIB_MODULES_TOOLS_FOR_SRC_COMMON_DEPENDENCIES='
219       alloca-opt
220       arg-nonnull
221       c++defs
222       extensions
223       gettext-h
224       include_next
225       localcharset
226       malloc-posix
227       mbrtowc
228       mbsinit
229       multiarch
230       ssize_t
231       stdbool
232       stddef
233       stdint
234       stdlib
235       streq
236       unistd
237       verify
238       warn-on-use
239       wchar
240       wctype
241     '
242     GNULIB_MODULES_TOOLS_OTHER='
243       gettext-tools-misc
244       csharpcomp-script
245       csharpexec-script
246       gcj
247       java
248       javacomp-script
249       javaexec-script
250       stdint
251     '
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~
257     fi
258     GNULIB_MODULES_TOOLS_FOR_LIBGREP='
259       regex
260     '
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~
266     fi
267     # This is a subset of the GNULIB_MODULES_FOR_SRC.
268     GNULIB_MODULES_LIBGETTEXTPO='
269       basename
270       c-ctype
271       c-strcase
272       c-strstr
273       error
274       error-progname
275       file-ostream
276       filename
277       fopen
278       fstrcmp
279       fwriteerror
280       gcd
281       getline
282       gettext-h
283       hash
284       iconv
285       libunistring-optional
286       minmax
287       open
288       ostream
289       progname
290       relocatable-lib
291       sigpipe
292       stdbool
293       stdio
294       stdlib
295       strerror
296       unilbrk/ulc-width-linebreaks
297       unistr/u8-mbtouc
298       unistr/u8-uctomb
299       unistr/u16-mbtouc
300       uniwidth/width
301       unlocked-io
302       vasprintf
303       xalloc
304       xconcat-filename
305       xmalloca
306       xerror
307       xstriconv
308       xvasprintf
309     '
310     GNULIB_MODULES_LIBGETTEXTPO_OTHER='
311     '
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
314   fi
315 fi
316
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
321   done
322 else
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
327   done
328 fi
329
330 (cd gettext-runtime/libasprintf
331  ../../build-aux/fixaclocal aclocal -I ../../m4 -I ../m4 -I gnulib-m4
332  autoconf
333  autoheader && touch config.h.in
334  automake --add-missing --copy
335 )
336
337 (cd gettext-runtime
338  ../build-aux/fixaclocal aclocal -I m4 -I ../m4 -I gnulib-m4
339  autoconf
340  autoheader && touch config.h.in
341  automake --add-missing --copy
342  # Rebuilding the PO files and manual pages is only rarely needed.
343  if ! $quick; then
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) \
348      && make distclean
349  fi
350 )
351
352 cp -p gettext-runtime/ABOUT-NLS gettext-tools/ABOUT-NLS
353
354 (cd gettext-tools/examples
355  ../../build-aux/fixaclocal aclocal -I ../../gettext-runtime/m4 -I ../../m4
356  autoconf
357  automake --add-missing --copy
358  # Rebuilding the examples PO files is only rarely needed.
359  if ! $quick; then
360    ./configure && (cd po && make update-po) && make distclean
361  fi
362 )
363
364 (cd gettext-tools
365  ../build-aux/fixaclocal aclocal -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
366  autoconf
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.
371  if ! $quick; then
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) \
378      && make distclean
379  fi
380 )
381
382 build-aux/fixaclocal aclocal -I m4
383 autoconf
384 automake