detect alpn by feature flag not openssl version (closes #23329)
diff --git a/Misc/NEWS b/Misc/NEWS
index 249bd5a..1e13f63 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,9 @@
 Library
 -------
 
+- Issue #23329: Allow the ssl module to be built with older versions of
+  LibreSSL.
+
 - Prevent overflow in _Unpickler_Read.
 
 - Issue #25047: The XML encoding declaration written by Element Tree now
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index ca3549c..e43c502 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -109,8 +109,7 @@
 # define HAVE_SNI 0
 #endif
 
-/* ALPN added in OpenSSL 1.0.2 */
-#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x1000200fL && !defined(OPENSSL_NO_TLSEXT)
+#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
 # define HAVE_ALPN
 #endif