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
47 # check if cpu affinity is available/wanted
49 AC_DEFUN([LN_CONFIG_AFFINITY], [
50 AC_MSG_CHECKING([whether to enable CPU affinity support])
51 AC_ARG_ENABLE([affinity],
52 AC_HELP_STRING([--disable-affinity],
53 [disable process/irq affinity]),
54 [], [enable_affinity="yes"])
55 AC_MSG_RESULT([$enable_affinity])
56 AS_IF([test "x$enable_affinity" = xyes], [
57 LB_CHECK_COMPILE([if Linux kernel has cpu affinity support],
58 set_cpus_allowed_ptr, [
59 #include <linux/sched.h>
61 struct task_struct *t;
67 set_cpus_allowed_ptr(t, &m);
69 AC_DEFINE(CPU_AFFINITY, 1,
70 [kernel has cpu affinity support])
73 ]) # LN_CONFIG_AFFINITY
78 # check if tunable tcp backoff is available/wanted
80 AC_DEFUN([LN_CONFIG_BACKOFF], [
81 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
82 AC_ARG_ENABLE([backoff],
83 AC_HELP_STRING([--disable-backoff],
84 [disable socknal tunable backoff]),
85 [], [enable_backoff="yes"])
86 AC_MSG_RESULT([$enable_backoff])
87 AS_IF([test "x$enable_backoff" = xyes], [
88 AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
89 AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
91 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
92 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
93 [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
94 [tunable backoff TCP in ms])])
99 ]) # LN_CONFIG_BACKOFF
104 # Configure dlc if enabled
106 # if libyaml is set (IE libyaml installed) and enable_dlc = yes then build
107 # dlc other wise (IE if libyaml is not set or enable_dlc = no) then don't
110 AC_DEFUN([LN_CONFIG_DLC], [
111 AC_CHECK_LIB([yaml], [yaml_parser_initialize],[
114 AC_MSG_CHECKING([whether to enable dlc])
116 AC_HELP_STRING([--disable-dlc],
117 [disable building dlc]),
118 [], [enable_dlc="yes"])
120 AS_IF([test "x$enable_dlc" = xyes],
121 [AS_IF([test "x$LIBYAML" = xlibyaml], [
125 AC_MSG_RESULT([no (libyaml not present)])
136 # If current OFED installed (assume with "ofed_info") and devel
137 # headers are not found, error because we assume OFED infiniband
138 # driver needs to be used and we must configure/build with it.
139 # Current OFED headers detection mechanism allow for non-standard
140 # prefix but relies on "ofed_info" command and on "%prefix/openib"
141 # link (both are ok for 1.5.x and 3.x versions), and should work
142 # for both source and DKMS builds.
144 AC_DEFUN([LN_CONFIG_O2IB], [
145 AC_MSG_CHECKING([whether to use Compat RDMA])
147 AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
148 [build o2iblnd against path]),
149 [], [with_o2ib="yes"])
152 yes) AS_IF([which ofed_info 2>/dev/null], [
153 O2IBPATHS=$(ofed_info | egrep -w 'compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs rpm -ql | grep '/openib$')
154 AS_IF([test -z "$O2IBPATHS"], [
156 You seem to have an OFED installed but have not installed it's devel package.
157 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
158 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.
161 AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
163 It appears that you have multiple OFED versions installed.
164 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.
165 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.
170 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
176 *) O2IBPATHS=$with_o2ib
177 ENABLEO2IB="withpath"
182 AS_IF([test $ENABLEO2IB = "no"], [
186 for O2IBPATH in $O2IBPATHS; do
187 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
188 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
189 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
190 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
191 AS_IF([test \( \( \( -d ${O2IBPATH}/patches -a \
192 \( "x$OFED" = "xyes" \) \) -o \
193 -d ${O2IBPATH}/kernel_patches \) -a \
194 -f ${O2IBPATH}/Makefile \)], [
198 trying to use the, explicit or detected, OFED distribution's source
199 directory (${O2IBPATH}) rather than the "development/headers"
200 directory which is likely in ${O2IBPATH%-*}
207 if ! $o2ib_found; then
210 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
211 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
212 *) AC_MSG_ERROR([internal error]) ;;
215 compatrdma_found=false
216 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
218 compatrdma_found=true
219 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
223 if ! $compatrdma_found; then
224 if test -f "$O2IBPATH/config.mk"; then
225 . "$O2IBPATH/config.mk"
226 elif test -f "$O2IBPATH/ofed_patch.mk"; then
227 . "$O2IBPATH/ofed_patch.mk"
230 if test "x$RHEL_KERNEL" = xyes; then
231 case "$RHEL_RELEASE_NO" in
233 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4" ;;
235 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4 -DCONFIG_COMPAT_RHEL_6_5" ;;
237 elif test "x$SUSE_KERNEL" = xyes; then
238 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
239 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
243 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
244 linux_kthread_worker, [
245 #include <linux/kthread.h>
247 struct kthread_work *kth_wrk __attribute__ ((unused));
248 flush_kthread_work(kth_wrk);
250 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
251 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
254 AC_MSG_CHECKING([whether to use any OFED backport headers])
255 if test -n "$BACKPORT_INCLUDES"; then
257 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
258 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
264 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
265 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
266 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
267 openib_gen2_support, [
268 #ifdef HAVE_COMPAT_RDMA
269 #include <linux/compat-2.6.h>
271 #include <linux/version.h>
272 #include <linux/pci.h>
273 #include <linux/gfp.h>
274 #include <rdma/rdma_cm.h>
275 #include <rdma/ib_cm.h>
276 #include <rdma/ib_verbs.h>
277 #include <rdma/ib_fmr_pool.h>
279 struct rdma_cm_id *cm_idi __attribute__ ((unused));
280 struct rdma_conn_param conn_param __attribute__ ((unused));
281 struct ib_device_attr device_attr __attribute__ ((unused));
282 struct ib_qp_attr qp_attr __attribute__ ((unused));
283 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
284 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
285 rdma_destroy_id(NULL);
290 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
291 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
292 *) AC_MSG_ERROR([internal error]) ;;
295 # we know at this point that the found OFED source is good
297 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
298 # OFED default rpm not handle sles10 Modules.symvers name
299 for name in Module.symvers Modules.symvers; do
300 if test -f $O2IBPATH/$name; then
305 if test -n "$O2IB_SYMVER"; then
306 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to Symbol Path])
307 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IBPATH/$O2IB_SYMVER"
308 AC_SUBST(EXTRA_SYMBOLS)
310 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
315 AC_SUBST(EXTRA_OFED_INCLUDE)
320 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
321 AS_IF([test $ENABLEO2IB != "no"], [
322 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
323 rdma_create_id_4args, [
324 #ifdef HAVE_COMPAT_RDMA
325 #include <linux/compat-2.6.h>
327 #include <rdma/rdma_cm.h>
329 rdma_create_id(NULL, NULL, 0, 0);
331 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
332 [rdma_create_id wants 4 args])
340 # check whether to use the Gemini Network Interface lnd
342 AC_DEFUN([LN_CONFIG_GNILND], [
343 AC_MSG_CHECKING([whether to enable GNI lnd])
345 AC_HELP_STRING([--enable-gni],
347 [], [enable_gni="no"])
348 AC_MSG_RESULT([$enable_gni])
350 AS_IF([test "x$enable_gni" = xyes], [
351 # GNICPPFLAGS was set in spec file
352 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
353 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
354 LB_CHECK_COMPILE([if GNI kernel headers are present],
356 #include <linux/types.h>
359 gni_cdm_handle_t kgni_domain;
362 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
363 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
368 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
370 # at this point, we have gnilnd basic support,
371 # now check for extra features
372 LB_CHECK_COMPILE([to use RCA in gnilnd],
374 #include <linux/types.h>
376 #include <krca_lib.h>
378 gni_cdm_handle_t kgni_domain;
380 krca_ticket_t ticket = KRCA_NULL_TICKET;
382 __u32 nid = 0, nic_addr;
383 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
384 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
385 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
386 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
389 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
391 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
393 AC_SUBST(GNICPPFLAGS)
395 ]) # LN_CONFIG_GNILND
400 # 2.6.35 kernel has sk_sleep function
402 AC_DEFUN([LN_CONFIG_SK_SLEEP], [
403 LB_CHECK_COMPILE([if Linux kernel has 'sk_sleep'],
405 #ifdef HAVE_COMPAT_RDMA
406 #include <linux/compat-2.6.h>
408 #include <net/sock.h>
412 AC_DEFINE(HAVE_SK_SLEEP, 1,
413 [kernel has sk_sleep])
415 ]) # LN_CONFIG_SK_SLEEP
418 # LN_CONFIG_TCP_SENDPAGE
420 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
422 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
423 tmp_flags="$EXTRA_KCFLAGS"
424 EXTRA_KCFLAGS="-Werror"
425 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
426 tcp_sendpage_socket, [
427 #include <linux/net.h>
430 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
432 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
433 [tcp_sendpage use socket as first parameter])
435 EXTRA_KCFLAGS="$tmp_flags"
436 ]) # LN_CONFIG_TCP_SENDPAGE
439 # LN_CONFIG_SK_DATA_READY
441 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
443 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
444 tmp_flags="$EXTRA_KCFLAGS"
445 EXTRA_KCFLAGS="-Werror"
446 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
448 #include <linux/net.h>
449 #include <net/sock.h>
451 ((struct sock *)0)->sk_data_ready(NULL);
453 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
454 [sk_data_ready uses only one argument])
456 EXTRA_KCFLAGS="$tmp_flags"
457 ]) # LN_CONFIG_SK_DATA_READY
462 # LNet linux kernel checks
464 AC_DEFUN([LN_PROG_LINUX], [
465 AC_MSG_NOTICE([LNet kernel checks
466 ==============================================================================])
475 LN_CONFIG_TCP_SENDPAGE
477 LN_CONFIG_SK_DATA_READY
483 # default paths for installed files
485 AC_DEFUN([LN_PATH_DEFAULTS], [
486 ]) # LN_PATH_DEFAULTS
491 # other configure checks
493 AC_DEFUN([LN_CONFIGURE], [
494 AC_MSG_NOTICE([LNet core checks
495 ==============================================================================])
497 # lnet/utils/portals.c
498 AC_CHECK_HEADERS([netdb.h])
499 AC_CHECK_FUNCS([gethostbyname])
501 # lnet/utils/wirecheck.c
502 AC_CHECK_FUNCS([strnlen])
504 # -------- Check for required packages --------------
506 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
507 AC_ARG_ENABLE(efence,
508 AC_HELP_STRING([--enable-efence],
509 [use efence library]),
510 [], [enable_efence="no"])
511 AC_MSG_RESULT([$enable_efence])
514 AS_IF([test "$enable_efence" = yes], [
516 AC_DEFINE(HAVE_LIBEFENCE, 1,
517 [libefence support is requested])
521 LN_CONFIG_MAX_PAYLOAD
528 # AM_CONDITIONAL defines for lnet
530 AC_DEFUN([LN_CONDITIONALS], [
531 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
532 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
533 AM_CONDITIONAL(BUILD_DLC, test x$USE_DLC = "xyes")
539 # files that should be generated with AC_OUTPUT
541 AC_DEFUN([LN_CONFIG_FILES], [
545 lnet/autoconf/Makefile
547 lnet/include/Makefile
548 lnet/include/lnet/Makefile
550 lnet/klnds/autoMakefile
551 lnet/klnds/o2iblnd/Makefile
552 lnet/klnds/o2iblnd/autoMakefile
553 lnet/klnds/gnilnd/Makefile
554 lnet/klnds/gnilnd/autoMakefile
555 lnet/klnds/socklnd/Makefile
556 lnet/klnds/socklnd/autoMakefile
558 lnet/lnet/autoMakefile
559 lnet/selftest/Makefile
560 lnet/selftest/autoMakefile
562 lnet/utils/lnetconfig/Makefile