Whamcloud - gitweb
LU-4442 tests: update version number in replay-vbr test 7g
[fs/lustre-release.git] / config / lustre-build.m4
1 #
2 # LB_CHECK_VERSION
3 #
4 # Verify that LUSTRE_VERSION was defined properly
5 #
6 AC_DEFUN([LB_CHECK_VERSION], [
7 AS_IF([test "LUSTRE_VERSION" = "LUSTRE""_VERSION"],
8         [AC_MSG_ERROR([This script was not built with a version number.])])
9 ]) # LB_CHECK_VERSION
10
11 #
12 # LB_CANONICAL_SYSTEM
13 #
14 # fixup $target_os for use in other places
15 #
16 AC_DEFUN([LB_CANONICAL_SYSTEM], [
17 case $target_os in
18         linux*)
19                 lb_target_os="linux"
20                 ;;
21         darwin*)
22                 lb_target_os="darwin"
23                 ;;
24         solaris*)
25                 lb_target_os="SunOS"
26                 ;;
27 esac
28 AC_SUBST(lb_target_os)
29 ]) # LB_CANONICAL_SYSTEM
30
31 #
32 # LB_DOWNSTREAM_RELEASE
33 #
34 AC_DEFUN([LB_DOWNSTREAM_RELEASE],
35 [AC_ARG_WITH([downstream-release],
36         AC_HELP_STRING([--with-downstream-release=string],
37                 [set a string in the BUILD_VERSION and RPM Release: (default is nothing)]),
38         [DOWNSTREAM_RELEASE=$with_downstream_release],
39         [ # if not specified, see if it's in the META file
40         AS_IF([test -f META],
41                 [DOWNSTREAM_RELEASE=$(sed -ne '/^LOCAL_VERSION =/s/.*= *//p' META)])
42         ])
43 AC_SUBST(DOWNSTREAM_RELEASE)
44 ]) # LB_DOWNSTREAM_RELEASE
45
46 #
47 # LB_BUILDID
48 #
49 # Check if the source is a GA release and if not, set a "BUILDID"
50 #
51 # Currently there are at least two ways/modes of/for doing this.  One
52 # is if we are in a valid git repository, the other is if we are in a
53 # non-git source tree of some form.  Building the latter from the former
54 # will be handled here.
55 AC_DEFUN([LB_BUILDID], [
56 AC_CACHE_CHECK([for buildid], [lb_cv_buildid], [
57 lb_cv_buildid=""
58 AS_IF([git branch >/dev/null 2>&1], [
59         ffw=0
60         hash=""
61         ver=$(git describe --match v[[0-9]]_*_[[0-9]]* --tags)
62         if [[[ $ver = *-*-* ]]]; then
63                 hash=${ver##*-}
64                 ffw=${ver#*-}
65                 ffw=${ffw%-*}
66                 ver=${ver%%-*}
67         fi
68         # it's tempting to use [[ $ver =~ ^v([0-9]+_)+([0-9]+|RC[0-9]+)$ ]]
69         # here but the portability of the regex on the right is dismal
70         # (thanx suse)
71         if echo "$ver" | egrep -q "^v([[0-9]]+_)+([[0-9]]+|RC[[0-9]]+)$"; then
72                 ver=$(echo $ver | sed -e 's/^v\(.*\)/\1/' \
73                                       -e 's/_RC[[0-9]].*$//' -e 's/_/./g')
74         fi
75
76         # a "lustre fix" value of .0 should be truncated
77         if [[[ $ver = *.*.*.0 ]]]; then
78                 ver=${ver%.0}
79         fi
80         # ditto for a "lustre fix" value of _0
81         if [[[ $ver = v*_*_*_0 ]]]; then
82                 ver=${ver%_0}
83         fi
84         if [[[ $ver = v*_*_* ]]]; then
85                 ver=${ver#v}
86                 ver=${ver//_/.}
87         fi
88
89         if test "$ver" != "$VERSION"; then
90                 AC_MSG_WARN([most recent tag found: $ver does not match current version $VERSION.])
91         fi
92
93         if test "$ffw" != "0"; then
94                 lb_cv_buildid="$hash"
95         fi
96 ], [test -f META], [
97         lb_cv_buildid=$(sed -ne '/^BUILDID =/s/.*= *//p' META)
98 ])
99 ])
100 AS_IF([test -z "$lb_cv_buildid"], [
101         AC_MSG_WARN([
102
103 FIXME: I don't know how to deal with source trees outside of git that
104 don't have a META file. Not setting a buildid.
105 ])
106 ])
107 BUILDID=$lb_cv_buildid
108 AC_SUBST(BUILDID)
109 ]) # LB_BUILDID
110
111 #
112 # LB_CHECK_FILE
113 #
114 # Check for file existance even when cross compiling
115 # $1 - file to check
116 # $2 - do 'yes'
117 # $3 - do 'no'
118 #
119 AC_DEFUN([LB_CHECK_FILE], [
120 AS_VAR_PUSHDEF([lb_file], [lb_cv_file_$1])dnl
121 AC_CACHE_CHECK([for $1], lb_file, [
122 AS_IF([test -r "$1"],
123         [AS_VAR_SET(lb_file, [yes])],
124         [AS_VAR_SET(lb_file, [no])])
125 ])
126 AS_VAR_IF([lb_file], [yes], [$2], [$3])[]dnl
127 AS_VAR_POPDEF([lb_file])dnl
128 ]) # LB_CHECK_FILE
129
130 #
131 # LB_ARG_LIBS_INCLUDES
132 #
133 # support for --with-foo, --with-foo-includes, and --with-foo-libs in
134 # a single magical macro
135 #
136 AC_DEFUN([LB_ARG_LIBS_INCLUDES], [
137 lb_pathvar="m4_bpatsubst([$2], -, _)"
138 AC_MSG_CHECKING([for $1])
139 AC_ARG_WITH([$2],
140         AC_HELP_STRING([--with-$2=path],
141                 [path to $1]),
142         [], [withval=$4])
143 AS_IF([test "x$withval" = xyes],
144         [eval "$lb_pathvar='$3'"],
145         [eval "$lb_pathvar='$withval'"])
146 AC_MSG_RESULT([${!lb_pathvar:-no}])
147
148 AS_IF([test "x${!lb_pathvar}" != x -a "x${!lb_pathvar}" != xno], [
149         AC_MSG_CHECKING([for $1 includes])
150         AC_ARG_WITH([$2-includes],
151                 AC_HELP_STRING([--with-$2-includes=path],
152                         [path to $1 includes]),
153                 [], [withval="yes"])
154
155         lb_includevar="${lb_pathvar}_includes"
156         AS_IF([test "x$withval" = xyes],
157                 [eval "${lb_includevar}='${!lb_pathvar}/include'"],
158                 [eval "${lb_includevar}='$withval'"])
159         AC_MSG_RESULT([${!lb_includevar}])
160
161         AC_MSG_CHECKING([for $1 libs])
162         AC_ARG_WITH([$2-libs],
163                 AC_HELP_STRING([--with-$2-libs=path],
164                         [path to $1 libs]),
165                 [], [withval="yes"])
166
167         lb_libvar="${lb_pathvar}_libs"
168         AS_IF([test "x$withval" = xyes],
169                 [eval "${lb_libvar}='${!lb_pathvar}/lib'"],
170                 [eval "${lb_libvar}='$withval'"])
171         AC_MSG_RESULT([${!lb_libvar}])
172 ])
173 ]) # LB_ARG_LIBS_INCLUDES
174
175 #
176 # LB_PATH_LIBSYSIO
177 #
178 # Handle internal/external libsysio
179 #
180 AC_DEFUN([LB_PATH_LIBSYSIO], [
181 AC_MSG_CHECKING([location of libsysio])
182 AC_ARG_WITH([sysio],
183         AC_HELP_STRING([--with-sysio=path],
184                 [set path to libsysio source (default is included libsysio)]),
185         [], [
186                 AS_IF([test "x$lb_target_os" = xlinux],
187                         [with_sysio="yes"],
188                         [with_sysio="no"])
189         ])
190 AS_IF([test "x$with_sysio" = xyes], [
191                 AC_MSG_RESULT([internal])
192                 LB_CHECK_FILE([$srcdir/libsysio/src/rmdir.c], [], [
193                         AC_MSG_ERROR([A complete internal libsysio was not found.])
194                 ])
195                 LIBSYSIO_SUBDIR="libsysio"
196                 SYSIO="$PWD/libsysio"
197         ], [test "x$with_sysio" = xno], [
198                 AC_MSG_RESULT([disabled])
199         ], [
200                 AC_MSG_RESULT([$with_sysio])
201                 LB_CHECK_FILE([$with_sysio/lib/libsysio.a], [], [
202                         AC_MSG_ERROR([A complete (built) external libsysio was not found.])
203                 ])
204                 LIBSYSIO_SUBDIR=""
205                 SYSIO=$with_sysio
206                 with_sysio="yes"
207         ])
208 enable_sysio=$with_sysio
209 # We have to configure even if we don't build here for make dist to work
210 AC_CONFIG_SUBDIRS([libsysio])
211 ]) # LB_PATH_LIBSYSIO
212
213 #
214 # LB_PATH_LUSTREIOKIT
215 #
216 # We no longer handle external lustre-iokit
217 #
218 AC_DEFUN([LB_PATH_LUSTREIOKIT], [
219 AC_MSG_CHECKING([whether to build iokit])
220 AC_ARG_ENABLE([iokit],
221         AC_HELP_STRING([--disable-iokit],
222                 [disable iokit (default is enable)]),
223         [], [enable_iokit="yes"])
224 AC_MSG_RESULT([$enable_iokit])
225 AS_IF([test "x$enable_iokit" = xyes],
226         [LUSTREIOKIT_SUBDIR="lustre-iokit"],
227         [LUSTREIOKIT_SUBDIR=""])
228 AC_SUBST(LUSTREIOKIT_SUBDIR)
229 AM_CONDITIONAL([BUILD_LUSTREIOKIT], [test "x$enable_iokit" = xyes])
230 ]) # LB_PATH_LUSTREIOKIT
231
232 # Define no libcfs by default.
233 AC_DEFUN([LB_LIBCFS_DIR], [
234 AS_IF([test "x$libcfs_is_module" = xyes], [
235                 LIBCFS_INCLUDE_DIR="libcfs/include"
236                 LIBCFS_SUBDIR="libcfs"
237         ], [
238                 LIBCFS_INCLUDE_DIR="lnet/include"
239                 LIBCFS_SUBDIR=""
240         ])
241 AC_SUBST(LIBCFS_INCLUDE_DIR)
242 AC_SUBST(LIBCFS_SUBDIR)
243 ]) # LB_LIBCFS_DIR
244
245 #
246 # LB_PATH_SNMP
247 #
248 # check for in-tree snmp support
249 #
250 AC_DEFUN([LB_PATH_SNMP], [
251 LB_CHECK_FILE([$srcdir/snmp/lustre-snmp.c], [SNMP_DIST_SUBDIR="snmp"])
252 AC_SUBST(SNMP_DIST_SUBDIR)
253 AC_SUBST(SNMP_SUBDIR)
254 ]) # LB_PATH_SNMP
255
256 #
257 # LB_CONFIG_MODULES
258 #
259 # Build kernel modules?
260 #
261 AC_DEFUN([LB_CONFIG_MODULES], [
262 AC_MSG_CHECKING([whether to build Linux kernel modules])
263 AC_ARG_ENABLE([modules],
264         AC_HELP_STRING([--disable-modules],
265                 [disable building of Lustre kernel modules]),
266         [], [
267                 LC_TARGET_SUPPORTED([enable_modules="yes"],
268                                     [enable_modules="no"])
269         ])
270 AC_MSG_RESULT([$enable_modules ($target_os)])
271
272 AS_IF([test "x$enable_modules" = xyes], [
273         AS_CASE([$target_os],
274                 [linux*], [
275                         LB_PROG_LINUX
276                         LIBCFS_PROG_LINUX
277                         LN_PROG_LINUX
278                         AS_IF([test "x$enable_server" != xno], [LB_EXT4_SRC_DIR])
279                         LC_PROG_LINUX
280                 ], [darwin*], [
281                         LB_PROG_DARWIN
282                         LIBCFS_PROG_DARWIN
283                 ], [*], [
284                         # This is strange - Lustre supports a target we don't
285                         AC_MSG_ERROR([Modules are not supported on $target_os])
286                 ])
287         ])
288 ]) # LB_CONFIG_MODULES
289
290 #
291 # LB_CONFIG_UTILS
292 #
293 # Build utils?
294 #
295 AC_DEFUN([LB_CONFIG_UTILS], [
296 AC_MSG_CHECKING([whether to build Lustre utilities])
297 AC_ARG_ENABLE([utils],
298         AC_HELP_STRING([--disable-utils],
299                 [disable building of Lustre utility programs]),
300         [], [enable_utils="yes"])
301 AC_MSG_RESULT([$enable_utils])
302 AS_IF([test "x$enable_utils" = xyes], [LB_CONFIG_INIT_SCRIPTS])
303 ]) # LB_CONFIG_UTILS
304
305 #
306 # LB_CONFIG_TESTS
307 #
308 # Build tests?
309 #
310 AC_DEFUN([LB_CONFIG_TESTS], [
311 AC_MSG_CHECKING([whether to build Lustre tests])
312 AC_ARG_ENABLE([tests],
313         AC_HELP_STRING([--disable-tests],
314                 [disable building of Lustre tests]),
315         [], [enable_tests="yes"])
316 AC_MSG_RESULT([$enable_tests])
317 ]) # LB_CONFIG_TESTS
318
319 #
320 # LB_CONFIG_DIST
321 #
322 # Just enough configure so that "make dist" is useful
323 #
324 # this simply re-adjusts some defaults, which of course can be overridden
325 # on the configure line after the --for-dist option
326 #
327 AC_DEFUN([LB_CONFIG_DIST], [
328 AC_MSG_CHECKING([whether to configure just enough for make dist])
329 AC_ARG_ENABLE([dist],
330         AC_HELP_STRING([--enable-dist],
331                         [only configure enough for make dist]),
332         [], [enable_dist="no"])
333 AC_MSG_RESULT([$enable_dist])
334 AS_IF([test "x$enable_dist" != xno], [
335         enable_doc="no"
336         enable_utils="no"
337         enable_tests="no"
338         enable_modules="no"
339         enable_liblustre="no"
340 ])
341 ]) # LB_CONFIG_DIST
342
343 #
344 # LB_CONFIG_DOCS
345 #
346 # Build docs?
347 #
348 AC_DEFUN([LB_CONFIG_DOCS], [
349 AC_MSG_CHECKING([whether to build Lustre docs])
350 AC_ARG_ENABLE([doc],
351         AC_HELP_STRING([--disable-doc],
352                         [skip creation of pdf documentation]),
353         [], [enable_doc="no"])
354 AC_MSG_RESULT([$enable_doc])
355 AS_IF([test "x$enable_doc" = xyes],
356         [ENABLE_DOC=1], [ENABLE_DOC=0])
357 AC_SUBST(ENABLE_DOC)
358 ]) # LB_CONFIG_DOCS
359
360 #
361 # LB_CONFIG_INIT_SCRIPTS
362 #
363 # our init scripts only work on red hat linux
364 #
365 AC_DEFUN([LB_CONFIG_INIT_SCRIPTS], [
366 ENABLE_INIT_SCRIPTS=0
367 AS_IF([test x$enable_utils = xyes], [
368         AC_CACHE_CHECK([whether to install init scripts], [lb_cv_enable_init_scripts], [
369         # our scripts only work on red hat systems
370         AS_IF([test -f /etc/init.d/functions -a -f /etc/sysconfig/network],
371                 [lb_cv_enable_init_scripts="yes"],
372                 [lb_cv_enable_init_scripts="no"])
373         ])
374         AS_IF([test "x$lb_cv_enable_init_scripts" = xyes],
375                 [ENABLE_INIT_SCRIPTS=1])
376 ])
377 AC_SUBST(ENABLE_INIT_SCRIPTS)
378 ])
379
380 #
381 # LB_CONFIG_HEADERS
382 #
383 # add -include config.h
384 #
385 AC_DEFUN([LB_CONFIG_HEADERS], [
386 AC_CONFIG_HEADERS([config.h])
387 CPPFLAGS="-include $PWD/config.h $CPPFLAGS"
388 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
389 AC_SUBST(EXTRA_KCFLAGS)
390 ]) # LB_CONFIG_HEADERS
391
392 #
393 # LB_INCLUDE_RULES
394 #
395 # defines for including the toplevel Rules
396 #
397 AC_DEFUN([LB_INCLUDE_RULES], [
398 INCLUDE_RULES="include $PWD/Rules"
399 AC_SUBST(INCLUDE_RULES)
400 ]) # LB_INCLUDE_RULES
401
402 #
403 # LB_PATH_DEFAULTS
404 #
405 # 'fixup' default paths
406 #
407 AC_DEFUN([LB_PATH_DEFAULTS], [
408 # directories for binaries
409 AC_PREFIX_DEFAULT([/usr])
410
411 sysconfdir='$(CROSS_PATH)/etc'
412 AC_SUBST(sysconfdir)
413
414 # Directories for documentation and demos.
415 docdir='$(datadir)/doc/$(PACKAGE)'
416 AC_SUBST(docdir)
417
418 LIBCFS_PATH_DEFAULTS
419 LN_PATH_DEFAULTS
420 LC_PATH_DEFAULTS
421 ]) # LB_PATH_DEFAULTS
422
423 #
424 # LB_PROG_CC
425 #
426 # checks on the C compiler
427 #
428 AC_DEFUN([LB_PROG_CC], [
429 AC_PROG_RANLIB
430 AC_CHECK_TOOL(LD, [ld], [no])
431 AC_CHECK_TOOL(OBJDUMP, [objdump], [no])
432 AC_CHECK_TOOL(STRIP, [strip], [no])
433
434 # ---------  unsigned long long sane? -------
435 AC_CHECK_SIZEOF(unsigned long long, 0)
436 AS_IF([test $ac_cv_sizeof_unsigned_long_long != 8],
437         [AC_MSG_ERROR([we assume that sizeof(unsigned long long) == 8.])])
438
439 AS_IF([test $target_cpu = powerpc64], [
440         AC_MSG_WARN([set compiler with -m64])
441         CFLAGS="$CFLAGS -m64"
442         CC="$CC -m64"
443 ])
444
445 CPPFLAGS="-I$PWD/$LIBCFS_INCLUDE_DIR -I$PWD/lnet/include -I$PWD/lustre/include $CPPFLAGS"
446
447 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
448 AC_SUBST(LLCPPFLAGS)
449
450 # Add _GNU_SOURCE for strnlen on linux
451 LLCFLAGS="-g -Wall -fPIC -D_GNU_SOURCE"
452 AC_SUBST(LLCFLAGS)
453
454 CCASFLAGS="-Wall -fPIC -D_GNU_SOURCE"
455 AC_SUBST(CCASFLAGS)
456
457 # everyone builds against lnet and lustre
458 EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/$LIBCFS_INCLUDE_DIR -I$PWD/lnet/include -I$PWD/lustre/include"
459 AC_SUBST(EXTRA_KCFLAGS)
460 ]) # LB_PROG_CC
461
462 #
463 # LB_CONDITIONALS
464 #
465 # AM_CONDITIONAL instances for everything
466 # (so that portals/lustre can disable some if needed)
467 #
468 AC_DEFUN([LB_CONDITIONALS], [
469 AM_CONDITIONAL([MODULES], [test x$enable_modules = xyes])
470 AM_CONDITIONAL([UTILS], [test x$enable_utils = xyes])
471 AM_CONDITIONAL([TESTS], [test x$enable_tests = xyes])
472 AM_CONDITIONAL([DOC], [test x$ENABLE_DOC = x1])
473 AM_CONDITIONAL([INIT_SCRIPTS], [test x$ENABLE_INIT_SCRIPTS = x1])
474 AM_CONDITIONAL([LINUX], [test x$lb_target_os = xlinux])
475 AM_CONDITIONAL([DARWIN], [test x$lb_target_os = xdarwin])
476 AM_CONDITIONAL([SUNOS], [test x$lb_target_os = xSunOS])
477 AM_CONDITIONAL([USES_DPKG], [test x$uses_dpkg = xyes])
478 AM_CONDITIONAL([USE_QUILT], [test x$use_quilt = xyes])
479
480 # Sanity check for PCLMULQDQ instruction availability
481 # PCLMULQDQ instruction is a new instruction available beginning with
482 # the all new Core processor family based on the 32nm microarchitecture
483 # codename Westmere. So, $target_cpu = x86_64 should have this instruction
484 # except MIC microarchitecture (k1om).
485 AM_CONDITIONAL(HAVE_PCLMULQDQ, test x$target_cpu = "xx86_64" -a x$target_vendor != "xk1om")
486 AS_IF([test x$target_cpu = "xx86_64" -a x$target_vendor != "xk1om"],
487         [AC_DEFINE(HAVE_PCLMULQDQ, 1, [have PCLMULQDQ instruction])])
488
489 # this lets lustre cancel libsysio, per-branch or if liblustre is
490 # disabled
491 AS_IF([test "x$LIBSYSIO_SUBDIR" = xlibsysio], [
492         AS_IF([test "x$with_sysio" != xyes], [
493                 SYSIO=""
494                 LIBSYSIO_SUBDIR=""
495         ])
496 ])
497 AC_SUBST(LIBSYSIO_SUBDIR)
498 AC_SUBST(SYSIO)
499
500 LB_DARWIN_CONDITIONALS
501
502 LIBCFS_CONDITIONALS
503 LN_CONDITIONALS
504 LC_CONDITIONALS
505 ]) # LB_CONTITIONALS
506
507 #
508 # LB_CONFIG_FILES
509 #
510 # build-specific config files
511 #
512 AC_DEFUN([LB_CONFIG_FILES], [
513         AC_CONFIG_FILES([
514                 Makefile
515                 autoMakefile]
516                 config/Makefile
517                 [Rules:build/Rules.in]
518                 AC_PACKAGE_TARNAME[.spec]
519                 AC_PACKAGE_TARNAME[-dkms.spec]
520                 contrib/Makefile
521                 contrib/lbuild/Makefile
522                 contrib/scripts/Makefile
523                 ldiskfs/Makefile
524                 ldiskfs/autoMakefile
525                 lustre-iokit/Makefile
526                 lustre-iokit/obdfilter-survey/Makefile
527                 lustre-iokit/ost-survey/Makefile
528                 lustre-iokit/sgpdd-survey/Makefile
529                 lustre-iokit/mds-survey/Makefile
530                 lustre-iokit/ior-survey/Makefile
531                 lustre-iokit/stats-collect/Makefile
532         )
533 ])
534
535 #
536 # LB_CONFIG_SERVERS
537 #
538 AC_DEFUN([LB_CONFIG_SERVERS], [
539 AC_ARG_ENABLE([server],
540         AC_HELP_STRING([--disable-server],
541                         [disable Lustre server support]), [
542                 AS_IF([test x$enable_server != xyes -a x$enable_server != xno],
543                         [AC_MSG_ERROR([server valid options are "yes" or "no"])])
544                 AS_IF([test x$enable_server = xyes -a x$enable_dist = xyes],
545                         [AC_MSG_ERROR([--enable-server cannot be used with --enable-dist])])
546         ], [
547                 AS_IF([test x$enable_dist = xyes],
548                         [enable_server=no], [enable_server=maybe])
549         ])
550
551 # There are at least two good reasons why we should really run
552 # LB_CONFIG_MODULES elsewhere before the call to LB_CONFIG_SERVERS:
553 # LB_CONFIG_MODULES needs to be run for client support even when
554 # servers are disabled, and because module support is actually a
555 # prerequisite of server support.  However, some things under
556 # LB_CONFIG_MODULES need us to already have checked for --disable-server,
557 # before running, so until LB_CONFIG_MODULES can be reorganized, we
558 # call it here.
559 LB_CONFIG_MODULES
560 AS_IF([test x$enable_modules = xno], [enable_server=no])
561 LB_CONFIG_LDISKFS
562 LB_CONFIG_ZFS
563
564 # If no backends were configured, and the user did not explicitly
565 # require servers to be enabled, we just disable servers.
566 AS_IF([test x$enable_ldiskfs = xno -a x$enable_zfs = xno], [
567         AS_CASE([$enable_server],
568                 [maybe], [enable_server=no],
569                 [yes], [AC_MSG_ERROR([cannot enable servers, no backends were configured])])
570         ], [
571                 AS_IF([test x$enable_server = xmaybe], [enable_server=yes])
572         ])
573
574 AC_MSG_CHECKING([whether to build Lustre server support])
575 AC_MSG_RESULT([$enable_server])
576 AS_IF([test x$enable_server = xyes],
577         [AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])])
578 ]) # LB_CONFIG_SERVERS
579
580 #
581 # LB_CONFIG_RPMBUILD_OPTIONS
582 #
583 # The purpose of this function is to assemble command line options
584 # for the rpmbuild command based on the options passed to the configure
585 # script, and also upon the descisions that configure makes based on
586 # the tests that it runs.
587 # These strings can be passed to rpmbuild on the command line
588 # in the Make targets named "rpms" and "srpm".
589 #
590 AC_DEFUN([LB_CONFIG_RPMBUILD_OPTIONS], [
591 RPMBINARGS=
592 RPMSRCARGS=
593 CONFIGURE_ARGS=
594 eval set -- $ac_configure_args
595 for arg; do
596         case $arg in
597                 --with-release=* ) ;;
598                 --with-kmp-moddir=* ) ;;
599                 --with-linux=* | --with-linux-obj=* ) ;;
600                 --enable-tests | --disable-tests ) ;;
601                 --enable-modules | --disable-modules ) ;;
602                 * ) CONFIGURE_ARGS="$CONFIGURE_ARGS '$arg'" ;;
603         esac
604 done
605 if test -n "$CONFIGURE_ARGS" ; then
606         RPMBINARGS="$RPMBINARGS --define \"configure_args $CONFIGURE_ARGS\""
607 fi
608 if test -n "$LINUX" ; then
609         RPMBINARGS="$RPMBINARGS --define \"kdir $LINUX\""
610         if test -n "$LINUX_OBJ" -a "$LINUX_OBJ" != x"$LINUX" ; then
611                 RPMBINARGS="$RPMBINARGS --define \"kobjdir $LINUX_OBJ\""
612         fi
613 fi
614 if test -n "$KMP_MODDIR" ; then
615         RPMBINARGS="$RPMBINARGS --define \"kmoddir $KMP_MODDIR\""
616 fi
617 if test -n "$CROSS_PATH" ; then
618         if test x$enable_server = xyes ; then
619                 echo -e "\n"
620                 "*** Don't support cross compilation for the Intel(R) Xeon Phi(TM) card.\n"
621                 exit 1
622         fi
623         CROSS_SUFFIX="-mic"
624         RPMBINARGS="$RPMBINARGS --define \"post_script build/gen_filelist.sh\""
625         RPMBINARGS="$RPMBINARGS --define \"cross_path $CROSS_PATH\""
626         RPMBINARGS="$RPMBINARGS --define \"rootdir %{cross_path}\""
627         RPMBINARGS="$RPMBINARGS --define \"_prefix %{cross_path}/usr\""
628         RPMBINARGS="$RPMBINARGS --define \"_mandir %{_prefix}/share/man\""
629         RPMBINARGS="$RPMBINARGS --define \"_sysconfdir %{cross_path}/etc\""
630         RPMBINARGS="$RPMBINARGS --define \"make_args $CROSS_VARS\""
631         if test x$CC_TARGET_ARCH = x"x86_64-k1om-linux" ; then
632                 RPMBINARGS="$RPMBINARGS --define \"cross_requires intel-mic-gpl\""
633         fi
634 fi
635 if test x$enable_modules != xyes ; then
636         RPMBINARGS="$RPMBINARGS --without lustre_modules"
637 fi
638 if test x$enable_tests != xyes ; then
639         RPMBINARGS="$RPMBINARGS --without lustre_tests"
640         RPMSRCARGS="$RPMSRCARGS --without lustre_tests"
641 fi
642 if test x$enable_server != xyes ; then
643         RPMBINARGS="$RPMBINARGS --without servers"
644         if test -n "$CROSS_SUFFIX" ; then
645                 RPMBINARGS="$RPMBINARGS --define \"lustre_name lustre-client$CROSS_SUFFIX\""
646         fi
647 fi
648 if test x$enable_ldiskfs != xyes ; then
649         RPMBINARGS="$RPMBINARGS --without ldiskfs"
650 fi
651 if test x$enable_zfs = xyes ; then
652         RPMBINARGS="$RPMBINARGS --with zfs"
653 fi
654 if test x$enable_iokit != xyes ; then
655         RPMBINARGS="$RPMBINARGS --without lustre_iokit"
656         RPMSRCARGS="$RPMSRCARGS --without lustre_iokit"
657 fi
658
659 RPMBUILD_BINARY_ARGS=$RPMBINARGS
660 RPMBUILD_SOURCE_ARGS=$RPMSRCARGS
661
662 AC_SUBST(RPMBUILD_BINARY_ARGS)
663 AC_SUBST(RPMBUILD_SOURCE_ARGS)
664 ]) # LB_CONFIG_RPMBUILD_OPTIONS
665
666 #
667 # LB_CONFIGURE
668 #
669 # main configure steps
670 #
671 AC_DEFUN([LB_CONFIGURE], [
672 AC_MSG_NOTICE([Lustre base checks
673 ==============================================================================])
674 LB_CANONICAL_SYSTEM
675
676 LB_CONFIG_DIST
677
678 LB_DOWNSTREAM_RELEASE
679 LB_USES_DPKG
680 LB_BUILDID
681
682 LB_LIBCFS_DIR
683
684 LB_INCLUDE_RULES
685
686 LB_PATH_DEFAULTS
687
688 LB_PROG_CC
689
690 LC_OSD_ADDON
691
692 LB_CONFIG_DOCS
693 LB_CONFIG_UTILS
694 LB_CONFIG_TESTS
695 LC_CONFIG_CLIENT
696 LB_CONFIG_SERVERS
697
698 # two macros for cmd3
699 m4_ifdef([LC_CONFIG_SPLIT], [LC_CONFIG_SPLIT])
700 m4_ifdef([LC_NODEMAP_PROC_DEBUG], [LC_NODEMAP_PROC_DEBUG])
701 LN_CONFIG_CDEBUG
702 LC_QUOTA
703
704 LN_CONFIG_USERSPACE
705
706 LB_PATH_LIBSYSIO
707 LB_PATH_SNMP
708 LB_PATH_LUSTREIOKIT
709
710 LB_DEFINE_E2FSPROGS_NAMES
711
712 LC_CONFIG_LIBLUSTRE
713 LIBCFS_CONFIGURE
714 LN_CONFIGURE
715 LC_CONFIGURE
716 AS_IF([test -n "$SNMP_DIST_SUBDIR"], [LS_CONFIGURE])
717
718 LB_CONDITIONALS
719 LB_CONFIG_HEADERS
720
721 LIBCFS_CONFIG_FILES
722 LB_CONFIG_FILES
723 LN_CONFIG_FILES
724 LC_CONFIG_FILES
725 AS_IF([test -n "$SNMP_DIST_SUBDIR"], [LS_CONFIG_FILES])
726
727 AC_SUBST(ac_configure_args)
728
729 MOSTLYCLEANFILES='.*.cmd .*.flags *.o *.ko *.mod.c .depend .*.1.* Modules.symvers Module.symvers'
730 AC_SUBST(MOSTLYCLEANFILES)
731
732 LB_CONFIG_RPMBUILD_OPTIONS
733
734 AC_OUTPUT
735
736 cat <<_ACEOF
737
738 CC:            $CC
739 LD:            $LD
740 CPPFLAGS:      $CPPFLAGS
741 LLCPPFLAGS:    $LLCPPFLAGS
742 CFLAGS:        $CFLAGS
743 EXTRA_KCFLAGS: $EXTRA_KCFLAGS
744 LLCFLAGS:      $LLCFLAGS
745
746 Type 'make' to build Lustre.
747 _ACEOF
748 ]) # LB_CONFIGURE