configure: Include pthread-win32 libraries for Windows build.
authorGurucharan Shetty <shettyg@nicira.com>
Tue, 4 Mar 2014 22:07:55 +0000 (14:07 -0800)
committerGurucharan Shetty <gshetty@nicira.com>
Thu, 13 Mar 2014 16:11:44 +0000 (09:11 -0700)
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Saurabh Shah <ssaurabh@vmware.com>
Co-authored-by: Saurabh Shah <ssaurabh@vmware.com>
Acked-by: Ben Pfaff <blp@nicira.com>
BUILD.Windows
Makefile.am
build-aux/cccl
lib/automake.mk
m4/openvswitch.m4
ofproto/automake.mk

index ea931eb..c640e28 100644 (file)
@@ -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.:
 
index 6a2aca2..b5d33ac 100644 (file)
@@ -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)
index 855f183..d6915aa 100644 (file)
@@ -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\""
         ;;
 
index b1688ef..c2cfb16 100644 (file)
@@ -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 = \
index 7a0465b..fa741f6 100644 (file)
@@ -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"
index 1308820..448138b 100644 (file)
@@ -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.