Allow conditional compilation with GPGME
This makes it possible to omit usage of -lgpgme, just as we can do for -lcurl and -lcrypto. Thanks to Rémy Oudompheng for an initial stab at this. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
b7b3fc2386
commit
97be2f0e0a
16
configure.ac
16
configure.ac
|
@ -93,6 +93,11 @@ AC_ARG_WITH(openssl,
|
||||||
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
|
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
|
||||||
[], [with_openssl=check])
|
[], [with_openssl=check])
|
||||||
|
|
||||||
|
# Help line for using gpgme
|
||||||
|
AC_ARG_WITH(gpgme,
|
||||||
|
AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]),
|
||||||
|
[], [with_gpgme=check])
|
||||||
|
|
||||||
# Check for useable libcurl
|
# Check for useable libcurl
|
||||||
LIBCURL_CHECK_CONFIG([yes], [7.19.4])
|
LIBCURL_CHECK_CONFIG([yes], [7.19.4])
|
||||||
|
|
||||||
|
@ -151,8 +156,17 @@ AS_IF([test "x$with_openssl" != "xno"],
|
||||||
AM_CONDITIONAL([HAVE_LIBSSL], [test "x$ac_cv_lib_ssl_MD5_Final" = "xyes"])
|
AM_CONDITIONAL([HAVE_LIBSSL], [test "x$ac_cv_lib_ssl_MD5_Final" = "xyes"])
|
||||||
|
|
||||||
# Check for gpgme
|
# 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], ,
|
AC_CHECK_LIB([gpgme], [gpgme_check_version], ,
|
||||||
AC_MSG_ERROR([gpgme is needed to compile pacman!]))
|
[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))
|
||||||
|
AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([fcntl.h glob.h libintl.h locale.h mntent.h string.h \
|
AC_CHECK_HEADERS([fcntl.h glob.h libintl.h locale.h mntent.h string.h \
|
||||||
|
|
|
@ -25,7 +25,6 @@ libalpm_la_SOURCES = \
|
||||||
alpm.h alpm.c \
|
alpm.h alpm.c \
|
||||||
alpm_list.h alpm_list.c \
|
alpm_list.h alpm_list.c \
|
||||||
backup.h backup.c \
|
backup.h backup.c \
|
||||||
base64.h base64.c \
|
|
||||||
be_local.c \
|
be_local.c \
|
||||||
be_package.c \
|
be_package.c \
|
||||||
be_sync.c \
|
be_sync.c \
|
||||||
|
@ -54,6 +53,11 @@ libalpm_la_SOURCES += \
|
||||||
md5.h md5.c
|
md5.h md5.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if HAVE_LIBGPGME
|
||||||
|
libalpm_la_SOURCES += \
|
||||||
|
base64.h base64.c
|
||||||
|
endif
|
||||||
|
|
||||||
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@
|
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@
|
||||||
libalpm_la_LIBADD = $(LTLIBINTL)
|
libalpm_la_LIBADD = $(LTLIBINTL)
|
||||||
|
|
||||||
|
|
|
@ -22,17 +22,21 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if HAVE_LIBGPGME
|
||||||
#include <locale.h> /* setlocale() */
|
#include <locale.h> /* setlocale() */
|
||||||
#include <gpgme.h>
|
#include <gpgme.h>
|
||||||
|
#include "base64.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* libalpm */
|
/* libalpm */
|
||||||
#include "signing.h"
|
#include "signing.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "base64.h"
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
|
#if HAVE_LIBGPGME
|
||||||
#define CHECK_ERR(void) do { \
|
#define CHECK_ERR(void) do { \
|
||||||
if(err != GPG_ERR_NO_ERROR) { goto error; } \
|
if(err != GPG_ERR_NO_ERROR) { goto error; } \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
@ -364,6 +368,12 @@ error:
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int _alpm_gpgme_checksig(const char *path, const char *base64_sig)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the necessity of checking for a valid PGP signature
|
* Determines the necessity of checking for a valid PGP signature
|
||||||
|
|
Loading…
Reference in New Issue