[PATCH 16/89] configure: move dlopen check to its own file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 configure.ac      | 26 ++++----------------------
 m4/virt-dlopen.m4 | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 22 deletions(-)
 create mode 100644 m4/virt-dlopen.m4

diff --git a/configure.ac b/configure.ac
index 26174cc2e4..54144777c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -597,22 +597,7 @@ 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])
+LIBVIRT_CHECK_DLOPEN
 
 
 dnl
@@ -1968,7 +1953,7 @@ fi
 DRIVER_MODULE_CFLAGS=
 DRIVER_MODULE_LIBS=
 if test "$with_driver_modules" = "yes" || test "$with_driver_modules" = "check"; then
-  if test "$dlfcn_found" != "yes" || test "$dlopen_found" != "yes"; then
+  if test "$with_dlfcn" != "yes" || test "$with_dlopen" != "yes"; then
     if test "$with_driver_modules" = "yes" ; then
       AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules])
     else
@@ -1981,10 +1966,7 @@ fi
 
 if test "$with_driver_modules" = "yes" ; then
   DRIVER_MODULE_LDFLAGS="-export-dynamic"
-  case $ac_cv_search_dlopen in
-    no*) DRIVER_MODULE_LIBS= ;;
-    *) DRIVER_MODULE_LIBS=$ac_cv_search_dlopen ;;
-  esac
+  DRIVER_MODULE_LIBS="$DLOPEN_LIBS"
   AC_DEFINE_UNQUOTED([WITH_DRIVER_MODULES], 1, [whether to build drivers as modules])
 fi
 AM_CONDITIONAL([WITH_DRIVER_MODULES], [test "$with_driver_modules" != "no"])
@@ -2402,6 +2384,7 @@ LIBVIRT_RESULT_BLKID
 LIBVIRT_RESULT_CAPNG
 LIBVIRT_RESULT_CURL
 LIBVIRT_RESULT_DBUS
+LIBVIRT_RESULT_DLOPEN
 LIBVIRT_RESULT_FUSE
 LIBVIRT_RESULT_GLUSTER
 LIBVIRT_RESULT_GNUTLS
@@ -2420,7 +2403,6 @@ LIBVIRT_RESULT_SELINUX
 LIBVIRT_RESULT_SSH2
 LIBVIRT_RESULT_UDEV
 LIBVIRT_RESULT_YAJL
-AC_MSG_NOTICE([  dlopen: $DLOPEN_LIBS])
 AC_MSG_NOTICE([firewalld: $with_firewalld])
 if test "$with_polkit" = "yes" ; then
 if test "$with_polkit0" = "yes" ; then
diff --git a/m4/virt-dlopen.m4 b/m4/virt-dlopen.m4
new file mode 100644
index 0000000000..412ce79ade
--- /dev/null
+++ b/m4/virt-dlopen.m4
@@ -0,0 +1,45 @@
+dnl The dlopen library
+dnl
+dnl Copyright (C) 2016 Red Hat, Inc.
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library.  If not, see
+dnl <http://www.gnu.org/licenses/>.
+dnl
+
+AC_DEFUN([LIBVIRT_CHECK_DLOPEN], [
+
+  with_dlopen=yes
+  with_dlfcn=yes
+
+  AC_CHECK_HEADER([dlfcn.h],, [with_dlfcn=no])
+  AC_SEARCH_LIBS([dlopen], [dl],, [with_dlopen=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$with_dlfcn" != "xyes"; then
+        AC_MSG_ERROR([Unable to find dlfcn.h])
+      fi
+      DLOPEN_LIBS=$ac_cv_search_dlopen ;;
+  esac
+
+  AC_SUBST([DLOPEN_LIBS])
+])
+
+AC_DEFUN([LIBVIRT_RESULT_DLOPEN], [
+  LIBVIRT_RESULT_LIB([DLOPEN])
+])
-- 
2.11.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux