Reverted, until me and maciej get some good ideas
[platform/upstream/gnome-common.git] / macros / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 DIE=0
5
6 if [ -n "$GNOME2_PATH" ]; then
7         ACLOCAL_FLAGS="-I $GNOME2_PATH/share/aclocal $ACLOCAL_FLAGS"
8         PATH="$GNOME2_PATH/bin:$PATH"
9         export PATH
10 fi
11
12 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
13   echo
14   echo "**Error**: You must have \`autoconf' installed to compile Gnome."
15   echo "Download the appropriate package for your distribution,"
16   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
17   DIE=1
18 }
19
20 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
21   (libtool --version) < /dev/null > /dev/null 2>&1 || {
22     echo
23     echo "**Error**: You must have \`libtool' installed to compile Gnome."
24     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
25     echo "(or a newer version if it is available)"
26     DIE=1
27   }
28 }
29
30 #grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
31 #  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
32 #  (gettext --version) < /dev/null > /dev/null 2>&1 || {
33 #    echo
34 #    echo "**Error**: You must have \`gettext' installed to compile Gnome."
35 #    echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
36 #    echo "(or a newer version if it is available)"
37 #    DIE=1
38 #  }
39 #}
40
41 #grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
42 #  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
43 #  (gettext --version) < /dev/null > /dev/null 2>&1 || {
44 #    echo
45 #    echo "**Error**: You must have \`gettext' installed to compile Gnome."
46 #    echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
47 #    echo "(or a newer version if it is available)"
48 #    DIE=1
49 #  }
50 #}
51
52 (automake --version) < /dev/null > /dev/null 2>&1 || {
53   echo
54   echo "**Error**: You must have \`automake' installed to compile Gnome."
55   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
56   echo "(or a newer version if it is available)"
57   DIE=1
58   NO_AUTOMAKE=yes
59 }
60
61
62 # if no automake, don't bother testing for aclocal
63 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
64   echo
65   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
66   echo "installed doesn't appear recent enough."
67   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
68   echo "(or a newer version if it is available)"
69   DIE=1
70 }
71
72 if test "$DIE" -eq 1; then
73   exit 1
74 fi
75
76 if test -z "$*"; then
77   echo "**Warning**: I am going to run \`configure' with no arguments."
78   echo "If you wish to pass any to it, please specify them on the"
79   echo \`$0\'" command line."
80   echo
81 fi
82
83 case $CC in
84 xlc )
85   am_opt=--include-deps;;
86 esac
87
88 for coin in `find $srcdir -name configure.in -print`
89 do 
90   dr=`dirname $coin`
91   if test -f $dr/NO-AUTO-GEN; then
92     echo skipping $dr -- flagged as no auto-gen
93   else
94     echo processing $dr
95     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
96     ( cd $dr
97       macrosdir=`find . -name macros -print`
98       for i in $macrodirs; do
99         if test -f $i/gnome-gettext.m4; then
100           DELETEFILES="$DELETEFILES $i/gnome-gettext.m4"
101         fi
102       done
103
104       echo "deletefiles is $DELETEFILES"
105       aclocalinclude="$ACLOCAL_FLAGS"
106       for k in $aclocalinclude; do
107         if test -d $k; then
108           if [ -f $k/gnome.m4 -a "$GNOME_INTERFACE_VERSION" = "1" ]; then
109             rm -f $DELETEFILES
110           fi
111         fi
112       done
113       for k in $macrodirs; do
114         if test -d $k; then
115           aclocalinclude="$aclocalinclude -I $k"
116           if [ -f $k/gnome.m4 -a "$GNOME_INTERFACE_VERSION" = "1" ]; then
117             rm -f $DELETEFILES
118           fi
119         fi
120       done
121       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
122         if grep "sed.*POTFILES" configure.in >/dev/null; then
123           : do nothing -- we still have an old unmodified configure.in
124         else
125           echo "Creating $dr/aclocal.m4 ..."
126           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
127           echo "Running gettextize...  Ignore non-fatal messages."
128           echo "no" | gettextize --force --copy
129           echo "Making $dr/aclocal.m4 writable ..."
130           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
131         fi
132       fi
133       if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
134         echo "Creating $dr/aclocal.m4 ..."
135         test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
136         echo "Running gettextize...  Ignore non-fatal messages."
137         echo "no" | gettextize --force --copy
138         echo "Making $dr/aclocal.m4 writable ..."
139         test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
140       fi
141       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
142         if test -z "$NO_LIBTOOLIZE" ; then 
143           echo "Running libtoolize..."
144           libtoolize --force --copy
145         fi
146       fi
147       echo "Running aclocal $aclocalinclude ..."
148       aclocal $aclocalinclude || {
149         echo
150         echo "**Error**: aclocal failed. This may mean that you have not"
151         echo "installed all of the packages you need, or you may need to"
152         echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
153         echo "for the prefix where you installed the packages whose"
154         echo "macros were not found"
155         exit 1
156       }
157
158       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
159         echo "Running autoheader..."
160         autoheader || { echo "**Error**: autoheader failed."; exit 1; }
161       fi
162       echo "Running automake --gnu $am_opt ..."
163       automake --add-missing --gnu $am_opt ||
164         { echo "**Error**: automake failed."; exit 1; }
165       echo "Running autoconf ..."
166       autoconf || { echo "**Error**: autoconf failed."; exit 1; }
167     ) || exit 1
168   fi
169 done
170
171 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
172
173 if test x$NOCONFIGURE = x; then
174   echo Running $srcdir/configure $conf_flags "$@" ...
175   $srcdir/configure $conf_flags "$@" \
176   && echo Now type \`make\' to compile $PKG_NAME || exit 1
177 else
178   echo Skipping configure process.
179 fi