File: configure.in

package info (click to toggle)
pchar 1.5-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,040 kB
  • sloc: cpp: 12,972; sh: 2,510; makefile: 765
file content (203 lines) | stat: -rw-r--r-- 6,381 bytes parent folder | download
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
dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.in 1082 2005-02-12 19:40:04Z bmah $
dnl  based on: 
dnl $ID: configure.in,v 1.10 1996/10/27 01:35:36 bmah Exp $
AC_PREREQ([2.72])
AC_REVISION($Revision: 1082 $)
AC_INIT
AC_CONFIG_SRCDIR([pc.h])
AC_PROG_CXX
AC_ARG_PROGRAM
AC_CANONICAL_HOST

AC_ARG_WITH(ipv6, [  --with-ipv6		  always enable IPv6 support])
AC_ARG_WITH(pcap, [  --with-pcap		  use pcap library])
AC_ARG_WITH(snmp, [  --with-snmp		  use UCD SNMP library])
AC_ARG_WITH(suid, [  --with-suid		  install SUID root])

dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S

AC_MSG_CHECKING(for pchar version number)
PC_VERSION=`cat ${srcdir}/VERSION`
AC_SUBST(PC_VERSION)
AC_MSG_RESULT("$PC_VERSION")

dnl Check echo functionality
AC_MSG_CHECKING(echo functionality)
if test "`echo "\\n"`" = '\n'; then
	echoqnl='echo "\"\\n\""'
        AC_MSG_RESULT("BSD-style")
else
	echoqnl='echo "\"\\\n\""'
        AC_MSG_RESULT("SysV-style")
fi
dnl Hack as above test did not seem to work properly
echoqnl='printf "\"\\\\n\""'
AC_SUBST(echoqnl)

dnl Check for a bool type.
dnl Hack to make sure SIZEOF_BOOL is defined, even though it is no
dnl longer relevant with recent compilers.
AC_CHECK_TYPE(bool, [ AC_DEFINE(SIZEOF_BOOL) ], [], [
#include <stdbool.h>
])

dnl Check for a socklen_t type.
AC_CHECK_TYPE(socklen_t, [ AC_DEFINE(HAVE_SOCKLEN_T) ], [], [
#include <sys/types.h>
#include <sys/socket.h>
])

# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change.  They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP

AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(strings.h)

dnl Checks for library functions.
AC_CHECK_FUNCS(herror)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_LIB(m, log)

dnl Subsets of object files that we need to link together.
dnl These are defined in the Makefile.  We always need ${OBJ_BASE}.
obj_subsets='${OBJ_BASE}'

dnl IPv6 support if desired.  If the user enabled --with-ipv6,
dnl then force IPv6 support on.  If the user set --without-ipv6,
dnl then force IPv6 support off.  Otherwise, test for a definition
dnl of struct in6_addr and use that to figure out if we have IPv6 on
dnl this system.  An argument to --with-ipv6
dnl is taken as the base directory to where any IPv6 support libraries
dnl live (e.g. with libraries in /usr/local/v6/lib, pchar should
dnl be configured --with-ipv6=/usr/local/v6 to find its libraries).
dnl Specification of a library is not needed with systems that have
dnl IPv6 support built-in, for example, in libc.

AC_CHECK_TYPE(struct in6_addr, [ pchar_cv_sys_ipv6=yes ], [ pchar_cv_sys_ipv6=no ], [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
])

if test "$pchar_cv_sys_ipv6" = "yes"; then
    AC_DEFINE(HAVE_IPV6)
fi

AC_ARG_WITH(ipv6, [  --with-ipv6\t\talways enable IPv6 support],
[ if test "$withval" != no; then pchar_cv_sys_ipv6=yes; fi ])

if test "$pchar_cv_sys_ipv6" = "yes" ; then
    AC_DEFINE(HAVE_IPV6)
    obj_subsets="$obj_subsets \${OBJ_IPV6}"
    if test "$with_ipv6" -a "$with_ipv6" != "yes" ; then
	LDFLAGS="-L$with_ipv6/lib $LDFLAGS"
    fi
    AC_CHECK_LIB(inet6, inet_pton)
fi

dnl UCD SNMP support if desired.  If the user enabled --with-snmp,
dnl then modify the include path and library definitions as needed.
dnl If the user gave an argument to --with-snmp, use that as the
dnl base directory for support libraries and header files.

