From 1d125e589a243969d55a8597cbbc834fde2947f0 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Tue, 30 Jul 2024 07:31:10 +0200 Subject: [PATCH] Autotools: Improve ftp and mysqlnd SSL configure options This makes the configure log messages and help text more intuitive what is being enabled and when. --- ext/ftp/config.m4 | 23 ++++++++++++----------- ext/ftp/config.w32 | 2 +- ext/mysqlnd/config.w32 | 4 ++-- ext/mysqlnd/config9.m4 | 27 ++++++++++++++------------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/ext/ftp/config.m4 b/ext/ftp/config.m4 index 0837b8465041c..a884c8f6dc96b 100644 --- a/ext/ftp/config.m4 +++ b/ext/ftp/config.m4 @@ -3,25 +3,26 @@ PHP_ARG_ENABLE([ftp], [AS_HELP_STRING([--enable-ftp], [Enable FTP support])]) +dnl Empty variable means 'no' (for phpize builds). +AS_VAR_IF([PHP_OPENSSL],, [PHP_OPENSSL=no]) + PHP_ARG_WITH([ftp-ssl], - [whether to explicitly enable FTP SSL support], + [whether to enable FTP over SSL support], [AS_HELP_STRING([--with-ftp-ssl], - [Explicitly enable SSL support in ext/ftp when not building with - ext/openssl. If ext/openssl is enabled at the configure step, SSL is enabled - implicitly.])], - [no], + [Explicitly enable FTP over SSL support when building without openssl + extension or when using phpize. If the openssl extension is enabled at the + configure step (--with-openssl), FTP-SSL is enabled implicitly regardless of + this option.])], + [$PHP_OPENSSL], [no]) if test "$PHP_FTP" = "yes"; then AC_DEFINE(HAVE_FTP,1,[Whether you want FTP support]) PHP_NEW_EXTENSION([ftp], [php_ftp.c ftp.c], [$ext_shared]) - dnl Empty variable means 'no' (for phpize builds). - test -z "$PHP_OPENSSL" && PHP_OPENSSL=no - - if test "$PHP_OPENSSL" != "no" || test "$PHP_FTP_SSL" != "no"; then + AS_VAR_IF([PHP_FTP_SSL], [no],, [ PHP_SETUP_OPENSSL([FTP_SHARED_LIBADD]) PHP_SUBST([FTP_SHARED_LIBADD]) - AC_DEFINE(HAVE_FTP_SSL,1,[Whether FTP over SSL is supported]) - fi + AC_DEFINE([HAVE_FTP_SSL], [1], [Define to 1 if FTP over SSL is enabled.]) + ]) fi diff --git a/ext/ftp/config.w32 b/ext/ftp/config.w32 index 2d6845ca5414a..11119c101e875 100644 --- a/ext/ftp/config.w32 +++ b/ext/ftp/config.w32 @@ -10,7 +10,7 @@ if (PHP_FTP != "no") { if (ret >= 2) { MESSAGE("Enabling SSL support for ext\\ftp"); - AC_DEFINE('HAVE_FTP_SSL', 1, 'Have FTP over SSL support'); + AC_DEFINE('HAVE_FTP_SSL', 1, 'Define to 1 if FTP over SSL is enabled.'); } AC_DEFINE('HAVE_FTP', 1, 'Have FTP support'); diff --git a/ext/mysqlnd/config.w32 b/ext/mysqlnd/config.w32 index d87f67c6e24ac..fbe122ab5d36a 100644 --- a/ext/mysqlnd/config.w32 +++ b/ext/mysqlnd/config.w32 @@ -35,9 +35,9 @@ if (PHP_MYSQLND != "no") { ) { AC_DEFINE("MYSQLND_COMPRESSION_ENABLED", 1, "Define to 1 if mysqlnd has compressed protocol support."); - AC_DEFINE("MYSQLND_SSL_SUPPORTED", 1, "SSL support"); + AC_DEFINE("MYSQLND_SSL_SUPPORTED", 1, "Define to 1 if mysqlnd core SSL is enabled."); if (CHECK_LIB("crypt32.lib", "mysqlnd")) { - AC_DEFINE("MYSQLND_HAVE_SSL", 1, "Define to 1 if mysqlnd has extended SSL support through OpenSSL."); + AC_DEFINE("MYSQLND_HAVE_SSL", 1, "Define to 1 if mysqlnd extended SSL is enabled through OpenSSL."); } } PHP_INSTALL_HEADERS("", "ext/mysqlnd"); diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4 index 24b5d7aa878e1..af242f46d7e2f 100644 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@ -6,13 +6,17 @@ PHP_ARG_ENABLE([mysqlnd], [no], [yes]) +dnl Empty variable means 'no' (for phpize builds). +AS_VAR_IF([PHP_OPENSSL],, [PHP_OPENSSL=no]) + PHP_ARG_WITH([mysqlnd-ssl], - [whether to explicitly enable SSL support in mysqlnd], + [whether to enable extended SSL support in mysqlnd], [AS_HELP_STRING([--with-mysqlnd-ssl], - [Explicitly enable SSL support in ext/mysqlnd when not building with - ext/openssl. If ext/openssl is enabled at the configure step, SSL is enabled - implicitly.])], - [no], + [Explicitly enable extended SSL support in the mysqlnd extension when + building without openssl extension or when using phpize. If the openssl + extension is enabled at the configure step (--with-openssl), extended SSL is + enabled implicitly regardless of this option.])], + [$PHP_OPENSSL], [no]) PHP_ARG_ENABLE([mysqlnd-compression-support], @@ -29,16 +33,13 @@ if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes"; then [AC_DEFINE([MYSQLND_COMPRESSION_ENABLED], [1], [Define to 1 if mysqlnd has compressed protocol support.])])]) - AC_DEFINE([MYSQLND_SSL_SUPPORTED], 1, [Enable core mysqlnd SSL code]) - - dnl Empty variable means 'no' (for phpize builds). - test -z "$PHP_OPENSSL" && PHP_OPENSSL=no + AC_DEFINE([MYSQLND_SSL_SUPPORTED], [1], + [Define to 1 if mysqlnd core SSL is enabled.]) - if test "$PHP_OPENSSL" != "no" || test "$PHP_MYSQLND_SSL" != "no"; then - PHP_SETUP_OPENSSL([MYSQLND_SHARED_LIBADD], + AS_VAR_IF([PHP_MYSQLND_SSL], [no],, + [PHP_SETUP_OPENSSL([MYSQLND_SHARED_LIBADD], [AC_DEFINE([MYSQLND_HAVE_SSL], [1], - [Define to 1 if mysqlnd has extended SSL support through OpenSSL.])]) - fi + [Define to 1 if mysqlnd extended SSL is enabled through OpenSSL.])])]) PHP_NEW_EXTENSION([mysqlnd], m4_normalize([ mysqlnd_alloc.c