00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef HAVE_CONFIG_H
00020 # include <config.h>
00021 #endif
00022
00023 #include <iostream>
00024
00025 #ifdef WIN32
00026 #ifndef WIN32_LEAN_AND_MEAN
00027 #define WIN32_LEAN_AND_MEAN
00028 #endif
00029 #include <windows.h>
00030 #endif
00031
00032 #if (defined(__linux__) || defined(__linux) || defined(linux))
00033 #include <fstream>
00034 #include <string>
00035 #endif
00036
00037 void getVersionInfo(std::ostream& out)
00038 {
00039
00040
00041
00042
00043 out << "Exult version " << VERSION << std::endl;
00044
00045
00046
00047
00048
00049
00050 #if (defined(__TIME__) || defined(__DATE__))
00051 out << "Built at: ";
00052 #ifdef __DATE__
00053 out << __DATE__ << " ";
00054 #endif
00055 #ifdef __TIME__
00056 out << __TIME__;
00057 #endif
00058 out << std::endl;
00059 #endif
00060
00061
00062
00063
00064
00065 out << "Compile-time options: ";
00066 bool firstoption = true;
00067
00068 #ifdef DEBUG
00069 if (!firstoption) out << ", ";
00070 firstoption = false;
00071 out << "DEBUG";
00072 #endif
00073
00074 #ifdef HAVE_TIMIDITY_BIN
00075 if (!firstoption) out << ", ";
00076 firstoption = false;
00077 out << "HAVE_TIMIDITY_BIN";
00078 #endif
00079
00080 #ifdef USE_EXULTSTUDIO
00081 if (!firstoption) out << ", ";
00082 firstoption = false;
00083 out << "USE_EXULTSTUDIO";
00084 #endif
00085
00086 #ifdef USECODE_DEBUGGER
00087 if (!firstoption) out << ", ";
00088 firstoption = false;
00089 out << "USECODE_DEBUGGER";
00090 #endif
00091
00092 #ifdef WANT_ALTERNATE_ALLOCATOR
00093 if (!firstoption) out << ", ";
00094 firstoption = false;
00095 out << "WANT_ALTERNATE_ALLOCATOR";
00096 #endif
00097
00098 #ifdef INITIALISE_ALLOCATED_BLOCKS
00099 if (!firstoption) out << ", ";
00100 firstoption = false;
00101 out << "INITIALISE_ALLOCATED_BLOCKS";
00102 #endif
00103
00104 #ifdef POISON_ALLOCATED_BLOCKS
00105 if (!firstoption) out << ", ";
00106 firstoption = false;
00107 out << "POISON_ALLOCATED_BLOCKS";
00108 #endif
00109
00110 #ifdef NO_SDL_PARACHUTE
00111 if (!firstoption) out << ", ";
00112 firstoption = false;
00113 out << "NO_SDL_PARACHUTE";
00114 #endif
00115
00116 #ifdef HAVE_ZIP_SUPPORT
00117 if (!firstoption) out << ", ";
00118 firstoption = false;
00119 out << "HAVE_ZIP_SUPPORT";
00120 #endif
00121
00122 #ifdef HAVE_OPENGL
00123 if (!firstoption) out << ", ";
00124 firstoption = false;
00125 out << "HAVE_OPENGL";
00126 #endif
00127
00128 out << std::endl;
00129
00130
00131
00132
00133
00134
00135 out << "Compiler: ";
00136
00137 #if (defined(__GNUC__))
00138 out << "gcc";
00139 #if defined(__VERSION__)
00140 out << ", version: " << __VERSION__;
00141 #elif (defined(__GNUC_MINOR__))
00142 out << ", version " << __GNUC__ << "." << __GNUC_MINOR__;
00143 #if (defined(__GNUC_PATCHLEVEL__))
00144 out << "." << __GNUC_PATCHLEVEL__;
00145 #endif
00146 #endif
00147
00148
00149 #elif (defined(_MSC_FULL_VER))
00150 out << "Microsoft C/C++ Compiler, version: " << (_MSC_FULL_VER/1000000) << "."
00151 << ((_MSC_FULL_VER/10000)%100) << "."
00152 << (_MSC_FULL_VER%10000);
00153 #elif (defined(_MSC_VER))
00154 out << "Microsoft C/C++ Compiler, version: " << (_MSC_VER/100) << "." << (_MSC_VER%100);
00155
00156
00157 #elif (defined(__MWERKS__))
00158 out << "Metrowerks CodeWarrior, version: ";
00159 out << ((__MWERKS__&0xf000)>>12) << ".";
00160 out << ((__MWERKS__&0x0f00)>>8) << ".";
00161 out << (__MWERKS__&0xff);
00162 #else
00163 out << "Unknown";
00164 #endif
00165
00166 out << std::endl;
00167
00168
00169
00170
00171
00172
00173 out << std::endl << "Platform: ";
00174
00175 #if (defined(__linux__) || defined(__linux) || defined(linux))
00176 std::string ver;
00177
00178 try {
00179 std::ifstream procversion("/proc/version");
00180 if (!procversion) {
00181 ver = "Linux";
00182 } else {
00183 std::getline(procversion, ver);
00184 procversion.close();
00185 ver = ver.substr(0, ver.find('('));
00186 }
00187 } catch(...) {
00188 ver = "Linux";
00189 }
00190 out << ver;
00191 #elif (defined(BEOS))
00192 out << "BeOS";
00193 #elif (defined(__sun__) || defined(__sun))
00194 out << "Solaris";
00195 #elif (defined(WIN32))
00196 out << "Windows ";
00197 {
00198
00199 OSVERSIONINFO info;
00200 info.dwOSVersionInfoSize = sizeof (info);
00201 GetVersionEx (&info);
00202
00203
00204 if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
00205 {
00206 if (info.dwMajorVersion < 4) out << "NT";
00207 else if (info.dwMajorVersion == 4) out << "NT4";
00208 else if (info.dwMajorVersion == 5 && info.dwMinorVersion == 0) out << 2000;
00209 else if (info.dwMajorVersion == 5 && info.dwMinorVersion == 1) out << "XP";
00210 else if (info.dwMajorVersion == 5 && info.dwMinorVersion == 2) out << 2003;
00211 else out << "Unknown NT";
00212
00213 if (info.szCSDVersion[0]) out << " " << info.szCSDVersion;
00214 }
00215 #ifdef VER_PLATFORM_WIN32_CE
00216 else if (info.dwPlatformId == VER_PLATFORM_WIN32_CE)
00217 {
00218 out << "CE";
00219 }
00220 #endif
00221 else if (info.dwMajorVersion == 4 && info.dwMinorVersion == 0)
00222 {
00223 out << 95;
00224 if (info.szCSDVersion[1] != ' ') out << info.szCSDVersion;
00225 }
00226 else if (info.dwMajorVersion == 4 && info.dwMinorVersion == 10)
00227 {
00228 out << 98;
00229 if ( info.szCSDVersion[1] == 'A' ) out << " SE";
00230 else if (info.szCSDVersion[1] != ' ') out << info.szCSDVersion;
00231 }
00232 else if (info.dwMajorVersion == 4 && info.dwMinorVersion == 90)
00233 out << "Me";
00234
00235 out << " Version " << info.dwMajorVersion << "." << info.dwMinorVersion << " Build " << LOWORD(info.dwBuildNumber&0xFFFF);
00236 }
00237 #elif (defined(MACOSX))
00238 out << "Mac OS X";
00239 #elif (defined(MACOS))
00240 out << "MacOS";
00241 #elif (defined(__MORPHOS__))
00242 out << "MorphOS";
00243 #elif (defined(AMIGA))
00244 out << "Amiga";
00245 #else
00246 out << "Unknown";
00247 #endif
00248
00249 out << std::endl;
00250
00251 }