bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [PATCH] detect openssl/pcre/libuuid/zlib via pkg-config if it


From: Mike Frysinger
Subject: [Bug-wget] [PATCH] detect openssl/pcre/libuuid/zlib via pkg-config if it's available
Date: Mon, 27 Aug 2012 17:13:54 -0400

Newer versions of these packages ship with pkg-config files, so if we can
detect it via those, do so.  If that fails, fall back to the old methods.

Signed-off-by: Mike Frysinger <address@hidden>
---
 configure.ac |  110 +++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 71 insertions(+), 39 deletions(-)

diff --git a/configure.ac b/configure.ac
index 873c3c9..779ff39 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,9 @@ AC_ARG_WITH(ssl,
 AC_ARG_WITH(zlib,
 [[  --without-zlib          disable zlib ]])
 
+AC_ARG_ENABLE(pcre, AC_HELP_STRING([--disable-pcre],
+                                   [Disable PCRE style regular expressions]))
+
 AC_ARG_ENABLE(opie,
 [  --disable-opie          disable support for opie or s/key FTP login],
 ENABLE_OPIE=$enableval, ENABLE_OPIE=yes)
@@ -237,11 +240,25 @@ dnl
 dnl Checks for libraries.
 dnl
 
+PKG_PROG_PKG_CONFIG
+
 AS_IF([test x"$with_zlib" != xno], [
-  AC_CHECK_LIB(z, compress)
+  PKG_CHECK_MODULES([ZLIB], zlib, [
+    LIBS="$ZLIB_LIBS $LIBS"
+    CFLAGS="$ZLIB_CFLAGS $CFLAGS"
+  ], [
+    AC_CHECK_LIB(z, compress)
+  ])
 ])
 
 AS_IF([test x"$with_ssl" = xopenssl], [
+  PKG_CHECK_MODULES([OPENSSL], [openssl], [
+    AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
+    AC_LIBOBJ([openssl])
+    LIBS="$OPENSSL_LIBS $LIBS"
+    CFLAGS="$OPENSSL_CFLAGS -DHAVE_LIBSSL $CFLAGS"
+    LIBSSL=" " # ntlm check below wants this
+  ], [
     dnl some versions of openssl use zlib compression
     AC_CHECK_LIB(z, compress)
 
@@ -278,29 +295,29 @@ AS_IF([test x"$with_ssl" = xopenssl], [
       ;;
     esac
 
-AS_IF([test x$ssl_found != xyes],
-[
-  dnl Now actually check for -lssl if it wasn't already found
-    AC_LIB_HAVE_LINKFLAGS([ssl], [crypto z], [
-  #include <openssl/ssl.h>
-  #include <openssl/x509.h>
-  #include <openssl/err.h>
-  #include <openssl/rand.h>
-  #include <openssl/des.h>
-  #include <openssl/md4.h>
-  #include <openssl/md5.h>
-    ], [SSL_library_init ()])
-    if test x"$LIBSSL" != x
-    then
-      ssl_found=yes
-      AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
-      AC_LIBOBJ([openssl])
-      LIBS="$LIBSSL $LIBS"
-    elif test x"$with_ssl" != x
-    then
-      AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not available.])
-    fi
-])
+    AS_IF([test x$ssl_found != xyes], [
+      dnl Now actually check for -lssl if it wasn't already found
+        AC_LIB_HAVE_LINKFLAGS([ssl], [crypto z], [
+#include <openssl/ssl.h>
+#include <openssl/x509.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+#include <openssl/des.h>
+#include <openssl/md4.h>
+#include <openssl/md5.h>
+        ], [SSL_library_init ()])
+        if test x"$LIBSSL" != x
+        then
+          ssl_found=yes
+          AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
+          AC_LIBOBJ([openssl])
+          LIBS="$LIBSSL $LIBS"
+        elif test x"$with_ssl" != x
+        then
+          AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not 
available.])
+        fi
+    ])
+  ])
 
 ], [
   # --with-ssl is not gnutls: check if it's no
@@ -524,26 +541,41 @@ dnl
 dnl Check for UUID
 dnl
 
-AC_CHECK_HEADER(uuid/uuid.h,
-                AC_CHECK_LIB(uuid, uuid_generate,
-                  [LIBS="${LIBS} -luuid"
-                   AC_DEFINE([HAVE_LIBUUID], 1,
-                             [Define if libuuid is available.])
-                  ])
-)
+AC_ARG_WITH(libuuid, AC_HELP_STRING([--without-libuuid],
+                                    [Generate UUIDs for WARC files via 
libuuid]))
+AS_IF([test "X$with_libuuid" != "Xno"],[
+  PKG_CHECK_MODULES([UUID], uuid, [
+    LIBS="$UUID_LIBS $LIBS"
+    CFLAGS="$UUID_CFLAGS $CFLAGS"
+  ], [
+    AC_CHECK_HEADER(uuid/uuid.h,
+                    AC_CHECK_LIB(uuid, uuid_generate,
+                                 [LIBS="${LIBS} -luuid"
+                                  AC_DEFINE([HAVE_LIBUUID], 1,
+                                            [Define if libuuid is available.])
+                                 ])
+    )
+  ])
+])
 
 dnl
 dnl Check for PCRE
 dnl
 
-AC_CHECK_HEADER(pcre.h,
-                AC_CHECK_LIB(pcre, pcre_compile,
-                  [LIBS="${LIBS} -lpcre"
-                   AC_DEFINE([HAVE_LIBPCRE], 1,
-                             [Define if libpcre is available.])
-                  ])
-)
-
+AS_IF([test "X$enable_pcre" != "Xno"],[
+  PKG_CHECK_MODULES([PCRE], libpcre, [
+    LIBS="$PCRE_LIBS $LIBS"
+    CFLAGS="$PCRE_CFLAGS $CFLAGS"
+  ], [
+    AC_CHECK_HEADER(pcre.h,
+                    AC_CHECK_LIB(pcre, pcre_compile,
+                                 [LIBS="${LIBS} -lpcre"
+                                  AC_DEFINE([HAVE_LIBPCRE], 1,
+                                            [Define if libpcre is available.])
+                                 ])
+    )
+  ])
+])
  
 dnl Needed by src/Makefile.am
 AM_CONDITIONAL([IRI_IS_ENABLED], [test "X$iri" != "Xno"])
-- 
1.7.9.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]