Add license notice to acinclude.m4, configure.ac.
[sliver-openvswitch.git] / configure.ac
1 # Copyright (c) 2008 The Board of Trustees of The Leland Stanford
2 # Junior University
3 #
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:
16 #
17 # The above copyright notice and this permission notice shall be
18 # included in all copies or substantial portions of the Software.
19 #
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
27 # SOFTWARE.
28 #
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.
32
33 AC_PREREQ(2.59)
34 AC_INIT(openflow, v0.8.1, info@openflowswitch.org)
35 AC_CONFIG_HEADERS([config.h])
36 AM_INIT_AUTOMAKE
37
38 AC_PROG_CC
39 AC_PROG_CPP
40 AC_PROG_RANLIB
41
42 AC_ARG_VAR([PERL], [path to Perl interpreter])
43 AC_PATH_PROG([PERL], perl, no)
44 if test "$PERL" = no; then
45    AC_MSG_ERROR([Perl interpreter not found in $PATH or $PERL.])
46 fi
47
48 AC_USE_SYSTEM_EXTENSIONS
49
50 AC_ARG_ENABLE(
51   [ndebug],
52   [AC_HELP_STRING([--enable-ndebug], 
53                   [Disable debugging features for max performance])],
54   [case "${enableval}" in # (
55      yes) ndebug=true ;; # (
56      no)  ndebug=false ;; # (
57      *) AC_MSG_ERROR([bad value ${enableval} for --enable-ndebug]) ;;
58    esac],
59   [ndebug=false])
60 AM_CONDITIONAL([NDEBUG], [test x$ndebug = xtrue])
61
62 AC_ARG_ENABLE(
63   [hw-tables],
64   [AC_HELP_STRING([--enable-hw-tables=MODULE...],
65                   [Configure and build the specified externally supplied 
66                    hardware table support modules])])
67 case "${enable_hw_tables}" in # (
68   yes) 
69     AC_MSG_ERROR([--enable-hw-tables has a required argument])
70     ;; # (
71   ''|no) 
72     hw_tables=
73     ;; # (
74   *) 
75     hw_tables=`echo "$enable_hw_tables" | sed 's/,/ /g'`
76     ;;
77 esac
78 for d in $hw_tables; do
79     mk=datapath/hwtable_$d/Modules.mk
80     if test ! -e $srcdir/$mk; then
81        AC_MSG_ERROR([--enable-hw-tables=$d specified but $mk is missing])
82     fi
83     HW_TABLES="$HW_TABLES \$(top_srcdir)/$mk"
84 done
85 AC_SUBST(HW_TABLES)
86
87 AC_ARG_VAR(KARCH, [Kernel Architecture String])
88 AC_SUBST(KARCH)
89
90 CHECK_LINUX(l26, 2.6, 2.6, KSRC26, L26_ENABLED)
91 CHECK_LINUX(l24, 2.4, 2.4, KSRC24, L24_ENABLED)
92
93 AC_CHECK_HEADER([linux/netlink.h],
94                 [HAVE_NETLINK=yes],
95                 [HAVE_NETLINK=no],
96                 [#include <sys/socket.h>
97 #include <linux/types.h>])
98 AM_CONDITIONAL([HAVE_NETLINK], [test "$HAVE_NETLINK" = yes])
99 if test "$HAVE_NETLINK" = yes; then
100    AC_DEFINE([HAVE_NETLINK], [1],
101              [Define to 1 if Netlink protocol is available.])
102 fi
103
104 AC_CHECK_HEADER([net/if_packet.h],
105                 [HAVE_IF_PACKET=yes],
106                 [HAVE_IF_PACKET=no])
107 AM_CONDITIONAL([HAVE_IF_PACKET], [test "$HAVE_IF_PACKET" = yes])
108 if test "$HAVE_IF_PACKET" = yes; then
109    AC_DEFINE([HAVE_IF_PACKET], [1],
110              [Define to 1 if net/if_packet.h is available.])
111 fi
112
113 AC_ARG_ENABLE(
114   [ssl],
115   [AC_HELP_STRING([--enable-ssl], 
116                   [Enable ssl support (requires libssl)])],
117   [case "${enableval}" in # (
118      yes) ssl=true ;;  # (
119      no)  ssl=false ;; # (
120      *) AC_MSG_ERROR([bad value ${enableval} for --enable-ssl]) ;;
121    esac],
122   [ssl=false])
123
124 if test "$ssl" = true; then
125 dnl Make sure that pkg-config is installed.
126 m4_pattern_forbid([PKG_CHECK_MODULES])
127 PKG_CHECK_MODULES([SSL], [libssl], 
128   [HAVE_OPENSSL=yes],
129   [HAVE_OPENSSL=no
130    AC_MSG_WARN([Cannot find libssl:
131
132 $SSL_PKG_ERRORS
133
134 OpenFlow will not support SSL connections.])])
135
136 fi
137 AM_CONDITIONAL([HAVE_OPENSSL], [test "$HAVE_OPENSSL" = yes])
138 if test "$HAVE_OPENSSL" = yes; then
139    AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if OpenSSL is installed.])
140 fi
141
142 AC_CHECK_LIB([socket], [connect])
143 AC_SEARCH_LIBS([gethostbyname], [resolv], [RESOLVER_LIBS=-lresolv])
144 AC_CHECK_LIB([dl], [dladdr], [FAULT_LIBS=-ldl])
145 AC_SUBST([FAULT_LIBS])
146
147 CFLAGS="$CFLAGS -Wall -Wno-sign-compare"
148
149 AC_CONFIG_FILES([Makefile 
150 datapath/Makefile 
151 lib/Makefile
152 include/Makefile
153 controller/Makefile
154 utilities/Makefile
155 secchan/Makefile
156 switch/Makefile
157 tests/Makefile
158 datapath/tests/Makefile
159 third-party/Makefile
160 datapath/linux-2.6/Kbuild
161 datapath/linux-2.6/Makefile
162 datapath/linux-2.6/Makefile.main
163 datapath/linux-2.4/Kbuild
164 datapath/linux-2.4/Makefile
165 datapath/linux-2.4/Makefile.main])
166
167 AC_OUTPUT