Index: /pjproject/trunk/aconfigure
===================================================================
--- /pjproject/trunk/aconfigure	(revision 5678)
+++ /pjproject/trunk/aconfigure	(revision 5679)
@@ -759,4 +759,5 @@
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
@@ -883,4 +884,5 @@
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
@@ -1135,4 +1137,13 @@
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
@@ -1272,5 +1283,5 @@
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
@@ -1425,4 +1436,5 @@
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
@@ -2587,9 +2599,5 @@
 if test "$CFLAGS" = ""; then
   CFLAGS="-O2"
-else
-  CFLAGS="$CFLAGS"
-fi
-
-CXXFLAGS="$CFLAGS $CXXFLAGS"
+fi
 
 ac_ext=c
Index: /pjproject/trunk/aconfigure.ac
===================================================================
--- /pjproject/trunk/aconfigure.ac	(revision 5678)
+++ /pjproject/trunk/aconfigure.ac	(revision 5679)
@@ -28,9 +28,5 @@
 if test "$CFLAGS" = ""; then
   CFLAGS="-O2"
-else
-  CFLAGS="$CFLAGS"
 fi
-
-CXXFLAGS="$CFLAGS $CXXFLAGS"
 
 dnl #
Index: /pjproject/trunk/build.mak.in
===================================================================
--- /pjproject/trunk/build.mak.in	(revision 5678)
+++ /pjproject/trunk/build.mak.in	(revision 5679)
@@ -205,5 +205,5 @@
 	-I$(PJDIR)/pjmedia/include\
 	-I$(PJDIR)/pjsip/include
-export APP_CXXFLAGS := $(APP_CFLAGS)
+export APP_CXXFLAGS := @CXXFLAGS@ $(APP_CFLAGS)
 export APP_LDFLAGS := -L$(PJDIR)/pjlib/lib\
 	-L$(PJDIR)/pjlib-util/lib\
@@ -315,5 +315,5 @@
 export PJ_INSTALL_INC_DIR := @includedir@
 export PJ_INSTALL_LIB_DIR := @libdir@
-export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1	@CFLAGS@
-export PJ_INSTALL_CXXFLAGS := $(PJ_INSTALL_CFLAGS)
+export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @CFLAGS@
+export PJ_INSTALL_CXXFLAGS := @CXXFLAGS@ $(PJ_INSTALL_CFLAGS)
 export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDLIBS)
Index: /pjproject/trunk/pjsip-apps/build/Footprint.mak
===================================================================
--- /pjproject/trunk/pjsip-apps/build/Footprint.mak	(revision 5678)
+++ /pjproject/trunk/pjsip-apps/build/Footprint.mak	(revision 5679)
@@ -11,5 +11,5 @@
 #
 export _CFLAGS 	:= $(APP_CFLAGS) $(CFLAGS)
-export _CXXFLAGS:= $(_CFLAGS)
+export _CXXFLAGS:= $(APP_CXXFLAGS) $(CXXFLAGS)
 
 export _LDFLAGS := $(APP_LDFLAGS) $(APP_LDLIBS) $(LDFLAGS)
Index: /pjproject/trunk/pjsip/build/Makefile
===================================================================
--- /pjproject/trunk/pjsip/build/Makefile	(revision 5678)
+++ /pjproject/trunk/pjsip/build/Makefile	(revision 5679)
@@ -141,5 +141,5 @@
 			   siptypes.o call.o presence.o media.o
 export PJSUA2_LIB_CFLAGS += $(_CFLAGS) $(PJ_VIDEO_CFLAGS)
-export PJSUA2_LIB_CXXFLAGS = $(PJSUA2_LIB_CFLAGS) 
+export PJSUA2_LIB_CXXFLAGS = $(_CXXFLAGS) $(PJSUA2_LIB_CFLAGS) 
 export PJSUA2_LIB_LDFLAGS += $(PJSUA_LIB_LDLIB) \
 			     $(PJSIP_UA_LDLIB) \
@@ -164,5 +164,5 @@
 			   main.o
 export PJSUA2_TEST_CFLAGS += $(_CFLAGS) $(PJ_VIDEO_CFLAGS)
-export PJSUA2_TEST_CXXFLAGS = $(PJSUA2_LIB_CFLAGS) 
+export PJSUA2_TEST_CXXFLAGS = $(_CXXFLAGS) $(PJSUA2_LIB_CFLAGS) 
 export PJSUA2_TEST_LDFLAGS += $(PJ_LDXXFLAGS) $(PJ_LDXXLIBS) $(LDFLAGS)
 export PJSUA2_TEST_EXE := pjsua2-test-$(TARGET_NAME)$(HOST_EXE)
Index: /pjproject/trunk/tests/pjsua/tools/Makefile
===================================================================
--- /pjproject/trunk/tests/pjsua/tools/Makefile	(revision 5678)
+++ /pjproject/trunk/tests/pjsua/tools/Makefile	(revision 5679)
@@ -8,5 +8,5 @@
 LDLIBS  = $(APP_LDLIBS)
 CFLAGS  = $(APP_CFLAGS)
-CPPFLAGS= ${CFLAGS}
+CPPFLAGS= $(APP_CXXFLAGS)
 
 # If your application is in a file named myapp.cpp or myapp.c
