comparison configure @ 30136:dc1d66a20ec2

Fixup SDL configure check: - Make it work without sdl-config which adds at least useless or even hurtful cflags and also does not work for cross-compiling - If using sdl-config, make it use the CFLAGS we actually use for compiling instead of something else. Thus #undef main is needed in the test program.
author reimar
date Sun, 03 Jan 2010 11:33:33 +0000
parents cc55de3130d9
children 12a49e9ca30e
comparison
equal deleted inserted replaced
30135:807fce7a4bb3 30136:dc1d66a20ec2
5190 # VIDEO + AUDIO # 5190 # VIDEO + AUDIO #
5191 ################# 5191 #################
5192 5192
5193 5193
5194 echocheck "SDL" 5194 echocheck "SDL"
5195 _inc_tmp=""
5196 _ld_tmp=""
5197 def_sdl_sdl_h="#undef CONFIG_SDL_SDL_H"
5195 if test -z "$_sdlconfig" ; then 5198 if test -z "$_sdlconfig" ; then
5196 if ( sdl-config --version ) >>"$TMPLOG" 2>&1 ; then 5199 if ( sdl-config --version ) >>"$TMPLOG" 2>&1 ; then
5197 _sdlconfig="sdl-config" 5200 _sdlconfig="sdl-config"
5198 elif ( sdl11-config --version ) >>"$TMPLOG" 2>&1 ; then 5201 elif ( sdl11-config --version ) >>"$TMPLOG" 2>&1 ; then
5199 _sdlconfig="sdl11-config" 5202 _sdlconfig="sdl11-config"
5201 _sdlconfig=false 5204 _sdlconfig=false
5202 fi 5205 fi
5203 fi 5206 fi
5204 if test "$_sdl" = auto || test "$_sdl" = yes ; then 5207 if test "$_sdl" = auto || test "$_sdl" = yes ; then
5205 cat > $TMPC << EOF 5208 cat > $TMPC << EOF
5209 #ifdef CONFIG_SDL_SDL_H
5210 #include <SDL/SDL.h>
5211 #else
5206 #include <SDL.h> 5212 #include <SDL.h>
5213 #endif
5214 #ifndef __APPLE__
5215 // we allow SDL hacking our main() only on OSX
5216 #undef main
5217 #endif
5207 int main(int argc, char *argv[]) { 5218 int main(int argc, char *argv[]) {
5208 SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE); 5219 SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE);
5209 return 0; 5220 return 0;
5210 } 5221 }
5211 EOF 5222 EOF
5212 _sdl=no 5223 _sdl=no
5213 if "$_sdlconfig" --version >>"$TMPLOG" 2>&1 ; then 5224 for _ld_tmp in "-lSDL" "-lSDL -lpthread" "-lSDL -lwinmm -lgdi32" ; do
5214 if cc_check $($_sdlconfig --cflags) $($_sdlconfig --libs) >>"$TMPLOG" 2>&1 ; then 5225 if cc_check -DCONFIG_SDL_SDL_H $_inc_tmp $_ld_tmp ; then
5226 _sdl=yes
5227 def_sdl_sdl_h="#define CONFIG_SDL_SDL_H 1"
5228 break
5229 fi
5230 done
5231 if test "$_sdl" = no && "$_sdlconfig" --version >>"$TMPLOG" 2>&1 ; then
5232 if cygwin ; then
5233 _inc_tmp="$($_sdlconfig --cflags | cut -d " " -f 1,5,6 | sed s/no-cygwin/cygwin/)"
5234 _ld_tmp="$($_sdlconfig --libs | cut -d " " -f 1,4,6 | sed s/no-cygwin/cygwin/)"
5235 elif mingw32 ; then
5236 _inc_tmp=$($_sdlconfig --cflags | sed s/-Dmain=SDL_main//)
5237 _ld_tmp=$($_sdlconfig --libs | sed -e s/-mwindows// -e s/-lmingw32//)
5238 else
5239 _inc_tmp="$($_sdlconfig --cflags)"
5240 _ld_tmp="$($_sdlconfig --libs)"
5241 fi
5242 if cc_check $_inc_tmp $_ld_tmp >>"$TMPLOG" 2>&1 ; then
5215 _sdlversion=$($_sdlconfig --version | sed 's/[^0-9]//g') 5243 _sdlversion=$($_sdlconfig --version | sed 's/[^0-9]//g')
5216 if test "$_sdlversion" -gt 116 ; then 5244 if test "$_sdlversion" -gt 116 ; then
5217 if test "$_sdlversion" -lt 121 ; then 5245 if test "$_sdlversion" -lt 121 ; then
5218 def_sdlbuggy='#define BUGGY_SDL' 5246 def_sdlbuggy='#define BUGGY_SDL'
5219 else 5247 else
5224 fi 5252 fi
5225 fi 5253 fi
5226 fi 5254 fi
5227 if test "$_sdl" = yes ; then 5255 if test "$_sdl" = yes ; then
5228 def_sdl='#define CONFIG_SDL 1' 5256 def_sdl='#define CONFIG_SDL 1'
5229 if cygwin ; then 5257 extra_cflags="$extra_cflags $_inc_tmp"
5230 libs_mplayer="$libs_mplayer $($_sdlconfig --libs | cut -d " " -f 1,4,6 | sed s/no-cygwin/cygwin/)" 5258 libs_mplayer="$libs_mplayer $_ld_tmp"
5231 extra_cflags="$extra_cflags $($_sdlconfig --cflags | cut -d " " -f 1,5,6 | sed s/no-cygwin/cygwin/)"
5232 elif mingw32 ; then
5233 libs_mplayer="$libs_mplayer $($_sdlconfig --libs | sed -e s/-mwindows// -e s/-lmingw32//)"
5234 extra_cflags="$extra_cflags $($_sdlconfig --cflags | sed s/-Dmain=SDL_main//)"
5235 else
5236 libs_mplayer="$libs_mplayer $($_sdlconfig --libs)"
5237 extra_cflags="$extra_cflags $($_sdlconfig --cflags | sed s/-D_GNU_SOURCE=1//)"
5238 fi
5239 _vomodules="sdl $_vomodules" 5259 _vomodules="sdl $_vomodules"
5240 _aomodules="sdl $_aomodules" 5260 _aomodules="sdl $_aomodules"
5241 _res_comment="using $_sdlconfig" 5261 _res_comment="using $_sdlconfig"
5242 else 5262 else
5243 def_sdl='#undef CONFIG_SDL' 5263 def_sdl='#undef CONFIG_SDL'
8872 $def_png 8892 $def_png
8873 $def_pnm 8893 $def_pnm
8874 $def_quartz 8894 $def_quartz
8875 $def_s3fb 8895 $def_s3fb
8876 $def_sdl 8896 $def_sdl
8897 $def_sdl_sdl_h
8877 $def_sdlbuggy 8898 $def_sdlbuggy
8878 $def_svga 8899 $def_svga
8879 $def_tdfxfb 8900 $def_tdfxfb
8880 $def_tdfxvid 8901 $def_tdfxvid
8881 $def_tga 8902 $def_tga