user-manual: List wolfSSL as potential dependency
[privoxy.git] / configure.in
index 9189b8a..1f7256d 100644 (file)
@@ -615,9 +615,9 @@ AC_CHECK_FUNC(gmtime_r, [
   AC_TRY_COMPILE([
 #   include <time.h>
   ], [
-    struct time *t;
-    struct tm *tm;
-    (void) gmtime_r(t, tm)
+    time_t t;
+    struct tm tm;
+    (void) gmtime_r(&t, &tm)
   ], [
     AC_MSG_RESULT(ok)
     AC_DEFINE(HAVE_GMTIME_R)
@@ -633,9 +633,9 @@ AC_CHECK_FUNC(localtime_r, [
   AC_TRY_COMPILE([
 #   include <time.h>
   ], [
-    struct time *t;
-    struct tm *tm;
-    (void) localtime_r(t, tm)
+    time_t t;
+    struct tm tm;
+    (void) localtime_r(&t, &tm)
   ], [
     AC_MSG_RESULT(ok)
     AC_DEFINE(HAVE_LOCALTIME_R)
@@ -872,6 +872,7 @@ if test $enableval2 = yes; then
 else
   AC_MSG_WARN([Ignoring pcre2 even if it's available])
   try_pcre2=no
+  have_pcre2=no
 fi
 
 if test $try_pcre2 != no; then
@@ -1140,16 +1141,18 @@ if test $have_pcre2 = "yes"; then
   LIBS="$LIBS -lpcre2-8 -lpcre2-posix"
   if test "$use_static_pcre" = "yes"; then
     pcre_dyn=no
-    AC_DEFINE(PCRE_STATIC,1,[Define to statically link to pcre library on Windows.])
-#     see /usr/i686-w64-mingw32/sys-root/mingw/include/pcre.h line 54
-#       #if defined(_WIN32) && !defined(PCRE_STATIC)
-#       #  ifndef PCRE_EXP_DECL
-#       #    define PCRE_EXP_DECL  extern __declspec(dllimport)
+    AC_DEFINE(PCRE2_STATIC,1,[Define to statically link to the pcre2 library on Windows.])
+#     see pcre2-10.42/src/pcre2.h line 54
+#       #if defined(_WIN32) && !defined(PCRE2_STATIC)
+#       #  ifndef PCRE2_EXP_DECL
+#       #    define PCRE2_EXP_DECL  extern __declspec(dllimport)
 #       #  endif
-#     If you want to statically link a program against a PCRE library in the form of
-#     a non-dll .a file, you must define PCRE_STATIC before including pcre.h or
-#     pcrecpp.h, otherwise the pcre_malloc() and pcre_free() exported functions will
-#     be declared __declspec(dllimport), with unwanted results.
+#       #endif
+#     If you want to statically link a program against a PCRE2 library in the form of
+#     a non-dll .a file, you must define PCRE2_STATIC before including src/pcre2.h.
+#     Otherwise the exported functions will be declared __declspec(dllimport),
+#     with unwanted results.  eg: build failures with error messages like
+#       undefined reference to `_imp__pcre2_compile_8'
   else
     pcre_dyn=yes
     AC_DEFINE(FEATURE_DYNAMIC_PCRE,1,[Define to dynamically link to pcre.])
@@ -1292,6 +1295,45 @@ if test X"$OPT_OPENSSL" != Xno; then
 fi
 AC_SUBST(FEATURE_HTTPS_INSPECTION_ONLY_OPENSSL)
 
+dnl ========================================================
+dnl check for wolfSSL which can be used for https inspection
+dnl ========================================================
+FEATURE_HTTPS_INSPECTION_ONLY_WOLFSSL=#
+OPT_WOLFSSL=no
+AC_ARG_WITH(wolfssl,dnl
+AC_HELP_STRING([--with-wolfssl], [Enable Wolfssl/LibreSSL detection for https inspection.])
+AC_HELP_STRING([--without-wolfssl], [Disable Wolfssl/LibreSSL detection]),
+  OPT_WOLFSSL=$withval)
+
+if test X"$OPT_WOLFSSL" != Xno; then
+    if test X"$OPT_MBEDTLS" != Xno; then
+        AC_MSG_ERROR([wolfSSL and mbedTLS support can't be enabled at the same time])
+    fi
+    if test X"$OPT_OPENSSL" != Xno; then
+        AC_MSG_ERROR([wolfSSL and OpenSSL support can't be enabled at the same time])
+    fi
+
+    AC_CHECK_LIB(wolfssl, wolfSSL_Init, [HAVE_WOLFSSL_INIT="yes"])
+
+    if test "x$HAVE_WOLFSSL_INIT" = "xyes"; then
+        AC_DEFINE(FEATURE_HTTPS_INSPECTION, 1, [if SSL/TLS is enabled])
+        AC_DEFINE(FEATURE_HTTPS_INSPECTION_WOLFSSL, 1, [if Wolfssl is enabled])
+        AC_SUBST(FEATURE_HTTPS_INSPECTION_WOLFSSL, [1])
+        FEATURE_HTTPS_INSPECTION="yes"
+        FEATURE_HTTPS_INSPECTION_WOLFSSL="yes"
+    fi
+
+    if test "x$FEATURE_HTTPS_INSPECTION_WOLFSSL" = "xyes"; then
+    AC_MSG_NOTICE([Detected wolfSSL. Enabling https inspection.])
+
+    LIBS="$LIBS -lwolfssl"
+
+    FEATURE_HTTPS_INSPECTION_ONLY=
+    FEATURE_HTTPS_INSPECTION_ONLY_WOLFSSL=
+  fi
+fi
+AC_SUBST(FEATURE_HTTPS_INSPECTION_ONLY_WOLFSSL)
+
 AC_SUBST(FEATURE_HTTPS_INSPECTION_ONLY)
 
 dnl ========================================================