Whamcloud - gitweb
b=b=6065
[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         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
372         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
373         AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
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         AC_MSG_CHECKING([if page_to_phys() must avoid sign extension])
399         LB_LINUX_TRY_COMPILE([
400                 #include <linux/kernel.h>
401                 #include <linux/mm.h>
402                 #include <linux/unistd.h>
403                 #include <asm/system.h>
404                 #include <asm/io.h>
405         ],[
406                 struct page p;
407
408                 switch (42) {
409                 case 0:
410                 case (sizeof(typeof(page_to_phys(&p))) < 8):
411                         break;
412                 }
413         ],[
414                 AC_MSG_RESULT([yes])
415                 VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_32BIT_PAGE2PHYS=1"
416         ],[
417                 AC_MSG_RESULT([no])
418         ])
419         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
420 fi
421 AC_SUBST(VIBCPPFLAGS)
422 AC_SUBST(VIBNAL)
423 ])
424
425 #
426 # LP_CONFIG_RANAL
427 #
428 # check whether to use the RapidArray nal
429 #
430 AC_DEFUN([LP_CONFIG_RANAL],
431 [#### Rapid Array
432 AC_MSG_CHECKING([if RapidArray kernel headers are present])
433 # placeholder
434 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
435 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
436 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
437 LB_LINUX_TRY_COMPILE([
438         #include <linux/types.h>
439         #include <rapl.h>
440 ],[
441         RAP_RETURN          rc;
442         RAP_PVOID           dev_handle;
443
444         rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
445
446         return rc == RAP_SUCCESS ? 0 : 1;
447 ],[
448         AC_MSG_RESULT([yes])
449         RANAL="ranal"
450 ],[
451         AC_MSG_RESULT([no])
452         RANAL=""
453         RACPPFLAGS=""
454 ])
455 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
456 AC_SUBST(RACPPFLAGS)
457 AC_SUBST(RANAL)
458 ])
459
460 #
461 # LP_STRUCT_PAGE_LIST
462 #
463 # 2.6.4 no longer has page->list
464 #
465 AC_DEFUN([LP_STRUCT_PAGE_LIST],
466 [AC_MSG_CHECKING([if struct page has a list field])
467 LB_LINUX_TRY_COMPILE([
468         #include <linux/mm.h>
469 ],[
470         struct page page;
471         &page.list;
472 ],[
473         AC_MSG_RESULT([yes])
474         AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
475 ],[
476         AC_MSG_RESULT([no])
477 ])
478 ])
479
480 #
481 # LP_STRUCT_SIGHAND
482 #
483 # red hat 2.4 adds sighand to struct task_struct
484 #
485 AC_DEFUN([LP_STRUCT_SIGHAND],
486 [AC_MSG_CHECKING([if task_struct has a sighand field])
487 LB_LINUX_TRY_COMPILE([
488         #include <linux/sched.h>
489 ],[
490         struct task_struct p;
491         p.sighand = NULL;
492 ],[
493         AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
494         AC_MSG_RESULT([yes])
495 ],[
496         AC_MSG_RESULT([no])
497 ])
498 ])
499
500 #
501 # LP_FUNC_CPU_ONLINE
502 #
503 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
504 #
505 AC_DEFUN([LP_FUNC_CPU_ONLINE],
506 [AC_MSG_CHECKING([if kernel defines cpu_online()])
507 LB_LINUX_TRY_COMPILE([
508         #include <linux/sched.h>
509 ],[
510         cpu_online(0);
511 ],[
512         AC_MSG_RESULT([yes])
513         AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
514 ],[
515         AC_MSG_RESULT([no])
516 ])
517 ])
518
519 #
520 # LP_TYPE_CPUMASK_T
521 #
522 # same goes for cpumask_t
523 #
524 AC_DEFUN([LP_TYPE_CPUMASK_T],
525 [AC_MSG_CHECKING([if kernel defines cpumask_t])
526 LB_LINUX_TRY_COMPILE([
527         #include <linux/sched.h>
528 ],[
529         return sizeof (cpumask_t);
530 ],[
531         AC_MSG_RESULT([yes])
532         AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
533 ],[
534         AC_MSG_RESULT([no])
535 ])
536 ])
537
538 #
539 # LP_FUNC_SHOW_TASK
540 #
541 # we export show_task(), but not all kernels have it (yet)
542 #
543 AC_DEFUN([LP_FUNC_SHOW_TASK],
544 [AC_MSG_CHECKING([if kernel exports show_task])
545 have_show_task=0
546 for file in ksyms sched ; do
547         if grep -q "EXPORT_SYMBOL(show_task)" \
548                  "$LINUX/kernel/$file.c" 2>/dev/null ; then
549                 have_show_task=1
550                 break
551         fi
552 done
553 if test x$have_show_task = x1 ; then
554         AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
555         AC_MSG_RESULT([yes])
556 else
557         AC_MSG_RESULT([no])
558 fi
559 ])
560
561 #
562 # LP_PROG_LINUX
563 #
564 # Portals linux kernel checks
565 #
566 AC_DEFUN([LP_PROG_LINUX],
567 [LP_CHECK_GCC_VERSION
568
569 LP_CONFIG_ZEROCOPY
570 LP_CONFIG_AFFINITY
571 LP_CONFIG_QUADRICS
572 LP_CONFIG_GM
573 LP_CONFIG_OPENIB
574 LP_CONFIG_VIB
575 LP_CONFIG_IIB
576 LP_CONFIG_RANAL
577
578 LP_STRUCT_PAGE_LIST
579 LP_STRUCT_SIGHAND
580 LP_FUNC_CPU_ONLINE
581 LP_TYPE_CPUMASK_T
582 LP_FUNC_SHOW_TASK
583 ])
584
585 #
586 # LP_PROG_DARWIN
587 #
588 # Darwin checks
589 #
590 AC_DEFUN([LP_PROG_DARWIN],
591 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
592 ])
593
594 #
595 # LP_PATH_DEFAULTS
596 #
597 # default paths for installed files
598 #
599 AC_DEFUN([LP_PATH_DEFAULTS],
600 [
601 ])
602
603 #
604 # LP_CONFIGURE
605 #
606 # other configure checks
607 #
608 AC_DEFUN([LP_CONFIGURE],
609 [# portals/utils/portals.c
610 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
611 AC_CHECK_FUNCS([gethostbyname socket connect])
612
613 # portals/utils/debug.c
614 AC_CHECK_HEADERS([linux/version.h])
615
616 AC_CHECK_TYPE([spinlock_t],
617         [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
618         [],
619         [#include <linux/spinlock.h>])
620
621 # portals/utils/wirecheck.c
622 AC_CHECK_FUNCS([strnlen])
623
624 # --------  Check for required packages  --------------
625
626 LIBS_save="$LIBS"
627 LIBS="-lncurses $LIBS"
628 AC_CHECK_LIB([readline],[readline],[
629         LIBREADLINE="-lreadline -lncurses"
630         AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
631 ],[
632         LIBREADLINE=""
633 ])
634 LIBS="$LIBS_save"
635 AC_SUBST(LIBREADLINE)
636
637 AC_MSG_CHECKING([if efence debugging support is requested])
638 AC_ARG_ENABLE(efence,
639         AC_HELP_STRING([--enable-efence],
640                         [use efence library]),
641         [],[enable_efence='no'])
642 AC_MSG_RESULT([$enable_efence])
643 if test "$enable_efence" = "yes" ; then
644         LIBEFENCE="-lefence"
645         AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
646 else 
647         LIBEFENCE=""
648 fi
649 AC_SUBST(LIBEFENCE)
650
651 # -------- enable acceptor libwrap (TCP wrappers) support? -------
652 AC_MSG_CHECKING([if libwrap support is requested])
653 AC_ARG_ENABLE([libwrap],
654         AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
655         [case "${enableval}" in
656                 yes) enable_libwrap=yes ;;
657                 no) enable_libwrap=no ;;
658                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
659         esac],[enable_libwrap=no])
660 AC_MSG_RESULT([$enable_libwrap])
661 if test x$enable_libwrap = xyes ; then
662         LIBWRAP="-lwrap"
663         AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
664 else
665         LIBWRAP=""
666 fi
667 AC_SUBST(LIBWRAP)
668
669 # ----------------------------------------
670 # some tests for catamount-like systems
671 # ----------------------------------------
672 AC_ARG_ENABLE([sysio_init],
673         AC_HELP_STRING([--disable-sysio-init],
674                 [call sysio init functions when initializing liblustre]),
675         [],[enable_sysio_init=yes])
676 AC_MSG_CHECKING([whether to initialize libsysio])
677 AC_MSG_RESULT([$enable_sysio_init])
678 if test x$enable_sysio_init != xno ; then
679         AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
680 fi
681
682 AC_ARG_ENABLE([urandom],
683         AC_HELP_STRING([--disable-urandom],
684                 [disable use of /dev/urandom for liblustre]),
685         [],[enable_urandom=yes])
686 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
687 AC_MSG_RESULT([$enable_urandom])
688 if test x$enable_urandom != xno ; then
689         AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
690 fi
691
692 # -------- check for -lcap and -lpthread ----
693 if test x$enable_liblustre = xyes ; then
694         AC_CHECK_LIB([cap], [cap_get_proc],
695                 [
696                         CAP_LIBS="-lcap"
697                         AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
698                 ],
699                 [CAP_LIBS=""])
700         AC_SUBST(CAP_LIBS)
701         AC_CHECK_LIB([pthread], [pthread_create],
702                 [
703                         PTHREAD_LIBS="-lpthread"
704                         AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
705                 ],
706                 [PTHREAD_LIBS=""])
707         AC_SUBST(PTHREAD_LIBS)
708 fi
709 ])
710
711 #
712 # LP_CONDITIONALS
713 #
714 # AM_CONDITOINAL defines for portals
715 #
716 AC_DEFUN([LP_CONDITIONALS],
717 [AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
718 AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
719 AM_CONDITIONAL(BUILD_OPENIBNAL, test x$OPENIBNAL = "xopenibnal")
720 AM_CONDITIONAL(BUILD_IIBNAL, test x$IIBNAL = "xiibnal")
721 AM_CONDITIONAL(BUILD_VIBNAL, test x$VIBNAL = "xvibnal")
722 AM_CONDITIONAL(BUILD_RANAL, test x$RANAL = "xranal")
723 ])
724
725 #
726 # LP_CONFIG_FILES
727 #
728 # files that should be generated with AC_OUTPUT
729 #
730 AC_DEFUN([LP_CONFIG_FILES],
731 [AC_CONFIG_FILES([
732 portals/Kernelenv
733 portals/Makefile
734 portals/autoMakefile
735 portals/autoconf/Makefile
736 portals/doc/Makefile
737 portals/include/Makefile
738 portals/include/libcfs/Makefile
739 portals/include/libcfs/linux/Makefile
740 portals/include/portals/Makefile
741 portals/include/portals/linux/Makefile
742 portals/knals/Makefile
743 portals/knals/autoMakefile
744 portals/knals/gmnal/Makefile
745 portals/knals/gmnal/autoMakefile
746 portals/knals/openibnal/Makefile
747 portals/knals/openibnal/autoMakefile
748 portals/knals/iibnal/Makefile
749 portals/knals/iibnal/autoMakefile
750 portals/knals/vibnal/Makefile
751 portals/knals/vibnal/autoMakefile
752 portals/knals/lonal/Makefile
753 portals/knals/lonal/autoMakefile
754 portals/knals/qswnal/Makefile
755 portals/knals/qswnal/autoMakefile
756 portals/knals/ranal/Makefile
757 portals/knals/ranal/autoMakefile
758 portals/knals/socknal/Makefile
759 portals/knals/socknal/autoMakefile
760 portals/libcfs/Makefile
761 portals/libcfs/autoMakefile
762 portals/libcfs/linux/Makefile
763 portals/portals/Makefile
764 portals/portals/autoMakefile
765 portals/router/Makefile
766 portals/router/autoMakefile
767 portals/tests/Makefile
768 portals/tests/autoMakefile
769 portals/unals/Makefile
770 portals/utils/Makefile
771 ])
772 case $lb_target_os in
773         darwin)
774                 AC_CONFIG_FILES([
775 portals/include/libcfs/darwin/Makefile
776 portals/include/portals/darwin/Makefile
777 portals/libcfs/darwin/Makefile
778 ])
779                 ;;
780 esac
781 ])