From: andy Date: Fri, 30 Apr 2004 00:44:04 +0000 (+0000) Subject: Changes to get SimGear to configure and compile out-of-the-box on X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=86e83faef3a983f09e7d07dcaf1e35a0ba54ded9;p=simgear.git Changes to get SimGear to configure and compile out-of-the-box on a MinGW target: Link against alut.dll in addition to openal32.dll. Remove some preprocessor defines from compiler.h that were confusing the mingw and/or libstdc++ headers (I put the _isnan one back in the only file it was used). Hack a broken sleep() call into the OpenAL sample programs so that they will compile (but not work) in a non-POSIX environment. Change the header file ordering in sample_openal.hxx to get around some really weird interactions between MinGW's windows.h and the gcc iostream header. --- diff --git a/configure.ac b/configure.ac index 0e9bdd91..7a87af31 100644 --- a/configure.ac +++ b/configure.ac @@ -275,7 +275,7 @@ case "${host}" in *-*-cygwin* | *-*-mingw32*) dnl CygWin under Windoze. - LIBS="$LIBS -lopenal32 -lwinmm -ldsound -ldxguid -lole32" + LIBS="$LIBS -lalut -lopenal32 -lwinmm -ldsound -ldxguid -lole32" ;; *-apple-darwin*) diff --git a/simgear/compiler.h b/simgear/compiler.h index 52cf3395..9123ab19 100644 --- a/simgear/compiler.h +++ b/simgear/compiler.h @@ -149,13 +149,6 @@ #endif // __GNUC__ -#if defined( __MINGW32__ ) -# define bcopy(from, to, n) memcpy(to, from, n) -# define FG_MEM_COPY(to,from,n) memcpy(to, from, n) -# define isnan _isnan -# define snprintf _snprintf -#endif - /* KAI C++ */ #if defined(__KCC) diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index 7042c568..f6278bdc 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -41,6 +41,10 @@ #include "cloud.hxx" +#if defined(_MSC_VER) || defined(__MINGW32__) +#define isnan(x) _isnan(x) +#endif + static ssgStateSelector *layer_states[SGCloudLayer::SG_MAX_CLOUD_COVERAGES]; static bool state_initialized = false; diff --git a/simgear/sound/openal_test1.cxx b/simgear/sound/openal_test1.cxx index 0a62ef1e..5d56bc9e 100644 --- a/simgear/sound/openal_test1.cxx +++ b/simgear/sound/openal_test1.cxx @@ -1,5 +1,12 @@ #include + +#ifdef __MINGW32__ +// This is broken, but allows the file to compile without a POSIX +// environment. +static unsigned int sleep(unsigned int secs) { return 0; } +#else #include // sleep() +#endif #if defined( __APPLE__ ) # define AL_ILLEGAL_ENUM AL_INVALID_ENUM diff --git a/simgear/sound/openal_test2.cxx b/simgear/sound/openal_test2.cxx index 63353ab6..bee6c4e7 100644 --- a/simgear/sound/openal_test2.cxx +++ b/simgear/sound/openal_test2.cxx @@ -1,5 +1,11 @@ #include +#ifdef __MINGW32__ +// This is broken, but allows the file to compile without a POSIX +// environment. +static unsigned int sleep(unsigned int secs) { return 0; } +#else #include // sleep() +#endif #include "sample_openal.hxx" #include "soundmgr_openal.hxx" diff --git a/simgear/sound/sample_openal.hxx b/simgear/sound/sample_openal.hxx index a7bfe03f..0a5afdac 100644 --- a/simgear/sound/sample_openal.hxx +++ b/simgear/sound/sample_openal.hxx @@ -36,6 +36,10 @@ #include STL_STRING +#include + +#include + #if defined(__APPLE__) # define AL_ILLEGAL_ENUM AL_INVALID_ENUM # define AL_ILLEGAL_COMMAND AL_INVALID_OPERATION @@ -46,13 +50,8 @@ # include #endif -#include - -#include - SG_USING_STD(string); - /** * manages everything we need to know for an individual sound sample */