Hi all, 5e4dacb9878c has reminded me that we don't show the version of OpenSSL in the output of ./configure. This would be useful to know when looking at issues within the buildfarm, and I've wanted that a few times.
How about the attached to use the openssl command, if available, to display this information? Libraries may be installed while the command is not available, but in most cases I'd like to think that it is around, and it is less complex than using something like SSLeay_version() from libcrypto. meson already shows this information, so no additions are required there. Also, LibreSSL uses `openssl`, right? Thoughts or comments? -- Michael
diff --git a/configure b/configure
index c2cb1b1b24..6cb0310fb3 100755
--- a/configure
+++ b/configure
@@ -648,13 +648,13 @@ MSGFMT
PG_CRC32C_OBJS
CFLAGS_CRC
LIBOBJS
-OPENSSL
ZSTD
LZ4
UUID_LIBS
LDAP_LIBS_BE
LDAP_LIBS_FE
with_ssl
+OPENSSL
PTHREAD_CFLAGS
PTHREAD_LIBS
PTHREAD_CC
@@ -904,6 +904,7 @@ LDFLAGS_EX
LDFLAGS_SL
PERL
PYTHON
+OPENSSL
MSGFMT
TCLSH'
@@ -1615,6 +1616,7 @@ Some influential environment variables:
LDFLAGS_SL extra linker flags for linking shared libraries only
PERL Perl program
PYTHON Python program
+ OPENSSL path to openssl command
MSGFMT msgfmt program for NLS
TCLSH Tcl interpreter program (tclsh)
@@ -12863,6 +12865,65 @@ else
fi
fi
+ # Print version of OpenSSL, if command is available.
+
+ if test -z "$OPENSSL"; then
+ for ac_prog in openssl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_OPENSSL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $OPENSSL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_OPENSSL="$OPENSSL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_OPENSSL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+OPENSSL=$ac_cv_path_OPENSSL
+if test -n "$OPENSSL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL" >&5
+$as_echo "$OPENSSL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$OPENSSL" && break
+done
+
+else
+ # Report the value of OPENSSL in configure's output in all cases.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL" >&5
+$as_echo_n "checking for OPENSSL... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL" >&5
+$as_echo "$OPENSSL" >&6; }
+fi
+
+ pgac_openssl_version="$($OPENSSL version 2> /dev/null || echo no)"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: using openssl $pgac_openssl_version" >&5
+$as_echo "$as_me: using openssl $pgac_openssl_version" >&6;}
# Function introduced in OpenSSL 1.0.2, not in LibreSSL.
for ac_func in SSL_CTX_set_cert_cb
do :
diff --git a/configure.ac b/configure.ac
index 440b08d113..35585df598 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1360,6 +1360,11 @@ if test "$with_ssl" = openssl ; then
AC_SEARCH_LIBS(CRYPTO_new_ex_data, [eay32 crypto], [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])])
AC_SEARCH_LIBS(SSL_new, [ssleay32 ssl], [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])])
fi
+ # Print version of OpenSSL, if command is available.
+ AC_ARG_VAR(OPENSSL, [path to openssl command])
+ PGAC_PATH_PROGS(OPENSSL, openssl)
+ pgac_openssl_version="$($OPENSSL version 2> /dev/null || echo no)"
+ AC_MSG_NOTICE([using openssl $pgac_openssl_version])
# Function introduced in OpenSSL 1.0.2, not in LibreSSL.
AC_CHECK_FUNCS([SSL_CTX_set_cert_cb])
# Functions introduced in OpenSSL 1.1.0. We used to check for
signature.asc
Description: PGP signature
