gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r32520 - in libmicrohttpd: . m4 src/microspdy


From: gnunet
Subject: [GNUnet-SVN] r32520 - in libmicrohttpd: . m4 src/microspdy
Date: Wed, 5 Mar 2014 14:20:49 +0100

Author: Karlson2k
Date: 2014-03-05 14:20:49 +0100 (Wed, 05 Mar 2014)
New Revision: 32520

Added:
   libmicrohttpd/m4/ax_check_openssl.m4
Removed:
   libmicrohttpd/m4/openssl.m4
Modified:
   libmicrohttpd/configure.ac
   libmicrohttpd/src/microspdy/Makefile.am
Log:
rewritten configure tests for OpenSSL, use OpenSSL flags only where required, 
updated libmicrospdy build flags

Modified: libmicrohttpd/configure.ac
===================================================================
--- libmicrohttpd/configure.ac  2014-03-05 13:20:39 UTC (rev 32519)
+++ libmicrohttpd/configure.ac  2014-03-05 13:20:49 UTC (rev 32520)
@@ -380,24 +380,49 @@
 
 # optional: libmicrospdy support. Enabled by default if not on W32
 AC_ARG_ENABLE([spdy],
-               AS_HELP_STRING([--disable-spdy],
-                       [disable libmicrospdy]),
+               AS_HELP_STRING([--enable-spdy],
+                       [enable build libmicrospdy (yes, no, auto) [auto]]),
                [enable_spdy=${enableval}],
-               [ AS_IF([[test "x$os_is_windows" = "xyes"]], [enable_spdy=no], 
[enable_spdy=yes]) ])
+               [ AS_IF([[test "x$os_is_windows" = "xyes"]], [enable_spdy=no]) 
])
 
-if test "$enable_spdy" = "yes"
+if test "$enable_spdy" != "no"
 then
- AC_CHECK_HEADERS([openssl/err.h],
-                   AC_CHECK_LIB(ssl, SSL_CTX_set_next_protos_advertised_cb,
-                    [AM_CONDITIONAL(HAVE_OPENSSL, true)
-                     enable_spdy="yes"],
-                    [AM_CONDITIONAL(HAVE_OPENSSL, false)
-                    enable_spdy="no"]),
-                   [AM_CONDITIONAL(HAVE_OPENSSL, false)
-                   enable_spdy="no"])
+  AX_CHECK_OPENSSL([ have_openssl=yes ],[ have_openssl=no ])
+  if test "x$have_openssl" = "xyes"
+  then
+    # check OpenSSL headers
+    SAVE_CPP_FLAGS="$CPPFLAGS"
+    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+    AC_CHECK_HEADERS([openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h 
openssl/sha.h openssl/pem.h openssl/engine.h], [ have_openssl=yes ],[ 
have_openssl=no ])
+    if test "x$have_openssl" = "xyes"
+    then
+      # check OpenSSL libs
+      SAVE_LIBS="$LIBS"
+      SAVE_LD_FLAGS="$LDFLAGS"
+      LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+      LIBS="$OPENSSL_LIBS $LIBS"
+      AC_CHECK_FUNC([SSL_CTX_set_next_protos_advertised_cb], 
+        [
+          AC_CHECK_FUNC([SSL_library_init], [ have_openssl=yes ],[ 
have_openssl=no ])
+        ],[ have_openssl=no ])
+      LIBS="$SAVE_LIBS"
+      LDFLAGS="$SAVE_LD_FLAGS"
+    fi
+    CPPFLAGS="$SAVE_CPP_FLAGS"
+  fi
+  if test "x$have_openssl" = "xyes"
+  then
+    enable_spdy=yes
+  else
+    AS_IF([[test "x$enable_spdy" = "xyes" ]], [AC_MSG_ERROR([[libmicrospdy 
cannot be enabled without OpenSSL.]])])
+    have_openssl=no
+    enable_spdy=no
+  fi
 else
- AM_CONDITIONAL(HAVE_OPENSSL, false)
+  # OpenSSL is used only for libmicrospdy
+  have_openssl=no
 fi
+AM_CONDITIONAL([HAVE_OPENSSL], [test "x$have_openssl" = "xyes"])
 
 if test "$enable_spdy" = "yes"
 then
@@ -409,25 +434,21 @@
 AC_MSG_CHECKING(whether we have OpenSSL and thus can support libmicrospdy)
 AC_MSG_RESULT($enable_spdy)
 
-SAVE_LIBS=$LIBS
-spdy_OPENSSL
 # for pkg-config
