Skip to contentSkip to conversation

configure update v2

PATCH New Zdenek Kabelac 1 participant 16 messages Mar 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover configure update v2

This patchset tries to mainly address linking problems. First few patches are rather cosmetic cleanups.

Interesting patches starts with: Readline linking update.

With this patchset libpthread, libselinux, libdl, libudev libraries are linked only to objects which really use them.
Tested it on Fedora, Debian and RHEL4 distribution.

configure diff is not part of patch (~0.5MB)

Zdenek Kabelac (15):
Update AC_PREREQ version to 2.61
Help display --disable-fsadm
Fix autoconf WARNING:
Fix usage of $(top_builddir)
Replace just one CFLOW_CMD
Use $() instead of ${} for Makefile variables
Move include before DEFS+=
Introduce LVMINTERNAL_LIBS
Readline linking update
Pthread linking change
Remove -rdynamic
SELinux configure update
Move "-ldl" from LIBS to DL_LIBS
Introduce UDEV_LIBS
Update generated misc/configure.in

 configure.in                                  |  134 ++++++++++++-------------
 daemons/Makefile.in                           |    2 +-
 daemons/clvmd/Makefile.in                     |    5 +-
 daemons/cmirrord/Makefile.in                  |    2 +-
 daemons/dmeventd/Makefile.in                  |    9 +-
 daemons/dmeventd/plugins/Makefile.in          |    2 +-
 daemons/dmeventd/plugins/lvm2/Makefile.in     |    4 +-
 daemons/dmeventd/plugins/mirror/Makefile.in   |    6 +-
 daemons/dmeventd/plugins/snapshot/Makefile.in |    6 +-
 doc/Makefile.in                               |    2 +-
 lib/Makefile.in                               |    4 +-
 lib/format1/Makefile.in                       |    2 +-
 lib/format_pool/Makefile.in                   |    2 +-
 lib/locking/Makefile.in                       |    2 +-
 lib/mirror/Makefile.in                        |    2 +-
 lib/misc/configure.h.in                       |    3 -
 lib/snapshot/Makefile.in                      |    2 +-
 libdm/Makefile.in                             |    4 +-
 liblvm/Makefile.in                            |    4 +-
 make.tmpl.in                                  |   10 ++
 man/Makefile.in                               |    6 +-
 old-tests/device/Makefile.in                  |    4 +-
 old-tests/filters/Makefile.in                 |    6 +-
 old-tests/format1/Makefile.in                 |   22 ++--
 old-tests/mm/Makefile.in                      |    6 +-
 old-tests/regex/Makefile.in                   |   10 +-
 po/Makefile.in                                |    2 +-
 scripts/Makefile.in                           |    2 +-
 test/api/Makefile.in                          |    2 +-
 tools/Makefile.in                             |   31 +++---
 udev/Makefile.in                              |    2 +-
 31 files changed, 149 insertions(+), 151 deletions(-)
#1 lore raw

PATCH 1/15 Update AC_PREREQ version to 2.61

Usage of AC_PROG_SED and AC_PROG_MKDIR_P requires autoconf version 2.61.

---
 configure.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure.in +1 -1
index aaa21c6..9ccde94 100644
@@ -11,7 +11,7 @@
 ## Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ################################################################################
 
-AC_PREREQ(2.57)
+AC_PREREQ(2.61)
 ################################################################################
 dnl -- Process this file with autoconf to produce a configure script.
 AC_INIT
Signature · 1 line
1.7.0
#2 lore raw

PATCH 2/15 Help display --disable-fsadm

In reply to Zdenek Kabelac

As fsadm is installed by default - it's a common practice to rather print help text in '--disable' form for such case.

---
 configure.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
configure.in +2 -2
index 9ccde94..a973590 100644
@@ -737,8 +737,8 @@ AC_ARG_ENABLE(pkgconfig,   [  --enable-pkgconfig      Install pkgconfig support]
 ################################################################################
 dnl -- Enable fsadm
 AC_MSG_CHECKING(whether to install fsadm)
-AC_ARG_ENABLE(fsadm, [  --enable-fsadm          Enable fsadm],
-FSADM=$enableval)
+AC_ARG_ENABLE(fsadm, [AC_HELP_STRING([--disable-fsadm], [Disable fsadm])],
+	FSADM=$enableval)
 AC_MSG_RESULT($FSADM)
 
 ################################################################################
Signature · 1 line
1.7.0
#3 lore raw

PATCH 3/15 Fix autoconf WARNING:

In reply to Zdenek Kabelac

Use datarootdir and fix warning during configure process:
config.status: WARNING: 'make.tmpl.in' seems to ignore the --datarootdir setting

---
 make.tmpl.in |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
make.tmpl.in +1 -0
index 1cba3f2..61365ec 100644
@@ -47,6 +47,7 @@ libdir = $(DESTDIR)@libdir@
 usrlibdir = $(DESTDIR)@usrlibdir@
 sbindir = $(DESTDIR)@sbindir@
 usrsbindir = $(DESTDIR)@usrsbindir@
+datarootdir = $(DESTDIR)@datarootdir@
 infodir = $(DESTDIR)@infodir@
 mandir = $(DESTDIR)@mandir@
 localedir = $(DESTDIR)@LOCALEDIR@
Signature · 1 line
1.7.0
#4 lore raw

PATCH 4/15 Fix usage of $(top_builddir)

In reply to Zdenek Kabelac
---
 daemons/Makefile.in                  |    2 +-
 daemons/clvmd/Makefile.in            |    2 +-
 daemons/cmirrord/Makefile.in         |    2 +-
 daemons/dmeventd/Makefile.in         |    2 +-
 daemons/dmeventd/plugins/Makefile.in |    2 +-
 doc/Makefile.in                      |    2 +-
 lib/Makefile.in                      |    4 ++--
 lib/format1/Makefile.in              |    2 +-
 lib/format_pool/Makefile.in          |    2 +-
 lib/locking/Makefile.in              |    2 +-
 lib/mirror/Makefile.in               |    2 +-
 lib/snapshot/Makefile.in             |    2 +-
 libdm/Makefile.in                    |    2 +-
 liblvm/Makefile.in                   |    2 +-
 man/Makefile.in                      |    2 +-
 old-tests/device/Makefile.in         |    4 ++--
 old-tests/filters/Makefile.in        |    6 +++---
 old-tests/format1/Makefile.in        |   22 +++++++++++-----------
 old-tests/mm/Makefile.in             |    6 +++---
 old-tests/regex/Makefile.in          |   10 +++++-----
 po/Makefile.in                       |    2 +-
 scripts/Makefile.in                  |    2 +-
 tools/Makefile.in                    |    2 +-
 udev/Makefile.in                     |    2 +-
 24 files changed, 44 insertions(+), 44 deletions(-)
daemons/Makefile.in +1 -1
index 92773bb..a0e7268 100644
@@ -30,7 +30,7 @@ ifeq ("@BUILD_DMEVENTD@", "yes")
   SUBDIRS += dmeventd
 endif
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 ifeq ("@BUILD_DMEVENTD@", "yes")
 device-mapper: dmeventd.device-mapper
daemons/clvmd/Makefile.in +1 -1
index dad568e..905f1c9 100644
@@ -86,7 +86,7 @@ LVMLIBS += -ldevmapper
 DEFS += -D_REENTRANT
 CFLAGS += -fno-strict-aliasing
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 INSTALL_TARGETS = \
 	install_clvmd
daemons/cmirrord/Makefile.in +1 -1
index b33aa6a..b8928c7 100644
@@ -25,7 +25,7 @@ SOURCES = clogd.c cluster.c compat.c functions.c link_mon.c local.c logging.c
 
 TARGETS = cmirrord
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 LIBS += -ldevmapper
 LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS)
