From bfbeafbd5d1f6176996c9626500d65eaff690cef Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Thu, 9 Jun 2011 21:47:43 +0200 Subject: [PATCH] Fix dlopen dependency Since the addition of the lock manager framework in 6a943419c528fdd7 dlopen is always required, but the checks in configure wasn't changed to reflect that. This didn't show up directly because the VirtualBox driver linking dlopen in covered it. But disabling the VirtualBox driver makes the build fail due to missing dlopen. Change the dlopen check in configure to pick up dlopen when available. Reported by Ruben Kerkhof. --- configure.ac | 46 ++++++++++++++++++++++++++-------------------- src/Makefile.am | 2 +- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 985b8c2f85..f816696fad 100644 --- a/configure.ac +++ b/configure.ac @@ -416,6 +416,28 @@ if test x"$with_remote" = x"yes" || test x"$with_libvirtd" = x"yes"; then fi +dnl +dnl check for libdl +dnl + +dlfcn_found=yes +dlopen_found=yes + +AC_CHECK_HEADER([dlfcn.h],, [dlfcn_found=no]) +AC_SEARCH_LIBS([dlopen], [dl],, [dlopen_found=no]) + +case $ac_cv_search_dlopen:$host_os in + 'none required'* | *:mingw* | *:msvc*) DLOPEN_LIBS= ;; + no*) AC_MSG_ERROR([Unable to find dlopen()]) ;; + *) if test "x$dlfcn_found" != "xyes"; then + AC_MSG_ERROR([Unable to find dlfcn.h]) + fi + DLOPEN_LIBS=$ac_cv_search_dlopen ;; +esac + +AC_SUBST([DLOPEN_LIBS]) + + dnl dnl check for VirtualBox XPCOMC location dnl @@ -432,14 +454,6 @@ AC_DEFINE_UNQUOTED([VBOX_XPCOMC_DIR], ["$vbox_xpcomc_dir"], [Location of directory containing VirtualBox XPCOMC library]) if test "x$with_vbox" = "xyes"; then - AC_SEARCH_LIBS([dlopen], [dl],,) - case $ac_cv_search_dlopen:$host_os in - 'none required'* | *:mingw* | *:msvc*) DLOPEN_LIBS= ;; - no*) AC_MSG_ERROR([Unable to find dlopen()]) ;; - *) DLOPEN_LIBS=$ac_cv_search_dlopen ;; - esac - AC_SUBST([DLOPEN_LIBS]) - case "$host" in *-*-mingw* | *-*-msvc*) MSCOM_LIBS="-lole32 -loleaut32" ;; *) MSCOM_LIBS= ;; @@ -2138,19 +2152,10 @@ AC_ARG_WITH([driver-modules], DRIVER_MODULE_CFLAGS= DRIVER_MODULE_LIBS= -if test "x$with_driver_modules" = "xyes" ; then - old_cflags="$CFLAGS" - old_libs="$LIBS" - fail=0 - AC_CHECK_HEADER([dlfcn.h],[],[fail=1]) - AC_SEARCH_LIBS([dlopen], [dl], [], [fail=1]) - test $fail = 1 && - AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules]) - - CFLAGS="$old_cflags" - LIBS="$old_libs" -fi if test "$with_driver_modules" = "yes"; then + if test "$dlfcn_found" != "yes" || test "$dlopen_found" != "yes"; then + AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules]) + fi DRIVER_MODULE_CFLAGS="-export-dynamic" case $ac_cv_search_dlopen in no*) DRIVER_MODULE_LIBS= ;; @@ -2468,6 +2473,7 @@ AC_MSG_NOTICE([]) AC_MSG_NOTICE([Libraries]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([ libxml: $LIBXML_CFLAGS $LIBXML_LIBS]) +AC_MSG_NOTICE([ dlopen: $DLOPEN_LIBS]) if test "$with_esx" = "yes" ; then AC_MSG_NOTICE([ libcurl: $LIBCURL_CFLAGS $LIBCURL_LIBS]) else diff --git a/src/Makefile.am b/src/Makefile.am index 3612a24cf2..4f9bfc9a97 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -526,7 +526,7 @@ libvirt_driver_la_SOURCES = $(DRIVER_SOURCES) libvirt_driver_la_CFLAGS = $(NUMACTL_CFLAGS) $(GNUTLS_CFLAGS) \ -I@top_srcdir@/src/conf $(AM_CFLAGS) -libvirt_driver_la_LIBADD = $(NUMACTL_LIBS) $(GNUTLS_LIBS) +libvirt_driver_la_LIBADD = $(NUMACTL_LIBS) $(GNUTLS_LIBS) $(DLOPEN_LIBS) USED_SYM_FILES = libvirt_private.syms