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