[libvirt] [PATCH] Disable static libraries by default

From: "Daniel P. Berrange" <berrange@redhat.com> Every source file is currently built twice by libtool, once for the shared library and once for the static library. Static libs are not commonly packaged by distros and slow down compilation time by as more than 50% compared to a shared-only build time. Time for 'make -j 4': shared only: 2 mins 9 secs shared + static: 3 mins 26 secs Time for non-parallel make shared only: 3 mins 32 secs shared + static: 5 mins 41 secs Those few people who really want them, can pass --enable-static to configure Disabling them by default requires use of LT_INIT, but for compat with RHEL5 we can't rely on that. So we conditionally use LT_INIT, but fallback to AM_PROG_LIBTOOL if not present. --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 09e4ad9..0df9e5c 100644 --- a/configure.ac +++ b/configure.ac @@ -123,7 +123,11 @@ AC_TYPE_UID_T dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL) AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL +m4_ifndef([LT_INIT], [ + AM_PROG_LIBTOOL +], [ + LT_INIT([shared disable-static]) +]) AM_PROG_CC_C_O AM_PROG_LD -- 1.8.1.4

On 04/02/2013 10:09 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Every source file is currently built twice by libtool, once for the shared library and once for the static library. Static libs are not commonly packaged by distros and slow down compilation time by as more than 50% compared to a shared-only build time.
s/by as more than/by as much as/
Time for 'make -j 4':
shared only: 2 mins 9 secs shared + static: 3 mins 26 secs
Time for non-parallel make
shared only: 3 mins 32 secs shared + static: 5 mins 41 secs
Those few people who really want them, can pass --enable-static to configure
Yep - we are just altering the defaults, not taking away the capability altogether.
Disabling them by default requires use of LT_INIT, but for compat with RHEL5 we can't rely on that. So we conditionally use LT_INIT, but fallback to AM_PROG_LIBTOOL if not present. --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 09e4ad9..0df9e5c 100644 --- a/configure.ac +++ b/configure.ac @@ -123,7 +123,11 @@ AC_TYPE_UID_T dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL) AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL +m4_ifndef([LT_INIT], [ + AM_PROG_LIBTOOL +], [ + LT_INIT([shared disable-static]) +])
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 04/02/2013 10:09 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Every source file is currently built twice by libtool, once for the shared library and once for the static library. Static libs are not commonly packaged by distros and slow down compilation time by as more than 50% compared to a shared-only build time.
Time for 'make -j 4':
shared only: 2 mins 9 secs shared + static: 3 mins 26 secs
Time for non-parallel make
shared only: 3 mins 32 secs shared + static: 5 mins 41 secs
Those few people who really want them, can pass --enable-static to configure
Question: should ./autobuild.sh be tweaked to pass --enable-static, just so that we have some test coverage that ensures we don't break things for that setup? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Apr 02, 2013 at 11:26:29AM -0600, Eric Blake wrote:
On 04/02/2013 10:09 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Every source file is currently built twice by libtool, once for the shared library and once for the static library. Static libs are not commonly packaged by distros and slow down compilation time by as more than 50% compared to a shared-only build time.
Time for 'make -j 4':
shared only: 2 mins 9 secs shared + static: 3 mins 26 secs
Time for non-parallel make
shared only: 3 mins 32 secs shared + static: 5 mins 41 secs
Those few people who really want them, can pass --enable-static to configure
Question: should ./autobuild.sh be tweaked to pass --enable-static, just so that we have some test coverage that ensures we don't break things for that setup?
I guess so, though personally I'd just say no to static libraries entirely if there was a way todo that. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Eric Blake