# HG changeset patch # User J. Ali Harlow # Date 1329766118 0 # Node ID 08b9c2e3cb373e8c6e574dfcc2cb20e0005e2054 # Parent 2e896ad9754b5dc797d24ba8c7c343f1f8f7ea2f Overload --disable-shared to also build static executables. diff -r 2e896ad9754b -r 08b9c2e3cb37 configure.ac --- a/configure.ac Fri Feb 17 18:35:10 2012 +0000 +++ b/configure.ac Mon Feb 20 19:28:38 2012 +0000 @@ -26,8 +26,34 @@ AC_CHECK_HEADERS([sys/mman.h]) gl_INIT AC_CHECK_FUNCS([symlink chroot]) -AC_LIBTOOL_WIN32_DLL -AM_PROG_LIBTOOL +LT_INIT([win32-dll]) +# Libtool supports a --disable-shared option to tell it to avoid +# building shared versions of libraries. In addition to this,we want +# to support building static versions of our executables. Libtool +# can do this (under the right circumstances) so we overload this +# switch for this purpose. +# +# The libtool option that we use (-static-libtool-libs) means to use +# static linking with libraries that supply a .la file and which +# include a non-empty value for "old_library". If the library doesn't +# include a .la file (they are deleted by some distributions), then +# this option will have no effect and likewise if old_library is set +# to '' (eg., if the library was build with --disable-static) then +# again -static-libtool-libs will have no effect. +# +# If old_library is set to a non-empty value, then specifying +# -static-libtool-libs will cause the link to fail if the old library +# cannot be found (libtool will not fallback to a shared library +# in these circumstances). This can happen with Fedora, for example, +# if a main mingw32 library package is installed but not the +# coresponding static sub-package. The solution is to either +# install the relevant static sub-packages or don't use --disable-shared. +AS_IF([test "$enable_shared" = no],[ + LDFLAGS="$LDFLAGS -static-libtool-libs" +]) +LT_OUTPUT +ac_compile="./libtool --mode=compile --tag=CC $ac_compile" +ac_link="./libtool --mode=link --tag=CC $ac_link" AC_PROG_MAKE_SET AC_PROG_LN_S AC_SYS_LARGEFILE