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