configure.in More work on enabling static building on Windows. When

2008-04-21  Tor Lillqvist  <tml@novell.com>

	* configure.in
	* */Makefile.am: More work on enabling static building on
	Windows. When building statically: Also define
	GOBJECT_STATIC_COMPILATION in glibconfig.h so that also the
	variables in gparamspecs.h get declared without any
	dllimport/dllexport decorations. Don't install .def files which
	obviously have no meaning for static libraries. Don't create MS
	import libraries. Don't do any resource object files.


svn path=/trunk/; revision=6866
This commit is contained in:
Tor Lillqvist 2008-04-21 08:38:36 +00:00 committed by Tor Lillqvist
parent 6965703ad2
commit 336cc8436b
7 changed files with 73 additions and 61 deletions

View File

@ -1,3 +1,14 @@
2008-04-21 Tor Lillqvist <tml@novell.com>
* configure.in
* */Makefile.am: More work on enabling static building on
Windows. When building statically: Also define
GOBJECT_STATIC_COMPILATION in glibconfig.h so that also the
variables in gparamspecs.h get declared without any
dllimport/dllexport decorations. Don't install .def files which
obviously have no meaning for static libraries. Don't create MS
import libraries. Don't do any resource object files.
2008-04-18 17:40:58 Tim Janik <timj@imendio.com> 2008-04-18 17:40:58 Tim Janik <timj@imendio.com>
* tests/testglib.c: fixed gstdio.h include. * tests/testglib.c: fixed gstdio.h include.

View File

@ -491,10 +491,12 @@ if test "$glib_native_win32" = "yes"; then
fi fi
if test x$enable_static = xyes; then if test x$enable_static = xyes; then
glib_win32_static_compilation=yes glib_win32_static_compilation=yes
GLIB_WIN32_STATIC_COMPILATION_DEFINE="#define GLIB_STATIC_COMPILATION 1" GLIB_WIN32_STATIC_COMPILATION_DEFINE="#define GLIB_STATIC_COMPILATION 1
#define GOBJECT_STATIC_COMPILATION 1"
AC_SUBST(GLIB_WIN32_STATIC_COMPILATION_DEFINE) AC_SUBST(GLIB_WIN32_STATIC_COMPILATION_DEFINE)
fi fi
fi fi
AM_CONDITIONAL(OS_WIN32_AND_DLL_COMPILATION, [test x$glib_native_win32 = xyes -a x$glib_win32_static_compilation != xyes])
dnl dnl
dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R) dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
@ -3203,7 +3205,8 @@ case $host in
esac esac
glib_static_compilation="" glib_static_compilation=""
if test x$glib_win32_static_compilation = xyes; then if test x$glib_win32_static_compilation = xyes; then
glib_static_compilation="#define GLIB_STATIC_COMPILATION 1" glib_static_compilation="#define GLIB_STATIC_COMPILATION 1
#define GOBJECT_STATIC_COMPILATION 1"
fi fi
]) ])

View File

@ -8,18 +8,20 @@ if OS_UNIX
SUBDIRS += xdgmime SUBDIRS += xdgmime
endif endif
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE if MS_LIB_AVAILABLE
noinst_DATA = gio-2.0.lib noinst_DATA = gio-2.0.lib
install_ms_lib_cmd = $(INSTALL) gio-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gio-2.0.lib
endif
endif
install-ms-lib: install-ms-lib:
$(INSTALL) gio-2.0.lib $(DESTDIR)$(libdir) $(install_ms_lib_cmd)
uninstall-ms-lib: uninstall-ms-lib:
-rm $(DESTDIR)$(libdir)/gio-2.0.lib $(uninstall_ms_lib_cmd)
else
install-ms-lib:
uninstall-ms-lib:
endif
gio.def: gio.symbols gio.def: gio.symbols
(echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gio.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g' | sort) > gio.def.tmp && \ (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gio.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g' | sort) > gio.def.tmp && \
@ -228,7 +230,7 @@ if PLATFORM_WIN32
no_undefined = -no-undefined no_undefined = -no-undefined
endif endif
if OS_WIN32 if OS_WIN32_AND_DLL_COMPILATION
export_symbols = -export-symbols gio.def export_symbols = -export-symbols gio.def
gio_def = gio.def gio_def = gio.def

