1 AC_DEFUN([SPL_AC_KERNEL], [
3 AS_HELP_STRING([--with-linux=PATH],
4 [Path to kernel source]),
5 [kernelsrc="$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}`
20 AC_MSG_RESULT([Not found])
22 *** Please specify the location of the kernel source
23 *** with the '--with-linux=PATH' option])
26 if test "$kernelsrc" = "NONE"; then
31 AC_MSG_RESULT([$kernelsrc])
32 AC_MSG_CHECKING([kernel build directory])
33 if test -z "$kernelbuild"; then
34 if test -d ${kernelsrc}-obj; then
35 kernelbuild=${kernelsrc}-obj/`arch`/`arch`
36 elif test -d `dirname ${kernelsrc}`/build-`arch`; then
37 kernelbuild=`dirname ${kernelsrc}`/build-`arch`
39 kernelbuild=${kernelsrc}
42 AC_MSG_RESULT([$kernelbuild])
44 AC_MSG_CHECKING([kernel source version])
45 if test -r $kernelbuild/include/linux/version.h &&
46 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
48 kernsrcver=`(echo "#include <linux/version.h>";
49 echo "kernsrcver=UTS_RELEASE") |
50 cpp -I $kernelbuild/include |
51 grep "^kernsrcver=" | cut -d \" -f 2`
53 elif test -r $kernelbuild/include/linux/utsrelease.h &&
54 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
56 kernsrcver=`(echo "#include <linux/utsrelease.h>";
57 echo "kernsrcver=UTS_RELEASE") |
58 cpp -I $kernelbuild/include |
59 grep "^kernsrcver=" | cut -d \" -f 2`
62 if test -z "$kernsrcver"; then
63 AC_MSG_RESULT([Not found])
65 *** Cannot determine the version of the linux kernel source.
66 *** Please prepare the kernel before running this script])
69 AC_MSG_RESULT([$kernsrcver])
72 LINUX_OBJ=${kernelbuild}
73 LINUX_VERSION=${kernsrcver}
75 abs_srcdir=`readlink -f ${srcdir}`
76 kerninclude="-I${abs_srcdir} -I${abs_srcdir}/include"
77 kernwarn="-Wstrict-prototypes -Werror"
79 if test "${LINUX_OBJ}" != "${LINUX}"; then
80 kernobjs="O=$kernelbuild"
84 KERNELCPPFLAGS="${kerninclude} ${kernwarn}"
85 KERNELMAKE_PARAMS="${kernobjs}"
89 AC_SUBST(LINUX_VERSION)
90 AC_SUBST(KERNELMAKE_PARAMS)
91 AC_SUBST(KERNELCPPFLAGS)
92 AC_SUBST(KERNELCFLAGS)
95 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
96 AC_MSG_CHECKING([kernel file name for module symbols])
97 if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost; then
98 LINUX_SYMBOLS=Modules.symvers
100 LINUX_SYMBOLS=Module.symvers
102 AC_MSG_RESULT($LINUX_SYMBOLS)
103 AC_SUBST(LINUX_SYMBOLS)
106 AC_DEFUN([SPL_AC_LICENSE], [
107 AC_MSG_CHECKING([license])
109 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
112 AC_DEFUN([SPL_AC_DEBUG], [
113 AC_MSG_CHECKING([whether debugging is enabled])
114 AC_ARG_ENABLE( [debug],
115 AS_HELP_STRING([--enable-debug],
116 [Enable generic debug support (default off)]),
117 [ case "$enableval" in
118 yes) spl_ac_debug=yes ;;
119 no) spl_ac_debug=no ;;
120 *) AC_MSG_RESULT([Error!])
121 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;;
124 if test "$spl_ac_debug" = yes; then
126 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
129 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
133 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
134 AC_MSG_CHECKING([whether kmem debugging is enabled])
135 AC_ARG_ENABLE( [debug-kmem],
136 AS_HELP_STRING([--enable-debug-kmem],
137 [Enable kmem debug support (default off)]),
138 [ case "$enableval" in
139 yes) spl_ac_debug_kmem=yes ;;
140 no) spl_ac_debug_kmem=no ;;
141 *) AC_MSG_RESULT([Error!])
142 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;;
145 if test "$spl_ac_debug_kmem" = yes; then
147 AC_DEFINE([DEBUG_KMEM], [1],
148 [Define to 1 to enable kmem debugging])
149 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
155 AC_DEFUN([SPL_AC_DEBUG_MUTEX], [
156 AC_MSG_CHECKING([whether mutex debugging is enabled])
157 AC_ARG_ENABLE( [debug-mutex],
158 AS_HELP_STRING([--enable-debug-mutex],
159 [Enable mutex debug support (default off)]),
160 [ case "$enableval" in
161 yes) spl_ac_debug_mutex=yes ;;
162 no) spl_ac_debug_mutex=no ;;
163 *) AC_MSG_RESULT([Error!])
164 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;;
167 if test "$spl_ac_debug_mutex" = yes; then
169 AC_DEFINE([DEBUG_MUTEX], [1],
170 [Define to 1 to enable mutex debugging])
171 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX"
177 AC_DEFUN([SPL_AC_DEBUG_KSTAT], [
178 AC_MSG_CHECKING([whether kstat debugging is enabled])
179 AC_ARG_ENABLE( [debug-kstat],
180 AS_HELP_STRING([--enable-debug-kstat],
181 [Enable kstat debug support (default off)]),
182 [ case "$enableval" in
183 yes) spl_ac_debug_kstat=yes ;;
184 no) spl_ac_debug_kstat=no ;;
185 *) AC_MSG_RESULT([Error!])
186 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;;
189 if test "$spl_ac_debug_kstat" = yes; then
191 AC_DEFINE([DEBUG_KSTAT], [1],
192 [Define to 1 to enable kstat debugging])
193 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT"
199 AC_DEFUN([SPL_AC_DEBUG_CALLB], [
200 AC_MSG_CHECKING([whether callb debugging is enabled])
201 AC_ARG_ENABLE( [debug-callb],
202 AS_HELP_STRING([--enable-debug-callb],
203 [Enable callb debug support (default off)]),
204 [ case "$enableval" in
205 yes) spl_ac_debug_callb=yes ;;
206 no) spl_ac_debug_callb=no ;;
207 *) AC_MSG_RESULT([Error!])
208 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;;
211 if test "$spl_ac_debug_callb" = yes; then
213 AC_DEFINE([DEBUG_CALLB], [1],
214 [Define to 1 to enable callb debugging])
215 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB"
222 dnl # SPL_LINUX_CONFTEST
224 AC_DEFUN([SPL_LINUX_CONFTEST], [
225 cat >conftest.c <<_ACEOF
231 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
233 m4_define([SPL_LANG_PROGRAM], [
238 dnl Do *not* indent the following line: there may be CPP directives.
239 dnl Don't move the `;' right after for the same reason.
247 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
249 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
250 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
251 rm -Rf build && mkdir -p build
252 echo "obj-m := conftest.o" >build/Makefile
254 [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])],
256 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
262 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
264 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
265 [SPL_LINUX_COMPILE_IFELSE(
266 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
268 [test -s build/conftest.o],
273 dnl # SPL_LINUX_CONFIG
275 AC_DEFUN([SPL_LINUX_CONFIG],
276 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
277 SPL_LINUX_TRY_COMPILE([
278 #ifndef AUTOCONF_INCLUDED
279 #include <linux/config.h>
283 #error CONFIG_$1 not #defined
295 dnl # SPL_CHECK_SYMBOL_EXPORT
296 dnl # check symbol exported or not
298 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
299 [AC_MSG_CHECKING([whether symbol $1 is exported])
300 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
301 $LINUX_OBJ/Module*.symvers 2>/dev/null
303 if test $rc -ne 0; then
306 grep -q -E "EXPORT_SYMBOL.*($1)" \
307 "$LINUX_OBJ/$file" 2>/dev/null
309 if test $rc -eq 0; then
314 if test $export -eq 0; then
328 dnl # SPL_CHECK_HEADER
329 dnl # check whether header exists and define HAVE_$2_HEADER
331 AC_DEFUN([SPL_CHECK_HEADER],
332 [AC_MSG_CHECKING([whether header $1 exists])
333 SPL_LINUX_TRY_COMPILE([
338 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
348 dnl # 2.6.24 API change,
349 dnl # check if uintptr_t typedef is defined
351 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
352 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
353 SPL_LINUX_TRY_COMPILE([
354 #include <linux/types.h>
359 AC_DEFINE(HAVE_UINTPTR_T, 1,
360 [kernel defines uintptr_t])
367 dnl # 2.6.x API change,
368 dnl # check if atomic64_t typedef is defined
370 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_T],
371 [AC_MSG_CHECKING([whether kernel defines atomic64_t])
372 SPL_LINUX_TRY_COMPILE([
373 #include <asm/atomic.h>
378 AC_DEFINE(HAVE_ATOMIC64_T, 1,
379 [kernel defines atomic64_t])
386 dnl # 2.6.20 API change,
387 dnl # INIT_WORK use 2 args and not store data inside
389 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
390 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
391 SPL_LINUX_TRY_COMPILE([
392 #include <linux/workqueue.h>
394 struct work_struct work;
395 INIT_WORK(&work, NULL, NULL);
398 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
399 [INIT_WORK wants 3 args])
406 dnl # 2.6.21 API change,
407 dnl # 'register_sysctl_table' use only one argument instead of two
409 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
410 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
411 SPL_LINUX_TRY_COMPILE([
412 #include <linux/sysctl.h>
414 return register_sysctl_table(NULL,0);
417 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
418 [register_sysctl_table() wants 2 args])
425 dnl # 2.6.23 API change
426 dnl # Old set_shrinker API replaced with register_shrinker
428 AC_DEFUN([SPL_AC_SET_SHRINKER], [
429 AC_MSG_CHECKING([whether set_shrinker() available])
430 SPL_LINUX_TRY_COMPILE([
431 #include <linux/mm.h>
433 return set_shrinker(DEFAULT_SEEKS, NULL);
436 AC_DEFINE(HAVE_SET_SHRINKER, 1,
437 [set_shrinker() available])
444 dnl # 2.6.25 API change,
445 dnl # struct path entry added to struct nameidata
447 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
448 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
449 SPL_LINUX_TRY_COMPILE([
450 #include <linux/namei.h>
455 nd.path.dentry = NULL;
458 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
459 [struct path used in struct nameidata])
466 dnl # Custom SPL patch may export this system it is not required
468 AC_DEFUN([SPL_AC_TASK_CURR], [
469 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
470 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
475 dnl # 2.6.19 API change,
476 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
478 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
479 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
480 SPL_LINUX_TRY_COMPILE([
481 #include <linux/sysctl.h>
483 #ifndef CTL_UNNUMBERED
484 #error CTL_UNNUMBERED undefined
488 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
489 [unnumbered sysctl support exists])
496 dnl # 2.6.16 API change.
497 dnl # Check if 'fls64()' is available
499 AC_DEFUN([SPL_AC_FLS64],
500 [AC_MSG_CHECKING([whether fls64() is available])
501 SPL_LINUX_TRY_COMPILE([
502 #include <linux/bitops.h>
507 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
514 dnl # 2.6.18 API change, check whether device_create() is available.
515 dnl # Device_create() was introduced in 2.6.18 and depricated
516 dnl # class_device_create() which was fully removed in 2.6.26.
518 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
519 SPL_CHECK_SYMBOL_EXPORT(
521 [drivers/base/core.c],
522 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
523 [device_create() is available])],
528 dnl # 2.6.27 API change,
529 dnl # device_create() uses 5 args, new 'drvdata' argument.
531 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
532 AC_MSG_CHECKING([whether device_create() wants 5 args])
533 tmp_flags="$EXTRA_KCFLAGS"
534 EXTRA_KCFLAGS="-Werror"
535 SPL_LINUX_TRY_COMPILE([
536 #include <linux/device.h>
538 device_create(NULL, NULL, 0, NULL, "%d", 1);
541 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
542 [device_create wants 5 args])
546 EXTRA_KCFLAGS="$tmp_flags"
550 dnl # 2.6.13 API change, check whether class_device_create() is available.
551 dnl # Class_device_create() was introduced in 2.6.13 and depricated
552 dnl # class_simple_device_add() which was fully removed in 2.6.13.
554 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
555 SPL_CHECK_SYMBOL_EXPORT(
556 [class_device_create],
557 [drivers/base/class.c],
558 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
559 [class_device_create() is available])],
564 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
566 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
567 SPL_CHECK_SYMBOL_EXPORT(
568 [set_normalized_timespec],
570 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
571 [set_normalized_timespec() is available as export])],
576 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
577 dnl # previously it was available in time.h as an inline.
579 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
580 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
581 SPL_LINUX_TRY_COMPILE([
582 #include <linux/time.h>
583 void set_normalized_timespec(struct timespec *ts,
584 time_t sec, long nsec) { }
591 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
592 [set_normalized_timespec() is available as inline])
597 dnl # 2.6.18 API change,
598 dnl # timespec_sub() inline function available in linux/time.h
600 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
601 AC_MSG_CHECKING([whether timespec_sub() is available])
602 SPL_LINUX_TRY_COMPILE([
603 #include <linux/time.h>
605 struct timespec a, b, c = { 0 };
606 c = timespec_sub(a, b);
609 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
616 dnl # 2.6.19 API change,
617 dnl # check if init_utsname() is available in linux/utsname.h
619 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
620 AC_MSG_CHECKING([whether init_utsname() is available])
621 SPL_LINUX_TRY_COMPILE([
622 #include <linux/utsname.h>
624 struct new_utsname *a = init_utsname();
627 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
634 dnl # 2.6.26 API change,
635 dnl # definition of struct fdtable relocated to linux/fdtable.h
637 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
638 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
642 dnl # 2.6.14 API change,
643 dnl # check whether 'files_fdtable()' exists
645 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
646 AC_MSG_CHECKING([whether files_fdtable() is available])
647 SPL_LINUX_TRY_COMPILE([
648 #include <linux/sched.h>
649 #include <linux/file.h>
650 #ifdef HAVE_FDTABLE_HEADER
651 #include <linux/fdtable.h>
654 struct files_struct *files = current->files;
655 struct fdtable *fdt = files_fdtable(files);
658 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
665 dnl # 2.6.18 API change,
666 dnl # added linux/uaccess.h
668 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
669 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
673 dnl # 2.6.12 API change,
674 dnl # check whether 'kmalloc_node()' is available.
676 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
677 AC_MSG_CHECKING([whether kmalloc_node() is available])
678 SPL_LINUX_TRY_COMPILE([
679 #include <linux/slab.h>
681 void *a = kmalloc_node(1, GFP_KERNEL, 0);
684 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
691 dnl # 2.6.9 API change,
692 dnl # check whether 'monotonic_clock()' is available it may
693 dnl # be available for some archs but not others.
695 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
696 SPL_CHECK_SYMBOL_EXPORT(
699 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
700 [monotonic_clock() is available])],
705 dnl # 2.6.16 API change,
706 dnl # check whether 'struct inode' has i_mutex
708 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
709 AC_MSG_CHECKING([whether struct inode has i_mutex])
710 SPL_LINUX_TRY_COMPILE([
711 #include <linux/fs.h>
712 #include <linux/mutex.h>
715 mutex_init(&i.i_mutex);
718 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
725 dnl # 2.6.18 API change,
726 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
727 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
728 dnl # if the mutex validator is disabled or otherwise unavailable.
730 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
731 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
732 SPL_LINUX_TRY_COMPILE([
733 #include <linux/mutex.h>
737 mutex_lock_nested(&mutex, 0);
740 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
741 [mutex_lock_nested() is available])
748 dnl # 2.6.22 API change,
749 dnl # First introduced 'div64_64()' in lib/div64.c
751 AC_DEFUN([SPL_AC_DIV64_64], [
752 SPL_CHECK_SYMBOL_EXPORT(
755 [AC_DEFINE(HAVE_DIV64_64, 1,
756 [div64_64() is available])],
761 dnl # 2.6.26 API change,
762 dnl # Renamed 'div64_64()' to 'div64_u64' in lib/div64.c
764 AC_DEFUN([SPL_AC_DIV64_U64], [
765 SPL_CHECK_SYMBOL_EXPORT(
768 [AC_DEFINE(HAVE_DIV64_U64, 1,
769 [div64_u64() is available])],
774 dnl # 2.6.27 API change,
775 dnl # on_each_cpu() uses 3 args, no 'retry' argument
777 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
778 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
779 SPL_LINUX_TRY_COMPILE([
780 #include <linux/smp.h>
782 on_each_cpu(NULL, NULL, 0);
785 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
786 [on_each_cpu wants 3 args])
793 dnl # 2.6.18 API change,
794 dnl # kallsyms_lookup_name no longer exported
796 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
797 SPL_CHECK_SYMBOL_EXPORT(
798 [kallsyms_lookup_name],
800 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
801 [kallsyms_lookup_name() 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_GET_VMALLOC_INFO], [
813 SPL_CHECK_SYMBOL_EXPORT(
816 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
817 [get_vmalloc_info() is available])],
822 dnl # 2.6.17 API change
823 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
824 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
825 dnl # were exported in 2.6.17 for use by modules which was consistent with
826 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
827 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
828 dnl # were dropped entirely leaving modules no way to directly iterate over
829 dnl # the zone list. Because we need access to the zone helpers we check
830 dnl # if the kernel contains the old or new implementation. Then we check
831 dnl # to see if the symbols we need for each version are available. If they
832 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
834 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
835 AC_MSG_CHECKING([whether symbol *_pgdat exist])
836 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
838 if test $rc -eq 0; then
840 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
847 dnl # Proposed API change,
848 dnl # This symbol is not available in stock kernels. You may build a
849 dnl # custom kernel with the *-spl-export-symbols.patch which will export
850 dnl # these symbols for use. If your already rolling a custom kernel for
851 dnl # your environment this is recommended.
853 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
854 SPL_CHECK_SYMBOL_EXPORT(
855 [first_online_pgdat],
857 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
858 [first_online_pgdat() is available])],
863 dnl # Proposed API change,
864 dnl # This symbol is not available in stock kernels. You may build a
865 dnl # custom kernel with the *-spl-export-symbols.patch which will export
866 dnl # these symbols for use. If your already rolling a custom kernel for
867 dnl # your environment this is recommended.
869 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
870 SPL_CHECK_SYMBOL_EXPORT(
873 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
874 [next_online_pgdat() is available])],
879 dnl # Proposed API change,
880 dnl # This symbol is not available in stock kernels. You may build a
881 dnl # custom kernel with the *-spl-export-symbols.patch which will export
882 dnl # these symbols for use. If your already rolling a custom kernel for
883 dnl # your environment this is recommended.
885 AC_DEFUN([SPL_AC_NEXT_ZONE], [
886 SPL_CHECK_SYMBOL_EXPORT(
889 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
890 [next_zone() is available])],
895 dnl # 2.6.17 API change,
896 dnl # See SPL_AC_PGDAT_HELPERS for details.
898 AC_DEFUN([SPL_AC_PGDAT_LIST], [
899 SPL_CHECK_SYMBOL_EXPORT(
902 [AC_DEFINE(HAVE_PGDAT_LIST, 1,
903 [pgdat_list is available])],
908 dnl # Proposed API change,
909 dnl # This symbol is not available in stock kernels. You may build a
910 dnl # custom kernel with the *-spl-export-symbols.patch which will export
911 dnl # these symbols for use. If your already rolling a custom kernel for
912 dnl # your environment this is recommended.
914 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
915 SPL_CHECK_SYMBOL_EXPORT(
918 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
919 [get_zone_counts() is available])],
924 dnl # 2.6.18 API change,
925 dnl # First introduced global_page_state() support as an inline.
927 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
928 AC_MSG_CHECKING([whether global_page_state() is available])
929 SPL_LINUX_TRY_COMPILE([
930 #include <linux/vmstat.h>
933 state = global_page_state(NR_FREE_PAGES);
936 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
937 [global_page_state() is available])
944 dnl # 2.6.21 API change,
945 dnl # Public global zone stats now include free/inactive/active page
946 dnl # counts. This replaced the priviate get_zone_counts() interface.
948 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FIA], [
949 AC_MSG_CHECKING([whether free/inactive/active page state is available])
950 SPL_LINUX_TRY_COMPILE([
951 #include <linux/mmzone.h>
953 enum zone_stat_item i1, i2, i3;
959 AC_DEFINE(HAVE_ZONE_STAT_ITEM_FIA, 1,
960 [free/inactive/active page state is available])
967 dnl # SLES API change, never adopted in mainline,
968 dnl # Third 'struct vfsmount *' argument removed.
970 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
971 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
972 SPL_LINUX_TRY_COMPILE([
973 #include <linux/fs.h>
975 vfs_unlink(NULL, NULL);
978 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
979 [vfs_unlink() wants 2 args])
986 dnl # SLES API change, never adopted in mainline,
987 dnl # Third and sixth 'struct vfsmount *' argument removed.
989 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
990 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
991 SPL_LINUX_TRY_COMPILE([
992 #include <linux/fs.h>
994 vfs_rename(NULL, NULL, NULL, NULL);
997 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
998 [vfs_rename() wants 4 args])