From a2b3d0409589d9b3084c0bcaa32a7af07cee715c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 31 Jan 2011 14:18:46 +0100 Subject: build-sys: enable lsblk and libmount for Linux only Signed-off-by: Karel Zak --- TODO | 33 +++++++++++++++++++++++++++++++++ configure.ac | 17 +++++++++++++---- misc-utils/Makefile.am | 3 +++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index af3750aa..dea40527 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,36 @@ +build-sys +-------- + + - we use something like + + AC_ARG_ENABLE(...., enable_foo=check) + build_foo=yes + if test "x$enable_foo" = xcheck; then + if test "x$linux_os" = xno; then + build_foo=no + fi + fi + AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_foo" = xyes) + + for Linux-only utils in configure.ac. It would be nice to set all defaults + for all $enable_ variables at begin of the configure script according to + $linux_os. Something like: + + if test "x$linux_os" = xno + enable_mount=no + enable_libmount=no + enable_lsblk=no + fi + + then we can remove all "if test "x$enable_foo" = xcheck;" stuff from the rest + of the configure script. + + - it would be nice to remove all "if BUILD_LIB{MOUNT,BLKID,UUID}" from the + Makefiles (e.g. misc-utils/Makefile.am) and use BUILD_ only + + The configure.ac has to care about dependence between utils and librares and + enable BUILD_. + fsprobe ------- diff --git a/configure.ac b/configure.ac index 10250d31..59b55ea0 100644 --- a/configure.ac +++ b/configure.ac @@ -445,10 +445,19 @@ AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid]) AC_ARG_ENABLE([libmount], AS_HELP_STRING([--disable-libmount], [do not build libmount]), - [], enable_libmount=yes + [], enable_libmount=check ) +build_libmount=yes +if test "x$enable_libmount" = xcheck; then + if test "x$linux_os" = xno; then + AC_MSG_WARN([non-linux system; do not build libmount]) + build_libmount=no + fi +elif test "x$enable_libmount" = xno; then + build_libmount=no +fi -case "$enable_libblkid:$enable_libmount" in +case "$enable_libblkid:$build_libmount" in no:yes) AC_MSG_ERROR([cannot enable libmount when libblkid is disabled]) ;; esac @@ -456,7 +465,7 @@ esac AC_SUBST([LIBMOUNT_VERSION]) AC_SUBST([LIBMOUNT_VERSION_INFO]) AC_DEFINE_UNQUOTED(LIBMOUNT_VERSION, "$LIBMOUNT_VERSION", [libmount version string]) -AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$enable_libmount" = xyes) +AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes) AC_ARG_ENABLE([libmount-mount], @@ -464,7 +473,7 @@ AC_ARG_ENABLE([libmount-mount], [], enable_libmount_mount=no ) -case "$enable_libmount:$enable_libmount_mount" in +case "$build_libmount:$enable_libmount_mount" in no:yes) AC_MSG_ERROR([cannot link mount(8) with libmount when libmount is disabled]) ;; yes:yes) diff --git a/misc-utils/Makefile.am b/misc-utils/Makefile.am index 8b1dbbe2..3f0843b2 100644 --- a/misc-utils/Makefile.am +++ b/misc-utils/Makefile.am @@ -50,6 +50,7 @@ wipefs_SOURCES = wipefs.c $(top_srcdir)/lib/strutils.c wipefs_LDADD = $(ul_libblkid_la) wipefs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) +if LINUX bin_PROGRAMS += lsblk dist_man_MANS += lsblk.8 lsblk_SOURCES = lsblk.c \ @@ -59,6 +60,8 @@ lsblk_SOURCES = lsblk.c \ $(top_srcdir)/lib/strutils.c lsblk_LDADD = $(ul_libblkid_la) lsblk_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir) +endif + if HAVE_STATIC_BLKID sbin_PROGRAMS += blkid.static blkid_static_SOURCES = $(blkid_SOURCES) -- cgit v1.2.3