]>
Commit | Line | Data |
---|---|---|
57d86234 BB |
1 | AC_DEFUN([SPL_AC_KERNEL], [ |
2 | ver=`uname -r` | |
3 | ||
4 | AC_ARG_WITH([linux], | |
5 | AS_HELP_STRING([--with-linux=PATH], | |
6 | [Path to kernel source]), | |
7 | [kernelsrc="$withval"; kernelbuild="$withval"]) | |
8 | ||
9 | AC_ARG_WITH([linux-obj], | |
10 | AS_HELP_STRING([--with-linux-obj=PATH], | |
11 | [Path to kernel build objects]), | |
12 | [kernelbuild="$withval"]) | |
13 | ||
14 | AC_MSG_CHECKING([kernel source directory]) | |
15 | if test -z "$kernelsrc"; then | |
16 | kernelbuild= | |
17 | sourcelink=/lib/modules/${ver}/source | |
18 | buildlink=/lib/modules/${ver}/build | |
19 | ||
20 | if test -e $sourcelink; then | |
21 | kernelsrc=`(cd $sourcelink; /bin/pwd)` | |
22 | fi | |
23 | if test -e $buildlink; then | |
24 | kernelbuild=`(cd $buildlink; /bin/pwd)` | |
25 | fi | |
26 | if test -z "$kernelsrc"; then | |
27 | kernelsrc=$kernelbuild | |
28 | fi | |
29 | if test -z "$kernelsrc" -o -z "$kernelbuild"; then | |
30 | AC_MSG_RESULT([Not found]) | |
31 | AC_MSG_ERROR([ | |
32 | *** Please specify the location of the kernel source | |
6a1c3d41 | 33 | *** with the '--with-linux=PATH' option]) |
57d86234 BB |
34 | fi |
35 | fi | |
36 | ||
37 | AC_MSG_RESULT([$kernelsrc]) | |
38 | AC_MSG_CHECKING([kernel build directory]) | |
39 | AC_MSG_RESULT([$kernelbuild]) | |
40 | ||
41 | AC_MSG_CHECKING([kernel source version]) | |
42 | if test -r $kernelbuild/include/linux/version.h && | |
43 | fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then | |
44 | ||
45 | kernsrcver=`(echo "#include <linux/version.h>"; | |
46 | echo "kernsrcver=UTS_RELEASE") | | |
47 | cpp -I $kernelbuild/include | | |
48 | grep "^kernsrcver=" | cut -d \" -f 2` | |
49 | ||
50 | elif test -r $kernelbuild/include/linux/utsrelease.h && | |
51 | fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then | |
52 | ||
53 | kernsrcver=`(echo "#include <linux/utsrelease.h>"; | |
54 | echo "kernsrcver=UTS_RELEASE") | | |
55 | cpp -I $kernelbuild/include | | |
56 | grep "^kernsrcver=" | cut -d \" -f 2` | |
57 | fi | |
58 | ||
59 | if test -z "$kernsrcver"; then | |
60 | AC_MSG_RESULT([Not found]) | |
61 | AC_MSG_ERROR([ | |
62 | *** Cannot determine the version of the linux kernel source. | |
63 | *** Please prepare the kernel before running this script]) | |
64 | fi | |
65 | ||
66 | AC_MSG_RESULT([$kernsrcver]) | |
67 | ||
68 | kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver | |
69 | LINUX=${kernelsrc} | |
70 | LINUX_OBJ=${kernelbuild} | |
71 | ||
72 | AC_SUBST(LINUX) | |
73 | AC_SUBST(LINUX_OBJ) | |
74 | AC_SUBST(kmoduledir) | |
75 | ]) | |
76 | ||
6a1c3d41 BB |
77 | AC_DEFUN([SPL_AC_LICENSE], [ |
78 | AC_MSG_CHECKING([license]) | |
79 | AC_MSG_RESULT([GPL]) | |
80 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS" | |
81 | ]) | |
82 | ||
57d86234 BB |
83 | AC_DEFUN([SPL_AC_DEBUG], [ |
84 | AC_MSG_CHECKING([whether debugging is enabled]) | |
85 | AC_ARG_ENABLE( [debug], | |
86 | AS_HELP_STRING([--enable-debug], | |
87 | [Enable generic debug support (default off)]), | |
88 | [ case "$enableval" in | |
89 | yes) spl_ac_debug=yes ;; | |
475cdc78 | 90 | no) spl_ac_debug=no ;; |
57d86234 BB |
91 | *) AC_MSG_RESULT([Error!]) |
92 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;; | |
93 | esac ] | |
94 | ) | |
95 | if test "$spl_ac_debug" = yes; then | |
475cdc78 | 96 | AC_MSG_RESULT([yes]) |
57d86234 BB |
97 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG" |
98 | else | |
475cdc78 | 99 | AC_MSG_RESULT([no]) |
475cdc78 | 100 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG" |
57d86234 | 101 | fi |
57d86234 BB |
102 | ]) |
103 | ||
104 | AC_DEFUN([SPL_AC_DEBUG_KMEM], [ | |
105 | AC_MSG_CHECKING([whether kmem debugging is enabled]) | |
106 | AC_ARG_ENABLE( [debug-kmem], | |
107 | AS_HELP_STRING([--enable-debug-kmem], | |
108 | [Enable kmem debug support (default off)]), | |
109 | [ case "$enableval" in | |
475cdc78 BB |
110 | yes) spl_ac_debug_kmem=yes ;; |
111 | no) spl_ac_debug_kmem=no ;; | |
57d86234 BB |
112 | *) AC_MSG_RESULT([Error!]) |
113 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;; | |
114 | esac ] | |
115 | ) | |
475cdc78 BB |
116 | if test "$spl_ac_debug_kmem" = yes; then |
117 | AC_MSG_RESULT([yes]) | |
57d86234 BB |
118 | AC_DEFINE([DEBUG_KMEM], [1], |
119 | [Define to 1 to enable kmem debugging]) | |
475cdc78 BB |
120 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM" |
121 | else | |
122 | AC_MSG_RESULT([no]) | |
57d86234 | 123 | fi |
57d86234 BB |
124 | ]) |
125 | ||
126 | AC_DEFUN([SPL_AC_DEBUG_MUTEX], [ | |
127 | AC_MSG_CHECKING([whether mutex debugging is enabled]) | |
128 | AC_ARG_ENABLE( [debug-mutex], | |
129 | AS_HELP_STRING([--enable-debug-mutex], | |
130 | [Enable mutex debug support (default off)]), | |
131 | [ case "$enableval" in | |
475cdc78 BB |
132 | yes) spl_ac_debug_mutex=yes ;; |
133 | no) spl_ac_debug_mutex=no ;; | |
57d86234 BB |
134 | *) AC_MSG_RESULT([Error!]) |
135 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;; | |
136 | esac ] | |
137 | ) | |
475cdc78 BB |
138 | if test "$spl_ac_debug_mutex" = yes; then |
139 | AC_MSG_RESULT([yes]) | |
57d86234 BB |
140 | AC_DEFINE([DEBUG_MUTEX], [1], |
141 | [Define to 1 to enable mutex debugging]) | |
475cdc78 BB |
142 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX" |
143 | else | |
144 | AC_MSG_RESULT([no]) | |
57d86234 | 145 | fi |
57d86234 BB |
146 | ]) |
147 | ||
148 | AC_DEFUN([SPL_AC_DEBUG_KSTAT], [ | |
149 | AC_MSG_CHECKING([whether kstat debugging is enabled]) | |
150 | AC_ARG_ENABLE( [debug-kstat], | |
151 | AS_HELP_STRING([--enable-debug-kstat], | |
152 | [Enable kstat debug support (default off)]), | |
153 | [ case "$enableval" in | |
475cdc78 BB |
154 | yes) spl_ac_debug_kstat=yes ;; |
155 | no) spl_ac_debug_kstat=no ;; | |
57d86234 BB |
156 | *) AC_MSG_RESULT([Error!]) |
157 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;; | |
158 | esac ] | |
159 | ) | |
475cdc78 BB |
160 | if test "$spl_ac_debug_kstat" = yes; then |
161 | AC_MSG_RESULT([yes]) | |
57d86234 BB |
162 | AC_DEFINE([DEBUG_KSTAT], [1], |
163 | [Define to 1 to enable kstat debugging]) | |
475cdc78 BB |
164 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT" |
165 | else | |
166 | AC_MSG_RESULT([no]) | |
57d86234 | 167 | fi |
57d86234 BB |
168 | ]) |
169 | ||
170 | AC_DEFUN([SPL_AC_DEBUG_CALLB], [ | |
171 | AC_MSG_CHECKING([whether callb debugging is enabled]) | |
172 | AC_ARG_ENABLE( [debug-callb], | |
173 | AS_HELP_STRING([--enable-debug-callb], | |
174 | [Enable callb debug support (default off)]), | |
175 | [ case "$enableval" in | |
475cdc78 BB |
176 | yes) spl_ac_debug_callb=yes ;; |
177 | no) spl_ac_debug_callb=no ;; | |
57d86234 BB |
178 | *) AC_MSG_RESULT([Error!]) |
179 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;; | |
180 | esac ] | |
181 | ) | |
475cdc78 BB |
182 | if test "$spl_ac_debug_callb" = yes; then |
183 | AC_MSG_RESULT([yes]) | |
57d86234 BB |
184 | AC_DEFINE([DEBUG_CALLB], [1], |
185 | [Define to 1 to enable callb debugging]) | |
475cdc78 BB |
186 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB" |
187 | else | |
188 | AC_MSG_RESULT([no]) | |
57d86234 | 189 | fi |
57d86234 BB |
190 | ]) |
191 | ||
192 | dnl # | |
193 | dnl # SPL_LINUX_CONFTEST | |
194 | dnl # | |
195 | AC_DEFUN([SPL_LINUX_CONFTEST], [ | |
196 | cat >conftest.c <<_ACEOF | |
197 | $1 | |
198 | _ACEOF | |
199 | ]) | |
200 | ||
201 | dnl # | |
202 | dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY]) | |
203 | dnl # | |
204 | m4_define([SPL_LANG_PROGRAM], [ | |
205 | $1 | |
206 | int | |
207 | main (void) | |
208 | { | |
209 | dnl Do *not* indent the following line: there may be CPP directives. | |
210 | dnl Don't move the `;' right after for the same reason. | |
211 | $2 | |
212 | ; | |
213 | return 0; | |
214 | } | |
215 | ]) | |
216 | ||
217 | dnl # | |
218 | dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE | |
219 | dnl # | |
220 | AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [ | |
221 | m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])dnl | |
222 | rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile | |
223 | echo "obj-m := conftest.o" >build/Makefile | |
224 | dnl AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" -f $PWD/build/Makefile LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], | |
225 | AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], | |
226 | [$4], | |
227 | [_AC_MSG_LOG_CONFTEST | |
228 | m4_ifvaln([$5],[$5])dnl])dnl | |
229 | rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.ko m4_ifval([$1], [build/conftest.c conftest.c])[]dnl | |
230 | ]) | |
231 | ||
232 | dnl # | |
233 | dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE | |
234 | dnl # | |
235 | AC_DEFUN([SPL_LINUX_TRY_COMPILE], | |
236 | [SPL_LINUX_COMPILE_IFELSE( | |
d50bd9e2 BB |
237 | [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])], |
238 | [modules], | |
239 | [test -s build/conftest.o], | |
240 | [$3], [$4]) | |
57d86234 BB |
241 | ]) |
242 | ||
243 | dnl # | |
244 | dnl # SPL_LINUX_CONFIG | |
245 | dnl # | |
246 | AC_DEFUN([SPL_LINUX_CONFIG], | |
247 | [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1]) | |
248 | SPL_LINUX_TRY_COMPILE([ | |
249 | #ifndef AUTOCONF_INCLUDED | |
250 | #include <linux/config.h> | |
251 | #endif | |
252 | ],[ | |
253 | #ifndef CONFIG_$1 | |
254 | #error CONFIG_$1 not #defined | |
255 | #endif | |
256 | ],[ | |
257 | AC_MSG_RESULT([yes]) | |
258 | $2 | |
259 | ],[ | |
260 | AC_MSG_RESULT([no]) | |
261 | $3 | |
262 | ]) | |
263 | ]) | |
264 | ||
265 | dnl # | |
266 | dnl # SPL_CHECK_SYMBOL_EXPORT | |
267 | dnl # check symbol exported or not | |
268 | dnl # | |
269 | AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], | |
270 | [AC_MSG_CHECKING([whether symbol $1 is exported]) | |
271 | grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/Module.symvers 2>/dev/null | |
272 | rc=$? | |
273 | if test $rc -ne 0; then | |
274 | export=0 | |
275 | for file in $2; do | |
276 | grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX/$file" 2>/dev/null | |
277 | rc=$? | |
278 | if test $rc -eq 0; then | |
279 | export=1 | |
280 | break; | |
281 | fi | |
282 | done | |
283 | if test $export -eq 0; then | |
284 | AC_MSG_RESULT([no]) | |
285 | $4 | |
286 | else | |
287 | AC_MSG_RESULT([yes]) | |
288 | $3 | |
289 | fi | |
290 | else | |
291 | AC_MSG_RESULT([yes]) | |
292 | $3 | |
293 | fi | |
294 | ]) | |
295 | ||
86de8532 BB |
296 | dnl # |
297 | dnl # SPL_CHECK_HEADER | |
298 | dnl # check whether header exists and define HAVE_$2_HEADER | |
299 | dnl # | |
300 | AC_DEFUN([SPL_CHECK_HEADER], | |
301 | [AC_MSG_CHECKING([whether header $1 exists]) | |
302 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 303 | #include <$1> |
86de8532 BB |
304 | ],[ |
305 | return 0; | |
306 | ],[ | |
307 | AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists]) | |
308 | AC_MSG_RESULT(yes) | |
309 | $3 | |
310 | ],[ | |
311 | AC_MSG_RESULT(no) | |
312 | $4 | |
313 | ]) | |
314 | ]) | |
6a6cafbe | 315 | |
57d86234 | 316 | dnl # |
3d061e9d | 317 | dnl # 2.6.24 API change, |
57d86234 BB |
318 | dnl # check if uintptr_t typedef is defined |
319 | dnl # | |
320 | AC_DEFUN([SPL_AC_TYPE_UINTPTR_T], | |
321 | [AC_MSG_CHECKING([whether kernel defines uintptr_t]) | |
322 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 323 | #include <linux/types.h> |
57d86234 | 324 | ],[ |
d50bd9e2 | 325 | uintptr_t *ptr; |
57d86234 | 326 | ],[ |
d50bd9e2 BB |
327 | AC_MSG_RESULT([yes]) |
328 | AC_DEFINE(HAVE_UINTPTR_T, 1, | |
57d86234 BB |
329 | [kernel defines uintptr_t]) |
330 | ],[ | |
d50bd9e2 | 331 | AC_MSG_RESULT([no]) |
57d86234 BB |
332 | ]) |
333 | ]) | |
334 | ||
a0f6da3d BB |
335 | dnl # |
336 | dnl # 2.6.x API change, | |
337 | dnl # check if atomic64_t typedef is defined | |
338 | dnl # | |
339 | AC_DEFUN([SPL_AC_TYPE_ATOMIC64_T], | |
340 | [AC_MSG_CHECKING([whether kernel defines atomic64_t]) | |
341 | SPL_LINUX_TRY_COMPILE([ | |
342 | #include <asm/atomic.h> | |
343 | ],[ | |
344 | atomic64_t *ptr; | |
345 | ],[ | |
346 | AC_MSG_RESULT([yes]) | |
347 | AC_DEFINE(HAVE_ATOMIC64_T, 1, | |
348 | [kernel defines atomic64_t]) | |
349 | ],[ | |
350 | AC_MSG_RESULT([no]) | |
351 | ]) | |
352 | ]) | |
353 | ||
57d86234 | 354 | dnl # |
3d061e9d | 355 | dnl # 2.6.20 API change, |
57d86234 BB |
356 | dnl # INIT_WORK use 2 args and not store data inside |
357 | dnl # | |
358 | AC_DEFUN([SPL_AC_3ARGS_INIT_WORK], | |
359 | [AC_MSG_CHECKING([whether INIT_WORK wants 3 args]) | |
360 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 361 | #include <linux/workqueue.h> |
57d86234 | 362 | ],[ |
d50bd9e2 BB |
363 | struct work_struct work; |
364 | INIT_WORK(&work, NULL, NULL); | |
57d86234 | 365 | ],[ |
d50bd9e2 BB |
366 | AC_MSG_RESULT(yes) |
367 | AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1, | |
368 | [INIT_WORK wants 3 args]) | |
57d86234 | 369 | ],[ |
d50bd9e2 | 370 | AC_MSG_RESULT(no) |
57d86234 BB |
371 | ]) |
372 | ]) | |
373 | ||
374 | dnl # | |
3d061e9d | 375 | dnl # 2.6.21 API change, |
57d86234 BB |
376 | dnl # 'register_sysctl_table' use only one argument instead of two |
377 | dnl # | |
378 | AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL], | |
379 | [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args]) | |
380 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 381 | #include <linux/sysctl.h> |
57d86234 | 382 | ],[ |
d50bd9e2 | 383 | return register_sysctl_table(NULL,0); |
57d86234 | 384 | ],[ |
d50bd9e2 BB |
385 | AC_MSG_RESULT(yes) |
386 | AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1, | |
387 | [register_sysctl_table() wants 2 args]) | |
57d86234 | 388 | ],[ |
d50bd9e2 | 389 | AC_MSG_RESULT(no) |
57d86234 BB |
390 | ]) |
391 | ]) | |
392 | ||
57d86234 | 393 | dnl # |
3d061e9d | 394 | dnl # 2.6.23 API change |
57d86234 BB |
395 | dnl # Old set_shrinker API replaced with register_shrinker |
396 | dnl # | |
397 | AC_DEFUN([SPL_AC_SET_SHRINKER], [ | |
398 | AC_MSG_CHECKING([whether set_shrinker() available]) | |
399 | SPL_LINUX_TRY_COMPILE([ | |
400 | #include <linux/mm.h> | |
401 | ],[ | |
402 | return set_shrinker(DEFAULT_SEEKS, NULL); | |
403 | ],[ | |
404 | AC_MSG_RESULT([yes]) | |
405 | AC_DEFINE(HAVE_SET_SHRINKER, 1, | |
406 | [set_shrinker() available]) | |
407 | ],[ | |
408 | AC_MSG_RESULT([no]) | |
409 | ]) | |
410 | ]) | |
411 | ||
412 | dnl # | |
3d061e9d | 413 | dnl # 2.6.25 API change, |
57d86234 BB |
414 | dnl # struct path entry added to struct nameidata |
415 | dnl # | |
416 | AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA], | |
417 | [AC_MSG_CHECKING([whether struct path used in struct nameidata]) | |
418 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 419 | #include <linux/namei.h> |
57d86234 | 420 | ],[ |
d50bd9e2 | 421 | struct nameidata nd; |
57d86234 BB |
422 | |
423 | nd.path.mnt = NULL; | |
424 | nd.path.dentry = NULL; | |
425 | ],[ | |
d50bd9e2 BB |
426 | AC_MSG_RESULT(yes) |
427 | AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1, | |
428 | [struct path used in struct nameidata]) | |
57d86234 | 429 | ],[ |
d50bd9e2 | 430 | AC_MSG_RESULT(no) |
57d86234 BB |
431 | ]) |
432 | ]) | |
433 | ||
434 | dnl # | |
435 | dnl # Custom SPL patch may export this system it is not required | |
436 | dnl # | |
437 | AC_DEFUN([SPL_AC_TASK_CURR], [ | |
438 | SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c], | |
439 | [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])], | |
440 | []) | |
441 | ]) | |
442 | ||
443 | dnl # | |
3d061e9d | 444 | dnl # 2.6.19 API change, |
57d86234 BB |
445 | dnl # Use CTL_UNNUMBERED when binary sysctl is not required |
446 | dnl # | |
447 | AC_DEFUN([SPL_AC_CTL_UNNUMBERED], | |
448 | [AC_MSG_CHECKING([whether unnumbered sysctl support exists]) | |
449 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 450 | #include <linux/sysctl.h> |
57d86234 BB |
451 | ],[ |
452 | #ifndef CTL_UNNUMBERED | |
453 | #error CTL_UNNUMBERED undefined | |
454 | #endif | |
455 | ],[ | |
d50bd9e2 BB |
456 | AC_MSG_RESULT(yes) |
457 | AC_DEFINE(HAVE_CTL_UNNUMBERED, 1, | |
458 | [unnumbered sysctl support exists]) | |
57d86234 | 459 | ],[ |
d50bd9e2 | 460 | AC_MSG_RESULT(no) |
57d86234 BB |
461 | ]) |
462 | ]) | |
877a32e9 BB |
463 | |
464 | dnl # | |
465 | dnl # 2.6.16 API change. | |
466 | dnl # Check if 'fls64()' is available | |
467 | dnl # | |
468 | AC_DEFUN([SPL_AC_FLS64], | |
6a6cafbe BB |
469 | [AC_MSG_CHECKING([whether fls64() is available]) |
470 | SPL_LINUX_TRY_COMPILE([ | |
471 | #include <linux/bitops.h> | |
472 | ],[ | |
473 | return fls64(0); | |
474 | ],[ | |
475 | AC_MSG_RESULT(yes) | |
476 | AC_DEFINE(HAVE_FLS64, 1, [fls64() is available]) | |
477 | ],[ | |
478 | AC_MSG_RESULT(no) | |
479 | ]) | |
877a32e9 | 480 | ]) |
46c685d0 BB |
481 | |
482 | dnl # | |
483 | dnl # 2.6.18 API change, check whether device_create() is available. | |
484 | dnl # Device_create() was introduced in 2.6.18 and depricated | |
485 | dnl # class_device_create() which was fully removed in 2.6.26. | |
486 | dnl # | |
487 | AC_DEFUN([SPL_AC_DEVICE_CREATE], [ | |
488 | SPL_CHECK_SYMBOL_EXPORT( | |
489 | [device_create], | |
490 | [drivers/base/core.c], | |
491 | [AC_DEFINE(HAVE_DEVICE_CREATE, 1, | |
492 | [device_create() is available])], | |
6a6cafbe | 493 | []) |
46c685d0 BB |
494 | ]) |
495 | ||
496 | dnl # | |
497 | dnl # 2.6.13 API change, check whether class_device_create() is available. | |
498 | dnl # Class_device_create() was introduced in 2.6.13 and depricated | |
499 | dnl # class_simple_device_add() which was fully removed in 2.6.13. | |
500 | dnl # | |
501 | AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [ | |
502 | SPL_CHECK_SYMBOL_EXPORT( | |
503 | [class_device_create], | |
504 | [drivers/base/class.c], | |
505 | [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1, | |
506 | [class_device_create() is available])], | |
6a6cafbe | 507 | []) |
46c685d0 | 508 | ]) |
6a6cafbe | 509 | |
6a6cafbe BB |
510 | dnl # |
511 | dnl # 2.6.26 API change, set_normalized_timespec() is exported. | |
512 | dnl # | |
513 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [ | |
514 | SPL_CHECK_SYMBOL_EXPORT( | |
515 | [set_normalized_timespec], | |
516 | [kernel/time.c], | |
517 | [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1, | |
518 | [set_normalized_timespec() is available as export])], | |
519 | []) | |
520 | ]) | |
521 | ||
522 | dnl # | |
523 | dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c | |
524 | dnl # previously it was available in time.h as an inline. | |
525 | dnl # | |
86de8532 BB |
526 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [ |
527 | AC_MSG_CHECKING([whether set_normalized_timespec() is an inline]) | |
6a6cafbe BB |
528 | SPL_LINUX_TRY_COMPILE([ |
529 | #include <linux/time.h> | |
6a6cafbe | 530 | void set_normalized_timespec(struct timespec *ts, |
25557fd8 BB |
531 | time_t sec, long nsec) { } |
532 | ], | |
533 | [], | |
534 | [ | |
6a6cafbe BB |
535 | AC_MSG_RESULT(no) |
536 | ],[ | |
537 | AC_MSG_RESULT(yes) | |
538 | AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1, | |
539 | [set_normalized_timespec() is available as inline]) | |
540 | ]) | |
541 | ]) | |
542 | ||
543 | dnl # | |
544 | dnl # 2.6.18 API change, | |
545 | dnl # timespec_sub() inline function available in linux/time.h | |
546 | dnl # | |
86de8532 BB |
547 | AC_DEFUN([SPL_AC_TIMESPEC_SUB], [ |
548 | AC_MSG_CHECKING([whether timespec_sub() is available]) | |
6a6cafbe BB |
549 | SPL_LINUX_TRY_COMPILE([ |
550 | #include <linux/time.h> | |
551 | ],[ | |
552 | struct timespec a, b, c = { 0 }; | |
553 | c = timespec_sub(a, b); | |
554 | ],[ | |
555 | AC_MSG_RESULT(yes) | |
556 | AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available]) | |
557 | ],[ | |
558 | AC_MSG_RESULT(no) | |
559 | ]) | |
560 | ]) | |
561 | ||
86de8532 | 562 | dnl # |
3d061e9d BB |
563 | dnl # 2.6.19 API change, |
564 | dnl # check if init_utsname() is available in linux/utsname.h | |
565 | dnl # | |
566 | AC_DEFUN([SPL_AC_INIT_UTSNAME], [ | |
567 | AC_MSG_CHECKING([whether init_utsname() is available]) | |
568 | SPL_LINUX_TRY_COMPILE([ | |
569 | #include <linux/utsname.h> | |
570 | ],[ | |
571 | struct new_utsname *a = init_utsname(); | |
572 | ],[ | |
573 | AC_MSG_RESULT(yes) | |
574 | AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available]) | |
575 | ],[ | |
576 | AC_MSG_RESULT(no) | |
577 | ]) | |
578 | ]) | |
579 | ||
580 | dnl # | |
581 | dnl # 2.6.26 API change, | |
582 | dnl # definition of struct fdtable relocated to linux/fdtable.h | |
86de8532 BB |
583 | dnl # |
584 | AC_DEFUN([SPL_AC_FDTABLE_HEADER], [ | |
585 | SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], []) | |
586 | ]) | |
322640b7 BB |
587 | |
588 | dnl # | |
3d061e9d BB |
589 | dnl # 2.6.14 API change, |
590 | dnl # check whether 'files_fdtable()' exists | |
591 | dnl # | |
592 | AC_DEFUN([SPL_AC_FILES_FDTABLE], [ | |
593 | AC_MSG_CHECKING([whether files_fdtable() is available]) | |
594 | SPL_LINUX_TRY_COMPILE([ | |
595 | #include <linux/sched.h> | |
596 | #include <linux/file.h> | |
597 | #ifdef HAVE_FDTABLE_HEADER | |
598 | #include <linux/fdtable.h> | |
599 | #endif | |
600 | ],[ | |
601 | struct files_struct *files = current->files; | |
602 | struct fdtable *fdt = files_fdtable(files); | |
603 | ],[ | |
604 | AC_MSG_RESULT(yes) | |
605 | AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available]) | |
606 | ],[ | |
607 | AC_MSG_RESULT(no) | |
608 | ]) | |
609 | ]) | |
610 | ||
611 | dnl # | |
612 | dnl # 2.6.18 API change, | |
613 | dnl # added linux/uaccess.h | |
322640b7 BB |
614 | dnl # |
615 | AC_DEFUN([SPL_AC_UACCESS_HEADER], [ | |
616 | SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], []) | |
617 | ]) | |
3d061e9d BB |
618 | |
619 | dnl # | |
620 | dnl # 2.6.12 API change, | |
621 | dnl # check whether 'kmalloc_node()' is available. | |
622 | dnl # | |
623 | AC_DEFUN([SPL_AC_KMALLOC_NODE], [ | |
624 | AC_MSG_CHECKING([whether kmalloc_node() is available]) | |
625 | SPL_LINUX_TRY_COMPILE([ | |
626 | #include <linux/slab.h> | |
627 | ],[ | |
628 | void *a = kmalloc_node(1, GFP_KERNEL, 0); | |
629 | ],[ | |
630 | AC_MSG_RESULT(yes) | |
631 | AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available]) | |
632 | ],[ | |
633 | AC_MSG_RESULT(no) | |
634 | ]) | |
635 | ]) | |
636 | ||
637 | dnl # | |
638 | dnl # 2.6.9 API change, | |
639 | dnl # check whether 'monotonic_clock()' is available it may | |
640 | dnl # be available for some archs but not others. | |
641 | dnl # | |
642 | AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [ | |
643 | SPL_CHECK_SYMBOL_EXPORT( | |
644 | [monotonic_clock], | |
645 | [], | |
646 | [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, | |
647 | [monotonic_clock() is available])], | |
648 | []) | |
649 | ]) | |
650 | ||
651 | dnl # | |
652 | dnl # 2.6.16 API change, | |
653 | dnl # check whether 'struct inode' has i_mutex | |
654 | dnl # | |
655 | AC_DEFUN([SPL_AC_INODE_I_MUTEX], [ | |
656 | AC_MSG_CHECKING([whether struct inode has i_mutex]) | |
657 | SPL_LINUX_TRY_COMPILE([ | |
658 | #include <linux/fs.h> | |
659 | #include <linux/mutex.h> | |
660 | ],[ | |
661 | struct inode i; | |
662 | mutex_init(&i.i_mutex); | |
663 | ],[ | |
664 | AC_MSG_RESULT(yes) | |
665 | AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex]) | |
666 | ],[ | |
667 | AC_MSG_RESULT(no) | |
668 | ]) | |
669 | ]) | |
b61a6e8b BB |
670 | |
671 | dnl # | |
672 | dnl # 2.6.14 API change, | |
673 | dnl # check whether 'div64_64()' is available | |
674 | dnl # | |
675 | AC_DEFUN([SPL_AC_DIV64_64], [ | |
676 | AC_MSG_CHECKING([whether div64_64() is available]) | |
677 | SPL_LINUX_TRY_COMPILE([ | |
678 | #include <asm/div64.h> | |
550f1705 | 679 | #include <linux/types.h> |
b61a6e8b BB |
680 | ],[ |
681 | uint64_t i = div64_64(1ULL, 1ULL); | |
682 | ],[ | |
683 | AC_MSG_RESULT(yes) | |
684 | AC_DEFINE(HAVE_DIV64_64, 1, [div64_64() is available]) | |
685 | ],[ | |
686 | AC_MSG_RESULT(no) | |
687 | ]) | |
688 | ]) |