From 94d15f75af169f0286aa18370d33619ffafa75c8 Mon Sep 17 00:00:00 2001 From: Ayoub Serti Date: Fri, 8 May 2020 16:36:03 +0000 Subject: [PATCH] fix configure for cross-compilation --- configure.ac | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1a38ec8fd..e155006e0 100644 --- a/configure.ac +++ b/configure.ac @@ -247,6 +247,28 @@ else [ AC_MSG_RESULT([no]) AC_DEFINE_UNQUOTED([HAVE_WCSRTOMBS], 0, [Define to 1 if you have the `wcsrtombs' function.]) + ], + [ + AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include + #include ]], + [[ + mbstate_t st; + memset(&st, 0, sizeof(st)); + char buffer[32]; + const wchar_t* src=L"help"; + wcsrtombs(buffer, &src, 32, &st); + if(src==0) + return 0; + else + return 1;]])], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED([HAVE_WCSRTOMBS], 1, [Define to 1 if you have the `wcsrtombs' function.]) + ], + [ + AC_MSG_RESULT([no]) + AC_DEFINE_UNQUOTED([HAVE_WCSRTOMBS], 0, [Define to 1 if you have the `wcsrtombs' function.]) + ]) ] ) AC_MSG_CHECKING([for mbsrtowcs]) @@ -269,7 +291,29 @@ else [ AC_MSG_RESULT([no]) AC_DEFINE_UNQUOTED([HAVE_MBSRTOWCS], 0, [Define to 1 if you have the `mbsrtowcs' function.]) - ] + ], + [ + AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include + #include ]], + [[ + mbstate_t st; + memset(&st, 0, sizeof(st)); + wchar_t buffer[32]; + const char* src="help"; + mbsrtowcs(buffer, &src, 32, &st); + if(src==0) + return 0; + else + return 1;]])], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED([HAVE_MBSRTOWCS], 1, [Define to 1 if you have the `mbsrtowcs' function.]) + ], + [ + AC_MSG_RESULT([no]) + AC_DEFINE_UNQUOTED([HAVE_MBSRTOWCS], 0, [Define to 1 if you have the `mbsrtowcs' function.]) + ]) + ] ) AC_MSG_CHECKING([if iconv uses const pointers])