Skip to content

Commit

Permalink
configure: Include pthread-win32 libraries for Windows build.
Browse files Browse the repository at this point in the history
Signed-off-by: Gurucharan Shetty <[email protected]>
Signed-off-by: Saurabh Shah <[email protected]>
Co-authored-by: Saurabh Shah <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
shettyg and Saurabh Shah committed Mar 13, 2014
1 parent c2dc87c commit 94887cf
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 2 deletions.
7 changes: 6 additions & 1 deletion BUILD.Windows
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.:

Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion build-aux/cccl
Original file line number Diff line number Diff line change
Expand Up @@ -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\""
;;

Expand Down
5 changes: 5 additions & 0 deletions lib/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 = \
Expand Down
21 changes: 21 additions & 0 deletions m4/openvswitch.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions ofproto/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 94887cf

Please sign in to comment.