Index: /pjproject/trunk/Makefile
===================================================================
--- /pjproject/trunk/Makefile	(revision 3062)
+++ /pjproject/trunk/Makefile	(revision 3063)
@@ -36,5 +36,5 @@
 	pjmedia/lib/libpjmedia-audiodev-$(TARGET_NAME).a \
 	pjmedia/lib/libpjmedia-codec-$(TARGET_NAME).a \
-       	pjsip/lib/libpjsip-$(TARGET_NAME).a \
+    	pjsip/lib/libpjsip-$(TARGET_NAME).a \
 	pjsip/lib/libpjsip-ua-$(TARGET_NAME).a \
 	pjsip/lib/libpjsip-simple-$(TARGET_NAME).a \
@@ -91,13 +91,17 @@
 	cd tests/pjsua && python runall.py
 
-prefix = /usr/local
+prefix = $(ac_prefix)
+include version.mak
+
 install:
 	mkdir -p $(DESTDIR)$(prefix)/lib
-	cp -L $$(find . -name '*.a') $(DESTDIR)$(prefix)/lib
+	cp -f $(APP_LIB_FILES) $(DESTDIR)$(prefix)/lib/
 	mkdir -p $(DESTDIR)$(prefix)/include
-	cp -RL $$(find  . -name include) $(DESTDIR)$(prefix)
-	cd $(DESTDIR)$(prefix)/lib && for i in $$(find . -name 'libpj*a'); do\
-		ln -s $$i $$(echo $$i | sed -e "s/-$(TARGET_NAME)//");\
+	for d in pjlib pjlib-util pjnath pjmedia pjsip; do \
+		cp -RLf $$d/include/* $(DESTDIR)$(prefix)/include/; \
 	done
 	mkdir -p $(DESTDIR)$(prefix)/lib/pkgconfig
-	sed -e "s!@PREFIX@!$(DESTDIR)$(prefix)!" libpj.pc.in > $(DESTDIR)/$(prefix)/lib/pkgconfig/libpj.pc
+	sed -e "s!@PREFIX@!$(DESTDIR)$(prefix)!" libpjproject.pc.in | \
+		sed -e "s/@PJ_VERSION@/$(PJ_VERSION)/" | \
+		sed -e "s!@PJ_LDLIBS@!$(PJ_LDLIBS)!" | \
+		sed -e "s!@PJ_INSTALL_CFLAGS@!$(PJ_INSTALL_CFLAGS)!" > $(DESTDIR)/$(prefix)/lib/pkgconfig/libpjproject.pc
Index: /pjproject/trunk/build.mak.in
===================================================================
--- /pjproject/trunk/build.mak.in	(revision 3062)
+++ /pjproject/trunk/build.mak.in	(revision 3063)
@@ -8,8 +8,11 @@
 export LINUX_POLL := @ac_linux_poll@ 
 
+export ac_prefix := @prefix@
+
 LIB_SUFFIX = $(TARGET_NAME).a
 
 # Determine which party libraries to use
 export APP_THIRD_PARTY_LIBS := -lresample-$(TARGET_NAME) -lmilenage-$(TARGET_NAME) -lsrtp-$(TARGET_NAME)
+export APP_THIRD_PARTY_EXT :=
 export APP_THIRD_PARTY_LIB_FILES = $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
 
@@ -17,6 +20,5 @@
 ifeq (@ac_external_gsm@,1)
 # External GSM library
-APP_THIRD_PARTY_LIBS += -lgsm
-APP_THIRD_PARTY_LIB_FILES +=
+APP_THIRD_PARTY_EXT += -lgsm
 else
 APP_THIRD_PARTY_LIBS += -lgsmcodec-$(TARGET_NAME)
@@ -27,6 +29,5 @@
 ifneq (@ac_no_speex_codec@,1)
 ifeq (@ac_external_speex@,1)
-APP_THIRD_PARTY_LIBS += -lspeex -lspeexdsp
-APP_THIRD_PARTY_LIB_FILES +=
+APP_THIRD_PARTY_EXT += -lspeex -lspeexdsp
 else
 APP_THIRD_PARTY_LIBS += -lspeex-$(TARGET_NAME)
@@ -47,6 +48,6 @@
 ifneq ($(findstring pa,@ac_pjmedia_snd@),)
 ifeq (@ac_external_pa@,1)
-APP_THIRD_PARTY_LIBS += -lportaudio
-APP_THIRD_PARTY_LIB_FILES += 
+# External PA
+APP_THIRD_PARTY_EXT += -lportaudio
 else
 APP_THIRD_PARTY_LIBS += -lportaudio-$(TARGET_NAME)
@@ -86,4 +87,5 @@
 	-lpjlib-util-$(TARGET_NAME)\
 	$(APP_THIRD_PARTY_LIBS)\
+	$(APP_THIRD_PARTY_EXT)\
 	-lpj-$(TARGET_NAME)\
 	@LIBS@
@@ -100,4 +102,6 @@
 	$(PJ_DIR)/pjlib/lib/libpj-$(LIB_SUFFIX)
 
+# Here are the variabels to use if application is using the library
+# from within the source distribution
 export PJ_DIR := $(PJDIR)
 export PJ_CC := $(APP_CC)
@@ -108,2 +112,10 @@
 export PJ_LIB_FILES := $(APP_LIB_FILES)
 
+# And here are the variables to use if application is using the
+# library from the install location (i.e. --prefix)
+export PJ_INSTALL_DIR := @prefix@
+export PJ_INSTALL_INC_DIR := $(PJ_INSTALL_DIR)/include
+export PJ_INSTALL_LIB_DIR := $(PJ_INSTALL_DIR)/lib
+export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1	@CFLAGS@
+export PJ_INSTALL_CXXFLAGS := $(PJ_INSTALL_CFLAGS)
+export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDLIBS)
Index: /pjproject/trunk/configure-legacy
===================================================================
--- /pjproject/trunk/configure-legacy	(revision 3062)
+++ /pjproject/trunk/configure-legacy	(revision 3063)
@@ -125,5 +125,5 @@
 export APP_LDFLAGS = -L\$(PJDIR)/pjlib/lib -L\$(PJDIR)/pjlib-util/lib -L\$(PJDIR)/pjnath/lib -L\$(PJDIR)/pjmedia/lib -L\$(PJDIR)/pjsip/lib -L\$(PJDIR)/third_party/lib 
 
-export APP_LDLIBS = -lpjsua-\$(TARGET_NAME) -lpjsip-ua-\$(TARGET_NAME) -lpjsip-simple-\$(TARGET_NAME) -lpjsip-\$(TARGET_NAME) -lpjmedia-codec-\$(TARGET_NAME) -lpjmedia-\$(TARGET_NAME) -lpjnath-\$(TARGET_NAME) -lpjlib-util-\$(TARGET_NAME) \$(APP_THIRD_PARTY_LIBS) -lpj-\$(TARGET_NAME) \$(CC_LDFLAGS) \$(OS_LDFLAGS) \$(M_LDFLAGS) \$(HOST_LDFLAGS) \$(LDFLAGS)
+export APP_LDLIBS = -lpjsua-\$(TARGET_NAME) -lpjsip-ua-\$(TARGET_NAME) -lpjsip-simple-\$(TARGET_NAME) -lpjsip-\$(TARGET_NAME) -lpjmedia-codec-\$(TARGET_NAME) -lpjmedia-\$(TARGET_NAME) -lpjnath-\$(TARGET_NAME) -lpjlib-util-\$(TARGET_NAME) \$(APP_THIRD_PARTY_LIBS) \$(APP_THIRD_PARTY_EXT) -lpj-\$(TARGET_NAME) \$(CC_LDFLAGS) \$(OS_LDFLAGS) \$(M_LDFLAGS) \$(HOST_LDFLAGS) \$(LDFLAGS)
 
 export PJ_DIR = \$(PJDIR)
Index: project/trunk/libpj.pc.in
===================================================================
--- /pjproject/trunk/libpj.pc.in	(revision 3062)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Package Information for pkg-config
-
-prefix=@PREFIX@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
-
-Name: libpj
-Description: Multimedia communication library
-Version: 0.5.10.3
-Libs: -L${libdir} -lpjsua -lpjsip -lpjmedia -lpjsip-ua -lpjsip-simple -lpjsip-ua -lpjmedia-codec -lpjlib-util -lpj
-Cflags: -I${includedir}
Index: /pjproject/trunk/libpjproject.pc.in
===================================================================
--- /pjproject/trunk/libpjproject.pc.in	(revision 3063)
+++ /pjproject/trunk/libpjproject.pc.in	(revision 3063)
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: libpjproject
+Description: Multimedia communication library
+URL: http://www.pjsip.org
+Version: @PJ_VERSION@
+Libs: -L${libdir} @PJ_LDLIBS@
+Cflags: -I${includedir} @PJ_INSTALL_CFLAGS@
Index: /pjproject/trunk/pjmedia/build/Makefile
===================================================================
--- /pjproject/trunk/pjmedia/build/Makefile	(revision 3062)
+++ /pjproject/trunk/pjmedia/build/Makefile	(revision 3063)
@@ -41,4 +41,5 @@
 		   -L$(PJDIR)/third_party/lib \
 		   $(APP_THIRD_PARTY_LIBS) \
+		   $(APP_THIRD_PARTY_EXT) \
 		   $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
 		   $(LDFLAGS) 
Index: /pjproject/trunk/pjsip/include/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua.h	(revision 3063)
+++ /pjproject/trunk/pjsip/include/pjsua.h	(revision 3063)
@@ -0,0 +1,1 @@
+#include <pjsua-lib/pjsua.h>
Index: /pjproject/trunk/version.mak
===================================================================
--- /pjproject/trunk/version.mak	(revision 3063)
+++ /pjproject/trunk/version.mak	(revision 3063)
@@ -0,0 +1,1 @@
+export PJ_VERSION := 1.5.5-trunk
