Whamcloud - gitweb
693251371c68b2ae09c772a6f6824bb88f9b1167
[fs/lustre-release.git] / libcfs / autoconf / lustre-libcfs.m4
1 #
2 # LN_CONFIG_CDEBUG
3 #
4 # whether to enable various libcfs debugs (CDEBUG, ENTRY/EXIT, LASSERT, etc.)
5 #
6 AC_DEFUN([LN_CONFIG_CDEBUG],
7 [
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])
16 else
17    AC_DEFINE(CDEBUG_ENABLED, 0, [disable libcfs CDEBUG, CWARN])
18 fi
19
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])
28 else
29    AC_DEFINE(CDEBUG_ENTRY_EXIT, 0, [disable libcfs ENTRY/EXIT])
30 fi
31
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])
40 fi
41 ])
42
43 #
44 # LIBCFS_CONFIG_PANIC_DUMPLOG
45 #
46 # check if tunable panic_dumplog is wanted
47 #
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)])
57 else
58        AC_MSG_RESULT([no])
59 fi
60 ])
61
62 #
63 # LIBCFS_FUNC_CPU_ONLINE
64 #
65 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
66 #
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>
71 ],[
72        cpu_online(0);
73 ],[
74        AC_MSG_RESULT([yes])
75        AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
76 ],[
77        AC_MSG_RESULT([no])
78 ])
79 ])
80
81 #
82 # LIBCFS_TYPE_GFP_T
83 #
84 # check if gfp_t is typedef-ed
85 #
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>
90 ],[
91         return sizeof(gfp_t);
92 ],[
93         AC_MSG_RESULT([yes])
94         AC_DEFINE(HAVE_GFP_T, 1, [gfp_t found])
95 ],[
96         AC_MSG_RESULT([no])
97 ])
98 ])
99
100 #
101 # LIBCFS_FUNC_SHOW_TASK
102 #
103 # we export show_task(), but not all kernels have it (yet)
104 #
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])
109 ],[
110 ])
111 ])
112
113 # check userland & kernel __u64 type
114 AC_DEFUN([LIBCFS_U64_LONG_LONG],
115 [AC_MSG_CHECKING([u64 is long long type])
116 tmp_flags="$CFLAGS"
117 CFLAGS="$CFLAGS -Werror"
118 AC_COMPILE_IFELSE([
119         #include <stdio.h>
120         #include <linux/types.h>
121         #include <linux/stddef.h>
122         int main(void) {
123                 unsigned long long *data1;
124                 __u64 *data2 = NULL;
125
126                 data1 = data2;
127                 return 0;
128         }
129 ],[
130         AC_MSG_RESULT([yes])
131         AC_DEFINE(HAVE_USER__U64_LONG_LONG, 1,
132                   [__u64 is long long type])
133 ],[
134         AC_MSG_RESULT([no])
135 ])
136 CFLAGS="$tmp_flags"
137 AC_MSG_CHECKING([kernel __u64 is long long type])
138 tmp_flags="$EXTRA_KCFLAGS"
139 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Werror"
140 LB_LINUX_TRY_COMPILE([
141         #include <linux/types.h>
142         #include <linux/stddef.h>
143 ],[
144         unsigned long long *data1;
145         __u64 *data2 = NULL;
146
147         data1 = data2;
148 ],[
149         AC_MSG_RESULT([yes])
150         AC_DEFINE(HAVE_KERN__U64_LONG_LONG, 1,
151                   [kernel __u64 is long long type])
152 ],[
153         AC_MSG_RESULT([no])
154 ])
155 EXTRA_KCFLAGS="$tmp_flags"
156 ])
157
158 # check if task_struct with rcu memeber
159 AC_DEFUN([LIBCFS_TASK_RCU],
160 [AC_MSG_CHECKING([if task_struct has a rcu field])
161 LB_LINUX_TRY_COMPILE([
162         #include <linux/sched.h>
163 ],[
164         struct task_struct tsk;
165
166         tsk.rcu.next = NULL;
167 ],[
168         AC_MSG_RESULT([yes])
169         AC_DEFINE(HAVE_TASK_RCU, 1,
170                   [task_struct has rcu field])
171 ],[
172         AC_MSG_RESULT([no])
173 ])
174 ])
175
176 # LIBCFS_TASKLIST_LOCK
177 # 2.6.18 remove tasklist_lock export
178 AC_DEFUN([LIBCFS_TASKLIST_LOCK],
179 [LB_CHECK_SYMBOL_EXPORT([tasklist_lock],
180 [kernel/fork.c],[
181 AC_DEFINE(HAVE_TASKLIST_LOCK, 1,
182          [tasklist_lock exported])
183 ],[
184 ])
185 ])
186
187 # 2.6.19 API changes
188 # kmem_cache_destroy(cachep) return void instead of
189 # int
190 AC_DEFUN([LIBCFS_KMEM_CACHE_DESTROY_INT],
191 [AC_MSG_CHECKING([kmem_cache_destroy(cachep) return int])
192 LB_LINUX_TRY_COMPILE([
193         #include <linux/slab.h>
194 ],[
195         int i = kmem_cache_destroy(NULL);
196 ],[
197         AC_MSG_RESULT(yes)
198         AC_DEFINE(HAVE_KMEM_CACHE_DESTROY_INT, 1,
199                 [kmem_cache_destroy(cachep) return int])
200 ],[
201         AC_MSG_RESULT(NO)
202 ])
203 ])
204
205 # 2.6.19 API change
206 #panic_notifier_list use atomic_notifier operations
207 #
208 AC_DEFUN([LIBCFS_ATOMIC_PANIC_NOTIFIER],
209 [AC_MSG_CHECKING([panic_notifier_list is atomic])
210 LB_LINUX_TRY_COMPILE([
211         #include <linux/notifier.h>
212         #include <linux/kernel.h>
213 ],[
214         struct atomic_notifier_head panic_notifier_list;
215 ],[
216         AC_MSG_RESULT(yes)
217         AC_DEFINE(HAVE_ATOMIC_PANIC_NOTIFIER, 1,
218                 [panic_notifier_list is atomic_notifier_head])
219 ],[
220         AC_MSG_RESULT(NO)
221 ])
222 ])
223
224 # since 2.6.19 nlmsg_multicast() needs 5 argument.
225 AC_DEFUN([LIBCFS_NLMSG_MULTICAST],
226 [AC_MSG_CHECKING([nlmsg_multicast needs 5 argument])
227 LB_LINUX_TRY_COMPILE([
228         #include <net/netlink.h>
229 ],[
230         nlmsg_multicast(NULL, NULL, 0, 0, 0);
231 ],[
232         AC_MSG_RESULT(yes)
233         AC_DEFINE(HAVE_NLMSG_MULTICAST_5ARGS, 1,
234                   [nlmsg_multicast needs 5 argument])
235 ],[
236         AC_MSG_RESULT(NO)
237 ])
238 ])
239
240 #
241 # LIBCFS_NETLINK
242 #
243 # If we have netlink.h, and nlmsg_new takes 2 args (2.6.19)
244 #
245 AC_DEFUN([LIBCFS_NETLINK],
246 [AC_MSG_CHECKING([if netlink.h can be compiled])
247 LB_LINUX_TRY_COMPILE([
248         #include <net/netlink.h>
249 ],[],[
250         AC_MSG_RESULT([yes])
251         AC_DEFINE(HAVE_NETLINK, 1, [net/netlink.h found])
252
253         AC_MSG_CHECKING([if nlmsg_new takes a 2nd argument])
254         LB_LINUX_TRY_COMPILE([
255                 #include <net/netlink.h>
256         ],[
257                 nlmsg_new(100, GFP_KERNEL);
258         ],[
259                 AC_MSG_RESULT([yes])
260                 AC_DEFINE(HAVE_NETLINK_NL2, 1, [nlmsg_new takes 2 args])
261         ],[
262                 AC_MSG_RESULT([no])
263         ])
264 ],[
265         AC_MSG_RESULT([no])
266 ])
267 ])
268
269 # 2.6.20 API change INIT_WORK use 2 args and not
270 # store data inside
271 AC_DEFUN([LIBCFS_3ARGS_INIT_WORK],
272 [AC_MSG_CHECKING([check INIT_WORK want 3 args])
273 LB_LINUX_TRY_COMPILE([
274         #include <linux/workqueue.h>
275 ],[
276         struct work_struct work;
277
278         INIT_WORK(&work, NULL, NULL);
279 ],[
280         AC_MSG_RESULT(yes)
281         AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
282                   [INIT_WORK use 3 args and store data inside])
283 ],[
284         AC_MSG_RESULT(NO)
285 ])
286 ])
287
288 # 2.6.21 api change. 'register_sysctl_table' use only one argument,
289 # instead of more old which need two.
290 AC_DEFUN([LIBCFS_2ARGS_REGISTER_SYSCTL],
291 [AC_MSG_CHECKING([check register_sysctl_table want 2 args])
292 LB_LINUX_TRY_COMPILE([
293         #include <linux/sysctl.h>
294 ],[
295         return register_sysctl_table(NULL,0);
296 ],[
297         AC_MSG_RESULT(yes)
298         AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
299                   [register_sysctl_table want 2 args])
300 ],[
301         AC_MSG_RESULT(NO)
302 ])
303 ])
304
305 # 2.6.21 marks kmem_cache_t deprecated and uses struct kmem_cache
306 # instead
307 AC_DEFUN([LIBCFS_KMEM_CACHE],
308 [AC_MSG_CHECKING([check kernel has struct kmem_cache])
309 tmp_flags="$EXTRA_KCFLAGS"
310 EXTRA_KCFLAGS="-Werror"
311 LB_LINUX_TRY_COMPILE([
312         #include <linux/slab.h>
313         typedef struct kmem_cache cache_t;
314 ],[
315         cache_t *cachep = NULL;
316
317         kmem_cache_alloc(cachep, 0);
318 ],[
319         AC_MSG_RESULT(yes)
320         AC_DEFINE(HAVE_KMEM_CACHE, 1,
321                   [kernel has struct kmem_cache])
322 ],[
323         AC_MSG_RESULT(NO)
324 ])
325 EXTRA_KCFLAGS="$tmp_flags"
326 ])
327
328 # 2.6.23 lost dtor argument
329 AC_DEFUN([LIBCFS_KMEM_CACHE_CREATE_DTOR],
330 [AC_MSG_CHECKING([check kmem_cache_create has dtor argument])
331 LB_LINUX_TRY_COMPILE([
332         #include <linux/slab.h>
333 ],[
334         kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);
335 ],[
336         AC_MSG_RESULT(yes)
337         AC_DEFINE(HAVE_KMEM_CACHE_CREATE_DTOR, 1,
338                   [kmem_cache_create has dtor argument])
339 ],[
340         AC_MSG_RESULT(NO)
341 ])
342 ])
343
344 # 2.6.24 
345 AC_DEFUN([LIBCFS_NETLINK_CBMUTEX],
346 [AC_MSG_CHECKING([for mutex in netlink_kernel_create])
347 LB_LINUX_TRY_COMPILE([
348         #include <linux/netlink.h>
349 ],[
350         struct mutex *lock = NULL;
351
352         netlink_kernel_create(0, 0, NULL, lock, NULL);
353 ],[
354         AC_MSG_RESULT(yes)
355         AC_DEFINE(HAVE_NETLINK_CBMUTEX, 1,
356                   [netlink_kernel_create want mutex for callback])
357 ],[
358         AC_MSG_RESULT(NO)
359 ])
360 ])
361
362 # 2.6.24 request not use real numbers for ctl_name
363 AC_DEFUN([LIBCFS_SYSCTL_UNNUMBERED],
364 [AC_MSG_CHECKING([for CTL_UNNUMBERED])
365 LB_LINUX_TRY_COMPILE([
366         #include <linux/sysctl.h>
367 ],[
368         #ifndef CTL_UNNUMBERED
369         #error CTL_UNNUMBERED not exist in kernel
370         #endif
371 ],[
372         AC_MSG_RESULT(yes)
373         AC_DEFINE(HAVE_SYSCTL_UNNUMBERED, 1,
374                   [sysctl has CTL_UNNUMBERED])
375 ],[
376         AC_MSG_RESULT(NO)
377 ])
378 ])
379
380 # 2.6.24 lost scatterlist->page
381 AC_DEFUN([LIBCFS_SCATTERLIST_SETPAGE],
382 [AC_MSG_CHECKING([for exist sg_set_page])
383 LB_LINUX_TRY_COMPILE([
384         #include <asm/types.h>
385         #include <linux/scatterlist.h>
386 ],[
387         sg_set_page(NULL,NULL,0,0);
388 ],[
389         AC_MSG_RESULT(yes)
390         AC_DEFINE(HAVE_SCATTERLIST_SETPAGE, 1,
391                   [struct scatterlist has page member])
392 ],[
393         AC_MSG_RESULT(NO)
394 ])
395 ])
396
397 # 2.6.24 
398 AC_DEFUN([LIBCFS_NETWORK_NAMESPACE],
399 [AC_MSG_CHECKING([for network stack has namespaces])
400 LB_LINUX_TRY_COMPILE([
401         #include <net/net_namespace.h>
402 ],[
403         struct net *net = &init_net;
404 ],[
405         AC_MSG_RESULT(yes)
406         AC_DEFINE(HAVE_INIT_NET, 1,
407                   [kernel is support network namespaces ])
408 ],[
409         AC_MSG_RESULT(NO)
410 ])
411 ])
412
413
414 # 2.6.24 
415 AC_DEFUN([LIBCFS_NETLINK_NETNS],
416 [AC_MSG_CHECKING([for netlink support net ns])
417 LB_LINUX_TRY_COMPILE([
418         #include <linux/netlink.h>
419 ],[
420         struct net *net = NULL;
421         struct mutex *lock = NULL;
422
423         netlink_kernel_create(net, 0, 0, NULL,
424                               lock,
425                               NULL);
426 ],[
427         AC_MSG_RESULT(yes)
428         AC_DEFINE(HAVE_NETLINK_NS, 1,
429                   [netlink is support network namespace])
430 # XXX
431 # for now - if kernel have netlink ns - he uses cbmutex
432         AC_DEFINE(HAVE_NETLINK_CBMUTEX, 1,
433                   [netlink_kernel_create want mutex for callback])
434
435 ],[
436         AC_MSG_RESULT(NO)
437 ])
438 ])
439
440 # ~2.6.24
441 AC_DEFUN([LIBCFS_NL_BROADCAST_GFP],
442 [AC_MSG_CHECKING([for netlink_broadcast is want to have gfp parameter])
443 LB_LINUX_TRY_COMPILE([
444         #include <linux/netlink.h>
445 ],[
446         gfp_t gfp = GFP_KERNEL;
447
448         netlink_broadcast(NULL, NULL, 0, 0, gfp);
449 ],[
450         AC_MSG_RESULT(yes)
451         AC_DEFINE(HAVE_NL_BROADCAST_GFP, 1,
452                   [netlink brouacast is want to have gfp paramter])
453 ],[
454         AC_MSG_RESULT(NO)
455 ])
456 ])
457
458 #
459 # LIBCFS_FUNC_DUMP_TRACE
460 #
461 # 2.6.23 exports dump_trace() so we can dump_stack() on any task
462 # 2.6.24 has stacktrace_ops.address with "reliable" parameter
463 #
464 AC_DEFUN([LIBCFS_FUNC_DUMP_TRACE],
465 [LB_CHECK_SYMBOL_EXPORT([dump_trace],
466 [kernel/ksyms.c arch/${LINUX_ARCH%_64}/kernel/traps_64.c],[
467         tmp_flags="$EXTRA_KCFLAGS"
468         EXTRA_KCFLAGS="-Werror"
469         AC_MSG_CHECKING([whether we can really use dump_trace])
470         LB_LINUX_TRY_COMPILE([
471                 struct task_struct;
472                 struct pt_regs;
473                 #include <asm/stacktrace.h>
474         ],[
475         ],[
476                 AC_MSG_RESULT(yes)
477                 AC_DEFINE(HAVE_DUMP_TRACE, 1, [dump_trace is exported])
478         ],[
479                 AC_MSG_RESULT(no)
480         ],[
481         ])
482         AC_MSG_CHECKING([whether print_trace_address has reliable argument])
483         LB_LINUX_TRY_COMPILE([
484                 struct task_struct;
485                 struct pt_regs;
486                 void print_addr(void *data, unsigned long addr, int reliable);
487                 #include <asm/stacktrace.h>
488         ],[
489                 struct stacktrace_ops ops;
490
491                 ops.address = print_addr;
492         ],[
493                 AC_MSG_RESULT(yes)
494                 AC_DEFINE(HAVE_TRACE_ADDRESS_RELIABLE, 1,
495                           [print_trace_address has reliable argument])
496         ],[
497                 AC_MSG_RESULT(no)
498         ],[
499         ])
500 EXTRA_KCFLAGS="$tmp_flags"
501 ])
502 ])
503
504
505 # 2.6.26 use int instead of atomic for sem.count
506 AC_DEFUN([LIBCFS_SEM_COUNT],
507 [AC_MSG_CHECKING([atomic sem.count])
508 LB_LINUX_TRY_COMPILE([
509         #include <asm/semaphore.h>
510 ],[
511         struct semaphore s;
512         
513         atomic_read(&s.count);
514 ],[
515         AC_MSG_RESULT(yes)
516         AC_DEFINE(HAVE_SEM_COUNT_ATOMIC, 1,
517                   [semaphore counter is atomic])
518 ],[
519         AC_MSG_RESULT(NO)
520 ])
521 ])
522
523 # 2.6.27 have second argument to sock_map_fd
524 AC_DEFUN([LIBCFS_SOCK_MAP_FD_2ARG],
525 [AC_MSG_CHECKING([sock_map_fd have second argument])
526 LB_LINUX_TRY_COMPILE([
527         #include <linux/net.h>
528 ],[
529         sock_map_fd(NULL, 0);
530 ],[
531         AC_MSG_RESULT(yes)
532         AC_DEFINE(HAVE_SOCK_MAP_FD_2ARG, 1,
533                   [sock_map_fd have second argument])
534 ],[
535         AC_MSG_RESULT(NO)
536 ])
537 ])
538
539 # LIBCFS_CRED_WRAPPERS
540 #
541 # wrappers for task's credentials are in sles11
542 #
543 AC_DEFUN([LIBCFS_CRED_WRAPPERS],
544 [AC_MSG_CHECKING([if kernel has wrappers for task's credentials])
545 LB_LINUX_TRY_COMPILE([
546        #include <linux/sched.h>
547 ],[
548        uid_t uid;
549
550        uid = current_uid();
551 ],[
552        AC_MSG_RESULT([yes])
553        AC_DEFINE(HAVE_CRED_WRAPPERS, 1, [task's cred wrappers found])
554 ],[
555        AC_MSG_RESULT([no])
556 ])
557 ])
558
559 #
560 # LN_STRUCT_CRED_IN_TASK
561 #
562 # struct cred was introduced in 2.6.29 to streamline credentials in task struct
563 #
564 AC_DEFUN([LIBCFS_STRUCT_CRED_IN_TASK],
565 [AC_MSG_CHECKING([if kernel has struct cred])
566 LB_LINUX_TRY_COMPILE([
567        #include <linux/sched.h>
568 ],[
569        struct task_struct *tsk = NULL;
570        tsk->real_cred = NULL;
571 ],[
572        AC_MSG_RESULT([yes])
573        AC_DEFINE(HAVE_STRUCT_CRED, 1, [struct cred found])
574 ],[
575        AC_MSG_RESULT([no])
576 ])
577 ])
578
579 #
580 # LIBCFS_FUNC_UNSHARE_FS_STRUCT
581 #
582 # unshare_fs_struct was introduced in 2.6.30 to prevent others to directly
583 # mess with copy_fs_struct
584 #
585 AC_DEFUN([LIBCFS_FUNC_UNSHARE_FS_STRUCT],
586 [AC_MSG_CHECKING([if kernel defines unshare_fs_struct()])
587 tmp_flags="$EXTRA_KCFLAGS"
588 EXTRA_KCFLAGS="-Werror"
589 LB_LINUX_TRY_COMPILE([
590        #include <linux/sched.h>
591        #include <linux/fs_struct.h>
592 ],[
593        unshare_fs_struct();
594 ],[
595        AC_MSG_RESULT([yes])
596        AC_DEFINE(HAVE_UNSHARE_FS_STRUCT, 1, [unshare_fs_struct found])
597 ],[
598        AC_MSG_RESULT([no])
599 ])
600 EXTRA_KCFLAGS="$tmp_flags"
601 ])
602
603 #
604 # LIBCFS_HAVE_IS_COMPAT_TASK
605 #
606 # Added in 2.6.17, it wasn't until 2.6.29 that all
607 # Linux architectures have is_compat_task()
608 #
609 AC_DEFUN([LIBCFS_HAVE_IS_COMPAT_TASK],
610 [AC_MSG_CHECKING([if is_compat_task() is declared])
611 LB_LINUX_TRY_COMPILE([
612         #include <linux/compat.h>
613 ],[
614         int i = is_compat_task();
615 ],[
616         AC_MSG_RESULT([yes])
617         AC_DEFINE(HAVE_IS_COMPAT_TASK, 1, [is_compat_task() is available])
618 ],[
619         AC_MSG_RESULT([no])
620 ])
621 ])
622
623 #
624 # LIBCFS_PROG_LINUX
625 #
626 # LNet linux kernel checks
627 #
628 AC_DEFUN([LIBCFS_PROG_LINUX],
629 [
630 LIBCFS_FUNC_CPU_ONLINE
631 LIBCFS_TYPE_GFP_T
632 LIBCFS_CONFIG_PANIC_DUMPLOG
633
634 LIBCFS_FUNC_SHOW_TASK
635 LIBCFS_U64_LONG_LONG
636 LIBCFS_TASK_RCU
637 # 2.6.18
638 LIBCFS_TASKLIST_LOCK
639 LIBCFS_HAVE_IS_COMPAT_TASK
640 # 2.6.19
641 LIBCFS_NETLINK
642 LIBCFS_NLMSG_MULTICAST
643 LIBCFS_KMEM_CACHE_DESTROY_INT
644 LIBCFS_ATOMIC_PANIC_NOTIFIER
645 # 2.6.20
646 LIBCFS_3ARGS_INIT_WORK
647 # 2.6.21
648 LIBCFS_2ARGS_REGISTER_SYSCTL
649 LIBCFS_KMEM_CACHE
650 # 2.6.23
651 LIBCFS_KMEM_CACHE_CREATE_DTOR
652 LIBCFS_NETLINK_CBMUTEX
653 # 2.6.24
654 LIBCFS_SYSCTL_UNNUMBERED
655 LIBCFS_SCATTERLIST_SETPAGE
656 LIBCFS_NL_BROADCAST_GFP
657 LIBCFS_NETWORK_NAMESPACE
658 LIBCFS_NETLINK_NETNS
659 LIBCFS_FUNC_DUMP_TRACE
660 # 2.6.26
661 LIBCFS_SEM_COUNT
662 # 2.6.27
663 LIBCFS_CRED_WRAPPERS
664 # 2.6.29
665 LIBCFS_STRUCT_CRED_IN_TASK
666 # 2.6.30
667 LIBCFS_FUNC_UNSHARE_FS_STRUCT
668 LIBCFS_SOCK_MAP_FD_2ARG
669 ])
670
671 #
672 # LIBCFS_PROG_DARWIN
673 #
674 # Darwin checks
675 #
676 AC_DEFUN([LIBCFS_PROG_DARWIN],
677 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
678 ])
679
680 #
681 # LIBCFS_PATH_DEFAULTS
682 #
683 # default paths for installed files
684 #
685 AC_DEFUN([LIBCFS_PATH_DEFAULTS],
686 [
687 ])
688
689 #
690 # LIBCFS_CONFIGURE
691 #
692 # other configure checks
693 #
694 AC_DEFUN([LIBCFS_CONFIGURE],
695 [# lnet/utils/portals.c
696 AC_CHECK_HEADERS([asm/types.h endian.h sys/ioctl.h])
697
698 # lnet/utils/debug.c
699 AC_CHECK_HEADERS([linux/version.h])
700
701 AC_CHECK_TYPE([spinlock_t],
702         [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
703         [],
704         [#include <linux/spinlock.h>])
705
706 # lnet/utils/wirecheck.c
707 AC_CHECK_FUNCS([strnlen])
708
709 AC_CHECK_TYPE([umode_t],
710         [AC_DEFINE(HAVE_UMODE_T, 1, [umode_t is defined])],
711         [],
712         [#include <asm/types.h>])
713
714 AC_CHECK_TYPE([__s8],
715         [AC_DEFINE(HAVE___S8, 1, [__s8 is defined])],
716         [],
717         [#include <asm/types.h>])
718
719 AC_CHECK_TYPE([__u8],
720         [AC_DEFINE(HAVE___U8, 1, [__u8 is defined])],
721         [],
722         [#include <asm/types.h>])
723
724 AC_CHECK_TYPE([__s16],
725         [AC_DEFINE(HAVE___S16, 1, [__s16 is defined])],
726         [],
727         [#include <asm/types.h>])
728
729 AC_CHECK_TYPE([__u16],
730         [AC_DEFINE(HAVE___U16, 1, [__u16 is defined])],
731         [],
732         [#include <asm/types.h>])
733
734 AC_CHECK_TYPE([__s32],
735         [AC_DEFINE(HAVE___S32, 1, [__s32 is defined])],
736         [],
737         [#include <asm/types.h>])
738
739 AC_CHECK_TYPE([__u32],
740         [AC_DEFINE(HAVE___U32, 1, [__u32 is defined])],
741         [],
742         [#include <asm/types.h>])
743
744 AC_CHECK_TYPE([__u64],
745         [AC_DEFINE(HAVE___U64, 1, [__u64 is defined])],
746         [],
747         [#include <asm/types.h>])
748
749 AC_CHECK_TYPE([__s64],
750         [AC_DEFINE(HAVE___S64, 1, [__s64 is defined])],
751         [],
752         [#include <asm/types.h>])
753
754 # --------  Check for required packages  --------------
755
756
757 AC_MSG_CHECKING([if efence debugging support is requested])
758 AC_ARG_ENABLE(efence,
759         AC_HELP_STRING([--enable-efence],
760                         [use efence library]),
761         [],[enable_efence='no'])
762 AC_MSG_RESULT([$enable_efence])
763 if test "$enable_efence" = "yes" ; then
764         LIBEFENCE="-lefence"
765         AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
766 else
767         LIBEFENCE=""
768 fi
769 AC_SUBST(LIBEFENCE)
770
771
772 # -------- check for -lpthread support ----
773 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
774 AC_ARG_ENABLE([libpthread],
775         AC_HELP_STRING([--disable-libpthread],
776                 [disable libpthread]),
777         [],[enable_libpthread=yes])
778 if test "$enable_libpthread" = "yes" ; then
779         AC_CHECK_LIB([pthread], [pthread_create],
780                 [ENABLE_LIBPTHREAD="yes"],
781                 [ENABLE_LIBPTHREAD="no"])
782         if test "$ENABLE_LIBPTHREAD" = "yes" ; then
783                 AC_MSG_RESULT([$ENABLE_LIBPTHREAD])
784                 PTHREAD_LIBS="-lpthread"
785                 AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
786         else
787                 PTHREAD_LIBS=""
788                 AC_MSG_RESULT([no libpthread is found])
789         fi
790         AC_SUBST(PTHREAD_LIBS)
791 else
792         AC_MSG_RESULT([no (disabled explicitly)])
793         ENABLE_LIBPTHREAD="no"
794 fi
795 AC_SUBST(ENABLE_LIBPTHREAD)
796
797
798 ])
799
800 #
801 # LIBCFS_CONDITIONALS
802 #
803 # AM_CONDITOINAL defines for lnet
804 #
805 AC_DEFUN([LIBCFS_CONDITIONALS],
806 [
807 ])
808
809 #
810 # LIBCFS_CONFIG_FILES
811 #
812 # files that should be generated with AC_OUTPUT
813 #
814 AC_DEFUN([LIBCFS_CONFIG_FILES],
815 [AC_CONFIG_FILES([
816 libcfs/Kernelenv
817 libcfs/Makefile
818 libcfs/autoMakefile
819 libcfs/autoconf/Makefile
820 libcfs/include/Makefile
821 libcfs/include/libcfs/Makefile
822 libcfs/include/libcfs/linux/Makefile
823 libcfs/include/libcfs/posix/Makefile
824 libcfs/include/libcfs/util/Makefile
825 libcfs/libcfs/Makefile
826 libcfs/libcfs/autoMakefile
827 libcfs/libcfs/linux/Makefile
828 libcfs/libcfs/posix/Makefile
829 libcfs/libcfs/util/Makefile
830 libcfs/include/libcfs/darwin/Makefile
831 libcfs/libcfs/darwin/Makefile
832 ])
833 ])