Changeset 2983 in orxonox.OLD for orxonox/branches/osX/aclocal.m4
- Timestamp:
- Nov 25, 2004, 1:39:02 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/osX/aclocal.m4
r2819 r2983 11 11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 12 12 # PARTICULAR PURPOSE. 13 14 15 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) 16 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page 17 dnl also defines GSTUFF_PKG_ERRORS on error 18 AC_DEFUN(PKG_CHECK_MODULES, [ 19 succeeded=no 20 21 if test -z "$PKG_CONFIG"; then 22 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 23 fi 24 25 if test "$PKG_CONFIG" = "no" ; then 26 echo "*** The pkg-config script could not be found. Make sure it is" 27 echo "*** in your path, or set the PKG_CONFIG environment variable" 28 echo "*** to the full path to pkg-config." 29 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." 30 else 31 PKG_CONFIG_MIN_VERSION=0.9.0 32 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then 33 AC_MSG_CHECKING(for $2) 34 35 if $PKG_CONFIG --exists "$2" ; then 36 AC_MSG_RESULT(yes) 37 succeeded=yes 38 39 AC_MSG_CHECKING($1_CFLAGS) 40 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` 41 AC_MSG_RESULT($$1_CFLAGS) 42 43 AC_MSG_CHECKING($1_LIBS) 44 $1_LIBS=`$PKG_CONFIG --libs "$2"` 45 AC_MSG_RESULT($$1_LIBS) 46 else 47 $1_CFLAGS="" 48 $1_LIBS="" 49 ## If we have a custom action on failure, don't print errors, but 50 ## do set a variable so people can do so. 51 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` 52 ifelse([$4], ,echo $$1_PKG_ERRORS,) 53 fi 54 55 AC_SUBST($1_CFLAGS) 56 AC_SUBST($1_LIBS) 57 else 58 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." 59 echo "*** See http://www.freedesktop.org/software/pkgconfig" 60 fi 61 fi 62 63 if test $succeeded = yes; then 64 ifelse([$3], , :, [$3]) 65 else 66 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]) 67 fi 68 ]) 69 70 71 72 # Configure paths for SDL 73 # Sam Lantinga 9/21/99 74 # stolen from Manish Singh 75 # stolen back from Frank Belew 76 # stolen from Manish Singh 77 # Shamelessly stolen from Owen Taylor 78 79 dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 80 dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS 81 dnl 82 AC_DEFUN([AM_PATH_SDL], 83 [dnl 84 dnl Get the cflags and libraries from the sdl-config script 85 dnl 86 AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], 87 sdl_prefix="$withval", sdl_prefix="") 88 AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], 89 sdl_exec_prefix="$withval", sdl_exec_prefix="") 90 AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], 91 , enable_sdltest=yes) 92 93 if test x$sdl_exec_prefix != x ; then 94 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" 95 if test x${SDL_CONFIG+set} != xset ; then 96 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config 97 fi 98 fi 99 if test x$sdl_prefix != x ; then 100 sdl_args="$sdl_args --prefix=$sdl_prefix" 101 if test x${SDL_CONFIG+set} != xset ; then 102 SDL_CONFIG=$sdl_prefix/bin/sdl-config 103 fi 104 fi 105 106 AC_REQUIRE([AC_CANONICAL_TARGET]) 107 PATH="$prefix/bin:$prefix/usr/bin:$PATH" 108 AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) 109 min_sdl_version=ifelse([$1], ,0.11.0,$1) 110 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) 111 no_sdl="" 112 if test "$SDL_CONFIG" = "no" ; then 113 no_sdl=yes 114 else 115 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` 116 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` 117 118 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ 119 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 120 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ 121 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 122 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ 123 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 124 if test "x$enable_sdltest" = "xyes" ; then 125 ac_save_CFLAGS="$CFLAGS" 126 ac_save_LIBS="$LIBS" 127 CFLAGS="$CFLAGS $SDL_CFLAGS" 128 LIBS="$LIBS $SDL_LIBS" 129 dnl 130 dnl Now check if the installed SDL is sufficiently new. (Also sanity 131 dnl checks the results of sdl-config to some extent 132 dnl 133 rm -f conf.sdltest 134 AC_TRY_RUN([ 135 #include <stdio.h> 136 #include <stdlib.h> 137 #include <string.h> 138 #include "SDL.h" 139 140 char* 141 my_strdup (char *str) 142 { 143 char *new_str; 144 145 if (str) 146 { 147 new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); 148 strcpy (new_str, str); 149 } 150 else 151 new_str = NULL; 152 153 return new_str; 154 } 155 156 int main (int argc, char *argv[]) 157 { 158 int major, minor, micro; 159 char *tmp_version; 160 161 /* This hangs on some systems (?) 162 system ("touch conf.sdltest"); 163 */ 164 { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } 165 166 /* HP/UX 9 (%@#!) writes to sscanf strings */ 167 tmp_version = my_strdup("$min_sdl_version"); 168 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 169 printf("%s, bad version string\n", "$min_sdl_version"); 170 exit(1); 171 } 172 173 if (($sdl_major_version > major) || 174 (($sdl_major_version == major) && ($sdl_minor_version > minor)) || 175 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) 176 { 177 return 0; 178 } 179 else 180 { 181 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); 182 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); 183 printf("*** best to upgrade to the required version.\n"); 184 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); 185 printf("*** to point to the correct copy of sdl-config, and remove the file\n"); 186 printf("*** config.cache before re-running configure\n"); 187 return 1; 188 } 189 } 190 191 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 192 CFLAGS="$ac_save_CFLAGS" 193 LIBS="$ac_save_LIBS" 194 fi 195 fi 196 if test "x$no_sdl" = x ; then 197 AC_MSG_RESULT(yes) 198 ifelse([$2], , :, [$2]) 199 else 200 AC_MSG_RESULT(no) 201 if test "$SDL_CONFIG" = "no" ; then 202 echo "*** The sdl-config script installed by SDL could not be found" 203 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" 204 echo "*** your path, or set the SDL_CONFIG environment variable to the" 205 echo "*** full path to sdl-config." 206 else 207 if test -f conf.sdltest ; then 208 : 209 else 210 echo "*** Could not run SDL test program, checking why..." 211 CFLAGS="$CFLAGS $SDL_CFLAGS" 212 LIBS="$LIBS $SDL_LIBS" 213 AC_TRY_LINK([ 214 #include <stdio.h> 215 #include "SDL.h" 216 217 int main(int argc, char *argv[]) 218 { return 0; } 219 #undef main 220 #define main K_and_R_C_main 221 ], [ return 0; ], 222 [ echo "*** The test program compiled, but did not run. This usually means" 223 echo "*** that the run-time linker is not finding SDL or finding the wrong" 224 echo "*** version of SDL. If it is not finding SDL, you'll need to set your" 225 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 226 echo "*** to the installed location Also, make sure you have run ldconfig if that" 227 echo "*** is required on your system" 228 echo "***" 229 echo "*** If you have an old version installed, it is best to remove it, although" 230 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 231 [ echo "*** The test program failed to compile or link. See the file config.log for the" 232 echo "*** exact error that occured. This usually means SDL was incorrectly installed" 233 echo "*** or that you have moved SDL since it was installed. In the latter case, you" 234 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) 235 CFLAGS="$ac_save_CFLAGS" 236 LIBS="$ac_save_LIBS" 237 fi 238 fi 239 SDL_CFLAGS="" 240 SDL_LIBS="" 241 ifelse([$3], , :, [$3]) 242 fi 243 AC_SUBST(SDL_CFLAGS) 244 AC_SUBST(SDL_LIBS) 245 rm -f conf.sdltest 246 ]) 13 247 14 248 # -*- Autoconf -*-
Note: See TracChangeset
for help on using the changeset viewer.