summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.make.in6
-rw-r--r--configure.ac23
-rw-r--r--ext2fs/Makefile2
-rw-r--r--fatfs/Makefile2
-rw-r--r--isofs/Makefile2
-rw-r--r--libstore/Makefile20
6 files changed, 39 insertions, 16 deletions
diff --git a/config.make.in b/config.make.in
index 5bfc777e..c5d4e68d 100644
--- a/config.make.in
+++ b/config.make.in
@@ -87,6 +87,12 @@ HAVE_DAEMON = @HAVE_DAEMON@
libdaemon_CFLAGS = @libdaemon_CFLAGS@
libdaemon_LIBS = @libdaemon_LIBS@
+# How to compile and link against libbz2.
+HAVE_LIBBZ2 = @HAVE_LIBBZ2@
+
+# How to compile and link against libz.
+HAVE_LIBZ = @HAVE_LIBZ@
+
# How to compile and link against libblkid.
HAVE_BLKID = @HAVE_BLKID@
libblkid_CFLAGS = @libblkid_CFLAGS@
diff --git a/configure.ac b/configure.ac
index b6f777e2..ecabfdfd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,13 +211,31 @@ AS_IF([test "x$with_parted" != xno], [
])
AC_SUBST([PARTED_LIBS])
+AC_ARG_WITH([libbz2],
+ [AS_HELP_STRING([--without-libbz2], [disable libbz2])], , [with_libbz2=yes])
+
+AS_IF([test "x$with_libbz2" != xno], [
+ AC_CHECK_LIB(bz2, BZ2_bzCompress, [HAVE_LIBBZ2=1], [true])
+])
+AC_SUBST([HAVE_LIBBZ2])
+
+AC_ARG_WITH([libz],
+ [AS_HELP_STRING([--without-libz], [disable libz])], , [with_libz=yes])
+
+AS_IF([test "x$with_libz" != xno], [
+ AC_CHECK_LIB(z, deflate, [HAVE_LIBZ=1], [true])
+])
+AC_SUBST([HAVE_LIBZ])
+
AC_ARG_ENABLE(boot-store-types,
[ --enable-boot-store-types=TYPES...
list of store types included in statically
linked filesystems used for booting])dnl
if test -z "$enable_boot_store_types"; then
- boot_store_types='device remap gunzip bunzip2'
+ boot_store_types='device remap'
test -z "$PARTED_LIBS" || boot_store_types="$boot_store_types part"
+ test -z "$HAVE_LIBBZ2" || boot_store_types="$boot_store_types bunzip2"
+ test -z "$HAVE_LIBZ" || boot_store_types="$boot_store_types gunzip"
elif test "x$enable_boot_store_types" = xno; then
AC_MSG_WARN([you probably wanted --disable-static-progs])
else
@@ -315,9 +333,6 @@ PKG_CHECK_MODULES([libblkid], [blkid],
AC_SUBST([libblkid_LIBS])
AC_SUBST([libblkid_CFLAGS])
-AC_CHECK_LIB(bz2, BZ2_bzCompress, , AC_MSG_ERROR([libbz2 is required.]))
-AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([libz is required.]))
-
AC_CONFIG_FILES([config.make ${makefiles}])
AC_OUTPUT
diff --git a/ext2fs/Makefile b/ext2fs/Makefile
index 32e40f06..8d2e68c7 100644
--- a/ext2fs/Makefile
+++ b/ext2fs/Makefile
@@ -24,7 +24,7 @@ SRCS = balloc.c dir.c ext2fs.c getblk.c hyper.c ialloc.c \
inode.c pager.c pokel.c truncate.c storeinfo.c msg.c xinl.c
OBJS = $(SRCS:.c=.o)
HURDLIBS = diskfs pager iohelp fshelp store ports ihash shouldbeinlibc
-OTHERLIBS = -lpthread -lbz2 -lz
+OTHERLIBS = -lpthread $(and $(HAVE_LIBBZ2),-lbz2) $(and $(HAVE_LIBZ),-lz)
include ../Makeconf
diff --git a/fatfs/Makefile b/fatfs/Makefile
index 2555669c..6224b644 100644
--- a/fatfs/Makefile
+++ b/fatfs/Makefile
@@ -23,7 +23,7 @@ SRCS = inode.c main.c dir.c pager.c fat.c virt-inode.c node-create.c
OBJS = $(SRCS:.c=.o)
HURDLIBS = diskfs iohelp fshelp store pager ports ihash shouldbeinlibc
-OTHERLIBS = -lpthread -lbz2 -lz
+OTHERLIBS = -lpthread $(and $(HAVE_LIBBZ2),-lbz2) $(and $(HAVE_LIBZ),-lz)
include ../Makeconf
diff --git a/isofs/Makefile b/isofs/Makefile
index 9147c123..6475c521 100644
--- a/isofs/Makefile
+++ b/isofs/Makefile
@@ -22,7 +22,7 @@ SRCS = inode.c main.c lookup.c pager.c rr.c
OBJS = $(SRCS:.c=.o)
HURDLIBS = diskfs iohelp fshelp store pager ports ihash shouldbeinlibc
-OTHERLIBS = -lpthread -lbz2 -lz
+OTHERLIBS = -lpthread $(and $(HAVE_LIBBZ2),-lbz2) $(and $(HAVE_LIBZ),-lz)
include ../Makeconf
diff --git a/libstore/Makefile b/libstore/Makefile
index 2bb5e4b9..28f56609 100644
--- a/libstore/Makefile
+++ b/libstore/Makefile
@@ -28,35 +28,37 @@ SRCS = create.c derive.c make.c rdwr.c set.c \
open.c xinl.c typed.c map.c url.c unknown.c \
stripe.c $(filter-out ileave.c concat.c,$(store-types:=.c))
-# This has to be evaluated after config.make has been included;
-# as a consequence, using 'ifneq' or similar is not an option.
-maybe_part = $(and $(PARTED_LIBS),part)
-
store-types = \
- bunzip2 \
concat \
copy \
device \
file \
- gunzip \
ileave \
memobj \
module \
mvol \
nbd \
- $(maybe_part) \
remap \
task \
zero
+# This has to be evaluated after config.make has been included;
+# as a consequence, using 'ifneq' or similar is not an option.
+store-types += \
+ $(and $(PARTED_LIBS),part) \
+ $(and $(HAVE_LIBBZ2),bunzip2) \
+ $(and $(HAVE_LIBZ),gunzip) \
+
libstore.so-LDLIBS += $(PARTED_LIBS) -ldl
installhdrs=store.h
HURDLIBS = shouldbeinlibc
-LDLIBS += -lpthread -lbz2 -lz
+LDLIBS += -lpthread $(and $(HAVE_LIBBZ2),-lbz2) $(and $(HAVE_LIBZ),-lz)
GUNZIP_OBJS = do-gunzip.o util.o
BUNZIP2_OBJS = do-bunzip2.o
-OBJS = $(SRCS:.c=.o) $(GUNZIP_OBJS) $(BUNZIP2_OBJS)
+OBJS = $(SRCS:.c=.o) \
+ $(and $(HAVE_LIBZ),$(GUNZIP_OBJS)) \
+ $(and $(HAVE_LIBBZ2),$(BUNZIP2_OBJS))
include ../Makeconf