daemons/dmeventd/Makefile.in +1 -1
index d185205..fc72c21 100644
@@ -48,7 +48,7 @@ ifneq ($(MAKECMDGOALS),device-mapper)
   SUBDIRS+=plugins
 endif
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 all: device-mapper
 device-mapper: $(TARGETS)
daemons/dmeventd/plugins/Makefile.in +1 -1
index 48ae9e9..6b25235 100644
@@ -19,7 +19,7 @@ VPATH = @srcdir@
 
 SUBDIRS += lvm2 mirror snapshot
 
-include ../../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 mirror: lvm2
 snapshot: lvm2
doc/Makefile.in +1 -1
index b4689af..ce66209 100644
@@ -19,7 +19,7 @@ VPATH = @srcdir@
 CONFSRC=example.conf
 CONFDEST=lvm.conf
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 install_lvm2: $(CONFSRC)
 	@if [ ! -e $(confdir)/$(CONFDEST) ]; then \
lib/Makefile.in +2 -2
index 6c29a5e..a2e66f3 100644
@@ -143,7 +143,7 @@ ifeq ("@HAVE_LIBDL@", "yes")
 endif
 
 ifeq ("@DMEVENTD@", "yes")
-  CLDFLAGS += -L../daemons/dmeventd
+  CLDFLAGS += -L$(top_builddir)/daemons/dmeventd
   LIBS += -ldevmapper-event
 endif
 
@@ -152,7 +152,7 @@ LIB_STATIC = $(LIB_NAME).a
 
 CLEAN_TARGETS += $(LIB_NAME).cflow
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 $(SUBDIRS): $(LIB_STATIC)
 
lib/format1/Makefile.in +1 -1
index e12cc6f..f62ab7c 100644
@@ -29,7 +29,7 @@ SOURCES =\
 LIB_SHARED = liblvm2format1.so
 LIB_VERSION = $(LIB_VERSION_LVM)
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 install: liblvm2format1.so
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
lib/format_pool/Makefile.in +1 -1
index d67c982..b0ebc36 100644
@@ -26,7 +26,7 @@ SOURCES =\
 LIB_SHARED = liblvm2formatpool.so
 LIB_VERSION = $(LIB_VERSION_LVM)
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 install: liblvm2formatpool.so
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
lib/locking/Makefile.in +1 -1
index 584c8d6..399b0af 100644
@@ -22,7 +22,7 @@ SOURCES = cluster_locking.c
 LIB_SHARED = liblvm2clusterlock.so
 LIB_VERSION = $(LIB_VERSION_LVM)
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 install install_cluster: liblvm2clusterlock.so
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
lib/mirror/Makefile.in +1 -1
index d5b678b..038399a 100644
@@ -22,7 +22,7 @@ SOURCES = mirrored.c
 LIB_SHARED = liblvm2mirror.so
 LIB_VERSION = $(LIB_VERSION_LVM)
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 install: liblvm2mirror.so
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
lib/snapshot/Makefile.in +1 -1
index 3f960fb..80728c7 100644
@@ -22,7 +22,7 @@ SOURCES = snapshot.c
 LIB_SHARED = liblvm2snapshot.so
 LIB_VERSION = $(LIB_VERSION_LVM)
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 install: liblvm2snapshot.so
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
libdm/Makefile.in +1 -1
index 6dd25ff..ce3e058 100644
@@ -50,7 +50,7 @@ LIB_VERSION = $(LIB_VERSION_DM)
 DEFS += -DDM_DEVICE_UID=@DM_DEVICE_UID@ -DDM_DEVICE_GID=@DM_DEVICE_GID@ \
 	-DDM_DEVICE_MODE=@DM_DEVICE_MODE@
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 device-mapper: all
 
liblvm/Makefile.in +1 -1
index 5e6dfd4..25906e1 100644
@@ -40,7 +40,7 @@ endif
 
 CLEAN_TARGETS += liblvm.cflow
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 LIBS += -ldevmapper -llvm-internal
 
man/Makefile.in +1 -1
index dfe95e6..f49d4c8 100644
@@ -48,7 +48,7 @@ MAN8DIR=${mandir}/man8
 
 CLEAN_TARGETS=$(MAN5) $(MAN8) $(MAN8CLUSTER) $(FSADMMAN) $(MAN8DM)
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 ifneq ("@CLVMD@", "none")
   install: install_cluster
old-tests/device/Makefile.in +2 -2
index 4bf15a9..5c9479e 100644
@@ -22,8 +22,8 @@ SOURCES=\
 
 TARGETS=dev_cache_t
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 dev_cache_t: dev_cache_t.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o dev_cache_t dev_cache_t.o -L$(top_srcdir)/lib -llvm
+	$(CC) -o dev_cache_t dev_cache_t.o -L$(top_builddir)/lib -llvm
 
old-tests/filters/Makefile.in +3 -3
index 01de934..62e13c0 100644
@@ -25,11 +25,11 @@ TARGETS=\
 	rfilter_t \
 	pfilter_t
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 rfilter_t: rfilter_t.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o rfilter_t rfilter_t.o -L$(top_srcdir)/lib -llvm
+	$(CC) -o rfilter_t rfilter_t.o -L$(top_builddir)/lib -llvm
 
 pfilter_t: pfilter_t.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o pfilter_t pfilter_t.o -L$(top_srcdir)/lib -llvm
+	$(CC) -o pfilter_t pfilter_t.o -L$(top_builddir)/lib -llvm
 
old-tests/format1/Makefile.in +11 -11
index 1ccb56d..b82e065 100644
@@ -32,21 +32,21 @@ TARGETS=\
 	read_pv_t \
 	get_vgs_t
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
-read_vg_t: read_vg_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o read_vg_t read_vg_t.o pretty_print.o -L$(top_srcdir)/lib -llvm
+read_vg_t: read_vg_t.o pretty_print.o $(top_builddir)/lib/liblvm.a
+	$(CC) -o read_vg_t read_vg_t.o pretty_print.o -L$(top_builddir)/lib -llvm
 
-write_vg_t: write_vg_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
+write_vg_t: write_vg_t.o pretty_print.o $(top_builddir)/lib/liblvm.a
 	$(CC) -o write_vg_t write_vg_t.o pretty_print.o \
-	-L$(top_srcdir)/lib -llvm
+	-L$(top_builddir)/lib -llvm
 