View File

@ -81,18 +81,20 @@ BUILT_EXTRA_DIST = \
lib_LTLIBRARIES = libglib-2.0.la lib_LTLIBRARIES = libglib-2.0.la
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE if MS_LIB_AVAILABLE
noinst_DATA = glib-2.0.lib noinst_DATA = glib-2.0.lib
install_ms_lib_cmd = $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/glib-2.0.lib
endif
endif
install-ms-lib: install-ms-lib:
$(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir) $(install_ms_lib_cmd)
uninstall-ms-lib: uninstall-ms-lib:
-rm $(DESTDIR)$(libdir)/glib-2.0.lib $(uninstall_ms_lib_cmd)
else
install-ms-lib:
uninstall-ms-lib:
endif
libglib_2_0_la_SOURCES = \ libglib_2_0_la_SOURCES = \
garray.c \ garray.c \
@ -251,8 +253,12 @@ if PLATFORM_WIN32
no_undefined = -no-undefined no_undefined = -no-undefined
endif endif
if OS_WIN32 if OS_WIN32_AND_DLL_COMPILATION
export_symbols = -export-symbols glib.def export_symbols = -export-symbols glib.def
glib_win32_res = glib-win32-res.o
glib_win32_res_ldflag = -Wl,$(glib_win32_res)
glib_def = glib.def glib_def = glib.def
install-def-file: install-def-file:
@ -267,11 +273,6 @@ uninstall-def-file:
export_symbols = $(LIBTOOL_EXPORT_OPTIONS) export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
endif endif
if OS_WIN32
glib_win32_res = glib-win32-res.o
glib_win32_res_ldflag = -Wl,$(glib_win32_res)
endif
if ENABLE_REGEX if ENABLE_REGEX
if USE_SYSTEM_PCRE if USE_SYSTEM_PCRE
pcre_lib = $(PCRE_LIBS) pcre_lib = $(PCRE_LIBS)
@ -303,10 +304,10 @@ INSTALL_PROGS += gspawn-win32-helper gspawn-win32-helper-console
gspawn_win32_helper_LDADD = libglib-2.0.la gspawn_win32_helper_LDADD = libglib-2.0.la
gspawn_win32_helper_LDFLAGS = -mwindows gspawn_win32_helper_LDFLAGS = -mwindows
gspawn_win32_helper_console_LDADD = libglib-2.0.la gspawn_win32_helper_console_LDADD = libglib-2.0.la
endif
glib-win32-res.o: glib.rc glib-win32-res.o: glib.rc
$(WINDRES) glib.rc $@ $(WINDRES) glib.rc $@
endif
bin_PROGRAMS = ${INSTALL_PROGS} bin_PROGRAMS = ${INSTALL_PROGS}

View File

