4 # fixup $target_os for use in other places
6 AC_DEFUN([LB_CANONICAL_SYSTEM], [
12 AC_SUBST(lb_target_os)
13 ]) # LB_CANONICAL_SYSTEM
16 # LB_DOWNSTREAM_RELEASE (DEPRECATED)
18 AC_DEFUN([LB_DOWNSTREAM_RELEASE],
19 [AC_ARG_WITH([downstream-release],,
20 AC_MSG_ERROR([--downstream-release was deprecated. Please read Documentation/versioning.txt.])
21 )]) # LB_DOWNSTREAM_RELEASE
26 # Check for file existence even when cross compiling
31 AC_DEFUN([LB_CHECK_FILE], [
32 AS_VAR_PUSHDEF([lb_file], [lb_cv_file_$1])dnl
33 AC_CACHE_CHECK([for $1], lb_file, [
35 [AS_VAR_SET(lb_file, [yes])],
36 [AS_VAR_SET(lb_file, [no])])
38 AS_VAR_IF([lb_file], [yes], [$2], [$3])[]dnl
39 AS_VAR_POPDEF([lb_file])dnl
43 # LB_ARG_LIBS_INCLUDES
45 # support for --with-foo, --with-foo-includes, and --with-foo-libs in
46 # a single magical macro
48 AC_DEFUN([LB_ARG_LIBS_INCLUDES], [
49 lb_pathvar="m4_bpatsubst([$2], -, _)"
50 AC_MSG_CHECKING([for $1])
52 AS_HELP_STRING([--with-$2=path],
55 AS_IF([test "x$withval" = xyes],
56 [eval "$lb_pathvar='$3'"],
57 [eval "$lb_pathvar='$withval'"])
58 AC_MSG_RESULT([${!lb_pathvar:-no}])
60 AS_IF([test "x${!lb_pathvar}" != x -a "x${!lb_pathvar}" != xno], [
61 AC_MSG_CHECKING([for $1 includes])
62 AC_ARG_WITH([$2-includes],
63 AS_HELP_STRING([--with-$2-includes=path],
64 [path to $1 includes]),
67 lb_includevar="${lb_pathvar}_includes"
68 AS_IF([test "x$withval" = xyes],
69 [eval "${lb_includevar}='${!lb_pathvar}/include'"],
70 [eval "${lb_includevar}='$withval'"])
71 AC_MSG_RESULT([${!lb_includevar}])
73 AC_MSG_CHECKING([for $1 libs])
74 AC_ARG_WITH([$2-libs],
75 AS_HELP_STRING([--with-$2-libs=path],
79 lb_libvar="${lb_pathvar}_libs"
80 AS_IF([test "x$withval" = xyes],
81 [eval "${lb_libvar}='${!lb_pathvar}/lib'"],
82 [eval "${lb_libvar}='$withval'"])
83 AC_MSG_RESULT([${!lb_libvar}])
85 ]) # LB_ARG_LIBS_INCLUDES
90 # We no longer handle external lustre-iokit
92 AC_DEFUN([LB_PATH_LUSTREIOKIT], [
93 AC_MSG_CHECKING([whether to build iokit])
94 AC_ARG_ENABLE([iokit],
95 AS_HELP_STRING([--disable-iokit],
96 [disable iokit (default is enable)]),
97 [], [enable_iokit="yes"])
98 AC_MSG_RESULT([$enable_iokit])
99 AS_IF([test "x$enable_iokit" = xyes],
100 [LUSTREIOKIT_SUBDIR="lustre-iokit"],
101 [LUSTREIOKIT_SUBDIR=""])
102 AC_SUBST(LUSTREIOKIT_SUBDIR)
103 AM_CONDITIONAL([BUILD_LUSTREIOKIT], [test "x$enable_iokit" = xyes])
104 ]) # LB_PATH_LUSTREIOKIT
109 # Check whether build with libmount for mount.lustre.
110 # libmount is part of the util-linux since v2.18.
111 # We need it to manipulate utab file.
113 AC_DEFUN([LB_LIBMOUNT], [
114 AC_CHECK_HEADER([libmount/libmount.h], [
115 AC_CHECK_LIB([mount], [mnt_update_set_fs], [
119 ],[with_libmount="no"])
120 ], [with_libmount="no"])
121 AC_MSG_CHECKING([whether to build with libmount])
122 AS_IF([test "x$with_libmount" = xyes], [
126 AC_MSG_ERROR([libmount development package is required])
133 # check for in-tree snmp support
135 AC_DEFUN([LB_PATH_SNMP], [
136 LB_CHECK_FILE([$srcdir/snmp/lustre-snmp.c], [SNMP_DIST_SUBDIR="snmp"])
137 AC_SUBST(SNMP_DIST_SUBDIR)
138 AC_SUBST(SNMP_SUBDIR)
144 # Build kernel modules?
146 AC_DEFUN([LB_CONFIG_MODULES], [
147 AC_MSG_CHECKING([whether to build Linux kernel modules])
148 AC_ARG_ENABLE([modules],
149 AS_HELP_STRING([--disable-modules],
150 [disable building of Lustre kernel modules]),
151 [ AC_DEFINE(HAVE_NATIVE_LINUX_CLIENT, 1, [support native Linux client])], [
152 LC_TARGET_SUPPORTED([enable_modules="yes"],
153 [enable_modules="no"])
155 AC_MSG_RESULT([$enable_modules ($target_os)])
157 AS_IF([test "x$enable_modules" = xyes], [
158 AS_IF([test "x$FLEX" = "x"], [AC_MSG_ERROR([flex package is required to build kernel modules])])
159 AS_IF([test "x$BISON" = "x"], [AC_MSG_ERROR([bison package is required to build kernel modules])])
160 AS_CASE([$target_os],
162 # Ensure SUBARCH is defined
163 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/')
169 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR])
172 # Run any parallel compile tests
174 LIBCFS_PROG_LINUX_SRC
176 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR_SRC])
179 LB2_LINUX_TEST_COMPILE_ALL([lustre],
180 [for available lustre kapi interfaces])
182 # Collect parallel compile tests results
183 LB_PROG_LINUX_RESULTS
184 LIBCFS_PROG_LINUX_RESULTS
185 LN_PROG_LINUX_RESULTS
186 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR_RESULTS])
187 LC_PROG_LINUX_RESULTS
190 # This is strange - Lustre supports a target we don't
191 AC_MSG_ERROR([Modules are not supported on $target_os])
193 # Use OpenSFS UAPI header path instead of linux kernel
194 CPPFLAGS="-I$PWD/lnet/include/uapi -I$PWD/lustre/include/uapi $CPPFLAGS"
196 ]) # LB_CONFIG_MODULES
203 AC_DEFUN([LB_CONFIG_UTILS], [
204 AC_MSG_CHECKING([whether to build Lustre utilities])
205 AC_ARG_ENABLE([utils],
206 AS_HELP_STRING([--disable-utils],
207 [disable building of Lustre utility programs]),
208 [], [enable_utils="yes"])
209 AC_MSG_RESULT([$enable_utils])
217 AC_DEFUN([LB_CONFIG_TESTS], [
218 AC_MSG_CHECKING([whether to build Lustre tests])
219 AC_ARG_ENABLE([tests],
220 AS_HELP_STRING([--disable-tests],
221 [disable building of Lustre tests]),
222 [], [enable_tests="yes"])
225 # Check to see if we can build the lutf
228 AS_IF([test "x$enable_dist" != xno], [
231 AS_IF([test "x$PYTHON_VERSION_CHECK" = xno], [
234 AX_PKG_SWIG(2.0, [ enable_lutf="yes" ],
235 [ enable_lutf="no" ])
239 AC_MSG_RESULT([$enable_tests])
245 # Just enough configure so that "make dist" is useful
247 # this simply re-adjusts some defaults, which of course can be overridden
248 # on the configure line after the --for-dist option
250 AC_DEFUN([LB_CONFIG_DIST], [
251 AC_MSG_CHECKING([whether to configure just enough for make dist])
252 AC_ARG_ENABLE([dist],
253 AS_HELP_STRING([--enable-dist],
254 [only configure enough for make dist]),
255 [], [enable_dist="no"])
256 AC_MSG_RESULT([$enable_dist])
257 AS_IF([test "x$enable_dist" != xno], [
270 AC_DEFUN([LB_CONFIG_DOCS], [
271 AC_MSG_CHECKING([whether to build Lustre docs])
273 AS_HELP_STRING([--disable-doc],
274 [skip creation of pdf documentation]),
275 [], [enable_doc="no"])
276 AC_MSG_RESULT([$enable_doc])
277 AS_IF([test "x$enable_doc" = xyes],
278 [ENABLE_DOC=1], [ENABLE_DOC=0])
287 AC_DEFUN([LB_CONFIG_MANPAGES], [
288 AC_MSG_CHECKING([whether to build Lustre manpages])
289 AC_ARG_ENABLE([manpages],
290 AS_HELP_STRING([--disable-manpages],
291 [skip creation and inclusion of man pages (default is enable)]),
292 [], [enable_manpages="yes"])
293 AC_MSG_RESULT([$enable_manpages])
294 ]) # LB_CONFIG_MANPAGES
299 # add -include config.h
301 AC_DEFUN([LB_CONFIG_HEADERS], [
302 AC_CONFIG_HEADERS([config.h])
303 CPPFLAGS="-include $PWD/undef.h -include $PWD/config.h $CPPFLAGS"
304 EXTRA_KCFLAGS="-include $PWD/undef.h -include $PWD/config.h $EXTRA_KCFLAGS"
305 AC_SUBST(EXTRA_KCFLAGS)
306 ]) # LB_CONFIG_HEADERS
311 # defines for including the toplevel Rules
313 AC_DEFUN([LB_INCLUDE_RULES], [
314 INCLUDE_RULES="include $PWD/Rules"
315 AC_SUBST(INCLUDE_RULES)
316 ]) # LB_INCLUDE_RULES
321 # 'fixup' default paths
323 AC_DEFUN([LB_PATH_DEFAULTS], [
324 # directories for binaries
325 AC_PREFIX_DEFAULT([/usr])
330 # Directories for documentation and demos.
331 docdir='${datadir}/doc/$(PACKAGE)'
337 ]) # LB_PATH_DEFAULTS
342 # AM_CONDITIONAL instances for everything
343 # (so that portals/lustre can disable some if needed)
345 AC_DEFUN([LB_CONDITIONALS], [
346 AM_CONDITIONAL([PLUGINS], [test x$enable_shared = xyes])
347 AM_CONDITIONAL([MODULES], [test x$enable_modules = xyes])
348 AM_CONDITIONAL([UTILS], [test x$enable_utils = xyes])
349 AM_CONDITIONAL([TESTS], [test x$enable_tests = xyes])
350 AM_CONDITIONAL([DOC], [test x$ENABLE_DOC = x1])
351 AM_CONDITIONAL([MANPAGES], [test x$enable_manpages = xyes])
352 AM_CONDITIONAL([LINUX], [test x$lb_target_os = xlinux])
353 AM_CONDITIONAL([USE_QUILT], [test x$use_quilt = xyes])
354 AM_CONDITIONAL([RHEL], [test -f /etc/redhat-release -o -f /etc/openEuler-release])
355 AM_CONDITIONAL([SUSE], [test -f /etc/SUSE-brand -o -f /etc/SuSE-release])
356 AM_CONDITIONAL([UBUNTU], [test x$UBUNTU_KERNEL = xyes])
357 AM_CONDITIONAL([BUILD_LUTF], [test x$enable_lutf = xyes])
358 AM_CONDITIONAL([DEQUOTE_CC_VERSION_TEXT], [test x$lb_cv_dequote_CC_VERSION_TEXT = xyes])
367 # build-specific config files
369 AC_DEFUN([LB_CONFIG_FILES], [
374 [Rules:build/Rules.in]
375 AC_PACKAGE_TARNAME[.spec]
376 AC_PACKAGE_TARNAME[-dkms.spec]
379 lustre/utils/lustre.pc
380 lustre-iokit/Makefile
381 lustre-iokit/obdfilter-survey/Makefile
382 lustre-iokit/ost-survey/Makefile
383 lustre-iokit/sgpdd-survey/Makefile
384 lustre-iokit/mds-survey/Makefile
385 lustre-iokit/ior-survey/Makefile
386 lustre-iokit/stats-collect/Makefile
387 lustre-iokit/lst-survey/Makefile
394 AC_DEFUN([LB_CONFIG_SERVERS], [
395 AC_ARG_ENABLE([server],
396 AS_HELP_STRING([--disable-server],
397 [disable Lustre server support]), [
398 AS_IF([test x$enable_server != xyes -a x$enable_server != xno],
399 [AC_MSG_ERROR([server valid options are "yes" or "no"])])
400 AS_IF([test x$enable_server = xyes -a x$enable_dist = xyes],
401 [AC_MSG_ERROR([--enable-server cannot be used with --enable-dist])])
403 AS_IF([test x$enable_dist = xyes],
404 [enable_server=no], [enable_server=maybe])
407 # There are at least two good reasons why we should really run
408 # LB_CONFIG_MODULES elsewhere before the call to LB_CONFIG_SERVERS:
409 # LB_CONFIG_MODULES needs to be run for client support even when
410 # servers are disabled, and because module support is actually a
411 # prerequisite of server support. However, some things under
412 # LB_CONFIG_MODULES need us to already have checked for --disable-server,
413 # before running, so until LB_CONFIG_MODULES can be reorganized, we
416 AS_IF([test x$enable_modules = xno], [enable_server=no])
420 # If no backends were configured, and the user did not explicitly
421 # require servers to be enabled, we just disable servers.
422 AS_IF([test x$enable_ldiskfs = xno -a x$enable_zfs = xno], [
423 AS_CASE([$enable_server],
424 [maybe], [enable_server=no],
425 [yes], [AC_MSG_ERROR([cannot enable servers, no backends were configured])])
427 AS_IF([test x$enable_server = xmaybe], [enable_server=yes])
430 AC_MSG_CHECKING([whether to build Lustre server support])
431 AC_MSG_RESULT([$enable_server])
432 AS_IF([test x$enable_server = xyes], [
433 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
434 AC_SUBST(ENABLE_SERVER, yes)
436 AC_SUBST(ENABLE_SERVER, no)
438 ]) # LB_CONFIG_SERVERS
441 # LB_CONFIG_RPMBUILD_OPTIONS
443 # The purpose of this function is to assemble command line options
444 # for the rpmbuild command based on the options passed to the configure
445 # script, and also upon the decisions that configure makes based on
446 # the tests that it runs.
447 # These strings can be passed to rpmbuild on the command line
448 # in the Make targets named "rpms" and "srpm".
450 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
453 eval set -- $ac_configure_args
457 -C | --cache-file=* ) ;;
458 --prefix=* | --*-prefix=* ) ;;
460 --with-kmp-moddir=* ) ;;
461 --with-linux=* | --with-linux-obj=* ) ;;
462 --enable-shared | --disable-shared ) ;;
463 --enable-static | --disable-static ) ;;
464 --enable-ldiskfs | --disable-ldiskfs ) ;;
465 --enable-modules | --disable-modules ) ;;
466 --enable-server | --disable-server ) ;;
467 --enable-tests | --disable-tests ) ;;
468 --enable-utils | --disable-utils ) ;;
469 --enable-iokit | --disable-iokit ) ;;
470 --enable-manpages | --disable-manpages ) ;;
471 * ) CONFIGURE_ARGS="$CONFIGURE_ARGS '$arg'" ;;
474 if test -n "$CONFIGURE_ARGS" ; then
475 RPMBINARGS="$RPMBINARGS --define \"configure_args $CONFIGURE_ARGS\""
477 if test -n "$LINUX" ; then
478 RPMBINARGS="$RPMBINARGS --define \"kdir $LINUX\""
479 if test -n "$LINUX_OBJ" -a "$LINUX_OBJ" != x"$LINUX" ; then
480 RPMBINARGS="$RPMBINARGS --define \"kobjdir $LINUX_OBJ\""
483 if test x$enable_modules != xyes ; then
484 RPMBINARGS="$RPMBINARGS --without lustre_modules"
486 if test x$enable_tests != xyes ; then
487 RPMBINARGS="$RPMBINARGS --without lustre_tests"
489 if test x$enable_lutf != xyes ; then
490 RPMBINARGS="$RPMBINARGS --without lustre_tests_lutf"
492 if test x$enable_utils != xyes ; then
493 RPMBINARGS="$RPMBINARGS --without lustre_utils"
495 if test x$enable_server != xyes ; then
496 RPMBINARGS="$RPMBINARGS --without servers"
498 if test x$enable_ldiskfs != xyes ; then
499 RPMBINARGS="$RPMBINARGS --without ldiskfs"
501 if test x$enable_zfs = xyes ; then
502 RPMBINARGS="$RPMBINARGS --with zfs"
504 if test x$enable_gss_keyring = xyes ; then
505 RPMBINARGS="$RPMBINARGS --with gss_keyring --with gss"
507 if test x$enable_gss = xyes ; then
508 RPMBINARGS="$RPMBINARGS --with gss"
509 AC_SUBST(ENABLE_GSS, yes)
510 elif test x$enable_gss = xno ; then
511 RPMBINARGS="$RPMBINARGS --without gss"
512 AC_SUBST(ENABLE_GSS, no)
514 if test x$enable_crypto = xyes ; then
515 RPMBINARGS="$RPMBINARGS --with crypto"
516 AC_SUBST(ENABLE_CRYPTO, yes)
517 elif test x$enable_crypto = xno ; then
518 RPMBINARGS="$RPMBINARGS --without crypto"
519 AC_SUBST(ENABLE_CRYPTO, no)
521 if test x$enable_iokit != xyes ; then
522 RPMBINARGS="$RPMBINARGS --without lustre_iokit"
524 if test x$enable_snmp != xyes ; then
525 RPMBINARGS="$RPMBINARGS --without snmp"
527 if test x$enable_manpages != xyes ; then
528 RPMBINARGS="$RPMBINARGS --without manpages"
530 if test x$enable_shared != xyes ; then
531 RPMBINARGS="$RPMBINARGS --without shared"
533 if test x$enable_static != xyes ; then
534 RPMBINARGS="$RPMBINARGS --without static"
536 if test x$enable_mpitests != xyes ; then
537 RPMBINARGS="$RPMBINARGS --without mpi"
540 RPMBUILD_BINARY_ARGS=$RPMBINARGS
542 AC_SUBST(RPMBUILD_BINARY_ARGS)
543 ]) # LB_CONFIG_RPMBUILD_OPTIONS
546 # LB_CONFIG_CACHE_OPTIONS
548 # Propagate config cache option
550 AC_DEFUN([LB_CONFIG_CACHE_OPTIONS], [
552 if test -f "$cache_file"; then
553 CONFIG_CACHE_FILE=$(readlink --canonicalize "$cache_file")
555 AC_SUBST(CONFIG_CACHE_FILE)
556 ]) # LB_CONFIG_CACHE_OPTIONS
561 # main configure steps
563 AC_DEFUN([LB_CONFIGURE], [
564 AC_MSG_NOTICE([Lustre base checks
565 ==============================================================================])
570 LB_DOWNSTREAM_RELEASE
587 LC_GLIBC_SUPPORT_COPY_FILE_RANGE
590 # Tests depends from utils (multiop from liblustreapi)
591 AS_IF([test "x$enable_utils" = xno], [enable_tests="no"])
593 AS_IF([test "x$enable_utils" = xyes], [
595 LC_FID2PATH_ANON_UNION
597 AS_IF([test "x$enable_tests" = xyes], [
599 LC_GLIBC_SUPPORT_FHANDLES
605 AS_IF([test "x$enable_dist" != xno], [],[LB_LIBMOUNT])
609 LB_DEFINE_E2FSPROGS_NAMES
614 AS_IF([test -n "$SNMP_DIST_SUBDIR"], [LS_CONFIGURE])
623 AS_IF([test -n "$SNMP_DIST_SUBDIR"], [LS_CONFIG_FILES])
625 AC_SUBST(ac_configure_args)
627 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
628 AC_SUBST(MOSTLYCLEANFILES)
630 LB_CONFIG_RPMBUILD_OPTIONS
631 LB_CONFIG_CACHE_OPTIONS
633 AS_IF([test -d $TEST_DIR -a "x${PARALLEL_BUILD_OPT}" != "xdebug"], [
634 AC_MSG_NOTICE([remove temporary parallel configure dir $TEST_DIR])