aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-03-10 17:42:04 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-03-10 17:42:04 +0100
commit67b846c099968439c415ae18fcc6736bdd26e233 (patch)
tree0c2efc26d2ebd0ab5735c20c2582fd6799da3571
parente88f9bb28500bdf2bfe5106b565ab56a0b601239 (diff)
downloadsciteco-67b846c099968439c415ae18fcc6736bdd26e233.tar.gz
added ./configure --enable-static-executables option
* This adds the -all-static libtool option and can be used to link a static sciteco binary (or at least link in as few as possible dynamic libraries) * Esp. useful on MinGW to link in all dependant libraries (glib, libintl, libiconv, libpdcurses, ...) statically. A static .exe is much smaller than a dynamically linked plus all the DLLs and is easier to relocate. * This does not guarantee that ALL libraries are linked in dynamically. E.g. on MinGW, the sciteco.exe will still link to MSVCRT and the Windows system DLLs, but they already ship with Windows. * On MinGW, even a static build will still require the gspawn-win32-helper-console.exe which is used by glib to implement g_spawn with redirection. We cannot get around that. * It would be better to let this be decided by the package builder using the standard env variables like LDFLAGS. However, this does not seem to work well with libtool. It IS possible to define LDFLAGS="-all-static" when calling make but this approach sucks.
-rw-r--r--configure.ac14
-rw-r--r--src/Makefile.am5
2 files changed, 19 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index af4220b..3ddf295 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,6 +223,20 @@ if [[ $bootstrap = no -a x$SCITECO = x ]]; then
fi
AM_CONDITIONAL(BOOTSTRAP, [test x$bootstrap = xyes])
+# This cannot be done with --enable-static as it only controls
+# which kind of libraries libtool builds.
+# Also, it cannot be controlled reliably by setting LDFLAGS for
+# ./configure, as this would be used for linking the test cases
+# without libtool and libtool would ignore it.
+# It is only possible to call `make LDFLAGS="-all-static"` but
+# this is inconvenient...
+AC_ARG_ENABLE(static-executables,
+ AS_HELP_STRING([--enable-static-executables],
+ [Link in as many runtime dependencies as possible
+ statically [default=no]]),
+ [static_executables=$enableval], [static_executables=no])
+AM_CONDITIONAL(STATIC_EXECUTABLES, [test x$static_executables = xyes])
+
AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile])
AC_CONFIG_FILES([doc/Makefile doc/Doxyfile])
AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index c1a1c7d..692ac1d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,11 @@ if NEED_COMPAT
AM_CPPFLAGS += -I@top_srcdir@/compat
endif
+if STATIC_EXECUTABLES
+# AM_LDFLAGS are libtool flags, NOT compiler/linker flags
+AM_LDFLAGS = -all-static
+endif
+
BUILT_SOURCES =
EXTRA_DIST = gtk-info-popup.gob \