@ -40,27 +40,32 @@ top_builddir_full=`cd \$(top_builddir); pwd`
lib_LTLIBRARIES = libgmodule-2.0.la lib_LTLIBRARIES = libgmodule-2.0.la
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE if MS_LIB_AVAILABLE
noinst_DATA = gmodule-2.0.lib noinst_DATA = gmodule-2.0.lib
install_ms_lib_cmd = $(INSTALL) gmodule-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gmodule-2.0.lib
endif
endif
install-ms-lib: install-ms-lib:
$(INSTALL) gmodule-2.0.lib $(DESTDIR)$(libdir) $(install_ms_lib_cmd)
uninstall-ms-lib: uninstall-ms-lib:
-rm $(DESTDIR)$(libdir)/gmodule-2.0.lib $(uninstall_ms_lib_cmd)
else
install-ms-lib:
uninstall-ms-lib:
endif
if PLATFORM_WIN32 if PLATFORM_WIN32
no_undefined = -no-undefined no_undefined = -no-undefined
endif endif
if OS_WIN32 if OS_WIN32_AND_DLL_COMPILATION
export_symbols = -export-symbols $(srcdir)/gmodule.def export_symbols = -export-symbols $(srcdir)/gmodule.def
gmodule_def = gmodule.def gmodule_def = gmodule.def
gmodule_win32_res = gmodule-win32-res.o
gmodule_win32_res_ldflag = -Wl,$(gmodule_win32_res)
install-def-file: install-def-file:
$(INSTALL) $(srcdir)/gmodule.def $(DESTDIR)$(libdir)/gmodule-2.0.def $(INSTALL) $(srcdir)/gmodule.def $(DESTDIR)$(libdir)/gmodule-2.0.def
@ -71,11 +76,6 @@ install-def-file:
uninstall-def-file: uninstall-def-file:
endif endif
if OS_WIN32
gmodule_win32_res = gmodule-win32-res.o
gmodule_win32_res_ldflag = -Wl,$(gmodule_win32_res)
endif
libgmodule_2_0_la_SOURCES = gmodule.c libgmodule_2_0_la_SOURCES = gmodule.c
libgmodule_2_0_la_LDFLAGS = \ libgmodule_2_0_la_LDFLAGS = \
$(gmodule_win32_res_ldflag) \ $(gmodule_win32_res_ldflag) \
@ -87,10 +87,8 @@ libgmodule_2_0_la_LIBADD = $(G_MODULE_LIBS_EXTRA) $(G_MODULE_LIBS) $(libglib)
libgmodule_2_0_la_DEPENDENCIES = $(gmodule_win32_res) $(gmodule_def) libgmodule_2_0_la_DEPENDENCIES = $(gmodule_win32_res) $(gmodule_def)
if OS_WIN32
gmodule-win32-res.o: gmodule.rc gmodule-win32-res.o: gmodule.rc
$(WINDRES) gmodule.rc $@ $(WINDRES) gmodule.rc $@
endif
gmodule-2.0.lib: libgmodule-2.0.la gmodule.def gmodule-2.0.lib: libgmodule-2.0.la gmodule.def
lib -name:libgmodule-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(srcdir)/gmodule.def -out:$@ lib -name:libgmodule-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(srcdir)/gmodule.def -out:$@

View File

@ -36,27 +36,32 @@ libglib = $(top_builddir)/glib/libglib-2.0.la
# libraries to compile and install # libraries to compile and install
lib_LTLIBRARIES = libgobject-2.0.la lib_LTLIBRARIES = libgobject-2.0.la
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE if MS_LIB_AVAILABLE
noinst_DATA = gobject-2.0.lib noinst_DATA = gobject-2.0.lib
install_ms_lib_cmd = $(INSTALL) gobject-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gobject-2.0.lib
endif
endif
install-ms-lib: install-ms-lib:
$(INSTALL) gobject-2.0.lib $(DESTDIR)$(libdir) $(install_ms_lib_cmd)
uninstall-ms-lib: uninstall-ms-lib:
-rm $(DESTDIR)$(libdir)/gobject-2.0.lib $(uninstall_ms_lib_cmd)
else
install-ms-lib:
uninstall-ms-lib:
endif
if PLATFORM_WIN32 if PLATFORM_WIN32
no_undefined = -no-undefined no_undefined = -no-undefined
endif endif
if OS_WIN32 if OS_WIN32_AND_DLL_COMPILATION
export_symbols = -export-symbols gobject.def export_symbols = -export-symbols gobject.def
gobject_def = gobject.def gobject_def = gobject.def
gobject_win32_res = gobject-win32-res.o
gobject_win32_res_ldflag = -Wl,$(gobject_win32_res)
install-def-file: install-def-file:
$(INSTALL) gobject.def $(DESTDIR)$(libdir)/gobject-2.0.def $(INSTALL) gobject.def $(DESTDIR)$(libdir)/gobject-2.0.def
@ -69,11 +74,6 @@ uninstall-def-file:
export_symbols = $(LIBTOOL_EXPORT_OPTIONS) export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
endif endif
if OS_WIN32
gobject_win32_res = gobject-win32-res.o
gobject_win32_res_ldflag = -Wl,$(gobject_win32_res)
endif
# libtool stuff: set version and export symbols for resolving # libtool stuff: set version and export symbols for resolving
libgobjectincludedir = $(includedir)/glib-2.0/gobject libgobjectincludedir = $(includedir)/glib-2.0/gobject
libgobject_2_0_la_LDFLAGS = \ libgobject_2_0_la_LDFLAGS = \
@ -240,11 +240,8 @@ BUILT_EXTRA_DIST = \
gobjectalias.h \ gobjectalias.h \
gobjectaliasdef.c gobjectaliasdef.c
if OS_WIN32
gobject-win32-res.o: gobject.rc gobject-win32-res.o: gobject.rc
$(WINDRES) gobject.rc $@ $(WINDRES) gobject.rc $@
endif
gobject-2.0.lib: libgobject-2.0.la gobject.def gobject-2.0.lib: libgobject-2.0.la gobject.def
lib -name:libgobject-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:gobject.def -out:$@ lib -name:libgobject-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:gobject.def -out:$@

