[go: up one dir, main page]

File: configure.in

package info (click to toggle)
farpd 0.2-11.1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 472 kB
  • sloc: sh: 3,553; ansic: 1,009; makefile: 75
file content (189 lines) | stat: -rw-r--r-- 4,747 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

AC_INIT(arpd.c)

AM_INIT_AUTOMAKE(arpd, 0.2)
AM_CONFIG_HEADER(config.h)

dnl Initialize prefix.
if test "$prefix" = "NONE"; then
   prefix="/usr/local"
fi

dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S

dnl Checks for libraries.
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)

dnl Checks for (installed) libdumbnet
AC_MSG_CHECKING(for libdumbnet)
AC_ARG_WITH(libdumbnet,
[  --with-libdumbnet=DIR      use libdumbnet in DIR],
[ case "$withval" in
  yes|no)
     AC_MSG_RESULT(no)
     ;;
  *)
     AC_MSG_RESULT($withval)
     if test -f $withval/src/libdumbnet.a; then
        DNETINC="-I$withval/include"
        DNETLIB="-L$withval/src -ldumbnet `$withval/dumbnet-config --libs`"
     elif test -x $withval/bin/dumbnet-config; then
        DNETINC="`$withval/bin/dumbnet-config --cflags`"
        DNETLIB="`$withval/bin/dumbnet-config --libs`"
     else
        AC_ERROR(dumbnet-config not found in $withval/bin)
     fi
     ;;
  esac ],
[ if test -x ${prefix}/bin/dumbnet-config; then
     DNETINC="`${prefix}/bin/dumbnet-config --cflags`"
     DNETLIB="`${prefix}/bin/dumbnet-config --libs`"
  else
     AC_MSG_RESULT(no)
     AC_ERROR(libdumbnet not found)
  fi
  AC_MSG_RESULT(yes) ]
)
AC_SUBST(DNETINC)
AC_SUBST(DNETLIB)

dnl Checks for libevent
AC_MSG_CHECKING(for libevent)
AC_ARG_WITH(libevent,
[  --with-libevent=DIR     use libevent in DIR],
[ case "$withval" in
  yes|no)
     AC_MSG_RESULT(no)
     ;;
  *)
     AC_MSG_RESULT($withval)
     if test -f $withval/include/event.h -a -f $withval/lib/libevent.a; then
        owd=`pwd`
        if cd $withval; then withval=`pwd`; cd $owd; fi
        EVENTINC="-I$withval/include"
        EVENTLIB="-L$withval/lib -levent"
     elif test -f $withval/event.h -a -f $withval/libevent.a; then
        owd=`pwd`
        if cd $withval; then withval=`pwd`; cd $owd; fi
        EVENTINC="-I$withval"
        EVENTLIB="-L$withval -levent"
     else
        AC_ERROR(event.h or libevent.a not found in $withval)
     fi
     ;;
  esac ],
[ if test -f ${prefix}/include/event.h -a -f ${prefix}/lib/${host}/libevent.a;
then
     EVENTINC="-I${prefix}/include"
     EVENTLIB="-L${prefix}/lib -levent"
  else
     AC_MSG_RESULT(no)
     AC_ERROR(libevent not found)
  fi
  AC_MSG_RESULT(yes) ]
)
AC_SUBST(EVENTINC)
AC_SUBST(EVENTLIB)

dnl Checks for libpcap
AC_MSG_CHECKING(for libpcap)
AC_ARG_WITH(libpcap,
[  --with-libpcap=DIR      use libpcap in DIR],
[ case "$withval" in
  yes|no)
     AC_MSG_RESULT(no)
     ;;
  *)
     AC_MSG_RESULT($withval)
     if test -f $withval/pcap.h -a -f $withval/libpcap.a; then
        owd=`pwd`
        if cd $withval; then withval=`pwd`; cd $owd; fi
        PCAPINC="-I$withval -I$withval/bpf"
        PCAPLIB="-L$withval -lpcap"
     elif test -f $withval/include/pcap.h -a \
               -f $withval/include/net/bpf.h; then
        owd=`pwd`
        if cd $withval; then withval=`pwd`; cd $owd; fi
        PCAPINC="-I$withval/include"
        if test -f $withval/lib/libwpcap.a; then
           PCAPLIB="-L$withval/lib -lwpcap"
        else
           PCAPLIB="-L$withval/lib -lpcap"
        fi
     else
        AC_ERROR(pcap.h, net/bpf.h, or libpcap.a not found in
	$withval)
     fi
     ;;
  esac ],
[ if test -f ${prefix}/include/pcap.h; then
     PCAPINC="-I${prefix}/include"
     if test -f ${prefix}/lib/libwpcap.a; then
        PCAPLIB="-L${prefix}/lib -lwpcap"
     else
        PCAPLIB="-L${prefix}/lib -lpcap"
     fi
  elif test -f /usr/include/pcap/pcap.h; then
     PCAPINC="-I/usr/include/pcap"
     PCAPLIB="-lpcap"
  elif test -f /usr/include/pcap.h; then
     PCAPLIB="-lpcap"
  else
     AC_MSG_RESULT(no)
     AC_ERROR(libpcap not found)
  fi
  AC_MSG_RESULT(yes) ]
)
AC_SUBST(PCAPINC)
AC_SUBST(PCAPLIB)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(paths.h sys/ioctl.h syslog.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
AC_PROG_GCC_TRADITIONAL
if test "$GCC" = yes; then
   CFLAGS="$CFLAGS -Wall"
fi

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_REPLACE_FUNCS(daemon)

CFLAGS=$DNETINC
LIBS=$DNETLIB

dnl see if dumbnet works
        AC_MSG_CHECKING(for working addr_cmp in libdumbnet)
        AC_TRY_RUN(
#include <sys/types.h>
#include <stdlib.h>
#include <dumbnet.h>
int
main(int argc, char **argv)
{
	struct addr a1;
	struct addr a2;

	memset(&a1, 0, sizeof(a1));
	memset(&a2, 0, sizeof(a2));

	a1.addr_type = a2.addr_type = ADDR_TYPE_IP;
	a1.addr_bits = a2.addr_bits = IP_ADDR_BITS;
	memset(&a2.addr_ip, 1, sizeof(a2.addr_ip));

        exit(addr_cmp(&a1, &a2) > 0);
}, AC_MSG_RESULT(yes), [
        AC_MSG_RESULT(no)
        AC_DEFINE(HAVE_BROKEN_DNET)
], AC_MSG_RESULT(yes))

AC_OUTPUT(Makefile)