-get_pvs_t: get_pvs_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o get_pvs_t get_pvs_t.o pretty_print.o -L$(top_srcdir)/lib -llvm
+get_pvs_t: get_pvs_t.o pretty_print.o $(top_builddir)/lib/liblvm.a
+	$(CC) -o get_pvs_t get_pvs_t.o pretty_print.o -L$(top_builddir)/lib -llvm
 
-read_pv_t: read_pv_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o read_pv_t read_pv_t.o pretty_print.o -L$(top_srcdir)/lib -llvm
+read_pv_t: read_pv_t.o pretty_print.o $(top_builddir)/lib/liblvm.a
+	$(CC) -o read_pv_t read_pv_t.o pretty_print.o -L$(top_builddir)/lib -llvm
 
-get_vgs_t: get_vgs_t.o pretty_print.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o get_vgs_t get_vgs_t.o pretty_print.o -L$(top_srcdir)/lib -llvm
+get_vgs_t: get_vgs_t.o pretty_print.o $(top_builddir)/lib/liblvm.a
+	$(CC) -o get_vgs_t get_vgs_t.o pretty_print.o -L$(top_builddir)/lib -llvm
 
old-tests/mm/Makefile.in +3 -3
index 997f0d3..62c341f 100644
@@ -22,12 +22,12 @@ SOURCES=\
 
 TARGETS=dbg_malloc_t
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
 dbg_malloc_t: dbg_malloc_t.o
 	$(CC) $(CFLAGS) -o dbg_malloc_t dbg_malloc_t.o \
-		-L$(top_srcdir)/lib -llvm
+		-L$(top_builddir)/lib -llvm
 
 pool_t: pool_t.o
-	$(CC) $(CFLAGS) -o pool_t pool_t.o -L$(top_srcdir)/lib -llvm
+	$(CC) $(CFLAGS) -o pool_t pool_t.o -L$(top_builddir)/lib -llvm
 
old-tests/regex/Makefile.in +5 -5
index 28783ae..7696c48 100644
@@ -25,11 +25,11 @@ TARGETS=\
 	parse_t \
 	matcher_t
 
-include ../../make.tmpl
+include $(top_builddir)/make.tmpl
 
-parse_t: parse_t.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o parse_t parse_t.o -L$(top_srcdir)/lib -llvm
+parse_t: parse_t.o $(top_builddir)/lib/liblvm.a
+	$(CC) -o parse_t parse_t.o -L$(top_builddir)/lib -llvm
 
-matcher_t: matcher_t.o $(top_srcdir)/lib/liblvm.a
-	$(CC) -o matcher_t matcher_t.o -L$(top_srcdir)/lib -llvm
+matcher_t: matcher_t.o $(top_builddir)/lib/liblvm.a
+	$(CC) -o matcher_t matcher_t.o -L$(top_builddir)/lib -llvm
 
po/Makefile.in +1 -1
index c9f8400..22184f1 100644
@@ -25,7 +25,7 @@ DM_POSOURCES = $(top_srcdir)/dmsetup/*.pot $(top_srcdir)/libdm/*.pot \
 
 LVM_POSOURCES = $(top_srcdir)/tools/*.pot $(top_srcdir)/lib/*/*.pot
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 lvm2.po: Makefile $(LVM_POSOURCES)
 	@echo Compiling string table
scripts/Makefile.in +1 -1
index 867f0ee..b79d312 100644
@@ -16,7 +16,7 @@ top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 VPATH = @srcdir@
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 install:
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(srcdir)/lvm_dump.sh \
tools/Makefile.in +1 -1
index b650c67..880ea89 100644
@@ -107,7 +107,7 @@ LVMLIBS += -ldevmapper
 
 DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 device-mapper: $(TARGETS_DM)
 
udev/Makefile.in +1 -1
index 0a0050a..d4006b9 100644
@@ -22,7 +22,7 @@ DM_DIR=$(shell grep "\#define DM_DIR" $(top_srcdir)/libdm/misc/dm-ioctl.h | awk
 
 CLEAN_TARGETS=10-dm.rules
 
-include ../make.tmpl
+include $(top_builddir)/make.tmpl
 
 %: %.in
 	$(SED) -e "s/(DM_DIR)/$(DM_DIR)/" $< >$@
Signature · 1 line
1.7.0
#5 lore raw

PATCH 5/15 Replace just one CFLOW_CMD

In reply to Zdenek Kabelac

Replace CFLOW_CMD only in make.tmpl and use it as variable elsewhere.

---
 make.tmpl.in      |    1 +
 tools/Makefile.in |   12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)
make.tmpl.in +1 -0
index 61365ec..5b8476f 100644
@@ -27,6 +27,7 @@ LCOV = @LCOV@
 GENHTML = @GENHTML@
 LN_S = @LN_S@
 SED = @SED@
+CFLOW_CMD = @CFLOW_CMD@
 
 LIBS = @LIBS@
 DEFS += @DEFS@
tools/Makefile.in +6 -6
index 880ea89..41c20db 100644
@@ -147,20 +147,20 @@ liblvm2cmd.$(LIB_SUFFIX): liblvm2cmd.a $(LDDEPS)
 .PHONY: install_cmdlib_dynamic install_cmdlib_static \
 	install_tools_dynamic install_tools_static
 
-ifneq ("@CFLOW_CMD@", "")
+ifneq ("$(CFLOW_CMD)", "")
 CFLOW_FLAGS += --cpp="$(CC) -E"
 .PHONY: lvm.cflow
 -include $(top_srcdir)/lib/liblvm-internal.cflow
 lvm.cflow: $(SOURCES)
-	@CFLOW_CMD@ -o$@ $(CFLOW_FLAGS) $(INCLUDES) $(DEFS) $(SOURCES)
+	$(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) $(INCLUDES) $(DEFS) $(SOURCES)
 lvm.rxref: $(SOURCES)
-	@CFLOW_CMD@ -o$@ --cpp="$(CC) -E" -r --omit-arguments -x $(INCLUDES) $(DEFS) $(SOURCES)
+	$(CFLOW_CMD) -o$@ --cpp="$(CC) -E" -r --omit-arguments -x $(INCLUDES) $(DEFS) $(SOURCES)
 lvm.xref: $(SOURCES)
-	@CFLOW_CMD@ -o$@ --cpp="$(CC) -E" --omit-arguments -x $(INCLUDES) $(DEFS) $(SOURCES)
+	$(CFLOW_CMD) -o$@ --cpp="$(CC) -E" --omit-arguments -x $(INCLUDES) $(DEFS) $(SOURCES)
 lvm.rtree: $(SOURCES)
-	@CFLOW_CMD@ -o$@ --cpp="$(CC) -E" -r --omit-arguments -T -b $(INCLUDES) $(DEFS) $(SOURCES)
+	$(CFLOW_CMD) -o$@ --cpp="$(CC) -E" -r --omit-arguments -T -b $(INCLUDES) $(DEFS) $(SOURCES)
 lvm.tree: $(SOURCES)
