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)])
155 AS_IF([test "x$enable_modules" = xyes], [
156 AS_IF([test "x$FLEX" = "x"], [AC_MSG_ERROR(
157 [flex package is required to build kernel modules])])
158 AS_IF([test "x$BISON" = "x"], [AC_MSG_ERROR(
159 [bison package is required to build kernel modules])])
160 AS_CASE([$target_os], [linux*], [
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/')
164 AS_IF([test "x$enable_server" != xno],
165 [LB_EXT4_SOURCE_PATH])
167 # This is strange - Lustre supports a target we don't
168 AC_MSG_ERROR([Modules are not supported on $target_os])
172 AC_DEFUN([LB_KABI_CHECKS], [
173 AS_CASE([$target_os],
175 # Ensure SUBARCH is defined
176 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/')
182 AS_IF([test "x$enable_zfs" = xyes],
183 [LZ_ZFS_KABI_SERIAL])
185 # Run 'early' checks. The results of these are used in
186 # other configure tests:
187 LIBCFS_SRC_LOCKDEP_IS_HELD
188 LIBCFS_SRC_HAVE_WAIT_BIT_HEADER
189 LIBCFS_SRC_LINUX_BLK_INTEGRITY_HEADER
190 LIBCFS_SRC_HAVE_MMAP_LOCK
192 LB2_LINUX_TEST_COMPILE_ALL([early],
193 [for available lustre kapi interfaces])
195 LIBCFS_LOCKDEP_IS_HELD
196 LIBCFS_HAVE_WAIT_BIT_HEADER
197 LIBCFS_LINUX_BLK_INTEGRITY_HEADER
198 LIBCFS_HAVE_MMAP_LOCK
200 # Run any parallel compile tests
202 LIBCFS_PROG_LINUX_SRC
204 AS_IF([test "x$enable_server" != xno],
205 [LB_EXT4_LDISKFS_TESTS])
207 AS_IF([test "x$enable_zfs" = xyes],
210 LB2_LINUX_TEST_COMPILE_ALL([lustre],
211 [for available lustre kapi interfaces])
213 # Collect parallel compile tests results
214 LB_PROG_LINUX_RESULTS
215 LIBCFS_PROG_LINUX_RESULTS
216 LN_PROG_LINUX_RESULTS
217 AS_IF([test "x$enable_server" != xno],
218 [LB_EXT4_LDISKFS_CHECKS])
219 LC_PROG_LINUX_RESULTS
220 AS_IF([test "x$enable_zfs" = xyes],
221 [LZ_KABI_ZFS_CHECKS])
224 # This is strange - Lustre supports a target we don't
225 AC_MSG_ERROR([Modules are not supported on $target_os])
227 # Use OpenSFS UAPI header path instead of linux kernel
228 CPPFLAGS="-I$PWD/lnet/include/uapi -I$PWD/lustre/include/uapi $CPPFLAGS"
230 ]) # LB_CONFIG_MODULES
237 AC_DEFUN([LB_CONFIG_UTILS], [
238 AC_MSG_CHECKING([whether to build Lustre utilities])
239 AC_ARG_ENABLE([utils],
240 AS_HELP_STRING([--disable-utils],
241 [disable building of Lustre utility programs]),
242 [], [enable_utils="yes"])
243 AC_MSG_RESULT([$enable_utils])
249 # Build LNet Unit Test Framework?
251 AC_DEFUN([LB_CONFIG_LUTF], [
253 AS_IF([test "x$enable_dist" != xno], [
256 AS_IF([test "x$PYTHON_VERSION_CHECK" = xno], [
259 AX_PKG_SWIG(2.0, [ enable_lutf="yes" ],
260 [ enable_lutf="no" ])
263 AC_ARG_ENABLE([lutf],
264 AS_HELP_STRING([--disable-lutf],
265 [disable building of LUTF]),
266 [], [enable_lutf="yes"])
267 AC_MSG_CHECKING([whether to build LUTF (LNet Unit Test Framework)])
268 AC_MSG_RESULT([$enable_lutf])
274 # Build Lustre/LNet regression tests?
276 AC_DEFUN([LB_CONFIG_TESTS], [
277 AC_MSG_CHECKING([whether to build Lustre tests])
278 AC_ARG_ENABLE([tests],
279 AS_HELP_STRING([--disable-tests],
280 [disable building of Lustre tests]),
281 [], [enable_tests="yes"])
282 AC_MSG_RESULT([$enable_tests])
288 # Just enough configure so that "make dist" is useful
290 # this simply re-adjusts some defaults, which of course can be overridden
291 # on the configure line after the --for-dist option
293 AC_DEFUN([LB_CONFIG_DIST], [
294 AC_MSG_CHECKING([whether to configure just enough for make dist])
295 AC_ARG_ENABLE([dist],
296 AS_HELP_STRING([--enable-dist],
297 [only configure enough for make dist]),
298 [], [enable_dist="no"])
299 AC_MSG_RESULT([$enable_dist])
300 AS_IF([test "x$enable_dist" != xno], [
313 AC_DEFUN([LB_CONFIG_DOCS], [
314 AC_MSG_CHECKING([whether to build Lustre docs])
316 AS_HELP_STRING([--disable-doc],
317 [skip creation of pdf documentation]),
318 [], [enable_doc="no"])
319 AC_MSG_RESULT([$enable_doc])
320 AS_IF([test "x$enable_doc" = xyes],
321 [ENABLE_DOC=1], [ENABLE_DOC=0])
330 AC_DEFUN([LB_CONFIG_MANPAGES], [
331 AC_MSG_CHECKING([whether to build Lustre manpages])
332 AC_ARG_ENABLE([manpages],
333 AS_HELP_STRING([--disable-manpages],
334 [skip creation and inclusion of man pages (default is enable)]),
335 [], [enable_manpages="yes"])
336 AC_MSG_RESULT([$enable_manpages])
337 ]) # LB_CONFIG_MANPAGES
342 # add -include config.h
344 AC_DEFUN([LB_CONFIG_HEADERS], [
345 AC_CONFIG_HEADERS([config.h])
346 CPPFLAGS="-include $PWD/undef.h -include $PWD/config.h $CPPFLAGS"
347 EXTRA_KCFLAGS="-include $PWD/undef.h -include $PWD/config.h $EXTRA_KCFLAGS"
348 AC_SUBST(EXTRA_KCFLAGS)
349 ]) # LB_CONFIG_HEADERS
354 # defines for including the toplevel Rules
356 AC_DEFUN([LB_INCLUDE_RULES], [
357 INCLUDE_RULES="include $PWD/Rules"
358 AC_SUBST(INCLUDE_RULES)
359 ]) # LB_INCLUDE_RULES
364 # 'fixup' default paths
366 AC_DEFUN([LB_PATH_DEFAULTS], [
367 # directories for binaries
368 AC_PREFIX_DEFAULT([/usr])
373 # Directories for documentation and demos.
374 docdir='${datadir}/doc/$(PACKAGE)'
380 ]) # LB_PATH_DEFAULTS
385 # AM_CONDITIONAL instances for everything
386 # (so that portals/lustre can disable some if needed)
388 AC_DEFUN([LB_CONDITIONALS], [
389 AM_CONDITIONAL([PLUGINS], [test x$enable_shared = xyes])
390 AM_CONDITIONAL([MODULES], [test x$enable_modules = xyes])
391 AM_CONDITIONAL([UTILS], [test x$enable_utils = xyes])
392 AM_CONDITIONAL([TESTS], [test x$enable_tests = xyes])
393 AM_CONDITIONAL([DOC], [test x$ENABLE_DOC = x1])
394 AM_CONDITIONAL([MANPAGES], [test x$enable_manpages = xyes])
395 AM_CONDITIONAL([LINUX], [test x$lb_target_os = xlinux])
396 AM_CONDITIONAL([USE_QUILT], [test x$use_quilt = xyes])
397 AM_CONDITIONAL([RHEL], [test -f /etc/redhat-release -o -f /etc/openEuler-release])
398 AM_CONDITIONAL([SUSE], [test -f /etc/SUSE-brand -o -f /etc/SuSE-release])
399 AM_CONDITIONAL([UBUNTU], [test x$UBUNTU_KERNEL = xyes])
400 AM_CONDITIONAL([BUILD_LUTF], [test x$enable_lutf = xyes])
401 AM_CONDITIONAL([DEQUOTE_CC_VERSION_TEXT], [test x$lb_cv_dequote_CC_VERSION_TEXT = xyes])
410 # build-specific config files
412 AC_DEFUN([LB_CONFIG_FILES], [
417 [Rules:build/Rules.in]
418 AC_PACKAGE_TARNAME[.spec]
419 AC_PACKAGE_TARNAME[-dkms.spec]
422 lustre/utils/lustre.pc
423 lustre-iokit/Makefile
424 lustre-iokit/obdfilter-survey/Makefile
425 lustre-iokit/ost-survey/Makefile
426 lustre-iokit/sgpdd-survey/Makefile
427 lustre-iokit/mds-survey/Makefile
428 lustre-iokit/ior-survey/Makefile
429 lustre-iokit/stats-collect/Makefile
430 lustre-iokit/lst-survey/Makefile
437 AC_DEFUN([LB_CONFIG_SERVERS], [
438 AC_ARG_ENABLE([server],
439 AS_HELP_STRING([--disable-server],
440 [disable Lustre server support]), [
441 AS_IF([test x$enable_server != xyes -a x$enable_server != xno],
442 [AC_MSG_ERROR([server valid options are "yes" or "no"])])
443 AS_IF([test x$enable_server = xyes -a x$enable_dist = xyes],
444 [AC_MSG_ERROR([--enable-server cannot be used with --enable-dist])])
446 AS_IF([test x$enable_dist = xyes],
447 [enable_server=no], [enable_server=maybe])
450 # There are at least two good reasons why we should really run
451 # LB_CONFIG_MODULES elsewhere before the call to LB_CONFIG_SERVERS:
452 # LB_CONFIG_MODULES needs to be run for client support even when
453 # servers are disabled, and because module support is actually a
454 # prerequisite of server support. However, some things under
455 # LB_CONFIG_MODULES need us to already have checked for --disable-server,
456 # before running, so until LB_CONFIG_MODULES can be reorganized, we
459 AS_IF([test x$enable_modules = xno], [enable_server=no])
462 AS_IF([test "x$enable_dist" = xno], [
468 # If no backends were configured, and the user did not explicitly
469 # require servers to be enabled, we just disable servers.
470 AS_IF([test x$enable_ldiskfs = xno -a x$enable_zfs = xno], [
471 AS_CASE([$enable_server],
472 [maybe], [enable_server=no],
473 [yes], [AC_MSG_ERROR([cannot enable servers, no backends were configured])])
475 AS_IF([test x$enable_server = xmaybe], [enable_server=yes])
478 AC_MSG_CHECKING([whether to build Lustre server support])
479 AC_MSG_RESULT([$enable_server])
480 AS_IF([test x$enable_server = xyes], [
481 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
482 AC_SUBST(ENABLE_SERVER, yes)
484 AC_SUBST(ENABLE_SERVER, no)
486 ]) # LB_CONFIG_SERVERS
489 # LB_CONFIG_RPMBUILD_OPTIONS
491 # The purpose of this function is to assemble command line options
492 # for the rpmbuild command based on the options passed to the configure
493 # script, and also upon the decisions that configure makes based on
494 # the tests that it runs.
495 # These strings can be passed to rpmbuild on the command line
496 # in the Make targets named "rpms" and "srpm".
498 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
501 eval set -- $ac_configure_args
505 -C | --cache-file=* ) ;;
506 --prefix=* | --*-prefix=* ) ;;
508 --with-kmp-moddir=* ) ;;
509 --with-linux=* | --with-linux-obj=* ) ;;
510 --enable-shared | --disable-shared ) ;;
511 --enable-static | --disable-static ) ;;
512 --enable-ldiskfs | --disable-ldiskfs ) ;;
513 --enable-modules | --disable-modules ) ;;
514 --enable-server | --disable-server ) ;;
515 --enable-tests | --disable-tests ) ;;
516 --enable-utils | --disable-utils ) ;;
517 --enable-iokit | --disable-iokit ) ;;
518 --enable-manpages | --disable-manpages ) ;;
519 * ) CONFIGURE_ARGS="$CONFIGURE_ARGS '$arg'" ;;
522 if test -n "$CONFIGURE_ARGS" ; then
523 RPMBINARGS="$RPMBINARGS --define \"configure_args $CONFIGURE_ARGS\""
525 if test -n "$LINUX" ; then
526 RPMBINARGS="$RPMBINARGS --define \"kdir $LINUX\""
527 if test -n "$LINUX_OBJ" -a "$LINUX_OBJ" != x"$LINUX" ; then
528 RPMBINARGS="$RPMBINARGS --define \"kobjdir $LINUX_OBJ\""
531 if test x$enable_modules != xyes ; then
532 RPMBINARGS="$RPMBINARGS --without lustre_modules"
534 if test x$enable_tests != xyes ; then
535 RPMBINARGS="$RPMBINARGS --without lustre_tests"
537 if test x$enable_lutf != xyes ; then
538 RPMBINARGS="$RPMBINARGS --without lustre_tests_lutf"
540 if test x$enable_utils != xyes ; then
541 RPMBINARGS="$RPMBINARGS --without lustre_utils"
543 if test x$enable_server != xyes ; then
544 RPMBINARGS="$RPMBINARGS --without servers"
546 if test x$enable_ldiskfs != xyes ; then
547 RPMBINARGS="$RPMBINARGS --without ldiskfs"
549 if test x$enable_zfs = xyes ; then
550 RPMBINARGS="$RPMBINARGS --with zfs"
552 if test x$enable_gss_keyring = xyes ; then
553 RPMBINARGS="$RPMBINARGS --with gss_keyring --with gss"
555 if test x$enable_gss = xyes ; then
556 RPMBINARGS="$RPMBINARGS --with gss"
557 AC_SUBST(ENABLE_GSS, yes)
558 elif test x$enable_gss = xno ; then
559 RPMBINARGS="$RPMBINARGS --without gss"
560 AC_SUBST(ENABLE_GSS, no)
562 if test x$enable_crypto = xyes ; then
563 RPMBINARGS="$RPMBINARGS --with crypto"
564 AC_SUBST(ENABLE_CRYPTO, yes)
565 elif test x$enable_crypto = xno ; then
566 RPMBINARGS="$RPMBINARGS --without crypto"
567 AC_SUBST(ENABLE_CRYPTO, no)
569 if test x$enable_multiple_lnds = xyes ; then
570 RPMBINARGS="$RPMBINARGS --with multiple_lnds"
572 RPMBINARGS="$RPMBINARGS --without multiple_lnds"
574 if test x$EXTERNAL_KO2IBLND = xyes ; then
575 RPMBINARGS="$RPMBINARGS --with mofed"
577 RPMBINARGS="$RPMBINARGS --without mofed"
579 if test x$BUILT_IN_KO2IBLND = xyes ; then
580 RPMBINARGS="$RPMBINARGS --with o2ib"
582 RPMBINARGS="$RPMBINARGS --without o2ib"
584 if test x$KFILND = xkfilnd ; then
585 RPMBINARGS="$RPMBINARGS --with kfi"
587 RPMBINARGS="$RPMBINARGS --without kfi"
589 if test x$ENABLE_GNI = xyes ; then
590 RPMBINARGS="$RPMBINARGS --with gni"
592 RPMBINARGS="$RPMBINARGS --without gni"
594 if test x$enable_iokit != xyes ; then
595 RPMBINARGS="$RPMBINARGS --without lustre_iokit"
597 if test x$enable_manpages != xyes ; then
598 RPMBINARGS="$RPMBINARGS --without manpages"
600 if test x$enable_shared != xyes ; then
601 RPMBINARGS="$RPMBINARGS --without shared"
603 if test x$enable_static != xyes ; then
604 RPMBINARGS="$RPMBINARGS --without static"
606 if test x$enable_mpitests != xyes ; then
607 RPMBINARGS="$RPMBINARGS --without mpi"
610 RPMBUILD_BINARY_ARGS=$RPMBINARGS
612 AC_SUBST(RPMBUILD_BINARY_ARGS)
613 ]) # LB_CONFIG_RPMBUILD_OPTIONS
616 # LB_CONFIG_CACHE_OPTIONS
618 # Propagate config cache option
620 AC_DEFUN([LB_CONFIG_CACHE_OPTIONS], [
622 if test -f "$cache_file"; then
623 CONFIG_CACHE_FILE=$(readlink --canonicalize "$cache_file")
625 AC_SUBST(CONFIG_CACHE_FILE)
626 ]) # LB_CONFIG_CACHE_OPTIONS
631 # main configure steps
633 AC_DEFUN([LB_CONFIGURE], [
634 AC_MSG_NOTICE([Lustre base checks
635 ==============================================================================])
640 LB_DOWNSTREAM_RELEASE
658 LC_GLIBC_SUPPORT_COPY_FILE_RANGE
661 # Tests depends from utils (multiop from liblustreapi)
662 AS_IF([test "x$enable_utils" = xno], [enable_tests="no"])
664 AS_IF([test "x$enable_utils" = xyes], [
667 LC_FID2PATH_ANON_UNION
669 AS_IF([test "x$enable_tests" = xyes], [
671 LC_GLIBC_SUPPORT_FHANDLES
677 AS_IF([test "x$enable_dist" != xno], [],[LB_LIBMOUNT])
680 LB_DEFINE_E2FSPROGS_NAMES
696 AC_SUBST(ac_configure_args)
698 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
699 AC_SUBST(MOSTLYCLEANFILES)
701 LB_CONFIG_RPMBUILD_OPTIONS
702 LB_CONFIG_CACHE_OPTIONS
704 AS_IF([test -d $TEST_DIR -a "x${PARALLEL_BUILD_OPT}" != "xdebug"], [
705 AC_MSG_NOTICE([remove temporary parallel configure dir $TEST_DIR])