Cope with cross-compiling when checking for a random-number source.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 30 Nov 2021 22:18:04 +0000 (17:18 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 30 Nov 2021 22:18:04 +0000 (17:18 -0500)
Commit 16f96c74d neglected to consider the possibility of cross-compiling,
causing cross-compiles to fail at the configure stage unless you'd
selected --with-openssl.  Since we're now more or less assuming that
/dev/urandom is available everywhere, it seems reasonable to assume
that the cross-compile target has it too, rather than failing.

Per complaint from Vincas Dargis.  Back-patch to v14 where this came in.

Discussion: https://postgr.es/m/0dc14a31-acaf-8cae-0df4-a87339b22bd9@gmail.com

configure
configure.ac

index 29a654ec51c1f372be8803661447567be91cc1cc..ecf14476a06e6514c49d09e49b7d21c7ab0a3bea 100755 (executable)
--- a/configure
+++ b/configure
@@ -10468,7 +10468,7 @@ $as_echo "${python_libspec} ${python_additional_libs}" >&6; }
 
 fi
 
-if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
+if test x"$cross_compiling" = x"yes" && test -z "$with_system_tzdata"; then
   if test -z "$ZIC"; then
   for ac_prog in zic
 do
@@ -18702,6 +18702,9 @@ $as_echo "OpenSSL" >&6; }
 elif test x"$PORTNAME" = x"win32" ; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: Windows native" >&5
 $as_echo "Windows native" >&6; }
+elif test x"$cross_compiling" = x"yes"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: assuming /dev/urandom" >&5
+$as_echo "assuming /dev/urandom" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: /dev/urandom" >&5
 $as_echo "/dev/urandom" >&6; }
index 54a9dec092588ec865580cacb2be0af418dcbb8a..4d37c2312c00aa8d94ab31cd8eaa4a7ea3cbc180 100644 (file)
@@ -1126,7 +1126,7 @@ if test "$with_python" = yes; then
   PGAC_CHECK_PYTHON_EMBED_SETUP
 fi
 
-if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
+if test x"$cross_compiling" = x"yes" && test -z "$with_system_tzdata"; then
   PGAC_PATH_PROGS(ZIC, zic)
   if test -z "$ZIC"; then
     AC_MSG_ERROR([
@@ -2257,6 +2257,8 @@ if test x"$with_ssl" = x"openssl" ; then
   AC_MSG_RESULT([OpenSSL])
 elif test x"$PORTNAME" = x"win32" ; then
   AC_MSG_RESULT([Windows native])
+elif test x"$cross_compiling" = x"yes"; then
+  AC_MSG_RESULT([assuming /dev/urandom])
 else
   AC_MSG_RESULT([/dev/urandom])
   AC_CHECK_FILE([/dev/urandom], [], [])