3 # Copyright (c) 2008 The Board of Trustees of The Leland Stanford
6 # We are making the OpenFlow specification and associated documentation
7 # (Software) available for public use and benefit with the expectation
8 # that others will use, modify and enhance the Software and contribute
9 # those enhancements back to the community. However, since we would
10 # like to make the Software available for broadest use, with as few
11 # restrictions as possible permission is hereby granted, free of
12 # charge, to any person obtaining a copy of this Software to deal in
13 # the Software under the copyrights without restriction, including
14 # without limitation the rights to use, copy, modify, merge, publish,
15 # distribute, sublicense, and/or sell copies of the Software, and to
16 # permit persons to whom the Software is furnished to do so, subject to
17 # the following conditions:
19 # The above copyright notice and this permission notice shall be
20 # included in all copies or substantial portions of the Software.
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 # The name and trademarks of copyright holder(s) may NOT be used in
32 # advertising or publicity pertaining to the Software or any
33 # derivatives without specific, written prior permission.
35 dnl Checks for --enable-ndebug and defines NDEBUG if it is specified.
36 AC_DEFUN([OFP_CHECK_NDEBUG],
39 [AC_HELP_STRING([--enable-ndebug],
40 [Disable debugging features for max performance])],
41 [case "${enableval}" in
44 (*) AC_MSG_ERROR([bad value ${enableval} for --enable-ndebug]) ;;
47 AM_CONDITIONAL([NDEBUG], [test x$ndebug = xtrue])])
49 dnl Checks for Netlink support.
50 AC_DEFUN([OFP_CHECK_NETLINK],
51 [AC_CHECK_HEADER([linux/netlink.h],
54 [#include <sys/socket.h>
55 #include <linux/types.h>
57 AM_CONDITIONAL([HAVE_NETLINK], [test "$HAVE_NETLINK" = yes])
58 if test "$HAVE_NETLINK" = yes; then
59 AC_DEFINE([HAVE_NETLINK], [1],
60 [Define to 1 if Netlink protocol is available.])
63 dnl Checks for OpenSSL, if --enable-ssl is passed in.
64 AC_DEFUN([OFP_CHECK_OPENSSL],
67 [AC_HELP_STRING([--enable-ssl],
68 [Enable ssl support (requires libssl)])],
69 [case "${enableval}" in
72 (*) AC_MSG_ERROR([bad value ${enableval} for --enable-ssl]) ;;
76 if test "$ssl" = true; then
77 dnl Make sure that pkg-config is installed.
78 m4_pattern_forbid([PKG_CHECK_MODULES])
79 PKG_CHECK_MODULES([SSL], [libssl],
82 AC_MSG_WARN([Cannot find libssl:
86 OpenFlow will not support SSL connections.])])
89 AM_CONDITIONAL([HAVE_OPENSSL], [test "$HAVE_OPENSSL" = yes])
90 if test "$HAVE_OPENSSL" = yes; then
91 AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if OpenSSL is installed.])
94 dnl Checks for --enable-snat and defines SUPPORT_SNAT if it is specified.
95 AC_DEFUN([OFP_CHECK_SNAT],
98 [AC_HELP_STRING([--enable-snat],
99 [Enable support for source-NAT action])],
100 [case "${enableval}" in
103 (*) AC_MSG_ERROR([bad value ${enableval} for --enable-snat]) ;;
106 AM_CONDITIONAL([SUPPORT_SNAT], [test x$snat = xtrue])
107 if test x$snat = xtrue; then
108 AC_DEFINE([SUPPORT_SNAT], [1], [Define to 1 if SNAT is desired.])
109 SUPPORT_SNAT=-DSUPPORT_SNAT
110 AC_SUBST([SUPPORT_SNAT])
113 dnl Checks for libraries needed by lib/fault.c.
114 AC_DEFUN([OFP_CHECK_FAULT_LIBS],
115 [AC_CHECK_LIB([dl], [dladdr], [FAULT_LIBS=-ldl])
116 AC_SUBST([FAULT_LIBS])])
118 dnl Checks for libraries needed by lib/socket-util.c.
119 AC_DEFUN([OFP_CHECK_SOCKET_LIBS],
120 [AC_CHECK_LIB([socket], [connect])
121 AC_SEARCH_LIBS([gethostbyname], [resolv], [RESOLVER_LIBS=-lresolv])])
123 dnl Checks for the directory in which to store the PKI.
124 AC_DEFUN([OFP_CHECK_PKIDIR],
127 AC_HELP_STRING([--with-pkidir=DIR],
128 [PKI hierarchy directory [[DATADIR/openflow/pki]]]),
130 [PKIDIR='${pkgdatadir}/pki'])
133 dnl Checks for the directory in which to store pidfiles.
134 AC_DEFUN([OFP_CHECK_RUNDIR],
137 AC_HELP_STRING([--with-rundir=DIR],
138 [directory used for pidfiles [[LOCALSTATEDIR/run]]]),
140 [RUNDIR='${localstatedir}/run'])
143 dnl Checks for the directory in which to store logs.
144 AC_DEFUN([OFP_CHECK_LOGDIR],
147 AC_HELP_STRING([--with-logdir=DIR],
148 [directory used for logs [[LOCALSTATEDIR/log/PACKAGE]]]),
150 [LOGDIR='${localstatedir}/log/${PACKAGE}'])
153 dnl Runs the checks required to include the headers in include/ and
154 dnl link against lib/libopenflow.a.
155 AC_DEFUN([OFP_CHECK_LIBOPENFLOW],
156 [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
157 AC_REQUIRE([OFP_CHECK_NDEBUG])
158 AC_REQUIRE([OFP_CHECK_NETLINK])
159 AC_REQUIRE([OFP_CHECK_OPENSSL])
160 AC_REQUIRE([OFP_CHECK_SNAT])
161 AC_REQUIRE([OFP_CHECK_FAULT_LIBS])
162 AC_REQUIRE([OFP_CHECK_SOCKET_LIBS])
163 AC_REQUIRE([OFP_CHECK_PKIDIR])
164 AC_REQUIRE([OFP_CHECK_RUNDIR])
165 AC_REQUIRE([OFP_CHECK_LOGDIR])
166 AC_CHECK_FUNCS([strlcpy])])