home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / LINUX / gopchop-1.1.7.tar.tar / gopchop-1.1.7.tar / gopchop-1.1.7 / autogen.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2005-04-28  |  7KB  |  223 lines

  1. #!/bin/sh
  2. # Run this to generate all the initial makefiles, etc.
  3.  
  4. if test -z "$*"; then
  5.   echo "**Warning**: I am going to run \`configure' with no arguments."
  6.   echo "If you wish to pass any to it, please specify them on the"
  7.   echo \`$0\'" command line."
  8.   echo
  9. fi
  10.  
  11. AUTOCONF_REQUIRED_VERSION=2.52
  12. AUTOMAKE_REQUIRED_VERSION=1.7
  13. GLIB_REQUIRED_VERSION=2.0.0
  14. INTLTOOL_REQUIRED_VERSION=0.22
  15.  
  16. check_version ()
  17. {
  18.     if expr $1 \>= $2 > /dev/null; then
  19.         echo "yes (version $1)"
  20.     else
  21.         echo "Too old (found version $1)!"
  22.         DIE=1
  23.     fi
  24. }
  25.  
  26. attempt_command () {
  27.     IGNORE=$1
  28.     shift
  29.  
  30.     echo "Running $@ ..."
  31.     ERR="`$@ 2>&1`"
  32.     errcode=$?
  33.     if [ "x$IGNORE" = "x" ]; then
  34.         ERR=`echo "$ERR"`
  35.     else
  36.         ERR=`echo "$ERR" | egrep -v "$IGNORE"`
  37.     fi
  38.     if [ "x$ERR" != "x" ]; then
  39.         echo "$ERR" | awk '{print "  " $0}'
  40.     fi
  41.     if [ $errcode -gt 0 ]; then
  42.         echo "Please fix the error conditions and try again."
  43.         exit 1
  44.     fi
  45. }
  46.  
  47. srcdir=`dirname $0`
  48. test -z "$srcdir" && srcdir=.
  49.  
  50. DIE=0
  51.  
  52. if [ -n "$GNOME2_DIR" ]; then
  53.     ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
  54.     LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
  55.     PATH="$GNOME2_DIR/bin:$PATH"
  56.     export PATH
  57.     export LD_LIBRARY_PATH
  58. fi
  59.  
  60. (test -f $srcdir/configure.ac) || {
  61.     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
  62.     echo " top-level package directory"
  63.     exit 1
  64. }
  65.  
  66. echo -n "checking for autoconf >= $AUTOCONF_REQUIRED_VERSION ... "
  67. if (autoconf --version) < /dev/null > /dev/null 2>&1; then
  68.     VER=`autoconf --version \
  69.          | grep -iw autoconf | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
  70.     check_version $VER $AUTOCONF_REQUIRED_VERSION
  71. else
  72.     echo
  73.     echo "  You must have autoconf installed to compile $PROJECT."
  74.     echo "  Download the appropriate package for your distribution,"
  75.     echo "  or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
  76.     DIE=1;
  77. fi
  78.  
  79. (grep "^AC_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
  80.  echo -n "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... "
  81.  if (intltoolize --version) < /dev/null > /dev/null 2>&1; then
  82.     VER=`intltoolize --version \
  83.          | grep intltoolize | sed "s/.* \([0-9.]*\)/\1/"`
  84.     check_version $VER $INTLTOOL_REQUIRED_VERSION
  85.  else
  86.     echo
  87.     echo "  You must have intltool installed to compile $PROJECT."
  88.     echo "  Get the latest version from"
  89.     echo "  ftp://ftp.gnome.org/pub/GNOME/sources/intltool/"
  90.     DIE=1
  91.  fi
  92. }
  93.  
  94. (grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
  95.   (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
  96.     echo
  97.     echo "**Error**: You must have \`xml-i18n-toolize' installed."
  98.     echo "You can get it from:"
  99.     echo "  ftp://ftp.gnome.org/pub/GNOME/"
  100.     DIE=1
  101.   }
  102. }
  103.  
  104. (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
  105.   (libtool --version) < /dev/null > /dev/null 2>&1 || {
  106.     echo
  107.     echo "**Error**: You must have \`libtool' installed."
  108.     echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
  109.     DIE=1
  110.   }
  111. }
  112.  
  113. (grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
  114.   (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
  115.   (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
  116.     echo
  117.     echo "**Error**: You must have \`glib' installed."
  118.     echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
  119.     DIE=1
  120.   }
  121. }
  122.  
  123. echo -n "checking for automake >= $AUTOMAKE_REQUIRED_VERSION ... "
  124. # Prefer earlier versions just so that the earliest supported version gets test coverage by developers.
  125. if (automake-1.7 --version) < /dev/null > /dev/null 2>&1; then
  126.    AUTOMAKE=automake-1.7
  127.    ACLOCAL=aclocal-1.7
  128. elif (automake-1.8 --version) < /dev/null > /dev/null 2>&1; then
  129.    AUTOMAKE=automake-1.8
  130.    ACLOCAL=aclocal-1.8
  131. elif (automake --version) < /dev/null > /dev/null 2>&1; then
  132.    # Leave unversioned automake for a last resort: it may be a version earlier
  133.    # than what we require.
  134.    # (In particular, it might mean automake 1.4: that version didn't default to
  135.    #  installing a versioned name.)
  136.    AUTOMAKE=automake
  137.    ACLOCAL=aclocal
  138. else
  139.     echo
  140.     echo "  You must have automake 1.7 or newer installed to compile $PROJECT."
  141.     echo "  Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.8.5.tar.gz"
  142.     echo "  (or a newer version of 1.8 if it is available; note that 1.9 is bugg
  143. y)"
  144.     DIE=1
  145.     NO_AUTOMAKE=1
  146. fi
  147. if test x$AUTOMAKE != x; then
  148.     VER=`$AUTOMAKE --version \
  149.          | grep automake | sed "s/.* \([0-9.]*\)[-a-z0-9]*$/\1/"`
  150.     check_version $VER $AUTOMAKE_REQUIRED_VERSION
  151. fi
  152.  
  153. # if no automake, don't bother testing for aclocal
  154. test x$AUTOMAKE == x || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
  155.   echo
  156.   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
  157.   echo "installed doesn't appear recent enough."
  158.   echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
  159.   DIE=1
  160. }
  161.  
  162. if test "$DIE" -eq 1; then
  163.   exit 1
  164. fi
  165.  
  166. case $CC in
  167. xlc )
  168.   am_opt=--include-deps;;
  169. esac
  170.  
  171. for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print`
  172. do 
  173.   dr=`dirname $coin`
  174.   if test -f $dr/NO-AUTO-GEN; then
  175.     echo skipping $dr -- flagged as no auto-gen
  176.   else
  177.     echo processing $dr
  178.     ( cd $dr
  179.  
  180.       aclocalinclude="$ACLOCAL_FLAGS"
  181.  
  182.     if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
  183.         echo "Creating $dr/aclocal.m4 ..."
  184.         test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
  185. #        echo "Running glib-gettextize...  Ignore non-fatal messages."
  186.         attempt_command '^(Please add the files|  codeset|  progtest|from the|or directly|You will also|ftp://ftp.gnu.org|$)' \
  187.             glib-gettextize --copy --force
  188.         #echo "no" | glib-gettextize --force --copy
  189.         echo "Making $dr/aclocal.m4 writable ..."
  190.         test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
  191.     fi
  192.     if grep "^AC_PROG_INTLTOOL" configure.ac >/dev/null; then
  193.         attempt_command '' intltoolize --copy --force --automake
  194.     fi
  195.     if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
  196.         attempt_command '' xml-i18n-toolize --copy --force --automake
  197.     fi
  198.     if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
  199.         if test -z "$NO_LIBTOOLIZE" ; then 
  200.             attempt_command '' libtoolize --force --copy
  201.         fi
  202.     fi
  203.     attempt_command 'underquoted definition of|[\)\#]Extending' \
  204.         $ACLOCAL $aclocalinclude
  205.     if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
  206.         attempt_command '' autoheader
  207.     fi
  208.     attempt_command '' $AUTOMAKE --add-missing --gnu $am_opt
  209.     attempt_command '' autoconf
  210.     )
  211.   fi
  212. done
  213.  
  214. conf_flags="--enable-maintainer-mode"
  215.  
  216. if test x$NOCONFIGURE = x; then
  217.   echo Running $srcdir/configure $conf_flags "$@" ...
  218.   $srcdir/configure $conf_flags "$@" \
  219.   && echo Now type \`make\' to compile. || exit 1
  220. else
  221.   echo Skipping configure process.
  222. fi
  223.