File: configure.in

package info (click to toggle)
havp 0.89-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,284 kB
  • ctags: 597
  • sloc: cpp: 7,161; sh: 497; makefile: 142
file content (169 lines) | stat: -rw-r--r-- 4,366 bytes parent folder | download | duplicates (3)
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

AC_INIT(havp)

dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH

AC_PROG_CXX

AC_PREFIX_DEFAULT(/usr/local)

AC_CONFIG_HEADER(havp/default.h)

AC_ARG_ENABLE(locking,[  --disable-locking       Disable mandatory locking (not needed on Linux/Solaris system)], enable_locking=$enableval, enable_locking=yes)
AC_ARG_ENABLE(ssl-tunnel,[  --enable-ssl-tunnel     Enable SSL proxying (not scanned, only forwarded!)], enable_ssl_tunnel=$enableval, enable_ssl_tunnel=no)
AC_ARG_ENABLE(clamav,[  --disable-clamav        Disable ClamAV libclamav support (clamd is supported anyway)], enable_clamav=$enableval, enable_clamav=yes)
AC_ARG_ENABLE(trophie,[  --disable-trophie       Disable Trend Micro Library (Trophie) support], enable_trophie=$enableval, enable_trophie=yes)

AC_CHECK_PROG(AR, ar, ar, no)

if test "$AR" = "no"; then
	AC_MSG_ERROR([ar not found in PATH])
fi

AC_CHECK_PROG(PERL, perl, perl, no)

AC_CHECK_FUNCS(initgroups setgroups)

if test "$PERL" = "no"; then
	AC_MSG_ERROR([perl not found in PATH])
fi

AC_MSG_CHECKING(OS)

os="`uname`"

case $os in
	Linux*)
		AC_MSG_RESULT(Linux)
		mandatory=yes
		;;
	SunOS*)
		AC_MSG_RESULT(Solaris)
		mandatory=yes
		OSLIBS="-lsocket -lresolv -lnsl"
		;;
	*)
		AC_MSG_RESULT($os)
		mandatory=no
		;;
esac

AC_MSG_CHECKING(for mandatory locking support)

if test "$enable_locking" = "no"
then
	AC_MSG_RESULT([disabled, no dynamic scanning!])

	AC_DEFINE(NOMAND)
else
	if test "$mandatory" = "yes"
	then
		AC_MSG_RESULT([OS supported])
	else
		AC_MSG_RESULT([OS not supported])

		echo ""
		echo " Mandatory locking only works on Linux and Solaris."
		echo ""
		echo " You are running $os, so you must rerun configure"
		echo " with --disable-locking option."
		echo ""
		echo " This means you cannot use dynamic scanning features"
		echo " like KEEPBACKBUFFER. Everything is downloaded fully"
		echo " and only then sent to client."
		echo ""

		exit 1
	fi
fi

if test "$enable_ssl_tunnel" = "yes"
then
	AC_DEFINE(SSLTUNNEL)
fi

AC_MSG_CHECKING(for ClamAV scanner library)

if test "$enable_clamav" = "yes"
then
	clamprefix="`clamav-config --prefix 2>/dev/null`"
	clamversion="`clamav-config --version 2>/dev/null`"

	if test "x$clamprefix" = "x"
	then
		AC_MSG_RESULT([clamav-config not found])

		echo ""
		echo " Error finding ClamAV installation!"
		echo " Add ClamAV binaries path to PATH and run configure again."
		echo ""
		echo " To disable ClamAV library support, use --disable-clamav."
		echo ""

		exit 1
	fi

	for cl in `clamav-config --cflags 2>/dev/null`; do
		if test "x`echo $cl | perl -ne 'print if (/^-I/)' 2>/dev/null`" != "x"
		then
			CFLAGS="$CFLAGS $cl"
		fi
	done

	for cl in `clamav-config --libs 2>/dev/null`; do
		if test "x`echo $cl | perl -ne 'print if (/(^-L|thread|c_r)/)' 2>/dev/null`" != "x"
		then
			LDFLAGS="$LDFLAGS $cl"
		fi
	done
	LDFLAGS="$LDFLAGS -lclamav"

	SCANNEROBJECTS="clamlibscanner.o"
	AC_DEFINE(USECLAMLIB)

	AC_MSG_RESULT([found $clamversion in $clamprefix])
else
	AC_MSG_RESULT([disabled :-(])
fi

AC_MSG_CHECKING(for Trend Micro scanner)

if test "$enable_trophie" = "yes"
then
	if test -f "/etc/iscan/libvsapi.so"
	then
		AC_MSG_RESULT([/etc/iscan/libvsapi.so found])

		SCANNEROBJECTS="$SCANNEROBJECTS trophiescanner.o"
		LDFLAGS="-L/etc/iscan -lvsapi $LDFLAGS"

		AC_DEFINE(USETROPHIE)
	else
		AC_MSG_RESULT([/etc/iscan/libvsapi.so not found, disabled])
	fi
else
	AC_MSG_RESULT([disabled])
fi

LDFLAGS="$LDFLAGS $OSLIBS"
CFLAGS="$CFLAGS -Wall -g -O2"

test "$prefix" = "NONE" && prefix=/usr/local
test "$localstatedir" = '${prefix}/var' && localstatedir=/var || localstatedir=$localstatedir
sysconfdir=`eval echo $sysconfdir | $PERL -pe 's#/havp/?$##'`
localstatedir=`eval echo $localstatedir`
AC_DEFINE_UNQUOTED(CONFIGFILE, "$sysconfdir/havp/havp.config")
AC_DEFINE_UNQUOTED(WHITELISTFILE, "$sysconfdir/havp/whitelist")
AC_DEFINE_UNQUOTED(BLACKLISTFILE, "$sysconfdir/havp/blacklist")
AC_DEFINE_UNQUOTED(TEMPLATEPATH, "$sysconfdir/havp/templates/en")
AC_DEFINE_UNQUOTED(ACCESSLOG, "$localstatedir/log/havp/access.log")
AC_DEFINE_UNQUOTED(ERRORLOG, "$localstatedir/log/havp/error.log")
AC_DEFINE_UNQUOTED(SCANTEMPFILE, "$localstatedir/tmp/havp/havp-XXXXXX")
AC_DEFINE_UNQUOTED(PIDFILE, "$localstatedir/run/havp/havp.pid")

AC_SUBST(SCANNEROBJECTS)
AC_SUBST(CFLAGS)

AC_OUTPUT(Makefile havp/Makefile havp/scanners/Makefile etc/havp/havp.config)