From 9856efc7b0d5653aea17f1f7e58c6ff97a0b6b35 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 26 Mar 2009 12:22:08 +0000 Subject: [PATCH] * Support doing a fully static build. Statically linked Nix binaries will be useful as a fallback on platforms for which there are no RPMs/Debs available. --- configure.ac | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 29b741927..ac76beb1e 100644 --- a/configure.ac +++ b/configure.ac @@ -50,14 +50,30 @@ AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier (`cpu-os')]) test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var +# Whether to produce a statically linked binary. On Cygwin, this is +# the default: dynamically linking against the ATerm DLL does work, +# except that it requires the ATerm "lib" directory to be in $PATH, as +# Windows doesn't have anything like an RPATH embedded in executable. +# Since this is kind of annoying, we use static libraries for now. + +AC_ARG_ENABLE(static-nix, AC_HELP_STRING([--enable-statix-nix], + [produce statically linked binaries]), + static_nix=$enableval, static_nix=no) + +if test "$sys_name" = cygwin; then + static_nix=yes +fi + +if test "$static_nix" = yes; then + AC_DISABLE_SHARED + AC_ENABLE_STATIC +fi + + # Windows-specific stuff. if test "$sys_name" = "cygwin"; then # We cannot delete open files. AC_DEFINE(CANNOT_DELETE_OPEN_FILES, 1, [Whether it is impossible to delete open files.]) - - # Shared libraries don't work, currently. - AC_DISABLE_SHARED - AC_ENABLE_STATIC fi @@ -276,13 +292,10 @@ if test "$(uname)" = "Darwin"; then fi -if test "$sys_name" = "cygwin"; then - # Dynamically linking against the ATerm DLL does work, except that it requires - # the ATerm "lib" directory to be in $PATH, as Windows doesn't have anything - # like an RPATH embedded in executable. Since this is kind of annoying, we - # use static libraries for now. This has to happen at the end of - # configure, because the C compiler doesn't know about -all-static - # (it's filtered out by libtool, but configure doesn't use libtool). +if test "$static_nix" = yes; then + # `-all-static' has to be added at the end of configure, because + # the C compiler doesn't know about -all-static (it's filtered out + # by libtool, but configure doesn't use libtool). LDFLAGS="-all-static $LDFLAGS" fi