From e21f091a6d76e53dc30179e55d17f09a0ed841de Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 15 Dec 2021 07:10:09 +0000 Subject: [PATCH] Bug 1746085 - Move --with-system-png to python configure. r=firefox-build-system-reviewers,andi Like with e.g. --with-system-zlib in bug 1641760, all supported versions of libpng now have a pkg-config file, so use that instead of the manual checks. Differential Revision: https://phabricator.services.mozilla.com/D133796 --- build/moz.configure/old.configure | 1 - old-configure.in | 58 ------------------------------- toolkit/moz.configure | 31 +++++++++++++++++ 3 files changed, 31 insertions(+), 59 deletions(-) diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index f0e8250ecef9..0170d3d681bd 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -117,7 +117,6 @@ def old_configure_options(*options): "--with-distribution-id", "--with-macbundlename-prefix", "--with-system-libevent", - "--with-system-png", "--with-user-appdir", "--x-includes", "--x-libraries", diff --git a/old-configure.in b/old-configure.in index 7ace45aed3a1..2c3db8a20f84 100644 --- a/old-configure.in +++ b/old-configure.in @@ -43,10 +43,6 @@ _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS" _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS" _SUBDIR_CONFIG_ARGS="$ac_configure_args" -dnl Set the version number of the libs included with mozilla -dnl ======================================================== -MOZPNG=10635 - dnl Set the minimum version of toolkit libs used by mozilla dnl ======================================================== GLIB_VERSION=2.42 @@ -1306,55 +1302,6 @@ LIBS=$_SAVE_LIBS AC_SUBST(MOZ_SYSTEM_LIBEVENT) -if test -z "$SKIP_LIBRARY_CHECKS"; then - -dnl ======================================================== -dnl system PNG Support -dnl ======================================================== -MOZ_ARG_WITH_STRING(system-png, -[ --with-system-png[=PFX] - Use system libpng [installed at prefix PFX]], - PNG_DIR=$withval) - -_SAVE_CFLAGS=$CFLAGS -_SAVE_LDFLAGS=$LDFLAGS -_SAVE_LIBS=$LIBS -if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then - CFLAGS="-I${PNG_DIR}/include $CFLAGS" - LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS" -fi -if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then - MOZ_SYSTEM_PNG= -else - AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"], - AC_MSG_ERROR([--with-system-png requested but no working libpng found])) - AC_CHECK_LIB(png, png_get_acTL, , - AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support])) -fi -if test "$MOZ_SYSTEM_PNG" = 1; then - AC_TRY_COMPILE([ #include - #include - #include ], - [ #if PNG_LIBPNG_VER < $MOZPNG - #error "Insufficient libpng version ($MOZPNG required)." - #endif - #ifndef PNG_UINT_31_MAX - #error "Insufficient libpng version." - #endif ], - MOZ_SYSTEM_PNG=1, - AC_MSG_ERROR([--with-system-png requested but no working libpng found])) -fi -CFLAGS=$_SAVE_CFLAGS -LDFLAGS=$_SAVE_LDFLAGS -LIBS=$_SAVE_LIBS - -if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then - MOZ_PNG_CFLAGS="-I${PNG_DIR}/include" - MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}" -fi - -fi # SKIP_LIBRARY_CHECKS - dnl ======================================================== dnl = dnl = Application @@ -2416,11 +2363,6 @@ HOST_CXXFLAGS=`echo \ $_COMPILATION_HOST_CXXFLAGS \ $HOST_CXXFLAGS` -AC_SUBST(MOZ_SYSTEM_PNG) - -AC_SUBST_LIST(MOZ_PNG_CFLAGS) -AC_SUBST_LIST(MOZ_PNG_LIBS) - HOST_CMFLAGS="-x objective-c -fobjc-exceptions" HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions" OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions" diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 56981e13d812..b675b0aa679e 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -1904,6 +1904,37 @@ with only_when(compile_environment): ) +# PNG +# === +with only_when(compile_environment): + system_lib_option( + "--with-system-png", + nargs="?", + help="Use system libpng", + ) + + @depends("--with-system-png") + def deprecated_system_png_path(value): + if len(value) == 1: + die( + "--with-system-png=PATH is not supported anymore. Please use " + "--with-system-png and set any necessary pkg-config environment variable." + ) + + png = pkg_check_modules("MOZ_PNG", "libpng >= 1.6.35", when="--with-system-png") + + check_symbol( + "png_get_acTL", + flags=png.libs, + onerror=lambda: die( + "--with-system-png won't work because the system's libpng doesn't have APNG support" + ), + when="--with-system-png", + ) + + set_config("MOZ_SYSTEM_PNG", True, when="--with-system-png") + + # FFmpeg's ffvpx configuration # ============================================================== with only_when(compile_environment):