@@ -1502,9 +1502,15 @@ use_homebrew_openssl() {
15021502 local ssldir=" $( brew --prefix " ${openssl} " || true) "
15031503 if [ -d " $ssldir " ]; then
15041504 echo " python-build: use ${openssl} from homebrew"
1505+ if [[ -n " ${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:- } " ]]; then
1506+ # configure scriopt of newer CPython versions support `--with-openssl`
1507+ # https://bugs.python.org/issue21541
1508+ package_option python configure --with-openssl=" ${ssldir} "
1509+ else
1510+ export CPPFLAGS=" -I$ssldir /include ${CPPFLAGS} "
1511+ export LDFLAGS=" -L$ssldir /lib ${LDFLAGS} "
1512+ fi
15051513 export PKG_CONFIG_PATH=" $ssldir /lib/pkgconfig/:${PKG_CONFIG_PATH} "
1506- export CPPFLAGS=" -I$ssldir /include ${CPPFLAGS} "
1507- export LDFLAGS=" -L$ssldir /lib ${LDFLAGS} "
15081514 return
15091515 fi
15101516 done
@@ -1519,8 +1525,14 @@ build_package_mac_openssl() {
15191525 OPENSSLDIR=" ${OPENSSLDIR:- $OPENSSL_PREFIX_PATH / ssl} "
15201526
15211527 # Tell Python to use this openssl for its extension.
1522- export CPPFLAGS=" -I${OPENSSL_PREFIX_PATH} /include ${CPPFLAGS} "
1523- export LDFLAGS=" -L${OPENSSL_PREFIX_PATH} /lib ${LDFLAGS} "
1528+ if [[ -n " ${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:- } " ]]; then
1529+ # configure scriopt of newer CPython versions support `--with-openssl`
1530+ # https://bugs.python.org/issue21541
1531+ package_option python configure --with-openssl=" ${OPENSSL_PREFIX_PATH} "
1532+ else
1533+ export CPPFLAGS=" -I${OPENSSL_PREFIX_PATH} /include ${CPPFLAGS} "
1534+ export LDFLAGS=" -L${OPENSSL_PREFIX_PATH} /lib ${LDFLAGS} "
1535+ fi
15241536
15251537 # Make sure pkg-config finds our build first.
15261538 export PKG_CONFIG_PATH=" ${OPENSSL_PREFIX_PATH} /lib/pkgconfig${PKG_CONFIG_PATH: +: $PKG_CONFIG_PATH } "
0 commit comments