1 # generated automatically by aclocal 1.13.3 -*- Autoconf -*-
3 # Copyright (C) 1996-2013 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-2013 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 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
235 [python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl
236 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
238 AC_ARG_VAR([PYTHON], [the Python interpreter])
241 dnl No version check is needed.
242 # Find any Python interpreter.
243 if test -z "$PYTHON"; then
244 AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
246 am_display_PYTHON=python
248 dnl A version check is needed.
249 if test -n "$PYTHON"; then
250 # If the user set $PYTHON, use it and don't search something else.
251 AC_MSG_CHECKING([whether $PYTHON version is >= $1])
252 AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
253 [AC_MSG_RESULT([yes])],
255 AC_MSG_ERROR([Python interpreter is too old])])
256 am_display_PYTHON=$PYTHON
258 # Otherwise, try each interpreter until we find one that satisfies
260 AC_CACHE_CHECK([for a Python interpreter with version >= $1],
261 [am_cv_pathless_PYTHON],[
262 for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
263 test "$am_cv_pathless_PYTHON" = none && break
264 AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
266 # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
267 if test "$am_cv_pathless_PYTHON" = none; then
270 AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
272 am_display_PYTHON=$am_cv_pathless_PYTHON
276 if test "$PYTHON" = :; then
277 dnl Run any user-specified action, or abort.
278 m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
281 dnl Query Python for its version number. Getting [:3] seems to be
282 dnl the best way to do this; it's what "site.py" does in the standard
285 AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
286 [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
287 AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
289 dnl Use the values of $prefix and $exec_prefix for the corresponding
290 dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
291 dnl distinct variables so they can be overridden if need be. However,
292 dnl general consensus is that you shouldn't need this ability.
294 AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
295 AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
297 dnl At times (like when building shared libraries) you may want
298 dnl to know which OS platform Python thinks this is.
300 AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
301 [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
302 AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
304 # Just factor out some code duplication.
305 am_python_setup_sysconfig="\
307 # Prefer sysconfig over distutils.sysconfig, for better compatibility
308 # with python 3.x. See automake bug#10227.
312 can_use_sysconfig = 0
314 can_use_sysconfig = 1
315 # Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs:
316 # <https://github.com/pypa/virtualenv/issues/118>
318 from platform import python_implementation
319 if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7':
320 can_use_sysconfig = 0
324 dnl Set up 4 directories:
326 dnl pythondir -- where to install python scripts. This is the
327 dnl site-packages directory, not the python standard library
328 dnl directory like in previous automake betas. This behavior
329 dnl is more consistent with lispdir.m4 for example.
330 dnl Query distutils for this directory.
331 AC_CACHE_CHECK([for $am_display_PYTHON script directory],
332 [am_cv_python_pythondir],
333 [if test "x$prefix" = xNONE
335 am_py_prefix=$ac_default_prefix
339 am_cv_python_pythondir=`$PYTHON -c "
340 $am_python_setup_sysconfig
341 if can_use_sysconfig:
342 sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
344 from distutils import sysconfig
345 sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
346 sys.stdout.write(sitedir)"`
347 case $am_cv_python_pythondir in
349 am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
350 am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
353 case $am_py_prefix in
356 am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
362 AC_SUBST([pythondir], [$am_cv_python_pythondir])
364 dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
365 dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
366 dnl more consistent with the rest of automake.
368 AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
370 dnl pyexecdir -- directory for installing python extension modules
371 dnl (shared libraries)
372 dnl Query distutils for this directory.
373 AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
374 [am_cv_python_pyexecdir],
375 [if test "x$exec_prefix" = xNONE
377 am_py_exec_prefix=$am_py_prefix
379 am_py_exec_prefix=$exec_prefix
381 am_cv_python_pyexecdir=`$PYTHON -c "
382 $am_python_setup_sysconfig
383 if can_use_sysconfig:
384 sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'})
386 from distutils import sysconfig
387 sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix')
388 sys.stdout.write(sitedir)"`
389 case $am_cv_python_pyexecdir in
391 am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
392 am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
395 case $am_py_exec_prefix in
398 am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
404 AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
406 dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
408 AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
410 dnl Run any user-specified action.
417 # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
418 # ---------------------------------------------------------------------------
419 # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
420 # Run ACTION-IF-FALSE otherwise.
421 # This test uses sys.hexversion instead of the string equivalent (first
422 # word of sys.version), in order to cope with versions such as 2.2c1.
423 # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
424 AC_DEFUN([AM_PYTHON_CHECK_VERSION],
426 # split strings by '.' and convert to numeric. Append some zeros
427 # because we need at least 4 digits for the hex conversion.
428 # map returns an iterator in Python 3.0 and a list in 2.x
429 minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
431 # xrange is not present in Python 3.0 and range returns an iterator
432 for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
433 sys.exit(sys.hexversion < minverhex)"
434 AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
436 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
438 # This file is free software; the Free Software Foundation
439 # gives unlimited permission to copy and/or distribute it,
440 # with or without modifications, as long as this notice is preserved.
442 # AM_RUN_LOG(COMMAND)
443 # -------------------
444 # Run COMMAND, save the exit status in ac_status, and log it.
445 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
446 AC_DEFUN([AM_RUN_LOG],
447 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
448 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
450 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
451 (exit $ac_status); }])
453 m4_include([acinclude.m4])