1 # SPDX-License-Identifier: GPL-2.0
4 # This file is part of Lustre, http://www.lustre.org/
6 # config/lustre-build.m4
8 # Generic Lustre configuration options
14 # fixup $target_os for use in other places
16 AC_DEFUN([LB_CANONICAL_SYSTEM], [
22 AC_SUBST(lb_target_os)
23 ]) # LB_CANONICAL_SYSTEM
26 # LB_DOWNSTREAM_RELEASE (DEPRECATED)
28 AC_DEFUN([LB_DOWNSTREAM_RELEASE],
29 [AC_ARG_WITH([downstream-release],,
30 AC_MSG_ERROR([--downstream-release was deprecated. Please read Documentation/versioning.txt.])
31 )]) # LB_DOWNSTREAM_RELEASE
36 # Check for file existence even when cross compiling
41 AC_DEFUN([LB_CHECK_FILE], [
42 AS_VAR_PUSHDEF([lb_file], [lb_cv_file_$1])dnl
43 AC_CACHE_CHECK([for $1], lb_file, [
45 [AS_VAR_SET(lb_file, [yes])],
46 [AS_VAR_SET(lb_file, [no])])
48 AS_VAR_IF([lb_file], [yes], [$2], [$3])[]dnl
49 AS_VAR_POPDEF([lb_file])dnl
53 # LB_ARG_LIBS_INCLUDES
55 # support for --with-foo, --with-foo-includes, and --with-foo-libs in
56 # a single magical macro
58 AC_DEFUN([LB_ARG_LIBS_INCLUDES], [
59 lb_pathvar="m4_bpatsubst([$2], -, _)"
60 AC_MSG_CHECKING([for $1])
62 AS_HELP_STRING([--with-$2=path],
65 AS_IF([test "x$withval" = xyes],
66 [eval "$lb_pathvar='$3'"],
67 [eval "$lb_pathvar='$withval'"])
68 AC_MSG_RESULT([${!lb_pathvar:-no}])
70 AS_IF([test "x${!lb_pathvar}" != x -a "x${!lb_pathvar}" != xno], [
71 AC_MSG_CHECKING([for $1 includes])
72 AC_ARG_WITH([$2-includes],
73 AS_HELP_STRING([--with-$2-includes=path],
74 [path to $1 includes]),
77 lb_includevar="${lb_pathvar}_includes"
78 AS_IF([test "x$withval" = xyes],
79 [eval "${lb_includevar}='${!lb_pathvar}/include'"],
80 [eval "${lb_includevar}='$withval'"])
81 AC_MSG_RESULT([${!lb_includevar}])
83 AC_MSG_CHECKING([for $1 libs])
84 AC_ARG_WITH([$2-libs],
85 AS_HELP_STRING([--with-$2-libs=path],
89 lb_libvar="${lb_pathvar}_libs"
90 AS_IF([test "x$withval" = xyes],
91 [eval "${lb_libvar}='${!lb_pathvar}/lib'"],
92 [eval "${lb_libvar}='$withval'"])
93 AC_MSG_RESULT([${!lb_libvar}])
95 ]) # LB_ARG_LIBS_INCLUDES
100 # We no longer handle external lustre-iokit
102 AC_DEFUN([LB_PATH_LUSTREIOKIT], [
103 AC_MSG_CHECKING([whether to build iokit])
104 AC_ARG_ENABLE([iokit],
105 AS_HELP_STRING([--disable-iokit],
106 [disable iokit (default is enable)]),
107 [], [enable_iokit="yes"])
108 AC_MSG_RESULT([$enable_iokit])
109 AS_IF([test "x$enable_iokit" = xyes],
110 [LUSTREIOKIT_SUBDIR="lustre-iokit"],
111 [LUSTREIOKIT_SUBDIR=""])
112 AC_SUBST(LUSTREIOKIT_SUBDIR)
113 AM_CONDITIONAL([BUILD_LUSTREIOKIT], [test "x$enable_iokit" = xyes])
114 ]) # LB_PATH_LUSTREIOKIT
119 # Check whether build with libmount for mount.lustre.
120 # libmount is part of the util-linux since v2.18.
121 # We need it to manipulate utab file.
123 AC_DEFUN([LB_LIBMOUNT], [
124 AC_CHECK_HEADER([libmount/libmount.h], [
125 AC_CHECK_LIB([mount], [mnt_update_set_fs], [
129 ],[with_libmount="no"])
130 ], [with_libmount="no"])
131 AC_MSG_CHECKING([whether to build with libmount])
132 AS_IF([test "x$with_libmount" = xyes], [
136 AC_MSG_ERROR([libmount development package is required])
143 # Build kernel modules?
145 AC_DEFUN([LB_CONFIG_MODULES], [
146 AC_MSG_CHECKING([whether to build Linux kernel modules])
147 AC_ARG_ENABLE([modules],
148 AS_HELP_STRING([--disable-modules],
149 [disable building of Lustre kernel modules]),
150 [ AC_DEFINE(HAVE_NATIVE_LINUX_CLIENT, 1, [support native Linux client])], [
151 LC_TARGET_SUPPORTED([enable_modules="yes"],
152 [enable_modules="no"])
154 AC_MSG_RESULT([$enable_modules ($target_os)])
156 AS_IF([test "x$enable_modules" = xyes], [
157 AS_IF([test "x$FLEX" = "x"], [AC_MSG_ERROR([flex package is required to build kernel modules])])
158 AS_IF([test "x$BISON" = "x"], [AC_MSG_ERROR([bison package is required to build kernel modules])])
159 AS_CASE([$target_os],
161 # Ensure SUBARCH is defined
162 SUBARCH=$(echo $target_cpu | sed -e 's/powerpc.*/powerpc/' -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/' -e 's/aarch64.*/arm64/' -e 's/armv7.*/arm/')
168 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR])
171 # Run 'early' checks. The results of these are used in
172 # other configure tests:
173 LIBCFS_SRC_LOCKDEP_IS_HELD
174 LIBCFS_SRC_HAVE_WAIT_BIT_HEADER
175 LIBCFS_SRC_LINUX_BLK_INTEGRITY_HEADER
176 LIBCFS_SRC_HAVE_MMAP_LOCK
178 LB2_LINUX_TEST_COMPILE_ALL([early],
179 [for available lustre kapi interfaces])
181 LIBCFS_LOCKDEP_IS_HELD
182 LIBCFS_HAVE_WAIT_BIT_HEADER
183 LIBCFS_LINUX_BLK_INTEGRITY_HEADER
184 LIBCFS_HAVE_MMAP_LOCK
186 # Run any parallel compile tests
188 LIBCFS_PROG_LINUX_SRC
190 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR_SRC])
193 LB2_LINUX_TEST_COMPILE_ALL([lustre],
194 [for available lustre kapi interfaces])
196 # Collect parallel compile tests results
197 LB_PROG_LINUX_RESULTS
198 LIBCFS_PROG_LINUX_RESULTS
199 LN_PROG_LINUX_RESULTS
200 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR_RESULTS])
201 LC_PROG_LINUX_RESULTS
204 # This is strange - Lustre supports a target we don't
205 AC_MSG_ERROR([Modules are not supported on $target_os])
207 # Use OpenSFS UAPI header path instead of linux kernel
208 CPPFLAGS="-I$PWD/lnet/include/uapi -I$PWD/lustre/include/uapi $CPPFLAGS"
210 ]) # LB_CONFIG_MODULES
217 AC_DEFUN([LB_CONFIG_UTILS], [
218 AC_MSG_CHECKING([whether to build Lustre utilities])
219 AC_ARG_ENABLE([utils],
220 AS_HELP_STRING([--disable-utils],
221 [disable building of Lustre utility programs]),
222 [], [enable_utils="yes"])
223 AC_MSG_RESULT([$enable_utils])
229 # Build LNet Unit Test Framework?
231 AC_DEFUN([LB_CONFIG_LUTF], [
233 AS_IF([test "x$enable_dist" != xno], [
236 AS_IF([test "x$PYTHON_VERSION_CHECK" = xno], [
239 AX_PKG_SWIG(2.0, [ enable_lutf="yes" ],
240 [ enable_lutf="no" ])
243 AC_ARG_ENABLE([lutf],
244 AS_HELP_STRING([--disable-lutf],
245 [disable building of LUTF]),
246 [], [enable_lutf="yes"])
247 AC_MSG_CHECKING([whether to build LUTF (LNet Unit Test Framework)])
248 AC_MSG_RESULT([$enable_lutf])
254 # Build Lustre/LNet regression tests?
256 AC_DEFUN([LB_CONFIG_TESTS], [
257 AC_MSG_CHECKING([whether to build Lustre tests])
258 AC_ARG_ENABLE([tests],
259 AS_HELP_STRING([--disable-tests],
260 [disable building of Lustre tests]),
261 [], [enable_tests="yes"])
262 AC_MSG_RESULT([$enable_tests])
268 # Just enough configure so that "make dist" is useful
270 # this simply re-adjusts some defaults, which of course can be overridden
271 # on the configure line after the --for-dist option
273 AC_DEFUN([LB_CONFIG_DIST], [
274 AC_MSG_CHECKING([whether to configure just enough for make dist])
275 AC_ARG_ENABLE([dist],
276 AS_HELP_STRING([--enable-dist],
277 [only configure enough for make dist]),
278 [], [enable_dist="no"])
279 AC_MSG_RESULT([$enable_dist])
280 AS_IF([test "x$enable_dist" != xno], [
293 AC_DEFUN([LB_CONFIG_DOCS], [
294 AC_MSG_CHECKING([whether to build Lustre docs])
296 AS_HELP_STRING([--disable-doc],
297 [skip creation of pdf documentation]),
298 [], [enable_doc="no"])
299 AC_MSG_RESULT([$enable_doc])
300 AS_IF([test "x$enable_doc" = xyes],
301 [ENABLE_DOC=1], [ENABLE_DOC=0])
310 AC_DEFUN([LB_CONFIG_MANPAGES], [
311 AC_MSG_CHECKING([whether to build Lustre manpages])
312 AC_ARG_ENABLE([manpages],
313 AS_HELP_STRING([--disable-manpages],
314 [skip creation and inclusion of man pages (default is enable)]),
315 [], [enable_manpages="yes"])
316 AC_MSG_RESULT([$enable_manpages])
317 ]) # LB_CONFIG_MANPAGES
322 # add -include config.h
324 AC_DEFUN([LB_CONFIG_HEADERS], [
325 AC_CONFIG_HEADERS([config.h])
326 CPPFLAGS="-include $PWD/undef.h -include $PWD/config.h $CPPFLAGS"
327 EXTRA_KCFLAGS="-include $PWD/undef.h -include $PWD/config.h $EXTRA_KCFLAGS"
328 AC_SUBST(EXTRA_KCFLAGS)
329 ]) # LB_CONFIG_HEADERS
334 # defines for including the toplevel Rules
336 AC_DEFUN([LB_INCLUDE_RULES], [
337 INCLUDE_RULES="include $PWD/Rules"
338 AC_SUBST(INCLUDE_RULES)
339 ]) # LB_INCLUDE_RULES
344 # 'fixup' default paths
346 AC_DEFUN([LB_PATH_DEFAULTS], [
347 # directories for binaries
348 AC_PREFIX_DEFAULT([/usr])
353 # Directories for documentation and demos.
354 docdir='${datadir}/doc/$(PACKAGE)'
360 ]) # LB_PATH_DEFAULTS
365 # AM_CONDITIONAL instances for everything
366 # (so that portals/lustre can disable some if needed)
368 AC_DEFUN([LB_CONDITIONALS], [
369 AM_CONDITIONAL([PLUGINS], [test x$enable_shared = xyes])
370 AM_CONDITIONAL([MODULES], [test x$enable_modules = xyes])
371 AM_CONDITIONAL([UTILS], [test x$enable_utils = xyes])
372 AM_CONDITIONAL([TESTS], [test x$enable_tests = xyes])
373 AM_CONDITIONAL([DOC], [test x$ENABLE_DOC = x1])
374 AM_CONDITIONAL([MANPAGES], [test x$enable_manpages = xyes])
375 AM_CONDITIONAL([LINUX], [test x$lb_target_os = xlinux])
376 AM_CONDITIONAL([USE_QUILT], [test x$use_quilt = xyes])
377 AM_CONDITIONAL([RHEL], [test -f /etc/redhat-release -o -f /etc/openEuler-release])
378 AM_CONDITIONAL([SUSE], [test -f /etc/SUSE-brand -o -f /etc/SuSE-release])
379 AM_CONDITIONAL([UBUNTU], [test x$UBUNTU_KERNEL = xyes])
380 AM_CONDITIONAL([BUILD_LUTF], [test x$enable_lutf = xyes])
381 AM_CONDITIONAL([DEQUOTE_CC_VERSION_TEXT], [test x$lb_cv_dequote_CC_VERSION_TEXT = xyes])
390 # build-specific config files
392 AC_DEFUN([LB_CONFIG_FILES], [
397 [Rules:build/Rules.in]
398 AC_PACKAGE_TARNAME[.spec]
399 AC_PACKAGE_TARNAME[-dkms.spec]
402 lustre/utils/lustre.pc
403 lustre-iokit/Makefile
404 lustre-iokit/obdfilter-survey/Makefile
405 lustre-iokit/ost-survey/Makefile
406 lustre-iokit/sgpdd-survey/Makefile
407 lustre-iokit/mds-survey/Makefile
408 lustre-iokit/ior-survey/Makefile
409 lustre-iokit/stats-collect/Makefile
410 lustre-iokit/lst-survey/Makefile
417 AC_DEFUN([LB_CONFIG_SERVERS], [
418 AC_ARG_ENABLE([server],
419 AS_HELP_STRING([--disable-server],
420 [disable Lustre server support]), [
421 AS_IF([test x$enable_server != xyes -a x$enable_server != xno],
422 [AC_MSG_ERROR([server valid options are "yes" or "no"])])
423 AS_IF([test x$enable_server = xyes -a x$enable_dist = xyes],
424 [AC_MSG_ERROR([--enable-server cannot be used with --enable-dist])])
426 AS_IF([test x$enable_dist = xyes],
427 [enable_server=no], [enable_server=maybe])
430 # There are at least two good reasons why we should really run
431 # LB_CONFIG_MODULES elsewhere before the call to LB_CONFIG_SERVERS:
432 # LB_CONFIG_MODULES needs to be run for client support even when
433 # servers are disabled, and because module support is actually a
434 # prerequisite of server support. However, some things under
435 # LB_CONFIG_MODULES need us to already have checked for --disable-server,
436 # before running, so until LB_CONFIG_MODULES can be reorganized, we
439 AS_IF([test x$enable_modules = xno], [enable_server=no])
443 # If no backends were configured, and the user did not explicitly
444 # require servers to be enabled, we just disable servers.
445 AS_IF([test x$enable_ldiskfs = xno -a x$enable_zfs = xno], [
446 AS_CASE([$enable_server],
447 [maybe], [enable_server=no],
448 [yes], [AC_MSG_ERROR([cannot enable servers, no backends were configured])])
450 AS_IF([test x$enable_server = xmaybe], [enable_server=yes])
453 AC_MSG_CHECKING([whether to build Lustre server support])
454 AC_MSG_RESULT([$enable_server])
455 AS_IF([test x$enable_server = xyes], [
456 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
457 AC_SUBST(ENABLE_SERVER, yes)
459 AC_SUBST(ENABLE_SERVER, no)
461 ]) # LB_CONFIG_SERVERS
464 # LB_CONFIG_RPMBUILD_OPTIONS
466 # The purpose of this function is to assemble command line options
467 # for the rpmbuild command based on the options passed to the configure
468 # script, and also upon the decisions that configure makes based on
469 # the tests that it runs.
470 # These strings can be passed to rpmbuild on the command line
471 # in the Make targets named "rpms" and "srpm".
473 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
476 eval set -- $ac_configure_args
480 -C | --cache-file=* ) ;;
481 --prefix=* | --*-prefix=* ) ;;
483 --with-kmp-moddir=* ) ;;
484 --with-linux=* | --with-linux-obj=* ) ;;
485 --enable-shared | --disable-shared ) ;;
486 --enable-static | --disable-static ) ;;
487 --enable-ldiskfs | --disable-ldiskfs ) ;;
488 --enable-modules | --disable-modules ) ;;
489 --enable-server | --disable-server ) ;;
490 --enable-tests | --disable-tests ) ;;
491 --enable-utils | --disable-utils ) ;;
492 --enable-iokit | --disable-iokit ) ;;
493 --enable-manpages | --disable-manpages ) ;;
494 * ) CONFIGURE_ARGS="$CONFIGURE_ARGS '$arg'" ;;
497 if test -n "$CONFIGURE_ARGS" ; then
498 RPMBINARGS="$RPMBINARGS --define \"configure_args $CONFIGURE_ARGS\""
500 if test -n "$LINUX" ; then
501 RPMBINARGS="$RPMBINARGS --define \"kdir $LINUX\""
502 if test -n "$LINUX_OBJ" -a "$LINUX_OBJ" != x"$LINUX" ; then
503 RPMBINARGS="$RPMBINARGS --define \"kobjdir $LINUX_OBJ\""
506 if test x$enable_modules != xyes ; then
507 RPMBINARGS="$RPMBINARGS --without lustre_modules"
509 if test x$enable_tests != xyes ; then
510 RPMBINARGS="$RPMBINARGS --without lustre_tests"
512 if test x$enable_lutf != xyes ; then
513 RPMBINARGS="$RPMBINARGS --without lustre_tests_lutf"
515 if test x$enable_utils != xyes ; then
516 RPMBINARGS="$RPMBINARGS --without lustre_utils"
518 if test x$enable_server != xyes ; then
519 RPMBINARGS="$RPMBINARGS --without servers"
521 if test x$enable_ldiskfs != xyes ; then
522 RPMBINARGS="$RPMBINARGS --without ldiskfs"
524 if test x$enable_zfs = xyes ; then
525 RPMBINARGS="$RPMBINARGS --with zfs"
527 if test x$enable_gss_keyring = xyes ; then
528 RPMBINARGS="$RPMBINARGS --with gss_keyring --with gss"
530 if test x$enable_gss = xyes ; then
531 RPMBINARGS="$RPMBINARGS --with gss"
532 AC_SUBST(ENABLE_GSS, yes)
533 elif test x$enable_gss = xno ; then
534 RPMBINARGS="$RPMBINARGS --without gss"
535 AC_SUBST(ENABLE_GSS, no)
537 if test x$enable_crypto = xyes ; then
538 RPMBINARGS="$RPMBINARGS --with crypto"
539 AC_SUBST(ENABLE_CRYPTO, yes)
540 elif test x$enable_crypto = xno ; then
541 RPMBINARGS="$RPMBINARGS --without crypto"
542 AC_SUBST(ENABLE_CRYPTO, no)
544 if test x$enable_multiple_lnds = xyes ; then
545 RPMBINARGS="$RPMBINARGS --with multiple_lnds"
547 RPMBINARGS="$RPMBINARGS --without multiple_lnds"
549 if test x$EXTERNAL_KO2IBLND = xyes ; then
550 RPMBINARGS="$RPMBINARGS --with mofed"
552 RPMBINARGS="$RPMBINARGS --without mofed"
554 if test x$BUILT_IN_KO2IBLND = xyes ; then
555 RPMBINARGS="$RPMBINARGS --with o2ib"
557 RPMBINARGS="$RPMBINARGS --without o2ib"
559 if test x$KFILND = xkfilnd ; then
560 RPMBINARGS="$RPMBINARGS --with kfi"
562 RPMBINARGS="$RPMBINARGS --without kfi"
564 if test x$ENABLE_GNI = xyes ; then
565 RPMBINARGS="$RPMBINARGS --with gni"
567 RPMBINARGS="$RPMBINARGS --without gni"
569 if test x$enable_iokit != xyes ; then
570 RPMBINARGS="$RPMBINARGS --without lustre_iokit"
572 if test x$enable_manpages != xyes ; then
573 RPMBINARGS="$RPMBINARGS --without manpages"
575 if test x$enable_shared != xyes ; then
576 RPMBINARGS="$RPMBINARGS --without shared"
578 if test x$enable_static != xyes ; then
579 RPMBINARGS="$RPMBINARGS --without static"
581 if test x$enable_mpitests != xyes ; then
582 RPMBINARGS="$RPMBINARGS --without mpi"
585 RPMBUILD_BINARY_ARGS=$RPMBINARGS
587 AC_SUBST(RPMBUILD_BINARY_ARGS)
588 ]) # LB_CONFIG_RPMBUILD_OPTIONS
591 # LB_CONFIG_CACHE_OPTIONS
593 # Propagate config cache option
595 AC_DEFUN([LB_CONFIG_CACHE_OPTIONS], [
597 if test -f "$cache_file"; then
598 CONFIG_CACHE_FILE=$(readlink --canonicalize "$cache_file")
600 AC_SUBST(CONFIG_CACHE_FILE)
601 ]) # LB_CONFIG_CACHE_OPTIONS
606 # main configure steps
608 AC_DEFUN([LB_CONFIGURE], [
609 AC_MSG_NOTICE([Lustre base checks
610 ==============================================================================])
615 LB_DOWNSTREAM_RELEASE
633 LC_GLIBC_SUPPORT_COPY_FILE_RANGE
636 # Tests depends from utils (multiop from liblustreapi)
637 AS_IF([test "x$enable_utils" = xno], [enable_tests="no"])
639 AS_IF([test "x$enable_utils" = xyes], [
642 LC_FID2PATH_ANON_UNION
644 AS_IF([test "x$enable_tests" = xyes], [
646 LC_GLIBC_SUPPORT_FHANDLES
652 AS_IF([test "x$enable_dist" != xno], [],[LB_LIBMOUNT])
655 LB_DEFINE_E2FSPROGS_NAMES
671 AC_SUBST(ac_configure_args)
673 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
674 AC_SUBST(MOSTLYCLEANFILES)
676 LB_CONFIG_RPMBUILD_OPTIONS
677 LB_CONFIG_CACHE_OPTIONS
679 AS_IF([test -d $TEST_DIR -a "x${PARALLEL_BUILD_OPT}" != "xdebug"], [
680 AC_MSG_NOTICE([remove temporary parallel configure dir $TEST_DIR])