[librest] build: Detect CA file location



commit 9229ec62b17660536d1bb1e9af6abab2c1ea6dac
Author: Rob Bradford <rob linux intel com>
Date:   Thu Nov 10 16:23:16 2011 +0000

    build: Detect CA file location
    
    It will autodetect and also allow the setting of the CA file by a configure
    option.
    
    This code was stolen from glib-networking's configure.ac
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=663783

 configure.ac |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7b6d515..37a2e0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,30 @@ AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" = "xyes"])
 AC_SUBST([GCOV_CFLAGS])
 AC_SUBST([GCOV_LDFLAGS])
 
+dnl Stolen from glib-networking - those guys rock
+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; 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(REST_SYSTEM_CA_FILE, ["$with_ca_certificates"], [The system TLS CA list])
+fi
+
 AC_OUTPUT([
         Makefile
         rest/Makefile



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