Index: configure
--- configure.orig
+++ configure
@@ -5089,16 +5089,14 @@ if test "$_vorbis" = auto ; then
 int main(void) { vorbis_packet_blocksize(0,0); return 0; }
 EOF
 	if test "$_ogg" = yes ; then
-		cc_check $OGG_CFLAGS $OGG_LIBS $VORBIS_CFLAGS $VORBIS_LIBS \
-			$VORBISFILE -lvorbis -logg && _vorbis=yes
+		cc_check `pkg-config --cflags --libs ogg vorbis vorbisfile` && _vorbis=yes
 	else
-		cc_check $VORBIS_CFLAGS $VORBIS_LIBS \
-			$VORBISFILE -lvorbis && _vorbis=yes
+		cc_check `pkg-config --cflags --libs vorbis vorbisfile` && _vorbis=yes
 	fi
 fi
 if test "$_vorbis" = yes ; then
-	append_var LIBS "$VORBIS_LIBS $VORBISFILE -lvorbis"
-	append_var INCLUDES "$VORBIS_CFLAGS"
+	append_var LIBS "`pkg-config --libs vorbis vorbisfile`"
+	append_var LIBS "`pkg-config --cflags vorbis vorbisfile`"
 fi
 define_in_config_if_yes "$_vorbis" 'USE_VORBIS'
 echo "$_vorbis"
@@ -5209,16 +5207,14 @@ int main(void) {
 }
 EOF
 	if test "$_ogg" = yes ; then
-		cc_check $FLAC_CFLAGS $FLAC_LIBS $OGG_CFLAGS $OGG_LIBS \
-			-logg && _flac=yes
+		cc_check `pkg-config --cflags --libs flac ogg` && _flac=yes
 	else
-		cc_check $FLAC_CFLAGS $FLAC_LIBS \
-			&& _flac=yes
+		cc_check `pkg-config --cflags --libs flac` && _flac=yes
 	fi
 fi
 if test "$_flac" = yes ; then
-	append_var LIBS "$FLAC_LIBS"
-	append_var INCLUDES "$FLAC_CFLAGS"
+	append_var LIBS "`pkg-config --libs flac`"
+	append_var INCLUDES "`pkg-config --cflags flac`"
 fi
 define_in_config_if_yes "$_flac" 'USE_FLAC'
 echo "$_flac"
