summaryrefslogtreecommitdiff
path: root/config.lib
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-11-25 19:32:12 +0000
committerrubidium <rubidium@openttd.org>2008-11-25 19:32:12 +0000
commit285d1846aebfc5bf3b874ff5d431a568e6a49da2 (patch)
tree014c824da9cb4b28b6633d99bfacc1b94526ddc2 /config.lib
parent6a431fc0893e5432a88ed25ed4998aa3652fe092 (diff)
downloadopenttd-285d1846aebfc5bf3b874ff5d431a568e6a49da2.tar.xz
(svn r14630) -Add: support Allegro as video backend.
Diffstat (limited to 'config.lib')
-rw-r--r--config.lib89
1 files changed, 88 insertions, 1 deletions
diff --git a/config.lib b/config.lib
index 14af7a3f0..a2352b226 100644
--- a/config.lib
+++ b/config.lib
@@ -56,6 +56,7 @@ set_default() {
with_osx_sysroot="1"
with_application_bundle="1"
with_menu_entry="1"
+ with_allegro="1"
with_sdl="1"
with_cocoa="1"
with_zlib="1"
@@ -121,6 +122,7 @@ set_default() {
enable_cocoa_quickdraw
with_osx_sysroot
with_application_bundle
+ with_allegro
with_sdl
with_cocoa
with_zlib
@@ -285,6 +287,10 @@ detect_params() {
--enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";;
--enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";;
+ --with-allegro) with_allegro="2";;
+ --without-allegro) with_allegro="0";;
+ --with-allegro=*) with_allegro="$optarg";;
+
--with-sdl) with_sdl="2";;
--without-sdl) with_sdl="0";;
--with-sdl=*) with_sdl="$optarg";;
@@ -559,6 +565,7 @@ check_params() {
sleep 5
fi
+ detect_allegro
detect_sdl
detect_cocoa
@@ -577,7 +584,7 @@ check_params() {
log 1 "checking GDI video driver... not Windows, skipping"
fi
- if [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
+ if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
log 1 "WARNING: no video driver found, building dedicated only"
enable_dedicated="1"
sleep 1
@@ -1164,6 +1171,18 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DWIN"
fi
+ if [ -n "$allegro_config" ]; then
+ CFLAGS="$CFLAGS -DWITH_ALLEGRO"
+ CFLAGS="$CFLAGS `$allegro_config --cflags`"
+ if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
+ if [ "$enable_static" != "0" ]; then
+ LIBS="$LIBS `$allegro_config --static --libs`"
+ else
+ LIBS="$LIBS `$allegro_config --libs`"
+ fi
+ fi
+ fi
+
if [ -n "$sdl_config" ]; then
CFLAGS="$CFLAGS -DWITH_SDL"
CFLAGS="$CFLAGS `$sdl_config --cflags`"
@@ -1740,6 +1759,72 @@ detect_os() {
fi
}
+detect_allegro() {
+ # 0 means no, 1 is auto-detect, 2 is force
+ if [ "$with_allegro" = "0" ]; then
+ log 1 "checking Allegro... disabled"
+
+ allegro_config=""
+ return 0
+ fi
+
+ if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then
+ log 1 "configure: error: it is impossible to compile both Allegro and COCOA"
+ log 1 "configure: error: please deselect one of them and try again"
+ exit 1
+ fi
+
+ if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then
+ log 1 "configure: error: it is impossible to compile a dedicated with Allegro"
+ log 1 "configure: error: please deselect one of them and try again"
+ exit 1
+ fi
+
+ if [ "$enable_dedicated" != "0" ]; then
+ log 1 "checking Allegro... dedicated server, skipping"
+
+ allegro_config=""
+ return 0
+ fi
+
+ # By default on OSX we don't use SDL. The rest is auto-detect
+ if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
+ log 1 "checking SDL... OSX, skipping"
+
+ allegro_config=""
+ return 0
+ fi
+
+ if [ "$with_allegro" = "1" ] || [ "$with_allegro" = "" ] || [ "$with_allegro" = "2" ]; then
+ allegro_config="allegro-config"
+ else
+ allegro_config="$with_allegro"
+ fi
+
+ version=`$allegro_config --version 2>/dev/null`
+ ret=$?
+ log 2 "executing $allegro_config --version"
+ log 2 " returned $version"
+ log 2 " exit code $ret"
+
+ if [ -z "$version" ] || [ "$ret" != "0" ]; then
+ log 1 "checking Allegro... not found"
+
+ # It was forced, so it should be found.
+ if [ "$with_allegro" != "1" ]; then
+ log 1 "configure: error: allegro-config couldn't be found"
+ log 1 "configure: error: you supplied '$with_allegro', but it seems invalid"
+ exit 1
+ fi
+
+ allegro_config=""
+ return 0
+ fi
+
+ log 1 "checking Allegro... found"
+}
+
+
detect_sdl() {
# 0 means no, 1 is auto-detect, 2 is force
if [ "$with_sdl" = "0" ]; then
@@ -2701,6 +2786,8 @@ showhelp() {
echo " --with-midi=midi define which midi-player to use"
echo " --with-midi-arg=arg define which args to use for the"
echo " midi-player"
+ echo " --with-allegrol[=allegro-config]"
+ echo " enables Allegro video driver support"
echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
echo " --with-sdl[=sdl-config] enables SDL video driver support"
echo " --with-zlib[=zlib.a] enables zlib support"