Made it possible to build SDL from a fresh checkout without any additional steps.
The trick is that if you're using configure and you don't want to have SDL_config.h and SDL_revision.h to show up as modified, you need to configure and build from a separate directory. You also need to include SDL_revision.h directly if you want to use the SDL_REVISION constant, as a side effect of these changes. --HG-- rename : include/SDL_config.h.default => include/SDL_config.h
This commit is contained in:
parent
20ae4187a4
commit
e0bf2dc643
19 changed files with 45463 additions and 138 deletions
12
.hgignore
12
.hgignore
|
@ -1,19 +1,13 @@
|
|||
syntax:glob
|
||||
aclocal.m4
|
||||
autom4te*
|
||||
config.cache
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
libtool
|
||||
Makefile
|
||||
sdl-config
|
||||
SDL.spec
|
||||
SDL.qpg
|
||||
build
|
||||
build-deps
|
||||
VisualC
|
||||
VisualCE
|
||||
# for Xcode
|
||||
*.orig
|
||||
*.swp
|
||||
|
@ -29,18 +23,12 @@ VisualCE
|
|||
(^|/)build($|/)
|
||||
.DS_Store
|
||||
sdl.pc
|
||||
include/SDL_config.h
|
||||
include/SDL_revision.h
|
||||
test/aclocal.m4
|
||||
test/autom4te*
|
||||
test/config.cache
|
||||
test/config.log
|
||||
test/config.status
|
||||
test/configure
|
||||
test/Makefile
|
||||
test/SDL.dll
|
||||
test/stdout.txt
|
||||
test/stderr.txt
|
||||
test/checkkeys
|
||||
test/graywin
|
||||
test/loopwave
|
||||
|
|
|
@ -122,7 +122,7 @@ all: $(TARGET) install nds_test
|
|||
src/atomic/SDL_spinlock.o: src/atomic/SDL_spinlock.c
|
||||
$(CC) $(CFLAGS) -mno-thumb -o $@ -c $^
|
||||
|
||||
$(TARGET): copy_config $(OBJS)
|
||||
$(TARGET): $(OBJS)
|
||||
$(AR) rc $(TARGET) $(OBJS)
|
||||
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
|
||||
|
||||
|
@ -136,9 +136,5 @@ nds_test:
|
|||
# $(MAKE) -C test/nds-test-progs/sprite
|
||||
# $(MAKE) -C test/nds-test-progs/sprite2
|
||||
|
||||
copy_config:
|
||||
@cp include/SDL_config.h.default include/SDL_config.h
|
||||
|
||||
clean:
|
||||
rm -f include/SDL_config.h $(OBJS)
|
||||
|
||||
rm -f $(OBJS)
|
||||
|
|
15
Makefile.in
15
Makefile.in
|
@ -72,7 +72,6 @@ HDRS = \
|
|||
SDL_quit.h \
|
||||
SDL_rect.h \
|
||||
SDL_render.h \
|
||||
SDL_revision.h \
|
||||
SDL_rwops.h \
|
||||
SDL_scancode.h \
|
||||
SDL_shape.h \
|
||||
|
@ -134,6 +133,7 @@ install-hdrs:
|
|||
$(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \
|
||||
done
|
||||
$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h
|
||||
$(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL/SDL_revision.h
|
||||
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
|
||||
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
|
||||
|
@ -153,6 +153,7 @@ uninstall-hdrs:
|
|||
rm -f $(DESTDIR)$(includedir)/SDL/$$file; \
|
||||
done
|
||||
rm -f $(DESTDIR)$(includedir)/SDL/SDL_config.h
|
||||
rm -f $(DESTDIR)$(includedir)/SDL/SDL_revision.h
|
||||
-rmdir $(DESTDIR)$(includedir)/SDL
|
||||
uninstall-lib:
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
|
||||
|
@ -166,7 +167,7 @@ clean:
|
|||
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile include/SDL_config.h sdl-config
|
||||
rm -f Makefile include/SDL_config.h include/SDL_revision.h sdl-config
|
||||
rm -f SDL.qpg
|
||||
rm -f config.status config.cache config.log libtool
|
||||
rm -rf $(srcdir)/autom4te*
|
||||
|
@ -178,15 +179,11 @@ distclean: clean
|
|||
-name '*.orig' -o \
|
||||
-name '.#*' \) \
|
||||
-exec rm -f {} \;
|
||||
cp $(srcdir)/include/SDL_config.h.default $(srcdir)/include/SDL_config.h
|
||||
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
|
||||
|
||||
dist $(distfile):
|
||||
$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
|
||||
tar cf - $(DIST) | (cd $(distdir); tar xf -)
|
||||
cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h
|
||||
$(SHELL) $(distdir)/build-scripts/updaterev.sh
|
||||
rm -rf `find $(distdir) -name .svn`
|
||||
find $(distdir) \( \
|
||||
-name '*~' -o \
|
||||
-name '*.bak' -o \
|
||||
|
@ -223,8 +220,4 @@ indent:
|
|||
|
||||
# Run indent and then commit modified files
|
||||
commit: indent
|
||||
svn commit
|
||||
|
||||
# Create a SVN snapshot that people can run update on
|
||||
snapshot:
|
||||
$(SHELL) $(auxdir)/snapshot.sh
|
||||
hg commit
|
||||
|
|
|
@ -5,41 +5,37 @@ CFLAGS = -g -O2 $(INCLUDE)
|
|||
AR = ar
|
||||
RANLIB = ranlib
|
||||
|
||||
CONFIG_H = include/SDL_config.h
|
||||
TARGET = libSDL.a
|
||||
SOURCES = \
|
||||
src/*.c \
|
||||
src/audio/*.c \
|
||||
src/cdrom/*.c \
|
||||
src/audio/dummy/*.c \
|
||||
src/cpuinfo/*.c \
|
||||
src/events/*.c \
|
||||
src/file/*.c \
|
||||
src/joystick/*.c \
|
||||
src/haptic/*.c \
|
||||
src/haptic/dummy/*.c \
|
||||
src/joystick/*.c \
|
||||
src/joystick/dummy/*.c \
|
||||
src/loadso/dummy/*.c \
|
||||
src/power/*.c \
|
||||
src/render/*.c \
|
||||
src/render/software/*.c \
|
||||
src/stdlib/*.c \
|
||||
src/thread/*.c \
|
||||
src/timer/*.c \
|
||||
src/video/*.c \
|
||||
src/power/*.c \
|
||||
src/audio/dummy/*.c \
|
||||
src/video/dummy/*.c \
|
||||
src/joystick/dummy/*.c \
|
||||
src/haptic/dummy/*.c \
|
||||
src/cdrom/dummy/*.c \
|
||||
src/thread/generic/*.c \
|
||||
src/timer/*.c \
|
||||
src/timer/dummy/*.c \
|
||||
src/loadso/dummy/*.c \
|
||||
src/video/*.c \
|
||||
src/video/dummy/*.c \
|
||||
|
||||
OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(CONFIG_H) $(OBJECTS)
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(AR) crv $@ $^
|
||||
$(RANLIB) $@
|
||||
|
||||
$(CONFIG_H):
|
||||
cp $(CONFIG_H).default $(CONFIG_H)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) $(OBJECTS)
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Making sure basic SDL headers are in place..."
|
||||
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...
xcopy /d /q /y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
"
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
|
@ -200,8 +199,7 @@
|
|||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Making sure basic SDL headers are in place..."
|
||||
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...
xcopy /d /q /y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
"
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
|
|
|
@ -72,17 +72,7 @@
|
|||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Message>Making sure basic SDL headers are in place...</Message>
|
||||
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
|
||||
xcopy /d /q /y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"
|
||||
|
||||
if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
|
||||
echo Creating stub SDL_revision.h file...
|
||||
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
|
||||
:SDLREVISIONOKAY
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent />
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
|
@ -150,17 +140,7 @@ echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_r
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Message>Making sure basic SDL headers are in place...</Message>
|
||||
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
|
||||
xcopy /d /q /y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"
|
||||
|
||||
if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
|
||||
echo Creating stub SDL_revision.h file...
|
||||
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
|
||||
:SDLREVISIONOKAY
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent />
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
|
@ -466,4 +446,4 @@ echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_r
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -29,8 +29,7 @@
|
|||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Making sure basic SDL headers are in place..."
|
||||
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
"
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
|
@ -164,8 +163,7 @@
|
|||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Making sure basic SDL headers are in place..."
|
||||
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
"
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
|
@ -299,8 +297,7 @@
|
|||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Making sure basic SDL headers are in place..."
|
||||
CommandLine="echo Copying SDL_config_windows.h to SDL_config.h...
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
"
|
||||
CommandLine=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
|
|
|
@ -99,16 +99,7 @@
|
|||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Message>Making sure basic SDL headers are in place...</Message>
|
||||
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
|
||||
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"
|
||||
|
||||
if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
|
||||
echo Creating stub SDL_revision.h file...
|
||||
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
|
||||
:SDLREVISIONOKAY</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent />
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -150,16 +141,7 @@ echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_r
|
|||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NoSTDIO|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Message>Making sure basic SDL headers are in place...</Message>
|
||||
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
|
||||
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"
|
||||
|
||||
if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
|
||||
echo Creating stub SDL_revision.h file...
|
||||
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
|
||||
:SDLREVISIONOKAY</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent />
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -201,16 +183,7 @@ echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_r
|
|||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Message>Making sure basic SDL headers are in place...</Message>
|
||||
<Command>echo Copying SDL_config_windows.h to SDL_config.h...
|
||||
copy /Y "$(ProjectDir)\..\..\include\SDL_config_windows.h" "$(ProjectDir)\..\..\include\SDL_config.h"
|
||||
|
||||
if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
|
||||
echo Creating stub SDL_revision.h file...
|
||||
echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_revision.h"
|
||||
:SDLREVISIONOKAY</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent />
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\include\SDL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -255,4 +228,4 @@ echo #define SDL_REVISION "hg-0:baadf00d" >"$(ProjectDir)\..\..\include\SDL_r
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
9486
aclocal.m4
vendored
Normal file
9486
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,27 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Generate a current snapshot from source control
|
||||
|
||||
echo "Checking out source"
|
||||
hg clone http://hg.libsdl.org/SDL || exit $?
|
||||
(cd SDL && ./autogen.sh && rm -rf autom4te.cache)
|
||||
sh SDL/build-scripts/updaterev.sh
|
||||
cp SDL/include/SDL_config.h.default SDL/include/SDL_config.h
|
||||
|
||||
major=`fgrep "#define SDL_MAJOR_VERSION" SDL/include/SDL_version.h | \
|
||||
sed 's,[^0-9]*\([0-9]*\),\1,'`
|
||||
minor=`fgrep "#define SDL_MINOR_VERSION" SDL/include/SDL_version.h | \
|
||||
sed 's,[^0-9]*\([0-9]*\),\1,'`
|
||||
patch=`fgrep "#define SDL_PATCHLEVEL" SDL/include/SDL_version.h | \
|
||||
sed 's,[^0-9]*\([0-9]*\),\1,'`
|
||||
rev=`fgrep "#define SDL_REVISION" SDL/include/SDL_revision.h | \
|
||||
sed 's,[^0-9]*\([0-9]*\):.*,\1,'`
|
||||
path="SDL-$major.$minor.$patch-$rev"
|
||||
|
||||
mv SDL $path
|
||||
echo $path.tar.gz
|
||||
tar zcf $path.tar.gz $path
|
||||
echo $path.zip
|
||||
rm -f $path.zip
|
||||
zip -rq $path.zip $path
|
||||
rm -rf $path
|
|
@ -2,9 +2,10 @@
|
|||
#
|
||||
# Generate a header file with the current source revision
|
||||
|
||||
outdir=`pwd`
|
||||
cd `dirname $0`
|
||||
srcdir=..
|
||||
header=$srcdir/include/SDL_revision.h
|
||||
header=$outdir/include/SDL_revision.h
|
||||
|
||||
rev=`sh showrev.sh`
|
||||
if [ "$rev" != "" -a "$rev" != "hg-0:baadf00d" ]; then
|
||||
|
|
1
include/SDL_revision.h
Normal file
1
include/SDL_revision.h
Normal file
|
@ -0,0 +1 @@
|
|||
#define SDL_REVISION "hg-0:aaaaaaaaaaah"
|
|
@ -30,7 +30,6 @@
|
|||
#define _SDL_version_h
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
#include "SDL_revision.h"
|
||||
|
||||
#include "begin_code.h"
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
/* Initialization code for SDL */
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_revision.h"
|
||||
#include "SDL_fatal.h"
|
||||
#include "SDL_assert_c.h"
|
||||
#include "haptic/SDL_haptic_c.h"
|
||||
|
|
181
test/aclocal.m4
vendored
Normal file
181
test/aclocal.m4
vendored
Normal file
|
@ -0,0 +1,181 @@
|
|||
# Configure paths for SDL
|
||||
# Sam Lantinga 9/21/99
|
||||
# stolen from Manish Singh
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_SDL],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
sdl_prefix="$withval", sdl_prefix="")
|
||||
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
|
||||
sdl_exec_prefix="$withval", sdl_exec_prefix="")
|
||||
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
|
||||
, enable_sdltest=yes)
|
||||
|
||||
if test x$sdl_exec_prefix != x ; then
|
||||
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
if test x$sdl_prefix != x ; then
|
||||
sdl_args="$sdl_args --prefix=$sdl_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$prefix" != xNONE; then
|
||||
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
|
||||
fi
|
||||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
|
||||
min_sdl_version=ifelse([$1], ,0.11.0,$1)
|
||||
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
|
||||
no_sdl=""
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
no_sdl=yes
|
||||
else
|
||||
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
|
||||
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
|
||||
|
||||
sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_sdltest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed SDL is sufficiently new. (Also sanity
|
||||
dnl checks the results of sdl-config to some extent
|
||||
dnl
|
||||
rm -f conf.sdltest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
/* This hangs on some systems (?)
|
||||
system ("touch conf.sdltest");
|
||||
*/
|
||||
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_sdl_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_sdl_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($sdl_major_version > major) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
|
||||
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
|
||||
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
echo "*** The sdl-config script installed by SDL could not be found"
|
||||
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the SDL_CONFIG environment variable to the"
|
||||
echo "*** full path to sdl-config."
|
||||
else
|
||||
if test -f conf.sdltest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run SDL test program, checking why..."
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{ return 0; }
|
||||
#undef main
|
||||
#define main K_and_R_C_main
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding SDL or finding the wrong"
|
||||
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
SDL_CFLAGS=""
|
||||
SDL_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
AC_SUBST(SDL_LIBS)
|
||||
rm -f conf.sdltest
|
||||
])
|
4908
test/configure
vendored
Executable file
4908
test/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
|
@ -7,6 +7,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_revision.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue