Moved SDL detection after graphic libraries so SDL linker flags don't affect them
authorSam Lantinga <slouken@libsdl.org>
Mon, 07 Oct 2019 10:37:37 -0700
changeset 718a1e9c987a73d
parent 717 f6d6ea662fe2
child 719 a1fd4472ed6b
Moved SDL detection after graphic libraries so SDL linker flags don't affect them
configure
configure.in
     1.1 --- a/configure	Sun Oct 06 17:35:56 2019 +0300
     1.2 +++ b/configure	Mon Oct 07 10:37:37 2019 -0700
     1.3 @@ -745,15 +745,15 @@
     1.4  LTLIBOBJS
     1.5  LIBOBJS
     1.6  IMG_LIBS
     1.7 +SDL2_CONFIG
     1.8 +SDL_LIBS
     1.9 +SDL_CFLAGS
    1.10 +SDL_VERSION
    1.11  LIBWEBP_LIBS
    1.12  LIBWEBP_CFLAGS
    1.13  LIBPNG_LIBS
    1.14  LIBPNG_CFLAGS
    1.15 -SDL2_CONFIG
    1.16 -SDL_LIBS
    1.17 -SDL_CFLAGS
    1.18  PKG_CONFIG
    1.19 -SDL_VERSION
    1.20  USE_VERSION_RC_FALSE
    1.21  USE_VERSION_RC_TRUE
    1.22  USE_IMAGEIO_FALSE
    1.23 @@ -898,9 +898,6 @@
    1.24  enable_dependency_tracking
    1.25  enable_silent_rules
    1.26  enable_imageio
    1.27 -with_sdl_prefix
    1.28 -with_sdl_exec_prefix
    1.29 -enable_sdltest
    1.30  enable_bmp
    1.31  enable_gif
    1.32  enable_jpg
    1.33 @@ -920,6 +917,9 @@
    1.34  enable_webp
    1.35  enable_webpdec
    1.36  enable_webp_shared
    1.37 +with_sdl_prefix
    1.38 +with_sdl_exec_prefix
    1.39 +enable_sdltest
    1.40  '
    1.41        ac_precious_vars='build_alias
    1.42  host_alias
    1.43 @@ -933,12 +933,12 @@
    1.44  OBJC
    1.45  OBJCFLAGS
    1.46  PKG_CONFIG
    1.47 -SDL_CFLAGS
    1.48 -SDL_LIBS
    1.49  LIBPNG_CFLAGS
    1.50  LIBPNG_LIBS
    1.51  LIBWEBP_CFLAGS
    1.52 -LIBWEBP_LIBS'
    1.53 +LIBWEBP_LIBS
    1.54 +SDL_CFLAGS
    1.55 +SDL_LIBS'
    1.56  
    1.57  
    1.58  # Initialize some variables set by options.
    1.59 @@ -1569,7 +1569,6 @@
    1.60    --disable-silent-rules  verbose build output (undo: "make V=0")
    1.61    --enable-imageio        use native Mac OS X frameworks for loading images
    1.62                            [default=yes]
    1.63 -  --disable-sdltest       Do not try to compile and run a test SDL program
    1.64    --enable-bmp            support loading BMP/ICO/CUR images [default=yes]
    1.65    --enable-gif            support loading GIF images [default=yes]
    1.66    --enable-jpg            support loading JPG images [default=yes]
    1.67 @@ -1590,6 +1589,7 @@
    1.68    --enable-webpdec        support loading WEBP images via libwebpdecoder
    1.69                            instead of libwebp [default=no]
    1.70    --enable-webp-shared    dynamically load WEBP support [[default=yes]]
    1.71 +  --disable-sdltest       Do not try to compile and run a test SDL program
    1.72  
    1.73  Optional Packages:
    1.74    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
    1.75 @@ -1612,8 +1612,6 @@
    1.76    OBJC        Objective C compiler command
    1.77    OBJCFLAGS   Objective C compiler flags
    1.78    PKG_CONFIG  path to pkg-config utility
    1.79 -  SDL_CFLAGS  C compiler flags for SDL, overriding pkg-config
    1.80 -  SDL_LIBS    linker flags for SDL, overriding pkg-config
    1.81    LIBPNG_CFLAGS
    1.82                C compiler flags for LIBPNG, overriding pkg-config
    1.83    LIBPNG_LIBS linker flags for LIBPNG, overriding pkg-config
    1.84 @@ -1621,6 +1619,8 @@
    1.85                C compiler flags for LIBWEBP, overriding pkg-config
    1.86    LIBWEBP_LIBS
    1.87                linker flags for LIBWEBP, overriding pkg-config
    1.88 +  SDL_CFLAGS  C compiler flags for SDL, overriding pkg-config
    1.89 +  SDL_LIBS    linker flags for SDL, overriding pkg-config
    1.90  
    1.91  Use these variables to override the choices made by `configure' or to help
    1.92  it to find libraries and programs with nonstandard names/locations.
    1.93 @@ -12214,469 +12214,6 @@
    1.94      done
    1.95  }
    1.96  
    1.97 -SDL_VERSION=2.0.8
    1.98 -
    1.99 -
   1.100 -
   1.101 -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
   1.102 -	if test -n "$ac_tool_prefix"; then
   1.103 -  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
   1.104 -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
   1.105 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   1.106 -$as_echo_n "checking for $ac_word... " >&6; }
   1.107 -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
   1.108 -  $as_echo_n "(cached) " >&6
   1.109 -else
   1.110 -  case $PKG_CONFIG in
   1.111 -  [\\/]* | ?:[\\/]*)
   1.112 -  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
   1.113 -  ;;
   1.114 -  *)
   1.115 -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   1.116 -for as_dir in $PATH
   1.117 -do
   1.118 -  IFS=$as_save_IFS
   1.119 -  test -z "$as_dir" && as_dir=.
   1.120 -    for ac_exec_ext in '' $ac_executable_extensions; do
   1.121 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   1.122 -    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   1.123 -    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   1.124 -    break 2
   1.125 -  fi
   1.126 -done
   1.127 -  done
   1.128 -IFS=$as_save_IFS
   1.129 -
   1.130 -  ;;
   1.131 -esac
   1.132 -fi
   1.133 -PKG_CONFIG=$ac_cv_path_PKG_CONFIG
   1.134 -if test -n "$PKG_CONFIG"; then
   1.135 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
   1.136 -$as_echo "$PKG_CONFIG" >&6; }
   1.137 -else
   1.138 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.139 -$as_echo "no" >&6; }
   1.140 -fi
   1.141 -
   1.142 -
   1.143 -fi
   1.144 -if test -z "$ac_cv_path_PKG_CONFIG"; then
   1.145 -  ac_pt_PKG_CONFIG=$PKG_CONFIG
   1.146 -  # Extract the first word of "pkg-config", so it can be a program name with args.
   1.147 -set dummy pkg-config; ac_word=$2
   1.148 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   1.149 -$as_echo_n "checking for $ac_word... " >&6; }
   1.150 -if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
   1.151 -  $as_echo_n "(cached) " >&6
   1.152 -else
   1.153 -  case $ac_pt_PKG_CONFIG in
   1.154 -  [\\/]* | ?:[\\/]*)
   1.155 -  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
   1.156 -  ;;
   1.157 -  *)
   1.158 -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   1.159 -for as_dir in $PATH
   1.160 -do
   1.161 -  IFS=$as_save_IFS
   1.162 -  test -z "$as_dir" && as_dir=.
   1.163 -    for ac_exec_ext in '' $ac_executable_extensions; do
   1.164 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   1.165 -    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   1.166 -    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   1.167 -    break 2
   1.168 -  fi
   1.169 -done
   1.170 -  done
   1.171 -IFS=$as_save_IFS
   1.172 -
   1.173 -  ;;
   1.174 -esac
   1.175 -fi
   1.176 -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
   1.177 -if test -n "$ac_pt_PKG_CONFIG"; then
   1.178 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
   1.179 -$as_echo "$ac_pt_PKG_CONFIG" >&6; }
   1.180 -else
   1.181 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.182 -$as_echo "no" >&6; }
   1.183 -fi
   1.184 -
   1.185 -  if test "x$ac_pt_PKG_CONFIG" = x; then
   1.186 -    PKG_CONFIG=""
   1.187 -  else
   1.188 -    case $cross_compiling:$ac_tool_warned in
   1.189 -yes:)
   1.190 -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
   1.191 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
   1.192 -ac_tool_warned=yes ;;
   1.193 -esac
   1.194 -    PKG_CONFIG=$ac_pt_PKG_CONFIG
   1.195 -  fi
   1.196 -else
   1.197 -  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
   1.198 -fi
   1.199 -
   1.200 -fi
   1.201 -if test -n "$PKG_CONFIG"; then
   1.202 -	_pkg_min_version=0.9.0
   1.203 -	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
   1.204 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
   1.205 -	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
   1.206 -		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
   1.207 -$as_echo "yes" >&6; }
   1.208 -	else
   1.209 -		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.210 -$as_echo "no" >&6; }
   1.211 -		PKG_CONFIG=""
   1.212 -	fi
   1.213 -
   1.214 -fi
   1.215 -
   1.216 -# Check whether --with-sdl-prefix was given.
   1.217 -if test "${with_sdl_prefix+set}" = set; then :
   1.218 -  withval=$with_sdl_prefix; sdl_prefix="$withval"
   1.219 -else
   1.220 -  sdl_prefix=""
   1.221 -fi
   1.222 -
   1.223 -
   1.224 -# Check whether --with-sdl-exec-prefix was given.
   1.225 -if test "${with_sdl_exec_prefix+set}" = set; then :
   1.226 -  withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval"
   1.227 -else
   1.228 -  sdl_exec_prefix=""
   1.229 -fi
   1.230 -
   1.231 -# Check whether --enable-sdltest was given.
   1.232 -if test "${enable_sdltest+set}" = set; then :
   1.233 -  enableval=$enable_sdltest;
   1.234 -else
   1.235 -  enable_sdltest=yes
   1.236 -fi
   1.237 -
   1.238 -
   1.239 -  min_sdl_version=$SDL_VERSION
   1.240 -
   1.241 -  if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
   1.242 -
   1.243 -pkg_failed=no
   1.244 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL" >&5
   1.245 -$as_echo_n "checking for SDL... " >&6; }
   1.246 -
   1.247 -if test -n "$PKG_CONFIG"; then
   1.248 -    if test -n "$SDL_CFLAGS"; then
   1.249 -        pkg_cv_SDL_CFLAGS="$SDL_CFLAGS"
   1.250 -    else
   1.251 -        if test -n "$PKG_CONFIG" && \
   1.252 -    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5
   1.253 -  ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5
   1.254 -  ac_status=$?
   1.255 -  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   1.256 -  test $ac_status = 0; }; then
   1.257 -  pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null`
   1.258 -else
   1.259 -  pkg_failed=yes
   1.260 -fi
   1.261 -    fi
   1.262 -else
   1.263 -	pkg_failed=untried
   1.264 -fi
   1.265 -if test -n "$PKG_CONFIG"; then
   1.266 -    if test -n "$SDL_LIBS"; then
   1.267 -        pkg_cv_SDL_LIBS="$SDL_LIBS"
   1.268 -    else
   1.269 -        if test -n "$PKG_CONFIG" && \
   1.270 -    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5
   1.271 -  ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5
   1.272 -  ac_status=$?
   1.273 -  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   1.274 -  test $ac_status = 0; }; then
   1.275 -  pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null`
   1.276 -else
   1.277 -  pkg_failed=yes
   1.278 -fi
   1.279 -    fi
   1.280 -else
   1.281 -	pkg_failed=untried
   1.282 -fi
   1.283 -
   1.284 -
   1.285 -
   1.286 -if test $pkg_failed = yes; then
   1.287 -
   1.288 -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
   1.289 -        _pkg_short_errors_supported=yes
   1.290 -else
   1.291 -        _pkg_short_errors_supported=no
   1.292 -fi
   1.293 -        if test $_pkg_short_errors_supported = yes; then
   1.294 -	        SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "sdl2 >= $min_sdl_version"`
   1.295 -        else
   1.296 -	        SDL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "sdl2 >= $min_sdl_version"`
   1.297 -        fi
   1.298 -	# Put the nasty error message in config.log where it belongs
   1.299 -	echo "$SDL_PKG_ERRORS" >&5
   1.300 -
   1.301 -	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.302 -$as_echo "no" >&6; }
   1.303 -                sdl_pc=no
   1.304 -elif test $pkg_failed = untried; then
   1.305 -	sdl_pc=no
   1.306 -else
   1.307 -	SDL_CFLAGS=$pkg_cv_SDL_CFLAGS
   1.308 -	SDL_LIBS=$pkg_cv_SDL_LIBS
   1.309 -        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
   1.310 -$as_echo "yes" >&6; }
   1.311 -	sdl_pc=yes
   1.312 -fi
   1.313 -  else
   1.314 -    sdl_pc=no
   1.315 -    if test x$sdl_exec_prefix != x ; then
   1.316 -      sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
   1.317 -      if test x${SDL2_CONFIG+set} != xset ; then
   1.318 -        SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config
   1.319 -      fi
   1.320 -    fi
   1.321 -    if test x$sdl_prefix != x ; then
   1.322 -      sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
   1.323 -      if test x${SDL2_CONFIG+set} != xset ; then
   1.324 -        SDL2_CONFIG=$sdl_prefix/bin/sdl2-config
   1.325 -      fi
   1.326 -    fi
   1.327 -  fi
   1.328 -
   1.329 -  if test "x$sdl_pc" = xyes ; then
   1.330 -    no_sdl=""
   1.331 -    SDL2_CONFIG="pkg-config sdl2"
   1.332 -  else
   1.333 -    as_save_PATH="$PATH"
   1.334 -    if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
   1.335 -      PATH="$prefix/bin:$prefix/usr/bin:$PATH"
   1.336 -    fi
   1.337 -    # Extract the first word of "sdl2-config", so it can be a program name with args.
   1.338 -set dummy sdl2-config; ac_word=$2
   1.339 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   1.340 -$as_echo_n "checking for $ac_word... " >&6; }
   1.341 -if test "${ac_cv_path_SDL2_CONFIG+set}" = set; then :
   1.342 -  $as_echo_n "(cached) " >&6
   1.343 -else
   1.344 -  case $SDL2_CONFIG in
   1.345 -  [\\/]* | ?:[\\/]*)
   1.346 -  ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path.
   1.347 -  ;;
   1.348 -  *)
   1.349 -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   1.350 -for as_dir in $PATH
   1.351 -do
   1.352 -  IFS=$as_save_IFS
   1.353 -  test -z "$as_dir" && as_dir=.
   1.354 -    for ac_exec_ext in '' $ac_executable_extensions; do
   1.355 -  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   1.356 -    ac_cv_path_SDL2_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   1.357 -    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   1.358 -    break 2
   1.359 -  fi
   1.360 -done
   1.361 -  done
   1.362 -IFS=$as_save_IFS
   1.363 -
   1.364 -  test -z "$ac_cv_path_SDL2_CONFIG" && ac_cv_path_SDL2_CONFIG="no"
   1.365 -  ;;
   1.366 -esac
   1.367 -fi
   1.368 -SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG
   1.369 -if test -n "$SDL2_CONFIG"; then
   1.370 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5
   1.371 -$as_echo "$SDL2_CONFIG" >&6; }
   1.372 -else
   1.373 -  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.374 -$as_echo "no" >&6; }
   1.375 -fi
   1.376 -
   1.377 -
   1.378 -    PATH="$as_save_PATH"
   1.379 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5
   1.380 -$as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; }
   1.381 -    no_sdl=""
   1.382 -
   1.383 -    if test "$SDL2_CONFIG" = "no" ; then
   1.384 -      no_sdl=yes
   1.385 -    else
   1.386 -      SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags`
   1.387 -      SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs`
   1.388 -
   1.389 -      sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \
   1.390 -             sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
   1.391 -      sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \
   1.392 -             sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
   1.393 -      sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \
   1.394 -             sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
   1.395 -      if test "x$enable_sdltest" = "xyes" ; then
   1.396 -        ac_save_CFLAGS="$CFLAGS"
   1.397 -        ac_save_CXXFLAGS="$CXXFLAGS"
   1.398 -        ac_save_LIBS="$LIBS"
   1.399 -        CFLAGS="$CFLAGS $SDL_CFLAGS"
   1.400 -        CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
   1.401 -        LIBS="$LIBS $SDL_LIBS"
   1.402 -      rm -f conf.sdltest
   1.403 -      if test "$cross_compiling" = yes; then :
   1.404 -  echo $ac_n "cross compiling; assumed OK... $ac_c"
   1.405 -else
   1.406 -  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.407 -/* end confdefs.h.  */
   1.408 -
   1.409 -#include <stdio.h>
   1.410 -#include <stdlib.h>
   1.411 -#include <string.h>
   1.412 -#include "SDL.h"
   1.413 -
   1.414 -char*
   1.415 -my_strdup (char *str)
   1.416 -{
   1.417 -  char *new_str;
   1.418 -
   1.419 -  if (str)
   1.420 -    {
   1.421 -      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
   1.422 -      strcpy (new_str, str);
   1.423 -    }
   1.424 -  else
   1.425 -    new_str = NULL;
   1.426 -
   1.427 -  return new_str;
   1.428 -}
   1.429 -
   1.430 -int main (int argc, char *argv[])
   1.431 -{
   1.432 -  int major, minor, micro;
   1.433 -  char *tmp_version;
   1.434 -
   1.435 -  /* This hangs on some systems (?)
   1.436 -  system ("touch conf.sdltest");
   1.437 -  */
   1.438 -  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
   1.439 -
   1.440 -  /* HP/UX 9 (%@#!) writes to sscanf strings */
   1.441 -  tmp_version = my_strdup("$min_sdl_version");
   1.442 -  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
   1.443 -     printf("%s, bad version string\n", "$min_sdl_version");
   1.444 -     exit(1);
   1.445 -   }
   1.446 -
   1.447 -   if (($sdl_major_version > major) ||
   1.448 -      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
   1.449 -      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
   1.450 -    {
   1.451 -      return 0;
   1.452 -    }
   1.453 -  else
   1.454 -    {
   1.455 -      printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
   1.456 -      printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro);
   1.457 -      printf("*** best to upgrade to the required version.\n");
   1.458 -      printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n");
   1.459 -      printf("*** to point to the correct copy of sdl2-config, and remove the file\n");
   1.460 -      printf("*** config.cache before re-running configure\n");
   1.461 -      return 1;
   1.462 -    }
   1.463 -}
   1.464 -
   1.465 -
   1.466 -_ACEOF
   1.467 -if ac_fn_c_try_run "$LINENO"; then :
   1.468 -
   1.469 -else
   1.470 -  no_sdl=yes
   1.471 -fi
   1.472 -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   1.473 -  conftest.$ac_objext conftest.beam conftest.$ac_ext
   1.474 -fi
   1.475 -
   1.476 -        CFLAGS="$ac_save_CFLAGS"
   1.477 -        CXXFLAGS="$ac_save_CXXFLAGS"
   1.478 -        LIBS="$ac_save_LIBS"
   1.479 -      fi
   1.480 -    fi
   1.481 -    if test "x$no_sdl" = x ; then
   1.482 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
   1.483 -$as_echo "yes" >&6; }
   1.484 -    else
   1.485 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.486 -$as_echo "no" >&6; }
   1.487 -    fi
   1.488 -  fi
   1.489 -  if test "x$no_sdl" = x ; then
   1.490 -     :
   1.491 -  else
   1.492 -     if test "$SDL2_CONFIG" = "no" ; then
   1.493 -       echo "*** The sdl2-config script installed by SDL could not be found"
   1.494 -       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
   1.495 -       echo "*** your path, or set the SDL2_CONFIG environment variable to the"
   1.496 -       echo "*** full path to sdl2-config."
   1.497 -     else
   1.498 -       if test -f conf.sdltest ; then
   1.499 -        :
   1.500 -       else
   1.501 -          echo "*** Could not run SDL test program, checking why..."
   1.502 -          CFLAGS="$CFLAGS $SDL_CFLAGS"
   1.503 -          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
   1.504 -          LIBS="$LIBS $SDL_LIBS"
   1.505 -          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.506 -/* end confdefs.h.  */
   1.507 -
   1.508 -#include <stdio.h>
   1.509 -#include "SDL.h"
   1.510 -
   1.511 -int main(int argc, char *argv[])
   1.512 -{ return 0; }
   1.513 -#undef  main
   1.514 -#define main K_and_R_C_main
   1.515 -
   1.516 -int
   1.517 -main ()
   1.518 -{
   1.519 - return 0;
   1.520 -  ;
   1.521 -  return 0;
   1.522 -}
   1.523 -_ACEOF
   1.524 -if ac_fn_c_try_link "$LINENO"; then :
   1.525 -   echo "*** The test program compiled, but did not run. This usually means"
   1.526 -          echo "*** that the run-time linker is not finding SDL or finding the wrong"
   1.527 -          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
   1.528 -          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
   1.529 -          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
   1.530 -          echo "*** is required on your system"
   1.531 -	  echo "***"
   1.532 -          echo "*** If you have an old version installed, it is best to remove it, although"
   1.533 -          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
   1.534 -else
   1.535 -   echo "*** The test program failed to compile or link. See the file config.log for the"
   1.536 -          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
   1.537 -          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
   1.538 -          echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG"
   1.539 -fi
   1.540 -rm -f core conftest.err conftest.$ac_objext \
   1.541 -    conftest$ac_exeext conftest.$ac_ext
   1.542 -          CFLAGS="$ac_save_CFLAGS"
   1.543 -          CXXFLAGS="$ac_save_CXXFLAGS"
   1.544 -          LIBS="$ac_save_LIBS"
   1.545 -       fi
   1.546 -     fi
   1.547 -     SDL_CFLAGS=""
   1.548 -     SDL_LIBS=""
   1.549 -     as_fn_error "*** SDL version $SDL_VERSION not found!" "$LINENO" 5
   1.550 -
   1.551 -  fi
   1.552 -
   1.553 -
   1.554 -  rm -f conf.sdltest
   1.555 -
   1.556 -CFLAGS="$CFLAGS $SDL_CFLAGS"
   1.557 -LIBS="$LIBS $SDL_LIBS"
   1.558 -saved_LIBS="$LIBS"
   1.559 -
   1.560  # Check whether --enable-bmp was given.
   1.561  if test "${enable_bmp+set}" = set; then :
   1.562    enableval=$enable_bmp;
   1.563 @@ -12889,6 +12426,122 @@
   1.564  
   1.565  if test x$enable_png = xyes -a x$enable_imageio != xyes; then
   1.566  
   1.567 +
   1.568 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
   1.569 +	if test -n "$ac_tool_prefix"; then
   1.570 +  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
   1.571 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
   1.572 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   1.573 +$as_echo_n "checking for $ac_word... " >&6; }
   1.574 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
   1.575 +  $as_echo_n "(cached) " >&6
   1.576 +else
   1.577 +  case $PKG_CONFIG in
   1.578 +  [\\/]* | ?:[\\/]*)
   1.579 +  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
   1.580 +  ;;
   1.581 +  *)
   1.582 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   1.583 +for as_dir in $PATH
   1.584 +do
   1.585 +  IFS=$as_save_IFS
   1.586 +  test -z "$as_dir" && as_dir=.
   1.587 +    for ac_exec_ext in '' $ac_executable_extensions; do
   1.588 +  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   1.589 +    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   1.590 +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   1.591 +    break 2
   1.592 +  fi
   1.593 +done
   1.594 +  done
   1.595 +IFS=$as_save_IFS
   1.596 +
   1.597 +  ;;
   1.598 +esac
   1.599 +fi
   1.600 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
   1.601 +if test -n "$PKG_CONFIG"; then
   1.602 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
   1.603 +$as_echo "$PKG_CONFIG" >&6; }
   1.604 +else
   1.605 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.606 +$as_echo "no" >&6; }
   1.607 +fi
   1.608 +
   1.609 +
   1.610 +fi
   1.611 +if test -z "$ac_cv_path_PKG_CONFIG"; then
   1.612 +  ac_pt_PKG_CONFIG=$PKG_CONFIG
   1.613 +  # Extract the first word of "pkg-config", so it can be a program name with args.
   1.614 +set dummy pkg-config; ac_word=$2
   1.615 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   1.616 +$as_echo_n "checking for $ac_word... " >&6; }
   1.617 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
   1.618 +  $as_echo_n "(cached) " >&6
   1.619 +else
   1.620 +  case $ac_pt_PKG_CONFIG in
   1.621 +  [\\/]* | ?:[\\/]*)
   1.622 +  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
   1.623 +  ;;
   1.624 +  *)
   1.625 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   1.626 +for as_dir in $PATH
   1.627 +do
   1.628 +  IFS=$as_save_IFS
   1.629 +  test -z "$as_dir" && as_dir=.
   1.630 +    for ac_exec_ext in '' $ac_executable_extensions; do
   1.631 +  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   1.632 +    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   1.633 +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   1.634 +    break 2
   1.635 +  fi
   1.636 +done
   1.637 +  done
   1.638 +IFS=$as_save_IFS
   1.639 +
   1.640 +  ;;
   1.641 +esac
   1.642 +fi
   1.643 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
   1.644 +if test -n "$ac_pt_PKG_CONFIG"; then
   1.645 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
   1.646 +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
   1.647 +else
   1.648 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.649 +$as_echo "no" >&6; }
   1.650 +fi
   1.651 +
   1.652 +  if test "x$ac_pt_PKG_CONFIG" = x; then
   1.653 +    PKG_CONFIG=""
   1.654 +  else
   1.655 +    case $cross_compiling:$ac_tool_warned in
   1.656 +yes:)
   1.657 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
   1.658 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
   1.659 +ac_tool_warned=yes ;;
   1.660 +esac
   1.661 +    PKG_CONFIG=$ac_pt_PKG_CONFIG
   1.662 +  fi
   1.663 +else
   1.664 +  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
   1.665 +fi
   1.666 +
   1.667 +fi
   1.668 +if test -n "$PKG_CONFIG"; then
   1.669 +	_pkg_min_version=0.9.0
   1.670 +	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
   1.671 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
   1.672 +	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
   1.673 +		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
   1.674 +$as_echo "yes" >&6; }
   1.675 +	else
   1.676 +		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.677 +$as_echo "no" >&6; }
   1.678 +		PKG_CONFIG=""
   1.679 +	fi
   1.680 +
   1.681 +fi
   1.682 +
   1.683  pkg_failed=no
   1.684  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBPNG" >&5
   1.685  $as_echo_n "checking for LIBPNG... " >&6; }
   1.686 @@ -13481,7 +13134,351 @@
   1.687      fi
   1.688  fi
   1.689  
   1.690 -LIBS="$saved_LIBS"
   1.691 +SDL_VERSION=2.0.8
   1.692 +
   1.693 +
   1.694 +# Check whether --with-sdl-prefix was given.
   1.695 +if test "${with_sdl_prefix+set}" = set; then :
   1.696 +  withval=$with_sdl_prefix; sdl_prefix="$withval"
   1.697 +else
   1.698 +  sdl_prefix=""
   1.699 +fi
   1.700 +
   1.701 +
   1.702 +# Check whether --with-sdl-exec-prefix was given.
   1.703 +if test "${with_sdl_exec_prefix+set}" = set; then :
   1.704 +  withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval"
   1.705 +else
   1.706 +  sdl_exec_prefix=""
   1.707 +fi
   1.708 +
   1.709 +# Check whether --enable-sdltest was given.
   1.710 +if test "${enable_sdltest+set}" = set; then :
   1.711 +  enableval=$enable_sdltest;
   1.712 +else
   1.713 +  enable_sdltest=yes
   1.714 +fi
   1.715 +
   1.716 +
   1.717 +  min_sdl_version=$SDL_VERSION
   1.718 +
   1.719 +  if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
   1.720 +
   1.721 +pkg_failed=no
   1.722 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL" >&5
   1.723 +$as_echo_n "checking for SDL... " >&6; }
   1.724 +
   1.725 +if test -n "$PKG_CONFIG"; then
   1.726 +    if test -n "$SDL_CFLAGS"; then
   1.727 +        pkg_cv_SDL_CFLAGS="$SDL_CFLAGS"
   1.728 +    else
   1.729 +        if test -n "$PKG_CONFIG" && \
   1.730 +    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5
   1.731 +  ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5
   1.732 +  ac_status=$?
   1.733 +  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   1.734 +  test $ac_status = 0; }; then
   1.735 +  pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null`
   1.736 +else
   1.737 +  pkg_failed=yes
   1.738 +fi
   1.739 +    fi
   1.740 +else
   1.741 +	pkg_failed=untried
   1.742 +fi
   1.743 +if test -n "$PKG_CONFIG"; then
   1.744 +    if test -n "$SDL_LIBS"; then
   1.745 +        pkg_cv_SDL_LIBS="$SDL_LIBS"
   1.746 +    else
   1.747 +        if test -n "$PKG_CONFIG" && \
   1.748 +    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5
   1.749 +  ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5
   1.750 +  ac_status=$?
   1.751 +  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   1.752 +  test $ac_status = 0; }; then
   1.753 +  pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null`
   1.754 +else
   1.755 +  pkg_failed=yes
   1.756 +fi
   1.757 +    fi
   1.758 +else
   1.759 +	pkg_failed=untried
   1.760 +fi
   1.761 +
   1.762 +
   1.763 +
   1.764 +if test $pkg_failed = yes; then
   1.765 +
   1.766 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
   1.767 +        _pkg_short_errors_supported=yes
   1.768 +else
   1.769 +        _pkg_short_errors_supported=no
   1.770 +fi
   1.771 +        if test $_pkg_short_errors_supported = yes; then
   1.772 +	        SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "sdl2 >= $min_sdl_version"`
   1.773 +        else
   1.774 +	        SDL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "sdl2 >= $min_sdl_version"`
   1.775 +        fi
   1.776 +	# Put the nasty error message in config.log where it belongs
   1.777 +	echo "$SDL_PKG_ERRORS" >&5
   1.778 +
   1.779 +	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.780 +$as_echo "no" >&6; }
   1.781 +                sdl_pc=no
   1.782 +elif test $pkg_failed = untried; then
   1.783 +	sdl_pc=no
   1.784 +else
   1.785 +	SDL_CFLAGS=$pkg_cv_SDL_CFLAGS
   1.786 +	SDL_LIBS=$pkg_cv_SDL_LIBS
   1.787 +        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
   1.788 +$as_echo "yes" >&6; }
   1.789 +	sdl_pc=yes
   1.790 +fi
   1.791 +  else
   1.792 +    sdl_pc=no
   1.793 +    if test x$sdl_exec_prefix != x ; then
   1.794 +      sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
   1.795 +      if test x${SDL2_CONFIG+set} != xset ; then
   1.796 +        SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config
   1.797 +      fi
   1.798 +    fi
   1.799 +    if test x$sdl_prefix != x ; then
   1.800 +      sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
   1.801 +      if test x${SDL2_CONFIG+set} != xset ; then
   1.802 +        SDL2_CONFIG=$sdl_prefix/bin/sdl2-config
   1.803 +      fi
   1.804 +    fi
   1.805 +  fi
   1.806 +
   1.807 +  if test "x$sdl_pc" = xyes ; then
   1.808 +    no_sdl=""
   1.809 +    SDL2_CONFIG="pkg-config sdl2"
   1.810 +  else
   1.811 +    as_save_PATH="$PATH"
   1.812 +    if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then
   1.813 +      PATH="$prefix/bin:$prefix/usr/bin:$PATH"
   1.814 +    fi
   1.815 +    # Extract the first word of "sdl2-config", so it can be a program name with args.
   1.816 +set dummy sdl2-config; ac_word=$2
   1.817 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
   1.818 +$as_echo_n "checking for $ac_word... " >&6; }
   1.819 +if test "${ac_cv_path_SDL2_CONFIG+set}" = set; then :
   1.820 +  $as_echo_n "(cached) " >&6
   1.821 +else
   1.822 +  case $SDL2_CONFIG in
   1.823 +  [\\/]* | ?:[\\/]*)
   1.824 +  ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path.
   1.825 +  ;;
   1.826 +  *)
   1.827 +  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   1.828 +for as_dir in $PATH
   1.829 +do
   1.830 +  IFS=$as_save_IFS
   1.831 +  test -z "$as_dir" && as_dir=.
   1.832 +    for ac_exec_ext in '' $ac_executable_extensions; do
   1.833 +  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
   1.834 +    ac_cv_path_SDL2_CONFIG="$as_dir/$ac_word$ac_exec_ext"
   1.835 +    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
   1.836 +    break 2
   1.837 +  fi
   1.838 +done
   1.839 +  done
   1.840 +IFS=$as_save_IFS
   1.841 +
   1.842 +  test -z "$ac_cv_path_SDL2_CONFIG" && ac_cv_path_SDL2_CONFIG="no"
   1.843 +  ;;
   1.844 +esac
   1.845 +fi
   1.846 +SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG
   1.847 +if test -n "$SDL2_CONFIG"; then
   1.848 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5
   1.849 +$as_echo "$SDL2_CONFIG" >&6; }
   1.850 +else
   1.851 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.852 +$as_echo "no" >&6; }
   1.853 +fi
   1.854 +
   1.855 +
   1.856 +    PATH="$as_save_PATH"
   1.857 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5
   1.858 +$as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; }
   1.859 +    no_sdl=""
   1.860 +
   1.861 +    if test "$SDL2_CONFIG" = "no" ; then
   1.862 +      no_sdl=yes
   1.863 +    else
   1.864 +      SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags`
   1.865 +      SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs`
   1.866 +
   1.867 +      sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \
   1.868 +             sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
   1.869 +      sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \
   1.870 +             sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
   1.871 +      sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \
   1.872 +             sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
   1.873 +      if test "x$enable_sdltest" = "xyes" ; then
   1.874 +        ac_save_CFLAGS="$CFLAGS"
   1.875 +        ac_save_CXXFLAGS="$CXXFLAGS"
   1.876 +        ac_save_LIBS="$LIBS"
   1.877 +        CFLAGS="$CFLAGS $SDL_CFLAGS"
   1.878 +        CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
   1.879 +        LIBS="$LIBS $SDL_LIBS"
   1.880 +      rm -f conf.sdltest
   1.881 +      if test "$cross_compiling" = yes; then :
   1.882 +  echo $ac_n "cross compiling; assumed OK... $ac_c"
   1.883 +else
   1.884 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.885 +/* end confdefs.h.  */
   1.886 +
   1.887 +#include <stdio.h>
   1.888 +#include <stdlib.h>
   1.889 +#include <string.h>
   1.890 +#include "SDL.h"
   1.891 +
   1.892 +char*
   1.893 +my_strdup (char *str)
   1.894 +{
   1.895 +  char *new_str;
   1.896 +
   1.897 +  if (str)
   1.898 +    {
   1.899 +      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
   1.900 +      strcpy (new_str, str);
   1.901 +    }
   1.902 +  else
   1.903 +    new_str = NULL;
   1.904 +
   1.905 +  return new_str;
   1.906 +}
   1.907 +
   1.908 +int main (int argc, char *argv[])
   1.909 +{
   1.910 +  int major, minor, micro;
   1.911 +  char *tmp_version;
   1.912 +
   1.913 +  /* This hangs on some systems (?)
   1.914 +  system ("touch conf.sdltest");
   1.915 +  */
   1.916 +  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
   1.917 +
   1.918 +  /* HP/UX 9 (%@#!) writes to sscanf strings */
   1.919 +  tmp_version = my_strdup("$min_sdl_version");
   1.920 +  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
   1.921 +     printf("%s, bad version string\n", "$min_sdl_version");
   1.922 +     exit(1);
   1.923 +   }
   1.924 +
   1.925 +   if (($sdl_major_version > major) ||
   1.926 +      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
   1.927 +      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
   1.928 +    {
   1.929 +      return 0;
   1.930 +    }
   1.931 +  else
   1.932 +    {
   1.933 +      printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
   1.934 +      printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro);
   1.935 +      printf("*** best to upgrade to the required version.\n");
   1.936 +      printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n");
   1.937 +      printf("*** to point to the correct copy of sdl2-config, and remove the file\n");
   1.938 +      printf("*** config.cache before re-running configure\n");
   1.939 +      return 1;
   1.940 +    }
   1.941 +}
   1.942 +
   1.943 +
   1.944 +_ACEOF
   1.945 +if ac_fn_c_try_run "$LINENO"; then :
   1.946 +
   1.947 +else
   1.948 +  no_sdl=yes
   1.949 +fi
   1.950 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   1.951 +  conftest.$ac_objext conftest.beam conftest.$ac_ext
   1.952 +fi
   1.953 +
   1.954 +        CFLAGS="$ac_save_CFLAGS"
   1.955 +        CXXFLAGS="$ac_save_CXXFLAGS"
   1.956 +        LIBS="$ac_save_LIBS"
   1.957 +      fi
   1.958 +    fi
   1.959 +    if test "x$no_sdl" = x ; then
   1.960 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
   1.961 +$as_echo "yes" >&6; }
   1.962 +    else
   1.963 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
   1.964 +$as_echo "no" >&6; }
   1.965 +    fi
   1.966 +  fi
   1.967 +  if test "x$no_sdl" = x ; then
   1.968 +     :
   1.969 +  else
   1.970 +     if test "$SDL2_CONFIG" = "no" ; then
   1.971 +       echo "*** The sdl2-config script installed by SDL could not be found"
   1.972 +       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
   1.973 +       echo "*** your path, or set the SDL2_CONFIG environment variable to the"
   1.974 +       echo "*** full path to sdl2-config."
   1.975 +     else
   1.976 +       if test -f conf.sdltest ; then
   1.977 +        :
   1.978 +       else
   1.979 +          echo "*** Could not run SDL test program, checking why..."
   1.980 +          CFLAGS="$CFLAGS $SDL_CFLAGS"
   1.981 +          CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
   1.982 +          LIBS="$LIBS $SDL_LIBS"
   1.983 +          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   1.984 +/* end confdefs.h.  */
   1.985 +
   1.986 +#include <stdio.h>
   1.987 +#include "SDL.h"
   1.988 +
   1.989 +int main(int argc, char *argv[])
   1.990 +{ return 0; }
   1.991 +#undef  main
   1.992 +#define main K_and_R_C_main
   1.993 +
   1.994 +int
   1.995 +main ()
   1.996 +{
   1.997 + return 0;
   1.998 +  ;
   1.999 +  return 0;
  1.1000 +}
  1.1001 +_ACEOF
  1.1002 +if ac_fn_c_try_link "$LINENO"; then :
  1.1003 +   echo "*** The test program compiled, but did not run. This usually means"
  1.1004 +          echo "*** that the run-time linker is not finding SDL or finding the wrong"
  1.1005 +          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
  1.1006 +          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
  1.1007 +          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
  1.1008 +          echo "*** is required on your system"
  1.1009 +	  echo "***"
  1.1010 +          echo "*** If you have an old version installed, it is best to remove it, although"
  1.1011 +          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
  1.1012 +else
  1.1013 +   echo "*** The test program failed to compile or link. See the file config.log for the"
  1.1014 +          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
  1.1015 +          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
  1.1016 +          echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG"
  1.1017 +fi
  1.1018 +rm -f core conftest.err conftest.$ac_objext \
  1.1019 +    conftest$ac_exeext conftest.$ac_ext
  1.1020 +          CFLAGS="$ac_save_CFLAGS"
  1.1021 +          CXXFLAGS="$ac_save_CXXFLAGS"
  1.1022 +          LIBS="$ac_save_LIBS"
  1.1023 +       fi
  1.1024 +     fi
  1.1025 +     SDL_CFLAGS=""
  1.1026 +     SDL_LIBS=""
  1.1027 +     as_fn_error "*** SDL version $SDL_VERSION not found!" "$LINENO" 5
  1.1028 +
  1.1029 +  fi
  1.1030 +
  1.1031 +
  1.1032 +  rm -f conf.sdltest
  1.1033 +
  1.1034 +CFLAGS="$CFLAGS $SDL_CFLAGS"
  1.1035 +LIBS="$LIBS $SDL_LIBS"
  1.1036  
  1.1037  
  1.1038  
     2.1 --- a/configure.in	Sun Oct 06 17:35:56 2019 +0300
     2.2 +++ b/configure.in	Mon Oct 07 10:37:37 2019 -0700
     2.3 @@ -115,17 +115,6 @@
     2.4      done
     2.5  }
     2.6  
     2.7 -dnl Check for SDL
     2.8 -SDL_VERSION=2.0.8
     2.9 -AC_SUBST(SDL_VERSION)
    2.10 -AM_PATH_SDL2($SDL_VERSION,
    2.11 -            :,
    2.12 -           AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    2.13 -)
    2.14 -CFLAGS="$CFLAGS $SDL_CFLAGS"
    2.15 -LIBS="$LIBS $SDL_LIBS"
    2.16 -saved_LIBS="$LIBS"
    2.17 -
    2.18  dnl Check command-line options
    2.19  AC_ARG_ENABLE([bmp], [AC_HELP_STRING([--enable-bmp], [support loading BMP/ICO/CUR images [default=yes]])],
    2.20   [], [enable_bmp=yes])
    2.21 @@ -380,7 +369,15 @@
    2.22      fi
    2.23  fi
    2.24  
    2.25 -LIBS="$saved_LIBS"
    2.26 +dnl Check for SDL
    2.27 +SDL_VERSION=2.0.8
    2.28 +AC_SUBST(SDL_VERSION)
    2.29 +AM_PATH_SDL2($SDL_VERSION,
    2.30 +            :,
    2.31 +           AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    2.32 +)
    2.33 +CFLAGS="$CFLAGS $SDL_CFLAGS"
    2.34 +LIBS="$LIBS $SDL_LIBS"
    2.35  
    2.36  AC_SUBST([WINDRES])
    2.37  AC_SUBST([IMG_LIBS])