Rename DRIVER_MODULE_(LDFLAGS|LIBS|CFLAGS) to unify the naming.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
configure.ac | 39 ++++---------------------------
m4/virt-driver-modules.m4 | 58 +++++++++++++++++++++++++++++++++++++++++++++++
src/Makefile.am | 2 +-
3 files changed, 63 insertions(+), 36 deletions(-)
create mode 100644 m4/virt-driver-modules.m4
diff --git a/configure.ac b/configure.ac
index 54144777c5..7677a25dad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1942,36 +1942,9 @@ esac
AM_CONDITIONAL([WITH_WIN_ICON], [test "$WINDRES" != ""])
-dnl Driver-Modules library
-LIBVIRT_ARG_WITH_ALT([DRIVER_MODULES], [build drivers as loadable modules],
- [check])
-
-if test "$with_libvirtd" = "no" ; then
- with_driver_modules=no
-fi
-
-DRIVER_MODULE_CFLAGS=
-DRIVER_MODULE_LIBS=
-if test "$with_driver_modules" = "yes" || test
"$with_driver_modules" = "check"; 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
- with_driver_modules=no
- fi
- else
- with_driver_modules=yes
- fi
-fi
-
-if test "$with_driver_modules" = "yes" ; then
- DRIVER_MODULE_LDFLAGS="-export-dynamic"
- 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"])
-AC_SUBST([DRIVER_MODULE_LDFLAGS])
-AC_SUBST([DRIVER_MODULE_LIBS])
+dnl Driver-Modules library support
+LIBVIRT_ARG_DRIVER_MODULES
+LIBVIRT_CHECK_DRIVER_MODULES
# Set LV_LIBTOOL_OBJDIR to "." or $lt_cv_objdir, depending on whether
@@ -2368,11 +2341,7 @@ AC_MSG_NOTICE([AppArmor: $with_secdriver_apparmor (install
profiles: $with_appar
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Driver Loadable Modules])
AC_MSG_NOTICE([])
-if test "$with_driver_modules" != "no" ; then
-AC_MSG_NOTICE([ dlopen: $DRIVER_MODULE_CFLAGS $DRIVER_MODULE_LIBS])
-else
-AC_MSG_NOTICE([ dlopen: no])
-fi
+LIBVIRT_RESULT_DRIVER_MODULES
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Libraries])
AC_MSG_NOTICE([])
diff --git a/m4/virt-driver-modules.m4 b/m4/virt-driver-modules.m4
new file mode 100644
index 0000000000..d2f6668176
--- /dev/null
+++ b/m4/virt-driver-modules.m4
@@ -0,0 +1,58 @@
+dnl The driver module support
+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_ARG_DRIVER_MODULES], [
+ LIBVIRT_ARG_WITH_ALT([DRIVER_MODULES], [build drivers as loadable modules],
+ [check])
+])
+
+AC_DEFUN([LIBVIRT_CHECK_DRIVER_MODULES], [
+ AC_REQUIRE([LIBVIRT_CHECK_DLOPEN])
+
+ if test "$with_libvirtd" = "no" ; then
+ with_driver_modules=no
+ fi
+
+ DRIVER_MODULES_CFLAGS=
+ DRIVER_MODULES_LIBS=
+ if test "$with_driver_modules" = "yes" || test
"$with_driver_modules" = "check"; 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
+ with_driver_modules=no
+ fi
+ else
+ with_driver_modules=yes
+ fi
+ fi
+
+ if test "$with_driver_modules" = "yes" ; then
+ DRIVER_MODULES_LDFLAGS="-export-dynamic"
+ DRIVER_MODULES_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"])
+ AC_SUBST([DRIVER_MODULES_LDFLAGS])
+ AC_SUBST([DRIVER_MODULES_LIBS])
+])
+
+AC_DEFUN([LIBVIRT_RESULT_DRIVER_MODULES], [
+ LIBVIRT_RESULT_LIB([DRIVER_MODULES])
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index b713787288..49abcf25d2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -42,7 +42,7 @@ AM_CFLAGS = $(LIBXML_CFLAGS) \
$(LOCK_CHECKING_CFLAGS) \
$(WIN32_EXTRA_CFLAGS) \
$(COVERAGE_CFLAGS)
-AM_LDFLAGS = $(DRIVER_MODULE_LDFLAGS) \
+AM_LDFLAGS = $(DRIVER_MODULES_LDFLAGS) \
$(COVERAGE_LDFLAGS) \
$(RELRO_LDFLAGS) \
$(NO_INDIRECT_LDFLAGS) \
--
2.11.0