-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathconfigure.ac
209 lines (184 loc) · 6.81 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([of-config], [0.0.1], [])
AC_CONFIG_SRCDIR([server/server.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
# Must be checked before AC_PROG_CC that sets default -g -O2:
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [Enable build with debug symbols and without optimizations.]),
[if test "$enableval" = "yes"; then
CFLAGS="$CFLAGS -Wall -g -O0"
fi], [CFLAGS="$CFLAGS -Wall -O3"])
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PATH_PROGS(SSHD_PATH, [sshd], [])
if test -z "$SSHD_PATH"; then
AC_MSG_ERROR([sshd was not found])
fi
AC_DEFINE_DIR([SSHD_EXEC], [SSHD_PATH], [Path to sshd])
LT_INIT()
m4_pattern_forbid([LT_INIT]) dnl Make autoconf fail if libtool is missing.
# configuration parameters
AC_ARG_WITH([ovs-srcdir],
AC_HELP_STRING([--with-ovs-srcdir=PATH],[Set path to the OVS package directory (because of header files).]),
[CPPFLAGS+="-I${withval}/lib/ -I${withval}/include/ -I${withval}/include/openvswitch/"
LDFLAGS+="-L${withval}/lib/.libs/"
OVS_SRCDIR="${withval}"
AC_SUBST(OVS_SRCDIR)],
[AC_MSG_ERROR(Missing --with-ovs-srcdir that specifies path to the Open vSwitch repository.)]
)
AC_ARG_ENABLE([dbus],
AC_HELP_STRING([--disable-dbus], [Use UNIX sockets instead of DBus.]),
[if test "$enableval" = "no"; then
dbus="no"
CPPFLAGS="$CPPFLAGS -DDISABLE_DBUS"
else
dbus="yes"
fi], [# use DBus by default
dbus="yes"])
AM_CONDITIONAL(dbus, test x"$dbus" = x"yes")
# Checks for libraries.
AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"],
[AC_MSG_ERROR([pthread not found])])
# libnetconf
AC_ARG_WITH([libnetconf],
AC_HELP_STRING([--with-libnetconf=PATH],[Set explicit installation prefix to the libnetconf library]),
[CPPFLAGS="-I$withval/include/ $CPPFLAGS"
LIBS="-L$withval/lib/ -Wl,-rpath,$withval/lib $LIBS"
CONFIGURE_PARAMS="$CONFIGURE_PARAMS --with-libnetconf=$withval"
LIBNETCONF_DATADIR="$withval/share/"
],[
# get info from pkg-config about installed package
PKG_CHECK_MODULES(LIBNETCONF, libnetconf)
CPPFLAGS="$LIBNETCONF_CFLAGS $CPPFLAGS"
LIBS="$LIBNETCONF_LIBS $LIBS"
LIBNETCONF_DATADIR="`$PKG_CONFIG --variable=datadir libnetconf`"]
)
AC_SEARCH_LIBS([nc_init], [netconf], [], AC_MSG_ERROR([libnetconf not found.]))
AC_SEARCH_LIBS([ncntf_dispatch_receive], [netconf], [], AC_MSG_ERROR([libnetconf does not support notifications.]))
LIBS_SAVED="$LIBS"
LIBS=""
AC_SEARCH_LIBS([shm_open], [rt])
# openssl
AX_CHECK_OPENSSL([HAVE_SSL="1"], [AC_MSG_ERROR([openssl not found])])
if test "$HAVE_SSL" == "1"; then
LIBS="$OPENSSL_LIBS $LIBS"
LDFLAGS="$OPENSSL_LDFLAGS $LDFLAGS"
CFLAGS="$OPENSSL_CFLAGS $CFLAGS "
CC="$PTHREAD_CC"
fi
AC_SEARCH_LIBS([ovsrec_init], [openvswitch], [], [AC_MSG_ERROR([libopenvswitch.a was not found. Try --with-ovs-libpath])])
OVS_LIBS="$LIBS"
AC_SUBST(OVS_LIBS)
LIBS="$LIBS_SAVED"
AX_LIBXML2_CHECK()
if test "x$dbus" = "xyes"; then
# - library
AC_ARG_WITH([libdbus],
AC_HELP_STRING([--with-libdbus=PATH],[Set explicit installation prefix to the libdbus library]),
[CPPFLAGS="-I$withval/include/ $CPPFLAGS"
LIBS="-L$withval/lib/ -Wl,-rpath,$withval/lib $LIBS"
CONFIGURE_PARAMS="$CONFIGURE_PARAMS --with-libdbus=$withval"
],[
# get info from pkg-config about installed package
PKG_CHECK_MODULES(LIBDBUS, [dbus-1 >= 1.0.0])
CPPFLAGS="$LIBDBUS_CFLAGS $CPPFLAGS"
LIBS="$LIBDBUS_LIBS $LIBS"]
)
AC_SEARCH_LIBS([dbus_bus_get], [dbus-1], [], AC_MSG_ERROR([libdbus not found.]))
# - configuration directory
AC_ARG_WITH([dbus-config-dir],
AC_HELP_STRING([--with-dbus-config-dir=DIR],[path to D-Bus config files (/etc/dbus-1/system.d/ by default)]),
DBUSCONF="$withval"
,
DBUSCONF="/etc/dbus-1/system.d/"
)
AC_MSG_CHECKING([for existence of D-Bus configuration directory $DBUSCONF])
if test ! -d "$DBUSCONF"; then
AC_MSG_RESULT([missing])
AC_MSG_ERROR([Wrong D-Bus configuration path, $DBUSCONF does not exist.])
else
AC_MSG_RESULT([ok])
DBUSCONFFILE="$DBUSCONF/org.liberouter.netopeer.conf"
AC_SUBST(DBUSCONF)
AC_SUBST(DBUSCONFFILE)
fi
# - services directory
AC_ARG_WITH([dbus-services],
AC_HELP_STRING([--with-dbus-services@<:@=DIR@:>@],
[path to D-Bus services directory (/usr/share/dbus-1/system-services/ by default), \
if this parameter is not used, service file for netopeer-server is not installed!]),
[
if test "$withval" = "yes"; then
DBUSSERVICES="/usr/share/dbus-1/system-services/"
else
DBUSSERVICES="$withval"
fi
AC_MSG_CHECKING([for existence of D-Bus services directory $DBUSSERVICES])
if test ! -d "$DBUSSERVICES"; then
AC_MSG_RESULT([missing])
AC_MSG_ERROR([Wrong D-Bus service path, $DBUSSERVICES does not exist.])
else
AC_MSG_RESULT([ok])
AC_SUBST(DBUSSERVICES)
fi
CONFIGURE_PARAMS="$CONFIGURE_PARAMS --with-dbus-services=$DBUSSERVICES"
DBUSSERVICESFILE="$DBUSSERVICES/org.liberouter.netopeer.server.service"
AC_SUBST(DBUSSERVICES)
AC_SUBST(DBUSSERVICESFILE)
]
,
# do not install DBus service file anywhere
DBUSSERVICES=""
)
fi
OFC_CONFDIR="${sysconfdir}/ofconfig"
AC_SUBST([OFC_CONFDIR])
AC_DEFINE_DIR([OFC_CONFDIR], [OFC_CONFDIR], [Configuration files directory.])
OFC_DATADIR="${localstatedir}/ofconfig"
AC_SUBST([OFC_DATADIR])
AC_DEFINE_DIR([OFC_DATADIR], [OFC_DATADIR], [Datastore&model files directory.])
# for creation of config files (e.g. for DBUS) containing directories:
AC_DEFINE_DIR([CONF_BINDIR], [bindir], [Configured path to bin/ directory.])
# Checks for header files.
AC_CHECK_HEADERS([stdbool.h stdint.h stdlib.h string.h dynamic-string.h ovsdb-idl-provider.h vlog.h vswitch-idl.h])
AC_CHECK_HEADERS([linux/if_ether.h linux/types.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT64_T
# Checks for library functions.
AC_CHECK_FUNCS([strdup])
AC_CONFIG_FILES([Makefile
config/Makefile
config/org.opennetworking.ofc.server.service
model/Makefile
server/Makefile])
AC_OUTPUT
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo
echo "Configuration Options Summary:"
echo
echo " ASM.(32 bit only)..: $ASM"
echo " Static binary......: $static"
echo
echo "Documentation..........: ${build_doc}"
echo
echo "Compilation............: make (or gmake)"
echo " CPPFLAGS.............: $CPPFLAGS"
echo " CFLAGS...............: $CFLAGS"
echo " LDFLAGS..............: $LDFLAGS"
echo " LIBS.................: $LIBS"
echo
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...............: $prefix"
echo