(svn r9821) [NoAI] -Fix: support compilation without threads.
--- a/config.lib Wed May 09 20:22:49 2007 +0000
+++ b/config.lib Thu May 10 15:07:16 2007 +0000
@@ -59,8 +59,9 @@
with_freetype="1"
with_fontconfig="1"
with_psp_config="1"
+ with_threads="1"
- save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os cpu_type revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
+ save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os cpu_type revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config with_threads CC CXX CFLAGS LDFLAGS"
}
detect_params() {
@@ -245,6 +246,10 @@
--with-application-bundle) with_application_bundle="1";;
--with-application-bundle=*) with_application_bundle="$optarg";;
+ --without-threads) with_threads="0";;
+ --with-threads) with_threads="1";;
+ --with-threads=*) with_threads="$optarg";;
+
CC=* | --CC=*) CC="$optarg";;
CXX=* | --CXX=*) CXX="$optarg";;
CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
@@ -675,6 +680,10 @@
LDFLAGS="$LDFLAGS -pg"
fi
+ if [ "$with_threads" == "0" ]; then
+ CFLAGS="$CFLAGS -DNO_THREADS"
+ fi
+
# Enable some things only for certain GCC versions
cc_version=`$cc_host -dumpversion | cut -c 1,3`
--- a/configure Wed May 09 20:22:49 2007 +0000
+++ b/configure Thu May 10 15:07:16 2007 +0000
@@ -95,6 +95,7 @@
if ($0 == "MSVC" && "'$os'" != "MSVC") { next; }
if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; }
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }
+ if ($0 == "NO_THREADS" && "'$with_threads'" == "0") { next; }
skip += 1;
--- a/projects/generate Wed May 09 20:22:49 2007 +0000
+++ b/projects/generate Thu May 10 15:07:16 2007 +0000
@@ -35,6 +35,7 @@
enable_dedicated="0"
with_cocoa="0"
enable_directmusic="1"
+with_threads="1"
file_prefix="..\\\\src\\\\"
load_main_data() {
@@ -64,6 +65,7 @@
if ($0 == "MSVC" && "'$os'" != "MSVC") { next; }
if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; }
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }
+ if ($0 == "NO_THREADS" && "'$with_threads'" == "0") { next; }
skip += 1;
--- a/source.list Wed May 09 20:22:49 2007 +0000
+++ b/source.list Thu May 10 15:07:16 2007 +0000
@@ -304,6 +304,7 @@
# AI Core
ai/ai.cpp
ai/ai.h
+#if NO_THREADS
ai/ai_factory.hpp
ai/ai_squirrel.cpp
ai/ai_squirrel.hpp
@@ -369,6 +370,7 @@
ai/api/ai_vehicle.cpp
ai/api/ai_vehiclelist.cpp
ai/api/ai_vehiclelist_valuator.cpp
+#end
# NewGRF
newgrf.cpp
--- a/src/ai/ai.cpp Wed May 09 20:22:49 2007 +0000
+++ b/src/ai/ai.cpp Thu May 10 15:07:16 2007 +0000
@@ -9,6 +9,8 @@
#include "../network/network.h"
#include "../helpers.hpp"
#include "../debug.h"
+
+#ifndef NO_THREADS
#include "ai.h"
#include "ai_threads.h"
#include "ai_factory.hpp"
@@ -158,3 +160,15 @@
return true;
}
+
+#else /* NO_THREADS */
+/* Stub functions for when we do not have threads. */
+void AI_StartNewAI(PlayerID player) { DEBUG(ai, 0, "Threading is disabled and therefor the AI too."); }
+void AI_PlayerDied(PlayerID player) {}
+void AI_RunGameLoop() {}
+void AI_Initialize() {}
+void AI_Uninitialize() {}
+bool AI_AllowNewAI() { return false; }
+void AI_ForceAI(const char *forced_ai) {}
+void CcAI(bool success, TileIndex tile, uint32 p1, uint32 p2) {}
+#endif /* NO_THREADS */