]>
Commit | Line | Data |
---|---|---|
c9c0d073 BB |
1 | dnl # |
2 | dnl # Default ZFS kernel configuration | |
3 | dnl # | |
4 | AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ | |
5 | ZFS_AC_KERNEL | |
6 | ZFS_AC_SPL | |
7 | ZFS_AC_KERNEL_CONFIG | |
8 | ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS | |
9 | ZFS_AC_KERNEL_TYPE_FMODE_T | |
10 | ZFS_AC_KERNEL_KOBJ_NAME_LEN | |
45066d1f | 11 | ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH |
c9c0d073 BB |
12 | ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE |
13 | ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS | |
14 | ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE | |
15 | ZFS_AC_KERNEL_BIO_EMPTY_BARRIER | |
2959d94a | 16 | ZFS_AC_KERNEL_BIO_FAILFAST |
f4af6bb7 BB |
17 | ZFS_AC_KERNEL_BIO_FAILFAST_DTD |
18 | ZFS_AC_KERNEL_REQ_FAILFAST_MASK | |
c9c0d073 | 19 | ZFS_AC_KERNEL_BIO_END_IO_T_ARGS |
675de5aa | 20 | ZFS_AC_KERNEL_BIO_RW_SYNC |
c9c0d073 | 21 | ZFS_AC_KERNEL_BIO_RW_SYNCIO |
675de5aa | 22 | ZFS_AC_KERNEL_REQ_SYNC |
c9c0d073 | 23 | ZFS_AC_KERNEL_BLK_END_REQUEST |
b18019d2 | 24 | ZFS_AC_KERNEL_BLK_QUEUE_FLUSH |
34037afe ED |
25 | ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS |
26 | ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS | |
27 | ZFS_AC_KERNEL_BLK_QUEUE_PHYSICAL_BLOCK_SIZE | |
28 | ZFS_AC_KERNEL_BLK_QUEUE_IO_OPT | |
29 | ZFS_AC_KERNEL_BLK_QUEUE_NONROT | |
c9c0d073 BB |
30 | ZFS_AC_KERNEL_BLK_FETCH_REQUEST |
31 | ZFS_AC_KERNEL_BLK_REQUEUE_REQUEST | |
32 | ZFS_AC_KERNEL_BLK_RQ_BYTES | |
33 | ZFS_AC_KERNEL_BLK_RQ_POS | |
34 | ZFS_AC_KERNEL_BLK_RQ_SECTORS | |
35 | ZFS_AC_KERNEL_GET_DISK_RO | |
36 | ZFS_AC_KERNEL_RQ_IS_SYNC | |
37 | ZFS_AC_KERNEL_RQ_FOR_EACH_SEGMENT | |
777d4af8 | 38 | ZFS_AC_KERNEL_CONST_XATTR_HANDLER |
f9637c6c BB |
39 | ZFS_AC_KERNEL_XATTR_HANDLER_GET |
40 | ZFS_AC_KERNEL_XATTR_HANDLER_SET | |
47621f3d | 41 | ZFS_AC_KERNEL_SHOW_OPTIONS |
adcd70bd | 42 | ZFS_AC_KERNEL_FSYNC |
2c395def | 43 | ZFS_AC_KERNEL_EVICT_INODE |
ab26409d BB |
44 | ZFS_AC_KERNEL_NR_CACHED_OBJECTS |
45 | ZFS_AC_KERNEL_FREE_CACHED_OBJECTS | |
bdf4328b | 46 | ZFS_AC_KERNEL_INSERT_INODE_LOCKED |
055656d4 | 47 | ZFS_AC_KERNEL_D_OBTAIN_ALIAS |
df554c14 | 48 | ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE |
b3129792 | 49 | ZFS_AC_KERNEL_TRUNCATE_SETSIZE |
5c03efc3 | 50 | ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY |
166dd49d | 51 | ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY |
2cf7f52b | 52 | ZFS_AC_KERNEL_MOUNT_NODEV |
ab26409d | 53 | ZFS_AC_KERNEL_SHRINK |
76659dc1 | 54 | ZFS_AC_KERNEL_BDI |
5547c2f1 | 55 | ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER |
28eb9213 | 56 | ZFS_AC_KERNEL_SET_NLINK |
c9c0d073 | 57 | |
8366cd6a | 58 | AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ |
6283f55e | 59 | KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" |
8366cd6a | 60 | ]) |
6283f55e BB |
61 | AC_SUBST(KERNELMAKE_PARAMS) |
62 | ||
63 | ||
c9c0d073 BB |
64 | dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other |
65 | dnl # compiler options are added by the kernel build system. | |
8a7e1cee | 66 | KERNELCPPFLAGS="$KERNELCPPFLAGS $NO_UNUSED_BUT_SET_VARIABLE" |
c9c0d073 BB |
67 | KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL" |
68 | KERNELCPPFLAGS="$KERNELCPPFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\"" | |
c9c0d073 | 69 | |
c9c0d073 BB |
70 | AC_SUBST(KERNELCPPFLAGS) |
71 | ]) | |
72 | ||
73 | dnl # | |
74 | dnl # Detect name used for Module.symvers file in kernel | |
75 | dnl # | |
76 | AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [ | |
77 | modpost=$LINUX/scripts/Makefile.modpost | |
78 | AC_MSG_CHECKING([kernel file name for module symbols]) | |
8366cd6a PS |
79 | AS_IF([test -f "$modpost"], [ |
80 | AS_IF([grep -q Modules.symvers $modpost], [ | |
c9c0d073 | 81 | LINUX_SYMBOLS=Modules.symvers |
8366cd6a | 82 | ], [ |
c9c0d073 | 83 | LINUX_SYMBOLS=Module.symvers |
8366cd6a | 84 | ]) |
a60b1c0a | 85 | |
8366cd6a | 86 | AS_IF([test ! -f "$LINUX_OBJ/$LINUX_SYMBOLS"], [ |
a60b1c0a BB |
87 | AC_MSG_ERROR([ |
88 | *** Please make sure the kernel devel package for your distribution | |
89 | *** is installed. If your building with a custom kernel make sure the | |
90 | *** kernel is configured, built, and the '--with-linux=PATH' configure | |
91 | *** option refers to the location of the kernel source.]) | |
8366cd6a PS |
92 | ]) |
93 | ], [ | |
c9c0d073 | 94 | LINUX_SYMBOLS=NONE |
8366cd6a | 95 | ]) |
c9c0d073 BB |
96 | AC_MSG_RESULT($LINUX_SYMBOLS) |
97 | AC_SUBST(LINUX_SYMBOLS) | |
98 | ]) | |
99 | ||
100 | dnl # | |
101 | dnl # Detect the kernel to be built against | |
102 | dnl # | |
103 | AC_DEFUN([ZFS_AC_KERNEL], [ | |
104 | AC_ARG_WITH([linux], | |
105 | AS_HELP_STRING([--with-linux=PATH], | |
106 | [Path to kernel source]), | |
107 | [kernelsrc="$withval"]) | |
108 | ||
109 | AC_ARG_WITH(linux-obj, | |
110 | AS_HELP_STRING([--with-linux-obj=PATH], | |
111 | [Path to kernel build objects]), | |
112 | [kernelbuild="$withval"]) | |
113 | ||
114 | AC_MSG_CHECKING([kernel source directory]) | |
8366cd6a PS |
115 | AS_IF([test -z "$kernelsrc"], [ |
116 | AS_IF([test -e "/lib/modules/$(uname -r)/source"], [ | |
1b94c25c BB |
117 | headersdir="/lib/modules/$(uname -r)/source" |
118 | sourcelink=$(readlink -f "$headersdir") | |
8366cd6a | 119 | ], [test -e "/lib/modules/$(uname -r)/build"], [ |
1b94c25c | 120 | headersdir="/lib/modules/$(uname -r)/build" |
c9c0d073 | 121 | sourcelink=$(readlink -f "$headersdir") |
8366cd6a | 122 | ], [ |
c9c0d073 | 123 | sourcelink=$(ls -1d /usr/src/kernels/* \ |
8366cd6a | 124 | /usr/src/linux-* \ |
c9c0d073 | 125 | 2>/dev/null | grep -v obj | tail -1) |
8366cd6a | 126 | ]) |
c9c0d073 | 127 | |
8366cd6a | 128 | AS_IF([test -n "$sourcelink" && test -e ${sourcelink}], [ |
c9c0d073 | 129 | kernelsrc=`readlink -f ${sourcelink}` |
8366cd6a | 130 | ], [ |
c9c0d073 BB |
131 | AC_MSG_RESULT([Not found]) |
132 | AC_MSG_ERROR([ | |
133 | *** Please make sure the kernel devel package for your distribution | |
134 | *** is installed then try again. If that fails you can specify the | |
135 | *** location of the kernel source with the '--with-linux=PATH' option.]) | |
8366cd6a PS |
136 | ]) |
137 | ], [ | |
138 | AS_IF([test "$kernelsrc" = "NONE"], [ | |
c9c0d073 | 139 | kernsrcver=NONE |
8366cd6a PS |
140 | ]) |
141 | ]) | |
c9c0d073 BB |
142 | |
143 | AC_MSG_RESULT([$kernelsrc]) | |
144 | AC_MSG_CHECKING([kernel build directory]) | |
8366cd6a PS |
145 | AS_IF([test -z "$kernelbuild"], [ |
146 | AS_IF([test -e "/lib/modules/$(uname -r)/build"], [ | |
1b94c25c | 147 | kernelbuild=`readlink -f /lib/modules/$(uname -r)/build` |
8366cd6a | 148 | ], [test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}], [ |
c9c0d073 | 149 | kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu} |
8366cd6a | 150 | ], [test -d ${kernelsrc}-obj/${target_cpu}/default], [ |
c9c0d073 | 151 | kernelbuild=${kernelsrc}-obj/${target_cpu}/default |
8366cd6a | 152 | ], [test -d `dirname ${kernelsrc}`/build-${target_cpu}], [ |
c9c0d073 | 153 | kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu} |
8366cd6a | 154 | ], [ |
c9c0d073 | 155 | kernelbuild=${kernelsrc} |
8366cd6a PS |
156 | ]) |
157 | ]) | |
c9c0d073 BB |
158 | AC_MSG_RESULT([$kernelbuild]) |
159 | ||
160 | AC_MSG_CHECKING([kernel source version]) | |
161 | utsrelease1=$kernelbuild/include/linux/version.h | |
162 | utsrelease2=$kernelbuild/include/linux/utsrelease.h | |
163 | utsrelease3=$kernelbuild/include/generated/utsrelease.h | |
8366cd6a | 164 | AS_IF([test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1], [ |
c9c0d073 | 165 | utsrelease=linux/version.h |
8366cd6a | 166 | ], [test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2], [ |
c9c0d073 | 167 | utsrelease=linux/utsrelease.h |
8366cd6a | 168 | ], [test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3], [ |
c9c0d073 | 169 | utsrelease=generated/utsrelease.h |
8366cd6a | 170 | ]) |
c9c0d073 | 171 | |
8366cd6a | 172 | AS_IF([test "$utsrelease"], [ |
c9c0d073 BB |
173 | kernsrcver=`(echo "#include <$utsrelease>"; |
174 | echo "kernsrcver=UTS_RELEASE") | | |
175 | cpp -I $kernelbuild/include | | |
176 | grep "^kernsrcver=" | cut -d \" -f 2` | |
177 | ||
8366cd6a | 178 | AS_IF([test -z "$kernsrcver"], [ |
c9c0d073 BB |
179 | AC_MSG_RESULT([Not found]) |
180 | AC_MSG_ERROR([*** Cannot determine kernel version.]) | |
8366cd6a PS |
181 | ]) |
182 | ], [ | |
c9c0d073 BB |
183 | AC_MSG_RESULT([Not found]) |
184 | AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.]) | |
8366cd6a | 185 | ]) |
c9c0d073 BB |
186 | |
187 | AC_MSG_RESULT([$kernsrcver]) | |
188 | ||
189 | LINUX=${kernelsrc} | |
190 | LINUX_OBJ=${kernelbuild} | |
191 | LINUX_VERSION=${kernsrcver} | |
192 | ||
193 | AC_SUBST(LINUX) | |
194 | AC_SUBST(LINUX_OBJ) | |
195 | AC_SUBST(LINUX_VERSION) | |
196 | ||
197 | ZFS_AC_MODULE_SYMVERS | |
198 | ]) | |
199 | ||
200 | dnl # | |
201 | dnl # Detect name used for the additional SPL Module.symvers file. If one | |
202 | dnl # does not exist this is likely because the SPL has been configured | |
203 | dnl # but not built. To allow recursive builds a good guess is made as to | |
204 | dnl # what this file will be named based on what it is named in the kernel | |
205 | dnl # build products. This file will first be used at link time so if | |
206 | dnl # the guess is wrong the build will fail then. This unfortunately | |
207 | dnl # means the ZFS package does not contain a reliable mechanism to | |
208 | dnl # detect symbols exported by the SPL at configure time. | |
209 | dnl # | |
210 | AC_DEFUN([ZFS_AC_SPL_MODULE_SYMVERS], [ | |
211 | AC_MSG_CHECKING([spl file name for module symbols]) | |
8366cd6a | 212 | AS_IF([test -r $SPL_OBJ/Module.symvers], [ |
c9c0d073 | 213 | SPL_SYMBOLS=Module.symvers |
8366cd6a | 214 | ], [test -r $SPL_OBJ/Modules.symvers], [ |
c9c0d073 | 215 | SPL_SYMBOLS=Modules.symvers |
8366cd6a | 216 | ], [test -r $SPL_OBJ/module/Module.symvers], [ |
6283f55e | 217 | SPL_SYMBOLS=Module.symvers |
8366cd6a | 218 | ], [test -r $SPL_OBJ/module/Modules.symvers], [ |
6283f55e | 219 | SPL_SYMBOLS=Modules.symvers |
8366cd6a | 220 | ], [ |
c9c0d073 | 221 | SPL_SYMBOLS=$LINUX_SYMBOLS |
8366cd6a | 222 | ]) |
c9c0d073 BB |
223 | |
224 | AC_MSG_RESULT([$SPL_SYMBOLS]) | |
225 | AC_SUBST(SPL_SYMBOLS) | |
226 | ]) | |
227 | ||
228 | dnl # | |
229 | dnl # Detect the SPL module to be built against | |
230 | dnl # | |
231 | AC_DEFUN([ZFS_AC_SPL], [ | |
232 | AC_ARG_WITH([spl], | |
233 | AS_HELP_STRING([--with-spl=PATH], | |
234 | [Path to spl source]), | |
235 | [splsrc="$withval"]) | |
236 | ||
237 | AC_ARG_WITH([spl-obj], | |
238 | AS_HELP_STRING([--with-spl-obj=PATH], | |
239 | [Path to spl build objects]), | |
240 | [splbuild="$withval"]) | |
241 | ||
242 | ||
243 | AC_MSG_CHECKING([spl source directory]) | |
8366cd6a | 244 | AS_IF([test -z "$splsrc"], [ |
c9c0d073 BB |
245 | sourcelink=`ls -1d /usr/src/spl-*/${LINUX_VERSION} \ |
246 | 2>/dev/null | tail -1` | |
247 | ||
8366cd6a | 248 | AS_IF([test -z "$sourcelink" || test ! -e $sourcelink], [ |
c9c0d073 | 249 | sourcelink=../spl |
8366cd6a | 250 | ]) |
c9c0d073 | 251 | |
8366cd6a | 252 | AS_IF([test -e $sourcelink], [ |
c9c0d073 | 253 | splsrc=`readlink -f ${sourcelink}` |
8366cd6a | 254 | ], [ |
c9c0d073 BB |
255 | AC_MSG_RESULT([Not found]) |
256 | AC_MSG_ERROR([ | |
257 | *** Please make sure the spl devel package for your distribution | |
258 | *** is installed then try again. If that fails you can specify the | |
259 | *** location of the spl source with the '--with-spl=PATH' option.]) | |
8366cd6a PS |
260 | ]) |
261 | ], [ | |
262 | AS_IF([test "$splsrc" = "NONE"], [ | |
c9c0d073 BB |
263 | splbuild=NONE |
264 | splsrcver=NONE | |
8366cd6a PS |
265 | ]) |
266 | ]) | |
c9c0d073 BB |
267 | |
268 | AC_MSG_RESULT([$splsrc]) | |
269 | AC_MSG_CHECKING([spl build directory]) | |
8366cd6a | 270 | AS_IF([test -z "$splbuild"], [ |
6283f55e | 271 | splbuild=${splsrc} |
8366cd6a | 272 | ]) |
c9c0d073 BB |
273 | AC_MSG_RESULT([$splbuild]) |
274 | ||
275 | AC_MSG_CHECKING([spl source version]) | |
8366cd6a PS |
276 | AS_IF([test -r $splbuild/spl_config.h && |
277 | fgrep -q SPL_META_VERSION $splbuild/spl_config.h], [ | |
c9c0d073 BB |
278 | |
279 | splsrcver=`(echo "#include <spl_config.h>"; | |
b40a77ae | 280 | echo "splsrcver=SPL_META_VERSION-SPL_META_RELEASE") | |
5e612145 | 281 | cpp -I $splbuild | |
b40a77ae | 282 | grep "^splsrcver=" | tr -d \" | cut -d= -f2` |
8366cd6a | 283 | ]) |
c9c0d073 | 284 | |
8366cd6a | 285 | AS_IF([test -z "$splsrcver"], [ |
c9c0d073 BB |
286 | AC_MSG_RESULT([Not found]) |
287 | AC_MSG_ERROR([ | |
2984e0bb PS |
288 | *** Cannot determine the version of the spl source. |
289 | *** Please prepare the spl source before running this script]) | |
8366cd6a | 290 | ]) |
c9c0d073 BB |
291 | |
292 | AC_MSG_RESULT([$splsrcver]) | |
293 | ||
294 | SPL=${splsrc} | |
295 | SPL_OBJ=${splbuild} | |
296 | SPL_VERSION=${splsrcver} | |
297 | ||
298 | AC_SUBST(SPL) | |
299 | AC_SUBST(SPL_OBJ) | |
300 | AC_SUBST(SPL_VERSION) | |
301 | ||
302 | ZFS_AC_SPL_MODULE_SYMVERS | |
303 | ]) | |
304 | ||
15805c77 BB |
305 | dnl # |
306 | dnl # Certain kernel build options are not supported. These must be | |
307 | dnl # detected at configure time and cause a build failure. Otherwise | |
308 | dnl # modules may be successfully built that behave incorrectly. | |
309 | dnl # | |
310 | dnl # CONFIG_PREEMPT - Preempt kernels require special handling. | |
c9c0d073 BB |
311 | dnl # |
312 | dnl # There are certain kernel build options which when enabled are | |
313 | dnl # completely incompatible with non GPL kernel modules. It is best | |
314 | dnl # to detect these at configure time and fail with a clear error | |
315 | dnl # rather than build everything and fail during linking. | |
316 | dnl # | |
317 | dnl # CONFIG_DEBUG_LOCK_ALLOC - Maps mutex_lock() to mutex_lock_nested() | |
318 | dnl # | |
319 | AC_DEFUN([ZFS_AC_KERNEL_CONFIG], [ | |
320 | ||
15805c77 BB |
321 | ZFS_LINUX_CONFIG([PREEMPT], |
322 | AC_MSG_ERROR([ | |
2984e0bb PS |
323 | *** Kernel built with CONFIG_PREEMPT which is not supported. |
324 | *** You must rebuild your kernel without this option.]), []) | |
15805c77 | 325 | |
8366cd6a | 326 | AS_IF([test "$ZFS_META_LICENSE" = CDDL], [ |
c9c0d073 BB |
327 | ZFS_LINUX_CONFIG([DEBUG_LOCK_ALLOC], |
328 | AC_MSG_ERROR([ | |
2984e0bb PS |
329 | *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is |
330 | *** incompatible with the CDDL license. You must rebuild | |
331 | *** your kernel without this option.]), []) | |
8366cd6a | 332 | ]) |
c9c0d073 | 333 | |
8366cd6a | 334 | AS_IF([test "$ZFS_META_LICENSE" = GPL], [ |
c9c0d073 BB |
335 | AC_DEFINE([HAVE_GPL_ONLY_SYMBOLS], [1], |
336 | [Define to 1 if licensed under the GPL]) | |
8366cd6a | 337 | ]) |
c9c0d073 BB |
338 | ]) |
339 | ||
340 | dnl # | |
341 | dnl # ZFS_LINUX_CONFTEST | |
342 | dnl # | |
343 | AC_DEFUN([ZFS_LINUX_CONFTEST], [ | |
344 | cat confdefs.h - <<_ACEOF >conftest.c | |
345 | $1 | |
346 | _ACEOF | |
347 | ]) | |
348 | ||
349 | dnl # | |
350 | dnl # ZFS_LANG_PROGRAM(C)([PROLOGUE], [BODY]) | |
351 | dnl # | |
352 | m4_define([ZFS_LANG_PROGRAM], [ | |
353 | $1 | |
354 | int | |
355 | main (void) | |
356 | { | |
357 | dnl Do *not* indent the following line: there may be CPP directives. | |
358 | dnl Don't move the `;' right after for the same reason. | |
359 | $2 | |
360 | ; | |
361 | return 0; | |
362 | } | |
363 | ]) | |
364 | ||
365 | dnl # | |
366 | dnl # ZFS_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE | |
367 | dnl # | |
368 | AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [ | |
369 | m4_ifvaln([$1], [ZFS_LINUX_CONFTEST([$1])]) | |
370 | rm -Rf build && mkdir -p build | |
371 | echo "obj-m := conftest.o" >build/Makefile | |
372 | AS_IF( | |
373 | [AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], | |
374 | [$4], | |
375 | [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])] | |
376 | ) | |
377 | rm -Rf build | |
378 | ]) | |
379 | ||
380 | dnl # | |
381 | dnl # ZFS_LINUX_TRY_COMPILE like AC_TRY_COMPILE | |
382 | dnl # | |
383 | AC_DEFUN([ZFS_LINUX_TRY_COMPILE], | |
384 | [ZFS_LINUX_COMPILE_IFELSE( | |
385 | [AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])], | |
386 | [modules], | |
387 | [test -s build/conftest.o], | |
388 | [$3], [$4]) | |
389 | ]) | |
390 | ||
391 | dnl # | |
392 | dnl # ZFS_LINUX_CONFIG | |
393 | dnl # | |
394 | AC_DEFUN([ZFS_LINUX_CONFIG], | |
395 | [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1]) | |
396 | ZFS_LINUX_TRY_COMPILE([ | |
0da78696 | 397 | #include <linux/module.h> |
c9c0d073 BB |
398 | ],[ |
399 | #ifndef CONFIG_$1 | |
400 | #error CONFIG_$1 not #defined | |
401 | #endif | |
402 | ],[ | |
403 | AC_MSG_RESULT([yes]) | |
404 | $2 | |
405 | ],[ | |
406 | AC_MSG_RESULT([no]) | |
407 | $3 | |
408 | ]) | |
409 | ]) | |
410 | ||
411 | dnl # | |
412 | dnl # ZFS_CHECK_SYMBOL_EXPORT | |
413 | dnl # check symbol exported or not | |
414 | dnl # | |
415 | AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], | |
416 | [AC_MSG_CHECKING([whether symbol $1 is exported]) | |
417 | grep -q -E '[[[:space:]]]$1[[[:space:]]]' \ | |
418 | $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null | |
419 | rc=$? | |
8366cd6a | 420 | AS_IF([test $rc -ne 0], [ |
c9c0d073 BB |
421 | export=0 |
422 | for file in $2; do | |
423 | grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX/$file" 2>/dev/null | |
424 | rc=$? | |
8366cd6a PS |
425 | AS_IF([test $rc -eq 0], [ |
426 | export=1 | |
427 | break; | |
428 | ]) | |
c9c0d073 | 429 | done |
8366cd6a | 430 | AS_IF([test $export -eq 0], [ |
c9c0d073 BB |
431 | AC_MSG_RESULT([no]) |
432 | $4 | |
8366cd6a | 433 | ], [ |
c9c0d073 BB |
434 | AC_MSG_RESULT([yes]) |
435 | $3 | |
8366cd6a PS |
436 | ]) |
437 | ], [ | |
c9c0d073 BB |
438 | AC_MSG_RESULT([yes]) |
439 | $3 | |
8366cd6a | 440 | ]) |
c9c0d073 | 441 | ]) |