[glib-openssl] Find CA bundle file in configure



commit 85309f3546c9d9ffbe3c3af0d3cec9d2bd512a7d
Author: Olivier Blin <olivier blin softathome com>
Date:   Tue Dec 6 17:41:13 2016 +0100

    Find CA bundle file in configure
    
    g_tls_backend_openssl_real_create_database() uses GTLS_SYSTEM_CA_FILE
    but it was never actually defined.
    
    Reuse configure.ac part from glib-networking.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775721

 configure.ac |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d99aeb1..80e879c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,32 @@ AM_CONDITIONAL(HAVE_OPENSSL, [test "$with_openssl" = "yes"])
 AC_SUBST(OPENSSL_CFLAGS)
 AC_SUBST(OPENSSL_LIBS)
 
+if test "x$with_openssl" = "xyes"; then
+    AC_MSG_CHECKING([location of system Certificate Authority list])
+    AC_ARG_WITH(ca-certificates,
+               [AC_HELP_STRING([--with-ca-certificates=@<:@path@:>@],
+                               [path to system Certificate Authority list])])
+    if test "$with_ca_certificates" = "no"; then
+        AC_MSG_RESULT([disabled])
+    else
+        if test -z "$with_ca_certificates"; then
+           for f in /etc/pki/tls/certs/ca-bundle.crt \
+                    /etc/ssl/certs/ca-certificates.crt \
+                    /etc/ssl/ca-bundle.pem; do
+               if test -f "$f"; then
+                   with_ca_certificates="$f"
+               fi
+           done
+           if test -z "$with_ca_certificates"; then
+               AC_MSG_ERROR([could not find. Use --with-ca-certificates=path to set, or 
--without-ca-certificates to disable])
+           fi
+        fi
+
+        AC_MSG_RESULT($with_ca_certificates)
+        AC_DEFINE_UNQUOTED(GTLS_SYSTEM_CA_FILE, ["$with_ca_certificates"], [The system TLS CA list])
+    fi
+fi
+
 dnl ************************************
 dnl *** Enable lcov coverage reports ***
 dnl ************************************


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