-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathacinclude.m4
82 lines (70 loc) · 2.18 KB
/
acinclude.m4
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
## $Id: acinclude.m4,v 1.12 2008/09/25 17:36:08 lirc Exp $
##
## additional m4 macros
##
## (C) 1999 Christoph Bartelmus ([email protected])
##
dnl check for kernel source
AC_DEFUN([AC_PATH_KERNEL_SOURCE_SEARCH],
[
kerneldir=missing
kernelext=ko
no_kernel=yes
if test `uname` != "Linux"; then
kerneldir="not running Linux"
else
for dir in /usr/src/kernel-source-`uname -r` /usr/src/linux-`uname -r` /usr/src/linux /lib/modules/`uname -r`/source /lib/modules/`uname -r`/build ${ac_kerneldir}; do
if test -d $dir; then
kerneldir=`dirname $dir/Makefile`/
no_kernel=no
fi;
done
fi
if test x${no_kernel} != xyes; then
if test -f ${kerneldir}/Makefile; then
if test "${ac_pkss_mktemp}" = "yes"; then
ac_pkss_makefile=`mktemp /tmp/LIRCMF.XXXXXX`
else
ac_pkss_makefile=/tmp/LIRCMF.XXXXXX
fi
cat ${kerneldir}/Makefile >${ac_pkss_makefile}
echo "lirc_tell_me_what_version_is:" >>${ac_pkss_makefile}
echo " echo \$(VERSION)" >>${ac_pkss_makefile}
echo "lirc_tell_me_what_patchlevel_is:" >>${ac_pkss_makefile}
echo " echo \$(PATCHLEVEL)" >>${ac_pkss_makefile}
version=$(make -s -C ${kerneldir} -f ${ac_pkss_makefile} lirc_tell_me_what_version_is M=$(pwd))
patchlevel=$(make -s -C ${kerneldir} -f ${ac_pkss_makefile} lirc_tell_me_what_patchlevel_is M=$(pwd))
if test ${version} -eq 2; then
if test ${patchlevel} -lt 5; then
kernelext=o
fi
fi
rm -f ${ac_pkss_makefile}
else
kerneldir="no Makefile found"
no_kernel=yes
fi
fi
ac_cv_have_kernel="no_kernel=${no_kernel} \
kerneldir=\"${kerneldir}\" \
kernelext=\"${kernelext}\""
]
)
AC_DEFUN([AC_PATH_KERNEL_SOURCE],
[
AC_CHECK_PROG(ac_pkss_mktemp,mktemp,yes,no)
AC_PROVIDE([AC_PATH_KERNEL_SOURCE])
AC_MSG_CHECKING(for Linux kernel sources)
AC_ARG_WITH(kerneldir,
[ --with-kerneldir=DIR kernel sources in DIR],
ac_kerneldir=${withval}
AC_PATH_KERNEL_SOURCE_SEARCH,
ac_kerneldir=""
AC_CACHE_VAL(ac_cv_have_kernel,AC_PATH_KERNEL_SOURCE_SEARCH)
)
eval "$ac_cv_have_kernel"
AC_SUBST(kerneldir)
AC_SUBST(kernelext)
AC_MSG_RESULT(${kerneldir})
]
)