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
63 # Handle internal/external libsysio
65 AC_DEFUN([LB_PATH_LIBSYSIO],
67 AC_HELP_STRING([--with-sysio=path],
68 [set path to libsysio source (default is included libsysio)]),
79 AC_MSG_CHECKING([location of libsysio])
80 enable_sysio="$with_sysio"
83 AC_MSG_RESULT([internal])
84 LB_CHECK_FILE([$srcdir/libsysio/src/rmdir.c],[],[
85 AC_MSG_ERROR([A complete internal libsysio was not found.])
87 LIBSYSIO_SUBDIR="libsysio"
91 AC_MSG_RESULT([disabled])
94 AC_MSG_RESULT([$with_sysio])
95 LB_CHECK_FILE([$with_sysio/lib/libsysio.a],[],[
96 AC_MSG_ERROR([A complete (built) external libsysio was not found.])
103 # We have to configure even if we don't build here for make dist to
105 AC_CONFIG_SUBDIRS(libsysio)
109 # LB_PATH_CRAY_PORTALS
111 # Support for external Cray portals
113 AC_DEFUN([LB_PATH_CRAY_PORTALS],
114 [AC_MSG_CHECKING([for Cray portals])
115 AC_ARG_WITH([cray-portals],
116 AC_HELP_STRING([--with-cray-portals=path],
117 [path to cray portals]),
119 if test "$with_cray_portals" != no; then
120 CRAY_PORTALS_PATH=$with_cray_portals
121 CRAY_PORTALS_INCLUDES="$with_cray_portals/include"
122 CRAY_PORTALS_LIBS="$with_cray_portals"
124 ],[with_cray_portals=no])
125 AC_SUBST(CRAY_PORTALS_PATH)
126 AC_MSG_RESULT([$CRAY_PORTALS_PATH])
128 AC_MSG_CHECKING([for Cray portals includes])
129 AC_ARG_WITH([cray-portals-includes],
130 AC_HELP_STRING([--with-cray-portals-includes=path],
131 [path to cray portals includes]),
133 if test "$with_cray_portals_includes" != no; then
134 CRAY_PORTALS_INCLUDES="$with_cray_portals_includes"
137 AC_SUBST(CRAY_PORTALS_INCLUDES)
138 AC_MSG_RESULT([$CRAY_PORTALS_INCLUDES])
140 AC_MSG_CHECKING([for Cray portals libs])
141 AC_ARG_WITH([cray-portals-libs],
142 AC_HELP_STRING([--with-cray-portals-libs=path],
143 [path to cray portals libs]),
145 if test "$with_cray_portals_libs" != no; then
146 CRAY_PORTALS_LIBS="$with_cray_portals_libs"
149 AC_SUBST(CRAY_PORTALS_LIBS)
150 AC_MSG_RESULT([$CRAY_PORTALS_LIBS])
152 if test x$CRAY_PORTALS_INCLUDES != x ; then
153 if test ! -r $CRAY_PORTALS_INCLUDES/portals/api.h ; then
154 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.])
157 if test x$CRAY_PORTALS_LIBS != x ; then
158 if test ! -r $CRAY_PORTALS_LIBS/libportals.a ; then
159 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.])
163 AC_MSG_CHECKING([whether to use Cray portals])
164 if test x$CRAY_PORTALS_INCLUDES != x -a x$CRAY_PORTALS_LIBS != x ; then
165 with_cray_portals=yes
166 AC_DEFINE(CRAY_PORTALS, 1, [Building with Cray Portals])
167 CPPFLAGS="-I$CRAY_PORTALS_INCLUDES $CPPFLAGS"
168 EXTRA_KCFLAGS="-I$CRAY_PORTALS_INCLUDES $EXTRA_KCFLAGS"
172 AC_MSG_RESULT([$with_cray_portals])
178 # Build kernel modules?
180 AC_DEFUN([LB_CONFIG_MODULES],
181 [AC_MSG_CHECKING([whether to build kernel modules])
182 AC_ARG_ENABLE([modules],
183 AC_HELP_STRING([--disable-modules],
184 [disable building of Lustre kernel modules]),
186 LC_TARGET_SUPPORTED([
192 AC_MSG_RESULT([$enable_modules ($target_os)])
194 if test x$enable_modules = xyes ; then
203 # This is strange - Lustre supports a target we don't
204 AC_MSG_ERROR([Modules are not supported on $target_os])
215 AC_DEFUN([LB_CONFIG_UTILS],
216 [AC_MSG_CHECKING([whether to build utilities])
217 AC_ARG_ENABLE([utils],
218 AC_HELP_STRING([--disable-utils],
219 [disable building of Lustre utility programs]),
220 [],[enable_utils='yes'])
221 if test x$with_cray_portals = xyes ; then
224 AC_MSG_RESULT([$enable_utils])
225 if test x$enable_utils = xyes ; then
226 LB_CONFIG_INIT_SCRIPTS
235 AC_DEFUN([LB_CONFIG_TESTS],
236 [AC_MSG_CHECKING([whether to build Lustre tests])
237 AC_ARG_ENABLE([tests],
238 AC_HELP_STRING([--disable-tests],
239 [disable building of Lustre tests]),
240 [],[enable_tests='yes'])
241 if test x$with_cray_portals = xyes ; then
244 AC_MSG_RESULT([$enable_tests])
252 AC_DEFUN([LB_CONFIG_DOCS],
253 [AC_MSG_CHECKING([whether to build docs])
255 AC_HELP_STRING([--disable-doc],
256 [skip creation of pdf documentation]),
258 if test x$enable_doc = xyes ; then
267 AC_MSG_RESULT([$enable_doc])
272 # LB_CONFIG_INIT_SCRIPTS
274 # our init scripts only work on red hat linux
276 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS],
277 [ENABLE_INIT_SCRIPTS=0
278 if test x$enable_utils = xyes ; then
279 AC_MSG_CHECKING([whether to install init scripts])
280 # our scripts only work on red hat systems
281 if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
282 ENABLE_INIT_SCRIPTS=1
288 AC_SUBST(ENABLE_INIT_SCRIPTS)
294 # add -include config.h
296 AC_DEFUN([LB_CONFIG_HEADERS],
297 [AC_CONFIG_HEADERS([config.h])
298 CPPFLAGS="-include \$(top_builddir)/config.h $CPPFLAGS"
299 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
300 AC_SUBST(EXTRA_KCFLAGS)
306 # defines for including the toplevel Rules
308 AC_DEFUN([LB_INCLUDE_RULES],
309 [INCLUDE_RULES="include $PWD/build/Rules"
310 AC_SUBST(INCLUDE_RULES)
316 # 'fixup' default paths
318 AC_DEFUN([LB_PATH_DEFAULTS],
319 [# directories for binaries
320 AC_PREFIX_DEFAULT([/usr])
325 # Directories for documentation and demos.
326 docdir='${datadir}/doc/$(PACKAGE)'
336 # checks on the C compiler
338 AC_DEFUN([LB_PROG_CC],
340 AC_MSG_CHECKING([for buggy compiler])
341 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
343 AC_MSG_RESULT([buggy compiler found!])
345 echo " '$CC_VERSION'"
346 echo " has been known to generate bad code, "
347 echo " please get an updated compiler."
348 AC_MSG_ERROR([sorry])
350 case "$CC_VERSION" in
354 # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
355 # without "sub $0xc,%esp" to protect the stack from being
356 # stomped on by interrupts (bug 606)
357 "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
360 # mandrake's similar sub 0xc compiler bug
361 # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
362 "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
366 AC_MSG_RESULT([no known problems])
370 # --------- unsigned long long sane? -------
371 AC_CHECK_SIZEOF(unsigned long long, 0)
372 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
373 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
374 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
375 AC_MSG_ERROR([** we assume that sizeof(long long) == 8. Tell phil@clusterfs.com])
378 AC_MSG_CHECKING([if $CC accepts -m64])
381 AC_TRY_COMPILE([],[],[
388 CPPFLAGS="-I\$(top_builddir)/portals/include -I\$(top_srcdir)/portals/include -I\$(top_builddir)/lustre/include -I\$(top_srcdir)/lustre/include $CPPFLAGS"
390 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
393 LLCFLAGS="-g -Wall -fPIC"
396 # everyone builds against portals and lustre
397 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/portals/include -I$PWD/lustre/include"
398 AC_SUBST(EXTRA_KCFLAGS)
404 # AM_CONDITIONAL instances for everything
405 # (so that portals/lustre can disable some if needed)
406 AC_DEFUN([LB_CONDITIONALS],
407 [AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
408 AM_CONDITIONAL(UTILS, test x$enable_utils = xyes)
409 AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
410 AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
411 AM_CONDITIONAL(CRAY_PORTALS, test x$with_cray_portals != xno)
412 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
413 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
414 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
416 # this lets lustre cancel libsysio, per-branch or if liblustre is
418 if test "x$LIBSYSIO_SUBDIR" = xlibsysio ; then
419 if test "x$with_sysio" != xyes ; then
424 AC_SUBST(LIBSYSIO_SUBDIR)
427 LB_LINUX_CONDITIONALS
428 LB_DARWIN_CONDITIONALS
437 # main configure steps
439 AC_DEFUN([LB_CONFIGURE],
466 [Makefile:build/Makefile.in.toplevel]
469 build/autoconf/Makefile
484 LLCPPFLAGS: $LLCPPFLAGS
486 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
489 Type 'make' to build Lustre.