about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-03-26T12·22+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-03-26T12·22+0000
commit9856efc7b0d5653aea17f1f7e58c6ff97a0b6b35 (patch)
treeec28e7e3d95b727af2464f0f77110f31daf104d1
parent5dd8fb20691c375778fd73bf613d4988df72fb50 (diff)
* 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.

-rw-r--r--configure.ac35
1 files changed, 24 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 29b741927422..ac76beb1e0fc 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