--- port/cpl_config.h.orig	2008-12-20 15:12:09.000000000 +0100
+++ port/cpl_config.h	2008-12-20 15:16:54.000000000 +0100
@@ -140,13 +140,26 @@
 #define SIZEOF_INT 4
 
 /* The size of `long', as computed by sizeof. */
-#define SIZEOF_LONG 8
+#if defined (__LP64__)
+  #define SIZEOF_LONG 8
+#else
+  #define SIZEOF_LONG 4
+#endif
 
 /* The size of `unsigned long', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_LONG 8
+#if defined (__LP64__)
+  #define SIZEOF_UNSIGNED_LONG 8
+#else
+  #define SIZEOF_UNSIGNED_LONG 4
+#endif
+
 
 /* The size of `void*', as computed by sizeof. */
-#define SIZEOF_VOIDP 8
+#if defined (__LP64__)
+  #define SIZEOF_VOIDP 8
+#else
+  #define SIZEOF_VOIDP 4
+#endif
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
