From 2aa0589192c5eeb47fcd59a5f6a082bf1dd7417d Mon Sep 17 00:00:00 2001
From: Ion Lupascu <ionlupascu@gmail.com>
Date: Wed, 2 Mar 2011 12:07:18 +0200
Subject: [PATCH] ZMQ_NOT_LIBRARY option: when use ZMQ source code in other projects not as a library.

Signed-off-by: Ion Lupascu <ionlupascu@gmail.com>
---
 include/zmq.h |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/include/zmq.h b/include/zmq.h
index 8c4447e..fa62571 100644
--- a/include/zmq.h
+++ b/include/zmq.h
@@ -20,7 +20,7 @@
 #ifndef __ZMQ_H_INCLUDED__
 #define __ZMQ_H_INCLUDED__
 
-#ifdef __cplusplus
+#if defined __cplusplus && !defined ZMQ_NOT_LIBRARY
 extern "C" {
 #endif
 
@@ -31,19 +31,23 @@ extern "C" {
 #endif
 
 /*  Handle DSO symbol visibility                                             */
-#if defined _WIN32
-#   if defined DLL_EXPORT
-#       define ZMQ_EXPORT __declspec(dllexport)
-#   else
-#       define ZMQ_EXPORT __declspec(dllimport)
-#   endif
+#if defined ZMQ_NOT_LIBRARY
+#   define ZMQ_EXPORT
 #else
-#   if defined __SUNPRO_C  || defined __SUNPRO_CC
-#       define ZMQ_EXPORT __global
-#   elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
-#       define ZMQ_EXPORT __attribute__ ((visibility("default")))
+#   if defined _WIN32
+#      if defined DLL_EXPORT
+#          define ZMQ_EXPORT __declspec(dllexport)
+#      else
+#          define ZMQ_EXPORT __declspec(dllimport)
+#      endif
 #   else
-#       define ZMQ_EXPORT
+#      if defined __SUNPRO_C  || defined __SUNPRO_CC
+#          define ZMQ_EXPORT __global
+#      elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
+#          define ZMQ_EXPORT __attribute__ ((visibility("default")))
+#      else
+#          define ZMQ_EXPORT
+#      endif
 #   endif
 #endif
 
@@ -255,7 +259,7 @@ ZMQ_EXPORT int zmq_device (int device, void * insocket, void* outsocket);
 
 #undef ZMQ_EXPORT
 
-#ifdef __cplusplus
+#if defined __cplusplus && !defined ZMQ_NOT_LIBRARY
 }
 #endif
 
-- 
1.7.1

