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 # Handle internal/external libsysio
17 AC_DEFUN([LB_PATH_LIBSYSIO],
19 AC_HELP_STRING([--with-sysio=path],
20 [set path to libsysio source (default is included libsysio)]),
21 [],[with_sysio='yes'])
22 AC_MSG_CHECKING([location of libsysio])
23 enable_sysio="$with_sysio"
26 AC_MSG_RESULT([internal])
27 AC_CHECK_FILE([$srcdir/libsysio/src/rmdir.c],[],[
28 AC_MSG_ERROR([A complete internal libsysio was not found.])
30 LIBSYSIO_SUBDIR="libsysio"
34 AC_MSG_RESULT([disabled])
37 AC_MSG_RESULT([$with_sysio])
38 AC_CHECK_FILE([$with_sysio/lib/libsysio.a],[],[
39 AC_MSG_ERROR([A complete (built) external libsysio was not found.])
45 AC_SUBST(LIBSYSIO_SUBDIR)
50 # LB_PATH_CRAY_PORTALS
52 # Support for external Cray portals
54 AC_DEFUN([LB_PATH_CRAY_PORTALS],
55 [AC_MSG_CHECKING([for Cray portals])
56 AC_ARG_WITH([cray-portals],
57 AC_HELP_STRING([--with-cray-portals=path],
58 [path to cray portals]),
60 if test "$with_cray_portals" != no; then
61 CRAY_PORTALS_PATH=$with_cray_portals
62 CRAY_PORTALS_INCLUDES="$with_cray_portals/include"
63 CRAY_PORTALS_LIBS="$with_cray_portals"
65 ],[with_cray_portals=no])
66 AC_SUBST(CRAY_PORTALS_PATH)
67 AC_MSG_RESULT([$CRAY_PORTALS_PATH])
69 AC_MSG_CHECKING([for Cray portals includes])
70 AC_ARG_WITH([cray-portals-includes],
71 AC_HELP_STRING([--with-cray-portals-includes=path],
72 [path to cray portals includes]),
74 if test "$with_cray_portals_includes" != no; then
75 CRAY_PORTALS_INCLUDES="$with_cray_portals_includes"
78 AC_SUBST(CRAY_PORTALS_INCLUDES)
79 AC_MSG_RESULT([$CRAY_PORTALS_INCLUDES])
81 AC_MSG_CHECKING([for Cray portals libs])
82 AC_ARG_WITH([cray-portals-libs],
83 AC_HELP_STRING([--with-cray-portals-libs=path],
84 [path to cray portals libs]),
86 if test "$with_cray_portals_libs" != no; then
87 CRAY_PORTALS_LIBS="$with_cray_portals_libs"
90 AC_SUBST(CRAY_PORTALS_LIBS)
91 AC_MSG_RESULT([$CRAY_PORTALS_LIBS])
93 if test x$CRAY_PORTALS_INCLUDES != x ; then
94 if test ! -r $CRAY_PORTALS_INCLUDES/portals/api.h ; then
95 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.])
98 if test x$CRAY_PORTALS_LIBS != x ; then
99 if test ! -r $CRAY_PORTALS_LIBS/libportals.a ; then
100 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.])
104 AC_MSG_CHECKING([whether to use Cray portals])
105 if test x$CRAY_PORTALS_INCLUDES != x -a x$CRAY_PORTALS_LIBS != x ; then
106 with_cray_portals=yes
107 AC_DEFINE(CRAY_PORTALS, 1, [Building with Cray Portals])
108 CPPFLAGS="-I$CRAY_PORTALS_INCLUDES $CPPFLAGS"
109 EXTRA_KCFLAGS="-I-I$CRAY_PORTALS_INCLUDES $EXTRA_KCFLAGS"
113 AC_MSG_RESULT([$with_cray_portals])
119 # Build kernel modules?
121 AC_DEFUN([LB_CONFIG_MODULES],
122 [AC_MSG_CHECKING([whether to build kernel modules])
123 AC_ARG_ENABLE([modules],
124 AC_HELP_STRING([--disable-modules],
125 [disable building of Lustre kernel modules]),
127 LC_TARGET_SUPPORTED([
133 AC_MSG_RESULT([$enable_modules ($target_os)])
135 if test x$enable_modules = xyes ; then
144 # This is strange - Lustre supports a target we don't
145 AC_MSG_ERROR([Modules are not supported on $target_os])
156 AC_DEFUN([LB_CONFIG_UTILS],
157 [AC_MSG_CHECKING([whether to build utilities])
158 AC_ARG_ENABLE([utils],
159 AC_HELP_STRING([--disable-utils],
160 [disable building of Lustre utility programs]),
161 [],[enable_utils='yes'])
162 if test x$with_cray_portals = xyes ; then
165 AC_MSG_RESULT([$enable_utils])
166 if test x$enable_utils = xyes ; then
167 LB_CONFIG_INIT_SCRIPTS
176 AC_DEFUN([LB_CONFIG_TESTS],
177 [AC_MSG_CHECKING([whether to build Lustre tests])
178 AC_ARG_ENABLE([tests],
179 AC_HELP_STRING([--disable-tests],
180 [disable building of Lustre tests]),
181 [],[enable_tests='yes'])
182 if test x$with_cray_portals = xyes ; then
185 AC_MSG_RESULT([$enable_tests])
193 AC_DEFUN([LB_CONFIG_DOCS],
194 [AC_MSG_CHECKING([whether to build docs])
196 AC_HELP_STRING([--disable-doc],
197 [skip creation of pdf documentation]),
199 if test x$enable_doc = xyes ; then
208 AC_MSG_RESULT([$enable_doc])
213 # LB_CONFIG_INIT_SCRIPTS
215 # our init scripts only work on red hat linux
217 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS],
218 [ENABLE_INIT_SCRIPTS=0
219 if test x$enable_utils = xyes ; then
220 AC_MSG_CHECKING([whether to install init scripts])
221 # our scripts only work on red hat systems
222 if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
223 ENABLE_INIT_SCRIPTS=1
229 AC_SUBST(ENABLE_INIT_SCRIPTS)
235 # add -include config.h
237 AC_DEFUN([LB_CONFIG_HEADERS],
238 [AC_CONFIG_HEADERS([config.h])
239 CPPFLAGS="-include \$(top_builddir)/config.h $CPPFLAGS"
240 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
241 AC_SUBST(EXTRA_KCFLAGS)
247 # defines for including the toplevel Rules
249 AC_DEFUN([LB_INCLUDE_RULES],
250 [INCLUDE_RULES="include $PWD/build/Rules"
251 AC_SUBST(INCLUDE_RULES)
257 # 'fixup' default paths
259 AC_DEFUN([LB_PATH_DEFAULTS],
260 [# directories for binaries
261 AC_PREFIX_DEFAULT([/usr])
266 # Directories for documentation and demos.
267 docdir='${datadir}/doc/$(PACKAGE)'
277 # checks on the C compiler
279 AC_DEFUN([LB_PROG_CC],
281 AC_MSG_CHECKING([for buggy compiler])
282 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
284 AC_MSG_RESULT([buggy compiler found!])
286 echo " '$CC_VERSION'"
287 echo " has been known to generate bad code, "
288 echo " please get an updated compiler."
289 AC_MSG_ERROR([sorry])
291 case "$CC_VERSION" in
295 # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
296 # without "sub $0xc,%esp" to protect the stack from being
297 # stomped on by interrupts (bug 606)
298 "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
301 # mandrake's similar sub 0xc compiler bug
302 # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
303 "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
307 AC_MSG_RESULT([no known problems])
311 # --------- unsigned long long sane? -------
312 AC_CHECK_SIZEOF(unsigned long long, 0)
313 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
314 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
315 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
316 AC_MSG_ERROR([** we assume that sizeof(long long) == 8. Tell phil@clusterfs.com])
319 AC_MSG_CHECKING([if $CC accepts -m64])
320 CFLAGS_save="$CFLAGS"
321 CFLAGS="-m64 $CFLAGS"
322 AC_TRY_COMPILE([],[],[
326 CFLAGS="$CFLAGS_save"
329 CPPFLAGS="-I\$(top_srcdir)/lustre/include -I\$(top_srcdir)/portals/include $CPPFLAGS"
331 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
334 LLCFLAGS="-g -Wall -fPIC"
337 # everyone builds against portals and lustre
338 EXTRA_KCFLAGS="-g -I$PWD/portals/include -I$PWD/lustre/include"
339 AC_SUBST(EXTRA_KCFLAGS)
345 # AM_CONDITIONAL instances for everything
346 # (so that portals/lustre can disable some if needed)
347 AC_DEFUN([LB_CONDITIONALS],
348 [AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
349 AM_CONDITIONAL(UTILS, test x$enable_utils = xyes)
350 AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
351 AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
352 AM_CONDITIONAL(CRAY_PORTALS, test x$with_cray_portals != xno)
353 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
355 LB_LINUX_CONDITIONALS
356 LB_DARWIN_CONDITIONALS
365 # main configure steps
367 AC_DEFUN([LB_CONFIGURE],
385 # this lets lustre cancel libsysio, per-branch or if liblustre is
387 if text x$LIBSYSIO_SUBDIR = xlibsysio ; then
388 if test x$with_sysio = xyes ; then
389 AC_CONFIG_SUBDIRS(libsysio)
402 [Makefile:build/Makefile.in.toplevel]
405 build/autoconf/Makefile
418 LLCPPFLAGS: $LLCPPFLAGS
420 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
423 Type 'make' to build Lustre.