diff options
author | Roger Leigh <rleigh@debian.org> | 2011-01-06 21:51:28 +0000 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2011-01-06 21:56:53 +0000 |
commit | 4bb3de1daa1543e89dac52138971727d5b011f51 (patch) | |
tree | 9fa330f0b8ff6bb353cd9f011741df88e90d39c2 | |
parent | 15ed86835a34196ccd6c0ea529623962323fe356 (diff) | |
download | schroot-4bb3de1daa1543e89dac52138971727d5b011f51.tar.gz |
build: Correct libuuid configuration
libuuid --enable-uuid and --disable-uuid options now work. The
configure logic was incorrect and now handles enabling, disabling
and automatic configuration correctly. Only link with libuuid
when UUID support is enabled. Only build with UUID support when
enabled, not merely present.
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | sbuild/sbuild-util.cc | 4 |
2 files changed, 17 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index e242367f..b5989606 100644 --- a/configure.ac +++ b/configure.ac @@ -331,8 +331,7 @@ AC_DEFINE_UNQUOTED(SBUILD_HOST_CPU, ["$host_cpu"]) # Checks for libraries. PKG_CHECK_MODULES([UUID], [uuid], - [AC_DEFINE(HAVE_UUID) - HAVE_UUID=yes], + [HAVE_UUID=yes], [HAVE_UUID=no]) AM_PATH_CPPUNIT([1.10.0], [HAVE_CPPUNIT=yes]) @@ -418,17 +417,25 @@ fi AC_MSG_CHECKING([whether to build UUID support]) BUILD_UUID="yes" -if test "$enable_uuid" = "yes"; then - BUILD_UUID="no" -fi -if test "$HAVE_UUID" = "no"; then +if test "$enable_uuid" = "no"; then BUILD_UUID="no" +elif test "$enable_uuid" = "yes"; then + if test "$HAVE_UUID" = "no"; then + AC_MSG_FAILURE([libuuid (e2fsprogs) is not installed, but is required by schroot]) + fi +elif test "$enable_uuid" = "auto"; then + if test "$HAVE_UUID" = "no"; then + BUILD_UUID="no" + fi fi AC_MSG_RESULT([$BUILD_UUID]) -AH_TEMPLATE(HAVE_UUID, [Set if UUID support is available]) +AM_CONDITIONAL([BUILD_UUID], [test "$BUILD_UUID" = "yes"]) +AH_TEMPLATE(SBUILD_USE_UUID, [Set if uuid support is present]) if test "$BUILD_UUID" = "yes"; then - AC_DEFINE(HAVE_UUID, 1) + AC_DEFINE(SBUILD_USE_UUID, 1) +else + UUID_LIBS="" fi AC_MSG_CHECKING([whether to build PAM support]) diff --git a/sbuild/sbuild-util.cc b/sbuild/sbuild-util.cc index 987ee96b..06358674 100644 --- a/sbuild/sbuild-util.cc +++ b/sbuild/sbuild-util.cc @@ -29,7 +29,7 @@ #include <sys/stat.h> #include <unistd.h> -#ifdef HAVE_UUID +#ifdef SBUILD_USE_UUID #include <uuid/uuid.h> #else #include <time.h> @@ -237,7 +237,7 @@ sbuild::unique_identifier () std::ostringstream id; id.imbue(std::locale::classic()); -#ifdef HAVE_UUID +#ifdef SBUILD_USE_UUID uuid_t uuid; char uuid_str[37]; uuid_generate(uuid); |