From 78133c59cd854d913dc4256de2a49d48a5033798 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 15 Jan 2021 16:13:56 -0800 Subject: [PATCH] configure: Add libpng detections and configurations. --- configure.ac | 54 +++++++++++++++++++++++++++++++++++++++++++++++++- ircd/magick.cc | 1 + 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3c64dc273..9a0958b93 100644 --- a/configure.ac +++ b/configure.ac @@ -1971,6 +1971,57 @@ RB_HELP_STRING([--with-included-pbc], [Use the libpbc sources from included subm AM_CONDITIONAL([PBC], [test "x$have_pbc" = "xyes" ]) +dnl +dnl +dnl Portable Network Graphics (PNG) support +dnl +dnl + +AC_SUBST(PNG_CPPFLAGS, []) +AC_SUBST(PNG_LDFLAGS, []) +AC_SUBST(PNG_LIBS, []) + +AC_ARG_WITH(png-includes, +RB_HELP_STRING([--with-png-includes=[[[DIR]]]], [Path to PNG include directory]), +[ + PNG_CPPFLAGS+="-I$withval" +], [ + PNG_CPPFLAGS+="-isystem /usr/include/GraphicsMagick/" +]) + +AC_ARG_WITH(png-libs, +RB_HELP_STRING([--with-png-libs=[[[DIR]]]], [Path to PNG library directory]), +[ + PNG_LDFLAGS+="-L$withval" +], []) + +RB_CHK_SYSHEADER([png.h], [PNG_H]) +PKG_CHECK_MODULES(PNG, [png], +[ + dnl May not be DT_NEEDED in actual library since Magick loads it dynamically. + PNG_LIBS+="-lpng" + have_png="yes" +], [ + AC_CHECK_LIB([png], [png_access_version_number], + [ + have_png="yes" + PNG_LIBS+="-lpng" + ], [ + have_png="no" + AC_MSG_WARN([Unable to find libpng for portable network graphics on this system.]) + ]) +]) + +AM_CONDITIONAL([PNG], [test "x$have_png" = "xyes"]) + +dnl IRCD_ENABLE_MAGICK is always defined for use in a constexpr if +AM_COND_IF([PNG], +[ + IRCD_DEFINE(USE_PNG, [1], [Portable Network Graphics (PNG) support is available and enabled]) +], [ + IRCD_DEFINE(USE_PNG, [0], [Portable Network Graphics (PNG) support is unavailable or disabled]) +]) + dnl dnl dnl ImageMagick support @@ -2655,8 +2706,9 @@ echo "Optimized runtime ................. $profiling_used" echo "Optimization level ................ $optimize_level" echo "Machine tuned ..................... $machine_tuning" echo -echo "ImageMagick support ............... $have_imagemagick" echo "Magic support ..................... $have_magic" +echo "ImageMagick support ............... $have_imagemagick" +echo "PNG support ....................... $have_png" echo "Unicode (icuuc) support ........... $have_icuuc" echo "Ziplinks (libz) support ........... $have_zlib" echo "Zstandard (zstd) support .......... $have_zstd" diff --git a/ircd/magick.cc b/ircd/magick.cc index dd7447d4d..759f430a3 100644 --- a/ircd/magick.cc +++ b/ircd/magick.cc @@ -9,6 +9,7 @@ // full license for this software is available in the LICENSE file. #include