Whamcloud - gitweb
LU-12438 llite: vfs_read/write removed, use kernel_read/write
[fs/lustre-release.git] / libcfs / autoconf / lustre-libcfs.m4
1 #
2 # LIBCFS_CONFIG_CDEBUG
3 #
4 # whether to enable various libcfs debugs (CDEBUG, ENTRY/EXIT, LASSERT, etc.)
5 #
6 AC_DEFUN([LIBCFS_CONFIG_CDEBUG], [
7 AC_MSG_CHECKING([whether to enable CDEBUG, CWARN])
8 AC_ARG_ENABLE([libcfs_cdebug],
9         AC_HELP_STRING([--disable-libcfs-cdebug],
10                 [disable libcfs CDEBUG, CWARN]),
11         [], [enable_libcfs_cdebug="yes"])
12 AC_MSG_RESULT([$enable_libcfs_cdebug])
13 AS_IF([test "x$enable_libcfs_cdebug" = xyes],
14         [AC_DEFINE(CDEBUG_ENABLED, 1, [enable libcfs CDEBUG, CWARN])])
15
16 AC_MSG_CHECKING([whether to enable ENTRY/EXIT])
17 AC_ARG_ENABLE([libcfs_trace],
18         AC_HELP_STRING([--disable-libcfs-trace],
19                 [disable libcfs ENTRY/EXIT]),
20         [], [enable_libcfs_trace="yes"])
21 AC_MSG_RESULT([$enable_libcfs_trace])
22 AS_IF([test "x$enable_libcfs_trace" = xyes],
23         [AC_DEFINE(CDEBUG_ENTRY_EXIT, 1, [enable libcfs ENTRY/EXIT])])
24
25 AC_MSG_CHECKING([whether to enable LASSERT, LASSERTF])
26 AC_ARG_ENABLE([libcfs_assert],
27         AC_HELP_STRING([--disable-libcfs-assert],
28                 [disable libcfs LASSERT, LASSERTF]),
29         [], [enable_libcfs_assert="yes"])
30 AC_MSG_RESULT([$enable_libcfs_assert])
31 AS_IF([test x$enable_libcfs_assert = xyes],
32         [AC_DEFINE(LIBCFS_DEBUG, 1, [enable libcfs LASSERT, LASSERTF])])
33 ]) # LIBCFS_CONFIG_CDEBUG
34
35 #
36 # LIBCFS_CONFIG_PANIC_DUMPLOG
37 #
38 # check if tunable panic_dumplog is wanted
39 #
40 AC_DEFUN([LIBCFS_CONFIG_PANIC_DUMPLOG], [
41 AC_MSG_CHECKING([whether to use tunable 'panic_dumplog' support])
42 AC_ARG_ENABLE([panic_dumplog],
43         AC_HELP_STRING([--enable-panic_dumplog],
44                 [enable panic_dumplog]),
45         [], [enable_panic_dumplog="no"])
46 AC_MSG_RESULT([$enable_panic_dumplog])
47 AS_IF([test "x$enable_panic_dumplog" = xyes],
48         [AC_DEFINE(LNET_DUMP_ON_PANIC, 1, [use dumplog on panic])])
49 ]) # LIBCFS_CONFIG_PANIC_DUMPLOG
50
51 #
52 # LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
53 #
54 # 2.6.32-30.el6 adds a new 'walk_stack' field in 'struct stacktrace_ops'
55 #
56 AC_DEFUN([LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK], [
57 LB_CHECK_COMPILE([if 'struct stacktrace_ops' has 'walk_stack' field],
58 stacktrace_ops_walk_stack, [
59         #include <asm/stacktrace.h>
60 ],[
61         ((struct stacktrace_ops *)0)->walk_stack(NULL, NULL, 0, NULL, NULL, NULL, NULL);
62 ],[
63         AC_DEFINE(STACKTRACE_OPS_HAVE_WALK_STACK, 1,
64                 ['struct stacktrace_ops' has 'walk_stack' field])
65 ])
66 ]) # LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
67
68 #
69 # LIBCFS_STACKTRACE_WARNING
70 #
71 # 3.0 removes stacktrace_ops warning* functions
72 #
73 AC_DEFUN([LIBCFS_STACKTRACE_WARNING], [
74 LB_CHECK_COMPILE([if 'stacktrace_ops.warning' is exist],
75 stacktrace_ops_warning, [
76         struct task_struct;
77         struct pt_regs;
78         #include <asm/stacktrace.h>
79 ],[
80         ((struct stacktrace_ops *)0)->warning(NULL, NULL);
81 ],[
82         AC_DEFINE(HAVE_STACKTRACE_WARNING, 1,
83                 [stacktrace_ops.warning is exist])
84 ])
85 ]) # LIBCFS_STACKTRACE_WARNING
86
87 #
88 # LC_SHRINKER_WANT_SHRINK_PTR
89 #
90 # RHEL6/2.6.32 want to have pointer to shrinker self pointer in handler function
91 #
92 AC_DEFUN([LC_SHRINKER_WANT_SHRINK_PTR], [
93 LB_CHECK_COMPILE([if 'shrinker' want self pointer in handler],
94 shrink_self_pointer, [
95         #include <linux/mm.h>
96 ],[
97         struct shrinker *tmp = NULL;
98         tmp->shrink(tmp, 0, 0);
99 ],[
100         AC_DEFINE(HAVE_SHRINKER_WANT_SHRINK_PTR, 1,
101                 [shrinker want self pointer in handler])
102 ])
103 ]) # LC_SHRINKER_WANT_SHRINK_PTR
104
105 #
106 # LIBCFS_SYSCTL_CTLNAME
107 #
108 # 2.6.33 no longer has ctl_name & strategy field in struct ctl_table.
109 #
110 AC_DEFUN([LIBCFS_SYSCTL_CTLNAME], [
111 LB_CHECK_COMPILE([if 'ctl_table' has a 'ctl_name' field],
112 ctl_table_ctl_name, [
113         #include <linux/sysctl.h>
114 ],[
115         struct ctl_table ct;
116         ct.ctl_name = sizeof(ct);
117 ],[
118         AC_DEFINE(HAVE_SYSCTL_CTLNAME, 1,
119                 [ctl_table has ctl_name field])
120 ])
121 ]) # LIBCFS_SYSCTL_CTLNAME
122
123 #
124 # LIBCFS_MODULE_LOCKING
125 #
126 # 2.6.36 introduced locking to module params. RHEL6 lacks this support
127 #
128 AC_DEFUN([LIBCFS_MODULE_LOCKING],[
129 LB_CHECK_COMPILE([does the kernel support module param locking],
130 module_param_locking, [
131         #include <linux/moduleparam.h>
132 ],[
133         __kernel_param_lock(NULL);
134         __kernel_param_unlock(NULL);
135 ],[
136         AC_DEFINE(HAVE_MODULE_PARAM_LOCKING, 1,
137                 [locking module param is supported])
138 ])
139 ]) # LIBCFS_MODULE_LOCKING
140
141 #
142 # LIBCFS_KSTRTOUL
143 #
144 # 2.6.38 kstrtoul is added
145 #
146 AC_DEFUN([LIBCFS_KSTRTOUL], [
147 LB_CHECK_COMPILE([if Linux kernel has 'kstrtoul'],
148 kstrtoul, [
149         #include <linux/kernel.h>
150 ],[
151         unsigned long result;
152         return kstrtoul("12345", 0, &result);
153 ],[
154         AC_DEFINE(HAVE_KSTRTOUL, 1,
155                 [kernel has kstrtoul])
156 ])
157 ]) # LIBCFS_KSTRTOUL
158
159 #
160 # LIBCFS_DUMP_TRACE_ADDRESS
161 #
162 # 2.6.39 adds a base pointer address argument to dump_trace
163 #
164 AC_DEFUN([LIBCFS_DUMP_TRACE_ADDRESS], [
165 LB_CHECK_COMPILE([if 'dump_trace' want address],
166 dump_trace_address, [
167         struct task_struct;
168         struct pt_regs;
169         #include <asm/stacktrace.h>
170 ],[
171         dump_trace(NULL, NULL, NULL, 0, NULL, NULL);
172 ],[
173         AC_DEFINE(HAVE_DUMP_TRACE_ADDRESS, 1,
174                 [dump_trace want address argument])
175 ])
176 ]) # LIBCFS_DUMP_TRACE_ADDRESS
177
178 #
179 # LC_SHRINK_CONTROL
180 #
181 # FC15 2.6.40-5 backported the "shrink_control" parameter to the memory
182 # pressure shrinker from Linux 3.0
183 #
184 AC_DEFUN([LC_SHRINK_CONTROL], [
185 LB_CHECK_COMPILE([if 'shrink_control' is present],
186 shrink_control, [
187         #include <linux/atomic.h>
188         #include <linux/mm.h>
189 ],[
190         struct shrink_control tmp = {0};
191         tmp.nr_to_scan = sizeof(tmp);
192 ],[
193         AC_DEFINE(HAVE_SHRINK_CONTROL, 1,
194                 [shrink_control is present])
195 ])
196 ]) # LC_SHRINK_CONTROL
197
198 #
199 # LIBCFS_PROCESS_NAMESPACE
200 #
201 # 3.5 introduced process namespace
202 AC_DEFUN([LIBCFS_PROCESS_NAMESPACE], [
203 LB_CHECK_LINUX_HEADER([linux/uidgid.h], [
204         AC_DEFINE(HAVE_UIDGID_HEADER, 1,
205                 [uidgid.h is present])])
206 ]) # LIBCFS_PROCESS_NAMESPACE
207
208 #
209 # LIBCFS_I_UID_READ
210 #
211 # 3.5 added helpers to read the new uid/gid types from VFS structures
212 # SLE11 SP3 has uidgid.h but not the helpers
213 #
214 AC_DEFUN([LIBCFS_I_UID_READ], [
215 LB_CHECK_COMPILE([if 'i_uid_read' is present],
216 i_uid_read, [
217         #include <linux/fs.h>
218 ],[
219         i_uid_read(NULL);
220 ],[
221         AC_DEFINE(HAVE_I_UID_READ, 1, [i_uid_read is present])
222 ])
223 ]) # LIBCFS_I_UID_READ
224
225 #
226 # LIBCFS_HAVE_CRC32
227 #
228 AC_DEFUN([LIBCFS_HAVE_CRC32], [
229 LB_CHECK_CONFIG_IM([CRC32],
230         [have_crc32="yes"], [have_crc32="no"])
231 AS_IF([test "x$have_crc32" = xyes],
232         [AC_DEFINE(HAVE_CRC32, 1,
233                 [kernel compiled with CRC32 functions])])
234 ]) # LIBCFS_HAVE_CRC32
235
236 #
237 # LIBCFS_ENABLE_CRC32_ACCEL
238 #
239 AC_DEFUN([LIBCFS_ENABLE_CRC32_ACCEL], [
240 LB_CHECK_CONFIG_IM([CRYPTO_CRC32_PCLMUL],
241         [enable_crc32_crypto="no"], [enable_crc32_crypto="yes"])
242 AS_IF([test "x$have_crc32" = xyes -a "x$enable_crc32_crypto" = xyes], [
243         AC_DEFINE(NEED_CRC32_ACCEL, 1, [need pclmulqdq based crc32])
244         AC_MSG_WARN([No crc32 pclmulqdq crypto api found, enable internal pclmulqdq based crc32])])
245 ]) # LIBCFS_ENABLE_CRC32_ACCEL
246
247 #
248 # LIBCFS_ENABLE_CRC32C_ACCEL
249 #
250 AC_DEFUN([LIBCFS_ENABLE_CRC32C_ACCEL], [
251 LB_CHECK_CONFIG_IM([CRYPTO_CRC32C_INTEL],
252         [enable_crc32c_crypto="no"], [enable_crc32c_crypto="yes"])
253 AS_IF([test "x$enable_crc32c_crypto" = xyes], [
254         AC_DEFINE(NEED_CRC32C_ACCEL, 1, [need pclmulqdq based crc32c])
255         AC_MSG_WARN([No crc32c pclmulqdq crypto api found, enable internal pclmulqdq based crc32c])])
256 ]) # LIBCFS_ENABLE_CRC32C_ACCEL
257
258 #
259 # Kernel version 3.11 introduced ktime_get_ts64
260 #
261 AC_DEFUN([LIBCFS_KTIME_GET_TS64],[
262 LB_CHECK_COMPILE([does function 'ktime_get_ts64' exist],
263 ktime_get_ts64, [
264         #include <linux/hrtimer.h>
265         #include <linux/ktime.h>
266 ],[
267         struct timespec64 *ts = NULL;
268
269         ktime_get_ts64(ts);
270 ],[
271         AC_DEFINE(HAVE_KTIME_GET_TS64, 1,
272                 ['ktime_get_ts64' is available])
273 ])
274 ]) # LIBCFS_KTIME_GET_TS64
275
276 #
277 # Kernel version 3.12-rc4 commit c2d816443ef30 added prepare_to_wait_event()
278 #
279 AC_DEFUN([LIBCFS_PREPARE_TO_WAIT_EVENT],[
280 LB_CHECK_COMPILE([does function 'prepare_to_wait_event' exist],
281 prepare_to_wait_event, [
282         #include <linux/wait.h>
283 ],[
284         prepare_to_wait_event(NULL, NULL, 0);
285 ],[
286         AC_DEFINE(HAVE_PREPARE_TO_WAIT_EVENT, 1,
287                 ['prepare_to_wait_event' is available])
288 ])
289 ]) # LIBCFS_PREPARE_TO_WAIT_EVENT
290
291 #
292 # Linux kernel 3.12 introduced struct kernel_param_ops
293 # This has been backported to all lustre supported
294 # clients except RHEL6. We have to handle the differences.
295 #
296 AC_DEFUN([LIBCFS_KERNEL_PARAM_OPS],[
297 LB_CHECK_COMPILE([does 'struct kernel_param_ops' exist],
298 kernel_param_ops, [
299         #include <linux/module.h>
300 ],[
301         struct kernel_param_ops ops;
302
303         ops.set = NULL;
304 ],[
305         AC_DEFINE(HAVE_KERNEL_PARAM_OPS, 1,
306                 ['struct kernel_param_ops' is available])
307 ])
308 ]) # LIBCFS_KERNEL_PARAM_OPS
309
310 #
311 # Kernel version 3.12 introduced ktime_add
312 #
313 AC_DEFUN([LIBCFS_KTIME_ADD],[
314 LB_CHECK_COMPILE([does function 'ktime_add' exist],
315 ktime_add, [
316         #include <linux/hrtimer.h>
317         #include <linux/ktime.h>
318 ],[
319         ktime_t start = ktime_set(0, 0);
320         ktime_t end = start;
321         ktime_t total;
322
323         total = ktime_add(start, end);
324 ],[
325         AC_DEFINE(HAVE_KTIME_ADD, 1,
326                 [ktime_add is available])
327 ])
328 ]) # LIBCFS_KTIME_ADD
329
330 #
331 # Kernel version 3.12 introduced ktime_after
332 #
333 AC_DEFUN([LIBCFS_KTIME_AFTER],[
334 LB_CHECK_COMPILE([does function 'ktime_after' exist],
335 ktime_after, [
336         #include <linux/hrtimer.h>
337         #include <linux/ktime.h>
338 ],[
339         ktime_t start = ktime_set(0, 0);
340         ktime_t end = start;
341
342         ktime_after(start, end);
343 ],[
344         AC_DEFINE(HAVE_KTIME_AFTER, 1,
345                 [ktime_after is available])
346 ])
347 ]) # LIBCFS_KTIME_AFTER
348
349 #
350 # Kernel version 3.12 introduced ktime_before
351 # See linux commit 67cb9366ff5f99868100198efba5ca88aaa6ad25
352 #
353 AC_DEFUN([LIBCFS_KTIME_BEFORE],[
354 LB_CHECK_COMPILE([does function 'ktime_before' exist],
355 ktime_before, [
356         #include <linux/hrtimer.h>
357         #include <linux/ktime.h>
358 ],[
359         ktime_t start = ktime_set(0, 0);
360         ktime_t end = start;
361
362         ktime_before(start, end);
363 ],[
364         AC_DEFINE(HAVE_KTIME_BEFORE, 1,
365                 [ktime_before is available])
366 ])
367 ]) # LIBCFS_KTIME_BEFORE
368
369 #
370 # Kernel version 3.12 introduced ktime_compare
371 #
372 AC_DEFUN([LIBCFS_KTIME_COMPARE],[
373 LB_CHECK_COMPILE([does function 'ktime_compare' exist],
374 ktime_compare, [
375         #include <linux/hrtimer.h>
376         #include <linux/ktime.h>
377 ],[
378         ktime_t start = ktime_set(0, 0);
379         ktime_t end = start;
380
381         ktime_compare(start, end);
382 ],[
383         AC_DEFINE(HAVE_KTIME_COMPARE, 1,
384                 [ktime_compare is available])
385 ])
386 ]) # LIBCFS_KTIME_COMPARE
387
388 #
389 # FC19 3.12 kernel struct shrinker change
390 #
391 AC_DEFUN([LIBCFS_SHRINKER_COUNT],[
392 LB_CHECK_COMPILE([shrinker has 'count_objects'],
393 shrinker_count_objects, [
394         #include <linux/mmzone.h>
395         #include <linux/shrinker.h>
396 ],[
397         struct shrinker shrinker;
398
399         shrinker.count_objects = NULL;
400 ],[
401         AC_DEFINE(HAVE_SHRINKER_COUNT, 1,
402                 [shrinker has count_objects member])
403 ])
404 ]) # LIBCFS_SHRINKER_COUNT
405
406 #
407 # Kernel version 3.17 changed hlist_add_after to
408 # hlist_add_behind
409 #
410 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
411 LB_CHECK_COMPILE([does function 'hlist_add_after' exist],
412 hlist_add_after, [
413         #include <linux/list.h>
414 ],[
415         hlist_add_after(NULL, NULL);
416 ],[
417         AC_DEFINE(HAVE_HLIST_ADD_AFTER, 1,
418                 [hlist_add_after is available])
419 ])
420 ]) # LIBCFS_HLIST_ADD_AFTER
421
422 #
423 # Kernel version 3.17 introduced struct timespec64
424 #
425 AC_DEFUN([LIBCFS_TIMESPEC64],[
426 LB_CHECK_COMPILE([does 'struct timespec64' exist],
427 timespec64, [
428         #include <linux/time.h>
429 ],[
430         struct timespec64 ts;
431
432         ts.tv_sec = 0;
433         ts.tv_nsec = 0;
434 ],[
435         AC_DEFINE(HAVE_TIMESPEC64, 1,
436                 ['struct timespec64' is available])
437 ])
438 ]) # LIBCFS_TIMESPEC64
439
440 #
441 # Kernel version 3.17 introduced ktime_get_real_ts64
442 #
443 AC_DEFUN([LIBCFS_KTIME_GET_REAL_TS64],[
444 LB_CHECK_COMPILE([does function 'ktime_get_real_ts64' exist],
445 ktime_get_real_ts64, [
446         #include <linux/ktime.h>
447 ],[
448         struct timespec64 *ts = NULL;
449
450         ktime_get_real_ts64(ts);
451 ],[
452         AC_DEFINE(HAVE_KTIME_GET_REAL_TS64, 1,
453                 ['ktime_get_real_ts64' is available])
454 ])
455 ]) # LIBCFS_KTIME_GET_REAL_TS64
456
457 #
458 # Kernel version 3.17 introduced ktime_get_real_seconds
459 #
460 AC_DEFUN([LIBCFS_KTIME_GET_REAL_SECONDS],[
461 LB_CHECK_COMPILE([does function 'ktime_get_real_seconds' exist],
462 ktime_get_real_seconds, [
463         #include <linux/hrtimer.h>
464         #include <linux/ktime.h>
465 ],[
466         time64_t now;
467
468         now = ktime_get_real_seconds();
469 ],[
470         AC_DEFINE(HAVE_KTIME_GET_REAL_SECONDS, 1,
471                 ['ktime_get_real_seconds' is available])
472 ])
473 ]) # LIBCFS_KTIME_GET_REAL_SECONDS
474
475 #
476 # Kernel version 3.17 created ktime_get_ns wrapper
477 #
478 AC_DEFUN([LIBCFS_KTIME_GET_NS],[
479 LB_CHECK_COMPILE([does function 'ktime_get_ns' exist],
480 ktime_get_ns, [
481         #include <linux/hrtimer.h>
482         #include <linux/ktime.h>
483 ],[
484         u64 nanoseconds;
485
486         nanoseconds = ktime_get_ns();
487 ],[],[
488         AC_DEFINE(NEED_KTIME_GET_NS, 1,
489                 ['ktime_get_ns' is not available])
490 ])
491 ]) # LIBCFS_KTIME_GET_NS
492
493 #
494 # Kernel version 3.17 created ktime_get_real_ns wrapper
495 #
496 AC_DEFUN([LIBCFS_KTIME_GET_REAL_NS],[
497 LB_CHECK_COMPILE([does function 'ktime_get_real_ns' exist],
498 ktime_get_real_ns, [
499         #include <linux/hrtimer.h>
500         #include <linux/ktime.h>
501 ],[
502         u64 nanoseconds;
503
504         nanoseconds = ktime_get_real_ns();
505 ],[],[
506         AC_DEFINE(NEED_KTIME_GET_REAL_NS, 1,
507                 ['ktime_get_real_ns' is not available])
508 ])
509 ]) # LIBCFS_KTIME_GET_REAL_NS
510
511 #
512 # Kernel version 3.17 introduced ktime_to_timespec64
513 #
514 AC_DEFUN([LIBCFS_KTIME_TO_TIMESPEC64],[
515 LB_CHECK_COMPILE([does function 'ktime_to_timespec64' exist],
516 ktime_to_timespec64, [
517         #include <linux/hrtimer.h>
518         #include <linux/ktime.h>
519 ],[
520         ktime_t now = ktime_set(0, 0);
521         struct timespec64 ts;
522
523         ts = ktime_to_timespec64(now);
524 ],[
525         AC_DEFINE(HAVE_KTIME_TO_TIMESPEC64, 1,
526                 ['ktime_to_timespec64' is available])
527 ])
528 ]) # LIBCFS_KTIME_TO_TIMESPEC64
529
530 #
531 # Kernel version 3.17 introduced timespec64_sub
532 #
533 AC_DEFUN([LIBCFS_TIMESPEC64_SUB],[
534 LB_CHECK_COMPILE([does function 'timespec64_sub' exist],
535 timespec64_sub, [
536         #include <linux/time.h>
537 ],[
538         struct timespec64 later = { }, earlier = { }, diff;
539
540         diff = timespec64_sub(later, earlier);
541 ],[
542         AC_DEFINE(HAVE_TIMESPEC64_SUB, 1,
543                 ['timespec64_sub' is available])
544 ])
545 ]) # LIBCFS_TIMESPEC64_SUB
546
547 #
548 # Kernel version 3.17 introduced timespec64_to_ktime
549 #
550 AC_DEFUN([LIBCFS_TIMESPEC64_TO_KTIME],[
551 LB_CHECK_COMPILE([does function 'timespec64_to_ktime' exist],
552 timespec64_to_ktime, [
553         #include <linux/ktime.h>
554 ],[
555         struct timespec64 ts;
556         ktime_t now;
557
558         now = timespec64_to_ktime(ts);
559 ],[
560         AC_DEFINE(HAVE_TIMESPEC64_TO_KTIME, 1,
561                 ['timespec64_to_ktime' is available])
562 ])
563 ]) # LIBCFS_TIMESPEC64_TO_KTIME
564
565 #
566 # Kernel version 3.19 introduced ktime_get_seconds
567 #
568 AC_DEFUN([LIBCFS_KTIME_GET_SECONDS],[
569 LB_CHECK_COMPILE([does function 'ktime_get_seconds' exist],
570 ktime_get_seconds, [
571         #include <linux/ktime.h>
572 ],[
573         time64_t now;
574
575         now = ktime_get_seconds();
576 ],[
577         AC_DEFINE(HAVE_KTIME_GET_SECONDS, 1,
578                 ['ktime_get_seconds' is available])
579 ])
580 ]) # LIBCFS_KTIME_GET_SECONDS
581
582 #
583 # Kernel version 4.0 commit 41fbf3b39d5eca01527338b4d0ee15ee1ae1023c
584 # introduced the helper function ktime_ms_delta.
585 #
586 AC_DEFUN([LIBCFS_KTIME_MS_DELTA],[
587 LB_CHECK_COMPILE([does function 'ktime_ms_delta' exist],
588 ktime_ms_delta, [
589         #include <linux/ktime.h>
590 ],[
591         ktime_t start = ktime_set(0, 0);
592         ktime_t end = start;
593
594         ktime_ms_delta(start, end);
595 ],[
596         AC_DEFINE(HAVE_KTIME_MS_DELTA, 1,
597                 ['ktime_ms_delta' is available])
598 ])
599 ]) # LIBCFS_KTIME_MS_DELTA
600
601 #
602 # Kernel version 4.1 commit b51d23e4e9fea6f264d39535c2a62d1f51e7ccc3
603 # create per module locks which added kernel_param_[un]lock(). Older
604 # kernels you have to use __kernel_param_[un]lock(). In that case its
605 # a global lock for all modules but that is okay since its a rare event.
606 #
607 AC_DEFUN([LIBCFS_KERNEL_PARAM_LOCK],[
608 LB_CHECK_COMPILE([does function 'kernel_param_[un]lock' exist],
609 kernel_param_lock, [
610         #include <linux/moduleparam.h>
611 ],[
612         kernel_param_lock(NULL);
613         kernel_param_unlock(NULL);
614 ],[
615         AC_DEFINE(HAVE_KERNEL_PARAM_LOCK, 1,
616                 ['kernel_param_[un]lock' is available])
617 ])
618 ]) # LIBCFS_KERNEL_PARAM_LOCK
619
620 #
621 # Kernel version 4.2 changed topology_thread_cpumask
622 # to topology_sibling_cpumask
623 #
624 AC_DEFUN([LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK],[
625 LB_CHECK_COMPILE([does function 'topology_sibling_cpumask' exist],
626 topology_sibling_cpumask, [
627         #include <linux/topology.h>
628 ],[
629         const struct cpumask *mask;
630
631         mask = topology_sibling_cpumask(0);
632 ],[
633         AC_DEFINE(HAVE_TOPOLOGY_SIBLING_CPUMASK, 1,
634                 [topology_sibling_cpumask is available])
635 ])
636 ]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
637
638 #
639 # Kernel version 4.2 commit df6b35f409af0a8ff1ef62f552b8402f3fef8665
640 # header file i387.h was renamed to fpu/api.h
641 #
642 AC_DEFUN([LIBCFS_FPU_API], [
643 LB_CHECK_LINUX_HEADER([asm/fpu/api.h], [
644         AC_DEFINE(HAVE_FPU_API_HEADER, 1,
645                 [fpu/api.h is present])])
646 ]) # LIBCFS_FPU_API
647
648 #
649 # Kernel version 4.4 commit ef951599074ba4fad2d0efa0a977129b41e6d203
650 # introduced kstrtobool and kstrtobool_from_user.
651 #
652 AC_DEFUN([LIBCFS_KSTRTOBOOL_FROM_USER], [
653 LB_CHECK_COMPILE([if Linux kernel has 'kstrtobool_from_user'],
654 kstrtobool_from_user, [
655         #include <linux/kernel.h>
656 ],[
657         bool result;
658         return kstrtobool_from_user(NULL, 0, &result);
659 ],[
660         AC_DEFINE(HAVE_KSTRTOBOOL_FROM_USER, 1,
661                 [kernel has kstrtobool_from_user])
662 ])
663 ]) # LIBCFS_KSTRTOBOOL_FROM_USER
664
665 #
666 # Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24
667 # added crypto hash helpers
668 #
669 AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [
670 LB_CHECK_COMPILE([does crypto hash helper functions exist],
671 crypto_hash_helpers, [
672         #include <crypto/hash.h>
673 ],[
674         crypto_ahash_alg_name(NULL);
675         crypto_ahash_driver_name(NULL);
676 ],[
677         AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1,
678                 [crypto hash helper functions are available])
679 ])
680 ]) # LIBCFS_CRYPTO_HASH_HELPERS
681
682 #
683 # Kernerl version 4.5-rc3 commit 2fe829aca9d7bed5fd6b49c6a1452e5e486b6cc3dd
684 # made kset_find_obj() exportable to modules
685 #
686 AC_DEFUN([LIBCFS_EXPORT_KSET_FIND_OBJ], [
687 LB_CHECK_EXPORT([kset_find_obj], [lib/kobject.c],
688         [AC_DEFINE(HAVE_KSET_FIND_OBJ, 1,
689                 [kset_find_obj is exported by the kernel])])
690 ]) # LIBCFS_EXPORT_KSET_FIND_OBJ
691
692 #
693 # Kernel version 4.6+ commit ef703f49a6c5b909a85149bb6625c4ed0d697186
694 # fixed the brokenness of hash_64(). The fix removed GOLDEN_RATIO_PRIME_64
695 # since it was a poor prime value.
696 #
697 AC_DEFUN([LIBCFS_BROKEN_HASH_64], [
698 LB_CHECK_COMPILE([kernel has fixed hash_64()],
699 broken_hash_64, [
700         #include <linux/hash.h>
701 ],[
702         int tmp = GOLDEN_RATIO_PRIME_64;
703 ],[
704         AC_DEFINE(HAVE_BROKEN_HASH_64, 1, [kernel hash_64() is broken])
705 ])
706 ]) # LIBCFS_BROKEN_HASH_64
707
708 #
709 # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
710 #
711 # linux 4.6 kernel changed stacktrace_ops address to return an int
712 #
713 AC_DEFUN([LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT], [
714 LB_CHECK_COMPILE([if 'struct stacktrace_ops' address function returns an int],
715 stacktrace_ops_address_return_int, [
716         #include <asm/stacktrace.h>
717 ],[
718         int rc;
719
720         rc = ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
721 ],[
722         AC_DEFINE(STACKTRACE_OPS_ADDRESS_RETURN_INT, 1,
723                 ['struct stacktrace_ops' address function returns an int])
724 ])
725 ]) # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
726
727 #
728 # Kernel version 4.6 removed both struct task_struct and struct mm_struct
729 # arguments to get_user_pages
730 #
731 AC_DEFUN([LIBCFS_GET_USER_PAGES_6ARG], [
732 LB_CHECK_COMPILE([if 'get_user_pages()' takes 6 arguments],
733 get_user_pages_6arg, [
734         #include <linux/mm.h>
735 ],[
736         int rc;
737
738         rc = get_user_pages(0, 0, 0, 0, NULL, NULL);
739 ],[
740         AC_DEFINE(HAVE_GET_USER_PAGES_6ARG, 1,
741                 [get_user_pages takes 6 arguments])
742 ])
743 ]) # LIBCFS_GET_USER_PAGES_6ARG
744
745 #
746 # LIBCFS_STRINGHASH
747 #
748 # 4.6 kernel created stringhash.h which moved stuff out of dcache.h
749 # commit f4bcbe792b8f434e32487cff9d9e30ab45a3ce02
750 #
751 AC_DEFUN([LIBCFS_STRINGHASH], [
752 LB_CHECK_LINUX_HEADER([linux/stringhash.h], [
753         AC_DEFINE(HAVE_STRINGHASH, 1,
754                 [stringhash.h is present])])
755 ]) # LIBCFS_STRINGHASH
756
757 #
758 # LIBCFS_RHASHTABLE_INSERT_FAST
759 #
760 # 4.7+ kernel commit 5ca8cc5bf11faed257c762018aea9106d529232f
761 # changed __rhashtable_insert_fast to support the new function
762 # rhashtable_lookup_get_insert_key().
763 #
764 AC_DEFUN([LIBCFS_RHASHTABLE_INSERT_FAST], [
765 tmp_flags="$EXTRA_KCFLAGS"
766 EXTRA_KCFLAGS="-Werror"
767 LB_CHECK_COMPILE([if internal '__rhashtable_insert_fast()' returns int],
768 rhashtable_insert_fast, [
769         #include <linux/rhashtable.h>
770 ],[
771         const struct rhashtable_params params = { 0 };
772         int rc;
773
774         rc = __rhashtable_insert_fast(NULL, NULL, NULL, params);
775 ],[
776         AC_DEFINE(HAVE_HASHTABLE_INSERT_FAST_RETURN_INT, 1,
777                   ['__rhashtable_insert_fast()' returns int])
778 ])
779 EXTRA_KCFLAGS="$tmp_flags"
780 ]) # LIBCFS_RHASHTABLE_INSERT_FAST
781
782 #
783 # Kernel version 4.8-rc6 commit ca26893f05e86497a86732768ec53cd38c0819ca
784 # introduced rhashtable_lookup
785 #
786 AC_DEFUN([LIBCFS_RHASHTABLE_LOOKUP], [
787 LB_CHECK_COMPILE([if 'rhashtable_lookup' exist],
788 rhashtable_lookup, [
789         #include <linux/rhashtable.h>
790 ],[
791         const struct rhashtable_params params = { 0 };
792         void *ret;
793
794         ret = rhashtable_lookup(NULL, NULL, params);
795 ],[
796         AC_DEFINE(HAVE_RHASHTABLE_LOOKUP, 1,
797                 [rhashtable_lookup() is available])
798 ])
799 ]) # LIBCFS_RHASHTABLE_LOOKUP
800
801 #
802 # LIBCFS_RHLTABLE
803 # Kernel version 4.8-rc6 commit ca26893f05e86497a86732768ec53cd38c0819ca
804 # created the rhlist interface to allow inserting duplicate objects
805 # into the same table.
806 #
807 AC_DEFUN([LIBCFS_RHLTABLE], [
808 LB_CHECK_COMPILE([does 'struct rhltable' exist],
809 rhtable, [
810         #include <linux/rhashtable.h>
811 ],[
812         struct rhltable *hlt;
813
814         rhltable_destroy(hlt);
815 ],[
816         AC_DEFINE(HAVE_RHLTABLE, 1,
817                   [struct rhltable exist])
818 ])
819 ]) # LIBCFS_RHLTABLE
820
821 #
822 # LIBCFS_STACKTRACE_OPS
823 #
824 # Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
825 # removed both struct stacktrace_ops and dump_trace() function
826 #
827 AC_DEFUN([LIBCFS_STACKTRACE_OPS], [
828 LB_CHECK_COMPILE([if 'struct stacktrace_ops' exists],
829 stacktrace_ops, [
830         struct task_struct;
831         struct pt_regs;
832         #include <asm/stacktrace.h>
833 ],[
834         struct stacktrace_ops ops;
835         ops.stack = NULL;
836 ],[
837         AC_DEFINE(HAVE_STACKTRACE_OPS, 1,
838                 [struct stacktrace_ops exists])
839 ])
840 ]) # LIBCFS_STACKTRACE_OPS
841
842 #
843 # Kernel version 4.9 commit 768ae309a96103ed02eb1e111e838c87854d8b51
844 # mm: replace get_user_pages() write/force parameters with gup_flags
845 #
846 AC_DEFUN([LIBCFS_GET_USER_PAGES_GUP_FLAGS], [
847 LB_CHECK_COMPILE([if 'get_user_pages()' takes gup_flags in arguments],
848 get_user_pages_gup_flags, [
849         #include <linux/mm.h>
850 ],[
851         int rc;
852         rc = get_user_pages(0, 0, FOLL_WRITE, NULL, NULL);
853 ],[
854         AC_DEFINE(HAVE_GET_USER_PAGES_GUP_FLAGS, 1,
855                 [get_user_pages takes gup_flags in arguments])
856 ])
857 ]) # LIBCFS_GET_USER_PAGES_GUP_FLAGS
858
859 #
860 # Kernel version 4.10 commit 7b737965b33188bd3dbb44e938535c4006d97fbb
861 # libcfs: Convert to hotplug state machine
862 #
863 AC_DEFUN([LIBCFS_HOTPLUG_STATE_MACHINE], [
864 LB_CHECK_COMPILE([if libcfs supports CPU hotplug state machine],
865 cpu_hotplug_state_machine, [
866         #include <linux/cpuhotplug.h>
867 ],[
868         cpuhp_remove_state(CPUHP_LUSTRE_CFS_DEAD);
869 ],[
870         AC_DEFINE(HAVE_HOTPLUG_STATE_MACHINE, 1,
871                 [hotplug state machine is supported])
872 ])
873 ]) # LIBCFS_HOTPLUG_STATE_MACHINE
874
875 #
876 # LIBCFS_SCHED_HEADERS
877 #
878 # 4.11 has broken up sched.h into more headers.
879 #
880 AC_DEFUN([LIBCFS_SCHED_HEADERS], [
881 LB_CHECK_LINUX_HEADER([linux/sched/signal.h], [
882         AC_DEFINE(HAVE_SCHED_HEADERS, 1,
883                 [linux/sched header directory exist])])
884 ]) # LIBCFS_SCHED_HEADERS
885
886 #
887 # Kernel version 4.11 commit f9fe1c12d126f9887441fa5bb165046f30ddd4b5
888 # introduced rhashtable_lookup_get_insert_fast
889 #
890 AC_DEFUN([LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST], [
891 LB_CHECK_COMPILE([if 'rhashtable_lookup_get_insert_fast' exist],
892 rhashtable_lookup_get_insert_fast, [
893         #include <linux/rhashtable.h>
894 ],[
895         const struct rhashtable_params params = { 0 };
896         void *ret;
897
898         ret = rhashtable_lookup_get_insert_fast(NULL, NULL, params);
899 ],[
900         AC_DEFINE(HAVE_RHASHTABLE_LOOKUP_GET_INSERT_FAST, 1,
901                 [rhashtable_lookup_get_insert_fast() is available])
902 ])
903 ]) # LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
904
905 #
906 # Kernel version 4.12-rc3 f9727a17db9bab71ddae91f74f11a8a2f9a0ece6
907 # renamed uuid_be to uuid_t
908 #
909 AC_DEFUN([LIBCFS_UUID_T], [
910 LB_CHECK_COMPILE([if 'uuid_t' exist],
911 uuid_t, [
912         #include <linux/uuid.h>
913 ],[
914         uuid_t uuid;
915
916         memset(uuid.b, 0, 16);
917 ],[
918         AC_DEFINE(HAVE_UUID_T, 1, ['uuid_t' exist])
919 ])
920 ]) # LIBCFS_UUID_T
921
922 #
923 # Kernel version 4.12-rc3 commit fd851a3cdc196bfc1d229b5f22369069af532bf8
924 # introduce processor.h
925 #
926 AC_DEFUN([LIBCFS_HAVE_PROCESSOR_HEADER], [
927 LB_CHECK_LINUX_HEADER([linux/processor.h], [
928         AC_DEFINE(HAVE_PROCESSOR_H, 1,
929                 [processor.h is present])])
930 ]) # LIBCFS_HAVE_PROCESSOR_HEADER
931
932 #
933 # Kernel verison 4.12-rc6 commit 5dd43ce2f69d42a71dcacdb13d17d8c0ac1fe8f7
934 # created wait_bit.h
935 #
936 AC_DEFUN([LIBCFS_HAVE_WAIT_BIT_HEADER], [
937 LB_CHECK_LINUX_HEADER([linux/wait_bit.h], [
938         AC_DEFINE(HAVE_WAIT_BIT_HEADER_H, 1,
939                 [wait_bit.h is present])])
940 ]) # LIBCFS_HAVE_WAIT_BIT_HEADER
941
942 #
943 # Kernel version 4.12-rc6 commmit 2055da97389a605c8a00d163d40903afbe413921
944 # changed:
945 #       struct wait_queue_head::task_list       => ::head
946 #       struct wait_queue_entry::task_list      => ::entry
947 #
948 AC_DEFUN([LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME], [
949 LB_CHECK_COMPILE([if linux wait_queue_head list_head is named head],
950 wait_queue_task_list, [
951         #include <linux/wait.h>
952 ],[
953         wait_queue_head_t e;
954
955         INIT_LIST_HEAD(&e.head);
956 ],[
957         AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_LIST, 1,
958                 [linux wait_queue_head_t list_head is name head])
959 ])
960 ]) # LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME
961
962 #
963 # LIBCFS_WAIT_QUEUE_ENTRY
964 #
965 # Kernel version 4.13 ac6424b981bce1c4bc55675c6ce11bfe1bbfa64f
966 # Rename wait_queue_t => wait_queue_entry_t
967 #
968 AC_DEFUN([LIBCFS_WAIT_QUEUE_ENTRY], [
969 LB_CHECK_COMPILE([if 'wait_queue_entry_t' exists],
970 wait_queue_entry, [
971         #include <linux/wait.h>
972 ],[
973         wait_queue_entry_t e;
974
975         e.flags = 0;
976 ],[
977         AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY, 1,
978                 ['wait_queue_entry_t' is available])
979 ])
980 ]) # LIBCFS_WAIT_QUEUE_ENTRY
981
982 #
983 # LIBCFS_NEW_KERNEL_WRITE
984 #
985 # Kernel version 4.14 e13ec939e96b13e664bb6cee361cc976a0ee621a
986 # changed kernel_write prototype to make is plug compatible
987 # with the unexported vfs_write()
988 #
989 AC_DEFUN([LIBCFS_NEW_KERNEL_WRITE], [
990 tmp_flags="$EXTRA_KCFLAGS"
991 EXTRA_KCFLAGS="-Werror"
992 LB_CHECK_COMPILE([if 'kernel_write' matches other read/write helpers],
993 kernel_write_match, [
994         #include <linux/fs.h>
995 ],[
996         const void *buf = NULL;
997         loff_t pos = 0;
998         return kernel_write(NULL, buf, 0, &pos);
999 ],[
1000         AC_DEFINE(HAVE_NEW_KERNEL_WRITE, 1,
1001                 ['kernel_write' aligns with read/write helpers])
1002 ])
1003 EXTRA_KCFLAGS="$tmp_flags"
1004 ]) # LIBCFS_NEW_KERNEL_WRITE
1005
1006 #
1007 # LIBCFS_NEW_KERNEL_WRITE
1008 #
1009 # 4.14 commit bdd1d2d3d251c65b74ac4493e08db18971c09240 changed
1010 # the signature of kernel_read to match other read/write helpers
1011 # and place offset last.
1012 #
1013 AC_DEFUN([LIBCFS_NEW_KERNEL_READ], [
1014 tmp_flags="$EXTRA_KCFLAGS"
1015 EXTRA_KCFLAGS="-Werror"
1016 LB_CHECK_COMPILE([if 'kernel_read()' has loff_t *pos as last parameter],
1017 kernel_read, [
1018         #include <linux/fs.h>
1019         ],[
1020         loff_t pos = 0;
1021         kernel_read(NULL, NULL, 0, &pos);
1022 ],[
1023         AC_DEFINE(HAVE_KERNEL_READ_LAST_POSP, 1,
1024                 [kernel_read() signature ends with loff_t *pos])
1025 ])
1026 EXTRA_KCFLAGS="$tmp_flags"
1027 ]) # LIBCFS_NEW_KERNEL_READ
1028
1029 #
1030 # LIBCFS_DEFINE_TIMER
1031 #
1032 # Kernel version 4.14 commit 1d27e3e2252ba9d949ca82fbdb73cde102cb2067
1033 # remove expires and data arguments from DEFINE_TIMER. Also the callback
1034 # when from using unsigned long argument to using struct timer_list pointer.
1035 #
1036 AC_DEFUN([LIBCFS_DEFINE_TIMER], [
1037 LB_CHECK_COMPILE([if DEFINE_TIMER takes only 2 arguments],
1038 define_timer, [
1039         #include <linux/timer.h>
1040 ],[
1041         static DEFINE_TIMER(my_timer, NULL);
1042 ],[
1043         AC_DEFINE(HAVE_NEW_DEFINE_TIMER, 1,
1044                 [DEFINE_TIMER uses only 2 arguements])
1045 ])
1046 ]) # LIBCFS_DEFINE_TIMER
1047
1048 #
1049 # LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
1050 #
1051 # Kernel 2.6.27 commit 8594698ebddeef5443b7da8258ae33b3eaca61d5
1052 # exported save_stack_trace_tsk for x86.
1053 # Kernel 2.6.27 commit 01f4b8b8b8db09b88be7df7e51192e4e678b69d3
1054 # exported save_stack_trace_tsk for powerpc
1055 # Kernel 4.13 commit e27c7fa015d61c8be6a2c32b2144aad2ae6ec975
1056 # exported save_stack_trace_tsk for arm64
1057 # Kernel 4.14 commit 9a3dc3186fc3795e076a4122da9e0258651a9631
1058 # exported save_stack_trace_tsk for arm
1059 #
1060 AC_DEFUN([LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK], [
1061 LB_CHECK_EXPORT([save_stack_trace_tsk], [arch/$SUBARCH/kernel/stacktrace.c],
1062         [AC_DEFINE(HAVE_SAVE_STACK_TRACE_TSK, 1,
1063                 [save_stack_trace_tsk is exported])])
1064 ]) # LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
1065
1066 #
1067 # LIBCFS_TIMER_SETUP
1068 #
1069 # Kernel version 4.15 commit e99e88a9d2b067465adaa9c111ada99a041bef9a
1070 # setup_timer() was replaced by timer_setup(), where the callback
1071 # argument is the structure already holding the struct timer_list.
1072 #
1073 AC_DEFUN([LIBCFS_TIMER_SETUP], [
1074 LB_CHECK_COMPILE([if setup_timer has been replaced with timer_setup],
1075 timer_setup, [
1076         #include <linux/timer.h>
1077 ],[
1078         timer_setup(NULL, NULL, 0);
1079 ],[
1080         AC_DEFINE(HAVE_TIMER_SETUP, 1,
1081                 [timer_setup has replaced setup_timer])
1082 ])
1083 ]) # LIBCFS_TIMER_SETUP
1084
1085 #
1086 # LIBCFS_WAIT_VAR_EVENT
1087 #
1088 # Kernel version 4.16-rc4 commit 6b2bb7265f0b62605e8caee3613449ed0db270b9
1089 # added wait_var_event()
1090 #
1091 AC_DEFUN([LIBCFS_WAIT_VAR_EVENT], [
1092 LB_CHECK_COMPILE([if 'wait_var_event' exist],
1093 wait_var_event, [
1094         #ifdef HAVE_WAIT_BIT_HEADER_H
1095         #include <linux/wait_bit.h>
1096         #endif
1097         #include <linux/wait.h>
1098 ],[
1099         wake_up_var(NULL);
1100 ],[
1101         AC_DEFINE(HAVE_WAIT_VAR_EVENT, 1,
1102                 ['wait_var_event' is available])
1103 ])
1104 ]) # LIBCFS_WAIT_VAR_EVENT
1105
1106 #
1107 # LIBCFS_CLEAR_AND_WAKE_UP_BIT
1108 #
1109 # Kernel version 4.17-rc2 commit 8236b0ae31c837d2b3a2565c5f8d77f637e824cc
1110 # added clear_and_wake_up_bit()
1111 #
1112 AC_DEFUN([LIBCFS_CLEAR_AND_WAKE_UP_BIT], [
1113 LB_CHECK_COMPILE([if 'clear_and_wake_up_bit' exist],
1114 clear_and_wake_up_bit, [
1115         #ifdef HAVE_WAIT_BIT_HEADER_H
1116         #include <linux/wait_bit.h>
1117         #endif
1118         #include <linux/wait.h>
1119 ],[
1120         clear_and_wake_up_bit(0, NULL);
1121 ],[
1122         AC_DEFINE(HAVE_CLEAR_AND_WAKE_UP_BIT, 1,
1123                 ['clear_and_wake_up_bit' is available])
1124 ])
1125 ]) # LIBCFS_CLEAR_AND_WAKE_UP_BIT
1126
1127 #
1128 # LIBCFS_PROG_LINUX
1129 #
1130 # LibCFS linux kernel checks
1131 #
1132 AC_DEFUN([LIBCFS_PROG_LINUX], [
1133 AC_MSG_NOTICE([LibCFS kernel checks
1134 ==============================================================================])
1135 LIBCFS_CONFIG_PANIC_DUMPLOG
1136
1137 # 2.6.32
1138 LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
1139 LC_SHRINKER_WANT_SHRINK_PTR
1140 # 2.6.33
1141 LIBCFS_SYSCTL_CTLNAME
1142 # 2.6.36
1143 LIBCFS_MODULE_LOCKING
1144 # 2.6.38
1145 LIBCFS_KSTRTOUL
1146 # 2.6.39
1147 LIBCFS_DUMP_TRACE_ADDRESS
1148 # 2.6.40 fc15
1149 LC_SHRINK_CONTROL
1150 # 3.0
1151 LIBCFS_STACKTRACE_WARNING
1152 # 3.5
1153 LIBCFS_PROCESS_NAMESPACE
1154 LIBCFS_I_UID_READ
1155 # 3.8
1156 LIBCFS_HAVE_CRC32
1157 LIBCFS_ENABLE_CRC32_ACCEL
1158 # 3.10
1159 LIBCFS_ENABLE_CRC32C_ACCEL
1160 # 3.11
1161 LIBCFS_KTIME_GET_TS64
1162 # 3.12
1163 LIBCFS_PREPARE_TO_WAIT_EVENT
1164 LIBCFS_KERNEL_PARAM_OPS
1165 LIBCFS_KTIME_ADD
1166 LIBCFS_KTIME_AFTER
1167 LIBCFS_KTIME_BEFORE
1168 LIBCFS_KTIME_COMPARE
1169 LIBCFS_SHRINKER_COUNT
1170 # 3.17
1171 LIBCFS_HLIST_ADD_AFTER
1172 LIBCFS_TIMESPEC64
1173 LIBCFS_KTIME_GET_NS
1174 LIBCFS_KTIME_GET_REAL_TS64
1175 LIBCFS_KTIME_GET_REAL_SECONDS
1176 LIBCFS_KTIME_GET_REAL_NS
1177 LIBCFS_KTIME_TO_TIMESPEC64
1178 LIBCFS_TIMESPEC64_SUB
1179 LIBCFS_TIMESPEC64_TO_KTIME
1180 # 3.19
1181 LIBCFS_KTIME_GET_SECONDS
1182 # 4.0
1183 LIBCFS_KTIME_MS_DELTA
1184 # 4.1
1185 LIBCFS_KERNEL_PARAM_LOCK
1186 # 4.2
1187 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
1188 LIBCFS_FPU_API
1189 # 4.4
1190 LIBCFS_KSTRTOBOOL_FROM_USER
1191 # 4.5
1192 LIBCFS_CRYPTO_HASH_HELPERS
1193 LIBCFS_EXPORT_KSET_FIND_OBJ
1194 # 4.6
1195 LIBCFS_BROKEN_HASH_64
1196 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
1197 LIBCFS_GET_USER_PAGES_6ARG
1198 LIBCFS_STRINGHASH
1199 # 4.7
1200 LIBCFS_RHASHTABLE_INSERT_FAST
1201 # 4.8
1202 LIBCFS_RHASHTABLE_LOOKUP
1203 LIBCFS_RHLTABLE
1204 LIBCFS_STACKTRACE_OPS
1205 # 4.9
1206 LIBCFS_GET_USER_PAGES_GUP_FLAGS
1207 # 4.10
1208 LIBCFS_HOTPLUG_STATE_MACHINE
1209 # 4.11
1210 LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
1211 LIBCFS_SCHED_HEADERS
1212 # 4.12
1213 LIBCFS_HAVE_PROCESSOR_HEADER
1214 LIBCFS_HAVE_WAIT_BIT_HEADER
1215 LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME
1216 LIBCFS_UUID_T
1217 # 4.13
1218 LIBCFS_WAIT_QUEUE_ENTRY
1219 # 4.14
1220 LIBCFS_DEFINE_TIMER
1221 LIBCFS_NEW_KERNEL_WRITE
1222 LIBCFS_NEW_KERNEL_READ
1223 LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
1224 # 4.15
1225 LIBCFS_TIMER_SETUP
1226 # 4.16
1227 LIBCFS_WAIT_VAR_EVENT
1228 # 4.17
1229 LIBCFS_CLEAR_AND_WAKE_UP_BIT
1230 ]) # LIBCFS_PROG_LINUX
1231
1232 #
1233 # LIBCFS_PATH_DEFAULTS
1234 #
1235 # default paths for installed files
1236 #
1237 AC_DEFUN([LIBCFS_PATH_DEFAULTS], [
1238 ]) # LIBCFS_PATH_DEFAULTS
1239
1240 #
1241 # LIBCFS_CONFIGURE
1242 #
1243 # other configure checks
1244 #
1245 AC_DEFUN([LIBCFS_CONFIGURE], [
1246 AC_MSG_NOTICE([LibCFS core checks
1247 ==============================================================================])
1248
1249 # libcfs/libcfs/util/nidstrings.c
1250 AC_CHECK_HEADERS([netdb.h asm/types.h endian.h])
1251 AC_CHECK_FUNCS([gethostbyname])
1252
1253 # --------  Check for required packages  --------------
1254
1255 AC_MSG_NOTICE([LibCFS required packages checks
1256 ==============================================================================])
1257
1258 AC_MSG_CHECKING([whether to enable readline support])
1259 AC_ARG_ENABLE(readline,
1260         AC_HELP_STRING([--disable-readline],
1261                 [disable readline support]),
1262         [], [enable_readline="yes"])
1263 AC_MSG_RESULT([$enable_readline])
1264
1265 LIBREADLINE=""
1266 AS_IF([test "x$enable_readline" = xyes], [
1267         AC_CHECK_LIB([readline], [readline], [
1268                 LIBREADLINE="-lreadline"
1269                 AC_DEFINE(HAVE_LIBREADLINE, 1,
1270                         [readline library is available])
1271         ])
1272 ])
1273 AC_SUBST(LIBREADLINE)
1274
1275 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
1276 AC_ARG_ENABLE([libpthread],
1277         AC_HELP_STRING([--disable-libpthread],
1278                 [disable libpthread]),
1279         [], [enable_libpthread="yes"])
1280 AC_MSG_RESULT([$enable_libpthread])
1281
1282 PTHREAD_LIBS=""
1283 AS_IF([test "x$enable_libpthread" = xyes], [
1284         AC_CHECK_LIB([pthread], [pthread_create], [
1285                 PTHREAD_LIBS="-lpthread"
1286                 AC_DEFINE([HAVE_LIBPTHREAD], 1,
1287                         [use libpthread for libcfs library])
1288         ])
1289 ], [
1290         AC_MSG_WARN([Using libpthread for libcfs library is disabled explicitly])
1291 ])
1292 AC_SUBST(PTHREAD_LIBS)
1293 ]) # LIBCFS_CONFIGURE
1294
1295 #
1296 # LIBCFS_CONDITIONALS
1297 #
1298 AC_DEFUN([LIBCFS_CONDITIONALS], [
1299 AM_CONDITIONAL(HAVE_CRC32, [test "x$have_crc32" = xyes])
1300 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32,  [test "x$have_crc32" = xyes -a "x$enable_crc32_crypto" = xyes])
1301 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32C, [test "x$enable_crc32c_crypto" = xyes])
1302 ]) # LIBCFS_CONDITIONALS
1303
1304 #
1305 # LIBCFS_CONFIG_FILES
1306 #
1307 # files that should be generated with AC_OUTPUT
1308 #
1309 AC_DEFUN([LIBCFS_CONFIG_FILES], [
1310 AC_CONFIG_FILES([
1311 libcfs/Makefile
1312 libcfs/autoMakefile
1313 libcfs/autoconf/Makefile
1314 libcfs/include/Makefile
1315 libcfs/include/libcfs/Makefile
1316 libcfs/include/libcfs/linux/Makefile
1317 libcfs/include/libcfs/util/Makefile
1318 libcfs/libcfs/Makefile
1319 libcfs/libcfs/autoMakefile
1320 libcfs/libcfs/linux/Makefile
1321 libcfs/libcfs/util/Makefile
1322 ])
1323 ]) # LIBCFS_CONFIG_FILES