-	@CFLOW_CMD@ -o$@ --cpp="$(CC) -E" --omit-arguments -T -b $(INCLUDES) $(DEFS) $(SOURCES)
+	$(CFLOW_CMD) -o$@ --cpp="$(CC) -E" --omit-arguments -T -b $(INCLUDES) $(DEFS) $(SOURCES)
 cflow: lvm.cflow lvm.xref lvm.tree lvm.rtree lvm.rxref
 endif
 
Signature · 1 line
1.7.0
#6 lore raw

PATCH 6/15 Use $() instead of ${} for Makefile variables

In reply to Zdenek Kabelac

Both usage forms are correct, but we should use one them consistenly through all Makefiles.

---
 daemons/dmeventd/plugins/lvm2/Makefile.in     |    2 +-
 daemons/dmeventd/plugins/mirror/Makefile.in   |    4 ++--
 daemons/dmeventd/plugins/snapshot/Makefile.in |    4 ++--
 man/Makefile.in                               |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
daemons/dmeventd/plugins/lvm2/Makefile.in +1 -1
index 96c60e0..af6807b 100644
@@ -16,7 +16,7 @@ top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 VPATH = @srcdir@
 
-CLDFLAGS += -L${top_builddir}/tools
+CLDFLAGS += -L$(top_builddir)/tools
 
 SOURCES = dmeventd_lvm.c
 
daemons/dmeventd/plugins/mirror/Makefile.in +2 -2
index a6af47f..bdb49d1 100644
@@ -17,8 +17,8 @@ top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 VPATH = @srcdir@
 
-INCLUDES += -I${top_srcdir}/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
-CLDFLAGS += -L${top_builddir}/tools -L${top_builddir}/daemons/dmeventd/plugins/lvm2
+INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
+CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
 
 SOURCES = dmeventd_mirror.c
 
daemons/dmeventd/plugins/snapshot/Makefile.in +2 -2
index 133459d..4b203a0 100644
@@ -17,8 +17,8 @@ top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 VPATH = @srcdir@
 
-INCLUDES += -I${top_srcdir}/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
-CLDFLAGS += -L${top_builddir}/tools -L${top_builddir}/daemons/dmeventd/plugins/lvm2
+INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
+CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
 
 SOURCES = dmeventd_snapshot.c
 
man/Makefile.in +2 -2
index f49d4c8..332f07f 100644
@@ -43,8 +43,8 @@ ifeq ("@BUILD_CMIRRORD@", "yes")
 endif
 
 MAN8DM=dmsetup.8
-MAN5DIR=${mandir}/man5
-MAN8DIR=${mandir}/man8
+MAN5DIR=$(mandir)/man5
+MAN8DIR=$(mandir)/man8
 
 CLEAN_TARGETS=$(MAN5) $(MAN8) $(MAN8CLUSTER) $(FSADMMAN) $(MAN8DM)
 
Signature · 1 line
1.7.0
#7 lore raw

PATCH 7/15 Move include before DEFS+=

In reply to Zdenek Kabelac

This patch moves inclusion of the make.tmpl before DEFS modification, so it goes in the same order on the compilation line. (i.e. HAVE_CONFIG_H goes first)

---
 libdm/Makefile.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
libdm/Makefile.in +2 -2
index ce3e058..6ff3bff 100644
@@ -47,11 +47,11 @@ endif
 VERSIONED_SHLIB = libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM)
 LIB_VERSION = $(LIB_VERSION_DM)
 
+include $(top_builddir)/make.tmpl
+
 DEFS += -DDM_DEVICE_UID=@DM_DEVICE_UID@ -DDM_DEVICE_GID=@DM_DEVICE_GID@ \
 	-DDM_DEVICE_MODE=@DM_DEVICE_MODE@
 
-include $(top_builddir)/make.tmpl
-
 device-mapper: all
 
 .PHONY: install_dynamic install_static install_include \
Signature · 1 line
1.7.0
#8 lore raw

PATCH 8/15 Introduce LVMINTERNAL_LIBS

In reply to Zdenek Kabelac

Keep dependency libraries for liblvm-internal in one place.

---
 daemons/clvmd/Makefile.in |    2 +-
 liblvm/Makefile.in        |    2 +-
 make.tmpl.in              |    1 +
 tools/Makefile.in         |    2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)
daemons/clvmd/Makefile.in +1 -1
index 905f1c9..40d1da4 100644
@@ -75,7 +75,7 @@ endif
 TARGETS = \
 	clvmd
 
-LVMLIBS = -llvm-internal -lpthread
+LVMLIBS = $(LVMINTERNAL_LIBS) -lpthread
 
 ifeq ("@DMEVENTD@", "yes")
 	LVMLIBS += -ldevmapper-event
liblvm/Makefile.in +1 -1
index 25906e1..1b2b474 100644
@@ -42,7 +42,7 @@ CLEAN_TARGETS += liblvm.cflow
 
 include $(top_builddir)/make.tmpl
 
-LIBS += -ldevmapper -llvm-internal
+LIBS += $(LVMINTERNAL_LIBS) -ldevmapper
 
 ifeq ("@DMEVENTD@", "yes")
   LIBS += -ldevmapper-event
make.tmpl.in +1 -0
index 5b8476f..4b3ac17 100644
@@ -36,6 +36,7 @@ CLDFLAGS += @CLDFLAGS@
 LDDEPS += @LDDEPS@
 LDFLAGS += @LDFLAGS@
 LIB_SUFFIX = @LIB_SUFFIX@
+LVMINTERNAL_LIBS = -llvm-internal
 
 # Setup directory variables
 prefix = @prefix@
tools/Makefile.in +1 -1
index 41c20db..efdf699 100644
@@ -86,7 +86,7 @@ ifeq ("@STATIC_LINK@", "yes")
   INSTALL_CMDLIB_TARGETS += install_cmdlib_static
 endif
 
-LVMLIBS = -llvm-internal
+LVMLIBS = $(LVMINTERNAL_LIBS)
 LIB_VERSION = $(LIB_VERSION_LVM)
 
 CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) liblvm2cmd.a liblvm2cmd-static.a lvm lvm.o \
Signature · 1 line
1.7.0
#9 lore raw

PATCH 9/15 Readline linking update

In reply to Zdenek Kabelac

Modify linking of readline library. Create new substituted varible READLINE_LIBS - readline library is linked ONLY with tools that really use it - i.e. lvm. (Static lvm does not use readlin).
Previous behaviour put this library into the variable LIBS and thus linked it with all created object files of lvm project (i.e. plugins...).

READLINE detection is simplified.
AC_SEARCH_LIBS needs to save/restore LIBS

Extra checking for termcap should not be really needed as the readline library should have the proper dependencies compiled into the library. Do we have some cases where we have to figure and link this termcap library explicitly?

---
 configure.in      |   65 ++++++++++++++++++++++++++++------------------------
 make.tmpl.in      |    1 +
 tools/Makefile.in |    2 +-
 3 files changed, 37 insertions(+), 31 deletions(-)
configure.in +35 -30
index a973590..aeac331 100644
@@ -788,24 +788,6 @@ if [[ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ]];
 fi;
 
 ################################################################################
