Mostly based on patch submitted by Wallace Wadge (SF Bug
3371547). Also
added some autoconf trickery to disable our printf wrappers; now they're
only compiled for Linux systems that have "ecvt()" (uClibc doesn't have
that). This prevents compiling the wrappers on Solaris and FreeBSD (which
was useless), and makes the code compile on uClibc (also fixing SF Bug
3026491).
uClibc seems tricky, though; depending on how the library is compiled
it won't work. I tried Alpine Linux, and it doesn't ship with uClibc
locale support, so codesetOld.c fails to compile. I added a hack to
work around the issue (not included here) and everything else compiled,
and vmtoolsd seemed to run happily.
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
#include <X11/Xmd.h>])
fi
+bsdPrintfWrappers=no
+if test "$os" = "linux"; then
+ AC_CHECK_LIB([c],
+ [ecvt],
+ [bsdPrintfWrappers=yes],
+ [])
+fi
+
###
### Typdefs, structs, and compiler quarks.
###
AM_CONDITIONAL(HAVE_GTKMM, test "$have_x" = "yes" -a "$with_gtkmm" = "yes")
AM_CONDITIONAL(HAVE_PAM, test "$with_pam" = "yes")
AM_CONDITIONAL(USE_SLASH_PROC, test "os" = "linux" -a "$have_glib_2_14" = "yes")
+AM_CONDITIONAL(USE_PRINTF_WRAPPERS, test "$bsdPrintfWrappers" = "yes")
if test "$have_xsm" != "yes"; then
AC_DEFINE([NO_XSM], 1, [])
* same place (see below). We do not support Glibc 2.0 or older.
*/
-# if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3)
+# if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3) && !defined(__UCLIBC__)
{
/*
* stat structure is same between glibc 2.3 and older glibcs, just
* Linux: Glibc 2.3+ has st_Xtim. Glibc 2.1/2.2 has st_Xtime/__unusedX on
* same place (see below). We do not support Glibc 2.0 or older.
*/
-# if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3)
+# if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3) && !defined(__UCLIBC__)
/*
* stat structure is same between glibc 2.3 and older glibcs, just
* these __unused fields are always zero. If we'll use __unused*
* Linux: Glibc 2.3+ has st_Xtim. Glibc 2.1/2.2 has st_Xtime/__unusedX on
* same place (see below). We do not support Glibc 2.0 or older.
*/
-# if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3)
+# if (__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3) && !defined(__UCLIBC__)
/*
* stat structure is same between glibc 2.3 and older glibcs, just
* these __unused fields are always zero. If we'll use __unused*
* This does not mean it has bsd_vsnwprintf().
*/
#if (defined _WIN32 && !defined STR_NO_WIN32_LIBS) || \
- defined __linux__ || defined __APPLE__
+ (defined __linux__ && !defined __UCLIBC__) || defined __APPLE__
#define HAS_BSD_PRINTF 1
#endif
float *avg1, // IN/OUT:
float *avg2) // IN/OUT:
{
-#if defined(__linux__) || defined(__APPLE__)
+#if (defined(__linux__) && !defined(__UCLIBC__)) || defined(__APPLE__)
double avg[3];
int res;
#define SOLARIS_BASH_PATH "/usr/bin/bash"
#endif
-#if defined(linux) && !defined(GLIBC_VERSION_23)
+#if defined(linux) && !defined(GLIBC_VERSION_23) && !defined(__UCLIBC__)
/*
* Implements the system calls (they are not wrapped by glibc til 2.3.2).
*
noinst_LTLIBRARIES = libString.la
libString_la_SOURCES =
-libString_la_SOURCES += bsd_output_shared.c
-libString_la_SOURCES += bsd_vsnprintf.c
-libString_la_SOURCES += bsd_vsnwprintf.c
+
+if USE_PRINTF_WRAPPERS
+ libString_la_SOURCES += bsd_output_shared.c
+ libString_la_SOURCES += bsd_vsnprintf.c
+ libString_la_SOURCES += bsd_vsnwprintf.c
+endif
+
libString_la_SOURCES += convertutf.c
libString_la_SOURCES += str.c