[Pkg-libvirt-commits] [libguestfs] 27/116: build: isolate the libdb tools search in an own autoconf macro

Hilko Bengen bengen at moszumanska.debian.org
Wed Nov 26 22:04:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.29.10-1
in repository libguestfs.

commit a293ac1e911052c52e3110800a5b7b2c5f1bd37d
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Thu Oct 30 14:52:28 2014 +0100

    build: isolate the libdb tools search in an own autoconf macro
    
    Create an autoconf macro to deal with the possible combinations of names
    and versions of the libdb tools. This also eases the addition of a libdb
    version, or a new pattern for the names of tools.
    
    There is no functional change.
---
 configure.ac               |  6 ++----
 m4/guestfs-find-db-tool.m4 | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index dd7a70b..e5fa215 100644
--- a/configure.ac
+++ b/configure.ac
@@ -679,10 +679,8 @@ AC_CHECK_PROG([PO4A],[po4a],[po4a],[no])
 AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A" != "xno"])
 
 dnl Check for db_dump, db_load (optional).
-AC_PATH_PROGS([DB_DUMP],
-              [db_dump db5.1_dump db4_dump db4.8_dump db4.7_dump db4.6_dump],[no])
-AC_PATH_PROGS([DB_LOAD],
-              [db_load db5.1_load db4_load db4.8_load db4.7_load db4.6_load],[no])
+GUESTFS_FIND_DB_TOOL([DB_DUMP], [dump])
+GUESTFS_FIND_DB_TOOL([DB_LOAD], [load])
 if test "x$DB_DUMP" != "xno"; then
     AC_DEFINE_UNQUOTED([DB_DUMP],["$DB_DUMP"],[Name of db_dump program.])
 fi
diff --git a/m4/guestfs-find-db-tool.m4 b/m4/guestfs-find-db-tool.m4
new file mode 100644
index 0000000..0cbbd13
--- /dev/null
+++ b/m4/guestfs-find-db-tool.m4
@@ -0,0 +1,42 @@
+# libguestfs
+# Copyright (C) 2014 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+AC_DEFUN([GUESTFS_FIND_DB_TOOL],[
+    pushdef([VARIABLE],$1)
+    TOOL=$2
+
+    db_tool_name="db_$TOOL"
+    db_versions="5.1 4.8 4.7 4.6"
+    db_tool_patterns="db_$TOOL dbX_$TOOL dbX.Y_$TOOL"
+
+    AC_ARG_VAR(VARIABLE, [Absolute path to $db_tool_name executable])
+
+    AS_IF(test -z "$VARIABLE", [
+        exe_list=""
+        for ver in $db_versions ; do
+            ver_maj=`echo $ver | cut -d. -f1`
+            ver_min=`echo $ver | cut -d. -f2`
+            for pattern in $db_tool_patterns ; do
+                exe=`echo "$pattern" | sed -e "s/X/$ver_maj/g;s/Y/$ver_min/g"`
+                exe_list="$exe_list $exe"
+            done
+        done
+        AC_PATH_PROGS([]VARIABLE[], [$exe_list], [no])
+    ])
+
+    popdef([VARIABLE])
+])

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list