-dnl -- Check for termcap (Shamelessly copied from parted 1.4.17)
-if test x$READLINE != xno; then
-	AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses termcap termlib],
-	  [tg_found=yes], [tg_found=no])
-	test x$READLINE:$tg_found = xyes:no &&
-	  AC_MSG_ERROR(
-termcap could not be found which is required for the
---enable-readline option (which is enabled by default).  Either disable readline
-support with --disable-readline or download and install termcap from:
-	ftp.gnu.org/gnu/termcap
-Note: if you are using precompiled packages you will also need the development
-  package as well (which may be called termcap-devel or something similar).
-Note: (n)curses also seems to work as a substitute for termcap.  This was
-  not found either - but you could try installing that as well.
-)
-fi
-
-################################################################################
 dnl -- Check for dlopen
 AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no)
 
@@ -887,22 +869,44 @@ AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getop
 ################################################################################
 dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
 if test x$READLINE != xno; then
-	rl_found=yes
-	AC_CHECK_LIB([readline], [readline], , [rl_found=no])
-	test x$READLINE:$rl_found = xyes:no &&
-	  AC_MSG_ERROR(
-GNU Readline could not be found which is required for the
+	lvm_saved_libs=$LIBS
+	AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses termcap termlib],
+		READLINE_LIBS=$ac_cv_search_tgetent, [
+		if test "$READLINE" = yes; then
+			AC_MSG_ERROR(
+[termcap could not be found which is required for the
+--enable-readline option (which is enabled by default).  Either disable readline
+support with --disable-readline or download and install termcap from:
+	ftp.gnu.org/gnu/termcap
+Note: if you are using precompiled packages you will also need the development
+  package as well (which may be called termcap-devel or something similar).
+Note: (n)curses also seems to work as a substitute for termcap.  This was
+  not found either - but you could try installing that as well.])
+		fi])
+	dnl -- Old systems may need extra termcap dependency explicitly in LIBS
+	AC_CHECK_LIB([readline], [readline], [
+		AC_DEFINE([READLINE_SUPPORT], 1,
+			[Define to 1 to include the LVM readline shell.])
+		dnl -- Try only with -lreadline and check for different symbol
+		LIBS=$lvm_saved_libs
+		AC_CHECK_LIB([readline], [rl_line_buffer],
+			[ READLINE_LIBS="-lreadline" ], [
+			  AC_MSG_RESULT([linking -lreadline with $READLINE_LIBS needed])
+			  READLINE_LIBS="-lreadline $READLINE_LIBS"
+			]) ], [
+		READLINE_LIBS=
+		if test "$READLINE" = yes; then
+			AC_MSG_ERROR(
+[GNU Readline could not be found which is required for the
 --enable-readline option (which is enabled by default).  Either disable readline
 support with --disable-readline or download and install readline from:
 	ftp.gnu.org/gnu/readline
 Note: if you are using precompiled packages you will also need the development
-package as well (which may be called readline-devel or something similar).
-)
-	if test $rl_found = yes; then
-		AC_CHECK_FUNCS([rl_completion_matches])
-		AC_DEFINE([READLINE_SUPPORT], 1,
-		  [Define to 1 to include the LVM readline shell.])
-	fi
+package as well (which may be called readline-devel or something similar).])
+		fi ])
+	LIBS="$READLINE_LIBS $lvm_saved_libs"
+	AC_CHECK_FUNCS([rl_completion_matches])
+	LIBS=$lvm_saved_libs
 fi
 
 ################################################################################
@@ -1123,6 +1127,7 @@ AC_SUBST(PKGCONFIG)
 AC_SUBST(POOL)
 AC_SUBST(QUORUM_CFLAGS)
 AC_SUBST(QUORUM_LIBS)
+AC_SUBST(READLINE_LIBS)
 AC_SUBST(SACKPT_CFLAGS)
 AC_SUBST(SACKPT_LIBS)
 AC_SUBST(SALCK_CFLAGS)
make.tmpl.in +1 -0
index 4b3ac17..88be259 100644
@@ -37,6 +37,7 @@ LDDEPS += @LDDEPS@
 LDFLAGS += @LDFLAGS@
 LIB_SUFFIX = @LIB_SUFFIX@
 LVMINTERNAL_LIBS = -llvm-internal
+READLINE_LIBS = @READLINE_LIBS@
 
 # Setup directory variables
 prefix = @prefix@
tools/Makefile.in +1 -1
index efdf699..236fb4e 100644
@@ -123,7 +123,7 @@ all: device-mapper
 
 lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) lvm.o \
-		$(LVMLIBS) $(LIBS) $(LIB_PTHREAD) -rdynamic
+		$(LVMLIBS) $(READLINE_LIBS) $(LIBS) $(LIB_PTHREAD) -rdynamic
 
 lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a  $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
Signature · 1 line
1.7.0
#10 lore raw

PATCH 10/15 Pthread linking change

In reply to Zdenek Kabelac

Create new substituted variable PTHREAD_LIBS and link this library only with tools/libs which really needs it - i.e. dmeventd.

Check for libpthread only for builds with clvmd or dmeventd.

Remove variable LIB_PTHREAD

---
 configure.in                                  |    8 +++++++-
 daemons/clvmd/Makefile.in                     |    3 ++-
 daemons/dmeventd/Makefile.in                  |    2 +-
 daemons/dmeventd/plugins/lvm2/Makefile.in     |    2 +-
 daemons/dmeventd/plugins/mirror/Makefile.in   |    2 +-
 daemons/dmeventd/plugins/snapshot/Makefile.in |    2 +-
 make.tmpl.in                                  |    1 +
 test/api/Makefile.in                          |    2 +-
 tools/Makefile.in                             |   12 +++++-------
 9 files changed, 20 insertions(+), 14 deletions(-)
configure.in +7 -1
index aeac331..42e4235 100644
@@ -809,6 +809,12 @@ Features cannot be 'shared' when building statically
 fi
 
 ################################################################################
