X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=m4%2Fopenvswitch.m4;h=0cfaae69cfd7ff27b22a7adc4e9958eb1ac12a9d;hb=aca8be36a2aba3dccd48c1ad91ff8ea7e9249761;hp=ee7e96a8d6551427b310dd59eb4ce1e8d2dea4a0;hpb=e42dfc72258c0b563a16ec36c9230287fbbcc7ae;p=cascardo%2Fovs.git diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index ee7e96a8d..0cfaae69c 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -1,6 +1,6 @@ # -*- autoconf -*- -# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. +# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +m4_include([m4/compat.at]) dnl Checks for --enable-coverage and updates CFLAGS and LDFLAGS appropriately. AC_DEFUN([OVS_CHECK_COVERAGE], @@ -28,8 +30,20 @@ AC_DEFUN([OVS_CHECK_COVERAGE], esac], [coverage=false]) if $coverage; then - CFLAGS="$CFLAGS -O0 --coverage" - LDFLAGS="$LDFLAGS --coverage" + # Autoconf by default puts "-g -O2" in CFLAGS. We need to remove the -O2 + # option for coverage to be useful. This does it without otherwise + # interfering with anything that the user might have put there. + old_CFLAGS=$CFLAGS + CFLAGS= + for option in $old_CFLAGS; do + case $option in + (-O2) ;; + (*) CFLAGS="$CFLAGS $option" ;; + esac + done + + OVS_CFLAGS="$OVS_CFLAGS --coverage" + OVS_LDFLAGS="$OVS_LDFLAGS --coverage" fi]) dnl Checks for --enable-ndebug and defines NDEBUG if it is specified. @@ -56,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], @@ -63,19 +93,92 @@ 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]) + ;; + *) + 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"]) +]) + dnl Checks for Netlink support. AC_DEFUN([OVS_CHECK_NETLINK], [AC_CHECK_HEADER([linux/netlink.h], [HAVE_NETLINK=yes], [HAVE_NETLINK=no], [#include - #include ]) AM_CONDITIONAL([HAVE_NETLINK], [test "$HAVE_NETLINK" = yes]) if test "$HAVE_NETLINK" = yes; then @@ -83,6 +186,42 @@ AC_DEFUN([OVS_CHECK_NETLINK], [Define to 1 if Netlink protocol is available.]) fi]) +dnl Checks for libcap-ng. +AC_DEFUN([OVS_CHECK_LIBCAPNG], + [AC_ARG_ENABLE( + [libcapng], + [AC_HELP_STRING([--disable-libcapng], [Disable Linux capability support])], + [case "${enableval}" in + (yes) libcapng=true ;; + (no) libcapng=false ;; + (*) AC_MSG_ERROR([bad value ${enableval} for --enable-libcapng]) ;; + esac], + [libcapng=check]) + + if test "$libcapng" != false; then + AC_CHECK_LIB([cap-ng], [capng_clear], [HAVE_LIBCAPNG=yes]) + + if test "$HAVE_LIBCAPNG" != yes; then + if test "$libcapng" = true ; then + AC_MSG_ERROR([libcap-ng support requested, but not found]) + fi + if test "$libcapng" = check ; then + AC_MSG_WARN([cannot find libcap-ng. +--user option will not be supported on Linux. +(you may use --disable-libcapng to suppress this warning). ]) + fi + fi + fi + + AC_SUBST([HAVE_LIBCAPNG]) + AM_CONDITIONAL([HAVE_LIBCAPNG], [test "$HAVE_LIBCAPNG" = yes]) + if test "$HAVE_LIBCAPNG" = yes; then + AC_DEFINE([HAVE_LIBCAPNG], [1], + [Define to 1 if libcap-ng is available.]) + CAPNG_LDADD="-lcap-ng" + AC_SUBST([CAPNG_LDADD]) + fi]) + dnl Checks for OpenSSL. AC_DEFUN([OVS_CHECK_OPENSSL], [AC_ARG_ENABLE( @@ -170,46 +309,30 @@ AC_DEFUN([OVS_CHECK_BACKTRACE], [AC_DEFINE([HAVE_BACKTRACE], [1], [Define to 1 if you have backtrace(3).])])]) -dnl Checks for __malloc_hook, etc., supported by glibc. -AC_DEFUN([OVS_CHECK_MALLOC_HOOKS], - [AC_CACHE_CHECK( - [whether libc supports hooks for malloc and related functions], - [ovs_cv_malloc_hooks], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [#include - ], - [(void) __malloc_hook; - (void) __realloc_hook; - (void) __free_hook;])], - [ovs_cv_malloc_hooks=yes], - [ovs_cv_malloc_hooks=no])]) - if test $ovs_cv_malloc_hooks = yes; then - AC_DEFINE([HAVE_MALLOC_HOOKS], [1], - [Define to 1 if you have __malloc_hook, __realloc_hook, and - __free_hook in .]) - fi]) +dnl Defines HAVE_PERF_EVENT if linux/perf_event.h is found. +AC_DEFUN([OVS_CHECK_PERF_EVENT], + [AC_CHECK_HEADERS([linux/perf_event.h])]) dnl Checks for valgrind/valgrind.h. AC_DEFUN([OVS_CHECK_VALGRIND], [AC_CHECK_HEADERS([valgrind/valgrind.h])]) -dnl Checks for Python 2.x, x >= 4. +dnl Checks for Python 2.x, x >= 7. AC_DEFUN([OVS_CHECK_PYTHON], [AC_CACHE_CHECK( - [for Python 2.x for x >= 4], + [for Python 2.x for x >= 7], [ovs_cv_python], [if test -n "$PYTHON"; then ovs_cv_python=$PYTHON else ovs_cv_python=no - for binary in python python2.4 python2.5; do + for binary in python python2.7; do ovs_save_IFS=$IFS; IFS=$PATH_SEPARATOR for dir in $PATH; do IFS=$ovs_save_IFS test -z "$dir" && dir=. if test -x "$dir"/"$binary" && "$dir"/"$binary" -c 'import sys -if sys.hexversion >= 0x02040000 and sys.hexversion < 0x03000000: +if sys.hexversion >= 0x02070000 and sys.hexversion < 0x03000000: sys.exit(0) else: sys.exit(1)'; then @@ -242,75 +365,6 @@ AC_DEFUN([OVS_CHECK_DOT], fi]) AM_CONDITIONAL([HAVE_DOT], [test "$ovs_cv_dot" = yes])]) -dnl Checks for pyuic4. -AC_DEFUN([OVS_CHECK_PYUIC4], - [AC_CACHE_CHECK( - [for pyuic4], - [ovs_cv_pyuic4], - [if (pyuic4 --version) >/dev/null 2>&1; then - ovs_cv_pyuic4=pyuic4 - else - ovs_cv_pyuic4=no - fi]) - AM_MISSING_PROG([PYUIC4], [pyuic4]) - if test $ovs_cv_pyuic4 != no; then - PYUIC4=$ovs_cv_pyuic4 - fi]) - -dnl Checks whether $PYTHON supports the module given as $1 -AC_DEFUN([OVS_CHECK_PYTHON_MODULE], - [AC_REQUIRE([OVS_CHECK_PYTHON]) - AC_CACHE_CHECK( - [for $1 Python module], - [ovs_cv_py_[]AS_TR_SH([$1])], - [ovs_cv_py_[]AS_TR_SH([$1])=no - if test $HAVE_PYTHON = yes; then - AS_ECHO(["running $PYTHON -c 'import $1 -import sys -sys.exit(0)'..."]) >&AS_MESSAGE_LOG_FD 2>&1 - if $PYTHON -c 'import $1 -import sys -sys.exit(0)' >&AS_MESSAGE_LOG_FD 2>&1; then - ovs_cv_py_[]AS_TR_SH([$1])=yes - fi - fi])]) - -dnl Checks for Python modules needed by ovsdbmonitor. -AC_DEFUN([OVS_CHECK_OVSDBMONITOR], - [OVS_CHECK_PYTHON_MODULE([PySide.QtCore]) - OVS_CHECK_PYTHON_MODULE([PyQt4.QtCore]) - OVS_CHECK_PYTHON_MODULE([twisted.conch.ssh]) - OVS_CHECK_PYTHON_MODULE([twisted.internet]) - OVS_CHECK_PYTHON_MODULE([twisted.application]) - OVS_CHECK_PYTHON_MODULE([json]) - OVS_CHECK_PYTHON_MODULE([zope.interface]) - if (test $ovs_cv_py_PySide_QtCore = yes \ - || test $ovs_cv_py_PyQt4_QtCore = yes) \ - && test $ovs_cv_py_twisted_conch_ssh = yes \ - && test $ovs_cv_py_twisted_internet = yes \ - && test $ovs_cv_py_twisted_application = yes \ - && test $ovs_cv_py_json = yes \ - && test $ovs_cv_py_zope_interface = yes; then - BUILD_OVSDBMONITOR=yes - else - BUILD_OVSDBMONITOR=no - fi - AC_MSG_CHECKING([whether to build ovsdbmonitor]) - AC_MSG_RESULT([$BUILD_OVSDBMONITOR]) - AM_CONDITIONAL([BUILD_OVSDBMONITOR], [test $BUILD_OVSDBMONITOR = yes])]) - -dnl Checks for missing python modules at build time -AC_DEFUN([OVS_CHECK_PYTHON_COMPAT], - [OVS_CHECK_PYTHON_MODULE([uuid]) - if test $ovs_cv_py_uuid = yes; then - INCLUDE_PYTHON_COMPAT=no - else - INCLUDE_PYTHON_COMPAT=yes - fi - AC_MSG_CHECKING([whether to add python/compat to PYTHONPATH]) - AC_MSG_RESULT([$INCLUDE_PYTHON_COMPAT]) - AM_CONDITIONAL([INCLUDE_PYTHON_COMPAT], [test $INCLUDE_PYTHON_COMPAT = yes])]) - dnl Checks for groff. AC_DEFUN([OVS_CHECK_GROFF], [AC_CACHE_CHECK( @@ -466,3 +520,12 @@ dnl OVS_CHECK_INCLUDE_NEXT AC_DEFUN([OVS_CHECK_INCLUDE_NEXT], [AC_REQUIRE([gl_CHECK_NEXT_HEADERS]) gl_CHECK_NEXT_HEADERS([$1])]) + +dnl OVS_CHECK_PRAGMA_MESSAGE +AC_DEFUN([OVS_CHECK_PRAGMA_MESSAGE], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[_Pragma("message(\"Checking for pragma message\")") + ]])], + [AC_DEFINE(HAVE_PRAGMA_MESSAGE,1,[Define if compiler supports #pragma + message directive])]) + ])