summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/rp-pppoe/src/configure.in
blob: c11690179109d0ddaeb5c1ee4f79da2e82634977 (plain)
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(pppoe.c)

AC_CONFIG_HEADER(config.h)

AC_PREFIX_DEFAULT(/usr)

dnl Checks for programs.
AC_PROG_CC

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h syslog.h unistd.h net/if_arp.h netinet/if_ether.h getopt.h sys/uio.h sys/param.h fcntl.h net/bpf.h netpacket/packet.h net/ethernet.h asm/types.h linux/if_packet.h linux/if_ether.h linux/if_pppox.h sys/socket.h sys/cdefs.h linux/if.h net/if.h net/if_dl.h net/if_ether.h net/if_types.h netinet/if_ether.h net/if_types.h net/if_dl.h sys/dlpi.h )

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_HEADER_TIME
AC_STRUCT_TM

dnl Check for an echo which supports -n -- another hack for Solaris
AC_PATH_PROG(ECHO, echo, "", /usr/ucb/bin:$PATH)

dnl Check for sockaddr_ll
$ECHO -n "checking for struct sockaddr_ll... "
AC_TRY_COMPILE([#include <asm/types.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
], [struct sockaddr_ll sa;],
ac_cv_struct_sockaddr_ll=yes, ac_cv_struct_sockaddr_ll=no)
$ECHO $ac_cv_struct_sockaddr_ll
if test "$ac_cv_struct_sockaddr_ll" = yes ; then
AC_DEFINE(HAVE_STRUCT_SOCKADDR_LL)
fi

dnl Check for N_HDLC line discipline
$ECHO -n "checking for N_HDLC line discipline... "
AC_TRY_COMPILE([#include <linux/termios.h>],
	[int x = N_HDLC;],
	ac_cv_n_hdlc=yes, ac_cv_n_hdlc=no)
$ECHO $ac_cv_n_hdlc
if test "$ac_cv_n_hdlc" = yes ; then
AC_DEFINE(HAVE_N_HDLC)
fi

AC_ARG_ENABLE(plugin, [  --enable-plugin=pppd_src_path   build pppd plugin], ac_cv_pluginpath=$enableval, ac_cv_pluginpath=no)

dnl Determine whether or not to build Linux pppd plugin
LINUX_KERNELMODE_PLUGIN=""
PPPD_INCDIR=""
if test "$ac_cv_header_linux_if_pppox_h" = yes ; then
	if test "$ac_cv_pluginpath" != no ; then
		LINUX_KERNELMODE_PLUGIN=rp-pppoe.so
		PPPD_INCDIR=$ac_cv_pluginpath
	fi
fi

AC_SUBST(LINUX_KERNELMODE_PLUGIN)
AC_SUBST(PPPD_INCDIR)

dnl Determine whether or not to build PPPoE relay
PPPOE_RELAY=""
if test "`uname -s`" = "Linux" ; then
	PPPOE_RELAY=pppoe-relay
fi
AC_SUBST(PPPOE_RELAY)

dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_SETVBUF_REVERSED
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(select socket strerror strtol)
AC_PROG_INSTALL

dnl Integer sizes
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)

dnl Check for location of pppd
AC_PATH_PROG(PPPD, pppd, NOTFOUND, $PATH:/sbin:/usr/sbin:/usr/local/sbin)

dnl Check for setsid (probably Linux-specific)
AC_PATH_PROG(SETSID, setsid, "", $PATH:/sbin:/usr/sbin:/usr/local/sbin)

dnl Check for an "id" which accepts "-u" option -- hack for Solaris.
AC_PATH_PROG(ID, id, "", /usr/xpg4/bin:$PATH)

dnl Check for Linux-specific kernel support for PPPoE
$ECHO -n "checking for Linux 2.4.X kernel-mode PPPoE support..."
if test "`uname -s`" = "Linux" ; then
AC_TRY_RUN([#include <sys/socket.h>
#include <net/ethernet.h>
#include <linux/if.h>
#include <linux/if_pppox.h>
int main()
{
	if (socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OE) >= 0) return 0; else return 1;
}
], ac_cv_linux_kernel_pppoe=yes, ac_cv_linux_kernel_pppoe=no)
else
	ac_cv_linux_kernel_pppoe=no
fi

