[telepathy-gabble/master] Add ax_config_dir from audacity

Sjoerd Simons sjoerd.simons at collabora.co.uk
Sun Dec 20 09:12:12 PST 2009


---
 configure.ac        |   39 ++-----------------
 m4/Makefile.am      |    3 +-
 m4/ax_config_dir.m4 |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 112 insertions(+), 36 deletions(-)
 create mode 100644 m4/ax_config_dir.m4

diff --git a/configure.ac b/configure.ac
index 70ddede..895e9f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,42 +171,11 @@ AC_MSG_RESULT([$TEST_PYTHON])
 AC_SUBST(TEST_PYTHON)
 AM_CONDITIONAL([WANT_TWISTED_TESTS], test false != "$TEST_PYTHON")
 
-# Always build Wocky with GTK doc support as we need it when doing "make check"
 # We have to run Wocky's configure *before* looking for it with PKG_CHECK_MODULES so wocky-uninstalled.pc has been generated
-echo "== Configuring embedded Wocky instance =="
-AS_MKDIR_P(["$ac_top_build_prefix"lib/ext/wocky])
-origdir=`pwd`
-
-AC_ARG_ENABLE(wocky-gtk-doc,
-  AC_HELP_STRING([--enable-wocky-gtk-doc],[compile wocky with gtk-doc enabled]),
-    enable_wocky_gtk_doc=$enableval, enable_wocky_gtk_doc=no )
-
-AC_ARG_WITH([wocky-tls],
-  AS_HELP_STRING([--with-wocky-tls],[tls library (gnutls, openssl, auto)]),
-  [],
-  [with_wocky_tls=auto])
-
-AS_CASE([$with_wocky_tls],
-  [gnutls], [with_wocky_tls=gnutls],
-  [openssl],[with_wocky_tls=openssl],
-  [auto],   [with_wocky_tls=auto],
-  [*],      [AC_MSG_ERROR(unknown ssl library "$with_wocky_tls")])
-
-confcmd="$origdir"/"$srcdir"/lib/ext/wocky/configure
-if test x$enable_wocky_gtk_doc != xno; then
-  confcmd="$confcmd --enable-gtk-doc"
-fi
-if test x$enable_silent_rules != xno; then
-  confcmd="$confcmd --enable-silent-rules"
-fi
-if test x$werror == xno; then
-  confcmd="$confcmd --disable-Werror"
-fi
-confcmd="$confcmd --with-tls=$with_wocky_tls"
-cd "$ac_top_build_prefix"lib/ext/wocky && echo "running $confcmd" &&
-  $confcmd ||
-  AC_MSG_ERROR([Failed to configure embedded Wocky tree])
-cd "$origdir"
+
+prev_top_build_prefix=$ac_top_build_prefix
+AX_CONFIG_DIR([lib/ext/wocky])
+ac_top_build_prefix=$prev_top_build_prefix
 
 dnl Check for Wocky
 # re-enable once Wocky has been released as a lib
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 80f350b..313f362 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -1,3 +1,4 @@
 EXTRA_DIST = \
     as-compiler-flag.m4 \
-    compiler.m4
+    compiler.m4 \
+    ax_config_dir.m4
diff --git a/m4/ax_config_dir.m4 b/m4/ax_config_dir.m4
new file mode 100644
index 0000000..dbe2d7c
--- /dev/null
+++ b/m4/ax_config_dir.m4
@@ -0,0 +1,106 @@
+dnl Copied from Audacity 1.3.10 which itself is licensed under the GPL v2 or
+dnl any later version
+
+dnl Function to configure a sub-library now, because we need to know the result
+dnl of the configuration now in order to take decisions.
+dnl We don't worry about whether the configuration worked or not - it is
+dnl assumed that the next thing after this will be a package-specific check to
+dnl see if the package is actually available. (Hint: use pkg-config and
+dnl -uninstalled.pc files if available).
+dnl code based on a simplification of _AC_OUTPUT_SUBDIRS in 
+dnl /usr/share/autoconf/autoconf/status.m4 which implements part of 
+dnl AC_CONFIG_SUBDIRS
+
+AC_DEFUN([AX_CONFIG_DIR], [
+  # Remove --cache-file and --srcdir arguments so they do not pile up.
+  ax_sub_configure_args=
+  ax_prev=
+  eval "set x $ac_configure_args"
+  shift
+  for ax_arg
+  do
+    if test -n "$ax_prev"; then
+      ax_prev=
+      continue
+    fi
+    case $ax_arg in
+    -cache-file | --cache-file | --cache-fil | --cache-fi \
+    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+      ax_prev=cache_file ;;
+    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
+    | --c=*)
+      ;;
+    --config-cache | -C)
+      ;;
+    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+      ax_prev=srcdir ;;
+    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+      ;;
+    -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+      ax_prev=prefix ;;
+    -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+      ;;
+    *)
+      case $ax_arg in
+      *\'*) ax_arg=`echo "$ax_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      esac
+      ax_sub_configure_args="$ax_sub_configure_args '$ax_arg'" ;;
+    esac
+  done
+
+  # Always prepend --prefix to ensure using the same prefix
+  # in subdir configurations.
+  ax_arg="--prefix=$prefix"
+  case $ax_arg in
+  *\'*) ax_arg=`echo "$ax_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+  esac
+  ax_sub_configure_args="'$ax_arg' $ax_sub_configure_args"
+
+  # Pass --silent
+  if test "$silent" = yes; then
+    ax_sub_configure_args="--silent $ax_sub_configure_args"
+  fi
+
+  ax_popdir=`pwd`
+  AC_MSG_NOTICE([Configuring sources in $1])
+  dnl for out-of-place builds srcdir and builddir will be different, and
+  dnl builddir may not exist, so we must create it
+  AS_MKDIR_P(["$1"])
+  dnl and also set the variables. As this isn't autoconf, the following may be
+  dnl risky:
+  _AC_SRCDIRS(["$1"])
+  cd "$1"
+
+  # Check for guested configure; otherwise get Cygnus style configure.
+  if test -f "configure.gnu"; then
+    ax_sub_configure=$ac_srcdir/configure.gnu
+  elif test -f "$ac_srcdir/configure"; then
+    ax_sub_configure=$ac_srcdir/configure
+  elif test -f "$ac_srcdir/configure.in"; then
+    # This should be Cygnus configure.
+	ax_sub_configure=$ac_aux_dir/configure
+  else
+    AC_MSG_WARN([no configuration information is in $1])
+    ax_sub_configure=
+  fi
+
+  # The recursion is here.
+  if test -n "$ax_sub_configure"; then
+    # Make the cache file name correct relative to the subdirectory.
+    case $cache_file in
+    [[\\/]]* | ?:[[\\/]]* ) ax_sub_cache_file=$cache_file ;;
+    *) # Relative name.
+	ax_sub_cache_file=$ac_top_build_prefix$cache_file ;;
+    esac
+
+    AC_MSG_NOTICE([running $SHELL $ax_sub_configure $ax_sub_configure_args --cache-file=$ax_sub_cache_file --srcdir=$ac_srcdir])
+    # The eval makes quoting arguments work.
+    eval "\$SHELL \"\$ax_sub_configure\" $ax_sub_configure_args \
+	   --cache-file=\"\$ax_sub_cache_file\" --srcdir=\"\$ax_srcdir\""
+  fi
+
+  cd "$ax_popdir"
+  AC_MSG_NOTICE([Done configuring in $1])
+])
+
-- 
1.5.6.5




More information about the telepathy-commits mailing list