1#!/bin/sh 2# Run this to generate all the initial makefiles, etc. 3 4srcdir=`dirname $0` 5test -z "$srcdir" && srcdir=. 6 7DIE=0 8 9(test -f $srcdir/configure.ac) || { 10 echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" 11 echo " top-level package directory" 12 exit 1 13} 14 15(autoconf --version) < /dev/null > /dev/null 2>&1 || { 16 echo 17 echo "**Error**: You must have \`autoconf' installed." 18 echo "Download the appropriate package for your distribution," 19 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" 20 DIE=1 21} 22 23(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { 24 (libtoolize --version) < /dev/null > /dev/null 2>&1 \ 25 && LIBTOOLIZE=libtoolize || { 26 (glibtoolize --version) < /dev/null > /dev/null 2>&1 \ 27 && LIBTOOLIZE=glibtoolize || { 28 echo 29 echo "**Error**: You must have \`libtool' installed." 30 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" 31 DIE=1 32 } 33 } 34} 35 36(automake --version) < /dev/null > /dev/null 2>&1 || { 37 echo 38 echo "**Error**: You must have \`automake' installed." 39 echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" 40 DIE=1 41 NO_AUTOMAKE=yes 42} 43 44 45# if no automake, don't bother testing for aclocal 46test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { 47 echo 48 echo "**Error**: Missing \`aclocal'. The version of \`automake'" 49 echo "installed doesn't appear recent enough." 50 echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/" 51 DIE=1 52} 53 54# Create README file for the benefit of automake 55test -e README || ln -v README.md README || cp -v README.md README || DIE=1 56 57if test "$DIE" -eq 1; then 58 exit 1 59fi 60 61if test -z "$*"; then 62 echo "**Warning**: I am going to run \`configure' with no arguments." 63 echo "If you wish to pass any to it, please specify them on the" 64 echo \`$0\'" command line." 65 echo 66fi 67 68case $CC in 69xlc ) 70 am_opt=--include-deps;; 71esac 72 73for coin in `find $srcdir -name configure.ac -print` 74do 75 dr=`dirname $coin` 76 if test -f $dr/NO-AUTO-GEN; then 77 echo skipping $dr -- flagged as no auto-gen 78 else 79 echo processing $dr 80 ( cd $dr 81 82 aclocalinclude="$ACLOCAL_FLAGS" 83 84 if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then 85 echo "Creating $dr/aclocal.m4 ..." 86 test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 87 echo "Running glib-gettextize... Ignore non-fatal messages." 88 echo "no" | glib-gettextize --force --copy 89 echo "Making $dr/aclocal.m4 writable ..." 90 test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 91 fi 92 if grep "^AC_PROG_INTLTOOL" configure.ac >/dev/null; then 93 echo "Running intltoolize..." 94 intltoolize --copy --force --automake 95 fi 96 if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then 97 if test -z "$NO_LIBTOOLIZE" ; then 98 echo "Running libtoolize..." 99 $LIBTOOLIZE --force --copy 100 fi 101 fi 102 echo "Running aclocal $aclocalinclude ..." 103 aclocal $aclocalinclude 104 if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null \ 105 || grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then 106 echo "Running autoheader..." 107 autoheader 108 fi 109 echo "Running automake --gnu $am_opt ..." 110 automake --add-missing --gnu $am_opt 111 echo "Running autoconf ..." 112 autoconf 113 ) 114 fi 115done 116 117if ( echo "$@" | grep -q -e "--no-configure" ); then 118 NOCONFIGURE=1 119fi 120 121conf_flags="--enable-maintainer-mode --enable-debug --disable-silent-rules" 122 123if test x$NOCONFIGURE = x; then 124 echo Running $srcdir/configure $conf_flags "$@" ... 125 $srcdir/configure $conf_flags "$@" \ 126 && echo Now type \`make\' to compile. || exit 1 127else 128 echo Skipping configure process. 129fi 130