[xerces-c] 02/02: XERCESC-2196 - cross-compiling issue

[email protected]
Newsgroups gmane.text.xml.xerces-c.devel
Message-ID <[email protected]>
This is an automated email from the ASF dual-hosted git repository.

scantor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/xerces-c.git

commit 472f612906ef860fab667af39fba51f01f2574db
Author: Scott Cantor <[email protected]>
AuthorDate: Thu Oct 6 09:37:11 2022 -0400

    XERCESC-2196 - cross-compiling issue
    
    https://issues.apache.org/jira/browse/XERCESC-2196
---
 configure.ac | 46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 4e804aec9..2e920856f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -221,6 +221,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 <wchar.h>
+                            #include <string.h>]],
+                                    [[
+                            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])
@@ -243,7 +265,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 <wchar.h>
+                        #include <string.h>]],
+                                [[
+                        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])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.