[seed] Big build system reorganization.n. Also add shave



commit cf93fe0ea8761d47459e95a546d7acf5a3f959e4
Author: Robert Carr <racarr mireia (none)>
Date:   Wed Mar 11 22:24:24 2009 -0400

    Big build system reorganization.n. Also add shave for pretty builds
---
 autogen.sh               |  177 +++++++---------------------------------------
 config.h.in              |    4 +
 configure.ac             |   45 ++++++++----
 libseed/Makefile.am      |    9 +--
 m4/shave.m4              |   40 ++++++++++
 scripts/shave-libtool.in |   69 ++++++++++++++++++
 scripts/shave.in         |   76 ++++++++++++++++++++
 7 files changed, 250 insertions(+), 170 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index 5f2ddab..1b2abb3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -4,165 +4,42 @@
 srcdir=`dirname $0`
 test -z "$srcdir" && srcdir=.
 
-DIE=0
-
-(gtkdocize) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "**Error**: You must have \`gtk-doc-tools' installed."
-    echo "Download the appropriate package for your distribution,"
-    echo "or get the source tarball at ftp://ftp.gtk.org/pub/";
-    DIE=1
-}
-
-if [ -n "$GNOME2_DIR" ]; then
-	ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
-	LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
-	PATH="$GNOME2_DIR/bin:$PATH"
-	export PATH
-	export LD_LIBRARY_PATH
-fi
+PKG_NAME="seed"
+REQUIRED_AUTOCONF_VERSION=2.53
+REQUIRED_AUTOMAKE_VERSION=1.9
+REQUIRED_GTK_DOC_VERSION=1.10
 
-(test -f $srcdir/configure.ac) || {
+(test -f $srcdir/configure.ac \
+  && test -f $srcdir/autogen.sh) || {
     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
-    echo " top-level package directory"
+    echo " top-level $PKG_NAME directory"
     exit 1
 }
 
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
-  echo
-  echo "**Error**: You must have \`autoconf' installed."
-  echo "Download the appropriate package for your distribution,"
-  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/";
-  DIE=1
-}
-
-(grep "^IT_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
-  (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
-    echo 
-    echo "**Error**: You must have \`intltool' installed."
-    echo "You can get it from:"
-    echo "  ftp://ftp.gnome.org/pub/GNOME/";
-    DIE=1
-  }
-}
-
-(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
-  (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "**Error**: You must have \`xml-i18n-toolize' installed."
-    echo "You can get it from:"
-    echo "  ftp://ftp.gnome.org/pub/GNOME/";
-    DIE=1
-  }
-}
-
-(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
-  (libtool --version) < /dev/null > /dev/null 2>&1 || 
-  (glibtool --version) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "**Error**: You must have \`libtool' installed."
-    echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/";
-    DIE=1
-  }
-}
-
-(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
-  (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
-  (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "**Error**: You must have \`glib' installed."
-    echo "You can get it from: ftp://ftp.gtk.org/pub/gtk";
-    DIE=1
-  }
-}
-
-(automake --version) < /dev/null > /dev/null 2>&1 || {
-  echo
-  echo "**Error**: You must have \`automake' installed."
-  echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/";
-  DIE=1
-  NO_AUTOMAKE=yes
-}
-
-
-# if no automake, don't bother testing for aclocal
-test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
-  echo
-  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
-  echo "installed doesn't appear recent enough."
-  echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/";
-  DIE=1
-}
-
-if test "$DIE" -eq 1; then
-  exit 1
-fi
-
-if test -z "$*"; then
-  echo "**Warning**: I am going to run \`configure' with no arguments."
-  echo "If you wish to pass any to it, please specify them on the"
-  echo \`$0\'" command line."
-  echo
-fi
-
-case $CC in
-xlc )
-  am_opt=--include-deps;;
-esac
+DIE=0
 
-for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print`
-do 
-  dr=`dirname $coin`
-  if test -f $dr/NO-AUTO-GEN; then
-    echo skipping $dr -- flagged as no auto-gen
-  else
-    echo processing $dr
-    ( cd $dr
+# This is a bit complicated here since we can't use gnome-config yet.
+# It'll be easier after switching to pkg-config since we can then
+# use pkg-config to find the gnome-autogen.sh script.
 
-      aclocalinclude="$ACLOCAL_FLAGS"
+gnome_autogen=
+gnome_datadir=
 
-      if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
-	echo "Creating $dr/aclocal.m4 ..."
-	test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
-	echo "Running glib-gettextize ...  Ignore non-fatal messages."
-	echo "no" | glib-gettextize --force --copy
-	echo "Making $dr/aclocal.m4 writable ..."
-	test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
-      fi
-      if grep "^IT_PROG_INTLTOOL" configure.ac >/dev/null; then
-        echo "Running intltoolize ..."
-	intltoolize --copy --force --automake
-      fi
-      if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
-        echo "Running xml-i18n-toolize ..."
-	xml-i18n-toolize --copy --force --automake
-      fi
-      if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
-	if test -z "$NO_LIBTOOLIZE" ; then 
-	  echo "Running libtoolize ..."
-	  libtoolize --force --copy || glibtoolize --force --copy
-	fi
-      fi
-      echo "Running aclocal $aclocalinclude ..."
-      aclocal $aclocalinclude
-      if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then
-	echo "Running autoheader..."
-	autoheader
-      fi
-      echo "Running automake --gnu $am_opt ..."
-      automake --add-missing --gnu $am_opt
-      echo "Running autoconf ..."
-      autoconf
-    )
+ifs_save="$IFS"; IFS=":"
+for dir in $PATH ; do
+  test -z "$dir" && dir=.
+  if test -f $dir/gnome-autogen.sh ; then
+    gnome_autogen="$dir/gnome-autogen.sh"
+    gnome_datadir=`echo $dir | sed -e 's,/bin$,/share,'`
+    break
   fi
 done
