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 AC_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 AC_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 AC_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 AC_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
106 # Define no libcfs by default.
107 AC_DEFUN([LB_LIBCFS_DIR], [
108 AS_IF([test "x$libcfs_is_module" = xyes], [
109 LIBCFS_INCLUDE_DIR="libcfs/include"
110 LIBCFS_SUBDIR="libcfs"
112 LIBCFS_INCLUDE_DIR="lnet/include"
115 AC_SUBST(LIBCFS_INCLUDE_DIR)
116 AC_SUBST(LIBCFS_SUBDIR)
122 # Check whether build with libmount for mount.lustre.
123 # libmount is part of the util-linux since v2.18.
124 # We need it to manipulate utab file.
126 AC_DEFUN([LB_LIBMOUNT], [
127 AC_CHECK_HEADER([libmount/libmount.h], [
128 AC_CHECK_LIB([mount], [mnt_update_set_fs], [
131 AC_DEFINE(HAVE_LIBMOUNT, 1, [build with libmount])
133 ],[with_libmount="no"])
134 ], [with_libmount="no"])
135 AC_MSG_CHECKING([whether to build with libmount])
136 AS_IF([test "x$with_libmount" = xyes], [
146 # check for in-tree snmp support
148 AC_DEFUN([LB_PATH_SNMP], [
149 LB_CHECK_FILE([$srcdir/snmp/lustre-snmp.c], [SNMP_DIST_SUBDIR="snmp"])
150 AC_SUBST(SNMP_DIST_SUBDIR)
151 AC_SUBST(SNMP_SUBDIR)
157 # Build kernel modules?
159 AC_DEFUN([LB_CONFIG_MODULES], [
160 AC_MSG_CHECKING([whether to build Linux kernel modules])
161 AC_ARG_ENABLE([modules],
162 AC_HELP_STRING([--disable-modules],
163 [disable building of Lustre kernel modules]),
165 LC_TARGET_SUPPORTED([enable_modules="yes"],
166 [enable_modules="no"])
168 AC_MSG_RESULT([$enable_modules ($target_os)])
170 AS_IF([test "x$enable_modules" = xyes], [
171 AS_CASE([$target_os],
176 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR])
179 # This is strange - Lustre supports a target we don't
180 AC_MSG_ERROR([Modules are not supported on $target_os])
183 ]) # LB_CONFIG_MODULES
190 AC_DEFUN([LB_CONFIG_UTILS], [
191 AC_MSG_CHECKING([whether to build Lustre utilities])
192 AC_ARG_ENABLE([utils],
193 AC_HELP_STRING([--disable-utils],
194 [disable building of Lustre utility programs]),
195 [], [enable_utils="yes"])
196 AC_MSG_RESULT([$enable_utils])
204 AC_DEFUN([LB_CONFIG_TESTS], [
205 AC_MSG_CHECKING([whether to build Lustre tests])
206 AC_ARG_ENABLE([tests],
207 AC_HELP_STRING([--disable-tests],
208 [disable building of Lustre tests]),
209 [], [enable_tests="yes"])
210 AC_MSG_RESULT([$enable_tests])
216 # Just enough configure so that "make dist" is useful
218 # this simply re-adjusts some defaults, which of course can be overridden
219 # on the configure line after the --for-dist option
221 AC_DEFUN([LB_CONFIG_DIST], [
222 AC_MSG_CHECKING([whether to configure just enough for make dist])
223 AC_ARG_ENABLE([dist],
224 AC_HELP_STRING([--enable-dist],
225 [only configure enough for make dist]),
226 [], [enable_dist="no"])
227 AC_MSG_RESULT([$enable_dist])
228 AS_IF([test "x$enable_dist" != xno], [
241 AC_DEFUN([LB_CONFIG_DOCS], [
242 AC_MSG_CHECKING([whether to build Lustre docs])
244 AC_HELP_STRING([--disable-doc],
245 [skip creation of pdf documentation]),
246 [], [enable_doc="no"])
247 AC_MSG_RESULT([$enable_doc])
248 AS_IF([test "x$enable_doc" = xyes],
249 [ENABLE_DOC=1], [ENABLE_DOC=0])
258 AC_DEFUN([LB_CONFIG_MANPAGES], [
259 AC_MSG_CHECKING([whether to build Lustre manpages])
260 AC_ARG_ENABLE([manpages],
261 AC_HELP_STRING([--disable-manpages],
262 [skip creation and inclusion of man pages (default is enable)]),
263 [], [enable_manpages="yes"])
264 AC_MSG_RESULT([$enable_manpages])
265 ]) # LB_CONFIG_MANPAGES
270 # add -include config.h
272 AC_DEFUN([LB_CONFIG_HEADERS], [
273 AC_CONFIG_HEADERS([config.h])
274 CPPFLAGS="-include $PWD/undef.h -include $PWD/config.h $CPPFLAGS"
275 EXTRA_KCFLAGS="-include $PWD/undef.h -include $PWD/config.h $EXTRA_KCFLAGS"
276 AC_SUBST(EXTRA_KCFLAGS)
277 ]) # LB_CONFIG_HEADERS
282 # defines for including the toplevel Rules
284 AC_DEFUN([LB_INCLUDE_RULES], [
285 INCLUDE_RULES="include $PWD/Rules"
286 AC_SUBST(INCLUDE_RULES)
287 ]) # LB_INCLUDE_RULES
292 # 'fixup' default paths
294 AC_DEFUN([LB_PATH_DEFAULTS], [
295 # directories for binaries
296 AC_PREFIX_DEFAULT([/usr])
301 # Directories for documentation and demos.
302 docdir='${datadir}/doc/$(PACKAGE)'
308 ]) # LB_PATH_DEFAULTS
313 # checks on the C compiler
315 AC_DEFUN([LB_PROG_CC], [
317 AC_CHECK_TOOL(LD, [ld], [no])
318 AC_CHECK_TOOL(OBJDUMP, [objdump], [no])
319 AC_CHECK_TOOL(STRIP, [strip], [no])
321 # --------- unsigned long long sane? -------
322 AC_CHECK_SIZEOF(unsigned long long, 0)
323 AS_IF([test $ac_cv_sizeof_unsigned_long_long != 8],
324 [AC_MSG_ERROR([we assume that sizeof(unsigned long long) == 8.])])
326 AS_IF([test $target_cpu = powerpc64], [
327 AC_MSG_WARN([set compiler with -m64])
328 CFLAGS="$CFLAGS -m64"
332 CPPFLAGS="-I$PWD/$LIBCFS_INCLUDE_DIR -I$PWD/lnet/include -I$PWD/lnet/include/uapi -I$PWD/lustre/include -I$PWD/lustre/include/uapi $CPPFLAGS"
334 CCASFLAGS="-Wall -fPIC -D_GNU_SOURCE"
337 # everyone builds against lnet and lustre
338 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/$LIBCFS_INCLUDE_DIR -I$PWD/lnet/include -I$PWD/lustre/include/uapi -I$PWD/lustre/include"
339 AC_SUBST(EXTRA_KCFLAGS)
343 # Check if gcc supports -Wno-format-truncation
345 # To supress many warnings with gcc7
347 AC_DEFUN([LB_CC_NO_FORMAT_TRUNCATION], [
348 AC_MSG_CHECKING([for -Wno-format-truncation support])
350 saved_flags="$CFLAGS"
351 CFLAGS="$CFLAGS -Wno-format-truncation"
353 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
354 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Wno-format-truncation"
355 AC_SUBST(EXTRA_KCFLAGS)
361 CFLAGS="$saved_flags"
365 # Check if gcc supports -Wno-stringop-truncation
367 # To supress many warnings with gcc8
369 AC_DEFUN([LB_CC_NO_STRINGOP_TRUNCATION], [
370 AC_MSG_CHECKING([for -Wno-stringop-truncation support])
372 saved_flags="$CFLAGS"
373 CFLAGS="$CFLAGS -Wno-stringop-truncation"
375 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
376 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Wno-stringop-truncation"
377 AC_SUBST(EXTRA_KCFLAGS)
383 CFLAGS="$saved_flags"
387 # Check if gcc supports -Wno-stringop-overflow
389 # To supress many warnings with gcc8
391 AC_DEFUN([LB_CC_NO_STRINGOP_OVERFLOW], [
392 AC_MSG_CHECKING([for -Wno-stringop-overflow support])
394 saved_flags="$CFLAGS"
395 CFLAGS="$CFLAGS -Wno-stringop-overflow"
397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
398 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Wno-stringop-overflow"
399 AC_SUBST(EXTRA_KCFLAGS)
405 CFLAGS="$saved_flags"
411 # AM_CONDITIONAL instances for everything
412 # (so that portals/lustre can disable some if needed)
414 AC_DEFUN([LB_CONDITIONALS], [
415 AM_CONDITIONAL([PLUGINS], [test x$enable_shared = xyes])
416 AM_CONDITIONAL([MODULES], [test x$enable_modules = xyes])
417 AM_CONDITIONAL([UTILS], [test x$enable_utils = xyes])
418 AM_CONDITIONAL([TESTS], [test x$enable_tests = xyes])
419 AM_CONDITIONAL([DOC], [test x$ENABLE_DOC = x1])
420 AM_CONDITIONAL([MANPAGES], [test x$enable_manpages = xyes])
421 AM_CONDITIONAL([LINUX], [test x$lb_target_os = xlinux])
422 AM_CONDITIONAL([USE_QUILT], [test x$use_quilt = xyes])
423 AM_CONDITIONAL([RHEL], [test x$RHEL_KERNEL = xyes])
424 AM_CONDITIONAL([SUSE], [test x$SUSE_KERNEL = xyes])
425 AM_CONDITIONAL([UBUNTU], [test x$UBUNTU_KERNEL = xyes])
427 # Sanity check for PCLMULQDQ instruction availability
428 # PCLMULQDQ instruction is a new instruction available beginning with
429 # the all new Core processor family based on the 32nm microarchitecture
430 # codename Westmere. So, $target_cpu = x86_64 should have this instruction
431 # except MIC microarchitecture (k1om).
432 AM_CONDITIONAL(HAVE_PCLMULQDQ, test x$target_cpu = "xx86_64" -a x$target_vendor != "xk1om")
433 AS_IF([test x$target_cpu = "xx86_64" -a x$target_vendor != "xk1om"],
434 [AC_DEFINE(HAVE_PCLMULQDQ, 1, [have PCLMULQDQ instruction])])
444 # build-specific config files
446 AC_DEFUN([LB_CONFIG_FILES], [
451 [Rules:build/Rules.in]
452 AC_PACKAGE_TARNAME[.spec]
453 AC_PACKAGE_TARNAME[-dkms.spec]
456 lustre-iokit/Makefile
457 lustre-iokit/obdfilter-survey/Makefile
458 lustre-iokit/ost-survey/Makefile
459 lustre-iokit/sgpdd-survey/Makefile
460 lustre-iokit/mds-survey/Makefile
461 lustre-iokit/ior-survey/Makefile
462 lustre-iokit/stats-collect/Makefile
469 AC_DEFUN([LB_CONFIG_SERVERS], [
470 AC_ARG_ENABLE([server],
471 AC_HELP_STRING([--disable-server],
472 [disable Lustre server support]), [
473 AS_IF([test x$enable_server != xyes -a x$enable_server != xno],
474 [AC_MSG_ERROR([server valid options are "yes" or "no"])])
475 AS_IF([test x$enable_server = xyes -a x$enable_dist = xyes],
476 [AC_MSG_ERROR([--enable-server cannot be used with --enable-dist])])
478 AS_IF([test x$enable_dist = xyes],
479 [enable_server=no], [enable_server=maybe])
482 # There are at least two good reasons why we should really run
483 # LB_CONFIG_MODULES elsewhere before the call to LB_CONFIG_SERVERS:
484 # LB_CONFIG_MODULES needs to be run for client support even when
485 # servers are disabled, and because module support is actually a
486 # prerequisite of server support. However, some things under
487 # LB_CONFIG_MODULES need us to already have checked for --disable-server,
488 # before running, so until LB_CONFIG_MODULES can be reorganized, we
491 AS_IF([test x$enable_modules = xno], [enable_server=no])
495 # If no backends were configured, and the user did not explicitly
496 # require servers to be enabled, we just disable servers.
497 AS_IF([test x$enable_ldiskfs = xno -a x$enable_zfs = xno], [
498 AS_CASE([$enable_server],
499 [maybe], [enable_server=no],
500 [yes], [AC_MSG_ERROR([cannot enable servers, no backends were configured])])
502 AS_IF([test x$enable_server = xmaybe], [enable_server=yes])
505 AC_MSG_CHECKING([whether to build Lustre server support])
506 AC_MSG_RESULT([$enable_server])
507 AS_IF([test x$enable_server = xyes], [
508 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
509 AC_SUBST(ENABLE_SERVER, yes)
511 AC_SUBST(ENABLE_SERVER, no)
513 ]) # LB_CONFIG_SERVERS
516 # LB_CONFIG_RPMBUILD_OPTIONS
518 # The purpose of this function is to assemble command line options
519 # for the rpmbuild command based on the options passed to the configure
520 # script, and also upon the decisions that configure makes based on
521 # the tests that it runs.
522 # These strings can be passed to rpmbuild on the command line
523 # in the Make targets named "rpms" and "srpm".
525 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
528 eval set -- $ac_configure_args
532 -C | --cache-file=* ) ;;
533 --prefix=* | --*-prefix=* ) ;;
535 --with-kmp-moddir=* ) ;;
536 --with-linux=* | --with-linux-obj=* ) ;;
537 --enable-shared | --disable-shared ) ;;
538 --enable-static | --disable-static ) ;;
539 --enable-ldiskfs | --disable-ldiskfs ) ;;
540 --enable-modules | --disable-modules ) ;;
541 --enable-server | --disable-server ) ;;
542 --enable-tests | --disable-tests ) ;;
543 --enable-utils | --disable-utils ) ;;
544 --enable-iokit | --disable-iokit ) ;;
545 --enable-manpages | --disable-manpages ) ;;
546 * ) CONFIGURE_ARGS="$CONFIGURE_ARGS '$arg'" ;;
549 if test -n "$CONFIGURE_ARGS" ; then
550 RPMBINARGS="$RPMBINARGS --define \"configure_args $CONFIGURE_ARGS\""
552 if test -n "$LINUX" ; then
553 RPMBINARGS="$RPMBINARGS --define \"kdir $LINUX\""
554 if test -n "$LINUX_OBJ" -a "$LINUX_OBJ" != x"$LINUX" ; then
555 RPMBINARGS="$RPMBINARGS --define \"kobjdir $LINUX_OBJ\""
558 if test x$enable_modules != xyes ; then
559 RPMBINARGS="$RPMBINARGS --without lustre_modules"
561 if test x$enable_tests != xyes ; then
562 RPMBINARGS="$RPMBINARGS --without lustre_tests"
564 if test x$enable_utils != xyes ; then
565 RPMBINARGS="$RPMBINARGS --without lustre_utils"
567 if test x$enable_server != xyes ; then
568 RPMBINARGS="$RPMBINARGS --without servers"
570 if test x$enable_ldiskfs != xyes ; then
571 RPMBINARGS="$RPMBINARGS --without ldiskfs"
573 if test x$enable_zfs = xyes ; then
574 RPMBINARGS="$RPMBINARGS --with zfs"
576 if test x$enable_gss_keyring = xyes ; then
577 RPMBINARGS="$RPMBINARGS --with gss_keyring --with gss"
579 if test x$enable_gss = xyes ; then
580 RPMBINARGS="$RPMBINARGS --with gss"
581 AC_SUBST(ENABLE_GSS, yes)
582 elif test x$enable_gss = xno ; then
583 RPMBINARGS="$RPMBINARGS --without gss"
584 AC_SUBST(ENABLE_GSS, no)
586 if test x$enable_iokit != xyes ; then
587 RPMBINARGS="$RPMBINARGS --without lustre_iokit"
589 if test x$enable_snmp != xyes ; then
590 RPMBINARGS="$RPMBINARGS --without snmp"
592 if test x$enable_manpages != xyes ; then
593 RPMBINARGS="$RPMBINARGS --without manpages"
595 if test x$enable_shared != xyes ; then
596 RPMBINARGS="$RPMBINARGS --without shared"
598 if test x$enable_static != xyes ; then
599 RPMBINARGS="$RPMBINARGS --without static"
602 RPMBUILD_BINARY_ARGS=$RPMBINARGS
604 AC_SUBST(RPMBUILD_BINARY_ARGS)
605 ]) # LB_CONFIG_RPMBUILD_OPTIONS
610 # main configure steps
612 AC_DEFUN([LB_CONFIGURE], [
613 AC_MSG_NOTICE([Lustre base checks
614 ==============================================================================])
619 LB_DOWNSTREAM_RELEASE
629 LB_CC_NO_FORMAT_TRUNCATION
630 LB_CC_NO_STRINGOP_TRUNCATION
631 LB_CC_NO_STRINGOP_OVERFLOW
643 # Tests depends from utils (multiop from liblustreapi)
644 AS_IF([test "x$enable_utils" = xno], [enable_tests="no"])
646 m4_ifdef([LC_NODEMAP_PROC_DEBUG], [LC_NODEMAP_PROC_DEBUG])
654 LB_DEFINE_E2FSPROGS_NAMES
659 AS_IF([test -n "$SNMP_DIST_SUBDIR"], [LS_CONFIGURE])
668 AS_IF([test -n "$SNMP_DIST_SUBDIR"], [LS_CONFIG_FILES])
670 AC_SUBST(ac_configure_args)
672 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
673 AC_SUBST(MOSTLYCLEANFILES)
675 LB_CONFIG_RPMBUILD_OPTIONS
685 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
687 Type 'make' to build Lustre.