]> git.proxmox.com Git - mirror_spl.git/blame - config/spl-build.m4
Remove credential configure checks.
[mirror_spl.git] / config / spl-build.m4
CommitLineData
716154c5
BB
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
86933a6e
BB
9AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
10 SPL_AC_KERNEL
11
86933a6e
BB
12 if test "${LINUX_OBJ}" != "${LINUX}"; then
13 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
14 fi
86933a6e 15 AC_SUBST(KERNELMAKE_PARAMS)
a7958f7e
BB
16
17 KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
86933a6e
BB
18 AC_SUBST(KERNELCPPFLAGS)
19
20 SPL_AC_DEBUG
4b2220f0 21 SPL_AC_DEBUG_LOG
86933a6e 22 SPL_AC_DEBUG_KMEM
055ffd98 23 SPL_AC_DEBUG_KMEM_TRACKING
0408008b 24 SPL_AC_TEST_MODULE
5e9b5d83 25 SPL_AC_ATOMIC_SPINLOCK
c3d9c0df 26 SPL_AC_SHRINKER_CALLBACK
79a3bf13 27 SPL_AC_CTL_NAME
1ddf9722 28 SPL_AC_PDE_DATA
4d54fdee 29 SPL_AC_MUTEX_OWNER
86fd39f3 30 SPL_AC_MUTEX_OWNER_TASK_STRUCT
a54718cf 31 SPL_AC_SET_FS_PWD_WITH_CONST
86933a6e
BB
32 SPL_AC_2ARGS_VFS_UNLINK
33 SPL_AC_4ARGS_VFS_RENAME
0d0b5237
BB
34 SPL_AC_VFS_FSYNC
35 SPL_AC_2ARGS_VFS_FSYNC
bbdc6ae4 36 SPL_AC_INODE_TRUNCATE_RANGE
9b2048c2 37 SPL_AC_FS_STRUCT_SPINLOCK
f7fd6ddd 38 SPL_AC_KUIDGID_T
e811949a 39 SPL_AC_PUT_TASK_STRUCT
3977f837 40 SPL_AC_5ARGS_PROC_HANDLER
b868e22f 41 SPL_AC_KVASPRINTF
46aa7b39 42 SPL_AC_EXPORTED_RWSEM_IS_LOCKED
1c7b3eaf 43 SPL_AC_KERNEL_FALLOCATE
ec18fe3c 44 SPL_AC_KERN_PATH
42b3ce62
BB
45 SPL_AC_CONFIG_ZLIB_INFLATE
46 SPL_AC_CONFIG_ZLIB_DEFLATE
3dfc591a 47 SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
a55bcaad 48 SPL_AC_SHRINK_CONTROL_STRUCT
588d9004 49 SPL_AC_RWSEM_SPINLOCK_IS_RAW
10087fe1 50 SPL_AC_SCHED_RT_HEADER
2a305c34 51 SPL_AC_2ARGS_VFS_GETATTR
184c6873 52 SPL_AC_USLEEP_RANGE
a073aeb0 53 SPL_AC_KMEM_CACHE_ALLOCFLAGS
2fc44f66 54 SPL_AC_WAIT_ON_BIT
86933a6e
BB
55])
56
57AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
bb339d06 58 modpost=$LINUX/scripts/Makefile.modpost
86933a6e 59 AC_MSG_CHECKING([kernel file name for module symbols])
0408008b 60 if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then
bb339d06
BB
61 if grep -q Modules.symvers $modpost; then
62 LINUX_SYMBOLS=Modules.symvers
63 else
64 LINUX_SYMBOLS=Module.symvers
65 fi
912fd84d
BB
66
67 if ! test -f "$LINUX_OBJ/$LINUX_SYMBOLS"; then
68 AC_MSG_ERROR([
69 *** Please make sure the kernel devel package for your distribution
7a8a6393 70 *** is installed. If you are building with a custom kernel, make sure the
912fd84d
BB
71 *** kernel is configured, built, and the '--with-linux=PATH' configure
72 *** option refers to the location of the kernel source.])
73 fi
86933a6e 74 else
bb339d06 75 LINUX_SYMBOLS=NONE
86933a6e
BB
76 fi
77 AC_MSG_RESULT($LINUX_SYMBOLS)
78 AC_SUBST(LINUX_SYMBOLS)
79])
80
57d86234 81AC_DEFUN([SPL_AC_KERNEL], [
57d86234 82 AC_ARG_WITH([linux],
83 AS_HELP_STRING([--with-linux=PATH],
84 [Path to kernel source]),
39a3d2a4 85 [kernelsrc="$withval"])
57d86234 86
87 AC_ARG_WITH([linux-obj],
88 AS_HELP_STRING([--with-linux-obj=PATH],
89 [Path to kernel build objects]),
90 [kernelbuild="$withval"])
91
92 AC_MSG_CHECKING([kernel source directory])
93 if test -z "$kernelsrc"; then
22ccfaa8
BB
94 if test -e "/lib/modules/$(uname -r)/source"; then
95 headersdir="/lib/modules/$(uname -r)/source"
96 sourcelink=$(readlink -f "$headersdir")
97 elif test -e "/lib/modules/$(uname -r)/build"; then
98 headersdir="/lib/modules/$(uname -r)/build"
534c4e38
BM
99 sourcelink=$(readlink -f "$headersdir")
100 else
101 sourcelink=$(ls -1d /usr/src/kernels/* \
723aa3b0 102 /usr/src/linux-* \
534c4e38
BM
103 2>/dev/null | grep -v obj | tail -1)
104 fi
57d86234 105
8fd4e3af 106 if test -n "$sourcelink" && test -e ${sourcelink}; then
d4326403 107 kernelsrc=`readlink -f ${sourcelink}`
d4326403 108 else
251677e9 109 kernelsrc="[Not found]"
57d86234 110 fi
c5f70460
BB
111 else
112 if test "$kernelsrc" = "NONE"; then
113 kernsrcver=NONE
114 fi
57d86234 115 fi
116
117 AC_MSG_RESULT([$kernelsrc])
251677e9
BB
118 if test ! -d "$kernelsrc"; then
119 AC_MSG_ERROR([
120 *** Please make sure the kernel devel package for your distribution
7a8a6393 121 *** is installed and then try again. If that fails, you can specify the
251677e9
BB
122 *** location of the kernel source with the '--with-linux=PATH' option.])
123 fi
124
57d86234 125 AC_MSG_CHECKING([kernel build directory])
39a3d2a4 126 if test -z "$kernelbuild"; then
22ccfaa8
BB
127 if test -e "/lib/modules/$(uname -r)/build"; then
128 kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
129 elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
e2d28a37
BB
130 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
131 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
132 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
133 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
134 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
39a3d2a4
BB
135 else
136 kernelbuild=${kernelsrc}
137 fi
bf338d8d 138 fi
57d86234 139 AC_MSG_RESULT([$kernelbuild])
140
141 AC_MSG_CHECKING([kernel source version])
fd921c2e
BB
142 utsrelease1=$kernelbuild/include/linux/version.h
143 utsrelease2=$kernelbuild/include/linux/utsrelease.h
144 utsrelease3=$kernelbuild/include/generated/utsrelease.h
145 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
146 utsrelease=linux/version.h
147 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
148 utsrelease=linux/utsrelease.h
149 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
150 utsrelease=generated/utsrelease.h
151 fi
57d86234 152
fd921c2e
BB
153 if test "$utsrelease"; then
154 kernsrcver=`(echo "#include <$utsrelease>";
57d86234 155 echo "kernsrcver=UTS_RELEASE") |
d4326403 156 cpp -I $kernelbuild/include |
57d86234 157 grep "^kernsrcver=" | cut -d \" -f 2`
57d86234 158
fd921c2e
BB
159 if test -z "$kernsrcver"; then
160 AC_MSG_RESULT([Not found])
161 AC_MSG_ERROR([*** Cannot determine kernel version.])
162 fi
163 else
57d86234 164 AC_MSG_RESULT([Not found])
0408008b
ED
165 if test "x$enable_linux_builtin" != xyes; then
166 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
167 else
168 AC_MSG_ERROR([
169 *** Cannot find UTS_RELEASE definition.
170 *** Please run 'make prepare' inside the kernel source tree.])
171 fi
57d86234 172 fi
173
174 AC_MSG_RESULT([$kernsrcver])
175
57d86234 176 LINUX=${kernelsrc}
177 LINUX_OBJ=${kernelbuild}
c5f70460
BB
178 LINUX_VERSION=${kernsrcver}
179
57d86234 180 AC_SUBST(LINUX)
181 AC_SUBST(LINUX_OBJ)
c5f70460 182 AC_SUBST(LINUX_VERSION)
57d86234 183
86933a6e 184 SPL_AC_MODULE_SYMVERS
2e0e7e69
BB
185])
186
287b2fb1
BB
187dnl #
188dnl # Default SPL user configuration
189dnl #
ad35b6a6 190AC_DEFUN([SPL_AC_CONFIG_USER], [])
287b2fb1
BB
191
192dnl #
193dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
7a8a6393 194dnl # are missing, it is non-fatal, but you will not be able to build
287b2fb1
BB
195dnl # RPM packages and will be warned if you try too.
196dnl #
7a8a6393 197dnl # By default, the generic spec file will be used because it requires
493972c8
BB
198dnl # minimal dependencies. Distribution specific spec files can be
199dnl # placed under the 'rpm/<distribution>' directory and enabled using
200dnl # the --with-spec=<distribution> configure option.
201dnl #
287b2fb1
BB
202AC_DEFUN([SPL_AC_RPM], [
203 RPM=rpm
204 RPMBUILD=rpmbuild
205
206 AC_MSG_CHECKING([whether $RPM is available])
207 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
208 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
209 HAVE_RPM=yes
210 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
211 ],[
212 HAVE_RPM=no
213 AC_MSG_RESULT([$HAVE_RPM])
214 ])
215
216 AC_MSG_CHECKING([whether $RPMBUILD is available])
217 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
218 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
219 HAVE_RPMBUILD=yes
220 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
221 ],[
222 HAVE_RPMBUILD=no
223 AC_MSG_RESULT([$HAVE_RPMBUILD])
224 ])
225
493972c8
BB
226 RPM_DEFINE_COMMON='--define "$(DEBUG_SPL) 1" --define "$(DEBUG_LOG) 1" --define "$(DEBUG_KMEM) 1" --define "$(DEBUG_KMEM_TRACKING) 1"'
227 RPM_DEFINE_UTIL=
228 RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"'
229 RPM_DEFINE_DKMS=
230
231 SRPM_DEFINE_COMMON='--define "build_src_rpm 1"'
232 SRPM_DEFINE_UTIL=
233 SRPM_DEFINE_KMOD=
234 SRPM_DEFINE_DKMS=
235
236 RPM_SPEC_DIR="rpm/generic"
237 AC_ARG_WITH([spec],
238 AS_HELP_STRING([--with-spec=SPEC],
239 [Spec files 'generic|fedora']),
240 [RPM_SPEC_DIR="rpm/$withval"])
241
242 AC_MSG_CHECKING([whether spec files are available])
243 AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)])
244
287b2fb1
BB
245 AC_SUBST(HAVE_RPM)
246 AC_SUBST(RPM)
247 AC_SUBST(RPM_VERSION)
248
249 AC_SUBST(HAVE_RPMBUILD)
250 AC_SUBST(RPMBUILD)
251 AC_SUBST(RPMBUILD_VERSION)
493972c8
BB
252
253 AC_SUBST(RPM_SPEC_DIR)
254 AC_SUBST(RPM_DEFINE_UTIL)
255 AC_SUBST(RPM_DEFINE_KMOD)
256 AC_SUBST(RPM_DEFINE_DKMS)
257 AC_SUBST(RPM_DEFINE_COMMON)
258 AC_SUBST(SRPM_DEFINE_UTIL)
259 AC_SUBST(SRPM_DEFINE_KMOD)
260 AC_SUBST(SRPM_DEFINE_DKMS)
261 AC_SUBST(SRPM_DEFINE_COMMON)
287b2fb1
BB
262])
263
264dnl #
265dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
266dnl # tools are missing it is non-fatal but you will not be able to build
267dnl # DEB packages and will be warned if you try too.
268dnl #
269AC_DEFUN([SPL_AC_DPKG], [
270 DPKG=dpkg
271 DPKGBUILD=dpkg-buildpackage
272
273 AC_MSG_CHECKING([whether $DPKG is available])
274 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
275 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
276 HAVE_DPKG=yes
277 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
278 ],[
279 HAVE_DPKG=no
280 AC_MSG_RESULT([$HAVE_DPKG])
281 ])
282
283 AC_MSG_CHECKING([whether $DPKGBUILD is available])
284 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
285 DPKGBUILD_VERSION=$(echo $tmp | \
286 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
287 HAVE_DPKGBUILD=yes
288 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
289 ],[
290 HAVE_DPKGBUILD=no
291 AC_MSG_RESULT([$HAVE_DPKGBUILD])
292 ])
293
294 AC_SUBST(HAVE_DPKG)
295 AC_SUBST(DPKG)
296 AC_SUBST(DPKG_VERSION)
297
298 AC_SUBST(HAVE_DPKGBUILD)
299 AC_SUBST(DPKGBUILD)
300 AC_SUBST(DPKGBUILD_VERSION)
301])
302
303dnl #
304dnl # Until native packaging for various different packing systems
305dnl # can be added the least we can do is attempt to use alien to
306dnl # convert the RPM packages to the needed package type. This is
307dnl # a hack but so far it has worked reasonable well.
308dnl #
309AC_DEFUN([SPL_AC_ALIEN], [
310 ALIEN=alien
311
312 AC_MSG_CHECKING([whether $ALIEN is available])
313 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
314 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
315 HAVE_ALIEN=yes
316 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
317 ],[
318 HAVE_ALIEN=no
319 AC_MSG_RESULT([$HAVE_ALIEN])
320 ])
321
322 AC_SUBST(HAVE_ALIEN)
323 AC_SUBST(ALIEN)
324 AC_SUBST(ALIEN_VERSION)
325])
326
327dnl #
328dnl # Using the VENDOR tag from config.guess set the default
329dnl # package type for 'make pkg': (rpm | deb | tgz)
330dnl #
331AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
73fc084e 332 AC_MSG_CHECKING([linux distribution])
a3a69b74
BB
333 if test -f /etc/toss-release ; then
334 VENDOR=toss ;
73fc084e
BB
335 elif test -f /etc/fedora-release ; then
336 VENDOR=fedora ;
a3a69b74
BB
337 elif test -f /etc/redhat-release ; then
338 VENDOR=redhat ;
339 elif test -f /etc/gentoo-release ; then
340 VENDOR=gentoo ;
cd2817f8
PS
341 elif test -f /etc/arch-release ; then
342 VENDOR=arch ;
73fc084e
BB
343 elif test -f /etc/SuSE-release ; then
344 VENDOR=sles ;
345 elif test -f /etc/slackware-version ; then
346 VENDOR=slackware ;
a3a69b74
BB
347 elif test -f /etc/lunar.release ; then
348 VENDOR=lunar ;
349 elif test -f /etc/lsb-release ; then
350 VENDOR=ubuntu ;
351 elif test -f /etc/debian_version ; then
352 VENDOR=debian ;
73fc084e
BB
353 else
354 VENDOR= ;
355 fi
356 AC_MSG_RESULT([$VENDOR])
357 AC_SUBST(VENDOR)
287b2fb1
BB
358
359 AC_MSG_CHECKING([default package type])
360 case "$VENDOR" in
a3a69b74
BB
361 toss) DEFAULT_PACKAGE=rpm ;;
362 redhat) DEFAULT_PACKAGE=rpm ;;
363 fedora) DEFAULT_PACKAGE=rpm ;;
364 gentoo) DEFAULT_PACKAGE=tgz ;;
5f0a4b08 365 arch) DEFAULT_PACKAGE=tgz ;;
a3a69b74
BB
366 sles) DEFAULT_PACKAGE=rpm ;;
367 slackware) DEFAULT_PACKAGE=tgz ;;
368 lunar) DEFAULT_PACKAGE=tgz ;;
369 ubuntu) DEFAULT_PACKAGE=deb ;;
370 debian) DEFAULT_PACKAGE=deb ;;
371 *) DEFAULT_PACKAGE=rpm ;;
287b2fb1
BB
372 esac
373
374 AC_MSG_RESULT([$DEFAULT_PACKAGE])
375 AC_SUBST(DEFAULT_PACKAGE)
376])
377
378dnl #
379dnl # Default SPL user configuration
380dnl #
381AC_DEFUN([SPL_AC_PACKAGE], [
0b14b9f3 382 SPL_AC_DEFAULT_PACKAGE
287b2fb1
BB
383 SPL_AC_RPM
384 SPL_AC_DPKG
385 SPL_AC_ALIEN
287b2fb1
BB
386])
387
6a1c3d41 388AC_DEFUN([SPL_AC_LICENSE], [
62032954
BB
389 AC_MSG_CHECKING([spl author])
390 AC_MSG_RESULT([$SPL_META_AUTHOR])
391
86933a6e 392 AC_MSG_CHECKING([spl license])
62032954 393 AC_MSG_RESULT([$SPL_META_LICENSE])
86933a6e
BB
394])
395
396AC_DEFUN([SPL_AC_CONFIG], [
0408008b
ED
397 SPL_CONFIG=all
398 AC_ARG_WITH([config],
399 AS_HELP_STRING([--with-config=CONFIG],
400 [Config file 'kernel|user|all|srpm']),
401 [SPL_CONFIG="$withval"])
402 AC_ARG_ENABLE([linux-builtin],
403 [AC_HELP_STRING([--enable-linux-builtin],
404 [Configure for builtin in-tree kernel modules @<:@default=no@:>@])],
405 [],
406 [enable_linux_builtin=no])
407
408 AC_MSG_CHECKING([spl config])
409 AC_MSG_RESULT([$SPL_CONFIG]);
410 AC_SUBST(SPL_CONFIG)
411
412 case "$SPL_CONFIG" in
413 kernel) SPL_AC_CONFIG_KERNEL ;;
414 user) SPL_AC_CONFIG_USER ;;
415 all) SPL_AC_CONFIG_KERNEL
416 SPL_AC_CONFIG_USER ;;
c1541dfe 417 srpm) ;;
0408008b
ED
418 *)
419 AC_MSG_RESULT([Error!])
420 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
421 user kernel|user|all|srpm]) ;;
422 esac
423
424 AM_CONDITIONAL([CONFIG_USER],
425 [test "$SPL_CONFIG" = user -o "$SPL_CONFIG" = all])
426 AM_CONDITIONAL([CONFIG_KERNEL],
427 [test "$SPL_CONFIG" = kernel -o "$SPL_CONFIG" = all] &&
428 [test "x$enable_linux_builtin" != xyes ])
6a1c3d41 429])
430
055ffd98
BB
431dnl #
432dnl # Enable if the SPL should be compiled with internal debugging enabled.
433dnl # By default this support is disabled.
434dnl #
57d86234 435AC_DEFUN([SPL_AC_DEBUG], [
c950d148 436 AC_MSG_CHECKING([whether debugging is enabled])
055ffd98
BB
437 AC_ARG_ENABLE([debug],
438 [AS_HELP_STRING([--enable-debug],
439 [Enable generic debug support @<:@default=no@:>@])],
440 [],
441 [enable_debug=no])
442
443 AS_IF([test "x$enable_debug" = xyes],
c950d148 444 [
c950d148
BB
445 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
446 DEBUG_CFLAGS="-DDEBUG -Werror"
3c208a54
BB
447 DEBUG_SPL="_with_debug"
448 ], [
c950d148
BB
449 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
450 DEBUG_CFLAGS="-DNDEBUG"
3c208a54 451 DEBUG_SPL="_without_debug"
c950d148 452 ])
055ffd98 453
c950d148 454 AC_SUBST(DEBUG_CFLAGS)
3c208a54 455 AC_SUBST(DEBUG_SPL)
055ffd98 456 AC_MSG_RESULT([$enable_debug])
57d86234 457])
458
4b2220f0
BB
459dnl #
460dnl # Enabled by default it provides a basic debug log infrastructure.
461dnl # Each subsystem registers itself with a name and logs messages
462dnl # using predefined types. If the debug mask it set to allow the
463dnl # message type it will be written to the internal log. The log
464dnl # can be dumped to a file by echoing 1 to the 'dump' proc entry,
465dnl # after dumping the log it must be decoded using the spl utility.
466dnl #
467dnl # echo 1 >/proc/sys/kernel/spl/debug/dump
468dnl # spl /tmp/spl-log.xxx.yyy /tmp/spl-log.xxx.yyy.txt
469dnl #
470AC_DEFUN([SPL_AC_DEBUG_LOG], [
471 AC_ARG_ENABLE([debug-log],
472 [AS_HELP_STRING([--enable-debug-log],
473 [Enable basic debug logging @<:@default=yes@:>@])],
474 [],
475 [enable_debug_log=yes])
476
477 AS_IF([test "x$enable_debug_log" = xyes],
3c208a54
BB
478 [
479 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_LOG"
480 DEBUG_LOG="_with_debug_log"
481 AC_DEFINE([DEBUG_LOG], [1],
4b2220f0 482 [Define to 1 to enable basic debug logging])
3c208a54
BB
483 ], [
484 DEBUG_LOG="_without_debug_log"
485 ])
4b2220f0 486
3c208a54 487 AC_SUBST(DEBUG_LOG)
4b2220f0
BB
488 AC_MSG_CHECKING([whether basic debug logging is enabled])
489 AC_MSG_RESULT([$enable_debug_log])
490])
491
055ffd98
BB
492dnl #
493dnl # Enabled by default it provides a minimal level of memory tracking.
494dnl # A total count of bytes allocated is kept for each alloc and free.
495dnl # Then at module unload time a report to the console will be printed
496dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
497dnl # and provide an easy way to inspect the kmem based slab.
498dnl #
57d86234 499AC_DEFUN([SPL_AC_DEBUG_KMEM], [
055ffd98
BB
500 AC_ARG_ENABLE([debug-kmem],
501 [AS_HELP_STRING([--enable-debug-kmem],
502 [Enable basic kmem accounting @<:@default=yes@:>@])],
503 [],
504 [enable_debug_kmem=yes])
57d86234 505
055ffd98 506 AS_IF([test "x$enable_debug_kmem" = xyes],
3c208a54
BB
507 [
508 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
509 DEBUG_KMEM="_with_debug_kmem"
510 AC_DEFINE([DEBUG_KMEM], [1],
055ffd98 511 [Define to 1 to enable basic kmem accounting])
3c208a54
BB
512 ], [
513 DEBUG_KMEM="_without_debug_kmem"
514 ])
055ffd98 515
3c208a54 516 AC_SUBST(DEBUG_KMEM)
055ffd98
BB
517 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
518 AC_MSG_RESULT([$enable_debug_kmem])
57d86234 519])
520
055ffd98
BB
521dnl #
522dnl # Disabled by default it provides detailed memory tracking. This
523dnl # feature also requires --enable-debug-kmem to be set. When enabled
524dnl # not only will total bytes be tracked but also the location of every
525dnl # alloc and free. When the SPL module is unloaded a list of all leaked
526dnl # addresses and where they were allocated will be dumped to the console.
527dnl # Enabling this feature has a significant impact on performance but it
528dnl # makes finding memory leaks pretty straight forward.
529dnl #
530AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
531 AC_ARG_ENABLE([debug-kmem-tracking],
532 [AS_HELP_STRING([--enable-debug-kmem-tracking],
533 [Enable detailed kmem tracking @<:@default=no@:>@])],
534 [],
535 [enable_debug_kmem_tracking=no])
536
537 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
3c208a54
BB
538 [
539 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"
540 DEBUG_KMEM_TRACKING="_with_debug_kmem_tracking"
541 AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
055ffd98 542 [Define to 1 to enable detailed kmem tracking])
3c208a54
BB
543 ], [
544 DEBUG_KMEM_TRACKING="_without_debug_kmem_tracking"
545 ])
055ffd98 546
3c208a54 547 AC_SUBST(DEBUG_KMEM_TRACKING)
055ffd98
BB
548 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
549 AC_MSG_RESULT([$enable_debug_kmem_tracking])
57d86234 550])
551
552dnl #
553dnl # SPL_LINUX_CONFTEST
554dnl #
555AC_DEFUN([SPL_LINUX_CONFTEST], [
dbe561d8 556cat confdefs.h - <<_ACEOF >conftest.c
57d86234 557$1
558_ACEOF
559])
560
561dnl #
562dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
563dnl #
564m4_define([SPL_LANG_PROGRAM], [
565$1
566int
567main (void)
568{
569dnl Do *not* indent the following line: there may be CPP directives.
570dnl Don't move the `;' right after for the same reason.
571$2
572 ;
573 return 0;
574}
575])
576
577dnl #
578dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
579dnl #
580AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
c5f70460 581 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
df7cc5bc 582 rm -Rf build && mkdir -p build && touch build/conftest.mod.c
c5f70460 583 echo "obj-m := conftest.o" >build/Makefile
df7cc5bc
ED
584 modpost_flag=''
585 test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
c5f70460 586 AS_IF(
df7cc5bc
ED
587 [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])],
588 [$4],
589 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
c5f70460
BB
590 )
591 rm -Rf build
57d86234 592])
593
594dnl #
595dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
596dnl #
597AC_DEFUN([SPL_LINUX_TRY_COMPILE],
598 [SPL_LINUX_COMPILE_IFELSE(
d50bd9e2 599 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
600 [modules],
601 [test -s build/conftest.o],
602 [$3], [$4])
57d86234 603])
604
57d86234 605dnl #
606dnl # SPL_CHECK_SYMBOL_EXPORT
607dnl # check symbol exported or not
608dnl #
723aa3b0 609AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], [
2e0e7e69
BB
610 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
611 $LINUX_OBJ/Module*.symvers 2>/dev/null
57d86234 612 rc=$?
613 if test $rc -ne 0; then
614 export=0
615 for file in $2; do
2e0e7e69
BB
616 grep -q -E "EXPORT_SYMBOL.*($1)" \
617 "$LINUX_OBJ/$file" 2>/dev/null
57d86234 618 rc=$?
723aa3b0
ED
619 if test $rc -eq 0; then
620 export=1
621 break;
622 fi
57d86234 623 done
723aa3b0 624 if test $export -eq 0; then :
57d86234 625 $4
723aa3b0 626 else :
57d86234 627 $3
628 fi
723aa3b0 629 else :
57d86234 630 $3
631 fi
632])
633
723aa3b0
ED
634dnl #
635dnl # SPL_LINUX_TRY_COMPILE_SYMBOL
636dnl # like SPL_LINUX_TRY_COMPILE, except SPL_CHECK_SYMBOL_EXPORT
637dnl # is called if not compiling for builtin
638dnl #
639AC_DEFUN([SPL_LINUX_TRY_COMPILE_SYMBOL], [
640 SPL_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
641 if test $rc -ne 0; then :
642 $6
643 else
644 if test "x$enable_linux_builtin" != xyes; then
645 SPL_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1])
646 fi
647 if test $rc -ne 0; then :
648 $6
649 else :
650 $5
651 fi
652 fi
653])
654
12ff95ff
BB
655dnl #
656dnl # SPL_CHECK_SYMBOL_HEADER
657dnl # check if a symbol prototype is defined in listed headers.
658dnl #
659AC_DEFUN([SPL_CHECK_SYMBOL_HEADER], [
660 AC_MSG_CHECKING([whether symbol $1 exists in header])
661 header=0
662 for file in $3; do
663 grep -q "$2" "$LINUX/$file" 2>/dev/null
664 rc=$?
723aa3b0
ED
665 if test $rc -eq 0; then
666 header=1
667 break;
668 fi
12ff95ff
BB
669 done
670 if test $header -eq 0; then
671 AC_MSG_RESULT([no])
672 $5
673 else
674 AC_MSG_RESULT([yes])
675 $4
676 fi
677])
678
86de8532 679dnl #
680dnl # SPL_CHECK_HEADER
681dnl # check whether header exists and define HAVE_$2_HEADER
682dnl #
683AC_DEFUN([SPL_CHECK_HEADER],
684 [AC_MSG_CHECKING([whether header $1 exists])
685 SPL_LINUX_TRY_COMPILE([
d50bd9e2 686 #include <$1>
86de8532 687 ],[
688 return 0;
689 ],[
690 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
691 AC_MSG_RESULT(yes)
692 $3
693 ],[
694 AC_MSG_RESULT(no)
695 $4
696 ])
697])
6a6cafbe 698
0408008b 699dnl #
62032954
BB
700dnl # Basic toolchain sanity check. Verify that kernel modules can
701dnl # be built and which symbols can be used.
0408008b
ED
702dnl #
703AC_DEFUN([SPL_AC_TEST_MODULE],
704 [AC_MSG_CHECKING([whether modules can be built])
705 SPL_LINUX_TRY_COMPILE([],[],[
706 AC_MSG_RESULT([yes])
707 ],[
708 AC_MSG_RESULT([no])
709 if test "x$enable_linux_builtin" != xyes; then
710 AC_MSG_ERROR([*** Unable to build an empty module.])
711 else
712 AC_MSG_ERROR([
713 *** Unable to build an empty module.
714 *** Please run 'make scripts' inside the kernel source tree.])
715 fi
716 ])
62032954
BB
717
718 AC_RUN_IFELSE([
719 AC_LANG_PROGRAM([
720 #include "$LINUX/include/linux/license.h"
721 ], [
722 return !license_is_gpl_compatible("$SPL_META_LICENSE");
723 ])
724 ], [
725 AC_DEFINE([SPL_IS_GPL_COMPATIBLE], [1],
726 [Define to 1 if GPL-only symbols can be used])
727 ], [
728 ])
0408008b
ED
729])
730
57d86234 731dnl #
d04c8a56
BB
732dnl # Use the atomic implemenation based on global spinlocks. This
733dnl # should only be needed by 32-bit kernels which do not provide
734dnl # the atomic64_* API. It may be optionally enabled as a fallback
735dnl # if problems are observed with the direct mapping to the native
736dnl # Linux atomic operations. You may not disable atomic spinlocks
737dnl # if you kernel does not an atomic64_* API.
57d86234 738dnl #
d04c8a56
BB
739AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
740 AC_ARG_ENABLE([atomic-spinlocks],
741 [AS_HELP_STRING([--enable-atomic-spinlocks],
742 [Atomic types use spinlocks @<:@default=check@:>@])],
743 [],
744 [enable_atomic_spinlocks=check])
57d86234 745
a0f6da3d 746 SPL_LINUX_TRY_COMPILE([
dd3678fc 747 #include <linux/fs.h>
a0f6da3d 748 ],[
03318641 749 atomic64_t *ptr __attribute__ ((unused));
a0f6da3d 750 ],[
d04c8a56 751 have_atomic64_t=yes
a0f6da3d 752 AC_DEFINE(HAVE_ATOMIC64_T, 1,
d04c8a56 753 [kernel defines atomic64_t])
a0f6da3d 754 ],[
d04c8a56
BB
755 have_atomic64_t=no
756 ])
757
758 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
759 AS_IF([test "x$have_atomic64_t" = xyes], [
760 enable_atomic_spinlocks=no
761 ],[
762 enable_atomic_spinlocks=yes
763 ])
a0f6da3d 764 ])
d04c8a56
BB
765
766 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
767 AC_DEFINE([ATOMIC_SPINLOCK], [1],
768 [Atomic types use spinlocks])
769 ],[
770 AS_IF([test "x$have_atomic64_t" = xno], [
771 AC_MSG_FAILURE(
772 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
773 ])
774 ])
775
776 AC_MSG_CHECKING([whether atomic types use spinlocks])
777 AC_MSG_RESULT([$enable_atomic_spinlocks])
778
779 AC_MSG_CHECKING([whether kernel defines atomic64_t])
780 AC_MSG_RESULT([$have_atomic64_t])
a0f6da3d 781])
782
c3d9c0df 783AC_DEFUN([SPL_AC_SHRINKER_CALLBACK],[
23aa63cb
BB
784 tmp_flags="$EXTRA_KCFLAGS"
785 EXTRA_KCFLAGS="-Werror"
c3d9c0df
RY
786 dnl #
787 dnl # 2.6.23 to 2.6.34 API change
788 dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
789 dnl #
790 AC_MSG_CHECKING([whether old 2-argument shrinker exists])
23aa63cb
BB
791 SPL_LINUX_TRY_COMPILE([
792 #include <linux/mm.h>
793
c3d9c0df 794 int shrinker_cb(int nr_to_scan, gfp_t gfp_mask);
23aa63cb
BB
795 ],[
796 struct shrinker cache_shrinker = {
797 .shrink = shrinker_cb,
798 .seeks = DEFAULT_SEEKS,
799 };
800 register_shrinker(&cache_shrinker);
801 ],[
802 AC_MSG_RESULT(yes)
c3d9c0df
RY
803 AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1,
804 [old shrinker callback wants 2 args])
23aa63cb
BB
805 ],[
806 AC_MSG_RESULT(no)
c3d9c0df
RY
807 dnl #
808 dnl # 2.6.35 - 2.6.39 API change
809 dnl # ->shrink(struct shrinker *,
810 dnl # int nr_to_scan, gfp_t gfp_mask)
811 dnl #
812 AC_MSG_CHECKING([whether old 3-argument shrinker exists])
813 SPL_LINUX_TRY_COMPILE([
814 #include <linux/mm.h>
815
816 int shrinker_cb(struct shrinker *, int nr_to_scan,
817 gfp_t gfp_mask);
818 ],[
819 struct shrinker cache_shrinker = {
820 .shrink = shrinker_cb,
821 .seeks = DEFAULT_SEEKS,
822 };
823 register_shrinker(&cache_shrinker);
824 ],[
825 AC_MSG_RESULT(yes)
826 AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
827 [old shrinker callback wants 3 args])
828 ],[
829 AC_MSG_RESULT(no)
830 dnl #
831 dnl # 3.0 - 3.11 API change
832 dnl # ->shrink(struct shrinker *,
833 dnl # struct shrink_control *sc)
834 dnl #
835 AC_MSG_CHECKING(
836 [whether new 2-argument shrinker exists])
837 SPL_LINUX_TRY_COMPILE([
838 #include <linux/mm.h>
839
840 int shrinker_cb(struct shrinker *,
841 struct shrink_control *sc);
842 ],[
843 struct shrinker cache_shrinker = {
844 .shrink = shrinker_cb,
845 .seeks = DEFAULT_SEEKS,
846 };
847 register_shrinker(&cache_shrinker);
848 ],[
849 AC_MSG_RESULT(yes)
850 AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
851 [new shrinker callback wants 2 args])
852 ],[
853 AC_MSG_RESULT(no)
854 dnl #
855 dnl # 3.12 API change,
856 dnl # ->shrink() is logically split in to
857 dnl # ->count_objects() and ->scan_objects()
858 dnl #
859 AC_MSG_CHECKING(
860 [whether ->count_objects callback exists])
861 SPL_LINUX_TRY_COMPILE([
862 #include <linux/mm.h>
863
864 unsigned long shrinker_cb(
865 struct shrinker *,
866 struct shrink_control *sc);
867 ],[
868 struct shrinker cache_shrinker = {
869 .count_objects = shrinker_cb,
870 .scan_objects = shrinker_cb,
871 .seeks = DEFAULT_SEEKS,
872 };
873 register_shrinker(&cache_shrinker);
874 ],[
875 AC_MSG_RESULT(yes)
876 AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
877 1, [->count_objects exists])
878 ],[
879 AC_MSG_ERROR(error)
880 ])
881 ])
882 ])
23aa63cb
BB
883 ])
884 EXTRA_KCFLAGS="$tmp_flags"
885])
886
79a3bf13
BB
887dnl #
888dnl # 2.6.33 API change,
889dnl # Removed .ctl_name from struct ctl_table.
890dnl #
891AC_DEFUN([SPL_AC_CTL_NAME], [
892 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
893 SPL_LINUX_TRY_COMPILE([
894 #include <linux/sysctl.h>
895 ],[
03318641 896 struct ctl_table ctl __attribute__ ((unused));
79a3bf13
BB
897 ctl.ctl_name = 0;
898 ],[
899 AC_MSG_RESULT(yes)
900 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
901 ],[
902 AC_MSG_RESULT(no)
903 ])
904])
905
4d54fdee
BB
906dnl #
907dnl # 2.6.29 API change,
a80d69ca
BB
908dnl # Adaptive mutexs were introduced which track the mutex owner. The
909dnl # mutex wrappers leverage this functionality to avoid tracking the
910dnl # owner multipe times.
4d54fdee
BB
911dnl #
912AC_DEFUN([SPL_AC_MUTEX_OWNER], [
913 AC_MSG_CHECKING([whether struct mutex has owner])
914 SPL_LINUX_TRY_COMPILE([
915 #include <linux/mutex.h>
916 ],[
03318641 917 struct mutex mtx __attribute__ ((unused));
4d54fdee
BB
918 mtx.owner = NULL;
919 ],[
920 AC_MSG_RESULT(yes)
921 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
922 ],[
923 AC_MSG_RESULT(no)
924 ])
925])
926
86fd39f3
BB
927dnl #
928dnl # 2.6.39 API change,
929dnl # Owner type change. A Linux mutex prior to 2.6.39 would store
930dnl # the owner as a thread_info pointer when CONFIG_DEBUG_MUTEXES
931dnl # was defined. As of 2.6.39 this was changed to a task_struct
932dnl # pointer which frankly makes a lot more sense.
933dnl #
934AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [
935 AC_MSG_CHECKING([whether struct mutex owner is a task_struct])
936 tmp_flags="$EXTRA_KCFLAGS"
937 EXTRA_KCFLAGS="-Werror"
938 SPL_LINUX_TRY_COMPILE([
939 #include <linux/mutex.h>
a0625691 940 #include <linux/sched.h>
86fd39f3
BB
941 ],[
942 struct mutex mtx __attribute__ ((unused));
943 mtx.owner = current;
944 ],[
945 AC_MSG_RESULT(yes)
946 AC_DEFINE(HAVE_MUTEX_OWNER_TASK_STRUCT, 1,
947 [struct mutex owner is a task_struct])
948 ],[
949 AC_MSG_RESULT(no)
950 ])
951 EXTRA_KCFLAGS="$tmp_flags"
952])
953
1ddf9722
YS
954dnl #
955dnl # 3.10 API change,
956dnl # PDE is replaced by PDE_DATA
957dnl #
958AC_DEFUN([SPL_AC_PDE_DATA], [
959 AC_MSG_CHECKING([whether PDE_DATA() is available])
960 SPL_LINUX_TRY_COMPILE_SYMBOL([
961 #include <linux/proc_fs.h>
962 ], [
963 PDE_DATA(NULL);
964 ], [PDE_DATA], [], [
965 AC_MSG_RESULT(yes)
966 AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
967 ],[
968 AC_MSG_RESULT(no)
969 ])
970])
971
a54718cf
RY
972dnl #
973dnl # 3.9 API change
974dnl # set_fs_pwd takes const struct path *
975dnl #
976AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
a54718cf
RY
977 tmp_flags="$EXTRA_KCFLAGS"
978 EXTRA_KCFLAGS="-Werror"
979 [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
980 SPL_LINUX_TRY_COMPILE([
981 #include <linux/spinlock.h>
982 #include <linux/fs_struct.h>
983 #include <linux/path.h>
984 void (*const set_fs_pwd_func)
985 (struct fs_struct *, const struct path *)
986 = set_fs_pwd;
987 ],[
988 return 0;
989 ],[
990 AC_MSG_RESULT(yes)
991 AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
992 [set_fs_pwd() needs const path *])
993 ],[
994 SPL_LINUX_TRY_COMPILE([
995 #include <linux/spinlock.h>
996 #include <linux/fs_struct.h>
997 #include <linux/path.h>
998 void (*const set_fs_pwd_func)
999 (struct fs_struct *, struct path *)
1000 = set_fs_pwd;
1001 ],[
1002 return 0;
1003 ],[
1004 AC_MSG_RESULT(no)
1005 ],[
1006 AC_MSG_ERROR(unknown)
1007 ])
1008 ])
1009 EXTRA_KCFLAGS="$tmp_flags"
a54718cf
RY
1010])
1011
e39174ed
BB
1012dnl #
1013dnl # 3.13 API change
1014dnl # vfs_unlink() updated to take a third delegated_inode argument.
1015dnl #
a093c6a4
BB
1016AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1017 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1018 SPL_LINUX_TRY_COMPILE([
1019 #include <linux/fs.h>
1020 ],[
50a0749e 1021 vfs_unlink((struct inode *) NULL, (struct dentry *) NULL);
a093c6a4
BB
1022 ],[
1023 AC_MSG_RESULT(yes)
1024 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1025 [vfs_unlink() wants 2 args])
1026 ],[
1027 AC_MSG_RESULT(no)
50a0749e
RY
1028 dnl #
1029 dnl # Linux 3.13 API change
1030 dnl # Added delegated inode
1031 dnl #
1032 AC_MSG_CHECKING([whether vfs_unlink() wants 3 args])
1033 SPL_LINUX_TRY_COMPILE([
1034 #include <linux/fs.h>
1035 ],[
1036 vfs_unlink((struct inode *) NULL,
1037 (struct dentry *) NULL,
1038 (struct inode **) NULL);
1039 ],[
1040 AC_MSG_RESULT(yes)
1041 AC_DEFINE(HAVE_3ARGS_VFS_UNLINK, 1,
1042 [vfs_unlink() wants 3 args])
1043 ],[
1044 AC_MSG_ERROR(no)
1045 ])
1046
a093c6a4
BB
1047 ])
1048])
1049
e39174ed
BB
1050dnl #
1051dnl # 3.13 and 3.15 API changes
1052dnl # Added delegated inode and flags argument.
1053dnl #
a093c6a4
BB
1054AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1055 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1056 SPL_LINUX_TRY_COMPILE([
1057 #include <linux/fs.h>
1058 ],[
50a0749e
RY
1059 vfs_rename((struct inode *) NULL, (struct dentry *) NULL,
1060 (struct inode *) NULL, (struct dentry *) NULL);
a093c6a4
BB
1061 ],[
1062 AC_MSG_RESULT(yes)
1063 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1064 [vfs_rename() wants 4 args])
1065 ],[
1066 AC_MSG_RESULT(no)
50a0749e
RY
1067 dnl #
1068 dnl # Linux 3.13 API change
1069 dnl # Added delegated inode
1070 dnl #
1071 AC_MSG_CHECKING([whether vfs_rename() wants 5 args])
1072 SPL_LINUX_TRY_COMPILE([
1073 #include <linux/fs.h>
1074 ],[
1075 vfs_rename((struct inode *) NULL,
1076 (struct dentry *) NULL,
1077 (struct inode *) NULL,
1078 (struct dentry *) NULL,
1079 (struct inode **) NULL);
1080 ],[
1081 AC_MSG_RESULT(yes)
1082 AC_DEFINE(HAVE_5ARGS_VFS_RENAME, 1,
1083 [vfs_rename() wants 5 args])
1084 ],[
ad3412ef
CC
1085 AC_MSG_RESULT(no)
1086 dnl #
1087 dnl # Linux 3.15 API change
1088 dnl # Added flags
1089 dnl #
1090 AC_MSG_CHECKING([whether vfs_rename() wants 6 args])
1091 SPL_LINUX_TRY_COMPILE([
1092 #include <linux/fs.h>
1093 ],[
1094 vfs_rename((struct inode *) NULL,
1095 (struct dentry *) NULL,
1096 (struct inode *) NULL,
1097 (struct dentry *) NULL,
1098 (struct inode **) NULL,
1099 (unsigned int) 0);
1100 ],[
1101 AC_MSG_RESULT(yes)
1102 AC_DEFINE(HAVE_6ARGS_VFS_RENAME, 1,
1103 [vfs_rename() wants 6 args])
1104 ],[
1105 AC_MSG_ERROR(no)
1106 ])
50a0749e 1107 ])
a093c6a4
BB
1108 ])
1109])
ec7d53e9 1110
9b2048c2
BB
1111dnl #
1112dnl # 2.6.36 API change,
1113dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
1114dnl # a spinlock_t to improve the fastpath performance.
1115dnl #
1116AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
1117 AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
97fd6a07
BB
1118 tmp_flags="$EXTRA_KCFLAGS"
1119 EXTRA_KCFLAGS="-Werror"
9b2048c2
BB
1120 SPL_LINUX_TRY_COMPILE([
1121 #include <linux/sched.h>
1122 #include <linux/fs_struct.h>
1123 ],[
1124 struct fs_struct fs;
1125 spin_lock_init(&fs.lock);
1126 ],[
1127 AC_MSG_RESULT(yes)
1128 AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
1129 [struct fs_struct uses spinlock_t])
1130 ],[
1131 AC_MSG_RESULT(no)
1132 ])
97fd6a07 1133 EXTRA_KCFLAGS="$tmp_flags"
9b2048c2
BB
1134])
1135
f7fd6ddd
RY
1136dnl #
1137dnl # User namespaces, use kuid_t in place of uid_t
1138dnl # where available. Not strictly a user namespaces thing
1139dnl # but it should prevent surprises
1140dnl #
1141AC_DEFUN([SPL_AC_KUIDGID_T], [
1142 AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
1143 SPL_LINUX_TRY_COMPILE([
1144 #include <linux/uidgid.h>
1145 ], [
1146 kuid_t userid = KUIDT_INIT(0);
1147 kgid_t groupid = KGIDT_INIT(0);
1148 ],[
1149 SPL_LINUX_TRY_COMPILE([
1150 #include <linux/uidgid.h>
1151 ], [
1152 kuid_t userid = 0;
1153 kgid_t groupid = 0;
1154 ],[
1155 AC_MSG_RESULT(yes; optional)
1156 ],[
1157 AC_MSG_RESULT(yes; mandatory)
1158 AC_DEFINE(HAVE_KUIDGID_T, 1, [kuid_t/kgid_t in use])
1159 ])
1160 ],[
1161 AC_MSG_RESULT(no)
1162 ])
1163])
1164
e811949a
BB
1165dnl #
1166dnl # 2.6.x API change,
1167dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1168dnl #
723aa3b0
ED
1169AC_DEFUN([SPL_AC_PUT_TASK_STRUCT],
1170 [AC_MSG_CHECKING([whether __put_task_struct() is available])
1171 SPL_LINUX_TRY_COMPILE_SYMBOL([
1172 #include <linux/sched.h>
1173 ], [
1174 __put_task_struct(NULL);
1175 ], [__put_task_struct], [], [
1176 AC_MSG_RESULT(yes)
1177 AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1178 [__put_task_struct() is available])
1179 ], [
1180 AC_MSG_RESULT(no)
1181 ])
e811949a 1182])
3977f837
BB
1183
1184dnl #
1185dnl # 2.6.32 API change,
1186dnl # Unused 'struct file *' removed from prototype.
1187dnl #
1188AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
1189 AC_MSG_CHECKING([whether proc_handler() wants 5 args])
1190 SPL_LINUX_TRY_COMPILE([
1191 #include <linux/sysctl.h>
1192 ],[
1193 proc_dostring(NULL, 0, NULL, NULL, NULL);
1194 ],[
1195 AC_MSG_RESULT(yes)
1196 AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
1197 [proc_handler() wants 5 args])
1198 ],[
1199 AC_MSG_RESULT(no)
1200 ])
1201])
b868e22f
BB
1202
1203dnl #
1204dnl # 2.6.x API change,
1205dnl # kvasprintf() function added.
1206dnl #
723aa3b0
ED
1207AC_DEFUN([SPL_AC_KVASPRINTF],
1208 [AC_MSG_CHECKING([whether kvasprintf() is available])
1209 SPL_LINUX_TRY_COMPILE_SYMBOL([
1210 #include <linux/kernel.h>
1211 ], [
1212 kvasprintf(0, NULL, *((va_list*)NULL));
1213 ], [kvasprintf], [], [
1214 AC_MSG_RESULT(yes)
1215 AC_DEFINE(HAVE_KVASPRINTF, 1, [kvasprintf() is available])
1216 ], [
1217 AC_MSG_RESULT(no)
1218 ])
b868e22f 1219])
f0ff89fc 1220
0d0b5237
BB
1221dnl #
1222dnl # 2.6.29 API change,
1223dnl # vfs_fsync() funcation added, prior to this use file_fsync().
1224dnl #
723aa3b0
ED
1225AC_DEFUN([SPL_AC_VFS_FSYNC],
1226 [AC_MSG_CHECKING([whether vfs_fsync() is available])
1227 SPL_LINUX_TRY_COMPILE_SYMBOL([
1228 #include <linux/fs.h>
1229 ], [
1230 (void) vfs_fsync;
1231 ], [vfs_fsync], [fs/sync.c], [
1232 AC_MSG_RESULT(yes)
1233 AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available])
1234 ], [
1235 AC_MSG_RESULT(no)
1236 ])
0d0b5237
BB
1237])
1238
f0ff89fc
BB
1239dnl #
1240dnl # 2.6.35 API change,
0d0b5237 1241dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
f0ff89fc 1242dnl #
0d0b5237
BB
1243AC_DEFUN([SPL_AC_2ARGS_VFS_FSYNC], [
1244 AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
f0ff89fc 1245 SPL_LINUX_TRY_COMPILE([
0d0b5237 1246 #include <linux/fs.h>
f0ff89fc 1247 ],[
0d0b5237 1248 vfs_fsync(NULL, 0);
f0ff89fc
BB
1249 ],[
1250 AC_MSG_RESULT(yes)
0d0b5237 1251 AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args])
f0ff89fc
BB
1252 ],[
1253 AC_MSG_RESULT(no)
1254 ])
1255])
46aa7b39 1256
bbdc6ae4
ED
1257dnl #
1258dnl # 3.5 API change,
1259dnl # inode_operations.truncate_range removed
bbdc6ae4
ED
1260dnl #
1261AC_DEFUN([SPL_AC_INODE_TRUNCATE_RANGE], [
1262 AC_MSG_CHECKING([whether truncate_range() inode operation is available])
1263 SPL_LINUX_TRY_COMPILE([
1264 #include <linux/fs.h>
1265 ],[
1266 struct inode_operations ops;
1267 ops.truncate_range = NULL;
1268 ],[
1269 AC_MSG_RESULT(yes)
1270 AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
1271 [truncate_range() inode operation is available])
1272 ],[
1273 AC_MSG_RESULT(no)
1274 ])
1c7b3eaf
BB
1275])
1276
1277dnl #
1278dnl # Linux 2.6.38 - 3.x API
1279dnl #
1280AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [
1281 AC_MSG_CHECKING([whether fops->fallocate() exists])
1282 SPL_LINUX_TRY_COMPILE([
1283 #include <linux/fs.h>
1284 ],[
1285 long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
1286 struct file_operations fops __attribute__ ((unused)) = {
1287 .fallocate = fallocate,
1288 };
1289 ],[
1290 AC_MSG_RESULT(yes)
1291 AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
1292 ],[
1293 AC_MSG_RESULT(no)
1294 ])
1295])
1296
1297dnl #
1298dnl # Linux 2.6.x - 2.6.37 API
1299dnl #
1300AC_DEFUN([SPL_AC_KERNEL_INODE_FALLOCATE], [
1301 AC_MSG_CHECKING([whether iops->fallocate() exists])
1302 SPL_LINUX_TRY_COMPILE([
1303 #include <linux/fs.h>
1304 ],[
1305 long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
1306 struct inode_operations fops __attribute__ ((unused)) = {
1307 .fallocate = fallocate,
1308 };
1309 ],[
1310 AC_MSG_RESULT(yes)
1311 AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
1312 ],[
1313 AC_MSG_RESULT(no)
1314 ])
1315])
1316
1317dnl #
1318dnl # PaX Linux 2.6.38 - 3.x API
1319dnl #
1320AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
1321 AC_MSG_CHECKING([whether fops->fallocate() exists])
1322 SPL_LINUX_TRY_COMPILE([
1323 #include <linux/fs.h>
1324 ],[
1325 long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
1326 struct file_operations_no_const fops __attribute__ ((unused)) = {
1327 .fallocate = fallocate,
1328 };
1329 ],[
1330 AC_MSG_RESULT(yes)
1331 AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
1332 ],[
1333 AC_MSG_RESULT(no)
1334 ])
1335])
1336
1337dnl #
1338dnl # The fallocate callback was moved from the inode_operations
1339dnl # structure to the file_operations structure.
1340dnl #
1341AC_DEFUN([SPL_AC_KERNEL_FALLOCATE], [
1342 SPL_AC_KERNEL_FILE_FALLOCATE
1343 SPL_AC_KERNEL_INODE_FALLOCATE
1344 SPL_AC_PAX_KERNEL_FILE_FALLOCATE
1345])
bbdc6ae4 1346
46aa7b39
NB
1347dnl #
1348dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
1349dnl # Earlier versions of rwsem_is_locked() were inline and had a race
1350dnl # condition. The fixed version is exported as a symbol. The race
1351dnl # condition is fixed by acquiring sem->wait_lock, so we must not
1352dnl # call that version while holding sem->wait_lock.
1353dnl #
723aa3b0
ED
1354AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED],
1355 [AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock])
1356 SPL_LINUX_TRY_COMPILE_SYMBOL([
1357 #include <linux/rwsem.h>
1358 int rwsem_is_locked(struct rw_semaphore *sem) { return 0; }
1359 ], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [
1360 AC_MSG_RESULT(yes)
1361 AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
1362 [rwsem_is_locked() acquires sem->wait_lock])
1363 ], [
1364 AC_MSG_RESULT(no)
723aa3b0 1365 ])
e76f4bf1 1366])
b1cbc461
BB
1367
1368dnl #
ec18fe3c
RY
1369dnl # 2.6.28 API change
1370dnl # The kern_path() function has been introduced. We adopt it as the new way
1371dnl # of looking up paths. When it is not available, we emulate it using the
1372dnl # older interfaces.
b1cbc461 1373dnl #
ec18fe3c
RY
1374AC_DEFUN([SPL_AC_KERN_PATH],
1375 [AC_MSG_CHECKING([whether kern_path() is available])
723aa3b0
ED
1376 SPL_LINUX_TRY_COMPILE_SYMBOL([
1377 #include <linux/namei.h>
1378 ], [
ec18fe3c
RY
1379 int r = kern_path(NULL, 0, NULL);
1380 ], [kern_path], [fs/namei.c], [
723aa3b0 1381 AC_MSG_RESULT(yes)
ec18fe3c
RY
1382 AC_DEFINE(HAVE_KERN_PATH, 1,
1383 [kern_path() is available])
723aa3b0
ED
1384 ], [
1385 AC_MSG_RESULT(no)
ec18fe3c
RY
1386 AC_MSG_CHECKING([whether path_lookup() is available])
1387 SPL_LINUX_TRY_COMPILE_SYMBOL([
1388 #include <linux/namei.h>
1389 ], [
1390 int r = path_lookup(NULL, 0, NULL);
1391 ], [path_lookup], [fs/namei.c], [
1392 AC_MSG_RESULT(yes)
1393 AC_DEFINE(HAVE_KERN_PATH, 1,
1394 [kern_path() is available])
1395 ], [
1396 AC_MSG_RESULT(no)
1397 AC_MSG_ERROR([
1398 *** Neither kern_path() nor path_lookup() is available.
1399 *** Please file an issue:
1400 *** https://github.com/zfsonlinux/spl/issues/new])
3dfc591a 1401
ec18fe3c
RY
1402 ])
1403 ])
bcb15891
YS
1404])
1405
42b3ce62
BB
1406dnl #
1407dnl # zlib inflate compat,
1408dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
1409dnl #
1410AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [
1411 AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
1412 SPL_LINUX_TRY_COMPILE([
1413 #if !defined(CONFIG_ZLIB_INFLATE) && \
1414 !defined(CONFIG_ZLIB_INFLATE_MODULE)
1415 #error CONFIG_ZLIB_INFLATE not defined
1416 #endif
1417 ],[ ],[
1418 AC_MSG_RESULT([yes])
1419 ],[
1420 AC_MSG_RESULT([no])
1421 AC_MSG_ERROR([
1422 *** This kernel does not include the required zlib inflate support.
1423 *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
1424 ])
1425])
1426
1427dnl #
1428dnl # zlib deflate compat,
1429dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
1430dnl #
1431AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
1432 AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
1433 SPL_LINUX_TRY_COMPILE([
1434 #if !defined(CONFIG_ZLIB_DEFLATE) && \
1435 !defined(CONFIG_ZLIB_DEFLATE_MODULE)
1436 #error CONFIG_ZLIB_DEFLATE not defined
1437 #endif
1438 ],[ ],[
1439 AC_MSG_RESULT([yes])
1440 ],[
1441 AC_MSG_RESULT([no])
1442 AC_MSG_ERROR([
1443 *** This kernel does not include the required zlib deflate support.
1444 *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
1445 ])
1446])
1447
3dfc591a
BB
1448dnl #
1449dnl # 2.6.39 API compat,
1450dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
1451dnl # This was done to avoid always having to allocate the maximum size
1452dnl # workspace (268K). The caller can now specific the windowBits and
1453dnl # memLevel compression parameters to get a smaller workspace.
1454dnl #
1455AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
1456 [AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
1457 SPL_LINUX_TRY_COMPILE([
1458 #include <linux/zlib.h>
1459 ],[
1460 return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
1461 ],[
1462 AC_MSG_RESULT(yes)
1463 AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
1464 [zlib_deflate_workspacesize() wants 2 args])
1465 ],[
1466 AC_MSG_RESULT(no)
1467 ])
1468])
a55bcaad
BB
1469
1470dnl #
1471dnl # 2.6.39 API change,
1472dnl # Shrinker adjust to use common shrink_control structure.
1473dnl #
1474AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [
1475 AC_MSG_CHECKING([whether struct shrink_control exists])
1476 SPL_LINUX_TRY_COMPILE([
1477 #include <linux/mm.h>
1478 ],[
1479 struct shrink_control sc __attribute__ ((unused));
1480
1481 sc.nr_to_scan = 0;
1482 sc.gfp_mask = GFP_KERNEL;
1483 ],[
1484 AC_MSG_RESULT(yes)
1485 AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
1486 [struct shrink_control exists])
1487 ],[
1488 AC_MSG_RESULT(no)
1489 ])
1490])
588d9004
DH
1491
1492dnl #
1493dnl # 3.1 API Change
1494dnl #
1495dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
1496dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
1497dnl #
1498AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
1499 AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
1500 tmp_flags="$EXTRA_KCFLAGS"
1501 EXTRA_KCFLAGS="-Werror"
1502 SPL_LINUX_TRY_COMPILE([
1503 #include <linux/rwsem.h>
1504 ],[
1505 struct rw_semaphore dummy_semaphore __attribute__ ((unused));
1506 raw_spinlock_t dummy_lock __attribute__ ((unused));
1507 dummy_semaphore.wait_lock = dummy_lock;
1508 ],[
1509 AC_MSG_RESULT(yes)
1510 AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1,
1511 [struct rw_semaphore member wait_lock is raw_spinlock_t])
1512 ],[
1513 AC_MSG_RESULT(no)
1514 ])
1515 EXTRA_KCFLAGS="$tmp_flags"
1516])
10087fe1
RY
1517
1518dnl #
1519dnl # 3.9 API change,
1520dnl # Moved things from linux/sched.h to linux/sched/rt.h
1521dnl #
1522AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
1523 [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
1524 SPL_LINUX_TRY_COMPILE([
1525 #include <linux/sched.h>
1526 #include <linux/sched/rt.h>
1527 ],[
1528 return 0;
1529 ],[
1530 AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
1531 AC_MSG_RESULT(yes)
1532 ],[
1533 AC_MSG_RESULT(no)
1534 ])
1535])
2a305c34
RY
1536
1537dnl #
1538dnl # 3.9 API change,
1539dnl # vfs_getattr() uses 2 args
1540dnl # It takes struct path * instead of struct vfsmount * and struct dentry *
1541dnl #
1542AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
1543 AC_MSG_CHECKING([whether vfs_getattr() wants])
1544 SPL_LINUX_TRY_COMPILE([
1545 #include <linux/fs.h>
1546 ],[
1547 vfs_getattr((struct path *) NULL,
1548 (struct kstat *)NULL);
1549 ],[
1550 AC_MSG_RESULT(2 args)
1551 AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
1552 [vfs_getattr wants 2 args])
1553 ],[
1554 SPL_LINUX_TRY_COMPILE([
1555 #include <linux/fs.h>
1556 ],[
1557 vfs_getattr((struct vfsmount *)NULL,
1558 (struct dentry *)NULL,
1559 (struct kstat *)NULL);
1560 ],[
1561 AC_MSG_RESULT(3 args)
1562 ],[
1563 AC_MSG_ERROR(unknown)
1564 ])
1565 ])
1566])
184c6873
NB
1567
1568dnl #
1569dnl # 2.6.36 API compatibility.
1570dnl # Added usleep_range timer.
1571dnl # usleep_range is a finer precision implementation of msleep
1572dnl # designed to be a drop-in replacement for udelay where a precise
1573dnl # sleep / busy-wait is unnecessary.
1574dnl #
1575AC_DEFUN([SPL_AC_USLEEP_RANGE], [
1576 AC_MSG_CHECKING([whether usleep_range() is available])
1577 SPL_LINUX_TRY_COMPILE([
1578 #include <linux/delay.h>
1579 ],[
1580 usleep_range(0, 0);
1581 ],[
1582 AC_MSG_RESULT(yes)
1583 AC_DEFINE(HAVE_USLEEP_RANGE, 1,
1584 [usleep_range is available])
1585 ],[
1586 AC_MSG_RESULT(no)
1587 ])
1588])
a073aeb0
BB
1589
1590dnl #
1591dnl # 2.6.35 API change,
1592dnl # The cachep->gfpflags member was renamed cachep->allocflags. These are
1593dnl # private allocation flags which are applied when allocating a new slab
1594dnl # in kmem_getpages(). Unfortunately there is no public API for setting
1595dnl # non-default flags.
1596dnl #
1597AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
1598 AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
1599 SPL_LINUX_TRY_COMPILE([
1600 #include <linux/slab.h>
1601 ],[
1602 struct kmem_cache cachep __attribute__ ((unused));
1603 cachep.allocflags = GFP_KERNEL;
1604 ],[
1605 AC_MSG_RESULT(yes)
1606 AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
1607 [struct kmem_cache has allocflags])
1608 ],[
1609 AC_MSG_RESULT(no)
1610
1611 AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
1612 SPL_LINUX_TRY_COMPILE([
1613 #include <linux/slab.h>
1614 ],[
1615 struct kmem_cache cachep __attribute__ ((unused));
1616 cachep.gfpflags = GFP_KERNEL;
1617 ],[
1618 AC_MSG_RESULT(yes)
1619 AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
1620 [struct kmem_cache has gfpflags])
1621 ],[
1622 AC_MSG_RESULT(no)
1623 ])
1624 ])
1625])
2fc44f66
NB
1626
1627dnl #
1628dnl # 3.17 API change,
1629dnl # wait_on_bit() no longer requires an action argument. The former
1630dnl # "wait_on_bit" interface required an 'action' function to be provided
1631dnl # which does the actual waiting. There were over 20 such functions in the
1632dnl # kernel, many of them identical, though most cases can be satisfied by one
1633dnl # of just two functions: one which uses io_schedule() and one which just
1634dnl # uses schedule(). This API change was made to consolidate all of those
1635dnl # redundant wait functions.
1636dnl #
1637AC_DEFUN([SPL_AC_WAIT_ON_BIT], [
1638 AC_MSG_CHECKING([whether wait_on_bit() takes an action])
1639 SPL_LINUX_TRY_COMPILE([
1640 #include <linux/wait.h>
1641 ],[
1642 int (*action)(void *) = NULL;
1643 wait_on_bit(NULL, 0, action, 0);
1644 ],[
1645 AC_MSG_RESULT(yes)
1646 AC_DEFINE(HAVE_WAIT_ON_BIT_ACTION, 1, [yes])
1647 ],[
1648 AC_MSG_RESULT(no)
1649 ])
1650])