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 # LC_SHRINKER_WANT_SHRINK_PTR
90 # RHEL6/2.6.32 want to have pointer to shrinker self pointer in handler function
92 AC_DEFUN([LC_SHRINKER_WANT_SHRINK_PTR], [
93 LB_CHECK_COMPILE([if 'shrinker' want self pointer in handler],
94 shrink_self_pointer, [
97 struct shrinker *tmp = NULL;
98 tmp->shrink(tmp, 0, 0);
100 AC_DEFINE(HAVE_SHRINKER_WANT_SHRINK_PTR, 1,
101 [shrinker want self pointer in handler])
103 ]) # LC_SHRINKER_WANT_SHRINK_PTR
106 # LIBCFS_SYSCTL_CTLNAME
108 # 2.6.33 no longer has ctl_name & strategy field in struct ctl_table.
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>
116 ct.ctl_name = sizeof(ct);
118 AC_DEFINE(HAVE_SYSCTL_CTLNAME, 1,
119 [ctl_table has ctl_name field])
121 ]) # LIBCFS_SYSCTL_CTLNAME
126 # 2.6.38 kstrtoul is added
128 AC_DEFUN([LIBCFS_KSTRTOUL], [
129 LB_CHECK_COMPILE([if Linux kernel has 'kstrtoul'],
131 #include <linux/kernel.h>
133 unsigned long result;
134 return kstrtoul("12345", 0, &result);
136 AC_DEFINE(HAVE_KSTRTOUL, 1,
137 [kernel has kstrtoul])
142 # LIBCFS_DUMP_TRACE_ADDRESS
144 # 2.6.39 adds a base pointer address argument to dump_trace
146 AC_DEFUN([LIBCFS_DUMP_TRACE_ADDRESS], [
147 LB_CHECK_COMPILE([if 'dump_trace' want address],
148 dump_trace_address, [
151 #include <asm/stacktrace.h>
153 dump_trace(NULL, NULL, NULL, 0, NULL, NULL);
155 AC_DEFINE(HAVE_DUMP_TRACE_ADDRESS, 1,
156 [dump_trace want address argument])
158 ]) # LIBCFS_DUMP_TRACE_ADDRESS
163 # FC15 2.6.40-5 backported the "shrink_control" parameter to the memory
164 # pressure shrinker from Linux 3.0
166 AC_DEFUN([LC_SHRINK_CONTROL], [
167 LB_CHECK_COMPILE([if 'shrink_control' is present],
169 #include <linux/atomic.h>
170 #include <linux/mm.h>
172 struct shrink_control tmp = {0};
173 tmp.nr_to_scan = sizeof(tmp);
175 AC_DEFINE(HAVE_SHRINK_CONTROL, 1,
176 [shrink_control is present])
178 ]) # LC_SHRINK_CONTROL
181 # LIBCFS_PROCESS_NAMESPACE
183 # 3.5 introduced process namespace
184 AC_DEFUN([LIBCFS_PROCESS_NAMESPACE], [
185 LB_CHECK_LINUX_HEADER([linux/uidgid.h], [
186 AC_DEFINE(HAVE_UIDGID_HEADER, 1,
187 [uidgid.h is present])])
188 ]) # LIBCFS_PROCESS_NAMESPACE
193 # 3.5 added helpers to read the new uid/gid types from VFS structures
194 # SLE11 SP3 has uidgid.h but not the helpers
196 AC_DEFUN([LIBCFS_I_UID_READ], [
197 LB_CHECK_COMPILE([if 'i_uid_read' is present],
199 #include <linux/fs.h>
203 AC_DEFINE(HAVE_I_UID_READ, 1, [i_uid_read is present])
205 ]) # LIBCFS_I_UID_READ
208 # LIBCFS_SOCK_ALLOC_FILE
210 # FC18 3.7.2-201 unexport sock_map_fd() change to
211 # use sock_alloc_file().
212 # upstream commit 56b31d1c9f1e6a3ad92e7bfe252721e05d92b285
214 AC_DEFUN([LIBCFS_SOCK_ALLOC_FILE], [
215 LB_CHECK_EXPORT([sock_alloc_file], [net/socket.c], [
216 LB_CHECK_COMPILE([if 'sock_alloc_file' takes 3 arguments],
217 sock_alloc_file_3args, [
218 #include <linux/net.h>
220 sock_alloc_file(NULL, 0, NULL);
222 AC_DEFINE(HAVE_SOCK_ALLOC_FILE_3ARGS, 1,
223 [sock_alloc_file takes 3 arguments])
225 AC_DEFINE(HAVE_SOCK_ALLOC_FILE, 1,
226 [sock_alloc_file is exported])
229 ]) # LIBCFS_SOCK_ALLOC_FILE
234 AC_DEFUN([LIBCFS_HAVE_CRC32], [
235 LB_CHECK_CONFIG_IM([CRC32],
236 [have_crc32="yes"], [have_crc32="no"])
237 AS_IF([test "x$have_crc32" = xyes],
238 [AC_DEFINE(HAVE_CRC32, 1,
239 [kernel compiled with CRC32 functions])])
240 ]) # LIBCFS_HAVE_CRC32
243 # LIBCFS_ENABLE_CRC32_ACCEL
245 AC_DEFUN([LIBCFS_ENABLE_CRC32_ACCEL], [
246 LB_CHECK_CONFIG_IM([CRYPTO_CRC32_PCLMUL],
247 [enable_crc32_crypto="no"], [enable_crc32_crypto="yes"])
248 AS_IF([test "x$have_crc32" = xyes -a "x$enable_crc32_crypto" = xyes], [
249 AC_DEFINE(NEED_CRC32_ACCEL, 1, [need pclmulqdq based crc32])
250 AC_MSG_WARN([No crc32 pclmulqdq crypto api found, enable internal pclmulqdq based crc32])])
251 ]) # LIBCFS_ENABLE_CRC32_ACCEL
254 # LIBCFS_ENABLE_CRC32C_ACCEL
256 AC_DEFUN([LIBCFS_ENABLE_CRC32C_ACCEL], [
257 LB_CHECK_CONFIG_IM([CRYPTO_CRC32C_INTEL],
258 [enable_crc32c_crypto="no"], [enable_crc32c_crypto="yes"])
259 AS_IF([test "x$enable_crc32c_crypto" = xyes], [
260 AC_DEFINE(NEED_CRC32C_ACCEL, 1, [need pclmulqdq based crc32c])
261 AC_MSG_WARN([No crc32c pclmulqdq crypto api found, enable internal pclmulqdq based crc32c])])
262 ]) # LIBCFS_ENABLE_CRC32C_ACCEL
265 # Kernel version 3.11 introduced ktime_get_ts64
267 AC_DEFUN([LIBCFS_KTIME_GET_TS64],[
268 LB_CHECK_COMPILE([does function 'ktime_get_ts64' exist],
270 #include <linux/ktime.h>
272 struct timespec64 *ts = NULL;
276 AC_DEFINE(HAVE_KTIME_GET_TS64, 1,
277 ['ktime_get_ts64' is available])
279 ]) # LIBCFS_KTIME_GET_TS64
282 # Kernel version 3.12 introduced ktime_add
284 AC_DEFUN([LIBCFS_KTIME_ADD],[
285 LB_CHECK_COMPILE([does function 'ktime_add' exist],
287 #include <linux/ktime.h>
289 ktime_t start = ktime_set(0, 0);
293 total = ktime_add(start, end);
295 AC_DEFINE(HAVE_KTIME_ADD, 1,
296 [ktime_add is available])
298 ]) # LIBCFS_KTIME_ADD
301 # Kernel version 3.12 introduced ktime_after
303 AC_DEFUN([LIBCFS_KTIME_AFTER],[
304 LB_CHECK_COMPILE([does function 'ktime_after' exist],
306 #include <linux/ktime.h>
308 ktime_t start = ktime_set(0, 0);
311 ktime_after(start, end);
313 AC_DEFINE(HAVE_KTIME_AFTER, 1,
314 [ktime_after is available])
316 ]) # LIBCFS_KTIME_AFTER
319 # FC19 3.12 kernel struct shrinker change
321 AC_DEFUN([LIBCFS_SHRINKER_COUNT],[
322 LB_CHECK_COMPILE([shrinker has 'count_objects'],
323 shrinker_count_objects, [
324 #include <linux/mmzone.h>
325 #include <linux/shrinker.h>
327 ((struct shrinker*)0)->count_objects(NULL, NULL);
329 AC_DEFINE(HAVE_SHRINKER_COUNT, 1,
330 [shrinker has count_objects member])
332 ]) # LIBCFS_SHRINKER_COUNT
335 # Kernel version 3.17 changed hlist_add_after to
338 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
339 LB_CHECK_COMPILE([does function 'hlist_add_after' exist],
341 #include <linux/list.h>
343 hlist_add_after(NULL, NULL);
345 AC_DEFINE(HAVE_HLIST_ADD_AFTER, 1,
346 [hlist_add_after is available])
348 ]) # LIBCFS_HLIST_ADD_AFTER
351 # Kernel version 3.17 introduced struct timespec64
353 AC_DEFUN([LIBCFS_TIMESPEC64],[
354 LB_CHECK_COMPILE([does 'struct timespec64' exist],
356 #include <linux/time.h>
358 struct timespec64 ts;
363 AC_DEFINE(HAVE_TIMESPEC64, 1,
364 ['struct timespec64' is available])
366 ]) # LIBCFS_TIMESPEC64
369 # Kernel version 3.17 introduced ktime_get_real_ts64
371 AC_DEFUN([LIBCFS_KTIME_GET_REAL_TS64],[
372 LB_CHECK_COMPILE([does function 'ktime_get_real_ts64' exist],
373 ktime_get_real_ts64, [
374 #include <linux/ktime.h>
376 struct timespec64 *ts = NULL;
378 ktime_get_real_ts64(ts);
380 AC_DEFINE(HAVE_KTIME_GET_REAL_TS64, 1,
381 ['ktime_get_real_ts64' is available])
383 ]) # LIBCFS_KTIME_GET_REAL_TS64
386 # Kernel version 3.17 introduced ktime_get_real_seconds
388 AC_DEFUN([LIBCFS_KTIME_GET_REAL_SECONDS],[
389 LB_CHECK_COMPILE([does function 'ktime_get_real_seconds' exist],
390 ktime_get_real_seconds, [
391 #include <linux/ktime.h>
395 now = ktime_get_real_seconds();
397 AC_DEFINE(HAVE_KTIME_GET_REAL_SECONDS, 1,
398 ['ktime_get_real_seconds' is available])
400 ]) # LIBCFS_KTIME_GET_REAL_SECONDS
403 # Kernel version 3.17 created ktime_get_real_ns wrapper
405 AC_DEFUN([LIBCFS_KTIME_GET_REAL_NS],[
406 LB_CHECK_COMPILE([does function 'ktime_get_real_ns' exist],
408 #include <linux/ktime.h>
412 nanoseconds = ktime_get_real_ns();
414 AC_DEFINE(NEED_KTIME_GET_REAL_NS, 1,
415 ['ktime_get_real_ns' is not available])
417 ]) # LIBCFS_KTIME_GET_REAL_NS
420 # Kernel version 3.17 introduced ktime_to_timespec64
422 AC_DEFUN([LIBCFS_KTIME_TO_TIMESPEC64],[
423 LB_CHECK_COMPILE([does function 'ktime_to_timespec64' exist],
424 ktime_to_timespec64, [
425 #include <linux/ktime.h>
427 struct timespec64 ts;
430 ts = ktime_to_timespec64(now);
432 AC_DEFINE(HAVE_KTIME_TO_TIMESPEC64, 1,
433 ['ktime_to_timespec64' is available])
435 ]) # LIBCFS_KTIME_TO_TIMESPEC64
438 # Kernel version 3.17 introduced timespec64_sub
440 AC_DEFUN([LIBCFS_TIMESPEC64_SUB],[
441 LB_CHECK_COMPILE([does function 'timespec64_sub' exist],
443 #include <linux/time.h>
445 struct timespec64 later,earlier,diff;
447 diff = timespec64_sub(later, earlier);
449 AC_DEFINE(HAVE_TIMESPEC64_SUB, 1,
450 ['timespec64_sub' is available])
452 ]) # LIBCFS_TIMESPEC64_SUB
455 # Kernel version 3.17 introduced timespec64_to_ktime
457 AC_DEFUN([LIBCFS_TIMESPEC64_TO_KTIME],[
458 LB_CHECK_COMPILE([does function 'timespec64_to_ktime' exist],
459 timespec64_to_ktime, [
460 #include <linux/ktime.h>
462 struct timespec64 ts;
465 now = timespec64_to_ktime(ts);
467 AC_DEFINE(HAVE_TIMESPEC64_TO_KTIME, 1,
468 ['timespec64_to_ktime' is available])
470 ]) # LIBCFS_TIMESPEC64_TO_KTIME
473 # Kernel version 3.19 introduced ktime_get_seconds
475 AC_DEFUN([LIBCFS_KTIME_GET_SECONDS],[
476 LB_CHECK_COMPILE([does function 'ktime_get_seconds' exist],
478 #include <linux/ktime.h>
482 now = ktime_get_seconds();
484 AC_DEFINE(HAVE_KTIME_GET_SECONDS, 1,
485 ['ktime_get_seconds' is available])
487 ]) # LIBCFS_KTIME_GET_SECONDS
490 # Kernel version 4.2 changed topology_thread_cpumask
491 # to topology_sibling_cpumask
493 AC_DEFUN([LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK],[
494 LB_CHECK_COMPILE([does function 'topology_sibling_cpumask' exist],
495 topology_sibling_cpumask, [
496 #include <linux/topology.h>
498 const struct cpumask *mask;
500 mask = topology_sibling_cpumask(0);
502 AC_DEFINE(HAVE_TOPOLOGY_SIBLING_CPUMASK, 1,
503 [topology_sibling_cpumask is available])
505 ]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
508 # Kernel version 4.2 commit df6b35f409af0a8ff1ef62f552b8402f3fef8665
509 # header file i387.h was renamed to fpu/api.h
511 AC_DEFUN([LIBCFS_FPU_API], [
512 LB_CHECK_LINUX_HEADER([asm/fpu/api.h], [
513 AC_DEFINE(HAVE_FPU_API_HEADER, 1,
514 [fpu/api.h is present])])
518 # Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24
519 # added crypto hash helpers
521 AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [
522 LB_CHECK_COMPILE([does crypto hash helper functions exist],
523 crypto_hash_helpers, [
524 #include <crypto/hash.h>
526 crypto_ahash_alg_name(NULL);
527 crypto_ahash_driver_name(NULL);
529 AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1,
530 [crypto hash helper functions are available])
532 ]) # LIBCFS_CRYPTO_HASH_HELPERS
535 # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
537 # linux 4.6 kernel changed stacktrace_ops address to return an int
539 AC_DEFUN([LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT], [
540 LB_CHECK_COMPILE([if 'struct stacktrace_ops' address function returns an int],
541 stacktrace_ops_address_return_int, [
542 #include <asm/stacktrace.h>
546 rc = ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
548 AC_DEFINE(STACKTRACE_OPS_ADDRESS_RETURN_INT, 1,
549 ['struct stacktrace_ops' address function returns an int])
551 ]) # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
554 # Kernel version 4.6 removed both struct task_struct and struct mm_struct
555 # arguments to get_user_pages
557 AC_DEFUN([LIBCFS_GET_USER_PAGES_6ARG], [
558 LB_CHECK_COMPILE([if 'get_user_pages()' takes 6 arguments],
559 get_user_pages_6arg, [
560 #include <linux/mm.h>
564 rc = get_user_pages(0, 0, 0, 0, NULL, NULL);
566 AC_DEFINE(HAVE_GET_USER_PAGES_6ARG, 1,
567 [get_user_pages takes 6 arguments])
569 ]) # LIBCFS_GET_USER_PAGES_6ARG
572 # LIBCFS_STACKTRACE_OPS
574 # Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
575 # removed both struct stacktrace_ops and dump_trace() function
577 AC_DEFUN([LIBCFS_STACKTRACE_OPS], [
578 LB_CHECK_COMPILE([if 'struct stacktrace_ops' exists],
582 #include <asm/stacktrace.h>
584 struct stacktrace_ops ops;
587 AC_DEFINE(HAVE_STACKTRACE_OPS, 1,
588 [struct stacktrace_ops exists])
590 ]) # LIBCFS_STACKTRACE_OPS
593 # Kernel version 4.9 commit 768ae309a96103ed02eb1e111e838c87854d8b51
594 # mm: replace get_user_pages() write/force parameters with gup_flags
596 AC_DEFUN([LIBCFS_GET_USER_PAGES_GUP_FLAGS], [
597 LB_CHECK_COMPILE([if 'get_user_pages()' takes gup_flags in arguments],
598 get_user_pages_gup_flags, [
599 #include <linux/mm.h>
602 rc = get_user_pages(0, 0, FOLL_WRITE, NULL, NULL);
604 AC_DEFINE(HAVE_GET_USER_PAGES_GUP_FLAGS, 1,
605 [get_user_pages takes gup_flags in arguments])
607 ]) # LIBCFS_GET_USER_PAGES_GUP_FLAGS
612 # LibCFS linux kernel checks
614 AC_DEFUN([LIBCFS_PROG_LINUX], [
615 AC_MSG_NOTICE([LibCFS kernel checks
616 ==============================================================================])
617 LIBCFS_CONFIG_PANIC_DUMPLOG
620 LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
621 LC_SHRINKER_WANT_SHRINK_PTR
623 LIBCFS_SYSCTL_CTLNAME
627 LIBCFS_DUMP_TRACE_ADDRESS
631 LIBCFS_STACKTRACE_WARNING
633 LIBCFS_PROCESS_NAMESPACE
636 LIBCFS_SOCK_ALLOC_FILE
639 LIBCFS_ENABLE_CRC32_ACCEL
641 LIBCFS_ENABLE_CRC32C_ACCEL
643 LIBCFS_KTIME_GET_TS64
647 LIBCFS_SHRINKER_COUNT
649 LIBCFS_HLIST_ADD_AFTER
651 LIBCFS_KTIME_GET_REAL_TS64
652 LIBCFS_KTIME_GET_REAL_SECONDS
653 LIBCFS_KTIME_GET_REAL_NS
654 LIBCFS_KTIME_TO_TIMESPEC64
655 LIBCFS_TIMESPEC64_SUB
656 LIBCFS_TIMESPEC64_TO_KTIME
658 LIBCFS_KTIME_GET_SECONDS
660 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
663 LIBCFS_CRYPTO_HASH_HELPERS
665 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
666 LIBCFS_GET_USER_PAGES_6ARG
668 LIBCFS_STACKTRACE_OPS
670 LIBCFS_GET_USER_PAGES_GUP_FLAGS
671 ]) # LIBCFS_PROG_LINUX
674 # LIBCFS_PATH_DEFAULTS
676 # default paths for installed files
678 AC_DEFUN([LIBCFS_PATH_DEFAULTS], [
679 ]) # LIBCFS_PATH_DEFAULTS
684 # other configure checks
686 AC_DEFUN([LIBCFS_CONFIGURE], [
687 AC_MSG_NOTICE([LibCFS core checks
688 ==============================================================================])
690 # lnet/utils/portals.c
691 AC_CHECK_HEADERS([asm/types.h endian.h sys/ioctl.h])
694 AC_CHECK_HEADERS([linux/version.h])
696 AC_CHECK_TYPE([spinlock_t],
697 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
699 [#include <linux/spinlock.h>])
701 # lnet/utils/wirecheck.c
702 AC_CHECK_FUNCS([strnlen])
704 # lnet/libcfs/user-prim.c, missing for RHEL5 and earlier userspace
705 AC_CHECK_FUNCS([strlcpy])
707 # libcfs/libcfs/user-prim.c, missing for RHEL5 and earlier userspace
708 AC_CHECK_FUNCS([strlcat])
710 # libcfs/include/libcfs/linux/linux-prim.h, ...
711 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
713 # libcfs/include/libcfs/linux/linux-prim.h
714 AC_CHECK_HEADERS([linux/random.h], [], [],
715 [#ifdef HAVE_LINUX_TYPES_H
716 #include <linux/types.h>
720 # libcfs/include/libcfs/linux/libcfs.h
721 # libcfs/include/libcfs/byteorder.h
722 # libcfs/libcfs/util/nidstrings.c
723 AC_CHECK_HEADERS([netdb.h asm/types.h endian.h])
724 AC_CHECK_FUNCS([gethostbyname])
726 # -------- Check for required packages --------------
728 AC_MSG_NOTICE([LibCFS required packages checks
729 ==============================================================================])
731 AC_MSG_CHECKING([whether to enable readline support])
732 AC_ARG_ENABLE(readline,
733 AC_HELP_STRING([--disable-readline],
734 [disable readline support]),
735 [], [enable_readline="yes"])
736 AC_MSG_RESULT([$enable_readline])
739 AS_IF([test "x$enable_readline" = xyes], [
740 AC_CHECK_LIB([readline], [readline], [
741 LIBREADLINE="-lreadline"
742 AC_DEFINE(HAVE_LIBREADLINE, 1,
743 [readline library is available])
746 AC_SUBST(LIBREADLINE)
748 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
749 AC_ARG_ENABLE([libpthread],
750 AC_HELP_STRING([--disable-libpthread],
751 [disable libpthread]),
752 [], [enable_libpthread="yes"])
753 AC_MSG_RESULT([$enable_libpthread])
756 AS_IF([test "x$enable_libpthread" = xyes], [
757 AC_CHECK_LIB([pthread], [pthread_create], [
758 PTHREAD_LIBS="-lpthread"
759 AC_DEFINE([HAVE_LIBPTHREAD], 1,
760 [use libpthread for libcfs library])
763 AC_MSG_WARN([Using libpthread for libcfs library is disabled explicitly])
765 AC_SUBST(PTHREAD_LIBS)
766 ]) # LIBCFS_CONFIGURE
769 # LIBCFS_CONDITIONALS
771 AC_DEFUN([LIBCFS_CONDITIONALS], [
772 AM_CONDITIONAL(HAVE_CRC32, [test "x$have_crc32" = xyes])
773 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32, [test "x$have_crc32" = xyes -a "x$enable_crc32_crypto" = xyes])
774 AM_CONDITIONAL(NEED_PCLMULQDQ_CRC32C, [test "x$enable_crc32c_crypto" = xyes])
775 ]) # LIBCFS_CONDITIONALS
778 # LIBCFS_CONFIG_FILES
780 # files that should be generated with AC_OUTPUT
782 AC_DEFUN([LIBCFS_CONFIG_FILES], [
786 libcfs/autoconf/Makefile
787 libcfs/include/Makefile
788 libcfs/include/libcfs/Makefile
789 libcfs/include/libcfs/linux/Makefile
790 libcfs/include/libcfs/util/Makefile
791 libcfs/libcfs/Makefile
792 libcfs/libcfs/autoMakefile
793 libcfs/libcfs/linux/Makefile
794 libcfs/libcfs/util/Makefile
796 ]) # LIBCFS_CONFIG_FILES