diff options
-rw-r--r-- | ConfigureChecks.cmake | 31 | ||||
-rw-r--r-- | cmakeconfig.h.in | 3 | ||||
-rw-r--r-- | configure.ac | 2 |
3 files changed, 35 insertions, 1 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() diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index b334cd82bf..f90a561a51 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -78,6 +78,9 @@ /* Define to 1 if you have the <getopt.h> header file. */ #cmakedefine HAVE_GETOPT_H 1 +/* Define if GLib's printf functions support thousands grouping. */ +#cmakedefine HAVE_GLIB_PRINTF_GROUPING 1 + /* Define to 1 if you have the `getprotobynumber' function. */ #cmakedefine HAVE_GETPROTOBYNUMBER 1 diff --git a/configure.ac b/configure.ac index 89a15d4447..1194aa8e54 100644 --- a/configure.ac +++ b/configure.ac @@ -1880,7 +1880,7 @@ CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" if test "$ac_cv_glib_supports_printf_grouping" = yes ; then AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GLIB_PRINTF_GROUPING, 1, [Define if your printf() function supports thousands grouping.]) + AC_DEFINE(HAVE_GLIB_PRINTF_GROUPING, 1, [Define if GLib's printf functions support thousands grouping.]) else AC_MSG_RESULT(no) fi |