Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Use pkg-config to find pth instead of pth-config. |
| 2 | |
| 3 | Upstream-Status: Denied |
| 4 | [not submitted but they've been clear they don't want a pkg-config dependency] |
| 5 | |
| 6 | RP 2014/5/22 |
| 7 | |
| 8 | Index: gnupg-2.1.0/m4/gnupg-pth.m4 |
| 9 | =================================================================== |
| 10 | --- gnupg-2.1.0.orig/m4/gnupg-pth.m4 |
| 11 | +++ gnupg-2.1.0/m4/gnupg-pth.m4 |
| 12 | @@ -17,33 +17,9 @@ dnl implied warranty of MERCHANTABILITY |
| 13 | # Taken and modified from the m4 macros which come with Pth. |
| 14 | AC_DEFUN([GNUPG_PTH_VERSION_CHECK], |
| 15 | [ |
| 16 | - _pth_version=`$PTH_CONFIG --version | awk 'NR==1 {print [$]3}'` |
| 17 | _req_version="ifelse([$1],,1.2.0,$1)" |
| 18 | + PKG_CHECK_MODULES(PTH, [pth >= $_req_version], [have_pth=yes], [have_pth=no]) |
| 19 | |
| 20 | - AC_MSG_CHECKING(for PTH - version >= $_req_version) |
| 21 | - for _var in _pth_version _req_version; do |
| 22 | - eval "_val=\"\$${_var}\"" |
| 23 | - _major=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\1/'` |
| 24 | - _minor=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\2/'` |
| 25 | - _rtype=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\3/'` |
| 26 | - _micro=`echo $_val | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\([[ab.]]\)\([[0-9]]*\)/\4/'` |
| 27 | - case $_rtype in |
| 28 | - "a" ) _rtype=0 ;; |
| 29 | - "b" ) _rtype=1 ;; |
| 30 | - "." ) _rtype=2 ;; |
| 31 | - esac |
| 32 | - _hex=`echo dummy | awk '{ printf("%d%02d%1d%02d", major, minor, rtype, micro); }' \ |
| 33 | - "major=$_major" "minor=$_minor" "rtype=$_rtype" "micro=$_micro"` |
| 34 | - eval "${_var}_hex=\"\$_hex\"" |
| 35 | - done |
| 36 | - have_pth=no |
| 37 | - if test ".$_pth_version_hex" != .; then |
| 38 | - if test ".$_req_version_hex" != .; then |
| 39 | - if test $_pth_version_hex -ge $_req_version_hex; then |
| 40 | - have_pth=yes |
| 41 | - fi |
| 42 | - fi |
| 43 | - fi |
| 44 | if test $have_pth = yes; then |
| 45 | AC_MSG_RESULT(yes) |
| 46 | AC_MSG_CHECKING([whether PTH installation is sane]) |
| 47 | @@ -51,9 +27,9 @@ AC_DEFUN([GNUPG_PTH_VERSION_CHECK], |
| 48 | _gnupg_pth_save_cflags=$CFLAGS |
| 49 | _gnupg_pth_save_ldflags=$LDFLAGS |
| 50 | _gnupg_pth_save_libs=$LIBS |
| 51 | - CFLAGS="$CFLAGS `$PTH_CONFIG --cflags`" |
| 52 | - LDFLAGS="$LDFLAGS `$PTH_CONFIG --ldflags`" |
| 53 | - LIBS="$LIBS `$PTH_CONFIG --libs --all`" |
| 54 | + CFLAGS="$CFLAGS $PTH_CFLAGS" |
| 55 | + LDFLAGS="$LDFLAGS $PTH_LDFLAGS" |
| 56 | + LIBS="$LIBS $PTH_LIBS" |
| 57 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pth.h> |
| 58 | ], |
| 59 | [[ pth_init ();]])], |
| 60 | @@ -80,26 +56,13 @@ AC_DEFUN([GNUPG_PTH_VERSION_CHECK], |
| 61 | # PTH_CLFAGS and PTH_LIBS are AS_SUBST. |
| 62 | # |
| 63 | AC_DEFUN([GNUPG_PATH_PTH], |
| 64 | -[ AC_ARG_WITH(pth-prefix, |
| 65 | - AC_HELP_STRING([--with-pth-prefix=PFX], |
| 66 | - [prefix where GNU Pth is installed (optional)]), |
| 67 | - pth_config_prefix="$withval", pth_config_prefix="") |
| 68 | - if test x$pth_config_prefix != x ; then |
| 69 | - PTH_CONFIG="$pth_config_prefix/bin/pth-config" |
| 70 | - fi |
| 71 | - AC_PATH_PROG(PTH_CONFIG, pth-config, no) |
| 72 | +[ |
| 73 | tmp=ifelse([$1], ,1.3.7,$1) |
| 74 | - if test "$PTH_CONFIG" != "no"; then |
| 75 | - GNUPG_PTH_VERSION_CHECK($tmp) |
| 76 | - if test $have_pth = yes; then |
| 77 | - PTH_CFLAGS=`$PTH_CONFIG --cflags` |
| 78 | - PTH_LIBS=`$PTH_CONFIG --ldflags` |
| 79 | - PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`" |
| 80 | - AC_DEFINE(HAVE_PTH, 1, |
| 81 | + GNUPG_PTH_VERSION_CHECK($tmp) |
| 82 | + if test $have_pth = yes; then |
| 83 | + AC_DEFINE(HAVE_PTH, 1, |
| 84 | [Defined if the GNU Pth is available]) |
| 85 | - fi |
| 86 | fi |
| 87 | AC_SUBST(PTH_CFLAGS) |
| 88 | AC_SUBST(PTH_LIBS) |
| 89 | ]) |
| 90 | - |