+if [[ "$DMEVENTD" = yes -o "$CLVMD" != none ]] ; then
+	AC_CHECK_LIB([pthread], [pthread_mutex_lock],
+		[PTHREAD_LIBS="-lpthread"], hard_bailout)
+fi
+
+################################################################################
 dnl -- Disable selinux
 AC_MSG_CHECKING(whether to enable selinux support)
 AC_ARG_ENABLE(selinux, [  --disable-selinux       Disable selinux support],
@@ -1125,6 +1131,7 @@ AC_SUBST(MSGFMT)
 AC_SUBST(OWNER)
 AC_SUBST(PKGCONFIG)
 AC_SUBST(POOL)
+AC_SUBST(PTHREAD_LIBS)
 AC_SUBST(QUORUM_CFLAGS)
 AC_SUBST(QUORUM_LIBS)
 AC_SUBST(READLINE_LIBS)
@@ -1138,7 +1145,6 @@ AC_SUBST(STATICDIR)
 AC_SUBST(STATIC_LINK)
 AC_SUBST(UDEV_RULES)
 AC_SUBST(UDEV_SYNC)
-AC_SUBST([LIB_PTHREAD])
 AC_SUBST(interface)
 AC_SUBST(kerneldir)
 AC_SUBST(missingkernel)
daemons/clvmd/Makefile.in +2 -1
index 40d1da4..16ba0b8 100644
@@ -75,13 +75,14 @@ endif
 TARGETS = \
 	clvmd
 
-LVMLIBS = $(LVMINTERNAL_LIBS) -lpthread
+LVMLIBS = $(LVMINTERNAL_LIBS)
 
 ifeq ("@DMEVENTD@", "yes")
 	LVMLIBS += -ldevmapper-event
 endif
  
 LVMLIBS += -ldevmapper
+LIBS += $(PTHREAD_LIBS)
 
 DEFS += -D_REENTRANT
 CFLAGS += -fno-strict-aliasing
daemons/dmeventd/Makefile.in +1 -1
index fc72c21..aa20453 100644
@@ -54,7 +54,7 @@ all: device-mapper
 device-mapper: $(TARGETS)
 
 LIBS += -ldl
-LVMLIBS += -ldevmapper-event -lpthread -ldevmapper
+LVMLIBS += -ldevmapper-event -ldevmapper $(PTHREAD_LIBS)
 
 $(VERSIONED_SHLIB): $(LIB_SHARED)
 	$(RM) -f $@
daemons/dmeventd/plugins/lvm2/Makefile.in +1 -1
index af6807b..0f23c84 100644
@@ -29,7 +29,7 @@ LIB_VERSION = $(LIB_VERSION_LVM)
 
 include $(top_builddir)/make.tmpl
 
-LIBS += -ldevmapper @LIB_PTHREAD@ @LVM2CMD_LIB@
+LIBS += @LVM2CMD_LIB@ -ldevmapper $(PTHREAD_LIBS)
 
 install_lvm2: libdevmapper-event-lvm2.$(LIB_SUFFIX)
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
daemons/dmeventd/plugins/mirror/Makefile.in +1 -1
index bdb49d1..bd85a6f 100644
@@ -32,7 +32,7 @@ LIB_VERSION = $(LIB_VERSION_LVM)
 
 include $(top_builddir)/make.tmpl
 
-LIBS += -ldevmapper @LIB_PTHREAD@ @LVM2CMD_LIB@ -ldevmapper-event-lvm2
+LIBS += @LVM2CMD_LIB@ -ldevmapper-event-lvm2 -ldevmapper $(PTHREAD_LIBS)
 
 install_lvm2: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
daemons/dmeventd/plugins/snapshot/Makefile.in +1 -1
index 4b203a0..793fd38 100644
@@ -32,7 +32,7 @@ LIB_VERSION = $(LIB_VERSION_LVM)
 
 include $(top_builddir)/make.tmpl
 
-LIBS += -ldevmapper @LIB_PTHREAD@ @LVM2CMD_LIB@ -ldevmapper-event-lvm2
+LIBS += @LVM2CMD_LIB@ -ldevmapper-event-lvm2 -ldevmapper $(PTHREAD_LIBS)
 
 install_lvm2: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX)
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
make.tmpl.in +1 -0
index 88be259..9def16d 100644
@@ -37,6 +37,7 @@ LDDEPS += @LDDEPS@
 LDFLAGS += @LDFLAGS@
 LIB_SUFFIX = @LIB_SUFFIX@
 LVMINTERNAL_LIBS = -llvm-internal
+PTHREAD_LIBS = @PTHREAD_LIBS@
 READLINE_LIBS = @READLINE_LIBS@
 
 # Setup directory variables
test/api/Makefile.in +1 -1
index 2c0c62f..605da33 100644
@@ -35,7 +35,7 @@ include $(top_builddir)/make.tmpl
 LDFLAGS = -L$(top_builddir)/libdm -L$(top_builddir)/liblvm
 
 ifeq ("@DMEVENTD@", "yes")
-	LVMLIBS += -ldevmapper-event -lpthread
+	LVMLIBS += -ldevmapper-event
 	LDFLAGS += -L$(top_builddir)/daemons/dmeventd
 endif
 
tools/Makefile.in +5 -7
index 236fb4e..a590d61 100644
@@ -17,8 +17,6 @@ top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 VPATH = @srcdir@
 
-LIB_PTHREAD = @LIB_PTHREAD@
-
 SOURCES =\
 	dumpconfig.c \
 	formats.c \
@@ -100,7 +98,7 @@ ifeq ("@CMDLIB@", "yes")
 endif
 
 ifeq ("@DMEVENTD@", "yes")
-	LVMLIBS += -ldevmapper-event -lpthread
+	LVMLIBS += -ldevmapper-event
 endif
 
 LVMLIBS += -ldevmapper
@@ -113,21 +111,21 @@ device-mapper: $(TARGETS_DM)
 
 dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
 	$(CC) $(CFLAGS) $(LDFLAGS) -L$(top_builddir)/libdm \
-	      -o $@ dmsetup.o -ldevmapper $(LIBS) $(LIB_PTHREAD)
+	      -o $@ dmsetup.o -ldevmapper $(LIBS)
 
 dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
-	      -o $@ dmsetup.o -ldevmapper $(LIBS) $(LIB_PTHREAD)
+	      -o $@ dmsetup.o -ldevmapper $(LIBS)
 
 all: device-mapper
 
 lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) lvm.o \
-		$(LVMLIBS) $(READLINE_LIBS) $(LIBS) $(LIB_PTHREAD) -rdynamic
+		$(LVMLIBS) $(READLINE_LIBS) $(LIBS) -rdynamic
 
 lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a  $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
-	      $(OBJECTS) lvm-static.o $(LVMLIBS) $(LIBS) $(LIB_PTHREAD) \
+	      $(OBJECTS) lvm-static.o $(LVMLIBS) $(LIBS) \
 	      -rdynamic
 
 liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
Signature · 1 line
1.7.0
#11 lore raw

PATCH 11/15 Remove -rdynamic

In reply to Zdenek Kabelac

This patch might be a bit contraversional. It removes -rdynamic from linking of lvm.static and dmeventd.static. In my understanding this compiler flag (or "-Wl,--export-dynamic") is mainly useful for dynamicaly linked libraries. It should not be needed for linking of static binary.

---
 daemons/dmeventd/Makefile.in |    2 +-
 tools/Makefile.in            |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
daemons/dmeventd/Makefile.in +1 -1
index aa20453..84514f0 100644
@@ -66,7 +66,7 @@ dmeventd: $(LIB_SHARED) $(VERSIONED_SHLIB) dmeventd.o
 
 dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
-	dmeventd.o $(LVMLIBS) $(LIBS) -rdynamic
+	dmeventd.o $(LVMLIBS) $(LIBS)
 
 ifeq ("@PKGCONFIG@", "yes")
   INSTALL_LIB_TARGETS += install_pkgconfig
tools/Makefile.in +1 -2
index a590d61..b3b0b29 100644
@@ -125,8 +125,7 @@ lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
 
 lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a  $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
