Index: i18n/i18n.pro
===================================================================
--- i18n/i18n.pro	(revision 10595)
+++ i18n/i18n.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../config.mak )
 include ( ../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG -= moc qt
 
Index: configure
===================================================================
--- configure	(revision 10595)
+++ configure	(working copy)
@@ -841,13 +841,22 @@
   esac
 
 # find source path
-source_path="`dirname $0`"
+if test -h $0; then
+    source_path="`readlink $0`"
+    source_path="`dirname $source_path`"
+else
+    source_path="`dirname $0`"
+fi
+
+source_path="`cd \"$source_path\"; pwd`"
 source_path_used="yes"
-if test -z "$source_path" -o "$source_path" = "." ; then
+if test -z "$source_path" -o "$source_path" = "`pwd`"; then
     source_path=`pwd`
     source_path_used="no"
 else
+    build_path="`pwd`"
     source_path="`cd \"$source_path\"; pwd`"
+    CONFIG_INCLUDEPATH="$CONFIG_INCLUDEPATH $build_path"
 fi
 
 FFMPEG_CONFIGURATION=" "
@@ -2510,7 +2519,9 @@
 echo "Compiler cache   $ccache"
 echo "DistCC           $distcc"
 echo "Install prefix   $prefix"
-#echo "Source path      $source_path"
+if test "$source_path_used" = "yes"; then
+    echo "Source path      $source_path"
+fi
 #echo "C compiler       $cc"
 #echo "make             $make"
 if test x"$processor" != x"" ; then
@@ -2648,6 +2659,26 @@
 
 MYTH_CONFIG_H=libs/libmyth/mythconfig.h
 MYTH_CONFIG_MAK=libs/libmyth/mythconfig.mak
+
+# build tree in object directory if source path is different from current one
+if test "$source_path_used" = "yes" ; then
+
+    ln -snf "$source_path/configure" configure
+    FILES=`cd $source_path;find -iname \*.pro -or -iname \*.h -or -iname \*.hh |sed -e "s/^.\///"`
+    DIRS=`echo $FILES |xargs -n 1 |sed -e "s/\/*[^\/]*$//;/^$/D" |sort -u`
+    THEMEDIRS=`cd $source_path;find themes/ -maxdepth 1 -mindepth 1 -type d |sed -e "s/^.\///;/\.svn/d"`
+
+    for dir in $DIRS ; do
+            mkdir -p $dir
+            ln -snf "$source_path/$dir" $dir/sourcedir
+    done
+    
+    for f in $FILES $THEMEDIRS ; do
+        ln -snf "$source_path/$f" $f
+    done
+fi
+
+
 echo "Creating $MYTH_CONFIG_H and $MYTH_CONFIG_MAK"
 
 date >> config.log
@@ -2656,6 +2687,8 @@
 echo "/* Automatically generated by configure - do not modify */" > $TMPH
 echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
 
+echo "SRC_PATH=$source_path" >> $MYTH_CONFIG_MAK
+echo "BUILD_PATH=$build_path" >> $MYTH_CONFIG_MAK
 echo "PREFIX=$prefix" >> $MYTH_CONFIG_MAK
 echo "LIBDIR=$libdir" >> $MYTH_CONFIG_MAK
 #echo "bindir=$bindir" >> $MYTH_CONFIG_MAK
@@ -3185,20 +3218,6 @@
   echo "#define CONFIG_SMALL 1" >> $TMPH
 fi
 
-# build tree in object directory if source path is different from current one
-if test "$source_path_used" = "yes" ; then
-    DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
-          libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
-    FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
-    for dir in $DIRS ; do
-            mkdir -p $dir
-    done
-    for f in $FILES ; do
-        ln -sf "$source_path/$f" $f
-    done
-fi
-echo "SRC_PATH='$source_path'" >> $MYTH_CONFIG_MAK
-
 if test "$amr_wb" = "yes" ; then
   echo "#define CONFIG_AMR_WB 1" >> $TMPH
   echo "CONFIG_AMR_WB=yes" >> $MYTH_CONFIG_MAK
Index: version.pro
===================================================================
--- version.pro	(revision 10595)
+++ version.pro	(working copy)
@@ -5,10 +5,19 @@
 #        "exported" is reported as the revision.           #
 ############################################################
 
-SVNTREEDIR = $$system(pwd)
+include ( config.mak )
+include ( settings.pro )
 
+exists (libs/sourcedir) {
+    SVNTREEDIR = $$SRC_PATH
+} else {
+    SVNTREEDIR = $$system(pwd)
+}
+
+
 SOURCES += version.cpp
 
+INCLUDEPATH += libs/libmyth $$BUILD_PATH
 version.target = version.cpp 
 version.commands = echo 'const char *myth_source_version =' \
 '"'`(svnversion $${SVNTREEDIR} 2>/dev/null) || echo Unknown`'";' > .vers.new ; \
Index: themes/themes.pro
===================================================================
--- themes/themes.pro	(revision 10595)
+++ themes/themes.pro	(working copy)
@@ -1,12 +1,18 @@
 include ( ../config.mak )
 include ( ../settings.pro )
 
+exists (sourcedir) {
+   VPATH=./sourcedir
+   !macx:QMAKE_COPY_DIR = sh ./sourcedir/cpsvndir
+} else {
+   !macx:QMAKE_COPY_DIR = sh ./cpsvndir
+}
+
 QMAKE_STRIP = echo
 
 TEMPLATE = app
 CONFIG -= moc qt
 
-!macx:QMAKE_COPY_DIR = sh ./cpsvndir
 
 themes.path = $${PREFIX}/share/mythtv/themes/
 themes.files = blue defaultosd blueosd oldosd default default-wide G.A.N.T. classic DVR
Index: libs/libmythtv/dvbrecorder.cpp
===================================================================
--- libs/libmythtv/dvbrecorder.cpp	(revision 10595)
+++ libs/libmythtv/dvbrecorder.cpp	(working copy)
@@ -66,9 +66,9 @@
 #include "dvbrecorder.h"
 
 // AVLib/FFMPEG includes
-#include "../libavcodec/avcodec.h"
-#include "../libavformat/avformat.h"
-#include "../libavformat/mpegts.h"
+#include "avcodec.h"
+#include "avformat.h"
+#include "mpegts.h"
 
 const int DVBRecorder::TSPACKETS_BETWEEN_PSIP_SYNC = 2000;
 const int DVBRecorder::POLL_INTERVAL        =  50; // msec
Index: libs/libmythtv/nuppeldecoder.cpp
===================================================================
--- libs/libmythtv/nuppeldecoder.cpp	(revision 10595)
+++ libs/libmythtv/nuppeldecoder.cpp	(working copy)
@@ -12,7 +12,7 @@
 using namespace std;
 
 // MythTV headers
-#include "mythconfig.h"
+#include "config.h"
 #include "nuppeldecoder.h"
 #include "NuppelVideoPlayer.h"
 #include "remoteencoder.h"
Index: libs/libmythtv/NuppelVideoRecorder.cpp
===================================================================
--- libs/libmythtv/NuppelVideoRecorder.cpp	(revision 10595)
+++ libs/libmythtv/NuppelVideoRecorder.cpp	(working copy)
@@ -4,7 +4,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "mythconfig.h"
+#include "config.h"
 #ifdef HAVE_SYS_SOUNDCARD_H
     #include <sys/soundcard.h>
 #elif HAVE_SOUNDCARD_H
Index: libs/libmythtv/hdtvrecorder.cpp
===================================================================
--- libs/libmythtv/hdtvrecorder.cpp	(revision 10595)
+++ libs/libmythtv/hdtvrecorder.cpp	(working copy)
@@ -86,9 +86,9 @@
 #include "tv_rec.h"
 
 // AVLib/FFMPEG includes
-#include "../libavcodec/avcodec.h"
-#include "../libavformat/avformat.h"
-#include "../libavformat/mpegts.h"
+#include "avcodec.h"
+#include "avformat.h"
+#include "mpegts.h"
 
 #define REPORT_RING_STATS 1
 
Index: libs/libmythtv/videoout_quartz.cpp
===================================================================
--- libs/libmythtv/videoout_quartz.cpp	(revision 10595)
+++ libs/libmythtv/videoout_quartz.cpp	(working copy)
@@ -59,7 +59,7 @@
 
 #include "osd.h"
 #include "osdsurface.h"
-#include "mythconfig.h"
+#include "config.h"
 #ifdef CONFIG_MAC_ACCEL
 #include "videoout_accel_utils.h"
 #endif
Index: libs/libmythtv/avformatdecoder.cpp
===================================================================
--- libs/libmythtv/avformatdecoder.cpp	(revision 10595)
+++ libs/libmythtv/avformatdecoder.cpp	(working copy)
@@ -8,7 +8,7 @@
 using namespace std;
 
 // MythTV headers
-#include "mythconfig.h" // for CONFIG_DTS
+#include "config.h" // for CONFIG_DTS
 #include "avformatdecoder.h"
 #include "RingBuffer.h"
 #include "NuppelVideoPlayer.h"
@@ -34,7 +34,7 @@
 
 extern "C" {
 #include "libavcodec/liba52/a52.h"
-#include "../libmythmpeg2/mpeg2.h"
+#include "mpeg2.h"
 #include "ivtv_myth.h"
 }
 
Index: libs/libmythtv/libmythtv.pro
===================================================================
--- libs/libmythtv/libmythtv.pro	(revision 10595)
+++ libs/libmythtv/libmythtv.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythtv-$$LIBVERSION
 CONFIG += thread dll
@@ -8,8 +12,8 @@
 INSTALLS = target
 
 INCLUDEPATH += ../.. ..
-INCLUDEPATH += ../libmyth ../libavcodec ../libavutil ../libmythmpeg2
-INCLUDEPATH += ./dvbdev ./mpeg
+INCLUDEPATH += ../libmyth ../libavcodec ../libavutil ../libavformat
+INCLUDEPATH += ../libmythmpeg2 ./dvbdev ./mpeg
 INCLUDEPATH += ../libmythlivemedia/BasicUsageEnvironment/include
 INCLUDEPATH += ../libmythlivemedia/groupsock/include
 INCLUDEPATH += ../libmythlivemedia/liveMedia/include
Index: libs/libmythtv/nuppeldecoder.h
===================================================================
--- libs/libmythtv/nuppeldecoder.h	(revision 10595)
+++ libs/libmythtv/nuppeldecoder.h	(working copy)
@@ -21,7 +21,7 @@
 
 extern "C" {
 #include "frame.h"
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 }
 
 class RawDataList
Index: libs/libmythtv/ivtvdecoder.h
===================================================================
--- libs/libmythtv/ivtvdecoder.h	(revision 10595)
+++ libs/libmythtv/ivtvdecoder.h	(working copy)
@@ -10,7 +10,7 @@
 
 extern "C" {
 #include "frame.h"
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 #include "../libavformat/avformat.h"
 }
 
Index: libs/libmythtv/NuppelVideoRecorder.h
===================================================================
--- libs/libmythtv/NuppelVideoRecorder.h	(revision 10595)
+++ libs/libmythtv/NuppelVideoRecorder.h	(working copy)
@@ -17,7 +17,7 @@
 #include "filter.h"
 #include "minilzo.h"
 #undef HAVE_AV_CONFIG_H
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 
 // C++ std headers
 #include <vector>
Index: libs/libmythtv/mpeg/pespacket.cpp
===================================================================
--- libs/libmythtv/mpeg/pespacket.cpp	(revision 10595)
+++ libs/libmythtv/mpeg/pespacket.cpp	(working copy)
@@ -5,11 +5,11 @@
 #include "mythcontext.h"
 
 extern "C" {
-#include "mythconfig.h"
-#include "../libavcodec/avcodec.h"
-#include "../libavformat/avformat.h"
-#include "../libavutil/crc.h"
-#include "../libavutil/bswap.h"
+#include "config.h"
+#include "avcodec.h"
+#include "avformat.h"
+#include "crc.h"
+#include "bswap.h"
 }
 
 #include <vector>
Index: libs/libmythtv/signalmonitor.cpp
===================================================================
--- libs/libmythtv/signalmonitor.cpp	(revision 10595)
+++ libs/libmythtv/signalmonitor.cpp	(working copy)
@@ -10,7 +10,7 @@
 #include "mythcontext.h"
 #include "signalmonitor.h"
 
-#include "libavcodec/avcodec.h"
+#include "avcodec.h"
 #include "libmyth/util.h"
 
 #ifdef USING_DVB
Index: libs/libmythtv/DVDRingBuffer.h
===================================================================
--- libs/libmythtv/DVDRingBuffer.h	(revision 10595)
+++ libs/libmythtv/DVDRingBuffer.h	(working copy)
@@ -9,7 +9,7 @@
 #include <qobject.h>
 #include <qmutex.h>
 #include "util.h"
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 
 #define DVDNAV_COMPILE
 #include "../libmythdvdnav/dvdnav.h"
Index: libs/libmythtv/mhi.h
===================================================================
--- libs/libmythtv/mhi.h	(revision 10595)
+++ libs/libmythtv/mhi.h	(working copy)
@@ -19,7 +19,7 @@
 #include <qptrqueue.h>
 
 // MythTV headers
-#include "../libavcodec/avcodec.h" // to decode single MPEG I-frames
+#include "avcodec.h" // to decode single MPEG I-frames
 #include "../libmythfreemheg/freemheg.h"
 #include "interactivetv.h"
 #include "mhi.h"
Index: libs/libmythtv/videooutbase.cpp
===================================================================
--- libs/libmythtv/videooutbase.cpp	(revision 10595)
+++ libs/libmythtv/videooutbase.cpp	(working copy)
@@ -5,7 +5,7 @@
 #include "osdsurface.h"
 #include "NuppelVideoPlayer.h"
 
-#include "../libmyth/mythcontext.h"
+#include "mythcontext.h"
 
 #ifdef USING_XV
 #include "videoout_xv.h"
@@ -31,7 +31,7 @@
 
 #include "dithertable.h"
 
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 
 #include "filtermanager.h"
 
Index: libs/libmythtv/videoout_xv.h
===================================================================
--- libs/libmythtv/videoout_xv.h	(revision 10595)
+++ libs/libmythtv/videoout_xv.h	(working copy)
@@ -14,7 +14,7 @@
 #include <X11/extensions/Xvlib.h>
 
 #undef HAVE_AV_CONFIG_H
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 
 class NuppelVideoPlayer;
 class ChromaKeyOSD;
Index: libs/libmythtv/videosource.cpp
===================================================================
--- libs/libmythtv/videosource.cpp	(revision 10595)
+++ libs/libmythtv/videosource.cpp	(working copy)
@@ -20,7 +20,7 @@
 #include <qdir.h>
 
 // MythTV headers
-#include "mythconfig.h"
+#include "config.h"
 #include "mythwidgets.h"
 #include "mythcontext.h"
 #include "mythdbcon.h"
Index: libs/libmythtv/selectavcdevice.cpp
===================================================================
--- libs/libmythtv/selectavcdevice.cpp	(revision 10595)
+++ libs/libmythtv/selectavcdevice.cpp	(working copy)
@@ -4,7 +4,7 @@
  *  Distributed as part of MythTV under GPL v2 and later.
  */
 
-#include "mythconfig.h"
+#include "config.h"
 
 #ifdef CONFIG_DARWIN
 # include "mythcontext.h"
Index: libs/libmythtv/videoout_xv.cpp
===================================================================
--- libs/libmythtv/videoout_xv.cpp	(revision 10595)
+++ libs/libmythtv/videoout_xv.cpp	(working copy)
@@ -33,7 +33,7 @@
 #include "xvmctextures.h"
 
 // MythTV General headers
-#include "mythconfig.h"
+#include "config.h"
 #include "mythcontext.h"
 #include "filtermanager.h"
 #define IGNORE_TV_PLAY_REC
@@ -52,7 +52,7 @@
                                       int, int, XShmSegmentInfo*);
 }
 
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 
 #ifndef HAVE_ROUND
 #define round(x) ((int) ((x) + 0.5))
