]>
Commit | Line | Data |
---|---|---|
57d86234 | 1 | AC_DEFUN([SPL_AC_KERNEL], [ |
57d86234 | 2 | AC_ARG_WITH([linux], |
3 | AS_HELP_STRING([--with-linux=PATH], | |
4 | [Path to kernel source]), | |
5 | [kernelsrc="$withval"; kernelbuild="$withval"]) | |
6 | ||
7 | AC_ARG_WITH([linux-obj], | |
8 | AS_HELP_STRING([--with-linux-obj=PATH], | |
9 | [Path to kernel build objects]), | |
10 | [kernelbuild="$withval"]) | |
11 | ||
12 | AC_MSG_CHECKING([kernel source directory]) | |
13 | if test -z "$kernelsrc"; then | |
14 | kernelbuild= | |
d4326403 | 15 | sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null | tail -1` |
57d86234 | 16 | |
d4326403 BB |
17 | if test -e ${sourcelink}; then |
18 | kernelsrc=`readlink -f ${sourcelink}` | |
19 | kernelbuild=${kernelsrc} | |
20 | else | |
57d86234 | 21 | AC_MSG_RESULT([Not found]) |
22 | AC_MSG_ERROR([ | |
23 | *** Please specify the location of the kernel source | |
6a1c3d41 | 24 | *** with the '--with-linux=PATH' option]) |
57d86234 | 25 | fi |
c5f70460 BB |
26 | else |
27 | if test "$kernelsrc" = "NONE"; then | |
28 | kernsrcver=NONE | |
29 | fi | |
57d86234 | 30 | fi |
31 | ||
32 | AC_MSG_RESULT([$kernelsrc]) | |
33 | AC_MSG_CHECKING([kernel build directory]) | |
34 | AC_MSG_RESULT([$kernelbuild]) | |
35 | ||
36 | AC_MSG_CHECKING([kernel source version]) | |
37 | if test -r $kernelbuild/include/linux/version.h && | |
38 | fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then | |
39 | ||
40 | kernsrcver=`(echo "#include <linux/version.h>"; | |
41 | echo "kernsrcver=UTS_RELEASE") | | |
d4326403 | 42 | cpp -I $kernelbuild/include | |
57d86234 | 43 | grep "^kernsrcver=" | cut -d \" -f 2` |
44 | ||
45 | elif test -r $kernelbuild/include/linux/utsrelease.h && | |
46 | fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then | |
47 | ||
48 | kernsrcver=`(echo "#include <linux/utsrelease.h>"; | |
49 | echo "kernsrcver=UTS_RELEASE") | | |
d4326403 | 50 | cpp -I $kernelbuild/include | |
57d86234 | 51 | grep "^kernsrcver=" | cut -d \" -f 2` |
52 | fi | |
53 | ||
54 | if test -z "$kernsrcver"; then | |
55 | AC_MSG_RESULT([Not found]) | |
56 | AC_MSG_ERROR([ | |
57 | *** Cannot determine the version of the linux kernel source. | |
58 | *** Please prepare the kernel before running this script]) | |
59 | fi | |
60 | ||
61 | AC_MSG_RESULT([$kernsrcver]) | |
62 | ||
57d86234 | 63 | LINUX=${kernelsrc} |
64 | LINUX_OBJ=${kernelbuild} | |
c5f70460 BB |
65 | LINUX_VERSION=${kernsrcver} |
66 | ||
67 | abs_srcdir=`readlink -f ${srcdir}` | |
68 | kerninclude="-I${abs_srcdir} -I${abs_srcdir}/include" | |
69 | kernwarn="-Wstrict-prototypes -Werror" | |
70 | ||
71 | if test "${LINUX_OBJ}" != "${LINUX}"; then | |
72 | kernobjs="O=$kernelbuild" | |
73 | fi | |
74 | ||
75 | KERNELCFLAGS= | |
76 | KERNELCPPFLAGS="${kerninclude} ${kernwarn}" | |
77 | KERNELMAKE_PARAMS="${kernobjs}" | |
57d86234 | 78 | |
79 | AC_SUBST(LINUX) | |
80 | AC_SUBST(LINUX_OBJ) | |
c5f70460 BB |
81 | AC_SUBST(LINUX_VERSION) |
82 | AC_SUBST(KERNELMAKE_PARAMS) | |
83 | AC_SUBST(KERNELCPPFLAGS) | |
84 | AC_SUBST(KERNELCFLAGS) | |
57d86234 | 85 | ]) |
86 | ||
6a1c3d41 | 87 | AC_DEFUN([SPL_AC_LICENSE], [ |
88 | AC_MSG_CHECKING([license]) | |
89 | AC_MSG_RESULT([GPL]) | |
90 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS" | |
91 | ]) | |
92 | ||
57d86234 | 93 | AC_DEFUN([SPL_AC_DEBUG], [ |
94 | AC_MSG_CHECKING([whether debugging is enabled]) | |
95 | AC_ARG_ENABLE( [debug], | |
96 | AS_HELP_STRING([--enable-debug], | |
97 | [Enable generic debug support (default off)]), | |
98 | [ case "$enableval" in | |
99 | yes) spl_ac_debug=yes ;; | |
475cdc78 | 100 | no) spl_ac_debug=no ;; |
57d86234 | 101 | *) AC_MSG_RESULT([Error!]) |
102 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;; | |
103 | esac ] | |
104 | ) | |
105 | if test "$spl_ac_debug" = yes; then | |
475cdc78 | 106 | AC_MSG_RESULT([yes]) |
57d86234 | 107 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG" |
108 | else | |
475cdc78 | 109 | AC_MSG_RESULT([no]) |
475cdc78 | 110 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG" |
57d86234 | 111 | fi |
57d86234 | 112 | ]) |
113 | ||
114 | AC_DEFUN([SPL_AC_DEBUG_KMEM], [ | |
115 | AC_MSG_CHECKING([whether kmem debugging is enabled]) | |
116 | AC_ARG_ENABLE( [debug-kmem], | |
117 | AS_HELP_STRING([--enable-debug-kmem], | |
118 | [Enable kmem debug support (default off)]), | |
119 | [ case "$enableval" in | |
475cdc78 | 120 | yes) spl_ac_debug_kmem=yes ;; |
121 | no) spl_ac_debug_kmem=no ;; | |
57d86234 | 122 | *) AC_MSG_RESULT([Error!]) |
123 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;; | |
124 | esac ] | |
125 | ) | |
475cdc78 | 126 | if test "$spl_ac_debug_kmem" = yes; then |
127 | AC_MSG_RESULT([yes]) | |
57d86234 | 128 | AC_DEFINE([DEBUG_KMEM], [1], |
129 | [Define to 1 to enable kmem debugging]) | |
475cdc78 | 130 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM" |
131 | else | |
132 | AC_MSG_RESULT([no]) | |
57d86234 | 133 | fi |
57d86234 | 134 | ]) |
135 | ||
136 | AC_DEFUN([SPL_AC_DEBUG_MUTEX], [ | |
137 | AC_MSG_CHECKING([whether mutex debugging is enabled]) | |
138 | AC_ARG_ENABLE( [debug-mutex], | |
139 | AS_HELP_STRING([--enable-debug-mutex], | |
140 | [Enable mutex debug support (default off)]), | |
141 | [ case "$enableval" in | |
475cdc78 | 142 | yes) spl_ac_debug_mutex=yes ;; |
143 | no) spl_ac_debug_mutex=no ;; | |
57d86234 | 144 | *) AC_MSG_RESULT([Error!]) |
145 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;; | |
146 | esac ] | |
147 | ) | |
475cdc78 | 148 | if test "$spl_ac_debug_mutex" = yes; then |
149 | AC_MSG_RESULT([yes]) | |
57d86234 | 150 | AC_DEFINE([DEBUG_MUTEX], [1], |
151 | [Define to 1 to enable mutex debugging]) | |
475cdc78 | 152 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX" |
153 | else | |
154 | AC_MSG_RESULT([no]) | |
57d86234 | 155 | fi |
57d86234 | 156 | ]) |
157 | ||
158 | AC_DEFUN([SPL_AC_DEBUG_KSTAT], [ | |
159 | AC_MSG_CHECKING([whether kstat debugging is enabled]) | |
160 | AC_ARG_ENABLE( [debug-kstat], | |
161 | AS_HELP_STRING([--enable-debug-kstat], | |
162 | [Enable kstat debug support (default off)]), | |
163 | [ case "$enableval" in | |
475cdc78 | 164 | yes) spl_ac_debug_kstat=yes ;; |
165 | no) spl_ac_debug_kstat=no ;; | |
57d86234 | 166 | *) AC_MSG_RESULT([Error!]) |
167 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;; | |
168 | esac ] | |
169 | ) | |
475cdc78 | 170 | if test "$spl_ac_debug_kstat" = yes; then |
171 | AC_MSG_RESULT([yes]) | |
57d86234 | 172 | AC_DEFINE([DEBUG_KSTAT], [1], |
173 | [Define to 1 to enable kstat debugging]) | |
475cdc78 | 174 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT" |
175 | else | |
176 | AC_MSG_RESULT([no]) | |
57d86234 | 177 | fi |
57d86234 | 178 | ]) |
179 | ||
180 | AC_DEFUN([SPL_AC_DEBUG_CALLB], [ | |
181 | AC_MSG_CHECKING([whether callb debugging is enabled]) | |
182 | AC_ARG_ENABLE( [debug-callb], | |
183 | AS_HELP_STRING([--enable-debug-callb], | |
184 | [Enable callb debug support (default off)]), | |
185 | [ case "$enableval" in | |
475cdc78 | 186 | yes) spl_ac_debug_callb=yes ;; |
187 | no) spl_ac_debug_callb=no ;; | |
57d86234 | 188 | *) AC_MSG_RESULT([Error!]) |
189 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;; | |
190 | esac ] | |
191 | ) | |
475cdc78 | 192 | if test "$spl_ac_debug_callb" = yes; then |
193 | AC_MSG_RESULT([yes]) | |
57d86234 | 194 | AC_DEFINE([DEBUG_CALLB], [1], |
195 | [Define to 1 to enable callb debugging]) | |
475cdc78 | 196 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB" |
197 | else | |
198 | AC_MSG_RESULT([no]) | |
57d86234 | 199 | fi |
57d86234 | 200 | ]) |
201 | ||
202 | dnl # | |
203 | dnl # SPL_LINUX_CONFTEST | |
204 | dnl # | |
205 | AC_DEFUN([SPL_LINUX_CONFTEST], [ | |
206 | cat >conftest.c <<_ACEOF | |
207 | $1 | |
208 | _ACEOF | |
209 | ]) | |
210 | ||
211 | dnl # | |
212 | dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY]) | |
213 | dnl # | |
214 | m4_define([SPL_LANG_PROGRAM], [ | |
215 | $1 | |
216 | int | |
217 | main (void) | |
218 | { | |
219 | dnl Do *not* indent the following line: there may be CPP directives. | |
220 | dnl Don't move the `;' right after for the same reason. | |
221 | $2 | |
222 | ; | |
223 | return 0; | |
224 | } | |
225 | ]) | |
226 | ||
227 | dnl # | |
228 | dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE | |
229 | dnl # | |
230 | AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [ | |
c5f70460 BB |
231 | m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])]) |
232 | rm -Rf build && mkdir -p build | |
233 | echo "obj-m := conftest.o" >build/Makefile | |
234 | AS_IF( | |
235 | [AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], | |
236 | [$4], | |
237 | [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])] | |
238 | ) | |
239 | rm -Rf build | |
57d86234 | 240 | ]) |
241 | ||
242 | dnl # | |
243 | dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE | |
244 | dnl # | |
245 | AC_DEFUN([SPL_LINUX_TRY_COMPILE], | |
246 | [SPL_LINUX_COMPILE_IFELSE( | |
d50bd9e2 | 247 | [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])], |
248 | [modules], | |
249 | [test -s build/conftest.o], | |
250 | [$3], [$4]) | |
57d86234 | 251 | ]) |
252 | ||
253 | dnl # | |
254 | dnl # SPL_LINUX_CONFIG | |
255 | dnl # | |
256 | AC_DEFUN([SPL_LINUX_CONFIG], | |
257 | [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1]) | |
258 | SPL_LINUX_TRY_COMPILE([ | |
259 | #ifndef AUTOCONF_INCLUDED | |
260 | #include <linux/config.h> | |
261 | #endif | |
262 | ],[ | |
263 | #ifndef CONFIG_$1 | |
264 | #error CONFIG_$1 not #defined | |
265 | #endif | |
266 | ],[ | |
267 | AC_MSG_RESULT([yes]) | |
268 | $2 | |
269 | ],[ | |
270 | AC_MSG_RESULT([no]) | |
271 | $3 | |
272 | ]) | |
273 | ]) | |
274 | ||
275 | dnl # | |
276 | dnl # SPL_CHECK_SYMBOL_EXPORT | |
277 | dnl # check symbol exported or not | |
278 | dnl # | |
279 | AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], | |
280 | [AC_MSG_CHECKING([whether symbol $1 is exported]) | |
d1ff2312 | 281 | grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX_OBJ/Module.symvers 2>/dev/null |
57d86234 | 282 | rc=$? |
283 | if test $rc -ne 0; then | |
284 | export=0 | |
285 | for file in $2; do | |
d1ff2312 | 286 | grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX_OBJ/$file" 2>/dev/null |
57d86234 | 287 | rc=$? |
288 | if test $rc -eq 0; then | |
289 | export=1 | |
290 | break; | |
291 | fi | |
292 | done | |
293 | if test $export -eq 0; then | |
294 | AC_MSG_RESULT([no]) | |
295 | $4 | |
296 | else | |
297 | AC_MSG_RESULT([yes]) | |
298 | $3 | |
299 | fi | |
300 | else | |
301 | AC_MSG_RESULT([yes]) | |
302 | $3 | |
303 | fi | |
304 | ]) | |
305 | ||
86de8532 | 306 | dnl # |
307 | dnl # SPL_CHECK_HEADER | |
308 | dnl # check whether header exists and define HAVE_$2_HEADER | |
309 | dnl # | |
310 | AC_DEFUN([SPL_CHECK_HEADER], | |
311 | [AC_MSG_CHECKING([whether header $1 exists]) | |
312 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 313 | #include <$1> |
86de8532 | 314 | ],[ |
315 | return 0; | |
316 | ],[ | |
317 | AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists]) | |
318 | AC_MSG_RESULT(yes) | |
319 | $3 | |
320 | ],[ | |
321 | AC_MSG_RESULT(no) | |
322 | $4 | |
323 | ]) | |
324 | ]) | |
6a6cafbe | 325 | |
57d86234 | 326 | dnl # |
3d061e9d | 327 | dnl # 2.6.24 API change, |
57d86234 | 328 | dnl # check if uintptr_t typedef is defined |
329 | dnl # | |
330 | AC_DEFUN([SPL_AC_TYPE_UINTPTR_T], | |
331 | [AC_MSG_CHECKING([whether kernel defines uintptr_t]) | |
332 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 333 | #include <linux/types.h> |
57d86234 | 334 | ],[ |
d50bd9e2 | 335 | uintptr_t *ptr; |
57d86234 | 336 | ],[ |
d50bd9e2 | 337 | AC_MSG_RESULT([yes]) |
338 | AC_DEFINE(HAVE_UINTPTR_T, 1, | |
57d86234 | 339 | [kernel defines uintptr_t]) |
340 | ],[ | |
d50bd9e2 | 341 | AC_MSG_RESULT([no]) |
57d86234 | 342 | ]) |
343 | ]) | |
344 | ||
a0f6da3d | 345 | dnl # |
346 | dnl # 2.6.x API change, | |
347 | dnl # check if atomic64_t typedef is defined | |
348 | dnl # | |
349 | AC_DEFUN([SPL_AC_TYPE_ATOMIC64_T], | |
350 | [AC_MSG_CHECKING([whether kernel defines atomic64_t]) | |
351 | SPL_LINUX_TRY_COMPILE([ | |
352 | #include <asm/atomic.h> | |
353 | ],[ | |
354 | atomic64_t *ptr; | |
355 | ],[ | |
356 | AC_MSG_RESULT([yes]) | |
357 | AC_DEFINE(HAVE_ATOMIC64_T, 1, | |
358 | [kernel defines atomic64_t]) | |
359 | ],[ | |
360 | AC_MSG_RESULT([no]) | |
361 | ]) | |
362 | ]) | |
363 | ||
57d86234 | 364 | dnl # |
3d061e9d | 365 | dnl # 2.6.20 API change, |
57d86234 | 366 | dnl # INIT_WORK use 2 args and not store data inside |
367 | dnl # | |
368 | AC_DEFUN([SPL_AC_3ARGS_INIT_WORK], | |
369 | [AC_MSG_CHECKING([whether INIT_WORK wants 3 args]) | |
370 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 371 | #include <linux/workqueue.h> |
57d86234 | 372 | ],[ |
d50bd9e2 | 373 | struct work_struct work; |
374 | INIT_WORK(&work, NULL, NULL); | |
57d86234 | 375 | ],[ |
d50bd9e2 | 376 | AC_MSG_RESULT(yes) |
377 | AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1, | |
378 | [INIT_WORK wants 3 args]) | |
57d86234 | 379 | ],[ |
d50bd9e2 | 380 | AC_MSG_RESULT(no) |
57d86234 | 381 | ]) |
382 | ]) | |
383 | ||
384 | dnl # | |
3d061e9d | 385 | dnl # 2.6.21 API change, |
57d86234 | 386 | dnl # 'register_sysctl_table' use only one argument instead of two |
387 | dnl # | |
388 | AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL], | |
389 | [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args]) | |
390 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 391 | #include <linux/sysctl.h> |
57d86234 | 392 | ],[ |
d50bd9e2 | 393 | return register_sysctl_table(NULL,0); |
57d86234 | 394 | ],[ |
d50bd9e2 | 395 | AC_MSG_RESULT(yes) |
396 | AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1, | |
397 | [register_sysctl_table() wants 2 args]) | |
57d86234 | 398 | ],[ |
d50bd9e2 | 399 | AC_MSG_RESULT(no) |
57d86234 | 400 | ]) |
401 | ]) | |
402 | ||
57d86234 | 403 | dnl # |
3d061e9d | 404 | dnl # 2.6.23 API change |
57d86234 | 405 | dnl # Old set_shrinker API replaced with register_shrinker |
406 | dnl # | |
407 | AC_DEFUN([SPL_AC_SET_SHRINKER], [ | |
408 | AC_MSG_CHECKING([whether set_shrinker() available]) | |
409 | SPL_LINUX_TRY_COMPILE([ | |
410 | #include <linux/mm.h> | |
411 | ],[ | |
412 | return set_shrinker(DEFAULT_SEEKS, NULL); | |
413 | ],[ | |
414 | AC_MSG_RESULT([yes]) | |
415 | AC_DEFINE(HAVE_SET_SHRINKER, 1, | |
416 | [set_shrinker() available]) | |
417 | ],[ | |
418 | AC_MSG_RESULT([no]) | |
419 | ]) | |
420 | ]) | |
421 | ||
422 | dnl # | |
3d061e9d | 423 | dnl # 2.6.25 API change, |
57d86234 | 424 | dnl # struct path entry added to struct nameidata |
425 | dnl # | |
426 | AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA], | |
427 | [AC_MSG_CHECKING([whether struct path used in struct nameidata]) | |
428 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 429 | #include <linux/namei.h> |
57d86234 | 430 | ],[ |
d50bd9e2 | 431 | struct nameidata nd; |
57d86234 | 432 | |
433 | nd.path.mnt = NULL; | |
434 | nd.path.dentry = NULL; | |
435 | ],[ | |
d50bd9e2 | 436 | AC_MSG_RESULT(yes) |
437 | AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1, | |
438 | [struct path used in struct nameidata]) | |
57d86234 | 439 | ],[ |
d50bd9e2 | 440 | AC_MSG_RESULT(no) |
57d86234 | 441 | ]) |
442 | ]) | |
443 | ||
444 | dnl # | |
445 | dnl # Custom SPL patch may export this system it is not required | |
446 | dnl # | |
447 | AC_DEFUN([SPL_AC_TASK_CURR], [ | |
448 | SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c], | |
449 | [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])], | |
450 | []) | |
451 | ]) | |
452 | ||
453 | dnl # | |
3d061e9d | 454 | dnl # 2.6.19 API change, |
57d86234 | 455 | dnl # Use CTL_UNNUMBERED when binary sysctl is not required |
456 | dnl # | |
457 | AC_DEFUN([SPL_AC_CTL_UNNUMBERED], | |
458 | [AC_MSG_CHECKING([whether unnumbered sysctl support exists]) | |
459 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 460 | #include <linux/sysctl.h> |
57d86234 | 461 | ],[ |
462 | #ifndef CTL_UNNUMBERED | |
463 | #error CTL_UNNUMBERED undefined | |
464 | #endif | |
465 | ],[ | |
d50bd9e2 | 466 | AC_MSG_RESULT(yes) |
467 | AC_DEFINE(HAVE_CTL_UNNUMBERED, 1, | |
468 | [unnumbered sysctl support exists]) | |
57d86234 | 469 | ],[ |
d50bd9e2 | 470 | AC_MSG_RESULT(no) |
57d86234 | 471 | ]) |
472 | ]) | |
877a32e9 | 473 | |
474 | dnl # | |
475 | dnl # 2.6.16 API change. | |
476 | dnl # Check if 'fls64()' is available | |
477 | dnl # | |
478 | AC_DEFUN([SPL_AC_FLS64], | |
6a6cafbe | 479 | [AC_MSG_CHECKING([whether fls64() is available]) |
480 | SPL_LINUX_TRY_COMPILE([ | |
481 | #include <linux/bitops.h> | |
482 | ],[ | |
483 | return fls64(0); | |
484 | ],[ | |
485 | AC_MSG_RESULT(yes) | |
486 | AC_DEFINE(HAVE_FLS64, 1, [fls64() is available]) | |
487 | ],[ | |
488 | AC_MSG_RESULT(no) | |
489 | ]) | |
877a32e9 | 490 | ]) |
46c685d0 | 491 | |
492 | dnl # | |
493 | dnl # 2.6.18 API change, check whether device_create() is available. | |
494 | dnl # Device_create() was introduced in 2.6.18 and depricated | |
495 | dnl # class_device_create() which was fully removed in 2.6.26. | |
496 | dnl # | |
497 | AC_DEFUN([SPL_AC_DEVICE_CREATE], [ | |
498 | SPL_CHECK_SYMBOL_EXPORT( | |
499 | [device_create], | |
500 | [drivers/base/core.c], | |
501 | [AC_DEFINE(HAVE_DEVICE_CREATE, 1, | |
502 | [device_create() is available])], | |
6a6cafbe | 503 | []) |
46c685d0 | 504 | ]) |
505 | ||
8123ac4f BB |
506 | dnl # |
507 | dnl # 2.6.27 API change, | |
508 | dnl # device_create() uses 5 args, new 'drvdata' argument. | |
509 | dnl # | |
510 | AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [ | |
511 | AC_MSG_CHECKING([whether device_create() wants 5 args]) | |
512 | tmp_flags="$EXTRA_KCFLAGS" | |
513 | EXTRA_KCFLAGS="-Werror" | |
514 | SPL_LINUX_TRY_COMPILE([ | |
515 | #include <linux/device.h> | |
516 | ],[ | |
517 | device_create(NULL, NULL, 0, NULL, "%d", 1); | |
518 | ],[ | |
519 | AC_MSG_RESULT(yes) | |
520 | AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1, | |
521 | [device_create wants 5 args]) | |
522 | ],[ | |
523 | AC_MSG_RESULT(no) | |
524 | ]) | |
525 | EXTRA_KCFLAGS="$tmp_flags" | |
526 | ]) | |
527 | ||
46c685d0 | 528 | dnl # |
529 | dnl # 2.6.13 API change, check whether class_device_create() is available. | |
530 | dnl # Class_device_create() was introduced in 2.6.13 and depricated | |
531 | dnl # class_simple_device_add() which was fully removed in 2.6.13. | |
532 | dnl # | |
533 | AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [ | |
534 | SPL_CHECK_SYMBOL_EXPORT( | |
535 | [class_device_create], | |
536 | [drivers/base/class.c], | |
537 | [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1, | |
538 | [class_device_create() is available])], | |
6a6cafbe | 539 | []) |
46c685d0 | 540 | ]) |
6a6cafbe | 541 | |
6a6cafbe | 542 | dnl # |
543 | dnl # 2.6.26 API change, set_normalized_timespec() is exported. | |
544 | dnl # | |
545 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [ | |
546 | SPL_CHECK_SYMBOL_EXPORT( | |
547 | [set_normalized_timespec], | |
548 | [kernel/time.c], | |
549 | [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1, | |
550 | [set_normalized_timespec() is available as export])], | |
551 | []) | |
552 | ]) | |
553 | ||
554 | dnl # | |
555 | dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c | |
556 | dnl # previously it was available in time.h as an inline. | |
557 | dnl # | |
86de8532 | 558 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [ |
559 | AC_MSG_CHECKING([whether set_normalized_timespec() is an inline]) | |
6a6cafbe | 560 | SPL_LINUX_TRY_COMPILE([ |
561 | #include <linux/time.h> | |
6a6cafbe | 562 | void set_normalized_timespec(struct timespec *ts, |
25557fd8 | 563 | time_t sec, long nsec) { } |
564 | ], | |
565 | [], | |
566 | [ | |
6a6cafbe | 567 | AC_MSG_RESULT(no) |
568 | ],[ | |
569 | AC_MSG_RESULT(yes) | |
570 | AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1, | |
571 | [set_normalized_timespec() is available as inline]) | |
572 | ]) | |
573 | ]) | |
574 | ||
575 | dnl # | |
576 | dnl # 2.6.18 API change, | |
577 | dnl # timespec_sub() inline function available in linux/time.h | |
578 | dnl # | |
86de8532 | 579 | AC_DEFUN([SPL_AC_TIMESPEC_SUB], [ |
580 | AC_MSG_CHECKING([whether timespec_sub() is available]) | |
6a6cafbe | 581 | SPL_LINUX_TRY_COMPILE([ |
582 | #include <linux/time.h> | |
583 | ],[ | |
584 | struct timespec a, b, c = { 0 }; | |
585 | c = timespec_sub(a, b); | |
586 | ],[ | |
587 | AC_MSG_RESULT(yes) | |
588 | AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available]) | |
589 | ],[ | |
590 | AC_MSG_RESULT(no) | |
591 | ]) | |
592 | ]) | |
593 | ||
86de8532 | 594 | dnl # |
3d061e9d | 595 | dnl # 2.6.19 API change, |
596 | dnl # check if init_utsname() is available in linux/utsname.h | |
597 | dnl # | |
598 | AC_DEFUN([SPL_AC_INIT_UTSNAME], [ | |
599 | AC_MSG_CHECKING([whether init_utsname() is available]) | |
600 | SPL_LINUX_TRY_COMPILE([ | |
601 | #include <linux/utsname.h> | |
602 | ],[ | |
603 | struct new_utsname *a = init_utsname(); | |
604 | ],[ | |
605 | AC_MSG_RESULT(yes) | |
606 | AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available]) | |
607 | ],[ | |
608 | AC_MSG_RESULT(no) | |
609 | ]) | |
610 | ]) | |
611 | ||
612 | dnl # | |
613 | dnl # 2.6.26 API change, | |
614 | dnl # definition of struct fdtable relocated to linux/fdtable.h | |
86de8532 | 615 | dnl # |
616 | AC_DEFUN([SPL_AC_FDTABLE_HEADER], [ | |
617 | SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], []) | |
618 | ]) | |
322640b7 | 619 | |
620 | dnl # | |
3d061e9d | 621 | dnl # 2.6.14 API change, |
622 | dnl # check whether 'files_fdtable()' exists | |
623 | dnl # | |
624 | AC_DEFUN([SPL_AC_FILES_FDTABLE], [ | |
625 | AC_MSG_CHECKING([whether files_fdtable() is available]) | |
626 | SPL_LINUX_TRY_COMPILE([ | |
627 | #include <linux/sched.h> | |
628 | #include <linux/file.h> | |
629 | #ifdef HAVE_FDTABLE_HEADER | |
630 | #include <linux/fdtable.h> | |
631 | #endif | |
632 | ],[ | |
633 | struct files_struct *files = current->files; | |
634 | struct fdtable *fdt = files_fdtable(files); | |
635 | ],[ | |
636 | AC_MSG_RESULT(yes) | |
637 | AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available]) | |
638 | ],[ | |
639 | AC_MSG_RESULT(no) | |
640 | ]) | |
641 | ]) | |
642 | ||
643 | dnl # | |
644 | dnl # 2.6.18 API change, | |
645 | dnl # added linux/uaccess.h | |
322640b7 | 646 | dnl # |
647 | AC_DEFUN([SPL_AC_UACCESS_HEADER], [ | |
648 | SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], []) | |
649 | ]) | |
3d061e9d | 650 | |
651 | dnl # | |
652 | dnl # 2.6.12 API change, | |
653 | dnl # check whether 'kmalloc_node()' is available. | |
654 | dnl # | |
655 | AC_DEFUN([SPL_AC_KMALLOC_NODE], [ | |
656 | AC_MSG_CHECKING([whether kmalloc_node() is available]) | |
657 | SPL_LINUX_TRY_COMPILE([ | |
658 | #include <linux/slab.h> | |
659 | ],[ | |
660 | void *a = kmalloc_node(1, GFP_KERNEL, 0); | |
661 | ],[ | |
662 | AC_MSG_RESULT(yes) | |
663 | AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available]) | |
664 | ],[ | |
665 | AC_MSG_RESULT(no) | |
666 | ]) | |
667 | ]) | |
668 | ||
669 | dnl # | |
670 | dnl # 2.6.9 API change, | |
671 | dnl # check whether 'monotonic_clock()' is available it may | |
672 | dnl # be available for some archs but not others. | |
673 | dnl # | |
674 | AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [ | |
675 | SPL_CHECK_SYMBOL_EXPORT( | |
676 | [monotonic_clock], | |
677 | [], | |
678 | [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, | |
679 | [monotonic_clock() is available])], | |
680 | []) | |
681 | ]) | |
682 | ||
683 | dnl # | |
684 | dnl # 2.6.16 API change, | |
685 | dnl # check whether 'struct inode' has i_mutex | |
686 | dnl # | |
687 | AC_DEFUN([SPL_AC_INODE_I_MUTEX], [ | |
688 | AC_MSG_CHECKING([whether struct inode has i_mutex]) | |
689 | SPL_LINUX_TRY_COMPILE([ | |
690 | #include <linux/fs.h> | |
691 | #include <linux/mutex.h> | |
692 | ],[ | |
693 | struct inode i; | |
694 | mutex_init(&i.i_mutex); | |
695 | ],[ | |
696 | AC_MSG_RESULT(yes) | |
697 | AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex]) | |
698 | ],[ | |
699 | AC_MSG_RESULT(no) | |
700 | ]) | |
701 | ]) | |
b61a6e8b | 702 | |
703 | dnl # | |
704 | dnl # 2.6.14 API change, | |
705 | dnl # check whether 'div64_64()' is available | |
706 | dnl # | |
707 | AC_DEFUN([SPL_AC_DIV64_64], [ | |
708 | AC_MSG_CHECKING([whether div64_64() is available]) | |
709 | SPL_LINUX_TRY_COMPILE([ | |
710 | #include <asm/div64.h> | |
550f1705 | 711 | #include <linux/types.h> |
b61a6e8b | 712 | ],[ |
713 | uint64_t i = div64_64(1ULL, 1ULL); | |
714 | ],[ | |
715 | AC_MSG_RESULT(yes) | |
716 | AC_DEFINE(HAVE_DIV64_64, 1, [div64_64() is available]) | |
717 | ],[ | |
718 | AC_MSG_RESULT(no) | |
719 | ]) | |
720 | ]) | |
31a033ec BB |
721 | |
722 | dnl # | |
723 | dnl # 2.6.27 API change, | |
724 | dnl # on_each_cpu() uses 3 args, no 'retry' argument | |
725 | dnl # | |
726 | AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [ | |
727 | AC_MSG_CHECKING([whether on_each_cpu() wants 3 args]) | |
728 | SPL_LINUX_TRY_COMPILE([ | |
729 | #include <linux/smp.h> | |
730 | ],[ | |
731 | on_each_cpu(NULL, NULL, 0); | |
732 | ],[ | |
733 | AC_MSG_RESULT(yes) | |
734 | AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1, | |
735 | [on_each_cpu wants 3 args]) | |
736 | ],[ | |
737 | AC_MSG_RESULT(no) | |
738 | ]) | |
739 | ]) | |
36b313da BB |
740 | |
741 | dnl # | |
d1ff2312 BB |
742 | dnl # 2.6.18 API change, |
743 | dnl # kallsyms_lookup_name no longer exported | |
744 | dnl # | |
745 | AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [ | |
746 | SPL_CHECK_SYMBOL_EXPORT( | |
747 | [kallsyms_lookup_name], | |
748 | [], | |
749 | [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1, | |
750 | [kallsyms_lookup_name() is available])], | |
751 | []) | |
752 | ]) | |
753 | ||
754 | dnl # | |
e11d6c5f BB |
755 | dnl # Proposed API change, |
756 | dnl # This symbol is not available in stock kernels. You may build a | |
757 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
758 | dnl # these symbols for use. If your already rolling a custom kernel for | |
759 | dnl # your environment this is recommended. | |
d1ff2312 BB |
760 | dnl # |
761 | AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [ | |
762 | SPL_CHECK_SYMBOL_EXPORT( | |
763 | [get_vmalloc_info], | |
764 | [], | |
765 | [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1, | |
766 | [get_vmalloc_info() is available])], | |
767 | []) | |
768 | ]) | |
769 | ||
770 | dnl # | |
e11d6c5f BB |
771 | dnl # Proposed API change, |
772 | dnl # This symbol is not available in stock kernels. You may build a | |
773 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
774 | dnl # these symbols for use. If your already rolling a custom kernel for | |
775 | dnl # your environment this is recommended. | |
36b313da BB |
776 | dnl # |
777 | AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [ | |
778 | SPL_CHECK_SYMBOL_EXPORT( | |
779 | [first_online_pgdat], | |
780 | [], | |
781 | [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1, | |
782 | [first_online_pgdat() is available])], | |
783 | []) | |
784 | ]) | |
785 | ||
786 | dnl # | |
e11d6c5f BB |
787 | dnl # Proposed API change, |
788 | dnl # This symbol is not available in stock kernels. You may build a | |
789 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
790 | dnl # these symbols for use. If your already rolling a custom kernel for | |
791 | dnl # your environment this is recommended. | |
36b313da BB |
792 | dnl # |
793 | AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [ | |
794 | SPL_CHECK_SYMBOL_EXPORT( | |
795 | [next_online_pgdat], | |
796 | [], | |
797 | [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1, | |
798 | [next_online_pgdat() is available])], | |
799 | []) | |
800 | ]) | |
801 | ||
802 | dnl # | |
e11d6c5f BB |
803 | dnl # Proposed API change, |
804 | dnl # This symbol is not available in stock kernels. You may build a | |
805 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
806 | dnl # these symbols for use. If your already rolling a custom kernel for | |
807 | dnl # your environment this is recommended. | |
36b313da BB |
808 | dnl # |
809 | AC_DEFUN([SPL_AC_NEXT_ZONE], [ | |
810 | SPL_CHECK_SYMBOL_EXPORT( | |
811 | [next_zone], | |
812 | [], | |
813 | [AC_DEFINE(HAVE_NEXT_ZONE, 1, | |
814 | [next_zone() is available])], | |
815 | []) | |
816 | ]) | |
4ab13d3b BB |
817 | |
818 | dnl # | |
e11d6c5f BB |
819 | dnl # Proposed API change, |
820 | dnl # This symbol is not available in stock kernels. You may build a | |
821 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
822 | dnl # these symbols for use. If your already rolling a custom kernel for | |
823 | dnl # your environment this is recommended. | |
4ab13d3b BB |
824 | dnl # |
825 | AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [ | |
826 | SPL_CHECK_SYMBOL_EXPORT( | |
827 | [get_zone_counts], | |
828 | [], | |
829 | [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1, | |
830 | [get_zone_counts() is available])], | |
831 | []) | |
832 | ]) | |
e11d6c5f BB |
833 | |
834 | dnl # | |
835 | dnl # 2.6.21 API change, | |
836 | dnl # Public global zone stats now include free/inactive/active page | |
837 | dnl # counts. This replaced the priviate get_zone_counts() interface. | |
838 | dnl # | |
839 | AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FIA], [ | |
840 | AC_MSG_CHECKING([whether free/inactive/active page state is available]) | |
841 | SPL_LINUX_TRY_COMPILE([ | |
842 | #include <linux/mmzone.h> | |
843 | ],[ | |
844 | enum zone_stat_item i1, i2, i3; | |
845 | i1 = NR_FREE_PAGES; | |
846 | i2 = NR_INACTIVE; | |
847 | i3 = NR_ACTIVE; | |
848 | ],[ | |
849 | AC_MSG_RESULT(yes) | |
850 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_FIA, 1, | |
851 | [free/inactive/active page state is available]) | |
852 | ],[ | |
853 | AC_MSG_RESULT(no) | |
854 | ]) | |
855 | ]) |