From c5d951846d6b803909cbd7cfeac643f5feb42911 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 14:26:35 -0400 Subject: buildsys: use pkg-config for openssl detection Signed-off-by: Dave Reisner --- configure.ac | 24 +++++++++++------------- lib/libalpm/Makefile.am | 9 ++++++++- src/util/Makefile.am | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 18726cfb..2fa7634c 100644 --- a/configure.ac +++ b/configure.ac @@ -157,17 +157,15 @@ AC_CHECK_LIB([archive], [archive_read_data], , AC_MSG_ERROR([libarchive is needed to compile pacman!])) # Check for OpenSSL -AC_MSG_CHECKING(whether to link with libssl) -AS_IF([test "x$with_openssl" != "xno"], - [AC_MSG_RESULT(yes) - AC_CHECK_LIB([ssl], [MD5_Final], , - [if test "x$with_openssl" != "xcheck"; then - AC_MSG_FAILURE([--with-openssl was given, but -lssl was not found]) - fi], - [-lcrypto]) - with_openssl=$ac_cv_lib_ssl_MD5_Final], - AC_MSG_RESULT(no)) -AM_CONDITIONAL([HAVE_LIBSSL], [test "x$with_openssl" = "xyes"]) +have_openssl=no +if test "x$with_openssl" != "xno"; then + PKG_CHECK_MODULES(LIBSSL, [libssl libcrypto], + [AC_DEFINE(HAVE_LIBSSL, 1, [Define if libcrypto is available]) have_openssl=yes], have_openssl=no) + if test "x$have_openssl" = xno -a "x$with_openssl" = xyes; then + AC_MSG_ERROR([*** openssl support requested but libraries not found]) + fi +fi +AM_CONDITIONAL(HAVE_LIBSSL, [test "$have_openssl" = "yes"]) # Check for gpgme AC_MSG_CHECKING(whether to link with libgpgme) @@ -414,7 +412,7 @@ ${PACKAGE_NAME}: preprocessor flags : ${CPPFLAGS} compiler flags : ${CFLAGS} defines : ${DEFS} - library flags : ${LIBS} + library flags : ${LIBS} ${LIBSSL_LIBS} linker flags : ${LDFLAGS} Architecture : ${CARCH} @@ -436,7 +434,7 @@ ${PACKAGE_NAME}: Compilation options: Use libcurl : ${with_libcurl} Use GPGME : ${with_gpgme} - Use OpenSSL : ${with_openssl} + Use OpenSSL : ${have_openssl} Run make in doc/ dir : ${wantdoc} ${asciidoc} Doxygen support : ${usedoxygen} debug support : ${debug} diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 61dcb877..8d1be908 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -64,6 +64,13 @@ libalpm_la_SOURCES += \ endif libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@ -libalpm_la_LIBADD = $(LTLIBINTL) + +libalpm_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(LIBSSL_CFLAGS) + +libalpm_la_LIBADD = \ + $(LTLIBINTL) \ + $(LIBSSL_LIBS) # vim:set ts=2 sw=2 noet: diff --git a/src/util/Makefile.am b/src/util/Makefile.am index e386d950..1465407c 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -35,6 +35,6 @@ testpkg_SOURCES = testpkg.c testpkg_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.la vercmp_SOURCES = vercmp.c -vercmp_LDADD = $(top_builddir)/lib/libalpm/version.lo +vercmp_LDADD = $(top_builddir)/lib/libalpm/libalpm_la-version.lo # vim:set ts=2 sw=2 noet: -- cgit v1.2.3-24-g4f1b