From eb7f80c9524dc62e70dcfdb409037ac4eee8d76e Mon Sep 17 00:00:00 2001
From: Cameron Cawley <[EMAIL REDACTED]>
Date: Tue, 11 Jan 2022 19:37:12 +0000
Subject: [PATCH] Add the required libraries to SDL_image.pc
---
SDL_image.pc.in | 2 ++
configure.ac | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/SDL_image.pc.in b/SDL_image.pc.in
index 6f3853d..41a9c52 100644
--- a/SDL_image.pc.in
+++ b/SDL_image.pc.in
@@ -8,5 +8,7 @@ Description: image loading library for Simple DirectMedia Layer
Version: @VERSION@
Requires: sdl >= @SDL_VERSION@
Libs: -L${libdir} -lSDL_image
+Requires.private: @PC_REQUIRES@
+Libs.private: @PC_LIBS@
Cflags: -I${includedir}/SDL
diff --git a/configure.ac b/configure.ac
index a2ca4a1..bb4ac37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,6 +158,7 @@ if (test x$enable_jpg = xyes || test x$enable_tif = xyes) && test x$enable_image
PKG_CHECK_MODULES([LIBJPEG], [libjpeg], [dnl
have_jpg_hdr=yes
have_jpg_lib=yes
+ have_jpg_pc=yes
], [dnl
AC_CHECK_HEADER([jpeglib.h], [
have_jpg_hdr=yes
@@ -197,6 +198,7 @@ if test x$enable_png = xyes -a x$enable_imageio != xyes; then
PKG_CHECK_MODULES([LIBPNG], [libpng], [dnl
have_png_hdr=yes
have_png_lib=yes
+ have_png_pc=yes
], [dnl
AC_CHECK_HEADER([png.h], [
have_png_hdr=yes
@@ -234,6 +236,7 @@ if test x$enable_tif = xyes -a x$enable_imageio != xyes; then
PKG_CHECK_MODULES([LIBTIFF], [libtiff-4], [dnl
have_tif_hdr=yes
have_tif_lib=yes
+ have_tif_pc=yes
], [dnl
AC_CHECK_HEADER([tiffio.h], [
have_tif_hdr=yes
@@ -276,6 +279,7 @@ if test x$enable_webp = xyes; then
PKG_CHECK_MODULES([LIBWEBP], [lib$webplib], [dnl
have_webp_hdr=yes
have_webp_lib=yes
+ have_webp_pc=yes
], [dnl
AC_CHECK_HEADER([webp/decode.h], [
have_webp_hdr=yes
@@ -352,6 +356,11 @@ if test x$enable_webp = xyes -a x$have_webp_hdr = xyes -a x$have_webp_lib = xyes
AC_DEFINE_UNQUOTED(LOAD_WEBP_DYNAMIC, "$webp_lib")
else
IMG_LIBS="$LIBWEBP_LIBS $IMG_LIBS"
+ if test x$have_webp_pc = xyes; then
+ PC_REQUIRES="lib$webplib $PC_REQUIRES"
+ else
+ PC_LIBS="$LIBWEBP_LIBS $PC_LIBS"
+ fi
fi
fi
@@ -366,6 +375,11 @@ if test x$enable_tif = xyes -a x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; t
jpg_lib=''
fi
IMG_LIBS="$LIBTIFF_LIBS $IMG_LIBS"
+ if test x$have_tif_pc = xyes; then
+ PC_REQUIRES="libtiff-4 $PC_REQUIRES"
+ else
+ PC_LIBS="$LIBTIFF_LIBS $PC_LIBS"
+ fi
fi
fi
if test x$enable_jpg = xyes -a x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
@@ -375,6 +389,11 @@ if test x$enable_jpg = xyes -a x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; t
AC_DEFINE_UNQUOTED(LOAD_JPG_DYNAMIC, "$jpg_lib")
else
IMG_LIBS="$LIBJPEG_LIBS $IMG_LIBS"
+ if test x$have_jpg_pc = xyes; then
+ PC_REQUIRES="libjpeg $PC_REQUIRES"
+ else
+ PC_LIBS="$LIBJPEG_LIBS $PC_LIBS"
+ fi
fi
fi
if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
@@ -384,6 +403,11 @@ if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; t
AC_DEFINE_UNQUOTED(LOAD_PNG_DYNAMIC, "$png_lib")
else
IMG_LIBS="$LIBPNG_LIBS $IMG_LIBS"
+ if test x$have_png_pc = xyes; then
+ PC_REQUIRES="libpng $PC_REQUIRES"
+ else
+ PC_LIBS="$LIBPNG_LIBS $PC_LIBS"
+ fi
fi
fi
@@ -399,6 +423,8 @@ LIBS="$LIBS $SDL_LIBS"
AC_SUBST([WINDRES])
AC_SUBST([IMG_LIBS])
+AC_SUBST([PC_LIBS])
+AC_SUBST([PC_REQUIRES])
OBJCFLAGS=$CFLAGS