File: configure.in

package info (click to toggle)
packit 1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, lenny, squeeze, wheezy
  • size: 828 kB
  • ctags: 376
  • sloc: ansic: 3,442; sh: 3,197; makefile: 95
file content (256 lines) | stat: -rw-r--r-- 7,575 bytes parent folder | download | duplicates (2)
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
#
# author: Darren Bounds <dbounds@intrusense.com>
# copyright: Copyright (C) 2002 by Darren Bounds
# license: This software is under GPL version 2 of license
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# packit official page at http://packit.sourceforge.net
#
#

dnl Copyright (c) 2002-2003 Darren Bounds
dnl All rights reserved.

AC_INIT(src/main.c)
AM_CONFIG_HEADER(config.h)
PACKIT_VERSION=`cat VERSION`
AC_MSG_RESULT(beginning auto-configuration process for packit-$PACKIT_VERSION...)
AM_INIT_AUTOMAKE(packit, $PACKIT_VERSION)
AC_SUBST(PACKIT_VERSION)
AC_PREFIX_DEFAULT(/usr/local)

AC_PROG_CC
AC_MSG_CHECKING(for gcc)
if test "$GCC" = yes; then
    CFLAGS="${CFLAGS} -Wall"
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi

DEBUG="no"
BINS="packit"

AC_ARG_ENABLE(debug, 
    [ --enable-debug          Enable debugging],
    [ if test "$GCC" = yes; then
          DEBUG="yes"
          CFLAGS="${CFLAGS} -DDEBUG -ggdb"
      else
          DEBUG="yes"
          CFLAGS="${CFLAGS} -DDEBUG"
      fi
    ],)

AC_ARG_WITH(capture,
    [ --without-capture       Remove packet capture support],
    with_capture=$withval, with_capture=yes)
if test "x$with_capture" = "xyes" ; then
    with_capture="yes"
    AC_DEFINE(WITH_CAPTURE, 1, Enable Capture)
else
    with_capture="no"
fi

AC_ARG_WITH(injection,
    [  --without-injection     Remove packet injection support],
    with_injection=$withval,with_injection=yes)
if test "x$with_injection" = "xyes"; then
    with_injection="yes"
    AC_DEFINE(WITH_INJECTION, 1, Enable Injection)
else
    with_injection="no"
fi

AC_SUBST(BINS)
AC_CANONICAL_HOST

SHELL="/bin/sh"

INCLUDES='-I$(top_srcdir) -I$(top_srcdir)/includes'

dnl Checks for OS type.
case "$host" in
    *-freebsd*)
        AC_DEFINE(BSD_DERIVED, 1, OS BSD Derived)
        AC_DEFINE(FREEBSD, 1, FreeBSD)
        ;;
    *-netbsd*)
        AC_DEFINE(BSD_DERIVED, 1, OS BSD Derived)
        AC_DEFINE(NETBSD, 1, NetBSD)
        ;;
    *-openbsd*)
        AC_DEFINE(BSD_DERIVED, 1, OS BSD Derived)
        AC_DEFINE(FREEBSD, 1, OpenBSD)
        ;;
    *-apple*)
        AC_DEFINE(BSD_DERIVED, 1, OS BSD Derived)
        AC_DEFINE(MACOS, 1, MacOS)
        LDFLAGS="${LDFLAGS} -L/sw/lib"
        INCLUDES="${INCLUDES} -I/sw/include";
        ;;
    *-linux*)
        AC_DEFINE(SYSV_DERIVED, 1, OS SysV Derived)
        AC_DEFINE(LINUX, 1, Linux)
        INCLUDES="${INCLUDES} -I/usr/include/pcap";
        ;;
    *-solaris*)
        AC_DEFINE(SYSV_DERIVED, 1, OS SysV Derived)
        AC_DEFINE(SOLARIS, 1, Solaris)
        ;;
    *-aix*)
        AC_DEFINE(SYSV_DERIVED, 1, OS SysV Derived)
        AC_DEFINE(AIX, 1, AIX)
        ;;
    *-hpux*)
        AC_DEFINE(SYSV_DERIVED, 1, OS SysV Derived)
        AC_DEFINE(HPUX, 1, HPUX) 
        ;;
esac

AC_SUBST(INCLUDES)

dnl Checks for typedef
AC_CHECK_TYPE(u_int8_t, unsigned char)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(u_int32_t, unsigned int)
AC_CHECK_TYPE(u_int64_t, unsigned long long)

dnl Checks for header files.
AC_CHECK_HEADERS(signal.h pcap-bpf.h sys/time.h)

AC_ARG_WITH(libnet_includes,
    [  --with-libnet-includes=DIR    libnet include directory],
    [with_libnet_includes="$withval"],[with_libnet_includes=no])

