summaryrefslogtreecommitdiff
path: root/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-01-04 17:43:19 -0800
committerGuy Harris <guy@alum.mit.edu>2015-01-05 01:44:12 +0000
commitfc39b9b151c94054d73e1aa8cdc4bb610045d661 (patch)
tree64cc81c8008712cba238666abd458319bb7fdf3a /ConfigureChecks.cmake
parent533f85785b3149c13a68658294a5ec3f24f02143 (diff)
downloadwireshark-fc39b9b151c94054d73e1aa8cdc4bb610045d661.tar.gz
In CMake, check for thousands-grouping support in the GLib printf routines.
We do that with the autotools; do it with CMake as well. We could, in theory, handle thosands-grouping ourselves, on all platforms supporting ANSI C (for which read "all platforms we care about") by using localeconv()'s thousands_sep and grouping items, but that's a bit more work. Fix autotools' comment for that item while we're at it (it checks the GLib printf routines, not the system printf routines). Change-Id: I000f0f3b955d9b192ade15e3fabc46d6b48a052e Reviewed-on: https://code.wireshark.org/review/6317 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r--ConfigureChecks.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index fcf3535d49..d24f55213a 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -147,3 +147,34 @@ if (NL_FOUND)
HAVE_NL80211_SPLIT_WIPHY_DUMP
)
endif()
+
+#
+# Check whether GLib's printf supports thousands grouping. (This might
+# be different from the system's printf since GLib can optionally use
+# its own printf implementation.)
+#
+if (CMAKE_CROSSCOMPILING)
+ #
+ # Play it safe when cross-compiling.
+ #
+ set(HAVE_GLIB_PRINTF_GROUPING FALSE)
+else()
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS})
+ set(CMAKE_REQUIRED_LIBRARIES ${GLIB2_LIBRARIES})
+ check_c_source_runs(
+ "#include <glib.h>
+ #include <locale.h>
+ #include <stdio.h>
+ #include <string.h>
+
+ int
+ main ()
+ {
+ gchar *str;
+ setlocale(LC_ALL, \"en_US.UTF-8\");
+ str = g_strdup_printf(\"%'u\", 123456);
+ return (strcmp (str, \"123,456\") != 0);
+ }" HAVE_GLIB_PRINTF_GROUPING)
+ cmake_pop_check_state()
+endif()