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