Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4d3db13

Browse files
committed
Define OPENSSL_API_COMPAT
This avoids deprecation warnings from newer OpenSSL versions (3.0.0 in particular). Discussion: https://www.postgresql.org/message-id/flat/FEF81714-D479-4512-839B-C769D2605F8A%40yesql.se
1 parent 9b14280 commit 4d3db13

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

configure

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12174,7 +12174,11 @@ fi
1217412174
fi
1217512175

1217612176
if test "$with_openssl" = yes ; then
12177-
if test "$PORTNAME" != "win32"; then
12177+
# Minimum required OpenSSL version is 1.0.1
12178+
12179+
$as_echo "#define OPENSSL_API_COMPAT 0x10001000L" >>confdefs.h
12180+
12181+
if test "$PORTNAME" != "win32"; then
1217812182
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_new_ex_data in -lcrypto" >&5
1217912183
$as_echo_n "checking for CRYPTO_new_ex_data in -lcrypto... " >&6; }
1218012184
if ${ac_cv_lib_crypto_CRYPTO_new_ex_data+:} false; then :

configure.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,9 @@ fi
12061206

12071207
if test "$with_openssl" = yes ; then
12081208
dnl Order matters!
1209+
# Minimum required OpenSSL version is 1.0.1
1210+
AC_DEFINE(OPENSSL_API_COMPAT, [0x10001000L],
1211+
[Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.])
12091212
if test "$PORTNAME" != "win32"; then
12101213
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
12111214
AC_CHECK_LIB(ssl, SSL_new, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])

src/include/pg_config.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,10 @@
749749
/* Define bytes to use libc memset(). */
750750
#undef MEMSET_LOOP_LIMIT
751751

752+
/* Define to the OpenSSL API version in use. This avoids deprecation warnings
753+
from newer OpenSSL versions. */
754+
#undef OPENSSL_API_COMPAT
755+
752756
/* Define to the address where bug reports for this package should be sent. */
753757
#undef PACKAGE_BUGREPORT
754758

src/tools/msvc/Solution.pm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ sub GenerateFiles
152152
my $package_bugreport;
153153
my $package_url;
154154
my ($majorver, $minorver);
155+
my $ac_define_openssl_api_compat_found = 0;
156+
my $openssl_api_compat;
155157

156158
# Parse configure.in to get version numbers
157159
open(my $c, '<', "configure.in")
@@ -176,10 +178,15 @@ sub GenerateFiles
176178
$majorver = sprintf("%d", $1);
177179
$minorver = sprintf("%d", $2 ? $2 : 0);
178180
}
181+
elsif (/\bAC_DEFINE\(OPENSSL_API_COMPAT, \[([0-9xL]+)\]/)
182+
{
183+
$ac_define_openssl_api_compat_found = 1;
184+
$openssl_api_compat = $1;
185+
}
179186
}
180187
close($c);
181188
confess "Unable to parse configure.in for all variables!"
182-
unless $ac_init_found;
189+
unless $ac_init_found && $ac_define_openssl_api_compat_found;
183190

184191
if (IsNewer("src/include/pg_config_os.h", "src/include/port/win32.h"))
185192
{
@@ -433,6 +440,7 @@ sub GenerateFiles
433440
LOCALE_T_IN_XLOCALE => undef,
434441
MAXIMUM_ALIGNOF => 8,
435442
MEMSET_LOOP_LIMIT => 1024,
443+
OPENSSL_API_COMPAT => $openssl_api_compat,
436444
PACKAGE_BUGREPORT => qq{"$package_bugreport"},
437445
PACKAGE_NAME => qq{"$package_name"},
438446
PACKAGE_STRING => qq{"$package_name $package_version"},

0 commit comments

Comments
 (0)