Remove #define OPENSSL_SYS_WIN32 since that tells OpenSSL to include
the Winsock header file. Define VC_EXTRALEAN and WIN32_LEAN_AND_MEAN
to avoid that header files are included from <windows.h> that conflict
with the OpenSSL header files. This patch avoids that building without
--with-openssl=internal fails.

This patch reverts commit 0657b90b7181 ("Cygwin, scapi.h: Fix build")
---
 configure                        | 6 ++++++
 configure.d/config_os_progs      | 6 ++++++
 include/net-snmp/library/scapi.h | 9 ---------
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index b8513ebd29f6..bafc9d205280 100755
--- a/configure
+++ b/configure
@@ -16284,6 +16284,12 @@ EOF
 
 
 
+# Avoid conflicts on Cygwin between <windows.h> and the openssl header files.
+case x$target_os in
+     xcygwin*)
+        CPPFLAGS="-DVC_EXTRALEAN -DWIN32_LEAN_AND_MEAN $CPPFLAGS";;
+esac
+
 #
 #    Whether or not Cygwin's ld recognizes the flag -no-undefined.
 #
diff --git a/configure.d/config_os_progs b/configure.d/config_os_progs
index 9266a40ca6b3..c053170d4c8b 100644
--- a/configure.d/config_os_progs
+++ b/configure.d/config_os_progs
@@ -199,6 +199,12 @@ changequote([, ])
 AC_MSG_CACHE_ADD(Building for:               $PARTIALTARGETOS)
 
 
+# Avoid conflicts on Cygwin between <windows.h> and the openssl header files.
+case x$target_os in
+     xcygwin*)
+        CPPFLAGS="-DVC_EXTRALEAN -DWIN32_LEAN_AND_MEAN $CPPFLAGS";;
+esac
+
 #
 #    Whether or not Cygwin's ld recognizes the flag -no-undefined. 
 #
diff --git a/include/net-snmp/library/scapi.h b/include/net-snmp/library/scapi.h
index c4cb8ffcdddd..72337308a494 100644
--- a/include/net-snmp/library/scapi.h
+++ b/include/net-snmp/library/scapi.h
@@ -11,15 +11,6 @@
 #define _SCAPI_H
 
 #ifdef NETSNMP_USE_OPENSSL
-#if defined(__CYGWIN__)
-/*
- * Recent versions of the Cygwin openssl header files and <windows.h> are
- * incompatible because both define X509_NAME unless OPENSSL_SYS_WIN32 is
- * defined. Hence define OPENSSL_SYS_WIN32 before including
- * <openssl/ossl_typ.h>.
- */
-#define OPENSSL_SYS_WIN32
-#endif
 #include <openssl/ossl_typ.h> /* EVP_MD */
 #endif
 
-- 
2.16.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to