2 # LN_CONFIG_MAX_PAYLOAD
4 # configure maximum payload
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]),
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)"
17 CONFIG_LNET_MAX_PAYLOAD="LNET_MTU"
19 AC_DEFINE_UNQUOTED(CONFIG_LNET_MAX_PAYLOAD, $CONFIG_LNET_MAX_PAYLOAD,
21 ]) # LN_CONFIG_MAX_PAYLOAD
24 # LN_CHECK_GCC_VERSION
26 # Check compiler version
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"
33 awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
35 if test -z "$PTL_CC_VERSION" -o \
36 $(echo $PTL_CC_VERSION | v2n) -ge $(echo $PTL_MIN_CC_VERSION | v2n); then
39 AC_MSG_RESULT([Buggy compiler found])
40 AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
42 ]) # LN_CHECK_GCC_VERSION
45 # LN_FUNC_DEV_GET_BY_NAME_2ARG
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>
52 dev_get_by_name(NULL, NULL);
54 AC_DEFINE(HAVE_DEV_GET_BY_NAME_2ARG, 1,
55 [dev_get_by_name has 2 args])
57 ]) # LN_FUNC_DEV_GET_BY_NAME_2ARG
62 # check if cpu affinity is available/wanted
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>
76 struct task_struct *t;
82 set_cpus_allowed_ptr(t, &m);
84 AC_DEFINE(CPU_AFFINITY, 1,
85 [kernel has cpu affinity support])
88 ]) # LN_CONFIG_AFFINITY
93 # check if tunable tcp backoff is available/wanted
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], [
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])])
114 ]) # LN_CONFIG_BACKOFF
119 # Configure dlc if enabled
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
125 AC_DEFUN([LN_CONFIG_DLC], [
126 AC_CHECK_LIB([yaml], [yaml_parser_initialize],[
129 AC_MSG_CHECKING([whether to enable dlc])
131 AC_HELP_STRING([--disable-dlc],
132 [disable building dlc]),
133 [], [enable_dlc="yes"])
135 AS_IF([test "x$enable_dlc" = xyes],
136 [AS_IF([test "x$LIBYAML" = xlibyaml], [
140 AC_MSG_RESULT([no (libyaml not present)])
151 # If current OFED installed (assume with "ofed_info") and devel
152 # headers are not found, error because we assume OFED infiniband
153 # driver needs to be used and we must configure/build with it.
154 # Current OFED headers detection mechanism allow for non-standard
155 # prefix but relies on "ofed_info" command and on "%prefix/openib"
156 # link (both are ok for 1.5.x and 3.x versions), and should work
157 # for both source and DKMS builds.
159 AC_DEFUN([LN_CONFIG_O2IB], [
160 AC_MSG_CHECKING([whether to use Compat RDMA])
162 AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
163 [build o2iblnd against path]),
164 [], [with_o2ib="yes"])
167 yes) AS_IF([which ofed_info 2>/dev/null], [
168 O2IBPATHS=$(ofed_info | egrep -w 'compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs rpm -ql | grep '/openib$')
169 AS_IF([test -z "$O2IBPATHS"], [
171 You seem to have an OFED installed but have not installed it's devel package.
172 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
173 Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
176 AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
178 It appears that you have multiple OFED versions installed.
179 If you still want to build Lustre for your OFED I/B stack, you need to install a single version with its devel headers RPM.
180 Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
185 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
191 *) O2IBPATHS=$with_o2ib
192 ENABLEO2IB="withpath"
197 AS_IF([test $ENABLEO2IB = "no"], [
201 for O2IBPATH in $O2IBPATHS; do
202 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
203 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
204 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
205 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
206 AS_IF([test \( \( \( -d ${O2IBPATH}/patches -a \
207 \( "x$OFED" = "xyes" \) \) -o \
208 -d ${O2IBPATH}/kernel_patches \) -a \
209 -f ${O2IBPATH}/Makefile \)], [
213 trying to use the, explicit or detected, OFED distribution's source
214 directory (${O2IBPATH}) rather than the "development/headers"
215 directory which is likely in ${O2IBPATH%-*}
222 if ! $o2ib_found; then
225 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
226 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
227 *) AC_MSG_ERROR([internal error]) ;;
230 compatrdma_found=false
231 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
233 compatrdma_found=true
234 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
238 if ! $compatrdma_found; then
239 if test -f "$O2IBPATH/config.mk"; then
240 . "$O2IBPATH/config.mk"
241 elif test -f "$O2IBPATH/ofed_patch.mk"; then
242 . "$O2IBPATH/ofed_patch.mk"
245 if test "x$RHEL_KERNEL" = xyes; then
246 case "$RHEL_RELEASE_NO" in
248 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4" ;;
250 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4 -DCONFIG_COMPAT_RHEL_6_5" ;;
252 elif test "x$SUSE_KERNEL" = xyes; then
253 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
254 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
257 AC_MSG_CHECKING([whether to use any OFED backport headers])
258 if test -n "$BACKPORT_INCLUDES"; then
260 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
261 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
267 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
268 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
269 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
270 openib_gen2_support, [
271 #include <linux/version.h>
272 #include <linux/pci.h>
273 #include <linux/gfp.h>
274 #ifdef HAVE_COMPAT_RDMA
275 #include <linux/compat-2.6.h>
277 #include <rdma/rdma_cm.h>
278 #include <rdma/ib_cm.h>
279 #include <rdma/ib_verbs.h>
280 #include <rdma/ib_fmr_pool.h>
282 struct rdma_cm_id *cm_idi __attribute__ ((unused));
283 struct rdma_conn_param conn_param __attribute__ ((unused));
284 struct ib_device_attr device_attr __attribute__ ((unused));
285 struct ib_qp_attr qp_attr __attribute__ ((unused));
286 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
287 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
288 rdma_destroy_id(NULL);
293 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
294 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
295 *) AC_MSG_ERROR([internal error]) ;;
298 # we know at this point that the found OFED source is good
300 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
301 # OFED default rpm not handle sles10 Modules.symvers name
302 for name in Module.symvers Modules.symvers; do
303 if test -f $O2IBPATH/$name; then
308 if test -n "$O2IB_SYMVER"; then
309 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
310 # strip out the existing symbols versions first
311 if test -f $PWD/$SYMVERFILE; then
312 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
314 touch $PWD/$SYMVERFILE.old
316 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
317 rm $PWD/$SYMVERFILE.old
319 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
326 AC_SUBST(EXTRA_OFED_INCLUDE)
329 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
330 AS_IF([test $ENABLEO2IB != "no"], [
331 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
332 rdma_create_id_4args, [
333 #ifdef HAVE_COMPAT_RDMA
334 #include <linux/compat-2.6.h>
336 #include <rdma/rdma_cm.h>
338 rdma_create_id(NULL, NULL, 0, 0);
340 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
341 [rdma_create_id wants 4 args])
349 # check whether to use the Gemini Network Interface lnd
351 AC_DEFUN([LN_CONFIG_GNILND], [
352 AC_MSG_CHECKING([whether to enable GNI lnd])
354 AC_HELP_STRING([--enable-gni],
356 [], [enable_gni="no"])
357 AC_MSG_RESULT([$enable_gni])
359 AS_IF([test "x$enable_gni" = xyes], [
360 # GNICPPFLAGS was set in spec file
361 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
362 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
363 LB_CHECK_COMPILE([if GNI kernel headers are present],
365 #include <linux/types.h>
368 gni_cdm_handle_t kgni_domain;
371 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
372 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
377 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
379 # at this point, we have gnilnd basic support,
380 # now check for extra features
381 LB_CHECK_COMPILE([to use RCA in gnilnd],
383 #include <linux/types.h>
385 #include <krca_lib.h>
387 gni_cdm_handle_t kgni_domain;
389 krca_ticket_t ticket = KRCA_NULL_TICKET;
391 __u32 nid = 0, nic_addr;
392 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
393 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
394 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
395 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
398 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
399 GNILNDRCA="gnilndrca"
401 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
403 AC_SUBST(GNICPPFLAGS)
406 ]) # LN_CONFIG_GNILND
409 # LN_CONFIG_TCP_SENDPAGE
411 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
413 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
414 tmp_flags="$EXTRA_KCFLAGS"
415 EXTRA_KCFLAGS="-Werror"
416 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
417 tcp_sendpage_socket, [
418 #include <linux/net.h>
421 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
423 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
424 [tcp_sendpage use socket as first parameter])
426 EXTRA_KCFLAGS="$tmp_flags"
427 ]) # LN_CONFIG_TCP_SENDPAGE
430 # LN_CONFIG_SK_DATA_READY
432 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
434 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
435 tmp_flags="$EXTRA_KCFLAGS"
436 EXTRA_KCFLAGS="-Werror"
437 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
439 #include <linux/net.h>
440 #include <net/sock.h>
442 ((struct sock *)0)->sk_data_ready(NULL);
444 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
445 [sk_data_ready uses only one argument])
447 EXTRA_KCFLAGS="$tmp_flags"
448 ]) # LN_CONFIG_SK_DATA_READY
453 # LNet linux kernel checks
455 AC_DEFUN([LN_PROG_LINUX], [
456 AC_MSG_NOTICE([LNet kernel checks
457 ==============================================================================])
459 LN_FUNC_DEV_GET_BY_NAME_2ARG
465 LN_CONFIG_TCP_SENDPAGE
467 LN_CONFIG_SK_DATA_READY
473 # default paths for installed files
475 AC_DEFUN([LN_PATH_DEFAULTS], [
476 ]) # LN_PATH_DEFAULTS
481 # other configure checks
483 AC_DEFUN([LN_CONFIGURE], [
484 AC_MSG_NOTICE([LNet core checks
485 ==============================================================================])
487 # lnet/utils/portals.c
488 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
489 AC_CHECK_FUNCS([gethostbyname socket connect])
492 AC_CHECK_HEADERS([linux/version.h])
494 # lnet/utils/wirecheck.c
495 AC_CHECK_FUNCS([strnlen])
497 # -------- Check for required packages --------------
502 # Build with readline
504 AC_MSG_CHECKING([whether to enable readline support])
505 AC_ARG_ENABLE(readline,
506 AC_HELP_STRING([--disable-readline],
507 [disable readline support]),
508 [], [enable_readline="yes"])
509 AC_MSG_RESULT([$enable_readline])
511 # -------- check for readline if enabled ----
514 AS_IF([test "x$enable_readline" = xyes], [
515 AC_CHECK_LIB([readline], [readline], [
516 LIBREADLINE="-lreadline"
517 AC_DEFINE(HAVE_LIBREADLINE, 1,
518 [readline library is available])])
520 AC_SUBST(LIBREADLINE)
522 # -------- enable acceptor libwrap (TCP wrappers) support? -------
524 AC_MSG_CHECKING([if libwrap support is requested])
525 AC_ARG_ENABLE([libwrap],
526 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
527 [case "${enableval}" in
528 yes) enable_libwrap="yes" ;;
529 no) enable_libwrap="no" ;;
530 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
531 esac], [enable_libwrap="no"])
532 AC_MSG_RESULT([$enable_libwrap])
534 AS_IF([test "x$enable_libwrap" = xyes], [
536 AC_DEFINE(HAVE_LIBWRAP, 1,
537 [libwrap support is requested])
541 LN_CONFIG_MAX_PAYLOAD
548 # AM_CONDITIONAL defines for lnet
550 AC_DEFUN([LN_CONDITIONALS], [
551 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
552 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
553 AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
554 AM_CONDITIONAL(BUILD_DLC, test x$USE_DLC = "xyes")
560 # files that should be generated with AC_OUTPUT
562 AC_DEFUN([LN_CONFIG_FILES], [
566 lnet/autoconf/Makefile
568 lnet/include/Makefile
569 lnet/include/lnet/Makefile
571 lnet/klnds/autoMakefile
572 lnet/klnds/o2iblnd/Makefile
573 lnet/klnds/o2iblnd/autoMakefile
574 lnet/klnds/gnilnd/Makefile
575 lnet/klnds/gnilnd/autoMakefile
576 lnet/klnds/socklnd/Makefile
577 lnet/klnds/socklnd/autoMakefile
579 lnet/lnet/autoMakefile
580 lnet/selftest/Makefile
581 lnet/selftest/autoMakefile
583 lnet/utils/lnetconfig/Makefile