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