From: <man...@us...> - 2014-10-28 15:04:20
|
Revision: 4513 http://sourceforge.net/p/modplug/code/4513 Author: manxorist Date: 2014-10-28 15:03:57 +0000 (Tue, 28 Oct 2014) Log Message: ----------- [Imp] openmpt123: Support building with C++98/03-TR1 for older GCC and VS2008. [Mod] libopenmpt: Do not rely on a modern help2man if ANCIENT=1 is given to Makefile. Modified Paths: -------------- trunk/OpenMPT/Makefile trunk/OpenMPT/libopenmpt/libopenmpt_config.h trunk/OpenMPT/openmpt123/openmpt123.cpp trunk/OpenMPT/openmpt123/openmpt123_config.hpp Modified: trunk/OpenMPT/Makefile =================================================================== --- trunk/OpenMPT/Makefile 2014-10-27 19:31:59 UTC (rev 4512) +++ trunk/OpenMPT/Makefile 2014-10-28 15:03:57 UTC (rev 4513) @@ -129,11 +129,7 @@ ONLY_TEST=0 ANCIENT=0 SOSUFFIX=.so -ifeq ($(ANCIENT),1) -OPENMPT123=0 -else OPENMPT123=1 -endif # get commandline or defaults @@ -251,9 +247,11 @@ ifeq ($(HOST),unix) +ifeq ($(ANCIENT),1) ifeq ($(shell help2man --version > /dev/null 2>&1 && echo yes ),yes) MPT_WITH_HELP2MAN := 1 endif +endif ifeq ($(shell doxygen --version > /dev/null 2>&1 && echo yes ),yes) MPT_WITH_DOXYGEN := 1 Modified: trunk/OpenMPT/libopenmpt/libopenmpt_config.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_config.h 2014-10-27 19:31:59 UTC (rev 4512) +++ trunk/OpenMPT/libopenmpt/libopenmpt_config.h 2014-10-28 15:03:57 UTC (rev 4513) @@ -111,14 +111,14 @@ #ifdef LIBOPENMPT_ANCIENT_COMPILER #include <stdint.h> namespace std { - typedef int8_t int8_t; - typedef int16_t int16_t; - typedef int32_t int32_t; - typedef int64_t int64_t; - typedef uint8_t uint8_t; - typedef uint16_t uint16_t; - typedef uint32_t uint32_t; - typedef uint64_t uint64_t; +typedef int8_t int8_t; +typedef int16_t int16_t; +typedef int32_t int32_t; +typedef int64_t int64_t; +typedef uint8_t uint8_t; +typedef uint16_t uint16_t; +typedef uint32_t uint32_t; +typedef uint64_t uint64_t; } #endif #endif Modified: trunk/OpenMPT/openmpt123/openmpt123.cpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123.cpp 2014-10-27 19:31:59 UTC (rev 4512) +++ trunk/OpenMPT/openmpt123/openmpt123.cpp 2014-10-28 15:03:57 UTC (rev 4513) @@ -52,7 +52,9 @@ #include <vector> #include <cmath> +#if !defined(OPENMPT123_ANCIENT_COMPILER) #include <cstdint> +#endif #include <cstdio> #include <cstdlib> #include <cstring> @@ -169,7 +171,11 @@ : impl(0) { if ( !flags.force_overwrite ) { +#if defined(OPENMPT123_ANCIENT_COMPILER) + std::ifstream testfile( filename.c_str(), std::ios::binary ); +#else std::ifstream testfile( filename, std::ios::binary ); +#endif if ( testfile ) { throw exception( "file already exists" ); } @@ -1348,12 +1354,20 @@ file_stream.str( data ); filesize = data.length(); #elif defined(_MSC_VER) && defined(UNICODE) +#if defined(OPENMPT123_ANCIENT_COMPILER) + file_stream.open( utf8_to_wstring( filename ).c_str(), std::ios::binary ); +#else file_stream.open( utf8_to_wstring( filename ), std::ios::binary ); +#endif file_stream.seekg( 0, std::ios::end ); filesize = file_stream.tellg(); file_stream.seekg( 0, std::ios::beg ); #else +#if defined(OPENMPT123_ANCIENT_COMPILER) + file_stream.open( filename.c_str(), std::ios::binary ); +#else file_stream.open( filename, std::ios::binary ); +#endif file_stream.seekg( 0, std::ios::end ); filesize = file_stream.tellg(); file_stream.seekg( 0, std::ios::beg ); Modified: trunk/OpenMPT/openmpt123/openmpt123_config.hpp =================================================================== --- trunk/OpenMPT/openmpt123/openmpt123_config.hpp 2014-10-27 19:31:59 UTC (rev 4512) +++ trunk/OpenMPT/openmpt123/openmpt123_config.hpp 2014-10-28 15:03:57 UTC (rev 4513) @@ -63,4 +63,30 @@ #define OPENMPT123_VERSION_STRING "0.2" +#if defined(_MSC_VER) +#if (_MSC_VER >= 1500) && (_MSC_VER < 1600) +#define OPENMPT123_ANCIENT_COMPILER +#endif +#endif + +#if defined(__GNUC__) && !defined(__clang__) +#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__*1 < 40300) +#define OPENMPT123_ANCIENT_COMPILER +#endif +#endif + +#ifdef OPENMPT123_ANCIENT_COMPILER +#include <stdint.h> +namespace std { +typedef int8_t int8_t; +typedef int16_t int16_t; +typedef int32_t int32_t; +typedef int64_t int64_t; +typedef uint8_t uint8_t; +typedef uint16_t uint16_t; +typedef uint32_t uint32_t; +typedef uint64_t uint64_t; +} +#endif + #endif // OPENMPT123_CONFIG_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |