From a3556bac2e0e1a139487a94d4604294c0b957c48 Mon Sep 17 00:00:00 2001 From: XScreenSaver owners Date: Thu, 7 Sep 2023 23:24:17 +0900 Subject: [PATCH 3/4] check header directory for ffmpeg related libraries and add to CFLAGS The header files for ffmpeg related libraries may be installed under subdirectories of /usr/include. To handle such settings: - configure.ac: detect such header files correctly using pkg-config --cflags . - hacks/Makefile.in: add header directory path to include path for compilation when needed --- configure.ac | 15 +++++++++++++++ hacks/Makefile.in | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index 826ec5a..feeff9a 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 avutil 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 avcodec 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 avformat 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 swscale 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 swresample 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]) diff --git a/hacks/Makefile.in b/hacks/Makefile.in index 5942315..1cef418 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) @@ -507,6 +509,10 @@ HACK_CFLAGS_BASE=$(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) .c.o: $(CC) -c $(HACK_CFLAGS_BASE) $< +# For objects which require ffmpeg related headers +ffmpeg-out.o: $(srcdir)/ffmpeg-out.c + $(CC) -o $@ -c $(FFMPEG_CFLAGS) $(HACK_CFLAGS_BASE) $< + # Make sure these are regenerated when the version number ticks. screenhack.o: $(UTILS_SRC)/version.h -- 2.41.0