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