Renamed
[gnupg.git] / acinclude.m4
index 5f742b2..b8af932 100644 (file)
@@ -214,6 +214,8 @@ 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/'`
@@ -237,16 +239,37 @@ AC_DEFUN([GNUPG_PTH_VERSION_CHECK],
             fi
         fi
     fi
-    if test $have_pth = no; then
-       AC_MSG_WARN([[
-***
-*** Found Pth version $_pth_version, but require at least
-*** version $_req_version.  Please upgrade Pth first.
-***]])
+    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    
   ])
 
 
+
+
 # Check whether mlock is broken (hpux 10.20 raises a SIGBUS if mlock
 # is not called from uid 0 (not tested whether uid 0 works)
 # For DECs Tru64 we have also to check whether mlock is in librt
@@ -367,70 +390,3 @@ fi
 
 
 
-dnl AM_PATH_OPENSC([MINIMUM-VERSION,
-dnl               [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
-dnl Test for OpenSC and define OPENSC_CFLAGS and OPENSC_LIBS
-dnl
-AC_DEFUN([AM_PATH_OPENSC],
-[ AC_ARG_WITH(opensc-prefix,
-            AC_HELP_STRING([--with-opensc-prefix=PFX],
-                           [prefix where OpenSC is installed (optional)]),
-     opensc_config_prefix="$withval", opensc_config_prefix="")
-  if test x$opensc_config_prefix != x ; then
-     opensc_config_args="$opensc_config_args --prefix=$opensc_config_prefix"
-     if test x${OPENSC_CONFIG+set} != xset ; then
-        OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
-     fi
-  fi
-
-  AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
-  min_opensc_version=ifelse([$1], ,0.7.0,$1)
-  AC_MSG_CHECKING(for OpenSC - version >= $min_opensc_version)
-  ok=no
-  if test "$OPENSC_CONFIG" != "no" ; then
-    req_major=`echo $min_opensc_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
-    req_minor=`echo $min_opensc_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
-    req_micro=`echo $min_opensc_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
-    opensc_config_version=`$OPENSC_CONFIG $opensc_config_args --version 2>/dev/null || echo 0.0.0`
-    major=`echo $opensc_config_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
-    minor=`echo $opensc_config_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
-    micro=`echo $opensc_config_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
-    if test "$major" -gt "$req_major"; then
-        ok=yes
-    else 
-        if test "$major" -eq "$req_major"; then
-            if test "$minor" -gt "$req_minor"; then
-               ok=yes
-            else
-               if test "$minor" -eq "$req_minor"; then
-                   if test "$micro" -ge "$req_micro"; then
-                     ok=yes
-                   fi
-               fi
-            fi
-        fi
-    fi
-  fi
-  if test $ok = yes; then
-    OPENSC_CFLAGS=`$OPENSC_CONFIG $opensc_config_args --cflags`
-    OPENSC_LIBS=`$OPENSC_CONFIG $opensc_config_args --libs`
-    OPENSC_LIBS="$OPENSC_LIBS -lpcsclite -lpthread"
-    AC_MSG_RESULT(yes)
-    ifelse([$2], , :, [$2])
-  else
-    OPENSC_CFLAGS=""
-    OPENSC_LIBS=""
-    AC_MSG_RESULT(no)
-    ifelse([$3], , :, [$3])
-  fi
-  AC_SUBST(OPENSC_CFLAGS)
-  AC_SUBST(OPENSC_LIBS)
-])
-
-