From eb3879122867c6376c9c7e155d8919e0609f9fdf Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sat, 23 Jan 2010 15:01:21 -0500 Subject: Check for availability of libufs on (k)freebsd Check for availability of libufs on (k)freebsd and compile the code conditionally. --- configure.in | 8 ++++++++ hald/freebsd/probing/Makefile.am | 2 +- hald/freebsd/probing/probe-volume.c | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 2c74863f..2394c456 100644 --- a/configure.in +++ b/configure.in @@ -508,6 +508,14 @@ AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], [Compilin AC_SUBST(HALD_BACKEND) if test "x$HALD_BACKEND" = "xfreebsd"; then AC_SEARCH_LIBS([clock_gettime], [rt]) + LIBUFS_LIBS="" + AC_CHECK_HEADERS([libufs.h], + [AC_CHECK_LIB([libufs], [ufs_disk_fillout], [USE_LIBUFS="yes"], [], [])]) + if test "x$USE_LIBUFS" = "xyes"; then + AC_DEFINE(HAVE_LIBUFS, 1, [Set if we have libufs]) + LIBUFS_LIBS="-lufs" + AC_SUBST(LIBUFS_LIBS) + fi USE_BSDLIBUSB20=no USE_BSDLIBUSB=no LIBUSB20_LIBS="" diff --git a/hald/freebsd/probing/Makefile.am b/hald/freebsd/probing/Makefile.am index 3e439b5f..67b8dcf5 100644 --- a/hald/freebsd/probing/Makefile.am +++ b/hald/freebsd/probing/Makefile.am @@ -67,5 +67,5 @@ hald_probe_volume_CPPFLAGS = $(AM_CPPFLAGS) @GLIB_CFLAGS@ @VOLUME_ID_CFLAGS@ hald_probe_volume_LDADD = \ @GLIB_LIBS@ \ @VOLUME_ID_LIBS@ \ - -lufs \ + @LIBUFS_LIBS@ \ $(top_builddir)/hald/freebsd/libprobe/libhald_freebsd_probe.la diff --git a/hald/freebsd/probing/probe-volume.c b/hald/freebsd/probing/probe-volume.c index e4e16899..9c8abde4 100644 --- a/hald/freebsd/probing/probe-volume.c +++ b/hald/freebsd/probing/probe-volume.c @@ -38,10 +38,12 @@ #include #include #include +#ifdef HAVE_LIBUFS #include #include #include #include +#endif /* HAVE_LIBUFS */ #include #include #include @@ -561,6 +563,7 @@ main (int argc, char **argv) libhal_device_set_property_bool(hfp_ctx, hfp_udi, "volume.ignore", has_children || is_swap, &hfp_error); +#ifdef HAVE_LIBUFS if (vid && ! strcmp (vid->type, "ufs")) { struct uufsd ufsdisk; @@ -602,6 +605,7 @@ main (int argc, char **argv) ufs_disk_close(&ufsdisk); } } +#endif /* HAVE_LIBUFS */ if (has_children) usage = "partitiontable"; -- cgit v1.2.3