1 # generated automatically by aclocal 1.10 -*- Autoconf -*-
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005, 2006 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 AC_DEFUN([MY_EXPAND_DIR],
17 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
18 test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
24 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
25 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
26 dnl also defines GSTUFF_PKG_ERRORS on error
27 AC_DEFUN([PKG_CHECK_MODULES], [
30 if test -z "$PKG_CONFIG"; then
31 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
34 if test "$PKG_CONFIG" = "no" ; then
35 echo "*** The pkg-config script could not be found. Make sure it is"
36 echo "*** in your path, or set the PKG_CONFIG environment variable"
37 echo "*** to the full path to pkg-config."
38 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
40 PKG_CONFIG_MIN_VERSION=0.9.0
41 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
42 AC_MSG_CHECKING(for $2)
44 if $PKG_CONFIG --exists "$2" ; then
48 AC_MSG_CHECKING($1_CFLAGS)
49 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
50 AC_MSG_RESULT($$1_CFLAGS)
52 AC_MSG_CHECKING($1_LIBS)
53 $1_LIBS=`$PKG_CONFIG --libs "$2"`
54 AC_MSG_RESULT($$1_LIBS)
59 ## If we have a custom action on failure, don't print errors, but
60 ## do set a variable so people can do so.
61 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
62 ifelse([$4], ,echo $$1_PKG_ERRORS,)
68 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
69 echo "*** See http://www.freedesktop.org/software/pkgconfig"
73 if test $succeeded = yes; then
74 ifelse([$3], , :, [$3])
76 ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
81 # Configure paths for SDL
82 # Sam Lantinga 9/21/99
83 # stolen from Manish Singh
84 # stolen back from Frank Belew
85 # stolen from Manish Singh
86 # Shamelessly stolen from Owen Taylor
88 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
89 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
91 AC_DEFUN([AM_PATH_SDL],
93 dnl Get the cflags and libraries from the sdl-config script
95 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
96 sdl_prefix="$withval", sdl_prefix="")
97 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
98 sdl_exec_prefix="$withval", sdl_exec_prefix="")
99 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
100 , enable_sdltest=yes)
102 if test x$sdl_exec_prefix != x ; then
103 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
104 if test x${SDL_CONFIG+set} != xset ; then
105 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
108 if test x$sdl_prefix != x ; then
109 sdl_args="$sdl_args --prefix=$sdl_prefix"
110 if test x${SDL_CONFIG+set} != xset ; then
111 SDL_CONFIG=$sdl_prefix/bin/sdl-config
115 AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
116 min_sdl_version=ifelse([$1], ,0.11.0,$1)
117 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
119 if test "$SDL_CONFIG" = "no" ; then
122 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
123 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
125 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
126 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
127 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
128 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
129 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
130 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
131 if test "x$enable_sdltest" = "xyes" ; then
132 ac_save_CFLAGS="$CFLAGS"
134 CFLAGS="$CFLAGS $SDL_CFLAGS"
135 LIBS="$LIBS $SDL_LIBS"
137 dnl Now check if the installed SDL is sufficiently new. (Also sanity
138 dnl checks the results of sdl-config to some extent
148 my_strdup (char *str)
154 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
155 strcpy (new_str, str);
163 int main (int argc, char *argv[])
165 int major, minor, micro;
168 /* This hangs on some systems (?)
169 system ("touch conf.sdltest");
171 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
173 /* HP/UX 9 (%@#!) writes to sscanf strings */
174 tmp_version = my_strdup("$min_sdl_version");
175 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
176 printf("%s, bad version string\n", "$min_sdl_version");
180 if (($sdl_major_version > major) ||
181 (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
182 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
188 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
189 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
190 printf("*** best to upgrade to the required version.\n");
191 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
192 printf("*** to point to the correct copy of sdl-config, and remove the file\n");
193 printf("*** config.cache before re-running configure\n");
198 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
199 CFLAGS="$ac_save_CFLAGS"
203 if test "x$no_sdl" = x ; then
205 ifelse([$2], , :, [$2])
208 if test "$SDL_CONFIG" = "no" ; then
209 echo "*** The sdl-config script installed by SDL could not be found"
210 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
211 echo "*** your path, or set the SDL_CONFIG environment variable to the"
212 echo "*** full path to sdl-config."
214 if test -f conf.sdltest ; then
217 echo "*** Could not run SDL test program, checking why..."
218 CFLAGS="$CFLAGS $SDL_CFLAGS"
219 LIBS="$LIBS $SDL_LIBS"
224 [ echo "*** The test program compiled, but did not run. This usually means"
225 echo "*** that the run-time linker is not finding SDL or finding the wrong"
226 echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
227 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
228 echo "*** to the installed location Also, make sure you have run ldconfig if that"
229 echo "*** is required on your system"
231 echo "*** If you have an old version installed, it is best to remove it, although"
232 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
233 [ echo "*** The test program failed to compile or link. See the file config.log for the"
234 echo "*** exact error that occured. This usually means SDL was incorrectly installed"
235 echo "*** or that you have moved SDL since it was installed. In the latter case, you"
236 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
237 CFLAGS="$ac_save_CFLAGS"
243 ifelse([$3], , :, [$3])