]> err.no Git - util-linux/commitdiff
build-sys: libtoolize by libtool-2
authorKarel Zak <kzak@redhat.com>
Fri, 13 Feb 2009 09:54:24 +0000 (10:54 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 13 Feb 2009 10:37:00 +0000 (11:37 +0100)
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 <kzak@redhat.com>
.gitignore
autogen.sh
config/include-Makefile.am
configure.ac
libs/blkid/bin/Makefile.am
libs/blkid/src/Makefile.am
libs/blkid/src/probers/Makefile.am

index 554c164bdc7970aa9a9dec2c77fcad1faee726e9..67f766cdeea0d47225ac9ae10d38efebeb5b9b90 100644 (file)
@@ -2,6 +2,8 @@
 *.[ao]
 *.static
 *.so
+*.lo
+*.la
 *.so.*
 *.pc
 Makefile
@@ -32,3 +34,4 @@ missing
 ltmain.sh
 libtool
 .deps
+.libs
index bc3950bd71e1468ca87f432a72a83521f990a557..f597b71476c09dd3af41b694b02fd0e1d58ec8fd 100755 (executable)
@@ -3,11 +3,11 @@
 #
 # Helps generate autoconf/automake stuff, when code is checked out from SCM.
 #
-# Copyright (C) 2006 - Karel Zak <kzak@redhat.com> 
+# Copyright (C) 2006-2009 - Karel Zak <kzak@redhat.com>
 #
 
 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
index 876fa3967fa2b10dc16fc5bc83e6e43befe27e1f..70494abc09e45f10e3e37d842a53fc7638b8037a 100644 (file)
@@ -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)
+
index dc8374de083cf0e985f701c07282ace8aa16c6dd..4ca1f112d6f0998be28f3925b2d57caca1f47f69 100644 (file)
@@ -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
index 581adbe75b8bff380f27d7bfbfa1e212d040edd7..97ba9912b2c3c61de733f6f16c832b173dbbd8fa 100644 (file)
@@ -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 $@
-
index d7421e29e14a312925aa84b8190c677240570cb2..850a945b4baf01827bbeca7b26ceed6cf9b714f8 100644 (file)
@@ -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)
 
index 116a2f655666797c236ecb05de2e09b10016dd24..9de2316871f659080d9dfb36cd97d8add6550fd6 100644 (file)
@@ -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)