summaryrefslogtreecommitdiff
path: root/pppd_plugin/configure.in
blob: 6e0e074d353f6b44a94f4dc5ee63803622cd77f4 (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
AC_INIT(configure.in)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(pptp,0.8.4)

AC_LANG_C
AC_PROG_CC
AM_PROG_LIBTOOL

AC_DEFINE(PPPD_VERSION,[],"PPPD version")
AC_DEFINE(KERNELVERSION,[],"kernel version")

CFLAGS="${CFLAGS:=}"

dnl check linux headers
AC_MSG_CHECKING([for linux kernel herders])
if test -n "${KDIR}"; then
    if test -f ${KDIR}/include/linux/version.h; then 
	header=${KDIR}/include
    else
	AC_MSG_RESULT(not found)
	AC_MSG_ERROR(Could not find linux kernel headers)
    fi
else
    kernel=`uname -r`
    if test -f /usr/src/linux/include/linux/version.h; then
	header=/usr/src/linux/include
    elif test -f /lib/modules/${kernel}/build/include/linux/version.h; then 
	header=/lib/modules/${kernel}/build/include
    else
	AC_MSG_RESULT(not found)
	AC_MSG_ERROR(Could not find linux kernel headers)
    fi
fi
VERSION=$(cat ${header/include}Makefile | grep '^VERSION = ' | awk '{print $3}')
PATCHLEVEL=$(cat ${header/include}Makefile | grep '^PATCHLEVEL = ' | awk '{print $3}')
SUBLEVEL=$(cat ${header/include}Makefile | grep '^SUBLEVEL = ' | awk '{print $3}')
EXTRAVERSION=$(cat ${header/include}Makefile | grep '^EXTRAVERSION = ' | awk '{print $3}')
KERNELVERSION=$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION
AC_MSG_RESULT(found ($KERNELVERSION at ${header/include}))
AC_DEFINE_UNQUOTED(KERNELVERSION,"$KERNELVERSION")


CFLAGS="${CFLAGS} -I. -I${header}"

AC_MSG_CHECKING([for pppd])
pppd=`which pppd 2>&1`
if test $? -eq 1; then
    pppd=""
    for path in /usr/sbin /usr/local/sbin /usr/bin /usr/local/bin /sbin; do
	if test -x ${path}/pppd; then
	    pppd=${path}/pppd
	    break;
        fi
    done
fi

if test -z "${pppd}"; then
    AC_MSG_RESULT(not found)
    AC_MSG_ERROR(Could not find pppd)
fi    
pppd_ver=`${pppd} --version 2>&1 | grep version | sed 's/pppd version //'`
AC_MSG_RESULT($pppd ($pppd_ver))
AC_DEFINE_UNQUOTED(PPPD_VERSION,"${pppd_ver}")

echo '==============================================================================='

echo 'Configuration chosen:'
echo    '   PPPD:              '${pppd_ver}
echo    '   linux kernel :     '$KERNELVERSION at ${header/include}

AC_OUTPUT(Makefile src/Makefile)