Whamcloud - gitweb
LU-6001 build: fix autoconf DLC detection output
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
1 #
2 # LN_CONFIG_MAX_PAYLOAD
3 #
4 # configure maximum payload
5 #
6 AC_DEFUN([LN_CONFIG_MAX_PAYLOAD], [
7 AC_MSG_CHECKING([for non-default maximum LNET payload])
8 AC_ARG_WITH([max-payload-mb],
9         AC_HELP_STRING([--with-max-payload-mb=MBytes],
10                 [set maximum lnet payload in MBytes]),
11         [
12                 AC_MSG_RESULT([$with_max_payload_mb])
13                 CONFIG_LNET_MAX_PAYLOAD_MB=$with_max_payload_mb
14                 CONFIG_LNET_MAX_PAYLOAD="(($with_max_payload_mb)<<20)"
15         ], [
16                 AC_MSG_RESULT([no])
17                 CONFIG_LNET_MAX_PAYLOAD="LNET_MTU"
18         ])
19 AC_DEFINE_UNQUOTED(CONFIG_LNET_MAX_PAYLOAD, $CONFIG_LNET_MAX_PAYLOAD,
20         [Max LNET payload])
21 ]) # LN_CONFIG_MAX_PAYLOAD
22
23 #
24 # LN_CHECK_GCC_VERSION
25 #
26 # Check compiler version
27 #
28 AC_DEFUN([LN_CHECK_GCC_VERSION], [
29 AC_MSG_CHECKING([compiler version])
30 PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
31 PTL_MIN_CC_VERSION="3.2.2"
32 v2n() {
33         awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
34 }
35 if test -z "$PTL_CC_VERSION" -o \
36         $(echo $PTL_CC_VERSION | v2n) -ge $(echo $PTL_MIN_CC_VERSION | v2n); then
37         AC_MSG_RESULT([ok])
38 else
39         AC_MSG_RESULT([Buggy compiler found])
40         AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
41 fi
42 ]) # LN_CHECK_GCC_VERSION
43
44 #
45 # LN_FUNC_DEV_GET_BY_NAME_2ARG
46 #
47 AC_DEFUN([LN_FUNC_DEV_GET_BY_NAME_2ARG], [
48 LB_CHECK_COMPILE([if 'dev_get_by_name' has two args],
49 dev_get_by_name_2args, [
50         #include <linux/netdevice.h>
51 ],[
52         dev_get_by_name(NULL, NULL);
53 ],[
54         AC_DEFINE(HAVE_DEV_GET_BY_NAME_2ARG, 1,
55                 [dev_get_by_name has 2 args])
56 ])
57 ]) # LN_FUNC_DEV_GET_BY_NAME_2ARG
58
59 #
60 # LN_CONFIG_AFFINITY
61 #
62 # check if cpu affinity is available/wanted
63 #
64 AC_DEFUN([LN_CONFIG_AFFINITY], [
65 AC_MSG_CHECKING([whether to enable CPU affinity support])
66 AC_ARG_ENABLE([affinity],
67         AC_HELP_STRING([--disable-affinity],
68                 [disable process/irq affinity]),
69         [], [enable_affinity="yes"])
70 AC_MSG_RESULT([$enable_affinity])
71 AS_IF([test "x$enable_affinity" = xyes], [
72         LB_CHECK_COMPILE([if Linux kernel has cpu affinity support],
73         set_cpus_allowed_ptr, [
74                 #include <linux/sched.h>
75         ],[
76                 struct task_struct *t;
77                 #if HAVE_CPUMASK_T
78                 cpumask_t     m;
79                 #else
80                 unsigned long m;
81                 #endif
82                 set_cpus_allowed_ptr(t, &m);
83         ],[
84                 AC_DEFINE(CPU_AFFINITY, 1,
85                         [kernel has cpu affinity support])
86         ])
87 ])
88 ]) # LN_CONFIG_AFFINITY
89
90 #
91 # LN_CONFIG_BACKOFF
92 #
93 # check if tunable tcp backoff is available/wanted
94 #
95 AC_DEFUN([LN_CONFIG_BACKOFF], [
96 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
97 AC_ARG_ENABLE([backoff],
98         AC_HELP_STRING([--disable-backoff],
99                 [disable socknal tunable backoff]),
100         [], [enable_backoff="yes"])
101 AC_MSG_RESULT([$enable_backoff])
102 AS_IF([test "x$enable_backoff" = xyes], [
103         AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
104         AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
105                 AC_MSG_RESULT([yes])
106                 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
107                 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
108                         [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
109                                 [tunable backoff TCP in ms])])
110         ], [
111                 AC_MSG_RESULT([no])
112         ])
113 ])
114 ]) # LN_CONFIG_BACKOFF
115
116 #
117 # LN_CONFIG_DLC
118 #
119 # Configure dlc if enabled
120 #
121 # if libyaml is set (IE libyaml installed) and enable_dlc = yes then build
122 # dlc other wise (IE if libyaml is not set or enable_dlc = no) then don't
123 # build dlc.
124 #
125 AC_DEFUN([LN_CONFIG_DLC], [
126         AC_CHECK_LIB([yaml],  [yaml_parser_initialize],[
127                 LIBYAML="libyaml"],[
128                 LIBYAML=""],[-lm])
129         AC_MSG_CHECKING([whether to enable dlc])
130         AC_ARG_ENABLE([dlc],
131                 AC_HELP_STRING([--disable-dlc],
132                         [disable building dlc]),
133                         [], [enable_dlc="yes"])
134         USE_DLC=""
135         AS_IF([test "x$enable_dlc" = xyes],
136                 [AS_IF([test "x$LIBYAML" = xlibyaml], [
137                         USE_DLC="yes"
138                         AC_MSG_RESULT([yes])
139                 ], [
140                         AC_MSG_RESULT([no (libyaml not present)])
141                 ])
142         ], [
143                 AC_MSG_RESULT([no])
144         ])
145         AC_SUBST(USE_DLC)
146 ])
147
148 #
149 # LN_CONFIG_QUADRICS
150 #
151 # check if quadrics support is in this kernel
152 #
153 AC_DEFUN([LN_CONFIG_QUADRICS], [
154 AC_MSG_CHECKING([for QsNet sources])
155 AC_ARG_WITH([qsnet],
156         AC_HELP_STRING([--with-qsnet=path],
157                 [set path to qsnet source (default=$LINUX)]),
158         [QSNET=$with_qsnet], [QSNET=$LINUX])
159 AC_MSG_RESULT([$QSNET])
160
161 QSWLND=""
162 QSWCPPFLAGS=""
163 AC_MSG_CHECKING([if quadrics kernel headers are present])
164 AS_IF([test -d $QSNET/drivers/net/qsnet], [
165         AC_MSG_RESULT([yes])
166         QSWLND="qswlnd"
167         AC_MSG_CHECKING([for multirail EKC])
168         AS_IF([test -f $QSNET/include/elan/epcomms.h], [
169                 AC_MSG_RESULT([supported])
170                 QSNET=$(readlink --canonicalize $QSNET)
171                 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
172         ], [
173                 AC_MSG_RESULT([not supported])
174                 AC_MSG_ERROR([Need multirail EKC])
175         ])
176
177         AS_IF([test x$QSNET = x$LINUX], [
178                 LB_CHECK_CONFIG([QSNET], [], [
179                         LB_CHECK_CONFIG([QSNET_MODULE], [], [
180                                 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
181                                 QSWLND=""
182                                 QSWCPPFLAGS=""
183                         ])
184                 ])
185         ])
186 ], [
187         AC_MSG_RESULT([no])
188 ])
189 AC_SUBST(QSWLND)
190 AC_SUBST(QSWCPPFLAGS)
191 ]) # LN_CONFIG_QUADRICS
192
193 #
194 # LN_CONFIG_MX
195 #
196 AC_DEFUN([LN_CONFIG_MX], [
197 # set default
198 MXPATH="/opt/mx"
199 AC_MSG_CHECKING([whether to enable Myrinet MX support])
200 AC_ARG_WITH([mx],
201         AC_HELP_STRING([--with-mx=path],
202                 [build mxlnd against path]),
203         [
204                 case $with_mx in
205                 yes) ENABLEMX=2 ;;
206                 no)  ENABLEMX=0 ;;
207                 *)   ENABLEMX=3; MXPATH=$with_mx ;;
208                 esac
209         ],[
210                 ENABLEMX=1
211         ])
212 AS_IF([test $ENABLEMX -eq 0], [
213         AC_MSG_RESULT([disabled])
214 ], [test ! \( -f ${MXPATH}/include/myriexpress.h -a \
215               -f ${MXPATH}/include/mx_kernel_api.h -a \
216               -f ${MXPATH}/include/mx_pin.h \)], [
217         AC_MSG_RESULT([no])
218         case $ENABLEMX in
219         1) ;;
220         2) AC_MSG_ERROR([Myrinet MX kernel headers not present]) ;;
221         3) AC_MSG_ERROR([bad --with-mx path]) ;;
222         *) AC_MSG_ERROR([internal error]) ;;
223         esac
224 ], [
225         AC_MSG_RESULT([check])
226         MXPATH=$(readlink --canonicalize $MXPATH)
227         MXCPPFLAGS="-I$MXPATH/include"
228         MXLIBS="-L$MXPATH/lib"
229         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
230         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
231         LB_CHECK_COMPILE([if have Myrinet MX support],
232         myrinet_mx_support, [
233                 #define MX_KERNEL 1
234                 #include <mx_extensions.h>
235                 #include <myriexpress.h>
236         ],[
237                 mx_endpoint_t   end;
238                 mx_status_t     status;
239                 mx_request_t    request;
240                 int             result;
241                 mx_init();
242                 mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
243                 mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
244                 mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
245                 mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
246                 return 0;
247         ],[
248                 MXLND="mxlnd"
249         ],[
250                 case $ENABLEMX in
251                 1) ;;
252                 2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]) ;;
253                 3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]) ;;
254                 *) AC_MSG_ERROR([internal error]) ;;
255                 esac
256                 MXCPPFLAGS=""
257                 MXLIBS=""
258                 MXLND=""
259         ])
260         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
261 ])
262 AC_SUBST(MXCPPFLAGS)
263 AC_SUBST(MXLIBS)
264 AC_SUBST(MXLND)
265 ]) # LN_CONFIG_MX
266
267 #
268 # LN_CONFIG_O2IB
269 #
270 AC_DEFUN([LN_CONFIG_O2IB], [
271 AC_MSG_CHECKING([whether to use Compat RDMA])
272 AC_ARG_WITH([o2ib],
273         AC_HELP_STRING([--with-o2ib=path],
274                 [build o2iblnd against path]),
275         [
276                 case $with_o2ib in
277                 yes)    O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
278                         ENABLEO2IB=2
279                         ;;
280                 no)     ENABLEO2IB=0
281                         ;;
282                 *)      O2IBPATHS=$with_o2ib
283                         ENABLEO2IB=3
284                         ;;
285                 esac
286         ],[
287                 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
288                 ENABLEO2IB=1
289         ])
290 AS_IF([test $ENABLEO2IB -eq 0], [
291         AC_MSG_RESULT([no])
292 ], [
293         o2ib_found=false
294         for O2IBPATH in $O2IBPATHS; do
295                 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
296                            -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
297                            -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
298                            -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
299                         AS_IF([test \( -d ${O2IBPATH}/kernel_patches -a \
300                                    -f ${O2IBPATH}/Makefile \)], [
301                                 AC_MSG_RESULT([no])
302                                 AC_MSG_ERROR([
303
304 you appear to be trying to use the OFED distribution's source
305 directory (${O2IBPATH}) rather than the "development/headers"
306 directory which is likely in ${O2IBPATH%-*}
307 ])
308                         ])
309                         o2ib_found=true
310                         break
311                 ])
312         done
313         if ! $o2ib_found; then
314                 AC_MSG_RESULT([no])
315                 case $ENABLEO2IB in
316                         1) ;;
317                         2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]) ;;
318                         3) AC_MSG_ERROR([bad --with-o2ib path]) ;;
319                         *) AC_MSG_ERROR([internal error]) ;;
320                 esac
321         else
322                 compatrdma_found=false
323                 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
324                         AC_MSG_RESULT([yes])
325                         compatrdma_found=true
326                         AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
327                 else
328                         AC_MSG_RESULT([no])
329                 fi
330                 if ! $compatrdma_found; then
331                         if test -f "$O2IBPATH/config.mk"; then
332                                 . "$O2IBPATH/config.mk"
333                         elif test -f "$O2IBPATH/ofed_patch.mk"; then
334                                 . "$O2IBPATH/ofed_patch.mk"
335                         fi
336                 else
337                         if test "x$RHEL_KERNEL" = xyes; then
338                                 case "$RHEL_KERNEL_VERSION" in
339                                         2.6.32-358*)
340                                                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4" ;;
341                                         2.6.32-431*)
342                                                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4 -DCONFIG_COMPAT_RHEL_6_5" ;;
343                                 esac
344                         elif test "x$SUSE_KERNEL" = xyes; then
345                                 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
346                                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
347                         fi
348                 fi
349                 AC_MSG_CHECKING([whether to use any OFED backport headers])
350                 if test -n "$BACKPORT_INCLUDES"; then
351                         AC_MSG_RESULT([yes])
352                         OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
353                         EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
354                 else
355                         AC_MSG_RESULT([no])
356                 fi
357
358                 O2IBLND=""
359                 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
360                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
361                 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
362                 openib_gen2_support, [
363                         #include <linux/version.h>
364                         #include <linux/pci.h>
365                         #include <linux/gfp.h>
366                         #ifdef HAVE_COMPAT_RDMA
367                         #include <linux/compat-2.6.h>
368                         #endif
369                         #include <rdma/rdma_cm.h>
370                         #include <rdma/ib_cm.h>
371                         #include <rdma/ib_verbs.h>
372                         #include <rdma/ib_fmr_pool.h>
373                 ],[
374                         struct rdma_cm_id      *cm_idi __attribute__ ((unused));
375                         struct rdma_conn_param  conn_param __attribute__ ((unused));
376                         struct ib_device_attr   device_attr __attribute__ ((unused));
377                         struct ib_qp_attr       qp_attr __attribute__ ((unused));
378                         struct ib_pool_fmr      pool_fmr __attribute__ ((unused));
379                         enum   ib_cm_rej_reason rej_reason __attribute__ ((unused));
380                         rdma_destroy_id(NULL);
381                 ],[
382                         O2IBLND="o2iblnd"
383                 ],[
384                         case $ENABLEO2IB in
385                         1) ;;
386                         2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]) ;;
387                         3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
388                         *) AC_MSG_ERROR([internal error]) ;;
389                         esac
390                 ])
391                 # we know at this point that the found OFED source is good
392                 O2IB_SYMVER=""
393                 if test $ENABLEO2IB -eq 3 ; then
394                         # OFED default rpm not handle sles10 Modules.symvers name
395                         for name in Module.symvers Modules.symvers; do
396                                 if test -f $O2IBPATH/$name; then
397                                         O2IB_SYMVER=$name;
398                                         break;
399                                 fi
400                         done
401                         if test -n "$O2IB_SYMVER"; then
402                                 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
403                                 # strip out the existing symbols versions first
404                                 if test -f $PWD/$SYMVERFILE; then
405                                 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
406                                 else
407                                         touch $PWD/$SYMVERFILE.old
408                                 fi
409                                 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
410                                 rm $PWD/$SYMVERFILE.old
411                         else
412                                 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
413                         fi
414                 fi
415
416                 LN_CONFIG_OFED_SPEC
417         fi
418 ])
419 AC_SUBST(EXTRA_OFED_INCLUDE)
420 AC_SUBST(O2IBLND)
421
422 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
423 AS_IF([test $ENABLEO2IB -ne 0], [
424         LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
425         rdma_create_id_4args, [
426                 #ifdef HAVE_COMPAT_RDMA
427                 #include <linux/compat-2.6.h>
428                 #endif
429                 #include <rdma/rdma_cm.h>
430         ],[
431                 rdma_create_id(NULL, NULL, 0, 0);
432         ],[
433                 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
434                         [rdma_create_id wants 4 args])
435         ])
436 ])
437 ]) # LN_CONFIG_O2IB
438
439 #
440 # LN_CONFIG_RALND
441 #
442 # check whether to use the RapidArray lnd
443 #
444 AC_DEFUN([LN_CONFIG_RALND], [
445 RALND=""
446 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
447 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
448 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
449 LB_CHECK_COMPILE([if 'RapidArray' kernel headers are present],
450 RapkGetDeviceByIndex, [
451         #include <linux/types.h>
452         #include <rapl.h>
453 ],[
454         RAP_RETURN rc;
455         RAP_PVOID  dev_handle;
456         rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
457         return rc == RAP_SUCCESS ? 0 : 1;
458 ],[
459         RALND="ralnd"
460 ],[
461         RACPPFLAGS=""
462 ])
463 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
464 AC_SUBST(RACPPFLAGS)
465 AC_SUBST(RALND)
466 ]) # LN_CONFIG_RALND
467
468 #
469 # LN_CONFIG_GNILND
470 #
471 # check whether to use the Gemini Network Interface lnd
472 #
473 AC_DEFUN([LN_CONFIG_GNILND], [
474 AC_MSG_CHECKING([whether to enable GNI lnd])
475 AC_ARG_ENABLE([gni],
476         AC_HELP_STRING([--enable-gni],
477                 [enable GNI lnd]),
478         [], [enable_gni="no"])
479 AC_MSG_RESULT([$enable_gni])
480
481 AS_IF([test "x$enable_gni" = xyes], [
482         # GNICPPFLAGS was set in spec file
483         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
484         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
485         LB_CHECK_COMPILE([if GNI kernel headers are present],
486         GNI_header, [
487                 #include <linux/types.h>
488                 #include <gni_pub.h>
489         ],[
490                 gni_cdm_handle_t kgni_domain;
491                 gni_return_t     rc;
492                 int              rrc;
493                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
494                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
495                 return rrc;
496         ],[
497                 GNILND="gnilnd"
498         ],[
499                 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
500         ])
501         # at this point, we have gnilnd basic support,
502         # now check for extra features
503         LB_CHECK_COMPILE([to use RCA in gnilnd],
504         RCA_gnilnd, [
505                 #include <linux/types.h>
506                 #include <gni_pub.h>
507                 #include <krca_lib.h>
508         ],[
509                 gni_cdm_handle_t kgni_domain;
510                 gni_return_t     rc;
511                 krca_ticket_t    ticket = KRCA_NULL_TICKET;
512                 int              rrc;
513                 __u32            nid = 0, nic_addr;
514                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
515                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
516                 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
517                 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
518                 return rrc;
519         ],[
520                 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
521                 GNILNDRCA="gnilndrca"
522         ])
523         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
524 ])
525 AC_SUBST(GNICPPFLAGS)
526 AC_SUBST(GNILNDRCA)
527 AC_SUBST(GNILND)
528 ]) # LN_CONFIG_GNILND
529
530 #
531 # LN_CONFIG_USERSPACE
532 #
533 # This is defined but empty because it is called from
534 # build/autconf/lustre-build.m4 which is shared by all branches.
535 #
536 AC_DEFUN([LN_CONFIG_USERSPACE], [
537 ]) # LN_CONFIG_USERSPACE
538
539 #
540 # LN_CONFIG_TCP_SENDPAGE
541 #
542 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
543 #
544 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
545 tmp_flags="$EXTRA_KCFLAGS"
546 EXTRA_KCFLAGS="-Werror"
547 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
548 tcp_sendpage_socket, [
549         #include <linux/net.h>
550         #include <net/tcp.h>
551 ],[
552         tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
553 ],[
554         AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
555                 [tcp_sendpage use socket as first parameter])
556 ])
557 EXTRA_KCFLAGS="$tmp_flags"
558 ]) # LN_CONFIG_TCP_SENDPAGE
559
560 #
561 # LN_CONFIG_SK_DATA_READY
562 #
563 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
564 #
565 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
566 tmp_flags="$EXTRA_KCFLAGS"
567 EXTRA_KCFLAGS="-Werror"
568 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
569 sk_data_ready, [
570         #include <linux/net.h>
571         #include <net/sock.h>
572 ],[
573         ((struct sock *)0)->sk_data_ready(NULL);
574 ],[
575         AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
576                 [sk_data_ready uses only one argument])
577 ])
578 EXTRA_KCFLAGS="$tmp_flags"
579 ]) # LN_CONFIG_SK_DATA_READY
580
581 #
582 # LN_PROG_LINUX
583 #
584 # LNet linux kernel checks
585 #
586 AC_DEFUN([LN_PROG_LINUX], [
587 AC_MSG_NOTICE([LNet kernel checks
588 ==============================================================================])
589
590 LN_FUNC_DEV_GET_BY_NAME_2ARG
591 LN_CONFIG_AFFINITY
592 LN_CONFIG_BACKOFF
593 LN_CONFIG_QUADRICS
594 LN_CONFIG_O2IB
595 LN_CONFIG_RALND
596 LN_CONFIG_GNILND
597 LN_CONFIG_MX
598 # 2.6.36
599 LN_CONFIG_TCP_SENDPAGE
600 # 3.15
601 LN_CONFIG_SK_DATA_READY
602 ]) # LN_PROG_LINUX
603
604 #
605 # LN_PATH_DEFAULTS
606 #
607 # default paths for installed files
608 #
609 AC_DEFUN([LN_PATH_DEFAULTS], [
610 ]) # LN_PATH_DEFAULTS
611
612 #
613 # LN_CONFIGURE
614 #
615 # other configure checks
616 #
617 AC_DEFUN([LN_CONFIGURE], [
618 AC_MSG_NOTICE([LNet core checks
619 ==============================================================================])
620
621 # lnet/utils/portals.c
622 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
623 AC_CHECK_FUNCS([gethostbyname socket connect])
624
625 # lnet/utils/debug.c
626 AC_CHECK_HEADERS([linux/version.h])
627
628 # lnet/utils/wirecheck.c
629 AC_CHECK_FUNCS([strnlen])
630
631 # --------  Check for required packages  --------------
632
633 #
634 # LC_CONFIG_READLINE
635 #
636 # Build with readline
637 #
638 AC_MSG_CHECKING([whether to enable readline support])
639 AC_ARG_ENABLE(readline,
640         AC_HELP_STRING([--disable-readline],
641                 [disable readline support]),
642         [], [enable_readline="yes"])
643 AC_MSG_RESULT([$enable_readline])
644
645 # -------- check for readline if enabled ----
646
647 LIBREADLINE=""
648 AS_IF([test "x$enable_readline" = xyes], [
649         AC_CHECK_LIB([readline], [readline], [
650                 LIBREADLINE="-lreadline"
651                 AC_DEFINE(HAVE_LIBREADLINE, 1,
652                         [readline library is available])])
653 ])
654 AC_SUBST(LIBREADLINE)
655
656 # -------- enable acceptor libwrap (TCP wrappers) support? -------
657
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 LIBWRAP=""
668 AS_IF([test "x$enable_libwrap" = xyes], [
669         LIBWRAP="-lwrap"
670         AC_DEFINE(HAVE_LIBWRAP, 1,
671                 [libwrap support is requested])
672 ])
673 AC_SUBST(LIBWRAP)
674
675 LN_CONFIG_MAX_PAYLOAD
676 LN_CONFIG_DLC
677 ]) # LN_CONFIGURE
678
679 #
680 # LN_CONDITIONALS
681 #
682 # AM_CONDITOINAL defines for lnet
683 #
684 AC_DEFUN([LN_CONDITIONALS], [
685 AM_CONDITIONAL(BUILD_QSWLND,     test x$QSWLND = "xqswlnd")
686 AM_CONDITIONAL(BUILD_MXLND,      test x$MXLND = "xmxlnd")
687 AM_CONDITIONAL(BUILD_O2IBLND,    test x$O2IBLND = "xo2iblnd")
688 AM_CONDITIONAL(BUILD_RALND,      test x$RALND = "xralnd")
689 AM_CONDITIONAL(BUILD_GNILND,     test x$GNILND = "xgnilnd")
690 AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
691 AM_CONDITIONAL(BUILD_DLC,        test x$USE_DLC = "xyes")
692 ]) # LN_CONDITIONALS
693
694 #
695 # LN_CONFIG_FILES
696 #
697 # files that should be generated with AC_OUTPUT
698 #
699 AC_DEFUN([LN_CONFIG_FILES], [
700 AC_CONFIG_FILES([
701 lnet/Kernelenv
702 lnet/Makefile
703 lnet/autoMakefile
704 lnet/autoconf/Makefile
705 lnet/doc/Makefile
706 lnet/include/Makefile
707 lnet/include/lnet/Makefile
708 lnet/include/lnet/linux/Makefile
709 lnet/klnds/Makefile
710 lnet/klnds/autoMakefile
711 lnet/klnds/mxlnd/autoMakefile
712 lnet/klnds/mxlnd/Makefile
713 lnet/klnds/o2iblnd/Makefile
714 lnet/klnds/o2iblnd/autoMakefile
715 lnet/klnds/qswlnd/Makefile
716 lnet/klnds/qswlnd/autoMakefile
717 lnet/klnds/ralnd/Makefile
718 lnet/klnds/ralnd/autoMakefile
719 lnet/klnds/gnilnd/Makefile
720 lnet/klnds/gnilnd/autoMakefile
721 lnet/klnds/socklnd/Makefile
722 lnet/klnds/socklnd/autoMakefile
723 lnet/lnet/Makefile
724 lnet/lnet/autoMakefile
725 lnet/selftest/Makefile
726 lnet/selftest/autoMakefile
727 lnet/utils/Makefile
728 lnet/utils/lnetconfig/Makefile
729 ])
730 ]) # LN_CONFIG_FILES