]> git.proxmox.com Git - mirror_spl-debian.git/blob - configure.ac
Give it a real version for a tag
[mirror_spl-debian.git] / configure.ac
1 AC_INIT
2
3 AC_CANONICAL_SYSTEM
4 AM_INIT_AUTOMAKE(spl, 0.2.0)
5 AC_CONFIG_HEADERS([config.h])
6
7 AC_PROG_INSTALL
8 AC_PROG_CC
9 AC_PROG_LIBTOOL
10
11 ver=`uname -r`
12 kernelsrc=
13 kernelbuild=
14 AC_ARG_WITH(kernel,
15 [ --with-linux=PATH Path to kernel source ],
16 [kernelsrc="$withval"; kernelbuild="$withval"])
17 AC_ARG_WITH(kernel-build,
18 [ --with-linux-obj=PATH Path to kernel build objects ],
19 [kernelbuild="$withval"])
20
21 AC_MSG_CHECKING([kernel source directory])
22 if 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
42 fi
43
44 AC_MSG_RESULT([$kernelsrc])
45 AC_MSG_CHECKING([kernel build directory])
46 AC_MSG_RESULT([$kernelbuild])
47
48 AC_MSG_CHECKING([kernel source version])
49 if 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
57 elif 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`
64 fi
65
66 if 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])
71 fi
72
73 AC_MSG_RESULT([$kernsrcver])
74 kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
75 AC_SUBST(kernelsrc)
76 AC_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 #
82 AC_MSG_CHECKING([if kernel defines kzalloc function])
83 if egrep -qw "kzalloc" $kernelsrc/include/linux/slab.h; then
84 AC_DEFINE(HAVE_KZALLOC, 1, [kzalloc() is defined])
85 AC_MSG_RESULT([yes])
86 else
87 AC_MSG_RESULT([no])
88 fi
89
90
91 AC_MSG_CHECKING([if kernel has mutex.h ])
92 if test -f $kernelsrc/include/linux/mutex.h; then
93 AC_DEFINE(HAVE_MUTEX_H, 1, [kernel has mutex.h])
94 AC_MSG_RESULT([yes])
95 else
96 AC_MSG_RESULT([no])
97 fi
98
99 TOPDIR=`/bin/pwd`
100
101 # Add "V=1" to KERNELMAKE_PARAMS to enable verbose module build
102 KERNELMAKE_PARAMS=
103 KERNELCPPFLAGS="-I$TOPDIR -I$TOPDIR/include"
104
105 if test "$kernelbuild" != "$kernelsrc"; then
106 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
107 fi
108
109 AC_SUBST(KERNELMAKE_PARAMS)
110 AC_SUBST(KERNELCPPFLAGS)
111 AC_SUBST(KERNELCFLAGS)
112
113 AC_CONFIG_FILES([ Makefile
114 lib/Makefile
115 cmd/Makefile
116 modules/Makefile
117 modules/spl/Makefile
118 modules/splat/Makefile
119 include/Makefile
120 include/sys/Makefile
121 scripts/Makefile
122 scripts/spl.spec
123 ])
124
125 AC_OUTPUT