From: Karel Zak Date: Fri, 13 Feb 2009 12:08:07 +0000 (+0100) Subject: build-sys: libtoolize mount/Makefile.am X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=154d63031340f91a2e019cf336c95e3c37183dd2;p=util-linux build-sys: libtoolize mount/Makefile.am * cleanup mount/Makefile.am * add {VOLUMEID,BLKID}_CFLAGS -- necessary for pkg-config * add support for linking with in-tree libblkid Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index 4ca1f112..04c1f611 100644 --- a/configure.ac +++ b/configure.ac @@ -135,24 +135,6 @@ yes) enable_static_programs=m4_quote(UTIL_STATIC_PROGRAMS) ;; no) enable_static_programs= ;; esac -if test "$enable_static_programs" != ""; then - AC_CACHE_CHECK([whether linker accepts -static], - [static_cv_option], - [SAVE_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -static" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -]], [[ -fflush(stdout); -]])], [static_cv_option=yes],[static_cv_option=no]) - LDFLAGS="$SAVE_LDFLAGS" - ]) - if test "x$static_cv_option" = xno; then - AC_MSG_ERROR([the linker does not accept option -static]) - fi -fi -AC_SUBST([LDFLAGS_STATIC], [-static]) - dnl Set all the individual AM_CONDITIONALs m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [ case ,$enable_static_programs, in @@ -162,8 +144,6 @@ m4_foreach([UTIL_PRG], m4_defn([UTIL_STATIC_PROGRAMS]), [ [test "x$static_[]UTIL_PRG" = xyes]) ]) - - dnl UTIL_CHECK_LIB(LIBRARY, FUNCTION, [VARSUFFIX = $1])) dnl The VARSUFFIX is optional and overrides the default behaviour. For example: dnl UTIL_CHECK_LIB(yyy, func, xxx) generates have_xxx and HAVE_LIBXXX diff --git a/mount/Makefile.am b/mount/Makefile.am index 90d956eb..1128fa85 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -6,82 +6,98 @@ bin_PROGRAMS = mount umount sbin_PROGRAMS = losetup swapon dist_man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8 -utils_common = sundries.c xmalloc.c ../lib/canonicalize.c +# generic sources for all programs (mount, umount, swapon, losetup) +srcs_common = sundries.c xmalloc.c ../lib/canonicalize.c -headers_common = fstab.h mount_mntent.h mount_constants.h \ - lomount.h fsprobe.h xmalloc.h \ - getusername.h loop.h sundries.h +# generic header for mount and umount +hdrs_mount = fstab.h mount_mntent.h mount_constants.h \ + lomount.h fsprobe.h xmalloc.h getusername.h loop.h sundries.h -mount_common = fstab.c mount_mntent.c getusername.c lomount.c \ - $(utils_common) $(headers_common) ../lib/env.c ../lib/linux_version.c \ +# generic sources for mount and umount +srcs_mount = fstab.c mount_mntent.c getusername.c lomount.c \ + $(srcs_common) $(hdrs_mount) ../lib/env.c ../lib/linux_version.c \ ../lib/blkdev.c fsprobe.c -mount_SOURCES = mount.c $(mount_common) ../lib/setproctitle.c -mount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) +# generic flags for all programs (except losetup) +# -- note that pkg-config autoconf macros (pkg.m4) does not differentiate +# between CFLAGS and CPPFLAGS, we follow this behaviour and use CFLAGS only. +ldadd_common = +ldadd_static = +cflags_common = + +# generic libtool options for all static programs +ldflags_static ="-all-static" + +mount_SOURCES = mount.c $(srcs_mount) ../lib/setproctitle.c +mount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) $(cflags_common) mount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) +mount_LDADD = $(ldadd_common) -umount_SOURCES = umount.c $(mount_common) -umount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) +umount_SOURCES = umount.c $(srcs_mount) +umount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) $(cflags_common) umount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) +umount_LDADD = $(ldadd_common) -swapon_SOURCES = swapon.c swap_constants.h $(utils_common) \ +swapon_SOURCES = swapon.c swap_constants.h $(srcs_common) \ ../lib/linux_version.c ../lib/blkdev.c fsprobe.c +swapon_CFLAGS = $(cflags_common) +swapon_LDADD = $(ldadd_common) -losetup_SOURCES = lomount.c $(utils_common) \ - loop.h lomount.h xmalloc.h sundries.h +losetup_SOURCES = lomount.c $(srcs_common) loop.h lomount.h xmalloc.h sundries.h losetup_CPPFLAGS = -DMAIN $(AM_CPPFLAGS) -mount_LDADD = $(LDADD_common) -umount_LDADD = $(LDADD_common) -swapon_LDADD = $(LDADD_common) - -LDADD_common = -LDADD_common_static = mount_static_LDADD = if HAVE_STATIC_MOUNT bin_PROGRAMS += mount.static mount_static_SOURCES = $(mount_SOURCES) -mount_static_LDFLAGS = $(LDFLAGS_STATIC) -mount_static_LDADD += $(LDADD_common_static) +mount_static_LDFLAGS = $(ldflags_static) +mount_static_LDADD += $(ldadd_static) endif if HAVE_STATIC_UMOUNT bin_PROGRAMS += umount.static umount_static_SOURCES = $(umount_SOURCES) -umount_static_LDFLAGS = $(LDFLAGS_STATIC) -umount_static_LDADD = $(LDADD_common_static) +umount_static_LDFLAGS = $(ldflags_static) +umount_static_LDADD = $(ldadd_static) endif if HAVE_STATIC_LOSETUP bin_PROGRAMS += losetup.static losetup_static_SOURCES = $(losetup_SOURCES) -losetup_static_LDFLAGS = $(LDFLAGS_STATIC) +losetup_static_LDFLAGS = $(ldflags_static) losetup_static_CPPFLAGS = -DMAIN $(AM_CPPFLAGS) endif if HAVE_BLKID -mount_common += fsprobe_blkid.c +srcs_mount += fsprobe_blkid.c swapon_SOURCES += fsprobe_blkid.c -LDADD_common += $(BLKID_LIBS) -LDADD_common_static += $(BLKID_LIBS_STATIC) +if BUILD_LIBBLKID +ldadd_common += $(ul_libblkid_la) +ldadd_static += $(ul_libblkid_la) +cflags_common += -I$(ul_libblkid_srcdir) +else +ldadd_common += $(BLKID_LIBS) +ldadd_static += $(BLKID_LIBS_STATIC) +cflags_common += $(BLKID_CFLAGS) endif - -if HAVE_SELINUX -mount_LDADD += $(SELINUX_LIBS) -mount_static_LDADD += $(SELINUX_LIBS_STATIC) endif if HAVE_VOLUME_ID -mount_common += fsprobe_volumeid.c +srcs_mount += fsprobe_volumeid.c swapon_SOURCES += fsprobe_volumeid.c -LDADD_common += $(VOLUMEID_LIBS) -LDADD_common_static += $(VOLUMEID_LIBS_STATIC) +ldadd_common += $(VOLUMEID_LIBS) +ldadd_static += $(VOLUMEID_LIBS_STATIC) +cflags_common += $(VOLUMEID_CFLAGS) +endif + +if HAVE_SELINUX +mount_LDADD += $(SELINUX_LIBS) +mount_static_LDADD += $(SELINUX_LIBS_STATIC) endif noinst_PROGRAMS = mtab_lock_test -mtab_lock_test_SOURCES = fstab.c sundries.c xmalloc.c $(headers_common) \ - ../lib/canonicalize.c +mtab_lock_test_SOURCES = fstab.c $(srcs_common) $(hdrs_mount) mtab_lock_test_CPPFLAGS = -DMAIN_TEST_MTABLOCK $(AM_CPPFLAGS) install-exec-hook: