~ubuntu-branches/ubuntu/edgy/syslog-ng/edgy

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
dnl $Id: configure.in,v 1.72.4.20 2005/05/26 08:33:54 bazsi Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/affile.c)
AC_PREREQ(2.50)

AM_INIT_AUTOMAKE(syslog-ng, "1.6.8")
if test -n "$SNAPSHOT_VERSION"; then
	VERSION=$VERSION+$SNAPSHOT_VERSION
fi
LIBOL_REQ_MAJOR=0
LIBOL_REQ_MINOR=3
LIBOL_REQ_PATCH=16

AM_CONFIG_HEADER(src/config.h)

if test "x$prefix" = "xNONE"; then
        prefix=$ac_default_prefix
fi

# We want an absolute path to the source-dir.
case "$srcdir" in
    /*)
	;;
    *)
        oldsrcdir="$srcdir"
        srcdir="`cd \"$srcdir\"; pwd`"
	;;
esac

dnl Check for arguments
dnl Check options
dnl AM_MAINTAINER_MODE

AC_ARG_ENABLE(debug,
   [  --enable-debug            include debug info],,
   enable_debug=no)

AC_ARG_WITH(libol,
   [  --with-libol=path       use an uninstalled copy of libol],
   [with_libol=`cd $with_libol; pwd`],
   [with_libol=""])
   
AC_ARG_WITH(libnet,
   [  --with-libnet=path      use path to libnet-config script],
   ,
   [with_libnet=""])

AC_ARG_ENABLE(sun-streams,
   [  --enable-sun-streams    enable Sun STREAMS support even if not detected])

AC_ARG_ENABLE(sun-door,
   [  --enable-sun-door       enable Sun door support even if not detected],,
   enable_sun_door=auto)

AC_ARG_ENABLE(tcp-wrapper,
   [  --enable-tcp-wrapper    enable using /etc/hosts.deny & /etc/hosts.allow for TCP access],,
   enable_tcp_wrapper=no)

AC_ARG_ENABLE(spoof-source,
   [  --enable-spoof-source    enable spoof_source feature],,
   enable_spoof_source=no)

AC_ARG_ENABLE(full-static,
   [  --enable-full-static    Link everything in statically],,
   enable_full_static=no)

AC_ARG_ENABLE(full-dynamic,
   [  --enable-full-dynamic    Link everything in dynamically],,
   enable_full_dynamic=no)

sysconfdir="${sysconfdir}/syslog-ng"

AM_SANITY_CHECK

dnl Checks for programs.
AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_MAKE_SET

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(malloc.h unistd.h door.h stropts.h sys/strlog.h stdarg.h sys/klog.h arpa/nameser.h)
AC_CHECK_HEADERS(tcpd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME

AC_CACHE_CHECK(for modern utmp,
	       blb_cv_c_modern_utmp,
[AC_TRY_COMPILE([
#include <time.h>
#include <utmp.h>
],
[
int foo(void)
{
	struct utmp ut;
	return &ut.ut_type && &ut.ut_user;
}
],
blb_cv_c_modern_utmp=yes,
blb_cv_c_modern_utmp=no)])

AC_CACHE_CHECK(for global timezone variable,
	       blb_cv_c_global_timezone,
[AC_TRY_COMPILE([
#include <time.h>
],
[
int foo(void)
{
	timezone = 0;
}
],
blb_cv_c_global_timezone=yes,
blb_cv_c_global_timezone=no)])

if test "x$blb_cv_c_modern_utmp" = "xyes"; then
	AC_DEFINE(HAVE_MODERN_UTMP, 1, [new style UTMP is defined on the system])
fi

dnl Seek a type for UINT32
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)

AC_CACHE_CHECK(for I_CONSLOG, blb_cv_c_i_conslog,
  [AC_EGREP_CPP(I_CONSLOG, 
[
#include <sys/strlog.h>
I_CONSLOG
],
  blb_cv_c_i_conslog=no, blb_cv_c_i_conslog=yes)])

old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-D_GNU_SOURCE
AC_CACHE_CHECK(for O_LARGEFILE, blb_cv_c_o_largefile,
  [AC_EGREP_CPP(O_LARGEFILE, 
[
#include <fcntl.h>
O_LARGEFILE
],
  blb_cv_c_o_largefile=no, blb_cv_c_o_largefile=yes)])
CPPFLAGS=$old_CPPFLAGS

if test "x$blb_cv_c_o_largefile" = "xyes"; then
	AC_DEFINE(HAVE_O_LARGEFILE, 1, [O_LARGEFILE is present])
fi

if test "x$blb_cv_c_global_timezone" = "xyes"; then
	AC_DEFINE(HAVE_GLOBAL_TIMEZONE, 1, [have a global timezone variable])
fi

AC_CACHE_CHECK(for res_init in <resolv.h>, blb_cv_c_res_init,
  [AC_EGREP_HEADER(res_init, resolv.h, blb_cv_c_res_init=yes)])

if test "x$blb_cv_c_res_init" = "xyes"; then
	AC_DEFINE(HAVE_RES_INIT, 1, [have a res_init() function])
fi

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_VPRINTF
AC_CHECK_LIB(resolv, res_init)
dnl on Linux res_init is a macro
AC_CHECK_LIB(resolv, __res_init)
AC_CHECK_LIB(door, door_create)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_FUNCS(select snprintf vsnprintf strerror inet_aton strncpy getutent)
AC_CHECK_FUNCS(getopt_long strcasecmp strptime)


old_LIBS=$LIBS


AC_CACHE_CHECK(for TCP wrapper library,
		blb_cv_c_lwrap,

for libwrap in "-lwrap" "/usr/local/lib/libwrap.a"; do
	LIBS="$old_LIBS $libwrap"

	[AC_TRY_LINK(,
	[
}

int allow_severity;
int deny_severity;
extern int hosts_access(void);

int foo(void)
{
	hosts_access();
],
	[blb_cv_c_lwrap=$libwrap
	break],
	blb_cv_c_lwrap="")
done

])
LIBS=$old_LIBS
LIBWRAP_LIBS=$blb_cv_c_lwrap

if test "x$ac_cv_func_snprintf" = "xno" -o \
	"x$ac_cv_func_vsnprintf" = "xno"; then
	AC_LIBOBJ(snprintf)
fi

if test "x$ac_cv_func_getopt_long" != "xyes"; then
	AC_LIBOBJ(getopt)
	AC_LIBOBJ(getopt1)
fi

if test "x$ac_cv_func_strcasecmp" != "xyes"; then
	AC_LIBOBJ(strcasecmp)
fi


if test "x$ac_cv_func_strptime" != "xyes"; then
	AC_LIBOBJ(strptime)
fi


if test "x$ac_cv_lib_door_door_create" = "xyes"; then
	AC_CHECK_HEADERS(pthread.h)
	AC_CHECK_LIB(pthread, pthread_create)
fi

AC_MSG_CHECKING(whether to enable Sun STREAMS support)
if test "x$ac_cv_header_stropts_h" = "xyes" -a \
        "x$ac_cv_header_sys_strlog_h" = "xyes" -a \
        "x$enable_sun_streams" != "xno" -a \
        "x$blb_cv_c_i_conslog" != "xno" -o \
        "x$enable_sun_streams" = "xyes"; then
	AC_DEFINE(HAVE_SUN_STREAMS, 1, [have STREAMS support])
	enable_sun_streams=yes
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to enable Sun door support)
if test "x$enable_sun_streams" = "xyes" -a "x$ac_cv_header_door_h" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes" -a "x$enable_sun_door" != "xno" -o "x$enable_sun_door" = "xyes"; then
	AC_DEFINE(HAVE_SUN_DOOR, 1, [have Solaris Streams support])
	enable_sun_door=yes
	AC_MSG_RESULT(yes)
else
	enable_sun_door=no
	AC_MSG_RESULT(no)
fi


AC_MSG_CHECKING(whether to enable TCP wrapper support)
if test "x$enable_tcp_wrapper" = "xyes"; then
	if test "x$ac_cv_header_tcpd_h" = "xyes" -a "x$blb_cv_c_lwrap" != "x"; then
		AC_DEFINE(ENABLE_TCP_WRAPPER, 1, [have TCP wrapper lib])
		enable_tcp_wrapper=yes
		AC_MSG_RESULT(yes)
	else
		LIBWRAP_LIBS=""
		AC_MSG_RESULT(no)
		enable_tcp_wrapper=no
	fi
else
	LIBWRAP_LIBS=""
	AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to enable spoof_source support)
if test "x$enable_spoof_source" = "xyes"; then
	if test "x$with_libnet" = "x"; then
		LIBNET_CONFIG=`which libnet-config`
	else
		LIBNET_CONFIG=$with_libnet/libnet-config
	fi
	if test -x $LIBNET_CONFIG; then
		AC_DEFINE(ENABLE_SPOOF_SOURCE, 1, [enable spoof source support])
		CFLAGS="$CFLAGS `$LIBNET_CONFIG --cflags`"
		CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --defines`"
		LIBNET_LIBS="`$LIBNET_CONFIG --libs`"
		AC_MSG_RESULT(yes)
	else
		LIBNET_LIBS=
		AC_ERROR(libnet-config not found)
	fi
else
	AC_MSG_RESULT(no)
fi

if test "$enable_full_static" = "yes" -a "$enable_full_dynamic" = "yes"; then
	AC_ERROR(You cannot use --enable-full-static and --enable-full-dynamic at the same time)
fi

AC_MSG_CHECKING(how to enable static linking for certain libraries)
ldversion=`ld -V 2>&1 | head -1 `
if echo $ldversion | egrep "GNU|Solaris" > /dev/null; then
	LD_START_STATIC="-Wl,-Bstatic"
	LD_END_STATIC="-Wl,-Bdynamic"
	AC_MSG_RESULT(GNU or Solaris)
elif echo $ldversion | egrep "HP" > /dev/null; then
	LD_START_STATIC="-Wl,-a,archive"
	LD_END_STATIC="-Wl,-a,shared_archive"
	AC_MSG_RESULT(HP-UX)
else
	LD_START_STATIC=""
	LD_END_STATIC=""
	enable_full_dynamic="yes"
	enable_full_static="no"
	AC_MSG_RESULT([no clues, linking everything dynamically, please send appropriate ld arguments to syslog-ng@lists.balabit.hu])
fi

AC_MSG_CHECKING(libol version >= $LIBOL_REQ_MAJOR.$LIBOL_REQ_MINOR.$LIBOL_REQ_PATCH)

if test "$with_libol" = ""; then
	if test ! -x "`which libol-config`" ; then
		AC_ERROR([libol-config not found, either install libol or supply its location with --with-libol])
	fi
	LIBOL_VERSION=`libol-config --version`
	LIBOL_CFLAGS=`libol-config --cflags`
	LIBOL_LIBS=`libol-config --static-libs`
	MAKE_CLASS="make_class"
else
	if test ! -x $with_libol/libol-config; then
		AC_ERROR(libol-config not found in the specified location)
	fi
	LIBOL_VERSION=`$with_libol/libol-config --version`
	LIBOL_CFLAGS=`$with_libol/libol-config --local-cflags`
	LIBOL_LIBS=`$with_libol/libol-config --local-static-libs`
	MAKE_CLASS="$with_libol/utils/make_class"
fi


LIBOL_VERSION=[`echo $LIBOL_VERSION | cut -d '+' -f 1`]
LIBOL_MAJOR=[`echo $LIBOL_VERSION | cut -d '.' -f 1`]
LIBOL_MINOR=[`echo $LIBOL_VERSION | cut -d '.' -f 2`]
LIBOL_PATCH=[`echo $LIBOL_VERSION | cut -d '.' -f 3`]

if test "$LIBOL_MAJOR" != "$LIBOL_REQ_MAJOR" -o \
	"$LIBOL_MINOR" != "$LIBOL_REQ_MINOR" -o \
	"$LIBOL_PATCH" -lt "$LIBOL_REQ_PATCH"; then
	AC_MSG_RESULT(no)
	AC_MSG_ERROR([Required libol version not found, make sure that your libol version is in the $LIBOL_REQ_MAJOR.$LIBOL_REQ_MINOR.x branch])
fi
AC_MSG_RESULT(ok)

if test "$enable_debug" = "yes" ; then
	CFLAGS="-W -Wno-unused -g -DYYDEBUG -Wall $LIBOL_CFLAGS -D_GNU_SOURCE"
	YFLAGS="-v -d"
	AC_DEFINE(WITH_DEBUG, 1, [enable debugging code])
else
	CFLAGS="$CFLAGS -Wall $LIBOL_CFLAGS -D_GNU_SOURCE"
	YFLAGS="-d"
fi

if test "$enable_full_static" = "yes"; then
	LIBS="-static $LIBS $LEXLIB $LIBWRAP_LIBS $LIBNET_LIBS $LIBOL_LIBS"
elif test "$enable_full_dynamic" = "yes"; then
	LIBS="$LIBS $LEXLIB $LIBWRAP_LIBS $LIBNET_LIBS $LIBOL_LIBS"
else
	LIBS="$LIBS $LIBOL_LIBS $LD_START_STATIC $LEXLIB $LIBWRAP_LIBS $LIBNET_LIBS   $LD_END_STATIC"
fi

AC_SUBST(YFLAGS)

AC_SUBST(MAKE_CLASS)
AC_DEFINE_UNQUOTED(PATH_SYSCONFDIR, "`eval echo $sysconfdir`", [configuration file directory])

AC_OUTPUT(
	Makefile 
	src/Makefile 
	src/tests/Makefile
	doc/Makefile
	doc/sgml/Makefile
	contrib/Makefile
	syslog-ng.spec)