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