Index: pjproject/trunk/configure-android
===================================================================
--- pjproject/trunk/configure-android	(revision 6121)
+++ pjproject/trunk/configure-android	(revision 6122)
@@ -107,7 +107,19 @@
         continue
       fi
-      if test "x`echo $i|grep ${IGNORE_CPPFLAGS}`" = "x"; then
-        NDK_CXXFLAGS="${NDK_CXXFLAGS} $i"
-      fi
+      if test "x`echo $i|grep ${IGNORE_CPPFLAGS}`" != "x"; then
+        continue
+      fi
+      # Check if flag is already in CFLAGS
+      ISDUP="0"
+      for j in $NDK_CFLAGS; do
+        if test "$i" = "$j"; then
+	  ISDUP="1"
+	  break
+	fi
+      done
+      if test "${ISDUP}" = "1"; then
+        continue
+      fi
+      NDK_CXXFLAGS="${NDK_CXXFLAGS} $i"
       continue
     fi
@@ -254,9 +266,9 @@
   export CXX="${NDK_CXX}"
 
-  export LDFLAGS="${NDK_LDFLAGS}"
+  export CPPFLAGS="${CPPFLAGS}"
+  export CFLAGS="${NDK_CFLAGS} ${CFLAGS} ${CPPFLAGS}"
+  export CXXFLAGS="${NDK_CXXFLAGS} ${CPPFLAGS}"
+  export LDFLAGS="${NDK_LDFLAGS} ${LDFLAGS}"
   export LIBS="${LIBS}"
-  export CFLAGS="${NDK_CFLAGS} ${CFLAGS}"
-  export CPPFLAGS="${NDK_CXXFLAGS} ${CPPFLAGS}"
-  export CXXFLAGS="${CPPFLAGS}"
 
 else
@@ -324,9 +336,9 @@
 #STDCPP_LDFLAGS="-L${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/${TARGET_ABI}"
 
-export CFLAGS="${CFLAGS} ${STDCPP_CFLAGS}"
-export LIBS="${STDCPP_LIBS} ${LIBS}"
+export CFLAGS="${CFLAGS}"
+export LIBS="${LIBS} ${STDCPP_LIBS}"
 export LDFLAGS="${LDFLAGS} ${STDCPP_LDFLAGS}"
-export CPPFLAGS="${CPPFLAGS} ${STDCPP_CFLAGS}"
-export CXXFLAGS="${CPPFLAGS}"
+export CPPFLAGS="${CPPFLAGS}"
+export CXXFLAGS="${CXXFLAGS} ${STDCPP_CFLAGS}"
 
 # Print settings
Index: pjproject/trunk/configure-iphone
===================================================================
--- pjproject/trunk/configure-iphone	(revision 6121)
+++ pjproject/trunk/configure-iphone	(revision 6122)
@@ -137,5 +137,4 @@
 #ARCH="-arch armv6"
 export CFLAGS="${CFLAGS} -DPJ_SDK_NAME=\"\\\"`basename $SDKPATH`\\\"\" ${ARCH} -isysroot ${SDKPATH}"
-export CXXFLAGS="${CFLAGS}"
 export LDFLAGS="${LDFLAGS} ${ARCH} -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation"
 export AR="${TCPATH}/usr/bin/libtool -static -o"
Index: pjproject/trunk/pjsip/build/Makefile
===================================================================
--- pjproject/trunk/pjsip/build/Makefile	(revision 6121)
+++ pjproject/trunk/pjsip/build/Makefile	(revision 6122)
@@ -48,9 +48,5 @@
 		   $(CC_INC)../../pjmedia/include
 export _CXXFLAGS:= $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
-		   $(HOST_CXXFLAGS) $(CXXFLAGS) $(CC_INC)../include \
-		   $(CC_INC)../../pjlib/include \
-		   $(CC_INC)../../pjlib-util/include \
-		   $(CC_INC)../../pjnath/include \
-		   $(CC_INC)../../pjmedia/include
+		   $(HOST_CXXFLAGS) $(CXXFLAGS) $(_CFLAGS)
 export _LDFLAGS := $(APP_THIRD_PARTY_LIBS) \
 		   $(APP_THIRD_PARTY_EXT) \
@@ -145,5 +141,5 @@
 			   siptypes.o call.o presence.o media.o
 export PJSUA2_LIB_CFLAGS += $(_CFLAGS) $(PJ_VIDEO_CFLAGS)
-export PJSUA2_LIB_CXXFLAGS = $(_CXXFLAGS) $(PJ_VIDEO_CFLAGS)
+export PJSUA2_LIB_CXXFLAGS = $(_CXXFLAGS) $(PJSUA2_LIB_CFLAGS)
 export PJSUA2_LIB_LDFLAGS += $(PJSUA_LIB_LDLIB) \
 			     $(PJSIP_UA_LDLIB) \
Index: pjproject/trunk/third_party/build/webrtc/Makefile
===================================================================
--- pjproject/trunk/third_party/build/webrtc/Makefile	(revision 6121)
+++ pjproject/trunk/third_party/build/webrtc/Makefile	(revision 6122)
@@ -22,5 +22,5 @@
 		   $(CC_INC)../../../pjlib/include
 export _CXXFLAGS:= $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
-		   $(HOST_CXXFLAGS) $(CXXFLAGS)
+		   $(HOST_CXXFLAGS) $(CXXFLAGS) $(_CFLAGS)
 export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
 		   $(LDFLAGS) 
Index: pjproject/trunk/third_party/build/yuv/Makefile
===================================================================
--- pjproject/trunk/third_party/build/yuv/Makefile	(revision 6121)
+++ pjproject/trunk/third_party/build/yuv/Makefile	(revision 6122)
@@ -21,5 +21,5 @@
 		   $(CC_INC)../../../pjlib/include
 export _CXXFLAGS:= $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
-		   $(HOST_CXXFLAGS) $(CXXFLAGS) $(CC_INC). $(CC_INC)../../yuv/include
+		   $(HOST_CXXFLAGS) $(CXXFLAGS) $(_CFLAGS)
 export _LDFLAGS := $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
 		   $(LDFLAGS) 
