bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/7] Fix the build system to handle part stores


From: Jeremie Koenig
Subject: [PATCH 1/7] Fix the build system to handle part stores
Date: Mon, 16 Aug 2010 13:51:21 +0200

Part stores are used for debian-installer, and they're considered more
elegant than kernel partition devices. This patch makes sure they're
included in the build unless the user disables them explicitely.

* configure.in: look for libparted again (see also 7c7a04eb).
* Makeconf: add $(PARTED_LIBS) to static binaries which use libstore_part.a.
* libstore/Makefile: include the 'part' store type when appropriate, remove
  the previous attempt.

Signed-off-by: Jeremie Koenig <address@hidden>
---
 Makeconf          |    4 +++-
 configure.in      |   33 +++++++++++++++++++++------------
 libstore/Makefile |   12 ++++++------
 3 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/Makeconf b/Makeconf
index 282437d..8c2bd0c 100644
--- a/Makeconf
+++ b/Makeconf
@@ -325,7 +325,8 @@ $(progtarg): %$(target-suffix): $(BUGADDR)
 $(addsuffix .static,$(progtarg)): %$(target-suffix).static: $(BUGADDR)
        $(link-executable) -static \
              '-Wl,-(' $(patsubst %.so,%.a,$^) $($*-LDLIBS) $(LDLIBS) \
-             '-Wl,-)'
+             '-Wl,-)' \
+             $(and $(filter %/libstore_part.a,$^), $(PARTED_LIBS))
 endif
 
 # Just like above, but tell how to make .prof versions of programs.
@@ -468,6 +469,7 @@ relink:
 # Tell make where to find other -l libraries that we use
 vpath libutil.% $(libdir)/
 
+# The libstore_%.a files fetch symbols from libstore.so
 ifneq ($(dir),libstore)
 $(boot-store-types:%=../libstore/libstore_%.a): ../libstore/libstore.so
 endif
diff --git a/configure.in b/configure.in
index e8c1261..1cf4daa 100644
--- a/configure.in
+++ b/configure.in
@@ -190,9 +190,26 @@ fi
 AC_SUBST(libc_cv_gnu89_inline)
 
 
-AC_ARG_WITH(parted, dnl
-[  --without-parted        don't try to use GNU Parted libraries],
-           , with_parted=yes)
+# Insist on libparted unless the user declines explicitely
+AC_ARG_WITH([parted],
+  [AS_HELP_STRING([--without-parted], [disable user-space partition stores])],
+  [],
+  [with_parted=yes])
+
+PARTED_LIBS=
+AC_DEFUN([PARTED_FAIL], [
+  AC_MSG_FAILURE([Please install required libraries or use --without-parted.])
+])
+AS_IF([test "x$with_parted" != xno], [
+  AC_CHECK_HEADER([parted/parted.h],
+    [AC_DEFINE(HAVE_PARTED_PARTED_H)],
+    [PARTED_FAIL])
+  AC_CHECK_LIB([parted], [ped_device_read], [], [PARTED_FAIL])
+  AC_CHECK_LIB([uuid], [uuid_generate], [], [PARTED_FAIL])
+  AC_CHECK_LIB([dl], [dlopen], [], [PARTED_FAIL])
+  PARTED_LIBS="-lparted -luuid -ldl"
+])
+AC_SUBST([PARTED_LIBS])
 
 AC_ARG_ENABLE(boot-store-types,
 [  --enable-boot-store-types=TYPES...
@@ -200,15 +217,7 @@ AC_ARG_ENABLE(boot-store-types,
                          linked filesystems used for booting])dnl
 if test -z "$enable_boot_store_types"; then
   boot_store_types='device remap gunzip bunzip2'
-
-  # Check for Parted's static store module.
-  if test "x$with_parted" != xno; then
-    save_LDFLAGS="$LDFLAGS"
-    LDFLAGS="$LDFLAGS -static"
-    AC_CHECK_LIB(store_part, store_part_open, [dnl
-                boot_store_types="$boot_store_types part"], , -luuid -lstore)
-    LDFLAGS="$save_LDFLAGS"
-  fi
+  test -z "$PARTED_LIBS" || boot_store_types="$boot_store_types part"
 elif test "x$enable_boot_store_types" = xno; then
   AC_MSG_WARN([you probably wanted --disable-static-progs])
 else
diff --git a/libstore/Makefile b/libstore/Makefile
index b1172c6..56c1fdf 100644
--- a/libstore/Makefile
+++ b/libstore/Makefile
@@ -28,6 +28,10 @@ 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 \
@@ -40,16 +44,12 @@ store-types = \
              module \
              mvol \
              nbd \
+             $(maybe_part) \
              remap \
              task \
              zero
 
-ifeq (HAVE_PARTED,yes)
-store-types += part
-libstore.so-LDLIBS += -lparted
-endif
-
-libstore.so-LDLIBS += -ldl
+libstore.so-LDLIBS += $(PARTED_LIBS) -ldl
 LCLHDRS=store.h
 installhdrs=store.h
 
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]