$ECHO $ac_cv_linux_kernel_pppoe
if test "$ac_cv_linux_kernel_pppoe" = yes ; then
    AC_DEFINE(HAVE_LINUX_KERNEL_PPPOE)
fi

dnl GCC warning level
if test "$GCC" = yes; then
	CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
fi

dnl If we couldn't find pppd, die
if test "$PPPD" = "NOTFOUND"; then
	$ECHO ""
	$ECHO "*** Oops!  I couldn't find pppd, the PPP daemon anywhere."
	$ECHO "*** You must install pppd, version 2.3.10 or later."
	$ECHO "*** I will keep going, but it may not work."
	$ECHO ""
fi

dnl Figure out pppd version.  2.3.7 to 2.3.9 -- issue warning.  Less than
dnl 2.3.7 -- stop

PPPD_VERSION=`$PPPD --version 2>&1 | awk '{print $NF}'`

case "$PPPD_VERSION" in
1.*|2.0.*|2.1.*|2.2.*|2.3.0|2.3.1|2.3.2|2.3.3|2.3.4|2.3.5|2.3.6)
	$ECHO ""
	$ECHO "*** Oops! Your version of pppd is $PPPD_VERSION, which is too old."
	$ECHO "*** You need at least 2.3.7 (2.3.10 or newer recommended.)"
	$ECHO "*** I will keep going, but it may not work."
	$ECHO ""
	;;

2.3.7|2.3.8|2.3.9)
	$ECHO ""
	$ECHO "*** Warning.  Your version of pppd is $PPPD_VERSION.  You will"
	$ECHO "*** not be able to use connect-on-demand.  Upgrade to pppd"
	$ECHO "*** 2.3.10 or newer if you need connect-on-demand."
	$ECHO ""
	;;

2*|3*|4*|5*|6*|7*|8*|9*)
	;;

*)
	$ECHO ""
	$ECHO "*** Oops.  I cannot figure out what version of pppd you have."
	$ECHO "*** All I got back was '$PPPD_VERSION'"
	$ECHO "*** I will keep going, but it may not work."
	$ECHO ""
	;;
esac

dnl Figure out packing order of structures
$ECHO -n "checking packing order of bit fields... "
AC_TRY_RUN([
union foo {
    struct bar {
	unsigned int ver:4;
	unsigned int type:4;
    } bb;
    unsigned char baz;
};

int
main(void)
{
    union foo x;
    x.bb.ver = 1;
    x.bb.type = 2;
    if (x.baz == 0x21) {
	return 1;
    } else if (x.baz == 0x12) {
	return 0;
    } else {
	return 2;
    }
}], PACK=normal, PACK=rev)

if test "$PACK" = "rev" ; then
	$ECHO "reversed"
	AC_DEFINE(PACK_BITFIELDS_REVERSED)
else
	$ECHO "normal"
fi

# Sigh... got to fix this up for tcl
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'

# Fully resolve WRAPPER for Tcl script.
WRAPPER=${sbindir}/pppoe-wrapper
eval "WRAPPER=${WRAPPER}"
eval "WRAPPER=${WRAPPER}"
AC_SUBST(WRAPPER)

# Determine what targets to build
TARGETS="pppoe pppoe-server"

# pppoe-sniff is built only on Linux and Solaris
if test "$ac_cv_header_linux_if_packet_h" = "yes" -o "$ac_cv_header_sys_dlpi_h" = "yes" ; then
	TARGETS="$TARGETS pppoe-sniff"
fi

# pppoe-relay is built only on Linux
if test "$ac_cv_header_linux_if_packet_h" = "yes" ; then
	TARGETS="$TARGETS pppoe-relay"
fi

# plugin is built only if we have kernel support
if test -n "$LINUX_KERNELMODE_PLUGIN" ; then
	TARGETS="$TARGETS $LINUX_KERNELMODE_PLUGIN"
fi

AC_SUBST(TARGETS)

AC_OUTPUT(Makefile ../scripts/adsl-connect ../scripts/adsl-start ../scripts/adsl-stop ../scripts/adsl-init ../scripts/adsl-init-suse ../scripts/adsl-init-turbolinux ../scripts/adsl-setup ../gui/Makefile ../gui/tkpppoe)

$ECHO ""
$ECHO "On this platform, the following targets will be built:"
$ECHO "        $TARGETS"
$ECHO ""
$ECHO "Type 'make' to compile the software."