From: Karel Zak Date: Fri, 13 Feb 2009 09:54:24 +0000 (+0100) Subject: build-sys: libtoolize by libtool-2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b12991dd5c4f8294096723158b6d387fc3d27342;p=util-linux build-sys: libtoolize by libtool-2 We need an infrastructure for stared libraries. The latest libtool-2 seems useful and it's definitely better than the old 1.5 crap. You need to install libtool-2 when you want to run ./autogen.sh script after checkout from git repository. Signed-off-by: Karel Zak --- diff --git a/.gitignore b/.gitignore index 554c164b..67f766cd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ *.[ao] *.static *.so +*.lo +*.la *.so.* *.pc Makefile @@ -32,3 +34,4 @@ missing ltmain.sh libtool .deps +.libs diff --git a/autogen.sh b/autogen.sh index bc3950bd..f597b714 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,11 +3,11 @@ # # Helps generate autoconf/automake stuff, when code is checked out from SCM. # -# Copyright (C) 2006 - Karel Zak +# Copyright (C) 2006-2009 - Karel Zak # srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. +test -z "$srcdir" && srcdir=. THEDIR=`pwd` cd $srcdir @@ -28,6 +28,15 @@ DIE=0 echo "or see http://www.gnu.org/software/autoconf" DIE=1 } + +(libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool-2 installed to generate util-linux-ng build system." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/libtool" + DIE=1 +} + (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have automake installed to generate util-linux-ng build system." @@ -53,6 +62,12 @@ test -f mount/mount.c || { exit 1 } +ltver=$(libtoolize --version | awk '/^libtoolize/ { print $4 }') +test ${ltver##2.} == "$ltver" && { + echo "You must have libtool version >= 2.x.x, but you have $ltver." + exit 1 +} + echo echo "Generate build-system by:" echo " autopoint: $(autopoint --version | head -1)" @@ -60,10 +75,12 @@ echo " aclocal: $(aclocal --version | head -1)" echo " autoconf: $(autoconf --version | head -1)" echo " autoheader: $(autoheader --version | head -1)" echo " automake: $(automake --version | head -1)" +echo " libtoolize: $(libtoolize --version | head -1)" echo set -e autopoint --force $AP_OPTS +libtoolize --force --copy $LT_OPTS aclocal -I m4 $AL_OPTS autoconf $AC_OPTS autoheader $AH_OPTS diff --git a/config/include-Makefile.am b/config/include-Makefile.am index 876fa396..70494abc 100644 --- a/config/include-Makefile.am +++ b/config/include-Makefile.am @@ -12,3 +12,12 @@ AM_LDFLAGS = # conditional is false. # Work the bug around until it is fixed: dist_noinst_DATA = $(dist_man_MANS) + +# Paths to in-tree libraries (use ul_ prefix to avoid possible collisions) +# +ul_libblkid_srcdir = $(top_builddir)/libs/blkid/src +ul_libblkid_la = $(ul_libblkid_srcdir)/libblkid.la + +$(ul_libblkid_la): + $(MAKE) -C $(ul_libblkid_srcdir) + diff --git a/configure.ac b/configure.ac index dc8374de..4ca1f112 100644 --- a/configure.ac +++ b/configure.ac @@ -3,6 +3,7 @@ AC_INIT(util-linux-ng, 2.14, kzak@redhat.com) AC_PREREQ(2.60) AC_CONFIG_AUX_DIR(config) +AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([check-news -Wall foreign 1.9 dist-bzip2]) @@ -19,11 +20,13 @@ BLKID_VERSION_RELEASE=0 BLKID_DATE="10-Feb-2009" BLKID_VERSION=$BLKID_VERSION_MAJOR.$BLKID_VERSION_MINOR.$BLKID_VERSION_RELEASE +BLKID_VERSION_INFO=`expr $BLKID_VERSION_MAJOR + $BLKID_VERSION_MINOR`:$BLKID_VERSION_RELEASE:$BLKID_VERSION_MINOR AC_SUBST(BLKID_VERSION_MAJOR) AC_SUBST(BLKID_VERSION_MINOR) AC_SUBST(BLKID_VERSION_RELEASE) AC_SUBST(BLKID_VERSION) +AC_SUBST(BLKID_VERSION_INFO) AC_DEFINE_UNQUOTED(BLKID_VERSION, "$BLKID_VERSION", [libblkid version string]) AC_DEFINE_UNQUOTED(BLKID_DATE, "$BLKID_DATE", [libblkid date string]) @@ -50,7 +53,9 @@ AC_PROG_CC_STDC AC_GNU_SOURCE AC_CANONICAL_HOST AC_C_BIGENDIAN -AC_PROG_RANLIB + +dnl libtool-2 +LT_INIT linux_os=no case ${host_os} in diff --git a/libs/blkid/bin/Makefile.am b/libs/blkid/bin/Makefile.am index 581adbe7..97ba9912 100644 --- a/libs/blkid/bin/Makefile.am +++ b/libs/blkid/bin/Makefile.am @@ -1,20 +1,7 @@ include $(top_srcdir)/config/include-Makefile.am -AM_LDFLAGS += -L$(top_builddir)/libs/blkid/src -lblkid -AM_CPPFLAGS += -I$(top_builddir)/libs/blkid/src/ +AM_CPPFLAGS += -I$(ul_libblkid_srcdir) +AM_LDFLAGS += $(ul_libblkid_la) sbin_PROGRAMS = blkid findfs dist_man_MANS = blkid.8 findfs.8 - -shell_in_files = blkid.sh.in findfs.sh -noinst_SCRIPTS = $(shell_in_files:.sh.in=.sh) - -blkid_SOURCES = blkid.c -findfs_SOURCES = findfs.c - -CLEANFILES = $(noinst_SCRIPTS) - -%.sh: %.sh.in - sed -e "s|\@SRCDIR\@|$(abs_top_srcdir)|" $< > $@ - chmod +x $@ - diff --git a/libs/blkid/src/Makefile.am b/libs/blkid/src/Makefile.am index d7421e29..850a945b 100644 --- a/libs/blkid/src/Makefile.am +++ b/libs/blkid/src/Makefile.am @@ -4,13 +4,18 @@ SUBDIRS = probers . AM_CPPFLAGS += -I$(top_builddir)/libs/blkid/src +common_ldadd = + +if HAVE_UUID +common_ldadd += -luuid #TODO $(UUID_LIBS) +endif + # includes blkidincdir = $(includedir)/blkid blkidinc_HEADERS = blkid.h -# static library -lib_LIBRARIES = libblkid.a -libblkid_a_SOURCES = cache.c dev.c devname.c devno.c getsize.c llseek.c \ +lib_LTLIBRARIES = libblkid.la +libblkid_la_SOURCES = cache.c dev.c devname.c devno.c getsize.c llseek.c \ probe.c read.c resolve.c save.c tag.c version.c verify.c \ encode.c blkid.h list.h probers/probers.h \ config.c evaluate.c \ @@ -20,57 +25,18 @@ libblkid_a_SOURCES = cache.c dev.c devname.c devno.c getsize.c llseek.c \ $(top_srcdir)/lib/canonicalize.c \ $(top_srcdir)/lib/md5.c -libblkid_a_LIBADD = probers/libprobers.a -libblkid_a_CFLAGS = -fPIC +libblkid_la_LIBADD = probers/libblkid_probers.la $(common_ldadd) +libblkid_la_DEPENDENCIES = $(libblkid_la_LIBADD) blkid.sym + +libblkid_la_LDFLAGS = -Wl,--version-script=blkid.sym -version-info @BLKID_VERSION_INFO@ tests = test_cache test_config test_dev test_devname test_devno test_getsize \ test_read test_resolve test_save test_tag test_verify test_evaluate -# shared library (note that we don't use LIBTOOL!) -blkid_IMAGE = libblkid.so -blkid_LDSCRIPT = $(srcdir)/blkid.sym -blkid_LIB = $(blkid_IMAGE).$(BLKID_VERSION) -blkid_SONAME = $(blkid_IMAGE).$(BLKID_VERSION_MAJOR) -blkid_LINKS = $(blkid_IMAGE) $(blkid_SONAME) -blkid_OTHERLDADD = - -if HAVE_UUID -blkid_OTHERLDADD += -luuid #TODO $(UUID_LIBS) -endif - EXTRA_DIST = blkid.sym -CLEANFILES = $(tests) $(blkid_LIB) $(blkid_LINKS) - -all-local: $(blkid_LIB) - -$(blkid_LIB): $(lib_LIBRARIES) $(blkid_LDSCRIPT) - $(CC) --shared -o $(blkid_LIB) $(AM_LDFLAGS) \ - -Wl,-soname,$(blkid_SONAME),--version-script,$(blkid_LDSCRIPT) \ - $(libblkid_a_OBJECTS) $(libblkid_a_LIBADD) $(blkid_OTHERLDADD) - for I in $(blkid_LINKS); do \ - ln -sf $(blkid_LIB) $$I; \ - done - -tests: $(tests) all-local - -# TODO: the -md5.o requirement is odd.. -test_%: %.c all - $(COMPILE) -DTEST_PROGRAM $< $(lib_LIBRARIES) libblkid_a-md5.o $(libblkid_a_LIBADD) \ - -o $@ $(blkid_OTHERLDADD) - -installdirs-local: - $(MKDIR_P) $(DESTDIR)$(libdir) - -install-exec-hook: - $(mkinstalldirs) $(DESTDIR)$(blkidincdir) - $(INSTALL_PROGRAM) $(blkid_LIB) $(DESTDIR)$(libdir) - for I in $(blkid_LINKS); do \ - cd $(DESTDIR)$(libdir) && ln -sf $(blkid_LIB) $$I; \ - done +CLEANFILES = $(tests) -uninstall-hook: - rm -f $(DESTDIR)$(libdir)/$(blkid_LIB) - for I in $(blkid_LINKS); do \ - cd $(DESTDIR)$(libdir) && rm -f $(blkid_LIB) $$I; \ - done +tests: all $(tests) +test_%: %.c + $(COMPILE) -DTEST_PROGRAM $< .libs/libblkid.a -o $@ $(common_ldadd) diff --git a/libs/blkid/src/probers/Makefile.am b/libs/blkid/src/probers/Makefile.am index 116a2f65..9de23168 100644 --- a/libs/blkid/src/probers/Makefile.am +++ b/libs/blkid/src/probers/Makefile.am @@ -2,9 +2,9 @@ include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -I$(top_builddir)/libs/blkid/src -lib_LIBRARIES = libprobers.a -libprobers_a_CFLAGS = -fPIC -libprobers_a_SOURCES = probers.h \ +noinst_LTLIBRARIES = libblkid_probers.la +libblkid_probers_la_SOURCES = \ + probers.h \ cramfs.c \ swap.c \ adaptec_raid.c \ @@ -40,5 +40,3 @@ libprobers_a_SOURCES = probers.h \ sysv.c \ btrfs.c \ lvm.c - -all-local: $(lib_LIBRARIES)