]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Look for OpenSSL the old way if pkg-config is not available (Issue #375)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 4 May 2022 12:28:00 +0000 (08:28 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 4 May 2022 12:28:00 +0000 (08:28 -0400)
CHANGES.md
config-scripts/cups-tls.m4
configure

index 050c41116a52a40ea1d3cc35cb4e82ca6f4ff97f..20743a577f5025402d89d0c72fc6b1fee6761184 100644 (file)
@@ -25,6 +25,8 @@ Changes in CUPS v2.4.2 (TBA)
 - Updated the scheduler to set "auth-info-required" to "username,password" if a
   backend reports it needs authentication info but doesn't set a method for
   authentication (Issue #373)
+- Updated the configure script to look for the OpenSSL library the old way if
+  pkg-config is not available (Issue #375)
 - Fixed the prototype for the `httpWriteResponse` function (Issue #380)
 - `cupsGetResponse` did not always set the last error.
 - Fixed a number of old references to the Apple CUPS web page.
index 880ea559b0c1564f34e39c4d9698f73553d8ed06..e9320f75530d92acb8654ce6ea1f506990e7e9f6 100644 (file)
@@ -24,6 +24,7 @@ CUPS_SERVERKEYCHAIN=""
 dnl First look for OpenSSL/LibreSSL...
 AS_IF([test $with_tls = yes -o $with_tls = openssl], [
     AS_IF([test "x$PKGCONFIG" != x], [
+       # Find openssl using pkg-config...
         AC_MSG_CHECKING([for openssl package])
        AS_IF([$PKGCONFIG --exists openssl], [
            AC_MSG_RESULT([yes])
@@ -37,6 +38,23 @@ AS_IF([test $with_tls = yes -o $with_tls = openssl], [
        ], [
            AC_MSG_RESULT([no])
        ])
+    ], [
+       # Find openssl using legacy library/header checks...
+       SAVELIBS="$LIBS"
+       LIBS="-lcrypto $LIBS"
+
+       AC_CHECK_LIB([ssl], [SSL_new], [
+           AC_CHECK_HEADER([openssl/ssl.h], [
+               have_tls="1"
+               with_tls="openssl"
+               TLSLIBS="-lssl -lcrypto"
+               PKGCONFIG_LIBS_STATIC="$PKGCONFIG_LIBS_STATIC $TLSLIBS"
+               AC_DEFINE([HAVE_TLS], [1], [Do we support TLS?])
+               AC_DEFINE([HAVE_OPENSSL], [1], [Do we have the OpenSSL library?])
+           ])
+       ])
+
+       LIBS="$SAVELIBS"
     ])
 
     AS_IF([test $have_tls = 1], [
index c6e785f7d400e838c1ed0765ccef93696dfeb639..7934a827981f8ee1c6316ac79766123042278a0e 100755 (executable)
--- a/configure
+++ b/configure
@@ -9676,6 +9676,7 @@ then :
     if test "x$PKGCONFIG" != x
 then :
 
+       # Find openssl using pkg-config...
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for openssl package" >&5
 printf %s "checking for openssl package... " >&6; }
        if $PKGCONFIG --exists openssl
@@ -9702,6 +9703,73 @@ printf "%s\n" "no" >&6; }
 
 fi
 
+else $as_nop
+
+       # Find openssl using legacy library/header checks...
+       SAVELIBS="$LIBS"
+       LIBS="-lcrypto $LIBS"
+
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5
+printf %s "checking for SSL_new in -lssl... " >&6; }
+if test ${ac_cv_lib_ssl_SSL_new+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lssl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+char SSL_new ();
+int
+main (void)
+{
+return SSL_new ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+  ac_cv_lib_ssl_SSL_new=yes
+else $as_nop
+  ac_cv_lib_ssl_SSL_new=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5
+printf "%s\n" "$ac_cv_lib_ssl_SSL_new" >&6; }
+if test "x$ac_cv_lib_ssl_SSL_new" = xyes
+then :
+
+           ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_ssl_h" = xyes
+then :
+
+               have_tls="1"
+               with_tls="openssl"
+               TLSLIBS="-lssl -lcrypto"
+               PKGCONFIG_LIBS_STATIC="$PKGCONFIG_LIBS_STATIC $TLSLIBS"
+
+printf "%s\n" "#define HAVE_TLS 1" >>confdefs.h
+
+
+printf "%s\n" "#define HAVE_OPENSSL 1" >>confdefs.h
+
+
+fi
+
+
+fi
+
+
+       LIBS="$SAVELIBS"
+
 fi
 
     if test $have_tls = 1