diff options
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r-- | ConfigureChecks.cmake | 31 |
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() |