diff --git a/src/libs/zeroconf/avahiLib.cpp b/src/libs/zeroconf/avahiLib.cpp
index 9558d023065a953c4036cf75e757607b197194af..bc4e0086630894030fe588e37c059e68db0ec979 100644
--- a/src/libs/zeroconf/avahiLib.cpp
+++ b/src/libs/zeroconf/avahiLib.cpp
@@ -38,9 +38,9 @@
 #include <QString>
 #include <QStringList>
 
-//#ifdef Q_OS_LINUX
+#ifdef Q_OS_LINUX
 #define AVAHI_LIB
-//#endif
+#endif
 
 #ifdef AVAHI_LIB
 
diff --git a/src/libs/zeroconf/embeddedLib.cpp b/src/libs/zeroconf/embeddedLib.cpp
index 8c9ac039afb4d91b7d48c9daa94d6ed1a882b8ed..aca6bf7eca9d58b9dea1d1d0d22085c04b38f2b4 100644
--- a/src/libs/zeroconf/embeddedLib.cpp
+++ b/src/libs/zeroconf/embeddedLib.cpp
@@ -29,14 +29,9 @@
 ** Nokia at info@qt.nokia.com.
 **
 **************************************************************************/
-#include <qglobal.h>
-#ifdef Q_OS_LINUX
-#define EMBEDDED_LIB
-#endif
 
-#ifdef Q_OS_WIN
-# include <Winsock2.h>
-#endif
+#include "syssocket.h" // this should be the first header included
+
 #include "servicebrowser_p.h"
 
 #include <QtCore/QString>
@@ -45,6 +40,10 @@
 #include <QtCore/QCoreApplication>
 #include <QtCore/QDebug>
 
+#ifdef Q_OS_LINUX
+#define EMBEDDED_LIB
+#endif
+
 #ifdef EMBEDDED_LIB
 #include "embed/dnssd_ipc.c"
 #include "embed/dnssd_clientlib.c"
diff --git a/src/libs/zeroconf/nativeLib.cpp b/src/libs/zeroconf/nativeLib.cpp
index d5bb6746766ef3d33365ef3bb99237587b1c4adc..c9fd4d5ad982f5fa4e9e4d6b0dee419051d0e2e3 100644
--- a/src/libs/zeroconf/nativeLib.cpp
+++ b/src/libs/zeroconf/nativeLib.cpp
@@ -30,6 +30,8 @@
 **
 **************************************************************************/
 
+#include "syssocket.h" // this should be the first header included
+
 #include "servicebrowser.h"
 #include "servicebrowser_p.h"
 
diff --git a/src/libs/zeroconf/servicebrowser.cpp b/src/libs/zeroconf/servicebrowser.cpp
index bab9e511e5b975436fb572e336b48bd1dfd66ddd..3fa8d23e14bee8c61d66997c5ba5125e1eb5bde0 100644
--- a/src/libs/zeroconf/servicebrowser.cpp
+++ b/src/libs/zeroconf/servicebrowser.cpp
@@ -30,19 +30,6 @@
 **
 **************************************************************************/
 
-#ifdef Q_OS_WIN32
-# include <Winsock2.h>
-# ifndef SHUT_RDWR
-#  ifdef SD_BOTH
-#    define SHUT_RDWR SD_BOTH
-#  else
-#    define SHUT_RDWR 2
-#  endif
-# endif
-#else
-# include <sys/socket.h>
-#endif
-
 #include "mdnsderived.h"
 #include "servicebrowser_p.h"
 
