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