Modified the naming scheme for hardware tables.
[sliver-openvswitch.git] / configure.ac
1 AC_PREREQ(2.59)
2 AC_INIT(openflow, v0.8.1, info@openflowswitch.org)
3 AM_INIT_AUTOMAKE
4
5 AC_PROG_CC
6 AC_PROG_CPP
7 AC_PROG_LD
8
9 AC_ARG_VAR([PERL], [path to Perl interpreter])
10 AC_PATH_PROG([PERL], perl, no)
11 if test "$PERL" = no; then
12    AC_MSG_ERROR([Perl interpreter not found in $PATH or $PERL.])
13 fi
14
15 AC_USE_SYSTEM_EXTENSIONS
16
17 AC_PROG_LIBTOOL
18
19 AC_ARG_ENABLE(
20   [ndebug],
21   [AC_HELP_STRING([--enable-ndebug], 
22                   [Disable debugging features for max performance])],
23   [case "${enableval}" in # (
24      yes) ndebug=true ;; # (
25      no)  ndebug=false ;; # (
26      *) AC_MSG_ERROR([bad value ${enableval} for --enable-ndebug]) ;;
27    esac],
28   [ndebug=false])
29 AM_CONDITIONAL([NDEBUG], [test x$ndebug = xtrue])
30
31 AC_ARG_ENABLE(
32   [hw-tables],
33   [AC_HELP_STRING([--enable-hw-tables=MODULE...],
34                   [Configure and build the specified externally supplied 
35                    hardware table support modules])])
36 case "${enable_hw_tables}" in # (
37   yes) 
38     AC_MSG_ERROR([--enable-hw-tables has a required argument])
39     ;; # (
40   ''|no) 
41     hw_tables=
42     ;; # (
43   *) 
44     hw_tables=`echo "$enable_hw_tables" | sed 's/,/ /g'`
45     ;;
46 esac
47 for d in $hw_tables; do
48     mk=datapath/hwtable_$d/Modules.mk
49     if test ! -e $srcdir/$mk; then
50        AC_MSG_ERROR([--enable-hw-tables=$d specified but $mk is missing])
51     fi
52     HW_TABLES="$HW_TABLES \$(top_srcdir)/$mk"
53 done
54 AC_SUBST(HW_TABLES)
55
56 AC_ARG_VAR(KARCH, [Kernel Architecture String])
57 AC_SUBST(KARCH)
58
59 CHECK_LINUX(l26, 2.6, 2.6, KSRC26, L26_ENABLED)
60 CHECK_LINUX(l24, 2.4, 2.4, KSRC24, L24_ENABLED)
61
62 AC_CHECK_HEADER([linux/netlink.h],
63                 [HAVE_NETLINK=yes],
64                 [HAVE_NETLINK=no],
65                 [#include <sys/socket.h>
66 #include <linux/types.h>])
67 AM_CONDITIONAL([HAVE_NETLINK], [test "$HAVE_NETLINK" = yes])
68 if test "$HAVE_NETLINK" = yes; then
69    AC_DEFINE([HAVE_NETLINK], [1],
70              [Define to 1 if Netlink protocol is available.])
71 fi
72
73 AC_CHECK_HEADER([net/if_packet.h],
74                 [HAVE_IF_PACKET=yes],
75                 [HAVE_IF_PACKET=no])
76 AM_CONDITIONAL([HAVE_IF_PACKET], [test "$HAVE_IF_PACKET" = yes])
77 if test "$HAVE_IF_PACKET" = yes; then
78    AC_DEFINE([HAVE_IF_PACKET], [1],
79              [Define to 1 if net/if_packet.h is available.])
80 fi
81
82 AC_ARG_ENABLE(
83   [ssl],
84   [AC_HELP_STRING([--enable-ssl], 
85                   [Enable ssl support (requires libssl)])],
86   [case "${enableval}" in # (
87      yes) ssl=true ;;  # (
88      no)  ssl=false ;; # (
89      *) AC_MSG_ERROR([bad value ${enableval} for --enable-ssl]) ;;
90    esac],
91   [ssl=false])
92
93 if test "$ssl" = true; then
94 dnl Make sure that pkg-config is installed.
95 m4_pattern_forbid([PKG_CHECK_MODULES])
96 PKG_CHECK_MODULES([SSL], [libssl], 
97   [HAVE_OPENSSL=yes],
98   [HAVE_OPENSSL=no
99    AC_MSG_WARN([Cannot find libssl:
100
101 $SSL_PKG_ERRORS
102
103 OpenFlow will not support SSL connections.])])
104
105 fi
106 AM_CONDITIONAL([HAVE_OPENSSL], [test "$HAVE_OPENSSL" = yes])
107 if test "$HAVE_OPENSSL" = yes; then
108    AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if OpenSSL is installed.])
109 fi
110
111 AC_CHECK_LIB([socket], [connect])
112 AC_CHECK_LIB([resolv], [gethostbyname])
113 AC_CHECK_LIB([dl], [dladdr])
114
115 CFLAGS="$CFLAGS -Wall -Wno-sign-compare"
116
117 AC_CONFIG_FILES([Makefile 
118 datapath/Makefile 
119 lib/Makefile
120 include/Makefile
121 controller/Makefile
122 utilities/Makefile
123 secchan/Makefile
124 switch/Makefile
125 tests/Makefile
126 datapath/tests/Makefile
127 third-party/Makefile
128 datapath/linux-2.6/Kbuild
129 datapath/linux-2.6/Makefile
130 datapath/linux-2.6/Makefile.main
131 datapath/linux-2.4/Kbuild
132 datapath/linux-2.4/Makefile
133 datapath/linux-2.4/Makefile.main])
134
135 AC_OUTPUT