1 # Copyright (c) 2008 The Board of Trustees of The Leland Stanford
4 # We are making the OpenFlow specification and associated documentation
5 # (Software) available for public use and benefit with the expectation
6 # that others will use, modify and enhance the Software and contribute
7 # those enhancements back to the community. However, since we would
8 # like to make the Software available for broadest use, with as few
9 # restrictions as possible permission is hereby granted, free of
10 # charge, to any person obtaining a copy of this Software to deal in
11 # the Software under the copyrights without restriction, including
12 # without limitation the rights to use, copy, modify, merge, publish,
13 # distribute, sublicense, and/or sell copies of the Software, and to
14 # permit persons to whom the Software is furnished to do so, subject to
15 # the following conditions:
17 # The above copyright notice and this permission notice shall be
18 # included in all copies or substantial portions of the Software.
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
24 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 # The name and trademarks of copyright holder(s) may NOT be used in
30 # advertising or publicity pertaining to the Software or any
31 # derivatives without specific, written prior permission.
33 dnl Checks for --enable-ndebug and defines NDEBUG if it is specified.
34 AC_DEFUN([OFP_CHECK_NDEBUG],
37 [AC_HELP_STRING([--enable-ndebug],
38 [Disable debugging features for max performance])],
39 [case "${enableval}" in
42 (*) AC_MSG_ERROR([bad value ${enableval} for --enable-ndebug]) ;;
45 AM_CONDITIONAL([NDEBUG], [test x$ndebug = xtrue])])
47 dnl Checks for Netlink support.
48 AC_DEFUN([OFP_CHECK_NETLINK],
49 [AC_CHECK_HEADER([linux/netlink.h],
52 [#include <sys/socket.h>
53 #include <linux/types.h>
55 AM_CONDITIONAL([HAVE_NETLINK], [test "$HAVE_NETLINK" = yes])
56 if test "$HAVE_NETLINK" = yes; then
57 AC_DEFINE([HAVE_NETLINK], [1],
58 [Define to 1 if Netlink protocol is available.])
61 dnl Checks for OpenSSL, if --enable-ssl is passed in.
62 AC_DEFUN([OFP_CHECK_OPENSSL],
65 [AC_HELP_STRING([--enable-ssl],
66 [Enable ssl support (requires libssl)])],
67 [case "${enableval}" in
70 (*) AC_MSG_ERROR([bad value ${enableval} for --enable-ssl]) ;;
74 if test "$ssl" = true; then
75 dnl Make sure that pkg-config is installed.
76 m4_pattern_forbid([PKG_CHECK_MODULES])
77 PKG_CHECK_MODULES([SSL], [libssl],
80 AC_MSG_WARN([Cannot find libssl:
84 OpenFlow will not support SSL connections.])])
87 AM_CONDITIONAL([HAVE_OPENSSL], [test "$HAVE_OPENSSL" = yes])
88 if test "$HAVE_OPENSSL" = yes; then
89 AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if OpenSSL is installed.])
92 dnl Checks for libraries needed by lib/fault.c.
93 AC_DEFUN([OFP_CHECK_FAULT_LIBS],
94 [AC_CHECK_LIB([dl], [dladdr], [FAULT_LIBS=-ldl])
95 AC_SUBST([FAULT_LIBS])])
97 dnl Checks for libraries needed by lib/socket-util.c.
98 AC_DEFUN([OFP_CHECK_SOCKET_LIBS],
99 [AC_CHECK_LIB([socket], [connect])
100 AC_SEARCH_LIBS([gethostbyname], [resolv], [RESOLVER_LIBS=-lresolv])])
102 dnl Runs the checks required to include the headers in include/ and
103 dnl link against lib/libopenflow.a.
104 AC_DEFUN([OFP_CHECK_LIBOPENFLOW],
105 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
106 AC_REQUIRE([OFP_CHECK_NDEBUG])
107 AC_REQUIRE([OFP_CHECK_NETLINK])
108 AC_REQUIRE([OFP_CHECK_OPENSSL])
109 AC_REQUIRE([OFP_CHECK_FAULT_LIBS])
110 AC_REQUIRE([OFP_CHECK_SOCKET_LIBS])])