]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Fix dlopen dependency
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 9 Jun 2011 19:47:43 +0000 (21:47 +0200)
committerEric Blake <eblake@redhat.com>
Mon, 13 Jun 2011 20:19:56 +0000 (14:19 -0600)
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
src/Makefile.am

index 985b8c2f85467e61ce5f43fec51a8e0a01f13a2d..f816696fad819b70022855114afb749a97564fd5 100644 (file)
@@ -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
index 3612a24cf251250c44300f53da074bb9280f3d98..4f9bfc9a97b86bf7bd27811240794aea45c5b593 100644 (file)
@@ -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