Include presence of openssl/engine.h as indication engines should not be
used. Skip engine if header is not present.
#include <ldns/keys.h>
#include <openssl/conf.h>
-#ifndef OPENSSL_NO_ENGINE
+#if defined(HAVE_OPENSSL_ENGINE_H) && !defined(OPENSSL_NO_ENGINE)
#include <openssl/engine.h>
+#else
+# ifndef OPENSSL_NO_ENGINE
+# define OPENSSL_NO_ENGINE
+# endif
#endif
#include <openssl/err.h>
#ifdef USE_DSA
#include <openssl/dsa.h>
#endif
-#ifndef OPENSSL_NO_ENGINE
+#if defined(HAVE_OPENSSL_ENGINE_H) && !defined(OPENSSL_NO_ENGINE)
#include <openssl/engine.h>
+#else
+# ifndef OPENSSL_NO_ENGINE
+# define OPENSSL_NO_ENGINE
+# endif
#endif
#endif /* HAVE_SSL */