]> git.proxmox.com Git - mirror_spl-debian.git/blob - config/spl-build.m4
Reimplement rwlocks for Linux lock profiling/analysis.
[mirror_spl-debian.git] / config / spl-build.m4
1 dnl #
2 dnl # Default SPL kernel configuration
3 dnl #
4 AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
5 SPL_AC_KERNEL
6
7 dnl # Kernel build make options
8 dnl # KERNELMAKE_PARAMS="V=1" # Enable verbose module build
9 KERNELMAKE_PARAMS="V=1"
10
11 dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
12 dnl # compiler options are added by the kernel build system.
13 abs_srcdir=`readlink -f ${srcdir}`
14 KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes -Werror"
15 KERNELCPPFLAGS="$KERNELCPPFLAGS -I${abs_srcdir} -I${abs_srcdir}/include"
16
17 if test "${LINUX_OBJ}" != "${LINUX}"; then
18 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
19 fi
20
21 AC_SUBST(KERNELMAKE_PARAMS)
22 AC_SUBST(KERNELCPPFLAGS)
23
24 SPL_AC_DEBUG
25 SPL_AC_DEBUG_KMEM
26 SPL_AC_DEBUG_MUTEX
27 SPL_AC_DEBUG_KSTAT
28 SPL_AC_DEBUG_CALLB
29 SPL_AC_TYPE_UINTPTR_T
30 SPL_AC_TYPE_ATOMIC64_T
31 SPL_AC_3ARGS_INIT_WORK
32 SPL_AC_2ARGS_REGISTER_SYSCTL
33 SPL_AC_SET_SHRINKER
34 SPL_AC_PATH_IN_NAMEIDATA
35 SPL_AC_TASK_CURR
36 SPL_AC_CTL_UNNUMBERED
37 SPL_AC_FLS64
38 SPL_AC_DEVICE_CREATE
39 SPL_AC_5ARGS_DEVICE_CREATE
40 SPL_AC_CLASS_DEVICE_CREATE
41 SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
42 SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
43 SPL_AC_TIMESPEC_SUB
44 SPL_AC_INIT_UTSNAME
45 SPL_AC_FDTABLE_HEADER
46 SPL_AC_FILES_FDTABLE
47 SPL_AC_UACCESS_HEADER
48 SPL_AC_KMALLOC_NODE
49 SPL_AC_MONOTONIC_CLOCK
50 SPL_AC_INODE_I_MUTEX
51 SPL_AC_MUTEX_LOCK_NESTED
52 SPL_AC_DIV64_64
53 SPL_AC_DIV64_U64
54 SPL_AC_3ARGS_ON_EACH_CPU
55 SPL_AC_KALLSYMS_LOOKUP_NAME
56 SPL_AC_GET_VMALLOC_INFO
57 SPL_AC_PGDAT_HELPERS
58 SPL_AC_FIRST_ONLINE_PGDAT
59 SPL_AC_NEXT_ONLINE_PGDAT
60 SPL_AC_NEXT_ZONE
61 SPL_AC_PGDAT_LIST
62 SPL_AC_GLOBAL_PAGE_STATE
63 SPL_AC_ZONE_STAT_ITEM_FREE
64 SPL_AC_ZONE_STAT_ITEM_INACTIVE
65 SPL_AC_ZONE_STAT_ITEM_ACTIVE
66 SPL_AC_GET_ZONE_COUNTS
67 SPL_AC_2ARGS_VFS_UNLINK
68 SPL_AC_4ARGS_VFS_RENAME
69 SPL_AC_CRED_STRUCT
70 SPL_AC_GROUPS_SEARCH
71 SPL_AC_PUT_TASK_STRUCT
72 ])
73
74 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
75 modpost=$LINUX/scripts/Makefile.modpost
76 AC_MSG_CHECKING([kernel file name for module symbols])
77 if test -f "$modpost"; then
78 if grep -q Modules.symvers $modpost; then
79 LINUX_SYMBOLS=Modules.symvers
80 else
81 LINUX_SYMBOLS=Module.symvers
82 fi
83 else
84 LINUX_SYMBOLS=NONE
85 fi
86 AC_MSG_RESULT($LINUX_SYMBOLS)
87 AC_SUBST(LINUX_SYMBOLS)
88 ])
89
90 AC_DEFUN([SPL_AC_KERNEL], [
91 AC_ARG_WITH([linux],
92 AS_HELP_STRING([--with-linux=PATH],
93 [Path to kernel source]),
94 [kernelsrc="$withval"])
95
96 AC_ARG_WITH([linux-obj],
97 AS_HELP_STRING([--with-linux-obj=PATH],
98 [Path to kernel build objects]),
99 [kernelbuild="$withval"])
100
101 AC_MSG_CHECKING([kernel source directory])
102 if test -z "$kernelsrc"; then
103 sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \
104 2>/dev/null | grep -v obj | tail -1`
105
106 if test -e ${sourcelink}; then
107 kernelsrc=`readlink -f ${sourcelink}`
108 else
109 AC_MSG_RESULT([Not found])
110 AC_MSG_ERROR([
111 *** Please specify the location of the kernel source
112 *** with the '--with-linux=PATH' option])
113 fi
114 else
115 if test "$kernelsrc" = "NONE"; then
116 kernsrcver=NONE
117 fi
118 fi
119
120 AC_MSG_RESULT([$kernelsrc])
121 AC_MSG_CHECKING([kernel build directory])
122 if test -z "$kernelbuild"; then
123 if test -d ${kernelsrc}-obj/`arch`/`arch`; then
124 kernelbuild=${kernelsrc}-obj/`arch`/`arch`
125 elif test -d ${kernelsrc}-obj/`arch`/default; then
126 kernelbuild=${kernelsrc}-obj/`arch`/default
127 elif test -d `dirname ${kernelsrc}`/build-`arch`; then
128 kernelbuild=`dirname ${kernelsrc}`/build-`arch`
129 else
130 kernelbuild=${kernelsrc}
131 fi
132 fi
133 AC_MSG_RESULT([$kernelbuild])
134
135 AC_MSG_CHECKING([kernel source version])
136 if test -r $kernelbuild/include/linux/version.h &&
137 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
138
139 kernsrcver=`(echo "#include <linux/version.h>";
140 echo "kernsrcver=UTS_RELEASE") |
141 cpp -I $kernelbuild/include |
142 grep "^kernsrcver=" | cut -d \" -f 2`
143
144 elif test -r $kernelbuild/include/linux/utsrelease.h &&
145 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
146
147 kernsrcver=`(echo "#include <linux/utsrelease.h>";
148 echo "kernsrcver=UTS_RELEASE") |
149 cpp -I $kernelbuild/include |
150 grep "^kernsrcver=" | cut -d \" -f 2`
151 fi
152
153 if test -z "$kernsrcver"; then
154 AC_MSG_RESULT([Not found])
155 AC_MSG_ERROR([
156 *** Cannot determine the version of the linux kernel source.
157 *** Please prepare the kernel before running this script])
158 fi
159
160 AC_MSG_RESULT([$kernsrcver])
161
162 LINUX=${kernelsrc}
163 LINUX_OBJ=${kernelbuild}
164 LINUX_VERSION=${kernsrcver}
165
166 AC_SUBST(LINUX)
167 AC_SUBST(LINUX_OBJ)
168 AC_SUBST(LINUX_VERSION)
169
170 SPL_AC_MODULE_SYMVERS
171 ])
172
173 dnl #
174 dnl # Default SPL user configuration
175 dnl #
176 AC_DEFUN([SPL_AC_CONFIG_USER], [])
177
178 AC_DEFUN([SPL_AC_LICENSE], [
179 AC_MSG_CHECKING([spl license])
180 LICENSE=GPL
181 AC_MSG_RESULT([$LICENSE])
182 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
183 AC_SUBST(LICENSE)
184 ])
185
186 AC_DEFUN([SPL_AC_CONFIG], [
187 SPL_CONFIG=all
188 AC_ARG_WITH([config],
189 AS_HELP_STRING([--with-config=CONFIG],
190 [Config file 'kernel|user|all']),
191 [SPL_CONFIG="$withval"])
192
193 AC_MSG_CHECKING([spl config])
194 AC_MSG_RESULT([$SPL_CONFIG]);
195 AC_SUBST(SPL_CONFIG)
196
197 case "$SPL_CONFIG" in
198 kernel) SPL_AC_CONFIG_KERNEL ;;
199 user) SPL_AC_CONFIG_USER ;;
200 all) SPL_AC_CONFIG_KERNEL
201 SPL_AC_CONFIG_USER ;;
202 *)
203 AC_MSG_RESULT([Error!])
204 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
205 user kernel|user|all]) ;;
206 esac
207
208 AM_CONDITIONAL([CONFIG_USER],
209 [test "$SPL_CONFIG" = user] ||
210 [test "$SPL_CONFIG" = all])
211 AM_CONDITIONAL([CONFIG_KERNEL],
212 [test "$SPL_CONFIG" = kernel] ||
213 [test "$SPL_CONFIG" = all])
214 ])
215
216 AC_DEFUN([SPL_AC_DEBUG], [
217 AC_MSG_CHECKING([whether debugging is enabled])
218 AC_ARG_ENABLE( [debug],
219 AS_HELP_STRING([--enable-debug],
220 [Enable generic debug support (default off)]),
221 [ case "$enableval" in
222 yes) spl_ac_debug=yes ;;
223 no) spl_ac_debug=no ;;
224 *) AC_MSG_RESULT([Error!])
225 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;;
226 esac ]
227 )
228 if test "$spl_ac_debug" = yes; then
229 AC_MSG_RESULT([yes])
230 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
231 else
232 AC_MSG_RESULT([no])
233 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
234 fi
235 ])
236
237 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
238 AC_MSG_CHECKING([whether kmem debugging is enabled])
239 AC_ARG_ENABLE( [debug-kmem],
240 AS_HELP_STRING([--enable-debug-kmem],
241 [Enable kmem debug support (default off)]),
242 [ case "$enableval" in
243 yes) spl_ac_debug_kmem=yes ;;
244 no) spl_ac_debug_kmem=no ;;
245 *) AC_MSG_RESULT([Error!])
246 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;;
247 esac ]
248 )
249 if test "$spl_ac_debug_kmem" = yes; then
250 AC_MSG_RESULT([yes])
251 AC_DEFINE([DEBUG_KMEM], [1],
252 [Define to 1 to enable kmem debugging])
253 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
254 else
255 AC_MSG_RESULT([no])
256 fi
257 ])
258
259 AC_DEFUN([SPL_AC_DEBUG_MUTEX], [
260 AC_MSG_CHECKING([whether mutex debugging is enabled])
261 AC_ARG_ENABLE( [debug-mutex],
262 AS_HELP_STRING([--enable-debug-mutex],
263 [Enable mutex debug support (default off)]),
264 [ case "$enableval" in
265 yes) spl_ac_debug_mutex=yes ;;
266 no) spl_ac_debug_mutex=no ;;
267 *) AC_MSG_RESULT([Error!])
268 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;;
269 esac ]
270 )
271 if test "$spl_ac_debug_mutex" = yes; then
272 AC_MSG_RESULT([yes])
273 AC_DEFINE([DEBUG_MUTEX], [1],
274 [Define to 1 to enable mutex debugging])
275 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX"
276 else
277 AC_MSG_RESULT([no])
278 fi
279 ])
280
281 AC_DEFUN([SPL_AC_DEBUG_KSTAT], [
282 AC_MSG_CHECKING([whether kstat debugging is enabled])
283 AC_ARG_ENABLE( [debug-kstat],
284 AS_HELP_STRING([--enable-debug-kstat],
285 [Enable kstat debug support (default off)]),
286 [ case "$enableval" in
287 yes) spl_ac_debug_kstat=yes ;;
288 no) spl_ac_debug_kstat=no ;;
289 *) AC_MSG_RESULT([Error!])
290 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;;
291 esac ]
292 )
293 if test "$spl_ac_debug_kstat" = yes; then
294 AC_MSG_RESULT([yes])
295 AC_DEFINE([DEBUG_KSTAT], [1],
296 [Define to 1 to enable kstat debugging])
297 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT"
298 else
299 AC_MSG_RESULT([no])
300 fi
301 ])
302
303 AC_DEFUN([SPL_AC_DEBUG_CALLB], [
304 AC_MSG_CHECKING([whether callb debugging is enabled])
305 AC_ARG_ENABLE( [debug-callb],
306 AS_HELP_STRING([--enable-debug-callb],
307 [Enable callb debug support (default off)]),
308 [ case "$enableval" in
309 yes) spl_ac_debug_callb=yes ;;
310 no) spl_ac_debug_callb=no ;;
311 *) AC_MSG_RESULT([Error!])
312 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;;
313 esac ]
314 )
315 if test "$spl_ac_debug_callb" = yes; then
316 AC_MSG_RESULT([yes])
317 AC_DEFINE([DEBUG_CALLB], [1],
318 [Define to 1 to enable callb debugging])
319 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB"
320 else
321 AC_MSG_RESULT([no])
322 fi
323 ])
324
325 dnl #
326 dnl # SPL_LINUX_CONFTEST
327 dnl #
328 AC_DEFUN([SPL_LINUX_CONFTEST], [
329 cat >conftest.c <<_ACEOF
330 $1
331 _ACEOF
332 ])
333
334 dnl #
335 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
336 dnl #
337 m4_define([SPL_LANG_PROGRAM], [
338 $1
339 int
340 main (void)
341 {
342 dnl Do *not* indent the following line: there may be CPP directives.
343 dnl Don't move the `;' right after for the same reason.
344 $2
345 ;
346 return 0;
347 }
348 ])
349
350 dnl #
351 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
352 dnl #
353 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
354 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
355 rm -Rf build && mkdir -p build
356 echo "obj-m := conftest.o" >build/Makefile
357 AS_IF(
358 [AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
359 [$4],
360 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
361 )
362 rm -Rf build
363 ])
364
365 dnl #
366 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
367 dnl #
368 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
369 [SPL_LINUX_COMPILE_IFELSE(
370 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
371 [modules],
372 [test -s build/conftest.o],
373 [$3], [$4])
374 ])
375
376 dnl #
377 dnl # SPL_LINUX_CONFIG
378 dnl #
379 AC_DEFUN([SPL_LINUX_CONFIG],
380 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
381 SPL_LINUX_TRY_COMPILE([
382 #ifndef AUTOCONF_INCLUDED
383 #include <linux/config.h>
384 #endif
385 ],[
386 #ifndef CONFIG_$1
387 #error CONFIG_$1 not #defined
388 #endif
389 ],[
390 AC_MSG_RESULT([yes])
391 $2
392 ],[
393 AC_MSG_RESULT([no])
394 $3
395 ])
396 ])
397
398 dnl #
399 dnl # SPL_CHECK_SYMBOL_EXPORT
400 dnl # check symbol exported or not
401 dnl #
402 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
403 [AC_MSG_CHECKING([whether symbol $1 is exported])
404 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
405 $LINUX_OBJ/Module*.symvers 2>/dev/null
406 rc=$?
407 if test $rc -ne 0; then
408 export=0
409 for file in $2; do
410 grep -q -E "EXPORT_SYMBOL.*($1)" \
411 "$LINUX_OBJ/$file" 2>/dev/null
412 rc=$?
413 if test $rc -eq 0; then
414 export=1
415 break;
416 fi
417 done
418 if test $export -eq 0; then
419 AC_MSG_RESULT([no])
420 $4
421 else
422 AC_MSG_RESULT([yes])
423 $3
424 fi
425 else
426 AC_MSG_RESULT([yes])
427 $3
428 fi
429 ])
430
431 dnl #
432 dnl # SPL_CHECK_HEADER
433 dnl # check whether header exists and define HAVE_$2_HEADER
434 dnl #
435 AC_DEFUN([SPL_CHECK_HEADER],
436 [AC_MSG_CHECKING([whether header $1 exists])
437 SPL_LINUX_TRY_COMPILE([
438 #include <$1>
439 ],[
440 return 0;
441 ],[
442 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
443 AC_MSG_RESULT(yes)
444 $3
445 ],[
446 AC_MSG_RESULT(no)
447 $4
448 ])
449 ])
450
451 dnl #
452 dnl # 2.6.24 API change,
453 dnl # check if uintptr_t typedef is defined
454 dnl #
455 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
456 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
457 SPL_LINUX_TRY_COMPILE([
458 #include <linux/types.h>
459 ],[
460 uintptr_t *ptr;
461 ],[
462 AC_MSG_RESULT([yes])
463 AC_DEFINE(HAVE_UINTPTR_T, 1,
464 [kernel defines uintptr_t])
465 ],[
466 AC_MSG_RESULT([no])
467 ])
468 ])
469
470 dnl #
471 dnl # 2.6.x API change,
472 dnl # check if atomic64_t typedef is defined
473 dnl #
474 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_T],
475 [AC_MSG_CHECKING([whether kernel defines atomic64_t])
476 SPL_LINUX_TRY_COMPILE([
477 #include <asm/atomic.h>
478 ],[
479 atomic64_t *ptr;
480 ],[
481 AC_MSG_RESULT([yes])
482 AC_DEFINE(HAVE_ATOMIC64_T, 1,
483 [kernel defines atomic64_t])
484 ],[
485 AC_MSG_RESULT([no])
486 ])
487 ])
488
489 dnl #
490 dnl # 2.6.20 API change,
491 dnl # INIT_WORK use 2 args and not store data inside
492 dnl #
493 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
494 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
495 SPL_LINUX_TRY_COMPILE([
496 #include <linux/workqueue.h>
497 ],[
498 struct work_struct work;
499 INIT_WORK(&work, NULL, NULL);
500 ],[
501 AC_MSG_RESULT(yes)
502 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
503 [INIT_WORK wants 3 args])
504 ],[
505 AC_MSG_RESULT(no)
506 ])
507 ])
508
509 dnl #
510 dnl # 2.6.21 API change,
511 dnl # 'register_sysctl_table' use only one argument instead of two
512 dnl #
513 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
514 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
515 SPL_LINUX_TRY_COMPILE([
516 #include <linux/sysctl.h>
517 ],[
518 return register_sysctl_table(NULL,0);
519 ],[
520 AC_MSG_RESULT(yes)
521 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
522 [register_sysctl_table() wants 2 args])
523 ],[
524 AC_MSG_RESULT(no)
525 ])
526 ])
527
528 dnl #
529 dnl # 2.6.23 API change
530 dnl # Old set_shrinker API replaced with register_shrinker
531 dnl #
532 AC_DEFUN([SPL_AC_SET_SHRINKER], [
533 AC_MSG_CHECKING([whether set_shrinker() available])
534 SPL_LINUX_TRY_COMPILE([
535 #include <linux/mm.h>
536 ],[
537 return set_shrinker(DEFAULT_SEEKS, NULL);
538 ],[
539 AC_MSG_RESULT([yes])
540 AC_DEFINE(HAVE_SET_SHRINKER, 1,
541 [set_shrinker() available])
542 ],[
543 AC_MSG_RESULT([no])
544 ])
545 ])
546
547 dnl #
548 dnl # 2.6.25 API change,
549 dnl # struct path entry added to struct nameidata
550 dnl #
551 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
552 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
553 SPL_LINUX_TRY_COMPILE([
554 #include <linux/namei.h>
555 ],[
556 struct nameidata nd;
557
558 nd.path.mnt = NULL;
559 nd.path.dentry = NULL;
560 ],[
561 AC_MSG_RESULT(yes)
562 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
563 [struct path used in struct nameidata])
564 ],[
565 AC_MSG_RESULT(no)
566 ])
567 ])
568
569 dnl #
570 dnl # Custom SPL patch may export this system it is not required
571 dnl #
572 AC_DEFUN([SPL_AC_TASK_CURR], [
573 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
574 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
575 [])
576 ])
577
578 dnl #
579 dnl # 2.6.19 API change,
580 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
581 dnl #
582 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
583 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
584 SPL_LINUX_TRY_COMPILE([
585 #include <linux/sysctl.h>
586 ],[
587 #ifndef CTL_UNNUMBERED
588 #error CTL_UNNUMBERED undefined
589 #endif
590 ],[
591 AC_MSG_RESULT(yes)
592 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
593 [unnumbered sysctl support exists])
594 ],[
595 AC_MSG_RESULT(no)
596 ])
597 ])
598
599 dnl #
600 dnl # 2.6.16 API change.
601 dnl # Check if 'fls64()' is available
602 dnl #
603 AC_DEFUN([SPL_AC_FLS64],
604 [AC_MSG_CHECKING([whether fls64() is available])
605 SPL_LINUX_TRY_COMPILE([
606 #include <linux/bitops.h>
607 ],[
608 return fls64(0);
609 ],[
610 AC_MSG_RESULT(yes)
611 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
612 ],[
613 AC_MSG_RESULT(no)
614 ])
615 ])
616
617 dnl #
618 dnl # 2.6.18 API change, check whether device_create() is available.
619 dnl # Device_create() was introduced in 2.6.18 and depricated
620 dnl # class_device_create() which was fully removed in 2.6.26.
621 dnl #
622 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
623 SPL_CHECK_SYMBOL_EXPORT(
624 [device_create],
625 [drivers/base/core.c],
626 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
627 [device_create() is available])],
628 [])
629 ])
630
631 dnl #
632 dnl # 2.6.27 API change,
633 dnl # device_create() uses 5 args, new 'drvdata' argument.
634 dnl #
635 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
636 AC_MSG_CHECKING([whether device_create() wants 5 args])
637 tmp_flags="$EXTRA_KCFLAGS"
638 EXTRA_KCFLAGS="-Werror"
639 SPL_LINUX_TRY_COMPILE([
640 #include <linux/device.h>
641 ],[
642 device_create(NULL, NULL, 0, NULL, "%d", 1);
643 ],[
644 AC_MSG_RESULT(yes)
645 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
646 [device_create wants 5 args])
647 ],[
648 AC_MSG_RESULT(no)
649 ])
650 EXTRA_KCFLAGS="$tmp_flags"
651 ])
652
653 dnl #
654 dnl # 2.6.13 API change, check whether class_device_create() is available.
655 dnl # Class_device_create() was introduced in 2.6.13 and depricated
656 dnl # class_simple_device_add() which was fully removed in 2.6.13.
657 dnl #
658 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
659 SPL_CHECK_SYMBOL_EXPORT(
660 [class_device_create],
661 [drivers/base/class.c],
662 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
663 [class_device_create() is available])],
664 [])
665 ])
666
667 dnl #
668 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
669 dnl #
670 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
671 SPL_CHECK_SYMBOL_EXPORT(
672 [set_normalized_timespec],
673 [kernel/time.c],
674 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
675 [set_normalized_timespec() is available as export])],
676 [])
677 ])
678
679 dnl #
680 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
681 dnl # previously it was available in time.h as an inline.
682 dnl #
683 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
684 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
685 SPL_LINUX_TRY_COMPILE([
686 #include <linux/time.h>
687 void set_normalized_timespec(struct timespec *ts,
688 time_t sec, long nsec) { }
689 ],
690 [],
691 [
692 AC_MSG_RESULT(no)
693 ],[
694 AC_MSG_RESULT(yes)
695 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
696 [set_normalized_timespec() is available as inline])
697 ])
698 ])
699
700 dnl #
701 dnl # 2.6.18 API change,
702 dnl # timespec_sub() inline function available in linux/time.h
703 dnl #
704 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
705 AC_MSG_CHECKING([whether timespec_sub() is available])
706 SPL_LINUX_TRY_COMPILE([
707 #include <linux/time.h>
708 ],[
709 struct timespec a, b, c = { 0 };
710 c = timespec_sub(a, b);
711 ],[
712 AC_MSG_RESULT(yes)
713 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
714 ],[
715 AC_MSG_RESULT(no)
716 ])
717 ])
718
719 dnl #
720 dnl # 2.6.19 API change,
721 dnl # check if init_utsname() is available in linux/utsname.h
722 dnl #
723 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
724 AC_MSG_CHECKING([whether init_utsname() is available])
725 SPL_LINUX_TRY_COMPILE([
726 #include <linux/utsname.h>
727 ],[
728 struct new_utsname *a = init_utsname();
729 ],[
730 AC_MSG_RESULT(yes)
731 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
732 ],[
733 AC_MSG_RESULT(no)
734 ])
735 ])
736
737 dnl #
738 dnl # 2.6.26 API change,
739 dnl # definition of struct fdtable relocated to linux/fdtable.h
740 dnl #
741 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
742 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
743 ])
744
745 dnl #
746 dnl # 2.6.14 API change,
747 dnl # check whether 'files_fdtable()' exists
748 dnl #
749 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
750 AC_MSG_CHECKING([whether files_fdtable() is available])
751 SPL_LINUX_TRY_COMPILE([
752 #include <linux/sched.h>
753 #include <linux/file.h>
754 #ifdef HAVE_FDTABLE_HEADER
755 #include <linux/fdtable.h>
756 #endif
757 ],[
758 struct files_struct *files = current->files;
759 struct fdtable *fdt = files_fdtable(files);
760 ],[
761 AC_MSG_RESULT(yes)
762 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
763 ],[
764 AC_MSG_RESULT(no)
765 ])
766 ])
767
768 dnl #
769 dnl # 2.6.18 API change,
770 dnl # added linux/uaccess.h
771 dnl #
772 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
773 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
774 ])
775
776 dnl #
777 dnl # 2.6.12 API change,
778 dnl # check whether 'kmalloc_node()' is available.
779 dnl #
780 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
781 AC_MSG_CHECKING([whether kmalloc_node() is available])
782 SPL_LINUX_TRY_COMPILE([
783 #include <linux/slab.h>
784 ],[
785 void *a = kmalloc_node(1, GFP_KERNEL, 0);
786 ],[
787 AC_MSG_RESULT(yes)
788 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
789 ],[
790 AC_MSG_RESULT(no)
791 ])
792 ])
793
794 dnl #
795 dnl # 2.6.9 API change,
796 dnl # check whether 'monotonic_clock()' is available it may
797 dnl # be available for some archs but not others.
798 dnl #
799 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
800 SPL_CHECK_SYMBOL_EXPORT(
801 [monotonic_clock],
802 [],
803 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
804 [monotonic_clock() is available])],
805 [])
806 ])
807
808 dnl #
809 dnl # 2.6.16 API change,
810 dnl # check whether 'struct inode' has i_mutex
811 dnl #
812 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
813 AC_MSG_CHECKING([whether struct inode has i_mutex])
814 SPL_LINUX_TRY_COMPILE([
815 #include <linux/fs.h>
816 #include <linux/mutex.h>
817 ],[
818 struct inode i;
819 mutex_init(&i.i_mutex);
820 ],[
821 AC_MSG_RESULT(yes)
822 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
823 ],[
824 AC_MSG_RESULT(no)
825 ])
826 ])
827
828 dnl #
829 dnl # 2.6.18 API change,
830 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
831 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
832 dnl # if the mutex validator is disabled or otherwise unavailable.
833 dnl #
834 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
835 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
836 SPL_LINUX_TRY_COMPILE([
837 #include <linux/mutex.h>
838 ],[
839 struct mutex mutex;
840 mutex_init(&mutex);
841 mutex_lock_nested(&mutex, 0);
842 ],[
843 AC_MSG_RESULT(yes)
844 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
845 [mutex_lock_nested() is available])
846 ],[
847 AC_MSG_RESULT(no)
848 ])
849 ])
850
851 dnl #
852 dnl # 2.6.22 API change,
853 dnl # First introduced 'div64_64()' in lib/div64.c
854 dnl
855 AC_DEFUN([SPL_AC_DIV64_64], [
856 SPL_CHECK_SYMBOL_EXPORT(
857 [div64_64],
858 [],
859 [AC_DEFINE(HAVE_DIV64_64, 1,
860 [div64_64() is available])],
861 [])
862 ])
863
864 dnl #
865 dnl # 2.6.26 API change,
866 dnl # Renamed 'div64_64()' to 'div64_u64' in lib/div64.c
867 dnl #
868 AC_DEFUN([SPL_AC_DIV64_U64], [
869 SPL_CHECK_SYMBOL_EXPORT(
870 [div64_u64],
871 [],
872 [AC_DEFINE(HAVE_DIV64_U64, 1,
873 [div64_u64() is available])],
874 [])
875 ])
876
877 dnl #
878 dnl # 2.6.27 API change,
879 dnl # on_each_cpu() uses 3 args, no 'retry' argument
880 dnl #
881 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
882 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
883 SPL_LINUX_TRY_COMPILE([
884 #include <linux/smp.h>
885 ],[
886 on_each_cpu(NULL, NULL, 0);
887 ],[
888 AC_MSG_RESULT(yes)
889 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
890 [on_each_cpu wants 3 args])
891 ],[
892 AC_MSG_RESULT(no)
893 ])
894 ])
895
896 dnl #
897 dnl # 2.6.18 API change,
898 dnl # kallsyms_lookup_name no longer exported
899 dnl #
900 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
901 SPL_CHECK_SYMBOL_EXPORT(
902 [kallsyms_lookup_name],
903 [],
904 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
905 [kallsyms_lookup_name() is available])],
906 [])
907 ])
908
909 dnl #
910 dnl # Proposed API change,
911 dnl # This symbol is not available in stock kernels. You may build a
912 dnl # custom kernel with the *-spl-export-symbols.patch which will export
913 dnl # these symbols for use. If your already rolling a custom kernel for
914 dnl # your environment this is recommended.
915 dnl #
916 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
917 SPL_CHECK_SYMBOL_EXPORT(
918 [get_vmalloc_info],
919 [],
920 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
921 [get_vmalloc_info() is available])],
922 [])
923 ])
924
925 dnl #
926 dnl # 2.6.17 API change
927 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
928 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
929 dnl # were exported in 2.6.17 for use by modules which was consistent with
930 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
931 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
932 dnl # were dropped entirely leaving modules no way to directly iterate over
933 dnl # the zone list. Because we need access to the zone helpers we check
934 dnl # if the kernel contains the old or new implementation. Then we check
935 dnl # to see if the symbols we need for each version are available. If they
936 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
937 dnl #
938 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
939 AC_MSG_CHECKING([whether symbol *_pgdat exist])
940 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
941 rc=$?
942 if test $rc -eq 0; then
943 AC_MSG_RESULT([yes])
944 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
945 else
946 AC_MSG_RESULT([no])
947 fi
948 ])
949
950 dnl #
951 dnl # Proposed API change,
952 dnl # This symbol is not available in stock kernels. You may build a
953 dnl # custom kernel with the *-spl-export-symbols.patch which will export
954 dnl # these symbols for use. If your already rolling a custom kernel for
955 dnl # your environment this is recommended.
956 dnl #
957 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
958 SPL_CHECK_SYMBOL_EXPORT(
959 [first_online_pgdat],
960 [],
961 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
962 [first_online_pgdat() is available])],
963 [])
964 ])
965
966 dnl #
967 dnl # Proposed API change,
968 dnl # This symbol is not available in stock kernels. You may build a
969 dnl # custom kernel with the *-spl-export-symbols.patch which will export
970 dnl # these symbols for use. If your already rolling a custom kernel for
971 dnl # your environment this is recommended.
972 dnl #
973 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
974 SPL_CHECK_SYMBOL_EXPORT(
975 [next_online_pgdat],
976 [],
977 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
978 [next_online_pgdat() is available])],
979 [])
980 ])
981
982 dnl #
983 dnl # Proposed API change,
984 dnl # This symbol is not available in stock kernels. You may build a
985 dnl # custom kernel with the *-spl-export-symbols.patch which will export
986 dnl # these symbols for use. If your already rolling a custom kernel for
987 dnl # your environment this is recommended.
988 dnl #
989 AC_DEFUN([SPL_AC_NEXT_ZONE], [
990 SPL_CHECK_SYMBOL_EXPORT(
991 [next_zone],
992 [],
993 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
994 [next_zone() is available])],
995 [])
996 ])
997
998 dnl #
999 dnl # 2.6.17 API change,
1000 dnl # See SPL_AC_PGDAT_HELPERS for details.
1001 dnl #
1002 AC_DEFUN([SPL_AC_PGDAT_LIST], [
1003 SPL_CHECK_SYMBOL_EXPORT(
1004 [pgdat_list],
1005 [],
1006 [AC_DEFINE(HAVE_PGDAT_LIST, 1,
1007 [pgdat_list is available])],
1008 [])
1009 ])
1010
1011 dnl #
1012 dnl # 2.6.18 API change,
1013 dnl # First introduced global_page_state() support as an inline.
1014 dnl #
1015 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1016 AC_MSG_CHECKING([whether global_page_state() is available])
1017 SPL_LINUX_TRY_COMPILE([
1018 #include <linux/mm.h>
1019 ],[
1020 unsigned long state;
1021 state = global_page_state(0);
1022 ],[
1023 AC_MSG_RESULT(yes)
1024 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1025 [global_page_state() is available])
1026 ],[
1027 AC_MSG_RESULT(no)
1028 ])
1029 ])
1030
1031 dnl #
1032 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1033 dnl # Public global zone stats now include a free page count. However
1034 dnl # the enumerated names of the counters have changed since this API
1035 dnl # was introduced. We need to deduce the corrent name to use. This
1036 dnl # replaces the priviate get_zone_counts() interface.
1037 dnl #
1038 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1039 dnl # is 2.6.30 as of when this was written.
1040 dnl #
1041 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1042 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1043 SPL_LINUX_TRY_COMPILE([
1044 #include <linux/mm.h>
1045 ],[
1046 enum zone_stat_item zsi;
1047 zsi = NR_FREE_PAGES;
1048 ],[
1049 AC_MSG_RESULT(yes)
1050 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1051 [Page state NR_FREE_PAGES is available])
1052 ],[
1053 AC_MSG_RESULT(no)
1054 ])
1055 ])
1056
1057 dnl #
1058 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1059 dnl # Public global zone stats now include an inactive page count. However
1060 dnl # the enumerated names of the counters have changed since this API
1061 dnl # was introduced. We need to deduce the corrent name to use. This
1062 dnl # replaces the priviate get_zone_counts() interface.
1063 dnl #
1064 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1065 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1066 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1067 dnl #
1068 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1069 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1070 SPL_LINUX_TRY_COMPILE([
1071 #include <linux/mm.h>
1072 ],[
1073 enum zone_stat_item zsi;
1074 zsi = NR_INACTIVE;
1075 ],[
1076 AC_MSG_RESULT(yes)
1077 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1078 [Page state NR_INACTIVE is available])
1079 ],[
1080 AC_MSG_RESULT(no)
1081 ])
1082
1083 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1084 SPL_LINUX_TRY_COMPILE([
1085 #include <linux/mm.h>
1086 ],[
1087 enum zone_stat_item zsi;
1088 zsi = NR_INACTIVE_ANON;
1089 ],[
1090 AC_MSG_RESULT(yes)
1091 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1092 [Page state NR_INACTIVE_ANON is available])
1093 ],[
1094 AC_MSG_RESULT(no)
1095 ])
1096
1097 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1098 SPL_LINUX_TRY_COMPILE([
1099 #include <linux/mm.h>
1100 ],[
1101 enum zone_stat_item zsi;
1102 zsi = NR_INACTIVE_FILE;
1103 ],[
1104 AC_MSG_RESULT(yes)
1105 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1106 [Page state NR_INACTIVE_FILE is available])
1107 ],[
1108 AC_MSG_RESULT(no)
1109 ])
1110 ])
1111
1112 dnl #
1113 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1114 dnl # Public global zone stats now include an active page count. However
1115 dnl # the enumerated names of the counters have changed since this API
1116 dnl # was introduced. We need to deduce the corrent name to use. This
1117 dnl # replaces the priviate get_zone_counts() interface.
1118 dnl #
1119 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1120 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1121 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1122 dnl #
1123 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1124 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1125 SPL_LINUX_TRY_COMPILE([
1126 #include <linux/mm.h>
1127 ],[
1128 enum zone_stat_item zsi;
1129 zsi = NR_ACTIVE;
1130 ],[
1131 AC_MSG_RESULT(yes)
1132 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1133 [Page state NR_ACTIVE is available])
1134 ],[
1135 AC_MSG_RESULT(no)
1136 ])
1137
1138 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1139 SPL_LINUX_TRY_COMPILE([
1140 #include <linux/mm.h>
1141 ],[
1142 enum zone_stat_item zsi;
1143 zsi = NR_ACTIVE_ANON;
1144 ],[
1145 AC_MSG_RESULT(yes)
1146 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1147 [Page state NR_ACTIVE_ANON is available])
1148 ],[
1149 AC_MSG_RESULT(no)
1150 ])
1151
1152 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1153 SPL_LINUX_TRY_COMPILE([
1154 #include <linux/mm.h>
1155 ],[
1156 enum zone_stat_item zsi;
1157 zsi = NR_ACTIVE_FILE;
1158 ],[
1159 AC_MSG_RESULT(yes)
1160 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1161 [Page state NR_ACTIVE_FILE is available])
1162 ],[
1163 AC_MSG_RESULT(no)
1164 ])
1165 ])
1166
1167 dnl #
1168 dnl # Proposed API change for legacy kernels.
1169 dnl # This symbol is not available in older kernels. For kernels post
1170 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1171 dnl # page state information. This symbol is only used in legacy kernels
1172 dnl # any only as a last resort.
1173 dnl
1174 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1175 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1176 SPL_LINUX_TRY_COMPILE([
1177 ],[
1178 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1179 #error "global_page_state needs NR_FREE_PAGES"
1180 #endif
1181
1182 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1183 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1184 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1185 #error "global_page_state needs NR_ACTIVE*"
1186 #endif
1187
1188 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1189 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1190 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1191 #error "global_page_state needs NR_INACTIVE*"
1192 #endif
1193 ],[
1194 AC_MSG_RESULT(no)
1195 ],[
1196 AC_MSG_RESULT(yes)
1197 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1198 [get_zone_counts() is needed])
1199
1200 SPL_CHECK_SYMBOL_EXPORT(
1201 [get_zone_counts],
1202 [],
1203 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1204 [get_zone_counts() is available])],
1205 [])
1206 ])
1207 ])
1208
1209 dnl #
1210 dnl # SLES API change, never adopted in mainline,
1211 dnl # Third 'struct vfsmount *' argument removed.
1212 dnl #
1213 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1214 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1215 SPL_LINUX_TRY_COMPILE([
1216 #include <linux/fs.h>
1217 ],[
1218 vfs_unlink(NULL, NULL);
1219 ],[
1220 AC_MSG_RESULT(yes)
1221 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1222 [vfs_unlink() wants 2 args])
1223 ],[
1224 AC_MSG_RESULT(no)
1225 ])
1226 ])
1227
1228 dnl #
1229 dnl # SLES API change, never adopted in mainline,
1230 dnl # Third and sixth 'struct vfsmount *' argument removed.
1231 dnl #
1232 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1233 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1234 SPL_LINUX_TRY_COMPILE([
1235 #include <linux/fs.h>
1236 ],[
1237 vfs_rename(NULL, NULL, NULL, NULL);
1238 ],[
1239 AC_MSG_RESULT(yes)
1240 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1241 [vfs_rename() wants 4 args])
1242 ],[
1243 AC_MSG_RESULT(no)
1244 ])
1245 ])
1246
1247 dnl #
1248 dnl # 2.6.29 API change,
1249 dnl # check whether 'struct cred' exists
1250 dnl #
1251 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1252 AC_MSG_CHECKING([whether struct cred exists])
1253 SPL_LINUX_TRY_COMPILE([
1254 #include <linux/cred.h>
1255 ],[
1256 struct cred *cr;
1257 cr = NULL;
1258 ],[
1259 AC_MSG_RESULT(yes)
1260 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1261 ],[
1262 AC_MSG_RESULT(no)
1263 ])
1264 ])
1265
1266 dnl #
1267 dnl # Custom SPL patch may export this symbol.
1268 dnl #
1269 AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
1270 SPL_CHECK_SYMBOL_EXPORT(
1271 [groups_search],
1272 [],
1273 [AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
1274 [groups_search() is available])],
1275 [])
1276 ])
1277
1278 dnl #
1279 dnl # 2.6.x API change,
1280 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1281 dnl #
1282 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
1283 SPL_CHECK_SYMBOL_EXPORT(
1284 [__put_task_struct],
1285 [],
1286 [AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1287 [__put_task_struct() is available])],
1288 [])
1289 ])