--- CMakeLists.txt.orig	2026-03-29 08:20:23 UTC
+++ CMakeLists.txt
@@ -96,11 +96,13 @@ option(ENABLE_ALIAS          "Enable Alias plugin"    
 option(ENABLE_ZSTD           "Enable Zstandard compression"             ON)
 option(ENABLE_CJSON          "Enable cJSON support"                     ON)
 option(ENABLE_ALIAS          "Enable Alias plugin"                      ON)
+option(ENABLE_BACKTRACE      "Enable backtraces (via libexecinfo)"      ON)
 option(ENABLE_BUFLIST        "Enable Buflist plugin"                    ON)
 option(ENABLE_CHARSET        "Enable Charset plugin"                    ON)
 option(ENABLE_EXEC           "Enable Exec plugin"                       ON)
 option(ENABLE_FIFO           "Enable FIFO plugin"                       ON)
 option(ENABLE_FSET           "Enable Fast Set plugin"                   ON)
+option(ENABLE_ICONV          "Enable character conversion support"      ON)
 option(ENABLE_IRC            "Enable IRC plugin"                        ON)
 option(ENABLE_LOGGER         "Enable Logger plugin"                     ON)
 option(ENABLE_RELAY          "Enable Relay plugin"                      ON)
@@ -258,13 +260,15 @@ endif()
   add_definitions(-DHAVE_CJSON)
 endif()
 
-# Check for iconv
-find_package(Iconv)
-if(ICONV_FOUND)
-  if(ICONV_LIBRARY)
-    list(APPEND EXTRA_LIBS ${ICONV_LIBRARY})
+if(ENABLE_ICONV)
+  # Check for iconv
+  find_package(Iconv)
+  if(ICONV_FOUND)
+    if(ICONV_LIBRARY)
+      list(APPEND EXTRA_LIBS ${ICONV_LIBRARY})
+    endif()
+    add_definitions(-DHAVE_ICONV)
   endif()
-  add_definitions(-DHAVE_ICONV)
 endif()
 
 # Check for CURL
@@ -290,12 +294,14 @@ endif()
   add_custom_target(translations COMMAND true)
 endif()
 
-if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
-  find_library(EXECINFO_LIB_PATH execinfo /usr/local/lib)
-  check_function_exists(backtrace HAVE_BACKTRACE)
-  list(APPEND EXTRA_LIBS "execinfo")
-else()
-  check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE)
+if(ENABLE_BACKTRACE)
+  if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+    find_library(EXECINFO_LIB_PATH execinfo /usr/local/lib)
+    check_function_exists(backtrace HAVE_BACKTRACE)
+    list(APPEND EXTRA_LIBS "execinfo")
+  else()
+    check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE)
+  endif()
 endif()
 
 if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku")
@@ -343,10 +349,10 @@ set(exec_prefix "\${prefix}")
 set(PACKAGE "${PROJECT_NAME}")
 set(prefix "${CMAKE_INSTALL_PREFIX}")
 set(exec_prefix "\${prefix}")
-string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${prefix}" libdir "${LIBDIR}")
+string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${prefix}" libdir "${LIBDATADIR}")
 set(includedir "\${prefix}/include")
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/weechat.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/weechat.pc" @ONLY)
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat.pc" DESTINATION "${LIBDIR}/pkgconfig")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/weechat.pc" DESTINATION "${LIBDATADIR}/pkgconfig")
 
 # cygport file (used to build Cygwin packages)
 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/weechat.cygport.in" "${CMAKE_CURRENT_BINARY_DIR}/weechat-${VERSION}-1.cygport" @ONLY)
