4 # whether to enable various libcfs debugs (CDEBUG, ENTRY/EXIT, LASSERT, etc.)
6 AC_DEFUN([LN_CONFIG_CDEBUG],
8 AC_MSG_CHECKING([whether to enable CDEBUG, CWARN])
9 AC_ARG_ENABLE([libcfs_cdebug],
10 AC_HELP_STRING([--disable-libcfs-cdebug],
11 [disable libcfs CDEBUG, CWARN]),
12 [],[enable_libcfs_cdebug='yes'])
13 AC_MSG_RESULT([$enable_libcfs_cdebug])
14 if test x$enable_libcfs_cdebug = xyes; then
15 AC_DEFINE(CDEBUG_ENABLED, 1, [enable libcfs CDEBUG, CWARN])
17 AC_DEFINE(CDEBUG_ENABLED, 0, [disable libcfs CDEBUG, CWARN])
20 AC_MSG_CHECKING([whether to enable ENTRY/EXIT])
21 AC_ARG_ENABLE([libcfs_trace],
22 AC_HELP_STRING([--disable-libcfs-trace],
23 [disable libcfs ENTRY/EXIT]),
24 [],[enable_libcfs_trace='yes'])
25 AC_MSG_RESULT([$enable_libcfs_trace])
26 if test x$enable_libcfs_trace = xyes; then
27 AC_DEFINE(CDEBUG_ENTRY_EXIT, 1, [enable libcfs ENTRY/EXIT])
29 AC_DEFINE(CDEBUG_ENTRY_EXIT, 0, [disable libcfs ENTRY/EXIT])
32 AC_MSG_CHECKING([whether to enable LASSERT, LASSERTF])
33 AC_ARG_ENABLE([libcfs_assert],
34 AC_HELP_STRING([--disable-libcfs-assert],
35 [disable libcfs LASSERT, LASSERTF]),
36 [],[enable_libcfs_assert='yes'])
37 AC_MSG_RESULT([$enable_libcfs_assert])
38 if test x$enable_libcfs_assert = xyes; then
39 AC_DEFINE(LIBCFS_DEBUG, 1, [enable libcfs LASSERT, LASSERTF])
44 # LIBCFS_CONFIG_PANIC_DUMPLOG
46 # check if tunable panic_dumplog is wanted
48 AC_DEFUN([LIBCFS_CONFIG_PANIC_DUMPLOG],
49 [AC_MSG_CHECKING([for tunable panic_dumplog support])
50 AC_ARG_ENABLE([panic_dumplog],
51 AC_HELP_STRING([--enable-panic_dumplog],
52 [enable panic_dumplog]),
53 [],[enable_panic_dumplog='no'])
54 if test x$enable_panic_dumplog = xyes ; then
55 AC_DEFINE(LNET_DUMP_ON_PANIC, 1, [use dumplog on panic])
56 AC_MSG_RESULT([yes (by request)])
63 # LIBCFS_FUNC_CPU_ONLINE
65 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
67 AC_DEFUN([LIBCFS_FUNC_CPU_ONLINE],
68 [AC_MSG_CHECKING([if kernel defines cpu_online()])
69 LB_LINUX_TRY_COMPILE([
70 #include <linux/sched.h>
75 AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
84 # check if gfp_t is typedef-ed
86 AC_DEFUN([LIBCFS_TYPE_GFP_T],
87 [AC_MSG_CHECKING([if kernel defines gfp_t])
88 LB_LINUX_TRY_COMPILE([
89 #include <linux/gfp.h>
94 AC_DEFINE(HAVE_GFP_T, 1, [gfp_t found])
101 # LIBCFS_FUNC_SHOW_TASK
103 # we export show_task(), but not all kernels have it (yet)
105 AC_DEFUN([LIBCFS_FUNC_SHOW_TASK],
106 [LB_CHECK_SYMBOL_EXPORT([show_task],
107 [kernel/ksyms.c kernel/sched.c],[
108 AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
110 LB_CHECK_SYMBOL_EXPORT([sched_show_task],
111 [kernel/ksyms.c kernel/sched.c],[
112 AC_DEFINE(HAVE_SCHED_SHOW_TASK, 1, [sched_show_task is exported])
117 # check kernel __u64 type
118 AC_DEFUN([LIBCFS_U64_LONG_LONG_LINUX],
120 AC_MSG_CHECKING([kernel __u64 is long long type])
121 tmp_flags="$EXTRA_KCFLAGS"
122 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Werror"
123 LB_LINUX_TRY_COMPILE([
124 #include <linux/types.h>
125 #include <linux/stddef.h>
127 unsigned long long *data;
129 data = (__u64*)sizeof(data);
132 AC_DEFINE(HAVE_KERN__U64_LONG_LONG, 1,
133 [kernel __u64 is long long type])
137 EXTRA_KCFLAGS="$tmp_flags"
140 # check if task_struct with rcu memeber
141 AC_DEFUN([LIBCFS_TASK_RCU],
142 [AC_MSG_CHECKING([if task_struct has a rcu field])
143 LB_LINUX_TRY_COMPILE([
144 #include <linux/sched.h>
146 memset(((struct task_struct *)0)->rcu.next, 0, 0);
149 AC_DEFINE(HAVE_TASK_RCU, 1, [task_struct has rcu field])
155 # LIBCFS_TASKLIST_LOCK
156 # 2.6.18 remove tasklist_lock export
157 AC_DEFUN([LIBCFS_TASKLIST_LOCK],
158 [LB_CHECK_SYMBOL_EXPORT([tasklist_lock],
160 AC_DEFINE(HAVE_TASKLIST_LOCK, 1,
161 [tasklist_lock exported])
167 # kmem_cache_destroy(cachep) return void instead of
169 AC_DEFUN([LIBCFS_KMEM_CACHE_DESTROY_INT],
170 [AC_MSG_CHECKING([kmem_cache_destroy(cachep) return int])
171 LB_LINUX_TRY_COMPILE([
172 #include <linux/slab.h>
174 int i = kmem_cache_destroy(NULL);
177 AC_DEFINE(HAVE_KMEM_CACHE_DESTROY_INT, 1,
178 [kmem_cache_destroy(cachep) return int])
185 #panic_notifier_list use atomic_notifier operations
187 AC_DEFUN([LIBCFS_ATOMIC_PANIC_NOTIFIER],
188 [AC_MSG_CHECKING([panic_notifier_list is atomic])
189 LB_LINUX_TRY_COMPILE([
190 #include <linux/notifier.h>
191 #include <linux/kernel.h>
193 struct atomic_notifier_head panic_notifier_list;
196 AC_DEFINE(HAVE_ATOMIC_PANIC_NOTIFIER, 1,
197 [panic_notifier_list is atomic_notifier_head])
203 # since 2.6.19 nlmsg_multicast() needs 5 argument.
204 AC_DEFUN([LIBCFS_NLMSG_MULTICAST],
205 [AC_MSG_CHECKING([nlmsg_multicast needs 5 argument])
206 LB_LINUX_TRY_COMPILE([
207 #include <net/netlink.h>
209 nlmsg_multicast(NULL, NULL, 0, 0, 0);
212 AC_DEFINE(HAVE_NLMSG_MULTICAST_5ARGS, 1,
213 [nlmsg_multicast needs 5 argument])
222 # If we have netlink.h, and nlmsg_new takes 2 args (2.6.19)
224 AC_DEFUN([LIBCFS_NETLINK],
225 [AC_MSG_CHECKING([if netlink.h can be compiled])
226 LB_LINUX_TRY_COMPILE([
227 #include <net/netlink.h>
230 AC_DEFINE(HAVE_NETLINK, 1, [net/netlink.h found])
232 AC_MSG_CHECKING([if nlmsg_new takes a 2nd argument])
233 LB_LINUX_TRY_COMPILE([
234 #include <net/netlink.h>
236 nlmsg_new(100, GFP_KERNEL);
239 AC_DEFINE(HAVE_NETLINK_NL2, 1, [nlmsg_new takes 2 args])
248 # 2.6.20 API change INIT_WORK use 2 args and not
250 AC_DEFUN([LIBCFS_3ARGS_INIT_WORK],
251 [AC_MSG_CHECKING([check INIT_WORK want 3 args])
252 LB_LINUX_TRY_COMPILE([
253 #include <linux/workqueue.h>
255 struct work_struct work;
257 INIT_WORK(&work, NULL, NULL);
260 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
261 [INIT_WORK use 3 args and store data inside])
267 # 2.6.21 api change. 'register_sysctl_table' use only one argument,
268 # instead of more old which need two.
269 AC_DEFUN([LIBCFS_2ARGS_REGISTER_SYSCTL],
270 [AC_MSG_CHECKING([check register_sysctl_table want 2 args])
271 LB_LINUX_TRY_COMPILE([
272 #include <linux/sysctl.h>
274 return register_sysctl_table(NULL,0);
277 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
278 [register_sysctl_table want 2 args])
284 # 2.6.21 marks kmem_cache_t deprecated and uses struct kmem_cache
286 AC_DEFUN([LIBCFS_KMEM_CACHE],
287 [AC_MSG_CHECKING([check kernel has struct kmem_cache])
288 tmp_flags="$EXTRA_KCFLAGS"
289 EXTRA_KCFLAGS="-Werror"
290 LB_LINUX_TRY_COMPILE([
291 #include <linux/slab.h>
292 typedef struct kmem_cache cache_t;
294 cache_t *cachep = NULL;
296 kmem_cache_alloc(cachep, 0);
299 AC_DEFINE(HAVE_KMEM_CACHE, 1,
300 [kernel has struct kmem_cache])
304 EXTRA_KCFLAGS="$tmp_flags"
307 # 2.6.23 lost dtor argument
308 AC_DEFUN([LIBCFS_KMEM_CACHE_CREATE_DTOR],
309 [AC_MSG_CHECKING([check kmem_cache_create has dtor argument])
310 LB_LINUX_TRY_COMPILE([
311 #include <linux/slab.h>
313 kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);
316 AC_DEFINE(HAVE_KMEM_CACHE_CREATE_DTOR, 1,
317 [kmem_cache_create has dtor argument])
323 #2.6.23 has new shrinker API
324 AC_DEFUN([LC_REGISTER_SHRINKER],
325 [AC_MSG_CHECKING([if kernel has register_shrinker])
326 LB_LINUX_TRY_COMPILE([
327 #include <linux/mm.h>
329 register_shrinker(NULL);
332 AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
333 [kernel has register_shrinker])
340 AC_DEFUN([LIBCFS_NETLINK_CBMUTEX],
341 [AC_MSG_CHECKING([for mutex in netlink_kernel_create])
342 LB_LINUX_TRY_COMPILE([
343 #include <linux/netlink.h>
345 struct mutex *lock = NULL;
347 netlink_kernel_create(0, 0, NULL, lock, NULL);
350 AC_DEFINE(HAVE_NETLINK_CBMUTEX, 1,
351 [netlink_kernel_create want mutex for callback])
357 # 2.6.24 request not use real numbers for ctl_name
358 AC_DEFUN([LIBCFS_SYSCTL_UNNUMBERED],
359 [AC_MSG_CHECKING([for CTL_UNNUMBERED])
360 LB_LINUX_TRY_COMPILE([
361 #include <linux/sysctl.h>
363 #ifndef CTL_UNNUMBERED
364 #error CTL_UNNUMBERED not exist in kernel
368 AC_DEFINE(HAVE_SYSCTL_UNNUMBERED, 1,
369 [sysctl has CTL_UNNUMBERED])
375 # 2.6.24 lost scatterlist->page
376 AC_DEFUN([LIBCFS_SCATTERLIST_SETPAGE],
377 [AC_MSG_CHECKING([for exist sg_set_page])
378 LB_LINUX_TRY_COMPILE([
379 #include <asm/types.h>
380 #include <linux/scatterlist.h>
382 sg_set_page(NULL,NULL,0,0);
385 AC_DEFINE(HAVE_SCATTERLIST_SETPAGE, 1,
386 [struct scatterlist has page member])
393 AC_DEFUN([LIBCFS_NETWORK_NAMESPACE],
394 [AC_MSG_CHECKING([for network stack has namespaces])
395 LB_LINUX_TRY_COMPILE([
396 #include <net/net_namespace.h>
398 struct net *net = &init_net;
401 AC_DEFINE(HAVE_INIT_NET, 1,
402 [kernel is support network namespaces ])
410 AC_DEFUN([LIBCFS_NETLINK_NETNS],
411 [AC_MSG_CHECKING([for netlink support net ns])
412 LB_LINUX_TRY_COMPILE([
413 #include <linux/netlink.h>
415 struct net *net = NULL;
416 struct mutex *lock = NULL;
418 netlink_kernel_create(net, 0, 0, NULL,
423 AC_DEFINE(HAVE_NETLINK_NS, 1,
424 [netlink is support network namespace])
426 # for now - if kernel have netlink ns - he uses cbmutex
427 AC_DEFINE(HAVE_NETLINK_CBMUTEX, 1,
428 [netlink_kernel_create want mutex for callback])
436 AC_DEFUN([LIBCFS_NL_BROADCAST_GFP],
437 [AC_MSG_CHECKING([for netlink_broadcast is want to have gfp parameter])
438 LB_LINUX_TRY_COMPILE([
439 #include <linux/netlink.h>
441 gfp_t gfp = GFP_KERNEL;
443 netlink_broadcast(NULL, NULL, 0, 0, gfp);
446 AC_DEFINE(HAVE_NL_BROADCAST_GFP, 1,
447 [netlink brouacast is want to have gfp paramter])
454 # LIBCFS_FUNC_DUMP_TRACE
456 # 2.6.23 exports dump_trace() so we can dump_stack() on any task
457 # 2.6.24 has stacktrace_ops.address with "reliable" parameter
459 AC_DEFUN([LIBCFS_FUNC_DUMP_TRACE],
460 [LB_CHECK_SYMBOL_EXPORT([dump_trace],
461 [kernel/ksyms.c arch/${LINUX_ARCH%_64}/kernel/traps_64.c arch/x86/kernel/dumpstack_32.c arch/x86/kernel/dumpstack_64.c],[
462 tmp_flags="$EXTRA_KCFLAGS"
463 EXTRA_KCFLAGS="-Werror"
464 AC_MSG_CHECKING([whether we can really use dump_trace])
465 LB_LINUX_TRY_COMPILE([
468 #include <asm/stacktrace.h>
472 AC_DEFINE(HAVE_DUMP_TRACE, 1, [dump_trace is exported])
477 AC_MSG_CHECKING([whether print_trace_address has reliable argument])
478 LB_LINUX_TRY_COMPILE([
481 #include <asm/stacktrace.h>
483 ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
486 AC_DEFINE(HAVE_TRACE_ADDRESS_RELIABLE, 1,
487 [print_trace_address has reliable argument])
492 AC_MSG_CHECKING([dump_trace want address])
493 LB_LINUX_TRY_COMPILE([
496 #include <asm/stacktrace.h>
498 dump_trace(NULL, NULL, NULL, 0, NULL, NULL);
501 AC_DEFINE(HAVE_DUMP_TRACE_ADDRESS, 1,
502 [dump_trace want address argument])
508 EXTRA_KCFLAGS="$tmp_flags"
513 # 2.6.26 use int instead of atomic for sem.count
514 AC_DEFUN([LIBCFS_SEM_COUNT],
515 [AC_MSG_CHECKING([atomic sem.count])
516 LB_LINUX_TRY_COMPILE([
517 #include <asm/semaphore.h>
521 atomic_read(&s.count);
524 AC_DEFINE(HAVE_SEM_COUNT_ATOMIC, 1,
525 [semaphore counter is atomic])
531 # 2.6.27 have second argument to sock_map_fd
532 AC_DEFUN([LIBCFS_SOCK_MAP_FD_2ARG],
533 [AC_MSG_CHECKING([sock_map_fd have second argument])
534 LB_LINUX_TRY_COMPILE([
535 #include <linux/net.h>
537 sock_map_fd(NULL, 0);
540 AC_DEFINE(HAVE_SOCK_MAP_FD_2ARG, 1,
541 [sock_map_fd have second argument])
547 # LIBCFS_CRED_WRAPPERS
549 # wrappers for task's credentials are in sles11
551 AC_DEFUN([LIBCFS_CRED_WRAPPERS],
552 [AC_MSG_CHECKING([if kernel has wrappers for task's credentials])
553 LB_LINUX_TRY_COMPILE([
554 #include <linux/sched.h>
558 uid = current_uid() + sizeof(uid);
561 AC_DEFINE(HAVE_CRED_WRAPPERS, 1, [task's cred wrappers found])
568 # LN_STRUCT_CRED_IN_TASK
570 # struct cred was introduced in 2.6.29 to streamline credentials in task struct
572 AC_DEFUN([LIBCFS_STRUCT_CRED_IN_TASK],
573 [AC_MSG_CHECKING([if kernel has struct cred])
574 LB_LINUX_TRY_COMPILE([
575 #include <linux/sched.h>
577 struct task_struct *tsk = NULL;
578 tsk->real_cred = NULL;
581 AC_DEFINE(HAVE_STRUCT_CRED, 1, [struct cred found])
588 # LIBCFS_FUNC_UNSHARE_FS_STRUCT
590 # unshare_fs_struct was introduced in 2.6.30 to prevent others to directly
591 # mess with copy_fs_struct
593 AC_DEFUN([LIBCFS_FUNC_UNSHARE_FS_STRUCT],
594 [AC_MSG_CHECKING([if kernel defines unshare_fs_struct()])
595 tmp_flags="$EXTRA_KCFLAGS"
596 EXTRA_KCFLAGS="-Werror"
597 LB_LINUX_TRY_COMPILE([
598 #include <linux/sched.h>
599 #include <linux/fs_struct.h>
604 AC_DEFINE(HAVE_UNSHARE_FS_STRUCT, 1, [unshare_fs_struct found])
608 EXTRA_KCFLAGS="$tmp_flags"
612 # LIBCFS_HAVE_IS_COMPAT_TASK
614 # Added in 2.6.17, it wasn't until 2.6.29 that all
615 # Linux architectures have is_compat_task()
617 AC_DEFUN([LIBCFS_HAVE_IS_COMPAT_TASK],
618 [AC_MSG_CHECKING([if is_compat_task() is declared])
619 LB_LINUX_TRY_COMPILE([
620 #include <linux/compat.h>
622 int i = is_compat_task();
625 AC_DEFINE(HAVE_IS_COMPAT_TASK, 1, [is_compat_task() is available])
632 # LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
634 # 2.6.32-30.el6 adds a new 'walk_stack' field in 'struct stacktrace_ops'
636 AC_DEFUN([LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK],
637 [AC_MSG_CHECKING([if 'struct stacktrace_ops' has 'walk_stack' field])
638 LB_LINUX_TRY_COMPILE([
639 #include <asm/stacktrace.h>
641 ((struct stacktrace_ops *)0)->walk_stack(NULL, NULL, 0, NULL, NULL, NULL, NULL);
644 AC_DEFINE(STACKTRACE_OPS_HAVE_WALK_STACK, 1, ['struct stacktrace_ops' has 'walk_stack' field])
650 AC_DEFUN([LIBCFS_HAVE_OOM_H],
651 [LB_CHECK_FILE([$LINUX/include/linux/oom.h], [
652 AC_DEFINE(HAVE_LINUX_OOM_H, 1,
653 [kernel has include/oom.h])
660 # RHEL6/2.6.32 want to have pointer to shrinker self pointer in handler function
662 AC_DEFUN([LC_SHRINKER_WANT_SHRINK_PTR],
663 [AC_MSG_CHECKING([shrinker want self pointer in handler])
664 LB_LINUX_TRY_COMPILE([
665 #include <linux/mm.h>
667 struct shrinker *tmp = NULL;
668 tmp->shrink(tmp, 0, 0);
671 AC_DEFINE(HAVE_SHRINKER_WANT_SHRINK_PTR, 1,
672 [shrinker want self pointer in handler])
678 # 2.6.18 store oom parameters in task struct.
679 # 2.6.32 store oom parameters in signal struct
680 AC_DEFUN([LIBCFS_OOMADJ_IN_SIG],
681 [AC_MSG_CHECKING([kernel store oom parameters in task])
682 LB_LINUX_TRY_COMPILE([
683 #include <linux/sched.h>
685 ((struct signal_struct *)0)->oom_adj = 0;
688 AC_DEFINE(HAVE_OOMADJ_IN_SIG, 1,
689 [kernel store a oom parameters in signal struct])
696 # 2.6.33 no longer has ctl_name & strategy field in struct ctl_table.
698 AC_DEFUN([LIBCFS_SYSCTL_CTLNAME],
699 [AC_MSG_CHECKING([if ctl_table has a ctl_name field])
700 LB_LINUX_TRY_COMPILE([
701 #include <linux/sysctl.h>
704 ct.ctl_name = sizeof(ct);
707 AC_DEFINE(HAVE_SYSCTL_CTLNAME, 1,
708 [ctl_table has ctl_name field])
715 # LIBCFS_ADD_WAIT_QUEUE_EXCLUSIVE
717 # 2.6.34 adds __add_wait_queue_exclusive
719 AC_DEFUN([LIBCFS_ADD_WAIT_QUEUE_EXCLUSIVE],
720 [AC_MSG_CHECKING([if __add_wait_queue_exclusive exists])
721 LB_LINUX_TRY_COMPILE([
722 #include <linux/wait.h>
724 wait_queue_head_t queue;
727 __add_wait_queue_exclusive(&queue, &wait);
730 AC_DEFINE(HAVE___ADD_WAIT_QUEUE_EXCLUSIVE, 1,
731 [__add_wait_queue_exclusive exists])
739 # FC15 2.6.40-5 backported the "shrink_control" parameter to the memory
740 # pressure shrinker from Linux 3.0
742 AC_DEFUN([LC_SHRINK_CONTROL],
743 [AC_MSG_CHECKING([shrink_control is present])
744 LB_LINUX_TRY_COMPILE([
745 #include <linux/mm.h>
747 struct shrink_control tmp = {0};
748 tmp.nr_to_scan = sizeof(tmp);
751 AC_DEFINE(HAVE_SHRINK_CONTROL, 1,
752 [shrink_control is present])
761 # LNet linux kernel checks
763 AC_DEFUN([LIBCFS_PROG_LINUX],
765 LIBCFS_FUNC_CPU_ONLINE
767 LIBCFS_CONFIG_PANIC_DUMPLOG
769 LIBCFS_FUNC_SHOW_TASK
770 LIBCFS_U64_LONG_LONG_LINUX
774 LIBCFS_HAVE_IS_COMPAT_TASK
777 LIBCFS_NLMSG_MULTICAST
778 LIBCFS_KMEM_CACHE_DESTROY_INT
779 LIBCFS_ATOMIC_PANIC_NOTIFIER
781 LIBCFS_3ARGS_INIT_WORK
783 LIBCFS_2ARGS_REGISTER_SYSCTL
786 LIBCFS_KMEM_CACHE_CREATE_DTOR
787 LIBCFS_NETLINK_CBMUTEX
790 LIBCFS_SYSCTL_UNNUMBERED
791 LIBCFS_SCATTERLIST_SETPAGE
792 LIBCFS_NL_BROADCAST_GFP
793 LIBCFS_NETWORK_NAMESPACE
795 LIBCFS_FUNC_DUMP_TRACE
801 LIBCFS_STRUCT_CRED_IN_TASK
803 LIBCFS_FUNC_UNSHARE_FS_STRUCT
804 LIBCFS_SOCK_MAP_FD_2ARG
806 LIBCFS_STACKTRACE_OPS_HAVE_WALK_STACK
807 LC_SHRINKER_WANT_SHRINK_PTR
811 LIBCFS_SYSCTL_CTLNAME
813 LIBCFS_ADD_WAIT_QUEUE_EXCLUSIVE
823 AC_DEFUN([LIBCFS_PROG_DARWIN],
824 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
828 # LIBCFS_PATH_DEFAULTS
830 # default paths for installed files
832 AC_DEFUN([LIBCFS_PATH_DEFAULTS],
839 # other configure checks
841 AC_DEFUN([LIBCFS_CONFIGURE],
842 [# lnet/utils/portals.c
843 AC_CHECK_HEADERS([asm/types.h endian.h sys/ioctl.h])
846 AC_CHECK_HEADERS([linux/version.h])
848 AC_CHECK_TYPE([spinlock_t],
849 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
851 [#include <linux/spinlock.h>])
853 # lnet/utils/wirecheck.c
854 AC_CHECK_FUNCS([strnlen])
856 AC_CHECK_TYPE([umode_t],
857 [AC_DEFINE(HAVE_UMODE_T, 1, [umode_t is defined])],
859 [#include <asm/types.h>])
861 AC_CHECK_TYPE([__s8],
862 [AC_DEFINE(HAVE___S8, 1, [__s8 is defined])],
864 [#include <asm/types.h>])
866 AC_CHECK_TYPE([__u8],
867 [AC_DEFINE(HAVE___U8, 1, [__u8 is defined])],
869 [#include <asm/types.h>])
871 AC_CHECK_TYPE([__s16],
872 [AC_DEFINE(HAVE___S16, 1, [__s16 is defined])],
874 [#include <asm/types.h>])
876 AC_CHECK_TYPE([__u16],
877 [AC_DEFINE(HAVE___U16, 1, [__u16 is defined])],
879 [#include <asm/types.h>])
881 AC_CHECK_TYPE([__s32],
882 [AC_DEFINE(HAVE___S32, 1, [__s32 is defined])],
884 [#include <asm/types.h>])
886 AC_CHECK_TYPE([__u32],
887 [AC_DEFINE(HAVE___U32, 1, [__u32 is defined])],
889 [#include <asm/types.h>])
891 AC_CHECK_TYPE([__u64],
892 [AC_DEFINE(HAVE___U64, 1, [__u64 is defined])],
894 [#include <asm/types.h>])
896 AC_CHECK_TYPE([__s64],
897 [AC_DEFINE(HAVE___S64, 1, [__s64 is defined])],
899 [#include <asm/types.h>])
901 # check userland __u64 type
902 AC_MSG_CHECKING([userspace __u64 is long long type])
904 CFLAGS="$CFLAGS -Werror"
907 #include <linux/types.h>
908 #include <linux/stddef.h>
910 unsigned long long *data1;
918 AC_DEFINE(HAVE_USER__U64_LONG_LONG, 1,
919 [__u64 is long long type])
925 # -------- Check for required packages --------------
928 AC_MSG_CHECKING([if efence debugging support is requested])
929 AC_ARG_ENABLE(efence,
930 AC_HELP_STRING([--enable-efence],
931 [use efence library]),
932 [],[enable_efence='no'])
933 AC_MSG_RESULT([$enable_efence])
934 if test "$enable_efence" = "yes" ; then
936 AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
943 # -------- check for -lpthread support ----
944 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
945 AC_ARG_ENABLE([libpthread],
946 AC_HELP_STRING([--disable-libpthread],
947 [disable libpthread]),
948 [],[enable_libpthread=yes])
949 if test "$enable_libpthread" = "yes" ; then
950 AC_CHECK_LIB([pthread], [pthread_create],
951 [ENABLE_LIBPTHREAD="yes"],
952 [ENABLE_LIBPTHREAD="no"])
953 if test "$ENABLE_LIBPTHREAD" = "yes" ; then
954 AC_MSG_RESULT([$ENABLE_LIBPTHREAD])
955 PTHREAD_LIBS="-lpthread"
956 AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
959 AC_MSG_RESULT([no libpthread is found])
961 AC_SUBST(PTHREAD_LIBS)
963 AC_MSG_RESULT([no (disabled explicitly)])
964 ENABLE_LIBPTHREAD="no"
966 AC_SUBST(ENABLE_LIBPTHREAD)
972 # LIBCFS_CONDITIONALS
974 # AM_CONDITOINAL defines for lnet
976 AC_DEFUN([LIBCFS_CONDITIONALS],
981 # LIBCFS_CONFIG_FILES
983 # files that should be generated with AC_OUTPUT
985 AC_DEFUN([LIBCFS_CONFIG_FILES],
990 libcfs/autoconf/Makefile
991 libcfs/include/Makefile
992 libcfs/include/libcfs/Makefile
993 libcfs/include/libcfs/linux/Makefile
994 libcfs/include/libcfs/posix/Makefile
995 libcfs/include/libcfs/util/Makefile
996 libcfs/libcfs/Makefile
997 libcfs/libcfs/autoMakefile
998 libcfs/libcfs/linux/Makefile
999 libcfs/libcfs/posix/Makefile
1000 libcfs/libcfs/util/Makefile
1001 libcfs/include/libcfs/darwin/Makefile
1002 libcfs/libcfs/darwin/Makefile