buildsys: cleanup gpgme compile time check

- handle gpgme libs and cflags separately rather than appending to
  CFLAGS and LDFLAGS
- be consistent in AC_LINK_IFELSE check for gpgme 1.3.0 (though this is
  irrelephant since we don't actually run)
- be consistent with usage of "have" and "with" variables (this
  actually ends up reducing SLOC)
- when voluntary detection fails, unset GPGME_CFLAGS and GPGME_LIBS
- when requested support fails the version check, complain about the min
  version.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
This commit is contained in:
Dave Reisner 2012-03-30 23:08:31 -04:00
parent b2226ed11b
commit cb5b66367d
2 changed files with 23 additions and 20 deletions

View File

@ -186,11 +186,9 @@ AS_IF([test "x$with_gpgme" != "xno"],
[AC_MSG_RESULT([yes])], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])]) [AC_MSG_RESULT([no])])
require_gpgme=no have_gpgme=no
AS_IF([test "x$with_gpgme" != "xno"], AS_IF([test "x$with_gpgme" != "xno"],
[AS_IF([test "x$with_gpgme" = "xyes"], [AM_PATH_GPGME([1.3.0],
[require_gpgme=yes])
AM_PATH_GPGME([1.3.0],
[LIBS_save="$LIBS" [LIBS_save="$LIBS"
CPPFLAGS_save="$CPPFLAGS" CPPFLAGS_save="$CPPFLAGS"
CFLAGS_save="$CFLAGS" CFLAGS_save="$CFLAGS"
@ -203,23 +201,26 @@ AS_IF([test "x$with_gpgme" != "xno"],
AC_LINK_IFELSE( AC_LINK_IFELSE(
[AC_LANG_PROGRAM( [AC_LANG_PROGRAM(
[[#include <gpgme.h>]], [[#include <gpgme.h>]],
[[const char *ver; [[return gpgme_check_version("1.3.0");]])],
ver = gpgme_check_version("1.2.4");]])],
[AC_MSG_RESULT([yes]) [AC_MSG_RESULT([yes])
with_gpgme=yes have_gpgme=yes
AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])], AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])],
[AC_MSG_RESULT([no]) [AC_MSG_RESULT([no])
with_gpgme=no have_gpgme=no
LIBS="$LIBS_save" unset GPGME_LIBS
CPPFLAGS="$CPPFLAGS_save" unset GPGME_CFLAGS]
CFLAGS="$CFLAGS_save"])], AS_IF([test "x$with_gpgme" = "xyes"],
[with_gpgme=no])]) [AC_MSG_FAILURE([*** gpgme >= 1.3.0 is needed for GPG signature support])])
AS_IF([test "x$with_gpgme" != "xyes"], )],
[AS_IF([test "x$require_gpgme" = "xyes"], [with_gpgme=no])]
[AC_MSG_FAILURE([--with-gpgme was given, but gpgme was not found])]) [LIBS="$LIBS_save"
with_gpgme=no]) CPPFLAGS="$CPPFLAGS_save"
CFLAGS="$CFLAGS_save"
AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"]) unset CPPFLAGS_save
unset CFLAGS_save])
AS_IF([test "x$have_gpgme" = xno -a "x$with_gpgme" = xyes],
[AC_MSG_FAILURE([--with-gpgme was given, but gpgme was not found])])
AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$have_gpgme" = "xyes"])
# Checks for header files. # Checks for header files.
AC_CHECK_HEADERS([fcntl.h float.h glob.h libintl.h limits.h locale.h \ AC_CHECK_HEADERS([fcntl.h float.h glob.h libintl.h limits.h locale.h \
@ -425,7 +426,7 @@ ${PACKAGE_NAME}:
preprocessor flags : ${CPPFLAGS} preprocessor flags : ${CPPFLAGS}
compiler flags : ${CFLAGS} compiler flags : ${CFLAGS}
defines : ${DEFS} defines : ${DEFS}
library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS}
linker flags : ${LDFLAGS} linker flags : ${LDFLAGS}
Architecture : ${CARCH} Architecture : ${CARCH}
@ -446,7 +447,7 @@ ${PACKAGE_NAME}:
Compilation options: Compilation options:
Use libcurl : ${have_libcurl} Use libcurl : ${have_libcurl}
Use GPGME : ${with_gpgme} Use GPGME : ${have_gpgme}
Use OpenSSL : ${have_openssl} Use OpenSSL : ${have_openssl}
Run make in doc/ dir : ${wantdoc} ${asciidoc} Run make in doc/ dir : ${wantdoc} ${asciidoc}
Doxygen support : ${usedoxygen} Doxygen support : ${usedoxygen}

View File

@ -67,12 +67,14 @@ libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
libalpm_la_CFLAGS = \ libalpm_la_CFLAGS = \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(GPGME_CFLAGS) \
$(LIBARCHIVE_CFLAGS) \ $(LIBARCHIVE_CFLAGS) \
$(LIBCURL_CFLAGS) \ $(LIBCURL_CFLAGS) \
$(LIBSSL_CFLAGS) $(LIBSSL_CFLAGS)
libalpm_la_LIBADD = \ libalpm_la_LIBADD = \
$(LTLIBINTL) \ $(LTLIBINTL) \
$(GPGME_LIBS) \
$(LIBARCHIVE_LIBS) \ $(LIBARCHIVE_LIBS) \
$(LIBCURL_LIBS) \ $(LIBCURL_LIBS) \
$(LIBSSL_LIBS) $(LIBSSL_LIBS)