Index: /pjproject/trunk/pjlib/build/Makefile
===================================================================
--- /pjproject/trunk/pjlib/build/Makefile	(revision 152)
+++ /pjproject/trunk/pjlib/build/Makefile	(revision 153)
@@ -9,5 +9,5 @@
 # Gather all flags.
 #
-export _CFLAGS 	:= -O2 -g $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
+export _CFLAGS 	:= $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
 		   $(CFLAGS) $(CC_INC)../include
 export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
Index: /pjproject/trunk/pjlib/include/pj/compat/os_linux.h
===================================================================
--- /pjproject/trunk/pjlib/include/pj/compat/os_linux.h	(revision 152)
+++ /pjproject/trunk/pjlib/include/pj/compat/os_linux.h	(revision 153)
@@ -77,5 +77,7 @@
 #define PJ_HAS_HIGH_RES_TIMER	    1
 #define PJ_HAS_MALLOC               1
-#define PJ_OS_HAS_CHECK_STACK	    0
+#ifndef PJ_OS_HAS_CHECK_STACK
+#   define PJ_OS_HAS_CHECK_STACK    0
+#endif
 #define PJ_NATIVE_STRING_IS_UNICODE 0
 
Index: /pjproject/trunk/pjlib/include/pj/compat/os_linux_kernel.h
===================================================================
--- /pjproject/trunk/pjlib/include/pj/compat/os_linux_kernel.h	(revision 152)
+++ /pjproject/trunk/pjlib/include/pj/compat/os_linux_kernel.h	(revision 153)
@@ -95,5 +95,6 @@
 #define PJ_HAS_EVENT_OBJ	    0
 #define PJ_HAS_HIGH_RES_TIMER	    1
-#define PJ_OS_HAS_CHECK_STACK	    0
+#ifndef PJ_OS_HAS_CHECK_STACK
+#   define PJ_OS_HAS_CHECK_STACK    0
 #define PJ_TERM_HAS_COLOR	    0
 #define PJ_NATIVE_STRING_IS_UNICODE 0
Index: /pjproject/trunk/pjlib/include/pj/compat/os_palmos.h
===================================================================
--- /pjproject/trunk/pjlib/include/pj/compat/os_palmos.h	(revision 152)
+++ /pjproject/trunk/pjlib/include/pj/compat/os_palmos.h	(revision 153)
@@ -71,10 +71,11 @@
 /* Default threading is enabled, unless it's overridden. */
 #ifndef PJ_HAS_THREADS
-#  define PJ_HAS_THREADS	    (1)
+#  define PJ_HAS_THREADS		(1)
 #endif
 
-#define PJ_HAS_HIGH_RES_TIMER	    1
-#define PJ_OS_HAS_CHECK_STACK	    0
-#define PJ_NATIVE_STRING_IS_UNICODE 0
+#define PJ_HAS_HIGH_RES_TIMER		1
+#ifndef PJ_OS_HAS_CHECK_STACK
+#   define PJ_OS_HAS_CHECK_STACK	0
+#define PJ_NATIVE_STRING_IS_UNICODE	0
 
 #endif	/* __PJ_COMPAT_OS_PALMOS_H__ */
Index: /pjproject/trunk/pjlib/include/pj/compat/os_sunos.h
===================================================================
--- /pjproject/trunk/pjlib/include/pj/compat/os_sunos.h	(revision 152)
+++ /pjproject/trunk/pjlib/include/pj/compat/os_sunos.h	(revision 153)
@@ -72,13 +72,15 @@
 /* Default threading is enabled, unless it's overridden. */
 #ifndef PJ_HAS_THREADS
-#  define PJ_HAS_THREADS	    (1)
+#  define PJ_HAS_THREADS		(1)
 #endif
 
-#define PJ_HAS_HIGH_RES_TIMER	    1
-#define PJ_HAS_MALLOC               1
-#define PJ_OS_HAS_CHECK_STACK	    0
-#define PJ_NATIVE_STRING_IS_UNICODE 0
+#define PJ_HAS_HIGH_RES_TIMER		1
+#define PJ_HAS_MALLOC			1
+#ifndef PJ_OS_HAS_CHECK_STACK
+#   define PJ_OS_HAS_CHECK_STACK        0
+#endif
+#define PJ_NATIVE_STRING_IS_UNICODE	0
 
