build: fix out of sourcedir build for check

Move the internal header to nodist (as we copy it around anyway).
Use builddir in pattern substitution for it.
Fixes #61483.
diff --git a/libs/gst/check/Makefile.am b/libs/gst/check/Makefile.am
index 6655499..4d986a1 100644
--- a/libs/gst/check/Makefile.am
+++ b/libs/gst/check/Makefile.am
@@ -26,12 +26,14 @@
 libgstcheck_@GST_MAJORMINOR@includedir =		\
 	$(includedir)/gstreamer-@GST_MAJORMINOR@/gst/check
 
-libgstcheck_@GST_MAJORMINOR@include_HEADERS =	\
-	internal-check.h			\
+libgstcheck_@GST_MAJORMINOR@include_HEADERS =	 \
 	gstbufferstraw.h			\
 	gstcheck.h				\
 	gstconsistencychecker.h
 
+nodist_libgstcheck_@GST_MAJORMINOR@include_HEADERS =	\
+	internal-check.h	
+
 CLEANFILES = *.gcno *.gcda *.gcov internal-check.h $(SYMBOLS_FILE)
 
 internal-check.h: $(top_builddir)/libs/gst/check/libcheck/check.h
@@ -106,9 +108,11 @@
 if HAVE_INTROSPECTION
 BUILT_GIRSOURCES = GstCheck-@GST_MAJORMINOR@.gir
 
-gir_headers=$(patsubst %,$(srcdir)/%, $(libgstcheck_@GST_MAJORMINOR@include_HEADERS))
+gir_headers=$(patsubst %,$(srcdir)/%, $(libgstcheck_@GST_MAJORMINOR@include_HEADERS)) \
+    $(patsubst %,$(builddir)/%, $(nodist_libgstcheck_@GST_MAJORMINOR@include_HEADERS))
 gir_sources=$(patsubst %,$(srcdir)/%, $(libgstcheck_@GST_MAJORMINOR@_la_SOURCES))
-gir_cincludes=$(patsubst %,--c-include='gst/check/%',$(libgstcheck_@GST_MAJORMINOR@include_HEADERS))
+gir_cincludes=$(patsubst %,--c-include='gst/check/%',$(libgstcheck_@GST_MAJORMINOR@include_HEADERS)) \
+    $(patsubst %,--c-include='gst/check/%',$(nodist_libgstcheck_@GST_MAJORMINOR@include_HEADERS))
 
 GstCheck-@GST_MAJORMINOR@.gir: $(INTROSPECTION_SCANNER) libgstcheck-@GST_MAJORMINOR@.la
 	$(AM_V_GEN)PKG_CONFIG_PATH="$(top_builddir)/pkgconfig:$(PKG_CONFIG_PATH)" \