summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorAlin Serdean <aserdean@cloudbasesolutions.com>2015-09-23 17:30:32 +0000
committerGurucharan Shetty <gshetty@nicira.com>2015-09-29 11:17:42 -0700
commit1cb3649c0bbacf4f3cea353d02a5e1217b5294b4 (patch)
tree47ea041e4038d65bfa1d5c14984b2118037988f3 /m4
parent34e1211b9a05d42a77cfac185361fc0539f77b21 (diff)
downloadopenvswitch-1cb3649c0bbacf4f3cea353d02a5e1217b5294b4.tar.gz
Add build system for compiling under MSVC x64
This patch adds the modifications needed to compile under x64 under Windows: - created a new macro for testing if we are compiling under x64. this will define the linker flag: "/MACHINE:X64" as per documentation (https://msdn.microsoft.com/en-us/library/9yb4317s.aspx). - added x64 pthread libraries under the pthread defines - add documentation on how to build under x64 Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/openvswitch.m433
1 files changed, 31 insertions, 2 deletions
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 087c7e544..98e5ce9be 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -70,6 +70,22 @@ AC_DEFUN([OVS_CHECK_ESX],
AC_DEFINE([ESX], [1], [Define to 1 if building on ESX.])
fi])
+dnl Checks for MSVC x64 compiler.
+AC_DEFUN([OVS_CHECK_WIN64],
+ [AC_CACHE_CHECK(
+ [for MSVC x64 compiler],
+ [cl_cv_x64],
+ [dnl "cl" writes x64 output to stdin:
+ if (cl) 2>&1 | grep 'x64' >/dev/null 2>&1; then
+ cl_cv_x64=yes
+ MSVC64_LDFLAGS=" /MACHINE:X64 "
+ else
+ cl_cv_x64=no
+ MSVC64_LDFLAGS=""
+ fi])
+ AC_SUBST([MSVC64_LDFLAGS])
+])
+
dnl Checks for WINDOWS.
AC_DEFUN([OVS_CHECK_WIN32],
[AC_CHECK_HEADER([windows.h],
@@ -86,11 +102,24 @@ AC_DEFUN([OVS_CHECK_WIN32],
AC_MSG_ERROR([Invalid --with-pthread value])
;;
*)
- PTHREAD_WIN32_DIR=$withval/lib/x86
- PTHREAD_WIN32_DIR_DLL=/${withval/:/}/dll/x86
+ if (cl) 2>&1 | grep 'x64' >/dev/null 2>&1; then
+ cl_cv_x64=yes
+ else
+ cl_cv_x64=no
+ fi
+ if test "$cl_cv_x64" = yes; then
+ PTHREAD_WIN32_DIR=$withval/lib/x64
+ PTHREAD_WIN32_DIR_DLL=/${withval/:/}/dll/x64
+ PTHREAD_WIN32_DIR_DLL_WIN_FORM=$withval/dll/x64
+ else
+ PTHREAD_WIN32_DIR=$withval/lib/x86
+ PTHREAD_WIN32_DIR_DLL=/${withval/:/}/dll/x86
+ PTHREAD_WIN32_DIR_DLL_WIN_FORM=$withval/dll/x86
+ fi
PTHREAD_INCLUDES=-I$withval/include
PTHREAD_LDFLAGS=-L$PTHREAD_WIN32_DIR
PTHREAD_LIBS="-lpthreadVC2"
+ AC_SUBST([PTHREAD_WIN32_DIR_DLL_WIN_FORM])
AC_SUBST([PTHREAD_WIN32_DIR_DLL])
AC_SUBST([PTHREAD_INCLUDES])
AC_SUBST([PTHREAD_LDFLAGS])