diff --git a/mythplugins/configure b/mythplugins/configure
index 7c07d42804..ca6882dfee 100755
--- a/mythplugins/configure
+++ b/mythplugins/configure
@@ -307,6 +307,7 @@ disable $DEPRECATED_PLUGIN_LIST
 prefix="/usr/local"
 libdir_name="lib"
 sysroot=""
+mythroot=""
 ln_s="ln -sf"
 
 logfile="config.ep"
@@ -326,8 +327,10 @@ NB:      all --enable-* options can be reversed with --disable-*
 
 Generic options:
   --prefix=PREFIX          MythTV install location PREFIX [$prefix]
-  --sysroot=SYSROOT        MythTV sysroot location SYSROOT [$sysroot]
+  --sysroot=SYSROOT        General sysroot location SYSROOT [$sysroot]
+  --mythroot=SYSROOT       MythTV specific sysroot location [$mythroot]
   --qmake=QMAKE            use specified qmake [$qmake]
+  --qmakespecs=QMAKE       use specified qmakespecs [$qmakespecs]
   --python=PATH            Force a specific python executable to use [$python]
   --libdir-name=LIBNAME    install/look for libs in PREFIX/LIBNAME [$libdir_name]
   --help                   print this message
@@ -397,8 +400,10 @@ fi
 CMDLINE_SET="
     logfile
     qmake
+    qmakespecs
     python
     sysroot
+    mythroot
 "
 
 CONFIGURATION_OPTS=""
@@ -528,7 +533,11 @@ EOF
 fi
 
 # bring in mythtv config
-if [ -e $prefix/include/mythtv/mythconfig.mak ] ; then
+if [ -e $mythroot$prefix/include/mythtv/mythconfig.mak ] ; then
+    rm mythconfig.mak 2> /dev/null
+    cp $mythroot$prefix/include/mythtv/mythconfig.mak mythconfig.mak
+    sed -i -e "s,^SYSROOT\=.*,SYSROOT=$mythroot,g" mythconfig.mak
+elif [ -e $prefix/include/mythtv/mythconfig.mak ] ; then
     rm mythconfig.mak 2> /dev/null
     ${ln_s} $prefix/include/mythtv/mythconfig.mak mythconfig.mak
 else
@@ -581,6 +590,9 @@ if [ x"$qmake" = "xqmake" ]; then
 else
     CHECK_QMAKE=`which $qmake 2>/dev/null`" "`which qmake-qt5 2>/dev/null`" /usr/lib64/qt5/bin/qmake /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /usr/lib/i386-linux-gnu/qt5/bin/qmake /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake /usr/local/lib/qt5/bin/qmake"
 fi
+if [ -n "qmakespec" ]; then
+	qmake="$qmake -spec $qmakespec"
+fi
 # try to find a qt5 qmake to use
 found_qmake=''
 for i in $CHECK_QMAKE; do
diff --git a/mythplugins/mythgame/mythgame/external/ioapi.c b/mythplugins/mythgame/mythgame/external/ioapi.c
index 7f5c191b2a..8db1d9f9be 100644
--- a/mythplugins/mythgame/mythgame/external/ioapi.c
+++ b/mythplugins/mythgame/mythgame/external/ioapi.c
@@ -14,7 +14,7 @@
         #define _CRT_SECURE_NO_WARNINGS
 #endif
 
-#if defined(__APPLE__) || defined(IOAPI_NO_64)
+#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(ANDROID)
 // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
 #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
 #define FTELLO_FUNC(stream) ftello(stream)
diff --git a/mythplugins/programs-libs.pro b/mythplugins/programs-libs.pro
index 905b593375..c8dce9abb1 100644
--- a/mythplugins/programs-libs.pro
+++ b/mythplugins/programs-libs.pro
@@ -5,7 +5,7 @@ INCLUDEPATH += $${SYSROOT}$${PREFIX}/include/mythtv/libmyth
 INCLUDEPATH += $${SYSROOT}$${PREFIX}/include/mythtv/libmythservicecontracts
 DEPENDPATH *= $${INCLUDEPATH}
 
-LIBS += -L$${LIBDIR} $$EXTRA_LIBS -lmythbase-$$LIBVERSION
+LIBS += -L$${SYSROOT}$${LIBDIR} $$EXTRA_LIBS -lmythbase-$$LIBVERSION
 LIBS += -lmyth-$$LIBVERSION -lmythui-$$LIBVERSION -lmythupnp-$$LIBVERSION
 LIBS += -lmythservicecontracts-$$LIBVERSION
 LIBS += -lmythavcodec
diff --git a/mythplugins/targetdep.pro b/mythplugins/targetdep.pro
index 55f714bde9..1a447f0ef0 100644
--- a/mythplugins/targetdep.pro
+++ b/mythplugins/targetdep.pro
@@ -10,7 +10,7 @@ MYTH_SHLIB_EXT=$${LIBVERSION}.$${QMAKE_EXTENSION_SHLIB}
 MYTH_LIB_EXT  =$${LIBVERSION}.$${QMAKE_EXTENSION_LIB}
 
 
-DEPLIBS = $${LIBDIR}
+DEPLIBS = $${SYSROOT}$${LIBDIR}
 
 # On Windows, dlls were installed with exes:
 mingw : DEPLIBS = $${PREFIX}/bin
