autogen.sh
changeset 138 210cf8993393
parent 124 de7f74dbf83c
child 296 54393019edac
equal deleted inserted replaced
137:18785575aa7a 138:210cf8993393
     1 #!/bin/sh
     1 #!/bin/sh
       
     2 # Run this to generate all the initial makefiles, etc.
     2 
     3 
     3 PACKAGE="loudmouth"
     4 : ${AUTOCONF=autoconf}
       
     5 : ${AUTOHEADER=autoheader}
       
     6 : ${AUTOMAKE=automake-1.9}
       
     7 : ${ACLOCAL=aclocal-1.9}
       
     8 : ${LIBTOOLIZE=libtoolize}
       
     9 : ${INTLTOOLIZE=intltoolize}
       
    10 : ${LIBTOOL=libtool}
       
    11 : ${GNOME_DOC_PREPARE=gnome-doc-prepare}
       
    12 : ${GTKDOCIZE=gtkdocize}
     4 
    13 
     5 have_libtool=false
    14 srcdir=`dirname $0`
     6 have_autoconf=false
    15 test -z "$srcdir" && srcdir=.
     7 have_automake=false
       
     8 need_configure_in=false
       
     9 
    16 
    10 have_gtk_doc=false
    17 ORIGDIR=`pwd`
    11 want_gtk_doc=false
    18 cd $srcdir
       
    19 PROJECT="loudmouth"
       
    20 TEST_TYPE=-f
       
    21 FILE=loudmouth/loudmouth.h
       
    22 CONFIGURE=configure.ac
    12 
    23 
    13 if libtool --version < /dev/null > /dev/null 2>&1 ; then
    24 DIE=0
    14 	libtool_version=`libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
       
    15 	have_libtool=true
       
    16 	case $libtool_version in
       
    17 	    1.3*)
       
    18 		need_configure_in=true
       
    19 		;;
       
    20 	esac
       
    21 fi
       
    22 
    25 
    23 if autoconf --version < /dev/null > /dev/null 2>&1 ; then
    26 ($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
    24 	autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
    27 	echo
    25 	have_autoconf=true
    28 	echo "You must have autoconf installed to compile $PROJECT."
    26 	case $autoconf_version in
    29 	echo "Download the appropriate package for your distribution,"
    27 	    2.13)
    30 	echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
    28 		need_configure_in=true
    31 	DIE=1
    29 		;;
    32 }
    30 	esac
       
    31 fi
       
    32 
    33 
    33 if $have_libtool ; then : ; else
    34 (grep "^AC_PROG_INTLTOOL" $srcdir/$CONFIGURE >/dev/null) && {
    34 	echo;
    35   ($INTLTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
    35 	echo "You must have libtool >= 1.3 installed to compile $PACKAGE";
    36     echo
    36 	echo;
    37     echo "You must have \`intltoolize' installed to compile $PROJECT."
    37 	exit;
    38     echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/intltool-0.22.tar.gz"
    38 fi
    39     echo "(or a newer version if it is available)"
       
    40     DIE=1
       
    41   }
       
    42 }
    39 
    43 
    40 if grep "^GTK_DOC_CHECK" ./configure.in; then
    44 (grep "^GNOME_DOC_INIT" $srcdir/$CONFIGURE >/dev/null) && {
    41 	want_gtk_doc=true
    45   ($GNOME_DOC_PREPARE --version) < /dev/null > /dev/null 2>&1 || {
    42 fi
    46     echo
       
    47     echo "You must have \`gnome-doc-prepare' installed to compile $PROJECT."
       
    48     #echo "Get ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/intltool-0.22.tar.gz"
       
    49     #echo "(or a newer version if it is available)"
       
    50     DIE=1
       
    51   }
       
    52 }
    43 
    53 
    44 if $want_gtk_doc; then
    54 if grep "^GTK_DOC_CHECK" $srcdir/$CONFIGURE; then
    45 	(gtkdocize --version) < /dev/null > /dev/null 2>&1 || {
    55 	($GTKDOCIZE --version) < /dev/null > /dev/null 2>&1 || {
    46 	        echo;
    56 	        echo;
    47 		echo "You need gtk-doc to build $PACKAGE";
    57 		echo "You need gtk-doc to build $PACKAGE";
    48 		echo;
    58 		echo;
    49 	}
    59 	}
    50 fi
    60 fi
    51 
    61 
    52 (automake --version) < /dev/null > /dev/null 2>&1 || {
    62 ($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
    53 	echo;
    63 	echo
    54 	echo "You must have automake installed to compile $PACKAGE";
    64 	echo "You must have automake installed to compile $PROJECT."
    55 	echo;
    65 	echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.9.tar.gz"
    56 	exit;
    66 	echo "(or a newer version if it is available)"
       
    67 	DIE=1
    57 }
    68 }
    58 
    69 
    59 echo "Generating configuration files for $PACKAGE, please wait...."
    70 (grep "^AM_PROG_LIBTOOL" $CONFIGURE >/dev/null) && {
    60 echo;
    71   ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || {
       
    72     echo
       
    73     echo "**Error**: You must have \`libtool' installed to compile $PROJECT."
       
    74     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
       
    75     echo "(or a newer version if it is available)"
       
    76     DIE=1
       
    77   }
       
    78 }
    61 
    79 
    62 if $need_configure_in ; then
    80 if grep "^AM_[A-Z0-9_]\{1,\}_GETTEXT" "$CONFIGURE" >/dev/null; then
    63     if test ! -f configure.in ; then
    81   if grep "sed.*POTFILES" "$CONFIGURE" >/dev/null; then
    64 	echo "Creating symlink from configure.in to configure.ac..."
    82     GETTEXTIZE=""
    65 	echo
    83   else
    66 	ln -s configure.ac configure.in
    84     if grep "^AM_GLIB_GNU_GETTEXT" "$CONFIGURE" >/dev/null; then
       
    85       GETTEXTIZE="glib-gettextize"
       
    86       GETTEXTIZE_URL="ftp://ftp.gtk.org/pub/gtk/v2.0/glib-2.0.0.tar.gz"
       
    87     else
       
    88       GETTEXTIZE="gettextize"
       
    89       GETTEXTIZE_URL="ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
    67     fi
    90     fi
       
    91                                                                                                           
       
    92     $GETTEXTIZE --version < /dev/null > /dev/null 2>&1
       
    93     if test $? -ne 0; then
       
    94       echo
       
    95       echo "**Error**: You must have \`$GETTEXTIZE' installed to compile $PKG_NAME."
       
    96       echo "Get $GETTEXTIZE_URL"
       
    97       echo "(or a newer version if it is available)"
       
    98       DIE=1
       
    99     fi
       
   100   fi
    68 fi
   101 fi
    69 
   102 
    70 aclocal $ACLOCAL_FLAGS
       
    71 libtoolize --force
       
    72 gtkdocize || exit 1
       
    73 autoheader
       
    74 automake --add-missing
       
    75 autoconf
       
    76 
   103 
    77 ./configure $@ --enable-maintainer-mode --enable-compile-warnings
   104 if test "$DIE" -eq 1; then
       
   105 	exit 1
       
   106 fi
    78 
   107 
       
   108 test $TEST_TYPE $FILE || {
       
   109 	echo "You must run this script in the top-level $PROJECT directory"
       
   110 	exit 1
       
   111 }
       
   112 
       
   113 #if test -z "$*"; then
       
   114 #	echo "I am going to run ./configure with no arguments - if you wish "
       
   115 #        echo "to pass any to it, please specify them on the $0 command line."
       
   116 #fi
       
   117 
       
   118 case $CC in
       
   119 *xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;;
       
   120 esac
       
   121 
       
   122 for coin in .
       
   123 do 
       
   124   dr=`dirname $coin`
       
   125   if test -f $dr/NO-AUTO-GEN; then
       
   126     echo skipping $dr -- flagged as no auto-gen
       
   127   else
       
   128     echo processing $dr
       
   129     macrodirs= #`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
       
   130     ( cd $dr
       
   131       aclocalinclude="$ACLOCAL_FLAGS"
       
   132       for k in $macrodirs; do
       
   133   	if test -d $k; then
       
   134           aclocalinclude="$aclocalinclude -I $k"
       
   135   	##else 
       
   136 	##  echo "**Warning**: No such directory \`$k'.  Ignored."
       
   137         fi
       
   138       done
       
   139       if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE >/dev/null; then
       
   140 	if grep "sed.*POTFILES" $CONFIGURE >/dev/null; then
       
   141 	  : do nothing -- we still have an old unmodified $CONFIGURE
       
   142 	else
       
   143 	  echo "Creating $dr/aclocal.m4 ..."
       
   144 	  test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
       
   145 	  echo "Running glib-gettextize...  Ignore non-fatal messages."
       
   146 	  echo "no" | glib-gettextize --force --copy
       
   147 	  echo "Making $dr/aclocal.m4 writable ..."
       
   148 	  test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
       
   149         fi
       
   150       fi
       
   151       if grep "^AC_PROG_INTLTOOL" $CONFIGURE >/dev/null; then
       
   152         echo "Running intltoolize..."
       
   153 	intltoolize --copy --force --automake
       
   154       fi
       
   155       if grep "^GNOME_DOC_INIT" $CONFIGURE >/dev/null; then
       
   156         echo "Running $GNOME_DOC_PREPARE..."
       
   157 	$GNOME_DOC_PREPARE --force --copy || exit 1
       
   158       fi
       
   159       if grep "^AM_PROG_LIBTOOL" $CONFIGURE >/dev/null; then
       
   160 	echo "Running $LIBTOOLIZE..."
       
   161 	$LIBTOOLIZE --force --copy
       
   162       fi
       
   163       echo "Running $ACLOCAL $aclocalinclude ..."
       
   164       $ACLOCAL $aclocalinclude
       
   165       if grep "^GTK_DOC_CHECK" $CONFIGURE > /dev/null; then
       
   166 	echo "Running $GTKDOCIZE..."
       
   167 	$GTKDOCIZE
       
   168       fi
       
   169       if grep "^AM_CONFIG_HEADER" $CONFIGURE >/dev/null; then
       
   170 	echo "Running $AUTOHEADER..."
       
   171 	$AUTOHEADER
       
   172       fi
       
   173       echo "Running $AUTOMAKE --gnu $am_opt ..."
       
   174       $AUTOMAKE --add-missing --gnu $am_opt
       
   175       echo "Running $AUTOCONF ..."
       
   176       $AUTOCONF
       
   177     )
       
   178   fi
       
   179 done
       
   180 
       
   181 conf_flags="--enable-maintainer-mode"
       
   182 
       
   183 cd "$ORIGDIR"
       
   184 
       
   185 if test x$NOCONFIGURE = x; then
       
   186   echo Running $srcdir/configure $conf_flags "$@" ...
       
   187   $srcdir/configure $conf_flags "$@" \
       
   188   && echo Now type \`make\' to compile $PROJECT  || exit 1
       
   189 else
       
   190   echo Skipping configure process.
       
   191 fi