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 # Kernel version 3.12 introduced ktime_before
371 # See linux commit 67cb9366ff5f99868100198efba5ca88aaa6ad25
373 AC_DEFUN([LIBCFS_KTIME_BEFORE],[
374 LB_CHECK_COMPILE([does function 'ktime_before' exist],
376 #include <linux/ktime.h>
378 ktime_t start = ktime_set(0, 0);
381 ktime_before(start, end);
383 AC_DEFINE(HAVE_KTIME_BEFORE, 1,
384 [ktime_before is available])
386 ]) # LIBCFS_KTIME_BEFORE
389 # Kernel version 3.12 introduced ktime_compare
391 AC_DEFUN([LIBCFS_KTIME_COMPARE],[
392 LB_CHECK_COMPILE([does function 'ktime_compare' exist],
394 #include <linux/ktime.h>
396 ktime_t start = ktime_set(0, 0);
399 ktime_compare(start, end);
401 AC_DEFINE(HAVE_KTIME_COMPARE, 1,
402 [ktime_compare is available])
404 ]) # LIBCFS_KTIME_COMPARE
407 # FC19 3.12 kernel struct shrinker change
409 AC_DEFUN([LIBCFS_SHRINKER_COUNT],[
410 LB_CHECK_COMPILE([shrinker has 'count_objects'],
411 shrinker_count_objects, [
412 #include <linux/mmzone.h>
413 #include <linux/shrinker.h>
415 ((struct shrinker*)0)->count_objects(NULL, NULL);
417 AC_DEFINE(HAVE_SHRINKER_COUNT, 1,
418 [shrinker has count_objects member])
420 ]) # LIBCFS_SHRINKER_COUNT
423 # Kernel version 3.17 changed hlist_add_after to
426 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
427 LB_CHECK_COMPILE([does function 'hlist_add_after' exist],
429 #include <linux/list.h>
431 hlist_add_after(NULL, NULL);
433 AC_DEFINE(HAVE_HLIST_ADD_AFTER, 1,
434 [hlist_add_after is available])
436 ]) # LIBCFS_HLIST_ADD_AFTER
439 # Kernel version 3.17 introduced struct timespec64
441 AC_DEFUN([LIBCFS_TIMESPEC64],[
442 LB_CHECK_COMPILE([does 'struct timespec64' exist],
444 #include <linux/time.h>
446 struct timespec64 ts;
451 AC_DEFINE(HAVE_TIMESPEC64, 1,
452 ['struct timespec64' is available])
454 ]) # LIBCFS_TIMESPEC64
457 # Kernel version 3.17 introduced ktime_get_real_ts64
459 AC_DEFUN([LIBCFS_KTIME_GET_REAL_TS64],[
460 LB_CHECK_COMPILE([does function 'ktime_get_real_ts64' exist],
461 ktime_get_real_ts64, [
462 #include <linux/ktime.h>
464 struct timespec64 *ts = NULL;
466 ktime_get_real_ts64(ts);
468 AC_DEFINE(HAVE_KTIME_GET_REAL_TS64, 1,
469 ['ktime_get_real_ts64' is available])
471 ]) # LIBCFS_KTIME_GET_REAL_TS64
474 # Kernel version 3.17 introduced ktime_get_real_seconds
476 AC_DEFUN([LIBCFS_KTIME_GET_REAL_SECONDS],[
477 LB_CHECK_COMPILE([does function 'ktime_get_real_seconds' exist],
478 ktime_get_real_seconds, [
479 #include <linux/ktime.h>
483 now = ktime_get_real_seconds();
485 AC_DEFINE(HAVE_KTIME_GET_REAL_SECONDS, 1,
486 ['ktime_get_real_seconds' is available])
488 ]) # LIBCFS_KTIME_GET_REAL_SECONDS
491 # Kernel version 3.17 created ktime_get_ns wrapper
493 AC_DEFUN([LIBCFS_KTIME_GET_NS],[
494 LB_CHECK_COMPILE([does function 'ktime_get_ns' exist],
496 #include <linux/ktime.h>
500 nanoseconds = ktime_get_ns();
502 AC_DEFINE(NEED_KTIME_GET_NS, 1,
503 ['ktime_get_ns' is not available])
505 ]) # LIBCFS_KTIME_GET_NS
508 # Kernel version 3.17 created ktime_get_real_ns wrapper
510 AC_DEFUN([LIBCFS_KTIME_GET_REAL_NS],[
511 LB_CHECK_COMPILE([does function 'ktime_get_real_ns' exist],
513 #include <linux/ktime.h>
517 nanoseconds = ktime_get_real_ns();
519 AC_DEFINE(NEED_KTIME_GET_REAL_NS, 1,
520 ['ktime_get_real_ns' is not available])
522 ]) # LIBCFS_KTIME_GET_REAL_NS
525 # Kernel version 3.17 introduced ktime_to_timespec64
527 AC_DEFUN([LIBCFS_KTIME_TO_TIMESPEC64],[
528 LB_CHECK_COMPILE([does function 'ktime_to_timespec64' exist],
529 ktime_to_timespec64, [
530 #include <linux/ktime.h>
532 struct timespec64 ts;
535 ts = ktime_to_timespec64(now);
537 AC_DEFINE(HAVE_KTIME_TO_TIMESPEC64, 1,
538 ['ktime_to_timespec64' is available])
540 ]) # LIBCFS_KTIME_TO_TIMESPEC64
543 # Kernel version 3.17 introduced timespec64_sub
545 AC_DEFUN([LIBCFS_TIMESPEC64_SUB],[
546 LB_CHECK_COMPILE([does function 'timespec64_sub' exist],
548 #include <linux/time.h>
550 struct timespec64 later,earlier,diff;
552 diff = timespec64_sub(later, earlier);
554 AC_DEFINE(HAVE_TIMESPEC64_SUB, 1,
555 ['timespec64_sub' is available])
557 ]) # LIBCFS_TIMESPEC64_SUB
560 # Kernel version 3.17 introduced timespec64_to_ktime
562 AC_DEFUN([LIBCFS_TIMESPEC64_TO_KTIME],[
563 LB_CHECK_COMPILE([does function 'timespec64_to_ktime' exist],
564 timespec64_to_ktime, [
565 #include <linux/ktime.h>
567 struct timespec64 ts;
570 now = timespec64_to_ktime(ts);
572 AC_DEFINE(HAVE_TIMESPEC64_TO_KTIME, 1,
573 ['timespec64_to_ktime' is available])
575 ]) # LIBCFS_TIMESPEC64_TO_KTIME
578 # Kernel version 3.19 introduced ktime_get_seconds
580 AC_DEFUN([LIBCFS_KTIME_GET_SECONDS],[
581 LB_CHECK_COMPILE([does function 'ktime_get_seconds' exist],
583 #include <linux/ktime.h>
587 now = ktime_get_seconds();
589 AC_DEFINE(HAVE_KTIME_GET_SECONDS, 1,
590 ['ktime_get_seconds' is available])
592 ]) # LIBCFS_KTIME_GET_SECONDS
595 # Kernel version 3.19 commit 5aaba36318e5995e8c95d077a46d9a4d00fcc1cd
596 # This patch creates a new helper function cpumap_print_to_pagebuf in
597 # cpumask.h using newly added bitmap_print_to_pagebuf and consolidates
598 # most of those sysfs functions using the new helper function.
600 AC_DEFUN([LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF],[
601 LB_CHECK_COMPILE([does function 'cpumap_print_to_pagebuf' exist],
602 cpumap_print_to_pagebuf, [
603 #include <linux/topology.h>
607 const struct cpumask *mask = NULL;
608 n = cpumap_print_to_pagebuf(true, buf, mask);
610 AC_DEFINE(HAVE_CPUMASK_PRINT_TO_PAGEBUF, 1,
611 [cpumap_print_to_pagebuf is available])
613 ]) # LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF
616 # Kernel version 4.1 commit b51d23e4e9fea6f264d39535c2a62d1f51e7ccc3
617 # create per module locks which added kernel_param_[un]lock(). Older
618 # kernels you have to use __kernel_param_[un]lock(). In that case its
619 # a global lock for all modules but that is okay since its a rare event.
621 AC_DEFUN([LIBCFS_KERNEL_PARAM_LOCK],[
622 LB_CHECK_COMPILE([does function 'kernel_param_[un]lock' exist],
624 #include <linux/moduleparam.h>
626 kernel_param_lock(NULL);
627 kernel_param_unlock(NULL);
629 AC_DEFINE(HAVE_KERNEL_PARAM_LOCK, 1,
630 ['kernel_param_[un]lock' is available])
632 ]) # LIBCFS_KERNEL_PARAM_LOCK
635 # Kernel version 4.2 changed topology_thread_cpumask
636 # to topology_sibling_cpumask
638 AC_DEFUN([LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK],[
639 LB_CHECK_COMPILE([does function 'topology_sibling_cpumask' exist],
640 topology_sibling_cpumask, [
641 #include <linux/topology.h>
643 const struct cpumask *mask;
645 mask = topology_sibling_cpumask(0);
647 AC_DEFINE(HAVE_TOPOLOGY_SIBLING_CPUMASK, 1,
648 [topology_sibling_cpumask is available])
650 ]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
653 # Kernel version 4.2 commit df6b35f409af0a8ff1ef62f552b8402f3fef8665
654 # header file i387.h was renamed to fpu/api.h
656 AC_DEFUN([LIBCFS_FPU_API], [
657 LB_CHECK_LINUX_HEADER([asm/fpu/api.h], [
658 AC_DEFINE(HAVE_FPU_API_HEADER, 1,
659 [fpu/api.h is present])])
663 # Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24
664 # added crypto hash helpers
666 AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [
667 LB_CHECK_COMPILE([does crypto hash helper functions exist],
668 crypto_hash_helpers, [
669 #include <crypto/hash.h>
671 crypto_ahash_alg_name(NULL);
672 crypto_ahash_driver_name(NULL);
674 AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1,
675 [crypto hash helper functions are available])
677 ]) # LIBCFS_CRYPTO_HASH_HELPERS
680 # Kernerl version 4.5-rc3 commit 2fe829aca9d7bed5fd6b49c6a1452e5e486b6cc3dd
681 # made kset_find_obj() exportable to modules
683 AC_DEFUN([LIBCFS_EXPORT_KSET_FIND_OBJ], [
684 LB_CHECK_EXPORT([kset_find_obj], [lib/kobject.c],
685 [AC_DEFINE(HAVE_KSET_FIND_OBJ, 1,
686 [kset_find_obj is exported by the kernel])])
687 ]) # LIBCFS_EXPORT_KSET_FIND_OBJ
690 # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
692 # linux 4.6 kernel changed stacktrace_ops address to return an int
694 AC_DEFUN([LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT], [
695 LB_CHECK_COMPILE([if 'struct stacktrace_ops' address function returns an int],
696 stacktrace_ops_address_return_int, [
697 #include <asm/stacktrace.h>
701 rc = ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
703 AC_DEFINE(STACKTRACE_OPS_ADDRESS_RETURN_INT, 1,
704 ['struct stacktrace_ops' address function returns an int])
706 ]) # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
709 # Kernel version 4.6 removed both struct task_struct and struct mm_struct
710 # arguments to get_user_pages
712 AC_DEFUN([LIBCFS_GET_USER_PAGES_6ARG], [
713 LB_CHECK_COMPILE([if 'get_user_pages()' takes 6 arguments],
714 get_user_pages_6arg, [
715 #include <linux/mm.h>
719 rc = get_user_pages(0, 0, 0, 0, NULL, NULL);
721 AC_DEFINE(HAVE_GET_USER_PAGES_6ARG, 1,
722 [get_user_pages takes 6 arguments])
724 ]) # LIBCFS_GET_USER_PAGES_6ARG
727 # LIBCFS_STACKTRACE_OPS
729 # Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
730 # removed both struct stacktrace_ops and dump_trace() function
732 AC_DEFUN([LIBCFS_STACKTRACE_OPS], [
733 LB_CHECK_COMPILE([if 'struct stacktrace_ops' exists],
737 #include <asm/stacktrace.h>
739 struct stacktrace_ops ops;
742 AC_DEFINE(HAVE_STACKTRACE_OPS, 1,
743 [struct stacktrace_ops exists])
745 ]) # LIBCFS_STACKTRACE_OPS
748 # Kernel version 4.9 commit 768ae309a96103ed02eb1e111e838c87854d8b51
749 # mm: replace get_user_pages() write/force parameters with gup_flags
751 AC_DEFUN([LIBCFS_GET_USER_PAGES_GUP_FLAGS], [
752 LB_CHECK_COMPILE([if 'get_user_pages()' takes gup_flags in arguments],
753 get_user_pages_gup_flags, [
754 #include <linux/mm.h>
757 rc = get_user_pages(0, 0, FOLL_WRITE, NULL, NULL);
759 AC_DEFINE(HAVE_GET_USER_PAGES_GUP_FLAGS, 1,
760 [get_user_pages takes gup_flags in arguments])
762 ]) # LIBCFS_GET_USER_PAGES_GUP_FLAGS
765 # Kernel version 4.10 commit 7b737965b33188bd3dbb44e938535c4006d97fbb
766 # libcfs: Convert to hotplug state machine
768 AC_DEFUN([LIBCFS_HOTPLUG_STATE_MACHINE], [
769 LB_CHECK_COMPILE([if libcfs supports CPU hotplug state machine],
770 cpu_hotplug_state_machine, [
771 #include <linux/cpuhotplug.h>
773 cpuhp_remove_state(CPUHP_LUSTRE_CFS_DEAD);
775 AC_DEFINE(HAVE_HOTPLUG_STATE_MACHINE, 1,
776 [hotplug state machine is supported])
778 ]) # LIBCFS_HOTPLUG_STATE_MACHINE
781 # LIBCFS_SCHED_HEADERS
783 # 4.11 has broken up sched.h into more headers.
785 AC_DEFUN([LIBCFS_SCHED_HEADERS], [
786 LB_CHECK_LINUX_HEADER([linux/sched/signal.h], [
787 AC_DEFINE(HAVE_SCHED_HEADERS, 1,
788 [linux/sched header directory exist])])
789 ]) # LIBCFS_SCHED_HEADERS
794 # LibCFS linux kernel checks
796 AC_DEFUN([LIBCFS_PROG_LINUX], [
797 AC_MSG_NOTICE([LibCFS kernel checks
798 ==============================================================================])
799 LIBCFS_CONFIG_PANIC_DUMPLOG
802 LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
803 LC_SHRINKER_WANT_SHRINK_PTR
805 LIBCFS_SYSCTL_CTLNAME
807 LIBCFS_MODULE_LOCKING
811 LIBCFS_DUMP_TRACE_ADDRESS
815 LIBCFS_STACKTRACE_WARNING
816 LIBCFS_REINIT_COMPLETION
818 LIBCFS_PROCESS_NAMESPACE
821 LIBCFS_SOCK_ALLOC_FILE
824 LIBCFS_ENABLE_CRC32_ACCEL
826 LIBCFS_ENABLE_CRC32C_ACCEL
828 LIBCFS_KTIME_GET_TS64
830 LIBCFS_KERNEL_PARAM_OPS
835 LIBCFS_SHRINKER_COUNT
837 LIBCFS_HLIST_ADD_AFTER
840 LIBCFS_KTIME_GET_REAL_TS64
841 LIBCFS_KTIME_GET_REAL_SECONDS
842 LIBCFS_KTIME_GET_REAL_NS
843 LIBCFS_KTIME_TO_TIMESPEC64
844 LIBCFS_TIMESPEC64_SUB
845 LIBCFS_TIMESPEC64_TO_KTIME
847 LIBCFS_KTIME_GET_SECONDS
848 LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF
850 LIBCFS_KERNEL_PARAM_LOCK
852 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
855 LIBCFS_CRYPTO_HASH_HELPERS
856 LIBCFS_EXPORT_KSET_FIND_OBJ
858 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
859 LIBCFS_GET_USER_PAGES_6ARG
861 LIBCFS_STACKTRACE_OPS
863 LIBCFS_GET_USER_PAGES_GUP_FLAGS
865 LIBCFS_HOTPLUG_STATE_MACHINE
868 ]) # LIBCFS_PROG_LINUX
871 # LIBCFS_PATH_DEFAULTS
873 # default paths for installed files
875 AC_DEFUN([LIBCFS_PATH_DEFAULTS], [
876 ]) # LIBCFS_PATH_DEFAULTS
881 # other configure checks
883 AC_DEFUN([LIBCFS_CONFIGURE], [
884 AC_MSG_NOTICE([LibCFS core checks
885 ==============================================================================])
887 # lnet/utils/portals.c
888 AC_CHECK_HEADERS([asm/types.h endian.h sys/ioctl.h])
891 AC_CHECK_HEADERS([linux/version.h])
893 AC_CHECK_TYPE([spinlock_t],
894 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
896 [#include <linux/spinlock.h>])
898 # lnet/utils/wirecheck.c
899 AC_CHECK_FUNCS([strnlen])
901 # lnet/libcfs/user-prim.c, missing for RHEL5 and earlier userspace
902 AC_CHECK_FUNCS([strlcpy])
904 # libcfs/libcfs/user-prim.c, missing for RHEL5 and earlier userspace
905 AC_CHECK_FUNCS([strlcat])
907 # libcfs/include/libcfs/linux/linux-prim.h, ...
908 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
910 # libcfs/include/libcfs/linux/linux-prim.h
911 AC_CHECK_HEADERS([linux/random.h], [], [],
912 [#ifdef HAVE_LINUX_TYPES_H
913 #include <linux/types.h>
917 # libcfs/include/libcfs/linux/libcfs.h
918 # libcfs/include/libcfs/byteorder.h
919 # libcfs/libcfs/util/nidstrings.c
920 AC_CHECK_HEADERS([netdb.h asm/types.h endian.h])
921 AC_CHECK_FUNCS([gethostbyname])
923 # -------- Check for required packages --------------
925 AC_MSG_NOTICE([LibCFS required packages checks
926 ==============================================================================])
928 AC_MSG_CHECKING([whether to enable readline support])
929 AC_ARG_ENABLE(readline,
930 AC_HELP_STRING([--disable-readline],
931 [disable readline support]),
932 [], [enable_readline="yes"])
933 AC_MSG_RESULT([$enable_readline])
936 AS_IF([test "x$enable_readline" = xyes], [
937 AC_CHECK_LIB([readline], [readline], [
938 LIBREADLINE="-lreadline"
939 AC_DEFINE(HAVE_LIBREADLINE, 1,
940 [readline library is available])
943 AC_SUBST(LIBREADLINE)
945 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
946 AC_ARG_ENABLE([libpthread],
947 AC_HELP_STRING([--disable-libpthread],
948 [disable libpthread]),
949 [], [enable_libpthread="yes"])
950 AC_MSG_RESULT([$enable_libpthread])
953 AS_IF([test "x$enable_libpthread" = xyes], [
954 AC_CHECK_LIB([pthread], [pthread_create], [
955 PTHREAD_LIBS="-lpthread"
956 AC_DEFINE([HAVE_LIBPTHREAD], 1,
957 [use libpthread for libcfs library])
960 AC_MSG_WARN([Using libpthread for libcfs library is disabled explicitly])
962 AC_SUBST(PTHREAD_LIBS)
963 ]) # LIBCFS_CONFIGURE
966 # LIBCFS_CONDITIONALS
968 AC_DEFUN([LIBCFS_CONDITIONALS], [
969 AM_CONDITIONAL(HAVE_CRC32, [test "x$have_crc32" = xyes])
970 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32, [test "x$have_crc32" = xyes -a "x$enable_crc32_crypto" = xyes])
971 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32C, [test "x$enable_crc32c_crypto" = xyes])
972 ]) # LIBCFS_CONDITIONALS
975 # LIBCFS_CONFIG_FILES
977 # files that should be generated with AC_OUTPUT
979 AC_DEFUN([LIBCFS_CONFIG_FILES], [
983 libcfs/autoconf/Makefile
984 libcfs/include/Makefile
985 libcfs/include/libcfs/Makefile
986 libcfs/include/libcfs/linux/Makefile
987 libcfs/include/libcfs/util/Makefile
988 libcfs/libcfs/Makefile
989 libcfs/libcfs/autoMakefile
990 libcfs/libcfs/linux/Makefile
991 libcfs/libcfs/util/Makefile
993 ]) # LIBCFS_CONFIG_FILES