configure: move dlopen check to its own file

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-11-12 00:20:21 +01:00
parent 71cf49b774
commit a811e45824
2 changed files with 49 additions and 22 deletions

View File

@ -597,22 +597,7 @@ dnl
dnl check for libdl dnl check for libdl
dnl dnl
dlfcn_found=yes LIBVIRT_CHECK_DLOPEN
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
@ -1968,7 +1953,7 @@ fi
DRIVER_MODULE_CFLAGS= DRIVER_MODULE_CFLAGS=
DRIVER_MODULE_LIBS= DRIVER_MODULE_LIBS=
if test "$with_driver_modules" = "yes" || test "$with_driver_modules" = "check"; then 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 if test "$with_driver_modules" = "yes" ; then
AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules]) AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules])
else else
@ -1981,10 +1966,7 @@ fi
if test "$with_driver_modules" = "yes" ; then if test "$with_driver_modules" = "yes" ; then
DRIVER_MODULE_LDFLAGS="-export-dynamic" DRIVER_MODULE_LDFLAGS="-export-dynamic"
case $ac_cv_search_dlopen in DRIVER_MODULE_LIBS="$DLOPEN_LIBS"
no*) DRIVER_MODULE_LIBS= ;;
*) DRIVER_MODULE_LIBS=$ac_cv_search_dlopen ;;
esac
AC_DEFINE_UNQUOTED([WITH_DRIVER_MODULES], 1, [whether to build drivers as modules]) AC_DEFINE_UNQUOTED([WITH_DRIVER_MODULES], 1, [whether to build drivers as modules])
fi fi
AM_CONDITIONAL([WITH_DRIVER_MODULES], [test "$with_driver_modules" != "no"]) AM_CONDITIONAL([WITH_DRIVER_MODULES], [test "$with_driver_modules" != "no"])
@ -2402,6 +2384,7 @@ LIBVIRT_RESULT_BLKID
LIBVIRT_RESULT_CAPNG LIBVIRT_RESULT_CAPNG
LIBVIRT_RESULT_CURL LIBVIRT_RESULT_CURL
LIBVIRT_RESULT_DBUS LIBVIRT_RESULT_DBUS
LIBVIRT_RESULT_DLOPEN
LIBVIRT_RESULT_FUSE LIBVIRT_RESULT_FUSE
LIBVIRT_RESULT_GLUSTER LIBVIRT_RESULT_GLUSTER
LIBVIRT_RESULT_GNUTLS LIBVIRT_RESULT_GNUTLS
@ -2420,7 +2403,6 @@ LIBVIRT_RESULT_SELINUX
LIBVIRT_RESULT_SSH2 LIBVIRT_RESULT_SSH2
LIBVIRT_RESULT_UDEV LIBVIRT_RESULT_UDEV
LIBVIRT_RESULT_YAJL LIBVIRT_RESULT_YAJL
AC_MSG_NOTICE([ dlopen: $DLOPEN_LIBS])
AC_MSG_NOTICE([firewalld: $with_firewalld]) AC_MSG_NOTICE([firewalld: $with_firewalld])
if test "$with_polkit" = "yes" ; then if test "$with_polkit" = "yes" ; then
if test "$with_polkit0" = "yes" ; then if test "$with_polkit0" = "yes" ; then

45
m4/virt-dlopen.m4 Normal file
View File

@ -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])
])