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