diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h
index 10f86fd..4ace1bc 100644
--- a/pjlib/include/pj/config.h
+++ b/pjlib/include/pj/config.h
@@ -245,7 +245,13 @@
 #   define PJ_M_NAME		"armv4"
 #   define PJ_HAS_PENTIUM	0
 #   if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
-#   	error Endianness must be declared for this processor
+#       if defined(__GNUC__)
+#           include <endian.h>
+#           define PJ_IS_LITTLE_ENDIAN  __BYTE_ORDER__ == __LITTLE_ENDIAN__
+#           define PJ_IS_BIG_ENDIAN     __BYTE_ORDER__ == __BIG_ENDIAN__
+#       else
+#           error Endianness must be declared for this processor
+#       endif
 #   endif
 
 #elif defined (PJ_M_POWERPC) || defined(__powerpc) || defined(__powerpc__) || \
