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
177 LB2_LINUX_TEST_COMPILE_ALL([early],
178 [for available lustre kapi interfaces])
180 LIBCFS_LOCKDEP_IS_HELD
181 LIBCFS_HAVE_WAIT_BIT_HEADER
182 LIBCFS_LINUX_BLK_INTEGRITY_HEADER
184 # Run any parallel compile tests
186 LIBCFS_PROG_LINUX_SRC
188 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR_SRC])
191 LB2_LINUX_TEST_COMPILE_ALL([lustre],
192 [for available lustre kapi interfaces])
194 # Collect parallel compile tests results
195 LB_PROG_LINUX_RESULTS
196 LIBCFS_PROG_LINUX_RESULTS
197 LN_PROG_LINUX_RESULTS
198 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR_RESULTS])
199 LC_PROG_LINUX_RESULTS
202 # This is strange - Lustre supports a target we don't
203 AC_MSG_ERROR([Modules are not supported on $target_os])
205 # Use OpenSFS UAPI header path instead of linux kernel
206 CPPFLAGS="-I$PWD/lnet/include/uapi -I$PWD/lustre/include/uapi $CPPFLAGS"
208 ]) # LB_CONFIG_MODULES
215 AC_DEFUN([LB_CONFIG_UTILS], [
216 AC_MSG_CHECKING([whether to build Lustre utilities])
217 AC_ARG_ENABLE([utils],
218 AS_HELP_STRING([--disable-utils],
219 [disable building of Lustre utility programs]),
220 [], [enable_utils="yes"])
221 AC_MSG_RESULT([$enable_utils])
227 # Build LNet Unit Test Framework?
229 AC_DEFUN([LB_CONFIG_LUTF], [
231 AS_IF([test "x$enable_dist" != xno], [
234 AS_IF([test "x$PYTHON_VERSION_CHECK" = xno], [
237 AX_PKG_SWIG(2.0, [ enable_lutf="yes" ],
238 [ enable_lutf="no" ])
241 AC_ARG_ENABLE([lutf],
242 AS_HELP_STRING([--disable-lutf],
243 [disable building of LUTF]),
244 [], [enable_lutf="yes"])
245 AC_MSG_CHECKING([whether to build LUTF (LNet Unit Test Framework)])
246 AC_MSG_RESULT([$enable_lutf])
252 # Build Lustre/LNet regression tests?
254 AC_DEFUN([LB_CONFIG_TESTS], [
255 AC_MSG_CHECKING([whether to build Lustre tests])
256 AC_ARG_ENABLE([tests],
257 AS_HELP_STRING([--disable-tests],
258 [disable building of Lustre tests]),
259 [], [enable_tests="yes"])
260 AC_MSG_RESULT([$enable_tests])
266 # Just enough configure so that "make dist" is useful
268 # this simply re-adjusts some defaults, which of course can be overridden
269 # on the configure line after the --for-dist option
271 AC_DEFUN([LB_CONFIG_DIST], [
272 AC_MSG_CHECKING([whether to configure just enough for make dist])
273 AC_ARG_ENABLE([dist],
274 AS_HELP_STRING([--enable-dist],
275 [only configure enough for make dist]),
276 [], [enable_dist="no"])
277 AC_MSG_RESULT([$enable_dist])
278 AS_IF([test "x$enable_dist" != xno], [
291 AC_DEFUN([LB_CONFIG_DOCS], [
292 AC_MSG_CHECKING([whether to build Lustre docs])
294 AS_HELP_STRING([--disable-doc],
295 [skip creation of pdf documentation]),
296 [], [enable_doc="no"])
297 AC_MSG_RESULT([$enable_doc])
298 AS_IF([test "x$enable_doc" = xyes],
299 [ENABLE_DOC=1], [ENABLE_DOC=0])
308 AC_DEFUN([LB_CONFIG_MANPAGES], [
309 AC_MSG_CHECKING([whether to build Lustre manpages])
310 AC_ARG_ENABLE([manpages],
311 AS_HELP_STRING([--disable-manpages],
312 [skip creation and inclusion of man pages (default is enable)]),
313 [], [enable_manpages="yes"])
314 AC_MSG_RESULT([$enable_manpages])
315 ]) # LB_CONFIG_MANPAGES
320 # add -include config.h
322 AC_DEFUN([LB_CONFIG_HEADERS], [
323 AC_CONFIG_HEADERS([config.h])
324 CPPFLAGS="-include $PWD/undef.h -include $PWD/config.h $CPPFLAGS"
325 EXTRA_KCFLAGS="-include $PWD/undef.h -include $PWD/config.h $EXTRA_KCFLAGS"
326 AC_SUBST(EXTRA_KCFLAGS)
327 ]) # LB_CONFIG_HEADERS
332 # defines for including the toplevel Rules
334 AC_DEFUN([LB_INCLUDE_RULES], [
335 INCLUDE_RULES="include $PWD/Rules"
336 AC_SUBST(INCLUDE_RULES)
337 ]) # LB_INCLUDE_RULES
342 # 'fixup' default paths
344 AC_DEFUN([LB_PATH_DEFAULTS], [
345 # directories for binaries
346 AC_PREFIX_DEFAULT([/usr])
351 # Directories for documentation and demos.
352 docdir='${datadir}/doc/$(PACKAGE)'
358 ]) # LB_PATH_DEFAULTS
363 # AM_CONDITIONAL instances for everything
364 # (so that portals/lustre can disable some if needed)
366 AC_DEFUN([LB_CONDITIONALS], [
367 AM_CONDITIONAL([PLUGINS], [test x$enable_shared = xyes])
368 AM_CONDITIONAL([MODULES], [test x$enable_modules = xyes])
369 AM_CONDITIONAL([UTILS], [test x$enable_utils = xyes])
370 AM_CONDITIONAL([TESTS], [test x$enable_tests = xyes])
371 AM_CONDITIONAL([DOC], [test x$ENABLE_DOC = x1])
372 AM_CONDITIONAL([MANPAGES], [test x$enable_manpages = xyes])
373 AM_CONDITIONAL([LINUX], [test x$lb_target_os = xlinux])
374 AM_CONDITIONAL([USE_QUILT], [test x$use_quilt = xyes])
375 AM_CONDITIONAL([RHEL], [test -f /etc/redhat-release -o -f /etc/openEuler-release])
376 AM_CONDITIONAL([SUSE], [test -f /etc/SUSE-brand -o -f /etc/SuSE-release])
377 AM_CONDITIONAL([UBUNTU], [test x$UBUNTU_KERNEL = xyes])
378 AM_CONDITIONAL([BUILD_LUTF], [test x$enable_lutf = xyes])
379 AM_CONDITIONAL([DEQUOTE_CC_VERSION_TEXT], [test x$lb_cv_dequote_CC_VERSION_TEXT = xyes])
388 # build-specific config files
390 AC_DEFUN([LB_CONFIG_FILES], [
395 [Rules:build/Rules.in]
396 AC_PACKAGE_TARNAME[.spec]
397 AC_PACKAGE_TARNAME[-dkms.spec]
400 lustre/utils/lustre.pc
401 lustre-iokit/Makefile
402 lustre-iokit/obdfilter-survey/Makefile
403 lustre-iokit/ost-survey/Makefile
404 lustre-iokit/sgpdd-survey/Makefile
405 lustre-iokit/mds-survey/Makefile
406 lustre-iokit/ior-survey/Makefile
407 lustre-iokit/stats-collect/Makefile
408 lustre-iokit/lst-survey/Makefile
415 AC_DEFUN([LB_CONFIG_SERVERS], [
416 AC_ARG_ENABLE([server],
417 AS_HELP_STRING([--disable-server],
418 [disable Lustre server support]), [
419 AS_IF([test x$enable_server != xyes -a x$enable_server != xno],
420 [AC_MSG_ERROR([server valid options are "yes" or "no"])])
421 AS_IF([test x$enable_server = xyes -a x$enable_dist = xyes],
422 [AC_MSG_ERROR([--enable-server cannot be used with --enable-dist])])
424 AS_IF([test x$enable_dist = xyes],
425 [enable_server=no], [enable_server=maybe])
428 # There are at least two good reasons why we should really run
429 # LB_CONFIG_MODULES elsewhere before the call to LB_CONFIG_SERVERS:
430 # LB_CONFIG_MODULES needs to be run for client support even when
431 # servers are disabled, and because module support is actually a
432 # prerequisite of server support. However, some things under
433 # LB_CONFIG_MODULES need us to already have checked for --disable-server,
434 # before running, so until LB_CONFIG_MODULES can be reorganized, we
437 AS_IF([test x$enable_modules = xno], [enable_server=no])
441 # If no backends were configured, and the user did not explicitly
442 # require servers to be enabled, we just disable servers.
443 AS_IF([test x$enable_ldiskfs = xno -a x$enable_zfs = xno], [
444 AS_CASE([$enable_server],
445 [maybe], [enable_server=no],
446 [yes], [AC_MSG_ERROR([cannot enable servers, no backends were configured])])
448 AS_IF([test x$enable_server = xmaybe], [enable_server=yes])
451 AC_MSG_CHECKING([whether to build Lustre server support])
452 AC_MSG_RESULT([$enable_server])
453 AS_IF([test x$enable_server = xyes], [
454 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
455 AC_SUBST(ENABLE_SERVER, yes)
457 AC_SUBST(ENABLE_SERVER, no)
459 ]) # LB_CONFIG_SERVERS
462 # LB_CONFIG_RPMBUILD_OPTIONS
464 # The purpose of this function is to assemble command line options
465 # for the rpmbuild command based on the options passed to the configure
466 # script, and also upon the decisions that configure makes based on
467 # the tests that it runs.
468 # These strings can be passed to rpmbuild on the command line
469 # in the Make targets named "rpms" and "srpm".
471 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
474 eval set -- $ac_configure_args
478 -C | --cache-file=* ) ;;
479 --prefix=* | --*-prefix=* ) ;;
481 --with-kmp-moddir=* ) ;;
482 --with-linux=* | --with-linux-obj=* ) ;;
483 --enable-shared | --disable-shared ) ;;
484 --enable-static | --disable-static ) ;;
485 --enable-ldiskfs | --disable-ldiskfs ) ;;
486 --enable-modules | --disable-modules ) ;;
487 --enable-server | --disable-server ) ;;
488 --enable-tests | --disable-tests ) ;;
489 --enable-utils | --disable-utils ) ;;
490 --enable-iokit | --disable-iokit ) ;;
491 --enable-manpages | --disable-manpages ) ;;
492 * ) CONFIGURE_ARGS="$CONFIGURE_ARGS '$arg'" ;;
495 if test -n "$CONFIGURE_ARGS" ; then
496 RPMBINARGS="$RPMBINARGS --define \"configure_args $CONFIGURE_ARGS\""
498 if test -n "$LINUX" ; then
499 RPMBINARGS="$RPMBINARGS --define \"kdir $LINUX\""
500 if test -n "$LINUX_OBJ" -a "$LINUX_OBJ" != x"$LINUX" ; then
501 RPMBINARGS="$RPMBINARGS --define \"kobjdir $LINUX_OBJ\""
504 if test x$enable_modules != xyes ; then
505 RPMBINARGS="$RPMBINARGS --without lustre_modules"
507 if test x$enable_tests != xyes ; then
508 RPMBINARGS="$RPMBINARGS --without lustre_tests"
510 if test x$enable_lutf != xyes ; then
511 RPMBINARGS="$RPMBINARGS --without lustre_tests_lutf"
513 if test x$enable_utils != xyes ; then
514 RPMBINARGS="$RPMBINARGS --without lustre_utils"
516 if test x$enable_server != xyes ; then
517 RPMBINARGS="$RPMBINARGS --without servers"
519 if test x$enable_ldiskfs != xyes ; then
520 RPMBINARGS="$RPMBINARGS --without ldiskfs"
522 if test x$enable_zfs = xyes ; then
523 RPMBINARGS="$RPMBINARGS --with zfs"
525 if test x$enable_gss_keyring = xyes ; then
526 RPMBINARGS="$RPMBINARGS --with gss_keyring --with gss"
528 if test x$enable_gss = xyes ; then
529 RPMBINARGS="$RPMBINARGS --with gss"
530 AC_SUBST(ENABLE_GSS, yes)
531 elif test x$enable_gss = xno ; then
532 RPMBINARGS="$RPMBINARGS --without gss"
533 AC_SUBST(ENABLE_GSS, no)
535 if test x$enable_crypto = xyes ; then
536 RPMBINARGS="$RPMBINARGS --with crypto"
537 AC_SUBST(ENABLE_CRYPTO, yes)
538 elif test x$enable_crypto = xno ; then
539 RPMBINARGS="$RPMBINARGS --without crypto"
540 AC_SUBST(ENABLE_CRYPTO, no)
542 if test x$enable_multiple_lnds = xyes ; then
543 RPMBINARGS="$RPMBINARGS --with multiple_lnds"
545 RPMBINARGS="$RPMBINARGS --without multiple_lnds"
547 if test x$EXTERNAL_KO2IBLND = xyes ; then
548 RPMBINARGS="$RPMBINARGS --with mofed"
550 RPMBINARGS="$RPMBINARGS --without mofed"
552 if test x$BUILT_IN_KO2IBLND = xyes ; then
553 RPMBINARGS="$RPMBINARGS --with o2ib"
555 RPMBINARGS="$RPMBINARGS --without o2ib"
557 if test x$KFILND = xkfilnd ; then
558 RPMBINARGS="$RPMBINARGS --with kfi"
560 RPMBINARGS="$RPMBINARGS --without kfi"
562 if test x$ENABLE_GNI = xyes ; then
563 RPMBINARGS="$RPMBINARGS --with gni"
565 RPMBINARGS="$RPMBINARGS --without gni"
567 if test x$enable_iokit != xyes ; then
568 RPMBINARGS="$RPMBINARGS --without lustre_iokit"
570 if test x$enable_manpages != xyes ; then
571 RPMBINARGS="$RPMBINARGS --without manpages"
573 if test x$enable_shared != xyes ; then
574 RPMBINARGS="$RPMBINARGS --without shared"
576 if test x$enable_static != xyes ; then
577 RPMBINARGS="$RPMBINARGS --without static"
579 if test x$enable_mpitests != xyes ; then
580 RPMBINARGS="$RPMBINARGS --without mpi"
583 RPMBUILD_BINARY_ARGS=$RPMBINARGS
585 AC_SUBST(RPMBUILD_BINARY_ARGS)
586 ]) # LB_CONFIG_RPMBUILD_OPTIONS
589 # LB_CONFIG_CACHE_OPTIONS
591 # Propagate config cache option
593 AC_DEFUN([LB_CONFIG_CACHE_OPTIONS], [
595 if test -f "$cache_file"; then
596 CONFIG_CACHE_FILE=$(readlink --canonicalize "$cache_file")
598 AC_SUBST(CONFIG_CACHE_FILE)
599 ]) # LB_CONFIG_CACHE_OPTIONS
604 # main configure steps
606 AC_DEFUN([LB_CONFIGURE], [
607 AC_MSG_NOTICE([Lustre base checks
608 ==============================================================================])
613 LB_DOWNSTREAM_RELEASE
631 LC_GLIBC_SUPPORT_COPY_FILE_RANGE
634 # Tests depends from utils (multiop from liblustreapi)
635 AS_IF([test "x$enable_utils" = xno], [enable_tests="no"])
637 AS_IF([test "x$enable_utils" = xyes], [
639 LC_FID2PATH_ANON_UNION
641 AS_IF([test "x$enable_tests" = xyes], [
643 LC_GLIBC_SUPPORT_FHANDLES
649 AS_IF([test "x$enable_dist" != xno], [],[LB_LIBMOUNT])
652 LB_DEFINE_E2FSPROGS_NAMES
668 AC_SUBST(ac_configure_args)
670 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
671 AC_SUBST(MOSTLYCLEANFILES)
673 LB_CONFIG_RPMBUILD_OPTIONS
674 LB_CONFIG_CACHE_OPTIONS
676 AS_IF([test -d $TEST_DIR -a "x${PARALLEL_BUILD_OPT}" != "xdebug"], [
677 AC_MSG_NOTICE([remove temporary parallel configure dir $TEST_DIR])