Last fuzzy trimmed...
[midnight-commander.git] / autogen.sh
blob6dd3efdd37c531c10a957e86e8ae3fd681c8b74e
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 if test ! -d config; then
21 mkdir config || exit 1
24 # Ensure that gettext is reasonably new.
25 gettext_ver=`$GETTEXTIZE --version | sed -n '1s/\.//g;1s/.* //;1s/^\(...\)$/\100/;1s/^\(...\)\(.\)$/\10\2/;1p'`
26 if test $gettext_ver -lt 01038; then
27 echo "Don't use gettext older than 0.10.38" 2>&1
28 exit 1
31 rm -rf intl
32 if test $gettext_ver -ge 01100; then
33 $GETTEXTIZE --copy --force --intl --no-changelog >tmpout || exit 1
34 if test -e Makefile.am~; then
35 rm -rf Makefile.am
36 mv Makefile.am~ Makefile.am
38 if test -e configure.in~ ; then
39 rm -rf configure.in
40 mv configure.in~ configure.in
42 for i in po/Rules-quot po/boldquot.sed po/en@boldquot.header \
43 po/en@quot.header po/insert-header.sin po/quot.sed \
44 po/remove-potcdate.sin po/Makefile.in.in
46 if diff -s $i $i~ >/dev/null 2>&1 ; then
47 mv $i~ $i
49 done
50 # Does we need po/Makevars.in and family for gettext 0.11 ?
51 if test ! -e po/Makevars; then
52 cat > po/Makevars <<\EOF
53 # Usually the message domain is the same as the package name.
54 DOMAIN = $(PACKAGE)
56 # These two variables depend on the location of this directory.
57 subdir = po
58 top_builddir = ../config
60 # These options get passed to xgettext.
61 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
62 EOF
64 else
65 $GETTEXTIZE --copy --force >tmpout || exit 1
66 if test -e po/ChangeLog~; then
67 rm -f po/ChangeLog
68 mv po/ChangeLog~ po/ChangeLog
72 rm -f aclocal.m4
73 if test -f `aclocal --print-ac-dir`/gettext.m4; then
74 : # gettext macro files are available to aclocal.
75 else
76 # gettext macro files are not available.
77 # Find them and copy to a local directory.
78 # Ugly way to parse the instructions gettexize gives us.
79 m4files="`cat tmpout | sed -n -e '/^Please/,/^from/s/^ *//p'`"
80 fromdir=`cat tmpout | sed -n -e '/^Please/,/^from/s/^from the \([^ ]*\) .*$/\1/p'`
81 rm -rf gettext.m4
82 mkdir gettext.m4
83 for i in $m4files; do
84 cp -f $fromdir/$i gettext.m4
85 done
86 ACLOCAL_INCLUDES="-I gettext.m4"
89 rm -f tmpout
91 # Some old version of GNU build tools fail to set error codes.
92 # Check that they generate some of the files they should.
94 $ACLOCAL $ACLOCAL_INCLUDES $ACLOCAL_FLAGS || exit 1
95 test -f aclocal.m4 || \
96 { echo "aclocal failed to generate aclocal.m4" 2>&1; exit 1; }
98 $AUTOHEADER || exit 1
99 test -f config.h.in || \
100 { echo "autoheader failed to generate config.h.in" 2>&1; exit 1; }
102 $AUTOCONF || exit 1
103 test -f configure || \
104 { echo "autoconf failed to generate configure" 2>&1; exit 1; }
106 # Workaround for Automake 1.5 to ensure that depcomp is distributed.
107 $AUTOMAKE -a src/Makefile || exit 1
108 $AUTOMAKE -a || exit 1
109 test -f Makefile.in || \
110 { echo "automake failed to generate Makefile.in" 2>&1; exit 1; }
112 cd vfs/samba || exit 1
113 date -u >include/stamp-h.in
115 $AUTOHEADER || exit 1
116 test -f include/config.h.in || \
117 { echo "autoheader failed to generate vfs/samba/include/config.h.in" 2>&1; exit 1; }
119 $AUTOCONF || exit 1
120 test -f configure || \
121 { echo "autoconf failed to generate vfs/samba/configure" 2>&1; exit 1; }
122 ) || exit 1
124 $srcdir/configure --cache-file=config.cache --enable-maintainer-mode "$@"