corrected chmod command label
[midnight-commander.git] / autogen.sh
blob1df0671273b4525ea42c86eb835432f16bffb74e
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}
10 : ${AUTOPOINT=autopoint}
12 srcdir=`dirname $0`
13 test -z "$srcdir" && srcdir=.
16 cd $srcdir
18 # The autoconf cache (version after 2.52) is not reliable yet.
19 rm -rf autom4te.cache vfs/samba/autom4te.cache
21 if test ! -d config; then
22 mkdir config || exit 1
25 # Ensure that gettext is reasonably new.
26 gettext_ver=`$GETTEXTIZE --version | sed -n '1s/\.//g;1s/.* //;1s/^\(...\)$/\100/;1s/^\(...\)\(.\)$/\10\2/;1p'`
27 if test $gettext_ver -lt 01038; then
28 echo "Don't use gettext older than 0.10.38" 2>&1
29 exit 1
32 rm -rf intl
33 if test $gettext_ver -ge 01100; then
34 if test $gettext_ver -lt 01105; then
35 echo "Upgrage gettext to at least 0.11.5 or downgrade to 0.10.40" 2>&1
36 exit 1
38 $AUTOPOINT || exit 1
39 else
40 $GETTEXTIZE --copy --force >tmpout || exit 1
41 if test -e po/ChangeLog~; then
42 rm -f po/ChangeLog
43 mv po/ChangeLog~ po/ChangeLog
47 rm -f aclocal.m4
48 if test -f `aclocal --print-ac-dir`/gettext.m4; then
49 : # gettext macro files are available to aclocal.
50 else
51 # gettext macro files are not available.
52 # Find them and copy to a local directory.
53 # Ugly way to parse the instructions gettexize gives us.
54 m4files="`cat tmpout | sed -n -e '/^Please/,/^from/s/^ *//p'`"
55 fromdir=`cat tmpout | sed -n -e '/^Please/,/^from/s/^from the \([^ ]*\) .*$/\1/p'`
56 rm -rf gettext.m4
57 mkdir gettext.m4
58 for i in $m4files; do
59 cp -f $fromdir/$i gettext.m4
60 done
61 ACLOCAL_INCLUDES="-I gettext.m4"
64 rm -f tmpout
66 # Some old version of GNU build tools fail to set error codes.
67 # Check that they generate some of the files they should.
69 $ACLOCAL $ACLOCAL_INCLUDES $ACLOCAL_FLAGS || exit 1
70 test -f aclocal.m4 || \
71 { echo "aclocal failed to generate aclocal.m4" 2>&1; exit 1; }
73 $AUTOHEADER || exit 1
74 test -f config.h.in || \
75 { echo "autoheader failed to generate config.h.in" 2>&1; exit 1; }
77 $AUTOCONF || exit 1
78 test -f configure || \
79 { echo "autoconf failed to generate configure" 2>&1; exit 1; }
81 # Workaround for Automake 1.5 to ensure that depcomp is distributed.
82 $AUTOMAKE -a src/Makefile || exit 1
83 $AUTOMAKE -a || exit 1
84 test -f Makefile.in || \
85 { echo "automake failed to generate Makefile.in" 2>&1; exit 1; }
87 cd vfs/samba || exit 1
88 date -u >include/stamp-h.in
90 $AUTOHEADER || exit 1
91 test -f include/config.h.in || \
92 { echo "autoheader failed to generate vfs/samba/include/config.h.in" 2>&1; exit 1; }
94 $AUTOCONF || exit 1
95 test -f configure || \
96 { echo "autoconf failed to generate vfs/samba/configure" 2>&1; exit 1; }
97 ) || exit 1
99 $srcdir/configure --cache-file=config.cache --enable-maintainer-mode "$@"