if test "$with_libnet_includes" != "no"; then
    CFLAGS="${CFLAGS} -I${with_libnet_includes}"
fi

AC_CHECK_HEADERS(libnet.h,, LIBNET="no")
if test "$LIBNET" = "no"; then
    echo ""
    echo "Error: Can't find libnet 1.1.0 or greater. Visit http://www.packetfactory.net/libnet for the latest version."
    exit;
fi  

AC_ARG_WITH(libpcap_includes,
     [  --with-libpcap-includes=DIR   libcap include directory],
     [with_libpcap_includes="$withval"],[with_libpcap_includes=no])

if test "$with_libpcap_includes" != "no"; then
    CFLAGS="${CFLAGS} -I${with_libpcap_includes}"
fi

AC_CHECK_HEADERS(pcap.h,, LIBPCAP="no")
if test "$LIBNET" = "no"; then
    echo ""
    echo "Error: Can't find Libpcap. Visit http://www.tcpdump.org for the latest version."
    exit;
fi

dnl Checks for library functions.
AC_CHECK_FUNCS(printf fprintf snprintf sprintf strdup strrchr strstr strncasecmp \
    strtol strncmp strncat memset malloc gethostbyname gettimeofday getuid \
    select setitimer)

AC_ARG_WITH(libnet_libraries,
    [  --with-libnet-libraries=DIR   libnet library directory],
    [with_libnet_libraries="$withval"],[with_libnet_libraries=no])

if test "$with_libnet_libraries" != "no"; then
    LDFLAGS="${LDFLAGS} -L${with_libnet_libraries}"
fi

AC_CHECK_LIB(net, libnet_build_ipv4,, LIBNET="no")
if test "$LIBNET" = "no"; then
    echo ""
    echo "Error: Can't find libnet 1.1.0 or greater. Visit http://www.packetfactory.net/libnet for the latest version."
    exit;
fi  

AC_ARG_WITH(libpcap_libraries,
    [  --with-libpcap-libraries=DIR  libcap library directory],
    [with_libpcap_libraries="$withval"],[with_libpcap_libraries=no])

if test "$with_libpcap_libraries" != "no"; then
    LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
fi

AC_CHECK_LIB(pcap, pcap_open_live,, LIBPCAP="no")
if test "$LIBPCAP" = "no"; then
    echo ""
    echo "Error: Can't find Libpcap. Visit http://www.tcpdump.org for the latest version."
    exit;
else
    AC_CHECK_LIB(pcap, pcap_setnonblock,, SETNONBLOCK="no")
    if test "$SETNONBLOCK" = "no"; then
        echo "compensating for lack of pcap_setnonblock()"
    else
        AC_DEFINE(HAVE_SETNONBLOCK, 1 , SETNONBLOCK)
    fi

    AC_CHECK_LIB(pcap, pcap_freecode,, FREECODE="no")
    if test "$FREECODE" = "no"; then
        echo "compensating for lack of pcap_freecode()"
    else
        AC_DEFINE(HAVE_FREECODE, 1, FREECODE)
    fi
fi

AC_MSG_CHECKING(for bpf)
if test -r /dev/bpf0; then
    AC_DEFINE(HAVE_BPF, 1, BPF)
    AC_MSG_RESULT(yes)
elif test -c /dev/bpf0; then
    AC_DEFINE(HAVE_BPF, 1, BPF)
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi

AC_PROG_INSTALL
AC_OUTPUT(Makefile src/Makefile man/Makefile man/packit.8 src/version.h)

BINDIR=`eval echo ${bindir}`; BINDIR=`eval echo ${BINDIR}`;
MANDIR=`eval echo ${mandir}/${mansubdir}`; MANDIR=`eval echo ${MANDIR}`;

echo ""
echo "                  _    _ _"   
echo " _ __   __ _  ___| | _(_) |_" 
echo "| '_ \ / _\` |/ __| |/ / | __|"
echo "| |_) | (_| | (__|   <| | |_" 
echo "| .__/ \__,_|\___|_|\_\_|\__|"
echo "|_|                       $PACKIT_VERSION"
echo ""
echo "has been configured with the following options:"
echo "-----------------------------------------------"
echo "Host type             : ${host}"
echo "Compiler              : ${CC}"
echo "Compiler flags        : ${CFLAGS}"
echo "Linker flags          : ${LDFLAGS}"
echo "Libraries             : ${LIBS}"
echo ""
echo "Binary                : ${BINDIR}"
echo "Manual pages          : ${MANDIR}"
echo ""
echo "Injection support     : ${with_injection}"
echo "Capture support       : ${with_capture}"
echo "Enable debugging      : ${DEBUG}"
echo "-----------------------------------------------"
echo ""

dnl EOF