From c2dc47d64226a7a79b6b5c9bf21c744d6df9c3f3 Mon Sep 17 00:00:00 2001 From: "Craig A. Berry" Date: Tue, 10 Dec 2024 07:06:27 -0600 Subject: [PATCH] Add openssl_prefix to Configure and friends In order to add TLS to the core, we need a library, and OpenSSL is as ubiquitous as it gets. So detect where it is with logic borrowed from Net::SSLeay. --- Configure | 11 +++++++++++ Cross/config.sh-arm-linux | 1 + Cross/config.sh-arm-linux-n770 | 1 + Porting/config.sh | 1 + configure.com | 9 +++++++++ win32/Makefile | 10 ++++++++++ win32/config.gc | 1 + win32/config.vc | 1 + 8 files changed, 35 insertions(+) diff --git a/Configure b/Configure index 7868560295fb..8edc6ff26554 100755 --- a/Configure +++ b/Configure @@ -1257,6 +1257,7 @@ uvoformat='' uvuformat='' uvxformat='' pidtype='' +openssl_prefix='' prefix='' prefixexp='' installprivlib='' @@ -5356,6 +5357,15 @@ none) libs=' ';; *) libs="$ans";; esac +: see if OpenSSL is available +for thisdir in $libpth; do + p=$(dirname $thisdir) # parent of lib/ directory + if test -x "$p/bin/openssl$exe_ext" || test -x "$p/sbin/openssl$exe_ext"; then + openssl_prefix=$p + break + fi +done + : determine optimization, if desired, or use for debug flag also case "$optimize" in ' '|$undef) dflt='none';; @@ -25795,6 +25805,7 @@ nvtype='$nvtype' o_nonblock='$o_nonblock' obj_ext='$obj_ext' old_pthread_create_joinable='$old_pthread_create_joinable' +openssl_prefix='$openssl_prefix' optimize='$optimize' orderlib='$orderlib' osname='$osname' diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux index 8c89f28d4fca..4a38fa3c92f9 100644 --- a/Cross/config.sh-arm-linux +++ b/Cross/config.sh-arm-linux @@ -961,6 +961,7 @@ nvtype='double' o_nonblock='O_NONBLOCK' obj_ext='.o' old_pthread_create_joinable='' +openssl_prefix='' optimize='-O2' orderlib='false' osname='linux' diff --git a/Cross/config.sh-arm-linux-n770 b/Cross/config.sh-arm-linux-n770 index dde522e1e195..34b071690cce 100644 --- a/Cross/config.sh-arm-linux-n770 +++ b/Cross/config.sh-arm-linux-n770 @@ -959,6 +959,7 @@ nvtype='double' o_nonblock='O_NONBLOCK' obj_ext='.armo' old_pthread_create_joinable='' +openssl_prefix='' optimize='-O2' orderlib='false' osname='linux' diff --git a/Porting/config.sh b/Porting/config.sh index f186383d2c53..7eb8dbe03e56 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -985,6 +985,7 @@ nvtype='__float128' o_nonblock='O_NONBLOCK' obj_ext='.o' old_pthread_create_joinable='' +openssl_prefix='' optimize='-O2' orderlib='false' osname='linux' diff --git a/configure.com b/configure.com index 99527c180bfc..9c003b81be0d 100644 --- a/configure.com +++ b/configure.com @@ -1758,6 +1758,14 @@ $ ans = F$EDIT(ans,"TRIM,COMPRESS,LOWERCASE") $ IF ans.eqs."decc" THEN Has_Dec_C_Sockets = "T" $ ENDIF $! +$! If openssl is a concealed device name, that "device" is the root +$! of our OpenSSL installation. +$ IF F$TRNLNM(F$PARSE("openssl",,,"DEVICE") - ":",,,,,"CONCEALED") +$ THEN +$ openssl_prefix = "/" + F$PARSE("openssl",,,"DEVICE") - ":" +$ ELSE +$ openssl_prefix = "" +$ ENDIF $! $! Ask if they want to build with VMS_DEBUG perl $ echo "" @@ -6675,6 +6683,7 @@ $ WC "obj_ext='" + obj_ext + "'" $ WC "old_pthread_create_joinable='" + old_pthread_create_joinable + "'" $ WC "oldarchlib='" + oldarchlib + "'" $ WC "oldarchlibexp='" + oldarchlibexp + "'" +$ WC "openssl_prefix='" + openssl_prefix + "'" $ WC "optimize='" + optimize + "'" $ WC "osname='" + osname + "'" $ WC "osvers='" + osvers + "'" diff --git a/win32/Makefile b/win32/Makefile index 0b55bb377d62..24ea1ed2859e 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -232,6 +232,15 @@ EXTRALIBDIRS = # #EMAIL = +# Try to locate OpenSSL installation, if any. +!IF EXISTS($(PROGRAMFILES)\OpenSSL-Win64\bin\openssl.exe) && "$(WIN64)" == "define" +OPENSSL_PREFIX = $(PROGRAMFILES)\OpenSSL-Win64 +!ELSEIF EXISTS($(PROGRAMFILES)\OpenSSL-Win32\bin\openssl.exe) +OPENSSL_PREFIX = $(PROGRAMFILES)\OpenSSL-Win32 +!ELSE +OPENSSL_PREFIX = +!ENDIF + ## ## Build configuration ends. ## @@ -822,6 +831,7 @@ CFG_VARS = \ "libpth=$(CCLIBDIR:"=\");$(EXTRALIBDIRS:"=\")" \ "libc=$(LIBC)" \ "make=$(MAKE_BARE)" \ + "openssl_prefix=$(OPENSSL_PREFIX)" \ "static_ext=$(STATIC_EXT)" \ "usethreads=$(USE_ITHREADS)" \ "useithreads=$(USE_ITHREADS)" \ diff --git a/win32/config.gc b/win32/config.gc index d0a675e50177..dfdbbbc035ab 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -955,6 +955,7 @@ nvtype='double' o_nonblock='O_NONBLOCK' obj_ext='.o' old_pthread_create_joinable='' +openssl_prefix='' optimize='-O2' orderlib='false' osname='MSWin32' diff --git a/win32/config.vc b/win32/config.vc index 619979e22b53..69e92dd42f31 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -954,6 +954,7 @@ nvtype='double' o_nonblock='O_NONBLOCK' obj_ext='.obj' old_pthread_create_joinable='' +openssl_prefix='' optimize='-O' orderlib='false' osname='MSWin32'