diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-10-29 11:34:21 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-10-29 11:37:59 +0300 |
commit | c0e2c507f11e43f043a866514b5b75c60f71dc53 (patch) | |
tree | 918c80505dd96fc9e364693834bd732805eda71a | |
parent | d4c81638d9087f5c344b0e86de6b2b3827c84f58 (diff) | |
download | bdwgc-c0e2c507f11e43f043a866514b5b75c60f71dc53.tar.gz |
Build with GC_wcsdup support if wcslen exists
Now, digimars.mak, NT_MAKEFILE and WCC_MAKEFILE scripts pass
-D GC_REQUIRE_WCSDUP option to the compiler unconditionally to build
GC_wcsdup API function. CMakeLists.txt and configure.ac pass this
option to the compiler after successful probing whether wcslen() is
provided on the host. Makefile.direct does not pass the option by
default, only the comment about the option is added (because this
script cannot check availability of wcslen in libc).
* CMakeLists.txt (HAVE_WCSLEN): Set if wcslen symbol exists in wchar.h.
* Makefile.direct (CFLAGS_EXTRA): Add comment of -D GC_REQUIRE_WCSDUP.
* NT_MAKEFILE (CFLAGS_DEFAULT): Add -D GC_REQUIRE_WCSDUP.
* WCC_MAKEFILE (DEFS): Likewise.
* digimars.mak (DEFINES): Likewise.
* configure.ac (GC_REQUIRE_WCSDUP): Define if the code snippet
including wchar.h and calling wcslen() can be compiled and linked.
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | Makefile.direct | 4 | ||||
-rw-r--r-- | NT_MAKEFILE | 2 | ||||
-rw-r--r-- | WCC_MAKEFILE | 3 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | digimars.mak | 3 |
6 files changed, 26 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 79babc17..7917be50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -494,6 +494,12 @@ if (NOT HAVE_SIGSETJMP) add_definitions("-DGC_NO_SIGSETJMP") endif() +# Build with GC_wcsdup() support if possible. +check_symbol_exists(wcslen wchar.h HAVE_WCSLEN) +if (HAVE_WCSLEN) + add_definitions("-DGC_REQUIRE_WCSDUP") +endif() + # pthread_setname_np, if available, may have 1, 2 or 3 arguments. if (CMAKE_USE_PTHREADS_INIT) check_c_source_compiles(" diff --git a/Makefile.direct b/Makefile.direct index c6bfe3d3..b7d5af12 100644 --- a/Makefile.direct +++ b/Makefile.direct @@ -72,6 +72,10 @@ CFLAGS+= -I$(srcdir)/include -I$(AO_SRC_DIR)/src \ # To build the collector with fork() support by default, add to the above: # -DHANDLE_FORK +# To build the collector with GC_wcsdup support, provided libc has wcslen(), +# add to the above: +# -DGC_REQUIRE_WCSDUP + # HOSTCC and HOSTCFLAGS are used to build executables that will be run as # part of the build process, i.e. on the build machine. These will usually # be the same as CC and CFLAGS, except in a cross-compilation environment. diff --git a/NT_MAKEFILE b/NT_MAKEFILE index 4ce7582c..ab622988 100644 --- a/NT_MAKEFILE +++ b/NT_MAKEFILE @@ -78,7 +78,7 @@ CFLAGS_EXTRA= CFLAGS_SPECIFIC=$(CFLAGS_DEBUG) $(CFLAGS_GCDLL) $(CFLAGS_MT) -CFLAGS_DEFAULT=-DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION -DUSE_MUNMAP +CFLAGS_DEFAULT=-DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION -DGC_REQUIRE_WCSDUP -DUSE_MUNMAP CXXFLAGS_SPECIFIC=/EHsc diff --git a/WCC_MAKEFILE b/WCC_MAKEFILE index 337ca19d..1062116d 100644 --- a/WCC_MAKEFILE +++ b/WCC_MAKEFILE @@ -27,8 +27,7 @@ OPTIM=-oneatx -s # Extra user-defined flags to pass both to C and C++ compilers. CFLAGS_EXTRA= -DEFS=-DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION #-DSMALL_CONFIG - +DEFS=-DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION -DGC_REQUIRE_WCSDUP #-DSMALL_CONFIG ##### diff --git a/configure.ac b/configure.ac index 57b1b950..acdae18c 100644 --- a/configure.ac +++ b/configure.ac @@ -828,6 +828,18 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <setjmp.h>], AC_DEFINE([GC_NO_SIGSETJMP], [1], [Missing sigsetjmp function.])]) CFLAGS="$old_CFLAGS" +# Build with GC_wcsdup() support if possible. +AC_MSG_CHECKING(for wcslen) +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $CFLAGS_EXTRA" +AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <wchar.h>], + [wchar_t ws[] = {0}; (void)wcslen(&ws)])], + [AC_MSG_RESULT(yes) + AC_DEFINE([GC_REQUIRE_WCSDUP], [1], + [Define and export GC_wcsdup function.])], + [AC_MSG_RESULT(no)]) +CFLAGS="$old_CFLAGS" + # pthread_setname_np, if available, may have 1, 2 or 3 arguments. AS_IF([test "$THREADS" = posix], [AC_MSG_CHECKING(for pthread_setname_np) diff --git a/digimars.mak b/digimars.mak index 2daab07b..d9809dd2 100644 --- a/digimars.mak +++ b/digimars.mak @@ -5,7 +5,8 @@ CFLAGS_EXTRA=
DEFINES=-D_WINDOWS -DGC_DLL -DGC_THREADS -DGC_DISCOVER_TASK_THREADS \
-DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE \
- -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION -DUSE_MUNMAP
+ -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION \
+ -DGC_REQUIRE_WCSDUP -DUSE_MUNMAP
CFLAGS=-Iinclude -Ilibatomic_ops\src $(DEFINES) -g $(CFLAGS_EXTRA)
LFLAGS=/ma/implib/co
CC=sc
|