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)
216 AC_DEFINE(LUSTRE_ULEVEL_MT, 1, Multi-threaded user-level lustre port)
224 # check for in-tree snmp support
226 AC_DEFUN([LB_PATH_SNMP],
227 [LB_CHECK_FILE([$srcdir/snmp/lustre-snmp.c],[SNMP_DIST_SUBDIR="snmp"])
228 AC_SUBST(SNMP_DIST_SUBDIR)
229 AC_SUBST(SNMP_SUBDIR)
235 # Build kernel modules?
237 AC_DEFUN([LB_CONFIG_MODULES],
238 [AC_MSG_CHECKING([whether to build kernel modules])
239 AC_ARG_ENABLE([modules],
240 AC_HELP_STRING([--disable-modules],
241 [disable building of Lustre kernel modules]),
243 LC_TARGET_SUPPORTED([
249 AC_MSG_RESULT([$enable_modules ($target_os)])
251 if test x$enable_modules = xyes ; then
260 # This is strange - Lustre supports a target we don't
261 AC_MSG_ERROR([Modules are not supported on $target_os])
272 AC_DEFUN([LB_CONFIG_UTILS],
273 [AC_MSG_CHECKING([whether to build utilities])
274 AC_ARG_ENABLE([utils],
275 AC_HELP_STRING([--disable-utils],
276 [disable building of Lustre utility programs]),
277 [],[enable_utils='yes'])
278 AC_MSG_RESULT([$enable_utils])
279 if test x$enable_utils = xyes ; then
280 LB_CONFIG_INIT_SCRIPTS
289 AC_DEFUN([LB_CONFIG_TESTS],
290 [AC_MSG_CHECKING([whether to build Lustre tests])
291 AC_ARG_ENABLE([tests],
292 AC_HELP_STRING([--disable-tests],
293 [disable building of Lustre tests]),
298 AC_MSG_RESULT([$enable_tests])
306 AC_DEFUN([LB_CONFIG_DOCS],
307 [AC_MSG_CHECKING([whether to build docs])
309 AC_HELP_STRING([--disable-doc],
310 [skip creation of pdf documentation]),
312 if test x$enable_doc = xyes ; then
321 AC_MSG_RESULT([$enable_doc])
326 # LB_CONFIG_INIT_SCRIPTS
328 # our init scripts only work on red hat linux
330 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS],
331 [ENABLE_INIT_SCRIPTS=0
332 if test x$enable_utils = xyes ; then
333 AC_MSG_CHECKING([whether to install init scripts])
334 # our scripts only work on red hat systems
335 if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
336 ENABLE_INIT_SCRIPTS=1
342 AC_SUBST(ENABLE_INIT_SCRIPTS)
348 # add -include config.h
350 AC_DEFUN([LB_CONFIG_HEADERS],
351 [AC_CONFIG_HEADERS([config.h])
352 CPPFLAGS="-include \$(top_builddir)/config.h $CPPFLAGS"
353 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
354 AC_SUBST(EXTRA_KCFLAGS)
360 # defines for including the toplevel Rules
362 AC_DEFUN([LB_INCLUDE_RULES],
363 [INCLUDE_RULES="include $PWD/build/Rules"
364 AC_SUBST(INCLUDE_RULES)
370 # 'fixup' default paths
372 AC_DEFUN([LB_PATH_DEFAULTS],
373 [# directories for binaries
374 AC_PREFIX_DEFAULT([/usr])
379 # Directories for documentation and demos.
380 docdir='${datadir}/doc/$(PACKAGE)'
391 # checks on the C compiler
393 AC_DEFUN([LB_PROG_CC],
395 AC_MSG_CHECKING([for buggy compiler])
396 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
398 AC_MSG_RESULT([buggy compiler found!])
400 echo " '$CC_VERSION'"
401 echo " has been known to generate bad code, "
402 echo " please get an updated compiler."
403 AC_MSG_ERROR([sorry])
405 case "$CC_VERSION" in
409 # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
410 # without "sub $0xc,%esp" to protect the stack from being
411 # stomped on by interrupts (bug 606)
412 "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
415 # mandrake's similar sub 0xc compiler bug
416 # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
417 "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
421 AC_MSG_RESULT([no known problems])
425 # --------- unsigned long long sane? -------
426 AC_CHECK_SIZEOF(unsigned long long, 0)
427 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
428 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
429 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
430 AC_MSG_ERROR([** we assume that sizeof(long long) == 8. Tell phil@clusterfs.com])
434 AC_CHECK_DECL([__i386__], [], [
436 if test x$enable_bgl != xyes; then
437 AC_MSG_CHECKING([if $CC accepts -m64])
440 AC_TRY_COMPILE([],[],[
450 AC_CHECK_FUNCS(strnlen pread pwrite directio)
452 CPPFLAGS="-I\$(top_builddir)/lnet/include -I\$(top_srcdir)/lnet/include -I\$(top_builddir)/lustre/include -I\$(top_srcdir)/lustre/include $CPPFLAGS"
454 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1 -D_GNU_SOURCE -D_XOPEN_SOURCE=500"
457 LLCFLAGS="-g -Wall -fPIC"
460 # everyone builds against lnet and lustre
461 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/lnet/include -I$PWD/lustre/include"
462 AC_SUBST(EXTRA_KCFLAGS)
468 # AM_CONDITIONAL instances for everything
469 # (so that portals/lustre can disable some if needed)
470 AC_DEFUN([LB_CONDITIONALS],
471 [AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
472 AM_CONDITIONAL(UTILS, test x$enable_utils = xyes)
473 AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
474 AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
475 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
476 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
477 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
478 AM_CONDITIONAL(CRAY_XT3, test x$enable_cray_xt3 = "xyes")
479 AM_CONDITIONAL(SUNOS, test x$lb_target_os = "xSunOS")
481 # this lets lustre cancel libsysio, per-branch or if liblustre is
483 if test "x$LIBSYSIO_SUBDIR" = xlibsysio ; then
484 if test "x$with_sysio" != xyes ; then
489 AC_SUBST(LIBSYSIO_SUBDIR)
492 LB_LINUX_CONDITIONALS
493 LB_DARWIN_CONDITIONALS
494 # LB_SUNOS_CONDITIONALS
503 # main configure steps
505 AC_DEFUN([LB_CONFIGURE],
523 LC_CONFIG_CLIENT_SERVER
525 # three macros for cmd3
537 if test "$SNMP_DIST_SUBDIR" ; then
545 [Makefile:build/Makefile.in.toplevel]
548 build/autoconf/Makefile
555 if test "$SNMP_DIST_SUBDIR" ; then
559 AC_SUBST(ac_configure_args)
561 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.*'
562 AC_SUBST(MOSTLYCLEANFILES)
571 LLCPPFLAGS: $LLCPPFLAGS
573 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
576 Type 'make' to build Lustre.