Index: libs/libmythtv/avformatdecoder.h
===================================================================
--- libs/libmythtv/avformatdecoder.h	(revision 10595)
+++ libs/libmythtv/avformatdecoder.h	(working copy)
@@ -12,7 +12,7 @@
 
 extern "C" {
 #include "frame.h"
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 #include "../libavformat/avformat.h"
 }
 
Index: libs/libmythtv/mpegrecorder.cpp
===================================================================
--- libs/libmythtv/mpegrecorder.cpp	(revision 10595)
+++ libs/libmythtv/mpegrecorder.cpp	(working copy)
@@ -22,7 +22,7 @@
 #include <qregexp.h>
 
 // avlib headers
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 
 // MythTV headers
 #include "mpegrecorder.h"
Index: libs/libmythtv/ivtvdecoder.cpp
===================================================================
--- libs/libmythtv/ivtvdecoder.cpp	(revision 10595)
+++ libs/libmythtv/ivtvdecoder.cpp	(working copy)
@@ -8,7 +8,7 @@
 
 using namespace std;
 
-#include "mythconfig.h"
+#include "config.h"
 #include "ivtvdecoder.h"
 #include "RingBuffer.h"
 #include "NuppelVideoPlayer.h"
Index: libs/libmythtv/tv_rec.cpp
===================================================================
--- libs/libmythtv/tv_rec.cpp	(revision 10595)
+++ libs/libmythtv/tv_rec.cpp	(working copy)
@@ -16,7 +16,7 @@
 #include <qsocket.h>
 
 // MythTV headers
