diff --git a/ci/autotools.sh b/ci/autotools.sh
index 9992baaeb0fac57669a3ddde3e68d0e81ec04e24..d0a179b4f64d4a188e373671a5aadb015f217117 100755
--- a/ci/autotools.sh
+++ b/ci/autotools.sh
@@ -4,18 +4,61 @@
 
 # This is intended to be run from the top-level source directory.
 
+set -x
+
 # WARNING: clobbers outside the current tree!
 rm  -f ../opus
 ln -s /srv/jenkins/jobs/opus/workspace ../opus
+rm  -f ../ogg
+ln -s /srv/jenkins/jobs/libogg/workspace ../ogg
+
+# HACK: libtool can't link a dynamic library to a static
+# library, and the 'unix' makefile build can't link to
+# a libopus.la. As a work around, hack our own pkg-config
+# file for the uninstalled opus library we want to build
+# against.
+cat <<EOF > opus-ininstalled.pc
+# Opus codec uninstalled pkg-config file
+# hacked up for the opusfile autotools build.
+
+libdir=\${pcfiledir}/../opus
+includedir=\${libdir}/include
+
+Name: opus uninstalled for opusfile
+Description: Opus IETF audio codec (not installed)
+Version: 1.0.1
+Requires:
+Conflicts:
+Libs: \${libdir}/libopus.la -lm
+Cflags: -I\${includedir}
+EOF
+
+cat <<EOF > ogg-uninstalled.pc
+# ogg uninstalled pkg-config file
+# hacked up for the opusfile autotools build
+
+libdir=\${pcfiledir}/../ogg/src
+includedir=\${pcfiledir}/../ogg/include
+
+Name: ogg uninstalled for opusfile
+Description: ogg is a library for manipulating ogg bitstreams (not installed)
+Version: 1.3.0
+Requires:
+Conflicts:
+Libs: \${libdir}/libogg.la
+Cflags: -I\${includedir}
+EOF
+
+PKG_CONFIG_PATH=$PWD
 
 # compile
 ./autogen.sh
-./configure PKG_CONFIG_PATH=$PWD/../opus
+./configure PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
 make clean
 make
 
 # verify distribution target
-make distcheck
+make distcheck PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
 
 # build the documentation
 make -C doc/latex
diff --git a/ci/unix.sh b/ci/unix.sh
index b696146fd70bc6d53396178c7ee5d8977b9aa72c..a84bbbfda953427d47f9cd449813eb4360114043 100755
--- a/ci/unix.sh
+++ b/ci/unix.sh
@@ -4,6 +4,8 @@
 
 # This is intended to be run from the top-level source directory.
 
+set -x
+
 # WARNING: clobbers outside the current tree!
 rm  -f ../opus
 ln -s /srv/jenkins/jobs/opus/workspace ../opus