Fixed ticket #216: Build error when PJ_HAS_TCP is set to zero (thanks ChenHuan)

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1159 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/include/pjsip/sip_transport_tcp.h b/pjsip/include/pjsip/sip_transport_tcp.h
index ff1af7a..abadf17 100644
--- a/pjsip/include/pjsip/sip_transport_tcp.h
+++ b/pjsip/include/pjsip/sip_transport_tcp.h
@@ -26,6 +26,11 @@
 
 #include <pjsip/sip_transport.h>
 
+
+/* Only declare the API if PJ_HAS_TCP is true */
+#if defined(PJ_HAS_TCP) && PJ_HAS_TCP!=0
+
+
 PJ_BEGIN_DECL
 
 /**
@@ -112,4 +117,6 @@
  * @}
  */
 
+#endif	/* PJ_HAS_TCP */
+
 #endif	/* __PJSIP_TRANSPORT_TCP_H__ */
diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
index 481387c..6033a8d 100644
--- a/pjsip/src/pjsip/sip_transport_tcp.c
+++ b/pjsip/src/pjsip/sip_transport_tcp.c
@@ -29,6 +29,9 @@
 #include <pj/pool.h>
 #include <pj/string.h>
 
+/* Only declare the API if PJ_HAS_TCP is true */
+#if defined(PJ_HAS_TCP) && PJ_HAS_TCP!=0
+
 
 #define THIS_FILE	"sip_transport_tcp.c"
 
@@ -1365,3 +1368,5 @@
     tcp_flush_pending_tx(tcp);
 }
 
+#endif	/* PJ_HAS_TCP */
+
diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c
index e40882d..136364f 100644
--- a/pjsip/src/pjsua-lib/pjsua_core.c
+++ b/pjsip/src/pjsua-lib/pjsua_core.c
@@ -1191,6 +1191,8 @@
 	pjsua_var.tpdata[id].local_name = tp->local_name;
 	pjsua_var.tpdata[id].data.tp = tp;
 
+#if defined(PJ_HAS_TCP) && PJ_HAS_TCP!=0
+
     } else if (type == PJSIP_TRANSPORT_TCP) {
 	/*
 	 * Create TCP transport.
@@ -1242,6 +1244,8 @@
 	pjsua_var.tpdata[id].local_name = tcp->addr_name;
 	pjsua_var.tpdata[id].data.factory = tcp;
 
+#endif	/* PJ_HAS_TCP */
+
 #if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0
     } else if (type == PJSIP_TRANSPORT_TLS) {
 	/*
diff --git a/pjsip/src/test-pjsip/test.c b/pjsip/src/test-pjsip/test.c
index 6236075..62e3aed 100644
--- a/pjsip/src/test-pjsip/test.c
+++ b/pjsip/src/test-pjsip/test.c
@@ -226,8 +226,10 @@
 #if INCLUDE_TSX_TEST
     unsigned i;
     pjsip_transport *tp;
+#if PJ_HAS_TCP
     pjsip_tpfactory *tpfactory;
-#endif
+#endif	/* PJ_HAS_TCP */
+#endif	/* INCLUDE_TSX_TEST */
     int line;
 
     pj_log_set_level(log_level);
@@ -331,6 +333,7 @@
 	++tsx_test_cnt;
     }
 
+#if PJ_HAS_TCP
     status = pjsip_tcp_transport_start(endpt, NULL, 1, &tpfactory);
     if (status == PJ_SUCCESS) {
 	tsx_test[tsx_test_cnt].port = tpfactory->addr_name.port;
@@ -342,6 +345,7 @@
 	rc = -4;
 	goto on_return;
     }
+#endif
 
 
     for (i=0; i<tsx_test_cnt; ++i) {
diff --git a/pjsip/src/test-pjsip/transport_tcp_test.c b/pjsip/src/test-pjsip/transport_tcp_test.c
index 1835f1d..50b59af 100644
--- a/pjsip/src/test-pjsip/transport_tcp_test.c
+++ b/pjsip/src/test-pjsip/transport_tcp_test.c
@@ -27,6 +27,7 @@
 /*
  * TCP transport test.
  */
+#if PJ_HAS_TCP
 int transport_tcp_test(void)
 {
     enum { SEND_RECV_LOOP = 8 };
@@ -141,3 +142,9 @@
     /* Done */
     return 0;
 }
+#else	/* PJ_HAS_TCP */
+int transport_tcp_test(void)
+{
+    return 0;
+}
+#endif	/* PJ_HAS_TCP */