From b98efc1bd0eab287a6027a23a92ef9df713335fa Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 2 Dec 2021 23:20:00 +0300
Subject: [PATCH] configure.ac: move SDL2 detection before all other libs.
---
configure | 1328 +++++++++++++++++++++++++-------------------------
configure.ac | 20 +-
2 files changed, 674 insertions(+), 674 deletions(-)
diff --git a/configure b/configure
index c2fa6e6..153b9cf 100755
--- a/configure
+++ b/configure
@@ -637,17 +637,17 @@ am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
IMG_LIBS
-SDL2_CONFIG
-SDL_LIBS
-SDL_CFLAGS
-SDL_VERSION
LIBWEBP_LIBS
LIBWEBP_CFLAGS
LIBPNG_LIBS
LIBPNG_CFLAGS
+SDL2_CONFIG
+SDL_LIBS
+SDL_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
+SDL_VERSION
USE_VERSION_RC_FALSE
USE_VERSION_RC_TRUE
USE_IMAGEIO_FALSE
@@ -838,12 +838,12 @@ OBJCFLAGS
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
+SDL_CFLAGS
+SDL_LIBS
LIBPNG_CFLAGS
LIBPNG_LIBS
LIBWEBP_CFLAGS
-LIBWEBP_LIBS
-SDL_CFLAGS
-SDL_LIBS'
+LIBWEBP_LIBS'
# Initialize some variables set by options.
@@ -1529,6 +1529,8 @@ Some influential environment variables:
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
+ SDL_CFLAGS C compiler flags for SDL, overriding pkg-config
+ SDL_LIBS linker flags for SDL, overriding pkg-config
LIBPNG_CFLAGS
C compiler flags for LIBPNG, overriding pkg-config
LIBPNG_LIBS linker flags for LIBPNG, overriding pkg-config
@@ -1536,8 +1538,6 @@ Some influential environment variables:
C compiler flags for LIBWEBP, overriding pkg-config
LIBWEBP_LIBS
linker flags for LIBWEBP, overriding pkg-config
- SDL_CFLAGS C compiler flags for SDL, overriding pkg-config
- SDL_LIBS linker flags for SDL, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -13853,82 +13853,8 @@ else
fi
-if (test x$enable_jpg = xyes || test x$enable_tif = xyes) && test x$enable_imageio != xyes; then
- ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
-if test "x$ac_cv_header_jpeglib_h" = xyes; then :
- have_jpg_hdr=yes
-fi
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_CreateDecompress in -ljpeg" >&5
-$as_echo_n "checking for jpeg_CreateDecompress in -ljpeg... " >&6; }
-if ${ac_cv_lib_jpeg_jpeg_CreateDecompress+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ljpeg $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char jpeg_CreateDecompress ();
-int
-main ()
-{
-return jpeg_CreateDecompress ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_jpeg_jpeg_CreateDecompress=yes
-else
- ac_cv_lib_jpeg_jpeg_CreateDecompress=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_CreateDecompress" >&5
-$as_echo "$ac_cv_lib_jpeg_jpeg_CreateDecompress" >&6; }
-if test "x$ac_cv_lib_jpeg_jpeg_CreateDecompress" = xyes; then :
- have_jpg_lib=yes
-fi
-
- if test x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
- if test x$enable_jpg = xyes; then
- $as_echo "#define LOAD_JPG 1" >>confdefs.h
-
- fi
-
- case "$host" in
- *-*-darwin*)
- jpg_lib=`find_lib libjpeg.dylib`
- ;;
- *-*-cygwin* | *-*-mingw*)
- jpg_lib=`find_lib "libjpeg*.dll"`
- ;;
- *)
- jpg_lib=`find_lib "libjpeg[0-9]*.so.*"`
- if test x$jpg_lib = x; then
- jpg_lib=`find_lib "libjpeg.so.*"`
- fi
- ;;
- esac
- elif test x$enable_jpg = xyes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find JPEG library (http://www.ijg.org/)" >&5
-$as_echo "$as_me: WARNING: *** Unable to find JPEG library (http://www.ijg.org/)" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: JPG image loading disabled" >&5
-$as_echo "$as_me: WARNING: JPG image loading disabled" >&2;}
- fi
-fi
+SDL_VERSION=2.0.8
-if test x$enable_png = xyes -a x$enable_imageio != xyes; then
@@ -14050,20 +13976,47 @@ $as_echo "no" >&6; }
fi
fi
+# Check whether --with-sdl-prefix was given.
+if test "${with_sdl_prefix+set}" = set; then :
+ withval=$with_sdl_prefix; sdl_prefix="$withval"
+else
+ sdl_prefix=""
+fi
+
+
+# Check whether --with-sdl-exec-prefix was given.
+if test "${with_sdl_exec_prefix+set}" = set; then :
+ withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval"
+else
+ sdl_exec_prefix=""
+fi
+
+# Check whether --enable-sdltest was given.
+if test "${enable_sdltest+set}" = set; then :
+ enableval=$enable_sdltest;
+else
+ enable_sdltest=yes
+fi
+
+
+ min_sdl_version=$SDL_VERSION
+
+ if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
+
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng" >&5
-$as_echo_n "checking for libpng... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdl2 >= $min_sdl_version" >&5
+$as_echo_n "checking for sdl2 >= $min_sdl_version... " >&6; }
-if test -n "$LIBPNG_CFLAGS"; then
- pkg_cv_LIBPNG_CFLAGS="$LIBPNG_CFLAGS"
+if test -n "$SDL_CFLAGS"; then
+ pkg_cv_SDL_CFLAGS="$SDL_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng\""; } >&5
- ($PKG_CONFIG --exists --print-errors "libpng") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_LIBPNG_CFLAGS=`$PKG_CONFIG --cflags "libpng" 2>/dev/null`
+ pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -14071,16 +14024,16 @@ fi
else
pkg_failed=untried
fi
-if test -n "$LIBPNG_LIBS"; then
- pkg_cv_LIBPNG_LIBS="$LIBPNG_LIBS"
+if test -n "$SDL_LIBS"; then
+ pkg_cv_SDL_LIBS="$SDL_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng\""; } >&5
- ($PKG_CONFIG --exists --print-errors "libpng") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_LIBPNG_LIBS=`$PKG_CONFIG --libs "libpng" 2>/dev/null`
+ pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -14101,171 +14054,263 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- LIBPNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpng" 2>&1`
+ SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sdl2 >= $min_sdl_version" 2>&1`
else
- LIBPNG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpng" 2>&1`
+ SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sdl2 >= $min_sdl_version" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
- echo "$LIBPNG_PKG_ERRORS" >&5
-
- ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
-if test "x$ac_cv_header_png_h" = xyes; then :
-
- have_png_hdr=yes
- LIBPNG_CFLAGS=""
+ echo "$SDL_PKG_ERRORS" >&5
+ sdl_pc=no
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ sdl_pc=no
+else
+ SDL_CFLAGS=$pkg_cv_SDL_CFLAGS
+ SDL_LIBS=$pkg_cv_SDL_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ sdl_pc=yes
fi
+ else
+ sdl_pc=no
+ if test x$sdl_exec_prefix != x ; then
+ sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
+ if test x${SDL2_CONFIG+set} != xset ; then
+ SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config
+ fi
+ fi
+ if test x$sdl_prefix != x ; then
+ sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
+ if test x${SDL2_CONFIG+set} != xset ; then
+ SDL2_CONFIG=$sdl_prefix/bin/sdl2-config
+ fi
+ fi
+ fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_create_read_struct in -lpng" >&5
-$as_echo_n "checking for png_create_read_struct in -lpng... " >&6; }
-if ${ac_cv_lib_png_png_create_read_struct+:} false; then :
+ if test "x$sdl_pc" = xyes ; then
+ no_sdl=""
+ SDL2_CONFIG="pkg-config sdl2"
+ else
+ as_save_PATH="$PATH"
+ if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
+ PATH="$prefix/bin:$prefix/usr/bin:$PATH"
+ fi
+ # Extract the first word of "sdl2-config", so it can be a program name with args.
+set dummy sdl2-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SDL2_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng -lz $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
+ case $SDL2_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_SDL2_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char png_create_read_struct ();
-int
-main ()
-{
-return png_create_read_struct ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_png_png_create_read_struct=yes
-else
- ac_cv_lib_png_png_create_read_struct=no
+ test -z "$ac_cv_path_SDL2_CONFIG" && ac_cv_path_SDL2_CONFIG="no"
+ ;;
+esac
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG
+if test -n "$SDL2_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5
+$as_echo "$SDL2_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_create_read_struct" >&5
-$as_echo "$ac_cv_lib_png_png_create_read_struct" >&6; }
-if test "x$ac_cv_lib_png_png_create_read_struct" = xyes; then :
- have_png_lib=yes
- LIBPNG_LIBS="-lpng -lz"
-fi
+ PATH="$as_save_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5
+$as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; }
+ no_sdl=""
+ if test "$SDL2_CONFIG" = "no" ; then
+ no_sdl=yes
+ else
+ SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags`
+ SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs`
-elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
-if test "x$ac_cv_header_png_h" = xyes; then :
+ sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+ sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+ sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+ if test "x$enable_sdltest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $SDL_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
+ LIBS="$LIBS $SDL_LIBS"
+ rm -f conf.sdltest
+ if test "$cross_compiling" = yes; then :
+ echo $ac_n "cross compiling; assumed OK... $ac_c"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
- have_png_hdr=yes
- LIBPNG_CFLAGS=""
+#include <stdio.h>
+#include <stdlib.h>
+#include "SDL.h"
-fi
+int main (int argc, char *argv[])
+{
+ int major, minor, micro;
+ FILE *fp = fopen("conf.sdltest", "w");
+ if (fp) fclose(fp);
+
+ if (sscanf("$min_sdl_version", "%d.%d.%d", &major, &minor, µ) != 3) {
+ printf("%s, bad version string\n", "$min_sdl_version");
+ exit(1);
+ }
+
+ if (($sdl_major_version > major) ||
+ (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
+ (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
+ printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro);
+ printf("*** best to upgrade to the required version.\n");
+ printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n");
+ printf("*** to point to the correct copy of sdl2-config, and remove the file\n");
+ printf("*** config.cache before re-running configure\n");
+ return 1;
+ }
+}
+
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_create_read_struct in -lpng" >&5
-$as_echo_n "checking for png_create_read_struct in -lpng... " >&6; }
-if ${ac_cv_lib_png_png_create_read_struct+:} false; then :
- $as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng -lz $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ no_sdl=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ CFLAGS="$ac_save_CFLAGS"
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_sdl" = x ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ fi
+ if test "x$no_sdl" = x ; then
+ :
+ else
+ if test "$SDL2_CONFIG" = "no" ; then
+ echo "*** The sdl2-config script installed by SDL could not be found"
+ echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the SDL2_CONFIG environment variable to the"
+ echo "*** full path to sdl2-config."
+ else
+ if test -f conf.sdltest ; then
+ :
+ else
+ echo "*** Could not run SDL test program, checking why..."
+ CFLAGS="$CFLAGS $SDL_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
+ LIBS="$LIBS $SDL_LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char png_create_read_struct ();
+#include <stdio.h>
+#include "SDL.h"
+
+int main(int argc, char *argv[])
+{ return 0; }
+#undef main
+#define main K_and_R_C_main
+
int
main ()
{
-return png_create_read_struct ();
+ return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_png_png_create_read_struct=yes
+ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding SDL or finding the wrong"
+ echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
else
- ac_cv_lib_png_png_create_read_struct=no
+ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means SDL was incorrectly installed"
+ echo "*** or that you have moved SDL since it was installed. In the latter case, you"
+ echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_create_read_struct" >&5
-$as_echo "$ac_cv_lib_png_png_create_read_struct" >&6; }
-if test "x$ac_cv_lib_png_png_create_read_struct" = xyes; then :
-
- have_png_lib=yes
- LIBPNG_LIBS="-lpng -lz"
-
-fi
-
+ CFLAGS="$ac_save_CFLAGS"
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ SDL_CFLAGS=""
+ SDL_LIBS=""
+ as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5
-else
- LIBPNG_CFLAGS=$pkg_cv_LIBPNG_CFLAGS
- LIBPNG_LIBS=$pkg_cv_LIBPNG_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- have_png_hdr=yes
- have_png_lib=yes
+ fi
-fi
- if test x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
- $as_echo "#define LOAD_PNG 1" >>confdefs.h
+ rm -f conf.sdltest
- case "$host" in
- *-*-darwin*)
- png_lib=`find_lib libpng.dylib`
- ;;
- *-*-cygwin* | *-*-mingw*)
- png_lib=`find_lib "libpng*.dll"`
- ;;
- *)
- png_lib=`find_lib "libpng[0-9]*.so.*"`
- if test x$png_lib = x; then
- png_lib=`find_lib "libpng.so.*"`
- fi
- ;;
- esac
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)" >&5
-$as_echo "$as_me: WARNING: *** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: PNG image loading disabled" >&5
-$as_echo "$as_me: WARNING: PNG image loading disabled" >&2;}
- fi
-fi
+CFLAGS="$CFLAGS $SDL_CFLAGS"
+LIBS="$LIBS $SDL_LIBS"
-if test x$enable_tif = xyes -a x$enable_imageio != xyes; then
- ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default"
-if test "x$ac_cv_header_tiffio_h" = xyes; then :
- have_tif_hdr=yes
+if (test x$enable_jpg = xyes || test x$enable_tif = xyes) && test x$enable_imageio != xyes; then
+ ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+ have_jpg_hdr=yes
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFClientOpen in -ltiff" >&5
-$as_echo_n "checking for TIFFClientOpen in -ltiff... " >&6; }
-if ${ac_cv_lib_tiff_TIFFClientOpen+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_CreateDecompress in -ljpeg" >&5
+$as_echo_n "checking for jpeg_CreateDecompress in -ljpeg... " >&6; }
+if ${ac_cv_lib_jpeg_jpeg_CreateDecompress+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltiff -lz $LIBS"
+LIBS="-ljpeg $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14275,77 +14320,74 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char TIFFClientOpen ();
+char jpeg_CreateDecompress ();
int
main ()
{
-return TIFFClientOpen ();
+return jpeg_CreateDecompress ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_tiff_TIFFClientOpen=yes
+ ac_cv_lib_jpeg_jpeg_CreateDecompress=yes
else
- ac_cv_lib_tiff_TIFFClientOpen=no
+ ac_cv_lib_jpeg_jpeg_CreateDecompress=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff_TIFFClientOpen" >&5
-$as_echo "$ac_cv_lib_tiff_TIFFClientOpen" >&6; }
-if test "x$ac_cv_lib_tiff_TIFFClientOpen" = xyes; then :
- have_tif_lib=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_CreateDecompress" >&5
+$as_echo "$ac_cv_lib_jpeg_jpeg_CreateDecompress" >&6; }
+if test "x$ac_cv_lib_jpeg_jpeg_CreateDecompress" = xyes; then :
+ have_jpg_lib=yes
fi
- if test x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
- $as_echo "#define LOAD_TIF 1" >>confdefs.h
+ if test x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
+ if test x$enable_jpg = xyes; then
+ $as_echo "#define LOAD_JPG 1" >>confdefs.h
+ fi
case "$host" in
*-*-darwin*)
- tif_lib=`find_lib libtiff.dylib`
+ jpg_lib=`find_lib libjpeg.dylib`
;;
*-*-cygwin* | *-*-mingw*)
- tif_lib=`find_lib "libtiff-*.dll"`
+ jpg_lib=`find_lib "libjpeg*.dll"`
;;
*)
- tif_lib=`find_lib "libtiff[0-9]*.so.*"`
- if test x$tif_lib = x; then
- tif_lib=`find_lib "libtiff.so.*"`
+ jpg_lib=`find_lib "libjpeg[0-9]*.so.*"`
+ if test x$jpg_lib = x; then
+ jpg_lib=`find_lib "libjpeg.so.*"`
fi
;;
esac
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find Tiff library (http://www.remotesensing.org/libtiff/)" >&5
-$as_echo "$as_me: WARNING: *** Unable to find Tiff library (http://www.remotesensing.org/libtiff/)" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TIF image loading disabled" >&5
-$as_echo "$as_me: WARNING: TIF image loading disabled" >&2;}
+ elif test x$enable_jpg = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find JPEG library (http://www.ijg.org/)" >&5
+$as_echo "$as_me: WARNING: *** Unable to find JPEG library (http://www.ijg.org/)" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: JPG image loading disabled" >&5
+$as_echo "$as_me: WARNING: JPG image loading disabled" >&2;}
fi
fi
-if test x$enable_webpdec = xyes; then
- webplib=webpdecoder
-else
- webplib=webp
-fi
-if test x$enable_webp = xyes; then
+if test x$enable_png = xyes -a x$enable_imageio != xyes; then
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lib$webplib" >&5
-$as_echo_n "checking for lib$webplib... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng" >&5
+$as_echo_n "checking for libpng... " >&6; }
-if test -n "$LIBWEBP_CFLAGS"; then
- pkg_cv_LIBWEBP_CFLAGS="$LIBWEBP_CFLAGS"
+if test -n "$LIBPNG_CFLAGS"; then
+ pkg_cv_LIBPNG_CFLAGS="$LIBPNG_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lib\$webplib\""; } >&5
- ($PKG_CONFIG --exists --print-errors "lib$webplib") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_LIBWEBP_CFLAGS=`$PKG_CONFIG --cflags "lib$webplib" 2>/dev/null`
+ pkg_cv_LIBPNG_CFLAGS=`$PKG_CONFIG --cflags "libpng" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -14353,16 +14395,16 @@ fi
else
pkg_failed=untried
fi
-if test -n "$LIBWEBP_LIBS"; then
- pkg_cv_LIBWEBP_LIBS="$LIBWEBP_LIBS"
+if test -n "$LIBPNG_LIBS"; then
+ pkg_cv_LIBPNG_LIBS="$LIBPNG_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lib\$webplib\""; } >&5
- ($PKG_CONFIG --exists --print-errors "lib$webplib") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_LIBWEBP_LIBS=`$PKG_CONFIG --libs "lib$webplib" 2>/dev/null`
+ pkg_cv_LIBPNG_LIBS=`$PKG_CONFIG --libs "libpng" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -14383,30 +14425,29 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- LIBWEBP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lib$webplib" 2>&1`
+ LIBPNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpng" 2>&1`
else
- LIBWEBP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lib$webplib" 2>&1`
+ LIBPNG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpng" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
- echo "$LIBWEBP_PKG_ERRORS" >&5
+ echo "$LIBPNG_PKG_ERRORS" >&5
- ac_fn_c_check_header_mongrel "$LINENO" "webp/decode.h" "ac_cv_header_webp_decode_h" "$ac_includes_default"
-if test "x$ac_cv_header_webp_decode_h" = xyes; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
+if test "x$ac_cv_header_png_h" = xyes; then :
- have_webp_hdr=yes
- LIBWEBP_CFLAGS=""
+ have_png_hdr=yes
+ LIBPNG_CFLAGS=""
fi
- as_ac_Lib=`$as_echo "ac_cv_lib_$webplib''_WebPGetDecoderVersion" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WebPGetDecoderVersion in -l$webplib" >&5
-$as_echo_n "checking for WebPGetDecoderVersion in -l$webplib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_create_read_struct in -lpng" >&5
+$as_echo_n "checking for png_create_read_struct in -lpng... " >&6; }
+if ${ac_cv_lib_png_png_create_read_struct+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$webplib -lm $LIBS"
+LIBS="-lpng -lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14416,31 +14457,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char WebPGetDecoderVersion ();
+char png_create_read_struct ();
int
main ()
{
-return WebPGetDecoderVersion ();
+return png_create_read_struct ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- eval "$as_ac_Lib=yes"
+ ac_cv_lib_png_png_create_read_struct=yes
else
- eval "$as_ac_Lib=no"
+ ac_cv_lib_png_png_create_read_struct=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-eval ac_res=\$$as_ac_Lib
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_create_read_struct" >&5
+$as_echo "$ac_cv_lib_png_png_create_read_struct" >&6; }
+if test "x$ac_cv_lib_png_png_create_read_struct" = xyes; then :
- have_webp_lib=yes
- LIBWEBP_LIBS="-l$webplib"
+ have_png_lib=yes
+ LIBPNG_LIBS="-lpng -lz"
fi
@@ -14448,23 +14488,22 @@ fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- ac_fn_c_check_header_mongrel "$LINENO" "webp/decode.h" "ac_cv_header_webp_decode_h" "$ac_includes_default"
-if test "x$ac_cv_header_webp_decode_h" = xyes; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
+if test "x$ac_cv_header_png_h" = xyes; then :
- have_webp_hdr=yes
- LIBWEBP_CFLAGS=""
+ have_png_hdr=yes
+ LIBPNG_CFLAGS=""
fi
- as_ac_Lib=`$as_echo "ac_cv_lib_$webplib''_WebPGetDecoderVersion" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WebPGetDecoderVersion in -l$webplib" >&5
-$as_echo_n "checking for WebPGetDecoderVersion in -l$webplib... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_create_read_struct in -lpng" >&5
+$as_echo_n "checking for png_create_read_struct in -lpng... " >&6; }
+if ${ac_cv_lib_png_png_create_read_struct+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$webplib -lm $LIBS"
+LIBS="-lpng -lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -14474,116 +14513,401 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char WebPGetDecoderVersion ();
+char png_create_read_struct ();
int
main ()
{
-return WebPGetDecoderVersion ();
+return png_create_read_struct ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- eval "$as_ac_Lib=yes"
+ ac_cv_lib_png_png_create_read_struct=yes
else
- eval "$as_ac_Lib=no"
+ ac_cv_lib_png_png_create_read_struct=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-eval ac_res=\$$as_ac_Lib
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_create_read_struct" >&5
+$as_echo "$ac_cv_lib_png_png_create_read_struct" >&6; }
+if test "x$ac_cv_lib_png_png_create_read_struct" = xyes; then :
- have_webp_lib=yes
- LIBWEBP_LIBS="-l$webplib"
+ have_png_l
(Patch may be truncated, please check the link at the top of this post.)