From 17afb0320c77e47a44dc838d3724f89aff06c703 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 18 May 2009 16:01:27 +0200 Subject: build-sys: cleanup libuuid stuff Supported scenarios: * internal libuuid (--enable-libuuid, default) * external libuuid (--disable-libuuid) - systems without pkg-config - systems with pkg-config * systems without libuuid at all (the library is optional for u-l-ng) Signed-off-by: Karel Zak --- configure.ac | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 27d8fa354..574be2194 100644 --- a/configure.ac +++ b/configure.ac @@ -201,13 +201,39 @@ AC_DEFUN([UTIL_RESTORE_FLAGS], [ ]) -UTIL_CHECK_LIB(uuid, uuid_is_null) -if test "x$have_uuid" = xno; then - AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs]) +AC_ARG_ENABLE([libuuid], + AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]), + [], enable_libuuid=yes +) +AC_SUBST(LIBUUID_VERSION) +AM_CONDITIONAL(BUILD_LIBUUID, test "x$enable_libuuid" = xyes) +have_uuid=yes + +if test "x$enable_libuuid" = xno; then + # Check for external (e2fsprogs) libuuid + PKG_CHECK_MODULES(UUID, uuid, [have_uuid=yes], [have_uuid=no]) + if test "x$have_uuid" = xno; then + # system without pkg-config or so, try classic check + AC_CHECK_LIB(uuid, uuid_is_null, [have_uuid=yes], [have_uuid=no]) + fi + if test "x$have_uuid" = xyes; then + UTIL_SET_FLAGS($UUID_CFLAGS, $UUID_CFLAGS, $UUID_LIBS) + AC_CHECK_HEADERS([uuid.h uuid/uuid.h], [break], []) + UTIL_RESTORE_FLAGS + fi +else + # internal librray + AC_DEFINE(HAVE_UUID_H, 1, [Define to 1 if you have the header file.]) fi -UTIL_CHECK_LIB(util, openpty) -UTIL_CHECK_LIB(termcap, tgetnum) +if test "x$have_uuid" = xyes; then + AC_DEFINE(HAVE_LIBUUID, 1, [Define to 1 if you have the -luuid.]) +else + AC_MSG_WARN([uuid library is not found; mkswap(8) will not generate UUIDs]) +fi +AM_CONDITIONAL(HAVE_UUID, test "x$have_uuid" = xyes) +# default +: ${UUID_LIBS='-luuid'} AC_ARG_WITH([fsprobe], @@ -269,14 +295,6 @@ fi AM_CONDITIONAL(BUILD_MOUNT, test "x$build_mount" = xyes) -AC_ARG_ENABLE([libuuid], - AS_HELP_STRING([--disable-libuuid], [do not build libuuid and uuid utilities]), - [], enable_libuuid=yes -) -AC_SUBST(LIBUUID_VERSION) -AM_CONDITIONAL(BUILD_LIBUUID, test "x$enable_libuuid" = xyes) - - AC_ARG_ENABLE([fsck], AS_HELP_STRING([--enable-fsck], [do build fsck]), [], enable_fsck=no @@ -289,6 +307,8 @@ fi AM_CONDITIONAL(BUILD_FSCK, test "x$enable_fsck" = xyes) + + dnl UTIL_PKG_STATIC(VARIABLE, MODULES) dnl ---------------------------------- AC_DEFUN([UTIL_PKG_STATIC], [ @@ -299,6 +319,7 @@ AC_DEFUN([UTIL_PKG_STATIC], [ fi ]) + # These default values should work in most cases: : ${BLKID_LIBS='-lblkid -luuid'} : ${VOLUME_ID_LIBS='-lvolume_id'} @@ -314,6 +335,8 @@ fi AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid]) AC_ARG_VAR([VOLUME_ID_LIBS_STATIC], [-l options for linking statically with volume_id]) +UTIL_CHECK_LIB(util, openpty) +UTIL_CHECK_LIB(termcap, tgetnum) AM_GNU_GETTEXT_VERSION([0.14.1]) AM_GNU_GETTEXT([external]) -- cgit v1.2.3-55-g7522