Overload --disable-shared to also build static executables.
authorJ. Ali Harlow <ali@juiblex.co.uk>
Mon Feb 20 19:28:38 2012 +0000 (2012-02-20)
changeset 42708b9c2e3cb37
parent 426 2e896ad9754b
child 428 6707b8b11f55
Overload --disable-shared to also build static executables.
configure.ac
     1.1 --- a/configure.ac	Fri Feb 17 18:35:10 2012 +0000
     1.2 +++ b/configure.ac	Mon Feb 20 19:28:38 2012 +0000
     1.3 @@ -26,8 +26,34 @@
     1.4  AC_CHECK_HEADERS([sys/mman.h])
     1.5  gl_INIT
     1.6  AC_CHECK_FUNCS([symlink chroot])
     1.7 -AC_LIBTOOL_WIN32_DLL
     1.8 -AM_PROG_LIBTOOL
     1.9 +LT_INIT([win32-dll])
    1.10 +# Libtool supports a --disable-shared option to tell it to avoid
    1.11 +# building shared versions of libraries. In addition to this,we want
    1.12 +# to support building static versions of our executables. Libtool
    1.13 +# can do this (under the right circumstances) so we overload this
    1.14 +# switch for this purpose.
    1.15 +#
    1.16 +# The libtool option that we use (-static-libtool-libs) means to use
    1.17 +# static linking with libraries that supply a .la file and which
    1.18 +# include a non-empty value for "old_library". If the library doesn't
    1.19 +# include a .la file (they are deleted by some distributions), then
    1.20 +# this option will have no effect and likewise if old_library is set
    1.21 +# to '' (eg., if the library was build with --disable-static) then
    1.22 +# again -static-libtool-libs will have no effect.
    1.23 +#
    1.24 +# If old_library is set to a non-empty value, then specifying
    1.25 +# -static-libtool-libs will cause the link to fail if the old library
    1.26 +# cannot be found (libtool will not fallback to a shared library
    1.27 +# in these circumstances). This can happen with Fedora, for example,
    1.28 +# if a main mingw32 library package is installed but not the
    1.29 +# coresponding static sub-package. The solution is to either
    1.30 +# install the relevant static sub-packages or don't use --disable-shared.
    1.31 +AS_IF([test "$enable_shared" = no],[
    1.32 +  LDFLAGS="$LDFLAGS -static-libtool-libs"
    1.33 +])
    1.34 +LT_OUTPUT
    1.35 +ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
    1.36 +ac_link="./libtool --mode=link --tag=CC $ac_link"
    1.37  AC_PROG_MAKE_SET
    1.38  AC_PROG_LN_S
    1.39  AC_SYS_LARGEFILE