-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.in
418 lines (366 loc) · 13.3 KB
/
configure.in
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
AC_PREREQ(2.59)
AC_INIT([nxlog-ce], m4_esyscmd([./version.sh]), [[email protected]], [nxlog-ce])
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR(src/core/nxlog.c)
AM_CONFIG_HEADER(src/common/config.h)
AM_INIT_AUTOMAKE(1.7)
CFLAGS=${CFLAGS=}
AC_LANG(C)
AC_PROG_CC
# APR
AC_PATH_PROG(apr_config, [apr-1-config])
if test "x$apr_config" = "x"; then
AC_MSG_ERROR([apr library not found])
fi
APR_LIBS=`$apr_config --link-ld --libs`
APR_CFLAGS=`$apr_config --cppflags`
CFLAGS="$CFLAGS $APR_CFLAGS"
LIBS="$LIBS $APR_LIBS"
APR_LDFLAGS=`$apr_config --ldflags`
LDFLAGS="$LDFLAGS $APR_LDFLAGS"
APR_INCLUDES=`$apr_config --includes`
INCLUDES="$INCLUDES $APR_INCLUDES"
AC_PROG_INSTALL
AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_YACC
AC_PROG_LEX
# ANDROID
AC_MSG_CHECKING([for an Android system])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#ifndef __ANDROID__
#error __ANDROID__ not defined
#endif
]],[[;]])], [HAVE_ANDROID="yes"; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
AM_CONDITIONAL(HAVE_ANDROID, test x$HAVE_ANDROID != x)
AC_CHECK_PROGS([OPENSSL], [openssl], [NOTFOUND], [])
if test "x$OPENSSL" = "xNOTFOUND"; then
AC_MSG_WARN([openssl binary not found])
fi
# PCRE
AC_PATH_PROG(pcre_config, [pcre-config])
if test "x$pcre_config" = "x"; then
AC_MSG_ERROR([pcre library not found])
fi
PCRE_LIBS=`$pcre_config --libs`
PCRE_CFLAGS=`$pcre_config --cflags`
AC_CHECK_LIB([apr-1], [apr_socket_create], [HAVELIBAPR=1], [AC_MSG_ERROR([libapr-1 not found])])
AC_CHECK_FUNCS(apr_pollset_wakeup apr_sockaddr_ip_getbuf apr_file_sync apr_file_link apr_pool_create_unmanaged_ex, [], [AC_MSG_WARN([libapr-1 1.4.0 or greater is recommended])])
# DBI
AC_CHECK_LIB([dbi], [dbi_initialize], [LIBDBI="-ldbi"], [AC_MSG_WARN([libdbi not found - not building dbi modules])])
if ! test "x$LIBDBI" = "x"; then
AC_CHECK_HEADERS(dbi/dbi.h, , AC_MSG_ERROR([please install header files for libdbi]))
fi
AM_CONDITIONAL([HAVE_LIBDBI], [test x$LIBDBI != x])
AC_HEADER_STDC
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_HEADERS(pcre.h, , AC_MSG_ERROR([please install pcre-dev]))
AC_CHECK_DECLS([PCRE_ERROR_BADUTF8, PCRE_ERROR_BADUTF8_OFFSET], [], [AC_MSG_ERROR([pcre 4.5 or greater is required!])], [#include <pcre.h>])
AC_CHECK_HEADERS(openssl/evp.h,,[AC_MSG_ERROR(openssl headers not found)])
SAVED_LIBS=$LIBS
LIBSSL="-lcrypto -lssl"
LIBS="$LIBS $LIBSSL"
AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_init], , [AC_MSG_ERROR([libcrypto not found])], [-L/usr/local/lib])
AC_CHECK_LIB([ssl], [SSL_library_init], , [AC_MSG_ERROR([libssl not found])], [-L/usr/local/lib])
AC_CHECK_FUNCS(EVP_md5 EVP_sha1 EVP_sha256 EVP_sha512 EVP_ripemd160)
LIBS=$SAVED_LIBS
AC_CHECK_FUNCS(klogctl, , [AC_MSG_WARN([klogctl system call not found, this is required by im_kernel on linux])])
AC_CHECK_HEADERS(sys/klog.h)
AC_CHECK_HEADERS(grp.h)
AC_CHECK_FUNCS(getgrouplist setgroups)
# Expat for XCC/pm_pattern and xml_xml
AC_CHECK_LIB([expat], [XML_Parse], [LIBEXPAT="-lexpat"],
[AC_MSG_ERROR([the expat library is required for the pm_pattern module])])
AC_CHECK_HEADERS(pcre.h, , AC_MSG_ERROR([please install pcre-dev]))
AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB([z], [deflate], [LIBZLIB="-lz"],
[AC_MSG_WARN([the zlib library was not found and xm_gelf will not be built])]),
AC_MSG_WARN([zlib.h header not found and xm_gelf will not be built]); LIBZLIB="")
AM_CONDITIONAL([HAVE_ZLIB], [test x$LIBZLIB != x])
# Linux-specific capability tests
case $host in
*linux*)
# prctl is needed for capabilities
AC_CHECK_HEADERS(sys/prctl.h)
AC_CHECK_FUNCS(prctl setpflags)
if test "x$ac_cv_enable_capability" != "xno"; then
AC_CHECK_LIB([cap], [cap_from_name], [CAPABILITY=yes; LIBCAP="-lcap"],
[if test "x$ac_cv_enable_capability" = "xyes"; then
AC_MSG_ERROR([no linux capability (libcap2) support found.])
else
AC_MSG_WARN([no linux capability (libcap2) support found, will be disabled.])
fi]
)
fi
if test "x$CAPABILITY" = "xyes"; then
AC_CHECK_HEADERS(sys/capability.h, [CAPABILITY=yes],
[if test "x$ac_cv_enable_capability" = "xyes"; then
AC_MSG_ERROR([Header files missing for capability support.])
else
AC_MSG_WARN([Header files missing for capability support])
CAPABILITY=yes;
fi]
)
fi
;;
esac
AC_CHECK_HEADERS(winevt.h)
# backtrace
AC_CHECK_HEADERS(execinfo.h)
AC_CHECK_FUNCS(backtrace_symbols, [], [])
# iconv
AC_CHECK_FUNCS(iconv_open, HAVE_ICONV=yes, [])
if test "x$HAVE_ICONV" = "xyes"; then
AC_CHECK_HEADERS(langinfo.h, [], AC_MSG_WARN([langinfo.h not found]))
AC_CHECK_FUNCS([nl_langinfo], [], [AC_MSG_WARN([nl_langinfo not found])])
else
AC_CHECK_LIB([iconv], [libiconv_open], [HAVE_ICONV=yes], [AC_MSG_WARN([no iconv found, will not build xm_charconv])])
if test "x$HAVE_ICONV" = "xyes"; then
LIBICONV="-liconv"
SAVED_LIBS=$LIBS
LIBS="$LIBS $LIBICONV"
AC_CHECK_HEADERS(langinfo.h,
AC_CHECK_FUNCS([nl_langinfo], [], [AC_MSG_ERROR([nl_langinfo not found in your libiconv])]),
AC_CHECK_FUNCS([locale_charset], [], [AC_MSG_ERROR([no langinfo.h nor locale_charset found in libiconv])]))
LIBS=$SAVED_LIBS
fi
fi
AM_CONDITIONAL([HAVE_ICONV], [test x$HAVE_ICONV != x])
# for date/time conversion
AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[
#include <sys/types.h>
#include <time.h>])
# strptime is only available on unix, we our own where it's not available
AC_CHECK_FUNCS(strptime, , [AC_MSG_WARN([using own strptime()])])
# xm_file has these
AC_CHECK_FUNCS(chown chmod)
# Unix Domain Sockets
AC_CHECK_DECLS(AF_UNIX, [HAVE_AF_UNIX=1], [], [#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
])
AM_CONDITIONAL([HAVE_AF_UNIX], [test x$HAVE_AF_UNIX != x])
# Perl and xm_perl
AC_ENABLE_FEATURE([xm_perl], ENABLE, yes,
[build the xm_perl module],
[yes|no) ;;])
if test "x$ac_cv_enable_xm_perl" = "xyes"; then
AC_CHECK_PROGS([PERL], [perl], [NOTFOUND], [])
if test "x$PERL" = "xNOTFOUND"; then
AC_MSG_WARN([perl binary not found])
else
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
PERL_LIBS=`perl -MExtUtils::Embed -e ldopts`
SAVED_LIBS=$LIBS
SAVED_CFLAGS=$CFLAGS
LIBS="$LIBS $PERL_LIBS"
CFLAGS="$CFLAGS $PERL_CFLAGS"
AC_CHECK_FUNCS([perl_parse], [HAVE_PERL=yes], [AC_MSG_WARN([perl cannot be embedded, not building xm_perl])])
LIBS=$SAVED_LIBS
CFLAGS=$SAVED_CFLAGS
fi
fi
AM_CONDITIONAL([HAVE_PERL], [test x$HAVE_PERL != x])
# OS/ARCH specific hacks
case $host in
*linux*)
;;
*mingw*)
BUILD_SHARED_LIBS=1
BUILD_MSEVENTLOG=1
WIN32=1
;;
*openbsd*)
BUILD_SHARED_LIBS=1
;;
*ibm-aix*)
LIBS="$LIBS -lm"
BUILD_SHARED_LIBS=1
;;
*)
BUILD_SHARED_LIBS=1
;;
esac
# Build shared library on systems which don't support libnx* linked into the executable
AM_CONDITIONAL([BUILD_SHARED_LIBS], [test "x$BUILD_SHARED_LIBS" == "x1"])
if test "x$BUILD_SHARED_LIBS" == "x1"; then
LIBNX='$(top_builddir)/src/common/libnx.la'
fi
# Windows event log
AM_CONDITIONAL([BUILD_MSEVENTLOG], [test x$BUILD_MSEVENTLOG != x])
AM_CONDITIONAL([WIN32], [test "x$WIN32" == "x1"])
AC_ARG_WITH(moduledir,
[ --with-moduledir=DIR path to installed modules],
[ NX_MODULEDIR="$withval"],
[ NX_MODULEDIR="${libexecdir}/nxlog/modules"]
)
AC_ARG_WITH(cachedir,
[ --with-cachedir=DIR directory to store cache files],
[ NX_CACHEDIR="$withval"],
[ NX_CACHEDIR="${localstatedir}/spool/nxlog"]
)
AC_ARG_WITH(configfile,
[ --with-configfile=FILE default config file to use],
[ NX_CONFIGFILE="$withval"],
[ NX_CONFIGFILE="${sysconfdir}/nxlog/nxlog.conf"]
)
AC_ARG_WITH(pidfile,
[ --with-pidfile=FILE default pid file to use],
[ NX_PIDFILE="$withval"],
[ NX_PIDFILE="${localstatedir}/run/nxlog/nxlog.pid"]
)
#################################
# C extensions.
#################################
# C flags
AC_CACHE_CHECK([whether ${CC-cc} accepts -Werror], ac_cv_c_option_werror,
[saved_CFLAGS="$CFLAGS" CFLAGS="-Werror"
AC_TRY_COMPILE(, , ac_cv_c_option_werror=yes, ac_c_option_werror=no)
CFLAGS="$saved_CFLAGS"])
AC_C_ADD_FLAG(pipe, -pipe)
AC_C_ADD_FLAG(w, -W)
AC_C_ADD_FLAG(wall, -Wall)
AC_C_ADD_FLAG(wshadow, -Wshadow)
AC_C_ADD_FLAG(wno_address, -Wno-address)
#AC_C_ADD_FLAG(wunreachable_code, -Wunreachable-code)
AC_C_ADD_FLAG(wcast_qual, -Wcast-qual)
AC_C_ADD_FLAG(wbad_function_cast, -Wbad-function-cast)
AC_C_ADD_FLAG(wsign_compare, -Wsign-compare)
AC_C_ADD_FLAG(wconversion, -Wconversion)
AC_C_ADD_FLAG(funsigned_char, -funsigned-char)
AC_C_ADD_FLAG(werror_implicit_function_declaration, -Werror-implicit-function-declaration)
AC_C_ADD_FLAG(wswitch_default, -Wswitch-default)
AC_C_ADD_FLAG(fstrict_aliasing, -fstrict-aliasing)
AC_C_ADD_FLAG(wpointer_arith, -Wpointer-arith)
AC_C_ADD_FLAG(wcast_align, -Wcast-align)
AC_C_ADD_FLAG(wwrite_strings, -Wwrite-strings)
AC_C_ADD_FLAG(wmissing_noreturn, -Wmissing-noreturn)
AC_C_ADD_FLAG(wmissing_format_attribute, -Wmissing-format-attribute)
AC_C_ADD_FLAG(wformat, -Wformat)
AC_C_ADD_FLAG(wextra, -Wextra)
AC_C_ADD_FLAG(werror_format_security, -Werror=format-security)
#TODO: this fails with pm_pattern because the xcc generated code has such an error
#AC_C_ADD_FLAG(werror_uninitialized, -Werror=uninitialized)
AC_C_ADD_FLAG(rdynamic, -rdynamic)
case $host in
*ibm-aix*)
# Compilation breaks with largefile support on on AIX
;;
*)
AC_SYS_LARGEFILE
;;
esac
if test "x$lt_cv_prog_gnu_ld" = "xyes"; then
AC_C_ADD_FLAG(g, -ggdb3 -g3)
else
AC_C_ADD_FLAG(g, -gstabs+ -ggdb3 -g3)
fi
#FIXME: optimization AC_C_ADD_FLAG(o, -O3 -O2 -O)
#################################
# Output.
#################################
NXLOG_VERSION_STRING="${PACKAGE_VERSION}"
AC_DEFINE_UNQUOTED(VERSION_STRING, "$NXLOG_VERSION_STRING", [version string])
AC_SUBST(VERSION)
AC_SUBST(INCLUDES)
AC_SUBST(DEFS)
CLEANFILES='*~'
AC_SUBST(CLEANFILES)
MAINTAINERCLEANFILES=Makefile.in
AC_SUBST(MAINTAINERCLEANFILES)
AC_SUBST(VERSION)
#AC_SUBST(PROJECT_NUMBER)
#AC_SUBST(OUTPUT_DIRECTORY)
#AC_SUBST(OUTPUT_LANGUAGE)
AC_SUBST(APR_LIBS)
AC_SUBST(APR_CFLAGS)
AC_SUBST(PCRE_LIBS)
AC_SUBST(PCRE_CFLAGS)
AC_SUBST(PERL_LIBS)
AC_SUBST(PERL_CFLAGS)
AC_SUBST(LIBDBI)
AC_SUBST(LIBCAP)
AC_SUBST(NX_MODULEDIR)
AC_SUBST(NX_CACHEDIR)
AC_SUBST(NX_PIDFILE)
AC_SUBST(NX_CONFIGFILE)
AC_SUBST(LIBNX)
AC_SUBST(LIBSSL)
AC_SUBST(LIBICONV)
AC_SUBST(LIBEXPAT)
AC_SUBST(LIBZLIB)
AC_SUBST(WIN32)
AC_OUTPUT(Makefile
doc/Makefile
doc/reference-manual/Makefile
doc/reference-manual/config-examples/Makefile
doc/reference-manual/en/Makefile
doc/reference-manual/hu/Makefile
test/Makefile
test/common/Makefile
test/coresrc/Makefile
src/Makefile
src/common/Makefile
src/core/Makefile
src/modules/Makefile
src/modules/input/Makefile
src/modules/input/file/Makefile
src/modules/input/uds/Makefile
src/modules/input/kernel/Makefile
src/modules/input/udp/Makefile
src/modules/input/tcp/Makefile
src/modules/input/ssl/Makefile
src/modules/input/testgen/Makefile
src/modules/input/null/Makefile
src/modules/input/mark/Makefile
src/modules/input/internal/Makefile
src/modules/input/dbi/Makefile
src/modules/input/exec/Makefile
src/modules/input/mseventlog/Makefile
src/modules/input/msvistalog/Makefile
src/modules/processor/Makefile
src/modules/processor/null/Makefile
src/modules/processor/filter/Makefile
src/modules/processor/transformer/Makefile
src/modules/processor/norepeat/Makefile
src/modules/processor/buffer/Makefile
src/modules/processor/blocker/Makefile
src/modules/processor/pattern/Makefile
src/modules/processor/evcorr/Makefile
src/modules/output/Makefile
src/modules/output/file/Makefile
src/modules/output/udp/Makefile
src/modules/output/tcp/Makefile
src/modules/output/ssl/Makefile
src/modules/output/null/Makefile
src/modules/output/dbi/Makefile
src/modules/output/blocker/Makefile
src/modules/output/uds/Makefile
src/modules/output/exec/Makefile
src/modules/output/http/Makefile
src/modules/extension/Makefile
src/modules/extension/syslog/Makefile
src/modules/extension/exec/Makefile
src/modules/extension/csv/Makefile
src/modules/extension/charconv/Makefile
src/modules/extension/json/Makefile
src/modules/extension/json/yajl/Makefile
src/modules/extension/xml/Makefile
src/modules/extension/gelf/Makefile
src/modules/extension/fileop/Makefile
src/modules/extension/multiline/Makefile
src/modules/extension/perl/Makefile
src/utils/Makefile
packaging/redhat/nxlog.spec
packaging/redhat/nxlog.spec.RHEL5
packaging/windows/nxlog.wxs
packaging/windows/pkgmsi.sh
)
#echo ----------------------------------------------------------
#echo Shared: ${BUILD_SHARED_LIBS}
#echo ----------------------------------------------------------
echo
echo "${PACKAGE}-${NXLOG_VERSION_STRING} configured successfully"
echo "type \`${MAKE-make}' and \`${MAKE-make} install'"
echo
echo