]>
Commit | Line | Data |
---|---|---|
57d86234 BB |
1 | AC_DEFUN([SPL_AC_KERNEL], [ |
2 | ver=`uname -r` | |
3 | ||
4 | AC_ARG_WITH([linux], | |
5 | AS_HELP_STRING([--with-linux=PATH], | |
6 | [Path to kernel source]), | |
7 | [kernelsrc="$withval"; kernelbuild="$withval"]) | |
8 | ||
9 | AC_ARG_WITH([linux-obj], | |
10 | AS_HELP_STRING([--with-linux-obj=PATH], | |
11 | [Path to kernel build objects]), | |
12 | [kernelbuild="$withval"]) | |
13 | ||
14 | AC_MSG_CHECKING([kernel source directory]) | |
15 | if test -z "$kernelsrc"; then | |
16 | kernelbuild= | |
17 | sourcelink=/lib/modules/${ver}/source | |
18 | buildlink=/lib/modules/${ver}/build | |
19 | ||
20 | if test -e $sourcelink; then | |
21 | kernelsrc=`(cd $sourcelink; /bin/pwd)` | |
22 | fi | |
23 | if test -e $buildlink; then | |
24 | kernelbuild=`(cd $buildlink; /bin/pwd)` | |
25 | fi | |
26 | if test -z "$kernelsrc"; then | |
27 | kernelsrc=$kernelbuild | |
28 | fi | |
29 | if test -z "$kernelsrc" -o -z "$kernelbuild"; then | |
30 | AC_MSG_RESULT([Not found]) | |
31 | AC_MSG_ERROR([ | |
32 | *** Please specify the location of the kernel source | |
33 | *** with the '--with-kernel=PATH' option]) | |
34 | fi | |
35 | fi | |
36 | ||
37 | AC_MSG_RESULT([$kernelsrc]) | |
38 | AC_MSG_CHECKING([kernel build directory]) | |
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") | | |
47 | cpp -I $kernelbuild/include | | |
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") | | |
55 | cpp -I $kernelbuild/include | | |
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 | ||
68 | kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver | |
69 | LINUX=${kernelsrc} | |
70 | LINUX_OBJ=${kernelbuild} | |
71 | ||
72 | AC_SUBST(LINUX) | |
73 | AC_SUBST(LINUX_OBJ) | |
74 | AC_SUBST(kmoduledir) | |
75 | ]) | |
76 | ||
77 | AC_DEFUN([SPL_AC_DEBUG], [ | |
78 | AC_MSG_CHECKING([whether debugging is enabled]) | |
79 | AC_ARG_ENABLE( [debug], | |
80 | AS_HELP_STRING([--enable-debug], | |
81 | [Enable generic debug support (default off)]), | |
82 | [ case "$enableval" in | |
83 | yes) spl_ac_debug=yes ;; | |
475cdc78 | 84 | no) spl_ac_debug=no ;; |
57d86234 BB |
85 | *) AC_MSG_RESULT([Error!]) |
86 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;; | |
87 | esac ] | |
88 | ) | |
89 | if test "$spl_ac_debug" = yes; then | |
475cdc78 | 90 | AC_MSG_RESULT([yes]) |
57d86234 BB |
91 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG" |
92 | else | |
475cdc78 | 93 | AC_MSG_RESULT([no]) |
57d86234 BB |
94 | AC_DEFINE([NDEBUG], [1], |
95 | [Define to 1 to disable debug tracing]) | |
475cdc78 | 96 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG" |
57d86234 | 97 | fi |
57d86234 BB |
98 | ]) |
99 | ||
100 | AC_DEFUN([SPL_AC_DEBUG_KMEM], [ | |
101 | AC_MSG_CHECKING([whether kmem debugging is enabled]) | |
102 | AC_ARG_ENABLE( [debug-kmem], | |
103 | AS_HELP_STRING([--enable-debug-kmem], | |
104 | [Enable kmem debug support (default off)]), | |
105 | [ case "$enableval" in | |
475cdc78 BB |
106 | yes) spl_ac_debug_kmem=yes ;; |
107 | no) spl_ac_debug_kmem=no ;; | |
57d86234 BB |
108 | *) AC_MSG_RESULT([Error!]) |
109 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;; | |
110 | esac ] | |
111 | ) | |
475cdc78 BB |
112 | if test "$spl_ac_debug_kmem" = yes; then |
113 | AC_MSG_RESULT([yes]) | |
57d86234 BB |
114 | AC_DEFINE([DEBUG_KMEM], [1], |
115 | [Define to 1 to enable kmem debugging]) | |
475cdc78 BB |
116 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM" |
117 | else | |
118 | AC_MSG_RESULT([no]) | |
57d86234 | 119 | fi |
57d86234 BB |
120 | ]) |
121 | ||
122 | AC_DEFUN([SPL_AC_DEBUG_MUTEX], [ | |
123 | AC_MSG_CHECKING([whether mutex debugging is enabled]) | |
124 | AC_ARG_ENABLE( [debug-mutex], | |
125 | AS_HELP_STRING([--enable-debug-mutex], | |
126 | [Enable mutex debug support (default off)]), | |
127 | [ case "$enableval" in | |
475cdc78 BB |
128 | yes) spl_ac_debug_mutex=yes ;; |
129 | no) spl_ac_debug_mutex=no ;; | |
57d86234 BB |
130 | *) AC_MSG_RESULT([Error!]) |
131 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;; | |
132 | esac ] | |
133 | ) | |
475cdc78 BB |
134 | if test "$spl_ac_debug_mutex" = yes; then |
135 | AC_MSG_RESULT([yes]) | |
57d86234 BB |
136 | AC_DEFINE([DEBUG_MUTEX], [1], |
137 | [Define to 1 to enable mutex debugging]) | |
475cdc78 BB |
138 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX" |
139 | else | |
140 | AC_MSG_RESULT([no]) | |
57d86234 | 141 | fi |
57d86234 BB |
142 | ]) |
143 | ||
144 | AC_DEFUN([SPL_AC_DEBUG_KSTAT], [ | |
145 | AC_MSG_CHECKING([whether kstat debugging is enabled]) | |
146 | AC_ARG_ENABLE( [debug-kstat], | |
147 | AS_HELP_STRING([--enable-debug-kstat], | |
148 | [Enable kstat debug support (default off)]), | |
149 | [ case "$enableval" in | |
475cdc78 BB |
150 | yes) spl_ac_debug_kstat=yes ;; |
151 | no) spl_ac_debug_kstat=no ;; | |
57d86234 BB |
152 | *) AC_MSG_RESULT([Error!]) |
153 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;; | |
154 | esac ] | |
155 | ) | |
475cdc78 BB |
156 | if test "$spl_ac_debug_kstat" = yes; then |
157 | AC_MSG_RESULT([yes]) | |
57d86234 BB |
158 | AC_DEFINE([DEBUG_KSTAT], [1], |
159 | [Define to 1 to enable kstat debugging]) | |
475cdc78 BB |
160 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT" |
161 | else | |
162 | AC_MSG_RESULT([no]) | |
57d86234 | 163 | fi |
57d86234 BB |
164 | ]) |
165 | ||
166 | AC_DEFUN([SPL_AC_DEBUG_CALLB], [ | |
167 | AC_MSG_CHECKING([whether callb debugging is enabled]) | |
168 | AC_ARG_ENABLE( [debug-callb], | |
169 | AS_HELP_STRING([--enable-debug-callb], | |
170 | [Enable callb debug support (default off)]), | |
171 | [ case "$enableval" in | |
475cdc78 BB |
172 | yes) spl_ac_debug_callb=yes ;; |
173 | no) spl_ac_debug_callb=no ;; | |
57d86234 BB |
174 | *) AC_MSG_RESULT([Error!]) |
175 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;; | |
176 | esac ] | |
177 | ) | |
475cdc78 BB |
178 | if test "$spl_ac_debug_callb" = yes; then |
179 | AC_MSG_RESULT([yes]) | |
57d86234 BB |
180 | AC_DEFINE([DEBUG_CALLB], [1], |
181 | [Define to 1 to enable callb debugging]) | |
475cdc78 BB |
182 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB" |
183 | else | |
184 | AC_MSG_RESULT([no]) | |
57d86234 | 185 | fi |
57d86234 BB |
186 | ]) |
187 | ||
188 | dnl # | |
189 | dnl # SPL_LINUX_CONFTEST | |
190 | dnl # | |
191 | AC_DEFUN([SPL_LINUX_CONFTEST], [ | |
192 | cat >conftest.c <<_ACEOF | |
193 | $1 | |
194 | _ACEOF | |
195 | ]) | |
196 | ||
197 | dnl # | |
198 | dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY]) | |
199 | dnl # | |
200 | m4_define([SPL_LANG_PROGRAM], [ | |
201 | $1 | |
202 | int | |
203 | main (void) | |
204 | { | |
205 | dnl Do *not* indent the following line: there may be CPP directives. | |
206 | dnl Don't move the `;' right after for the same reason. | |
207 | $2 | |
208 | ; | |
209 | return 0; | |
210 | } | |
211 | ]) | |
212 | ||
213 | dnl # | |
214 | dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE | |
215 | dnl # | |
216 | AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [ | |
217 | m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])dnl | |
218 | rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile | |
219 | echo "obj-m := conftest.o" >build/Makefile | |
220 | dnl AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" -f $PWD/build/Makefile LINUXINCLUDE="-Iinclude -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 SUBDIRS=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], | |
221 | AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" LINUXINCLUDE="-Iinclude -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])], | |
222 | [$4], | |
223 | [_AC_MSG_LOG_CONFTEST | |
224 | m4_ifvaln([$5],[$5])dnl])dnl | |
225 | rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.ko m4_ifval([$1], [build/conftest.c conftest.c])[]dnl | |
226 | ]) | |
227 | ||
228 | dnl # | |
229 | dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE | |
230 | dnl # | |
231 | AC_DEFUN([SPL_LINUX_TRY_COMPILE], | |
232 | [SPL_LINUX_COMPILE_IFELSE( | |
d50bd9e2 BB |
233 | [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])], |
234 | [modules], | |
235 | [test -s build/conftest.o], | |
236 | [$3], [$4]) | |
57d86234 BB |
237 | ]) |
238 | ||
239 | dnl # | |
240 | dnl # SPL_LINUX_CONFIG | |
241 | dnl # | |
242 | AC_DEFUN([SPL_LINUX_CONFIG], | |
243 | [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1]) | |
244 | SPL_LINUX_TRY_COMPILE([ | |
245 | #ifndef AUTOCONF_INCLUDED | |
246 | #include <linux/config.h> | |
247 | #endif | |
248 | ],[ | |
249 | #ifndef CONFIG_$1 | |
250 | #error CONFIG_$1 not #defined | |
251 | #endif | |
252 | ],[ | |
253 | AC_MSG_RESULT([yes]) | |
254 | $2 | |
255 | ],[ | |
256 | AC_MSG_RESULT([no]) | |
257 | $3 | |
258 | ]) | |
259 | ]) | |
260 | ||
261 | dnl # | |
262 | dnl # SPL_CHECK_SYMBOL_EXPORT | |
263 | dnl # check symbol exported or not | |
264 | dnl # | |
265 | AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], | |
266 | [AC_MSG_CHECKING([whether symbol $1 is exported]) | |
267 | grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/Module.symvers 2>/dev/null | |
268 | rc=$? | |
269 | if test $rc -ne 0; then | |
270 | export=0 | |
271 | for file in $2; do | |
272 | grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX/$file" 2>/dev/null | |
273 | rc=$? | |
274 | if test $rc -eq 0; then | |
275 | export=1 | |
276 | break; | |
277 | fi | |
278 | done | |
279 | if test $export -eq 0; then | |
280 | AC_MSG_RESULT([no]) | |
281 | $4 | |
282 | else | |
283 | AC_MSG_RESULT([yes]) | |
284 | $3 | |
285 | fi | |
286 | else | |
287 | AC_MSG_RESULT([yes]) | |
288 | $3 | |
289 | fi | |
290 | ]) | |
291 | ||
86de8532 BB |
292 | dnl # |
293 | dnl # SPL_CHECK_HEADER | |
294 | dnl # check whether header exists and define HAVE_$2_HEADER | |
295 | dnl # | |
296 | AC_DEFUN([SPL_CHECK_HEADER], | |
297 | [AC_MSG_CHECKING([whether header $1 exists]) | |
298 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 299 | #include <$1> |
86de8532 BB |
300 | ],[ |
301 | return 0; | |
302 | ],[ | |
303 | AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists]) | |
304 | AC_MSG_RESULT(yes) | |
305 | $3 | |
306 | ],[ | |
307 | AC_MSG_RESULT(no) | |
308 | $4 | |
309 | ]) | |
310 | ]) | |
6a6cafbe | 311 | |
57d86234 | 312 | dnl # |
3d061e9d | 313 | dnl # 2.6.24 API change, |
57d86234 BB |
314 | dnl # check if uintptr_t typedef is defined |
315 | dnl # | |
316 | AC_DEFUN([SPL_AC_TYPE_UINTPTR_T], | |
317 | [AC_MSG_CHECKING([whether kernel defines uintptr_t]) | |
318 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 319 | #include <linux/types.h> |
57d86234 | 320 | ],[ |
d50bd9e2 | 321 | uintptr_t *ptr; |
57d86234 | 322 | ],[ |
d50bd9e2 BB |
323 | AC_MSG_RESULT([yes]) |
324 | AC_DEFINE(HAVE_UINTPTR_T, 1, | |
57d86234 BB |
325 | [kernel defines uintptr_t]) |
326 | ],[ | |
d50bd9e2 | 327 | AC_MSG_RESULT([no]) |
57d86234 BB |
328 | ]) |
329 | ]) | |
330 | ||
a0f6da3d BB |
331 | dnl # |
332 | dnl # 2.6.x API change, | |
333 | dnl # check if atomic64_t typedef is defined | |
334 | dnl # | |
335 | AC_DEFUN([SPL_AC_TYPE_ATOMIC64_T], | |
336 | [AC_MSG_CHECKING([whether kernel defines atomic64_t]) | |
337 | SPL_LINUX_TRY_COMPILE([ | |
338 | #include <asm/atomic.h> | |
339 | ],[ | |
340 | atomic64_t *ptr; | |
341 | ],[ | |
342 | AC_MSG_RESULT([yes]) | |
343 | AC_DEFINE(HAVE_ATOMIC64_T, 1, | |
344 | [kernel defines atomic64_t]) | |
345 | ],[ | |
346 | AC_MSG_RESULT([no]) | |
347 | ]) | |
348 | ]) | |
349 | ||
57d86234 | 350 | dnl # |
3d061e9d | 351 | dnl # 2.6.20 API change, |
57d86234 BB |
352 | dnl # INIT_WORK use 2 args and not store data inside |
353 | dnl # | |
354 | AC_DEFUN([SPL_AC_3ARGS_INIT_WORK], | |
355 | [AC_MSG_CHECKING([whether INIT_WORK wants 3 args]) | |
356 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 357 | #include <linux/workqueue.h> |
57d86234 | 358 | ],[ |
d50bd9e2 BB |
359 | struct work_struct work; |
360 | INIT_WORK(&work, NULL, NULL); | |
57d86234 | 361 | ],[ |
d50bd9e2 BB |
362 | AC_MSG_RESULT(yes) |
363 | AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1, | |
364 | [INIT_WORK wants 3 args]) | |
57d86234 | 365 | ],[ |
d50bd9e2 | 366 | AC_MSG_RESULT(no) |
57d86234 BB |
367 | ]) |
368 | ]) | |
369 | ||
370 | dnl # | |
3d061e9d | 371 | dnl # 2.6.21 API change, |
57d86234 BB |
372 | dnl # 'register_sysctl_table' use only one argument instead of two |
373 | dnl # | |
374 | AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL], | |
375 | [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args]) | |
376 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 377 | #include <linux/sysctl.h> |
57d86234 | 378 | ],[ |
d50bd9e2 | 379 | return register_sysctl_table(NULL,0); |
57d86234 | 380 | ],[ |
d50bd9e2 BB |
381 | AC_MSG_RESULT(yes) |
382 | AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1, | |
383 | [register_sysctl_table() wants 2 args]) | |
57d86234 | 384 | ],[ |
d50bd9e2 | 385 | AC_MSG_RESULT(no) |
57d86234 BB |
386 | ]) |
387 | ]) | |
388 | ||
57d86234 | 389 | dnl # |
3d061e9d | 390 | dnl # 2.6.23 API change |
57d86234 BB |
391 | dnl # Old set_shrinker API replaced with register_shrinker |
392 | dnl # | |
393 | AC_DEFUN([SPL_AC_SET_SHRINKER], [ | |
394 | AC_MSG_CHECKING([whether set_shrinker() available]) | |
395 | SPL_LINUX_TRY_COMPILE([ | |
396 | #include <linux/mm.h> | |
397 | ],[ | |
398 | return set_shrinker(DEFAULT_SEEKS, NULL); | |
399 | ],[ | |
400 | AC_MSG_RESULT([yes]) | |
401 | AC_DEFINE(HAVE_SET_SHRINKER, 1, | |
402 | [set_shrinker() available]) | |
403 | ],[ | |
404 | AC_MSG_RESULT([no]) | |
405 | ]) | |
406 | ]) | |
407 | ||
408 | dnl # | |
3d061e9d | 409 | dnl # 2.6.25 API change, |
57d86234 BB |
410 | dnl # struct path entry added to struct nameidata |
411 | dnl # | |
412 | AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA], | |
413 | [AC_MSG_CHECKING([whether struct path used in struct nameidata]) | |
414 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 415 | #include <linux/namei.h> |
57d86234 | 416 | ],[ |
d50bd9e2 | 417 | struct nameidata nd; |
57d86234 BB |
418 | |
419 | nd.path.mnt = NULL; | |
420 | nd.path.dentry = NULL; | |
421 | ],[ | |
d50bd9e2 BB |
422 | AC_MSG_RESULT(yes) |
423 | AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1, | |
424 | [struct path used in struct nameidata]) | |
57d86234 | 425 | ],[ |
d50bd9e2 | 426 | AC_MSG_RESULT(no) |
57d86234 BB |
427 | ]) |
428 | ]) | |
429 | ||
430 | dnl # | |
431 | dnl # Custom SPL patch may export this system it is not required | |
432 | dnl # | |
433 | AC_DEFUN([SPL_AC_TASK_CURR], [ | |
434 | SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c], | |
435 | [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])], | |
436 | []) | |
437 | ]) | |
438 | ||
439 | dnl # | |
3d061e9d | 440 | dnl # 2.6.19 API change, |
57d86234 BB |
441 | dnl # Use CTL_UNNUMBERED when binary sysctl is not required |
442 | dnl # | |
443 | AC_DEFUN([SPL_AC_CTL_UNNUMBERED], | |
444 | [AC_MSG_CHECKING([whether unnumbered sysctl support exists]) | |
445 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 446 | #include <linux/sysctl.h> |
57d86234 BB |
447 | ],[ |
448 | #ifndef CTL_UNNUMBERED | |
449 | #error CTL_UNNUMBERED undefined | |
450 | #endif | |
451 | ],[ | |
d50bd9e2 BB |
452 | AC_MSG_RESULT(yes) |
453 | AC_DEFINE(HAVE_CTL_UNNUMBERED, 1, | |
454 | [unnumbered sysctl support exists]) | |
57d86234 | 455 | ],[ |
d50bd9e2 | 456 | AC_MSG_RESULT(no) |
57d86234 BB |
457 | ]) |
458 | ]) | |
877a32e9 BB |
459 | |
460 | dnl # | |
461 | dnl # 2.6.16 API change. | |
462 | dnl # Check if 'fls64()' is available | |
463 | dnl # | |
464 | AC_DEFUN([SPL_AC_FLS64], | |
6a6cafbe BB |
465 | [AC_MSG_CHECKING([whether fls64() is available]) |
466 | SPL_LINUX_TRY_COMPILE([ | |
467 | #include <linux/bitops.h> | |
468 | ],[ | |
469 | return fls64(0); | |
470 | ],[ | |
471 | AC_MSG_RESULT(yes) | |
472 | AC_DEFINE(HAVE_FLS64, 1, [fls64() is available]) | |
473 | ],[ | |
474 | AC_MSG_RESULT(no) | |
475 | ]) | |
877a32e9 | 476 | ]) |
46c685d0 BB |
477 | |
478 | dnl # | |
479 | dnl # 2.6.18 API change, check whether device_create() is available. | |
480 | dnl # Device_create() was introduced in 2.6.18 and depricated | |
481 | dnl # class_device_create() which was fully removed in 2.6.26. | |
482 | dnl # | |
483 | AC_DEFUN([SPL_AC_DEVICE_CREATE], [ | |
484 | SPL_CHECK_SYMBOL_EXPORT( | |
485 | [device_create], | |
486 | [drivers/base/core.c], | |
487 | [AC_DEFINE(HAVE_DEVICE_CREATE, 1, | |
488 | [device_create() is available])], | |
6a6cafbe | 489 | []) |
46c685d0 BB |
490 | ]) |
491 | ||
492 | dnl # | |
493 | dnl # 2.6.13 API change, check whether class_device_create() is available. | |
494 | dnl # Class_device_create() was introduced in 2.6.13 and depricated | |
495 | dnl # class_simple_device_add() which was fully removed in 2.6.13. | |
496 | dnl # | |
497 | AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [ | |
498 | SPL_CHECK_SYMBOL_EXPORT( | |
499 | [class_device_create], | |
500 | [drivers/base/class.c], | |
501 | [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1, | |
502 | [class_device_create() is available])], | |
6a6cafbe | 503 | []) |
46c685d0 | 504 | ]) |
6a6cafbe | 505 | |
6a6cafbe BB |
506 | dnl # |
507 | dnl # 2.6.26 API change, set_normalized_timespec() is exported. | |
508 | dnl # | |
509 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [ | |
510 | SPL_CHECK_SYMBOL_EXPORT( | |
511 | [set_normalized_timespec], | |
512 | [kernel/time.c], | |
513 | [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1, | |
514 | [set_normalized_timespec() is available as export])], | |
515 | []) | |
516 | ]) | |
517 | ||
518 | dnl # | |
519 | dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c | |
520 | dnl # previously it was available in time.h as an inline. | |
521 | dnl # | |
86de8532 BB |
522 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [ |
523 | AC_MSG_CHECKING([whether set_normalized_timespec() is an inline]) | |
6a6cafbe BB |
524 | SPL_LINUX_TRY_COMPILE([ |
525 | #include <linux/time.h> | |
6a6cafbe | 526 | void set_normalized_timespec(struct timespec *ts, |
25557fd8 BB |
527 | time_t sec, long nsec) { } |
528 | ], | |
529 | [], | |
530 | [ | |
6a6cafbe BB |
531 | AC_MSG_RESULT(no) |
532 | ],[ | |
533 | AC_MSG_RESULT(yes) | |
534 | AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1, | |
535 | [set_normalized_timespec() is available as inline]) | |
536 | ]) | |
537 | ]) | |
538 | ||
539 | dnl # | |
540 | dnl # 2.6.18 API change, | |
541 | dnl # timespec_sub() inline function available in linux/time.h | |
542 | dnl # | |
86de8532 BB |
543 | AC_DEFUN([SPL_AC_TIMESPEC_SUB], [ |
544 | AC_MSG_CHECKING([whether timespec_sub() is available]) | |
6a6cafbe BB |
545 | SPL_LINUX_TRY_COMPILE([ |
546 | #include <linux/time.h> | |
547 | ],[ | |
548 | struct timespec a, b, c = { 0 }; | |
549 | c = timespec_sub(a, b); | |
550 | ],[ | |
551 | AC_MSG_RESULT(yes) | |
552 | AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available]) | |
553 | ],[ | |
554 | AC_MSG_RESULT(no) | |
555 | ]) | |
556 | ]) | |
557 | ||
86de8532 | 558 | dnl # |
3d061e9d BB |
559 | dnl # 2.6.19 API change, |
560 | dnl # check if init_utsname() is available in linux/utsname.h | |
561 | dnl # | |
562 | AC_DEFUN([SPL_AC_INIT_UTSNAME], [ | |
563 | AC_MSG_CHECKING([whether init_utsname() is available]) | |
564 | SPL_LINUX_TRY_COMPILE([ | |
565 | #include <linux/utsname.h> | |
566 | ],[ | |
567 | struct new_utsname *a = init_utsname(); | |
568 | ],[ | |
569 | AC_MSG_RESULT(yes) | |
570 | AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available]) | |
571 | ],[ | |
572 | AC_MSG_RESULT(no) | |
573 | ]) | |
574 | ]) | |
575 | ||
576 | dnl # | |
577 | dnl # 2.6.26 API change, | |
578 | dnl # definition of struct fdtable relocated to linux/fdtable.h | |
86de8532 BB |
579 | dnl # |
580 | AC_DEFUN([SPL_AC_FDTABLE_HEADER], [ | |
581 | SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], []) | |
582 | ]) | |
322640b7 BB |
583 | |
584 | dnl # | |
3d061e9d BB |
585 | dnl # 2.6.14 API change, |
586 | dnl # check whether 'files_fdtable()' exists | |
587 | dnl # | |
588 | AC_DEFUN([SPL_AC_FILES_FDTABLE], [ | |
589 | AC_MSG_CHECKING([whether files_fdtable() is available]) | |
590 | SPL_LINUX_TRY_COMPILE([ | |
591 | #include <linux/sched.h> | |
592 | #include <linux/file.h> | |
593 | #ifdef HAVE_FDTABLE_HEADER | |
594 | #include <linux/fdtable.h> | |
595 | #endif | |
596 | ],[ | |
597 | struct files_struct *files = current->files; | |
598 | struct fdtable *fdt = files_fdtable(files); | |
599 | ],[ | |
600 | AC_MSG_RESULT(yes) | |
601 | AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available]) | |
602 | ],[ | |
603 | AC_MSG_RESULT(no) | |
604 | ]) | |
605 | ]) | |
606 | ||
607 | dnl # | |
608 | dnl # 2.6.18 API change, | |
609 | dnl # added linux/uaccess.h | |
322640b7 BB |
610 | dnl # |
611 | AC_DEFUN([SPL_AC_UACCESS_HEADER], [ | |
612 | SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], []) | |
613 | ]) | |
3d061e9d BB |
614 | |
615 | dnl # | |
616 | dnl # 2.6.12 API change, | |
617 | dnl # check whether 'kmalloc_node()' is available. | |
618 | dnl # | |
619 | AC_DEFUN([SPL_AC_KMALLOC_NODE], [ | |
620 | AC_MSG_CHECKING([whether kmalloc_node() is available]) | |
621 | SPL_LINUX_TRY_COMPILE([ | |
622 | #include <linux/slab.h> | |
623 | ],[ | |
624 | void *a = kmalloc_node(1, GFP_KERNEL, 0); | |
625 | ],[ | |
626 | AC_MSG_RESULT(yes) | |
627 | AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available]) | |
628 | ],[ | |
629 | AC_MSG_RESULT(no) | |
630 | ]) | |
631 | ]) | |
632 | ||
633 | dnl # | |
634 | dnl # 2.6.9 API change, | |
635 | dnl # check whether 'monotonic_clock()' is available it may | |
636 | dnl # be available for some archs but not others. | |
637 | dnl # | |
638 | AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [ | |
639 | SPL_CHECK_SYMBOL_EXPORT( | |
640 | [monotonic_clock], | |
641 | [], | |
642 | [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, | |
643 | [monotonic_clock() is available])], | |
644 | []) | |
645 | ]) | |
646 | ||
647 | dnl # | |
648 | dnl # 2.6.16 API change, | |
649 | dnl # check whether 'struct inode' has i_mutex | |
650 | dnl # | |
651 | AC_DEFUN([SPL_AC_INODE_I_MUTEX], [ | |
652 | AC_MSG_CHECKING([whether struct inode has i_mutex]) | |
653 | SPL_LINUX_TRY_COMPILE([ | |
654 | #include <linux/fs.h> | |
655 | #include <linux/mutex.h> | |
656 | ],[ | |
657 | struct inode i; | |
658 | mutex_init(&i.i_mutex); | |
659 | ],[ | |
660 | AC_MSG_RESULT(yes) | |
661 | AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex]) | |
662 | ],[ | |
663 | AC_MSG_RESULT(no) | |
664 | ]) | |
665 | ]) | |
b61a6e8b BB |
666 | |
667 | dnl # | |
668 | dnl # 2.6.14 API change, | |
669 | dnl # check whether 'div64_64()' is available | |
670 | dnl # | |
671 | AC_DEFUN([SPL_AC_DIV64_64], [ | |
672 | AC_MSG_CHECKING([whether div64_64() is available]) | |
673 | SPL_LINUX_TRY_COMPILE([ | |
674 | #include <asm/div64.h> | |
550f1705 | 675 | #include <linux/types.h> |
b61a6e8b BB |
676 | ],[ |
677 | uint64_t i = div64_64(1ULL, 1ULL); | |
678 | ],[ | |
679 | AC_MSG_RESULT(yes) | |
680 | AC_DEFINE(HAVE_DIV64_64, 1, [div64_64() is available]) | |
681 | ],[ | |
682 | AC_MSG_RESULT(no) | |
683 | ]) | |
684 | ]) |