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 for in-tree snmp support
124 AC_DEFUN([LB_PATH_SNMP], [
125 LB_CHECK_FILE([$srcdir/snmp/lustre-snmp.c], [SNMP_DIST_SUBDIR="snmp"])
126 AC_SUBST(SNMP_DIST_SUBDIR)
127 AC_SUBST(SNMP_SUBDIR)
133 # Build kernel modules?
135 AC_DEFUN([LB_CONFIG_MODULES], [
136 AC_MSG_CHECKING([whether to build Linux kernel modules])
137 AC_ARG_ENABLE([modules],
138 AC_HELP_STRING([--disable-modules],
139 [disable building of Lustre kernel modules]),
141 LC_TARGET_SUPPORTED([enable_modules="yes"],
142 [enable_modules="no"])
144 AC_MSG_RESULT([$enable_modules ($target_os)])
146 AS_IF([test "x$enable_modules" = xyes], [
147 AS_CASE([$target_os],
152 AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR])
155 # This is strange - Lustre supports a target we don't
156 AC_MSG_ERROR([Modules are not supported on $target_os])
159 ]) # LB_CONFIG_MODULES
166 AC_DEFUN([LB_CONFIG_UTILS], [
167 AC_MSG_CHECKING([whether to build Lustre utilities])
168 AC_ARG_ENABLE([utils],
169 AC_HELP_STRING([--disable-utils],
170 [disable building of Lustre utility programs]),
171 [], [enable_utils="yes"])
172 AC_MSG_RESULT([$enable_utils])
180 AC_DEFUN([LB_CONFIG_TESTS], [
181 AC_MSG_CHECKING([whether to build Lustre tests])
182 AC_ARG_ENABLE([tests],
183 AC_HELP_STRING([--disable-tests],
184 [disable building of Lustre tests]),
185 [], [enable_tests="yes"])
186 AC_MSG_RESULT([$enable_tests])
192 # Just enough configure so that "make dist" is useful
194 # this simply re-adjusts some defaults, which of course can be overridden
195 # on the configure line after the --for-dist option
197 AC_DEFUN([LB_CONFIG_DIST], [
198 AC_MSG_CHECKING([whether to configure just enough for make dist])
199 AC_ARG_ENABLE([dist],
200 AC_HELP_STRING([--enable-dist],
201 [only configure enough for make dist]),
202 [], [enable_dist="no"])
203 AC_MSG_RESULT([$enable_dist])
204 AS_IF([test "x$enable_dist" != xno], [
217 AC_DEFUN([LB_CONFIG_DOCS], [
218 AC_MSG_CHECKING([whether to build Lustre docs])
220 AC_HELP_STRING([--disable-doc],
221 [skip creation of pdf documentation]),
222 [], [enable_doc="no"])
223 AC_MSG_RESULT([$enable_doc])
224 AS_IF([test "x$enable_doc" = xyes],
225 [ENABLE_DOC=1], [ENABLE_DOC=0])
234 AC_DEFUN([LB_CONFIG_MANPAGES], [
235 AC_MSG_CHECKING([whether to build Lustre manpages])
236 AC_ARG_ENABLE([manpages],
237 AC_HELP_STRING([--disable-manpages],
238 [skip creation and inclusion of man pages (default is enable)]),
239 [], [enable_manpages="yes"])
240 AC_MSG_RESULT([$enable_manpages])
241 ]) # LB_CONFIG_MANPAGES
246 # add -include config.h
248 AC_DEFUN([LB_CONFIG_HEADERS], [
249 AC_CONFIG_HEADERS([config.h])
250 CPPFLAGS="-include $PWD/undef.h -include $PWD/config.h $CPPFLAGS"
251 EXTRA_KCFLAGS="-include $PWD/undef.h -include $PWD/config.h $EXTRA_KCFLAGS"
252 AC_SUBST(EXTRA_KCFLAGS)
253 ]) # LB_CONFIG_HEADERS
258 # defines for including the toplevel Rules
260 AC_DEFUN([LB_INCLUDE_RULES], [
261 INCLUDE_RULES="include $PWD/Rules"
262 AC_SUBST(INCLUDE_RULES)
263 ]) # LB_INCLUDE_RULES
268 # 'fixup' default paths
270 AC_DEFUN([LB_PATH_DEFAULTS], [
271 # directories for binaries
272 AC_PREFIX_DEFAULT([/usr])
277 # Directories for documentation and demos.
278 docdir='${datadir}/doc/$(PACKAGE)'
284 ]) # LB_PATH_DEFAULTS
289 # checks on the C compiler
291 AC_DEFUN([LB_PROG_CC], [
293 AC_CHECK_TOOL(LD, [ld], [no])
294 AC_CHECK_TOOL(OBJDUMP, [objdump], [no])
295 AC_CHECK_TOOL(STRIP, [strip], [no])
297 # --------- unsigned long long sane? -------
298 AC_CHECK_SIZEOF(unsigned long long, 0)
299 AS_IF([test $ac_cv_sizeof_unsigned_long_long != 8],
300 [AC_MSG_ERROR([we assume that sizeof(unsigned long long) == 8.])])
302 AS_IF([test $target_cpu = powerpc64], [
303 AC_MSG_WARN([set compiler with -m64])
304 CFLAGS="$CFLAGS -m64"
308 CPPFLAGS="-I$PWD/$LIBCFS_INCLUDE_DIR -I$PWD/lnet/include -I$PWD/lustre/include $CPPFLAGS"
310 CCASFLAGS="-Wall -fPIC -D_GNU_SOURCE"
313 # everyone builds against lnet and lustre
314 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/$LIBCFS_INCLUDE_DIR -I$PWD/lnet/include -I$PWD/lustre/include"
315 AC_SUBST(EXTRA_KCFLAGS)
321 # AM_CONDITIONAL instances for everything
322 # (so that portals/lustre can disable some if needed)
324 AC_DEFUN([LB_CONDITIONALS], [
325 AM_CONDITIONAL([MODULES], [test x$enable_modules = xyes])
326 AM_CONDITIONAL([UTILS], [test x$enable_utils = xyes])
327 AM_CONDITIONAL([TESTS], [test x$enable_tests = xyes])
328 AM_CONDITIONAL([DOC], [test x$ENABLE_DOC = x1])
329 AM_CONDITIONAL([MANPAGES], [test x$enable_manpages = xyes])
330 AM_CONDITIONAL([LINUX], [test x$lb_target_os = xlinux])
331 AM_CONDITIONAL([USES_DPKG], [test x$uses_dpkg = xyes])
332 AM_CONDITIONAL([USE_QUILT], [test x$use_quilt = xyes])
333 AM_CONDITIONAL([RHEL], [test x$RHEL_KERNEL = xyes])
334 AM_CONDITIONAL([SUSE], [test x$SUSE_KERNEL = xyes])
336 # Sanity check for PCLMULQDQ instruction availability
337 # PCLMULQDQ instruction is a new instruction available beginning with
338 # the all new Core processor family based on the 32nm microarchitecture
339 # codename Westmere. So, $target_cpu = x86_64 should have this instruction
340 # except MIC microarchitecture (k1om).
341 AM_CONDITIONAL(HAVE_PCLMULQDQ, test x$target_cpu = "xx86_64" -a x$target_vendor != "xk1om")
342 AS_IF([test x$target_cpu = "xx86_64" -a x$target_vendor != "xk1om"],
343 [AC_DEFINE(HAVE_PCLMULQDQ, 1, [have PCLMULQDQ instruction])])
353 # build-specific config files
355 AC_DEFUN([LB_CONFIG_FILES], [
360 [Rules:build/Rules.in]
361 AC_PACKAGE_TARNAME[.spec]
362 AC_PACKAGE_TARNAME[-dkms.spec]
364 contrib/lbuild/Makefile
365 contrib/scripts/Makefile
368 lustre-iokit/Makefile
369 lustre-iokit/obdfilter-survey/Makefile
370 lustre-iokit/ost-survey/Makefile
371 lustre-iokit/sgpdd-survey/Makefile
372 lustre-iokit/mds-survey/Makefile
373 lustre-iokit/ior-survey/Makefile
374 lustre-iokit/stats-collect/Makefile
376 AC_CONFIG_FILES([lustre/scripts/dkms.mkconf],
377 [chmod +x lustre/scripts/dkms.mkconf])
383 AC_DEFUN([LB_CONFIG_SERVERS], [
384 AC_ARG_ENABLE([server],
385 AC_HELP_STRING([--disable-server],
386 [disable Lustre server support]), [
387 AS_IF([test x$enable_server != xyes -a x$enable_server != xno],
388 [AC_MSG_ERROR([server valid options are "yes" or "no"])])
389 AS_IF([test x$enable_server = xyes -a x$enable_dist = xyes],
390 [AC_MSG_ERROR([--enable-server cannot be used with --enable-dist])])
392 AS_IF([test x$enable_dist = xyes],
393 [enable_server=no], [enable_server=maybe])
396 # There are at least two good reasons why we should really run
397 # LB_CONFIG_MODULES elsewhere before the call to LB_CONFIG_SERVERS:
398 # LB_CONFIG_MODULES needs to be run for client support even when
399 # servers are disabled, and because module support is actually a
400 # prerequisite of server support. However, some things under
401 # LB_CONFIG_MODULES need us to already have checked for --disable-server,
402 # before running, so until LB_CONFIG_MODULES can be reorganized, we
405 AS_IF([test x$enable_modules = xno], [enable_server=no])
409 # If no backends were configured, and the user did not explicitly
410 # require servers to be enabled, we just disable servers.
411 AS_IF([test x$enable_ldiskfs = xno -a x$enable_zfs = xno], [
412 AS_CASE([$enable_server],
413 [maybe], [enable_server=no],
414 [yes], [AC_MSG_ERROR([cannot enable servers, no backends were configured])])
416 AS_IF([test x$enable_server = xmaybe], [enable_server=yes])
419 AC_MSG_CHECKING([whether to build Lustre server support])
420 AC_MSG_RESULT([$enable_server])
421 AS_IF([test x$enable_server = xyes],
422 [AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])])
423 ]) # LB_CONFIG_SERVERS
426 # LB_CONFIG_RPMBUILD_OPTIONS
428 # The purpose of this function is to assemble command line options
429 # for the rpmbuild command based on the options passed to the configure
430 # script, and also upon the decisions that configure makes based on
431 # the tests that it runs.
432 # These strings can be passed to rpmbuild on the command line
433 # in the Make targets named "rpms" and "srpm".
435 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
438 eval set -- $ac_configure_args
442 -C | --cache-file=* ) ;;
443 --prefix=* | --*-prefix=* ) ;;
445 --with-release=* ) ;;
446 --with-kmp-moddir=* ) ;;
447 --with-linux=* | --with-linux-obj=* ) ;;
448 --enable-shared | --disable-shared ) ;;
449 --enable-static | --disable-static ) ;;
450 --enable-ldiskfs | --disable-ldiskfs ) ;;
451 --enable-modules | --disable-modules ) ;;
452 --enable-server | --disable-server ) ;;
453 --enable-tests | --disable-tests ) ;;
454 --enable-utils | --disable-utils ) ;;
455 --enable-iokit | --disable-iokit ) ;;
456 --enable-dlc | --disable-dlc ) ;;
457 --enable-manpages | --disable-manpages ) ;;
458 * ) CONFIGURE_ARGS="$CONFIGURE_ARGS '$arg'" ;;
461 if test -n "$CONFIGURE_ARGS" ; then
462 RPMBINARGS="$RPMBINARGS --define \"configure_args $CONFIGURE_ARGS\""
464 if test -n "$LINUX" ; then
465 RPMBINARGS="$RPMBINARGS --define \"kdir $LINUX\""
466 if test -n "$LINUX_OBJ" -a "$LINUX_OBJ" != x"$LINUX" ; then
467 RPMBINARGS="$RPMBINARGS --define \"kobjdir $LINUX_OBJ\""
470 if test -n "$KMP_MODDIR" ; then
471 RPMBINARGS="$RPMBINARGS --define \"kmoddir $KMP_MODDIR\""
473 if test x$enable_modules != xyes ; then
474 RPMBINARGS="$RPMBINARGS --without lustre_modules"
476 if test x$enable_tests != xyes ; then
477 RPMBINARGS="$RPMBINARGS --without lustre_tests"
479 if test x$enable_utils != xyes ; then
480 RPMBINARGS="$RPMBINARGS --without lustre_utils"
482 if test x$enable_server != xyes ; then
483 RPMBINARGS="$RPMBINARGS --without servers"
485 if test x$enable_ldiskfs != xyes ; then
486 RPMBINARGS="$RPMBINARGS --without ldiskfs"
488 if test x$enable_zfs = xyes ; then
489 RPMBINARGS="$RPMBINARGS --with zfs"
491 if test x$enable_iokit != xyes ; then
492 RPMBINARGS="$RPMBINARGS --without lustre_iokit"
494 if test x$USE_DLC = xyes ; then
495 RPMBINARGS="$RPMBINARGS --with lnet_dlc"
497 if test x$enable_manpages != xyes ; then
498 RPMBINARGS="$RPMBINARGS --without manpages"
500 if test x$enable_shared != xyes ; then
501 RPMBINARGS="$RPMBINARGS --without shared"
503 if test x$enable_static != xyes ; then
504 RPMBINARGS="$RPMBINARGS --without static"
507 RPMBUILD_BINARY_ARGS=$RPMBINARGS
509 AC_SUBST(RPMBUILD_BINARY_ARGS)
510 ]) # LB_CONFIG_RPMBUILD_OPTIONS
515 # main configure steps
517 AC_DEFUN([LB_CONFIGURE], [
518 AC_MSG_NOTICE([Lustre base checks
519 ==============================================================================])
524 LB_DOWNSTREAM_RELEASE
545 # Tests depends from utils (multiop from liblustreapi)
546 AS_IF([test "x$enable_utils" = xno], [enable_tests="no"])
548 m4_ifdef([LC_NODEMAP_PROC_DEBUG], [LC_NODEMAP_PROC_DEBUG])
555 LB_DEFINE_E2FSPROGS_NAMES
560 AS_IF([test -n "$SNMP_DIST_SUBDIR"], [LS_CONFIGURE])
569 AS_IF([test -n "$SNMP_DIST_SUBDIR"], [LS_CONFIG_FILES])
571 AC_SUBST(ac_configure_args)
573 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
574 AC_SUBST(MOSTLYCLEANFILES)
576 LB_CONFIG_RPMBUILD_OPTIONS
586 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
588 Type 'make' to build Lustre.