]> git.street.me.uk Git - andy/viking.git/blob - autogen.sh
Fix bug: "config.status: error: cannot find input file: Makefile.in"
[andy/viking.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 : ${AUTOCONF=autoconf}
5 : ${AUTOHEADER=autoheader}
6 : ${AUTOMAKE=automake}
7 : ${ACLOCAL=aclocal}
8 : ${LIBTOOLIZE=libtoolize}
9 : ${INTLTOOLIZE=intltoolize}
10 : ${LIBTOOL=libtool}
11
12 srcdir=`dirname $0`
13 test -z "$srcdir" && srcdir=.
14
15 ORIGDIR=`pwd`
16 cd $srcdir
17 PROJECT=viking
18 TEST_TYPE=-f
19 FILE=src/main.c
20 CONFIGURE=configure.ac
21
22 ACLOCAL_FLAGS="-I m4"
23
24 DIE=0
25
26 ($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
27         echo
28         echo "You must have autoconf installed to compile $PROJECT."
29         echo "Download the appropriate package for your distribution,"
30         echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
31         DIE=1
32 }
33
34 (grep "^AC_PROG_INTLTOOL" $srcdir/$CONFIGURE >/dev/null) && {
35   ($INTLTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
36     echo
37     echo "You must have \`intltoolize' installed to compile $PROJECT."
38     echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/intltool-0.22.tar.gz"
39     echo "(or a newer version if it is available)"
40     DIE=1
41   }
42 }
43
44 ($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
45         echo
46         echo "You must have automake installed to compile $PROJECT."
47         echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.7.tar.gz"
48         echo "(or a newer version if it is available)"
49         DIE=1
50 }
51
52 (grep "^AM_PROG_LIBTOOL" $CONFIGURE >/dev/null) && {
53   ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || {
54     echo
55     echo "**Error**: You must have \`libtool' installed to compile $PROJECT."
56     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
57     echo "(or a newer version if it is available)"
58     DIE=1
59   }
60 }
61
62 if grep "^AM_[A-Z0-9_]\{1,\}_GETTEXT" "$CONFIGURE" >/dev/null; then
63   if grep "sed.*POTFILES" "$CONFIGURE" >/dev/null; then
64     GETTEXTIZE=""
65   else
66     if grep "^AM_GLIB_GNU_GETTEXT" "$CONFIGURE" >/dev/null; then
67       GETTEXTIZE="glib-gettextize"
68       GETTEXTIZE_URL="ftp://ftp.gtk.org/pub/gtk/v2.0/glib-2.0.0.tar.gz"
69     else
70       GETTEXTIZE="gettextize"
71       GETTEXTIZE_URL="ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
72     fi
73                                                                                                           
74     $GETTEXTIZE --version < /dev/null > /dev/null 2>&1
75     if test $? -ne 0; then
76       echo
77       echo "**Error**: You must have \`$GETTEXTIZE' installed to compile $PKG_NAME."
78       echo "Get $GETTEXTIZE_URL"
79       echo "(or a newer version if it is available)"
80       DIE=1
81     fi
82   fi
83 fi
84
85 if test "$DIE" -eq 1; then
86         exit 1
87 fi
88
89 test $TEST_TYPE $FILE || {
90         echo "You must run this script in the top-level $PROJECT directory"
91         exit 1
92 }
93
94 #if test -z "$*"; then
95 #       echo "I am going to run ./configure with no arguments - if you wish "
96 #        echo "to pass any to it, please specify them on the $0 command line."
97 #fi
98
99 case $CC in
100 *xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;;
101 esac
102
103 for coin in .
104 do 
105   dr=`dirname $coin`
106   if test -f $dr/NO-AUTO-GEN; then
107     echo skipping $dr -- flagged as no auto-gen
108   else
109     echo processing $dr
110     macrodirs= #`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
111     ( cd $dr
112       aclocalinclude="$ACLOCAL_FLAGS"
113       for k in $macrodirs; do
114         if test -d $k; then
115           aclocalinclude="$aclocalinclude -I $k"
116         ##else 
117         ##  echo "**Warning**: No such directory \`$k'.  Ignored."
118         fi
119       done
120       if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE >/dev/null; then
121         if grep "sed.*POTFILES" $CONFIGURE >/dev/null; then
122           : do nothing -- we still have an old unmodified configure.in
123         else
124           echo "Creating $dr/aclocal.m4 ..."
125           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
126           echo "Running glib-gettextize...  Ignore non-fatal messages."
127           echo "no" | glib-gettextize --force --copy
128           echo "Making $dr/aclocal.m4 writable ..."
129           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
130         fi
131       fi
132       if grep "^AC_PROG_INTLTOOL" $CONFIGURE >/dev/null ||
133          grep "^IT_PROG_INTLTOOL" $CONFIGURE >/dev/null; then
134         echo "Running intltoolize..."
135         intltoolize --copy --force --automake
136       fi
137       if grep "^AM_PROG_LIBTOOL" $CONFIGURE >/dev/null; then
138         echo "Running $LIBTOOLIZE..."
139         $LIBTOOLIZE --force --copy
140       fi
141       echo "Running $ACLOCAL $aclocalinclude ..."
142       $ACLOCAL $aclocalinclude
143       if grep "^A[CM]_CONFIG_HEADER" $CONFIGURE >/dev/null; then
144         echo "Running $AUTOHEADER..."
145         $AUTOHEADER
146       fi
147       echo "Running $AUTOMAKE --gnu $am_opt ..."
148       $AUTOMAKE --add-missing --gnu $am_opt
149       echo "Running $AUTOCONF ..."
150       $AUTOCONF
151     )
152   fi
153 done
154
155 conf_flags="--enable-maintainer-mode"
156
157 cd "$ORIGDIR"
158
159 if test x$NOCONFIGURE = x; then
160   echo Running $srcdir/configure $conf_flags "$@" ...
161   $srcdir/configure $conf_flags "$@" \
162   && echo Now type \`make\' to compile $PROJECT  || exit 1
163 else
164   echo Skipping configure process.
165 fi