From 575944384d405df3944bd4ea9c0e785f93febd1b Mon Sep 17 00:00:00 2001 From: Shiz Date: Sat, 5 Apr 2025 04:09:11 +0200 Subject: [PATCH 1/3] build: fix compiling for non-standard ffmpeg include paths --- configure.ac | 25 ++++++++++++++++++++++--- hacks/Makefile.in | 46 ++++++++++++++++++++++++---------------------- 2 files changed, 46 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index dc2ad2f..5e84706 100644 --- a/configure.ac +++ b/configure.ac @@ -4015,6 +4015,9 @@ have_swresample="$ok" # Check includes if test "$have_avutil" = yes; then ac_save_avutil_CPPFLAGS="$CPPFLAGS" + AC_CACHE_CHECK([for libavutil includes], ac_cv_avutil_config_cflags, + [ac_cv_avutil_config_cflags=`$pkg_config --cflags libavutil`]) + ac_avutil_config_cflags=$ac_cv_avutil_config_cflags CPPFLAGS="$CPPFLAGS $ac_avutil_config_cflags" have_avutil=no AC_CHECK_X_HEADER(libavutil/avutil.h, [have_avutil=yes]) @@ -4023,6 +4026,9 @@ fi if test "$have_avcodec" = yes; then ac_save_avcodec_CPPFLAGS="$CPPFLAGS" + AC_CACHE_CHECK([for libavcodec includes], ac_cv_avcodec_config_cflags, + [ac_cv_avcodec_config_cflags=`$pkg_config --cflags libavcodec`]) + ac_avcodec_config_cflags=$ac_cv_avcodec_config_cflags CPPFLAGS="$CPPFLAGS $ac_avcodec_config_cflags" have_avcodec=no AC_CHECK_X_HEADER(libavcodec/avcodec.h, [have_avcodec=yes]) @@ -4031,6 +4037,9 @@ fi if test "$have_avformat" = yes; then ac_save_avformat_CPPFLAGS="$CPPFLAGS" + AC_CACHE_CHECK([for libavformat includes], ac_cv_avformat_config_cflags, + [ac_cv_avformat_config_cflags=`$pkg_config --cflags libavformat`]) + ac_avformat_config_cflags=$ac_cv_avformat_config_cflags CPPFLAGS="$CPPFLAGS $ac_avformat_config_cflags" have_avformat=no AC_CHECK_X_HEADER(libavformat/avformat.h, [have_avformat=yes]) @@ -4039,6 +4048,9 @@ fi if test "$have_swscale" = yes; then ac_save_swscale_CPPFLAGS="$CPPFLAGS" + AC_CACHE_CHECK([for libswscale includes], ac_cv_swscale_config_cflags, + [ac_cv_swscale_config_cflags=`$pkg_config --cflags libswscale`]) + ac_swscale_config_cflags=$ac_cv_swscale_config_cflags CPPFLAGS="$CPPFLAGS $ac_swscale_config_cflags" have_swscale=no AC_CHECK_X_HEADER(libswscale/swscale.h, [have_swscale=yes]) @@ -4047,6 +4059,9 @@ fi if test "$have_swresample" = yes; then ac_save_swresample_CPPFLAGS="$CPPFLAGS" + AC_CACHE_CHECK([for libswresample includes], ac_cv_swresample_config_cflags, + [ac_cv_swresample_config_cflags=`$pkg_config --cflags libswresample`]) + ac_swresample_config_cflags=$ac_cv_swresample_config_cflags CPPFLAGS="$CPPFLAGS $ac_swresample_config_cflags" have_swresample=no AC_CHECK_X_HEADER(libswresample/swresample.h, [have_swresample=yes]) @@ -4114,14 +4129,18 @@ if test "$have_avformat" = yes -a \ "$have_swscale" = yes -a \ "$have_swresample" = yes ; then have_ffmpeg=yes - AC_CACHE_CHECK([for ffmpeg includes], ac_cv_ffmpeg_config_cflags, - [ac_cv_ffmpeg_config_cflags=`$pkg_config --cflags $pkgs`]) AC_CACHE_CHECK([for ffmpeg libs], ac_cv_ffmpeg_config_libs, [ac_cv_ffmpeg_config_libs=`$pkg_config --libs $pkgs`]) AC_DEFINE(HAVE_FFMPEG) FFMPEG_OBJS='$(FFMPEG_OBJS)' fi -ac_ffmpeg_config_cflags=$ac_cv_ffmpeg_config_cflags +ac_ffmpeg_config_cflags=" \ + $ac_avutil_config_cflags \ + $ac_avcodec_config_cflags \ + $ac_avformat_config_cflags \ + $ac_swscale_config_cflags \ + $ac_swresample_config_cflags \ +" ac_ffmpeg_config_libs=$ac_cv_ffmpeg_config_libs FFMPEG_CFLAGS="$ac_ffmpeg_config_cflags" FFMPEG_LIBS="$ac_ffmpeg_config_libs" diff --git a/hacks/Makefile.in b/hacks/Makefile.in index 44b745e..fa5638b 100644 --- a/hacks/Makefile.in +++ b/hacks/Makefile.in @@ -51,6 +51,8 @@ X_PRE_LIBS = @X_PRE_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ XFT_LIBS = @XFT_LIBS@ +FFMPEG_CFLAGS = @FFMPEG_CFLAGS@ + # Note: see comment in ../driver/Makefile.in for explanation of X_LIBS, etc. # HACK_PRE = $(LIBS) $(X_LIBS) @@ -400,9 +402,9 @@ distclean: clean # Adds all current dependencies to Makefile depend: - $(DEPEND) -s '# DO NOT DELETE: updated by make depend' \ - $(DEPEND_FLAGS) -- \ - $(INCLUDES) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) -- \ + $(DEPEND) -s '# DO NOT DELETE: updated by make depend' \ + $(DEPEND_FLAGS) -- \ + $(INCLUDES) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) $(FFMPEG_CFLAGS) -- \ $(SRCS) # Adds some dependencies to Makefile.in -- not totally accurate, but pretty @@ -410,24 +412,24 @@ depend: # to include only dependencies on files which are themselves a part of this # package. distdepend:: m6502.h - @echo updating dependencies in `pwd`/Makefile.in... ; \ - $(DEPEND) -w 0 -f - \ - -s '# DO NOT DELETE: updated by make distdepend' $(DEPEND_FLAGS) -- \ - $(INCLUDES_1) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) -- \ - $(SRCS) 2>/dev/null | \ - sort -d | \ - ( \ - awk '/^# .*Makefile.in ---/,/^# DO .*distdepend/' < Makefile.in ; \ - sed -e '/^#.*/d' \ - -e 's@ \./@ @g;s@ /[^ ]*@@g;/^.*:$$/d' \ - -e 's@\.\./utils@$$(UTILS_SRC)@g' \ - -e 's@ \([^$$]\)@ $$(srcdir)/\1@g' \ - -e 's@ $$(srcdir)/\(.*config.h\)@ \1@g' \ - -e 's@ $$(srcdir)/\(m6502.h\)@ \1@g' \ - -e 's@ $$(srcdir)/\(images/gen/\)@ \1@g' \ - -e 's@ $$(HACK_SRC)/\(images/gen/\)@ \1@g' ; \ - echo '' \ - ) > /tmp/distdepend.$$$$ && \ + @echo updating dependencies in `pwd`/Makefile.in... ; \ + $(DEPEND) -w 0 -f - \ + -s '# DO NOT DELETE: updated by make distdepend' $(DEPEND_FLAGS) -- \ + $(INCLUDES_1) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) $(FFMPEG_CFLAGS) -- \ + $(SRCS) 2>/dev/null | \ + sort -d | \ + ( \ + awk '/^# .*Makefile.in ---/,/^# DO .*distdepend/' < Makefile.in ; \ + sed -e '/^#.*/d' \ + -e 's@ \./@ @g;s@ /[^ ]*@@g;/^.*:$$/d' \ + -e 's@\.\./utils@$$(UTILS_SRC)@g' \ + -e 's@ \([^$$]\)@ $$(srcdir)/\1@g' \ + -e 's@ $$(srcdir)/\(.*config.h\)@ \1@g' \ + -e 's@ $$(srcdir)/\(m6502.h\)@ \1@g' \ + -e 's@ $$(srcdir)/\(images/gen/\)@ \1@g' \ + -e 's@ $$(HACK_SRC)/\(images/gen/\)@ \1@g' ; \ + echo '' \ + ) > /tmp/distdepend.$$$$ && \ mv /tmp/distdepend.$$$$ Makefile.in TAGS: tags @@ -503,7 +505,7 @@ $(DRIVER_BIN)/prefs.o: # How we build object files in this directory. -HACK_CFLAGS_BASE=$(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) +HACK_CFLAGS_BASE=$(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $(FFMPEG_CFLAGS) .c.o: $(CC) -c $(HACK_CFLAGS_BASE) $< -- 2.48.1