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],
26 AC_SUBST(lb_target_os)
32 # Check for file existance even when cross compiling
34 AC_DEFUN([LB_CHECK_FILE],
35 [AS_VAR_PUSHDEF([lb_File], [lb_cv_file_$1])dnl
36 AC_CACHE_CHECK([for $1], lb_File,
37 [if test -r "$1"; then
38 AS_VAR_SET(lb_File, yes)
40 AS_VAR_SET(lb_File, no)
42 AS_IF([test AS_VAR_GET(lb_File) = yes], [$2], [$3])[]dnl
43 AS_VAR_POPDEF([lb_File])dnl
49 # LB_CHECK_FILE over multiple files
51 AC_DEFUN([LB_CHECK_FILES],
52 [AC_FOREACH([AC_FILE_NAME], [$1],
53 [LB_CHECK_FILE(AC_FILE_NAME,
54 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_FILE_NAME), 1,
55 [Define to 1 if you have the
61 # LB_ARG_LIBS_INCLUDES
63 # support for --with-foo, --with-foo-includes, and --with-foo-libs in
64 # a single magical macro
66 AC_DEFUN([LB_ARG_LIBS_INCLUDES],
67 [lb_pathvar="m4_bpatsubst([$2], -, _)"
68 AC_MSG_CHECKING([for $1])
70 AC_HELP_STRING([--with-$2=path],
74 if test x$withval = xyes ; then
75 eval "$lb_pathvar='$3'"
77 eval "$lb_pathvar='$withval'"
79 AC_MSG_RESULT([${!lb_pathvar:-no}])
81 if test x${!lb_pathvar} != x -a x${!lb_pathvar} != xno ; then
82 AC_MSG_CHECKING([for $1 includes])
83 AC_ARG_WITH([$2-includes],
84 AC_HELP_STRING([--with-$2-includes=path],
85 [path to $1 includes]),
88 lb_includevar="${lb_pathvar}_includes"
89 if test x$withval = xyes ; then
90 eval "${lb_includevar}='${!lb_pathvar}/include'"
92 eval "${lb_includevar}='$withval'"
94 AC_MSG_RESULT([${!lb_includevar}])
96 AC_MSG_CHECKING([for $1 libs])
97 AC_ARG_WITH([$2-libs],
98 AC_HELP_STRING([--with-$2-libs=path],
102 lb_libvar="${lb_pathvar}_libs"
103 if test x$withval = xyes ; then
104 eval "${lb_libvar}='${!lb_pathvar}/lib'"
106 eval "${lb_libvar}='$withval'"
108 AC_MSG_RESULT([${!lb_libvar}])
116 # Handle internal/external libsysio
118 AC_DEFUN([LB_PATH_LIBSYSIO],
119 [AC_ARG_WITH([sysio],
120 AC_HELP_STRING([--with-sysio=path],
121 [set path to libsysio source (default is included libsysio)]),
123 case $lb_target_os in
132 AC_MSG_CHECKING([location of libsysio])
133 enable_sysio="$with_sysio"
136 AC_MSG_RESULT([internal])
137 LB_CHECK_FILE([$srcdir/libsysio/src/rmdir.c],[],[
138 AC_MSG_ERROR([A complete internal libsysio was not found.])
140 LIBSYSIO_SUBDIR="libsysio"
141 SYSIO="$PWD/libsysio"
144 AC_MSG_RESULT([disabled])
147 AC_MSG_RESULT([$with_sysio])
148 LB_CHECK_FILE([$with_sysio/lib/libsysio.a],[],[
149 AC_MSG_ERROR([A complete (built) external libsysio was not found.])
156 # We have to configure even if we don't build here for make dist to
158 AC_CONFIG_SUBDIRS(libsysio)
164 # configure support for Cray Portals
166 AC_DEFUN([LB_CONFIG_PORTALS],
167 [AC_MSG_CHECKING([for external Portals])
168 AC_ARG_WITH([portals],
169 AC_HELP_STRING([--with-portals=path],
170 [set path to portals]),
172 case $with_portals in
176 *) if test x$with_portals != x ; then
177 PORTALS="$with_portals"
180 AC_MSG_ERROR([Path to portals must be specified])
186 ], [enable_portals=no])
187 AC_MSG_CHECKING([location of portals])
188 case x$enable_portals in
190 AC_MSG_RESULT([$PORTALS])
191 LB_CHECK_FILE([$PORTALS/include/portals/api.h],[],
192 AC_MSG_ERROR([Cannot find portals headers]))
195 AC_MSG_RESULT([no external portals])
203 # LB_CONFIG_LUSTRE_PORTALS
205 # configure support for Lustre Portals
207 AC_DEFUN([LB_CONFIG_LUSTRE_PORTALS],
208 [AC_MSG_CHECKING([for Lustre Portals])
209 AC_ARG_WITH([lustre-portals],
210 AC_HELP_STRING([--with-lustre-portals=path],
211 [set path to Lustre portals]),
213 case $with_lustre_portals in
214 yes) LUSTRE_PORTALS="$PWD/portals"
215 enable_lustre_portals=yes
217 no) LUSTRE_PORTALS=""
218 enable_lustre_portals=no
220 *) if test x$with_lustre_portals != x ; then
221 LUSTRE_PORTALS="$with_lustre_portals"
223 LUSTRE_PORTALS="$PWD/portals"
225 enable_lustre_portals=yes
229 ], [enable_lustre_portals=no])
231 AC_MSG_CHECKING([location of Lustre portals])
232 case x$enable_lustre_portals in
234 AC_MSG_RESULT([$LUSTRE_PORTALS])
235 LB_CHECK_FILE([$LUSTRE_PORTALS/include/portals/api.h],[LUSTRE_PORTALS_SUBDIR="portals"],
236 AC_MSG_ERROR([Cannot find Lustre portals headers]))
239 AC_MSG_RESULT([disable Lustre portals])
243 AC_SUBST(LUSTRE_PORTALS_SUBDIR)
244 AC_SUBST(LUSTRE_PORTALS)
250 # Enable Cray XT3 features
252 AC_DEFUN([LB_CONFIG_CRAY_XT3],
253 [AC_MSG_CHECKING([whether to build Cray XT3 features])
254 AC_ARG_ENABLE([cray_xt3],
255 AC_HELP_STRING([--enable-cray-xt3],
256 [enable building of Cray XT3 features]),
257 [enable_cray_xt3='yes'],[enable_cray_xt3='no'])
258 AC_MSG_RESULT([$enable_cray_xt3])
259 if test x$enable_cray_xt3 != xno; then
260 AC_DEFINE(CRAY_XT3, 1, Enable Cray XT3 Features)
267 # Enable BGL features
269 AC_DEFUN([LB_CONFIG_BGL],
270 [AC_MSG_CHECKING([whether to build BGL features])
272 AC_HELP_STRING([--enable-bgl],
273 [enable building of BGL features]),
274 [enable_bgl='yes'],[enable_bgl='no'])
275 AC_MSG_RESULT([$enable_bgl])
276 if test x$enable_bgl != xno; then
277 AC_DEFINE(BGL_SUPPORT, 1, Enable BGL Features)
281 enable_liblustre='no'
288 # check for in-tree snmp support
290 AC_DEFUN([LB_PATH_SNMP],
291 [LB_CHECK_FILE([$srcdir/snmp/lustre-snmp.c],[SNMP_DIST_SUBDIR="snmp"])
292 AC_SUBST(SNMP_DIST_SUBDIR)
293 AC_SUBST(SNMP_SUBDIR)
299 # Build kernel modules?
301 AC_DEFUN([LB_CONFIG_MODULES],
302 [AC_MSG_CHECKING([whether to build kernel modules])
303 AC_ARG_ENABLE([modules],
304 AC_HELP_STRING([--disable-modules],
305 [disable building of Lustre kernel modules]),
307 LC_TARGET_SUPPORTED([
313 AC_MSG_RESULT([$enable_modules ($target_os)])
315 if test x$enable_modules = xyes ; then
324 # This is strange - Lustre supports a target we don't
325 AC_MSG_ERROR([Modules are not supported on $target_os])
336 AC_DEFUN([LB_CONFIG_UTILS],
337 [AC_MSG_CHECKING([whether to build utilities])
338 AC_ARG_ENABLE([utils],
339 AC_HELP_STRING([--disable-utils],
340 [disable building of Lustre utility programs]),
341 [],[enable_utils='yes'])
342 AC_MSG_RESULT([$enable_utils])
343 if test x$enable_utils = xyes ; then
344 LB_CONFIG_INIT_SCRIPTS
353 AC_DEFUN([LB_CONFIG_TESTS],
354 [AC_MSG_CHECKING([whether to build Lustre tests])
355 AC_ARG_ENABLE([tests],
356 AC_HELP_STRING([--disable-tests],
357 [disable building of Lustre tests]),
362 AC_MSG_RESULT([$enable_tests])
370 AC_DEFUN([LB_CONFIG_DOCS],
371 [AC_MSG_CHECKING([whether to build docs])
373 AC_HELP_STRING([--disable-doc],
374 [skip creation of pdf documentation]),
376 if test x$enable_doc = xyes ; then
385 AC_MSG_RESULT([$enable_doc])
390 # LB_CONFIG_INIT_SCRIPTS
392 # our init scripts only work on red hat linux
394 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS],
395 [ENABLE_INIT_SCRIPTS=0
396 if test x$enable_utils = xyes ; then
397 AC_MSG_CHECKING([whether to install init scripts])
398 # our scripts only work on red hat systems
399 if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
400 ENABLE_INIT_SCRIPTS=1
406 AC_SUBST(ENABLE_INIT_SCRIPTS)
412 # add -include config.h
414 AC_DEFUN([LB_CONFIG_HEADERS],
415 [AC_CONFIG_HEADERS([config.h])
416 CPPFLAGS="-include \$(top_builddir)/config.h $CPPFLAGS"
417 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
418 AC_SUBST(EXTRA_KCFLAGS)
424 # defines for including the toplevel Rules
426 AC_DEFUN([LB_INCLUDE_RULES],
427 [INCLUDE_RULES="include $PWD/build/Rules"
428 AC_SUBST(INCLUDE_RULES)
434 # 'fixup' default paths
436 AC_DEFUN([LB_PATH_DEFAULTS],
437 [# directories for binaries
438 AC_PREFIX_DEFAULT([/usr])
443 # Directories for documentation and demos.
444 docdir='${datadir}/doc/$(PACKAGE)'
455 # checks on the C compiler
457 AC_DEFUN([LB_PROG_CC],
459 AC_MSG_CHECKING([for buggy compiler])
460 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
462 AC_MSG_RESULT([buggy compiler found!])
464 echo " '$CC_VERSION'"
465 echo " has been known to generate bad code, "
466 echo " please get an updated compiler."
467 AC_MSG_ERROR([sorry])
469 case "$CC_VERSION" in
473 # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
474 # without "sub $0xc,%esp" to protect the stack from being
475 # stomped on by interrupts (bug 606)
476 "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
479 # mandrake's similar sub 0xc compiler bug
480 # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
481 "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
485 AC_MSG_RESULT([no known problems])
489 # --------- unsigned long long sane? -------
490 AC_CHECK_SIZEOF(unsigned long long, 0)
491 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
492 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
493 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
494 AC_MSG_ERROR([** we assume that sizeof(long long) == 8. Tell phil@clusterfs.com])
497 if test x$enable_bgl != xyes; then
498 AC_MSG_CHECKING([if $CC accepts -m64])
501 AC_TRY_COMPILE([],[],[
509 CPPFLAGS="-I\$(top_builddir)/lnet/include -I\$(top_srcdir)/lnet/include -I\$(top_builddir)/lustre/include -I\$(top_srcdir)/lustre/include $CPPFLAGS"
511 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
514 LLCFLAGS="-g -Wall -fPIC"
517 # everyone builds against lnet and lustre
518 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/lnet/include -I$PWD/lustre/include"
519 AC_SUBST(EXTRA_KCFLAGS)
525 # AM_CONDITIONAL instances for everything
526 # (so that portals/lustre can disable some if needed)
527 AC_DEFUN([LB_CONDITIONALS],
528 [AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
529 AM_CONDITIONAL(UTILS, test x$enable_utils = xyes)
530 AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
531 AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
532 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
533 AM_CONDITIONAL(BUILD_PORTALS, test x$LUSTRE_PORTALS_SUBDIR = "xportals")
534 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
535 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
537 # this lets lustre cancel libsysio, per-branch or if liblustre is
539 if test "x$LIBSYSIO_SUBDIR" = xlibsysio ; then
540 if test "x$with_sysio" != xyes ; then
545 AC_SUBST(LIBSYSIO_SUBDIR)
548 LB_LINUX_CONDITIONALS
549 LB_DARWIN_CONDITIONALS
553 #if test "$LUSTRE_PORTALS" ; then
561 # main configure steps
563 AC_DEFUN([LB_CONFIGURE],
569 if ! test "$PORTALS" ; then
570 # if portals is configured, Lustre portals will be ignored
571 LB_CONFIG_LUSTRE_PORTALS
582 if test "$LUSTRE_PORTALS" ; then
589 LC_CONFIG_CLIENT_SERVER
598 if test "$LUSTRE_PORTALS" ; then
601 if test "$SNMP_DIST_SUBDIR" ; then
609 [Makefile:build/Makefile.in.toplevel]
612 build/autoconf/Makefile
619 if test "$LUSTRE_PORTALS" ; then
622 if test "$SNMP_DIST_SUBDIR" ; then
626 AC_SUBST(ac_configure_args)
628 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.*'
629 AC_SUBST(MOSTLYCLEANFILES)
638 LLCPPFLAGS: $LLCPPFLAGS
640 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
643 Type 'make' to build Lustre.