+IFS="$ifs_save"
 
-conf_flags="--enable-maintainer-mode"
-
-if test x$NOCONFIGURE = x; then
-  echo Running $srcdir/configure $conf_flags "$@" ...
-  $srcdir/configure $conf_flags "$@" \
-  && echo Now type \`make\' to compile. || exit 1
-else
-  echo Skipping configure process.
+if test -z "$gnome_autogen" ; then
+  echo "You need to install the gnome-common module and make"
+  echo "sure the gnome-autogen.sh script is in your \$PATH."
+  exit 1
 fi
+
+GNOME_DATADIR="$gnome_datadir" USE_GNOME2_MACROS=1 USE_COMMON_DOC_BUILD=yes . $gnome_autogen
diff --git a/config.h.in b/config.h.in
index 2996727..8617d09 100644
--- a/config.h.in
+++ b/config.h.in
@@ -54,6 +54,10 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
 /* Define to 1 if your C compiler doesn't accept -c and -o together. */
 #undef NO_MINUS_C_MINUS_O
 
diff --git a/configure.ac b/configure.ac
index c05291b..3e13837 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,21 +1,37 @@
+AC_PREREQ(2.59)
 AC_INIT(seed, 0.3)
-AC_CANONICAL_BUILD
-AC_CANONICAL_HOST
 
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
-AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.7 -Wno-portability])
 AM_MAINTAINER_MODE
+AC_CONFIG_HEADERS([config.h])
+
+AC_CONFIG_MACRO_DIR([m4])
 
-AC_CONFIG_MACRO_DIR(m4)
+AC_CANONICAL_HOST
 
-AC_ISC_POSIX
 AC_PROG_CC
-AM_PROG_CC_STDC
 AM_PROG_CC_C_O
-AC_HEADER_STDC
+AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
 
 CFLAGS="-O3"
 
+changequote(,)dnl
+ensureflag() {
+  flag="$1"; shift
+  result="$@"
+
+  case " ${result} " in
+  *[\ \	]${flag}[\ \	]*) ;;
+  *) result="${flag} ${result}" ;;
+  esac
+
+  echo ${result}
+}
+
+changequote([,])dnl
+
+
 dnl =====================Internationalization==================================
 GETTEXT_PACKAGE=seed
 AC_SUBST(GETTEXT_PACKAGE)
@@ -23,8 +39,6 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
 AM_GLIB_GNU_GETTEXT
 IT_PROG_INTLTOOL([0.35.0])
 
-AM_PROG_LIBTOOL
-
 dnl ============================libffi=========================================
 PKG_CHECK_MODULES(libffi, libffi, have_ffi_pkgconfig=yes, have_ffi_pkgconfig=no)
 
@@ -228,14 +242,13 @@ esac
 AC_SUBST(SEED_OSX_CFLAGS)
 AC_SUBST(SEED_OSX_LDFLAGS)
 
-AC_CONFIG_FILES([
-seed.pc])
-
 dnl =============================gtk-doc=======================================
 GTK_DOC_CHECK(1.9)
 
 dnl =============================Output========================================
-AC_OUTPUT([
+SHAVE_INIT([scripts])
+AC_CONFIG_FILES([
+seed.pc
 Makefile
 
 doc/conventions.html
@@ -247,6 +260,9 @@ doc/modules/multiprocessing.html
 doc/modules/readline.html
 doc/modules/sqlite.html
 
+scripts/shave
+scripts/shave-libtool
+
 libseed/Makefile
 po/Makefile.in
 src/Makefile
@@ -273,6 +289,7 @@ modules/canvas/Makefile
 modules/readline/Makefile
 modules/Multiprocessing/Makefile
 ])
+AC_OUTPUT
 
 echo "
 Build Configuration:
diff --git a/libseed/Makefile.am b/libseed/Makefile.am
index 4748878..b3ba4c1 100644
--- a/libseed/Makefile.am
+++ b/libseed/Makefile.am
@@ -23,14 +23,11 @@ libseed_la_SOURCES = \
 	seed-types.h
 
 libseed_la_LIBADD = $(LIBSEED_LIBS)
-
-AM_CPPFLAGS = -lgmodule-2.0 $(LIBSEED_CFLAGS) $(SEED_OSX_CFLAGS) $(FFI_CFLAGS)
+libseed_la_CPPFLAGS = -lgmodule-2.0 $(LIBSEED_CFLAGS) $(SEED_OSX_CFLAGS) $(FFI_CFLAGS)
+libseed_la_LDFLAGS = -no-undefined $(SEED_PROFILE_LDFLAGS) $(SEED_OSX_LDFLAGS) $(FFI_LIBS)
 
 seedheaders_HEADERS = seed.h
 
 seedheadersdir = $(pkgincludedir)
 
-EXTRA_DIST = $(seedheaders_HEADERS)
-
-LIBSEED_CFLAGS += -Wall -Werror $(SEED_DEBUG_CFLAGS) $(SEED_PROFILE_CFLAGS)
-AM_LDFLAGS = $(SEED_PROFILE_LDFLAGS) $(SEED_OSX_LDFLAGS) $(FFI_LIBS)
+LIBSEED_CFLAGS += $(SEED_DEBUG_CFLAGS) $(SEED_PROFILE_CFLAGS)
diff --git a/m4/shave.m4 b/m4/shave.m4
new file mode 100644
index 0000000..5b1f675
--- /dev/null
+++ b/m4/shave.m4
@@ -0,0 +1,40 @@
+dnl Make automake/libtool output more friendly to humans
+dnl
+dnl SHAVE_INIT([shavedir])
+dnl
+dnl shavedir: the directory where the shave script is, it defaults to
+dnl           $(top_builddir)
+dnl
+dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
+dnl   before AC_CONFIG_FILE/AC_OUTPUT is perfect.  This macro rewrite CC and
+dnl   LIBTOOL, you don't want the configure tests to have these variables
+dnl   re-defined.
+dnl * This macro requires GNU make's -s option.
+
+AC_DEFUN([SHAVE_INIT], [
+dnl where can we find the shave scripts?
+m4_if([$1],,
+  [shavedir='$(top_builddir)'],
+  [shavedir='$(top_builddir)'/$1])
+AC_SUBST(shavedir)
+dnl make is now quiet
+AC_SUBST([MAKEFLAGS], [-s])
+AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
+dnl we need sed
+AC_CHECK_PROG(SED,sed,sed,false)
+dnl substitute libtool
+SHAVE_SAVED_LIBTOOL=$LIBTOOL
+AC_SUBST(SHAVE_SAVED_LIBTOOL)
+LIBTOOL="\$(SHELL) \$(shavedir)/shave-libtool '\$(SHAVE_SAVED_LIBTOOL)'"
+AC_SUBST(LIBTOOL)
+dnl substitute cc
+SHAVE_SAVED_CC=$CC
+SHAVE_SAVED_CXX=$CXX
+AC_SUBST(SHAVE_SAVED_CC)
+AC_SUBST(SHAVE_SAVED_CXX)
+CC="\$(SHELL) \$(shavedir)/shave cc '\$(SHAVE_SAVED_CC)'"
+CXX="\$(SHELL) \$(shavedir)/shave cxx '\$(SHAVE_SAVED_CXX)'"
+AC_SUBST(CC)
+AC_SUBST(CXX)
+])
+
diff --git a/scripts/shave-libtool.in b/scripts/shave-libtool.in
new file mode 100644
index 0000000..1f3a720
--- /dev/null
+++ b/scripts/shave-libtool.in
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# we need sed
+SED= SED@
+if test -z "$SED" ; then
+SED=sed
+fi
+
+lt_unmangle ()
+{
+   last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
+}
+
+# the real libtool to use
+LIBTOOL="$1"
+shift
+
+# if 1, don't print anything, the underlaying wrapper will do it
+pass_though=0
+
+# scan the arguments, keep the right ones for libtool, and discover the mode
+preserved_args=
+while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+    --mode=*)
+        mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
+        preserved_args="$preserved_args $opt"
+        ;;
+    -o)
+        lt_output="$1"
+        preserved_args="$preserved_args $opt"
+	;;
+    *)
+        preserved_args="$preserved_args $opt"
+        ;;
+      esac
+done
+
+case "$mode" in
+compile)
+    # shave will be called and print the actual CC/CXX/LINK line
+    preserved_args="$preserved_args --shave-mode=$mode"
+    pass_though=1
+    ;;
+link)
+    preserved_args="$preserved_args --shave-mode=$mode"
+    Q="  LINK  "
+    ;;
+*)
+    # let's u
+    # echo "*** libtool: Unimplemented mode: $mode, fill a bug report"
+    ;;
+esac
+
+lt_unmangle "$lt_output"
+output=$last_result
+
+if test -z $V; then
+    if test $pass_though -eq 0; then
+        echo "$Q$output"
+    fi
+    $LIBTOOL --silent $preserved_args
+else
+    echo $LIBTOOL $preserved_args
+    $LIBTOOL $preserved_args
+fi
diff --git a/scripts/shave.in b/scripts/shave.in
new file mode 100644
index 0000000..174641e
--- /dev/null
+++ b/scripts/shave.in
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+# we need sed
+SED= SED@
+if test -z "$SED" ; then
+SED=sed
+fi
+
+lt_unmangle ()
+{
+   last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
+}
+
+# the tool to wrap (cc, cxx, ar, ranlib, ..)
+tool="$1"
+shift
+
+# the reel tool (to call)
+REEL_TOOL="$1"
+shift
+
+pass_through=0
+preserved_args=
+while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+    --shave-mode=*)
+        mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
+	;;
+    -o)
+        lt_output="$1"
+        preserved_args="$preserved_args $opt"
+	;;
+    *)
+        preserved_args="$preserved_args $opt"
+        ;;
+      esac
+done
+
+# mode=link is handled in the libtool wrapper
+case "$mode,$tool" in
+link,*)
+    pass_through=1
+    ;;
+*,cxx)
+    Q="  CXX   "
+    ;;
+*,cc)
+    Q="  CC    "
+    ;;
+*,fc)
+    Q="  FC    "
+    ;;
+*,f77)
+    Q="  F77   "
+    ;;
+*,*)
+    # should not happen
+    Q="  CC    "
+    ;;
+esac
+
+lt_unmangle "$lt_output"
+output=$last_result
+
+if test -z $V; then
+    if test $pass_through -eq 0; then
+        echo "$Q$output"
+    fi
+    $REEL_TOOL $preserved_args
+else
+    echo $REEL_TOOL $preserved_args
+    $REEL_TOOL $preserved_args
+fi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]