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