Imported Upstream version 0.9.3
[platform/upstream/libunistring.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.63 and automake-1.11 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 gperf program.
14
15 # Copyright (C) 2003-2009 Free Software Foundation, Inc.
16 #
17 # This program is free software: you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 3 of the License, or
20 # (at your option) any later version.
21 #
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25 # GNU General Public License for more details.
26 #
27 # You should have received a copy of the GNU General Public License
28 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
29
30 # Usage: ./autogen.sh [--skip-gnulib]
31 #
32 # Usage from a git checkout:                 ./autogen.sh
33 # This uses an up-to-date gnulib checkout.
34 #
35 # Usage from a released tarball:             ./autogen.sh --skip-gnulib
36 # This does not use a gnulib checkout.
37
38 skip_gnulib=false
39 while :; do
40   case "$1" in
41     --skip-gnulib) skip_gnulib=true; shift;;
42     *) break ;;
43   esac
44 done
45
46 if test $skip_gnulib = false; then
47   # texinfo.tex
48   # The most recent snapshot of it is available in the gnulib repository.
49   # But this is a snapshot, with all possible dangers.
50   # A stable release of it is available through "automake --add-missing --copy",
51   # but that is too old (does not support @arrow{}). So take the version which
52   # matches the latest stable texinfo release.
53   if test ! -f build-aux/texinfo.tex; then
54     { wget -q --timeout=5 -O build-aux/texinfo.tex.tmp 'http://cvs.savannah.gnu.org/viewvc/*checkout*/texinfo/doc/texinfo.tex?root=texinfo&pathrev=texinfo_4_13' \
55         && mv build-aux/texinfo.tex.tmp build-aux/texinfo.tex; \
56     } || rm -f build-aux/texinfo.tex.tmp
57   fi
58   if test -z "$GNULIB_TOOL"; then
59     # Check out gnulib in a subdirectory 'gnulib'.
60     if test -d gnulib; then
61       (cd gnulib && git pull)
62     else
63       git clone git://git.savannah.gnu.org/gnulib.git
64     fi
65     # Now it should contain a gnulib-tool.
66     if test -f gnulib/gnulib-tool; then
67       GNULIB_TOOL=`pwd`/gnulib/gnulib-tool
68     else
69       echo "** warning: gnulib-tool not found" 1>&2
70     fi
71   fi
72   # Skip the gnulib-tool step if gnulib-tool was not found.
73   if test -n "$GNULIB_TOOL"; then
74     if test -f m4/gnulib-cache.m4; then
75       mv -f m4/gnulib-cache.m4 m4/gnulib-cache.m4~
76     fi
77     if test -f lib/Makefile.gnulib; then
78       mv -f lib/Makefile.gnulib lib/Makefile.gnulib~
79     fi
80     GNULIB_MODULES='
81       unitypes
82       unistr/base
83       unistr/u8-check
84       unistr/u8-chr
85       unistr/u8-cmp
86       unistr/u8-cmp2
87       unistr/u8-cpy
88       unistr/u8-cpy-alloc
89       unistr/u8-endswith
90       unistr/u8-mblen
91       unistr/u8-mbsnlen
92       unistr/u8-mbtouc
93       unistr/u8-mbtoucr
94       unistr/u8-mbtouc-unsafe
95       unistr/u8-move
96       unistr/u8-next
97       unistr/u8-prev
98       unistr/u8-set
99       unistr/u8-startswith
100       unistr/u8-stpcpy
101       unistr/u8-stpncpy
102       unistr/u8-strcat
103       unistr/u8-strchr
104       unistr/u8-strcmp
105       unistr/u8-strcoll
106       unistr/u8-strcpy
107       unistr/u8-strcspn
108       unistr/u8-strdup
109       unistr/u8-strlen
110       unistr/u8-strmblen
111       unistr/u8-strmbtouc
112       unistr/u8-strncat
113       unistr/u8-strncmp
114       unistr/u8-strncpy
115       unistr/u8-strnlen
116       unistr/u8-strpbrk
117       unistr/u8-strrchr
118       unistr/u8-strspn
119       unistr/u8-strstr
120       unistr/u8-strtok
121       unistr/u8-to-u16
122       unistr/u8-to-u32
123       unistr/u8-uctomb
124       unistr/u16-check
125       unistr/u16-chr
126       unistr/u16-cmp
127       unistr/u16-cmp2
128       unistr/u16-cpy
129       unistr/u16-cpy-alloc
130       unistr/u16-endswith
131       unistr/u16-mblen
132       unistr/u16-mbsnlen
133       unistr/u16-mbtouc
134       unistr/u16-mbtoucr
135       unistr/u16-mbtouc-unsafe
136       unistr/u16-move
137       unistr/u16-next
138       unistr/u16-prev
139       unistr/u16-set
140       unistr/u16-startswith
141       unistr/u16-stpcpy
142       unistr/u16-stpncpy
143       unistr/u16-strcat
144       unistr/u16-strchr
145       unistr/u16-strcmp
146       unistr/u16-strcoll
147       unistr/u16-strcpy
148       unistr/u16-strcspn
149       unistr/u16-strdup
150       unistr/u16-strlen
151       unistr/u16-strmblen
152       unistr/u16-strmbtouc
153       unistr/u16-strncat
154       unistr/u16-strncmp
155       unistr/u16-strncpy
156       unistr/u16-strnlen
157       unistr/u16-strpbrk
158       unistr/u16-strrchr
159       unistr/u16-strspn
160       unistr/u16-strstr
161       unistr/u16-strtok
162       unistr/u16-to-u32
163       unistr/u16-to-u8
164       unistr/u16-uctomb
165       unistr/u32-check
166       unistr/u32-chr
167       unistr/u32-cmp
168       unistr/u32-cmp2
169       unistr/u32-cpy
170       unistr/u32-cpy-alloc
171       unistr/u32-endswith
172       unistr/u32-mblen
173       unistr/u32-mbsnlen
174       unistr/u32-mbtouc
175       unistr/u32-mbtoucr
176       unistr/u32-mbtouc-unsafe
177       unistr/u32-move
178       unistr/u32-next
179       unistr/u32-prev
180       unistr/u32-set
181       unistr/u32-startswith
182       unistr/u32-stpcpy
183       unistr/u32-stpncpy
184       unistr/u32-strcat
185       unistr/u32-strchr
186       unistr/u32-strcmp
187       unistr/u32-strcoll
188       unistr/u32-strcpy
189       unistr/u32-strcspn
190       unistr/u32-strdup
191       unistr/u32-strlen
192       unistr/u32-strmblen
193       unistr/u32-strmbtouc
194       unistr/u32-strncat
195       unistr/u32-strncmp
196       unistr/u32-strncpy
197       unistr/u32-strnlen
198       unistr/u32-strpbrk
199       unistr/u32-strrchr
200       unistr/u32-strspn
201       unistr/u32-strstr
202       unistr/u32-strtok
203       unistr/u32-to-u16
204       unistr/u32-to-u8
205       unistr/u32-uctomb
206       uniconv/base
207       uniconv/u8-conv-from-enc
208       uniconv/u8-conv-to-enc
209       uniconv/u8-strconv-from-enc
210       uniconv/u8-strconv-from-locale
211       uniconv/u8-strconv-to-enc
212       uniconv/u8-strconv-to-locale
213       uniconv/u16-conv-from-enc
214       uniconv/u16-conv-to-enc
215       uniconv/u16-strconv-from-enc
216       uniconv/u16-strconv-from-locale
217       uniconv/u16-strconv-to-enc
218       uniconv/u16-strconv-to-locale
219       uniconv/u32-conv-from-enc
220       uniconv/u32-conv-to-enc
221       uniconv/u32-strconv-from-enc
222       uniconv/u32-strconv-from-locale
223       uniconv/u32-strconv-to-enc
224       uniconv/u32-strconv-to-locale
225       unistdio/base
226       unistdio/u8-asnprintf
227       unistdio/u8-asprintf
228       unistdio/u8-snprintf
229       unistdio/u8-sprintf
230       unistdio/u8-u8-asnprintf
231       unistdio/u8-u8-asprintf
232       unistdio/u8-u8-snprintf
233       unistdio/u8-u8-sprintf
234       unistdio/u8-u8-vasnprintf
235       unistdio/u8-u8-vasprintf
236       unistdio/u8-u8-vsnprintf
237       unistdio/u8-u8-vsprintf
238       unistdio/u8-vasnprintf
239       unistdio/u8-vasprintf
240       unistdio/u8-vsnprintf
241       unistdio/u8-vsprintf
242       unistdio/u16-asnprintf
243       unistdio/u16-asprintf
244       unistdio/u16-snprintf
245       unistdio/u16-sprintf
246       unistdio/u16-u16-asnprintf
247       unistdio/u16-u16-asprintf
248       unistdio/u16-u16-snprintf
249       unistdio/u16-u16-sprintf
250       unistdio/u16-u16-vasnprintf
251       unistdio/u16-u16-vasprintf
252       unistdio/u16-u16-vsnprintf
253       unistdio/u16-u16-vsprintf
254       unistdio/u16-vasnprintf
255       unistdio/u16-vasprintf
256       unistdio/u16-vsnprintf
257       unistdio/u16-vsprintf
258       unistdio/u32-asnprintf
259       unistdio/u32-asprintf
260       unistdio/u32-snprintf
261       unistdio/u32-sprintf
262       unistdio/u32-u32-asnprintf
263       unistdio/u32-u32-asprintf
264       unistdio/u32-u32-snprintf
265       unistdio/u32-u32-sprintf
266       unistdio/u32-u32-vasnprintf
267       unistdio/u32-u32-vasprintf
268       unistdio/u32-u32-vsnprintf
269       unistdio/u32-u32-vsprintf
270       unistdio/u32-vasnprintf
271       unistdio/u32-vasprintf
272       unistdio/u32-vsnprintf
273       unistdio/u32-vsprintf
274       unistdio/ulc-asnprintf
275       unistdio/ulc-asprintf
276       unistdio/ulc-fprintf
277       unistdio/ulc-snprintf
278       unistdio/ulc-sprintf
279       unistdio/ulc-vasnprintf
280       unistdio/ulc-vasprintf
281       unistdio/ulc-vfprintf
282       unistdio/ulc-vsnprintf
283       unistdio/ulc-vsprintf
284       uniname/base
285       uniname/uniname
286       unictype/base
287       unictype/bidicategory-all
288       unictype/block-all
289       unictype/category-all
290       unictype/combining-class
291       unictype/ctype-alnum
292       unictype/ctype-alpha
293       unictype/ctype-blank
294       unictype/ctype-cntrl
295       unictype/ctype-digit
296       unictype/ctype-graph
297       unictype/ctype-lower
298       unictype/ctype-print
299       unictype/ctype-punct
300       unictype/ctype-space
301       unictype/ctype-upper
302       unictype/ctype-xdigit
303       unictype/decimal-digit
304       unictype/digit
305       unictype/mirror
306       unictype/numeric
307       unictype/property-all
308       unictype/scripts-all
309       unictype/syntax-c-ident
310       unictype/syntax-c-whitespace
311       unictype/syntax-java-ident
312       unictype/syntax-java-whitespace
313       uniwidth/base
314       uniwidth/u8-strwidth
315       uniwidth/u8-width
316       uniwidth/u16-strwidth
317       uniwidth/u16-width
318       uniwidth/u32-strwidth
319       uniwidth/u32-width
320       uniwidth/width
321       uniwbrk/base
322       uniwbrk/u8-wordbreaks
323       uniwbrk/u16-wordbreaks
324       uniwbrk/u32-wordbreaks
325       uniwbrk/ulc-wordbreaks
326       uniwbrk/wordbreak-property
327       unilbrk/base
328       unilbrk/u8-possible-linebreaks
329       unilbrk/u8-width-linebreaks
330       unilbrk/u16-possible-linebreaks
331       unilbrk/u16-width-linebreaks
332       unilbrk/u32-possible-linebreaks
333       unilbrk/u32-width-linebreaks
334       unilbrk/ulc-possible-linebreaks
335       unilbrk/ulc-width-linebreaks
336       uninorm/base
337       uninorm/canonical-decomposition
338       uninorm/composition
339       uninorm/decomposition
340       uninorm/filter
341       uninorm/nfc
342       uninorm/nfd
343       uninorm/nfkc
344       uninorm/nfkd
345       uninorm/u8-normalize
346       uninorm/u8-normcmp
347       uninorm/u8-normcoll
348       uninorm/u8-normxfrm
349       uninorm/u16-normalize
350       uninorm/u16-normcmp
351       uninorm/u16-normcoll
352       uninorm/u16-normxfrm
353       uninorm/u32-normalize
354       uninorm/u32-normcmp
355       uninorm/u32-normcoll
356       uninorm/u32-normxfrm
357       unicase/base
358       unicase/empty-prefix-context
359       unicase/empty-suffix-context
360       unicase/locale-language
361       unicase/tolower
362       unicase/totitle
363       unicase/toupper
364       unicase/u8-casecmp
365       unicase/u8-casecoll
366       unicase/u8-casefold
367       unicase/u8-casexfrm
368       unicase/u8-ct-casefold
369       unicase/u8-ct-tolower
370       unicase/u8-ct-totitle
371       unicase/u8-ct-toupper
372       unicase/u8-is-cased
373       unicase/u8-is-casefolded
374       unicase/u8-is-lowercase
375       unicase/u8-is-titlecase
376       unicase/u8-is-uppercase
377       unicase/u8-tolower
378       unicase/u8-totitle
379       unicase/u8-toupper
380       unicase/u16-casecmp
381       unicase/u16-casecoll
382       unicase/u16-casefold
383       unicase/u16-casexfrm
384       unicase/u16-ct-casefold
385       unicase/u16-ct-tolower
386       unicase/u16-ct-totitle
387       unicase/u16-ct-toupper
388       unicase/u16-is-cased
389       unicase/u16-is-casefolded
390       unicase/u16-is-lowercase
391       unicase/u16-is-titlecase
392       unicase/u16-is-uppercase
393       unicase/u16-tolower
394       unicase/u16-totitle
395       unicase/u16-toupper
396       unicase/u32-casecmp
397       unicase/u32-casecoll
398       unicase/u32-casefold
399       unicase/u32-casexfrm
400       unicase/u32-ct-casefold
401       unicase/u32-ct-tolower
402       unicase/u32-ct-totitle
403       unicase/u32-ct-toupper
404       unicase/u32-is-cased
405       unicase/u32-is-casefolded
406       unicase/u32-is-lowercase
407       unicase/u32-is-titlecase
408       unicase/u32-is-uppercase
409       unicase/u32-tolower
410       unicase/u32-totitle
411       unicase/u32-toupper
412       unicase/ulc-casecmp
413       unicase/ulc-casecoll
414       unicase/ulc-casexfrm
415       relocatable-lib-lgpl
416     '
417     $GNULIB_TOOL --lib=libunistring --source-base=lib --m4-base=gnulib-m4 --tests-base=tests \
418       --with-tests --lgpl --makefile-name=Makefile.gnulib --libtool --local-dir=gnulib-local \
419       --import $GNULIB_MODULES
420     # Change lib/unistr.h to be usable standalone.
421     sed -e 's/ifdef GNULIB_[A-Za-z0-9_]*/if 1/' -e 's/defined GNULIB_[A-Za-z0-9_]*/1/g' \
422         -e 's/HAVE_INLINE/UNISTRING_HAVE_INLINE/g' \
423         < lib/unistr.h \
424         > lib/unistr.h.tmp \
425     && mv lib/unistr.h.tmp lib/unistr.h
426     # Change lib/unictype.h and lib/uninorm.h for shared libraries on Woe32 systems.
427     sed -e 's/extern const uc_general_category_t UC_/extern LIBUNISTRING_DLL_VARIABLE const uc_general_category_t UC_/' \
428         -e 's/extern const uc_property_t UC_/extern LIBUNISTRING_DLL_VARIABLE const uc_property_t UC_/' \
429         < lib/unictype.h \
430         > lib/unictype.h.tmp \
431     && mv lib/unictype.h.tmp lib/unictype.h
432     sed -e 's/extern const struct unicode_normalization_form /extern LIBUNISTRING_DLL_VARIABLE const struct unicode_normalization_form /' \
433         < lib/uninorm.h \
434         > lib/uninorm.h.tmp \
435     && mv lib/uninorm.h.tmp lib/uninorm.h
436     sed -e 's/extern const casing_/extern LIBUNISTRING_DLL_VARIABLE const casing_/' \
437         < lib/unicase.h \
438         > lib/unicase.h.tmp \
439     && mv lib/unicase.h.tmp lib/unicase.h
440     $GNULIB_TOOL --copy-file build-aux/config.guess; chmod a+x build-aux/config.guess
441     $GNULIB_TOOL --copy-file build-aux/config.sub;   chmod a+x build-aux/config.sub
442     # If we got no texinfo.tex so far, take the snapshot from gnulib.
443     if test ! -f build-aux/texinfo.tex; then
444       $GNULIB_TOOL --copy-file build-aux/texinfo.tex build-aux/texinfo.tex
445     fi
446   fi
447 fi
448
449 build-aux/fixaclocal aclocal -I m4 -I gnulib-m4
450 autoconf
451 autoheader && touch config.h.in
452 automake --add-missing --copy