Whamcloud - gitweb
* 5852 vibnal patch to detect __u64/void* vv_scatgat_t::v_address and
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
1 #
2 # LP_CHECK_GCC_VERSION
3 #
4 # Check compiler version
5 #
6 AC_DEFUN([LP_CHECK_GCC_VERSION],
7 [AC_MSG_CHECKING([compiler version])
8 PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
9 PTL_MIN_CC_VERSION="3.2.2"
10 v2n() {
11         awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
12 }
13 if test -z "$PTL_CC_VERSION" -o \
14         `echo $PTL_CC_VERSION | v2n` -ge `echo $PTL_MIN_CC_VERSION | v2n`; then
15         AC_MSG_RESULT([ok])
16 else
17         AC_MSG_RESULT([Buggy compiler found])
18         AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
19 fi
20 ])
21
22 #
23 # LP_CONFIG_ZEROCOPY
24 #
25 # check if zerocopy is available/wanted
26 #
27 AC_DEFUN([LP_CONFIG_ZEROCOPY],
28 [AC_MSG_CHECKING([for zero-copy TCP support])
29 AC_ARG_ENABLE([zerocopy],
30         AC_HELP_STRING([--disable-zerocopy],
31                        [disable socknal zerocopy]),
32         [],[enable_zerocopy='yes'])
33 if test x$enable_zerocopy = xno ; then
34         AC_MSG_RESULT([no (by request)])
35 else
36         ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
37         if test "$ZCCD" != 0 ; then
38                 AC_DEFINE(SOCKNAL_ZC, 1, [use zero-copy TCP])
39                 AC_MSG_RESULT(yes)
40         else
41                 AC_MSG_RESULT([no (no kernel support)])
42         fi
43 fi
44 ])
45
46 #
47 # LP_CONFIG_AFFINITY
48 #
49 # check if cpu affinity is available/wanted
50 #
51 AC_DEFUN([LP_CONFIG_AFFINITY],
52 [AC_ARG_ENABLE([affinity],
53         AC_HELP_STRING([--disable-affinity],
54                        [disable process/irq affinity]),
55         [],[enable_affinity='yes'])
56
57 AC_MSG_CHECKING([for CPU affinity support])
58 if test x$enable_affinity = xno ; then
59         AC_MSG_RESULT([no (by request)])
60 else
61         LB_LINUX_TRY_COMPILE([
62                 #include <linux/sched.h>
63         ],[
64                 struct task_struct t;
65                 #ifdef CPU_ARRAY_SIZE
66                 cpumask_t m;
67                 #else
68                 unsigned long m;
69                 #endif
70                 set_cpus_allowed(&t, m);
71         ],[
72                 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
73                 AC_MSG_RESULT([yes])
74         ],[
75                 AC_MSG_RESULT([no (no kernel support)])
76         ])
77 fi
78 ])
79
80 #
81 # LP_CONFIG_QUADRICS
82 #
83 # check if quadrics support is in this kernel
84 #
85 AC_DEFUN([LP_CONFIG_QUADRICS],
86 [AC_MSG_CHECKING([for QsNet sources])
87 AC_ARG_WITH([qsnet],
88         AC_HELP_STRING([--with-qsnet=path],
89                        [set path to qsnet source (default=$LINUX)]),
90         [QSNET=$with_qsnet],
91         [QSNET=$LINUX])
92 AC_MSG_RESULT([$QSNET])
93
94 AC_MSG_CHECKING([if quadrics kernel headers are present])
95 if test -d $QSNET/drivers/net/qsnet ; then
96         AC_MSG_RESULT([yes])
97         QSWNAL="qswnal"
98         AC_MSG_CHECKING([for multirail EKC])
99         if test -f $QSNET/include/elan/epcomms.h; then
100                 AC_MSG_RESULT([supported])
101                 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
102         else
103                 AC_MSG_RESULT([not supported])
104                 if test -d $QSNET/drivers/net/qsnet/include; then
105                         QSWCPPFLAGS="-I$QSNET/drivers/net/qsnet/include"
106                 else
107                         QSWCPPFLAGS="-I$QSNET/include/linux"
108                 fi
109         fi
110 else
111         AC_MSG_RESULT([no])
112         QSWNAL=""
113         QSWCPPFLAGS=""
114 fi
115 AC_SUBST(QSWCPPFLAGS)
116 AC_SUBST(QSWNAL)
117 ])
118
119 #
120 # LP_CONFIG_GM
121 #
122 # check if GM support is available
123 #
124 AC_DEFUN([LP_CONFIG_GM],
125 [LB_ARG_LIBS_INCLUDES([Myrinet],[gm])
126 if test x$gm_includes != x ; then
127         GMCPPFLAGS="-I$gm_includes"
128         if test -d "$gm/drivers" ; then
129                 GMCPPFLAGS="$GMCPPFLAGS -I$gm/drivers -I$gm/drivers/linux/gm"
130         fi
131 fi
132 AC_SUBST(GMCPPFLAGS)
133
134 if test x$gm_libs != x ; then
135         GMLIBS="-L$gm_libs"
136 fi
137 AC_SUBST(GMLIBS)
138
139 ENABLE_GM=0
140 if test x$gm != x ; then
141         GMNAL="gmnal"
142         ENABLE_GM=1
143 fi
144 AC_SUBST(GMNAL)
145 AC_SUBST(ENABLE_GM)
146 ])
147
148 #
149 # LP_CONFIG_OPENIB
150 #
151 # check for OpenIB in the kernel
152 AC_DEFUN([LP_CONFIG_OPENIB],[
153 AC_MSG_CHECKING([whether to enable OpenIB support])
154 # set default
155 OPENIBPATH="$LINUX/drivers/infiniband"
156 AC_ARG_WITH([openib],
157         AC_HELP_STRING([--with-openib=path],
158                        [build openibnal against path]),
159         [
160                 case $with_openib in
161                 yes)    ENABLEOPENIB=2
162                         ;;
163                 no)     ENABLEOPENIB=0
164                         ;;
165                 *)      OPENIBPATH="$with_openib"
166                         ENABLEOPENIB=3
167                         ;;
168                 esac
169         ],[
170                 ENABLEOPENIB=1
171         ])
172 if test $ENABLEOPENIB -eq 0; then
173         AC_MSG_RESULT([disabled])
174 elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
175                -f ${OPENIBPATH}/include/ts_ib_cm.h -a\
176                -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
177         AC_MSG_RESULT([no])
178         case $ENABLEOPENIB in
179         1) ;;
180         2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
181         3) AC_MSG_ERROR([bad --with-openib path]);;
182         *) AC_MSG_ERROR([internal error]);;
183         esac
184 else
185         case $ENABLEOPENIB in
186         1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
187         3)   OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
188         *)   AC_MSG_RESULT([no])
189              AC_MSG_ERROR([internal error]);;
190         esac
191         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
192         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
193         LB_LINUX_TRY_COMPILE([
194                 #include <ts_ib_core.h>
195                 #include <ts_ib_cm.h>
196                 #include <ts_ib_sa_client.h>
197         ],[
198                 struct ib_device_properties dev_props;
199                 struct ib_cm_active_param   cm_active_params;
200                 tTS_IB_CLIENT_QUERY_TID     tid;
201                 int                         enum1 = IB_QP_ATTRIBUTE_STATE;
202                 int                         enum2 = IB_ACCESS_LOCAL_WRITE;
203                 int                         enum3 = IB_CQ_CALLBACK_INTERRUPT;
204                 int                         enum4 = IB_CQ_PROVIDER_REARM;
205                 return 0;
206         ],[
207                 AC_MSG_RESULT([yes])
208                 OPENIBNAL="openibnal"
209         ],[
210                 AC_MSG_RESULT([no])
211                 case $ENABLEOPENIB in
212                 1) ;;
213                 2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
214                 3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
215                 *) AC_MSG_ERROR([internal error]);;
216                 esac
217                 OPENIBNAL=""
218                 OPENIBCPPFLAGS=""
219         ])
220         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
221 fi
222 AC_SUBST(OPENIBCPPFLAGS)
223 AC_SUBST(OPENIBNAL)
224 ])
225
226 #
227 # LP_CONFIG_IIB
228 #
229 # check for infinicon infiniband support
230 #
231 #
232 # LP_CONFIG_IIB
233 #
234 # check for infinicon infiniband support
235 #
236 AC_DEFUN([LP_CONFIG_IIB],[
237 AC_MSG_CHECKING([whether to enable Infinicon support])
238 # set default
239 IIBPATH="/usr/include"
240 AC_ARG_WITH([iib],
241         AC_HELP_STRING([--with-iib=path],
242                        [build iibnal against path]),
243         [
244                 case $with_iib in
245                 yes)    ENABLEIIB=2
246                         ;;
247                 no)     ENABLEIIB=0
248                         ;;
249                 *)      IIBPATH="${with_iib}/include"
250                         ENABLEIIB=3
251                         ;;
252                 esac
253         ],[
254                 ENABLEIIB=1
255         ])
256 if test $ENABLEIIB -eq 0; then
257         AC_MSG_RESULT([disabled])
258 elif test ! \( -f ${IIBPATH}/linux/iba/ibt.h \); then
259         AC_MSG_RESULT([no])
260         case $ENABLEIIB in
261         1) ;;
262         2) AC_MSG_ERROR([default Infinicon headers not present]);;
263         3) AC_MSG_ERROR([bad --with-iib path]);;
264         *) AC_MSG_ERROR([internal error]);;
265         esac
266 else
267         IIBCPPFLAGS="-I$IIBPATH"
268         if test $IIBPATH != "/usr/include"; then
269                 # we need /usr/include come what may
270                 IIBCPPFLAGS="$IIBCPPFLAGS -I/usr/include"
271         fi
272         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
273         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
274         LB_LINUX_TRY_COMPILE([
275                 #include <linux/iba/ibt.h>
276         ],[
277                 IBT_INTERFACE_UNION interfaces;
278                 FSTATUS             rc;
279
280                  rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
281                                                &interfaces);
282
283                 return rc == FSUCCESS ? 0 : 1;
284         ],[
285                 AC_MSG_RESULT([yes])
286                 IIBNAL="iibnal"
287         ],[
288                 AC_MSG_RESULT([no])
289                 case $ENABLEIIB in
290                 1) ;;
291                 2) AC_MSG_ERROR([can't compile with default Infinicon headers]);;
292                 3) AC_MSG_ERROR([can't compile with Infinicon headers under $IIBPATH]);;
293                 *) AC_MSG_ERROR([internal error]);;
294                 esac
295                 IIBNAL=""
296                 IIBCPPFLAGS=""
297         ])
298         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
299 fi
300 AC_SUBST(IIBCPPFLAGS)
301 AC_SUBST(IIBNAL)
302 ])
303
304 #
305 # LP_CONFIG_VIB
306 #
307 # check for Voltaire infiniband support
308 #
309 AC_DEFUN([LP_CONFIG_VIB],
310 [AC_MSG_CHECKING([whether to enable Voltaire IB support])
311 VIBPATH=""
312 AC_ARG_WITH([vib],
313         AC_HELP_STRING([--with-vib=path],
314                        [build vibnal against path]),
315         [
316                 case $with_vib in
317                 no)     AC_MSG_RESULT([no]);;
318                 *)      VIBPATH="${with_vib}/src/nvigor/ib-code"
319                         if test -d "$with_vib" -a -d "$VIBPATH"; then
320                                 AC_MSG_RESULT([yes])
321                         else
322                                 AC_MSG_RESULT([no])
323                                 AC_MSG_ERROR([No directory $VIBPATH])
324                         fi;;
325                 esac
326         ],[
327                 AC_MSG_RESULT([no])
328         ])
329 if test -z "$VIBPATH"; then
330         VIBNAL=""
331 else
332         VIBCPPFLAGS="-I${VIBPATH}/include -I${VIBPATH}/cm"
333         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
334         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
335         LB_LINUX_TRY_COMPILE([
336                 #include <linux/list.h>
337                 #include <asm/byteorder.h>
338                 #ifdef __BIG_ENDIAN
339                 # define CPU_BE 1
340                 # define CPU_LE 0
341                 #endif
342                 #ifdef __LITTLE_ENDIAN
343                 # define CPU_BE 0
344                 # define CPU_LE 1
345                 #endif
346                 #include <vverbs.h>
347                 #include <ib-cm.h>
348                 #include <ibat.h>
349         ],[
350                 vv_hca_h_t       kib_hca;
351                 vv_return_t      vvrc;
352                 cm_cep_handle_t  cep;
353                 ibat_arp_data_t  arp_data;
354                 ibat_stat_t      ibatrc;
355
356                 vvrc = vv_hca_open("ANY_HCA", NULL, &kib_hca);
357                 cep = cm_create_cep(cm_cep_transp_rc);
358                 ibatrc = ibat_get_ib_data((uint32_t)0, (uint32_t)0,
359                                           ibat_paths_primary, &arp_data,
360                                           (ibat_get_ib_data_reply_fn_t)NULL,
361                                           NULL, 0);
362                 return 0;
363         ],[
364                 VIBNAL="vibnal"
365         ],[
366                 AC_MSG_ERROR([can't compile vibnal with given path])
367         ])
368         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
369 fi
370 if test -n "$VIBNAL"; then
371         AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
372         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
373         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
374         LB_LINUX_TRY_COMPILE([
375                 #include <linux/list.h>
376                 #include <asm/byteorder.h>
377                 #ifdef __BIG_ENDIAN
378                 # define CPU_BE 1
379                 # define CPU_LE 0
380                 #endif
381                 #ifdef __LITTLE_ENDIAN
382                 # define CPU_BE 0
383                 # define CPU_LE 1
384                 #endif
385                 #include <vverbs.h>
386                 #include <ib-cm.h>
387                 #include <ibat.h>
388         ],[
389                 vv_scatgat_t  sg;
390
391                 return &sg.v_address[3] == NULL;
392         ],[
393                 AC_MSG_RESULT([yes])
394                 VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_VOIDSTAR_SGADDR=1"
395         ],[
396                 AC_MSG_RESULT([no])
397         ])
398         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
399 fi
400 AC_SUBST(VIBCPPFLAGS)
401 AC_SUBST(VIBNAL)
402 ])
403
404 #
405 # LP_CONFIG_RANAL
406 #
407 # check whether to use the RapidArray nal
408 #
409 AC_DEFUN([LP_CONFIG_RANAL],
410 [#### Rapid Array
411 AC_MSG_CHECKING([if RapidArray kernel headers are present])
412 # placeholder
413 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
414 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
415 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
416 LB_LINUX_TRY_COMPILE([
417         #include <linux/types.h>
418         #include <rapl.h>
419 ],[
420         RAP_RETURN          rc;
421         RAP_PVOID           dev_handle;
422
423         rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
424
425         return rc == RAP_SUCCESS ? 0 : 1;
426 ],[
427         AC_MSG_RESULT([yes])
428         RANAL="ranal"
429 ],[
430         AC_MSG_RESULT([no])
431         RANAL=""
432         RACPPFLAGS=""
433 ])
434 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
435 AC_SUBST(RACPPFLAGS)
436 AC_SUBST(RANAL)
437 ])
438
439 #
440 # LP_STRUCT_PAGE_LIST
441 #
442 # 2.6.4 no longer has page->list
443 #
444 AC_DEFUN([LP_STRUCT_PAGE_LIST],
445 [AC_MSG_CHECKING([if struct page has a list field])
446 LB_LINUX_TRY_COMPILE([
447         #include <linux/mm.h>
448 ],[
449         struct page page;
450         &page.list;
451 ],[
452         AC_MSG_RESULT([yes])
453         AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
454 ],[
455         AC_MSG_RESULT([no])
456 ])
457 ])
458
459 #
460 # LP_STRUCT_SIGHAND
461 #
462 # red hat 2.4 adds sighand to struct task_struct
463 #
464 AC_DEFUN([LP_STRUCT_SIGHAND],
465 [AC_MSG_CHECKING([if task_struct has a sighand field])
466 LB_LINUX_TRY_COMPILE([
467         #include <linux/sched.h>
468 ],[
469         struct task_struct p;
470         p.sighand = NULL;
471 ],[
472         AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
473         AC_MSG_RESULT([yes])
474 ],[
475         AC_MSG_RESULT([no])
476 ])
477 ])
478
479 #
480 # LP_FUNC_CPU_ONLINE
481 #
482 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
483 #
484 AC_DEFUN([LP_FUNC_CPU_ONLINE],
485 [AC_MSG_CHECKING([if kernel defines cpu_online()])
486 LB_LINUX_TRY_COMPILE([
487         #include <linux/sched.h>
488 ],[
489         cpu_online(0);
490 ],[
491         AC_MSG_RESULT([yes])
492         AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
493 ],[
494         AC_MSG_RESULT([no])
495 ])
496 ])
497
498 #
499 # LP_TYPE_CPUMASK_T
500 #
501 # same goes for cpumask_t
502 #
503 AC_DEFUN([LP_TYPE_CPUMASK_T],
504 [AC_MSG_CHECKING([if kernel defines cpumask_t])
505 LB_LINUX_TRY_COMPILE([
506         #include <linux/sched.h>
507 ],[
508         return sizeof (cpumask_t);
509 ],[
510         AC_MSG_RESULT([yes])
511         AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
512 ],[
513         AC_MSG_RESULT([no])
514 ])
515 ])
516
517 #
518 # LP_FUNC_SHOW_TASK
519 #
520 # we export show_task(), but not all kernels have it (yet)
521 #
522 AC_DEFUN([LP_FUNC_SHOW_TASK],
523 [AC_MSG_CHECKING([if kernel exports show_task])
524 have_show_task=0
525 for file in ksyms sched ; do
526         if grep -q "EXPORT_SYMBOL(show_task)" \
527                  "$LINUX/kernel/$file.c" 2>/dev/null ; then
528                 have_show_task=1
529                 break
530         fi
531 done
532 if test x$have_show_task = x1 ; then
533         AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
534         AC_MSG_RESULT([yes])
535 else
536         AC_MSG_RESULT([no])
537 fi
538 ])
539
540 #
541 # LP_PROG_LINUX
542 #
543 # Portals linux kernel checks
544 #
545 AC_DEFUN([LP_PROG_LINUX],
546 [LP_CHECK_GCC_VERSION
547
548 LP_CONFIG_ZEROCOPY
549 LP_CONFIG_AFFINITY
550 LP_CONFIG_QUADRICS
551 LP_CONFIG_GM
552 LP_CONFIG_OPENIB
553 LP_CONFIG_VIB
554 LP_CONFIG_IIB
555 LP_CONFIG_RANAL
556
557 LP_STRUCT_PAGE_LIST
558 LP_STRUCT_SIGHAND
559 LP_FUNC_CPU_ONLINE
560 LP_TYPE_CPUMASK_T
561 LP_FUNC_SHOW_TASK
562 ])
563
564 #
565 # LP_PROG_DARWIN
566 #
567 # Darwin checks
568 #
569 AC_DEFUN([LP_PROG_DARWIN],
570 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
571 ])
572
573 #
574 # LP_PATH_DEFAULTS
575 #
576 # default paths for installed files
577 #
578 AC_DEFUN([LP_PATH_DEFAULTS],
579 [
580 ])
581
582 #
583 # LP_CONFIGURE
584 #
585 # other configure checks
586 #
587 AC_DEFUN([LP_CONFIGURE],
588 [# portals/utils/portals.c
589 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h])
590 AC_CHECK_FUNCS([gethostbyname socket connect])
591
592 # portals/utils/debug.c
593 AC_CHECK_HEADERS([linux/version.h])
594
595 AC_CHECK_TYPE([spinlock_t],
596         [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
597         [],
598         [#include <linux/spinlock.h>])
599
600 # portals/utils/wirecheck.c
601 AC_CHECK_FUNCS([strnlen])
602
603 # --------  Check for required packages  --------------
604
605 LIBS_save="$LIBS"
606 LIBS="-lncurses $LIBS"
607 AC_CHECK_LIB([readline],[readline],[
608         LIBREADLINE="-lreadline -lncurses"
609         AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
610 ],[
611         LIBREADLINE=""
612 ])
613 LIBS="$LIBS_save"
614 AC_SUBST(LIBREADLINE)
615
616 AC_MSG_CHECKING([if efence debugging support is requested])
617 AC_ARG_ENABLE(efence,
618         AC_HELP_STRING([--enable-efence],
619                         [use efence library]),
620         [],[enable_efence='no'])
621 AC_MSG_RESULT([$enable_efence])
622 if test "$enable_efence" = "yes" ; then
623         LIBEFENCE="-lefence"
624         AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
625 else 
626         LIBEFENCE=""
627 fi
628 AC_SUBST(LIBEFENCE)
629
630 # -------- enable acceptor libwrap (TCP wrappers) support? -------
631 AC_MSG_CHECKING([if libwrap support is requested])
632 AC_ARG_ENABLE([libwrap],
633         AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
634         [case "${enableval}" in
635                 yes) enable_libwrap=yes ;;
636                 no) enable_libwrap=no ;;
637                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
638         esac],[enable_libwrap=no])
639 AC_MSG_RESULT([$enable_libwrap])
640 if test x$enable_libwrap = xyes ; then
641         LIBWRAP="-lwrap"
642         AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
643 else
644         LIBWRAP=""
645 fi
646 AC_SUBST(LIBWRAP)
647
648 # ----------------------------------------
649 # some tests for catamount-like systems
650 # ----------------------------------------
651 AC_ARG_ENABLE([sysio_init],
652         AC_HELP_STRING([--disable-sysio-init],
653                 [call sysio init functions when initializing liblustre]),
654         [],[enable_sysio_init=yes])
655 AC_MSG_CHECKING([whether to initialize libsysio])
656 AC_MSG_RESULT([$enable_sysio_init])
657 if test x$enable_sysio_init != xno ; then
658         AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
659 fi
660
661 AC_ARG_ENABLE([urandom],
662         AC_HELP_STRING([--disable-urandom],
663                 [disable use of /dev/urandom for liblustre]),
664         [],[enable_urandom=yes])
665 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
666 AC_MSG_RESULT([$enable_urandom])
667 if test x$enable_urandom != xno ; then
668         AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
669 fi
670
671 # -------- check for -lcap and -lpthread ----
672 if test x$enable_liblustre = xyes ; then
673         AC_CHECK_LIB([cap], [cap_get_proc],
674                 [
675                         CAP_LIBS="-lcap"
676                         AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
677                 ],
678                 [CAP_LIBS=""])
679         AC_SUBST(CAP_LIBS)
680         AC_CHECK_LIB([pthread], [pthread_create],
681                 [
682                         PTHREAD_LIBS="-lpthread"
683                         AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
684                 ],
685                 [PTHREAD_LIBS=""])
686         AC_SUBST(PTHREAD_LIBS)
687 fi
688 ])
689
690 #
691 # LP_CONDITIONALS
692 #
693 # AM_CONDITOINAL defines for portals
694 #
695 AC_DEFUN([LP_CONDITIONALS],
696 [AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
697 AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
698 AM_CONDITIONAL(BUILD_OPENIBNAL, test x$OPENIBNAL = "xopenibnal")
699 AM_CONDITIONAL(BUILD_IIBNAL, test x$IIBNAL = "xiibnal")
700 AM_CONDITIONAL(BUILD_VIBNAL, test x$VIBNAL = "xvibnal")
701 AM_CONDITIONAL(BUILD_RANAL, test x$RANAL = "xranal")
702 ])
703
704 #
705 # LP_CONFIG_FILES
706 #
707 # files that should be generated with AC_OUTPUT
708 #
709 AC_DEFUN([LP_CONFIG_FILES],
710 [AC_CONFIG_FILES([
711 portals/Kernelenv
712 portals/Makefile
713 portals/autoMakefile
714 portals/autoconf/Makefile
715 portals/doc/Makefile
716 portals/include/Makefile
717 portals/include/libcfs/Makefile
718 portals/include/libcfs/linux/Makefile
719 portals/include/portals/Makefile
720 portals/include/portals/linux/Makefile
721 portals/knals/Makefile
722 portals/knals/autoMakefile
723 portals/knals/gmnal/Makefile
724 portals/knals/gmnal/autoMakefile
725 portals/knals/openibnal/Makefile
726 portals/knals/openibnal/autoMakefile
727 portals/knals/iibnal/Makefile
728 portals/knals/iibnal/autoMakefile
729 portals/knals/vibnal/Makefile
730 portals/knals/vibnal/autoMakefile
731 portals/knals/lonal/Makefile
732 portals/knals/lonal/autoMakefile
733 portals/knals/qswnal/Makefile
734 portals/knals/qswnal/autoMakefile
735 portals/knals/ranal/Makefile
736 portals/knals/ranal/autoMakefile
737 portals/knals/socknal/Makefile
738 portals/knals/socknal/autoMakefile
739 portals/libcfs/Makefile
740 portals/libcfs/autoMakefile
741 portals/libcfs/linux/Makefile
742 portals/portals/Makefile
743 portals/portals/autoMakefile
744 portals/router/Makefile
745 portals/router/autoMakefile
746 portals/tests/Makefile
747 portals/tests/autoMakefile
748 portals/unals/Makefile
749 portals/utils/Makefile
750 ])
751 case $lb_target_os in
752         darwin)
753                 AC_CONFIG_FILES([
754 portals/include/libcfs/darwin/Makefile
755 portals/include/portals/darwin/Makefile
756 portals/libcfs/darwin/Makefile
757 ])
758                 ;;
759 esac
760 ])