Whamcloud - gitweb
0cb49a2923d91109be8671b6dcb71d75e0fb9111
[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 infiniband 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([if OpenIB kernel headers are present])
133 OPENIBCPPFLAGS="-I$LINUX/drivers/infiniband/include -DIN_TREE_BUILD"
134 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
135 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
136 LB_LINUX_TRY_COMPILE(
137         [
138                 #include <ts_ib_core.h>
139         ],[
140                 struct ib_device_properties props;
141                 return 0;
142         ],[
143                 AC_MSG_RESULT([yes])
144                 OPENIBNAL="openibnal"
145         ],[
146                 AC_MSG_RESULT([no])
147                 OPENIBNAL=""
148                 OPENIBCPPFLAGS=""
149         ])
150 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
151 AC_SUBST(OPENIBCPPFLAGS)
152 AC_SUBST(OPENIBNAL)
153 ])
154
155 #
156 # LP_CONFIG_IIB
157 #
158 # check for infinicon infiniband support
159 #
160 AC_DEFUN([LP_CONFIG_IIB],
161 [AC_MSG_CHECKING([if Infinicon IB kernel headers are present])
162 # for how the only infinicon ib build has headers in /usr/include/iba
163 IIBCPPFLAGS="-I/usr/include -DIN_TREE_BUILD"
164 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
165 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
166 LB_LINUX_TRY_COMPILE([
167         #include <linux/iba/ibt.h>
168 ],[
169         IBT_INTERFACE_UNION interfaces;
170         FSTATUS             rc;
171
172          rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
173                                        &interfaces);
174
175         return rc == FSUCCESS ? 0 : 1;
176 ],[
177         AC_MSG_RESULT([yes])
178         IIBNAL="iibnal"
179 ],[
180         AC_MSG_RESULT([no])
181         IIBNAL=""
182         IIBCPPFLAGS=""
183 ])
184 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
185 AC_SUBST(IIBCPPFLAGS)
186 AC_SUBST(IIBNAL)
187 ])
188
189 #
190 # LP_STRUCT_PAGE_LIST
191 #
192 # 2.6.4 no longer has page->list
193 #
194 AC_DEFUN([LP_STRUCT_PAGE_LIST],
195 [AC_MSG_CHECKING([if struct page has a list field])
196 LB_LINUX_TRY_COMPILE([
197         #include <linux/mm.h>
198 ],[
199         struct page page;
200         &page.list;
201 ],[
202         AC_MSG_RESULT([yes])
203         AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
204 ],[
205         AC_MSG_RESULT([no])
206 ])
207 ])
208
209 #
210 # LP_STRUCT_SIGHAND
211 #
212 # red hat 2.4 adds sighand to struct task_struct
213 #
214 AC_DEFUN([LP_STRUCT_SIGHAND],
215 [AC_MSG_CHECKING([if task_struct has a sighand field])
216 LB_LINUX_TRY_COMPILE([
217         #include <linux/sched.h>
218 ],[
219         struct task_struct p;
220         p.sighand = NULL;
221 ],[
222         AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
223         AC_MSG_RESULT([yes])
224 ],[
225         AC_MSG_RESULT([no])
226 ])
227 ])
228
229 #
230 # LP_FUNC_CPU_ONLINE
231 #
232 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
233 #
234 AC_DEFUN([LP_FUNC_CPU_ONLINE],
235 [AC_MSG_CHECKING([if kernel defines cpu_online()])
236 LB_LINUX_TRY_COMPILE([
237         #include <linux/sched.h>
238 ],[
239         cpu_online(0);
240 ],[
241         AC_MSG_RESULT([yes])
242         AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
243 ],[
244         AC_MSG_RESULT([no])
245 ])
246 ])
247
248 #
249 # LP_TYPE_CPUMASK_T
250 #
251 # same goes for cpumask_t
252 #
253 AC_DEFUN([LP_TYPE_CPUMASK_T],
254 [AC_MSG_CHECKING([if kernel defines cpumask_t])
255 LB_LINUX_TRY_COMPILE([
256         #include <linux/sched.h>
257 ],[
258         return sizeof (cpumask_t);
259 ],[
260         AC_MSG_RESULT([yes])
261         AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
262 ],[
263         AC_MSG_RESULT([no])
264 ])
265 ])
266
267 #
268 # LP_FUNC_SHOW_TASK
269 #
270 # we export show_task(), but not all kernels have it (yet)
271 #
272 AC_DEFUN([LP_FUNC_SHOW_TASK],
273 [AC_MSG_CHECKING([if kernel exports show_task])
274 have_show_task=0
275 for file in ksyms sched ; do
276         if grep -q "EXPORT_SYMBOL(show_task)" \
277                  "$LINUX/kernel/$file.c" 2>/dev/null ; then
278                 have_show_task=1
279                 break
280         fi
281 done
282 if test x$have_show_task = x1 ; then
283         AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
284         AC_MSG_RESULT([yes])
285 else
286         AC_MSG_RESULT([no])
287 fi
288 ])
289
290 #
291 # LP_PROG_LINUX
292 #
293 # Portals linux kernel checks
294 #
295 AC_DEFUN([LP_PROG_LINUX],
296 [LP_CONFIG_ZEROCOPY
297 LP_CONFIG_AFFINITY
298 LP_CONFIG_QUADRICS
299 LP_CONFIG_GM
300 if test $linux25 = 'no' ; then
301         LP_CONFIG_OPENIB
302 fi
303 LP_CONFIG_IIB
304
305 LP_STRUCT_PAGE_LIST
306 LP_STRUCT_SIGHAND
307 LP_FUNC_CPU_ONLINE
308 LP_TYPE_CPUMASK_T
309 LP_FUNC_SHOW_TASK
310 ])
311
312 #
313 # LP_PATH_DEFAULTS
314 #
315 # default paths for installed files
316 #
317 AC_DEFUN([LP_PATH_DEFAULTS],
318 [
319 ])
320
321 #
322 # LP_CONFIGURE
323 #
324 # other configure checks
325 #
326 AC_DEFUN([LP_CONFIGURE],
327 [# portals/utils/portals.c
328 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h])
329 AC_CHECK_FUNCS([gethostbyname socket connect])
330
331 # portals/utils/debug.c
332 AC_CHECK_HEADERS([linux/version.h])
333
334 AC_CHECK_TYPE([spinlock_t],
335         [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
336         [],
337         [#include <linux/spinlock.h>])
338
339 # --------  Check for required packages  --------------
340
341 # this doesn't seem to work on older autoconf
342 # AC_CHECK_LIB(readline, readline,,)
343 AC_MSG_CHECKING([for readline support])
344 AC_ARG_ENABLE(readline,
345         AC_HELP_STRING([--disable-readline],
346                         [do not use readline library]),
347         [],[enable_readline='yes'])
348 AC_MSG_RESULT([$enable_readline]) 
349 if test x$enable_readline = xyes ; then
350         LIBREADLINE="-lreadline -lncurses"
351         AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
352 else 
353         LIBREADLINE=""
354 fi
355 AC_SUBST(LIBREADLINE)
356
357 AC_MSG_CHECKING([if efence debugging support is requested])
358 AC_ARG_ENABLE(efence,
359         AC_HELP_STRING([--enable-efence],
360                         [use efence library]),
361         [],[enable_efence='no'])
362 AC_MSG_RESULT([$enable_efence])
363 if test "$enable_efence" = "yes" ; then
364         LIBEFENCE="-lefence"
365         AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
366 else 
367         LIBEFENCE=""
368 fi
369 AC_SUBST(LIBEFENCE)
370
371 # -------- enable acceptor libwrap (TCP wrappers) support? -------
372 AC_MSG_CHECKING([if libwrap support is requested])
373 AC_ARG_ENABLE([libwrap],
374         AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
375         [case "${enableval}" in
376                 yes) enable_libwrap=yes ;;
377                 no) enable_libwrap=no ;;
378                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
379         esac],[enable_libwrap=no])
380 AC_MSG_RESULT([$enable_libwrap])
381 if test x$enable_libwrap = xyes ; then
382         LIBWRAP="-lwrap"
383         AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
384 else
385         LIBWRAP=""
386 fi
387 AC_SUBST(LIBWRAP)
388
389 # ----------------------------------------
390 # some tests for catamount-like systems
391 # ----------------------------------------
392 AC_ARG_ENABLE([sysio_init],
393         AC_HELP_STRING([--disable-sysio-init],
394                 [call sysio init functions when initializing liblustre]),
395         [],[enable_sysio_init=yes])
396 AC_MSG_CHECKING([whether to initialize libsysio])
397 AC_MSG_RESULT([$enable_sysio_init])
398 if test x$enable_sysio_init != xno ; then
399         AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
400 fi
401
402 AC_ARG_ENABLE([urandom],
403         AC_HELP_STRING([--disable-urandom],
404                 [disable use of /dev/urandom for liblustre]),
405         [],[enable_urandom=yes])
406 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
407 AC_MSG_RESULT([$enable_urandom])
408 if test x$enable_urandom != xno ; then
409         AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
410 fi
411
412 # -------- check for -lcap and -lpthread ----
413 if test x$enable_liblustre = xyes ; then
414         AC_CHECK_LIB([cap], [cap_get_proc],
415                 [
416                         CAP_LIBS="-lcap"
417                         AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
418                 ],
419                 [CAP_LIBS=""])
420         AC_SUBST(CAP_LIBS)
421         AC_CHECK_LIB([pthread], [pthread_create],
422                 [
423                         PTHREAD_LIBS="-lpthread"
424                         AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
425                 ],
426                 [PTHREAD_LIBS=""])
427         AC_SUBST(PTHREAD_LIBS)
428 fi
429 ])
430
431 #
432 # LP_CONDITIONALS
433 #
434 # AM_CONDITOINAL defines for portals
435 #
436 AC_DEFUN([LP_CONDITIONALS],
437 [AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
438 AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
439 AM_CONDITIONAL(BUILD_OPENIBNAL, test x$OPENIBNAL = "xopenibnal")
440 AM_CONDITIONAL(BUILD_IIBNAL, test x$IIBNAL = "xiibnal")
441 ])
442
443 #
444 # LP_CONFIG_FILES
445 #
446 # files that should be generated with AC_OUTPUT
447 #
448 AC_DEFUN([LP_CONFIG_FILES],
449 [AC_CONFIG_FILES([
450 portals/Kernelenv
451 portals/Makefile
452 portals/autoMakefile
453 portals/autoconf/Makefile
454 portals/doc/Makefile
455 portals/include/Makefile
456 portals/include/linux/Makefile
457 portals/include/portals/Makefile
458 portals/knals/Makefile
459 portals/knals/autoMakefile
460 portals/knals/gmnal/Makefile
461 portals/knals/gmnal/autoMakefile
462 portals/knals/iibnal/Makefile
463 portals/knals/iibnal/autoMakefile
464 portals/knals/openibnal/Makefile
465 portals/knals/openibnal/autoMakefile
466 portals/knals/qswnal/Makefile
467 portals/knals/qswnal/autoMakefile
468 portals/knals/socknal/Makefile
469 portals/knals/socknal/autoMakefile
470 portals/knals/lonal/Makefile
471 portals/knals/lonal/autoMakefile
472 portals/libcfs/Makefile
473 portals/libcfs/autoMakefile
474 portals/portals/Makefile
475 portals/portals/autoMakefile
476 portals/router/Makefile
477 portals/router/autoMakefile
478 portals/tests/Makefile
479 portals/tests/autoMakefile
480 portals/unals/Makefile
481 portals/utils/Makefile
482 ])
483 ])