[libvirt] [PATCHv3 1/2] spec: make it easier to autoreconf when building rpm

Eric Blake eblake at redhat.com
Tue Dec 6 23:47:27 UTC 2011

Over time, Fedora and RHEL RPMs have often backported upstream
patches that touched configure.ac and/or Makefile.am; this
necessitates rerunning the autotools for the patch to be effective.
Making this a one-liner spec tweak will make it easier for future
backports to pull patches without having to find all the places
to touch to properly use the autotools.  Meanwhile, there have been
historical instances where an update in the autotools caused FTBFS
situations, so this is not on by default.

* libvirt.spec.in (BuildRequires): Add autotools.
(%build): Conditionally use them before configure.

v2: switch default value of %enable_autotools

 libvirt.spec.in |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index 97b811d..c2c926d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -8,6 +8,11 @@
   sed -ne 's/^\.fc\?\([0-9]\+\).*/%%define fedora \1/p')}

+# Default to skipping autoreconf.  Distros can change just this one line
+# (or provide a command-line override) if they backport any patches that
+# touch configure.ac or Makefile.am.
+%{?enable_autotools:%define enable_autotools 0}
 # A client only build will create a libvirt.so only containing
 # the generic RPC driver, and test driver and no libvirtd
 # Default to a full server + client build
@@ -349,6 +354,11 @@ Requires(postun): systemd-units

 # All build-time requirements
+%if 0%{?enable_autotools}
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libtool
 BuildRequires: python-devel
 %if %{with_systemd}
 BuildRequires: systemd-units
@@ -729,6 +739,9 @@ of recent versions of Linux (and other OSes).
 %define init_scripts --with-init_script=redhat

+%if 0%{?enable_autotools}
+autoreconf -if
 %configure %{?_without_xen} \
            %{?_without_qemu} \
            %{?_without_openvz} \

More information about the libvir-list mailing list