View File

@ -28,24 +28,26 @@ top_builddir_full=`cd \$(top_builddir); pwd`
lib_LTLIBRARIES = libgthread-2.0.la lib_LTLIBRARIES = libgthread-2.0.la
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE if MS_LIB_AVAILABLE
noinst_DATA = gthread-2.0.lib noinst_DATA = gthread-2.0.lib
install_ms_lib_cmd = $(INSTALL) gthread-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gthread-2.0.lib
endif
endif
install-ms-lib: install-ms-lib:
$(INSTALL) gthread-2.0.lib $(DESTDIR)$(libdir) $(install_ms_lib_cmd)
uninstall-ms-lib: uninstall-ms-lib:
-rm $(DESTDIR)$(libdir)/gthread-2.0.lib $(uninstall_ms_lib_cmd)
else
install-ms-lib:
uninstall-ms-lib:
endif
if PLATFORM_WIN32 if PLATFORM_WIN32
no_undefined = -no-undefined no_undefined = -no-undefined
endif endif
if OS_WIN32 if OS_WIN32_AND_DLL_COMPILATION
export_symbols = -export-symbols $(srcdir)/gthread.def export_symbols = -export-symbols $(srcdir)/gthread.def
gthread_def = gthread.def gthread_def = gthread.def
@ -59,7 +61,7 @@ install-def-file:
uninstall-def-file: uninstall-def-file:
endif endif
if OS_WIN32 if OS_WIN32_AND_DLL_COMPILATION
gthread_win32_res = gthread-win32-res.o gthread_win32_res = gthread-win32-res.o
gthread_win32_res_ldflag = -Wl,$(gthread_win32_res) gthread_win32_res_ldflag = -Wl,$(gthread_win32_res)
endif endif
@ -74,10 +76,8 @@ libgthread_2_0_la_LIBADD = $(G_THREAD_LIBS_EXTRA) $(G_THREAD_LIBS_FOR_GTHREAD) $
libgthread_2_0_la_DEPENDENCIES = $(gthread_win32_res) $(gthread_def) libgthread_2_0_la_DEPENDENCIES = $(gthread_win32_res) $(gthread_def)
if OS_WIN32
gthread-win32-res.o: gthread.rc gthread-win32-res.o: gthread.rc
$(WINDRES) gthread.rc $@ $(WINDRES) gthread.rc $@
endif
gthread-2.0.lib: libgthread-2.0.la gthread.def gthread-2.0.lib: libgthread-2.0.la gthread.def
lib -name:libgthread-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(srcdir)/gthread.def -out:$@ lib -name:libgthread-2.0-$(LT_CURRENT_MINUS_AGE).dll -def:$(srcdir)/gthread.def -out:$@