From: Ivan Maidanski Date: Thu, 22 Sep 2011 11:46:54 +0000 (+0400) Subject: Define GC_DLL if building only dynamic libraries. X-Git-Tag: gc7_2~121^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2942741ad382e6e09123bed1a414893a8554a00f;p=gc 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. --- diff --git a/configure.ac b/configure.ac index 5040363d..89b97a29 100644 --- a/configure.ac +++ b/configure.ac @@ -104,6 +104,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 @@ -261,6 +265,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], @@ -407,6 +416,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 4a030cf3..d8772fda 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 -------------