[ovs-dev] [PATCH] configure: Include pthread-win32 libraries for Windows build.
Gurucharan Shetty
shettyg at nicira.com
Wed Mar 12 18:21:14 UTC 2014
From: Gurucharan Shetty <shettyg at nicira.com>
Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
Signed-off-by: Saurabh Shah <ssaurabh at vmware.com>
Co-authored-by: Saurabh Shah <ssaurabh at vmware.com>
---
BUILD.Windows | 7 ++++++-
Makefile.am | 2 ++
build-aux/cccl | 2 +-
lib/automake.mk | 5 +++++
m4/openvswitch.m4 | 21 +++++++++++++++++++++
ofproto/automake.mk | 4 ++++
6 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/BUILD.Windows b/BUILD.Windows
index ea931eb..c640e28 100644
--- a/BUILD.Windows
+++ b/BUILD.Windows
@@ -34,6 +34,11 @@ If after the above step, a 'which link' inside MSYS's bash says,
"/bin/link.exe", rename /bin/link.exe to something else so that the
Visual studio's linker is used.
+* For pthread support, install the library, dll and includes of pthreads-win32
+project from
+ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release to a
+directory (e.g.: C:/pthread).
+
* Get the Open vSwitch sources from either cloning the repo using git
or from a distribution tar ball.
@@ -49,7 +54,7 @@ or from a distribution tar ball.
% ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32 ..." \
--prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
- --sysconfdir="C:/openvswitch/etc"
+ --sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread"
* Run make for the ported executables in the top source directory, e.g.:
diff --git a/Makefile.am b/Makefile.am
index 6a2aca2..b5d33ac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,6 +14,8 @@ AM_LDFLAGS = $(SSL_LDFLAGS)
if WIN32
AM_CPPFLAGS += -I $(top_srcdir)/include/windows
+AM_CPPFLAGS += $(PTHREAD_INCLUDES)
+AM_LDFLAGS += $(PTHREAD_LDFLAGS)
endif
AM_CPPFLAGS += $(SSL_INCLUDES)
diff --git a/build-aux/cccl b/build-aux/cccl
index 855f183..d6915aa 100644
--- a/build-aux/cccl
+++ b/build-aux/cccl
@@ -91,7 +91,7 @@ EOF
-L*)
path=`echo "$1" | sed 's/-L//'`
- linkopt="$linkopt ${slash}LIBPATH:\"$path\""
+ linkopt="$linkopt ${slash}LIBPATH:$path"
cl_linkopt="${slash}link ${slash}LIBPATH:\"$path\""
;;
diff --git a/lib/automake.mk b/lib/automake.mk
index b1688ef..c2cfb16 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -8,6 +8,11 @@
lib_LTLIBRARIES += lib/libopenvswitch.la
lib_libopenvswitch_la_LIBADD = $(SSL_LIBS)
+
+if WIN32
+lib_libopenvswitch_la_LIBADD += ${PTHREAD_LIBS}
+endif
+
lib_libopenvswitch_la_LDFLAGS = -release $(VERSION)
lib_libopenvswitch_la_SOURCES = \
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 7a0465b..fa741f6 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -63,6 +63,27 @@ AC_DEFUN([OVS_CHECK_WIN32],
[WIN32=no])
AM_CONDITIONAL([WIN32], [test "$WIN32" = yes])
if test "$WIN32" = yes; then
+ AC_ARG_WITH([pthread],
+ [AS_HELP_STRING([--with-pthread=DIR],
+ [root of the pthread-win32 directory])],
+ [
+ case "$withval" in
+ "" | y | ye | yes | n | no)
+ AC_MSG_ERROR([Invalid --with-pthread value])
+ ;;
+ *)
+ PTHREAD_INCLUDES="-I$withval/include"
+ PTHREAD_LDFLAGS="-L$withval/lib/x86"
+ PTHREAD_LIBS="-lpthreadVC2"
+ AC_SUBST([PTHREAD_INCLUDES])
+ AC_SUBST([PTHREAD_LDFLAGS])
+ AC_SUBST([PTHREAD_LIBS])
+ ;;
+ esac
+ ], [
+ AC_MSG_ERROR([pthread directory not specified])
+ ]
+ )
AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
AH_BOTTOM([#ifdef WIN32
#include "include/windows/windefs.h"
diff --git a/ofproto/automake.mk b/ofproto/automake.mk
index 1308820..448138b 100644
--- a/ofproto/automake.mk
+++ b/ofproto/automake.mk
@@ -47,6 +47,10 @@ ofproto_libofproto_la_SOURCES = \
ofproto_libofproto_la_CPPFLAGS = $(AM_CPPFLAGS)
ofproto_libofproto_la_CFLAGS = $(AM_CFLAGS)
ofproto_libofproto_la_LIBADD = lib/libsflow.la
+if WIN32
+ofproto_libofproto_la_LIBADD += ${PTHREAD_LIBS}
+endif
+
# Distribute this generated file in order not to require Python at
# build time if ofproto/ipfix.xml is not modified.
--
1.7.9.5
More information about the dev
mailing list