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