From: Michael R Sweet Date: Wed, 4 May 2022 12:28:00 +0000 (-0400) Subject: Look for OpenSSL the old way if pkg-config is not available (Issue #375) X-Git-Tag: v2.4.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd9310639871b88ac3f9e741105eff122ecdea3b;p=thirdparty%2Fcups.git Look for OpenSSL the old way if pkg-config is not available (Issue #375) --- diff --git a/CHANGES.md b/CHANGES.md index 050c41116a..20743a577f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. diff --git a/config-scripts/cups-tls.m4 b/config-scripts/cups-tls.m4 index 880ea559b0..e9320f7553 100644 --- a/config-scripts/cups-tls.m4 +++ b/config-scripts/cups-tls.m4 @@ -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], [ diff --git a/configure b/configure index c6e785f7d4..7934a82798 100755 --- 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