void-packages/srcpkgs/xerces-c/patches/fix-configure-cross.patch

125 lines
5.3 KiB
Diff

Remove checks which require running a binary in order to
make cross compiling possible again. The results are all
true for glibc and musl libc, thus unconditionally add
the corresponding defines via AC_DEFINE_UNQUOTED.
--- a/configure.ac
+++ b/configure.ac
@@ -208,113 +208,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#in
]
)
-# The check for mbrlen, wcsrtombs and mbsrtowcs gives a false
-# positive on HP-UX, so we use a different snippet to set the
-# corresponding macro
-# Furthermore, OpenBSD 5.1 doesn't follow the standard that states
-# that the "src" pointer must be set to NULL when a \0 has been
-# converted in the source data, a behaviour that we rely on
-# So we also check for this scenario before using these functions
-AC_MSG_CHECKING([for mbrlen])
-AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <wchar.h>]],
- [[mbstate_t st; mbrlen( "t", 5, &st );]])],
- [
- AC_MSG_RESULT([yes])
- AC_DEFINE_UNQUOTED([HAVE_MBRLEN], 1, [Define to 1 if you have the `mbrlen' function.])
- ],
- [
- AC_MSG_RESULT([no])
- AC_DEFINE_UNQUOTED([HAVE_MBRLEN], 0, [Define to 1 if you have the `mbrlen' function.])
- ]
- )
-AC_MSG_CHECKING([for wcsrtombs])
-AC_RUN_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_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])
-AC_RUN_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_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_DEFINE_UNQUOTED([HAVE_MBRLEN], 1, [Define to 1 if you have the `mbrlen' function.])
+AC_DEFINE_UNQUOTED([HAVE_WCSRTOMBS], 1, [Define to 1 if you have the `wcsrtombs' function.])
+AC_DEFINE_UNQUOTED([HAVE_MBSRTOWCS], 1, [Define to 1 if you have the `mbsrtowcs' function.])
AC_MSG_CHECKING([if iconv uses const pointers])
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <iconv.h>]],