--- a/cpp/include/IceUtil/Config.h
+++ b/cpp/include/IceUtil/Config.h
@@ -20,31 +20,28 @@
 # include <endian.h>
 #endif
 
-#if defined(__i386)     || defined(_M_IX86) || defined(__x86_64)  || \
-    defined(_M_X64)     || defined(_M_IA64) || defined(__alpha__) || \
-    defined(__ARMEL__) || defined(_M_ARM_FP) || \
-    defined(__MIPSEL__) || (defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN))
-#   define ICE_LITTLE_ENDIAN
-#elif defined(__sparc) || defined(__sparc__) || defined(__hppa)      || \
-      defined(__ppc__) || defined(__powerpc) || defined(_ARCH_COM) || \
-      defined(__MIPSEB__) || (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN))
-#   define ICE_BIG_ENDIAN
-#else
-#   error "Unknown architecture"
+#if defined(HAVE_ENDIAN_H)
+#  include <endian.h>
+#  if __BYTE_ORDER==__LITTLE_ENDIAN
+#    define ICE_LITTLE_ENDIAN
+#  elif __BYTE_ORDER==__BIG_ENDIAN
+#    define ICE_BIG_ENDIAN
+#  else
+#    error "Unknown endian type"
+#  endif
 #endif
 
 //
 // 32 or 64 bit mode?
 //
-#if defined(__sun) && (defined(__sparcv9) || defined(__x86_64))    || \
-      defined(__linux) && defined(__x86_64)                        || \
-      defined(__hppa) && defined(__LP64__)                         || \
-      defined(_ARCH_COM) && defined(__64BIT__)                     || \
-      defined(__alpha__)                                           || \
-      defined(_WIN64)
-#   define ICE_64
-#else
-#   define ICE_32
+#if defined(HAVE_LIMITS_H)
+#   include <stdint.h>
+#   include <limits.h>
+#   if __WORDSIZE == 64
+#      define ICE_64
+#   else
+#      define ICE_32
+#   endif
 #endif
 
 //
@@ -82,17 +79,17 @@
 
 //
 // Windows provides native condition variables on Vista and later,
-// and Visual Studio 2012 with the default Platform Toolset (vc100) no 
+// and Visual Studio 2012 with the default Platform Toolset (vc100) no
 // longer supports Windows XP or Windows Server 2003.
 //
 // You can "switch-on" this macro to use native condition variables with
 // other C++ compilers on Windows.
 //
-#   define ICE_HAS_WIN32_CONDVAR 
+#   define ICE_HAS_WIN32_CONDVAR
 #endif
 
 //
-// Compiler extensions to export and import symbols: see the documentation 
+// Compiler extensions to export and import symbols: see the documentation
 // for Visual C++, Solaris Studio and HP aC++.
 //
 #if (defined(_MSC_VER) && !defined(ICE_STATIC_LIBS)) || \
@@ -165,7 +162,7 @@
 protected:
 
     noncopyable() { }
-    ~noncopyable() { } // May not be virtual! Classes without virtual 
+    ~noncopyable() { } // May not be virtual! Classes without virtual
                        // operations also derive from noncopyable.
 
 private:
--- a/cpp/src/IceUtil/Makefile
+++ b/cpp/src/IceUtil/Makefile
@@ -10,7 +10,7 @@
 top_srcdir	= ../..
 
 LIBFILENAME	= $(call mklibfilename,IceUtil,$(VERSION))
-SONAME		= $(call mksoname,IceUtil,$(SOVERSION))  
+SONAME		= $(call mksoname,IceUtil,$(SOVERSION))
 LIBNAME		= $(call mklibname,IceUtil)
 TARGETS		= $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
 
@@ -41,7 +41,7 @@
 include $(top_srcdir)/config/Make.rules
 
 CPPFLAGS        := $(CPPFLAGS) $(ICEUTIL_FLAGS) -DICE_UTIL_API_EXPORTS -I..
-LINKWITH        := $(ICEUTIL_OS_LIBS)
+LINKWITH        := $(ICEUTIL_OS_LIBS) -lrt
 
 ifeq ($(STATICLIBS),yes)
 $(libdir)/$(LIBNAME): $(OBJS)
