ooops...
[midnight-commander.git] / autogen.sh
blobcd70ee7b72e750254c16fd5e48cd3c823ed29a7a
1 #! /bin/sh
2 # Run this to generate all the initial makefiles, etc.
4 # Make it possible to specify path in the environment
5 : ${AUTOCONF=autoconf}
6 : ${AUTOHEADER=autoheader}
7 : ${AUTOMAKE=automake}
8 : ${ACLOCAL=aclocal}
9 : ${GETTEXTIZE=gettextize}
11 srcdir=`dirname $0`
12 test -z "$srcdir" && srcdir=.
15 cd $srcdir
17 # The autoconf cache (version after 2.52) is not reliable yet.
18 rm -rf autom4te.cache vfs/samba/autom4te.cache
20 # Ensure that gettext is reasonably new.
21 gettext_ver=`$GETTEXTIZE --version | sed -n '1s/\.//g;1s/.* //;1s/^\(...\)$/\100/;1s/^\(...\)\(.\)$/\10\2/;1p'`
22 if test $gettext_ver -lt 01038; then
23 echo "Don't use gettext older than 0.10.38" 2>&1
24 exit 1
27 if test $gettext_ver -ge 01100; then
28 GETTEXTIZE_ARGS='--intl --no-changelog'
31 rm -rf intl
32 $GETTEXTIZE $GETTEXTIZE_ARGS --copy --force >tmpout || exit 1
34 if test -e po/ChangeLog~; then
35 rm -f po/ChangeLog
36 mv po/ChangeLog~ po/ChangeLog
39 if test ! -d config; then
40 mkdir config || exit 1
43 rm -f aclocal.m4
44 if test -f `aclocal --print-ac-dir`/gettext.m4; then
45 : # gettext macro files are available to aclocal.
46 else
47 # gettext macro files are not available.
48 # Find them and copy to a local directory.
49 # Ugly way to parse the instructions gettexize gives us.
50 m4files="`cat tmpout | sed -n -e '/^Please/,/^from/s/^ *//p'`"
51 fromdir=`cat tmpout | sed -n -e '/^Please/,/^from/s/^from the \([^ ]*\) .*$/\1/p'`
52 rm tmpout
53 rm -rf gettext.m4
54 mkdir gettext.m4
55 for i in $m4files; do
56 cp -f $fromdir/$i gettext.m4
57 done
58 ACLOCAL_INCLUDES="-I gettext.m4"
61 # Some old version of GNU build tools fail to set error codes.
62 # Check that they generate some of the files they should.
64 $ACLOCAL $ACLOCAL_INCLUDES $ACLOCAL_FLAGS || exit 1
65 test -f aclocal.m4 || \
66 { echo "aclocal failed to generate aclocal.m4" 2>&1; exit 1; }
68 $AUTOHEADER || exit 1
69 test -f config.h.in || \
70 { echo "autoheader failed to generate config.h.in" 2>&1; exit 1; }
72 $AUTOCONF || exit 1
73 test -f configure || \
74 { echo "autoconf failed to generate configure" 2>&1; exit 1; }
76 # Workaround for Automake 1.5 to ensure that depcomp is distributed.
77 $AUTOMAKE -a src/Makefile || exit 1
78 $AUTOMAKE -a || exit 1
79 test -f Makefile.in || \
80 { echo "automake failed to generate Makefile.in" 2>&1; exit 1; }
82 cd vfs/samba || exit 1
83 date -u >include/stamp-h.in
85 $AUTOHEADER || exit 1
86 test -f include/config.h.in || \
87 { echo "autoheader failed to generate vfs/samba/include/config.h.in" 2>&1; exit 1; }
89 $AUTOCONF || exit 1
90 test -f configure || \
91 { echo "autoconf failed to generate vfs/samba/configure" 2>&1; exit 1; }
92 ) || exit 1
94 $srcdir/configure --cache-file=config.cache --enable-maintainer-mode "$@"