[mm-common] Handle filename argument to mm-common-prepare



commit f2b7669ab6db7afa4db7c100136c54a99c83a070
Author: Daniel Elstner <danielk openismus com>
Date:   Thu Sep 17 15:59:23 2009 +0200

    Handle filename argument to mm-common-prepare
    
    * util/mm-common-prepare.in: Allow the name of the Autoconf source
    file to be specified on the command-line, so that it works the same
    way as with autoreconf.  Also, create the directory for the auxiliary
    build files automatically if it does not exist.

 util/mm-common-prepare.in |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/util/mm-common-prepare.in b/util/mm-common-prepare.in
index da71758..d3ea47f 100644
--- a/util/mm-common-prepare.in
+++ b/util/mm-common-prepare.in
@@ -2,7 +2,7 @@
 
 # Copyright (c) 2009  Openismus GmbH  <http://www.openismus.com/>
 #
-# This file is part of mm-common.
+# @configure_input@
 #
 # mm-common is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published
@@ -22,18 +22,18 @@ datarootdir="@datarootdir@"
 datadir="@datadir@"
 pkgdatadir="${datadir}/@PACKAGE_TARNAME@"
 
-progname="${0##*/}"
+progname=${0##*/}
 installcmd='ln -s'
 instaction=symlinking
 forceflag=
-srcdir=.
+target=.
 
 for arg
 do
   case $arg in
   '-?'|--help)
     cat <<EOF
-Usage: $progname [OPTION]... [DIRECTORY]
+Usage: $progname [OPTION]... [DIRECTORY | CONFIGURE-FILE]
 
 Prepare a C++ binding module to use mm-common.
 
@@ -65,24 +65,32 @@ EOF
     exit 1
     ;;
   ?*)
-    srcdir="${arg%/}"
+    target=${arg%/}
     ;;
   esac
 done
 
-acfile=$srcdir/configure.ac
+if test -d "$target"; then
+  srcdir=$target
+  acfile=$target/configure.ac
+else
+  srcdir=${target%/*}
+  acfile=$target
+fi
 
-test -f "$acfile" || {
+if test ! -f "$acfile"; then
   echo "$progname: error: $acfile not found" >&2
   exit 1
-}
+fi
+
 # Extract the directory macro arguments from configure.ac
 s='	 ' # tab+space
 auxdir=`sed -n "s/^[$s]*AC_CONFIG_AUX_DIR([[$s]*\\([^])\$,$s]*\\).*/\\1/p" "$acfile"`
 doctooldir=`sed -n "s/^[$s]*MM_CONFIG_DOCTOOL_DIR([[$s]*\\([^])\$,$s]*\\).*/\\1/p" "$acfile"`
 
-auxdir="$srcdir${auxdir:+/}$auxdir"
+auxdir=$srcdir${auxdir:+/}$auxdir
 echo "$progname: putting auxiliary files in '$auxdir'."
+test -d "$auxdir" || mkdir "$auxdir"
 
 for file in compile-binding.am dist-changelog.am doc-reference.am generate-binding.am
 do
@@ -94,10 +102,8 @@ done
 
 if test -n "$doctooldir"
 then
-  doctooldir="$srcdir/$doctooldir"
+  doctooldir=$srcdir/$doctooldir
   echo "$progname: putting documentation utilities in '$doctooldir'."
-
-  # Create the destination directory automatically if necessary
   test -d "$doctooldir" || mkdir "$doctooldir"
 
   for file in doc-install.pl doc-postprocess.pl doxygen.css tagfile-to-devhelp2.xsl



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