]> git.proxmox.com Git - mirror_spl-debian.git/blob - config/spl-build.m4
Linux VM Integration Cleanup
[mirror_spl-debian.git] / config / spl-build.m4
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
33 *** with the '--with-linux=PATH' option])
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
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
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 ;;
90 no) spl_ac_debug=no ;;
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
96 AC_MSG_RESULT([yes])
97 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
98 else
99 AC_MSG_RESULT([no])
100 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
101 fi
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
110 yes) spl_ac_debug_kmem=yes ;;
111 no) spl_ac_debug_kmem=no ;;
112 *) AC_MSG_RESULT([Error!])
113 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;;
114 esac ]
115 )
116 if test "$spl_ac_debug_kmem" = yes; then
117 AC_MSG_RESULT([yes])
118 AC_DEFINE([DEBUG_KMEM], [1],
119 [Define to 1 to enable kmem debugging])
120 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
121 else
122 AC_MSG_RESULT([no])
123 fi
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
132 yes) spl_ac_debug_mutex=yes ;;
133 no) spl_ac_debug_mutex=no ;;
134 *) AC_MSG_RESULT([Error!])
135 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;;
136 esac ]
137 )
138 if test "$spl_ac_debug_mutex" = yes; then
139 AC_MSG_RESULT([yes])
140 AC_DEFINE([DEBUG_MUTEX], [1],
141 [Define to 1 to enable mutex debugging])
142 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX"
143 else
144 AC_MSG_RESULT([no])
145 fi
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
154 yes) spl_ac_debug_kstat=yes ;;
155 no) spl_ac_debug_kstat=no ;;
156 *) AC_MSG_RESULT([Error!])
157 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;;
158 esac ]
159 )
160 if test "$spl_ac_debug_kstat" = yes; then
161 AC_MSG_RESULT([yes])
162 AC_DEFINE([DEBUG_KSTAT], [1],
163 [Define to 1 to enable kstat debugging])
164 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT"
165 else
166 AC_MSG_RESULT([no])
167 fi
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
176 yes) spl_ac_debug_callb=yes ;;
177 no) spl_ac_debug_callb=no ;;
178 *) AC_MSG_RESULT([Error!])
179 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;;
180 esac ]
181 )
182 if test "$spl_ac_debug_callb" = yes; then
183 AC_MSG_RESULT([yes])
184 AC_DEFINE([DEBUG_CALLB], [1],
185 [Define to 1 to enable callb debugging])
186 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB"
187 else
188 AC_MSG_RESULT([no])
189 fi
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 -Iinclude2 -I$LINUX/include -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 -Iinclude2 -I$LINUX/include -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(
237 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
238 [modules],
239 [test -s build/conftest.o],
240 [$3], [$4])
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_OBJ/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_OBJ/$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
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([
303 #include <$1>
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 ])
315
316 dnl #
317 dnl # 2.6.24 API change,
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([
323 #include <linux/types.h>
324 ],[
325 uintptr_t *ptr;
326 ],[
327 AC_MSG_RESULT([yes])
328 AC_DEFINE(HAVE_UINTPTR_T, 1,
329 [kernel defines uintptr_t])
330 ],[
331 AC_MSG_RESULT([no])
332 ])
333 ])
334
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
354 dnl #
355 dnl # 2.6.20 API change,
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([
361 #include <linux/workqueue.h>
362 ],[
363 struct work_struct work;
364 INIT_WORK(&work, NULL, NULL);
365 ],[
366 AC_MSG_RESULT(yes)
367 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
368 [INIT_WORK wants 3 args])
369 ],[
370 AC_MSG_RESULT(no)
371 ])
372 ])
373
374 dnl #
375 dnl # 2.6.21 API change,
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([
381 #include <linux/sysctl.h>
382 ],[
383 return register_sysctl_table(NULL,0);
384 ],[
385 AC_MSG_RESULT(yes)
386 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
387 [register_sysctl_table() wants 2 args])
388 ],[
389 AC_MSG_RESULT(no)
390 ])
391 ])
392
393 dnl #
394 dnl # 2.6.23 API change
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 #
413 dnl # 2.6.25 API change,
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([
419 #include <linux/namei.h>
420 ],[
421 struct nameidata nd;
422
423 nd.path.mnt = NULL;
424 nd.path.dentry = NULL;
425 ],[
426 AC_MSG_RESULT(yes)
427 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
428 [struct path used in struct nameidata])
429 ],[
430 AC_MSG_RESULT(no)
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 #
444 dnl # 2.6.19 API change,
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([
450 #include <linux/sysctl.h>
451 ],[
452 #ifndef CTL_UNNUMBERED
453 #error CTL_UNNUMBERED undefined
454 #endif
455 ],[
456 AC_MSG_RESULT(yes)
457 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
458 [unnumbered sysctl support exists])
459 ],[
460 AC_MSG_RESULT(no)
461 ])
462 ])
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],
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 ])
480 ])
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])],
493 [])
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])],
507 [])
508 ])
509
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 #
526 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
527 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
528 SPL_LINUX_TRY_COMPILE([
529 #include <linux/time.h>
530 void set_normalized_timespec(struct timespec *ts,
531 time_t sec, long nsec) { }
532 ],
533 [],
534 [
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 #
547 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
548 AC_MSG_CHECKING([whether timespec_sub() is available])
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
562 dnl #
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
583 dnl #
584 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
585 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
586 ])
587
588 dnl #
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
614 dnl #
615 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
616 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
617 ])
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 ])
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>
679 #include <linux/types.h>
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 ])
689
690 dnl #
691 dnl # 2.6.27 API change,
692 dnl # on_each_cpu() uses 3 args, no 'retry' argument
693 dnl #
694 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
695 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
696 SPL_LINUX_TRY_COMPILE([
697 #include <linux/smp.h>
698 ],[
699 on_each_cpu(NULL, NULL, 0);
700 ],[
701 AC_MSG_RESULT(yes)
702 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
703 [on_each_cpu wants 3 args])
704 ],[
705 AC_MSG_RESULT(no)
706 ])
707 ])
708
709 dnl #
710 dnl # 2.6.18 API change,
711 dnl # kallsyms_lookup_name no longer exported
712 dnl #
713 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
714 SPL_CHECK_SYMBOL_EXPORT(
715 [kallsyms_lookup_name],
716 [],
717 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
718 [kallsyms_lookup_name() is available])],
719 [])
720 ])
721
722 dnl #
723 dnl # Symbol only available in custom kernels
724 dnl #
725 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
726 SPL_CHECK_SYMBOL_EXPORT(
727 [get_vmalloc_info],
728 [],
729 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
730 [get_vmalloc_info() is available])],
731 [])
732 ])
733
734 dnl #
735 dnl # Symbol only available in custom kernels
736 dnl #
737 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
738 SPL_CHECK_SYMBOL_EXPORT(
739 [first_online_pgdat],
740 [],
741 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
742 [first_online_pgdat() is available])],
743 [])
744 ])
745
746 dnl #
747 dnl # Symbol only available in custom kernels
748 dnl #
749 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
750 SPL_CHECK_SYMBOL_EXPORT(
751 [next_online_pgdat],
752 [],
753 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
754 [next_online_pgdat() is available])],
755 [])
756 ])
757
758 dnl #
759 dnl # Symbol only available in custom kernels
760 dnl #
761 AC_DEFUN([SPL_AC_NEXT_ZONE], [
762 SPL_CHECK_SYMBOL_EXPORT(
763 [next_zone],
764 [],
765 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
766 [next_zone() is available])],
767 [])
768 ])
769
770 dnl #
771 dnl # Symbol only available in custom kernels
772 dnl #
773 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
774 SPL_CHECK_SYMBOL_EXPORT(
775 [get_zone_counts],
776 [],
777 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
778 [get_zone_counts() is available])],
779 [])
780 ])