+dnl Checks for ESX.
+AC_DEFUN([OVS_CHECK_ESX],
+ [AC_CHECK_HEADER([vmware.h],
+ [ESX=yes],
+ [ESX=no])
+ AM_CONDITIONAL([ESX], [test "$ESX" = yes])
+ if test "$ESX" = yes; then
+ 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],
+ [WIN32=yes],
+ [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])
+ ;;
+ *)
+ 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=/$(echo ${withval} | ${SED} -e 's/://')/dll/x64
+ PTHREAD_WIN32_DIR_DLL_WIN_FORM=$withval/dll/x64
+ else
+ PTHREAD_WIN32_DIR=$withval/lib/x86
+ PTHREAD_WIN32_DIR_DLL=/$(echo ${withval} | ${SED} -e 's/://')/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])
+ AC_SUBST([PTHREAD_LIBS])
+ ;;
+ esac
+ ], [
+ AC_MSG_ERROR([pthread directory not specified])
+ ]
+ )
+ AC_ARG_WITH([debug],
+ [AS_HELP_STRING([--with-debug],
+ [Build without compiler optimizations])],
+ [
+ MSVC_CFLAGS="-O0"
+ AC_SUBST([MSVC_CFLAGS])
+ ], [
+ MSVC_CFLAGS="-O2"
+ AC_SUBST([MSVC_CFLAGS])
+ ]
+ )
+
+ AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.])
+ AH_BOTTOM([#ifdef WIN32
+#include "include/windows/windefs.h"
+#endif])
+ fi])
+
+dnl OVS_CHECK_WINDOWS
+dnl
+dnl Configure Visual Studio solution build
+AC_DEFUN([OVS_CHECK_VISUAL_STUDIO_DDK], [
+AC_ARG_WITH([vstudiotarget],
+ [AS_HELP_STRING([--with-vstudiotarget=target_type],
+ [Target type: Debug/Release])],
+ [
+ case "$withval" in
+ "Release") ;;
+ "Debug") ;;
+ *) AC_MSG_ERROR([No valid Visual Studio configuration found]) ;;
+ esac
+
+ VSTUDIO_CONFIG=$withval
+ ], [
+ VSTUDIO_CONFIG=
+ ]
+ )
+
+ AC_SUBST([VSTUDIO_CONFIG])
+ AC_DEFINE([VSTUDIO_DDK], [1], [System uses the Visual Studio build target.])
+ AM_CONDITIONAL([VSTUDIO_DDK], [test -n "$VSTUDIO_CONFIG"])
+])
+