-#define PJ_ATOMIC_VALUE_TYPE	    long
+#define PJ_ATOMIC_VALUE_TYPE		long
 
 /* Get BSD related identifers in Sun's include files */
Index: /pjproject/trunk/pjlib/include/pj/compat/os_win32.h
===================================================================
--- /pjproject/trunk/pjlib/include/pj/compat/os_win32.h	(revision 152)
+++ /pjproject/trunk/pjlib/include/pj/compat/os_win32.h	(revision 153)
@@ -76,13 +76,15 @@
 /* Default threading is enabled, unless it's overridden. */
 #ifndef PJ_HAS_THREADS
-#  define PJ_HAS_THREADS	    (1)
+#  define PJ_HAS_THREADS		(1)
 #endif
 
-#define PJ_HAS_HIGH_RES_TIMER	    1
-#define PJ_HAS_MALLOC               1
-#define PJ_OS_HAS_CHECK_STACK	    1
-#define PJ_NATIVE_STRING_IS_UNICODE 0
+#define PJ_HAS_HIGH_RES_TIMER		1
+#define PJ_HAS_MALLOC			1
+#ifndef PJ_OS_HAS_CHECK_STACK
+#   define PJ_OS_HAS_CHECK_STACK	1
+#endif
+#define PJ_NATIVE_STRING_IS_UNICODE	0
 
-#define PJ_ATOMIC_VALUE_TYPE	    long
+#define PJ_ATOMIC_VALUE_TYPE		long
 
 #endif	/* __PJ_COMPAT_OS_WIN32_H__ */
Index: /pjproject/trunk/pjlib/src/pj/sock_bsd.c
===================================================================
--- /pjproject/trunk/pjlib/src/pj/sock_bsd.c	(revision 152)
+++ /pjproject/trunk/pjlib/src/pj/sock_bsd.c	(revision 153)
@@ -523,4 +523,19 @@
 
 /*
+ * Connect socket.
+ */
+PJ_DEF(pj_status_t) pj_sock_connect( pj_sock_t sock,
+				     const pj_sockaddr_t *addr,
+				     int namelen)
+{
+    PJ_CHECK_STACK();
+    if (connect(sock, (struct sockaddr*)addr, namelen) != 0)
+	return PJ_RETURN_OS_ERROR(pj_get_native_netos_error());
+    else
+	return PJ_SUCCESS;
+}
+
+
+/*
  * Shutdown socket.
  */
@@ -544,18 +559,4 @@
     PJ_CHECK_STACK();
     if (listen(sock, backlog) != 0)
-	return PJ_RETURN_OS_ERROR(pj_get_native_netos_error());
-    else
-	return PJ_SUCCESS;
-}
-
-/*
- * Connect socket.
- */
-PJ_DEF(pj_status_t) pj_sock_connect( pj_sock_t sock,
-				     const pj_sockaddr_t *addr,
-				     int namelen)
-{
-    PJ_CHECK_STACK();
-    if (connect(sock, (struct sockaddr*)addr, namelen) != 0)
 	return PJ_RETURN_OS_ERROR(pj_get_native_netos_error());
     else
Index: /pjproject/trunk/pjlib/src/pjlib-test/util.c
===================================================================
--- /pjproject/trunk/pjlib/src/pjlib-test/util.c	(revision 152)
+++ /pjproject/trunk/pjlib/src/pjlib-test/util.c	(revision 153)
@@ -51,4 +51,5 @@
         return rc;
     
+#if PJ_HAS_TCP
     if (type == PJ_SOCK_STREAM) {
         rc = pj_sock_listen(sock, 5);
@@ -56,4 +57,5 @@
             return rc;
     }
+#endif
 
     *ptr_sock = sock;
@@ -95,4 +97,5 @@
 
     /* For TCP, listen the socket. */
+#if PJ_HAS_TCP
     if (type == PJ_SOCK_STREAM) {
         rc = pj_sock_listen(sock[SERVER], PJ_SOMAXCONN);
@@ -100,4 +103,5 @@
             goto on_error;
     }
+#endif
 
     /* Connect client socket. */
@@ -108,4 +112,5 @@
 
     /* For TCP, must accept(), and get the new socket. */
+#if PJ_HAS_TCP
     if (type == PJ_SOCK_STREAM) {
         pj_sock_t newserver;
@@ -119,4 +124,5 @@
         sock[SERVER] = newserver;
     }
+#endif
 
     *serverfd = sock[SERVER];