-#include "mythconfig.h"
+#include "config.h"
 #include "tv_rec.h"
 #include "osd.h"
 #include "mythcontext.h"
Index: libs/libmythtv/videoout_ivtv.cpp
===================================================================
--- libs/libmythtv/videoout_ivtv.cpp	(revision 10595)
+++ libs/libmythtv/videoout_ivtv.cpp	(working copy)
@@ -39,7 +39,7 @@
 #include "libmyth/mythcontext.h"
 
 #include "NuppelVideoPlayer.h"
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 #include "yuv2rgb.h"
 #include "osd.h"
 #include "osdsurface.h"
Index: libs/libmythtv/tv_rec.h
===================================================================
--- libs/libmythtv/tv_rec.h	(revision 10595)
+++ libs/libmythtv/tv_rec.h	(working copy)
@@ -14,7 +14,7 @@
 #include "programinfo.h"
 #include "tv.h"
 
-#include "mythconfig.h"
+#include "config.h"
 
 class NuppelVideoRecorder;
 class RingBuffer;
Index: libs/libmythtv/crcipnetworkrecorder.cpp
===================================================================
--- libs/libmythtv/crcipnetworkrecorder.cpp	(revision 10595)
+++ libs/libmythtv/crcipnetworkrecorder.cpp	(working copy)
@@ -54,7 +54,7 @@
 
 #include "crcipnetworkrecorder.h"
 
