From 505b041e15e243e0f33540363ac40797e2bff4f4 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 22 Sep 2011 15:46:54 +0400 Subject: [PATCH] Define GC_DLL if building only dynamic libraries. Update README for Cygwin/MinGW. * configure.ac (GC_DLL): New AC template; define if only the dynamic libraries are being built. * configure.ac (THREAD_LOCAL_ALLOC): Define for Win32 implicitly if static libraries are being built (i.e. GC_DLL is not defined). * doc/README.win32: Update "GNU Tools" section. --- configure.ac | 17 +++++++++++++++++ doc/README.win32 | 33 +++++++++++++-------------------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index c3698d2a..6cb6c7fa 100644 --- a/configure.ac +++ b/configure.ac @@ -141,6 +141,10 @@ dnl System header feature requests. AH_TEMPLATE([_POSIX_C_SOURCE], [The POSIX feature macro.]) AH_TEMPLATE([_PTHREADS], [Indicates the use of pthreads (NetBSD).]) +dnl GC API symbols export control. +AH_TEMPLATE([GC_DLL], + [Define to build dynamic libraries with only API symbols exposed.]) + dnl Check for a flavor of supported inline keyword. AC_C_INLINE @@ -298,6 +302,11 @@ case "$THREADS" in if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) AC_DEFINE(THREAD_LOCAL_ALLOC) + else + if test "${enable_static}" == yes; then + # Imply THREAD_LOCAL_ALLOC unless GC_DLL. + AC_DEFINE(THREAD_LOCAL_ALLOC) + fi fi win32_threads=true AC_DEFINE([EMPTY_GETENV_RESULTS], [1], @@ -448,6 +457,14 @@ esac AC_MSG_RESULT($enable_shared) +# Compile with GC_DLL defined unless building static libraries. +if test "${enable_shared}" == yes; then + if test "${enable_static}" == no; then + AC_DEFINE(GC_DLL) + # FIXME: Also pass -fvisibility=hidden option if GCC v4+ and not Win32. + fi +fi + # Configuration of machine-dependent code # AC_MSG_CHECKING(which machine-dependent code should be used) diff --git a/doc/README.win32 b/doc/README.win32 index 2c127497..4131529d 100644 --- a/doc/README.win32 +++ b/doc/README.win32 @@ -68,26 +68,19 @@ absence of thread support). GNU Tools --------- -The collector should be buildable under Cygwin with either the old standard -Makefile, or possibly with the "configure --disable-shared;make" machinery. -(For the latter use --enable-threads=posix for thread support.) The major issue -here seems to be that dynamic library support is not currently enabled for -Cygwin. (This is probably fixable without a great deal of difficulty by -reusing the standard WIN32 code. But it requires some tweaking.) As a result -of this, "configure; make; make check" currently does not completely succeed, -though the static library appears to be OK when used only from the main -programs, and correspondingly the Makefile.direct self tests succeed. - -Mingw32 builds are not regularly tested, and may or may not work. -The following paragraph is probably obsolete: - -For GNU-win32, use the regular makefile, possibly after uncommenting -the line "include Makefile.DLLs". The latter should be necessary only -if you want to package the collector as a DLL. -[Is the following sentence obsolete? -HB] The GNU-win32 port is -believed to work only for b18, not b19, probably due to linker changes -in b19. This is probably fixable with a different definition of -DATASTART and DATAEND in gcconfig.h. +The collector should be buildable under Cygwin with the +"./configure; make check" machinery. + +MinGW builds (including for x86_64) are available via cross-compilation, e.g. +"./configure --host=i686-pc-mingw32; make check" + +To build the collector as a DLL, pass "--enable-shared --disable-static" to +configure (this will instruct make compile with -D GC_DLL). + +Parallel marker could be enabled via "--enable-parallel-mark". + +Memory unmapping could be enabled via "--enable-munmap" (not well supported +on Cygwin currently). Borland Tools ------------- -- 2.50.1