]> git.proxmox.com Git - mirror_spl-debian.git/blame - configure.ac
Almost dropped this!
[mirror_spl-debian.git] / configure.ac
CommitLineData
f1ca4da6 1AC_INIT
2
3AC_CANONICAL_SYSTEM
4AM_INIT_AUTOMAKE(spl, 0.0.1)
f4b37741 5AC_CONFIG_HEADERS([config.h])
f1ca4da6 6
7AC_PROG_INSTALL
8AC_PROG_CC
564f6d15 9AC_PROG_LIBTOOL
f1ca4da6 10
11ver=`uname -r`
f1ca4da6 12kernelsrc=
13kernelbuild=
14AC_ARG_WITH(kernel,
15 [ --with-linux=PATH Path to kernel source ],
16 [kernelsrc="$withval"; kernelbuild="$withval"])
17AC_ARG_WITH(kernel-build,
18 [ --with-linux-obj=PATH Path to kernel build objects ],
19 [kernelbuild="$withval"])
20
21AC_MSG_CHECKING([kernel source directory])
22if test -z "$kernelsrc"; then
23 kernelbuild=
24 sourcelink=/lib/modules/${ver}/source
25 buildlink=/lib/modules/${ver}/build
26
27 if test -e $sourcelink; then
28 kernelsrc=`(cd $sourcelink; /bin/pwd)`
29 fi
30 if test -e $buildlink; then
31 kernelbuild=`(cd $buildlink; /bin/pwd)`
32 fi
33 if test -z "$kernelsrc"; then
34 kernelsrc=$kernelbuild
35 fi
36 if test -z "$kernelsrc" -o -z "$kernelbuild"; then
37 AC_MSG_RESULT([Not found])
38 AC_MSG_ERROR([
39 *** Please specify the location of the kernel source
40 *** with the '--with-kernel=PATH' option])
41 fi
42fi
43
44AC_MSG_RESULT([$kernelsrc])
45AC_MSG_CHECKING([kernel build directory])
46AC_MSG_RESULT([$kernelbuild])
47
48AC_MSG_CHECKING([kernel source version])
49if test -r $kernelbuild/include/linux/version.h &&
50 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
51
52 kernsrcver=`(echo "#include <linux/version.h>";
53 echo "kernsrcver=UTS_RELEASE") |
54 cpp -I $kernelbuild/include |
55 grep "^kernsrcver=" | cut -d \" -f 2`
56
57elif test -r $kernelbuild/include/linux/utsrelease.h &&
58 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
59
60 kernsrcver=`(echo "#include <linux/utsrelease.h>";
61 echo "kernsrcver=UTS_RELEASE") |
62 cpp -I $kernelbuild/include |
63 grep "^kernsrcver=" | cut -d \" -f 2`
64fi
65
66if test -z "$kernsrcver"; then
67 AC_MSG_RESULT([Not found])
68 AC_MSG_ERROR([
69 *** Cannot determine the version of the linux kernel source.
70 *** Please prepare the kernel before running this script])
71fi
72
73AC_MSG_RESULT([$kernsrcver])
74kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
75AC_SUBST(kernelsrc)
76AC_SUBST(kmoduledir)
77
78#
79# Each version of the kernel provides a slightly different
80# ABI, so figure out what we have to work with and adapt.
81#
82AC_MSG_CHECKING([if kernel defines kzalloc function])
83if egrep -qw "kzalloc" $kernelsrc/include/linux/slab.h; then
84 AC_DEFINE(HAVE_KZALLOC, 1, [kzalloc() is defined])
85 AC_MSG_RESULT([yes])
86else
87 AC_MSG_RESULT([no])
88fi
89
f1ca4da6 90
91AC_MSG_CHECKING([if kernel has mutex.h ])
92if test -f $kernelsrc/include/linux/mutex.h; then
93 AC_DEFINE(HAVE_MUTEX_H, 1, [kernel has mutex.h])
94 AC_MSG_RESULT([yes])
95else
96 AC_MSG_RESULT([no])
97fi
98
3d4ea0ce 99# Add "V=1" to KERNELMAKE_PARAMS to enable verbose module build
100KERNELMAKE_PARAMS=
101KERNELCPPFLAGS="-I`/bin/pwd`/include"
102
f1ca4da6 103if test "$kernelbuild" != "$kernelsrc"; then
104 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
105fi
106
107AC_SUBST(KERNELMAKE_PARAMS)
108AC_SUBST(KERNELCPPFLAGS)
109AC_SUBST(KERNELCFLAGS)
110
111AC_CONFIG_FILES([ Makefile
a0aadf56 112 lib/Makefile
113 cmd/Makefile
114 modules/Makefile
115 modules/spl/Makefile
116 modules/splat/Makefile
f1ca4da6 117 include/Makefile
f4b37741 118 include/sys/Makefile
f1ca4da6 119 scripts/Makefile
120 scripts/spl.spec
121 ])
122
123AC_OUTPUT