-#include "../libavformat/avformat.h"
+#include "avformat.h"
 
 /*
 
Index: libs/libmythtv/videobuffers.cpp
===================================================================
--- libs/libmythtv/videobuffers.cpp	(revision 10595)
+++ libs/libmythtv/videobuffers.cpp	(working copy)
@@ -4,7 +4,7 @@
 #include <unistd.h>
 #include "mythcontext.h"
 #include "videobuffers.h"
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 
 #ifdef USING_XVMC
 #include "videoout_xv.h" // for xvmc stuff
Index: libs/libmythtv/videoout_dx.cpp
===================================================================
--- libs/libmythtv/videoout_dx.cpp	(revision 10595)
+++ libs/libmythtv/videoout_dx.cpp	(working copy)
@@ -10,7 +10,7 @@
 #include "mmsystem.h"
 
 extern "C" {
-#include "../libavcodec/avcodec.h"
+#include "avcodec.h"
 }
 
 #define PRINT_FOURCC(c) ((char) (c & 0xFF)) << ((char) ((c >> 8) & 0xFF)) << ((char) ((c >> 16) & 0xFF)) << ((char) ((c >> 24) & 0xFF))
Index: libs/libmythmpeg2/libmythmpeg2.pro
===================================================================
--- libs/libmythmpeg2/libmythmpeg2.pro	(revision 10595)
+++ libs/libmythmpeg2/libmythmpeg2.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythmpeg2-$$LIBVERSION
 CONFIG += thread staticlib warn_off
Index: libs/libmythsoundtouch/libmythsoundtouch.pro
===================================================================
--- libs/libmythsoundtouch/libmythsoundtouch.pro	(revision 10595)
+++ libs/libmythsoundtouch/libmythsoundtouch.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythsoundtouch-$$LIBVERSION
 CONFIG += thread staticlib warn_off
Index: libs/libavformat/libavformat.pro
===================================================================
--- libs/libavformat/libavformat.pro	(revision 10595)
+++ libs/libavformat/libavformat.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythavformat-$$LIBVERSION
 CONFIG += thread dll warn_off
Index: libs/libmythsamplerate/libmythsamplerate.pro
===================================================================
--- libs/libmythsamplerate/libmythsamplerate.pro	(revision 10595)
+++ libs/libmythsamplerate/libmythsamplerate.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythsamplerate-$$LIBVERSION
 CONFIG += thread staticlib warn_off
Index: libs/libmythui/libmythui.pro
===================================================================
--- libs/libmythui/libmythui.pro	(revision 10595)
+++ libs/libmythui/libmythui.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythui-$$LIBVERSION
 CONFIG += debug thread dll 
Index: libs/libmyth/mythcdrom.cpp
===================================================================
--- libs/libmyth/mythcdrom.cpp	(revision 10595)
+++ libs/libmyth/mythcdrom.cpp	(working copy)
@@ -1,7 +1,7 @@
 #include "mythcdrom.h"
 #include <sys/stat.h>
 
-#include "mythconfig.h"
+#include "config.h"
 #include "mythcontext.h"
 
 // For testing
Index: libs/libmyth/mythmedia.cpp
===================================================================
--- libs/libmyth/mythmedia.cpp	(revision 10595)
+++ libs/libmyth/mythmedia.cpp	(working copy)
@@ -11,7 +11,7 @@
 
 // MythTV headers
 #include "mythmedia.h"
-#include "mythconfig.h"
+#include "config.h"
 #include "mythcontext.h"
 #include "util.h"
 
Index: libs/libmyth/util.cpp
===================================================================
--- libs/libmyth/util.cpp	(revision 10595)
+++ libs/libmyth/util.cpp	(working copy)
@@ -30,7 +30,7 @@
 #include <qfont.h>
 
 // Myth headers
-#include "mythconfig.h"
+#include "config.h"
 #include "exitcodes.h"
 #include "util.h"
 #include "mythcontext.h"
Index: libs/libmyth/libmyth.pro
===================================================================
--- libs/libmyth/libmyth.pro	(revision 10595)
+++ libs/libmyth/libmyth.pro	(working copy)
@@ -1,5 +1,9 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
+
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
  
 TEMPLATE = lib
 TARGET = myth-$$LIBVERSION
Index: libs/libmyth/mythmediamonitor.cpp
===================================================================
--- libs/libmyth/mythmediamonitor.cpp	(revision 10595)
+++ libs/libmyth/mythmediamonitor.cpp	(working copy)
@@ -29,7 +29,7 @@
 #include "mythmediamonitor.h"
 #include "mythcontext.h"
 #include "mythdialogs.h"
-#include "mythconfig.h"
+#include "config.h"
 #include "mythcdrom.h"
 #include "mythhdd.h"
 
Index: libs/libmythlivemedia/libmythlivemedia.pro
===================================================================
--- libs/libmythlivemedia/libmythlivemedia.pro	(revision 10595)
+++ libs/libmythlivemedia/libmythlivemedia.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythlivemedia-$$LIBVERSION
 CONFIG += thread shared warn_off
Index: libs/libavcodec/libavcodec.pro
===================================================================
--- libs/libavcodec/libavcodec.pro	(revision 10595)
+++ libs/libavcodec/libavcodec.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythavcodec-$$LIBVERSION
 CONFIG += thread dll warn_off
Index: libs/libavutil/libavutil.pro
===================================================================
--- libs/libavutil/libavutil.pro	(revision 10595)
+++ libs/libavutil/libavutil.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythavutil-$$LIBVERSION
 CONFIG += thread dll warn_off
Index: libs/libmythdvdnav/libmythdvdnav.pro
===================================================================
--- libs/libmythdvdnav/libmythdvdnav.pro	(revision 10595)
+++ libs/libmythdvdnav/libmythdvdnav.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = lib
 TARGET = mythdvdnav-$$LIBVERSION
 CONFIG += thread staticlib warn_off
Index: libs/libmythfreemheg/libmythfreemheg.pro
===================================================================
--- libs/libmythfreemheg/libmythfreemheg.pro	(revision 10595)
+++ libs/libmythfreemheg/libmythfreemheg.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../libmythtv
 
 TEMPLATE = lib
Index: libs/libmythupnp/httprequest.cpp
===================================================================
--- libs/libmythupnp/httprequest.cpp	(revision 10595)
+++ libs/libmythupnp/httprequest.cpp	(working copy)
@@ -17,7 +17,7 @@
 #include <qfile.h>
 #include <qfileinfo.h>
 
-#include "mythconfig.h"
+#include "config.h"
 #ifdef CONFIG_DARWIN
 #include "darwin-sendfile.h"
 #else
Index: libs/libmythupnp/libmythupnp.pro
===================================================================
--- libs/libmythupnp/libmythupnp.pro	(revision 10595)
+++ libs/libmythupnp/libmythupnp.pro	(working copy)
@@ -1,6 +1,13 @@
 include ( ../../config.mak )
+SOURCE=.
+exists ( sourcedir ) {
+    SOURCE=$$system( readlink sourcedir )
+    VPATH=$$SOURCE
+}
 include ( ../../settings.pro )
- 
+
+INCLUDEPATH += $${SOURCE}/../libmythtv
+
 TEMPLATE = lib
 TARGET = mythupnp-$$LIBVERSION
 CONFIG += thread dll
@@ -24,10 +31,10 @@
 SOURCES += upnpdevice.cpp upnptasknotify.cpp upnptasksearch.cpp threadpool.cpp
 SOURCES += httpserver.cpp upnpcds.cpp upnpcdsobjects.cpp bufferedsocketdevice.cpp
 
-INCLUDEPATH += ../libmyth
-INCLUDEPATH += ../..
-DEPENDPATH += ../libmythtv ../libmyth ../libavcodec
-DEPENDPATH += ../libavformat
+INCLUDEPATH += $${SOURCE}/../libmyth
+INCLUDEPATH += $${SOURCE}/../..
+DEPENDPATH += $${SOURCE}/../libmythtv $${SOURCE}/../libmyth $${SOURCE}/../libavcodec
+DEPENDPATH += $${SOURCE}/../libavformat
 
 LIBS += -L../libmyth -L../libmythtv -L../libavcodec
 LIBS += -L../libavformat
Index: programs/mythuitest/mythuitest.pro
===================================================================
--- programs/mythuitest/mythuitest.pro	(revision 10595)
+++ programs/mythuitest/mythuitest.pro	(working copy)
@@ -5,6 +5,11 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
+
 TEMPLATE = app
 TARGET = mythuitest
 CONFIG += thread opengl
Index: programs/mythfrontend/globalsettings.cpp
===================================================================
--- programs/mythfrontend/globalsettings.cpp	(revision 10595)
+++ programs/mythfrontend/globalsettings.cpp	(working copy)
@@ -7,7 +7,7 @@
 #include <qdir.h>
 #include <qimage.h>
 
-#include "mythconfig.h"
+#include "config.h"
 #include "mythcontext.h"
 #include "mythdbcon.h"
 #include "dbsettings.h"
Index: programs/mythfrontend/main.cpp
===================================================================
--- programs/mythfrontend/main.cpp	(revision 10595)
+++ programs/mythfrontend/main.cpp	(working copy)
@@ -14,7 +14,7 @@
 #include <iostream>
 using namespace std;
 
-#include "mythconfig.h"
+#include "config.h"
 #include "tv.h"
 #include "proglist.h"
 #include "progfind.h"
Index: programs/mythfrontend/mythfrontend.pro
===================================================================
--- programs/mythfrontend/mythfrontend.pro	(revision 10595)
+++ programs/mythfrontend/mythfrontend.pro	(working copy)
@@ -3,6 +3,10 @@
 include ( ../../version.pro )
 include ( ../programs-libs.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 TARGET = mythfrontend
Index: programs/mythjobqueue/mythjobqueue.pro
===================================================================
--- programs/mythjobqueue/mythjobqueue.pro	(revision 10595)
+++ programs/mythjobqueue/mythjobqueue.pro	(working copy)
@@ -2,6 +2,10 @@
 include ( ../../settings.pro)
 include ( ../programs-libs.pro)
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 target.path = $${PREFIX}/bin
Index: programs/mythtranscode/replex/replex.pro
===================================================================
--- programs/mythtranscode/replex/replex.pro	(revision 10595)
+++ programs/mythtranscode/replex/replex.pro	(working copy)
@@ -1,6 +1,16 @@
-include ( ../../../config.mak )
+include ( ../../config.mak )
+SOURCE=.
+exists ( sourcedir ) {
+    SOURCE=$$system( readlink sourcedir )
+    VPATH=$$SOURCE
+}
+
 include ( ../../../settings.pro)
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 TARGET = mythreplex
 target.path = $${PREFIX}/bin
Index: programs/mythtranscode/mythtranscode.pro
===================================================================
--- programs/mythtranscode/mythtranscode.pro	(revision 10595)
+++ programs/mythtranscode/mythtranscode.pro	(working copy)
@@ -2,6 +2,10 @@
 include ( ../../settings.pro)
 include ( ../programs-libs.pro)
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 target.path = $${PREFIX}/bin
Index: programs/mythcommflag/mythcommflag.pro
===================================================================
--- programs/mythcommflag/mythcommflag.pro	(revision 10595)
+++ programs/mythcommflag/mythcommflag.pro	(working copy)
@@ -2,6 +2,10 @@
 include (../../settings.pro)
 include ( ../programs-libs.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 target.path = $${PREFIX}/bin
Index: programs/mythbackend/mythbackend.pro
===================================================================
--- programs/mythbackend/mythbackend.pro	(revision 10595)
+++ programs/mythbackend/mythbackend.pro	(working copy)
@@ -3,6 +3,10 @@
 include ( ../../version.pro )
 include ( ../programs-libs.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 TARGET = mythbackend
Index: programs/mythbackend/main.cpp
===================================================================
--- programs/mythbackend/main.cpp	(revision 10595)
+++ programs/mythbackend/main.cpp	(working copy)
@@ -11,7 +11,7 @@
 #include <signal.h>
 #include <cerrno>
 
-#include "mythconfig.h"
+#include "config.h"
 #ifdef CONFIG_DARWIN
     #include <sys/aio.h>    // O_SYNC
 #endif
Index: programs/mythtv-setup/mythtv-setup.pro
===================================================================
--- programs/mythtv-setup/mythtv-setup.pro	(revision 10595)
+++ programs/mythtv-setup/mythtv-setup.pro	(working copy)
@@ -2,6 +2,10 @@
 include ( ../../settings.pro )
 include ( ../programs-libs.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread opengl
 TARGET = mythtv-setup
Index: programs/mythlcdserver/mythlcdserver.pro
===================================================================
--- programs/mythlcdserver/mythlcdserver.pro	(revision 10595)
+++ programs/mythlcdserver/mythlcdserver.pro	(working copy)
@@ -2,6 +2,10 @@
 include ( ../../settings.pro )
 include ( ../programs-libs.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 TARGET = mythlcdserver
Index: programs/mythtv/mythtv.pro
===================================================================
--- programs/mythtv/mythtv.pro	(revision 10595)
+++ programs/mythtv/mythtv.pro	(working copy)
@@ -2,6 +2,10 @@
 include ( ../../settings.pro )
 include ( ../programs-libs.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 TARGET = mythtv
Index: programs/mythwelcome/mythwelcome.pro
===================================================================
--- programs/mythwelcome/mythwelcome.pro	(revision 10595)
+++ programs/mythwelcome/mythwelcome.pro	(working copy)
@@ -2,6 +2,10 @@
 include (../../settings.pro)
 include (../programs-libs.pro)
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 TARGET = mythwelcome
Index: programs/mythtvosd/mythtvosd.pro
===================================================================
--- programs/mythtvosd/mythtvosd.pro	(revision 10595)
+++ programs/mythtvosd/mythtvosd.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../../config.mak )
 include ( ../../settings.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 TARGET = mythtvosd
Index: programs/mythfilldatabase/mythfilldatabase.pro
===================================================================
--- programs/mythfilldatabase/mythfilldatabase.pro	(revision 10595)
+++ programs/mythfilldatabase/mythfilldatabase.pro	(working copy)
@@ -2,6 +2,10 @@
 include ( ../../settings.pro )
 include ( ../programs-libs.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 CONFIG -= moc
Index: programs/mythshutdown/mythshutdown.pro
===================================================================
--- programs/mythshutdown/mythshutdown.pro	(revision 10595)
+++ programs/mythshutdown/mythshutdown.pro	(working copy)
@@ -2,6 +2,10 @@
 include (../../settings.pro)
 include (../programs-libs.pro)
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 TEMPLATE = app
 CONFIG += thread
 target.path = $${PREFIX}/bin
Index: filters/linearblend/filter_linearblend.c
===================================================================
--- filters/linearblend/filter_linearblend.c	(revision 10595)
+++ filters/linearblend/filter_linearblend.c	(working copy)
@@ -9,7 +9,7 @@
 
 #include "config.h"
 #include "dsputil.h"
-#include "../mm_arch.h"
+#include "mm_arch.h"
 
 #define PAVGB(a,b)   "pavgb " #a ", " #b " \n\t"
 #define PAVGUSB(a,b) "pavgusb " #a ", " #b " \n\t"
Index: filters/linearblend/linearblend.pro
===================================================================
--- filters/linearblend/linearblend.pro	(revision 10595)
+++ filters/linearblend/linearblend.pro	(working copy)
@@ -1,7 +1,11 @@
 include ( ../filter-common.pro )
 include ( ../filter-avcodec.pro )
 
-INCLUDEPATH += ../../libs/libmythtv ../..
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
 
+INCLUDEPATH += ../../libs/libmythtv ../.. ..
+
 # Input
 SOURCES += filter_linearblend.c
Index: filters/convert/convert.pro
===================================================================
--- filters/convert/convert.pro	(revision 10595)
+++ filters/convert/convert.pro	(working copy)
@@ -1,5 +1,9 @@
 include ( ../filter-common.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv
 
 # Input
Index: filters/quickdnr/quickdnr.pro
===================================================================
--- filters/quickdnr/quickdnr.pro	(revision 10595)
+++ filters/quickdnr/quickdnr.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../filter-common.pro )
 include ( ../filter-avcodec.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv ../../libs/libavcodec ../..
 
 # Input
Index: filters/postprocess/postprocess.pro
===================================================================
--- filters/postprocess/postprocess.pro	(revision 10595)
+++ filters/postprocess/postprocess.pro	(working copy)
@@ -1,7 +1,11 @@
 include ( ../filter-common.pro )
 include ( ../filter-avcodec.pro )
 
-INCLUDEPATH += ../../libs/libmythtv
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
+INCLUDEPATH += ../../libs/libmythtv ../../libs/libavcodec/libpostproc
 DEPENDPATH  += ../../libs/libmythtv
 
 SOURCES += filter_postprocess.c
Index: filters/postprocess/filter_postprocess.c
===================================================================
--- filters/postprocess/filter_postprocess.c	(revision 10595)
+++ filters/postprocess/filter_postprocess.c	(working copy)
@@ -13,7 +13,7 @@
 #include "avcodec.h"
 #include "filter.h"
 #include "frame.h"
-#include "../../libs/libavcodec/libpostproc/postprocess.h"
+#include "postprocess.h"
 
 static const char FILTER_NAME[] = "PostProcess";
 
Index: filters/onefield/onefield.pro
===================================================================
--- filters/onefield/onefield.pro	(revision 10595)
+++ filters/onefield/onefield.pro	(working copy)
@@ -1,5 +1,9 @@
 include ( ../filter-common.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv
 
 # Input
Index: filters/bobdeint/bobdeint.pro
===================================================================
--- filters/bobdeint/bobdeint.pro	(revision 10595)
+++ filters/bobdeint/bobdeint.pro	(working copy)
@@ -1,5 +1,9 @@
 include ( ../filter-common.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv
 
 # Input
Index: filters/adjust/adjust.pro
===================================================================
--- filters/adjust/adjust.pro	(revision 10595)
+++ filters/adjust/adjust.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../filter-common.pro )
 include ( ../filter-avcodec.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv ../../libs/libavcodec ../..
 
 # Input
Index: filters/force/force.pro
===================================================================
--- filters/force/force.pro	(revision 10595)
+++ filters/force/force.pro	(working copy)
@@ -1,5 +1,9 @@
 include ( ../filter-common.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv
 
 # Input
Index: filters/crop/crop.pro
===================================================================
--- filters/crop/crop.pro	(revision 10595)
+++ filters/crop/crop.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../filter-common.pro )
 include ( ../filter-avcodec.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv ../../libs/libavcodec ../..
 
 # Input
Index: filters/kerneldeint/kerneldeint.pro
===================================================================
--- filters/kerneldeint/kerneldeint.pro	(revision 10595)
+++ filters/kerneldeint/kerneldeint.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../filter-common.pro )
 include ( ../filter-avcodec.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv ../../libs/libavcodec ../..
 
 # Input
Index: filters/ivtc/ivtc.pro
===================================================================
--- filters/ivtc/ivtc.pro	(revision 10595)
+++ filters/ivtc/ivtc.pro	(working copy)
@@ -1,5 +1,9 @@
 include ( ../filter-common.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv ../..
 
 # Input
Index: filters/invert/invert.pro
===================================================================
--- filters/invert/invert.pro	(revision 10595)
+++ filters/invert/invert.pro	(working copy)
@@ -1,5 +1,9 @@
 include ( ../filter-common.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv
 
 # Input
Index: filters/denoise3d/denoise3d.pro
===================================================================
--- filters/denoise3d/denoise3d.pro	(revision 10595)
+++ filters/denoise3d/denoise3d.pro	(working copy)
@@ -1,6 +1,10 @@
 include ( ../filter-common.pro )
 include ( ../filter-avcodec.pro )
 
+exists ( sourcedir ) {
+   VPATH=./sourcedir $${BUILD_PATH}
+}
+
 INCLUDEPATH += ../../libs/libmythtv ../../libs/libavcodec ../..
 
 # Input