-	      $(OBJECTS) lvm-static.o $(LVMLIBS) $(LIBS) \
-	      -rdynamic
+	      $(OBJECTS) lvm-static.o $(LVMLIBS) $(LIBS)
 
 liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
 	cat $(top_builddir)/lib/liblvm-internal.a > $@
Signature · 1 line
1.7.0
#12 lore raw

PATCH 12/15 SELinux configure update

In reply to Zdenek Kabelac

This patch add substituted variables SELINUX_LIBS and STATIC_LIBS.

Here we have little trouble for static builds - there is the dependency on SELinux libraries which are not bundled automagicaly to 'ar' library files. So statically compiled binaries that links with libdevmapper needs to explicitly link $(STATIC_LIBS)
(until better solution is found).
Also it looks like some static builds of selinux have dependencies on runtime glibc libraries.

Modifies SELinux detection to use 3rd & 4th parameter for Success/Fail. Also removes detection of pthread from this check as we know which version of libdevmapper we are going to link with lvm after merge.

Move SELinux header check to the SELinux test code.

---
 configure.in                 |   38 ++++++++------------------------------
 daemons/dmeventd/Makefile.in |    2 +-
 libdm/Makefile.in            |    2 ++
 make.tmpl.in                 |    3 +++
 tools/Makefile.in            |    4 ++--
 5 files changed, 16 insertions(+), 33 deletions(-)
configure.in +8 -30
index 42e4235..b985c98 100644
@@ -824,35 +824,18 @@ AC_MSG_RESULT($SELINUX)
 ################################################################################
 dnl -- Check for selinux
 if test x$SELINUX = xyes; then
-	AC_CHECK_LIB(sepol, sepol_check_context, HAVE_SEPOL=yes, HAVE_SEPOL=no)
+	AC_CHECK_LIB([sepol], [sepol_check_context], [
+		AC_DEFINE([HAVE_SEPOL], 1, [Define to 1 if sepol_check_context is available.])
+		SELINUX_LIBS="-lsepol"])
 
-	if test x$HAVE_SEPOL = xyes; then
-		AC_DEFINE([HAVE_SEPOL], 1,
-		  [Define to 1 if sepol_check_context is available.])
-		SELINUX_LIBS="-lsepol $SELINUX_LIBS"
-	fi
-
-	AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no)
-
-	if test x$HAVE_SELINUX = xyes; then
+	AC_CHECK_LIB([selinux], [is_selinux_enabled], [
+		AC_CHECK_HEADERS([selinux/selinux.h],, hard_bailout)
 		AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
 		SELINUX_LIBS="-lselinux $SELINUX_LIBS"
-	else
+		HAVE_SELINUX=yes ], [
 		AC_MSG_WARN(Disabling selinux)
-	fi
-	LIBS="$SELINUX_LIBS $LIBS"
-
-	# With --enable-static_link and selinux enabled, linking
-	# fails on at least Debian unstable due to unsatisfied references
-	# to pthread_mutex_lock and _unlock.  See if we need -lpthread.
-	if test "$STATIC_LINK-$HAVE_SELINUX" = yes-yes; then
-		lvm_saved_libs=$LIBS
-		LIBS="$LIBS -static"
-		AC_SEARCH_LIBS([pthread_mutex_lock], [pthread],
-		  [test "$ac_cv_search_pthread_mutex_lock" = "none required" ||
-				LIB_PTHREAD=-lpthread])
-		LIBS=$lvm_saved_libs
-	fi
+		SELINUX_LIBS=
+		HAVE_SELINUX=no ])
 fi
 
 ################################################################################
@@ -997,10 +980,6 @@ if test x$INTL = xyes; then
 	AC_CHECK_HEADERS(libintl.h,,AC_MSG_ERROR(bailing out))
 fi
 
-if test x$HAVE_SELINUX = xyes; then
-	AC_CHECK_HEADERS(selinux/selinux.h,,AC_MSG_ERROR(bailing out))
-fi
-
 if test x$UDEV_SYNC = xyes; then
 	AC_CHECK_HEADERS(sys/ipc.h sys/sem.h,,AC_MSG_ERROR(bailing out))
 fi
@@ -1109,7 +1088,6 @@ AC_SUBST(GULM_CFLAGS)
 AC_SUBST(GULM_LIBS)
 AC_SUBST(HAVE_LIBDL)
 AC_SUBST(HAVE_REALTIME)
-AC_SUBST(HAVE_SELINUX)
 AC_SUBST(INTL)
 AC_SUBST(INTL_PACKAGE)
 AC_SUBST(JOBS)
daemons/dmeventd/Makefile.in +1 -1
index 84514f0..df223ef 100644
@@ -66,7 +66,7 @@ dmeventd: $(LIB_SHARED) $(VERSIONED_SHLIB) dmeventd.o
 
 dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
-	dmeventd.o $(LVMLIBS) $(LIBS)
+	dmeventd.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
 
 ifeq ("@PKGCONFIG@", "yes")
   INSTALL_LIB_TARGETS += install_pkgconfig
libdm/Makefile.in +2 -0
index 6ff3bff..7ea0604 100644
@@ -52,6 +52,8 @@ include $(top_builddir)/make.tmpl
 DEFS += -DDM_DEVICE_UID=@DM_DEVICE_UID@ -DDM_DEVICE_GID=@DM_DEVICE_GID@ \
 	-DDM_DEVICE_MODE=@DM_DEVICE_MODE@
 
+LIBS += $(SELINUX_LIBS)
+
 device-mapper: all
 
 .PHONY: install_dynamic install_static install_include \
make.tmpl.in +3 -0
index 9def16d..15ee915 100644
@@ -30,6 +30,8 @@ SED = @SED@
 CFLOW_CMD = @CFLOW_CMD@
 
 LIBS = @LIBS@
+# Extra libraries always linked with static binaries
+STATIC_LIBS = $(SELINUX_LIBS)
 DEFS += @DEFS@
 CFLAGS += @CFLAGS@
 CLDFLAGS += @CLDFLAGS@
@@ -39,6 +41,7 @@ LIB_SUFFIX = @LIB_SUFFIX@
 LVMINTERNAL_LIBS = -llvm-internal
 PTHREAD_LIBS = @PTHREAD_LIBS@
 READLINE_LIBS = @READLINE_LIBS@
+SELINUX_LIBS = @SELINUX_LIBS@
 
 # Setup directory variables
 prefix = @prefix@
tools/Makefile.in +2 -2
index b3b0b29..c7cd1d5 100644
@@ -115,7 +115,7 @@ dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
 
 dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
-	      -o $@ dmsetup.o -ldevmapper $(LIBS)
+	      -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS)
 
 all: device-mapper
 
@@ -125,7 +125,7 @@ lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
 
 lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a  $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
-	      $(OBJECTS) lvm-static.o $(LVMLIBS) $(LIBS)
+	      $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
 
 liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
 	cat $(top_builddir)/lib/liblvm-internal.a > $@
Signature · 1 line
1.7.0
#13 lore raw

PATCH 13/15 Move "-ldl" from LIBS to DL_LIBS

In reply to Zdenek Kabelac

