1 ###############################################################################
2 ## Copyright (C) 2000-2004 Sistina Software, Inc. All rights reserved.
3 ## Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
5 ## This copyrighted material is made available to anyone wishing to use,
6 ## modify, copy, or redistribute it subject to the terms and conditions
7 ## of the GNU General Public License v.2.
9 ## You should have received a copy of the GNU General Public License
10 ## along with this program; if not, write to the Free Software Foundation,
11 ## Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12 ################################################################################
15 ################################################################################
16 dnl -- Process this file with autoconf to produce a configure script.
18 AC_CONFIG_SRCDIR([lib/device/dev-cache.h])
19 AC_CONFIG_HEADERS([lib/misc/configure.h])
21 ################################################################################
22 dnl -- Setup the directory where autoconf has auxilary files
23 AC_CONFIG_AUX_DIR(autoconf)
25 ################################################################################
26 dnl -- Get system type
27 AC_CANONICAL_TARGET([])
33 CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
34 CLDWHOLEARCHIVE="-Wl,-whole-archive"
35 CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
36 LDDEPS="$LDDEPS .export.sym"
37 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
47 CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
50 CLDWHOLEARCHIVE="-all_load"
62 ################################################################################
63 dnl -- Checks for programs.
68 dnl probably no longer needed in 2008, but...
69 AC_PROG_GCC_TRADITIONAL
75 AC_PATH_PROG(CFLOW_CMD, cflow)
76 AC_PATH_PROG(CSCOPE_CMD, cscope)
78 ################################################################################
79 dnl -- Check for header files.
86 AC_CHECK_HEADERS([locale.h stddef.h syslog.h sys/file.h sys/time.h assert.h \
87 langinfo.h libgen.h signal.h sys/mman.h sys/resource.h sys/utsname.h \
89 [AC_MSG_ERROR(bailing out)])
93 AC_CHECK_HEADERS(asm/byteorder.h linux/fs.h malloc.h,,AC_MSG_ERROR(bailing out)) ;;
95 AC_CHECK_HEADERS(machine/endian.h sys/disk.h,,AC_MSG_ERROR(bailing out)) ;;
98 AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h getopt.h inttypes.h limits.h \
99 stdarg.h stdio.h stdlib.h string.h sys/ioctl.h sys/param.h sys/stat.h \
100 sys/types.h unistd.h], , [AC_MSG_ERROR(bailing out)])
101 AC_CHECK_HEADERS(termios.h sys/statvfs.h)
103 ################################################################################
104 dnl -- Check for typedefs, structures, and compiler characteristics.
107 AC_CHECK_MEMBERS([struct stat.st_rdev])
123 AC_CHECK_MEMBERS([struct stat.st_rdev])
126 ################################################################################
127 dnl -- Check for functions
128 AC_SEARCH_LIBS([floor], [m], , [AC_MSG_ERROR(bailing out)])
129 AC_CHECK_FUNCS([floor ftruncate gethostname getpagesize \
130 gettimeofday memset mkdir mkfifo rmdir munmap nl_langinfo setenv setlocale \
131 strcasecmp strchr strcspn strspn strdup strncasecmp strerror strrchr \
132 strstr strtol strtoul uname], , [AC_MSG_ERROR(bailing out)])
133 AC_CHECK_FUNCS(siginterrupt)
135 AC_FUNC_CLOSEDIR_VOID
147 ################################################################################
148 dnl -- Enables statically-linked tools
149 AC_MSG_CHECKING(whether to use static linking)
150 AC_ARG_ENABLE(static_link,
151 [ --enable-static_link Use this to link the tools to their libraries
152 statically. Default is dynamic linking],
153 STATIC_LINK=$enableval, STATIC_LINK=no)
154 AC_MSG_RESULT($STATIC_LINK)
156 ################################################################################
157 dnl -- Prefix is /usr by default, the exec_prefix default is setup later
158 AC_PREFIX_DEFAULT(/usr)
160 ################################################################################
161 dnl -- Setup the ownership of the files
162 AC_MSG_CHECKING(file owner)
164 [ --with-user=USER Set the owner of installed files [[USER=]] ],
165 [ OWNER="$withval" ])
166 AC_MSG_RESULT($OWNER)
168 if test x$OWNER != x; then
169 INSTALL="$INSTALL -o $OWNER"
172 ################################################################################
173 dnl -- Setup the group ownership of the files
174 AC_MSG_CHECKING(group owner)
176 [ --with-group=GROUP Set the group owner of installed files [[GROUP=]] ],
177 [ GROUP="$withval" ])
178 AC_MSG_RESULT($GROUP)
180 if test x$GROUP != x; then
181 INSTALL="$INSTALL -g $GROUP"
184 ################################################################################
185 dnl -- Setup device node ownership
186 AC_MSG_CHECKING(device node uid)
188 AC_ARG_WITH(device-uid,
189 [ --with-device-uid=UID Set the owner used for new device nodes [[UID=0]] ],
190 [ DM_DEVICE_UID="$withval" ], [ DM_DEVICE_UID="0" ] )
191 AC_MSG_RESULT($DM_DEVICE_UID)
193 ################################################################################
194 dnl -- Setup device group ownership
195 AC_MSG_CHECKING(device node gid)
197 AC_ARG_WITH(device-gid,
198 [ --with-device-gid=UID Set the group used for new device nodes [[GID=0]] ],
199 [ DM_DEVICE_GID="$withval" ], [ DM_DEVICE_GID="0" ] )
200 AC_MSG_RESULT($DM_DEVICE_GID)
202 ################################################################################
203 dnl -- Setup device mode
204 AC_MSG_CHECKING(device node mode)
206 AC_ARG_WITH(device-mode,
207 [ --with-device-mode=MODE Set the mode used for new device nodes [[MODE=0600]] ],
208 [ DM_DEVICE_MODE="$withval" ], [ DM_DEVICE_MODE="0600" ] )
209 AC_MSG_RESULT($DM_DEVICE_MODE)
211 ################################################################################
212 dnl -- LVM1 tool fallback option
213 AC_MSG_CHECKING(whether to enable lvm1 fallback)
214 AC_ARG_ENABLE(lvm1_fallback, [ --enable-lvm1_fallback Use this to fall back and use LVM1 binaries if
215 device-mapper is missing from the kernel], LVM1_FALLBACK=$enableval, LVM1_FALLBACK=no)
216 AC_MSG_RESULT($LVM1_FALLBACK)
218 if test x$LVM1_FALLBACK = xyes; then
219 AC_DEFINE([LVM1_FALLBACK], 1, [Define to 1 if 'lvm' should fall back to using LVM1 binaries if device-mapper is missing from the kernel])
222 ################################################################################
223 dnl -- format1 inclusion type
224 AC_MSG_CHECKING(whether to include support for lvm1 metadata)
226 [ --with-lvm1=TYPE LVM1 metadata support: internal/shared/none
232 if [[ "x$LVM1" != xnone -a "x$LVM1" != xinternal -a "x$LVM1" != xshared ]];
234 --with-lvm1 parameter invalid
238 if test x$LVM1 = xinternal; then
239 AC_DEFINE([LVM1_INTERNAL], 1, [Define to 1 to include built-in support for LVM1 metadata.])
242 ################################################################################
243 dnl -- format_pool inclusion type
244 AC_MSG_CHECKING(whether to include support for GFS pool metadata)
246 [ --with-pool=TYPE GFS pool read-only support: internal/shared/none
252 if [[ "x$POOL" != xnone -a "x$POOL" != xinternal -a "x$POOL" != xshared ]];
254 --with-pool parameter invalid
258 if test x$POOL = xinternal; then
259 AC_DEFINE([POOL_INTERNAL], 1, [Define to 1 to include built-in support for GFS pool metadata.])
262 ################################################################################
263 dnl -- cluster_locking inclusion type
264 AC_MSG_CHECKING(whether to include support for cluster locking)
266 [ --with-cluster=TYPE Cluster LVM locking support: internal/shared/none
268 [ CLUSTER="$withval" ])
269 AC_MSG_RESULT($CLUSTER)
271 if [[ "x$CLUSTER" != xnone -a "x$CLUSTER" != xinternal -a "x$CLUSTER" != xshared ]];
273 --with-cluster parameter invalid
277 if test x$CLUSTER = xinternal; then
278 AC_DEFINE([CLUSTER_LOCKING_INTERNAL], 1, [Define to 1 to include built-in support for clustered LVM locking.])
281 ################################################################################
282 dnl -- snapshots inclusion type
283 AC_MSG_CHECKING(whether to include snapshots)
284 AC_ARG_WITH(snapshots,
285 [ --with-snapshots=TYPE Snapshot support: internal/shared/none
287 [ SNAPSHOTS="$withval" ],
288 [ SNAPSHOTS="internal" ])
289 AC_MSG_RESULT($SNAPSHOTS)
291 if [[ "x$SNAPSHOTS" != xnone -a "x$SNAPSHOTS" != xinternal -a "x$SNAPSHOTS" != xshared ]];
293 --with-snapshots parameter invalid
297 if test x$SNAPSHOTS = xinternal; then
298 AC_DEFINE([SNAPSHOT_INTERNAL], 1, [Define to 1 to include built-in support for snapshots.])
301 ################################################################################
302 dnl -- mirrors inclusion type
303 AC_MSG_CHECKING(whether to include mirrors)
305 [ --with-mirrors=TYPE Mirror support: internal/shared/none
307 [ MIRRORS="$withval" ],
308 [ MIRRORS="internal" ])
309 AC_MSG_RESULT($MIRRORS)
311 if [[ "x$MIRRORS" != xnone -a "x$MIRRORS" != xinternal -a "x$MIRRORS" != xshared ]];
313 --with-mirrors parameter invalid
317 if test x$MIRRORS = xinternal; then
318 AC_DEFINE([MIRRORED_INTERNAL], 1, [Define to 1 to include built-in support for mirrors.])
321 ################################################################################
322 dnl -- asynchronous volume replicator inclusion type
323 AC_MSG_CHECKING(whether to include replicators)
324 AC_ARG_WITH(replicators, AC_HELP_STRING([--with-replicators=TYPE],
325 [Replicator support: internal/shared/none [TYPE=none] ]),
326 [REPLICATORS=$withval], [REPLICATORS="none"])
327 AC_MSG_RESULT($REPLICATORS)
329 case "$REPLICATORS" in
331 internal) AC_DEFINE([REPLICATOR_INTERNAL], 1,
332 [Define to 1 to include built-in support for replicators.]) ;;
333 *) AC_MSG_ERROR([--with-replicators parameter invalid ($REPLICATORS)]) ;;
336 ################################################################################
337 dnl -- Disable readline
338 AC_MSG_CHECKING(whether to enable readline)
339 AC_ARG_ENABLE([readline],
340 [ --disable-readline Disable readline support],
341 [READLINE=$enableval], [READLINE=maybe])
342 AC_MSG_RESULT($READLINE)
344 ################################################################################
345 dnl -- Disable realtime clock support
346 AC_MSG_CHECKING(whether to enable realtime support)
347 AC_ARG_ENABLE(realtime, [ --enable-realtime Enable realtime clock support],
349 AC_MSG_RESULT($REALTIME)
351 ################################################################################
352 dnl -- Init pkg-config with dummy invokation:
353 dnl -- this is required because PKG_CHECK_MODULES macro is expanded
354 dnl -- to initialize the pkg-config environment only at the first invokation,
355 dnl -- that would be conditional in this configure.in.
357 PKG_CHECK_MODULES(PKGCONFIGINIT, pkgconfiginit, [],
358 [AC_MSG_RESULT([pkg-config initialized])])
362 ################################################################################
363 dnl -- Build cluster LVM daemon
364 AC_MSG_CHECKING(whether to build cluster LVM daemon)
366 [ --with-clvmd=TYPE Build cluster LVM Daemon.
367 The following cluster manager combinations are valid:
368 * cman,gulm (RHEL4 or equivalent)
369 * cman (RHEL5 or equivalent)
370 * cman,corosync,openais (or selection of them)
371 * singlenode (localhost only)
373 * none (disable build)
375 [ CLVMD="$withval" ],
377 if test x$CLVMD = xyes; then
380 AC_MSG_RESULT($CLVMD)
382 dnl -- If clvmd enabled without cluster locking, automagically include it
383 if test x$CLVMD != xnone && test x$CLUSTER = xnone; then
387 dnl -- init pkgconfig if required
388 if test x$CLVMD != xnone && test x$PKGCONFIG_INIT != x1; then
393 dnl -- define build types
394 if [[ `expr x"$CLVMD" : '.*gulm.*'` != 0 ]]; then
397 if [[ `expr x"$CLVMD" : '.*corosync.*'` != 0 ]]; then
400 if [[ `expr x"$CLVMD" : '.*openais.*'` != 0 ]]; then
403 if [[ `expr x"$CLVMD" : '.*cman.*'` != 0 ]]; then
407 dnl -- sanity check around user selection
408 if test x$BUILDGULM = xyes; then
409 if test x$BUILDCOROSYNC = xyes || \
410 test x$BUILDOPENAIS = xyes; then
411 AC_MSG_ERROR([requested clvmd configuration is not valid])
415 dnl -- define a soft bailout if we are autodetecting
421 AC_MSG_ERROR([bailing out])
424 dnl -- if clvmd=all then set soft_bailout (we don't want to error)
425 dnl -- and set all builds to yes. We need to do this here
426 dnl -- to skip the gulm + openais|corosync sanity check above.
427 if test x$CLVMD = xall; then
437 dnl -- helper macro to check libs without adding them to LIBS
438 check_lib_no_libs() {
444 AC_CHECK_LIB([$lib_no_libs_arg1],
445 [$lib_no_libs_arg2],,
448 LIBS=$ac_check_lib_save_LIBS
451 dnl -- Look for gulm libraries if required.
452 if test x$BUILDGULM = xyes; then
453 PKG_CHECK_MODULES(CCS, libccs, [HAVE_CCS=yes],
455 AC_CHECK_HEADERS(ccs.h,,$bailout)
456 check_lib_no_libs ccs ccs_connect
457 if test $NOTFOUND = 0; then
458 AC_MSG_RESULT([no pkg for libccs, using -lccs])
462 PKG_CHECK_MODULES(GULM, libgulm, [HAVE_GULM=yes],
464 AC_CHECK_HEADERS(libgulm.h,,$bailout)
465 check_lib_no_libs gulm lg_core_login
466 if test $NOTFOUND = 0; then
467 AC_MSG_RESULT([no pkg for libgulm, using -lgulm])
473 dnl -- Look for cman libraries if required.
474 if test x$BUILDCMAN = xyes; then
475 PKG_CHECK_MODULES(CMAN, libcman, [HAVE_CMAN=yes],
477 AC_CHECK_HEADERS(libcman.h,,$bailout)
478 check_lib_no_libs cman cman_init
479 if test $NOTFOUND = 0; then
480 AC_MSG_RESULT([no pkg for libcman, using -lcman])
488 dnl -- Look for corosync that's required also for openais build
489 dnl -- only enough recent version of corosync ship pkg-config files.
490 dnl -- We can safely rely on that to detect the correct bits.
491 if test x$BUILDCOROSYNC = xyes || \
492 test x$BUILDOPENAIS = xyes; then
493 PKG_CHECK_MODULES(COROSYNC, corosync, [HAVE_COROSYNC=yes], $bailout)
497 dnl -- Look for corosync libraries if required.
498 if test x$BUILDCOROSYNC = xyes; then
499 PKG_CHECK_MODULES(QUORUM, libquorum, [HAVE_QUORUM=yes], $bailout)
504 dnl -- Look for openais libraries if required.
505 if test x$BUILDOPENAIS = xyes; then
506 PKG_CHECK_MODULES(SALCK, libSaLck, [HAVE_SALCK=yes], $bailout)
510 dnl -- Below are checks for libraries common to more than one build.
512 dnl -- Check confdb library.
513 dnl -- mandatory for corosync build.
514 dnl -- optional for openais/cman build.
516 if test x$CHECKCONFDB = xyes; then
517 PKG_CHECK_MODULES(CONFDB, libconfdb,
521 AC_CHECK_HEADERS(corosync/confdb.h,
525 if test x$HAVE_CONFDB != xyes && \
526 test x$HAVE_CONFDB_H = xyes; then
527 check_lib_no_libs confdb confdb_initialize
528 AC_MSG_RESULT([no pkg for confdb, using -lconfdb])
529 CONFDB_LIBS="-lconfdb"
533 if test x$BUILDCOROSYNC = xyes && \
534 test x$HAVE_CONFDB != xyes &&
535 test x$CLVMD != xall; then
536 AC_MSG_ERROR([bailing out... confdb library is required])
540 dnl -- Check cpg library.
541 if test x$CHECKCPG = xyes; then
542 PKG_CHECK_MODULES(CPG, libcpg, [HAVE_CPG=yes], $bailout)
545 dnl -- Check dlm library.
546 if test x$CHECKDLM = xyes; then
547 PKG_CHECK_MODULES(DLM, libdlm, [HAVE_DLM=yes],
549 AC_CHECK_HEADERS(libdlm.h,,$bailout)
550 check_lib_no_libs dlm dlm_lock -lpthread
551 if test $NOTFOUND = 0; then
552 AC_MSG_RESULT([no pkg for libdlm, using -ldlm])
553 DLM_LIBS="-ldlm -lpthread"
558 dnl -- If we are autodetecting, we need to re-create
559 dnl -- the depedencies checks and set a proper CLVMD.
560 if test x$CLVMD = xall; then
562 if test x$HAVE_CCS = xyes && \
563 test x$HAVE_GULM = xyes; then
564 AC_MSG_RESULT([Enabling clvmd gulm cluster manager])
567 if test x$HAVE_CMAN = xyes && \
568 test x$HAVE_DLM = xyes; then
569 AC_MSG_RESULT([Enabling clvmd cman cluster manager])
572 if test x$HAVE_COROSYNC = xyes && \
573 test x$HAVE_QUORUM = xyes && \
574 test x$HAVE_CPG = xyes && \
575 test x$HAVE_DLM = xyes && \
576 test x$HAVE_CONFDB = xyes; then
577 AC_MSG_RESULT([Enabling clvmd corosync cluster manager])
578 CLVMD="$CLVMD,corosync"
580 if test x$HAVE_COROSYNC = xyes && \
581 test x$HAVE_CPG = xyes && \
582 test x$HAVE_SALCK = xyes; then
583 AC_MSG_RESULT([Enabling clvmd openais cluster manager])
584 CLVMD="$CLVMD,openais"
586 if test x$CLVMD = xnone; then
587 AC_MSG_RESULT([Disabling clvmd build. No cluster manager detected.])
591 ################################################################################
592 dnl -- Build cluster mirror log daemon
593 AC_MSG_CHECKING(whether to build cluster mirror log daemon)
594 AC_ARG_ENABLE(cmirrord, [ --enable-cmirrord Enable the cluster mirror log daemon],
595 CMIRRORD=$enableval, CMIRRORD=no)
596 AC_MSG_RESULT($CMIRRORD)
598 BUILD_CMIRRORD=$CMIRRORD
600 ################################################################################
601 dnl -- cmirrord pidfile
602 AH_TEMPLATE(CMIRRORD_PIDFILE, [Path to cmirrord pidfile.])
603 if test "x$BUILD_CMIRRORD" = xyes; then
604 AC_ARG_WITH(cmirrord-pidfile,
605 [ --with-cmirrord-pidfile=PATH cmirrord pidfile [[/var/run/cmirrord.pid]] ],
606 [ AC_DEFINE_UNQUOTED(CMIRRORD_PIDFILE,"$withval") ],
607 [ AC_DEFINE_UNQUOTED(CMIRRORD_PIDFILE,"/var/run/cmirrord.pid") ])
610 ################################################################################
611 dnl -- Look for corosync libraries if required.
612 if [[ "x$BUILD_CMIRRORD" = xyes ]]; then
613 dnl -- init pkgconfig if required
614 if test x$PKGCONFIG_INIT != x1; then
617 PKG_CHECK_MODULES(SACKPT, libSaCkpt)
618 if test x$HAVE_CPG != xyes; then
619 PKG_CHECK_MODULES(CPG, libcpg)
623 ################################################################################
624 dnl -- Enable debugging
625 AC_MSG_CHECKING(whether to enable debugging)
626 AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging],
627 DEBUG=$enableval, DEBUG=no)
628 AC_MSG_RESULT($DEBUG)
630 dnl -- Normally turn off optimisation for debug builds
631 if test x$DEBUG = xyes; then
637 ################################################################################
638 dnl -- Override optimisation
639 AC_MSG_CHECKING(for C optimisation flag)
640 AC_ARG_WITH(optimisation,
641 [ --with-optimisation=OPT C optimisation flag [[OPT=-O2]] ],
642 [ COPTIMISE_FLAG="$withval" ])
643 AC_MSG_RESULT($COPTIMISE_FLAG)
645 ################################################################################
646 dnl -- Enable profiling
647 AC_MSG_CHECKING(whether to gather gcov profiling data)
648 AC_ARG_ENABLE(profiling,
649 AC_HELP_STRING(--enable-profiling, [Gather gcov profiling data]),
650 PROFILING=$enableval, PROFILING=no)
651 AC_MSG_RESULT($PROFILING)
653 if test "x$PROFILING" = xyes; then
654 COPTIMISE_FLAG="$COPTIMISE_FLAG -fprofile-arcs -ftest-coverage"
655 AC_PATH_PROG(LCOV, lcov)
656 AC_PATH_PROG(GENHTML, genhtml)
657 if test -z "$LCOV" -o -z "$GENHTML"; then
658 AC_MSG_ERROR([lcov and genhtml are required for profiling])
660 AC_PATH_PROG(GENPNG, genpng)
661 if test -n "$GENPNG"; then
662 AC_MSG_CHECKING([whether $GENPNG has all required modules])
663 if $GENPNG --help > /dev/null 2>&1 ; then
665 GENHTML="$GENHTML --frames"
667 AC_MSG_RESULT(not supported)
668 AC_MSG_WARN([GD.pm perl module is not installed])
674 ################################################################################
675 dnl -- Disable devmapper
676 AC_MSG_CHECKING(whether to use device-mapper)
677 AC_ARG_ENABLE(devmapper, [ --disable-devmapper Disable LVM2 device-mapper interaction],
678 DEVMAPPER=$enableval)
679 AC_MSG_RESULT($DEVMAPPER)
681 if test x$DEVMAPPER = xyes; then
682 AC_DEFINE([DEVMAPPER_SUPPORT], 1, [Define to 1 to enable LVM2 device-mapper interaction.])
685 ################################################################################
686 dnl -- Enable udev synchronisation
687 AC_MSG_CHECKING(whether to enable synchronisation with udev processing)
688 AC_ARG_ENABLE(udev_sync, [ --enable-udev_sync Enable synchronisation with udev processing],
689 UDEV_SYNC=$enableval, UDEV_SYNC=no)
690 AC_MSG_RESULT($UDEV_SYNC)
692 if test x$UDEV_SYNC = xyes; then
693 AC_CHECK_LIB(udev, udev_queue_get_udev_is_active,
694 [UDEV_PC="libudev"; UDEV_LIBS="-ludev"],
695 [AC_MSG_ERROR([bailing out... libudev library is required])])
696 AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
699 dnl -- Enable udev rules
700 AC_MSG_CHECKING(whether to enable installation of udev rules required for synchronisation)
701 AC_ARG_ENABLE(udev_rules, [ --enable-udev_rules Install rule files needed for udev synchronisation],
702 UDEV_RULES=$enableval, UDEV_RULES=$UDEV_SYNC)
703 AC_MSG_RESULT($UDEV_RULES)
705 ################################################################################
706 dnl -- Compatibility mode
707 AC_ARG_ENABLE(compat, [ --enable-compat Enable support for old device-mapper versions],
708 DM_COMPAT=$enableval, DM_COMPAT=no)
710 ################################################################################
711 dnl -- Compatible units suffix mode
712 AC_ARG_ENABLE(units-compat,
713 [ --enable-units-compat Enable output compatibility with old versions that
714 that don't use KiB-style unit suffixes],
715 UNITS_COMPAT=$enableval, UNITS_COMPAT=no)
717 if test x$UNITS_COMPAT = xyes; then
718 AC_DEFINE([DEFAULT_SI_UNIT_CONSISTENCY], 0, [Define to 0 to reinstate the pre-2.02.54 handling of unit suffixes.])
721 ################################################################################
723 AC_ARG_ENABLE(ioctl, [ --disable-driver Disable calls to device-mapper in the kernel],
724 DM_IOCTLS=$enableval)
726 ################################################################################
727 dnl -- Disable O_DIRECT
728 AC_MSG_CHECKING(whether to enable O_DIRECT)
729 AC_ARG_ENABLE(o_direct, [ --disable-o_direct Disable O_DIRECT],
731 AC_MSG_RESULT($ODIRECT)
733 if test x$ODIRECT = xyes; then
734 AC_DEFINE([O_DIRECT_SUPPORT], 1, [Define to 1 to enable O_DIRECT support.])
737 ################################################################################
738 dnl -- Enable liblvm2app.so
739 AC_MSG_CHECKING(whether to build liblvm2app.so application library)
740 AC_ARG_ENABLE(applib,
741 [ --enable-applib Build application library],
742 APPLIB=$enableval, APPLIB=no)
743 AC_MSG_RESULT($APPLIB)
744 AC_SUBST([LVM2APP_LIB])
745 test x$APPLIB = xyes \
746 && LVM2APP_LIB=-llvm2app \
749 ################################################################################
751 AC_MSG_CHECKING(whether to compile liblvm2cmd.so)
752 AC_ARG_ENABLE(cmdlib, [ --enable-cmdlib Build shared command library],
753 CMDLIB=$enableval, CMDLIB=no)
754 AC_MSG_RESULT($CMDLIB)
755 AC_SUBST([LVM2CMD_LIB])
756 test x$CMDLIB = xyes \
757 && LVM2CMD_LIB=-llvm2cmd \
760 ################################################################################
761 dnl -- Enable pkg-config
762 AC_ARG_ENABLE(pkgconfig, [ --enable-pkgconfig Install pkgconfig support],
763 PKGCONFIG=$enableval, PKGCONFIG=no)
765 ################################################################################
766 dnl -- Enable installation of writable files by user
767 AC_ARG_ENABLE(write_install, AC_HELP_STRING([--enable-write_install],
768 [Install user writable files]),
769 [WRITE_INSTALL=$enableval], [WRITE_INSTALL=no])
771 ################################################################################
773 AC_MSG_CHECKING(whether to install fsadm)
774 AC_ARG_ENABLE(fsadm, [AC_HELP_STRING([--disable-fsadm], [Disable fsadm])],
776 AC_MSG_RESULT($FSADM)
778 ################################################################################
779 dnl -- enable dmeventd handling
780 AC_MSG_CHECKING(whether to use dmeventd)
781 AC_ARG_ENABLE(dmeventd, [ --enable-dmeventd Enable the device-mapper event daemon],
783 AC_MSG_RESULT($DMEVENTD)
785 BUILD_DMEVENTD=$DMEVENTD
787 dnl -- dmeventd currently requires internal mirror support
788 if test x$DMEVENTD = xyes; then
789 if test x$MIRRORS != xinternal; then
791 --enable-dmeventd currently requires --with-mirrors=internal
794 if test x$CMDLIB = xno; then
796 --enable-dmeventd requires --enable-cmdlib to be used as well
801 if test x$DMEVENTD = xyes; then
802 AC_DEFINE([DMEVENTD], 1, [Define to 1 to enable the device-mapper event daemon.])
805 ################################################################################
806 dnl -- getline included in recent libc
808 AC_CHECK_LIB(c, getline, AC_DEFINE([HAVE_GETLINE], 1,
809 [Define to 1 if getline is available.]))
811 ################################################################################
812 dnl -- canonicalize_file_name included in recent libc
814 AC_CHECK_LIB(c, canonicalize_file_name,
815 AC_DEFINE([HAVE_CANONICALIZE_FILE_NAME], 1,
816 [Define to 1 if canonicalize_file_name is available.]))
818 ################################################################################
819 dnl -- Clear default exec_prefix - install into /sbin rather than /usr/sbin
820 if [[ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ]];
824 ################################################################################
825 dnl -- Check for dlopen
826 AC_CHECK_LIB(dl, dlopen, [
827 AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dynamic libraries are available.])
833 ################################################################################
834 dnl -- Check for shared/static conflicts
835 if [[ \( "x$LVM1" = xshared -o "x$POOL" = xshared -o "x$CLUSTER" = xshared \
836 -o "x$SNAPSHOTS" = xshared -o "x$MIRRORS" = xshared \
837 \) -a "x$STATIC_LINK" = xyes ]];
839 Features cannot be 'shared' when building statically
843 ################################################################################
844 if [[ "$DMEVENTD" = yes -o "$CLVMD" != none ]] ; then
845 AC_CHECK_LIB([pthread], [pthread_mutex_lock],
846 [PTHREAD_LIBS="-lpthread"], hard_bailout)
849 ################################################################################
850 dnl -- Disable selinux
851 AC_MSG_CHECKING(whether to enable selinux support)
852 AC_ARG_ENABLE(selinux, [ --disable-selinux Disable selinux support],
854 AC_MSG_RESULT($SELINUX)
856 ################################################################################
857 dnl -- Check for selinux
858 if test x$SELINUX = xyes; then
859 AC_CHECK_LIB([sepol], [sepol_check_context], [
860 AC_DEFINE([HAVE_SEPOL], 1, [Define to 1 if sepol_check_context is available.])
861 SELINUX_LIBS="-lsepol"])
863 AC_CHECK_LIB([selinux], [is_selinux_enabled], [
864 AC_CHECK_HEADERS([selinux/selinux.h],, hard_bailout)
865 AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
866 SELINUX_LIBS="-lselinux $SELINUX_LIBS"
867 SELINUX_PC="libselinux"
868 HAVE_SELINUX=yes ], [
869 AC_MSG_WARN(Disabling selinux)
875 ################################################################################
876 dnl -- Check for realtime clock support
877 if test x$REALTIME = xyes; then
878 AC_CHECK_LIB(rt, clock_gettime, HAVE_REALTIME=yes, HAVE_REALTIME=no)
880 if test x$HAVE_REALTIME = xyes; then
881 AC_DEFINE([HAVE_REALTIME], 1, [Define to 1 to include support for realtime clock.])
884 AC_MSG_WARN(Disabling realtime clock)
888 ################################################################################
889 dnl -- Check for getopt
890 AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.]))
892 ################################################################################
893 dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
894 if test x$READLINE != xno; then
896 AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses termcap termlib],
897 READLINE_LIBS=$ac_cv_search_tgetent, [
898 if test "$READLINE" = yes; then
900 [termcap could not be found which is required for the
901 --enable-readline option (which is enabled by default). Either disable readline
902 support with --disable-readline or download and install termcap from:
903 ftp.gnu.org/gnu/termcap
904 Note: if you are using precompiled packages you will also need the development
905 package as well (which may be called termcap-devel or something similar).
906 Note: (n)curses also seems to work as a substitute for termcap. This was
907 not found either - but you could try installing that as well.])
909 dnl -- Old systems may need extra termcap dependency explicitly in LIBS
910 AC_CHECK_LIB([readline], [readline], [
911 AC_DEFINE([READLINE_SUPPORT], 1,
912 [Define to 1 to include the LVM readline shell.])
913 dnl -- Try only with -lreadline and check for different symbol
915 AC_CHECK_LIB([readline], [rl_line_buffer],
916 [ READLINE_LIBS="-lreadline" ], [
917 AC_MSG_RESULT([linking -lreadline with $READLINE_LIBS needed])
918 READLINE_LIBS="-lreadline $READLINE_LIBS"
921 if test "$READLINE" = yes; then
923 [GNU Readline could not be found which is required for the
924 --enable-readline option (which is enabled by default). Either disable readline
925 support with --disable-readline or download and install readline from:
926 ftp.gnu.org/gnu/readline
927 Note: if you are using precompiled packages you will also need the development
928 package as well (which may be called readline-devel or something similar).])
930 LIBS="$READLINE_LIBS $lvm_saved_libs"
931 AC_CHECK_FUNCS([rl_completion_matches])
935 ################################################################################
936 dnl -- Internationalisation stuff
937 AC_MSG_CHECKING(whether to enable internationalisation)
938 AC_ARG_ENABLE(nls, [ --enable-nls Enable Native Language Support],
939 INTL=$enableval, INTL=no)
942 if test x$INTL = xyes; then
943 # FIXME - Move this - can be device-mapper too
945 AC_PATH_PROG(MSGFMT, msgfmt)
946 if [[ "x$MSGFMT" == x ]];
948 msgfmt not found in path $PATH
952 AC_ARG_WITH(localedir,
953 [ --with-localedir=DIR Translation files in DIR [[PREFIX/share/locale]] ],
954 [ LOCALEDIR="$withval" ],
955 [ LOCALEDIR='${prefix}/share/locale' ])
958 ################################################################################
960 [ --with-confdir=DIR Configuration files in DIR [[/etc]]],
961 [ CONFDIR="$withval" ],
964 AC_ARG_WITH(staticdir,
965 [ --with-staticdir=DIR Static binary in DIR [[EPREFIX/sbin]]],
966 [ STATICDIR="$withval" ],
967 [ STATICDIR='${exec_prefix}/sbin' ])
969 AC_ARG_WITH(usrlibdir,
970 [ --with-usrlibdir=DIR],
971 [ usrlibdir="$withval"],
972 [ usrlibdir='${prefix}/lib' ])
974 AC_ARG_WITH(usrsbindir,
975 [ --with-usrsbindir=DIR],
976 [ usrsbindir="$withval"],
977 [ usrsbindir='${prefix}/sbin' ])
979 ################################################################################
980 AC_ARG_WITH(udev_prefix,
981 [ --with-udev-prefix=UPREFIX Install udev rule files in UPREFIX [[EPREFIX]]],
982 [ udev_prefix="$withval"],
983 [ udev_prefix='${exec_prefix}' ])
986 [ --with-udevdir=DIR udev rules in DIR [[UPREFIX/lib/udev/rules.d]]],
987 [ udevdir="$withval"],
988 [ udevdir='${udev_prefix}/lib/udev/rules.d' ])
990 ################################################################################
991 dnl -- Ensure additional headers required
992 if test x$READLINE = xyes; then
993 AC_CHECK_HEADERS(readline/readline.h readline/history.h,,AC_MSG_ERROR(bailing out))
996 if test x$CLVMD != xnone; then
997 AC_CHECK_HEADERS(mntent.h netdb.h netinet/in.h pthread.h search.h sys/mount.h sys/socket.h sys/uio.h sys/un.h utmpx.h,,AC_MSG_ERROR(bailing out))
998 AC_CHECK_FUNCS(dup2 getmntent memmove select socket,,AC_MSG_ERROR(bailing out))
1000 AC_FUNC_SELECT_ARGTYPES
1003 if test x$CLUSTER != xnone; then
1004 AC_CHECK_HEADERS(sys/socket.h sys/un.h,,AC_MSG_ERROR(bailing out))
1005 AC_CHECK_FUNCS(socket,,AC_MSG_ERROR(bailing out))
1008 if test x$DMEVENTD = xyes; then
1009 AC_CHECK_HEADERS(arpa/inet.h,,AC_MSG_ERROR(bailing out))
1012 if test x$HAVE_LIBDL = xyes; then
1013 AC_CHECK_HEADERS(dlfcn.h,,AC_MSG_ERROR(bailing out))
1016 if test x$INTL = xyes; then
1017 AC_CHECK_HEADERS(libintl.h,,AC_MSG_ERROR(bailing out))
1020 if test x$UDEV_SYNC = xyes; then
1021 AC_CHECK_HEADERS(sys/ipc.h sys/sem.h,,AC_MSG_ERROR(bailing out))
1024 ################################################################################
1025 AC_PATH_PROG(MODPROBE_CMD, modprobe)
1027 if test x$MODPROBE_CMD != x; then
1028 AC_DEFINE_UNQUOTED([MODPROBE_CMD], ["$MODPROBE_CMD"], [The path to 'modprobe', if available.])
1032 lvm_exec_prefix=$exec_prefix
1033 test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$prefix
1034 test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$ac_default_prefix
1035 AC_DEFINE_UNQUOTED(LVM_PATH, ["$lvm_exec_prefix/sbin/lvm"], [Path to lvm binary.])
1037 if test "$CLVMD" != none; then
1038 clvmd_prefix=$ac_default_prefix
1039 test "$prefix" != NONE && clvmd_prefix=$prefix
1040 AC_DEFINE_UNQUOTED(CLVMD_PATH, ["$clvmd_prefix/sbin/clvmd"], [Path to clvmd binary.])
1043 ################################################################################
1044 dnl -- dmeventd pidfile and executable path
1045 AH_TEMPLATE(DMEVENTD_PIDFILE, [Path to dmeventd pidfile.])
1046 if test "$BUILD_DMEVENTD" = yes; then
1047 AC_ARG_WITH(dmeventd-pidfile,
1048 [ --with-dmeventd-pidfile=PATH dmeventd pidfile [[/var/run/dmeventd.pid]] ],
1049 [ AC_DEFINE_UNQUOTED(DMEVENTD_PIDFILE,"$withval") ],
1050 [ AC_DEFINE_UNQUOTED(DMEVENTD_PIDFILE,"/var/run/dmeventd.pid") ])
1053 AH_TEMPLATE(DMEVENTD_PATH, [Path to dmeventd binary.])
1054 if test "$BUILD_DMEVENTD" = yes; then
1055 AC_ARG_WITH(dmeventd-path,
1056 [ --with-dmeventd-path=PATH dmeventd path [[EPREFIX/sbin/dmeventd]] ],
1057 [ AC_DEFINE_UNQUOTED(DMEVENTD_PATH,"$withval") ],
1058 [ AC_DEFINE_UNQUOTED(DMEVENTD_PATH,"$lvm_exec_prefix/sbin/dmeventd") ])
1061 ################################################################################
1062 dnl -- various defaults
1063 AH_TEMPLATE(DEFAULT_SYS_DIR, [Path to LVM system directory.])
1064 AC_ARG_WITH(default-system-dir,
1065 [ --with-default-system-dir=DIR Default LVM system directory [[/etc/lvm]] ],
1066 [ DEFAULT_SYS_DIR="$withval" ],
1067 [ DEFAULT_SYS_DIR="/etc/lvm" ])
1068 AC_DEFINE_UNQUOTED(DEFAULT_SYS_DIR,["$DEFAULT_SYS_DIR"] )
1070 AH_TEMPLATE(DEFAULT_ARCHIVE_SUBDIR, [Name of default metadata archive subdirectory.])
1071 AC_ARG_WITH(default-archive-subdir,
1072 [ --with-default-archive-subdir=SUBDIR Default metadata archive subdir [[archive]] ],
1073 [ DEFAULT_ARCHIVE_SUBDIR="$withval" ],
1074 [ DEFAULT_ARCHIVE_SUBDIR="archive" ])
1075 AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE_SUBDIR,["$DEFAULT_ARCHIVE_SUBDIR"])
1077 AH_TEMPLATE(DEFAULT_BACKUP_SUBDIR, [Name of default metadata backup subdirectory.])
1078 AC_ARG_WITH(default-backup-subdir,
1079 [ --with-default-backup-subdir=SUBDIR Default metadata backup subdir [[backup]] ],
1080 [ DEFAULT_BACKUP_SUBDIR="$withval" ],
1081 [ DEFAULT_BACKUP_SUBDIR="backup" ])
1082 AC_DEFINE_UNQUOTED(DEFAULT_BACKUP_SUBDIR,["$DEFAULT_BACKUP_SUBDIR"] )
1084 AH_TEMPLATE(DEFAULT_CACHE_SUBDIR, [Name of default metadata cache subdirectory.])
1085 AC_ARG_WITH(default-cache-subdir,
1086 [ --with-default-cache-subdir=SUBDIR Default metadata cache subdir [[cache]] ],
1087 [ DEFAULT_CACHE_SUBDIR="$withval" ],
1088 [ DEFAULT_CACHE_SUBDIR="cache" ])
1089 AC_DEFINE_UNQUOTED(DEFAULT_CACHE_SUBDIR,["$DEFAULT_CACHE_SUBDIR"] )
1091 AH_TEMPLATE(DEFAULT_LOCK_DIR, [Name of default locking directory.])
1092 AC_ARG_WITH(default-locking-dir,
1093 [ --with-default-locking-dir=DIR Default locking directory [[/var/lock/lvm]] ],
1094 [ DEFAULT_LOCK_DIR="$withval" ],
1095 [ DEFAULT_LOCK_DIR="/var/lock/lvm" ])
1096 AC_DEFINE_UNQUOTED(DEFAULT_LOCK_DIR,["$DEFAULT_LOCK_DIR"] )
1098 ################################################################################
1099 dnl -- which kernel interface to use (ioctl only)
1100 AC_MSG_CHECKING(for kernel interface choice)
1101 AC_ARG_WITH(interface,
1102 [ --with-interface=IFACE Choose kernel interface (ioctl) [[ioctl]] ],
1103 [ interface="$withval" ],
1104 [ interface=ioctl ])
1105 if [[ "x$interface" != xioctl ]];
1107 AC_MSG_ERROR(--with-interface=ioctl required. fs no longer supported.)
1109 AC_MSG_RESULT($interface)
1111 ################################################################################
1112 DM_LIB_VERSION="\"`cat "$srcdir"/VERSION_DM 2>/dev/null || echo Unknown`\""
1113 AC_DEFINE_UNQUOTED(DM_LIB_VERSION, $DM_LIB_VERSION, [Library version])
1115 DM_LIB_PATCHLEVEL=`cat "$srcdir"/VERSION_DM | $AWK -F '[[-. ]]' '{printf "%s.%s.%s",$1,$2,$3}'`
1117 LVM_VERSION="\"`cat "$srcdir"/VERSION 2>/dev/null || echo Unknown`\""
1119 VER=`cat "$srcdir"/VERSION`
1120 LVM_RELEASE_DATE="\"`echo $VER | $SED 's/.* (//;s/).*//'`\""
1121 VER=`echo "$VER" | $AWK '{print $1}'`
1122 LVM_RELEASE="\"`echo "$VER" | $AWK -F '-' '{print $2}'`\""
1123 VER=`echo "$VER" | $AWK -F '-' '{print $1}'`
1124 LVM_MAJOR=`echo "$VER" | $AWK -F '.' '{print $1}'`
1125 LVM_MINOR=`echo "$VER" | $AWK -F '.' '{print $2}'`
1126 LVM_PATCHLEVEL=`echo "$VER" | $AWK -F '[[(.]]' '{print $3}'`
1127 LVM_LIBAPI=`echo "$VER" | $AWK -F '[[()]]' '{print $2}'`
1129 ################################################################################
1132 AC_SUBST(BUILD_CMIRRORD)
1133 AC_SUBST(BUILD_DMEVENTD)
1134 AC_SUBST(CCS_CFLAGS)
1139 AC_SUBST(CLDNOWHOLEARCHIVE)
1140 AC_SUBST(CLDWHOLEARCHIVE)
1143 AC_SUBST(CMAN_CFLAGS)
1146 AC_SUBST(CONFDB_CFLAGS)
1147 AC_SUBST(CONFDB_LIBS)
1149 AC_SUBST(COPTIMISE_FLAG)
1150 AC_SUBST(CPG_CFLAGS)
1152 AC_SUBST(CSCOPE_CMD)
1154 AC_SUBST(DEFAULT_SYS_DIR)
1155 AC_SUBST(DEFAULT_ARCHIVE_SUBDIR)
1156 AC_SUBST(DEFAULT_BACKUP_SUBDIR)
1157 AC_SUBST(DEFAULT_CACHE_SUBDIR)
1158 AC_SUBST(DEFAULT_LOCK_DIR)
1160 AC_SUBST(DLM_CFLAGS)
1165 AC_SUBST(DM_DEVICE_GID)
1166 AC_SUBST(DM_DEVICE_MODE)
1167 AC_SUBST(DM_DEVICE_UID)
1169 AC_SUBST(DM_LIB_VERSION)
1170 AC_SUBST(DM_LIB_PATCHLEVEL)
1172 AC_SUBST(GULM_CFLAGS)
1174 AC_SUBST(HAVE_LIBDL)
1175 AC_SUBST(HAVE_REALTIME)
1177 AC_SUBST(INTL_PACKAGE)
1181 AC_SUBST(LIB_SUFFIX)
1184 AC_SUBST(LVM1_FALLBACK)
1185 AC_SUBST(LVM_VERSION)
1186 AC_SUBST(LVM_LIBAPI)
1189 AC_SUBST(LVM_PATCHLEVEL)
1190 AC_SUBST(LVM_RELEASE)
1191 AC_SUBST(LVM_RELEASE_DATE)
1193 AC_SUBST(REPLICATORS)
1197 AC_SUBST(PTHREAD_LIBS)
1198 AC_SUBST(QUORUM_CFLAGS)
1199 AC_SUBST(QUORUM_LIBS)
1200 AC_SUBST(READLINE_LIBS)
1201 AC_SUBST(SACKPT_CFLAGS)
1202 AC_SUBST(SACKPT_LIBS)
1203 AC_SUBST(SALCK_CFLAGS)
1204 AC_SUBST(SALCK_LIBS)
1205 AC_SUBST(SELINUX_LIBS)
1206 AC_SUBST(SELINUX_PC)
1209 AC_SUBST(STATIC_LINK)
1212 AC_SUBST(UDEV_RULES)
1214 AC_SUBST(WRITE_INSTALL)
1217 AC_SUBST(missingkernel)
1220 AC_SUBST(udev_prefix)
1223 AC_SUBST(usrsbindir)
1225 ################################################################################
1226 dnl -- First and last lines should not contain files to generate in order to
1227 dnl -- keep utility scripts running properly
1232 daemons/clvmd/Makefile
1233 daemons/cmirrord/Makefile
1234 daemons/dmeventd/Makefile
1235 daemons/dmeventd/libdevmapper-event.pc
1236 daemons/dmeventd/plugins/Makefile
1237 daemons/dmeventd/plugins/lvm2/Makefile
1238 daemons/dmeventd/plugins/mirror/Makefile
1239 daemons/dmeventd/plugins/snapshot/Makefile
1245 lib/format1/Makefile
1246 lib/format_pool/Makefile
1247 lib/locking/Makefile
1249 lib/replicator/Makefile
1250 lib/misc/lvm-version.h
1251 lib/snapshot/Makefile
1253 libdm/libdevmapper.pc
1255 liblvm/liblvm2app.pc
1258 scripts/clvmd_init_red_hat
1259 scripts/cmirrord_init_red_hat
1260 scripts/lvm2_monitoring_init_red_hat
1269 if test x$ODIRECT != xyes; then
1270 AC_MSG_WARN(Warning: O_DIRECT disabled: low-memory pvmove may lock up)