-SPDY_LIBDEPS=""
+SPDY_LIBDEPS="$OPENSSL_LIBS"
 
-
-AC_CHECK_HEADERS([spdylay/spdylay.h],
-                 [AM_CONDITIONAL(HAVE_SPDYLAY, true)
-                have_spdylay="yes"],
-                 [AM_CONDITIONAL(HAVE_SPDYLAY, false)
-                 have_spdylay="no"])
-
+SPDY_LIB_LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+SPDY_LIB_CFLAGS="$CFLAGS"
+SPDY_LIB_CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
 AC_SUBST(SPDY_LIB_LDFLAGS)
+AC_SUBST(SPDY_LIB_CFLAGS)
+AC_SUBST(SPDY_LIB_CPPFLAGS)
 # for pkg-config
 AC_SUBST(SPDY_LIBDEPS)
 
+AC_CHECK_HEADERS([spdylay/spdylay.h], [ have_spdylay="yes" ], 
[have_spdylay="no"])
+AM_CONDITIONAL(HAVE_SPDYLAY, [test "x$have_spdylay" = "xyes"])
 
-LIBS=$SAVE_LIBS
-
 # large file support (> 4 GB)
 AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO

Added: libmicrohttpd/m4/ax_check_openssl.m4
===================================================================
--- libmicrohttpd/m4/ax_check_openssl.m4                                (rev 0)
+++ libmicrohttpd/m4/ax_check_openssl.m4        2014-03-05 13:20:49 UTC (rev 
32520)
@@ -0,0 +1,124 @@
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
+#
+# DESCRIPTION
+#
+#   Look for OpenSSL in a number of default spots, or in a user-selected
+#   spot (via --with-openssl).  Sets
+#
+#     OPENSSL_INCLUDES to the include directives required
+#     OPENSSL_LIBS to the -l directives required
+#     OPENSSL_LDFLAGS to the -L or -R flags required
+#
+#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
+#
+#   This macro sets OPENSSL_INCLUDES such that source files should use the
+#   openssl/ directory in include directives:
+#
+#     #include <openssl/hmac.h>
+#
+# LICENSE
+#
+#   Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
+#   Copyright (c) 2009,2010 Dustin J. Mitchell <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 8
+
+AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
+AC_DEFUN([AX_CHECK_OPENSSL], [
+    found=false
+    AC_ARG_WITH([openssl],
+        [AS_HELP_STRING([--with-openssl=DIR],
+            [root of the OpenSSL directory])],
+        [
+            case "$withval" in
+            "" | y | ye | yes | n | no)
+            AC_MSG_ERROR([Invalid --with-openssl value])
+              ;;
+            *) ssldirs="$withval"
+              ;;
+            esac
+        ], [
+            # if pkg-config is installed and openssl has installed a .pc file,
+            # then use that information and don't search ssldirs
+            AC_PATH_PROG([PKG_CONFIG], [pkg-config])
+            if test x"$PKG_CONFIG" != x""; then
+                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
+                if test $? = 0; then
+                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 
2>/dev/null`
+                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 
2>/dev/null`
+                    found=true
+                fi
+            fi
+
+            # no such luck; use some default ssldirs
+            if ! $found; then
+                ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg 
/usr/local /usr"
+            fi
+        ]
+        )
+
+
+    # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be 
in
+    # an 'openssl' subdirectory
+
+    if ! $found; then
+        OPENSSL_INCLUDES=
+        for ssldir in $ssldirs; do
+            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
+            if test -f "$ssldir/include/openssl/ssl.h"; then
+                OPENSSL_INCLUDES="-I$ssldir/include"
+                OPENSSL_LDFLAGS="-L$ssldir/lib"
+                OPENSSL_LIBS="-lssl -lcrypto"
+                found=true
+                AC_MSG_RESULT([yes])
+                break
+            else
+                AC_MSG_RESULT([no])
+            fi
+        done
+
+        # if the file wasn't found, well, go ahead and try the link anyway -- 
maybe
+        # it will just work!
+    fi
+
+    # try the preprocessor and linker with our new flags,
+    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
+
+    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
+    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
+        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" 
>&AS_MESSAGE_LOG_FD
+
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    save_CPPFLAGS="$CPPFLAGS"
+    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+    LIBS="$OPENSSL_LIBS $LIBS"
+    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+    AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
+        [
+            AC_MSG_RESULT([yes])
+            $1
+        ], [
+            AC_MSG_RESULT([no])
+            $2
+        ])
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+
+    AC_SUBST([OPENSSL_INCLUDES])
+    AC_SUBST([OPENSSL_LIBS])
+    AC_SUBST([OPENSSL_LDFLAGS])
+])

