Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 ocp (1:0.2.90-4) unstable; urgency=medium
 .
   * d/rules: drop the gcc-11/g++-11 exports.
   * Apply patch to fix FTCBFS. Thanks Helmut Grohne. (Closes: #996498)
Author: Gürkan Myczko <gurkan@phys.ethz.ch>
Bug-Debian: https://bugs.debian.org/996498

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2021-10-16

--- ocp-0.2.90.orig/configure.ac
+++ ocp-0.2.90/configure.ac
@@ -343,13 +343,11 @@ AC_SUBST(LIBJPEG_CFLAGS)
 AC_SUBST(LIBJPEG_LIBS)
 AC_SUBST(LIBPNG_CFLAGS)
 AC_SUBST(LIBPNG_LIBS)
-if test "x$with_mad" != "xno"; then
+AS_IF([test "x$with_mad" != "xno"],[
 	AC_MSG_CHECKING([mad support])
-	MAD_LIBS=`pkg-config --libs mad 2> /dev/null`
-	MAD_CFLAGS=`pkg-config --cflags mad 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([MAD],[mad],[
 		AC_MSG_RESULT("$MAD_CFLAGS $MAD_LIBS")
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed]);
 	dnl Fall back to non-pkg-config method
 		AC_CHECK_LIB(mad, mad_stream_init, , if test "x$with_mad" = "xyes"; then AC_MSG_ERROR("libmad not found"); else with_mad="no"; fi)
@@ -361,26 +359,22 @@ if test "x$with_mad" != "xno"; then
 			MAD_CFLAGS=""
 			LIBS=$push_LIBS
 		fi
-	fi
-fi
+	])
+])
 
 AC_MSG_CHECKING([libjpeg / libjpeg-turbo support])
-LIBJPEG_LIBS=`pkg-config --libs libjpeg 2> /dev/null`
-LIBJPEG_CFLAGS=`pkg-config --cflags libjpeg 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([LIBJPEG],[libjpeg],[
 	AC_MSG_RESULT("$LIBJPEG_CFLAGS $LIBJPEG_LIBS")
-else
+],[
 	AC_MSG_ERROR([pkg-config failed]);
-fi
+])
 
 AC_MSG_CHECKING([libpng support])
-LIBPNG_LIBS=`pkg-config --libs libpng 2> /dev/null`
-LIBPNG_CFLAGS=`pkg-config --cflags libpng 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([LIBPNG],[libpng],[
 	AC_MSG_RESULT("$LIBPNG_CFLAGS $LIBPNG_LIBS")
-else
+],[
 	AC_MSG_ERROR([pkg-config failed]);
-fi
+])
 
 AC_SUBST(HAVE_MAD)
 if test "x$with_mad" = "xno"; then
@@ -393,27 +387,23 @@ fi
 AC_SUBST(OGG_CFLAGS)
 AC_SUBST(OGG_LIBS)
 AC_MSG_CHECKING([ogg support])
-OGG_LIBS=`pkg-config --libs ogg 2> /dev/null`
-OGG_CFLAGS=`pkg-config --cflags ogg 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([OGG],[ogg],[
 	AC_MSG_RESULT("$OGG_CFLAGS $OGG_LIBS")
-else
+],[
 	AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 	AC_CHECK_LIB(ogg, ogg_sync_init, , AC_MSG_ERROR("ogg libraries not found"))
 	OGG_LIBS="-logg"
 	OGG_CFLAGS=""
 	LIBS=$push_LIBS
-fi
+])
 
 AC_SUBST(VORBIS_CFLAGS)
 AC_SUBST(VORBIS_LIBS)
 AC_MSG_CHECKING([vorbis support])
-VORBIS_LIBS=`pkg-config --libs vorbis 2> /dev/null`
-VORBIS_CFLAGS=`pkg-config --cflags vorbis 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([VORBIS],[vorbis],[
 	AC_MSG_RESULT("$VORBIS_CFLAGS $VORBIS_LIBS")
-else
+],[
 	AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 	AC_CHECK_LIB(vorbis, vorbis_bitrate_init, , AC_MSG_ERROR("vorbis libraries not found"), -logg)
@@ -421,16 +411,14 @@ dnl Fall back to non-pkg-config method
 	VORBIS_LIBS="-lvorbis"
 	VORBIS_CFLAGS=""
 	LIBS=$push_LIBS
-fi
+])
 
 AC_SUBST(VORBISFILE_CFLAGS)
 AC_SUBST(VORBISFILE_LIBS)
 AC_MSG_CHECKING([vorbisfile support])
-VORBISFILE_LIBS=`pkg-config --libs vorbisfile 2> /dev/null`
-VORBISFILE_CFLAGS=`pkg-config --cflags vorbisfile 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([VORBISFILE],[vorbisfile],[
 	AC_MSG_RESULT("$VORBISFILE_CFLAGS $VORBISFILE_LIBS")
-else
+],[
 	AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 
@@ -441,7 +429,7 @@ dnl Fall back to non-pkg-config method
 	VORBISFILE_LIBS="-lvorbisfile"
 	VORBISFILE_CFLAGS=""
 	LIBS=$push_LIBS
-fi
+](
 
 AC_SUBST(FLAC_CFLAGS)
 AC_SUBST(FLAC_LIBS)
@@ -537,13 +525,11 @@ org_cflags="$CFLAGS"
 org_cppflags="$CPPFLAGS"
 AC_SUBST(SDL_CFLAGS)
 AC_SUBST(SDL_LIBS)
-if test "x$with_sdl" != "xno"; then
+AS_IF([test "x$with_sdl" != "xno"],[
 	AC_MSG_CHECKING([SDL support])
-	SDL_LIBS=`pkg-config --libs sdl 2> /dev/null`
-	SDL_CFLAGS=`pkg-config --cflags sdl 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([SDL],[sdl],[
 		AC_MSG_RESULT("$SDL_CFLAGS $SDL_LIBS")
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed])
 
 		AC_CHECK_LIB(SDL, SDL_Init, SDL_LIBS="-lSDL", if test "x$with_sdl" = "xyes"; then AC_MSG_ERROR("libSDL was not found"); else with_sdl="no"; fi)
@@ -553,8 +539,8 @@ if test "x$with_sdl" != "xno"; then
 			CPPFLAGS="$CPPFLAGS -I/usr/include/SDL"
 			AC_CHECK_HEADER(SDL.h, SDL_CFLAGS="-I/usr/include/SDL", if test "x$with_sdl" = "xyes"; then AC_MSG_ERROR("SDL header files not found"); else with_sdl="no"; fi)
 		fi
-	fi
-fi
+	])
+])
 AC_SUBST(HAVE_SDL)
 if test "x$with_sdl" = "xno"; then
 	HAVE_SDL=
@@ -567,18 +553,16 @@ CPPFLAGS="$org_cflags"
 
 AC_SUBST(FREETYPE2_LIBS)
 AC_SUBST(FREETYPE2_CFLAGS)
-if test "x$HAVE_SDL" = "x1" || test "x$HAVE_SDL2" = "x1" || test "x$HAVE_X11" = "x1"; then
+AS_IF([test "x$HAVE_SDL" = "x1" || test "x$HAVE_SDL2" = "x1" || test "x$HAVE_X11" = "x1"],[
 	AC_MSG_CHECKING([freetype2 support])
-	FREETYPE2_LIBS=`pkg-config --libs freetype2 2> /dev/null`
-	FREETYPE2_CFLAGS=`pkg-config --cflags freetype2 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([FREETYPE2],[freetype2],[
 		AC_MSG_RESULT("$FREETYPE2_CFLAGS $FREETYPE2_LIBS")
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed]);
 	dnl Fall back to non-pkg-config method
 		AC_CHECK_LIB(freetype, FT_Init_FreeType, ,AC_MSG_ERROR("libfreetype not found"))
 		AC_CHECK_HEADER(ft2built.h, , AC_MSG_ERROR("libfreetype header files was not found"))
-	fi
+	])
 
 dnl locate the ttf-unifont
 	AS_AC_EXPAND(UNIFONTDIR, $with_unifontdir)
@@ -586,20 +570,18 @@ dnl locate the ttf-unifont
 	AC_CHECK_FILE($UNIFONTDIR/unifont_csur.ttf, , AC_MSG_ERROR([$UNIFONTDIR/unifont_csur.ttf not found - please use --with-unifontdir=/path/ (needed by X11, SDL1.x and SDL2)]))
 	AC_CHECK_FILE($UNIFONTDIR/unifont_upper.ttf, , AC_MSG_ERROR([$UNIFONTDIR/unifont_upper.ttf not found - please use --with-unifontdir=/path/ (needed by X11, SDL1.x and SDL2)]))
 	AC_DEFINE_UNQUOTED(UNIFONTDIR, "$UNIFONTDIR")
-fi
+])
 
 AC_LANG_PUSH(C++)
 org_cxxflags="$CXXFLAGS"
 org_cppflags="$CPPFLAGS"
 AC_SUBST(ADPLUG_CXXFLAGS)
 AC_SUBST(ADPLUG_LIBS)
-if test "x$with_adplug" != "xno"; then
+AS_IF([test "x$with_adplug" != "xno"],[
 	AC_MSG_CHECKING([Adplug support])
-	ADPLUG_LIBS=`pkg-config --libs adplug 2> /dev/null`
-	ADPLUG_CXXFLAGS=`pkg-config --cflags adplug 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([ADPLUG],[adplug],[
 		AC_MSG_RESULT("$ADPLUG_CXXFLAGS $ADPLUG_LIBS")
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 		AC_CHECK_HEADER(adplug/adplug.h, ,with_adplug_failed=yes)
@@ -617,8 +599,8 @@ dnl Fall back to non-pkg-config method
 			AC_CHECK_LIB(adplug, docell0, ADPLUG_LIBS="-ladplug", if test "x$with_adplug" = "xyes"; then AC_MSG_ERROR("Adplug was not found"); else with_adplug="no"; fi)
 			LIBS=$push_LIBS
 		fi
-	fi
-fi
+	])
+])
 CXXFLAGS="$org_cxxflags"
 CPPFLAGS="$org_cppflags"
 
@@ -823,21 +805,19 @@ AC_LANG_POP()
 
 AC_SUBST(ALSA_CFLAGS)
 AC_SUBST(ALSA_LIBS)
-if test "x$with_alsa" != "xno"; then
+AS_IF([test "x$with_alsa" != "xno"],[
 	AC_MSG_CHECKING([Alsa support])
-	ALSA_LIBS=`pkg-config --libs alsa 2> /dev/null`
-	ALSA_CFLAGS=`pkg-config --cflags alsa 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([ALSA],[alsa],[
 		AC_MSG_RESULT("$ALSA_CFLAGS $ALSA_LIBS")
-	else
+	],[
 		if test "x$with_alsa" = "xyes"; then
 			AC_MSG_ERROR([pkg-config failed]);
 		else
 			AC_MSG_RESULT([pkg-config failed]);
 			with_alsa="no"
 		fi
-	fi
-fi
+	])
+])
 
 AC_SUBST(HAVE_ALSA)
 if test "x$with_alsa" = "xno"; then
@@ -877,22 +857,20 @@ fi
 AC_SUBST(HAVE_OSS)
 AC_SUBST(OSS_LIBS)
 AC_SUBST(OSS_CFLAGS)
-if test "x$with_oss" != "xno"; then
+AS_IF([test "x$with_oss" != "xno"],[
 	AC_MSG_CHECKING([liboss])
-	OSS_LIBS=`pkg-config --libs liboss 2> /dev/null`
-	OSS_CFLAGS=`pkg-config --cflags liboss 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([OSS],[oss],[
 		AC_MSG_RESULT("$OSS_CFLAGS $OSS_LIBS")
 		HAVE_OSS=1
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 		AC_CHECK_HEADER(sys/soundcard.h,
 			HAVE_OSS=1
 			AC_DEFINE(HAVE_SYS_SOUNDCARD_H),
 			if test "x$with_oss" = "xyes"; then AC_MSG_ERROR([kernel OSS header file was not found], 1); else with_oss="no"; HAVE_OSS=0;fi)
-	fi
-fi
+	])
+])
 
 AC_SUBST(HAVE_COREAUDIO)
 AC_SUBST(COREAUDIO_CFLAGS)
