Fixed bug 4354 - CMake builds do not correctly enable IME on Linux
authorSam Lantinga <slouken@libsdl.org>
Mon, 05 Aug 2019 23:46:09 -0700
changeset 130011353fb9be62b
parent 13000 e6407f3ddba3
child 13002 4436f8e76e5c
Fixed bug 4354 - CMake builds do not correctly enable IME on Linux

Callum McGing

While the CMake build checks for ibus and does enable the ibus backend with set(HAVE_IBUS_IBUS_H TRUE), this does not define SDL_USE_IME, thus CMake built SDL2 (as in Arch Linux) cannot use IME at all.

The attached patch fixes this behaviour when building against ibus. IME support will still fail when only fcitx is available on the build system.
CMakeLists.txt
configure
configure.ac
     1.1 --- a/CMakeLists.txt	Mon Aug 05 23:38:48 2019 -0700
     1.2 +++ b/CMakeLists.txt	Mon Aug 05 23:46:09 2019 -0700
     1.3 @@ -1114,6 +1114,7 @@
     1.4          set(HAVE_IBUS_IBUS_H TRUE)
     1.5          include_directories(${IBUS_INCLUDE_DIRS})
     1.6          list(APPEND EXTRA_LIBS ${IBUS_LIBRARIES})
     1.7 +        add_definitions(-DSDL_USE_IME)
     1.8        endif()
     1.9        if(HAVE_LIBUNWIND_H)
    1.10          # We've already found the header, so REQUIRE the lib to be present
     2.1 --- a/configure	Mon Aug 05 23:38:48 2019 -0700
     2.2 +++ b/configure	Mon Aug 05 23:46:09 2019 -0700
     2.3 @@ -22731,7 +22731,7 @@
     2.4  
     2.5  $as_echo "#define SDL_USE_IME 1" >>confdefs.h
     2.6  
     2.7 -            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
     2.8 +        SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
     2.9      fi
    2.10  }
    2.11  
     3.1 --- a/configure.ac	Mon Aug 05 23:38:48 2019 -0700
     3.2 +++ b/configure.ac	Mon Aug 05 23:46:09 2019 -0700
     3.3 @@ -2602,7 +2602,7 @@
     3.4                    , enable_ime=yes)
     3.5      if test x$enable_ime = xyes; then
     3.6          AC_DEFINE(SDL_USE_IME, 1, [ ])
     3.7 -            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
     3.8 +        SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
     3.9      fi
    3.10  }
    3.11