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