1 # generated automatically by aclocal 1.15.1 -*- Autoconf -*-
3 # Copyright (C) 1996-2017 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
15 # Configure paths for SDL
16 # Sam Lantinga 9/21/99
17 # stolen from Manish Singh
18 # stolen back from Frank Belew
19 # stolen from Manish Singh
20 # Shamelessly stolen from Owen Taylor
24 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
25 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
27 AC_DEFUN([AM_PATH_SDL],
29 dnl Get the cflags and libraries from the sdl-config script
31 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
32 sdl_prefix="$withval", sdl_prefix="")
33 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
34 sdl_exec_prefix="$withval", sdl_exec_prefix="")
35 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
38 if test x$sdl_exec_prefix != x ; then
39 sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
40 if test x${SDL_CONFIG+set} != xset ; then
41 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
44 if test x$sdl_prefix != x ; then
45 sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
46 if test x${SDL_CONFIG+set} != xset ; then
47 SDL_CONFIG=$sdl_prefix/bin/sdl-config
52 if test "x$prefix" != xNONE; then
53 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
55 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
57 min_sdl_version=ifelse([$1], ,0.11.0,$1)
58 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
60 if test "$SDL_CONFIG" = "no" ; then
63 SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
64 SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
66 sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
67 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
68 sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
69 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
70 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
71 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
72 if test "x$enable_sdltest" = "xyes" ; then
73 ac_save_CFLAGS="$CFLAGS"
74 ac_save_CXXFLAGS="$CXXFLAGS"
76 CFLAGS="$CFLAGS $SDL_CFLAGS"
77 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
78 LIBS="$LIBS $SDL_LIBS"
80 dnl Now check if the installed SDL is sufficiently new. (Also sanity
81 dnl checks the results of sdl-config to some extent
97 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
98 strcpy (new_str, str);
106 int main (int argc, char *argv[])
108 int major, minor, micro;
111 /* This hangs on some systems (?)
112 system ("touch conf.sdltest");
114 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
116 /* HP/UX 9 (%@#!) writes to sscanf strings */
117 tmp_version = my_strdup("$min_sdl_version");
118 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
119 printf("%s, bad version string\n", "$min_sdl_version");
123 if (($sdl_major_version > major) ||
124 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
125 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
131 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
132 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
133 printf("*** best to upgrade to the required version.\n");
134 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
135 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
136 printf("*** config.cache before re-running configure\n");
141 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
142 CFLAGS="$ac_save_CFLAGS"
143 CXXFLAGS="$ac_save_CXXFLAGS"
147 if test "x$no_sdl" = x ; then
149 ifelse([$2], , :, [$2])
152 if test "$SDL_CONFIG" = "no" ; then
153 echo "*** The sdl-config script installed by SDL could not be found"
154 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
155 echo "*** your path, or set the SDL_CONFIG environment variable to the"
156 echo "*** full path to sdl-config."
158 if test -f conf.sdltest ; then
161 echo "*** Could not run SDL test program, checking why..."
162 CFLAGS="$CFLAGS $SDL_CFLAGS"
163 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
164 LIBS="$LIBS $SDL_LIBS"
169 int main(int argc, char *argv[])
172 #define main K_and_R_C_main
174 [ echo "*** The test program compiled, but did not run. This usually means"
175 echo "*** that the run-time linker is not finding SDL or finding the wrong"
176 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
177 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
178 echo "*** to the installed location Also, make sure you have run ldconfig if that"
179 echo "*** is required on your system"
181 echo "*** If you have an old version installed, it is best to remove it, although"
182 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
183 [ echo "*** The test program failed to compile or link. See the file config.log for the"
184 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
185 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
186 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
187 CFLAGS="$ac_save_CFLAGS"
188 CXXFLAGS="$ac_save_CXXFLAGS"
194 ifelse([$3], , :, [$3])
201 # Copyright (C) 1999-2017 Free Software Foundation, Inc.
203 # This file is free software; the Free Software Foundation
204 # gives unlimited permission to copy and/or distribute it,
205 # with or without modifications, as long as this notice is preserved.
208 # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
209 # ---------------------------------------------------------------------------
210 # Adds support for distributing Python modules and packages. To
211 # install modules, copy them to $(pythondir), using the python_PYTHON
212 # automake variable. To install a package with the same name as the
213 # automake package, install to $(pkgpythondir), or use the
214 # pkgpython_PYTHON automake variable.
216 # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
217 # locations to install python extension modules (shared libraries).
218 # Another macro is required to find the appropriate flags to compile
221 # If your package is configured with a different prefix to python,
222 # users will have to add the install directory to the PYTHONPATH
223 # environment variable, or create a .pth file (see the python
224 # documentation for details).
226 # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
227 # cause an error if the version of python installed on the system
228 # doesn't meet the requirement. MINIMUM-VERSION should consist of
229 # numbers and dots only.
230 AC_DEFUN([AM_PATH_PYTHON],
232 dnl Find a Python interpreter. Python versions prior to 2.0 are not
233 dnl supported. (2.0 was released on October 16, 2000).
234 dnl FIXME: Remove the need to hard-code Python versions here.
235 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
236 [python python2 python3 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 dnl
237 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
239 AC_ARG_VAR([PYTHON], [the Python interpreter])
242 dnl No version check is needed.
243 # Find any Python interpreter.
244 if test -z "$PYTHON"; then
245 AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
247 am_display_PYTHON=python
249 dnl A version check is needed.
250 if test -n "$PYTHON"; then
251 # If the user set $PYTHON, use it and don't search something else.
252 AC_MSG_CHECKING([whether $PYTHON version is >= $1])
253 AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
254 [AC_MSG_RESULT([yes])],
256 AC_MSG_ERROR([Python interpreter is too old])])
257 am_display_PYTHON=$PYTHON
259 # Otherwise, try each interpreter until we find one that satisfies
261 AC_CACHE_CHECK([for a Python interpreter with version >= $1],
262 [am_cv_pathless_PYTHON],[
263 for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
264 test "$am_cv_pathless_PYTHON" = none && break
265 AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
267 # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
268 if test "$am_cv_pathless_PYTHON" = none; then
271 AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
273 am_display_PYTHON=$am_cv_pathless_PYTHON
277 if test "$PYTHON" = :; then
278 dnl Run any user-specified action, or abort.
279 m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
282 dnl Query Python for its version number. Getting [:3] seems to be
283 dnl the best way to do this; it's what "site.py" does in the standard
286 AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
287 [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
288 AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
290 dnl Use the values of $prefix and $exec_prefix for the corresponding
291 dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
292 dnl distinct variables so they can be overridden if need be. However,
293 dnl general consensus is that you shouldn't need this ability.
295 AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
296 AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
298 dnl At times (like when building shared libraries) you may want
299 dnl to know which OS platform Python thinks this is.
301 AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
302 [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
303 AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
305 # Just factor out some code duplication.
306 am_python_setup_sysconfig="\
308 # Prefer sysconfig over distutils.sysconfig, for better compatibility
309 # with python 3.x. See automake bug#10227.
313 can_use_sysconfig = 0
315 can_use_sysconfig = 1
316 # Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
317 # <https://github.com/pypa/virtualenv/issues/118>
319 from platform import python_implementation
320 if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
321 can_use_sysconfig = 0
325 dnl Set up 4 directories:
327 dnl pythondir -- where to install python scripts. This is the
328 dnl site-packages directory, not the python standard library
329 dnl directory like in previous automake betas. This behavior
330 dnl is more consistent with lispdir.m4 for example.
331 dnl Query distutils for this directory.
332 AC_CACHE_CHECK([for $am_display_PYTHON script directory],
333 [am_cv_python_pythondir],
334 [if test "x$prefix" = xNONE
336 am_py_prefix=$ac_default_prefix
340 am_cv_python_pythondir=`$PYTHON -c "
341 $am_python_setup_sysconfig
342 if can_use_sysconfig:
343 sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
345 from distutils import sysconfig
346 sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
347 sys.stdout.write(sitedir)"`
348 case $am_cv_python_pythondir in
350 am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
351 am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
354 case $am_py_prefix in
357 am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
363 AC_SUBST([pythondir], [$am_cv_python_pythondir])
365 dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
366 dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
367 dnl more consistent with the rest of automake.
369 AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
371 dnl pyexecdir -- directory for installing python extension modules
372 dnl (shared libraries)
373 dnl Query distutils for this directory.
374 AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
375 [am_cv_python_pyexecdir],
376 [if test "x$exec_prefix" = xNONE
378 am_py_exec_prefix=$am_py_prefix
380 am_py_exec_prefix=$exec_prefix
382 am_cv_python_pyexecdir=`$PYTHON -c "
383 $am_python_setup_sysconfig
384 if can_use_sysconfig:
385 sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
387 from distutils import sysconfig
388 sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
389 sys.stdout.write(sitedir)"`
390 case $am_cv_python_pyexecdir in
392 am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
393 am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
396 case $am_py_exec_prefix in
399 am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
405 AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
407 dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
409 AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
411 dnl Run any user-specified action.
418 # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
419 # ---------------------------------------------------------------------------
420 # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
421 # Run ACTION-IF-FALSE otherwise.
422 # This test uses sys.hexversion instead of the string equivalent (first
423 # word of sys.version), in order to cope with versions such as 2.2c1.
424 # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
425 AC_DEFUN([AM_PYTHON_CHECK_VERSION],
427 # split strings by '.' and convert to numeric. Append some zeros
428 # because we need at least 4 digits for the hex conversion.
429 # map returns an iterator in Python 3.0 and a list in 2.x
430 minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
432 # xrange is not present in Python 3.0 and range returns an iterator
433 for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
434 sys.exit(sys.hexversion < minverhex)"
435 AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
437 # Copyright (C) 2001-2017 Free Software Foundation, Inc.
439 # This file is free software; the Free Software Foundation
440 # gives unlimited permission to copy and/or distribute it,
441 # with or without modifications, as long as this notice is preserved.
443 # AM_RUN_LOG(COMMAND)
444 # -------------------
445 # Run COMMAND, save the exit status in ac_status, and log it.
446 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
447 AC_DEFUN([AM_RUN_LOG],
448 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
449 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
451 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
452 (exit $ac_status); }])
454 m4_include([acinclude.m4])