[ovs-dev] [PATCH 7/8] windefs: Add a placeholder for common definitions for windows.

Gurucharan Shetty shettyg at nicira.com
Mon Nov 18 15:43:28 UTC 2013


windefs.h will be included inside config.h. Since config.h
should ideally be included by all the header files, windefs.h
will automatically be included while compiling on windows.
The file is eventually expected to have some typedefs
and #defines to make code compile on windows.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 Makefile.am               |    5 +++++
 include/windows/windefs.h |   27 +++++++++++++++++++++++++++
 m4/openvswitch.m4         |    3 +++
 3 files changed, 35 insertions(+)
 create mode 100644 include/windows/windefs.h

diff --git a/Makefile.am b/Makefile.am
index 578485b..a7a1345 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,6 +10,11 @@ ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = datapath
 
 AM_CPPFLAGS = $(SSL_CFLAGS)
+
+if WIN32
+AM_CPPFLAGS += -I $(top_srcdir)/include/windows
+endif
+
 AM_CPPFLAGS += -I $(top_srcdir)/include
 AM_CPPFLAGS += -I $(top_srcdir)/lib
 AM_CPPFLAGS += -I $(top_builddir)/lib
diff --git a/include/windows/windefs.h b/include/windows/windefs.h
new file mode 100644
index 0000000..a784408
--- /dev/null
+++ b/include/windows/windefs.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013 Nicira, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WINDEFS_H
+#define WINDEFS_H 1
+
+#include <Winsock2.h>
+#include <In6addr.h>
+#include <WS2tcpip.h>
+#include <windows.h>
+
+typedef char bool;
+
+#endif /* windefs.h */
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 7c37985..45f915d 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -64,6 +64,9 @@ AC_DEFUN([OVS_CHECK_WIN32],
    AM_CONDITIONAL([WIN32], [test "$WIN32" = yes])
    if test "$WIN32" = yes; then
       AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
+      AH_BOTTOM([#ifdef WIN32
+#include "include/windows/windefs.h"
+#endif])
    fi])
 
 dnl Checks for Netlink support.
-- 
1.7.9.5




More information about the dev mailing list