]> git.proxmox.com Git - mirror_spl.git/blob - config/spl-build.m4
Linux 3.9 compat: vfs_getattr takes two arguments
[mirror_spl.git] / config / spl-build.m4
1 ###############################################################################
2 # Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 # Copyright (C) 2007 The Regents of the University of California.
4 # Written by Brian Behlendorf <behlendorf1@llnl.gov>.
5 ###############################################################################
6 # SPL_AC_CONFIG_KERNEL: Default SPL kernel configuration.
7 ###############################################################################
8
9 AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
10 SPL_AC_KERNEL
11
12 if test "${LINUX_OBJ}" != "${LINUX}"; then
13 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
14 fi
15 AC_SUBST(KERNELMAKE_PARAMS)
16
17 KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
18 AC_SUBST(KERNELCPPFLAGS)
19
20 SPL_AC_DEBUG
21 SPL_AC_DEBUG_LOG
22 SPL_AC_DEBUG_KMEM
23 SPL_AC_DEBUG_KMEM_TRACKING
24 SPL_AC_TEST_MODULE
25 SPL_AC_ATOMIC_SPINLOCK
26 SPL_AC_TYPE_ATOMIC64_CMPXCHG
27 SPL_AC_TYPE_ATOMIC64_XCHG
28 SPL_AC_TYPE_UINTPTR_T
29 SPL_AC_2ARGS_REGISTER_SYSCTL
30 SPL_AC_SET_SHRINKER
31 SPL_AC_3ARGS_SHRINKER_CALLBACK
32 SPL_AC_PATH_IN_NAMEIDATA
33 SPL_AC_TASK_CURR
34 SPL_AC_CTL_UNNUMBERED
35 SPL_AC_CTL_NAME
36 SPL_AC_FLS64
37 SPL_AC_DEVICE_CREATE
38 SPL_AC_5ARGS_DEVICE_CREATE
39 SPL_AC_CLASS_DEVICE_CREATE
40 SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
41 SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
42 SPL_AC_TIMESPEC_SUB
43 SPL_AC_INIT_UTSNAME
44 SPL_AC_UACCESS_HEADER
45 SPL_AC_KMALLOC_NODE
46 SPL_AC_MONOTONIC_CLOCK
47 SPL_AC_INODE_I_MUTEX
48 SPL_AC_MUTEX_OWNER
49 SPL_AC_MUTEX_OWNER_TASK_STRUCT
50 SPL_AC_MUTEX_LOCK_NESTED
51 SPL_AC_3ARGS_ON_EACH_CPU
52 SPL_AC_KALLSYMS_LOOKUP_NAME
53 SPL_AC_GET_VMALLOC_INFO
54 SPL_AC_PGDAT_HELPERS
55 SPL_AC_FIRST_ONLINE_PGDAT
56 SPL_AC_NEXT_ONLINE_PGDAT
57 SPL_AC_NEXT_ZONE
58 SPL_AC_PGDAT_LIST
59 SPL_AC_GLOBAL_PAGE_STATE
60 SPL_AC_ZONE_STAT_ITEM_FREE
61 SPL_AC_ZONE_STAT_ITEM_INACTIVE
62 SPL_AC_ZONE_STAT_ITEM_ACTIVE
63 SPL_AC_GET_ZONE_COUNTS
64 SPL_AC_USER_PATH_DIR
65 SPL_AC_SET_FS_PWD
66 SPL_AC_2ARGS_SET_FS_PWD
67 SPL_AC_2ARGS_VFS_UNLINK
68 SPL_AC_4ARGS_VFS_RENAME
69 SPL_AC_VFS_FSYNC
70 SPL_AC_2ARGS_VFS_FSYNC
71 SPL_AC_INODE_TRUNCATE_RANGE
72 SPL_AC_FS_STRUCT_SPINLOCK
73 SPL_AC_CRED_STRUCT
74 SPL_AC_GROUPS_SEARCH
75 SPL_AC_PUT_TASK_STRUCT
76 SPL_AC_5ARGS_PROC_HANDLER
77 SPL_AC_KVASPRINTF
78 SPL_AC_EXPORTED_RWSEM_IS_LOCKED
79 SPL_AC_KERNEL_FALLOCATE
80 SPL_AC_SHRINK_DCACHE_MEMORY
81 SPL_AC_SHRINK_ICACHE_MEMORY
82 SPL_AC_KERN_PATH_PARENT_HEADER
83 SPL_AC_KERN_PATH_PARENT_SYMBOL
84 SPL_AC_KERN_PATH_LOCKED
85 SPL_AC_CONFIG_KALLSYMS
86 SPL_AC_CONFIG_ZLIB_INFLATE
87 SPL_AC_CONFIG_ZLIB_DEFLATE
88 SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
89 SPL_AC_SHRINK_CONTROL_STRUCT
90 SPL_AC_RWSEM_SPINLOCK_IS_RAW
91 SPL_AC_SCHED_RT_HEADER
92 SPL_AC_2ARGS_VFS_GETATTR
93 ])
94
95 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
96 modpost=$LINUX/scripts/Makefile.modpost
97 AC_MSG_CHECKING([kernel file name for module symbols])
98 if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then
99 if grep -q Modules.symvers $modpost; then
100 LINUX_SYMBOLS=Modules.symvers
101 else
102 LINUX_SYMBOLS=Module.symvers
103 fi
104
105 if ! test -f "$LINUX_OBJ/$LINUX_SYMBOLS"; then
106 AC_MSG_ERROR([
107 *** Please make sure the kernel devel package for your distribution
108 *** is installed. If your building with a custom kernel make sure the
109 *** kernel is configured, built, and the '--with-linux=PATH' configure
110 *** option refers to the location of the kernel source.])
111 fi
112 else
113 LINUX_SYMBOLS=NONE
114 fi
115 AC_MSG_RESULT($LINUX_SYMBOLS)
116 AC_SUBST(LINUX_SYMBOLS)
117 ])
118
119 AC_DEFUN([SPL_AC_KERNEL], [
120 AC_ARG_WITH([linux],
121 AS_HELP_STRING([--with-linux=PATH],
122 [Path to kernel source]),
123 [kernelsrc="$withval"])
124
125 AC_ARG_WITH([linux-obj],
126 AS_HELP_STRING([--with-linux-obj=PATH],
127 [Path to kernel build objects]),
128 [kernelbuild="$withval"])
129
130 AC_MSG_CHECKING([kernel source directory])
131 if test -z "$kernelsrc"; then
132 if test -e "/lib/modules/$(uname -r)/source"; then
133 headersdir="/lib/modules/$(uname -r)/source"
134 sourcelink=$(readlink -f "$headersdir")
135 elif test -e "/lib/modules/$(uname -r)/build"; then
136 headersdir="/lib/modules/$(uname -r)/build"
137 sourcelink=$(readlink -f "$headersdir")
138 else
139 sourcelink=$(ls -1d /usr/src/kernels/* \
140 /usr/src/linux-* \
141 2>/dev/null | grep -v obj | tail -1)
142 fi
143
144 if test -n "$sourcelink" && test -e ${sourcelink}; then
145 kernelsrc=`readlink -f ${sourcelink}`
146 else
147 kernelsrc="[Not found]"
148 fi
149 else
150 if test "$kernelsrc" = "NONE"; then
151 kernsrcver=NONE
152 fi
153 fi
154
155 AC_MSG_RESULT([$kernelsrc])
156 if test ! -d "$kernelsrc"; then
157 AC_MSG_ERROR([
158 *** Please make sure the kernel devel package for your distribution
159 *** is installed then try again. If that fails you can specify the
160 *** location of the kernel source with the '--with-linux=PATH' option.])
161 fi
162
163 AC_MSG_CHECKING([kernel build directory])
164 if test -z "$kernelbuild"; then
165 if test -e "/lib/modules/$(uname -r)/build"; then
166 kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
167 elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
168 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
169 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
170 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
171 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
172 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
173 else
174 kernelbuild=${kernelsrc}
175 fi
176 fi
177 AC_MSG_RESULT([$kernelbuild])
178
179 AC_MSG_CHECKING([kernel source version])
180 utsrelease1=$kernelbuild/include/linux/version.h
181 utsrelease2=$kernelbuild/include/linux/utsrelease.h
182 utsrelease3=$kernelbuild/include/generated/utsrelease.h
183 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
184 utsrelease=linux/version.h
185 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
186 utsrelease=linux/utsrelease.h
187 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
188 utsrelease=generated/utsrelease.h
189 fi
190
191 if test "$utsrelease"; then
192 kernsrcver=`(echo "#include <$utsrelease>";
193 echo "kernsrcver=UTS_RELEASE") |
194 cpp -I $kernelbuild/include |
195 grep "^kernsrcver=" | cut -d \" -f 2`
196
197 if test -z "$kernsrcver"; then
198 AC_MSG_RESULT([Not found])
199 AC_MSG_ERROR([*** Cannot determine kernel version.])
200 fi
201 else
202 AC_MSG_RESULT([Not found])
203 if test "x$enable_linux_builtin" != xyes; then
204 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
205 else
206 AC_MSG_ERROR([
207 *** Cannot find UTS_RELEASE definition.
208 *** Please run 'make prepare' inside the kernel source tree.])
209 fi
210 fi
211
212 AC_MSG_RESULT([$kernsrcver])
213
214 LINUX=${kernelsrc}
215 LINUX_OBJ=${kernelbuild}
216 LINUX_VERSION=${kernsrcver}
217
218 AC_SUBST(LINUX)
219 AC_SUBST(LINUX_OBJ)
220 AC_SUBST(LINUX_VERSION)
221
222 SPL_AC_MODULE_SYMVERS
223 ])
224
225 dnl #
226 dnl # Default SPL user configuration
227 dnl #
228 AC_DEFUN([SPL_AC_CONFIG_USER], [])
229
230 dnl #
231 dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
232 dnl # are missing it is non-fatal but you will not be able to build
233 dnl # RPM packages and will be warned if you try too.
234 dnl #
235 AC_DEFUN([SPL_AC_RPM], [
236 RPM=rpm
237 RPMBUILD=rpmbuild
238
239 AC_MSG_CHECKING([whether $RPM is available])
240 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
241 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
242 HAVE_RPM=yes
243 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
244 ],[
245 HAVE_RPM=no
246 AC_MSG_RESULT([$HAVE_RPM])
247 ])
248
249 AC_MSG_CHECKING([whether $RPMBUILD is available])
250 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
251 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
252 HAVE_RPMBUILD=yes
253 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
254 ],[
255 HAVE_RPMBUILD=no
256 AC_MSG_RESULT([$HAVE_RPMBUILD])
257 ])
258
259 AC_SUBST(HAVE_RPM)
260 AC_SUBST(RPM)
261 AC_SUBST(RPM_VERSION)
262
263 AC_SUBST(HAVE_RPMBUILD)
264 AC_SUBST(RPMBUILD)
265 AC_SUBST(RPMBUILD_VERSION)
266 ])
267
268 dnl #
269 dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
270 dnl # tools are missing it is non-fatal but you will not be able to build
271 dnl # DEB packages and will be warned if you try too.
272 dnl #
273 AC_DEFUN([SPL_AC_DPKG], [
274 DPKG=dpkg
275 DPKGBUILD=dpkg-buildpackage
276
277 AC_MSG_CHECKING([whether $DPKG is available])
278 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
279 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
280 HAVE_DPKG=yes
281 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
282 ],[
283 HAVE_DPKG=no
284 AC_MSG_RESULT([$HAVE_DPKG])
285 ])
286
287 AC_MSG_CHECKING([whether $DPKGBUILD is available])
288 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
289 DPKGBUILD_VERSION=$(echo $tmp | \
290 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
291 HAVE_DPKGBUILD=yes
292 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
293 ],[
294 HAVE_DPKGBUILD=no
295 AC_MSG_RESULT([$HAVE_DPKGBUILD])
296 ])
297
298 AC_SUBST(HAVE_DPKG)
299 AC_SUBST(DPKG)
300 AC_SUBST(DPKG_VERSION)
301
302 AC_SUBST(HAVE_DPKGBUILD)
303 AC_SUBST(DPKGBUILD)
304 AC_SUBST(DPKGBUILD_VERSION)
305 ])
306
307 dnl #
308 dnl # Until native packaging for various different packing systems
309 dnl # can be added the least we can do is attempt to use alien to
310 dnl # convert the RPM packages to the needed package type. This is
311 dnl # a hack but so far it has worked reasonable well.
312 dnl #
313 AC_DEFUN([SPL_AC_ALIEN], [
314 ALIEN=alien
315
316 AC_MSG_CHECKING([whether $ALIEN is available])
317 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
318 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
319 HAVE_ALIEN=yes
320 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
321 ],[
322 HAVE_ALIEN=no
323 AC_MSG_RESULT([$HAVE_ALIEN])
324 ])
325
326 AC_SUBST(HAVE_ALIEN)
327 AC_SUBST(ALIEN)
328 AC_SUBST(ALIEN_VERSION)
329 ])
330
331 dnl #
332 dnl # Using the VENDOR tag from config.guess set the default
333 dnl # package type for 'make pkg': (rpm | deb | tgz)
334 dnl #
335 AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
336 AC_MSG_CHECKING([linux distribution])
337 if test -f /etc/toss-release ; then
338 VENDOR=toss ;
339 elif test -f /etc/fedora-release ; then
340 VENDOR=fedora ;
341 elif test -f /etc/redhat-release ; then
342 VENDOR=redhat ;
343 elif test -f /etc/gentoo-release ; then
344 VENDOR=gentoo ;
345 elif test -f /etc/arch-release ; then
346 VENDOR=arch ;
347 elif test -f /etc/SuSE-release ; then
348 VENDOR=sles ;
349 elif test -f /etc/slackware-version ; then
350 VENDOR=slackware ;
351 elif test -f /etc/lunar.release ; then
352 VENDOR=lunar ;
353 elif test -f /etc/lsb-release ; then
354 VENDOR=ubuntu ;
355 elif test -f /etc/debian_version ; then
356 VENDOR=debian ;
357 else
358 VENDOR= ;
359 fi
360 AC_MSG_RESULT([$VENDOR])
361 AC_SUBST(VENDOR)
362
363 AC_MSG_CHECKING([default package type])
364 case "$VENDOR" in
365 toss) DEFAULT_PACKAGE=rpm ;;
366 redhat) DEFAULT_PACKAGE=rpm ;;
367 fedora) DEFAULT_PACKAGE=rpm ;;
368 gentoo) DEFAULT_PACKAGE=tgz ;;
369 arch) DEFAULT_PACKAGE=tgz ;;
370 sles) DEFAULT_PACKAGE=rpm ;;
371 slackware) DEFAULT_PACKAGE=tgz ;;
372 lunar) DEFAULT_PACKAGE=tgz ;;
373 ubuntu) DEFAULT_PACKAGE=deb ;;
374 debian) DEFAULT_PACKAGE=deb ;;
375 *) DEFAULT_PACKAGE=rpm ;;
376 esac
377
378 AC_MSG_RESULT([$DEFAULT_PACKAGE])
379 AC_SUBST(DEFAULT_PACKAGE)
380 ])
381
382 dnl #
383 dnl # Default SPL user configuration
384 dnl #
385 AC_DEFUN([SPL_AC_PACKAGE], [
386 SPL_AC_DEFAULT_PACKAGE
387 SPL_AC_RPM
388 SPL_AC_DPKG
389 SPL_AC_ALIEN
390 ])
391
392 AC_DEFUN([SPL_AC_LICENSE], [
393 AC_MSG_CHECKING([spl license])
394 LICENSE=GPL
395 AC_MSG_RESULT([$LICENSE])
396 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
397 AC_SUBST(LICENSE)
398 ])
399
400 AC_DEFUN([SPL_AC_CONFIG], [
401 SPL_CONFIG=all
402 AC_ARG_WITH([config],
403 AS_HELP_STRING([--with-config=CONFIG],
404 [Config file 'kernel|user|all|srpm']),
405 [SPL_CONFIG="$withval"])
406 AC_ARG_ENABLE([linux-builtin],
407 [AC_HELP_STRING([--enable-linux-builtin],
408 [Configure for builtin in-tree kernel modules @<:@default=no@:>@])],
409 [],
410 [enable_linux_builtin=no])
411
412 AC_MSG_CHECKING([spl config])
413 AC_MSG_RESULT([$SPL_CONFIG]);
414 AC_SUBST(SPL_CONFIG)
415
416 case "$SPL_CONFIG" in
417 kernel) SPL_AC_CONFIG_KERNEL ;;
418 user) SPL_AC_CONFIG_USER ;;
419 all) SPL_AC_CONFIG_KERNEL
420 SPL_AC_CONFIG_USER ;;
421 srpm) ;;
422 *)
423 AC_MSG_RESULT([Error!])
424 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
425 user kernel|user|all|srpm]) ;;
426 esac
427
428 AM_CONDITIONAL([CONFIG_USER],
429 [test "$SPL_CONFIG" = user -o "$SPL_CONFIG" = all])
430 AM_CONDITIONAL([CONFIG_KERNEL],
431 [test "$SPL_CONFIG" = kernel -o "$SPL_CONFIG" = all] &&
432 [test "x$enable_linux_builtin" != xyes ])
433 ])
434
435 dnl #
436 dnl # Enable if the SPL should be compiled with internal debugging enabled.
437 dnl # By default this support is disabled.
438 dnl #
439 AC_DEFUN([SPL_AC_DEBUG], [
440 AC_MSG_CHECKING([whether debugging is enabled])
441 AC_ARG_ENABLE([debug],
442 [AS_HELP_STRING([--enable-debug],
443 [Enable generic debug support @<:@default=no@:>@])],
444 [],
445 [enable_debug=no])
446
447 AS_IF([test "x$enable_debug" = xyes],
448 [
449 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
450 DEBUG_CFLAGS="-DDEBUG -Werror"
451 DEBUG_SPL="_with_debug"
452 ], [
453 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
454 DEBUG_CFLAGS="-DNDEBUG"
455 DEBUG_SPL="_without_debug"
456 ])
457
458 AC_SUBST(DEBUG_CFLAGS)
459 AC_SUBST(DEBUG_SPL)
460 AC_MSG_RESULT([$enable_debug])
461 ])
462
463 dnl #
464 dnl # Enabled by default it provides a basic debug log infrastructure.
465 dnl # Each subsystem registers itself with a name and logs messages
466 dnl # using predefined types. If the debug mask it set to allow the
467 dnl # message type it will be written to the internal log. The log
468 dnl # can be dumped to a file by echoing 1 to the 'dump' proc entry,
469 dnl # after dumping the log it must be decoded using the spl utility.
470 dnl #
471 dnl # echo 1 >/proc/sys/kernel/spl/debug/dump
472 dnl # spl /tmp/spl-log.xxx.yyy /tmp/spl-log.xxx.yyy.txt
473 dnl #
474 AC_DEFUN([SPL_AC_DEBUG_LOG], [
475 AC_ARG_ENABLE([debug-log],
476 [AS_HELP_STRING([--enable-debug-log],
477 [Enable basic debug logging @<:@default=yes@:>@])],
478 [],
479 [enable_debug_log=yes])
480
481 AS_IF([test "x$enable_debug_log" = xyes],
482 [
483 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_LOG"
484 DEBUG_LOG="_with_debug_log"
485 AC_DEFINE([DEBUG_LOG], [1],
486 [Define to 1 to enable basic debug logging])
487 ], [
488 DEBUG_LOG="_without_debug_log"
489 ])
490
491 AC_SUBST(DEBUG_LOG)
492 AC_MSG_CHECKING([whether basic debug logging is enabled])
493 AC_MSG_RESULT([$enable_debug_log])
494 ])
495
496 dnl #
497 dnl # Enabled by default it provides a minimal level of memory tracking.
498 dnl # A total count of bytes allocated is kept for each alloc and free.
499 dnl # Then at module unload time a report to the console will be printed
500 dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
501 dnl # and provide an easy way to inspect the kmem based slab.
502 dnl #
503 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
504 AC_ARG_ENABLE([debug-kmem],
505 [AS_HELP_STRING([--enable-debug-kmem],
506 [Enable basic kmem accounting @<:@default=yes@:>@])],
507 [],
508 [enable_debug_kmem=yes])
509
510 AS_IF([test "x$enable_debug_kmem" = xyes],
511 [
512 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
513 DEBUG_KMEM="_with_debug_kmem"
514 AC_DEFINE([DEBUG_KMEM], [1],
515 [Define to 1 to enable basic kmem accounting])
516 ], [
517 DEBUG_KMEM="_without_debug_kmem"
518 ])
519
520 AC_SUBST(DEBUG_KMEM)
521 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
522 AC_MSG_RESULT([$enable_debug_kmem])
523 ])
524
525 dnl #
526 dnl # Disabled by default it provides detailed memory tracking. This
527 dnl # feature also requires --enable-debug-kmem to be set. When enabled
528 dnl # not only will total bytes be tracked but also the location of every
529 dnl # alloc and free. When the SPL module is unloaded a list of all leaked
530 dnl # addresses and where they were allocated will be dumped to the console.
531 dnl # Enabling this feature has a significant impact on performance but it
532 dnl # makes finding memory leaks pretty straight forward.
533 dnl #
534 AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
535 AC_ARG_ENABLE([debug-kmem-tracking],
536 [AS_HELP_STRING([--enable-debug-kmem-tracking],
537 [Enable detailed kmem tracking @<:@default=no@:>@])],
538 [],
539 [enable_debug_kmem_tracking=no])
540
541 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
542 [
543 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"
544 DEBUG_KMEM_TRACKING="_with_debug_kmem_tracking"
545 AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
546 [Define to 1 to enable detailed kmem tracking])
547 ], [
548 DEBUG_KMEM_TRACKING="_without_debug_kmem_tracking"
549 ])
550
551 AC_SUBST(DEBUG_KMEM_TRACKING)
552 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
553 AC_MSG_RESULT([$enable_debug_kmem_tracking])
554 ])
555
556 dnl #
557 dnl # SPL_LINUX_CONFTEST
558 dnl #
559 AC_DEFUN([SPL_LINUX_CONFTEST], [
560 cat confdefs.h - <<_ACEOF >conftest.c
561 $1
562 _ACEOF
563 ])
564
565 dnl #
566 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
567 dnl #
568 m4_define([SPL_LANG_PROGRAM], [
569 $1
570 int
571 main (void)
572 {
573 dnl Do *not* indent the following line: there may be CPP directives.
574 dnl Don't move the `;' right after for the same reason.
575 $2
576 ;
577 return 0;
578 }
579 ])
580
581 dnl #
582 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
583 dnl #
584 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
585 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
586 rm -Rf build && mkdir -p build && touch build/conftest.mod.c
587 echo "obj-m := conftest.o" >build/Makefile
588 modpost_flag=''
589 test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
590 AS_IF(
591 [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 $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
592 [$4],
593 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
594 )
595 rm -Rf build
596 ])
597
598 dnl #
599 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
600 dnl #
601 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
602 [SPL_LINUX_COMPILE_IFELSE(
603 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
604 [modules],
605 [test -s build/conftest.o],
606 [$3], [$4])
607 ])
608
609 dnl #
610 dnl # SPL_CHECK_SYMBOL_EXPORT
611 dnl # check symbol exported or not
612 dnl #
613 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], [
614 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
615 $LINUX_OBJ/Module*.symvers 2>/dev/null
616 rc=$?
617 if test $rc -ne 0; then
618 export=0
619 for file in $2; do
620 grep -q -E "EXPORT_SYMBOL.*($1)" \
621 "$LINUX_OBJ/$file" 2>/dev/null
622 rc=$?
623 if test $rc -eq 0; then
624 export=1
625 break;
626 fi
627 done
628 if test $export -eq 0; then :
629 $4
630 else :
631 $3
632 fi
633 else :
634 $3
635 fi
636 ])
637
638 dnl #
639 dnl # SPL_LINUX_TRY_COMPILE_SYMBOL
640 dnl # like SPL_LINUX_TRY_COMPILE, except SPL_CHECK_SYMBOL_EXPORT
641 dnl # is called if not compiling for builtin
642 dnl #
643 AC_DEFUN([SPL_LINUX_TRY_COMPILE_SYMBOL], [
644 SPL_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
645 if test $rc -ne 0; then :
646 $6
647 else
648 if test "x$enable_linux_builtin" != xyes; then
649 SPL_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1])
650 fi
651 if test $rc -ne 0; then :
652 $6
653 else :
654 $5
655 fi
656 fi
657 ])
658
659 dnl #
660 dnl # SPL_CHECK_SYMBOL_HEADER
661 dnl # check if a symbol prototype is defined in listed headers.
662 dnl #
663 AC_DEFUN([SPL_CHECK_SYMBOL_HEADER], [
664 AC_MSG_CHECKING([whether symbol $1 exists in header])
665 header=0
666 for file in $3; do
667 grep -q "$2" "$LINUX/$file" 2>/dev/null
668 rc=$?
669 if test $rc -eq 0; then
670 header=1
671 break;
672 fi
673 done
674 if test $header -eq 0; then
675 AC_MSG_RESULT([no])
676 $5
677 else
678 AC_MSG_RESULT([yes])
679 $4
680 fi
681 ])
682
683 dnl #
684 dnl # SPL_CHECK_HEADER
685 dnl # check whether header exists and define HAVE_$2_HEADER
686 dnl #
687 AC_DEFUN([SPL_CHECK_HEADER],
688 [AC_MSG_CHECKING([whether header $1 exists])
689 SPL_LINUX_TRY_COMPILE([
690 #include <$1>
691 ],[
692 return 0;
693 ],[
694 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
695 AC_MSG_RESULT(yes)
696 $3
697 ],[
698 AC_MSG_RESULT(no)
699 $4
700 ])
701 ])
702
703 dnl #
704 dnl # Basic toolchain sanity check.
705 dnl #
706 AC_DEFUN([SPL_AC_TEST_MODULE],
707 [AC_MSG_CHECKING([whether modules can be built])
708 SPL_LINUX_TRY_COMPILE([],[],[
709 AC_MSG_RESULT([yes])
710 ],[
711 AC_MSG_RESULT([no])
712 if test "x$enable_linux_builtin" != xyes; then
713 AC_MSG_ERROR([*** Unable to build an empty module.])
714 else
715 AC_MSG_ERROR([
716 *** Unable to build an empty module.
717 *** Please run 'make scripts' inside the kernel source tree.])
718 fi
719 ])
720 ])
721
722 dnl #
723 dnl # Use the atomic implemenation based on global spinlocks. This
724 dnl # should only be needed by 32-bit kernels which do not provide
725 dnl # the atomic64_* API. It may be optionally enabled as a fallback
726 dnl # if problems are observed with the direct mapping to the native
727 dnl # Linux atomic operations. You may not disable atomic spinlocks
728 dnl # if you kernel does not an atomic64_* API.
729 dnl #
730 AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
731 AC_ARG_ENABLE([atomic-spinlocks],
732 [AS_HELP_STRING([--enable-atomic-spinlocks],
733 [Atomic types use spinlocks @<:@default=check@:>@])],
734 [],
735 [enable_atomic_spinlocks=check])
736
737 SPL_LINUX_TRY_COMPILE([
738 #include <linux/fs.h>
739 ],[
740 atomic64_t *ptr __attribute__ ((unused));
741 ],[
742 have_atomic64_t=yes
743 AC_DEFINE(HAVE_ATOMIC64_T, 1,
744 [kernel defines atomic64_t])
745 ],[
746 have_atomic64_t=no
747 ])
748
749 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
750 AS_IF([test "x$have_atomic64_t" = xyes], [
751 enable_atomic_spinlocks=no
752 ],[
753 enable_atomic_spinlocks=yes
754 ])
755 ])
756
757 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
758 AC_DEFINE([ATOMIC_SPINLOCK], [1],
759 [Atomic types use spinlocks])
760 ],[
761 AS_IF([test "x$have_atomic64_t" = xno], [
762 AC_MSG_FAILURE(
763 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
764 ])
765 ])
766
767 AC_MSG_CHECKING([whether atomic types use spinlocks])
768 AC_MSG_RESULT([$enable_atomic_spinlocks])
769
770 AC_MSG_CHECKING([whether kernel defines atomic64_t])
771 AC_MSG_RESULT([$have_atomic64_t])
772 ])
773
774 dnl #
775 dnl # 2.6.24 API change,
776 dnl # check if atomic64_cmpxchg is defined
777 dnl #
778 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
779 [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
780 SPL_LINUX_TRY_COMPILE([
781 #include <linux/fs.h>
782 ],[
783 atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
784 ],[
785 AC_MSG_RESULT([yes])
786 AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1,
787 [kernel defines atomic64_cmpxchg])
788 ],[
789 AC_MSG_RESULT([no])
790 ])
791 ])
792
793 dnl #
794 dnl # 2.6.24 API change,
795 dnl # check if atomic64_xchg is defined
796 dnl #
797 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
798 [AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
799 SPL_LINUX_TRY_COMPILE([
800 #include <linux/fs.h>
801 ],[
802 atomic64_xchg((atomic64_t *)NULL, 0);
803 ],[
804 AC_MSG_RESULT([yes])
805 AC_DEFINE(HAVE_ATOMIC64_XCHG, 1,
806 [kernel defines atomic64_xchg])
807 ],[
808 AC_MSG_RESULT([no])
809 ])
810 ])
811
812 dnl #
813 dnl # 2.6.24 API change,
814 dnl # check if uintptr_t typedef is defined
815 dnl #
816 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
817 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
818 SPL_LINUX_TRY_COMPILE([
819 #include <linux/types.h>
820 ],[
821 uintptr_t *ptr __attribute__ ((unused));
822 ],[
823 AC_MSG_RESULT([yes])
824 AC_DEFINE(HAVE_UINTPTR_T, 1,
825 [kernel defines uintptr_t])
826 ],[
827 AC_MSG_RESULT([no])
828 ])
829 ])
830
831 dnl #
832 dnl # 2.6.21 API change,
833 dnl # 'register_sysctl_table' use only one argument instead of two
834 dnl #
835 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
836 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
837 SPL_LINUX_TRY_COMPILE([
838 #include <linux/sysctl.h>
839 ],[
840 (void) register_sysctl_table(NULL, 0);
841 ],[
842 AC_MSG_RESULT(yes)
843 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
844 [register_sysctl_table() wants 2 args])
845 ],[
846 AC_MSG_RESULT(no)
847 ])
848 ])
849
850 dnl #
851 dnl # 2.6.23 API change
852 dnl # Old set_shrinker API replaced with register_shrinker
853 dnl #
854 AC_DEFUN([SPL_AC_SET_SHRINKER], [
855 AC_MSG_CHECKING([whether set_shrinker() available])
856 SPL_LINUX_TRY_COMPILE([
857 #include <linux/mm.h>
858 ],[
859 return set_shrinker(DEFAULT_SEEKS, NULL);
860 ],[
861 AC_MSG_RESULT([yes])
862 AC_DEFINE(HAVE_SET_SHRINKER, 1,
863 [set_shrinker() available])
864 ],[
865 AC_MSG_RESULT([no])
866 ])
867 ])
868
869 dnl #
870 dnl # 2.6.35 API change,
871 dnl # Add context to shrinker callback
872 dnl #
873 AC_DEFUN([SPL_AC_3ARGS_SHRINKER_CALLBACK],
874 [AC_MSG_CHECKING([whether shrinker callback wants 3 args])
875 tmp_flags="$EXTRA_KCFLAGS"
876 EXTRA_KCFLAGS="-Werror"
877 SPL_LINUX_TRY_COMPILE([
878 #include <linux/mm.h>
879
880 int shrinker_cb(struct shrinker *, int, unsigned int);
881 ],[
882 struct shrinker cache_shrinker = {
883 .shrink = shrinker_cb,
884 .seeks = DEFAULT_SEEKS,
885 };
886 register_shrinker(&cache_shrinker);
887 ],[
888 AC_MSG_RESULT(yes)
889 AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
890 [shrinker callback wants 3 args])
891 ],[
892 AC_MSG_RESULT(no)
893 ])
894 EXTRA_KCFLAGS="$tmp_flags"
895 ])
896
897 dnl #
898 dnl # 2.6.25 API change,
899 dnl # struct path entry added to struct nameidata
900 dnl #
901 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
902 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
903 SPL_LINUX_TRY_COMPILE([
904 #include <linux/namei.h>
905 ],[
906 struct nameidata nd __attribute__ ((unused));
907
908 nd.path.mnt = NULL;
909 nd.path.dentry = NULL;
910 ],[
911 AC_MSG_RESULT(yes)
912 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
913 [struct path used in struct nameidata])
914 ],[
915 AC_MSG_RESULT(no)
916 ])
917 ])
918
919 dnl #
920 dnl # Custom SPL patch may export this system it is not required
921 dnl #
922 AC_DEFUN([SPL_AC_TASK_CURR],
923 [AC_MSG_CHECKING([whether task_curr() is available])
924 SPL_LINUX_TRY_COMPILE_SYMBOL([
925 #include <linux/sched.h>
926 ], [
927 task_curr(NULL);
928 ], [task_curr], [kernel/sched.c], [
929 AC_MSG_RESULT(yes)
930 AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() is available])
931 ], [
932 AC_MSG_RESULT(no)
933 ])
934 ])
935
936 dnl #
937 dnl # 2.6.19 API change,
938 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
939 dnl #
940 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
941 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
942 SPL_LINUX_TRY_COMPILE([
943 #include <linux/sysctl.h>
944 ],[
945 #ifndef CTL_UNNUMBERED
946 #error CTL_UNNUMBERED undefined
947 #endif
948 ],[
949 AC_MSG_RESULT(yes)
950 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
951 [unnumbered sysctl support exists])
952 ],[
953 AC_MSG_RESULT(no)
954 ])
955 ])
956
957 dnl #
958 dnl # 2.6.33 API change,
959 dnl # Removed .ctl_name from struct ctl_table.
960 dnl #
961 AC_DEFUN([SPL_AC_CTL_NAME], [
962 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
963 SPL_LINUX_TRY_COMPILE([
964 #include <linux/sysctl.h>
965 ],[
966 struct ctl_table ctl __attribute__ ((unused));
967 ctl.ctl_name = 0;
968 ],[
969 AC_MSG_RESULT(yes)
970 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
971 ],[
972 AC_MSG_RESULT(no)
973 ])
974 ])
975
976 dnl #
977 dnl # 2.6.16 API change.
978 dnl # Check if 'fls64()' is available
979 dnl #
980 AC_DEFUN([SPL_AC_FLS64],
981 [AC_MSG_CHECKING([whether fls64() is available])
982 SPL_LINUX_TRY_COMPILE([
983 #include <linux/bitops.h>
984 ],[
985 return fls64(0);
986 ],[
987 AC_MSG_RESULT(yes)
988 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
989 ],[
990 AC_MSG_RESULT(no)
991 ])
992 ])
993
994 dnl #
995 dnl # 2.6.18 API change, check whether device_create() is available.
996 dnl # Device_create() was introduced in 2.6.18 and depricated
997 dnl # class_device_create() which was fully removed in 2.6.26.
998 dnl #
999 AC_DEFUN([SPL_AC_DEVICE_CREATE],
1000 [AC_MSG_CHECKING([whether device_create() is available])
1001 SPL_CHECK_SYMBOL_EXPORT([device_create], [drivers/base/core.c], [
1002 AC_MSG_RESULT(yes)
1003 AC_DEFINE(HAVE_DEVICE_CREATE, 1,
1004 [device_create() is available])
1005 ], [
1006 AC_MSG_RESULT(no)
1007 ])
1008 ])
1009
1010 dnl #
1011 dnl # 2.6.27 API change,
1012 dnl # device_create() uses 5 args, new 'drvdata' argument.
1013 dnl #
1014 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
1015 AC_MSG_CHECKING([whether device_create() wants 5 args])
1016 tmp_flags="$EXTRA_KCFLAGS"
1017 EXTRA_KCFLAGS="-Werror"
1018 SPL_LINUX_TRY_COMPILE([
1019 #include <linux/device.h>
1020 ],[
1021 device_create(NULL, NULL, 0, NULL, "%d", 1);
1022 ],[
1023 AC_MSG_RESULT(yes)
1024 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
1025 [device_create wants 5 args])
1026 ],[
1027 AC_MSG_RESULT(no)
1028 ])
1029 EXTRA_KCFLAGS="$tmp_flags"
1030 ])
1031
1032 dnl #
1033 dnl # 2.6.13 API change, check whether class_device_create() is available.
1034 dnl # Class_device_create() was introduced in 2.6.13 and depricated
1035 dnl # class_simple_device_add() which was fully removed in 2.6.13.
1036 dnl #
1037 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE],
1038 [AC_MSG_CHECKING([whether class_device_create() is available])
1039 SPL_LINUX_TRY_COMPILE_SYMBOL([
1040 #include <linux/device.h>
1041 ], [
1042 class_device_create(NULL, NULL, 0, NULL, NULL);
1043 ], [class_device_create], [drivers/base/class.c], [
1044 AC_MSG_RESULT(yes)
1045 AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
1046 [class_device_create() is available])
1047 ], [
1048 AC_MSG_RESULT(no)
1049 ])
1050 ])
1051
1052 dnl #
1053 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
1054 dnl #
1055 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT],
1056 [AC_MSG_CHECKING([whether set_normalized_timespec() is available as export])
1057 SPL_LINUX_TRY_COMPILE_SYMBOL([
1058 #include <linux/time.h>
1059 ], [
1060 set_normalized_timespec(NULL, 0, 0);
1061 ], [set_normalized_timespec], [kernel/time.c], [
1062 AC_MSG_RESULT(yes)
1063 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
1064 [set_normalized_timespec() is available as export])
1065 ], [
1066 AC_MSG_RESULT(no)
1067 ])
1068 ])
1069
1070 dnl #
1071 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
1072 dnl # previously it was available in time.h as an inline.
1073 dnl #
1074 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
1075 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
1076 SPL_LINUX_TRY_COMPILE([
1077 #include <linux/time.h>
1078 void set_normalized_timespec(struct timespec *ts,
1079 time_t sec, long nsec) { }
1080 ],
1081 [],
1082 [
1083 AC_MSG_RESULT(no)
1084 ],[
1085 AC_MSG_RESULT(yes)
1086 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
1087 [set_normalized_timespec() is available as inline])
1088 ])
1089 ])
1090
1091 dnl #
1092 dnl # 2.6.18 API change,
1093 dnl # timespec_sub() inline function available in linux/time.h
1094 dnl #
1095 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
1096 AC_MSG_CHECKING([whether timespec_sub() is available])
1097 SPL_LINUX_TRY_COMPILE([
1098 #include <linux/time.h>
1099 ],[
1100 struct timespec a = { 0 };
1101 struct timespec b = { 0 };
1102 struct timespec c __attribute__ ((unused));
1103 c = timespec_sub(a, b);
1104 ],[
1105 AC_MSG_RESULT(yes)
1106 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
1107 ],[
1108 AC_MSG_RESULT(no)
1109 ])
1110 ])
1111
1112 dnl #
1113 dnl # 2.6.19 API change,
1114 dnl # check if init_utsname() is available in linux/utsname.h
1115 dnl #
1116 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
1117 AC_MSG_CHECKING([whether init_utsname() is available])
1118 SPL_LINUX_TRY_COMPILE([
1119 #include <linux/utsname.h>
1120 ],[
1121 struct new_utsname *a __attribute__ ((unused));
1122 a = init_utsname();
1123 ],[
1124 AC_MSG_RESULT(yes)
1125 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
1126 ],[
1127 AC_MSG_RESULT(no)
1128 ])
1129 ])
1130
1131 dnl #
1132 dnl # 2.6.18 API change,
1133 dnl # added linux/uaccess.h
1134 dnl #
1135 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
1136 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
1137 ])
1138
1139 dnl #
1140 dnl # 2.6.12 API change,
1141 dnl # check whether 'kmalloc_node()' is available.
1142 dnl #
1143 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
1144 AC_MSG_CHECKING([whether kmalloc_node() is available])
1145 SPL_LINUX_TRY_COMPILE([
1146 #include <linux/slab.h>
1147 ],[
1148 void *a __attribute__ ((unused));
1149 a = kmalloc_node(1, GFP_KERNEL, 0);
1150 ],[
1151 AC_MSG_RESULT(yes)
1152 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
1153 ],[
1154 AC_MSG_RESULT(no)
1155 ])
1156 ])
1157
1158 dnl #
1159 dnl # 2.6.9 API change,
1160 dnl # check whether 'monotonic_clock()' is available it may
1161 dnl # be available for some archs but not others.
1162 dnl #
1163 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK],
1164 [AC_MSG_CHECKING([whether monotonic_clock() is available])
1165 SPL_LINUX_TRY_COMPILE_SYMBOL([
1166 #include <linux/timex.h>
1167 ], [
1168 monotonic_clock();
1169 ], [monotonic_clock], [], [
1170 AC_MSG_RESULT(yes)
1171 AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
1172 [monotonic_clock() is available])
1173 ], [
1174 AC_MSG_RESULT(no)
1175 ])
1176 ])
1177
1178 dnl #
1179 dnl # 2.6.16 API change,
1180 dnl # check whether 'struct inode' has i_mutex
1181 dnl #
1182 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
1183 AC_MSG_CHECKING([whether struct inode has i_mutex])
1184 SPL_LINUX_TRY_COMPILE([
1185 #include <linux/fs.h>
1186 #include <linux/mutex.h>
1187 ],[
1188 struct inode i;
1189 mutex_init(&i.i_mutex);
1190 ],[
1191 AC_MSG_RESULT(yes)
1192 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
1193 ],[
1194 AC_MSG_RESULT(no)
1195 ])
1196 ])
1197
1198 dnl #
1199 dnl # 2.6.29 API change,
1200 dnl # Adaptive mutexs introduced.
1201 dnl #
1202 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
1203 AC_MSG_CHECKING([whether struct mutex has owner])
1204 SPL_LINUX_TRY_COMPILE([
1205 #include <linux/mutex.h>
1206 ],[
1207 struct mutex mtx __attribute__ ((unused));
1208 mtx.owner = NULL;
1209 ],[
1210 AC_MSG_RESULT(yes)
1211 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
1212 ],[
1213 AC_MSG_RESULT(no)
1214 ])
1215 ])
1216
1217 dnl #
1218 dnl # 2.6.39 API change,
1219 dnl # Owner type change. A Linux mutex prior to 2.6.39 would store
1220 dnl # the owner as a thread_info pointer when CONFIG_DEBUG_MUTEXES
1221 dnl # was defined. As of 2.6.39 this was changed to a task_struct
1222 dnl # pointer which frankly makes a lot more sense.
1223 dnl #
1224 AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [
1225 AC_MSG_CHECKING([whether struct mutex owner is a task_struct])
1226 tmp_flags="$EXTRA_KCFLAGS"
1227 EXTRA_KCFLAGS="-Werror"
1228 SPL_LINUX_TRY_COMPILE([
1229 #include <linux/mutex.h>
1230 #include <linux/sched.h>
1231 ],[
1232 struct mutex mtx __attribute__ ((unused));
1233 mtx.owner = current;
1234 ],[
1235 AC_MSG_RESULT(yes)
1236 AC_DEFINE(HAVE_MUTEX_OWNER_TASK_STRUCT, 1,
1237 [struct mutex owner is a task_struct])
1238 ],[
1239 AC_MSG_RESULT(no)
1240 ])
1241 EXTRA_KCFLAGS="$tmp_flags"
1242 ])
1243
1244 dnl #
1245 dnl # 2.6.18 API change,
1246 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
1247 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
1248 dnl # if the mutex validator is disabled or otherwise unavailable.
1249 dnl #
1250 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
1251 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
1252 SPL_LINUX_TRY_COMPILE([
1253 #include <linux/mutex.h>
1254 ],[
1255 struct mutex mutex;
1256 mutex_init(&mutex);
1257 mutex_lock_nested(&mutex, 0);
1258 ],[
1259 AC_MSG_RESULT(yes)
1260 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
1261 [mutex_lock_nested() is available])
1262 ],[
1263 AC_MSG_RESULT(no)
1264 ])
1265 ])
1266
1267 dnl #
1268 dnl # 2.6.27 API change,
1269 dnl # on_each_cpu() uses 3 args, no 'retry' argument
1270 dnl #
1271 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
1272 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
1273 SPL_LINUX_TRY_COMPILE([
1274 #include <linux/interrupt.h>
1275 #include <linux/smp.h>
1276
1277 void on_each_cpu_func(void *data) { return; }
1278 ],[
1279 on_each_cpu(on_each_cpu_func, NULL, 0);
1280 ],[
1281 AC_MSG_RESULT(yes)
1282 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
1283 [on_each_cpu wants 3 args])
1284 ],[
1285 AC_MSG_RESULT(no)
1286 ])
1287 ])
1288
1289 dnl #
1290 dnl # 2.6.18 API change,
1291 dnl # kallsyms_lookup_name no longer exported
1292 dnl #
1293 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME],
1294 [AC_MSG_CHECKING([whether kallsyms_lookup_name() is available])
1295 SPL_LINUX_TRY_COMPILE_SYMBOL([
1296 #include <linux/kallsyms.h>
1297 ], [
1298 kallsyms_lookup_name(NULL);
1299 ], [kallsyms_lookup_name], [], [
1300 AC_MSG_RESULT(yes)
1301 AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1302 [kallsyms_lookup_name() is available])
1303 ], [
1304 AC_MSG_RESULT(no)
1305 ])
1306 ])
1307
1308 dnl #
1309 dnl # Proposed API change,
1310 dnl # This symbol is not available in stock kernels. You may build a
1311 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1312 dnl # these symbols for use. If your already rolling a custom kernel for
1313 dnl # your environment this is recommended.
1314 dnl #
1315 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO],
1316 [AC_MSG_CHECKING([whether get_vmalloc_info() is available])
1317 SPL_CHECK_SYMBOL_EXPORT([get_vmalloc_info], [], [
1318 AC_MSG_RESULT(yes)
1319 AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
1320 [get_vmalloc_info() is available])
1321 ], [
1322 AC_MSG_RESULT(no)
1323 ])
1324 ])
1325
1326 dnl #
1327 dnl # 2.6.17 API change
1328 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
1329 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
1330 dnl # were exported in 2.6.17 for use by modules which was consistent with
1331 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
1332 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
1333 dnl # were dropped entirely leaving modules no way to directly iterate over
1334 dnl # the zone list. Because we need access to the zone helpers we check
1335 dnl # if the kernel contains the old or new implementation. Then we check
1336 dnl # to see if the symbols we need for each version are available. If they
1337 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
1338 dnl #
1339 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
1340 AC_MSG_CHECKING([whether symbol *_pgdat exist])
1341 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
1342 rc=$?
1343 if test $rc -eq 0; then
1344 AC_MSG_RESULT([yes])
1345 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
1346 else
1347 AC_MSG_RESULT([no])
1348 fi
1349 ])
1350
1351 dnl #
1352 dnl # Proposed API change,
1353 dnl # This symbol is not available in stock kernels. You may build a
1354 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1355 dnl # these symbols for use. If your already rolling a custom kernel for
1356 dnl # your environment this is recommended.
1357 dnl #
1358 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT],
1359 [AC_MSG_CHECKING([whether first_online_pgdat() is available])
1360 SPL_LINUX_TRY_COMPILE_SYMBOL([
1361 #include <linux/mmzone.h>
1362 ], [
1363 first_online_pgdat();
1364 ], [first_online_pgdat], [], [
1365 AC_MSG_RESULT(yes)
1366 AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
1367 [first_online_pgdat() is available])
1368 ], [
1369 AC_MSG_RESULT(no)
1370 ])
1371 ])
1372
1373 dnl #
1374 dnl # Proposed API change,
1375 dnl # This symbol is not available in stock kernels. You may build a
1376 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1377 dnl # these symbols for use. If your already rolling a custom kernel for
1378 dnl # your environment this is recommended.
1379 dnl #
1380 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT],
1381 [AC_MSG_CHECKING([whether next_online_pgdat() is available])
1382 SPL_LINUX_TRY_COMPILE_SYMBOL([
1383 #include <linux/mmzone.h>
1384 ], [
1385 next_online_pgdat(NULL);
1386 ], [next_online_pgdat], [], [
1387 AC_MSG_RESULT(yes)
1388 AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
1389 [next_online_pgdat() is available])
1390 ], [
1391 AC_MSG_RESULT(no)
1392 ])
1393 ])
1394
1395 dnl #
1396 dnl # Proposed API change,
1397 dnl # This symbol is not available in stock kernels. You may build a
1398 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1399 dnl # these symbols for use. If your already rolling a custom kernel for
1400 dnl # your environment this is recommended.
1401 dnl #
1402 AC_DEFUN([SPL_AC_NEXT_ZONE],
1403 [AC_MSG_CHECKING([whether next_zone() is available])
1404 SPL_LINUX_TRY_COMPILE_SYMBOL([
1405 #include <linux/mmzone.h>
1406 ], [
1407 next_zone(NULL);
1408 ], [next_zone], [], [
1409 AC_MSG_RESULT(yes)
1410 AC_DEFINE(HAVE_NEXT_ZONE, 1, [next_zone() is available])
1411 ], [
1412 AC_MSG_RESULT(no)
1413 ])
1414 ])
1415
1416 dnl #
1417 dnl # 2.6.17 API change,
1418 dnl # See SPL_AC_PGDAT_HELPERS for details.
1419 dnl #
1420 AC_DEFUN([SPL_AC_PGDAT_LIST],
1421 [AC_MSG_CHECKING([whether pgdat_list is available])
1422 SPL_LINUX_TRY_COMPILE_SYMBOL([
1423 #include <linux/topology.h>
1424 pg_data_t *tmp = pgdat_list;
1425 ], [], [pgdat_list], [], [
1426 AC_MSG_RESULT(yes)
1427 AC_DEFINE(HAVE_PGDAT_LIST, 1, [pgdat_list is available])
1428 ], [
1429 AC_MSG_RESULT(no)
1430 ])
1431 ])
1432
1433 dnl #
1434 dnl # 2.6.18 API change,
1435 dnl # First introduced global_page_state() support as an inline.
1436 dnl #
1437 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1438 AC_MSG_CHECKING([whether global_page_state() is available])
1439 SPL_LINUX_TRY_COMPILE([
1440 #include <linux/mm.h>
1441 ],[
1442 unsigned long state __attribute__ ((unused));
1443 state = global_page_state(0);
1444 ],[
1445 AC_MSG_RESULT(yes)
1446 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1447 [global_page_state() is available])
1448 ],[
1449 AC_MSG_RESULT(no)
1450 ])
1451 ])
1452
1453 dnl #
1454 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1455 dnl # Public global zone stats now include a free page count. However
1456 dnl # the enumerated names of the counters have changed since this API
1457 dnl # was introduced. We need to deduce the corrent name to use. This
1458 dnl # replaces the priviate get_zone_counts() interface.
1459 dnl #
1460 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1461 dnl # is 2.6.30 as of when this was written.
1462 dnl #
1463 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1464 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1465 SPL_LINUX_TRY_COMPILE([
1466 #include <linux/mm.h>
1467 ],[
1468 enum zone_stat_item zsi __attribute__ ((unused));
1469 zsi = NR_FREE_PAGES;
1470 ],[
1471 AC_MSG_RESULT(yes)
1472 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1473 [Page state NR_FREE_PAGES is available])
1474 ],[
1475 AC_MSG_RESULT(no)
1476 ])
1477 ])
1478
1479 dnl #
1480 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1481 dnl # Public global zone stats now include an inactive page count. However
1482 dnl # the enumerated names of the counters have changed since this API
1483 dnl # was introduced. We need to deduce the corrent name to use. This
1484 dnl # replaces the priviate get_zone_counts() interface.
1485 dnl #
1486 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1487 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1488 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1489 dnl #
1490 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1491 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1492 SPL_LINUX_TRY_COMPILE([
1493 #include <linux/mm.h>
1494 ],[
1495 enum zone_stat_item zsi __attribute__ ((unused));
1496 zsi = NR_INACTIVE;
1497 ],[
1498 AC_MSG_RESULT(yes)
1499 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1500 [Page state NR_INACTIVE is available])
1501 ],[
1502 AC_MSG_RESULT(no)
1503 ])
1504
1505 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1506 SPL_LINUX_TRY_COMPILE([
1507 #include <linux/mm.h>
1508 ],[
1509 enum zone_stat_item zsi __attribute__ ((unused));
1510 zsi = NR_INACTIVE_ANON;
1511 ],[
1512 AC_MSG_RESULT(yes)
1513 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1514 [Page state NR_INACTIVE_ANON is available])
1515 ],[
1516 AC_MSG_RESULT(no)
1517 ])
1518
1519 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1520 SPL_LINUX_TRY_COMPILE([
1521 #include <linux/mm.h>
1522 ],[
1523 enum zone_stat_item zsi __attribute__ ((unused));
1524 zsi = NR_INACTIVE_FILE;
1525 ],[
1526 AC_MSG_RESULT(yes)
1527 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1528 [Page state NR_INACTIVE_FILE is available])
1529 ],[
1530 AC_MSG_RESULT(no)
1531 ])
1532 ])
1533
1534 dnl #
1535 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1536 dnl # Public global zone stats now include an active page count. However
1537 dnl # the enumerated names of the counters have changed since this API
1538 dnl # was introduced. We need to deduce the corrent name to use. This
1539 dnl # replaces the priviate get_zone_counts() interface.
1540 dnl #
1541 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1542 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1543 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1544 dnl #
1545 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1546 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1547 SPL_LINUX_TRY_COMPILE([
1548 #include <linux/mm.h>
1549 ],[
1550 enum zone_stat_item zsi __attribute__ ((unused));
1551 zsi = NR_ACTIVE;
1552 ],[
1553 AC_MSG_RESULT(yes)
1554 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1555 [Page state NR_ACTIVE is available])
1556 ],[
1557 AC_MSG_RESULT(no)
1558 ])
1559
1560 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1561 SPL_LINUX_TRY_COMPILE([
1562 #include <linux/mm.h>
1563 ],[
1564 enum zone_stat_item zsi __attribute__ ((unused));
1565 zsi = NR_ACTIVE_ANON;
1566 ],[
1567 AC_MSG_RESULT(yes)
1568 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1569 [Page state NR_ACTIVE_ANON is available])
1570 ],[
1571 AC_MSG_RESULT(no)
1572 ])
1573
1574 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1575 SPL_LINUX_TRY_COMPILE([
1576 #include <linux/mm.h>
1577 ],[
1578 enum zone_stat_item zsi __attribute__ ((unused));
1579 zsi = NR_ACTIVE_FILE;
1580 ],[
1581 AC_MSG_RESULT(yes)
1582 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1583 [Page state NR_ACTIVE_FILE is available])
1584 ],[
1585 AC_MSG_RESULT(no)
1586 ])
1587 ])
1588
1589 dnl #
1590 dnl # Proposed API change for legacy kernels.
1591 dnl # This symbol is not available in older kernels. For kernels post
1592 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1593 dnl # page state information. This symbol is only used in legacy kernels
1594 dnl # any only as a last resort.
1595 dnl
1596 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1597 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1598 SPL_LINUX_TRY_COMPILE([
1599 ],[
1600 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1601 #error "global_page_state needs NR_FREE_PAGES"
1602 #endif
1603
1604 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1605 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1606 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1607 #error "global_page_state needs NR_ACTIVE*"
1608 #endif
1609
1610 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1611 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1612 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1613 #error "global_page_state needs NR_INACTIVE*"
1614 #endif
1615 ],[
1616 AC_MSG_RESULT(no)
1617 ],[
1618 AC_MSG_RESULT(yes)
1619 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1620 [get_zone_counts() is needed])
1621
1622 AC_MSG_CHECKING([whether get_zone_counts() is available])
1623 SPL_LINUX_TRY_COMPILE_SYMBOL([
1624 #include <linux/mmzone.h>
1625 ], [
1626 get_zone_counts(NULL, NULL, NULL);
1627 ], [get_zone_counts], [], [
1628 AC_MSG_RESULT(yes)
1629 AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1630 [get_zone_counts() is available])
1631 ], [
1632 AC_MSG_RESULT(no)
1633 ])
1634 ])
1635 ])
1636
1637 dnl #
1638 dnl # 2.6.27 API change,
1639 dnl # The user_path_dir() replaces __user_walk()
1640 dnl #
1641 AC_DEFUN([SPL_AC_USER_PATH_DIR],
1642 [AC_MSG_CHECKING([whether user_path_dir() is available])
1643 SPL_LINUX_TRY_COMPILE_SYMBOL([
1644 #include <linux/fcntl.h>
1645 #include <linux/namei.h>
1646 ], [
1647 user_path_dir(NULL, NULL);
1648 ], [user_path_at], [], [
1649 AC_MSG_RESULT(yes)
1650 AC_DEFINE(HAVE_USER_PATH_DIR, 1, [user_path_dir() is available])
1651 ], [
1652 AC_MSG_RESULT(no)
1653 ])
1654 ])
1655
1656 dnl #
1657 dnl # Symbol available in RHEL kernels not in stock kernels.
1658 dnl #
1659 AC_DEFUN([SPL_AC_SET_FS_PWD],
1660 [AC_MSG_CHECKING([whether set_fs_pwd() is available])
1661 SPL_LINUX_TRY_COMPILE_SYMBOL([
1662 #include <linux/spinlock.h>
1663 #include <linux/fs_struct.h>
1664 ], [
1665 (void) set_fs_pwd;
1666 ], [set_fs_pwd], [], [
1667 AC_MSG_RESULT(yes)
1668 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd() is available])
1669 ], [
1670 AC_MSG_RESULT(no)
1671 ])
1672 ])
1673
1674 dnl #
1675 dnl # 2.6.25 API change,
1676 dnl # Simplied API by replacing mnt+dentry args with a single path arg.
1677 dnl #
1678 AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
1679 [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
1680 SPL_LINUX_TRY_COMPILE([
1681 #include <linux/sched.h>
1682 #include <linux/fs_struct.h>
1683 ],[
1684 set_fs_pwd(NULL, NULL);
1685 ],[
1686 AC_MSG_RESULT(yes)
1687 AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
1688 [set_fs_pwd() wants 2 args])
1689 ],[
1690 AC_MSG_RESULT(no)
1691 ])
1692 ])
1693
1694 dnl #
1695 dnl # SLES API change, never adopted in mainline,
1696 dnl # Third 'struct vfsmount *' argument removed.
1697 dnl #
1698 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1699 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1700 SPL_LINUX_TRY_COMPILE([
1701 #include <linux/fs.h>
1702 ],[
1703 vfs_unlink(NULL, NULL);
1704 ],[
1705 AC_MSG_RESULT(yes)
1706 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1707 [vfs_unlink() wants 2 args])
1708 ],[
1709 AC_MSG_RESULT(no)
1710 ])
1711 ])
1712
1713 dnl #
1714 dnl # SLES API change, never adopted in mainline,
1715 dnl # Third and sixth 'struct vfsmount *' argument removed.
1716 dnl #
1717 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1718 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1719 SPL_LINUX_TRY_COMPILE([
1720 #include <linux/fs.h>
1721 ],[
1722 vfs_rename(NULL, NULL, NULL, NULL);
1723 ],[
1724 AC_MSG_RESULT(yes)
1725 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1726 [vfs_rename() wants 4 args])
1727 ],[
1728 AC_MSG_RESULT(no)
1729 ])
1730 ])
1731
1732 dnl #
1733 dnl # 2.6.36 API change,
1734 dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
1735 dnl # a spinlock_t to improve the fastpath performance.
1736 dnl #
1737 AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
1738 AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
1739 tmp_flags="$EXTRA_KCFLAGS"
1740 EXTRA_KCFLAGS="-Werror"
1741 SPL_LINUX_TRY_COMPILE([
1742 #include <linux/sched.h>
1743 #include <linux/fs_struct.h>
1744 ],[
1745 struct fs_struct fs;
1746 spin_lock_init(&fs.lock);
1747 ],[
1748 AC_MSG_RESULT(yes)
1749 AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
1750 [struct fs_struct uses spinlock_t])
1751 ],[
1752 AC_MSG_RESULT(no)
1753 ])
1754 EXTRA_KCFLAGS="$tmp_flags"
1755 ])
1756
1757 dnl #
1758 dnl # 2.6.29 API change,
1759 dnl # check whether 'struct cred' exists
1760 dnl #
1761 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1762 AC_MSG_CHECKING([whether struct cred exists])
1763 SPL_LINUX_TRY_COMPILE([
1764 #include <linux/cred.h>
1765 ],[
1766 struct cred *cr __attribute__ ((unused));
1767 cr = NULL;
1768 ],[
1769 AC_MSG_RESULT(yes)
1770 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1771 ],[
1772 AC_MSG_RESULT(no)
1773 ])
1774 ])
1775
1776 dnl #
1777 dnl # Custom SPL patch may export this symbol.
1778 dnl #
1779 AC_DEFUN([SPL_AC_GROUPS_SEARCH],
1780 [AC_MSG_CHECKING([whether groups_search() is available])
1781 SPL_LINUX_TRY_COMPILE_SYMBOL([
1782 #include <linux/cred.h>
1783 ], [
1784 groups_search(NULL, 0);
1785 ], [groups_search], [], [
1786 AC_MSG_RESULT(yes)
1787 AC_DEFINE(HAVE_GROUPS_SEARCH, 1, [groups_search() is available])
1788 ], [
1789 AC_MSG_RESULT(no)
1790 ])
1791 ])
1792
1793 dnl #
1794 dnl # 2.6.x API change,
1795 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1796 dnl #
1797 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT],
1798 [AC_MSG_CHECKING([whether __put_task_struct() is available])
1799 SPL_LINUX_TRY_COMPILE_SYMBOL([
1800 #include <linux/sched.h>
1801 ], [
1802 __put_task_struct(NULL);
1803 ], [__put_task_struct], [], [
1804 AC_MSG_RESULT(yes)
1805 AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1806 [__put_task_struct() is available])
1807 ], [
1808 AC_MSG_RESULT(no)
1809 ])
1810 ])
1811
1812 dnl #
1813 dnl # 2.6.32 API change,
1814 dnl # Unused 'struct file *' removed from prototype.
1815 dnl #
1816 AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
1817 AC_MSG_CHECKING([whether proc_handler() wants 5 args])
1818 SPL_LINUX_TRY_COMPILE([
1819 #include <linux/sysctl.h>
1820 ],[
1821 proc_dostring(NULL, 0, NULL, NULL, NULL);
1822 ],[
1823 AC_MSG_RESULT(yes)
1824 AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
1825 [proc_handler() wants 5 args])
1826 ],[
1827 AC_MSG_RESULT(no)
1828 ])
1829 ])
1830
1831 dnl #
1832 dnl # 2.6.x API change,
1833 dnl # kvasprintf() function added.
1834 dnl #
1835 AC_DEFUN([SPL_AC_KVASPRINTF],
1836 [AC_MSG_CHECKING([whether kvasprintf() is available])
1837 SPL_LINUX_TRY_COMPILE_SYMBOL([
1838 #include <linux/kernel.h>
1839 ], [
1840 kvasprintf(0, NULL, *((va_list*)NULL));
1841 ], [kvasprintf], [], [
1842 AC_MSG_RESULT(yes)
1843 AC_DEFINE(HAVE_KVASPRINTF, 1, [kvasprintf() is available])
1844 ], [
1845 AC_MSG_RESULT(no)
1846 ])
1847 ])
1848
1849 dnl #
1850 dnl # 2.6.29 API change,
1851 dnl # vfs_fsync() funcation added, prior to this use file_fsync().
1852 dnl #
1853 AC_DEFUN([SPL_AC_VFS_FSYNC],
1854 [AC_MSG_CHECKING([whether vfs_fsync() is available])
1855 SPL_LINUX_TRY_COMPILE_SYMBOL([
1856 #include <linux/fs.h>
1857 ], [
1858 (void) vfs_fsync;
1859 ], [vfs_fsync], [fs/sync.c], [
1860 AC_MSG_RESULT(yes)
1861 AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available])
1862 ], [
1863 AC_MSG_RESULT(no)
1864 ])
1865 ])
1866
1867 dnl #
1868 dnl # 2.6.35 API change,
1869 dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
1870 dnl #
1871 AC_DEFUN([SPL_AC_2ARGS_VFS_FSYNC], [
1872 AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
1873 SPL_LINUX_TRY_COMPILE([
1874 #include <linux/fs.h>
1875 ],[
1876 vfs_fsync(NULL, 0);
1877 ],[
1878 AC_MSG_RESULT(yes)
1879 AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args])
1880 ],[
1881 AC_MSG_RESULT(no)
1882 ])
1883 ])
1884
1885 dnl #
1886 dnl # 3.5 API change,
1887 dnl # inode_operations.truncate_range removed
1888 dnl #
1889 AC_DEFUN([SPL_AC_INODE_TRUNCATE_RANGE], [
1890 AC_MSG_CHECKING([whether truncate_range() inode operation is available])
1891 SPL_LINUX_TRY_COMPILE([
1892 #include <linux/fs.h>
1893 ],[
1894 struct inode_operations ops;
1895 ops.truncate_range = NULL;
1896 ],[
1897 AC_MSG_RESULT(yes)
1898 AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
1899 [truncate_range() inode operation is available])
1900 ],[
1901 AC_MSG_RESULT(no)
1902 ])
1903 ])
1904
1905 dnl #
1906 dnl # Linux 2.6.38 - 3.x API
1907 dnl #
1908 AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [
1909 AC_MSG_CHECKING([whether fops->fallocate() exists])
1910 SPL_LINUX_TRY_COMPILE([
1911 #include <linux/fs.h>
1912 ],[
1913 long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
1914 struct file_operations fops __attribute__ ((unused)) = {
1915 .fallocate = fallocate,
1916 };
1917 ],[
1918 AC_MSG_RESULT(yes)
1919 AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
1920 ],[
1921 AC_MSG_RESULT(no)
1922 ])
1923 ])
1924
1925 dnl #
1926 dnl # Linux 2.6.x - 2.6.37 API
1927 dnl #
1928 AC_DEFUN([SPL_AC_KERNEL_INODE_FALLOCATE], [
1929 AC_MSG_CHECKING([whether iops->fallocate() exists])
1930 SPL_LINUX_TRY_COMPILE([
1931 #include <linux/fs.h>
1932 ],[
1933 long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
1934 struct inode_operations fops __attribute__ ((unused)) = {
1935 .fallocate = fallocate,
1936 };
1937 ],[
1938 AC_MSG_RESULT(yes)
1939 AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
1940 ],[
1941 AC_MSG_RESULT(no)
1942 ])
1943 ])
1944
1945 dnl #
1946 dnl # PaX Linux 2.6.38 - 3.x API
1947 dnl #
1948 AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
1949 AC_MSG_CHECKING([whether fops->fallocate() exists])
1950 SPL_LINUX_TRY_COMPILE([
1951 #include <linux/fs.h>
1952 ],[
1953 long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
1954 struct file_operations_no_const fops __attribute__ ((unused)) = {
1955 .fallocate = fallocate,
1956 };
1957 ],[
1958 AC_MSG_RESULT(yes)
1959 AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
1960 ],[
1961 AC_MSG_RESULT(no)
1962 ])
1963 ])
1964
1965 dnl #
1966 dnl # The fallocate callback was moved from the inode_operations
1967 dnl # structure to the file_operations structure.
1968 dnl #
1969 AC_DEFUN([SPL_AC_KERNEL_FALLOCATE], [
1970 SPL_AC_KERNEL_FILE_FALLOCATE
1971 SPL_AC_KERNEL_INODE_FALLOCATE
1972 SPL_AC_PAX_KERNEL_FILE_FALLOCATE
1973 ])
1974
1975 dnl #
1976 dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
1977 dnl # Earlier versions of rwsem_is_locked() were inline and had a race
1978 dnl # condition. The fixed version is exported as a symbol. The race
1979 dnl # condition is fixed by acquiring sem->wait_lock, so we must not
1980 dnl # call that version while holding sem->wait_lock.
1981 dnl #
1982 AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED],
1983 [AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock])
1984 SPL_LINUX_TRY_COMPILE_SYMBOL([
1985 #include <linux/rwsem.h>
1986 int rwsem_is_locked(struct rw_semaphore *sem) { return 0; }
1987 ], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [
1988 AC_MSG_RESULT(yes)
1989 AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
1990 [rwsem_is_locked() acquires sem->wait_lock])
1991 ], [
1992 AC_MSG_RESULT(no)
1993 ])
1994 ])
1995
1996 dnl #
1997 dnl # 2.6.xx API compat,
1998 dnl # There currently exists no exposed API to partially shrink the dcache.
1999 dnl # The expected mechanism to shrink the cache is a registered shrinker
2000 dnl # which is called during memory pressure.
2001 dnl #
2002 AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY],
2003 [AC_MSG_CHECKING([whether shrink_dcache_memory() is available])
2004 SPL_LINUX_TRY_COMPILE_SYMBOL([
2005 #include <linux/dcache.h>
2006 ], [
2007 shrink_dcache_memory(0, 0);
2008 ], [shrink_dcache_memory], [fs/dcache.c], [
2009 AC_MSG_RESULT(yes)
2010 AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1,
2011 [shrink_dcache_memory() is available])
2012 ], [
2013 AC_MSG_RESULT(no)
2014 ])
2015 ])
2016
2017 dnl #
2018 dnl # 2.6.xx API compat,
2019 dnl # There currently exists no exposed API to partially shrink the icache.
2020 dnl # The expected mechanism to shrink the cache is a registered shrinker
2021 dnl # which is called during memory pressure.
2022 dnl #
2023 AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY],
2024 [AC_MSG_CHECKING([whether shrink_icache_memory() is available])
2025 SPL_LINUX_TRY_COMPILE_SYMBOL([
2026 #include <linux/dcache.h>
2027 ], [
2028 shrink_icache_memory(0, 0);
2029 ], [shrink_icache_memory], [fs/inode.c], [
2030 AC_MSG_RESULT(yes)
2031 AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1,
2032 [shrink_icache_memory() is available])
2033 ], [
2034 AC_MSG_RESULT(no)
2035 ])
2036 ])
2037
2038 dnl #
2039 dnl # 2.6.39 API compat,
2040 dnl # The path_lookup() function has been renamed to kern_path_parent()
2041 dnl # and the flags argument has been removed. The only behavior now
2042 dnl # offered is that of LOOKUP_PARENT. The spl already always passed
2043 dnl # this flag so dropping the flag does not impact us.
2044 dnl #
2045 AC_DEFUN([SPL_AC_KERN_PATH_PARENT_HEADER], [
2046 SPL_CHECK_SYMBOL_HEADER(
2047 [kern_path_parent],
2048 [int kern_path_parent(const char \*, struct nameidata \*)],
2049 [include/linux/namei.h],
2050 [AC_DEFINE(HAVE_KERN_PATH_PARENT_HEADER, 1,
2051 [kern_path_parent() is available])],
2052 [])
2053 ])
2054
2055 dnl #
2056 dnl # 3.1 API compat,
2057 dnl # The kern_path_parent() symbol is no longer exported by the kernel.
2058 dnl # However, it remains the prefered interface and since we still have
2059 dnl # access to the prototype we dynamically lookup the required address.
2060 dnl #
2061 AC_DEFUN([SPL_AC_KERN_PATH_PARENT_SYMBOL],
2062 [AC_MSG_CHECKING([whether kern_path_parent() is available])
2063 SPL_LINUX_TRY_COMPILE_SYMBOL([
2064 #include <linux/namei.h>
2065 ], [
2066 kern_path_parent(NULL, NULL);
2067 ], [kern_path_parent], [fs/namei.c], [
2068 AC_MSG_RESULT(yes)
2069 AC_DEFINE(HAVE_KERN_PATH_PARENT_SYMBOL, 1,
2070 [kern_path_parent() is available])
2071 ], [
2072 AC_MSG_RESULT(no)
2073 ])
2074 ])
2075
2076 dnl #
2077 dnl # 3.6 API compat,
2078 dnl # The kern_path_parent() function was replaced by the kern_path_locked()
2079 dnl # function to eliminate all struct nameidata usage outside fs/namei.c.
2080 dnl #
2081 AC_DEFUN([SPL_AC_KERN_PATH_LOCKED], [
2082 SPL_CHECK_SYMBOL_HEADER(
2083 [kern_path_locked],
2084 [struct dentry \*kern_path_locked(const char \*, struct path \*)],
2085 [include/linux/namei.h],
2086 [AC_DEFINE(HAVE_KERN_PATH_LOCKED, 1,
2087 [kern_path_locked() is available])],
2088 [])
2089 ])
2090
2091 dnl #
2092 dnl # /proc/kallsyms support,
2093 dnl # Verify the kernel has CONFIG_KALLSYMS support enabled.
2094 dnl #
2095 AC_DEFUN([SPL_AC_CONFIG_KALLSYMS], [
2096 AC_MSG_CHECKING([whether CONFIG_KALLSYMS is defined])
2097 SPL_LINUX_TRY_COMPILE([
2098 #if !defined(CONFIG_KALLSYMS)
2099 #error CONFIG_KALLSYMS not defined
2100 #endif
2101 ],[ ],[
2102 AC_MSG_RESULT([yes])
2103 ],[
2104 AC_MSG_RESULT([no])
2105 AC_MSG_ERROR([
2106 *** This kernel does not include the required kallsyms support.
2107 *** Rebuild the kernel with CONFIG_KALLSYMS=y set.])
2108 ])
2109 ])
2110
2111 dnl #
2112 dnl # zlib inflate compat,
2113 dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
2114 dnl #
2115 AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [
2116 AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
2117 SPL_LINUX_TRY_COMPILE([
2118 #if !defined(CONFIG_ZLIB_INFLATE) && \
2119 !defined(CONFIG_ZLIB_INFLATE_MODULE)
2120 #error CONFIG_ZLIB_INFLATE not defined
2121 #endif
2122 ],[ ],[
2123 AC_MSG_RESULT([yes])
2124 ],[
2125 AC_MSG_RESULT([no])
2126 AC_MSG_ERROR([
2127 *** This kernel does not include the required zlib inflate support.
2128 *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
2129 ])
2130 ])
2131
2132 dnl #
2133 dnl # zlib deflate compat,
2134 dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
2135 dnl #
2136 AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
2137 AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
2138 SPL_LINUX_TRY_COMPILE([
2139 #if !defined(CONFIG_ZLIB_DEFLATE) && \
2140 !defined(CONFIG_ZLIB_DEFLATE_MODULE)
2141 #error CONFIG_ZLIB_DEFLATE not defined
2142 #endif
2143 ],[ ],[
2144 AC_MSG_RESULT([yes])
2145 ],[
2146 AC_MSG_RESULT([no])
2147 AC_MSG_ERROR([
2148 *** This kernel does not include the required zlib deflate support.
2149 *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
2150 ])
2151 ])
2152
2153 dnl #
2154 dnl # 2.6.39 API compat,
2155 dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
2156 dnl # This was done to avoid always having to allocate the maximum size
2157 dnl # workspace (268K). The caller can now specific the windowBits and
2158 dnl # memLevel compression parameters to get a smaller workspace.
2159 dnl #
2160 AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
2161 [AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
2162 SPL_LINUX_TRY_COMPILE([
2163 #include <linux/zlib.h>
2164 ],[
2165 return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
2166 ],[
2167 AC_MSG_RESULT(yes)
2168 AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
2169 [zlib_deflate_workspacesize() wants 2 args])
2170 ],[
2171 AC_MSG_RESULT(no)
2172 ])
2173 ])
2174
2175 dnl #
2176 dnl # 2.6.39 API change,
2177 dnl # Shrinker adjust to use common shrink_control structure.
2178 dnl #
2179 AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [
2180 AC_MSG_CHECKING([whether struct shrink_control exists])
2181 SPL_LINUX_TRY_COMPILE([
2182 #include <linux/mm.h>
2183 ],[
2184 struct shrink_control sc __attribute__ ((unused));
2185
2186 sc.nr_to_scan = 0;
2187 sc.gfp_mask = GFP_KERNEL;
2188 ],[
2189 AC_MSG_RESULT(yes)
2190 AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
2191 [struct shrink_control exists])
2192 ],[
2193 AC_MSG_RESULT(no)
2194 ])
2195 ])
2196
2197 dnl #
2198 dnl # 3.1 API Change
2199 dnl #
2200 dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
2201 dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
2202 dnl #
2203 AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
2204 AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
2205 tmp_flags="$EXTRA_KCFLAGS"
2206 EXTRA_KCFLAGS="-Werror"
2207 SPL_LINUX_TRY_COMPILE([
2208 #include <linux/rwsem.h>
2209 ],[
2210 struct rw_semaphore dummy_semaphore __attribute__ ((unused));
2211 raw_spinlock_t dummy_lock __attribute__ ((unused));
2212 dummy_semaphore.wait_lock = dummy_lock;
2213 ],[
2214 AC_MSG_RESULT(yes)
2215 AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1,
2216 [struct rw_semaphore member wait_lock is raw_spinlock_t])
2217 ],[
2218 AC_MSG_RESULT(no)
2219 ])
2220 EXTRA_KCFLAGS="$tmp_flags"
2221 ])
2222
2223 dnl #
2224 dnl # 3.9 API change,
2225 dnl # Moved things from linux/sched.h to linux/sched/rt.h
2226 dnl #
2227 AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
2228 [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
2229 SPL_LINUX_TRY_COMPILE([
2230 #include <linux/sched.h>
2231 #include <linux/sched/rt.h>
2232 ],[
2233 return 0;
2234 ],[
2235 AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
2236 AC_MSG_RESULT(yes)
2237 ],[
2238 AC_MSG_RESULT(no)
2239 ])
2240 ])
2241
2242 dnl #
2243 dnl # 3.9 API change,
2244 dnl # vfs_getattr() uses 2 args
2245 dnl # It takes struct path * instead of struct vfsmount * and struct dentry *
2246 dnl #
2247 AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
2248 AC_MSG_CHECKING([whether vfs_getattr() wants])
2249 SPL_LINUX_TRY_COMPILE([
2250 #include <linux/fs.h>
2251 ],[
2252 vfs_getattr((struct path *) NULL,
2253 (struct kstat *)NULL);
2254 ],[
2255 AC_MSG_RESULT(2 args)
2256 AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
2257 [vfs_getattr wants 2 args])
2258 ],[
2259 SPL_LINUX_TRY_COMPILE([
2260 #include <linux/fs.h>
2261 ],[
2262 vfs_getattr((struct vfsmount *)NULL,
2263 (struct dentry *)NULL,
2264 (struct kstat *)NULL);
2265 ],[
2266 AC_MSG_RESULT(3 args)
2267 ],[
2268 AC_MSG_ERROR(unknown)
2269 ])
2270 ])
2271 ])