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