diff --git a/Makefile.am b/Makefile.am
index 84d128227..d46b682f5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -586,6 +586,8 @@ noinst_LIBRARIES += libxiph.a
 
 libxiph_a_SOURCES = \
 	src/lib/xiph/XiphTags.cxx src/lib/xiph/XiphTags.hxx
+libxiph_a_CPPFLAGS = $(AM_CPPFLAGS) \
+	$(OGG_CFLAGS)
 
 XIPH_LIBS = libxiph.a
 
diff --git a/configure.ac b/configure.ac
index faae616a3..e50163cce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1266,6 +1266,10 @@ if test x$enable_ogg = xyes || test x$enable_flac = xyes; then
 	have_xiph=yes
 fi
 
+if test x$have_ogg = xyes; then
+	PKG_CHECK_MODULES([OGG], [ogg],, [AC_MSG_ERROR([libogg not found])])
+fi
+
 AM_CONDITIONAL(HAVE_OGG, test x$have_ogg = xyes)
 AM_CONDITIONAL(HAVE_XIPH, test x$have_xiph = xyes)