--- src/common.h
+++ src/common.h
@@ -427,7 +427,7 @@
 #endif /* HAVE_OSSL_OCSP_H */
 #endif /* OpenSSL older than 0.9.8h */
 
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
 #include <openssl/ocsp.h>
 #endif /* HAVE_OSSL_OCSP_H */
 
--- src/options.c
+++ src/options.c
@@ -73,7 +73,7 @@
 static char *print_option(int, OPT_UNION *);
 static int parse_socket_option(char *);
 
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
 static char *parse_ocsp_url(SERVICE_OPTIONS *, char *);
 static unsigned long parse_ocsp_flag(char *);
 #endif /* HAVE_OSSL_OCSP_H */
@@ -1218,7 +1218,7 @@
         break;
     }
 
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
 
     /* OCSP */
     switch(cmd) {
@@ -2559,7 +2559,7 @@
 
 /**************************************** OCSP */
 
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
 
 static char *parse_ocsp_url(SERVICE_OPTIONS *section, char *arg) {
     char *host, *port, *path;
--- src/prototypes.h
+++ src/prototypes.h
@@ -141,7 +141,7 @@
     char *crl_file;                       /* file containing bunches of CRLs */
     int verify_level;
     X509_STORE *revocation_store;             /* cert store for CRL checking */
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
     SOCKADDR_UNION ocsp_addr;
     char *ocsp_path;
     unsigned long ocsp_flags;
@@ -220,7 +220,7 @@
         unsigned int transparent_src:1;
         unsigned int transparent_dst:1; /* endpoint: transparent destination */
 #endif
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
         unsigned int ocsp:1;
 #endif
         unsigned int reset:1;           /* reset sockets on error */
--- src/verify.c
+++ src/verify.c
@@ -48,7 +48,7 @@
 static int verify_callback(int, X509_STORE_CTX *);
 static int cert_check(CLI *c, X509_STORE_CTX *, int);
 static int crl_check(CLI *c, X509_STORE_CTX *);
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
 static int ocsp_check(CLI *c, X509_STORE_CTX *);
 static OCSP_RESPONSE *ocsp_get_response(CLI *, OCSP_REQUEST *);
 #endif
@@ -189,7 +189,7 @@
         OPENSSL_free(subject_name);
         return 0; /* reject connection */
     }
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
     if(c->opt->option.ocsp && !ocsp_check(c, callback_ctx)) {
         s_log(LOG_WARNING, "OCSP check failed: depth=%d, %s",
             depth, subject_name);
@@ -351,7 +351,7 @@
     return 1; /* accept connection */
 }
 
-#ifdef HAVE_OSSL_OCSP_H
+#if defined(HAVE_OSSL_OCSP_H) && SSLEAY_VERSION_NUMBER >= 0x00907000L
 
 /**************************************** OCSP checking */
 /* TODO: check OCSP server specified in the certificate */
