From 115c0381c235100d7b05d9751767017a9ee325c4 Mon Sep 17 00:00:00 2001 From: Nathan Phillip Brink Date: Tue, 18 Oct 2011 03:42:17 +0000 Subject: Use AM_PATH_GPGME macro from gpgme instead of home-built gpgme detection. Fixes compilation on Gentoo, where CPPFLAGS=-I/usr/include/gpgme is necessary. The AC_SYS_LARGEFILE macro call has to be before the GPGME checks, otherwise the GPGME header gives an error about ABI incompatibilities. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- configure.ac | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 385a355a..5b54ee9c 100644 --- a/configure.ac +++ b/configure.ac @@ -129,6 +129,10 @@ AC_ARG_ENABLE(git-version, [enable use of git version in version string if available]), [wantgitver=$enableval], [wantgitver=no]) +# Enable large file support if available (must be enabled before +# testing compilation against gpgme). +AC_SYS_LARGEFILE + # Checks for programs. AC_PROG_AWK AC_PROG_CC_C99 @@ -168,14 +172,42 @@ AM_CONDITIONAL([HAVE_LIBSSL], [test "x$with_openssl" = "xyes"]) # Check for gpgme AC_MSG_CHECKING(whether to link with libgpgme) 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)) + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + +require_gpgme=no +AS_IF([test "x$with_gpgme" != "xno"], + [AS_IF([test "x$with_gpgme" = "xyes"], + [require_gpgme=yes]) + AM_PATH_GPGME([], + [LIBS_save="$LIBS" + CPPFLAGS_save="$CPPFLAGS" + CFLAGS_save="$CFLAGS" + + LIBS="$LIBS $GPGME_LIBS" + CPPFLAGS="$CPPFLAGS $GPGME_CPPFLAGS" + CFLAGS="$CFLAGS $GPGME_CFLAGS" + + AC_MSG_CHECKING([for sane gpgme]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[const char *ver; +ver = gpgme_check_version("1.2.4");]])], + [AC_MSG_RESULT([yes]) + with_gpgme=yes + AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])], + [AC_MSG_RESULT([no]) + with_gpgme=no + LIBS="$LIBS_save" + CPPFLAGS="$CPPFLAGS_save" + CFLAGS="$CFLAGS_save"])], + [with_gpgme=no])]) +AS_IF([test "x$with_gpgme" != "xyes"], + [AS_IF([test "x$require_gpgme" = "xyes"], + [AC_MSG_FAILURE([--with-gpgme was given, but gpgme was not found])]) + with_gpgme=no]) + AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"]) # Checks for header files. @@ -218,9 +250,6 @@ AC_CHECK_MEMBERS([struct statvfs.f_flag],,,[[#include ]]) AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include #include ]]) -# Enable large file support if available -AC_SYS_LARGEFILE - # Check if we can use symbol visibility support in GCC GCC_VISIBILITY_CC # Check if we have -fgnu89-inline flag -- cgit v1.2.3-70-g09d2