summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2006-10-09 11:35:35 +0000
committerWerner Koch <wk@gnupg.org>2006-10-09 11:35:35 +0000
commitfa35790126e1d8246cb91ec3b4b0995902703698 (patch)
treea734f44167eb6409c68e875556a10dac68ee5bbd /m4
parenta0c2238ff8f222e8b5e8fec9a58a8240883d1569 (diff)
downloadlibassuan-fa35790126e1d8246cb91ec3b4b0995902703698.tar.gz
Splitted up into a standad lib and an pth enabled one.
Also enhanced libassuan-config and libassuan.m4. Not really tested!
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am2
-rw-r--r--m4/gnupg-pth.m4114
2 files changed, 115 insertions, 1 deletions
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 4b141b2..0848e42 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -1 +1 @@
-EXTRA_DIST = socklen.m4 sys_socket_h.m4 onceonly.m4 autobuild.m4
+EXTRA_DIST = socklen.m4 sys_socket_h.m4 onceonly.m4 autobuild.m4 gnupg-pth.m4
diff --git a/m4/gnupg-pth.m4 b/m4/gnupg-pth.m4
new file mode 100644
index 0000000..00db177
--- /dev/null
+++ b/m4/gnupg-pth.m4
@@ -0,0 +1,114 @@
+dnl GnuPG's check for Pth.
+dnl Copyright (C) 2003 Free Software Foundation, Inc.
+dnl
+dnl This file is free software; as a special exception the author gives
+dnl unlimited permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+dnl This file is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+
+# GNUPG_PTH_VERSION_CHECK(REQUIRED)
+#
+# If the version is sufficient, HAVE_PTH will be set to yes.
+#
+# Taken and modified from the m4 macros which come with Pth.
+AC_DEFUN([GNUPG_PTH_VERSION_CHECK],
+ [
+ _pth_version=`$PTH_CONFIG --version | awk 'NR==1 {print [$]3}'`
+ _req_version="ifelse([$1],,1.2.0,$1)"
+
+ AC_MSG_CHECKING(for PTH - version >= $_req_version)
+ for _var in _pth_version _req_version; do
+ eval "_val=\"\$${_var}\""
+ _major=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\1/'`
+ _minor=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\2/'`
+ _rtype=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\3/'`
+ _micro=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\4/'`
+ case $_rtype in
+ "a" ) _rtype=0 ;;
+ "b" ) _rtype=1 ;;
+ "." ) _rtype=2 ;;
+ esac
+ _hex=`echo dummy | awk '{ printf("%d%02d%1d%02d", major, minor, rtype, micro); }' \
+ "major=$_major" "minor=$_minor" "rtype=$_rtype" "micro=$_micro"`
+ eval "${_var}_hex=\"\$_hex\""
+ done
+ have_pth=no
+ if test ".$_pth_version_hex" != .; then
+ if test ".$_req_version_hex" != .; then
+ if test $_pth_version_hex -ge $_req_version_hex; then
+ have_pth=yes
+ fi
+ fi
+ fi
+ if test $have_pth = yes; then
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING([whether PTH installation is sane])
+ AC_CACHE_VAL(gnupg_cv_pth_is_sane,[
+ _gnupg_pth_save_cflags=$CFLAGS
+ _gnupg_pth_save_ldflags=$LDFLAGS
+ _gnupg_pth_save_libs=$LIBS
+ CFLAGS="$CFLAGS `$PTH_CONFIG --cflags`"
+ LDFLAGS="$LDFLAGS `$PTH_CONFIG --ldflags`"
+ LIBS="$LIBS `$PTH_CONFIG --libs`"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pth.h>
+ ],
+ [[ pth_init ();]])],
+ gnupg_cv_pth_is_sane=yes,
+ gnupg_cv_pth_is_sane=no)
+ CFLAGS=$_gnupg_pth_save_cflags
+ LDFLAGS=$_gnupg_pth_save_ldflags
+ LIBS=$_gnupg_pth_save_libs
+ ])
+ if test $gnupg_cv_pth_is_sane != yes; then
+ have_pth=no
+ fi
+ AC_MSG_RESULT($gnupg_cv_pth_is_sane)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ ])
+
+
+#
+# GNUPG_PATH_PTH([MINIMUM_VERSION])
+#
+# This is a special version of the check whioch assumes that a
+# emulation for W32 systems is available. The test assumes that
+# $have_w32_system has already been set. On return $have_pth is set
+# as well as HAVE_PTH is defined and PTH_CLFAGS and PTH_LIBS are AS_SUBST.
+#
+AC_DEFUN([GNUPG_PATH_PTH],
+[ AC_ARG_WITH(pth-prefix,
+ AC_HELP_STRING([--with-pth-prefix=PFX],
+ [prefix where GNU Pth is installed (optional)]),
+ pth_config_prefix="$withval", pth_config_prefix="")
+ if test x$pth_config_prefix != x ; then
+ PTH_CONFIG="$pth_config_prefix/bin/pth-config"
+ fi
+ AC_PATH_PROG(PTH_CONFIG, pth-config, no)
+ tmp=ifelse([$1], ,1.3.7,$1)
+ if test "$have_w32_system" = no; then
+ if test "$PTH_CONFIG" != "no"; then
+ GNUPG_PTH_VERSION_CHECK($tmp)
+ if test $have_pth = yes; then
+ PTH_CFLAGS=`$PTH_CONFIG --cflags`
+ PTH_LIBS=`$PTH_CONFIG --ldflags`
+ PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`"
+ AC_DEFINE(HAVE_PTH, 1,
+ [Defined if the GNU Pth is available])
+ fi
+ fi
+ else
+ have_pth=yes
+ PTH_CFLAGS=""
+ PTH_LIBS=""
+ AC_DEFINE(HAVE_PTH, 1)
+ fi
+ AC_SUBST(PTH_CFLAGS)
+ AC_SUBST(PTH_LIBS)
+])
+