forked from kkovaacs/zorp
-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
448 lines (355 loc) · 13.9 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
dnl Process this file with autoconf to produce a configure script.
dnl
dnl There are a couple of environment defined variables which this script
dnl makes use of in addition to the standard CXXFLAGS/LDFLAGS/etc. These are:
dnl
dnl RELEASE_TAG - Debian release tag which is put to debian/changelog
dnl
AC_CONFIG_SRCDIR([zorp/main.cc])
AC_INIT([zorp], m4_esyscmd([tr -d '\n' < VERSION]))
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_MACRO_DIR([m4])
dnl ***************************************************************************
dnl Definitions
BROCHURE_VERSION="7"
ZORP_PRODUCT_NAME="Zorp Professional"
dnl ***************************************************************************
dnl Dependencies
GLIB_MIN_VERSION="2.32.0"
ZORPLL_MIN_VERSION="7.0.1.0"
ZORPLIC_MIN_VERSION="7.0.1.0"
ZORPMISC_MIN_VERSION="7.0.1.0"
OPENSSL_MIN_VERSION=1.1.0
OPENSSL_MAX_VERSION=1.1.2
PYTHON_MIN_VERSION="2.7"
PYTHON_MAX_VERSION="2.8"
m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python2.7])
dnl ***************************************************************************
dnl Initial setup
# We want an absolute path to the source-dir.
case "$srcdir" in
/*)
top_srcdir=$srcdir
;;
*)
oldsrcdir="$srcdir"
top_srcdir="`cd \"$srcdir\"; pwd`"
;;
esac
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
if test -z "$RELEASE_TAG"; then
RELEASE_TAG=zorp35dbg
fi
AM_CONFIG_HEADER(lib/zorp/zorpconfig.h)
AC_PREFIX_DEFAULT(/usr/local)
zorp_srcdir=$top_srcdir
AC_ARG_ENABLE(trace,
[ --enable-trace Enable debug information & messages (default: no)],,
enable_trace=no)
AC_ARG_ENABLE(werror,
[ --enable-werror When enabled, consider compiler warnings as errors (default: yes)],,
enable_werror=yes)
AC_ARG_ENABLE(coverage,
[ --enable-coverage Enable runtime coverage information generation (default: no)],,
enable_coverage=no)
AC_ARG_ENABLE(ip_options,
[ --enable-ip-options Enable handling IP options (EXPERIMENTAL)],,
enable_ip_options=no)
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 Enable IPv6 support (EXPERIMENTAL)],,
enable_ipv6=yes)
AC_ARG_ENABLE(prefork,
[ --enable-prefork Enable prefork],,
enable_prefork=no)
AC_ARG_ENABLE(predictable_random,
[ --enable-predictable-random Enable predictable random],,
enable_predictable_random=no)
AC_ARG_ENABLE(kzorp,
[ --enable-kzorp Enable kzorp],,
enable_kzorp=yes)
ZORP_MUNIN_CONF_DIR="${sysconfdir}/munin/plugin-conf.d"
ZORP_NAGIOS_CONF_DIR="${sysconfdir}/nagios/nrpe.d"
ZORP_SUDOERSD_CONF_DIR="${sysconfdir}/sudoers.d"
dnl Library versioning, the resulting shared object is named:
dnl zorplib-<RELEASE>.so.<AGE>
dnl
VERSION_NOSNAPSHOT="`echo $VERSION | cut -d '+' -f 1 | cut -d '~' -f 1`"
VERSION_MAJOR=`echo $VERSION_NOSNAPSHOT | cut -d '.' -f 1`
VERSION_MINOR=`echo $VERSION_NOSNAPSHOT | cut -d '.' -f 2`
VERSION_COMPAT=`echo $VERSION_NOSNAPSHOT | cut -d '.' -f 3`
LIBZORP_LT_RELEASE="$VERSION_MAJOR.$VERSION_MINOR"
LIBZORP_LT_COMPAT_BRANCH="$VERSION_MAJOR.$VERSION_MINOR-$VERSION_COMPAT"
LIBZORP_LT_COMPAT_PL="$VERSION_COMPAT"
dnl ***************************************************************************
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_MKDIR_P
AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
AX_CXX_MIN_VERSION_CHECK
AC_DISABLE_STATIC
AC_LANG(C++)
AM_PROG_LIBTOOL
dnl ***************************************************************************
dnl Checks for header files.
AC_CHECK_HEADERS(sys/capability.h sys/prctl.h sys/syscall.h limits.h stdbool.h stdint.h)
AC_CHECK_HEADERS([sys/thr.h])
AC_CHECK_HEADERS([arpa/inet.h])
AC_CHECK_HEADERS([linux/netlink.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_CACHE_CHECK(for MSG_PROXY, blb_cv_msg_proxy,
[AC_EGREP_CPP(MSG_PROXY,
[
#include <sys/types.h>
#include <sys/socket.h>
#ifdef MSG_PROXY
MSG_PROXY
#endif
],
blb_cv_msg_proxy=yes,
blb_cv_msg_proxy=no)])
if test "x$blb_cv_msg_proxy" = "xyes"; then
AC_DEFINE(HAVE_MSG_PROXY, 1, [Have MSG_PROXY flag (Linux 2.2)])
fi
dnl ***************************************************************************
dnl Checks for libraries.
dnl Checks for library functions.
AC_CHECK_LIB(socket, setsockopt, SOCK_LIBS="$SOCK_LIBS -lsocket")
AC_CHECK_LIB(xnet, inet_addr, SOCK_LIBS="$SOCK_LIBS -lxnet")
AC_CHECK_LIB(nsl, gethostbyname, SOCK_LIBS="$SOCK_LIBS -lnsl")
dnl Python might required -ldl, -lutil & -lm
AC_CHECK_LIB(rt, aio_read, PYTHON_DEPS="$PYTHON_DEPS -lrt")
AC_CHECK_LIB(m, sin, PYTHON_DEPS="$PYTHON_DEPS -lm")
AC_CHECK_LIB(util, openpty, PYTHON_DEPS="$PYTHON_DEPS -lutil")
AC_CHECK_LIB(dl, dlsym, PYTHON_DEPS="$PYTHON_DEPS -ldl")
AC_CHECK_LIB(z, inflate, ZLIB_LIBS="$ZLIB_LIBS -lz")
AC_CHECK_FUNCS(socket,,AC_MSG_ERROR(Cannot find socket in C library))
AC_CHECK_FUNCS(select snprintf vsnprintf strerror inet_aton)
AC_CHECK_FUNCS(prctl gethostbyname_r)
AC_CACHE_CHECK(for PR_SET_DUMPABLE, blb_cv_dumpable,
[AC_EGREP_CPP(PR_SET_DUMPABLE,
[
#include <sys/prctl.h>
PR_SET_DUMPABLE
],
blb_cv_dumpable=no,
blb_cv_dumpable=yes)])
if test "x$blb_cv_dumpable" = "xyes"; then
AC_DEFINE(HAVE_PR_SET_DUMPABLE, 1, [Zorp may enable core_dumping Linux 2.4-])
fi
AM_PATH_PYTHON([$PYTHON_MIN_VERSION],,)
AM_CONDITIONAL([PYTHON_VERSION_MATCHES], [test "x$PYTHON_VERSION" = "x$PYTHON_MIN_VERSION"])
AM_COND_IF([PYTHON_VERSION_MATCHES],, AC_MSG_ERROR(Cannot find Python version = $PYTHON_MIN_VERSION))
AC_CHECK_DECLS([IP_FREEBIND], [], [], [[#include <linux/in.h>]])
AC_CHECK_DECLS([IP_TRANSPARENT], [], [], [[#include <linux/in.h>]])
AC_CHECK_DECLS([IPV6_TRANSPARENT], [], [], [[#include <linux/in6.h>]])
AC_CHECK_DECLS([IP_BINDANY], [], [], [#include <netinet/in.h>])
AC_CHECK_DECLS([IPV6_BINDANY], [], [], [[#include <netinet6/in6.h>]])
AC_CHECK_DECLS([TCP_CORK], [], [], [[#include <linux/tcp.h>]])
AC_CHECK_DECLS([TCP_NOPUSH], [], [], [[#include <netinet/tcp.h>]])
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_MIN_VERSION,,
AC_MSG_ERROR(Cannot find GLib library version >= $GLIB_MIN_VERSION: is pkg-config in path?))
PKG_CHECK_MODULES(GMODULE, gmodule-2.0 >= $GLIB_MIN_VERSION,,
AC_MSG_ERROR(Cannot find GModule library version >= $GLIB_MIN_VERSION: is pkg-config in path?))
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= $GLIB_MIN_VERSION,,
AC_MSG_ERROR(Cannot find GThread library version >= $GLIB_MIN_VERSION: is pkg-config in path?))
PKG_CHECK_MODULES(ZORPLL, zorpll-${LIBZORP_LT_RELEASE} >= $ZORPLL_MIN_VERSION,,
AC_MSG_ERROR(Cannot find ZORP Lowlevel library version >= $ZORPLL_MIN_VERSION: is pkg-config in path?))
PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MIN_VERSION openssl < $OPENSSL_MAX_VERSION],,
AC_MSG_ERROR(Cannot find OpenSSL library $OPENSSL_MIN_VERSION <= version < $OPENSSL_MAX_VERSION: is pkg-config in path?)
)
PKG_CHECK_MODULES(PYTHON, python-2.7 >= $PYTHON_MIN_VERSION,,
AC_MSG_ERROR(Cannot find Python library version >= $PYTHON_MIN_VERSION: is pkg-config in path?))
PKG_CHECK_MODULES(PYTHON, python-2.7 < $PYTHON_MAX_VERSION,,
AC_MSG_ERROR(Cannot find Python library version >= $PYTHON_MAX_VERSION: is pkg-config in path?))
AM_CONDITIONAL(ENABLE_KZORP, test x$enable_kzorp = xyes)
if test "x$ac_cv_func_gethostbyname_r" = "xyes"; then
dnl if test "`uname -s`" = "Linux"; then
dnl AC_DEFINE(HAVE_LEAK_IN_GETHOSTBYNAME_R, 1, [We have a leak in gethostbyname_r, avoid using it])
if test "`uname -s`" = "SunOS"; then
AC_DEFINE(HAVE_SUN_GETHOSTBYNAME_R, 1, [We have a Solaris style gethostbyname_r];)
fi
fi
dnl ***************************************************************************
dnl Misc checks
AC_SYS_LARGEFILE
ZORP_PROC="`uname -m`"
ZORP_OS="`uname -s`"
ZORP_OS_RELEASE="`uname -r | cut -d '.' -f 1-2`"
if test "x$ZORP_OS" = "xLinux";then
CURRDATE=`date -R`
else
CURRDATE=`date +"%a, %d %b %Y %H:%M:%S %Z"`
fi
dnl ***************************************************************************
dnl Export detected settings to Makefiles and Zorp
AC_SUBST(zorp_srcdir)
AC_SUBST(ZORP_PROC)
AC_SUBST(ZORP_OS)
AC_SUBST(ZORP_MUNIN_CONF_DIR)
AC_SUBST(ZORP_NAGIOS_CONF_DIR)
AC_SUBST(ZORP_PYTHON_DIR)
AC_SUBST(ZORPCTL_PYTHON_DIR)
AC_SUBST(ZORP_SUDOERSD_CONF_DIR)
AC_SUBST(ENABLE_KZORP)
ZORP_MUNIN_DIR="${prefix}/share/munin/plugins"
ZORP_NAGIOS_DIR="${prefix}/lib/nagios/plugins"
ZORP_PYTHON_DIR="${pythondir}/Zorp"
ZORPCTL_PYTHON_DIR="${pythondir}/zorpctl"
ZORP_SYSCONFDIR="${sysconfdir}/zorp"
ZORP_DATADIR="${datadir}/zorp"
ZORP_LIBDIR="${libdir}/zorp"
ZORP_SBINDIR="${sbindir}"
ZORP_STATEDIR="${localstatedir}/lib/zorp"
ZORP_PIDFILEDIR="${localstatedir}/run/zorp/"
dnl ***************************************************************************
dnl Export results
enable_value()
{
if test "x$1" = "xyes" ; then
echo 1
else
echo 0
fi
}
dnl ***************************************************************************
dnl Size check of pointers
AC_CHECK_SIZEOF(void *)
AC_SUBST(RELEASE_TAG)
AC_SUBST(BROCHURE_VERSION)
AC_SUBST(ZORP_PACKAGE_LICENSE)
AC_SUBST(PACKAGE_SUFFIX)
AC_DEFINE_UNQUOTED(ZORP_PRODUCT_NAME, "$ZORP_PRODUCT_NAME", [Required product name in license])
AC_SUBST(ZORP_PRODUCT_NAME)
AC_DEFINE_UNQUOTED(BROCHURE_VERSION, "$BROCHURE_VERSION", [Zorp brochure version])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Zorp package version])
AC_DEFINE_UNQUOTED(ZORP_SOURCE_REVISION, "$SOURCE_REVISION", [Zorp source revision number])
AC_DEFINE_UNQUOTED(ENABLE_TRACE, `enable_value $enable_trace`, [Enable trace messages])
AC_DEFINE_UNQUOTED(ENABLE_IPOPTIONS, `enable_value $enable_ip_options`, [Enable IP option processing])
AC_DEFINE_UNQUOTED(ENABLE_IPV6, `enable_value $enable_ipv6`, [Enable IPv6 support])
AC_DEFINE_UNQUOTED(ENABLE_PREFORK, `enable_value $enable_prefork`, [Enable prefork support])
AC_DEFINE_UNQUOTED(ENABLE_KZORP, `enable_value $enable_kzorp`, [Enable kzorp support])
WARNING_CXXFLAGS="-Wall -W -Werror-implicit-function-declaration -Wwrite-strings"
DIRECTORY_CXXFLAGS="-DZORP_PIDFILEDIR=\\\"${ZORP_PIDFILEDIR}\\\" -DZORP_STATEDIR=\\\"${ZORP_STATEDIR}\\\" -DZORP_SBINDIR=\\\"${ZORP_SBINDIR}\\\" -DZORP_SYSCONFDIR=\\\"${ZORP_SYSCONFDIR}\\\" -DZORP_DATADIR=\\\"${ZORP_DATADIR}\\\" -DZORP_LIBDIR=\\\"${ZORP_LIBDIR}\\\""
if test "x$enable_coverage" = "xyes"; then
COVERAGE_CXXFLAGS="-fprofile-arcs -ftest-coverage"
COVERAGE_LIBS="-fprofile-arcs -lgcov"
fi
GENERAL_CXXFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I$top_srcdir/lib $COVERAGE_CXXFLAGS $WARNING_CXXFLAGS $DIRECTORY_CXXFLAGS"
# Dependencies outside the source tree
DEPS_CXXFLAGS="$ZORPLL_CFLAGS $ZORPLIC_CFLAGS $ZORPMISC_CFLAGS $PYTHON_CFLAGS $OPENSSL_CFLAGS"
DEPS_LIBS="$ZORPLL_LIBS $ZORPLIC_LIBS $ZORPMISC_LIBS $PYTHON_LIBS $PYTHON_DEPS $COREDUMP_LIBS $OPENSSL_LIBS"
# zorp library libs
LIBZORP_CXXFLAGS="$GENERAL_CXXFLAGS $DEPS_CXXFLAGS $GLIB_CXXFLAGS $GMODULE_CXXFLAGS $GTHREAD_CXXFLAGS $PYTHON_CXXFLAGS $OPENSSL_CXXFLAGS $PCAP_CXXFLAGS"
LIBZORP_LIBS="$DEPS_LIBS $GLIB_LIBS $GMODULE_LIBS $GTHREAD_LIBS $PYTHON_LIBS $OPENSSL_LIBS $PCAP_LIBS"
# Zorp main program
ZORP_CXXFLAGS="$GENERAL_CXXFLAGS $DEPS_CXXFLAGS"
ZORP_LIBS="-L\$(top_builddir)/lib/ -lzorp $DEPS_LIBS $LIBZORP_LIBS"
# zorpctl program
ZORPCTL_CXXFLAGS="$GENERAL_CXXFLAGS $GLIB_CFLAGS $SOCK_CFLAGS $ZORPLL_CFLAGS"
ZORPCTL_LIBS="$GLIB_LIBS $SOCK_LIBS"
# zorp modules
MODULES_CXXFLAGS="-I$top_srcdir/libproxy/ $GENERAL_CXXFLAGS $DEPS_CXXFLAGS"
MODULES_LIBS="-L\$(top_builddir)/lib/ -lzorp -L\$(top_builddir)/libproxy/ -lzorpproxy $DEPS_LIBS"
# module test program
MODULETESTS_CXXFLAGS="$MODULES_CXXFLAGS $ZORP_CXXFLAGS"
MODULETESTS_LIBS="$MODULES_LIBS $ZORP_LIBS"
# unit test program
UNITTESTS_CXXFLAGS="$MODULES_CXXFLAGS $ZORP_CXXFLAGS"
UNITTESTS_LIBS="$MODULES_LIBS $ZORP_LIBS"
AC_SUBST(LIBZORP_CXXFLAGS)
AC_SUBST(LIBZORP_LIBS)
AC_SUBST(ZORP_CXXFLAGS)
AC_SUBST(ZORP_LIBS)
AC_SUBST(ZORPCTL_CXXFLAGS)
AC_SUBST(ZORPCTL_LIBS)
AC_SUBST(MODULES_CXXFLAGS)
AC_SUBST(MODULES_LIBS)
AC_SUBST(MODULETESTS_CXXFLAGS)
AC_SUBST(MODULETESTS_LIBS)
AC_SUBST(UNITTESTS_CXXFLAGS)
AC_SUBST(UNITTESTS_LIBS)
if test "x$enable_predictable_random" = "xyes"; then
AC_DEFINE(PREDICTABLE_RANDOM_ENABLED, 1, [Predictable random is enabled])
fi
AC_SUBST(ZORP_MUNIN_DIR)
AC_SUBST(ZORP_NAGIOS_DIR)
AC_SUBST(ZORP_DATADIR)
AC_SUBST(ZORP_LIBDIR)
AC_SUBST(ZORP_PIDFILEDIR)
AC_SUBST(ZORP_SYSCONFDIR)
AC_SUBST(ZORP_STATEDIR)
AC_SUBST(ZORP_SBINDIR)
date=`date +%Y/%m/%d`
AC_DEFINE_UNQUOTED(ZORP_CONFIG_DATE, "$date", [Configuration date])
cat <<EOF
Compile time options:
---------------------
coverage: $enable_coverage
ipoptions: $enable_ip_options
ipv6: $enable_ipv6
prefork: $enable_prefork
kzorp: $enable_kzorp
License: $ZORP_PACKAGE_LICENSE
EOF
AC_SUBST(LIBZORP_LT_RELEASE)
AC_SUBST(LIBZORP_LT_COMPAT_BRANCH)
AC_SUBST(LIBZORP_LT_COMPAT_PL)
AC_SUBST(GLIB_MIN_VERSION)
AC_SUBST(ZORPLL_MIN_VERSION)
AC_SUBST(ZORPLIC_MIN_VERSION)
AC_SUBST(ZORPMISC_MIN_VERSION)
AC_SUBST(OPENSSL_MIN_VERSION)
AC_SUBST(PYTHON_MIN_VERSION)
AC_SUBST(CURRDATE)
AC_CONFIG_LINKS([pylib/Zorp/__init__.py:pylib/Zorp/__init__.py])
AC_CONFIG_FILES([
Makefile
doc/Makefile
doc/man/Makefile
doc/man/zorp-entities.ent
lib/Makefile
lib/zorp/Makefile
libproxy/Makefile
libproxy/zorp/Makefile
libproxy/zorp/proxy/Makefile
libzorp.pc
libzorpproxy.pc
moduledist.conf
modules/Makefile
modules/anypy/Makefile
modules/apr/Makefile
modules/finger/Makefile
modules/ftp/Makefile
modules/ftp/tests/Makefile
modules/http/Makefile
modules/http/messages/Makefile
modules/http/messages/de/Makefile
modules/http/messages/en/Makefile
modules/http/messages/hu/Makefile
modules/http/tests/Makefile
modules/plug/Makefile
modules/pop3/Makefile
modules/pop3/messages/Makefile
modules/pop3/messages/en/Makefile
modules/pop3/messages/hu/Makefile
modules/smtp/Makefile
modules/smtp/tests/Makefile
modules/telnet/Makefile
modules/telnet/tests/Makefile
modules/whois/Makefile
munin_plugins/Makefile
nagios_plugins/Makefile
pylib/Makefile
pylib/Zorp/Config_.py
pylib/Zorp/Makefile
scripts/Makefile
tests/Makefile
tests/python/Makefile
tests/unit/Makefile
tests/zorpctl/Makefile
zorp/Makefile
zorpctl/Makefile],
[chmod +x debian/rules]
)
AC_OUTPUT