Deleted: libmicrohttpd/m4/openssl.m4
===================================================================
--- libmicrohttpd/m4/openssl.m4 2014-03-05 13:20:39 UTC (rev 32519)
+++ libmicrohttpd/m4/openssl.m4 2014-03-05 13:20:49 UTC (rev 32520)
@@ -1,69 +0,0 @@
-dnl Check to find the OpenSSL headers/libraries
-
-AC_DEFUN([spdy_OPENSSL],
-[
-  AC_ARG_WITH(openssl,
-    AS_HELP_STRING([--with-openssl=DIR], [OpenSSL base directory, or:]),
-    [openssl="$withval"
-     CPPFLAGS="$CPPFLAGS -I$withval/include"
-     LDFLAGS="$LDFLAGS -L$withval/lib"]
-  )
-
-  AC_ARG_WITH(openssl-include,
-    AS_HELP_STRING([--with-openssl-include=DIR], [OpenSSL headers directory 
(without trailing /openssl)]),
-    [openssl_include="$withval"
-     CPPFLAGS="$CPPFLAGS -I$withval"]
-  )
-
-  AC_ARG_WITH(openssl-lib,
-    AS_HELP_STRING([--with-openssl-lib=DIR], [OpenSSL library directory]),
-    [openssl_lib="$withval"
-     LDFLAGS="$LDFLAGS -L$withval"]
-  )
-
-  AC_CHECK_HEADERS(openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h 
openssl/sha.h openssl/pem.h openssl/engine.h,
-    [],
-    [AC_MSG_WARN([OpenSSL header files not found.]); break]
-  )
-
-case $host_os in
-  *mingw*)
-    AC_CHECK_LIB(crypto, SHA1_Init,
-      [LIBS="$LIBS -lcrypto -lgdi32"],
-      [AC_MSG_WARN([OpenSSL libraries not found.])]
-    )
-  ;;
-  *)
-    
-    AC_CHECK_LIB(crypto, SHA1_Init,
-      [LIBS="$LIBS -lcrypto"],
-      [AC_MSG_WARN([OpenSSL libraries not found.])]
-    )
-
-    AC_CHECK_FUNC(dlopen,
-      [],
-      [AC_CHECK_LIB(dl, dlopen,
-        [LIBS="$LIBS -ldl"],
-        [AC_MSG_WARN([OpenSSL depends on libdl.]); break]
-      )]
-    )
-
-    AC_CHECK_FUNC(SSL_library_init,
-      [],
-      [AC_CHECK_LIB(ssl, SSL_library_init,
-        [LIBS="$LIBS -lssl"],
-        [AC_MSG_WARN([OpenSSL?.]); break]
-      )]
-    )
-  ;;
-esac
-
-#  AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex], ,
-#    [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have 
installed the latest version.]); break],
-#  )
-
-#  AC_CHECK_DECL([OpenSSL_add_all_algorithms], ,
-#    [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have 
installed the latest version.]); break],
-#    [#include <openssl/evp.h>]
-#  )
-])

Modified: libmicrohttpd/src/microspdy/Makefile.am
===================================================================
--- libmicrohttpd/src/microspdy/Makefile.am     2014-03-05 13:20:39 UTC (rev 
32519)
+++ libmicrohttpd/src/microspdy/Makefile.am     2014-03-05 13:20:49 UTC (rev 
32520)
@@ -21,17 +21,17 @@
   applicationlayer.c applicationlayer.h \
   alstructures.c alstructures.h 
 libmicrospdy_la_LIBADD = \
-  -lssl
+  $(SPDY_LIBDEPS)
 
 libmicrospdy_la_LDFLAGS = \
-  $(SPDY_LIB_LDFLAGS) 
+  $(SPDY_LIB_LDFLAGS)
 
 libmicrospdy_la_CPPFLAGS = \
-  $(AM_CPPFLAGS) \
+  $(AM_CPPFLAGS) $(SPDY_LIB_CPPFLAGS) \
   -DBUILDING_MHD_LIB=1
 
 libmicrospdy_la_CFLAGS = -Wextra \
-  $(SPDY_LIB_CFLAGS)
+  $(AM_CFLAGS) $(SPDY_LIB_CFLAGS)
 
 
 if USE_COVERAGE




reply via email to

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