AC_ARG_WITH(snmp, [  --with-snmp\t\tuse UCD SNMP library],
[ if test "$withval" != no; then pchar_cv_sys_snmp=yes; else pchar_cv_sys_snmp=no; fi ],
[ pchar_cv_sys_snmp=no ])

if test "$pchar_cv_sys_snmp" = "yes"; then
    AC_DEFINE(HAVE_SNMP)
fi

if test "$pchar_cv_sys_snmp" = "yes" ; then
    AC_DEFINE(HAVE_SNMP)
    obj_subsets="$obj_subsets \${OBJ_SNMP}"
    if test "$with_snmp" -a "$with_snmp" != "yes" ; then
	LDFLAGS="-L$with_snmp/lib $LDFLAGS"
	CPPFLAGS="-I$with_snmp/include $CPPFLAGS"
    fi
    AC_CHECK_LIB(crypto, des_cbc_encrypt)
    AC_CHECK_LIB(snmp, snmp_sess_init,,,-lcrypto)
fi

dnl pcap support if desired.  If the user enabled --with-pcap,
dnl the modify the include path and library definitions as needed.
dnl (Basically, do what we do for UCD SNMP support.)

AC_ARG_WITH(pcap, [  --with-pcap\t\tuse pcap library],
[ if test "$withval" != no; then pchar_cv_sys_pcap=yes; else pchar_cv_sys_pcap=no; fi ],
[ pchar_cv_sys_pcap=no ])

if test "$pchar_cv_sys_pcap" = "yes"; then
    AC_DEFINE(HAVE_PCAP)
fi

if test "$pchar_cv_sys_pcap" = "yes" ; then
    AC_DEFINE(HAVE_PCAP)
    obj_subsets="$obj_subsets"
    if test "$with_pcap" -a "$with_pcap" != "yes" ; then
	LDFLAGS="-L$with_pcap/lib $LDFLAGS"
	CPPFLAGS="-I$with_pcap/include $CPPFLAGS"
    fi
    AC_CHECK_LIB(pcap, pcap_open_live)
fi

dnl If we are using pcap, check if we're running it over BPF
dnl The check using "test -r" followed by "test -c" comes from
dnl the pcap configure script.
if test "$pchar_cv_sys_pcap" = "yes"; then
   AC_CHECK_FILE(/dev/bpf0, [ pchar_cv_sys_bpf=yes ], [ pchar_cv_sys_bpf=no ])
   
   if test "$pchar_cv_sys_bpf" = "yes"; then
       AC_DEFINE(HAVE_BPF)
   fi
fi

dnl Set object file list substitution
AC_SUBST(obj_subsets)

dnl Check for setuid root.  If user specified this as an argument
dnl to configure, then turn on that part of the code and tweak our
dnl install program variable.  Doing this is bad for the general case
dnl since anything installed with ${INSTALL_PROGRAM} will get
dnl installed SUID.  Also make sure to strip the binary.
AC_MSG_CHECKING(for SUID root build)
if test "$with_suid" ; then
    if test "$with_suid" = "yes" ; then
	AC_DEFINE(WITH_SUID)
	INSTALL_PROGRAM='${INSTALL} -m 4755 -s'
	AC_MSG_RESULT(yes)
    else
	AC_MSG_RESULT(no)
    fi
else
    AC_MSG_RESULT(no)
fi

dnl OS-specific kludges
AC_MSG_CHECKING(for OS-specific requirements)
case $host in
    *-solaris2*)	AC_DEFINE(NEED_XOPEN)
	case $host in
	    *-solaris2.5.1)	AC_DEFINE(NEED_RANDOM_PROTO)
				AC_MSG_RESULT(Solaris X/Open flags and random prototype) ;;
	    *)			AC_MSG_RESULT(Solaris X/Open flags) ;;
	esac
	;;
    *-irix* | *-osf*)	AC_DEFINE(NEED_GETSOCKNAME_HACK)
			AC_MSG_RESULT(getsockname(3) takes (int *)) ;;
    *-bsdi4.1)		AC_DEFINE(NEED_NRL_IPV6_HACK)
			AC_MSG_RESULT(BSDI 4.1 uses NRL IPv6 stack) ;;
    *)			AC_MSG_RESULT(none);
esac

AC_CONFIG_FILES([Makefile Makefile.depend])
AC_OUTPUT