1 |
pcg |
1.1 |
dnl Check to find out whether the running kernel has support for TUN/TAP |
2 |
|
|
|
3 |
|
|
AC_DEFUN(tinc_TUNTAP, |
4 |
|
|
[ |
5 |
|
|
AC_ARG_WITH(kernel, |
6 |
|
|
[ --with-kernel=dir give the directory with kernel sources] |
7 |
|
|
[ (default: /usr/src/linux)], |
8 |
|
|
kerneldir="$withval", |
9 |
|
|
kerneldir="/usr/src/linux" |
10 |
|
|
) |
11 |
|
|
|
12 |
|
|
AC_CACHE_CHECK([for linux/if_tun.h], tinc_cv_linux_if_tun_h, |
13 |
|
|
[ |
14 |
|
|
AC_TRY_COMPILE([#include "$kerneldir/include/linux/if_tun.h"], |
15 |
|
|
[int a = IFF_TAP;], |
16 |
|
|
if_tun_h="\"$kerneldir/include/linux/if_tun.h\"", |
17 |
|
|
[AC_TRY_COMPILE([#include <linux/if_tun.h>], |
18 |
|
|
[int a = IFF_TAP;], |
19 |
|
|
if_tun_h="default", |
20 |
|
|
if_tun_h="no" |
21 |
|
|
)] |
22 |
|
|
) |
23 |
|
|
|
24 |
|
|
if test $if_tun_h = no; then |
25 |
|
|
tinc_cv_linux_if_tun_h=none |
26 |
|
|
else |
27 |
|
|
tinc_cv_linux_if_tun_h="$if_tun_h" |
28 |
|
|
fi |
29 |
|
|
]) |
30 |
|
|
|
31 |
|
|
if test $tinc_cv_linux_if_tun_h != none; then |
32 |
|
|
AC_DEFINE(HAVE_TUNTAP, 1, [Universal tun/tap driver present]) |
33 |
|
|
if test $tinc_cv_linux_if_tun_h != default; then |
34 |
|
|
AC_DEFINE_UNQUOTED(LINUX_IF_TUN_H, $tinc_cv_linux_if_tun_h, [Location of if_tun.h]) |
35 |
|
|
fi |
36 |
|
|
fi |
37 |
|
|
AC_SUBST(LINUX_IF_TUN_H) |
38 |
|
|
AC_SUBST(HAVE_TUNTAP) |
39 |
|
|
]) |