1#
2#  Argus Software
3#  Copyright (c) 2000-2016 QoSient, LLC
4#  All rights reserved.
5#
6#  This program is free software; you can redistribute it and/or modify
7#  it under the terms of the GNU General Public License as published by
8#  the Free Software Foundation; either version 2, or (at your option)
9#  any later version.
10#
11#  This program is distributed in the hope that it will be useful,
12#  but WITHOUT ANY WARRANTY; without even the implied warranty of
13#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#  GNU General Public License for more details.
15#
16#  You should have received a copy of the GNU General Public License
17#  along with this program; if not, write to the Free Software
18#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19#
20#  $Id: //depot/argus/clients/configure.ac#47 $
21#  $DateTime: 2016/06/01 15:17:28 $
22#  $Change: 3148 $
23#
24#
25# Process this file with autoconf to produce a configure script.
26
27AC_PREREQ([2.61])
28AC_INIT([Argus Client Programs],[3.0.8],[bug-report@qosient.com],[argus-clients],[http://qosient.com/argus])
29AC_CONFIG_SRCDIR([clients/ra.c])
30AC_CONFIG_AUX_DIR([config])
31AC_CONFIG_HEADER([include/argus_config.h])
32AC_CANONICAL_TARGET
33
34AC_QOSIENT_PERL(V_PERL)
35
36# Checks for programs.
37AC_LBL_C_INIT(V_CCOPT, V_INCLS)
38AC_PROG_LN_S
39AC_PROG_LEX
40AC_PROG_INSTALL
41AC_PROG_RANLIB
42AC_PROG_YACC
43
44AC_CHECK_PROGS(V_RANLIB, ranlib, @true)
45AC_QOSIENT_LEX_AND_YACC(V_LEX, V_YACC, argus_)
46
47# Checks for libraries.
48AC_QOSIENT_READLINE(V_READLINE, V_INCLS)
49
50CMU_SASL2(V_INCLS)
51AC_CMU_MYSQL
52
53AC_CHECK_HEADERS(zlib.h, [AC_CHECK_LIB(z, uncompress, ZLIB="-lz")])
54AC_QOSIENT_FLOWTOOLS(V_FLOWTOOLS, V_INCLS)
55
56if test ! -z "$V_FLOWTOOLS"; then
57   AC_DEFINE([ARGUS_FLOWTOOLS], [], [Using Flow Tools library])
58   if test -f "$V_FLOWTOOLS"; then
59      if test -f lib/libft.a; then
60         rm -rf lib/libft.a
61      fi
62      ftdir=`echo $V_FLOWTOOLS | sed -e 's/\.\./..\/../'`
63      V_FTDEP=$ftdir
64   else
65      if test "$V_FLOWTOOLS" = "-lft" ; then
66         if test -f lib/libft.a; then
67            rm -rf lib/libft.a
68         fi
69      fi
70   fi
71fi
72
73AC_QOSIENT_PCRE(V_PCRE, V_INCLS)
74
75# Checks for header files.
76AC_HEADER_DIRENT
77AC_HEADER_STDC
78AC_HEADER_SYS_WAIT
79
80AC_CHECK_HEADERS([sys/types.h sys/sockio.h sys/file.h string.h fcntl.h syslog.h stdbool.h])
81AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h libintl.h malloc.h memory.h netdb.h netinet/in.h net/if_dl.h])
82AC_CHECK_HEADERS([stdlib.h stddef.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h])
83AC_CHECK_HEADERS([sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h unistd.h values.h ifaddrs.h])
84
85# Checks for typedefs, structures, and compiler characteristics.
86AC_C_CONST
87AC_C_INLINE
88
89AC_SYS_LARGEFILE
90AC_LBL_UNALIGNED_ACCESS
91
92AC_LBL_DEVEL(V_CCOPT)
93AC_QOSIENT_DEBUG(V_CCOPT)
94AC_QOSIENT_MEMORY
95
96AC_TYPE_INT8_T
97AC_TYPE_UINT8_T
98AC_TYPE_INT16_T
99AC_TYPE_UINT16_T
100AC_TYPE_INT32_T
101AC_TYPE_UINT32_T
102AC_TYPE_UINT64_T
103AC_TYPE_UID_T
104AC_TYPE_PID_T
105AC_TYPE_SIZE_T
106
107AC_HEADER_TIME
108AC_STRUCT_TM
109AC_STRUCT_TIMEZONE
110
111# Checks for library functions.
112AC_FUNC_ALLOCA
113AC_FUNC_VPRINTF
114AC_FUNC_CLOSEDIR_VOID
115AC_FUNC_ERROR_AT_LINE
116AC_FUNC_FORK
117AC_PROG_GCC_TRADITIONAL
118AC_FUNC_MALLOC
119AC_FUNC_MEMCMP
120AC_FUNC_MKTIME
121AC_FUNC_REALLOC
122AC_FUNC_SELECT_ARGTYPES
123AC_TYPE_SIGNAL
124AC_FUNC_STAT
125AC_FUNC_STRFTIME
126AC_FUNC_STRTOD
127
128
129AC_CHECK_FUNCS(backtrace)
130AC_CHECK_FUNCS(openlog syslog)
131AC_CHECK_FUNCS(vfprintf strlcpy)
132AC_CHECK_FUNCS(strftime)
133AC_CHECK_FUNCS(inet_aton)
134AC_CHECK_FUNCS(setlinebuf)
135AC_CHECK_FUNCS(strerror strtof)
136AC_CHECK_FUNCS(floorf remainderf)
137AC_CHECK_FUNCS(timegm)
138
139needsnprintf=no
140AC_CHECK_FUNCS(vsnprintf snprintf,, [needsnprintf=yes])
141if test $needsnprintf = yes; then
142   AC_LIBOBJ(snprintf)
143fi
144#
145# Do this before checking for ether_hostton(), as it's a
146# "gethostbyname() -ish function".
147#
148AC_LBL_LIBRARY_NET
149
150AC_CHECK_FUNCS([ether_hostton getaddrinfo gethostname])
151AC_CHECK_FUNCS([alarm bzero endgrent endpwent floor gethostbyaddr gethostbyname getpass gettimeofday inet_ntoa isascii localtime_r])
152AC_CHECK_FUNCS([memchr memmove memset mkdir modf pow putenv realpath regcomp select setenv socket sqrt strcasecmp strchr])
153AC_CHECK_FUNCS([strdup strerror strlcat strncasecmp strpbrk strerror strrchr strstr strtol strtof srandomdev tzset])
154
155case "$target_os" in
156   *) COMPATLIB="-lm"
157esac
158
159AC_QOSIENT_THREADS(V_THREADS)
160AC_QOSIENT_TCPWRAP(V_WRAPDEP, V_INCLS)
161if test ! -z "$V_WRAPDEP"; then
162   if test -f "$V_WRAPDEP"; then
163      if test -f lib/libwrap.a; then
164         rm -rf lib/libwrap.a
165      fi
166      wrapdir=`echo $V_WRAPDEP | sed -e 's/^\.\./..\/../'`
167      ln -s $wrapdir lib/libwrap.a
168      V_WRAPDEP="../lib/libwrap.a"
169   else
170      if test "$V_WRAPDEP" = "-lwrap" ; then
171         if test -f lib/libwrap.a; then
172            rm -rf lib/libwrap.a
173         fi
174         case "$target_os" in
175         linux*)
176            V_WRAPDEP="$V_WRAPDEP -lnsl";;
177         esac
178      fi
179   fi
180   AC_DEFINE([HAVE_TCP_WRAPPER], [], [Using Tcp wrappers])
181   WRAPLIBS="$V_WRAPDEP"
182fi
183
184
185saved_CPPFLAGS=$CPPFLAGS
186saved_LIBS=$LIBS
187LIB_XDR=""
188
189AC_CHECK_HEADERS([rpc/xdr.h], ,
190   [CPPFLAGS="${saved_CPPFLAGS} -I/usr/include/tirpc"
191    unset ac_cv_header_rpc_xdr_h
192    AC_CHECK_HEADERS(rpc/xdr.h,
193      [XDR_INCLS="-I/usr/include/tirpc"
194      LIB_XDR="-ltirpc"])],
195      [#include <rpc/types.h>
196       #include <rpc/xdr.h>])
197
198LIBS="$LIB_XDR $LIBS"
199
200AC_CHECK_FUNCS(xdrmem_create,
201   AC_DEFINE([HAVE_XDR], [], [Using system XDR library]),
202   LIB_XDR=""
203   XDR_INCLS=""
204   )
205
206CPPFLAGS=${saved_CPPFLAGS}
207LIBS=${saved_LIBS}
208
209
210CURSESLIB=""
211saved_CPPFLAGS=$CPPFLAGS
212saved_LDFLAGS=$LDFLAGS
213saved_LIBS=$LIBS
214
215case "$target_os" in
216   solaris*)
217      NCURSES_INCLS="-I/usr/include/ncurses"
218      NCURSES_LDFLAGS="-L/usr/gnu/lib"
219      CPPFLAGS="${saved_CPPFLAGS} ${NCURSES_INCLS}"
220      LDFLAGS="${saved_LDFLAGS} ${NCURSES_LDFLAGS}"
221
222      AC_CHECK_HEADERS(ncurses.h, CURSESLIB="-lncurses",
223         [AC_CHECK_HEADERS(curses.h, CURSESLIB="-lcurses")],)
224
225      if test "$CURSESLIB" = "-lncurses"; then
226         AC_CHECK_LIB(ncurses, initscr,
227           [AC_DEFINE([ARGUS_CURSES], [], [Using ncurses])
228            CURSES_INCLS="-I/usr/include/ncurses"
229            LIBS="$LIBS -L/usr/gnu/lib" ],)
230      else
231         if test "$CURSESLIB" = "-lcurses"; then
232            AC_DEFINE([ARGUS_CURSES], [], [Using curses])
233         fi
234      fi
235
236      CPPFLAGS="${saved_CPPFLAGS}"
237      LDFLAGS="${saved_LDFLAGS}"
238      ;;
239
240   *)
241      AC_CHECK_HEADERS(ncurses.h, [AC_CHECK_LIB(ncurses, initscr,
242           CURSESLIB="-lncurses")],
243           [AC_CHECK_HEADERS(curses.h, AC_CHECK_LIB(curses, initscr,
244                   CURSESLIB="-lcurses"))
245           ],)
246
247      if test "$CURSESLIB" = "-lncurses"; then
248         AC_DEFINE([ARGUS_CURSES], [], [Using ncurses])
249      else
250         if test "$CURSESLIB" = "-lcurses"; then
251            AC_DEFINE([ARGUS_CURSES], [], [Using curses])
252         fi
253      fi
254      ;;
255esac
256
257
258
259case "$target_cpu" in
260*86)
261   have_x86=yes;
262   ;;
263
264powerpc-apple*)
265   ;;
266
267powerpc64-*-linux-gnu)
268   V_CCOPT="$V_CCOPT -m64 -fPIC"
269   ;;
270
271esac
272
273case "$target_os" in
274
275aix*)
276	dnl Workaround to enable certain features
277	have_sun=yes;
278	;;
279
280darwin*)
281	have_darwin=yes;
282	;;
283
284hpux9*)
285        have_hpux_nine=yes;
286	;;
287
288hpux10.0*)
289	;;
290
291hpux10.1*)
292	;;
293
294hpux*)
295	dnl HPUX 10.20 and above is similar to HPUX 9...
296	have_hpux_ten=yes;
297	;;
298
299sinix*)
300	AC_MSG_CHECKING(if SINIX compiler defines sinix)
301	AC_CACHE_VAL(ac_cv_cc_sinix_defined,
302		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int i = sinix;]])],[ac_cv_cc_sinix_defined=yes],[ac_cv_cc_sinix_defined=no]))
303	    AC_MSG_RESULT($ac_cv_cc_sinix_defined)
304	    if test "$ac_cv_cc_sinix_defined" = "no" ; then
305               AC_DEFINE([sinix], [], [Description])
306	    fi
307	;;
308
309solaris*)
310	AC_DEFINE(ARGUS_SOLARIS,1,[On solaris])
311	AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
312	if test "x$LD_LIBRARY_PATH" != "x" ; then
313		LIBS="$LIBS -R$LD_LIBRARY_PATH"
314		AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
315	else
316		AC_MSG_RESULT(no -- this may be a problem in a few seconds)
317	fi
318	COMPATLIB="-lsocket -lnsl -lrt $COMPATLIB"
319	;;
320
321linux*)
322	;;
323
324cygwin*)
325	have_cygwin=yes;
326	V_INCLS="$V_INCLS -I../include/cygwin-include"
327	;;
328esac
329
330if test "$have_x86" = yes ; then
331   AC_DEFINE([CONFIG_X86_BSWAP], [], [System has x86 endian support])
332fi
333if test "$have_darwin" = yes ; then
334   AC_DEFINE([HAVE_DARWIN], [], [Mac OS X])
335fi
336if test "$have_hpux_nine" = yes ; then
337   AC_DEFINE([HAVE_HPUX9], [], [HPUX 9])
338fi
339if test "$have_hpux_ten" = yes ; then
340   AC_DEFINE([HAVE_HPUX10_20], [], [HPUX 10])
341fi
342if test "$have_sun" = yes ; then
343   AC_DEFINE([_SUN], [], [Description])
344fi
345if test "$have_cygwin" = yes ; then
346   AC_DEFINE([CYGWIN], [], [Using cygwin])
347fi
348
349AC_QOSIENT_GEOIP(V_GEOIPDEP, V_INCLS)
350
351AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
352   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tm; tm.tm_gmtoff;]])],[tcl_cv_member_tm_gmtoff=yes],[tcl_cv_member_tm_gmtoff=no])])
353if test $tcl_cv_member_tm_gmtoff = yes ; then
354   AC_DEFINE([HAVE_TM_GMTOFF], [], [tm_gmtoff in struct tm])
355fi
356
357AC_CACHE_CHECK([sys_errlist in stdio.h], arg_cv_sys_errlist, [
358   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[char *ptr = sys_errlist[0];]])],[arg_cv_sys_errlist=yes],[arg_cv_sys_errlist=no])])
359if test $arg_cv_sys_errlist = yes ; then
360   AC_DEFINE([ARGUS_SYS_ERRLIST], [], [sys_errlist in stdio.h])
361fi
362
363if test "$V_FLOWTOOLS" = "-lft" ; then
364   LIBS="$LIBS $V_FLOWTOOLS"
365fi
366
367INSTALL_LIB="../lib"
368INSTALL_BIN="../bin"
369
370DIRS="./common ./include ./clients"
371
372if test "$with_examples" != no; then
373   DIRS="$DIRS ./examples"
374fi
375
376if test "$with_pluribus" != no; then
377   AC_DEFINE([ARGUS_PLURIBUS], [], [Building for pluribus])
378fi
379
380V_INCLS_EXAMPLES=`echo $V_INCLS | sed -e 's/\.\./..\/../'`
381
382AC_SUBST(PACKAGE_VERSION)
383AC_SUBST(LIBS)
384AC_SUBST(DIRS)
385AC_SUBST(INCLS)
386AC_SUBST(V_CCOPT)
387AC_SUBST(V_INCLS)
388AC_SUBST(V_INCLS_EXAMPLES)
389AC_SUBST(V_RANLIB)
390AC_SUBST(V_YACC)
391AC_SUBST(V_LEX)
392AC_SUBST(V_PERL)
393AC_SUBST(V_THREADS)
394AC_SUBST(V_FTDEP)
395AC_SUBST(V_PCRE)
396AC_SUBST(V_READLINE)
397AC_SUBST(V_GEOIPDEP)
398AC_SUBST(WRAPLIBS)
399AC_SUBST(COMPATLIB)
400AC_SUBST(ZLIB)
401AC_SUBST(CURSESLIB)
402AC_SUBST(CURSES_INCLS)
403AC_SUBST(XDR_INCLS)
404AC_SUBST(LIB_XDR)
405AC_SUBST(INSTALL_LIB)
406AC_SUBST(INSTALL_BIN)
407AC_SUBST(PCRE_CFLAGS)
408
409AC_CONFIG_FILES([
410   Makefile
411   ./common/Makefile
412   ./include/Makefile
413   ./clients/Makefile
414   ./lib/argus-clients.pc
415])
416
417AS_IF([test "$with_examples" != no],
418   [AC_CONFIG_FILES([
419      ./examples/Makefile
420      ./examples/raconvert/Makefile
421      ./examples/radark/Makefile
422      ./examples/radecode/Makefile
423      ./examples/radump/Makefile
424      ./examples/raevent/Makefile
425      ./examples/rafilter/Makefile
426      ./examples/ragraph/Makefile
427      ./examples/ragrep/Makefile
428      ./examples/rahisto/Makefile
429      ./examples/rahosts/Makefile
430      ./examples/ralabel/Makefile
431   ])
432
433   AS_IF([test "$ARGUS_MYSQL_MAKEFILE" != no],
434      [AC_CONFIG_FILES([
435         ./examples/ramysql/Makefile
436      ])
437   ])
438
439   AC_CONFIG_FILES([
440      ./examples/rapath/Makefile
441      ./examples/rapolicy/Makefile
442      ./examples/raports/Makefile
443      ./examples/rarpwatch/Makefile
444      ./examples/raservices/Makefile
445      ./examples/rastream/Makefile
446      ./examples/rastrip/Makefile
447      ./examples/ratop/Makefile
448      ./examples/ratimerange/Makefile
449      ./examples/ratemplate/Makefile
450   ])
451])
452
453AC_OUTPUT
454
455if test -f .devel ; then
456	make depend
457fi
458