4 # whether to enable various libcfs debugs (CDEBUG, ENTRY/EXIT, LASSERT, etc.)
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])])
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])])
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
36 # LIBCFS_CONFIG_PANIC_DUMPLOG
38 # check if tunable panic_dumplog is wanted
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
52 # LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
54 # 2.6.32-30.el6 adds a new 'walk_stack' field in 'struct stacktrace_ops'
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>
61 ((struct stacktrace_ops *)0)->walk_stack(NULL, NULL, 0, NULL, NULL, NULL, NULL);
63 AC_DEFINE(STACKTRACE_OPS_HAVE_WALK_STACK, 1,
64 ['struct stacktrace_ops' has 'walk_stack' field])
66 ]) # LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
69 # LIBCFS_STACKTRACE_WARNING
71 # 3.0 removes stacktrace_ops warning* functions
73 AC_DEFUN([LIBCFS_STACKTRACE_WARNING], [
74 LB_CHECK_COMPILE([if 'stacktrace_ops.warning' is exist],
75 stacktrace_ops_warning, [
78 #include <asm/stacktrace.h>
80 ((struct stacktrace_ops *)0)->warning(NULL, NULL);
82 AC_DEFINE(HAVE_STACKTRACE_WARNING, 1,
83 [stacktrace_ops.warning is exist])
85 ]) # LIBCFS_STACKTRACE_WARNING
88 # LIBCFS_REINIT_COMPLETION
90 AC_DEFUN([LIBCFS_REINIT_COMPLETION], [
91 LB_CHECK_COMPILE([if 'reinit_completion' exists],
93 #include <linux/completion.h>
96 reinit_completion(&x);
98 AC_DEFINE(HAVE_REINIT_COMPLETION, 1,
99 [reinit_completion is exist])
101 ]) # LIBCFS_REINIT_COMPLETION
104 # LC_SHRINKER_WANT_SHRINK_PTR
106 # RHEL6/2.6.32 want to have pointer to shrinker self pointer in handler function
108 AC_DEFUN([LC_SHRINKER_WANT_SHRINK_PTR], [
109 LB_CHECK_COMPILE([if 'shrinker' want self pointer in handler],
110 shrink_self_pointer, [
111 #include <linux/mm.h>
113 struct shrinker *tmp = NULL;
114 tmp->shrink(tmp, 0, 0);
116 AC_DEFINE(HAVE_SHRINKER_WANT_SHRINK_PTR, 1,
117 [shrinker want self pointer in handler])
119 ]) # LC_SHRINKER_WANT_SHRINK_PTR
122 # LIBCFS_SYSCTL_CTLNAME
124 # 2.6.33 no longer has ctl_name & strategy field in struct ctl_table.
126 AC_DEFUN([LIBCFS_SYSCTL_CTLNAME], [
127 LB_CHECK_COMPILE([if 'ctl_table' has a 'ctl_name' field],
128 ctl_table_ctl_name, [
129 #include <linux/sysctl.h>
132 ct.ctl_name = sizeof(ct);
134 AC_DEFINE(HAVE_SYSCTL_CTLNAME, 1,
135 [ctl_table has ctl_name field])
137 ]) # LIBCFS_SYSCTL_CTLNAME
140 # LIBCFS_MODULE_LOCKING
142 # 2.6.36 introduced locking to module params. RHEL6 lacks this support
144 AC_DEFUN([LIBCFS_MODULE_LOCKING],[
145 LB_CHECK_COMPILE([does the kernel support module param locking],
146 module_param_locking, [
147 #include <linux/moduleparam.h>
149 __kernel_param_lock(NULL);
150 __kernel_param_unlock(NULL);
152 AC_DEFINE(HAVE_MODULE_PARAM_LOCKING, 1,
153 [locking module param is supported])
155 ]) # LIBCFS_MODULE_LOCKING
160 # 2.6.38 kstrtoul is added
162 AC_DEFUN([LIBCFS_KSTRTOUL], [
163 LB_CHECK_COMPILE([if Linux kernel has 'kstrtoul'],
165 #include <linux/kernel.h>
167 unsigned long result;
168 return kstrtoul("12345", 0, &result);
170 AC_DEFINE(HAVE_KSTRTOUL, 1,
171 [kernel has kstrtoul])
176 # LIBCFS_DUMP_TRACE_ADDRESS
178 # 2.6.39 adds a base pointer address argument to dump_trace
180 AC_DEFUN([LIBCFS_DUMP_TRACE_ADDRESS], [
181 LB_CHECK_COMPILE([if 'dump_trace' want address],
182 dump_trace_address, [
185 #include <asm/stacktrace.h>
187 dump_trace(NULL, NULL, NULL, 0, NULL, NULL);
189 AC_DEFINE(HAVE_DUMP_TRACE_ADDRESS, 1,
190 [dump_trace want address argument])
192 ]) # LIBCFS_DUMP_TRACE_ADDRESS
197 # FC15 2.6.40-5 backported the "shrink_control" parameter to the memory
198 # pressure shrinker from Linux 3.0
200 AC_DEFUN([LC_SHRINK_CONTROL], [
201 LB_CHECK_COMPILE([if 'shrink_control' is present],
203 #include <linux/atomic.h>
204 #include <linux/mm.h>
206 struct shrink_control tmp = {0};
207 tmp.nr_to_scan = sizeof(tmp);
209 AC_DEFINE(HAVE_SHRINK_CONTROL, 1,
210 [shrink_control is present])
212 ]) # LC_SHRINK_CONTROL
215 # LIBCFS_PROCESS_NAMESPACE
217 # 3.5 introduced process namespace
218 AC_DEFUN([LIBCFS_PROCESS_NAMESPACE], [
219 LB_CHECK_LINUX_HEADER([linux/uidgid.h], [
220 AC_DEFINE(HAVE_UIDGID_HEADER, 1,
221 [uidgid.h is present])])
222 ]) # LIBCFS_PROCESS_NAMESPACE
227 # 3.5 added helpers to read the new uid/gid types from VFS structures
228 # SLE11 SP3 has uidgid.h but not the helpers
230 AC_DEFUN([LIBCFS_I_UID_READ], [
231 LB_CHECK_COMPILE([if 'i_uid_read' is present],
233 #include <linux/fs.h>
237 AC_DEFINE(HAVE_I_UID_READ, 1, [i_uid_read is present])
239 ]) # LIBCFS_I_UID_READ
242 # LIBCFS_SOCK_ALLOC_FILE
244 # FC18 3.7.2-201 unexport sock_map_fd() change to
245 # use sock_alloc_file().
246 # upstream commit 56b31d1c9f1e6a3ad92e7bfe252721e05d92b285
248 AC_DEFUN([LIBCFS_SOCK_ALLOC_FILE], [
249 LB_CHECK_EXPORT([sock_alloc_file], [net/socket.c], [
250 LB_CHECK_COMPILE([if 'sock_alloc_file' takes 3 arguments],
251 sock_alloc_file_3args, [
252 #include <linux/net.h>
254 sock_alloc_file(NULL, 0, NULL);
256 AC_DEFINE(HAVE_SOCK_ALLOC_FILE_3ARGS, 1,
257 [sock_alloc_file takes 3 arguments])
259 AC_DEFINE(HAVE_SOCK_ALLOC_FILE, 1,
260 [sock_alloc_file is exported])
263 ]) # LIBCFS_SOCK_ALLOC_FILE
268 AC_DEFUN([LIBCFS_HAVE_CRC32], [
269 LB_CHECK_CONFIG_IM([CRC32],
270 [have_crc32="yes"], [have_crc32="no"])
271 AS_IF([test "x$have_crc32" = xyes],
272 [AC_DEFINE(HAVE_CRC32, 1,
273 [kernel compiled with CRC32 functions])])
274 ]) # LIBCFS_HAVE_CRC32
277 # LIBCFS_ENABLE_CRC32_ACCEL
279 AC_DEFUN([LIBCFS_ENABLE_CRC32_ACCEL], [
280 LB_CHECK_CONFIG_IM([CRYPTO_CRC32_PCLMUL],
281 [enable_crc32_crypto="no"], [enable_crc32_crypto="yes"])
282 AS_IF([test "x$have_crc32" = xyes -a "x$enable_crc32_crypto" = xyes], [
283 AC_DEFINE(NEED_CRC32_ACCEL, 1, [need pclmulqdq based crc32])
284 AC_MSG_WARN([No crc32 pclmulqdq crypto api found, enable internal pclmulqdq based crc32])])
285 ]) # LIBCFS_ENABLE_CRC32_ACCEL
288 # LIBCFS_ENABLE_CRC32C_ACCEL
290 AC_DEFUN([LIBCFS_ENABLE_CRC32C_ACCEL], [
291 LB_CHECK_CONFIG_IM([CRYPTO_CRC32C_INTEL],
292 [enable_crc32c_crypto="no"], [enable_crc32c_crypto="yes"])
293 AS_IF([test "x$enable_crc32c_crypto" = xyes], [
294 AC_DEFINE(NEED_CRC32C_ACCEL, 1, [need pclmulqdq based crc32c])
295 AC_MSG_WARN([No crc32c pclmulqdq crypto api found, enable internal pclmulqdq based crc32c])])
296 ]) # LIBCFS_ENABLE_CRC32C_ACCEL
299 # Kernel version 3.11 introduced ktime_get_ts64
301 AC_DEFUN([LIBCFS_KTIME_GET_TS64],[
302 LB_CHECK_COMPILE([does function 'ktime_get_ts64' exist],
304 #include <linux/hrtimer.h>
305 #include <linux/ktime.h>
307 struct timespec64 *ts = NULL;
311 AC_DEFINE(HAVE_KTIME_GET_TS64, 1,
312 ['ktime_get_ts64' is available])
314 ]) # LIBCFS_KTIME_GET_TS64
317 # Linux kernel 3.12 introduced struct kernel_param_ops
318 # This has been backported to all lustre supported
319 # clients expect RHEL6. We have to handle the differences.
321 AC_DEFUN([LIBCFS_KERNEL_PARAM_OPS],[
322 LB_CHECK_COMPILE([does 'struct kernel_param_ops' exist],
324 #include <linux/module.h>
326 struct kernel_param_ops ops;
328 AC_DEFINE(HAVE_KERNEL_PARAM_OPS, 1,
329 ['struct kernel_param_ops' is available])
331 ]) # LIBCFS_KERNEL_PARAM_OPS
334 # Kernel version 3.12 introduced ktime_add
336 AC_DEFUN([LIBCFS_KTIME_ADD],[
337 LB_CHECK_COMPILE([does function 'ktime_add' exist],
339 #include <linux/hrtimer.h>
340 #include <linux/ktime.h>
342 ktime_t start = ktime_set(0, 0);
346 total = ktime_add(start, end);
348 AC_DEFINE(HAVE_KTIME_ADD, 1,
349 [ktime_add is available])
351 ]) # LIBCFS_KTIME_ADD
354 # Kernel version 3.12 introduced ktime_after
356 AC_DEFUN([LIBCFS_KTIME_AFTER],[
357 LB_CHECK_COMPILE([does function 'ktime_after' exist],
359 #include <linux/hrtimer.h>
360 #include <linux/ktime.h>
362 ktime_t start = ktime_set(0, 0);
365 ktime_after(start, end);
367 AC_DEFINE(HAVE_KTIME_AFTER, 1,
368 [ktime_after is available])
370 ]) # LIBCFS_KTIME_AFTER
373 # Kernel version 3.12 introduced ktime_before
374 # See linux commit 67cb9366ff5f99868100198efba5ca88aaa6ad25
376 AC_DEFUN([LIBCFS_KTIME_BEFORE],[
377 LB_CHECK_COMPILE([does function 'ktime_before' exist],
379 #include <linux/hrtimer.h>
380 #include <linux/ktime.h>
382 ktime_t start = ktime_set(0, 0);
385 ktime_before(start, end);
387 AC_DEFINE(HAVE_KTIME_BEFORE, 1,
388 [ktime_before is available])
390 ]) # LIBCFS_KTIME_BEFORE
393 # Kernel version 3.12 introduced ktime_compare
395 AC_DEFUN([LIBCFS_KTIME_COMPARE],[
396 LB_CHECK_COMPILE([does function 'ktime_compare' exist],
398 #include <linux/hrtimer.h>
399 #include <linux/ktime.h>
401 ktime_t start = ktime_set(0, 0);
404 ktime_compare(start, end);
406 AC_DEFINE(HAVE_KTIME_COMPARE, 1,
407 [ktime_compare is available])
409 ]) # LIBCFS_KTIME_COMPARE
412 # FC19 3.12 kernel struct shrinker change
414 AC_DEFUN([LIBCFS_SHRINKER_COUNT],[
415 LB_CHECK_COMPILE([shrinker has 'count_objects'],
416 shrinker_count_objects, [
417 #include <linux/mmzone.h>
418 #include <linux/shrinker.h>
420 ((struct shrinker*)0)->count_objects(NULL, NULL);
422 AC_DEFINE(HAVE_SHRINKER_COUNT, 1,
423 [shrinker has count_objects member])
425 ]) # LIBCFS_SHRINKER_COUNT
428 # Kernel version 3.17 changed hlist_add_after to
431 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
432 LB_CHECK_COMPILE([does function 'hlist_add_after' exist],
434 #include <linux/list.h>
436 hlist_add_after(NULL, NULL);
438 AC_DEFINE(HAVE_HLIST_ADD_AFTER, 1,
439 [hlist_add_after is available])
441 ]) # LIBCFS_HLIST_ADD_AFTER
444 # Kernel version 3.17 introduced struct timespec64
446 AC_DEFUN([LIBCFS_TIMESPEC64],[
447 LB_CHECK_COMPILE([does 'struct timespec64' exist],
449 #include <linux/time.h>
451 struct timespec64 ts;
456 AC_DEFINE(HAVE_TIMESPEC64, 1,
457 ['struct timespec64' is available])
459 ]) # LIBCFS_TIMESPEC64
462 # Kernel version 3.17 introduced ktime_get_real_ts64
464 AC_DEFUN([LIBCFS_KTIME_GET_REAL_TS64],[
465 LB_CHECK_COMPILE([does function 'ktime_get_real_ts64' exist],
466 ktime_get_real_ts64, [
467 #include <linux/ktime.h>
469 struct timespec64 *ts = NULL;
471 ktime_get_real_ts64(ts);
473 AC_DEFINE(HAVE_KTIME_GET_REAL_TS64, 1,
474 ['ktime_get_real_ts64' is available])
476 ]) # LIBCFS_KTIME_GET_REAL_TS64
479 # Kernel version 3.17 introduced ktime_get_real_seconds
481 AC_DEFUN([LIBCFS_KTIME_GET_REAL_SECONDS],[
482 LB_CHECK_COMPILE([does function 'ktime_get_real_seconds' exist],
483 ktime_get_real_seconds, [
484 #include <linux/hrtimer.h>
485 #include <linux/ktime.h>
489 now = ktime_get_real_seconds();
491 AC_DEFINE(HAVE_KTIME_GET_REAL_SECONDS, 1,
492 ['ktime_get_real_seconds' is available])
494 ]) # LIBCFS_KTIME_GET_REAL_SECONDS
497 # Kernel version 3.17 created ktime_get_ns wrapper
499 AC_DEFUN([LIBCFS_KTIME_GET_NS],[
500 LB_CHECK_COMPILE([does function 'ktime_get_ns' exist],
502 #include <linux/hrtimer.h>
503 #include <linux/ktime.h>
507 nanoseconds = ktime_get_ns();
509 AC_DEFINE(NEED_KTIME_GET_NS, 1,
510 ['ktime_get_ns' is not available])
512 ]) # LIBCFS_KTIME_GET_NS
515 # Kernel version 3.17 created ktime_get_real_ns wrapper
517 AC_DEFUN([LIBCFS_KTIME_GET_REAL_NS],[
518 LB_CHECK_COMPILE([does function 'ktime_get_real_ns' exist],
520 #include <linux/hrtimer.h>
521 #include <linux/ktime.h>
525 nanoseconds = ktime_get_real_ns();
527 AC_DEFINE(NEED_KTIME_GET_REAL_NS, 1,
528 ['ktime_get_real_ns' is not available])
530 ]) # LIBCFS_KTIME_GET_REAL_NS
533 # Kernel version 3.17 introduced ktime_to_timespec64
535 AC_DEFUN([LIBCFS_KTIME_TO_TIMESPEC64],[
536 LB_CHECK_COMPILE([does function 'ktime_to_timespec64' exist],
537 ktime_to_timespec64, [
538 #include <linux/hrtimer.h>
539 #include <linux/ktime.h>
541 struct timespec64 ts;
544 ts = ktime_to_timespec64(now);
546 AC_DEFINE(HAVE_KTIME_TO_TIMESPEC64, 1,
547 ['ktime_to_timespec64' is available])
549 ]) # LIBCFS_KTIME_TO_TIMESPEC64
552 # Kernel version 3.17 introduced timespec64_sub
554 AC_DEFUN([LIBCFS_TIMESPEC64_SUB],[
555 LB_CHECK_COMPILE([does function 'timespec64_sub' exist],
557 #include <linux/time.h>
559 struct timespec64 later,earlier,diff;
561 diff = timespec64_sub(later, earlier);
563 AC_DEFINE(HAVE_TIMESPEC64_SUB, 1,
564 ['timespec64_sub' is available])
566 ]) # LIBCFS_TIMESPEC64_SUB
569 # Kernel version 3.17 introduced timespec64_to_ktime
571 AC_DEFUN([LIBCFS_TIMESPEC64_TO_KTIME],[
572 LB_CHECK_COMPILE([does function 'timespec64_to_ktime' exist],
573 timespec64_to_ktime, [
574 #include <linux/ktime.h>
576 struct timespec64 ts;
579 now = timespec64_to_ktime(ts);
581 AC_DEFINE(HAVE_TIMESPEC64_TO_KTIME, 1,
582 ['timespec64_to_ktime' is available])
584 ]) # LIBCFS_TIMESPEC64_TO_KTIME
587 # Kernel version 3.19 introduced ktime_get_seconds
589 AC_DEFUN([LIBCFS_KTIME_GET_SECONDS],[
590 LB_CHECK_COMPILE([does function 'ktime_get_seconds' exist],
592 #include <linux/ktime.h>
596 now = ktime_get_seconds();
598 AC_DEFINE(HAVE_KTIME_GET_SECONDS, 1,
599 ['ktime_get_seconds' is available])
601 ]) # LIBCFS_KTIME_GET_SECONDS
604 # Kernel version 3.19 commit 5aaba36318e5995e8c95d077a46d9a4d00fcc1cd
605 # This patch creates a new helper function cpumap_print_to_pagebuf in
606 # cpumask.h using newly added bitmap_print_to_pagebuf and consolidates
607 # most of those sysfs functions using the new helper function.
609 AC_DEFUN([LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF],[
610 LB_CHECK_COMPILE([does function 'cpumap_print_to_pagebuf' exist],
611 cpumap_print_to_pagebuf, [
612 #include <linux/topology.h>
616 const struct cpumask *mask = NULL;
617 n = cpumap_print_to_pagebuf(true, buf, mask);
619 AC_DEFINE(HAVE_CPUMASK_PRINT_TO_PAGEBUF, 1,
620 [cpumap_print_to_pagebuf is available])
622 ]) # LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF
625 # Kernel version 4.0 commit 41fbf3b39d5eca01527338b4d0ee15ee1ae1023c
626 # introduced the helper function ktime_ms_delta.
628 AC_DEFUN([LIBCFS_KTIME_MS_DELTA],[
629 LB_CHECK_COMPILE([does function 'ktime_ms_delta' exist],
631 #include <linux/ktime.h>
633 ktime_t start = ktime_set(0, 0);
636 ktime_ms_delta(start, end);
638 AC_DEFINE(HAVE_KTIME_MS_DELTA, 1,
639 ['ktime_ms_delta' is available])
641 ]) # LIBCFS_KTIME_MS_DELTA
644 # Kernel version 4.1 commit b51d23e4e9fea6f264d39535c2a62d1f51e7ccc3
645 # create per module locks which added kernel_param_[un]lock(). Older
646 # kernels you have to use __kernel_param_[un]lock(). In that case its
647 # a global lock for all modules but that is okay since its a rare event.
649 AC_DEFUN([LIBCFS_KERNEL_PARAM_LOCK],[
650 LB_CHECK_COMPILE([does function 'kernel_param_[un]lock' exist],
652 #include <linux/moduleparam.h>
654 kernel_param_lock(NULL);
655 kernel_param_unlock(NULL);
657 AC_DEFINE(HAVE_KERNEL_PARAM_LOCK, 1,
658 ['kernel_param_[un]lock' is available])
660 ]) # LIBCFS_KERNEL_PARAM_LOCK
663 # Kernel version 4.2 changed topology_thread_cpumask
664 # to topology_sibling_cpumask
666 AC_DEFUN([LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK],[
667 LB_CHECK_COMPILE([does function 'topology_sibling_cpumask' exist],
668 topology_sibling_cpumask, [
669 #include <linux/topology.h>
671 const struct cpumask *mask;
673 mask = topology_sibling_cpumask(0);
675 AC_DEFINE(HAVE_TOPOLOGY_SIBLING_CPUMASK, 1,
676 [topology_sibling_cpumask is available])
678 ]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
681 # Kernel version 4.2 commit df6b35f409af0a8ff1ef62f552b8402f3fef8665
682 # header file i387.h was renamed to fpu/api.h
684 AC_DEFUN([LIBCFS_FPU_API], [
685 LB_CHECK_LINUX_HEADER([asm/fpu/api.h], [
686 AC_DEFINE(HAVE_FPU_API_HEADER, 1,
687 [fpu/api.h is present])])
691 # Kernel version 4.4 commit ef951599074ba4fad2d0efa0a977129b41e6d203
692 # introduced kstrtobool and kstrtobool_from_user.
694 AC_DEFUN([LIBCFS_KSTRTOBOOL_FROM_USER], [
695 LB_CHECK_COMPILE([if Linux kernel has 'kstrtobool_from_user'],
696 kstrtobool_from_user, [
697 #include <linux/kernel.h>
700 return kstrtobool_from_user(NULL, 0, &result);
702 AC_DEFINE(HAVE_KSTRTOBOOL_FROM_USER, 1,
703 [kernel has kstrtobool_from_user])
705 ]) # LIBCFS_KSTRTOBOOL_FROM_USER
708 # Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24
709 # added crypto hash helpers
711 AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [
712 LB_CHECK_COMPILE([does crypto hash helper functions exist],
713 crypto_hash_helpers, [
714 #include <crypto/hash.h>
716 crypto_ahash_alg_name(NULL);
717 crypto_ahash_driver_name(NULL);
719 AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1,
720 [crypto hash helper functions are available])
722 ]) # LIBCFS_CRYPTO_HASH_HELPERS
725 # Kernerl version 4.5-rc3 commit 2fe829aca9d7bed5fd6b49c6a1452e5e486b6cc3dd
726 # made kset_find_obj() exportable to modules
728 AC_DEFUN([LIBCFS_EXPORT_KSET_FIND_OBJ], [
729 LB_CHECK_EXPORT([kset_find_obj], [lib/kobject.c],
730 [AC_DEFINE(HAVE_KSET_FIND_OBJ, 1,
731 [kset_find_obj is exported by the kernel])])
732 ]) # LIBCFS_EXPORT_KSET_FIND_OBJ
735 # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
737 # linux 4.6 kernel changed stacktrace_ops address to return an int
739 AC_DEFUN([LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT], [
740 LB_CHECK_COMPILE([if 'struct stacktrace_ops' address function returns an int],
741 stacktrace_ops_address_return_int, [
742 #include <asm/stacktrace.h>
746 rc = ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
748 AC_DEFINE(STACKTRACE_OPS_ADDRESS_RETURN_INT, 1,
749 ['struct stacktrace_ops' address function returns an int])
751 ]) # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
754 # Kernel version 4.6 removed both struct task_struct and struct mm_struct
755 # arguments to get_user_pages
757 AC_DEFUN([LIBCFS_GET_USER_PAGES_6ARG], [
758 LB_CHECK_COMPILE([if 'get_user_pages()' takes 6 arguments],
759 get_user_pages_6arg, [
760 #include <linux/mm.h>
764 rc = get_user_pages(0, 0, 0, 0, NULL, NULL);
766 AC_DEFINE(HAVE_GET_USER_PAGES_6ARG, 1,
767 [get_user_pages takes 6 arguments])
769 ]) # LIBCFS_GET_USER_PAGES_6ARG
772 # LIBCFS_STACKTRACE_OPS
774 # Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
775 # removed both struct stacktrace_ops and dump_trace() function
777 AC_DEFUN([LIBCFS_STACKTRACE_OPS], [
778 LB_CHECK_COMPILE([if 'struct stacktrace_ops' exists],
782 #include <asm/stacktrace.h>
784 struct stacktrace_ops ops;
787 AC_DEFINE(HAVE_STACKTRACE_OPS, 1,
788 [struct stacktrace_ops exists])
790 ]) # LIBCFS_STACKTRACE_OPS
793 # Kernel version 4.9 commit 768ae309a96103ed02eb1e111e838c87854d8b51
794 # mm: replace get_user_pages() write/force parameters with gup_flags
796 AC_DEFUN([LIBCFS_GET_USER_PAGES_GUP_FLAGS], [
797 LB_CHECK_COMPILE([if 'get_user_pages()' takes gup_flags in arguments],
798 get_user_pages_gup_flags, [
799 #include <linux/mm.h>
802 rc = get_user_pages(0, 0, FOLL_WRITE, NULL, NULL);
804 AC_DEFINE(HAVE_GET_USER_PAGES_GUP_FLAGS, 1,
805 [get_user_pages takes gup_flags in arguments])
807 ]) # LIBCFS_GET_USER_PAGES_GUP_FLAGS
810 # Kernel version 4.10 commit 7b737965b33188bd3dbb44e938535c4006d97fbb
811 # libcfs: Convert to hotplug state machine
813 AC_DEFUN([LIBCFS_HOTPLUG_STATE_MACHINE], [
814 LB_CHECK_COMPILE([if libcfs supports CPU hotplug state machine],
815 cpu_hotplug_state_machine, [
816 #include <linux/cpuhotplug.h>
818 cpuhp_remove_state(CPUHP_LUSTRE_CFS_DEAD);
820 AC_DEFINE(HAVE_HOTPLUG_STATE_MACHINE, 1,
821 [hotplug state machine is supported])
823 ]) # LIBCFS_HOTPLUG_STATE_MACHINE
826 # LIBCFS_SCHED_HEADERS
828 # 4.11 has broken up sched.h into more headers.
830 AC_DEFUN([LIBCFS_SCHED_HEADERS], [
831 LB_CHECK_LINUX_HEADER([linux/sched/signal.h], [
832 AC_DEFINE(HAVE_SCHED_HEADERS, 1,
833 [linux/sched header directory exist])])
834 ]) # LIBCFS_SCHED_HEADERS
837 # LIBCFS_WAIT_QUEUE_ENTRY
839 # Kernel version 4.13 ac6424b981bce1c4bc55675c6ce11bfe1bbfa64f
840 # Rename wait_queue_t => wait_queue_entry_t
842 AC_DEFUN([LIBCFS_WAIT_QUEUE_ENTRY], [
843 LB_CHECK_COMPILE([if 'wait_queue_entry_t' exists],
845 #include <linux/wait.h>
847 wait_queue_entry_t e;
849 AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY, 1,
850 ['wait_queue_entry_t' is available])
852 ]) # LIBCFS_WAIT_QUEUE_ENTRY
857 # LibCFS linux kernel checks
859 AC_DEFUN([LIBCFS_PROG_LINUX], [
860 AC_MSG_NOTICE([LibCFS kernel checks
861 ==============================================================================])
862 LIBCFS_CONFIG_PANIC_DUMPLOG
865 LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
866 LC_SHRINKER_WANT_SHRINK_PTR
868 LIBCFS_SYSCTL_CTLNAME
870 LIBCFS_MODULE_LOCKING
874 LIBCFS_DUMP_TRACE_ADDRESS
878 LIBCFS_STACKTRACE_WARNING
879 LIBCFS_REINIT_COMPLETION
881 LIBCFS_PROCESS_NAMESPACE
884 LIBCFS_SOCK_ALLOC_FILE
887 LIBCFS_ENABLE_CRC32_ACCEL
889 LIBCFS_ENABLE_CRC32C_ACCEL
891 LIBCFS_KTIME_GET_TS64
893 LIBCFS_KERNEL_PARAM_OPS
898 LIBCFS_SHRINKER_COUNT
900 LIBCFS_HLIST_ADD_AFTER
903 LIBCFS_KTIME_GET_REAL_TS64
904 LIBCFS_KTIME_GET_REAL_SECONDS
905 LIBCFS_KTIME_GET_REAL_NS
906 LIBCFS_KTIME_TO_TIMESPEC64
907 LIBCFS_TIMESPEC64_SUB
908 LIBCFS_TIMESPEC64_TO_KTIME
910 LIBCFS_KTIME_GET_SECONDS
911 LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF
913 LIBCFS_KTIME_MS_DELTA
915 LIBCFS_KERNEL_PARAM_LOCK
917 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
920 LIBCFS_KSTRTOBOOL_FROM_USER
922 LIBCFS_CRYPTO_HASH_HELPERS
923 LIBCFS_EXPORT_KSET_FIND_OBJ
925 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
926 LIBCFS_GET_USER_PAGES_6ARG
928 LIBCFS_STACKTRACE_OPS
930 LIBCFS_GET_USER_PAGES_GUP_FLAGS
932 LIBCFS_HOTPLUG_STATE_MACHINE
936 LIBCFS_WAIT_QUEUE_ENTRY
937 ]) # LIBCFS_PROG_LINUX
940 # LIBCFS_PATH_DEFAULTS
942 # default paths for installed files
944 AC_DEFUN([LIBCFS_PATH_DEFAULTS], [
945 ]) # LIBCFS_PATH_DEFAULTS
950 # other configure checks
952 AC_DEFUN([LIBCFS_CONFIGURE], [
953 AC_MSG_NOTICE([LibCFS core checks
954 ==============================================================================])
956 # libcfs/libcfs/util/nidstrings.c
957 AC_CHECK_HEADERS([netdb.h asm/types.h endian.h])
958 AC_CHECK_FUNCS([gethostbyname])
960 # -------- Check for required packages --------------
962 AC_MSG_NOTICE([LibCFS required packages checks
963 ==============================================================================])
965 AC_MSG_CHECKING([whether to enable readline support])
966 AC_ARG_ENABLE(readline,
967 AC_HELP_STRING([--disable-readline],
968 [disable readline support]),
969 [], [enable_readline="yes"])
970 AC_MSG_RESULT([$enable_readline])
973 AS_IF([test "x$enable_readline" = xyes], [
974 AC_CHECK_LIB([readline], [readline], [
975 LIBREADLINE="-lreadline"
976 AC_DEFINE(HAVE_LIBREADLINE, 1,
977 [readline library is available])
980 AC_SUBST(LIBREADLINE)
982 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
983 AC_ARG_ENABLE([libpthread],
984 AC_HELP_STRING([--disable-libpthread],
985 [disable libpthread]),
986 [], [enable_libpthread="yes"])
987 AC_MSG_RESULT([$enable_libpthread])
990 AS_IF([test "x$enable_libpthread" = xyes], [
991 AC_CHECK_LIB([pthread], [pthread_create], [
992 PTHREAD_LIBS="-lpthread"
993 AC_DEFINE([HAVE_LIBPTHREAD], 1,
994 [use libpthread for libcfs library])
997 AC_MSG_WARN([Using libpthread for libcfs library is disabled explicitly])
999 AC_SUBST(PTHREAD_LIBS)
1000 ]) # LIBCFS_CONFIGURE
1003 # LIBCFS_CONDITIONALS
1005 AC_DEFUN([LIBCFS_CONDITIONALS], [
1006 AM_CONDITIONAL(HAVE_CRC32, [test "x$have_crc32" = xyes])
1007 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32, [test "x$have_crc32" = xyes -a "x$enable_crc32_crypto" = xyes])
1008 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32C, [test "x$enable_crc32c_crypto" = xyes])
1009 ]) # LIBCFS_CONDITIONALS
1012 # LIBCFS_CONFIG_FILES
1014 # files that should be generated with AC_OUTPUT
1016 AC_DEFUN([LIBCFS_CONFIG_FILES], [
1020 libcfs/autoconf/Makefile
1021 libcfs/include/Makefile
1022 libcfs/include/libcfs/Makefile
1023 libcfs/include/libcfs/linux/Makefile
1024 libcfs/include/libcfs/util/Makefile
1025 libcfs/libcfs/Makefile
1026 libcfs/libcfs/autoMakefile
1027 libcfs/libcfs/linux/Makefile
1028 libcfs/libcfs/util/Makefile
1030 ]) # LIBCFS_CONFIG_FILES