changes to allow building on Solaris 10

Fixes #3456
This commit is contained in:
Kurtis Rader 2016-12-07 16:21:08 -08:00
parent 8e1661cd22
commit 0019c12af3
3 changed files with 32 additions and 2 deletions

View file

@ -323,6 +323,7 @@ AC_CHECK_FUNCS( wcslcpy lrand48_r killpg )
AC_CHECK_FUNCS( backtrace_symbols getifaddrs )
AC_CHECK_FUNCS( futimens clock_gettime )
AC_CHECK_FUNCS( getpwent flock )
AC_CHECK_FUNCS( dirfd )
AC_CHECK_DECL( [mkostemp], [ AC_CHECK_FUNCS([mkostemp]) ] )

View file

@ -91,7 +91,6 @@ char *tparm_solaris_kludge(char *str, ...) {
#endif
#if __APPLE__
/// Fallback implementations of wcsdup and wcscasecmp. On systems where these are not needed (e.g.
/// building on Linux) these should end up just being stripped, as they are static functions that
/// are not referenced in this file.
@ -105,7 +104,6 @@ __attribute__((unused)) static wchar_t *wcsdup_fallback(const wchar_t *in) {
memcpy(out, in, sizeof(wchar_t) * (len + 1));
return out;
}
#endif
__attribute__((unused)) static int wcscasecmp_fallback(const wchar_t *a, const wchar_t *b) {
if (*a == 0) {
@ -160,6 +158,19 @@ int wcsncasecmp(const wchar_t *a, const wchar_t *b, size_t n) {
#endif // __DARWIN_C_LEVEL >= 200809L
#endif // __APPLE__
/// These functions are missing from Solaris 10
#ifndef HAVE_WCSDUP
wchar_t *wcsdup(const wchar_t *in) { return wcsdup_fallback(in); }
#endif
#ifndef HAVE_WCSCASECMP
int wcscasecmp(const wchar_t *a, const wchar_t *b) { return wcscasecmp_fallback(a, b); }
#endif
#ifndef HAVE_WCSNCASECMP
int wcsncasecmp(const wchar_t *a, const wchar_t *b, size_t n) {
return wcsncasecmp_fallback(a, b, n);
}
#endif
#ifndef HAVE_WCSNDUP
wchar_t *wcsndup(const wchar_t *in, size_t c) {
wchar_t *res = (wchar_t *)malloc(sizeof(wchar_t) * (c + 1));

View file

@ -77,6 +77,24 @@ wchar_t *wcsndup(const wchar_t *in, size_t c);
#endif
#endif //__APPLE__
/// These functions are missing from Solaris 10
#ifndef HAVE_WCSDUP
wchar_t *wcsdup(const wchar_t *in);
#endif
#ifndef HAVE_WCSCASECMP
int wcscasecmp(const wchar_t *a, const wchar_t *b);
#endif
#ifndef HAVE_WCSNCASECMP
int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
#endif
#ifndef HAVE_DIRFD
#ifndef __XOPEN_OR_POSIX
#define dirfd(d) (d->dd_fd)
#else
#define dirfd(d) (d->d_fd)
#endif
#endif
#ifndef HAVE_WCSNDUP
/// Fallback for wcsndup function. Returns a copy of \c in, truncated to a maximum length of \c c.
wchar_t *wcsndup(const wchar_t *in, size_t c);