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