* 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.
This commit is contained in:
Eelco Dolstra 2009-03-26 12:22:08 +00:00
parent 5dd8fb2069
commit 9856efc7b0

View file

@ -50,14 +50,30 @@ AC_DEFINE_UNQUOTED(SYSTEM, ["$system"], [platform identifier (`cpu-os')])
test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var 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. # Windows-specific stuff.
if test "$sys_name" = "cygwin"; then if test "$sys_name" = "cygwin"; then
# We cannot delete open files. # We cannot delete open files.
AC_DEFINE(CANNOT_DELETE_OPEN_FILES, 1, [Whether it is impossible to 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 fi
@ -276,13 +292,10 @@ if test "$(uname)" = "Darwin"; then
fi fi
if test "$sys_name" = "cygwin"; then if test "$static_nix" = yes; then
# Dynamically linking against the ATerm DLL does work, except that it requires # `-all-static' has to be added at the end of configure, because
# the ATerm "lib" directory to be in $PATH, as Windows doesn't have anything # the C compiler doesn't know about -all-static (it's filtered out
# like an RPATH embedded in executable. Since this is kind of annoying, we # by libtool, but configure doesn't use libtool).
# 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).
LDFLAGS="-all-static $LDFLAGS" LDFLAGS="-all-static $LDFLAGS"
fi fi