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