Whamcloud - gitweb
* fixed openib comment typo
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
1 #
2 # LP_CONFIG_ZEROCOPY
3 #
4 # check if zerocopy is available/wanted
5 #
6 AC_DEFUN([LP_CONFIG_ZEROCOPY],
7 [AC_MSG_CHECKING([for zero-copy TCP support])
8 AC_ARG_ENABLE([zerocopy],
9         AC_HELP_STRING([--disable-zerocopy],
10                        [disable socknal zerocopy]),
11         [],[enable_zerocopy='yes'])
12 if test x$enable_zerocopy = xno ; then
13         AC_MSG_RESULT([no (by request)])
14 else
15         ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
16         if test "$ZCCD" != 0 ; then
17                 AC_DEFINE(SOCKNAL_ZC, 1, [use zero-copy TCP])
18                 AC_MSG_RESULT(yes)
19         else
20                 AC_MSG_RESULT([no (no kernel support)])
21         fi
22 fi
23 ])
24
25 #
26 # LP_CONFIG_AFFINITY
27 #
28 # check if cpu affinity is available/wanted
29 #
30 AC_DEFUN([LP_CONFIG_AFFINITY],
31 [AC_ARG_ENABLE([affinity],
32         AC_HELP_STRING([--disable-affinity],
33                        [disable process/irq affinity]),
34         [],[enable_affinity='yes'])
35
36 AC_MSG_CHECKING([for CPU affinity support])
37 if test x$enable_affinity = xno ; then
38         AC_MSG_RESULT([no (by request)])
39 else
40         LB_LINUX_TRY_COMPILE([
41                 #include <linux/sched.h>
42         ],[
43                 struct task_struct t;
44                 #ifdef CPU_ARRAY_SIZE
45                 cpumask_t m;
46                 #else
47                 unsigned long m;
48                 #endif
49                 set_cpus_allowed(&t, m);
50         ],[
51                 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
52                 AC_MSG_RESULT([yes])
53         ],[
54                 AC_MSG_RESULT([no (no kernel support)])
55         ])
56 fi
57 ])
58
59 #
60 # LP_CONFIG_QUADRICS
61 #
62 # check if quadrics support is in this kernel
63 #
64 AC_DEFUN([LP_CONFIG_QUADRICS],
65 [AC_MSG_CHECKING([if quadrics kernel headers are present])
66 if test -d $LINUX/drivers/net/qsnet ; then
67         AC_MSG_RESULT([yes])
68         QSWNAL="qswnal"
69         AC_MSG_CHECKING([for multirail EKC])
70         if test -f $LINUX/include/elan/epcomms.h; then
71                 AC_MSG_RESULT([supported])
72                 QSWCPPFLAGS="-DMULTIRAIL_EKC=1"
73         else
74                 AC_MSG_RESULT([not supported])
75                 if test -d $LINUX/drivers/net/qsnet/include; then
76                         QSWCPPFLAGS="-I$LINUX/drivers/net/qsnet/include"
77                 else
78                         QSWCPPFLAGS="-I$LINUX/include/linux"
79                 fi
80         fi
81 else
82         AC_MSG_RESULT([no])
83         QSWNAL=""
84         QSWCPPFLAGS=""
85 fi
86 AC_SUBST(QSWCPPFLAGS)
87 AC_SUBST(QSWNAL)
88 ])
89
90 #
91 # LP_CONFIG_GM
92 #
93 # check if GM support is available
94 #
95 AC_DEFUN([LP_CONFIG_GM],
96 [AC_MSG_CHECKING([if gm support was requested])
97 AC_ARG_WITH([gm],
98         AC_HELP_STRING([--with-gm=path],
99                        [build gmnal against path]),
100         [
101                 case $with_gm in 
102                         yes)
103                                 AC_MSG_RESULT([yes])
104                                 GMCPPFLAGS="-I/usr/local/gm/include"
105                                 GMNAL="gmnal"
106                                 ;;
107                         no)
108                                 AC_MSG_RESULT([no])
109                                 GMCPPFLAGS=""
110                                 GMNAL=""
111                                 ;;
112                         *)
113                                 AC_MSG_RESULT([yes])
114                                 GMCPPFLAGS="-I$with_gm/include -I$with_gm/drivers -I$with_gm/drivers/linux/gm"
115                                 GMNAL="gmnal"
116                                 ;;
117                 esac
118         ],[
119                 AC_MSG_RESULT([no])
120                 GMCPPFLAGS=""
121                 GMNAL=""
122         ])
123 AC_SUBST(GMCPPFLAGS)
124 AC_SUBST(GMNAL)
125 ])
126
127 #
128 # LP_CONFIG_OPENIB
129 #
130 # check for OpenIB in the kernel
131 AC_DEFUN([LP_CONFIG_OPENIB],[
132 AC_MSG_CHECKING([whether to enable OpenIB support])
133 # set default
134 OPENIBPATH="$LINUX/drivers/infiniband"
135 AC_ARG_WITH([openib],
136         AC_HELP_STRING([--with-openib=path],
137                        [build openibnal against path]),
138         [
139                 case $with_openib in
140                 yes)    ENABLEOPENIB=2
141                         ;;
142                 no)     ENABLEOPENIB=0
143                         ;;
144                 *)      OPENIBPATH="$with_openib"
145                         ENABLEOPENIB=3
146                         ;;
147                 esac
148         ],[
149                 ENABLEOPENIB=1
150         ])
151 if test $ENABLEOPENIB -eq 0; then
152         AC_MSG_RESULT([disabled])
153 elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
154                -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
155         AC_MSG_RESULT([no])
156         case $ENABLEOPENIB in
157         1) ;;
158         2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
159         3) AC_MSG_ERROR([bad --with-openib path]);;
160         *) AC_MSG_ERROR([internal error]);;
161         esac
162 else
163         case $ENABLEOPENIB in
164         1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
165         3)   OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
166         *)   AC_MSG_RESULT([no])
167              AC_MSG_ERROR([internal error]);;
168         esac
169         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
170         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
171         LB_LINUX_TRY_COMPILE([
172                 #include <ts_ib_core.h>
173                 #include <ts_ib_sa_client.h>
174         ],[
175                 struct ib_device_properties props;
176                 struct ib_common_attrib_services svc;
177                 return 0;
178         ],[
179                 AC_MSG_RESULT([yes])
180                 OPENIBNAL="openibnal"
181         ],[
182                 AC_MSG_RESULT([no])
183                 case $ENABLEOPENIB in
184                 1) ;;
185                 2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
186                 3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
187                 *) AC_MSG_ERROR([internal error]);;
188                 esac
189                 OPENIBNAL=""
190                 OPENIBCPPFLAGS=""
191         ])
192         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
193 fi
194 AC_SUBST(OPENIBCPPFLAGS)
195 AC_SUBST(OPENIBNAL)
196 ])
197
198 #
199 # LP_CONFIG_IIB
200 #
201 # check for infinicon infiniband support
202 #
203 AC_DEFUN([LP_CONFIG_IIB],
204 [AC_MSG_CHECKING([if Infinicon IB kernel headers are present])
205 # for how the only infinicon ib build has headers in /usr/include/iba
206 IIBCPPFLAGS="-I/usr/include -DIN_TREE_BUILD"
207 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
208 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
209 LB_LINUX_TRY_COMPILE([
210         #include <linux/iba/ibt.h>
211 ],[
212         IBT_INTERFACE_UNION interfaces;
213         FSTATUS             rc;
214
215          rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
216                                        &interfaces);
217
218         return rc == FSUCCESS ? 0 : 1;
219 ],[
220         AC_MSG_RESULT([yes])
221         IIBNAL="iibnal"
222 ],[
223         AC_MSG_RESULT([no])
224         IIBNAL=""
225         IIBCPPFLAGS=""
226 ])
227 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
228 AC_SUBST(IIBCPPFLAGS)
229 AC_SUBST(IIBNAL)
230 ])
231
232 #
233 # LP_CONFIG_VIB
234 #
235 # check for Voltaire infiniband support
236 #
237 AC_DEFUN([LP_CONFIG_VIB],
238 [AC_MSG_CHECKING([if Voltaire IB kernel headers are present])
239 VIBCPPFLAGS="-I/usr/local/include/ibhost-kdevel -DCPU_BE=0 -DCPU_LE=1 -DGSI_PASS_PORT_NUM"
240 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
241 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
242 LB_LINUX_TRY_COMPILE([
243         #include <linux/list.h>
244         #include <vverbs.h>
245 ],[
246         vv_hca_h_t     kib_hca;
247         vv_return_t    retval;
248
249         retval = vv_hca_open("ANY_HCA", NULL, &kib_hca);
250
251         return retval == vv_return_ok ? 0 : 1;
252 ],[
253         AC_MSG_RESULT([yes])
254         VIBNAL="vibnal"
255 ],[
256         AC_MSG_RESULT([no])
257         VIBNAL=""
258         VIBCPPFLAGS=""
259 ])
260 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
261 AC_SUBST(VIBCPPFLAGS)
262 AC_SUBST(VIBNAL)
263 ])
264
265 #
266 # LP_CONFIG_RANAL
267 #
268 # check whether to use the RapidArray nal
269 #
270 AC_DEFUN([LP_CONFIG_RANAL],
271 [#### Rapid Array
272 AC_MSG_CHECKING([if RapidArray kernel headers are present])
273 # placeholder
274 RACPPFLAGS="-I/tmp"
275 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
276 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
277 LB_LINUX_TRY_COMPILE([
278         #include <linux/types.h>
279         #include <rapl.h>
280 ],[
281         RAP_RETURN          rc;
282         RAP_PVOID           dev_handle;
283
284         rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
285
286         return rc == RAP_SUCCESS ? 0 : 1;
287 ],[
288         AC_MSG_RESULT([yes])
289         RANAL="ranal"
290 ],[
291         AC_MSG_RESULT([no])
292         RANAL=""
293         RACPPFLAGS=""
294 ])
295 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
296 AC_SUBST(RACPPFLAGS)
297 AC_SUBST(RANAL)
298 ])
299
300 #
301 # LP_STRUCT_PAGE_LIST
302 #
303 # 2.6.4 no longer has page->list
304 #
305 AC_DEFUN([LP_STRUCT_PAGE_LIST],
306 [AC_MSG_CHECKING([if struct page has a list field])
307 LB_LINUX_TRY_COMPILE([
308         #include <linux/mm.h>
309 ],[
310         struct page page;
311         &page.list;
312 ],[
313         AC_MSG_RESULT([yes])
314         AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
315 ],[
316         AC_MSG_RESULT([no])
317 ])
318 ])
319
320 #
321 # LP_STRUCT_SIGHAND
322 #
323 # red hat 2.4 adds sighand to struct task_struct
324 #
325 AC_DEFUN([LP_STRUCT_SIGHAND],
326 [AC_MSG_CHECKING([if task_struct has a sighand field])
327 LB_LINUX_TRY_COMPILE([
328         #include <linux/sched.h>
329 ],[
330         struct task_struct p;
331         p.sighand = NULL;
332 ],[
333         AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
334         AC_MSG_RESULT([yes])
335 ],[
336         AC_MSG_RESULT([no])
337 ])
338 ])
339
340 #
341 # LP_FUNC_CPU_ONLINE
342 #
343 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
344 #
345 AC_DEFUN([LP_FUNC_CPU_ONLINE],
346 [AC_MSG_CHECKING([if kernel defines cpu_online()])
347 LB_LINUX_TRY_COMPILE([
348         #include <linux/sched.h>
349 ],[
350         cpu_online(0);
351 ],[
352         AC_MSG_RESULT([yes])
353         AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
354 ],[
355         AC_MSG_RESULT([no])
356 ])
357 ])
358
359 #
360 # LP_TYPE_CPUMASK_T
361 #
362 # same goes for cpumask_t
363 #
364 AC_DEFUN([LP_TYPE_CPUMASK_T],
365 [AC_MSG_CHECKING([if kernel defines cpumask_t])
366 LB_LINUX_TRY_COMPILE([
367         #include <linux/sched.h>
368 ],[
369         return sizeof (cpumask_t);
370 ],[
371         AC_MSG_RESULT([yes])
372         AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
373 ],[
374         AC_MSG_RESULT([no])
375 ])
376 ])
377
378 #
379 # LP_FUNC_SHOW_TASK
380 #
381 # we export show_task(), but not all kernels have it (yet)
382 #
383 AC_DEFUN([LP_FUNC_SHOW_TASK],
384 [AC_MSG_CHECKING([if kernel exports show_task])
385 have_show_task=0
386 for file in ksyms sched ; do
387         if grep -q "EXPORT_SYMBOL(show_task)" \
388                  "$LINUX/kernel/$file.c" 2>/dev/null ; then
389                 have_show_task=1
390                 break
391         fi
392 done
393 if test x$have_show_task = x1 ; then
394         AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
395         AC_MSG_RESULT([yes])
396 else
397         AC_MSG_RESULT([no])
398 fi
399 ])
400
401 #
402 # LP_PROG_LINUX
403 #
404 # Portals linux kernel checks
405 #
406 AC_DEFUN([LP_PROG_LINUX],
407 [LP_CONFIG_ZEROCOPY
408 LP_CONFIG_AFFINITY
409 LP_CONFIG_QUADRICS
410 LP_CONFIG_GM
411 LP_CONFIG_OPENIB
412 LP_CONFIG_IIB
413 LP_CONFIG_VIB
414 LP_CONFIG_RANAL
415
416 LP_STRUCT_PAGE_LIST
417 LP_STRUCT_SIGHAND
418 LP_FUNC_CPU_ONLINE
419 LP_TYPE_CPUMASK_T
420 LP_FUNC_SHOW_TASK
421 ])
422
423 #
424 # LP_PATH_DEFAULTS
425 #
426 # default paths for installed files
427 #
428 AC_DEFUN([LP_PATH_DEFAULTS],
429 [
430 ])
431
432 #
433 # LP_CONFIGURE
434 #
435 # other configure checks
436 #
437 AC_DEFUN([LP_CONFIGURE],
438 [# portals/utils/portals.c
439 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h])
440 AC_CHECK_FUNCS([gethostbyname socket connect])
441
442 # portals/utils/debug.c
443 AC_CHECK_HEADERS([linux/version.h])
444
445 AC_CHECK_TYPE([spinlock_t],
446         [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
447         [],
448         [#include <linux/spinlock.h>])
449
450 # --------  Check for required packages  --------------
451
452 # this doesn't seem to work on older autoconf
453 # AC_CHECK_LIB(readline, readline,,)
454 AC_MSG_CHECKING([for readline support])
455 AC_ARG_ENABLE(readline,
456         AC_HELP_STRING([--disable-readline],
457                         [do not use readline library]),
458         [],[enable_readline='yes'])
459 AC_MSG_RESULT([$enable_readline]) 
460 if test x$enable_readline = xyes ; then
461         LIBREADLINE="-lreadline -lncurses"
462         AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
463 else 
464         LIBREADLINE=""
465 fi
466 AC_SUBST(LIBREADLINE)
467
468 AC_MSG_CHECKING([if efence debugging support is requested])
469 AC_ARG_ENABLE(efence,
470         AC_HELP_STRING([--enable-efence],
471                         [use efence library]),
472         [],[enable_efence='no'])
473 AC_MSG_RESULT([$enable_efence])
474 if test "$enable_efence" = "yes" ; then
475         LIBEFENCE="-lefence"
476         AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
477 else 
478         LIBEFENCE=""
479 fi
480 AC_SUBST(LIBEFENCE)
481
482 # -------- enable acceptor libwrap (TCP wrappers) support? -------
483 AC_MSG_CHECKING([if libwrap support is requested])
484 AC_ARG_ENABLE([libwrap],
485         AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
486         [case "${enableval}" in
487                 yes) enable_libwrap=yes ;;
488                 no) enable_libwrap=no ;;
489                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
490         esac],[enable_libwrap=no])
491 AC_MSG_RESULT([$enable_libwrap])
492 if test x$enable_libwrap = xyes ; then
493         LIBWRAP="-lwrap"
494         AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
495 else
496         LIBWRAP=""
497 fi
498 AC_SUBST(LIBWRAP)
499
500 # ----------------------------------------
501 # some tests for catamount-like systems
502 # ----------------------------------------
503 AC_ARG_ENABLE([sysio_init],
504         AC_HELP_STRING([--disable-sysio-init],
505                 [call sysio init functions when initializing liblustre]),
506         [],[enable_sysio_init=yes])
507 AC_MSG_CHECKING([whether to initialize libsysio])
508 AC_MSG_RESULT([$enable_sysio_init])
509 if test x$enable_sysio_init != xno ; then
510         AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
511 fi
512
513 AC_ARG_ENABLE([urandom],
514         AC_HELP_STRING([--disable-urandom],
515                 [disable use of /dev/urandom for liblustre]),
516         [],[enable_urandom=yes])
517 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
518 AC_MSG_RESULT([$enable_urandom])
519 if test x$enable_urandom != xno ; then
520         AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
521 fi
522
523 # -------- check for -lcap and -lpthread ----
524 if test x$enable_liblustre = xyes ; then
525         AC_CHECK_LIB([cap], [cap_get_proc],
526                 [
527                         CAP_LIBS="-lcap"
528                         AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
529                 ],
530                 [CAP_LIBS=""])
531         AC_SUBST(CAP_LIBS)
532         AC_CHECK_LIB([pthread], [pthread_create],
533                 [
534                         PTHREAD_LIBS="-lpthread"
535                         AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
536                 ],
537                 [PTHREAD_LIBS=""])
538         AC_SUBST(PTHREAD_LIBS)
539 fi
540 ])
541
542 #
543 # LP_CONDITIONALS
544 #
545 # AM_CONDITOINAL defines for portals
546 #
547 AC_DEFUN([LP_CONDITIONALS],
548 [AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
549 AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
550 AM_CONDITIONAL(BUILD_OPENIBNAL, test x$OPENIBNAL = "xopenibnal")
551 AM_CONDITIONAL(BUILD_IIBNAL, test x$IIBNAL = "xiibnal")
552 AM_CONDITIONAL(BUILD_VIBNAL, test x$VIBNAL = "xvibnal")
553 AM_CONDITIONAL(BUILD_RANAL, test x$RANAL = "xranal")
554 ])
555
556 #
557 # LP_CONFIG_FILES
558 #
559 # files that should be generated with AC_OUTPUT
560 #
561 AC_DEFUN([LP_CONFIG_FILES],
562 [AC_CONFIG_FILES([
563 portals/Kernelenv
564 portals/Makefile
565 portals/autoMakefile
566 portals/autoconf/Makefile
567 portals/doc/Makefile
568 portals/include/Makefile
569 portals/include/linux/Makefile
570 portals/include/portals/Makefile
571 portals/knals/Makefile
572 portals/knals/autoMakefile
573 portals/knals/gmnal/Makefile
574 portals/knals/gmnal/autoMakefile
575 portals/knals/openibnal/Makefile
576 portals/knals/openibnal/autoMakefile
577 portals/knals/iibnal/Makefile
578 portals/knals/iibnal/autoMakefile
579 portals/knals/vibnal/Makefile
580 portals/knals/vibnal/autoMakefile
581 portals/knals/lonal/Makefile
582 portals/knals/lonal/autoMakefile
583 portals/knals/qswnal/Makefile
584 portals/knals/qswnal/autoMakefile
585 portals/knals/ranal/Makefile
586 portals/knals/ranal/autoMakefile
587 portals/knals/socknal/Makefile
588 portals/knals/socknal/autoMakefile
589 portals/libcfs/Makefile
590 portals/libcfs/autoMakefile
591 portals/portals/Makefile
592 portals/portals/autoMakefile
593 portals/router/Makefile
594 portals/router/autoMakefile
595 portals/tests/Makefile
596 portals/tests/autoMakefile
597 portals/unals/Makefile
598 portals/utils/Makefile
599 ])
600 ])