X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=m4%2Fopenvswitch.m4;h=fa85d3f300dd16e96f06b09a138a7eb11dbab87f;hb=8fb7d02686ed;hp=3f0d097d71184e93c440dc05572ea45495ab28ea;hpb=bd7fe4e925d73dff879a4a1ac19a4365365e0dd7;p=cascardo%2Fovs.git diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index 3f0d097d7..fa85d3f30 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -1,6 +1,6 @@ # -*- autoconf -*- -# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 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. @@ -30,7 +30,19 @@ AC_DEFUN([OVS_CHECK_COVERAGE], esac], [coverage=false]) if $coverage; then - OVS_CFLAGS="$OVS_CFLAGS -O0 --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]) @@ -58,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], @@ -74,9 +102,25 @@ AC_DEFUN([OVS_CHECK_WIN32], AC_MSG_ERROR([Invalid --with-pthread value]) ;; *) - PTHREAD_INCLUDES="-I$withval/include" - PTHREAD_LDFLAGS="-L$withval/lib/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=/$(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]) @@ -108,16 +152,14 @@ dnl OVS_CHECK_WINDOWS dnl dnl Configure Visual Studio solution build AC_DEFUN([OVS_CHECK_VISUAL_STUDIO_DDK], [ -AC_ARG_WITH([vstudioddk], - [AS_HELP_STRING([--with-vstudioddk=version_type], - [Visual Studio DDK version type e.g. Win8.1 Release])], +AC_ARG_WITH([vstudiotarget], + [AS_HELP_STRING([--with-vstudiotarget=target_type], + [Target type: Debug/Release])], [ case "$withval" in - "Win8.1 Release") ;; - "Win8.1 Debug") ;; - "Win8 Release") ;; - "Win8 Debug") ;; - *) AC_MSG_ERROR([No good Visual Studio configuration found]) ;; + "Release") ;; + "Debug") ;; + *) AC_MSG_ERROR([No valid Visual Studio configuration found]) ;; esac VSTUDIO_CONFIG=$withval @@ -127,7 +169,7 @@ AC_ARG_WITH([vstudioddk], ) AC_SUBST([VSTUDIO_CONFIG]) - AC_DEFINE([VSTUDIO_DDK], [1], [System uses the Visual Studio DDK version module.]) + AC_DEFINE([VSTUDIO_DDK], [1], [System uses the Visual Studio build target.]) AM_CONDITIONAL([VSTUDIO_DDK], [test -n "$VSTUDIO_CONFIG"]) ]) @@ -144,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( @@ -231,26 +309,30 @@ AC_DEFUN([OVS_CHECK_BACKTRACE], [AC_DEFINE([HAVE_BACKTRACE], [1], [Define to 1 if you have backtrace(3).])])]) +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 python2.7; 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 @@ -259,6 +341,12 @@ else: fi done done + if test $ovs_cv_python != no; then + if test -x "$ovs_cv_python" && ! "$ovs_cv_python" -c 'import six' >/dev/null 2>&1; then + ovs_cv_python=no + AC_MSG_WARN([Missing Python six library.]) + fi + fi fi]) AC_SUBST([HAVE_PYTHON]) AM_MISSING_PROG([PYTHON], [python]) @@ -270,6 +358,60 @@ else: fi AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])]) +dnl Checks for Python 3.x, x >= 4. +AC_DEFUN([OVS_CHECK_PYTHON3], + [AC_CACHE_CHECK( + [for Python 3.x for x >= 4], + [ovs_cv_python3], + [if test -n "$PYTHON3"; then + ovs_cv_python3=$PYTHON3 + else + ovs_cv_python3=no + for binary in python3 python3.4; 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 >= 0x03040000 and sys.hexversion < 0x04000000: + sys.exit(0) +else: + sys.exit(1)'; then + ovs_cv_python3=$dir/$binary + break 2 + fi + done + done + if test $ovs_cv_python != no; then + if test -x "$ovs_cv_python" && ! "$ovs_cv_python" -c 'import six' >/dev/null 2>&1; then + ovs_cv_python=no + AC_MSG_WARN([Missing Python six library.]) + fi + fi + fi]) + AC_SUBST([HAVE_PYTHON3]) + AM_MISSING_PROG([PYTHON3], [python3]) + if test $ovs_cv_python3 != no; then + PYTHON3=$ovs_cv_python3 + HAVE_PYTHON3=yes + else + HAVE_PYTHON3=no + fi + AM_CONDITIONAL([HAVE_PYTHON3], [test "$HAVE_PYTHON3" = yes])]) + + +dnl Checks for dot. +AC_DEFUN([OVS_CHECK_FLAKE8], + [AC_CACHE_CHECK( + [for flake8], + [ovs_cv_flake8], + [if flake8 --version >/dev/null 2>&1; then + ovs_cv_flake8=yes + else + ovs_cv_flake8=no + fi]) + AM_CONDITIONAL([HAVE_FLAKE8], [test "$ovs_cv_flake8" = yes])]) + dnl Checks for dot. AC_DEFUN([OVS_CHECK_DOT], [AC_CACHE_CHECK( @@ -283,36 +425,6 @@ AC_DEFUN([OVS_CHECK_DOT], fi]) AM_CONDITIONAL([HAVE_DOT], [test "$ovs_cv_dot" = yes])]) -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 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(