X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=m4%2Fopenvswitch.m4;h=861e4ebd80df1ed0530a9231e20e91df944cd6a6;hb=b63fadcfdc8a96ddb5e944b60733edf21999a1ad;hp=7b23516a4049f4ffad07ec839886aeb094b27735;hpb=064af42167bf4fc9aaea2702d80ce08074b889c0;p=openvswitch diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index 7b23516a..861e4ebd 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -1,18 +1,36 @@ # -*- autoconf -*- -# Copyright (c) 2008, 2009 Nicira Networks. +# Copyright (c) 2008, 2009, 2010 Nicira Networks. # -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: # -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +dnl Checks for --enable-coverage and updates CFLAGS and LDFLAGS appropriately. +AC_DEFUN([OVS_CHECK_COVERAGE], + [AC_REQUIRE([AC_PROG_CC]) + AC_ARG_ENABLE( + [coverage], + [AC_HELP_STRING([--enable-coverage], + [Enable gcov coverage tool.])], + [case "${enableval}" in + (lcov|yes) coverage=true ;; + (no) coverage=false ;; + (*) AC_MSG_ERROR([bad value ${enableval} for --enable-coverage]) ;; + esac], + [coverage=false]) + if $coverage; then + CFLAGS="$CFLAGS -O0 --coverage" + LDFLAGS="$LDFLAGS --coverage" + fi]) dnl Checks for --enable-ndebug and defines NDEBUG if it is specified. AC_DEFUN([OVS_CHECK_NDEBUG], @@ -56,28 +74,25 @@ AC_DEFUN([OVS_CHECK_OPENSSL], [ssl=false]) if test "$ssl" = true; then - dnl Make sure that pkg-config is installed. - m4_pattern_forbid([PKG_CHECK_MODULES]) - PKG_CHECK_MODULES([SSL], [libssl], - [HAVE_OPENSSL=yes], - [HAVE_OPENSSL=no - AC_MSG_WARN([Cannot find libssl: + dnl Make sure that pkg-config is installed. + m4_pattern_forbid([PKG_CHECK_MODULES]) + PKG_CHECK_MODULES([SSL], [libssl], + [HAVE_OPENSSL=yes], + [HAVE_OPENSSL=no + AC_MSG_WARN([Cannot find libssl: - $SSL_PKG_ERRORS - - OpenFlow connections over SSL will not be supported.])]) +$SSL_PKG_ERRORS +OpenFlow connections over SSL will not be supported.])]) + else + HAVE_OPENSSL=no fi + AC_SUBST([HAVE_OPENSSL]) AM_CONDITIONAL([HAVE_OPENSSL], [test "$HAVE_OPENSSL" = yes]) if test "$HAVE_OPENSSL" = yes; then AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if OpenSSL is installed.]) fi]) -dnl Checks for libraries needed by lib/fault.c. -AC_DEFUN([OVS_CHECK_FAULT_LIBS], - [AC_CHECK_LIB([dl], [dladdr], [FAULT_LIBS=-ldl]) - AC_SUBST([FAULT_LIBS])]) - dnl Checks for libraries needed by lib/socket-util.c. AC_DEFUN([OVS_CHECK_SOCKET_LIBS], [AC_CHECK_LIB([socket], [connect]) @@ -200,11 +215,63 @@ AC_DEFUN([OVS_CHECK_LINUX_VT_H], fi]) dnl Checks for libpcre. +dnl +dnl ovsdb wants any reasonable version of libpcre (6.6 is what +dnl XenServer 5.5 has). +dnl +dnl ezio-term wants libpcre that supports the PCRE_PARTIAL feature, +dnl which is libpcre 7.2 or later. AC_DEFUN([OVS_CHECK_PCRE], [dnl Make sure that pkg-config is installed. m4_pattern_forbid([PKG_CHECK_MODULES]) - PKG_CHECK_MODULES([PCRE], [libpcre], [HAVE_PCRE=yes], [HAVE_PCRE=no]) + PKG_CHECK_MODULES([PCRE], + [libpcre >= 6.6], + [HAVE_PCRE=yes + PKG_CHECK_EXISTS([libpcre >= 7.2], + [HAVE_PCRE_PARTIAL=yes], + [HAVE_PCRE_PARTIAL=no])], + [HAVE_PCRE=no + HAVE_PCRE_PARTIAL=no]) AM_CONDITIONAL([HAVE_PCRE], [test "$HAVE_PCRE" = yes]) + AM_CONDITIONAL([HAVE_PCRE_PARTIAL], [test "$HAVE_PCRE_PARTIAL" = yes]) if test "$HAVE_PCRE" = yes; then AC_DEFINE([HAVE_PCRE], [1], [Define to 1 if libpcre is installed.]) - fi]) + fi + AC_SUBST([HAVE_PCRE]) + AC_SUBST([HAVE_PCRE_PARTIAL]) +]) + +dnl Checks for Python 2.x, x >= 4. +AC_DEFUN([OVS_CHECK_PYTHON], + [AC_CACHE_CHECK( + [for Python 2.x for x >= 4], + [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 + 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: + sys.exit(0) +else: + sys.exit(1)'; then + ovs_cv_python=$dir/$binary + break 2 + fi + done + done + fi]) + AC_SUBST([HAVE_PYTHON]) + AM_MISSING_PROG([PYTHON], [python]) + if test $ovs_cv_python != no; then + PYTHON=$ovs_cv_python + HAVE_PYTHON=yes + else + HAVE_PYTHON=no + fi + AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])