1 # generated automatically by aclocal 1.9.6 -*- Autoconf -*-
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005 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 # Configure paths for SDL
15 # Sam Lantinga 9/21/99
16 # stolen from Manish Singh
17 # stolen back from Frank Belew
18 # stolen from Manish Singh
19 # Shamelessly stolen from Owen Taylor
21 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
22 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
24 AC_DEFUN([AM_PATH_SDL],
26 dnl Get the cflags and libraries from the sdl-config script
28 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
29 sdl_prefix="$withval", sdl_prefix="")
30 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
31 sdl_exec_prefix="$withval", sdl_exec_prefix="")
32 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
35 if test x$sdl_exec_prefix != x ; then
36 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
37 if test x${SDL_CONFIG+set} != xset ; then
38 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
41 if test x$sdl_prefix != x ; then
42 sdl_args="$sdl_args --prefix=$sdl_prefix"
43 if test x${SDL_CONFIG+set} != xset ; then
44 SDL_CONFIG=$sdl_prefix/bin/sdl-config
48 if test "x$prefix" != xNONE; then
49 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
51 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
52 min_sdl_version=ifelse([$1], ,0.11.0,$1)
53 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
55 if test "$SDL_CONFIG" = "no" ; then
58 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
59 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
61 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
62 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
63 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
64 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
65 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
66 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
67 if test "x$enable_sdltest" = "xyes" ; then
68 ac_save_CFLAGS="$CFLAGS"
69 ac_save_CXXFLAGS="$CXXFLAGS"
71 CFLAGS="$CFLAGS $SDL_CFLAGS"
72 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
73 LIBS="$LIBS $SDL_LIBS"
75 dnl Now check if the installed SDL is sufficiently new. (Also sanity
76 dnl checks the results of sdl-config to some extent
92 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
93 strcpy (new_str, str);
101 int main (int argc, char *argv[])
103 int major, minor, micro;
106 /* This hangs on some systems (?)
107 system ("touch conf.sdltest");
109 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
111 /* HP/UX 9 (%@#!) writes to sscanf strings */
112 tmp_version = my_strdup("$min_sdl_version");
113 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
114 printf("%s, bad version string\n", "$min_sdl_version");
118 if (($sdl_major_version > major) ||
119 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
120 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
126 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
127 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
128 printf("*** best to upgrade to the required version.\n");
129 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
130 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
131 printf("*** config.cache before re-running configure\n");
136 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
137 CFLAGS="$ac_save_CFLAGS"
138 CXXFLAGS="$ac_save_CXXFLAGS"
142 if test "x$no_sdl" = x ; then
144 ifelse([$2], , :, [$2])
147 if test "$SDL_CONFIG" = "no" ; then
148 echo "*** The sdl-config script installed by SDL could not be found"
149 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
150 echo "*** your path, or set the SDL_CONFIG environment variable to the"
151 echo "*** full path to sdl-config."
153 if test -f conf.sdltest ; then
156 echo "*** Could not run SDL test program, checking why..."
157 CFLAGS="$CFLAGS $SDL_CFLAGS"
158 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
159 LIBS="$LIBS $SDL_LIBS"
164 int main(int argc, char *argv[])
167 #define main K_and_R_C_main
169 [ echo "*** The test program compiled, but did not run. This usually means"
170 echo "*** that the run-time linker is not finding SDL or finding the wrong"
171 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
172 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
173 echo "*** to the installed location Also, make sure you have run ldconfig if that"
174 echo "*** is required on your system"
176 echo "*** If you have an old version installed, it is best to remove it, although"
177 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
178 [ echo "*** The test program failed to compile or link. See the file config.log for the"
179 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
180 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
181 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
182 CFLAGS="$ac_save_CFLAGS"
183 CXXFLAGS="$ac_save_CXXFLAGS"
189 ifelse([$3], , :, [$3])
196 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
197 # Free Software Foundation, Inc.
199 # This file is free software; the Free Software Foundation
200 # gives unlimited permission to copy and/or distribute it,
201 # with or without modifications, as long as this notice is preserved.
203 # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
204 # ---------------------------------------------------------------------------
205 # Adds support for distributing Python modules and packages. To
206 # install modules, copy them to $(pythondir), using the python_PYTHON
207 # automake variable. To install a package with the same name as the
208 # automake package, install to $(pkgpythondir), or use the
209 # pkgpython_PYTHON automake variable.
211 # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
212 # locations to install python extension modules (shared libraries).
213 # Another macro is required to find the appropriate flags to compile
216 # If your package is configured with a different prefix to python,
217 # users will have to add the install directory to the PYTHONPATH
218 # environment variable, or create a .pth file (see the python
219 # documentation for details).
221 # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
222 # cause an error if the version of python installed on the system
223 # doesn't meet the requirement. MINIMUM-VERSION should consist of
224 # numbers and dots only.
225 AC_DEFUN([AM_PATH_PYTHON],
227 dnl Find a Python interpreter. Python versions prior to 1.5 are not
228 dnl supported because the default installation locations changed from
229 dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
231 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
232 [python python2 python2.5 python2.4 python2.3 python2.2 dnl
233 python2.1 python2.0 python1.6 python1.5])
236 dnl No version check is needed.
237 # Find any Python interpreter.
238 if test -z "$PYTHON"; then
239 AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
241 am_display_PYTHON=python
243 dnl A version check is needed.
244 if test -n "$PYTHON"; then
245 # If the user set $PYTHON, use it and don't search something else.
246 AC_MSG_CHECKING([whether $PYTHON version >= $1])
247 AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
248 [AC_MSG_RESULT(yes)],
249 [AC_MSG_ERROR(too old)])
250 am_display_PYTHON=$PYTHON
252 # Otherwise, try each interpreter until we find one that satisfies
254 AC_CACHE_CHECK([for a Python interpreter with version >= $1],
255 [am_cv_pathless_PYTHON],[
256 for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
257 test "$am_cv_pathless_PYTHON" = none && break
258 AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
260 # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
261 if test "$am_cv_pathless_PYTHON" = none; then
264 AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
266 am_display_PYTHON=$am_cv_pathless_PYTHON
270 if test "$PYTHON" = :; then
271 dnl Run any user-specified action, or abort.
272 m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
275 dnl Query Python for its version number. Getting [:3] seems to be
276 dnl the best way to do this; it's what "site.py" does in the standard
279 AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
280 [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
281 AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
283 dnl Use the values of $prefix and $exec_prefix for the corresponding
284 dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
285 dnl distinct variables so they can be overridden if need be. However,
286 dnl general consensus is that you shouldn't need this ability.
288 AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
289 AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
291 dnl At times (like when building shared libraries) you may want
292 dnl to know which OS platform Python thinks this is.
294 AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
295 [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
296 AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
299 dnl Set up 4 directories:
301 dnl pythondir -- where to install python scripts. This is the
302 dnl site-packages directory, not the python standard library
303 dnl directory like in previous automake betas. This behavior
304 dnl is more consistent with lispdir.m4 for example.
305 dnl Query distutils for this directory. distutils does not exist in
306 dnl Python 1.5, so we fall back to the hardcoded directory if it
308 AC_CACHE_CHECK([for $am_display_PYTHON script directory],
309 [am_cv_python_pythondir],
310 [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
311 echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
312 AC_SUBST([pythondir], [$am_cv_python_pythondir])
314 dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
315 dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
316 dnl more consistent with the rest of automake.
318 AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
320 dnl pyexecdir -- directory for installing python extension modules
321 dnl (shared libraries)
322 dnl Query distutils for this directory. distutils does not exist in
323 dnl Python 1.5, so we fall back to the hardcoded directory if it
325 AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
326 [am_cv_python_pyexecdir],
327 [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
328 echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
329 AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
331 dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
333 AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
335 dnl Run any user-specified action.
342 # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
343 # ---------------------------------------------------------------------------
344 # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
345 # Run ACTION-IF-FALSE otherwise.
346 # This test uses sys.hexversion instead of the string equivalent (first
347 # word of sys.version), in order to cope with versions such as 2.2c1.
348 # hexversion has been introduced in Python 1.5.2; it's probably not
349 # worth to support older versions (1.5.1 was released on October 31, 1998).
350 AC_DEFUN([AM_PYTHON_CHECK_VERSION],
351 [prog="import sys, string
352 # split strings by '.' and convert to numeric. Append some zeros
353 # because we need at least 4 digits for the hex conversion.
354 minver = map(int, string.split('$2', '.')) + [[0, 0, 0]]
356 for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
357 sys.exit(sys.hexversion < minverhex)"
358 AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
360 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
362 # This file is free software; the Free Software Foundation
363 # gives unlimited permission to copy and/or distribute it,
364 # with or without modifications, as long as this notice is preserved.
366 # AM_RUN_LOG(COMMAND)
367 # -------------------
368 # Run COMMAND, save the exit status in ac_status, and log it.
369 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
370 AC_DEFUN([AM_RUN_LOG],
371 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
372 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
374 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
375 (exit $ac_status); }])
377 m4_include([acinclude.m4])