]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
open-vm-tools: minor adjustments for uClibc.
authorVMware, Inc <>
Thu, 27 Oct 2011 18:22:23 +0000 (11:22 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 27 Oct 2011 18:22:23 +0000 (11:22 -0700)
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>
open-vm-tools/configure.ac
open-vm-tools/lib/file/filePosix.c
open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
open-vm-tools/lib/include/str.h
open-vm-tools/lib/misc/hostinfoPosix.c
open-vm-tools/lib/procMgr/procMgrPosix.c
open-vm-tools/lib/string/Makefile.am

index 502944b3403a8d3f13ee25ec1281aea490f3e6b7..ca7a044857dd98d37eb0283a4f18c87c2fafd1d5 100644 (file)
@@ -800,6 +800,14 @@ if test "$enable_multimon" != "no"; then
        #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.
 ###
@@ -1023,6 +1031,7 @@ AM_CONDITIONAL(HAVE_GNU_LD, test "$with_gnu_ld" = "yes")
 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, [])
index 96d6a01826881619e4f52999f698ac2d2db60dec..6c28288671f5ad776bf1c6ef81d711231edb7049 100644 (file)
@@ -702,7 +702,7 @@ File_GetTimes(ConstUnicode pathName,       // IN:
     *        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
index 5df0a0c08910c4c8da92805c9314c3ee3ca5579c..9125ce7ab6fb20fb61140a4b9264103f9cdd57d9 100644 (file)
@@ -1966,7 +1966,7 @@ HgfsGetCreationTime(const struct stat *stats)
     * 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*
@@ -2432,7 +2432,7 @@ HgfsStatToFileAttr(struct stat *stats,       // IN: stat information
     * 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*
index bb9289bdd9bd45bd879dcabb91db01eb5175ac16..dfec5e395d13045eb4998bd89ce7391969840879 100644 (file)
@@ -61,7 +61,7 @@
  * 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
 
index 31e9cbdc12c77dfeba0d4ac76a25ba16b68437a4..79eadab4d2b3a45d1edc6ebd5f7e2925d9f65853 100644 (file)
@@ -1417,7 +1417,7 @@ HostinfoGetLoadAverage(float *avg0,  // IN/OUT:
                        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;
 
index dd95227c7f8a1914369dc2b64dbb9659912d8faf..a7d205e1085df141cad1c07f13558f6f288c4aba 100644 (file)
@@ -133,7 +133,7 @@ static int ProcMgrGetCommandLineArgs(long pid,
 #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).
  *
index acbb2a88565d88e100c918d69af130f35e9e98a7..558461ad60e12679464cc16526aee2d72f85f179 100644 (file)
 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