Submitted By:            Kevin Day <kevin AT kevux DOT org>
Date:                    2005-10-18
Initial Package Version: 5.5
Upstream Status:         Not Submitted
Description:             Xorg assumes system's libc is glibc and based judgement from whatever version it finds.  This causes numerous problems with uClibc.  In addition, many #defines are not checking if they have been defined already.  This causes more problems with uClibc if these #DEFINE's must be changed (which they do). I added the #DEFINE IsNoGlibcSystem to allow override of glibc scans, so that options specified in host.def can be used without being overwritten by Xorg's assumptions.
--- Xorg-6.8.2/config/cf/linux.cf.orig	2005-10-14 09:20:22.000000000 +0000
+++ Xorg-6.8.2/config/cf/linux.cf	2005-10-14 09:32:10.000000000 +0000
@@ -206,11 +206,15 @@
 # define BinUtilsMajorVersion	LinuxBinUtilsMajorVersion
 #endif
 
+#ifndef LinuxLocaleDefines
+#ifndef IsNoGlibcSystem
 #if (LinuxCLibMajorVersion >= 6 || LinuxDistribution == LinuxSuSE)
 # define LinuxLocaleDefines	/**/
 #else
 # define LinuxLocaleDefines	-DX_LOCALE
 #endif
+#endif
+#endif
 
 #ifndef  LinuxAdditionalIncludes
 # define LinuxAdditionalIncludes	/**/
@@ -224,6 +228,7 @@
 # endif
 #endif
 
+#ifndef IsNoGlibcSystem
 #if LinuxCLibMajorVersion >= 6
 # define LinuxSourceDefines	-D_POSIX_C_SOURCE=199309L \
 				-D_POSIX_SOURCE -D_XOPEN_SOURCE \
@@ -259,6 +264,7 @@
 #  define DefaultCCOptions	GccWarningOptions
 # endif
 #endif
+#endif
 
 #ifndef InstallXloadSetGID
 #define InstallXloadSetGID	NO
@@ -268,19 +274,23 @@
  * XXX Check which versions of Linux really have IPv6.  glibc 2.0 on
  * Red Hat 5.2 doesn't.
  */
+#ifndef IsNoGlibcSystem
 #if LinuxCLibMajorVersion < 6 || \
     (LinuxCLibMajorVersion == 6 && LinuxCLibMinorVersion == 0)
 #define BuildIPv6		NO
 #endif
+#endif
 
 /* <linux/input.h> support mainly for USB support */
 #ifndef HasLinuxInput
+#ifndef IsNoGlibcSystem
 # if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 4)
 #  define HasLinuxInput YES
 # else
 #  define HasLinuxInput NO
 # endif
 #endif
+#endif
 
 /* <linux/joystick.h> appeared in 2.1.45 (officially) */
 #ifndef JoystickSupport
@@ -366,11 +376,13 @@
  * Build shared libGL and the DRI modules without -fPIC on some architectures.
  * This improves performance.
  */
+#ifndef BuildLibGlxWithoutPIC
 #if BuildXF86DRI
 # if defined(i386Architecture)
 #  define BuildLibGlxWithoutPIC	YES
 # endif
 #endif
+#endif
 
 #ifndef HasAgpGart
 #  if defined(i386Architecture) || defined(ia64Architecture) || defined(AMD64Architecture)
@@ -388,11 +400,13 @@
  */
 #ifndef HasSSESupport
 #  if defined(i386Architecture)
+#  ifndef IsNoGlibcSystem
 #    if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 4)
 #      define HasSSESupport		YES
 #    else
 #      define HasSSESupport		NO
 #    endif
+#  endif
 #  else
 #    define HasSSESupport		NO
 #  endif
@@ -404,11 +418,13 @@
  */
 #ifndef HasMMXSupport
 #  if defined(i386Architecture)
+#  ifndef IsNoGlibcSystem
 #    if (LinuxCLibMajorVersion > 5)
 #      define HasMMXSupport		YES
 #    else
 #      define HasMMXSupport		NO
 #    endif
+#  endif
 #  else
 #    define HasMMXSupport		NO
 #  endif
@@ -422,11 +438,13 @@
  */
 #ifndef Has3DNowSupport
 #  if defined(i386Architecture)
+#  ifndef IsNoGlibcSystem
 #    if (LinuxCLibMajorVersion > 5)
 #      define Has3DNowSupport		YES
 #    else
 #      define Has3DNowSupport		NO
 #    endif
+#  endif
 #  else
 #    define Has3DNowSupport		NO
 #  endif
@@ -731,6 +749,7 @@
  * test, but this handles the older Red Hat releases at least.
  */
 #ifndef CppCmd
+#ifndef IsNoGlibcSystem
 # if (LinuxDistribution == LinuxRedHat) && \
      ((LinuxCLibMajorVersion < 6) || \
       (LinuxCLibMajorVersion == 6 && LinuxCLibMinorVersion < 1))
@@ -739,6 +758,7 @@
 #  define CppCmd		cpp
 # endif
 #endif
+#endif
 
 /* Some Linux distributions have yacc, some don't. All have bison. */
 #define YaccCmd			bison -y
--- Xorg-6.8.2/config/cf/lnxLib.rules.orig	2005-10-14 09:36:50.000000000 +0000
+++ Xorg-6.8.2/config/cf/lnxLib.rules	2005-10-14 09:37:34.000000000 +0000
@@ -21,6 +21,7 @@
 
 #if UseElfFormat
 
+#ifndef IsNoGlibcSystem
 # if (LinuxCLibMajorVersion >= 5 && LinuxCLibMinorVersion >= 4) || LinuxCLibMajorVersion >= 6
 #  ifndef SpecialMalloc
 #   define SpecialMalloc NO
@@ -54,6 +55,7 @@
 /* With GNU libc 2 this works fine. */
 #  define BaseShLibReqs	-lc
 # endif
+#endif
 
 # ifndef SharedDataSeparation
 #  define SharedDataSeparation NO
