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