| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
AC_DEFUN([MY_EXPAND_DIR], |
|---|
| 15 |
[$1=$2 |
|---|
| 16 |
$1=`( |
|---|
| 17 |
test "x$prefix" = xNONE && prefix="$ac_default_prefix" |
|---|
| 18 |
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" |
|---|
| 19 |
eval echo \""[$]$1"\" |
|---|
| 20 |
)`] |
|---|
| 21 |
) |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
AC_DEFUN([PKG_CHECK_MODULES], [ |
|---|
| 28 |
succeeded=no |
|---|
| 29 |
|
|---|
| 30 |
if test -z "$PKG_CONFIG"; then |
|---|
| 31 |
AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
|---|
| 32 |
fi |
|---|
| 33 |
|
|---|
| 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." |
|---|
| 39 |
else |
|---|
| 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) |
|---|
| 43 |
|
|---|
| 44 |
if $PKG_CONFIG --exists "$2" ; then |
|---|
| 45 |
AC_MSG_RESULT(yes) |
|---|
| 46 |
succeeded=yes |
|---|
| 47 |
|
|---|
| 48 |
AC_MSG_CHECKING($1_CFLAGS) |
|---|
| 49 |
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"` |
|---|
| 50 |
AC_MSG_RESULT($$1_CFLAGS) |
|---|
| 51 |
|
|---|
| 52 |
AC_MSG_CHECKING($1_LIBS) |
|---|
| 53 |
$1_LIBS=`$PKG_CONFIG --libs "$2"` |
|---|
| 54 |
AC_MSG_RESULT($$1_LIBS) |
|---|
| 55 |
else |
|---|
| 56 |
AC_MSG_RESULT(no) |
|---|
| 57 |
$1_CFLAGS="" |
|---|
| 58 |
$1_LIBS="" |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` |
|---|
| 62 |
ifelse([$4], ,echo $$1_PKG_ERRORS,) |
|---|
| 63 |
fi |
|---|
| 64 |
|
|---|
| 65 |
AC_SUBST($1_CFLAGS) |
|---|
| 66 |
AC_SUBST($1_LIBS) |
|---|
| 67 |
else |
|---|
| 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" |
|---|
| 70 |
fi |
|---|
| 71 |
fi |
|---|
| 72 |
|
|---|
| 73 |
if test $succeeded = yes; then |
|---|
| 74 |
ifelse([$3], , :, [$3]) |
|---|
| 75 |
else |
|---|
| 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]) |
|---|
| 77 |
fi |
|---|
| 78 |
]) |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
AC_DEFUN([AM_PATH_SDL], |
|---|
| 92 |
[ |
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 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) |
|---|
| 101 |
|
|---|
| 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 |
|---|
| 106 |
fi |
|---|
| 107 |
fi |
|---|
| 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 |
|---|
| 112 |
fi |
|---|
| 113 |
fi |
|---|
| 114 |
|
|---|
| 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) |
|---|
| 118 |
no_sdl="" |
|---|
| 119 |
if test "$SDL_CONFIG" = "no" ; then |
|---|
| 120 |
no_sdl=yes |
|---|
| 121 |
else |
|---|
| 122 |
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` |
|---|
| 123 |
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` |
|---|
| 124 |
|
|---|
| 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" |
|---|
| 133 |
ac_save_LIBS="$LIBS" |
|---|
| 134 |
CFLAGS="$CFLAGS $SDL_CFLAGS" |
|---|
| 135 |
LIBS="$LIBS $SDL_LIBS" |
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
rm -f conf.sdltest |
|---|
| 141 |
AC_TRY_RUN([ |
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
char* |
|---|
| 148 |
my_strdup (char *str) |
|---|
| 149 |
{ |
|---|
| 150 |
char *new_str; |
|---|
| 151 |
|
|---|
| 152 |
if (str) |
|---|
| 153 |
{ |
|---|
| 154 |
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); |
|---|
| 155 |
strcpy (new_str, str); |
|---|
| 156 |
} |
|---|
| 157 |
else |
|---|
| 158 |
new_str = NULL; |
|---|
| 159 |
|
|---|
| 160 |
return new_str; |
|---|
| 161 |
} |
|---|
| 162 |
|
|---|
| 163 |
int main (int argc, char *argv[]) |
|---|
| 164 |
{ |
|---|
| 165 |
int major, minor, micro; |
|---|
| 166 |
char *tmp_version; |
|---|
| 167 |
|
|---|
| 168 |
/* This hangs on some systems (?) |
|---|
| 169 |
system ("touch conf.sdltest"); |
|---|
| 170 |
*/ |
|---|
| 171 |
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } |
|---|
| 172 |
|
|---|
| 173 |
/* HP/UX 9 (%@ |
|---|
| 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"); |
|---|
| 177 |
exit(1); |
|---|
| 178 |
} |
|---|
| 179 |
|
|---|
| 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))) |
|---|
| 183 |
{ |
|---|
| 184 |
return 0; |
|---|
| 185 |
} |
|---|
| 186 |
else |
|---|
| 187 |
{ |
|---|
| 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"); |
|---|
| 194 |
return 1; |
|---|
| 195 |
} |
|---|
| 196 |
} |
|---|
| 197 |
|
|---|
| 198 |
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
|---|
| 199 |
CFLAGS="$ac_save_CFLAGS" |
|---|
| 200 |
LIBS="$ac_save_LIBS" |
|---|
| 201 |
fi |
|---|
| 202 |
fi |
|---|
| 203 |
if test "x$no_sdl" = x ; then |
|---|
| 204 |
AC_MSG_RESULT(yes) |
|---|
| 205 |
ifelse([$2], , :, [$2]) |
|---|
| 206 |
else |
|---|
| 207 |
AC_MSG_RESULT(no) |
|---|
| 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." |
|---|
| 213 |
else |
|---|
| 214 |
if test -f conf.sdltest ; then |
|---|
| 215 |
: |
|---|
| 216 |
else |
|---|
| 217 |
echo "*** Could not run SDL test program, checking why..." |
|---|
| 218 |
CFLAGS="$CFLAGS $SDL_CFLAGS" |
|---|
| 219 |
LIBS="$LIBS $SDL_LIBS" |
|---|
| 220 |
AC_TRY_LINK([ |
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 |
], [ return 0; ], |
|---|
| 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" |
|---|
| 230 |
echo "***" |
|---|
| 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" |
|---|
| 238 |
LIBS="$ac_save_LIBS" |
|---|
| 239 |
fi |
|---|
| 240 |
fi |
|---|
| 241 |
SDL_CFLAGS="" |
|---|
| 242 |
SDL_LIBS="" |
|---|
| 243 |
ifelse([$3], , :, [$3]) |
|---|
| 244 |
fi |
|---|
| 245 |
AC_SUBST(SDL_CFLAGS) |
|---|
| 246 |
AC_SUBST(SDL_LIBS) |
|---|
| 247 |
rm -f conf.sdltest |
|---|
| 248 |
]) |
|---|
| 249 |
|
|---|