From 628c7aa854a680753f0bbc9d3cb2b12e2d53136b Mon Sep 17 00:00:00 2001 From: Nathan Phillip Brink Date: Mon, 6 Jun 2011 23:51:03 -0400 Subject: [PATCH] Add support for gpgme installations which don't install gpgme.h into /usr/include using gpgme-config. --- configure.ac | 34 ++++++++++++++++++++++++---------- 1 files changed, 24 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 3baae5d..08aa396 100644 --- a/configure.ac +++ b/configure.ac @@ -96,7 +96,7 @@ AC_ARG_WITH(openssl, # Help line for using gpgme AC_ARG_WITH(gpgme, - AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]), + AS_HELP_STRING([--with-gpgme=path], [use GPGME for PGP signature verification]), [], [with_gpgme=check]) # Check for useable libcurl @@ -158,16 +158,30 @@ AS_IF([test "x$with_openssl" != "xno"], AM_CONDITIONAL([HAVE_LIBSSL], [test "x$with_openssl" = "xyes"]) # Check for gpgme -AC_MSG_CHECKING(whether to link with libgpgme) +CPPFLAGS_save="$CPPFLAGS" +LIBS_save="$LIBS" AS_IF([test "x$with_gpgme" != "xno"], - [AC_MSG_RESULT(yes) - AC_CHECK_LIB([gpgme], [gpgme_check_version], , - [if test "x$with_gpgme" != "xcheck"; then - AC_MSG_FAILURE([--with-ggpme was given, but -lgpgme was not found]) - fi], - [-lgpgme]) - with_gpgme=$ac_cv_lib_gpgme_gpgme_check_version], - AC_MSG_RESULT(no)) + [AS_IF([test "x$with_gpgme" != "xyes" -a "x$with_gpgme" != "xcheck"], + [gpgme_path="$with_gpgme/bin"], [gpgme_path=""]) + AC_CHECK_PROG([GPGME_CONFIG], [gpgme-config], [gpgme-config], [$PATH$PATH_SEPARATOR$gpgme_path]) + CPPFLAGS="$CPPFLAGS `$GPGME_CONFIG --cflags`" + LIBS="$LIBS `$GPGME_CONFIG --libs`" + + AC_CHECK_HEADER([gpgme.h], + [AC_CHECK_LIB([gpgme], [gpgme_check_version], [], + [if test "x$with_gpgme" != "xcheck"; then + AC_MSG_FAILURE([--with-ggpme was given, but -lgpgme was not found]) + fi]) + with_gpgme=$ac_cv_lib_gpgme_gpgme_check_version], + [AS_IF([test "x$with_gpgme" != "xcheck"], + [AC_MSG_FAILURE([--with-gpgme was given, but gpgme.h was not found])]) + with_gpgme=no]) + ]) +AS_IF([test "x$with_gpgme" = "xno"], + [CPPFLAGS="$CPPFLAGS_save" + LIBS="$LIBS_save"]) +AC_MSG_CHECKING(whether to link with libgpgme) +AC_MSG_RESULT([$with_gpgme]) AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"]) # Checks for header files. -- 1.7.3.4