2005-10-15 Marcus Brinkmann <marcus@g10code.de>
authorMarcus Brinkmann <mb@g10code.com>
Sat, 15 Oct 2005 15:54:55 +0000 (15:54 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Sat, 15 Oct 2005 15:54:55 +0000 (15:54 +0000)
* m4/gpg4win.m4: New file.
* include/config.sh: Add many package variables.
* configure.ac: Call package detection macros.
* Makefile.am (ACLOCAL_AMFLAGS): New variable.
* src/gpg4win.sh: Use some of the new variables.

ChangeLog
Makefile.am
configure.ac
include/config.sh.in
m4/gpg4win.m4 [new file with mode: 0644]
src/gpg4win.sh

index fcc76da..7a9b12a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
 2005-10-15  Marcus Brinkmann  <marcus@g10code.de>
 
+       * m4/gpg4win.m4: New file.
+       * include/config.sh: Add many package variables.
+       * configure.ac: Call package detection macros.
+       * Makefile.am (ACLOCAL_AMFLAGS): New variable.
+       * src/gpg4win.sh: Use some of the new variables.
+
        * packages/download.sh: Fix downloading of Gtk source packages.
 
index 59dcf5a..aadafa3 100644 (file)
@@ -1 +1,3 @@
+ACLOCAL_AMFLAGS = -I m4
+
 SUBDIRS = packages include src
index e399d08..e1fef2e 100644 (file)
@@ -27,10 +27,10 @@ PACKAGE=$PACKAGE_NAME
 VERSION=$PACKAGE_VERSION
 
 AC_CONFIG_SRCDIR(include/config.sh.in)
+AC_CONFIG_MACRO_DIR(m4)
 
 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
 AM_MAINTAINER_MODE
-
 AC_CANONICAL_HOST
 
 AC_SUBST(PACKAGE)
@@ -54,6 +54,30 @@ AC_PROG_INSTALL
 AC_CHECK_PROGS(WGET, wget)
 
 
+# Packages.
+
+#GPG4WIN_BPKG_GNU([libiconv])
+#GPG4WIN_BPKG_GNU([gettext], [libiconv])
+
+GPG4WIN_BPKG_GNUWIN32([zlib])
+GPG4WIN_BPKG_GNUWIN32([libpng], [pkgconfig])
+
+GPG4WIN_BPKG_GTK([pkgconfig])
+GPG4WIN_BPKG_GTK_DEV([glib], [pkgconfig])
+#GPG4WIN_BPKG_GTK_DEV([gtk+], [atk pango glib libiconv gettext pkgconfig])
+GPG4WIN_BPKG_GTK_DEV([gtk+], [atk pango glib pkgconfig])
+GPG4WIN_BPKG_GTK_DEV([atk], [glib pkgconfig])
+GPG4WIN_BPKG_GTK_DEV([pango], [glib pkgconfig])
+
+GPG4WIN_SPKG([libgpg-error])
+GPG4WIN_SPKG([gpgme], [libgpg-error])
+GPG4WIN_SPKG([gnupg])
+GPG4WIN_SPKG([gpgol], [gpgme])
+GPG4WIN_SPKG([gpa], [zlib gtk+ libpng glib gpgme])
+
+GPG4WIN_FINALIZE
+
+
 # Finalize.
 
 AC_CONFIG_FILES(Makefile src/Makefile include/Makefile)
index 9a7a53b..c1cd450 100755 (executable)
@@ -14,3 +14,63 @@ RM=@RM@
 STOW=@STOW@
 INSTALL="@INSTALL@"
 WGET=@WGET@
+
+
+# The package build list, in order.
+gpg4win_build_list="@gpg4win_build_list@"
+
+
+# The default packages source directory.
+gpg4win_packages=@gpg4win_packages@
+
+
+# The path of each package.
+
+gpg4win_pkg_libgpg_error=@gpg4win_pkg_libgpg_error@
+gpg4win_pkg_libgpg_error_version=@gpg4win_pkg_libgpg_error_version@
+
+gpg4win_pkg_gpgme=@gpg4win_pkg_gpgme@
+gpg4win_pkg_gpgme_version=@gpg4win_pkg_gpgme_version@
+
+gpg4win_pkg_gnupg=@gpg4win_pkg_gnupg@
+gpg4win_pkg_gnupg_version=@gpg4win_pkg_gnupg_version@
+
+gpg4win_pkg_gpgol=@gpg4win_pkg_gpgol@
+gpg4win_pkg_gpgol_version=@gpg4win_pkg_gpgol_version@
+
+gpg4win_pkg_gpa=@gpg4win_pkg_gpa@
+gpg4win_pkg_gpa_version=@gpg4win_pkg_gpa_version@
+
+gpg4win_pkg_zlib=@gpg4win_pkg_zlib@
+gpg4win_pkg_zlib_version=@gpg4win_pkg_zlib_version@
+gpg4win_pkg_zlib_dev=@gpg4win_pkg_zlib_dev@
+gpg4win_pkg_zlib_src=@gpg4win_pkg_zlib_src@
+
+gpg4win_pkg_libpng=@gpg4win_pkg_libpng@
+gpg4win_pkg_libpng_version=@gpg4win_pkg_libpng_version@
+gpg4win_pkg_libpng_dev=@gpg4win_pkg_libpng_dev@
+gpg4win_pkg_libpng_src=@gpg4win_pkg_libpng_src@
+
+gpg4win_pkg_pkgconfig=@gpg4win_pkg_pkgconfig@
+gpg4win_pkg_pkgconfig_version=@gpg4win_pkg_pkgconfig_version@
+gpg4win_pkg_pkgconfig_src=@gpg4win_pkg_pkgconfig_src@
+
+gpg4win_pkg_glib=@gpg4win_pkg_glib@
+gpg4win_pkg_glib_version=@gpg4win_pkg_glib_version@
+gpg4win_pkg_glib_dev=@gpg4win_pkg_glib_dev@
+gpg4win_pkg_glib_src=@gpg4win_pkg_glib_src@
+
+gpg4win_pkg_atk=@gpg4win_pkg_atk@
+gpg4win_pkg_atk_version=@gpg4win_pkg_atk_version@
+gpg4win_pkg_atk_dev=@gpg4win_pkg_atk_dev@
+gpg4win_pkg_atk_src=@gpg4win_pkg_atk_src@
+
+gpg4win_pkg_pango=@gpg4win_pkg_pango@
+gpg4win_pkg_pango_version=@gpg4win_pkg_pango_version@
+gpg4win_pkg_pango_dev=@gpg4win_pkg_pango_dev@
+gpg4win_pkg_pango_src=@gpg4win_pkg_pango_src@
+
+gpg4win_pkg_gtk_=@gpg4win_pkg_gtk_@
+gpg4win_pkg_gtk__version=@gpg4win_pkg_gtk__version@
+gpg4win_pkg_gtk__dev=@gpg4win_pkg_gtk__dev@
+gpg4win_pkg_gtk__src=@gpg4win_pkg_gtk__src@
diff --git a/m4/gpg4win.m4 b/m4/gpg4win.m4
new file mode 100644 (file)
index 0000000..e443ae2
--- /dev/null
@@ -0,0 +1,391 @@
+dnl gpg4win.m4 - macros to configure gpg4win.
+dnl Copyright (C) 2005 g10 Code GmbH
+dnl
+dnl This file is part of GPG4Win.
+dnl
+dnl GPG4Win is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl GPG4Win is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+dnl MA 02110-1301, USA
+
+
+# GPG4WIN_BASH
+# Gpg4Win needs bash.  This macro checks for it.
+AC_DEFUN([GPG4WIN_BASH],
+[
+  AC_MSG_CHECKING([for Bash])
+  _bash=$BASH_VERSION
+  if test -z "$_bash"; then
+    _bash=no
+  fi
+  AC_MSG_RESULT($_bash)
+  if test $_bash = no; then
+    AC_MSG_ERROR("this configure script requires Bash")
+  fi
+])
+
+
+# GPG4WIN_PACKAGES
+# Determines the path to the source and binary packages.
+# Default is the "packages" directory in the source directory.
+# The path is stored in the shell variable gpg4win_packages.
+AC_DEFUN([GPG4WIN_PACKAGES],
+[
+  AC_MSG_CHECKING(for packages directory)
+  _gpg4win_packages_default=packages
+  AC_ARG_WITH([packages],
+    AS_HELP_STRING([--with-packages=DIR],
+                   [source and binary packages [[packages]]]),
+    gpg4win_packages=$withval)
+  AS_IF([test -z $gpg4win_packages],
+        [gpg4win_packages=$_gpg4win_packages_default])
+  AS_IF([test `echo $gpg4win_packages | head -c 1` != /],
+        [gpg4win_packages=`pwd`/$gpg4win_packages])
+  AC_SUBST(gpg4win_packages)
+  AC_MSG_RESULT($gpg4win_packages)
+
+  # Set auto-detection.  FIXME: This should accept a comma-separated
+  # list of packages that will be autodetected.
+  _gpg4win_auto_detection=yes
+  AC_ARG_ENABLE([packages],
+    AS_HELP_STRING([--enable-packages], [enable auto-detection [[yes]]]),
+    _gpg4win_auto_detection=$enableval)
+])
+
+
+# Should be called early.
+AC_DEFUN([GPG4WIN_INIT],
+[
+  # We call this here so its options appear before the per-package options.
+  AC_REQUIRE([GPG4WIN_PACKAGES])
+])
+
+
+# GPG4WIN_FIND([FILE],[PATTERN],[ZIP|TAR],[DIR],[IF-FOUND],[IF-NOT-FOUND])
+# Search for package file FILE in DIR.  If DIR is empty, yes or maybe,
+# look in default directory.  If DIR is not maybe, abort if not found.
+# The package file name is provided in gpg4win_val and the version in
+# gpg4win_version.
+AC_DEFUN([GPG4WIN_FIND],
+[
+  AC_REQUIRE([GPG4WIN_BASH])
+  AC_REQUIRE([GPG4WIN_PACKAGES])
+
+  gpg4win_val=
+  gpg4win_version=
+
+  AC_MSG_CHECKING(for package $1)
+  _gpg4win_critical=no
+  _gpg4win_file=
+  _gpg4win_dir=$4
+
+  # If --enable-pkg-foo was specified, make success critical.
+  AS_IF([test x$_gpg4win_dir != xmaybe], [_gpg4win_critical=yes])
+
+  # Only check if critical or auto detection is requested.
+  AS_IF([test $_gpg4win_auto_detection = yes -o $_gpg4win_critical = yes],
+    [AS_IF([test -z "$_gpg4win_dir" -o x$_gpg4win_dir = xyes -o x$_gpg4win_dir = xmaybe],
+          [_gpg4win_dir=$gpg4win_packages])
+
+    # Install pattern.
+    AS_IF([test -z "$2"], [_gpg4win_pat='$1-\([[0-9]].*\)'],
+         [_gpg4win_pat="$2"])
+
+    # Frob pattern.  Regex party! 
+    [_gpg4win_glob=`echo "$_gpg4win_pat" | sed -e 's/\\\\(\(.*\)\\\\)/\1/'`]
+    [_gpg4win_glob=`echo "$_gpg4win_glob" | sed -e 's/\\.\\*/*/'`]
+
+    # Make non-matching globs expand to nothing.
+    shopt -s nullglob
+
+    _gpg4win_format=both
+    AS_IF([test ! -z "$3"], _gpg4win_format="$3")
+
+    AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip],
+          [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tar.bz2`
+           _gpg4win_suffix=.tar.bz2])
+    AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip],
+          [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tbz2`
+           _gpg4win_suffix=.tbz2])
+    AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip],
+          [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tbz`
+           _gpg4win_suffix=.tbz])
+    AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip],
+          [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tar.gz`
+           _gpg4win_suffix=.tar.gz])
+    AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != zip],
+          [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.tgz`
+           _gpg4win_suffix=.tgz])
+    AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_format != tar],
+          [_gpg4win_file=`echo ${_gpg4win_dir}/${_gpg4win_glob}.zip`
+           _gpg4win_suffix=.zip])
+    shopt -u nullglob])
+
+  AS_IF([test -z "$_gpg4win_file"],
+        AC_MSG_RESULT(no),
+       AS_IF([test `echo $_gpg4win_file | head -c 1` != /],
+              [_gpg4win_file=`pwd`/$_gpg4win_file])
+        AC_MSG_RESULT($_gpg4win_file))
+  AS_IF([test -z "$_gpg4win_file" -a $_gpg4win_critical = yes],
+        AC_MSG_ERROR(could not find sources for $1 in $_gpg4win_dir))
+  AS_IF([test ! -z $_gpg4win_file],
+        [gpg4win_val="$_gpg4win_file"
+       [gpg4win_version=`echo "$gpg4win_val" | sed -e "s,^.*/${_gpg4win_pat}${_gpg4win_suffix}$,\1,"`]
+         [$5]],
+        [$6])
+])
+
+
+AC_DEFUN([GPG4WIN_CHECK_DEPS],
+[
+  AC_MSG_CHECKING(build list)
+  gpg4win_build_list=`echo $_gpg4win_deps | tsort`
+  # Remove newlines.
+  gpg4win_build_list=`echo $gpg4win_build_list`
+  AC_MSG_RESULT($gpg4win_build_list)
+  AC_SUBST(gpg4win_build_list)
+
+  # Check each dependency.
+  _gpg4win_not_found=
+  _gpg4win_d=
+  _gpg4win_p=
+  for _gpg4win_p in $_gpg4win_deps; do
+    AS_IF([test -z $_gpg4win_d], [_gpg4win_d=$_gpg4win_p],
+          [
+            _gpg4win_found=
+            for _gpg4win_i in $_gpg4win_pkgs; do
+              AS_IF([test $_gpg4win_d = $_gpg4win_i],
+                    _gpg4win_found=yes
+                    break)
+            done
+            AS_IF([test -z $_gpg4win_found],
+                  AC_MSG_WARN(could not find package $_gpg4win_d required by package $_gpg4win_p)
+                  _gpg4win_not_found=yes)
+            _gpg4win_d=
+          ])
+  done
+  AS_IF([test ! -z "$_gpg4win_not_found"],
+        AC_MSG_ERROR([could not find some required packages]))
+])
+
+
+AC_DEFUN([GPG4WIN_FINALIZE],
+[
+  AC_REQUIRE([GPG4WIN_CHECK_DEPS])
+])
+
+
+# GPG4WIN_SPKG([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND])
+# Set up the source package PKG.
+# It is provided in gpg4win_val.
+AC_DEFUN([GPG4WIN_SPKG],
+[
+  AC_REQUIRE([GPG4WIN_INIT])
+  _gpg4win_pkg=maybe
+  AC_ARG_ENABLE([pkg-$1],
+    AS_HELP_STRING([--enable-pkg-$1[=DIR]],
+                   [include package $1]),
+    _gpg4win_pkg=$enableval)
+  _gpg4win_spkg=no
+  _gpg4win_version=
+  AS_IF([test x$_gpg4win_pkg != xno],
+        [GPG4WIN_FIND($1,,, $_gpg4win_pkg,
+        _gpg4win_spkg=$gpg4win_val
+        _gpg4win_version=$gpg4win_version)])
+
+  # At this point, _gpg4win_spkg is no, or the actual package source file.
+
+  # gpg4win_pkg_PKGNAME=FILENAME_OF_SOURCE
+  gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]=$_gpg4win_spkg
+  AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_))
+
+  # gpg4win_pkg_PKGNAME_version=VERSION
+  gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_version=$_gpg4win_version
+  AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_version)
+
+  AS_IF([test $_gpg4win_spkg != no],
+    _gpg4win_pkgs="$_gpg4win_pkgs $1"
+    # Record dependencies.  Also enter every package as node.
+    _gpg4win_deps="$_gpg4win_deps $1 $1"
+    AS_IF([test ! -z "$2"],
+          for _gpg4win_i in $2; do
+            _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1"
+          done)
+      [$3],
+      [$4])
+])
+
+
+# GPG4WIN_BPKG_GNUWIN32([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND])
+# Set up the source package PKG.
+# It is provided in gpg4win_val.
+AC_DEFUN([GPG4WIN_BPKG_GNUWIN32],
+[
+  AC_REQUIRE([GPG4WIN_INIT])
+  _gpg4win_pkg=maybe
+  AC_ARG_ENABLE([pkg-$1],
+    AS_HELP_STRING([--enable-pkg-$1[=DIR]],
+                   [include package $1]),
+    _gpg4win_pkg=$enableval)
+  _gpg4win_bpkg=no
+  _gpg4win_version=
+  AS_IF([test x$_gpg4win_pkg != xno],
+        [GPG4WIN_FIND($1-bin, [$1-\(.*\)-bin],,
+         $_gpg4win_pkg,
+         _gpg4win_bpkg=$gpg4win_val
+        _gpg4win_version=$gpg4win_version)])
+
+  # At this point, _gpg4win_bpkg is no, or the actual package source file.
+
+  # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY
+  gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]]-,_)[]=$_gpg4win_bpkg
+  AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_))
+
+  # gpg4win_pkg_PKGNAME_version=VERSION
+  gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_version=$_gpg4win_version
+  AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_version)
+
+  AS_IF([test $_gpg4win_bpkg != no],
+    GPG4WIN_FIND($1-lib, [$1-\(.*\)-lib],,
+                 $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val,
+       AC_MSG_ERROR(can not find development package for package $1))
+    # gpg4win_pkg_PKGNAME_dev=FILENAME_OF_BINARY_DEVEL
+    gpg4win_pkg_[]m4_bpatsubst([$1],-,_)[]_dev=$_gpg4win_bpkg
+    AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],-,_)[]_dev)
+
+    GPG4WIN_FIND($1-src, [$1-\(.*\)-src],,
+                 $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val,
+       AC_MSG_ERROR(can not find sources for package $1))
+    # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE
+    gpg4win_pkg_[]m4_bpatsubst([$1],-,_)[]_src=$_gpg4win_bpkg
+    AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],-,_)[]_src)
+
+    # FIXME: Add a version consistency check here.  All three packages
+    # must match!
+
+    _gpg4win_pkgs="$_gpg4win_pkgs $1"
+    # Record dependencies.  Also enter every package as node.
+    _gpg4win_deps="$_gpg4win_deps $1 $1"
+    AS_IF([test ! -z "$2"],
+          for _gpg4win_i in $2; do
+           _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1"
+          done)
+          [$3],
+          [$4])
+])
+
+
+# GPG4WIN_BPKG_GTK([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND])
+# Set up the source package PKG.
+# It is provided in gpg4win_val.
+AC_DEFUN([GPG4WIN_BPKG_GTK],
+[
+  AC_REQUIRE([GPG4WIN_INIT])
+  _gpg4win_pkg=maybe
+  AC_ARG_ENABLE([pkg-$1],
+    AS_HELP_STRING([--enable-pkg-$1[=DIR]],
+                   [include package $1]),
+    _gpg4win_pkg=$enableval)
+  _gpg4win_bpkg=no
+  _gpg4win_version=
+  AS_IF([test x$_gpg4win_pkg != xno],
+        [GPG4WIN_FIND($1,,zip, $_gpg4win_pkg,
+         _gpg4win_bpkg=$gpg4win_val
+        _gpg4win_version=$gpg4win_version)])
+
+  # At this point, _gpg4win_bpkg is no, or the actual package source file.
+
+  # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY
+  gpg4win_pkg_[]m4_bpatsubst([$1],-,_)[]=$_gpg4win_bpkg
+  AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],-,_))
+
+  # gpg4win_pkg_PKGNAME_version=VERSION
+  gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_version=$_gpg4win_version
+  AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_version)
+
+  AS_IF([test $_gpg4win_bpkg != no],
+    [GPG4WIN_FIND($1,,tar, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val,
+       AC_MSG_ERROR(can not find sources for package $1))]
+    # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE
+    gpg4win_pkg_[]m4_bpatsubst([$1],-,_)[]_src=$_gpg4win_bpkg
+    AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],-,_)[]_src)
+
+    # FIXME: Add a version consistency check here.  All three packages
+    # must match!
+
+    _gpg4win_pkgs="$_gpg4win_pkgs $1"
+    # Record dependencies.  Also enter every package as node.
+    _gpg4win_deps="$_gpg4win_deps $1 $1"
+    AS_IF([test ! -z "$2"],
+          for _gpg4win_i in $2; do
+           _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1"
+          done)
+          [$3],
+          [$4])
+])
+
+
+# GPG4WIN_BPKG_GTK_DEV([PKG],[DEPENDS],[IF-FOUND],[IF-NOT-FOUND])
+# Set up the source package PKG.
+# It is provided in gpg4win_val.
+AC_DEFUN([GPG4WIN_BPKG_GTK_DEV],
+[
+  AC_REQUIRE([GPG4WIN_INIT])
+  _gpg4win_pkg=maybe
+  AC_ARG_ENABLE([pkg-$1],
+    AS_HELP_STRING([--enable-pkg-$1[=DIR]],
+                   [include package $1]),
+    _gpg4win_pkg=$enableval)
+  _gpg4win_bpkg=no
+  _gpg4win_version=
+  AS_IF([test x$_gpg4win_pkg != xno],
+        [GPG4WIN_FIND($1,,zip, $_gpg4win_pkg,
+         _gpg4win_bpkg=$gpg4win_val
+        _gpg4win_version=$gpg4win_version)])
+
+  # At this point, _gpg4win_bpkg is no, or the actual package source file.
+
+  # gpg4win_pkg_PKGNAME=FILENAME_OF_BINARY
+  gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]=$_gpg4win_bpkg
+  AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_))
+
+  # gpg4win_pkg_PKGNAME_version=VERSION
+  gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_version=$_gpg4win_version
+  AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_version)
+
+  AS_IF([test $_gpg4win_bpkg != no],
+    [GPG4WIN_FIND($1-dev,,, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val,
+       AC_MSG_ERROR(can not find development package for package $1))]
+    # gpg4win_pkg_PKGNAME_dev=FILENAME_OF_BINARY_DEVEL
+    gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_dev=$_gpg4win_bpkg
+    AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_dev)
+
+    [GPG4WIN_FIND($1,,tar, $_gpg4win_pkg, _gpg4win_bpkg=$gpg4win_val,
+       AC_MSG_ERROR(can not find sources for package $1))]
+    # gpg4win_pkg_PKGNAME_src=FILENAME_OF_SOURCE
+    gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_src=$_gpg4win_bpkg
+    AC_SUBST(gpg4win_pkg_[]m4_bpatsubst([$1],[[-+]],_)[]_src)
+
+    # FIXME: Add a version consistency check here.  All three packages
+    # must match!
+
+    _gpg4win_pkgs="$_gpg4win_pkgs $1"
+    # Record dependencies.  Also enter every package as node.
+    _gpg4win_deps="$_gpg4win_deps $1 $1"
+    AS_IF([test ! -z "$2"],
+          for _gpg4win_i in $2; do
+           _gpg4win_deps="$_gpg4win_deps $_gpg4win_i $1"
+          done)
+          [$3],
+          [$4])
+])
index 8a977e8..875d55e 100755 (executable)
@@ -135,12 +135,12 @@ install_binary gettext-runtime-0.13.1.bin.woe32 gettext-0.13.1 LIBINTL
 
 # Install zlib runtime and development.
 
-install_binary zlib-1.2.3-bin zlib-1.2.3-src
-install_binary zlib-1.2.3-lib zlib-1.2.3-src ZLIB
+install_binary zlib-${gpg4win_pkg_zlib_version}-bin zlib-${gpg4win_pkg_zlib_version}-src
+install_binary zlib-${gpg4win_pkg_zlib_version}-lib zlib-${gpg4win_pkg_zlib_version}-src ZLIB
 
 # Now generate the required file for libtool (FIXME: Is this really
 # required?).
-(cd ${ipdir}; ${no_run} ${STOW} -D zlib-1.2.3-lib)
+(cd ${ipdir}; ${no_run} ${STOW} -D zlib-${gpg4win_pkg_zlib_version}-lib)
 (cd ${ZLIB_PREFIX}; ${no_run} cat > lib/libz.la <<EOF)
 dlname='../bin/zlib1.dll'
 library_names='libz.dll.a'
@@ -155,37 +155,37 @@ dlopen=''
 dlpreopen=''
 libdir="${ZLIB_PREFIX}/lib"
 EOF
-(cd ${ipdir}; ${no_run} ${STOW} zlib-1.2.3-lib)
+(cd ${ipdir}; ${no_run} ${STOW} zlib-${gpg4win_pkg_zlib_version}-lib)
 
 
 # Install Glib runtime and development.
 
 # extra-source: dirent.zip
-install_binary glib-2.6.6 glib-2.6.6
-install_binary glib-dev-2.6.6 glib-2.6.6 GLIB
+install_binary glib-${gpg4win_pkg_glib_version} glib-${gpg4win_pkg_glib_version}
+install_binary glib-dev-${gpg4win_pkg_glib_version} glib-${gpg4win_pkg_glib_version} GLIB
 
 
 # Install Gtk+ runtime and development.  Requires glib.
 
-install_binary atk-1.9.0 atk-1.9.0
-install_binary atk-dev-1.9.0 atk-1.9.0 ATK
+install_binary atk-${gpg4win_pkg_atk_version} atk-${gpg4win_pkg_atk_version}
+install_binary atk-dev-${gpg4win_pkg_atk_version} atk-${gpg4win_pkg_atk_version} ATK
 
-install_binary pango-1.8.2 pango-1.8.2
-install_binary pango-dev-1.8.2 pango-1.8.2 PANGO
+install_binary pango-${gpg4win_pkg_pango_version} pango-${gpg4win_pkg_pango_version}
+install_binary pango-dev-${gpg4win_pkg_pango_version} pango-${gpg4win_pkg_pango_version} PANGO
 
-install_binary gtk+-2.6.9 gtk+-2.6.9
-install_binary gtk+-dev-2.6.9 gtk+-2.6.9 GTK2
+install_binary gtk+-${gpg4win_pkg_gtk__version} gtk+-${gpg4win_pkg_gtk__version}
+install_binary gtk+-dev-${gpg4win_pkg_gtk__version} gtk+-${gpg4win_pkg_gtk__version} GTK2
 
 
 # Install libpng runtime and development.
 
-install_binary libpng-1.2.8-bin libpng-1.2.8-src
-install_binary libpng-1.2.8-lib libpng-1.2.8-src LIBPNG
+install_binary libpng-${gpg4win_pkg_libpng_version}-bin libpng-${gpg4win_pkg_libpng_version}-src
+install_binary libpng-${gpg4win_pkg_libpng_version}-lib libpng-${gpg4win_pkg_libpng_version}-src LIBPNG
 
 
 # Install pkg-config.  Requires Gtk+.  (FIXME: Is this needed?)
 
-install_binary pkgconfig-0.15 pkgconfig-0.15.0
+install_binary pkgconfig-${gpg4win_pkg_pkgconfig_version} pkgconfig-0.15.0
 
 
 # BINARY FIXUP
@@ -198,30 +198,30 @@ install_binary pkgconfig-0.15 pkgconfig-0.15.0
 
 # Install GnuPG.
 
-install_source gnupg-1.4.2
+install_source gnupg-${gpg4win_pkg_gnupg_version}
 
 
 # Install libgpg-error.
 
-install_source libgpg-error-1.2-cvs "" LIBGPG_ERROR
+install_source libgpg-error-${gpg4win_pkg_libgpg_error_version} "" LIBGPG_ERROR
 
 
 # Install GPGME.  Requires libgpg-error.
 
-install_source gpgme-1.1.0 \
+install_source gpgme-${gpg4win_pkg_gpgme_version} \
   "--with-gpg-error-prefix=${idir} --without-gpgsm" \
   GPGME
 
 
 # Install GPA.  Requires zlib, Gtk+, libpng, glib, GPGME.
 
-install_source gpa-0.7.1-cvs \
+install_source gpa-${gpg4win_pkg_gpa_version} \
     "--with-libiconv-prefix=${idir} --with-libintl-prefix=${idir} --with-gpgme-prefix=${idir} --with-zlib=${idir}" \
     GPA
 
 # Install GPGol.  Requires GPGME.
 
-install_source gpgol-0.9.3-cvs "--with-gpgme-prefix=${idir}" GPA
+install_source gpgol-${gpg4win_pkg_gpgol_version} "--with-gpgme-prefix=${idir}" GPA
 
 # Install GPGee.  FIXME  (From installable exe ?)