summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-10-29 11:34:21 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-10-29 11:37:59 +0300
commitc0e2c507f11e43f043a866514b5b75c60f71dc53 (patch)
tree918c80505dd96fc9e364693834bd732805eda71a /configure.ac
parentd4c81638d9087f5c344b0e86de6b2b3827c84f58 (diff)
downloadbdwgc-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.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 12 insertions, 0 deletions
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)