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 # Handle internal/external libsysio
34 AC_DEFUN([LB_PATH_LIBSYSIO],
36 AC_HELP_STRING([--with-sysio=path],
37 [set path to libsysio source (default is included libsysio)]),
48 AC_MSG_CHECKING([location of libsysio])
49 enable_sysio="$with_sysio"
52 AC_MSG_RESULT([internal])
53 AC_CHECK_FILE([$srcdir/libsysio/src/rmdir.c],[],[
54 AC_MSG_ERROR([A complete internal libsysio was not found.])
56 LIBSYSIO_SUBDIR="libsysio"
60 AC_MSG_RESULT([disabled])
63 AC_MSG_RESULT([$with_sysio])
64 AC_CHECK_FILE([$with_sysio/lib/libsysio.a],[],[
65 AC_MSG_ERROR([A complete (built) external libsysio was not found.])
72 # We have to configure even if we don't build here for make dist to
74 AC_CONFIG_SUBDIRS(libsysio)
78 # LB_PATH_CRAY_PORTALS
80 # Support for external Cray portals
82 AC_DEFUN([LB_PATH_CRAY_PORTALS],
83 [AC_MSG_CHECKING([for Cray portals])
84 AC_ARG_WITH([cray-portals],
85 AC_HELP_STRING([--with-cray-portals=path],
86 [path to cray portals]),
88 if test "$with_cray_portals" != no; then
89 CRAY_PORTALS_PATH=$with_cray_portals
90 CRAY_PORTALS_INCLUDES="$with_cray_portals/include"
91 CRAY_PORTALS_LIBS="$with_cray_portals"
93 ],[with_cray_portals=no])
94 AC_SUBST(CRAY_PORTALS_PATH)
95 AC_MSG_RESULT([$CRAY_PORTALS_PATH])
97 AC_MSG_CHECKING([for Cray portals includes])
98 AC_ARG_WITH([cray-portals-includes],
99 AC_HELP_STRING([--with-cray-portals-includes=path],
100 [path to cray portals includes]),
102 if test "$with_cray_portals_includes" != no; then
103 CRAY_PORTALS_INCLUDES="$with_cray_portals_includes"
106 AC_SUBST(CRAY_PORTALS_INCLUDES)
107 AC_MSG_RESULT([$CRAY_PORTALS_INCLUDES])
109 AC_MSG_CHECKING([for Cray portals libs])
110 AC_ARG_WITH([cray-portals-libs],
111 AC_HELP_STRING([--with-cray-portals-libs=path],
112 [path to cray portals libs]),
114 if test "$with_cray_portals_libs" != no; then
115 CRAY_PORTALS_LIBS="$with_cray_portals_libs"
118 AC_SUBST(CRAY_PORTALS_LIBS)
119 AC_MSG_RESULT([$CRAY_PORTALS_LIBS])
121 if test x$CRAY_PORTALS_INCLUDES != x ; then
122 if test ! -r $CRAY_PORTALS_INCLUDES/portals/api.h ; then
123 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.])
126 if test x$CRAY_PORTALS_LIBS != x ; then
127 if test ! -r $CRAY_PORTALS_LIBS/libportals.a ; then
128 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.])
132 AC_MSG_CHECKING([whether to use Cray portals])
133 if test x$CRAY_PORTALS_INCLUDES != x -a x$CRAY_PORTALS_LIBS != x ; then
134 with_cray_portals=yes
135 AC_DEFINE(CRAY_PORTALS, 1, [Building with Cray Portals])
136 CPPFLAGS="-I$CRAY_PORTALS_INCLUDES $CPPFLAGS"
137 EXTRA_KCFLAGS="-I$CRAY_PORTALS_INCLUDES $EXTRA_KCFLAGS"
141 AC_MSG_RESULT([$with_cray_portals])
147 # Build kernel modules?
149 AC_DEFUN([LB_CONFIG_MODULES],
150 [AC_MSG_CHECKING([whether to build kernel modules])
151 AC_ARG_ENABLE([modules],
152 AC_HELP_STRING([--disable-modules],
153 [disable building of Lustre kernel modules]),
155 LC_TARGET_SUPPORTED([
161 AC_MSG_RESULT([$enable_modules ($target_os)])
163 if test x$enable_modules = xyes ; then
172 # This is strange - Lustre supports a target we don't
173 AC_MSG_ERROR([Modules are not supported on $target_os])
184 AC_DEFUN([LB_CONFIG_UTILS],
185 [AC_MSG_CHECKING([whether to build utilities])
186 AC_ARG_ENABLE([utils],
187 AC_HELP_STRING([--disable-utils],
188 [disable building of Lustre utility programs]),
189 [],[enable_utils='yes'])
190 if test x$with_cray_portals = xyes ; then
193 AC_MSG_RESULT([$enable_utils])
194 if test x$enable_utils = xyes ; then
195 LB_CONFIG_INIT_SCRIPTS
204 AC_DEFUN([LB_CONFIG_TESTS],
205 [AC_MSG_CHECKING([whether to build Lustre tests])
206 AC_ARG_ENABLE([tests],
207 AC_HELP_STRING([--disable-tests],
208 [disable building of Lustre tests]),
209 [],[enable_tests='yes'])
210 if test x$with_cray_portals = xyes ; then
213 AC_MSG_RESULT([$enable_tests])
221 AC_DEFUN([LB_CONFIG_DOCS],
222 [AC_MSG_CHECKING([whether to build docs])
224 AC_HELP_STRING([--disable-doc],
225 [skip creation of pdf documentation]),
227 if test x$enable_doc = xyes ; then
236 AC_MSG_RESULT([$enable_doc])
241 # LB_CONFIG_INIT_SCRIPTS
243 # our init scripts only work on red hat linux
245 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS],
246 [ENABLE_INIT_SCRIPTS=0
247 if test x$enable_utils = xyes ; then
248 AC_MSG_CHECKING([whether to install init scripts])
249 # our scripts only work on red hat systems
250 if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
251 ENABLE_INIT_SCRIPTS=1
257 AC_SUBST(ENABLE_INIT_SCRIPTS)
263 # add -include config.h
265 AC_DEFUN([LB_CONFIG_HEADERS],
266 [AC_CONFIG_HEADERS([config.h])
267 CPPFLAGS="-include \$(top_builddir)/config.h $CPPFLAGS"
268 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
269 AC_SUBST(EXTRA_KCFLAGS)
275 # defines for including the toplevel Rules
277 AC_DEFUN([LB_INCLUDE_RULES],
278 [INCLUDE_RULES="include $PWD/build/Rules"
279 AC_SUBST(INCLUDE_RULES)
285 # 'fixup' default paths
287 AC_DEFUN([LB_PATH_DEFAULTS],
288 [# directories for binaries
289 AC_PREFIX_DEFAULT([/usr])
294 # Directories for documentation and demos.
295 docdir='${datadir}/doc/$(PACKAGE)'
305 # checks on the C compiler
307 AC_DEFUN([LB_PROG_CC],
309 AC_MSG_CHECKING([for buggy compiler])
310 CC_VERSION=`$CC -v 2>&1 | grep "^gcc version"`
312 AC_MSG_RESULT([buggy compiler found!])
314 echo " '$CC_VERSION'"
315 echo " has been known to generate bad code, "
316 echo " please get an updated compiler."
317 AC_MSG_ERROR([sorry])
319 case "$CC_VERSION" in
323 # ost_pack_niobuf putting 64bit NTOH temporaries on the stack
324 # without "sub $0xc,%esp" to protect the stack from being
325 # stomped on by interrupts (bug 606)
326 "gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)")
329 # mandrake's similar sub 0xc compiler bug
330 # http://marc.theaimsgroup.com/?l=linux-kernel&m=104748366226348&w=2
331 "gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)")
335 AC_MSG_RESULT([no known problems])
339 # --------- unsigned long long sane? -------
340 AC_CHECK_SIZEOF(unsigned long long, 0)
341 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
342 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
343 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
344 AC_MSG_ERROR([** we assume that sizeof(long long) == 8. Tell phil@clusterfs.com])
347 AC_MSG_CHECKING([if $CC accepts -m64])
350 AC_TRY_COMPILE([],[],[
357 CPPFLAGS="-I\$(top_builddir)/portals/include -I\$(top_srcdir)/portals/include -I\$(top_builddir)/lustre/include -I\$(top_srcdir)/lustre/include $CPPFLAGS"
359 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
362 LLCFLAGS="-g -Wall -fPIC"
365 # everyone builds against portals and lustre
366 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/portals/include -I$PWD/lustre/include"
367 AC_SUBST(EXTRA_KCFLAGS)
373 # AM_CONDITIONAL instances for everything
374 # (so that portals/lustre can disable some if needed)
375 AC_DEFUN([LB_CONDITIONALS],
376 [AM_CONDITIONAL(MODULES, test x$enable_modules = xyes)
377 AM_CONDITIONAL(UTILS, test x$enable_utils = xyes)
378 AM_CONDITIONAL(TESTS, test x$enable_tests = xyes)
379 AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
380 AM_CONDITIONAL(CRAY_PORTALS, test x$with_cray_portals != xno)
381 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
382 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
383 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
385 # this lets lustre cancel libsysio, per-branch or if liblustre is
387 if test "x$LIBSYSIO_SUBDIR" = xlibsysio ; then
388 if test "x$with_sysio" != xyes ; then
393 AC_SUBST(LIBSYSIO_SUBDIR)
396 LB_LINUX_CONDITIONALS
397 LB_DARWIN_CONDITIONALS
406 # main configure steps
408 AC_DEFUN([LB_CONFIGURE],
435 [Makefile:build/Makefile.in.toplevel]
438 build/autoconf/Makefile
453 LLCPPFLAGS: $LLCPPFLAGS
455 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
458 Type 'make' to build Lustre.