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],
29 AC_SUBST(lb_target_os)
35 # Check for file existance even when cross compiling
37 AC_DEFUN([LB_CHECK_FILE],
38 [AS_VAR_PUSHDEF([lb_File], [lb_cv_file_$1])dnl
39 AC_CACHE_CHECK([for $1], lb_File,
40 [if test -r "$1"; then
41 AS_VAR_SET(lb_File, yes)
43 AS_VAR_SET(lb_File, no)
45 AS_IF([test AS_VAR_GET(lb_File) = yes], [$2], [$3])[]dnl
46 AS_VAR_POPDEF([lb_File])dnl
52 # LB_CHECK_FILE over multiple files
54 AC_DEFUN([LB_CHECK_FILES],
55 [AC_FOREACH([AC_FILE_NAME], [$1],
56 [LB_CHECK_FILE(AC_FILE_NAME,
57 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_FILE_NAME), 1,
58 [Define to 1 if you have the
64 # LB_ARG_LIBS_INCLUDES
66 # support for --with-foo, --with-foo-includes, and --with-foo-libs in
67 # a single magical macro
69 AC_DEFUN([LB_ARG_LIBS_INCLUDES],
70 [lb_pathvar="m4_bpatsubst([$2], -, _)"
71 AC_MSG_CHECKING([for $1])
73 AC_HELP_STRING([--with-$2=path],
77 if test x$withval = xyes ; then
78 eval "$lb_pathvar='$3'"
80 eval "$lb_pathvar='$withval'"
82 AC_MSG_RESULT([${!lb_pathvar:-no}])
84 if test x${!lb_pathvar} != x -a x${!lb_pathvar} != xno ; then
85 AC_MSG_CHECKING([for $1 includes])
86 AC_ARG_WITH([$2-includes],
87 AC_HELP_STRING([--with-$2-includes=path],
88 [path to $1 includes]),
91 lb_includevar="${lb_pathvar}_includes"
92 if test x$withval = xyes ; then
93 eval "${lb_includevar}='${!lb_pathvar}/include'"
95 eval "${lb_includevar}='$withval'"
97 AC_MSG_RESULT([${!lb_includevar}])
99 AC_MSG_CHECKING([for $1 libs])
100 AC_ARG_WITH([$2-libs],
101 AC_HELP_STRING([--with-$2-libs=path],
105 lb_libvar="${lb_pathvar}_libs"
106 if test x$withval = xyes ; then
107 eval "${lb_libvar}='${!lb_pathvar}/lib'"
109 eval "${lb_libvar}='$withval'"
111 AC_MSG_RESULT([${!lb_libvar}])
119 # Handle internal/external libsysio
121 AC_DEFUN([LB_PATH_LIBSYSIO],
122 [AC_ARG_WITH([sysio],
123 AC_HELP_STRING([--with-sysio=path],
124 [set path to libsysio source (default is included libsysio)]),
126 case $lb_target_os in
135 AC_MSG_CHECKING([location of libsysio])
136 enable_sysio="$with_sysio"
139 AC_MSG_RESULT([internal])
140 LB_CHECK_FILE([$srcdir/libsysio/src/rmdir.c],[],[
141 AC_MSG_ERROR([A complete internal libsysio was not found.])
143 LIBSYSIO_SUBDIR="libsysio"
144 SYSIO="$PWD/libsysio"
147 AC_MSG_RESULT([disabled])
150 AC_MSG_RESULT([$with_sysio])
151 LB_CHECK_FILE([$with_sysio/lib/libsysio.a],[],[
152 AC_MSG_ERROR([A complete (built) external libsysio was not found.])
159 # We have to configure even if we don't build here for make dist to
161 AC_CONFIG_SUBDIRS(libsysio)
167 # Enable Cray XT3 features
169 AC_DEFUN([LB_CONFIG_CRAY_XT3],
170 [AC_MSG_CHECKING([whether to build Cray XT3 features])
171 AC_ARG_ENABLE([cray_xt3],
172 AC_HELP_STRING([--enable-cray-xt3],
173 [enable building of Cray XT3 features]),
174 [enable_cray_xt3='yes'],[enable_cray_xt3='no'])
175 AC_MSG_RESULT([$enable_cray_xt3])
176 if test x$enable_cray_xt3 != xno; then
177 AC_DEFINE(CRAY_XT3, 1, Enable Cray XT3 Features)
184 # Enable BGL features
186 AC_DEFUN([LB_CONFIG_BGL],
187 [AC_MSG_CHECKING([whether to build BGL features])
189 AC_HELP_STRING([--enable-bgl],
190 [enable building of BGL features]),
191 [enable_bgl='yes'],[enable_bgl='no'])
192 AC_MSG_RESULT([$enable_bgl])
193 if test x$enable_bgl != xno; then
194 AC_DEFINE(BGL_SUPPORT, 1, Enable BGL Features)
198 enable_liblustre='no'
199 enable_libreadline='no'
208 AC_DEFUN([LB_CONFIG_UOSS],
209 [AC_MSG_CHECKING([whether to build user-level oss])
210 AC_ARG_ENABLE([uoss],
211 AC_HELP_STRING([--enable-uoss],
212 [enable building of user-level oss]),
213 [enable_uoss='yes'],[enable_uoss='no'])
214 if test x$enable_uoss != xno; then
215 AC_DEFINE(UOSS_SUPPORT, 1, Enable user-level OSS)
223 # check for in-tree snmp support
225 AC_DEFUN([LB_PATH_SNMP],
226 [LB_CHECK_FILE([$srcdir/snmp/lustre-snmp.c],[SNMP_DIST_SUBDIR="snmp"])
227 AC_SUBST(SNMP_DIST_SUBDIR)
228 AC_SUBST(SNMP_SUBDIR)
234 # Build kernel modules?
236 AC_DEFUN([LB_CONFIG_MODULES],
237 [AC_MSG_CHECKING([whether to build kernel modules])
238 AC_ARG_ENABLE([modules],
239 AC_HELP_STRING([--disable-modules],
240 [disable building of Lustre kernel modules]),
242 LC_TARGET_SUPPORTED([
248 AC_MSG_RESULT([$enable_modules ($target_os)])
250 if test x$enable_modules = xyes ; then
259 # This is strange - Lustre supports a target we don't
260 AC_MSG_ERROR([Modules are not supported on $target_os])
271 AC_DEFUN([LB_CONFIG_UTILS],
272 [AC_MSG_CHECKING([whether to build utilities])
273 AC_ARG_ENABLE([utils],
274 AC_HELP_STRING([--disable-utils],
275 [disable building of Lustre utility programs]),
276 [],[enable_utils='yes'])
277 AC_MSG_RESULT([$enable_utils])
278 if test x$enable_utils = xyes ; then
279 LB_CONFIG_INIT_SCRIPTS
288 AC_DEFUN([LB_CONFIG_TESTS],
289 [AC_MSG_CHECKING([whether to build Lustre tests])
290 AC_ARG_ENABLE([tests],
291 AC_HELP_STRING([--disable-tests],
292 [disable building of Lustre tests]),
297 AC_MSG_RESULT([$enable_tests])
305 AC_DEFUN([LB_CONFIG_DOCS],
306 [AC_MSG_CHECKING([whether to build docs])
308 AC_HELP_STRING([--disable-doc],
309 [skip creation of pdf documentation]),
311 if test x$enable_doc = xyes ; then
320 AC_MSG_RESULT([$enable_doc])
325 # LB_CONFIG_INIT_SCRIPTS
327 # our init scripts only work on red hat linux
329 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS],
330 [ENABLE_INIT_SCRIPTS=0
331 if test x$enable_utils = xyes ; then
332 AC_MSG_CHECKING([whether to install init scripts])
333 # our scripts only work on red hat systems
334 if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
335 ENABLE_INIT_SCRIPTS=1
341 AC_SUBST(ENABLE_INIT_SCRIPTS)
347 # add -include config.h
349 AC_DEFUN([LB_CONFIG_HEADERS],
350 [AC_CONFIG_HEADERS([config.h])
351 CPPFLAGS="-include \$(top_builddir)/config.h $CPPFLAGS"
352 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
353 AC_SUBST(EXTRA_KCFLAGS)
359 # defines for including the toplevel Rules
361 AC_DEFUN([LB_INCLUDE_RULES],
362 [INCLUDE_RULES="include $PWD/build/Rules"
363 AC_SUBST(INCLUDE_RULES)
369 # 'fixup' default paths
371 AC_DEFUN([LB_PATH_DEFAULTS],
372 [# directories for binaries
373 AC_PREFIX_DEFAULT([/usr])
378 # Directories for documentation and demos.
379 docdir='${datadir}/doc/$(PACKAGE)'
390 # checks on the C compiler
392 AC_DEFUN([LB_PROG_CC],
394 AC_MSG_CHECKING([for buggy compiler])
395 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
397 AC_MSG_RESULT([buggy compiler found!])
399 echo " '$CC_VERSION'"
400 echo " has been known to generate bad code, "
401 echo " please get an updated compiler."
402 AC_MSG_ERROR([sorry])
404 case "$CC_VERSION" in
408 # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
409 # without "sub $0xc,%esp" to protect the stack from being
410 # stomped on by interrupts (bug 606)
411 "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
414 # mandrake's similar sub 0xc compiler bug
415 # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
416 "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
420 AC_MSG_RESULT([no known problems])
424 # --------- unsigned long long sane? -------
425 AC_CHECK_SIZEOF(unsigned long long, 0)
426 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
427 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
428 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
429 AC_MSG_ERROR([** we assume that sizeof(long long) == 8. Tell phil@clusterfs.com])
433 AC_CHECK_DECL([__i386__], [], [
435 if test x$enable_bgl != xyes; then
436 AC_MSG_CHECKING([if $CC accepts -m64])
439 AC_TRY_COMPILE([],[],[
449 CPPFLAGS="-I\$(top_builddir)/lnet/include -I\$(top_srcdir)/lnet/include -I\$(top_builddir)/lustre/include -I\$(top_srcdir)/lustre/include $CPPFLAGS"
451 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
454 LLCFLAGS="-g -Wall -fPIC"
457 # everyone builds against lnet and lustre
458 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/lnet/include -I$PWD/lustre/include"
459 AC_SUBST(EXTRA_KCFLAGS)
465 # AM_CONDITIONAL instances for everything
466 # (so that portals/lustre can disable some if needed)
467 AC_DEFUN([LB_CONDITIONALS],
468 [AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
469 AM_CONDITIONAL(UTILS, test x$enable_utils = xyes)
470 AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
471 AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
472 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
473 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
474 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
475 AM_CONDITIONAL(CRAY_XT3, test x$enable_cray_xt3 = "xyes")
476 AM_CONDITIONAL(SUNOS, test x$lb_target_os = "xSunOS")
478 # this lets lustre cancel libsysio, per-branch or if liblustre is
480 if test "x$LIBSYSIO_SUBDIR" = xlibsysio ; then
481 if test "x$with_sysio" != xyes ; then
486 AC_SUBST(LIBSYSIO_SUBDIR)
489 LB_LINUX_CONDITIONALS
490 LB_DARWIN_CONDITIONALS
491 LB_SUNOS_CONDITIONALS
500 # main configure steps
502 AC_DEFUN([LB_CONFIGURE],
520 LC_CONFIG_CLIENT_SERVER
522 # three macros for cmd3
534 if test "$SNMP_DIST_SUBDIR" ; then
542 [Makefile:build/Makefile.in.toplevel]
545 build/autoconf/Makefile
552 if test "$SNMP_DIST_SUBDIR" ; then
556 AC_SUBST(ac_configure_args)
558 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.*'
559 AC_SUBST(MOSTLYCLEANFILES)
568 LLCPPFLAGS: $LLCPPFLAGS
570 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
573 Type 'make' to build Lustre.