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/ktime.h>
306 struct timespec64 *ts = NULL;
310 AC_DEFINE(HAVE_KTIME_GET_TS64, 1,
311 ['ktime_get_ts64' is available])
313 ]) # LIBCFS_KTIME_GET_TS64
316 # Linux kernel 3.12 introduced struct kernel_param_ops
317 # This has been backported to all lustre supported
318 # clients expect RHEL6. We have to handle the differences.
320 AC_DEFUN([LIBCFS_KERNEL_PARAM_OPS],[
321 LB_CHECK_COMPILE([does 'struct kernel_param_ops' exist],
323 #include <linux/module.h>
325 struct kernel_param_ops ops;
327 AC_DEFINE(HAVE_KERNEL_PARAM_OPS, 1,
328 ['struct kernel_param_ops' is available])
330 ]) # LIBCFS_KERNEL_PARAM_OPS
333 # Kernel version 3.12 introduced ktime_add
335 AC_DEFUN([LIBCFS_KTIME_ADD],[
336 LB_CHECK_COMPILE([does function 'ktime_add' exist],
338 #include <linux/ktime.h>
340 ktime_t start = ktime_set(0, 0);
344 total = ktime_add(start, end);
346 AC_DEFINE(HAVE_KTIME_ADD, 1,
347 [ktime_add is available])
349 ]) # LIBCFS_KTIME_ADD
352 # Kernel version 3.12 introduced ktime_after
354 AC_DEFUN([LIBCFS_KTIME_AFTER],[
355 LB_CHECK_COMPILE([does function 'ktime_after' exist],
357 #include <linux/ktime.h>
359 ktime_t start = ktime_set(0, 0);
362 ktime_after(start, end);
364 AC_DEFINE(HAVE_KTIME_AFTER, 1,
365 [ktime_after is available])
367 ]) # LIBCFS_KTIME_AFTER
370 # FC19 3.12 kernel struct shrinker change
372 AC_DEFUN([LIBCFS_SHRINKER_COUNT],[
373 LB_CHECK_COMPILE([shrinker has 'count_objects'],
374 shrinker_count_objects, [
375 #include <linux/mmzone.h>
376 #include <linux/shrinker.h>
378 ((struct shrinker*)0)->count_objects(NULL, NULL);
380 AC_DEFINE(HAVE_SHRINKER_COUNT, 1,
381 [shrinker has count_objects member])
383 ]) # LIBCFS_SHRINKER_COUNT
386 # Kernel version 3.17 changed hlist_add_after to
389 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
390 LB_CHECK_COMPILE([does function 'hlist_add_after' exist],
392 #include <linux/list.h>
394 hlist_add_after(NULL, NULL);
396 AC_DEFINE(HAVE_HLIST_ADD_AFTER, 1,
397 [hlist_add_after is available])
399 ]) # LIBCFS_HLIST_ADD_AFTER
402 # Kernel version 3.17 introduced struct timespec64
404 AC_DEFUN([LIBCFS_TIMESPEC64],[
405 LB_CHECK_COMPILE([does 'struct timespec64' exist],
407 #include <linux/time.h>
409 struct timespec64 ts;
414 AC_DEFINE(HAVE_TIMESPEC64, 1,
415 ['struct timespec64' is available])
417 ]) # LIBCFS_TIMESPEC64
420 # Kernel version 3.17 introduced ktime_get_real_ts64
422 AC_DEFUN([LIBCFS_KTIME_GET_REAL_TS64],[
423 LB_CHECK_COMPILE([does function 'ktime_get_real_ts64' exist],
424 ktime_get_real_ts64, [
425 #include <linux/ktime.h>
427 struct timespec64 *ts = NULL;
429 ktime_get_real_ts64(ts);
431 AC_DEFINE(HAVE_KTIME_GET_REAL_TS64, 1,
432 ['ktime_get_real_ts64' is available])
434 ]) # LIBCFS_KTIME_GET_REAL_TS64
437 # Kernel version 3.17 introduced ktime_get_real_seconds
439 AC_DEFUN([LIBCFS_KTIME_GET_REAL_SECONDS],[
440 LB_CHECK_COMPILE([does function 'ktime_get_real_seconds' exist],
441 ktime_get_real_seconds, [
442 #include <linux/ktime.h>
446 now = ktime_get_real_seconds();
448 AC_DEFINE(HAVE_KTIME_GET_REAL_SECONDS, 1,
449 ['ktime_get_real_seconds' is available])
451 ]) # LIBCFS_KTIME_GET_REAL_SECONDS
454 # Kernel version 3.17 created ktime_get_real_ns wrapper
456 AC_DEFUN([LIBCFS_KTIME_GET_REAL_NS],[
457 LB_CHECK_COMPILE([does function 'ktime_get_real_ns' exist],
459 #include <linux/ktime.h>
463 nanoseconds = ktime_get_real_ns();
465 AC_DEFINE(NEED_KTIME_GET_REAL_NS, 1,
466 ['ktime_get_real_ns' is not available])
468 ]) # LIBCFS_KTIME_GET_REAL_NS
471 # Kernel version 3.17 introduced ktime_to_timespec64
473 AC_DEFUN([LIBCFS_KTIME_TO_TIMESPEC64],[
474 LB_CHECK_COMPILE([does function 'ktime_to_timespec64' exist],
475 ktime_to_timespec64, [
476 #include <linux/ktime.h>
478 struct timespec64 ts;
481 ts = ktime_to_timespec64(now);
483 AC_DEFINE(HAVE_KTIME_TO_TIMESPEC64, 1,
484 ['ktime_to_timespec64' is available])
486 ]) # LIBCFS_KTIME_TO_TIMESPEC64
489 # Kernel version 3.17 introduced timespec64_sub
491 AC_DEFUN([LIBCFS_TIMESPEC64_SUB],[
492 LB_CHECK_COMPILE([does function 'timespec64_sub' exist],
494 #include <linux/time.h>
496 struct timespec64 later,earlier,diff;
498 diff = timespec64_sub(later, earlier);
500 AC_DEFINE(HAVE_TIMESPEC64_SUB, 1,
501 ['timespec64_sub' is available])
503 ]) # LIBCFS_TIMESPEC64_SUB
506 # Kernel version 3.17 introduced timespec64_to_ktime
508 AC_DEFUN([LIBCFS_TIMESPEC64_TO_KTIME],[
509 LB_CHECK_COMPILE([does function 'timespec64_to_ktime' exist],
510 timespec64_to_ktime, [
511 #include <linux/ktime.h>
513 struct timespec64 ts;
516 now = timespec64_to_ktime(ts);
518 AC_DEFINE(HAVE_TIMESPEC64_TO_KTIME, 1,
519 ['timespec64_to_ktime' is available])
521 ]) # LIBCFS_TIMESPEC64_TO_KTIME
524 # Kernel version 3.19 introduced ktime_get_seconds
526 AC_DEFUN([LIBCFS_KTIME_GET_SECONDS],[
527 LB_CHECK_COMPILE([does function 'ktime_get_seconds' exist],
529 #include <linux/ktime.h>
533 now = ktime_get_seconds();
535 AC_DEFINE(HAVE_KTIME_GET_SECONDS, 1,
536 ['ktime_get_seconds' is available])
538 ]) # LIBCFS_KTIME_GET_SECONDS
541 # Kernel version 3.19 commit 5aaba36318e5995e8c95d077a46d9a4d00fcc1cd
542 # This patch creates a new helper function cpumap_print_to_pagebuf in
543 # cpumask.h using newly added bitmap_print_to_pagebuf and consolidates
544 # most of those sysfs functions using the new helper function.
546 AC_DEFUN([LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF],[
547 LB_CHECK_COMPILE([does function 'cpumap_print_to_pagebuf' exist],
548 cpumap_print_to_pagebuf, [
549 #include <linux/topology.h>
553 const struct cpumask *mask = NULL;
554 n = cpumap_print_to_pagebuf(true, buf, mask);
556 AC_DEFINE(HAVE_CPUMASK_PRINT_TO_PAGEBUF, 1,
557 [cpumap_print_to_pagebuf is available])
559 ]) # LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF
562 # Kernel version 4.1 commit b51d23e4e9fea6f264d39535c2a62d1f51e7ccc3
563 # create per module locks which added kernel_param_[un]lock(). Older
564 # kernels you have to use __kernel_param_[un]lock(). In that case its
565 # a global lock for all modules but that is okay since its a rare event.
567 AC_DEFUN([LIBCFS_KERNEL_PARAM_LOCK],[
568 LB_CHECK_COMPILE([does function 'kernel_param_[un]lock' exist],
570 #include <linux/moduleparam.h>
572 kernel_param_lock(NULL);
573 kernel_param_unlock(NULL);
575 AC_DEFINE(HAVE_KERNEL_PARAM_LOCK, 1,
576 ['kernel_param_[un]lock' is available])
578 ]) # LIBCFS_KERNEL_PARAM_LOCK
581 # Kernel version 4.2 changed topology_thread_cpumask
582 # to topology_sibling_cpumask
584 AC_DEFUN([LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK],[
585 LB_CHECK_COMPILE([does function 'topology_sibling_cpumask' exist],
586 topology_sibling_cpumask, [
587 #include <linux/topology.h>
589 const struct cpumask *mask;
591 mask = topology_sibling_cpumask(0);
593 AC_DEFINE(HAVE_TOPOLOGY_SIBLING_CPUMASK, 1,
594 [topology_sibling_cpumask is available])
596 ]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
599 # Kernel version 4.2 commit df6b35f409af0a8ff1ef62f552b8402f3fef8665
600 # header file i387.h was renamed to fpu/api.h
602 AC_DEFUN([LIBCFS_FPU_API], [
603 LB_CHECK_LINUX_HEADER([asm/fpu/api.h], [
604 AC_DEFINE(HAVE_FPU_API_HEADER, 1,
605 [fpu/api.h is present])])
609 # Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24
610 # added crypto hash helpers
612 AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [
613 LB_CHECK_COMPILE([does crypto hash helper functions exist],
614 crypto_hash_helpers, [
615 #include <crypto/hash.h>
617 crypto_ahash_alg_name(NULL);
618 crypto_ahash_driver_name(NULL);
620 AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1,
621 [crypto hash helper functions are available])
623 ]) # LIBCFS_CRYPTO_HASH_HELPERS
626 # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
628 # linux 4.6 kernel changed stacktrace_ops address to return an int
630 AC_DEFUN([LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT], [
631 LB_CHECK_COMPILE([if 'struct stacktrace_ops' address function returns an int],
632 stacktrace_ops_address_return_int, [
633 #include <asm/stacktrace.h>
637 rc = ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
639 AC_DEFINE(STACKTRACE_OPS_ADDRESS_RETURN_INT, 1,
640 ['struct stacktrace_ops' address function returns an int])
642 ]) # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
645 # Kernel version 4.6 removed both struct task_struct and struct mm_struct
646 # arguments to get_user_pages
648 AC_DEFUN([LIBCFS_GET_USER_PAGES_6ARG], [
649 LB_CHECK_COMPILE([if 'get_user_pages()' takes 6 arguments],
650 get_user_pages_6arg, [
651 #include <linux/mm.h>
655 rc = get_user_pages(0, 0, 0, 0, NULL, NULL);
657 AC_DEFINE(HAVE_GET_USER_PAGES_6ARG, 1,
658 [get_user_pages takes 6 arguments])
660 ]) # LIBCFS_GET_USER_PAGES_6ARG
663 # LIBCFS_STACKTRACE_OPS
665 # Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
666 # removed both struct stacktrace_ops and dump_trace() function
668 AC_DEFUN([LIBCFS_STACKTRACE_OPS], [
669 LB_CHECK_COMPILE([if 'struct stacktrace_ops' exists],
673 #include <asm/stacktrace.h>
675 struct stacktrace_ops ops;
678 AC_DEFINE(HAVE_STACKTRACE_OPS, 1,
679 [struct stacktrace_ops exists])
681 ]) # LIBCFS_STACKTRACE_OPS
684 # Kernel version 4.9 commit 768ae309a96103ed02eb1e111e838c87854d8b51
685 # mm: replace get_user_pages() write/force parameters with gup_flags
687 AC_DEFUN([LIBCFS_GET_USER_PAGES_GUP_FLAGS], [
688 LB_CHECK_COMPILE([if 'get_user_pages()' takes gup_flags in arguments],
689 get_user_pages_gup_flags, [
690 #include <linux/mm.h>
693 rc = get_user_pages(0, 0, FOLL_WRITE, NULL, NULL);
695 AC_DEFINE(HAVE_GET_USER_PAGES_GUP_FLAGS, 1,
696 [get_user_pages takes gup_flags in arguments])
698 ]) # LIBCFS_GET_USER_PAGES_GUP_FLAGS
701 # Kernel version 4.10 commit 7b737965b33188bd3dbb44e938535c4006d97fbb
702 # libcfs: Convert to hotplug state machine
704 AC_DEFUN([LIBCFS_HOTPLUG_STATE_MACHINE], [
705 LB_CHECK_COMPILE([if libcfs supports CPU hotplug state machine],
706 cpu_hotplug_state_machine, [
707 #include <linux/cpuhotplug.h>
709 cpuhp_remove_state(CPUHP_LUSTRE_CFS_DEAD);
711 AC_DEFINE(HAVE_HOTPLUG_STATE_MACHINE, 1,
712 [hotplug state machine is supported])
714 ]) # LIBCFS_HOTPLUG_STATE_MACHINE
717 # LIBCFS_SCHED_HEADERS
719 # 4.11 has broken up sched.h into more headers.
721 AC_DEFUN([LIBCFS_SCHED_HEADERS], [
722 LB_CHECK_LINUX_HEADER([linux/sched/signal.h], [
723 AC_DEFINE(HAVE_SCHED_HEADERS, 1,
724 [linux/sched header directory exist])])
725 ]) # LIBCFS_SCHED_HEADERS
730 # LibCFS linux kernel checks
732 AC_DEFUN([LIBCFS_PROG_LINUX], [
733 AC_MSG_NOTICE([LibCFS kernel checks
734 ==============================================================================])
735 LIBCFS_CONFIG_PANIC_DUMPLOG
738 LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
739 LC_SHRINKER_WANT_SHRINK_PTR
741 LIBCFS_SYSCTL_CTLNAME
743 LIBCFS_MODULE_LOCKING
747 LIBCFS_DUMP_TRACE_ADDRESS
751 LIBCFS_STACKTRACE_WARNING
752 LIBCFS_REINIT_COMPLETION
754 LIBCFS_PROCESS_NAMESPACE
757 LIBCFS_SOCK_ALLOC_FILE
760 LIBCFS_ENABLE_CRC32_ACCEL
762 LIBCFS_ENABLE_CRC32C_ACCEL
764 LIBCFS_KTIME_GET_TS64
766 LIBCFS_KERNEL_PARAM_OPS
769 LIBCFS_SHRINKER_COUNT
771 LIBCFS_HLIST_ADD_AFTER
773 LIBCFS_KTIME_GET_REAL_TS64
774 LIBCFS_KTIME_GET_REAL_SECONDS
775 LIBCFS_KTIME_GET_REAL_NS
776 LIBCFS_KTIME_TO_TIMESPEC64
777 LIBCFS_TIMESPEC64_SUB
778 LIBCFS_TIMESPEC64_TO_KTIME
780 LIBCFS_KTIME_GET_SECONDS
781 LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF
783 LIBCFS_KERNEL_PARAM_LOCK
785 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
788 LIBCFS_CRYPTO_HASH_HELPERS
790 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
791 LIBCFS_GET_USER_PAGES_6ARG
793 LIBCFS_STACKTRACE_OPS
795 LIBCFS_GET_USER_PAGES_GUP_FLAGS
797 LIBCFS_HOTPLUG_STATE_MACHINE
800 ]) # LIBCFS_PROG_LINUX
803 # LIBCFS_PATH_DEFAULTS
805 # default paths for installed files
807 AC_DEFUN([LIBCFS_PATH_DEFAULTS], [
808 ]) # LIBCFS_PATH_DEFAULTS
813 # other configure checks
815 AC_DEFUN([LIBCFS_CONFIGURE], [
816 AC_MSG_NOTICE([LibCFS core checks
817 ==============================================================================])
819 # lnet/utils/portals.c
820 AC_CHECK_HEADERS([asm/types.h endian.h sys/ioctl.h])
823 AC_CHECK_HEADERS([linux/version.h])
825 AC_CHECK_TYPE([spinlock_t],
826 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
828 [#include <linux/spinlock.h>])
830 # lnet/utils/wirecheck.c
831 AC_CHECK_FUNCS([strnlen])
833 # lnet/libcfs/user-prim.c, missing for RHEL5 and earlier userspace
834 AC_CHECK_FUNCS([strlcpy])
836 # libcfs/libcfs/user-prim.c, missing for RHEL5 and earlier userspace
837 AC_CHECK_FUNCS([strlcat])
839 # libcfs/include/libcfs/linux/linux-prim.h, ...
840 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
842 # libcfs/include/libcfs/linux/linux-prim.h
843 AC_CHECK_HEADERS([linux/random.h], [], [],
844 [#ifdef HAVE_LINUX_TYPES_H
845 #include <linux/types.h>
849 # libcfs/include/libcfs/linux/libcfs.h
850 # libcfs/include/libcfs/byteorder.h
851 # libcfs/libcfs/util/nidstrings.c
852 AC_CHECK_HEADERS([netdb.h asm/types.h endian.h])
853 AC_CHECK_FUNCS([gethostbyname])
855 # -------- Check for required packages --------------
857 AC_MSG_NOTICE([LibCFS required packages checks
858 ==============================================================================])
860 AC_MSG_CHECKING([whether to enable readline support])
861 AC_ARG_ENABLE(readline,
862 AC_HELP_STRING([--disable-readline],
863 [disable readline support]),
864 [], [enable_readline="yes"])
865 AC_MSG_RESULT([$enable_readline])
868 AS_IF([test "x$enable_readline" = xyes], [
869 AC_CHECK_LIB([readline], [readline], [
870 LIBREADLINE="-lreadline"
871 AC_DEFINE(HAVE_LIBREADLINE, 1,
872 [readline library is available])
875 AC_SUBST(LIBREADLINE)
877 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
878 AC_ARG_ENABLE([libpthread],
879 AC_HELP_STRING([--disable-libpthread],
880 [disable libpthread]),
881 [], [enable_libpthread="yes"])
882 AC_MSG_RESULT([$enable_libpthread])
885 AS_IF([test "x$enable_libpthread" = xyes], [
886 AC_CHECK_LIB([pthread], [pthread_create], [
887 PTHREAD_LIBS="-lpthread"
888 AC_DEFINE([HAVE_LIBPTHREAD], 1,
889 [use libpthread for libcfs library])
892 AC_MSG_WARN([Using libpthread for libcfs library is disabled explicitly])
894 AC_SUBST(PTHREAD_LIBS)
895 ]) # LIBCFS_CONFIGURE
898 # LIBCFS_CONDITIONALS
900 AC_DEFUN([LIBCFS_CONDITIONALS], [
901 AM_CONDITIONAL(HAVE_CRC32, [test "x$have_crc32" = xyes])
902 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32, [test "x$have_crc32" = xyes -a "x$enable_crc32_crypto" = xyes])
903 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32C, [test "x$enable_crc32c_crypto" = xyes])
904 ]) # LIBCFS_CONDITIONALS
907 # LIBCFS_CONFIG_FILES
909 # files that should be generated with AC_OUTPUT
911 AC_DEFUN([LIBCFS_CONFIG_FILES], [
915 libcfs/autoconf/Makefile
916 libcfs/include/Makefile
917 libcfs/include/libcfs/Makefile
918 libcfs/include/libcfs/linux/Makefile
919 libcfs/include/libcfs/util/Makefile
920 libcfs/libcfs/Makefile
921 libcfs/libcfs/autoMakefile
922 libcfs/libcfs/linux/Makefile
923 libcfs/libcfs/util/Makefile
925 ]) # LIBCFS_CONFIG_FILES