4 # Verify that LUSTRE_VERSION was defined properly
6 AC_DEFUN([LB_CHECK_VERSION],
7 [if test "LUSTRE_VERSION" = "LUSTRE""_VERSION" ; then
8 AC_MSG_ERROR([This script was not built with a version number.])
15 # fixup $target_os for use in other places
17 AC_DEFUN([LB_CANONICAL_SYSTEM],
28 AC_SUBST(lb_target_os)
34 # Check for file existance even when cross compiling
36 AC_DEFUN([LB_CHECK_FILE],
37 [AS_VAR_PUSHDEF([lb_File], [lb_cv_file_$1])dnl
38 AC_CACHE_CHECK([for $1], lb_File,
39 [if test -r "$1"; then
40 AS_VAR_SET(lb_File, yes)
42 AS_VAR_SET(lb_File, no)
44 AS_IF([test AS_VAR_GET(lb_File) = yes], [$2], [$3])[]dnl
45 AS_VAR_POPDEF([lb_File])dnl
51 # LB_CHECK_FILE over multiple files
53 AC_DEFUN([LB_CHECK_FILES],
54 [AC_FOREACH([AC_FILE_NAME], [$1],
55 [LB_CHECK_FILE(AC_FILE_NAME,
56 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_FILE_NAME), 1,
57 [Define to 1 if you have the
63 # LB_ARG_LIBS_INCLUDES
65 # support for --with-foo, --with-foo-includes, and --with-foo-libs in
66 # a single magical macro
68 AC_DEFUN([LB_ARG_LIBS_INCLUDES],
69 [lb_pathvar="m4_bpatsubst([$2], -, _)"
70 AC_MSG_CHECKING([for $1])
72 AC_HELP_STRING([--with-$2=path],
76 if test x$withval = xyes ; then
77 eval "$lb_pathvar='$3'"
79 eval "$lb_pathvar='$withval'"
81 AC_MSG_RESULT([${!lb_pathvar:-no}])
83 if test x${!lb_pathvar} != x -a x${!lb_pathvar} != xno ; then
84 AC_MSG_CHECKING([for $1 includes])
85 AC_ARG_WITH([$2-includes],
86 AC_HELP_STRING([--with-$2-includes=path],
87 [path to $1 includes]),
90 lb_includevar="${lb_pathvar}_includes"
91 if test x$withval = xyes ; then
92 eval "${lb_includevar}='${!lb_pathvar}/include'"
94 eval "${lb_includevar}='$withval'"
96 AC_MSG_RESULT([${!lb_includevar}])
98 AC_MSG_CHECKING([for $1 libs])
99 AC_ARG_WITH([$2-libs],
100 AC_HELP_STRING([--with-$2-libs=path],
104 lb_libvar="${lb_pathvar}_libs"
105 if test x$withval = xyes ; then
106 eval "${lb_libvar}='${!lb_pathvar}/lib'"
108 eval "${lb_libvar}='$withval'"
110 AC_MSG_RESULT([${!lb_libvar}])
118 # Handle internal/external libsysio
120 AC_DEFUN([LB_PATH_LIBSYSIO],
121 [AC_ARG_WITH([sysio],
122 AC_HELP_STRING([--with-sysio=path],
123 [set path to libsysio source (default is included libsysio)]),
125 case $lb_target_os in
134 AC_MSG_CHECKING([location of libsysio])
135 enable_sysio="$with_sysio"
138 AC_MSG_RESULT([internal])
139 LB_CHECK_FILE([$srcdir/libsysio/src/rmdir.c],[],[
140 AC_MSG_ERROR([A complete internal libsysio was not found.])
142 LIBSYSIO_SUBDIR="libsysio"
143 SYSIO="$PWD/libsysio"
146 AC_MSG_RESULT([disabled])
149 AC_MSG_RESULT([$with_sysio])
150 LB_CHECK_FILE([$with_sysio/lib/libsysio.a],[],[
151 AC_MSG_ERROR([A complete (built) external libsysio was not found.])
158 # We have to configure even if we don't build here for make dist to work
159 AC_CONFIG_SUBDIRS(libsysio)
165 # Handle internal/external ldiskfs
167 AC_DEFUN([LB_PATH_LDISKFS],
168 [AC_ARG_WITH([ldiskfs],
169 AC_HELP_STRING([--with-ldiskfs=path],
170 [set path to ldiskfs source (default is included ldiskfs)]),
172 if test x$linux25$enable_server = xyesyes ; then
178 AC_MSG_CHECKING([location of ldiskfs])
179 case x$with_ldiskfs in
181 AC_MSG_RESULT([internal])
182 LB_CHECK_FILE([$srcdir/ldiskfs/lustre-ldiskfs.spec.in],[],[
183 AC_MSG_ERROR([A complete internal ldiskfs was not found.])
185 LDISKFS_SUBDIR="ldiskfs"
186 LDISKFS_DIR="$PWD/ldiskfs"
189 AC_MSG_RESULT([disabled])
192 AC_MSG_RESULT([$with_ldiskfs])
193 LB_CHECK_FILE([$with_ldiskfs/ldiskfs/linux/ldiskfs_fs.h],[],[
194 AC_MSG_ERROR([A complete (built) external ldiskfs was not found.])
196 LDISKFS_DIR=$with_ldiskfs
199 AC_SUBST(LDISKFS_DIR)
200 AC_SUBST(LDISKFS_SUBDIR)
201 AM_CONDITIONAL(LDISKFS_ENABLED, test x$with_ldiskfs != xno)
203 # We have to configure even if we don't build here for make dist to work
204 AC_CONFIG_SUBDIRS(ldiskfs)
208 # LB_DEFINE_LDISKFS_OPTIONS
210 # Enable config options related to ldiskfs. These are used both by ldiskfs
211 # and lvfs (which includes ldiskfs headers.)
213 AC_DEFUN([LB_DEFINE_LDISKFS_OPTIONS],
215 AC_DEFINE(CONFIG_LDISKFS_FS_MODULE, 1, [build ldiskfs as a module])
216 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [enable extended attributes for ldiskfs])
217 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [enable posix acls for ldiskfs])
218 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [enable fs security for ldiskfs])
224 # Enable Cray XT3 features
226 AC_DEFUN([LB_CONFIG_CRAY_XT3],
227 [AC_MSG_CHECKING([whether to build Cray XT3 features])
228 AC_ARG_ENABLE([cray_xt3],
229 AC_HELP_STRING([--enable-cray-xt3],
230 [enable building of Cray XT3 features]),
231 [enable_cray_xt3='yes'],[enable_cray_xt3='no'])
232 AC_MSG_RESULT([$enable_cray_xt3])
233 if test x$enable_cray_xt3 != xno; then
234 AC_DEFINE(CRAY_XT3, 1, Enable Cray XT3 Features)
241 # Enable BGL features
243 AC_DEFUN([LB_CONFIG_BGL],
244 [AC_MSG_CHECKING([whether to build BGL features])
246 AC_HELP_STRING([--enable-bgl],
247 [enable building of BGL features]),
248 [enable_bgl='yes'],[enable_bgl='no'])
249 AC_MSG_RESULT([$enable_bgl])
250 if test x$enable_bgl != xno; then
251 AC_DEFINE(BGL_SUPPORT, 1, Enable BGL Features)
255 enable_liblustre='no'
256 enable_libreadline='no'
263 # Support for --with-dmu
265 AC_DEFUN([LB_PATH_DMU],
267 AC_HELP_STRING([--with-dmu=path],
268 [set path to a built dmu]),
277 AC_MSG_RESULT([$dmu])
278 if test x$enable_dmu_osd != xno; then
279 AC_DEFINE(ENABLE_DMU, 1, Enable DMU OSD)
280 AC_DEFINE(DMU_OSD, 1, Enable DMU OSD)
281 AC_DEFINE(UOSS_SUPPORT, 1, Enable user-level OSS)
282 AC_DEFINE(LUSTRE_ULEVEL_MT, 1, Multi-threaded user-level lustre port)
284 enable_ulevel_mt='yes'
288 enable_liblustre='no'
295 # Support for --enable-posix-dmu
297 AC_DEFUN([LB_POSIX_OSD],
298 [AC_MSG_CHECKING([whether to posix osd])
299 AC_ARG_ENABLE([posix-osd],
300 AC_HELP_STRING([--enable-posix-osd],
301 [enable using of posix osd]),
302 [enable_posix_osd='yes'],[enable_posix_osd='no'])
303 AC_MSG_RESULT([$enable_posix_osd])
304 if test x$enable_posix_osd != xno; then
305 AC_DEFINE(POSIX_OSD, 1, Enable POSIX OSD)
306 AC_DEFINE(UOSS_SUPPORT, 1, Enable user-level OSS)
307 AC_DEFINE(LUSTRE_ULEVEL_MT, 1, Multi-threaded user-level lustre port)
309 enable_ulevel_mt='yes'
313 enable_liblustre='no'
321 # check for in-tree snmp support
323 AC_DEFUN([LB_PATH_SNMP],
324 [LB_CHECK_FILE([$srcdir/snmp/lustre-snmp.c],[SNMP_DIST_SUBDIR="snmp"])
325 AC_SUBST(SNMP_DIST_SUBDIR)
326 AC_SUBST(SNMP_SUBDIR)
332 # Build kernel modules?
334 AC_DEFUN([LB_CONFIG_MODULES],
335 [AC_MSG_CHECKING([whether to build kernel modules])
336 AC_ARG_ENABLE([modules],
337 AC_HELP_STRING([--disable-modules],
338 [disable building of Lustre kernel modules]),
340 LC_TARGET_SUPPORTED([
346 AC_MSG_RESULT([$enable_modules ($target_os)])
348 if test x$enable_modules = xyes ; then
359 # This is strange - Lustre supports a target we don't
360 AC_MSG_ERROR([Modules are not supported on $target_os])
371 AC_DEFUN([LB_CONFIG_UTILS],
372 [AC_MSG_CHECKING([whether to build utilities])
373 AC_ARG_ENABLE([utils],
374 AC_HELP_STRING([--disable-utils],
375 [disable building of Lustre utility programs]),
376 [],[enable_utils='yes'])
377 AC_MSG_RESULT([$enable_utils])
378 if test x$enable_utils = xyes ; then
379 LB_CONFIG_INIT_SCRIPTS
388 AC_DEFUN([LB_CONFIG_TESTS],
389 [AC_MSG_CHECKING([whether to build Lustre tests])
390 AC_ARG_ENABLE([tests],
391 AC_HELP_STRING([--disable-tests],
392 [disable building of Lustre tests]),
397 AC_MSG_RESULT([$enable_tests])
405 AC_DEFUN([LB_CONFIG_DOCS],
406 [AC_MSG_CHECKING([whether to build docs])
408 AC_HELP_STRING([--disable-doc],
409 [skip creation of pdf documentation]),
411 if test x$enable_doc = xyes ; then
420 AC_MSG_RESULT([$enable_doc])
425 # LB_CONFIG_INIT_SCRIPTS
427 # our init scripts only work on red hat linux
429 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS],
430 [ENABLE_INIT_SCRIPTS=0
431 if test x$enable_utils = xyes ; then
432 AC_MSG_CHECKING([whether to install init scripts])
433 # our scripts only work on red hat systems
434 if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
435 ENABLE_INIT_SCRIPTS=1
441 AC_SUBST(ENABLE_INIT_SCRIPTS)
447 # add -include config.h
449 AC_DEFUN([LB_CONFIG_HEADERS],
450 [AC_CONFIG_HEADERS([config.h])
451 CPPFLAGS="-include \$(top_builddir)/config.h $CPPFLAGS"
452 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
453 AC_SUBST(EXTRA_KCFLAGS)
459 # defines for including the toplevel Rules
461 AC_DEFUN([LB_INCLUDE_RULES],
462 [INCLUDE_RULES="include $PWD/Rules"
463 AC_SUBST(INCLUDE_RULES)
469 # 'fixup' default paths
471 AC_DEFUN([LB_PATH_DEFAULTS],
472 [# directories for binaries
473 AC_PREFIX_DEFAULT([/usr])
478 # Directories for documentation and demos.
479 docdir='${datadir}/doc/$(PACKAGE)'
490 # checks on the C compiler
492 AC_DEFUN([LB_PROG_CC],
494 AC_MSG_CHECKING([for buggy compiler])
495 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
497 AC_MSG_RESULT([buggy compiler found!])
499 echo " '$CC_VERSION'"
500 echo " has been known to generate bad code, "
501 echo " please get an updated compiler."
502 AC_MSG_ERROR([sorry])
504 case "$CC_VERSION" in
508 # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
509 # without "sub $0xc,%esp" to protect the stack from being
510 # stomped on by interrupts (bug 606)
511 "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
514 # mandrake's similar sub 0xc compiler bug
515 # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
516 "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
520 AC_MSG_RESULT([no known problems])
524 # --------- unsigned long long sane? -------
525 AC_CHECK_SIZEOF(unsigned long long, 0)
526 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
527 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
528 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
529 AC_MSG_ERROR([** we assume that sizeof(long long) == 8. Tell phil@clusterfs.com])
533 AC_CHECK_DECL([__i386__], [], [
535 if test x$enable_bgl != xyes; then
536 AC_MSG_CHECKING([if $CC accepts -m64])
539 AC_TRY_COMPILE([],[],[
549 CPPFLAGS="-I\$(top_builddir)/lnet/include -I\$(top_srcdir)/lnet/include -I\$(top_builddir)/lustre/include -I\$(top_srcdir)/lustre/include $CPPFLAGS"
551 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
554 LLCFLAGS="-g -Wall -fPIC"
557 # everyone builds against lnet and lustre
558 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/lnet/include -I$PWD/lustre/include"
559 AC_SUBST(EXTRA_KCFLAGS)
565 # AM_CONDITIONAL instances for everything
566 # (so that portals/lustre can disable some if needed)
567 AC_DEFUN([LB_CONDITIONALS],
568 [AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
569 AM_CONDITIONAL(UTILS, test x$enable_utils = xyes)
570 AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
571 AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
572 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
573 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
574 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
575 AM_CONDITIONAL(CRAY_XT3, test x$enable_cray_xt3 = "xyes")
576 AM_CONDITIONAL(SUNOS, test x$lb_target_os = "xSunOS")
578 # this lets lustre cancel libsysio, per-branch or if liblustre is
580 if test "x$LIBSYSIO_SUBDIR" = xlibsysio ; then
581 if test "x$with_sysio" != xyes ; then
586 AC_SUBST(LIBSYSIO_SUBDIR)
589 LB_LINUX_CONDITIONALS
590 LB_DARWIN_CONDITIONALS
599 # build-specific config files
601 AC_DEFUN([LB_CONFIG_FILES],
607 [Rules:build/Rules.in]
608 AC_PACKAGE_TARNAME[.spec]
615 # main configure steps
617 AC_DEFUN([LB_CONFIGURE],
634 LC_CONFIG_CLIENT_SERVER
636 # three macros for cmd3
652 if test "$SNMP_DIST_SUBDIR" ; then
662 if test "$SNMP_DIST_SUBDIR" ; then
666 AC_SUBST(ac_configure_args)
668 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
669 AC_SUBST(MOSTLYCLEANFILES)
678 LLCPPFLAGS: $LLCPPFLAGS
680 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
683 Type 'make' to build Lustre.