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)
162 # LB_PATH_CRAY_PORTALS
164 # Support for external Cray portals
166 AC_DEFUN([LB_PATH_CRAY_PORTALS],
167 [LB_ARG_LIBS_INCLUDES([Cray Portals],[cray-portals])
169 if test x$cray_portals_includes != x ; then
170 if test ! -r $cray_portals_includes/portals/api.h ; then
171 AC_MSG_ERROR([Cray portals headers were not found in $cray_portals_includes. Please check the paths passed to --with-cray-portals or --with-cray-portals-includes.])
174 if test x$cray_portals_libs != x ; then
175 if test ! -r $cray_portals_libs/libportals.a ; then
176 AC_MSG_ERROR([Cray portals libraries were not found in $cray_portals_libs. Please check the paths passed to --with-cray-portals or --with-cray-portals-libs.])
180 if test x$cray_portals_includes != x -a x$cray_portals_libs != x ; then
182 AC_DEFINE(CRAY_PORTALS, 1, [Building with Cray Portals])
183 CPPFLAGS="-I$cray_portals_includes $CPPFLAGS"
184 EXTRA_KCFLAGS="-I$cray_portals_includes $EXTRA_KCFLAGS"
185 # for liblustre + b_cray
186 CRAY_PORTALS_LIBS="$cray_portals_libs"
187 AC_SUBST(CRAY_PORTALS_LIBS)
196 # Build kernel modules?
198 AC_DEFUN([LB_CONFIG_MODULES],
199 [AC_MSG_CHECKING([whether to build kernel modules])
200 AC_ARG_ENABLE([modules],
201 AC_HELP_STRING([--disable-modules],
202 [disable building of Lustre kernel modules]),
204 LC_TARGET_SUPPORTED([
210 AC_MSG_RESULT([$enable_modules ($target_os)])
212 if test x$enable_modules = xyes ; then
221 # This is strange - Lustre supports a target we don't
222 AC_MSG_ERROR([Modules are not supported on $target_os])
233 AC_DEFUN([LB_CONFIG_UTILS],
234 [AC_MSG_CHECKING([whether to build utilities])
235 AC_ARG_ENABLE([utils],
236 AC_HELP_STRING([--disable-utils],
237 [disable building of Lustre utility programs]),
238 [],[enable_utils='yes'])
239 AC_MSG_RESULT([$enable_utils])
240 if test x$enable_utils = xyes ; then
241 LB_CONFIG_INIT_SCRIPTS
250 AC_DEFUN([LB_CONFIG_TESTS],
251 [AC_MSG_CHECKING([whether to build Lustre tests])
252 AC_ARG_ENABLE([tests],
253 AC_HELP_STRING([--disable-tests],
254 [disable building of Lustre tests]),
255 [],[enable_tests='yes'])
256 if test x$cray_portals = xyes ; then
259 AC_MSG_RESULT([$enable_tests])
267 AC_DEFUN([LB_CONFIG_DOCS],
268 [AC_MSG_CHECKING([whether to build docs])
270 AC_HELP_STRING([--disable-doc],
271 [skip creation of pdf documentation]),
273 if test x$enable_doc = xyes ; then
282 AC_MSG_RESULT([$enable_doc])
287 # LB_CONFIG_INIT_SCRIPTS
289 # our init scripts only work on red hat linux
291 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS],
292 [ENABLE_INIT_SCRIPTS=0
293 if test x$enable_utils = xyes ; then
294 AC_MSG_CHECKING([whether to install init scripts])
295 # our scripts only work on red hat systems
296 if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
297 ENABLE_INIT_SCRIPTS=1
303 AC_SUBST(ENABLE_INIT_SCRIPTS)
309 # add -include config.h
311 AC_DEFUN([LB_CONFIG_HEADERS],
312 [AC_CONFIG_HEADERS([config.h])
313 CPPFLAGS="-include \$(top_builddir)/config.h $CPPFLAGS"
314 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
315 AC_SUBST(EXTRA_KCFLAGS)
321 # defines for including the toplevel Rules
323 AC_DEFUN([LB_INCLUDE_RULES],
324 [INCLUDE_RULES="include $PWD/build/Rules"
325 AC_SUBST(INCLUDE_RULES)
331 # 'fixup' default paths
333 AC_DEFUN([LB_PATH_DEFAULTS],
334 [# directories for binaries
335 AC_PREFIX_DEFAULT([/usr])
340 # Directories for documentation and demos.
341 docdir='${datadir}/doc/$(PACKAGE)'
351 # checks on the C compiler
353 AC_DEFUN([LB_PROG_CC],
355 AC_MSG_CHECKING([for buggy compiler])
356 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
358 AC_MSG_RESULT([buggy compiler found!])
360 echo " '$CC_VERSION'"
361 echo " has been known to generate bad code, "
362 echo " please get an updated compiler."
363 AC_MSG_ERROR([sorry])
365 case "$CC_VERSION" in
369 # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
370 # without "sub $0xc,%esp" to protect the stack from being
371 # stomped on by interrupts (bug 606)
372 "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
375 # mandrake's similar sub 0xc compiler bug
376 # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
377 "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
381 AC_MSG_RESULT([no known problems])
385 # --------- unsigned long long sane? -------
386 AC_CHECK_SIZEOF(unsigned long long, 0)
387 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
388 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
389 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
390 AC_MSG_ERROR([** we assume that sizeof(long long) == 8. Tell phil@clusterfs.com])
393 AC_MSG_CHECKING([if $CC accepts -m64])
396 AC_TRY_COMPILE([],[],[
403 CPPFLAGS="-I\$(top_builddir)/portals/include -I\$(top_srcdir)/portals/include -I\$(top_builddir)/lustre/include -I\$(top_srcdir)/lustre/include $CPPFLAGS"
405 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
408 LLCFLAGS="-g -Wall -fPIC"
411 # everyone builds against portals and lustre
412 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/portals/include -I$PWD/lustre/include"
413 AC_SUBST(EXTRA_KCFLAGS)
419 # AM_CONDITIONAL instances for everything
420 # (so that portals/lustre can disable some if needed)
421 AC_DEFUN([LB_CONDITIONALS],
422 [AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
423 AM_CONDITIONAL(UTILS, test x$enable_utils = xyes)
424 AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
425 AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
426 AM_CONDITIONAL(CRAY_PORTALS, test x$cray_portals != xno)
427 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
428 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
429 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
431 # this lets lustre cancel libsysio, per-branch or if liblustre is
433 if test "x$LIBSYSIO_SUBDIR" = xlibsysio ; then
434 if test "x$with_sysio" != xyes ; then
439 AC_SUBST(LIBSYSIO_SUBDIR)
442 LB_LINUX_CONDITIONALS
443 LB_DARWIN_CONDITIONALS
452 # main configure steps
454 AC_DEFUN([LB_CONFIGURE],
481 [Makefile:build/Makefile.in.toplevel]
484 build/autoconf/Makefile
499 LLCPPFLAGS: $LLCPPFLAGS
501 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
504 Type 'make' to build Lustre.