1 AC_DEFUN([SPL_AC_KERNEL], [
3 AS_HELP_STRING([--with-linux=PATH],
4 [Path to kernel source]),
5 [kernelsrc="$withval"; kernelbuild="$withval"])
7 AC_ARG_WITH([linux-obj],
8 AS_HELP_STRING([--with-linux-obj=PATH],
9 [Path to kernel build objects]),
10 [kernelbuild="$withval"])
12 AC_MSG_CHECKING([kernel source directory])
13 if test -z "$kernelsrc"; then
14 sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \
15 2>/dev/null | grep -v obj | tail -1`
17 if test -e ${sourcelink}; then
18 kernelsrc=`readlink -f ${sourcelink}`
21 AC_MSG_RESULT([Not found])
23 *** Please specify the location of the kernel source
24 *** with the '--with-linux=PATH' option])
27 if test "$kernelsrc" = "NONE"; then
32 AC_MSG_RESULT([$kernelsrc])
33 AC_MSG_CHECKING([kernel build directory])
34 if test -z "$kernelbuild" && test -d ${kernelsrc}-obj; then
35 kernelbuild=${kernelsrc}-obj/`arch`/`arch`
37 kernelbuild=${kernelsrc}
39 AC_MSG_RESULT([$kernelbuild])
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
45 kernsrcver=`(echo "#include <linux/version.h>";
46 echo "kernsrcver=UTS_RELEASE") |
47 cpp -I $kernelbuild/include |
48 grep "^kernsrcver=" | cut -d \" -f 2`
50 elif test -r $kernelbuild/include/linux/utsrelease.h &&
51 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
53 kernsrcver=`(echo "#include <linux/utsrelease.h>";
54 echo "kernsrcver=UTS_RELEASE") |
55 cpp -I $kernelbuild/include |
56 grep "^kernsrcver=" | cut -d \" -f 2`
59 if test -z "$kernsrcver"; then
60 AC_MSG_RESULT([Not found])
62 *** Cannot determine the version of the linux kernel source.
63 *** Please prepare the kernel before running this script])
66 AC_MSG_RESULT([$kernsrcver])
69 LINUX_OBJ=${kernelbuild}
70 LINUX_VERSION=${kernsrcver}
72 abs_srcdir=`readlink -f ${srcdir}`
73 kerninclude="-I${abs_srcdir} -I${abs_srcdir}/include"
74 kernwarn="-Wstrict-prototypes -Werror"
76 if test "${LINUX_OBJ}" != "${LINUX}"; then
77 kernobjs="O=$kernelbuild"
81 KERNELCPPFLAGS="${kerninclude} ${kernwarn}"
82 KERNELMAKE_PARAMS="${kernobjs}"
86 AC_SUBST(LINUX_VERSION)
87 AC_SUBST(KERNELMAKE_PARAMS)
88 AC_SUBST(KERNELCPPFLAGS)
89 AC_SUBST(KERNELCFLAGS)
92 AC_DEFUN([SPL_AC_LICENSE], [
93 AC_MSG_CHECKING([license])
95 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
98 AC_DEFUN([SPL_AC_DEBUG], [
99 AC_MSG_CHECKING([whether debugging is enabled])
100 AC_ARG_ENABLE( [debug],
101 AS_HELP_STRING([--enable-debug],
102 [Enable generic debug support (default off)]),
103 [ case "$enableval" in
104 yes) spl_ac_debug=yes ;;
105 no) spl_ac_debug=no ;;
106 *) AC_MSG_RESULT([Error!])
107 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;;
110 if test "$spl_ac_debug" = yes; then
112 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
115 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
119 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
120 AC_MSG_CHECKING([whether kmem debugging is enabled])
121 AC_ARG_ENABLE( [debug-kmem],
122 AS_HELP_STRING([--enable-debug-kmem],
123 [Enable kmem debug support (default off)]),
124 [ case "$enableval" in
125 yes) spl_ac_debug_kmem=yes ;;
126 no) spl_ac_debug_kmem=no ;;
127 *) AC_MSG_RESULT([Error!])
128 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;;
131 if test "$spl_ac_debug_kmem" = yes; then
133 AC_DEFINE([DEBUG_KMEM], [1],
134 [Define to 1 to enable kmem debugging])
135 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
141 AC_DEFUN([SPL_AC_DEBUG_MUTEX], [
142 AC_MSG_CHECKING([whether mutex debugging is enabled])
143 AC_ARG_ENABLE( [debug-mutex],
144 AS_HELP_STRING([--enable-debug-mutex],
145 [Enable mutex debug support (default off)]),
146 [ case "$enableval" in
147 yes) spl_ac_debug_mutex=yes ;;
148 no) spl_ac_debug_mutex=no ;;
149 *) AC_MSG_RESULT([Error!])
150 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;;
153 if test "$spl_ac_debug_mutex" = yes; then
155 AC_DEFINE([DEBUG_MUTEX], [1],
156 [Define to 1 to enable mutex debugging])
157 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX"
163 AC_DEFUN([SPL_AC_DEBUG_KSTAT], [
164 AC_MSG_CHECKING([whether kstat debugging is enabled])
165 AC_ARG_ENABLE( [debug-kstat],
166 AS_HELP_STRING([--enable-debug-kstat],
167 [Enable kstat debug support (default off)]),
168 [ case "$enableval" in
169 yes) spl_ac_debug_kstat=yes ;;
170 no) spl_ac_debug_kstat=no ;;
171 *) AC_MSG_RESULT([Error!])
172 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;;
175 if test "$spl_ac_debug_kstat" = yes; then
177 AC_DEFINE([DEBUG_KSTAT], [1],
178 [Define to 1 to enable kstat debugging])
179 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT"
185 AC_DEFUN([SPL_AC_DEBUG_CALLB], [
186 AC_MSG_CHECKING([whether callb debugging is enabled])
187 AC_ARG_ENABLE( [debug-callb],
188 AS_HELP_STRING([--enable-debug-callb],
189 [Enable callb debug support (default off)]),
190 [ case "$enableval" in
191 yes) spl_ac_debug_callb=yes ;;
192 no) spl_ac_debug_callb=no ;;
193 *) AC_MSG_RESULT([Error!])
194 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;;
197 if test "$spl_ac_debug_callb" = yes; then
199 AC_DEFINE([DEBUG_CALLB], [1],
200 [Define to 1 to enable callb debugging])
201 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB"
208 dnl # SPL_LINUX_CONFTEST
210 AC_DEFUN([SPL_LINUX_CONFTEST], [
211 cat >conftest.c <<_ACEOF
217 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
219 m4_define([SPL_LANG_PROGRAM], [
224 dnl Do *not* indent the following line: there may be CPP directives.
225 dnl Don't move the `;' right after for the same reason.
233 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
235 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
236 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
237 rm -Rf build && mkdir -p build
238 echo "obj-m := conftest.o" >build/Makefile
240 [AC_TRY_COMMAND(cp conftest.c build && make [$2] 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])],
242 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
248 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
250 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
251 [SPL_LINUX_COMPILE_IFELSE(
252 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
254 [test -s build/conftest.o],
259 dnl # SPL_LINUX_CONFIG
261 AC_DEFUN([SPL_LINUX_CONFIG],
262 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
263 SPL_LINUX_TRY_COMPILE([
264 #ifndef AUTOCONF_INCLUDED
265 #include <linux/config.h>
269 #error CONFIG_$1 not #defined
281 dnl # SPL_CHECK_SYMBOL_EXPORT
282 dnl # check symbol exported or not
284 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
285 [AC_MSG_CHECKING([whether symbol $1 is exported])
286 grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX_OBJ/Module.symvers 2>/dev/null
288 if test $rc -ne 0; then
291 grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX_OBJ/$file" 2>/dev/null
293 if test $rc -eq 0; then
298 if test $export -eq 0; then
312 dnl # SPL_CHECK_HEADER
313 dnl # check whether header exists and define HAVE_$2_HEADER
315 AC_DEFUN([SPL_CHECK_HEADER],
316 [AC_MSG_CHECKING([whether header $1 exists])
317 SPL_LINUX_TRY_COMPILE([
322 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
332 dnl # 2.6.24 API change,
333 dnl # check if uintptr_t typedef is defined
335 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
336 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
337 SPL_LINUX_TRY_COMPILE([
338 #include <linux/types.h>
343 AC_DEFINE(HAVE_UINTPTR_T, 1,
344 [kernel defines uintptr_t])
351 dnl # 2.6.x API change,
352 dnl # check if atomic64_t typedef is defined
354 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_T],
355 [AC_MSG_CHECKING([whether kernel defines atomic64_t])
356 SPL_LINUX_TRY_COMPILE([
357 #include <asm/atomic.h>
362 AC_DEFINE(HAVE_ATOMIC64_T, 1,
363 [kernel defines atomic64_t])
370 dnl # 2.6.20 API change,
371 dnl # INIT_WORK use 2 args and not store data inside
373 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
374 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
375 SPL_LINUX_TRY_COMPILE([
376 #include <linux/workqueue.h>
378 struct work_struct work;
379 INIT_WORK(&work, NULL, NULL);
382 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
383 [INIT_WORK wants 3 args])
390 dnl # 2.6.21 API change,
391 dnl # 'register_sysctl_table' use only one argument instead of two
393 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
394 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
395 SPL_LINUX_TRY_COMPILE([
396 #include <linux/sysctl.h>
398 return register_sysctl_table(NULL,0);
401 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
402 [register_sysctl_table() wants 2 args])
409 dnl # 2.6.23 API change
410 dnl # Old set_shrinker API replaced with register_shrinker
412 AC_DEFUN([SPL_AC_SET_SHRINKER], [
413 AC_MSG_CHECKING([whether set_shrinker() available])
414 SPL_LINUX_TRY_COMPILE([
415 #include <linux/mm.h>
417 return set_shrinker(DEFAULT_SEEKS, NULL);
420 AC_DEFINE(HAVE_SET_SHRINKER, 1,
421 [set_shrinker() available])
428 dnl # 2.6.25 API change,
429 dnl # struct path entry added to struct nameidata
431 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
432 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
433 SPL_LINUX_TRY_COMPILE([
434 #include <linux/namei.h>
439 nd.path.dentry = NULL;
442 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
443 [struct path used in struct nameidata])
450 dnl # Custom SPL patch may export this system it is not required
452 AC_DEFUN([SPL_AC_TASK_CURR], [
453 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
454 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
459 dnl # 2.6.19 API change,
460 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
462 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
463 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
464 SPL_LINUX_TRY_COMPILE([
465 #include <linux/sysctl.h>
467 #ifndef CTL_UNNUMBERED
468 #error CTL_UNNUMBERED undefined
472 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
473 [unnumbered sysctl support exists])
480 dnl # 2.6.16 API change.
481 dnl # Check if 'fls64()' is available
483 AC_DEFUN([SPL_AC_FLS64],
484 [AC_MSG_CHECKING([whether fls64() is available])
485 SPL_LINUX_TRY_COMPILE([
486 #include <linux/bitops.h>
491 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
498 dnl # 2.6.18 API change, check whether device_create() is available.
499 dnl # Device_create() was introduced in 2.6.18 and depricated
500 dnl # class_device_create() which was fully removed in 2.6.26.
502 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
503 SPL_CHECK_SYMBOL_EXPORT(
505 [drivers/base/core.c],
506 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
507 [device_create() is available])],
512 dnl # 2.6.27 API change,
513 dnl # device_create() uses 5 args, new 'drvdata' argument.
515 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
516 AC_MSG_CHECKING([whether device_create() wants 5 args])
517 tmp_flags="$EXTRA_KCFLAGS"
518 EXTRA_KCFLAGS="-Werror"
519 SPL_LINUX_TRY_COMPILE([
520 #include <linux/device.h>
522 device_create(NULL, NULL, 0, NULL, "%d", 1);
525 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
526 [device_create wants 5 args])
530 EXTRA_KCFLAGS="$tmp_flags"
534 dnl # 2.6.13 API change, check whether class_device_create() is available.
535 dnl # Class_device_create() was introduced in 2.6.13 and depricated
536 dnl # class_simple_device_add() which was fully removed in 2.6.13.
538 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
539 SPL_CHECK_SYMBOL_EXPORT(
540 [class_device_create],
541 [drivers/base/class.c],
542 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
543 [class_device_create() is available])],
548 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
550 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
551 SPL_CHECK_SYMBOL_EXPORT(
552 [set_normalized_timespec],
554 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
555 [set_normalized_timespec() is available as export])],
560 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
561 dnl # previously it was available in time.h as an inline.
563 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
564 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
565 SPL_LINUX_TRY_COMPILE([
566 #include <linux/time.h>
567 void set_normalized_timespec(struct timespec *ts,
568 time_t sec, long nsec) { }
575 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
576 [set_normalized_timespec() is available as inline])
581 dnl # 2.6.18 API change,
582 dnl # timespec_sub() inline function available in linux/time.h
584 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
585 AC_MSG_CHECKING([whether timespec_sub() is available])
586 SPL_LINUX_TRY_COMPILE([
587 #include <linux/time.h>
589 struct timespec a, b, c = { 0 };
590 c = timespec_sub(a, b);
593 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
600 dnl # 2.6.19 API change,
601 dnl # check if init_utsname() is available in linux/utsname.h
603 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
604 AC_MSG_CHECKING([whether init_utsname() is available])
605 SPL_LINUX_TRY_COMPILE([
606 #include <linux/utsname.h>
608 struct new_utsname *a = init_utsname();
611 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
618 dnl # 2.6.26 API change,
619 dnl # definition of struct fdtable relocated to linux/fdtable.h
621 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
622 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
626 dnl # 2.6.14 API change,
627 dnl # check whether 'files_fdtable()' exists
629 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
630 AC_MSG_CHECKING([whether files_fdtable() is available])
631 SPL_LINUX_TRY_COMPILE([
632 #include <linux/sched.h>
633 #include <linux/file.h>
634 #ifdef HAVE_FDTABLE_HEADER
635 #include <linux/fdtable.h>
638 struct files_struct *files = current->files;
639 struct fdtable *fdt = files_fdtable(files);
642 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
649 dnl # 2.6.18 API change,
650 dnl # added linux/uaccess.h
652 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
653 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
657 dnl # 2.6.12 API change,
658 dnl # check whether 'kmalloc_node()' is available.
660 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
661 AC_MSG_CHECKING([whether kmalloc_node() is available])
662 SPL_LINUX_TRY_COMPILE([
663 #include <linux/slab.h>
665 void *a = kmalloc_node(1, GFP_KERNEL, 0);
668 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
675 dnl # 2.6.9 API change,
676 dnl # check whether 'monotonic_clock()' is available it may
677 dnl # be available for some archs but not others.
679 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
680 SPL_CHECK_SYMBOL_EXPORT(
683 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
684 [monotonic_clock() is available])],
689 dnl # 2.6.16 API change,
690 dnl # check whether 'struct inode' has i_mutex
692 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
693 AC_MSG_CHECKING([whether struct inode has i_mutex])
694 SPL_LINUX_TRY_COMPILE([
695 #include <linux/fs.h>
696 #include <linux/mutex.h>
699 mutex_init(&i.i_mutex);
702 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
709 dnl # 2.6.18 API change,
710 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
711 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
712 dnl # if the mutex validator is disabled or otherwise unavailable.
714 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
715 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
716 SPL_LINUX_TRY_COMPILE([
717 #include <linux/mutex.h>
721 mutex_lock_nested(&mutex, 0);
724 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
725 [mutex_lock_nested() is available])
732 dnl # 2.6.22 API change,
733 dnl # First introduced 'div64_64()' in lib/div64.c
735 AC_DEFUN([SPL_AC_DIV64_64], [
736 SPL_CHECK_SYMBOL_EXPORT(
739 [AC_DEFINE(HAVE_DIV64_64, 1,
740 [div64_64() is available])],
745 dnl # 2.6.26 API change,
746 dnl # Renamed 'div64_64()' to 'div64_u64' in lib/div64.c
748 AC_DEFUN([SPL_AC_DIV64_U64], [
749 SPL_CHECK_SYMBOL_EXPORT(
752 [AC_DEFINE(HAVE_DIV64_U64, 1,
753 [div64_u64() is available])],
758 dnl # 2.6.27 API change,
759 dnl # on_each_cpu() uses 3 args, no 'retry' argument
761 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
762 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
763 SPL_LINUX_TRY_COMPILE([
764 #include <linux/smp.h>
766 on_each_cpu(NULL, NULL, 0);
769 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
770 [on_each_cpu wants 3 args])
777 dnl # 2.6.18 API change,
778 dnl # kallsyms_lookup_name no longer exported
780 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
781 SPL_CHECK_SYMBOL_EXPORT(
782 [kallsyms_lookup_name],
784 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
785 [kallsyms_lookup_name() is available])],
790 dnl # Proposed API change,
791 dnl # This symbol is not available in stock kernels. You may build a
792 dnl # custom kernel with the *-spl-export-symbols.patch which will export
793 dnl # these symbols for use. If your already rolling a custom kernel for
794 dnl # your environment this is recommended.
796 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
797 SPL_CHECK_SYMBOL_EXPORT(
800 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
801 [get_vmalloc_info() is available])],
806 dnl # Proposed API change,
807 dnl # This symbol is not available in stock kernels. You may build a
808 dnl # custom kernel with the *-spl-export-symbols.patch which will export
809 dnl # these symbols for use. If your already rolling a custom kernel for
810 dnl # your environment this is recommended.
812 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
813 SPL_CHECK_SYMBOL_EXPORT(
814 [first_online_pgdat],
816 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
817 [first_online_pgdat() is available])],
822 dnl # Proposed API change,
823 dnl # This symbol is not available in stock kernels. You may build a
824 dnl # custom kernel with the *-spl-export-symbols.patch which will export
825 dnl # these symbols for use. If your already rolling a custom kernel for
826 dnl # your environment this is recommended.
828 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
829 SPL_CHECK_SYMBOL_EXPORT(
832 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
833 [next_online_pgdat() is available])],
838 dnl # Proposed API change,
839 dnl # This symbol is not available in stock kernels. You may build a
840 dnl # custom kernel with the *-spl-export-symbols.patch which will export
841 dnl # these symbols for use. If your already rolling a custom kernel for
842 dnl # your environment this is recommended.
844 AC_DEFUN([SPL_AC_NEXT_ZONE], [
845 SPL_CHECK_SYMBOL_EXPORT(
848 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
849 [next_zone() is available])],
854 dnl # Proposed API change,
855 dnl # This symbol is not available in stock kernels. You may build a
856 dnl # custom kernel with the *-spl-export-symbols.patch which will export
857 dnl # these symbols for use. If your already rolling a custom kernel for
858 dnl # your environment this is recommended.
860 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
861 SPL_CHECK_SYMBOL_EXPORT(
864 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
865 [get_zone_counts() is available])],
870 dnl # 2.6.18 API change,
871 dnl # First introduced global_page_state() support as an inline.
873 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
874 AC_MSG_CHECKING([whether global_page_state() is available])
875 SPL_LINUX_TRY_COMPILE([
876 #include <linux/vmstat.h>
879 state = global_page_state(NR_FREE_PAGES);
882 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
883 [global_page_state() is available])
890 dnl # 2.6.21 API change,
891 dnl # Public global zone stats now include free/inactive/active page
892 dnl # counts. This replaced the priviate get_zone_counts() interface.
894 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FIA], [
895 AC_MSG_CHECKING([whether free/inactive/active page state is available])
896 SPL_LINUX_TRY_COMPILE([
897 #include <linux/mmzone.h>
899 enum zone_stat_item i1, i2, i3;
905 AC_DEFINE(HAVE_ZONE_STAT_ITEM_FIA, 1,
906 [free/inactive/active page state is available])
913 dnl # SLES API change, never adopted in mainline,
914 dnl # Third 'struct vfsmount *' argument removed.
916 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
917 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
918 SPL_LINUX_TRY_COMPILE([
919 #include <linux/fs.h>
921 vfs_unlink(NULL, NULL);
924 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
925 [vfs_unlink() wants 2 args])
932 dnl # SLES API change, never adopted in mainline,
933 dnl # Third and sixth 'struct vfsmount *' argument removed.
935 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
936 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
937 SPL_LINUX_TRY_COMPILE([
938 #include <linux/fs.h>
940 vfs_rename(NULL, NULL, NULL, NULL);
943 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
944 [vfs_rename() wants 4 args])