@@ -442,16 +429,16 @@ void initLib(LibUsage usage, const QString &libName, const QString &daemonPath)
 namespace Internal {
 // ----------------- dns-sd C callbacks -----------------
 
-extern "C" void cServiceResolveReply(DNSServiceRef                       sdRef,
-                                     DNSServiceFlags                     flags,
-                                     uint32_t                            interfaceIndex,
-                                     DNSServiceErrorType                 errorCode,
-                                     const char                          *fullname,
-                                     const char                          *hosttarget,
-                                     uint16_t                            port,        /* In network byte order */
-                                     uint16_t                            txtLen,
-                                     const unsigned char                 *txtRecord,
-                                     void                                *context)
+extern "C" void DNSSD_API cServiceResolveReply(DNSServiceRef                       sdRef,
+                                               DNSServiceFlags                     flags,
+                                               uint32_t                            interfaceIndex,
+                                               DNSServiceErrorType                 errorCode,
+                                               const char                          *fullname,
+                                               const char                          *hosttarget,
+                                               uint16_t                            port,        /* In network byte order */
+                                               uint16_t                            txtLen,
+                                               const unsigned char                 *txtRecord,
+                                               void                                *context)
 {
     if (DEBUG_ZEROCONF)
         qDebug() << "cServiceResolveReply(" << ((size_t)sdRef) << ", " << ((quint32)flags) << ", " << interfaceIndex
@@ -469,17 +456,17 @@ extern "C" void cServiceResolveReply(DNSServiceRef                       sdRef,
     }
 }
 
-extern "C" void cTxtRecordReply(DNSServiceRef                       sdRef,
-                                DNSServiceFlags                     flags,
-                                uint32_t                            interfaceIndex,
-                                DNSServiceErrorType                 errorCode,
-                                const char                          *fullname,
-                                uint16_t                            rrtype,
-                                uint16_t                            rrclass,
-                                uint16_t                            rdlen,
-                                const void                          *rdata,
-                                uint32_t                            ttl,
-                                void                                *context)
+extern "C" void DNSSD_API cTxtRecordReply(DNSServiceRef                       sdRef,
+                                          DNSServiceFlags                     flags,
+                                          uint32_t                            interfaceIndex,
+                                          DNSServiceErrorType                 errorCode,
+                                          const char                          *fullname,
+                                          uint16_t                            rrtype,
+                                          uint16_t                            rrclass,
+                                          uint16_t                            rdlen,
+                                          const void                          *rdata,
+                                          uint32_t                            ttl,
+                                          void                                *context)
 {
     if (DEBUG_ZEROCONF)
         qDebug() << "cTxtRecordReply(" << ((size_t)sdRef) << ", " << ((int)flags) << ", " << interfaceIndex
@@ -495,14 +482,14 @@ extern "C" void cTxtRecordReply(DNSServiceRef                       sdRef,
     }
 }
 
-extern "C" void cAddrReply(DNSServiceRef                    sdRef,
-                           DNSServiceFlags                  flags,
-                           uint32_t                         interfaceIndex,
-                           DNSServiceErrorType              errorCode,
-                           const char                       *hostname,
-                           const struct sockaddr            *address,
-                           uint32_t                         ttl,
-                           void                             *context)
+extern "C" void DNSSD_API cAddrReply(DNSServiceRef                    sdRef,
+                                     DNSServiceFlags                  flags,
+                                     uint32_t                         interfaceIndex,
+                                     DNSServiceErrorType              errorCode,
+                                     const char                       *hostname,
+                                     const struct sockaddr            *address,
+                                     uint32_t                         ttl,
+                                     void                             *context)
 {
     if (DEBUG_ZEROCONF)
         qDebug() << "cAddrReply(" << ((size_t)sdRef) << ", " << ((int)flags) << ", " << interfaceIndex
@@ -515,14 +502,14 @@ extern "C" void cAddrReply(DNSServiceRef                    sdRef,
 }
 
 /// callback for service browsing
-extern "C" void cBrowseReply(DNSServiceRef       sdRef,
-                             DNSServiceFlags     flags,
-                             uint32_t            interfaceIndex,
-                             DNSServiceErrorType errorCode,
-                             const char          *serviceName,
-                             const char          *regtype,
-                             const char          *replyDomain,
-                             void                *context)
+extern "C" void DNSSD_API cBrowseReply(DNSServiceRef       sdRef,
+                                       DNSServiceFlags     flags,
+                                       uint32_t            interfaceIndex,
+                                       DNSServiceErrorType errorCode,
+                                       const char          *serviceName,
+                                       const char          *regtype,
+                                       const char          *replyDomain,
+                                       void                *context)
 {
     if (DEBUG_ZEROCONF)
         qDebug() << "cBrowseReply(" << ((size_t)sdRef) << ", " << flags << ", " << interfaceIndex
diff --git a/src/libs/zeroconf/syssocket.h b/src/libs/zeroconf/syssocket.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc9fb6991a61b04263aa0168224f3f099123bb21
--- /dev/null
+++ b/src/libs/zeroconf/syssocket.h
@@ -0,0 +1,56 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef SYSSOCKET_H
+#define SYSSOCKET_H
+
+// WARNING:
+//
+// we use Winsock2, which means that this header should be included *before*
+// any other windows header
+
+#include <qglobal.h>
+
+#ifdef Q_OS_WIN32
+# include <Winsock2.h>
+# ifndef SHUT_RDWR
+#  ifdef SD_BOTH
+#    define SHUT_RDWR SD_BOTH
+#  else
+#    define SHUT_RDWR 2
+#  endif
+# endif
+#else
+# include <sys/socket.h>
+#endif
+
+#endif // SYSSOCKET_H
diff --git a/src/libs/zeroconf/zeroconf.pro b/src/libs/zeroconf/zeroconf.pro
index 7081d4646a8024c80c5abda3d1105fadf4280784..6dca3c066b5587a7bfe9207c9e97f7e602700593 100644
--- a/src/libs/zeroconf/zeroconf.pro
+++ b/src/libs/zeroconf/zeroconf.pro
@@ -16,7 +16,8 @@ HEADERS += servicebrowser.h \
         zeroconf_global.h \
         dns_sd_types.h \
     servicebrowser_p.h \
-    mdnsderived.h
+    mdnsderived.h \
+    syssocket.h
 
 include(../../qtcreatorlibrary.pri)
 
@@ -25,3 +26,4 @@ win32{
 }
 
 
+