1 # generated automatically by aclocal 1.11.3 -*- Autoconf -*-
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
6 # This file is free software; the Free Software Foundation
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
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
22 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
23 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
25 AC_DEFUN([AM_PATH_SDL],
27 dnl Get the cflags and libraries from the sdl-config script
29 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
30 sdl_prefix="$withval", sdl_prefix="")
31 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
32 sdl_exec_prefix="$withval", sdl_exec_prefix="")
33 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
36 if test x$sdl_exec_prefix != x ; then
37 sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
38 if test x${SDL_CONFIG+set} != xset ; then
39 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
42 if test x$sdl_prefix != x ; then
43 sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
44 if test x${SDL_CONFIG+set} != xset ; then
45 SDL_CONFIG=$sdl_prefix/bin/sdl-config
50 if test "x$prefix" != xNONE; then
51 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
53 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
55 min_sdl_version=ifelse([$1], ,0.11.0,$1)
56 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
58 if test "$SDL_CONFIG" = "no" ; then
61 SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
62 SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
64 sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
65 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
66 sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
67 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
68 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
69 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
70 if test "x$enable_sdltest" = "xyes" ; then
71 ac_save_CFLAGS="$CFLAGS"
72 ac_save_CXXFLAGS="$CXXFLAGS"
74 CFLAGS="$CFLAGS $SDL_CFLAGS"
75 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
76 LIBS="$LIBS $SDL_LIBS"
78 dnl Now check if the installed SDL is sufficiently new. (Also sanity
79 dnl checks the results of sdl-config to some extent
95 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
96 strcpy (new_str, str);
104 int main (int argc, char *argv[])
106 int major, minor, micro;
109 /* This hangs on some systems (?)
110 system ("touch conf.sdltest");
112 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
114 /* HP/UX 9 (%@#!) writes to sscanf strings */
115 tmp_version = my_strdup("$min_sdl_version");
116 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
117 printf("%s, bad version string\n", "$min_sdl_version");
121 if (($sdl_major_version > major) ||
122 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
123 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
129 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
130 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
131 printf("*** best to upgrade to the required version.\n");
132 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
133 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
134 printf("*** config.cache before re-running configure\n");
139 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
140 CFLAGS="$ac_save_CFLAGS"
141 CXXFLAGS="$ac_save_CXXFLAGS"
145 if test "x$no_sdl" = x ; then
147 ifelse([$2], , :, [$2])
150 if test "$SDL_CONFIG" = "no" ; then
151 echo "*** The sdl-config script installed by SDL could not be found"
152 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
153 echo "*** your path, or set the SDL_CONFIG environment variable to the"
154 echo "*** full path to sdl-config."
156 if test -f conf.sdltest ; then
159 echo "*** Could not run SDL test program, checking why..."
160 CFLAGS="$CFLAGS $SDL_CFLAGS"
161 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
162 LIBS="$LIBS $SDL_LIBS"
167 int main(int argc, char *argv[])
170 #define main K_and_R_C_main
172 [ echo "*** The test program compiled, but did not run. This usually means"
173 echo "*** that the run-time linker is not finding SDL or finding the wrong"
174 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
175 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
176 echo "*** to the installed location Also, make sure you have run ldconfig if that"
177 echo "*** is required on your system"
179 echo "*** If you have an old version installed, it is best to remove it, although"
180 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
181 [ echo "*** The test program failed to compile or link. See the file config.log for the"
182 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
183 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
184 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
185 CFLAGS="$ac_save_CFLAGS"
186 CXXFLAGS="$ac_save_CXXFLAGS"
192 ifelse([$3], , :, [$3])
199 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009,
200 # 2011 Free Software Foundation, Inc.
202 # This file is free software; the Free Software Foundation
203 # gives unlimited permission to copy and/or distribute it,
204 # 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.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 >= $1])
252 AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
253 [AC_MSG_RESULT(yes)],
254 [AC_MSG_ERROR(too old)])
255 am_display_PYTHON=$PYTHON
257 # Otherwise, try each interpreter until we find one that satisfies
259 AC_CACHE_CHECK([for a Python interpreter with version >= $1],
260 [am_cv_pathless_PYTHON],[
261 for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
262 test "$am_cv_pathless_PYTHON" = none && break
263 AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
265 # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
266 if test "$am_cv_pathless_PYTHON" = none; then
269 AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
271 am_display_PYTHON=$am_cv_pathless_PYTHON
275 if test "$PYTHON" = :; then
276 dnl Run any user-specified action, or abort.
277 m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
280 dnl Query Python for its version number. Getting [:3] seems to be
281 dnl the best way to do this; it's what "site.py" does in the standard
284 AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
285 [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
286 AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
288 dnl Use the values of $prefix and $exec_prefix for the corresponding
289 dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
290 dnl distinct variables so they can be overridden if need be. However,
291 dnl general consensus is that you shouldn't need this ability.
293 AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
294 AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
296 dnl At times (like when building shared libraries) you may want
297 dnl to know which OS platform Python thinks this is.
299 AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
300 [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
301 AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
304 dnl Set up 4 directories:
306 dnl pythondir -- where to install python scripts. This is the
307 dnl site-packages directory, not the python standard library
308 dnl directory like in previous automake betas. This behavior
309 dnl is more consistent with lispdir.m4 for example.
310 dnl Query distutils for this directory.
311 AC_CACHE_CHECK([for $am_display_PYTHON script directory],
312 [am_cv_python_pythondir],
313 [if test "x$prefix" = xNONE
315 am_py_prefix=$ac_default_prefix
319 am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null`
320 case $am_cv_python_pythondir in
322 am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
323 am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"`
326 case $am_py_prefix in
329 am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages
335 AC_SUBST([pythondir], [$am_cv_python_pythondir])
337 dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
338 dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
339 dnl more consistent with the rest of automake.
341 AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
343 dnl pyexecdir -- directory for installing python extension modules
344 dnl (shared libraries)
345 dnl Query distutils for this directory.
346 AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
347 [am_cv_python_pyexecdir],
348 [if test "x$exec_prefix" = xNONE
350 am_py_exec_prefix=$am_py_prefix
352 am_py_exec_prefix=$exec_prefix
354 am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null`
355 case $am_cv_python_pyexecdir in
357 am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
358 am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"`
361 case $am_py_exec_prefix in
364 am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages
370 AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
372 dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
374 AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
376 dnl Run any user-specified action.
383 # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
384 # ---------------------------------------------------------------------------
385 # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
386 # Run ACTION-IF-FALSE otherwise.
387 # This test uses sys.hexversion instead of the string equivalent (first
388 # word of sys.version), in order to cope with versions such as 2.2c1.
389 # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
390 AC_DEFUN([AM_PYTHON_CHECK_VERSION],
392 # split strings by '.' and convert to numeric. Append some zeros
393 # because we need at least 4 digits for the hex conversion.
394 # map returns an iterator in Python 3.0 and a list in 2.x
395 minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
397 # xrange is not present in Python 3.0 and range returns an iterator
398 for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
399 sys.exit(sys.hexversion < minverhex)"
400 AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
402 # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
404 # This file is free software; the Free Software Foundation
405 # gives unlimited permission to copy and/or distribute it,
406 # with or without modifications, as long as this notice is preserved.
410 # AM_RUN_LOG(COMMAND)
411 # -------------------
412 # Run COMMAND, save the exit status in ac_status, and log it.
413 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
414 AC_DEFUN([AM_RUN_LOG],
415 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
416 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
418 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
419 (exit $ac_status); }])
421 m4_include([acinclude.m4])