Introduce DL_LIBS substituted variable and move -ldl from global LIBS to local DL_LIBS. Link this library only when needed.

---
 configure.in                 |   13 ++++++-------
 daemons/dmeventd/Makefile.in |    5 ++---
 make.tmpl.in                 |    3 ++-
 3 files changed, 10 insertions(+), 11 deletions(-)
configure.in +6 -7
index b985c98..f632420 100644
@@ -789,14 +789,12 @@ fi;
 
 ################################################################################
 dnl -- Check for dlopen
-AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no)
-
-if [[ "x$HAVE_LIBDL" = xyes ]]; then
+AC_CHECK_LIB(dl, dlopen, [
 	AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dynamic libraries are available.])
-	LIBS="-ldl $LIBS"
-else
-	HAVE_LIBDL=no
-fi
+	DL_LIBS="-ldl"
+	HAVE_LIBDL=yes ], [
+	DL_LIBS=
+	HAVE_LIBDL=no ])
 
 ################################################################################
 dnl -- Check for shared/static conflicts
@@ -1074,6 +1072,7 @@ AC_SUBST(DEBUG)
 AC_SUBST(DEVMAPPER)
 AC_SUBST(DLM_CFLAGS)
 AC_SUBST(DLM_LIBS)
+AC_SUBST(DL_LIBS)
 AC_SUBST(DMEVENTD)
 AC_SUBST(DM_COMPAT)
 AC_SUBST(DM_DEVICE_GID)
daemons/dmeventd/Makefile.in +2 -3
index df223ef..dc48f0d 100644
@@ -53,7 +53,6 @@ include $(top_builddir)/make.tmpl
 all: device-mapper
 device-mapper: $(TARGETS)
 
-LIBS += -ldl
 LVMLIBS += -ldevmapper-event -ldevmapper $(PTHREAD_LIBS)
 
 $(VERSIONED_SHLIB): $(LIB_SHARED)
@@ -62,11 +61,11 @@ $(VERSIONED_SHLIB): $(LIB_SHARED)
 
 dmeventd: $(LIB_SHARED) $(VERSIONED_SHLIB) dmeventd.o
 	$(CC) $(CFLAGS) $(LDFLAGS) -L. -o $@ dmeventd.o \
-	$(LVMLIBS) $(LIBS) -rdynamic
+	$(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic
 
 dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
 	$(CC) $(CFLAGS) $(LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
-	dmeventd.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
+	dmeventd.o $(DL_LIBS) $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
 
 ifeq ("@PKGCONFIG@", "yes")
   INSTALL_LIB_TARGETS += install_pkgconfig
make.tmpl.in +2 -1
index 15ee915..48f145d 100644
@@ -38,7 +38,8 @@ CLDFLAGS += @CLDFLAGS@
 LDDEPS += @LDDEPS@
 LDFLAGS += @LDFLAGS@
 LIB_SUFFIX = @LIB_SUFFIX@
-LVMINTERNAL_LIBS = -llvm-internal
+LVMINTERNAL_LIBS = -llvm-internal $(DL_LIBS)
+DL_LIBS = @DL_LIBS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
 READLINE_LIBS = @READLINE_LIBS@
 SELINUX_LIBS = @SELINUX_LIBS@
Signature · 1 line
1.7.0
#14 lore raw

PATCH 14/15 Introduce UDEV_LIBS

In reply to Zdenek Kabelac

Link libudev only to object files that really needs this library.

---
 configure.in      |    4 +++-
 libdm/Makefile.in |    2 +-
 make.tmpl.in      |    3 ++-
 tools/Makefile.in |    2 ++
 4 files changed, 8 insertions(+), 3 deletions(-)
configure.in +3 -1
index f632420..3473d95 100644
@@ -668,8 +668,9 @@ if test x$UDEV_SYNC = xyes; then
 		if test x$HAVE_UDEV_QUEUE_GET_UDEV_IS_ACTIVE = xyes; then
 			AC_DEFINE([HAVE_UDEV_QUEUE_GET_UDEV_IS_ACTIVE], 1,
 			  [Define to 1 if libudev's udev_queue_get_udev_is_active function is available.])
-			LIBS="-ludev $LIBS"
+			UDEV_LIBS="-ludev"
 		else
+			UDEV_LIBS=
 			AC_MSG_WARN(It won't be possible to get udev state. We will assume that udev is not running.)
 		fi
 fi
@@ -1120,6 +1121,7 @@ AC_SUBST(SELINUX_LIBS)
 AC_SUBST(SNAPSHOTS)
 AC_SUBST(STATICDIR)
 AC_SUBST(STATIC_LINK)
+AC_SUBST(UDEV_LIBS)
 AC_SUBST(UDEV_RULES)
 AC_SUBST(UDEV_SYNC)
 AC_SUBST(interface)
libdm/Makefile.in +1 -1
index 7ea0604..85e19ea 100644
@@ -52,7 +52,7 @@ include $(top_builddir)/make.tmpl
 DEFS += -DDM_DEVICE_UID=@DM_DEVICE_UID@ -DDM_DEVICE_GID=@DM_DEVICE_GID@ \
 	-DDM_DEVICE_MODE=@DM_DEVICE_MODE@
 
-LIBS += $(SELINUX_LIBS)
+LIBS += $(SELINUX_LIBS) $(UDEV_LIBS)
 
 device-mapper: all
 
make.tmpl.in +2 -1
index 48f145d..ff4d1b2 100644
@@ -31,7 +31,7 @@ CFLOW_CMD = @CFLOW_CMD@
 
 LIBS = @LIBS@
 # Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS)
+STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS)
 DEFS += @DEFS@
 CFLAGS += @CFLAGS@
 CLDFLAGS += @CLDFLAGS@
@@ -43,6 +43,7 @@ DL_LIBS = @DL_LIBS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
 READLINE_LIBS = @READLINE_LIBS@
 SELINUX_LIBS = @SELINUX_LIBS@
+UDEV_LIBS = @UDEV_LIBS@
 
 # Setup directory variables
 prefix = @prefix@
tools/Makefile.in +2 -0
index c7cd1d5..5106327 100644
@@ -107,6 +107,8 @@ DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
 
 include $(top_builddir)/make.tmpl
 
+LIBS += $(UDEV_LIBS)
+
 device-mapper: $(TARGETS_DM)
 
 dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
Signature · 1 line
1.7.0
#15 lore raw

PATCH 15/15 Update generated misc/configure.in

In reply to Zdenek Kabelac

This file is generated from autoreconf.
HAVE_LIBREADLINE is no longer defined
- lvm does not use it anyway.

---
 lib/misc/configure.h.in |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
lib/misc/configure.h.in +0 -3
index 4273eeb..b0af63f 100644
@@ -120,9 +120,6 @@
 /* Define to 1 if you have the <libintl.h> header file. */
 #undef HAVE_LIBINTL_H
 
-/* Define to 1 if you have the `readline' library (-lreadline). */
-#undef HAVE_LIBREADLINE
-
 /* Define to 1 if you have the <limits.h> header file. */
 #undef HAVE_LIMITS_H
 
Signature · 1 line
1.7.0