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