Merge branch '3016_extfs_segfault'
[midnight-commander.git] / autogen.sh
blob071533ce68862aa7571497190eec74138c783c64
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 : ${AUTOPOINT=autopoint}
13 : ${LIBTOOLIZE=libtoolize}
14 : ${XGETTEXT=xgettext}
16 srcdir=`dirname $0`
17 test -z "$srcdir" && srcdir=.
21 # Some shells don't propagate "set -e" to subshells.
22 set -e
24 $AUTOPOINT --version >/dev/null 2>&1
25 if test $? -ne 0; then
26 AUTOPOINT=maint/utils/autopoint
29 cd "$srcdir"
31 # The autoconf cache (version after 2.52) is not reliable yet.
32 rm -rf autom4te.cache src/vfs/smbfs/helpers/autom4te.cache
34 if test ! -d config; then
35 mkdir config
38 # Recreate intl directory.
39 rm -rf intl
40 $AUTOPOINT --force || exit 1
42 # Generate po/POTFILES.in
43 $XGETTEXT --keyword=_ --keyword=N_ --keyword=Q_ --output=- \
44 `find . -name '*.[ch]'` | sed -ne '/^#:/{s/#://;s/:[0-9]*/\
45 /g;s/ //g;p;}' | \
46 grep -v '^$' | sort | uniq >po/POTFILES.in
48 $LIBTOOLIZE
50 ACLOCAL_INCLUDES="-I m4"
52 # Some old version of GNU build tools fail to set error codes.
53 # Check that they generate some of the files they should.
55 $ACLOCAL $ACLOCAL_INCLUDES $ACLOCAL_FLAGS
56 test -f aclocal.m4 || \
57 { echo "aclocal failed to generate aclocal.m4" >&2; exit 1; }
59 $AUTOHEADER || exit 1
60 test -f config.h.in || \
61 { echo "autoheader failed to generate config.h.in" >&2; exit 1; }
63 $AUTOCONF || exit 1
64 test -f configure || \
65 { echo "autoconf failed to generate configure" >&2; exit 1; }
67 # Workaround for Automake 1.5 to ensure that depcomp is distributed.
68 if test "`$AUTOMAKE --version|awk '{print $NF;exit}'`" = '1.5' ; then
69 $AUTOMAKE -a src/Makefile
71 $AUTOMAKE -a
72 test -f Makefile.in || \
73 { echo "automake failed to generate Makefile.in" >&2; exit 1; }
75 cd src/vfs/smbfs/helpers
76 date -u >include/stamp-h.in
78 $AUTOHEADER
79 test -f include/config.h.in || \
80 { echo "autoheader failed to generate src/vfs/smbfs/helpers/include/config.h.in" >&2; exit 1; }
82 $AUTOCONF
83 test -f configure || \
84 { echo "autoconf failed to generate src/vfs/smbfs/helpers/configure" >&2; exit 1; }
85 ) || exit 1
87 $srcdir/maint/utils/version.sh "$srcdir"
89 if test -x $srcdir/configure.mc; then
90 $srcdir/configure.mc "$@"