Make wcwidth configurable (#4816)

* Make wcwidth configurable

This adds the cmake option "INTERNAL_WCWIDTH" (to be set to "ON" or
"OFF") and the configure option --[en,dis]able-internal-wcwidth.

Both default to enabling our fallback, but can be set to use the system's wcwidth again.

Sequel to #4554.
See #4571, #4539, #4609.

On my system, this would fix #4306.
This commit is contained in:
Fabian Homborg 2018-03-25 10:19:57 +02:00 committed by GitHub
parent 669eafb55f
commit ad5bbeb3c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -90,6 +90,13 @@ SET_SOURCE_FILES_PROPERTIES(src/fish_version.cpp
PROPERTIES OBJECT_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/${FBVF})
OPTION(INTERNAL_WCWIDTH "use fallback wcwidth" ON)
IF(INTERNAL_WCWIDTH)
add_definitions(-DHAVE_BROKEN_WCWIDTH=1)
ELSE()
add_definitions(-DHAVE_BROKEN_WCWIDTH=0)
ENDIF()
# Set up PCRE2
INCLUDE(cmake/PCRE2.cmake)

View file

@ -25,6 +25,7 @@ AC_SUBST(HAVE_DOXYGEN)
AC_SUBST(LDFLAGS_FISH)
AC_SUBST(WCHAR_T_BITS)
AC_SUBST(EXTRA_PCRE2)
AC_SUBST(HAVE_BROKEN_WCWIDTH)
#
# If needed, run autoconf to regenerate the configure file
@ -599,6 +600,20 @@ AC_ARG_WITH(
[included_pcre2=auto]
)
HAVE_BROKEN_WCWIDTH=
AC_ARG_ENABLE(
[wcwidth],
AS_HELP_STRING(
[--disable-internal-wcwidth],
[use system wcwidth instead of the bundled version]
))
if test "x$enable_wcwidth" != "xno"; then
AC_DEFINE([HAVE_BROKEN_WCWIDTH], [1], [banana])
else
AC_DEFINE([HAVE_BROKEN_WCWIDTH], [0], [banana])
fi
if test "x$included_pcre2" != "xyes"; then
# test for pcre2-config