Index: src/mod/languages/mod_lua/Makefile
===================================================================
--- src/mod/languages/mod_lua/Makefile	(revision 12651)
+++ src/mod/languages/mod_lua/Makefile	(working copy)
@@ -2,7 +2,7 @@
 LOCAL_CFLAGS=-Ilua
 LIBLUA_A=lua/liblua.a
 LOCAL_LIBADD=$(LIBLUA_A)
-LOCAL_LDFLAGS=-lm
+LOCAL_LDFLAGS=-lm -xnolibmopt
 LOCAL_OBJS=freeswitch_lua.o mod_lua_wrap.o
 VERBOSE=1
 
Index: libs/apr/include/apr.h.in
===================================================================
--- libs/apr/include/apr.h.in	(revision 12651)
+++ libs/apr/include/apr.h.in	(working copy)
@@ -53,17 +53,16 @@
  * means.  In particular it's missing inline and the __attribute__
  * stuff.  So we hack around it.  PR#1613. -djg
  */
-#if !defined(__GNUC__) || __GNUC__ < 2 || \
-    (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
-    defined(NEXT)
+#if (defined(__GNUC__) && (__GNUC__ > 2 || !(__GNUC__ == 2 && __GNUC_MINOR__ < 7)) && !defined(NEXT)) || \
+    (defined(__SUNPRO_C) || defined(__SUNPRO_CC))
+#define APR_INLINE __inline__
+#define APR_HAS_INLINE		1
+#else	/* unknown compiler */
 #ifndef __attribute__
 #define __attribute__(__x)
 #endif
 #define APR_INLINE
 #define APR_HAS_INLINE		0
-#else
-#define APR_INLINE __inline__
-#define APR_HAS_INLINE		1
 #endif
 
 #define APR_HAVE_ARPA_INET_H     @arpa_ineth@
Index: libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_protos.h.in
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_protos.h.in	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http_protos.h.in	(working copy)
@@ -263,7 +263,7 @@
 su_inline
 #endif
 http_#xxxxxx#_t *http_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
-     __attribute__((__malloc__, __format__ (printf, 2, 3)));
+     __attribute__((__malloc__)) SOFIAPRINTFMT(2, 3);
 
 
 /* Inlined functions */
Index: libs/sofia-sip/libsofia-sip-ua/msg/test_protos.h.in
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/msg/test_protos.h.in	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/msg/test_protos.h.in	(working copy)
@@ -334,7 +334,7 @@
 su_inline
 #endif
 msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
-     __attribute__((__format__ (printf, 2, 3)));
+     SOFIAPRINTFMT(2, 3);
 
 #if SU_HAVE_INLINE
 su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
Index: libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h	(working copy)
@@ -161,7 +161,7 @@
 SOFIAPUBFUN msg_header_t *msg_header_format(su_home_t *home,
 					    msg_hclass_t *hc,
 					    char const *fmt, ...)
-     __attribute__ ((__malloc__, __format__ (printf, 3, 4)));
+     __attribute__ ((__malloc__)) SOFIAPRINTFMT(3, 4);
 
 SOFIAPUBFUN msg_header_t *msg_header_vformat(su_home_t *home,
 					     msg_hclass_t *hc,
Index: libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_protos.h.in	(working copy)
@@ -287,7 +287,7 @@
 su_inline
 #endif
 msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
-     __attribute__((__malloc__, __format__ (printf, 2, 3)));
+     __attribute__((__malloc__)) SOFIAPRINTFMT(2, 3);
 
 #if SU_HAVE_INLINE
 su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
Index: libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime_protos.h.in
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime_protos.h.in	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime_protos.h.in	(working copy)
@@ -294,7 +294,7 @@
 su_inline
 #endif
 msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
-     __attribute__((__format__ (printf, 2, 3)));
+     SOFIAPRINTFMT(2, 3);
 
 #if SU_HAVE_INLINE
 su_inline msg_#xxxxxx#_t *msg_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
Index: libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h	(working copy)
@@ -136,7 +136,7 @@
      __attribute__((__malloc__));
 
 SU_DLL char *su_sprintf(su_home_t *home, char const *fmt, ...)
-     __attribute__ ((__malloc__, __format__ (printf, 2, 3)));
+     __attribute__ ((__malloc__)) SOFIAPRINTFMT(2, 3);
 
 SU_DLL char *su_vsprintf(su_home_t *home, char const *fmt, va_list ap)
      __attribute__((__malloc__));
Index: libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_debug.h
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_debug.h	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_debug.h	(working copy)
@@ -75,7 +75,7 @@
 
 #define SU_DEBUG_DEF(level) \
   su_inline void su_debug_##level(char const *fmt, ...) \
-    __attribute__ ((__format__ (printf, 1, 2))); \
+    SOFIAPRINTFMT(1, 2); \
   su_inline void su_debug_##level(char const *fmt, ...) \
     { va_list ap; va_start(ap, fmt); su_vllog(SU_LOG, level, fmt, ap); va_end(ap); }
 
Index: libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_config.h
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_config.h	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_config.h	(working copy)
@@ -44,7 +44,12 @@
 #if __GNUC__ < 3 && (!defined(__GNUC_MINOR__) || __GNUC_MINOR__ < 96)
 #define __malloc__		/* avoid spurious warnigns */
 #endif
+#  define SOFIAPRINTFMT(m, n)	__attribute__((__format__(printf, m, n)))
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+/* Sun C does not support printf format attribute */
+#  define SOFIAPRINTFMT(m, n)
 #elif !defined(__attribute__)
+#  define SOFIAPRINTFMT(m, n)
 #  define __attribute__(x)
 #endif
 
Index: libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_log.h
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_log.h	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_log.h	(working copy)
@@ -75,10 +75,10 @@
   { sizeof(su_log_t), name, env, level, SU_LOG_MAX, 0, NULL, NULL, }
 
 SOFIAPUBFUN void su_log(char const *fmt, ...)
-  __attribute__ ((__format__ (printf, 1, 2)));
+  SOFIAPRINTFMT(1, 2);
 
 SOFIAPUBFUN void su_llog(su_log_t *log, unsigned level, char const *fmt, ...)
-  __attribute__ ((__format__ (printf, 3, 4)));
+  SOFIAPRINTFMT(3, 4);
 SOFIAPUBFUN void su_vllog(su_log_t *log, unsigned level,
 			  char const *fmt, va_list ap);
 SOFIAPUBFUN void su_log_redirect(su_log_t *log, su_logger_f *f, void *stream);
Index: libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h	(working copy)
@@ -126,7 +126,12 @@
 #define sip_fragment_clear(a) ((a)->h_data = NULL, (a)->h_len = 0)
 
 /* Use __attribute__ to allow argument checking for sip_header_format() */
-#if !defined(__GNUC__) && !defined(__attribute__)
+#if defined(__GNUC__)
+#define SOFIAPRINTFMT(m, n) __attribute__((__format__(printf, m, n)))
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+#define SOFIAPRINTFMT(m, n)
+#elif !defined(__attribute__)
+#define SOFIAPRINTFMT(m, n)
 #define __attribute__(x)
 #endif
 
@@ -135,7 +140,7 @@
 					    msg_hclass_t *hc,
 					    char const *fmt,
 					    ...)
-  __attribute__((__format__ (printf, 3, 4)));
+  SOFIAPRINTFMT(3, 4);
 
 /** Return current time */
 SOFIAPUBFUN sip_time_t sip_now(void);
Index: libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in
===================================================================
--- libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in	(revision 12651)
+++ libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_protos.h.in	(working copy)
@@ -345,7 +345,7 @@
 su_inline
 #endif
 sip_#xxxxxx#_t *sip_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
-     __attribute__((__malloc__, __format__ (printf, 2, 3)));
+     __attribute__((__malloc__)) SOFIAPRINTFMT(2, 3);
 
 #if SU_HAVE_INLINE
 su_inline sip_#xxxxxx#_t *sip_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
