mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
support for old gcc as well as gcc 3.2
This commit is contained in:
parent
3ef2e8416b
commit
24cca694cf
@ -1,6 +1,9 @@
|
|||||||
AC_DEFUN(AC_HEADER_IOSTREAM,
|
AC_DEFUN(AC_HEADER_IOSTREAM,
|
||||||
[AC_CHECK_HEADERS(iostream,[have_iostream=yes],[have_iostream=no])])
|
[AC_CHECK_HEADERS(iostream,[have_iostream=yes],[have_iostream=no])])
|
||||||
|
|
||||||
|
AC_DEFUN(AC_HEADER_SSTREAM,
|
||||||
|
[AC_CHECK_HEADERS(sstream,[have_sstream=yes],[have_sstream=no])])
|
||||||
|
|
||||||
AC_DEFUN(AC_IOS_BINARY,
|
AC_DEFUN(AC_IOS_BINARY,
|
||||||
[AC_CACHE_CHECK([for ios::binary],
|
[AC_CACHE_CHECK([for ios::binary],
|
||||||
ac_cv_ios_binary,
|
ac_cv_ios_binary,
|
||||||
|
@ -6,12 +6,18 @@
|
|||||||
other platforms.
|
other platforms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Define if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
/* Define if the C++ compiler uses namespaces. */
|
/* Define if the C++ compiler uses namespaces. */
|
||||||
#define HAVE_NAMESPACE 1
|
#define HAVE_NAMESPACE 1
|
||||||
|
|
||||||
/* Define if the C++ iostream library supports ios::binary. */
|
/* Define if the C++ iostream library supports ios::binary. */
|
||||||
/* #undef HAVE_IOS_BINARY */
|
/* #undef HAVE_IOS_BINARY */
|
||||||
|
|
||||||
|
/* Define if fstream::open() accepts a third parameter for umask. */
|
||||||
|
/* #undef HAVE_OPEN_MASK */
|
||||||
|
|
||||||
/* Define if we're compiling with Cygwin. */
|
/* Define if we're compiling with Cygwin. */
|
||||||
/* #undef HAVE_CYGWIN */
|
/* #undef HAVE_CYGWIN */
|
||||||
|
|
||||||
@ -22,60 +28,57 @@
|
|||||||
initial setting of the $[PLATFORM] variable. */
|
initial setting of the $[PLATFORM] variable. */
|
||||||
#define PLATFORM "Win32"
|
#define PLATFORM "Win32"
|
||||||
|
|
||||||
/* Define if you have the <alloca.h> header file. */
|
/* Define if you have the `getopt' function. */
|
||||||
/* #undef HAVE_ALLOCA_H */
|
|
||||||
|
|
||||||
/* Define if you have the `getopt' function. */
|
|
||||||
/* #undef HAVE_GETOPT */
|
/* #undef HAVE_GETOPT */
|
||||||
|
|
||||||
/* Define if you have the <iostream> header file. */
|
/* Define if you have the <alloca.h> header file. */
|
||||||
#define HAVE_IOSTREAM 1
|
/* #undef HAVE_ALLOCA_H */
|
||||||
|
|
||||||
/* Define if you have the <io.h> header file. */
|
/* Define if you have the <dirent.h> header file. */
|
||||||
#define HAVE_IO_H 1
|
|
||||||
|
|
||||||
/* Define if you have the <malloc.h> header file. */
|
|
||||||
#define HAVE_MALLOC_H 1
|
|
||||||
|
|
||||||
/* Define if you have the <minmax.h> header file. */
|
|
||||||
/* #undef HAVE_MINMAX_H */
|
|
||||||
|
|
||||||
/* Define if you have the <dirent.h> header file. */
|
|
||||||
/* #undef HAVE_DIRENT_H */
|
/* #undef HAVE_DIRENT_H */
|
||||||
|
|
||||||
/* Define if you have the <regex.h> header file. */
|
/* Define if you have the <io.h> header file. */
|
||||||
|
#define HAVE_IO_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <iostream> header file. */
|
||||||
|
#define HAVE_IOSTREAM 1
|
||||||
|
|
||||||
|
/* Define if you have the <malloc.h> header file. */
|
||||||
|
#define HAVE_MALLOC_H 1
|
||||||
|
|
||||||
|
/* Define if you have the <minmax.h> header file. */
|
||||||
|
/* #undef HAVE_MINMAX_H */
|
||||||
|
|
||||||
|
/* Define if you have the <regex.h> header file. */
|
||||||
/* #undef HAVE_REGEX_H */
|
/* #undef HAVE_REGEX_H */
|
||||||
|
|
||||||
/* Define if you have the <string.h> header file. */
|
/* Define if you have the <sstream> header file. */
|
||||||
|
#define HAVE_SSTREAM 1
|
||||||
|
|
||||||
|
/* Define if you have the <string.h> header file. */
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
|
|
||||||
/* Define if you have the <strstream.h> header file. */
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
#define HAVE_STRSTREAM_H 1
|
|
||||||
|
|
||||||
/* Define if you have the <sys/types.h> header file. */
|
|
||||||
/* #undef HAVE_SYS_TYPES_H 1 */
|
|
||||||
|
|
||||||
/* Define if you have the <sys/time.h> header file. */
|
|
||||||
/* #undef HAVE_SYS_TIME_H 1 */
|
/* #undef HAVE_SYS_TIME_H 1 */
|
||||||
|
|
||||||
/* Define if you have the <sys/utime.h> header file. */
|
/* Define if you have the <sys/types.h> header file. */
|
||||||
|
/* #undef HAVE_SYS_TYPES_H 1 */
|
||||||
|
|
||||||
|
/* Define if you have the <sys/utime.h> header file. */
|
||||||
#define HAVE_SYS_UTIME_H 1
|
#define HAVE_SYS_UTIME_H 1
|
||||||
|
|
||||||
/* Define if you have the <sys/wait.h> header file. */
|
/* Define if you have the <sys/wait.h> header file. */
|
||||||
/* #undef HAVE_SYS_WAIT_H 1 */
|
/* #undef HAVE_SYS_WAIT_H 1 */
|
||||||
|
|
||||||
/* Define if you have the <unistd.h> header file. */
|
/* Define if you have the <unistd.h> header file. */
|
||||||
/* #undef HAVE_UNISTD_H 1 */
|
/* #undef HAVE_UNISTD_H 1 */
|
||||||
|
|
||||||
/* Define if you have the <utime.h> header file. */
|
/* Define if you have the <utime.h> header file. */
|
||||||
/* #undef HAVE_UTIME_H 1 */
|
/* #undef HAVE_UTIME_H 1 */
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#define PACKAGE "ppremake"
|
#define PACKAGE "ppremake"
|
||||||
|
|
||||||
/* Define if you have the ANSI C header files. */
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
|
|
||||||
/**************** UPDATE VERSION NUMBER HERE ****************
|
/**************** UPDATE VERSION NUMBER HERE ****************
|
||||||
** Also be sure to change the version number **
|
** Also be sure to change the version number **
|
||||||
** at the beginning of configure.in. **
|
** at the beginning of configure.in. **
|
||||||
|
@ -42,7 +42,7 @@ AC_SUBST(libm)
|
|||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(malloc.h alloca.h unistd.h utime.h io.h minmax.h dirent.h sys/types.h sys/time.h sys/utime.h sys/wait.h string.h strstream.h regex.h)
|
AC_CHECK_HEADERS(malloc.h alloca.h unistd.h utime.h io.h minmax.h dirent.h sys/types.h sys/time.h sys/utime.h sys/wait.h string.h regex.h)
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
|
||||||
@ -53,6 +53,7 @@ AC_CHECK_FUNCS(getopt)
|
|||||||
dnl Now we can test some C++-specific features.
|
dnl Now we can test some C++-specific features.
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CPLUSPLUS
|
||||||
AC_HEADER_IOSTREAM
|
AC_HEADER_IOSTREAM
|
||||||
|
AC_HEADER_SSTREAM
|
||||||
AC_NAMESPACE
|
AC_NAMESPACE
|
||||||
AC_IOS_BINARY
|
AC_IOS_BINARY
|
||||||
AC_OPEN_MASK
|
AC_OPEN_MASK
|
||||||
|
@ -1229,8 +1229,15 @@ handle_end_command() {
|
|||||||
// Now compare the file we generated to the file that's already
|
// Now compare the file we generated to the file that's already
|
||||||
// there, if there is one.
|
// there, if there is one.
|
||||||
|
|
||||||
// nest->_output << ends;
|
#ifdef HAVE_SSTREAM
|
||||||
string generated_file = nest->_output.str();
|
string generated_file = nest->_output.str();
|
||||||
|
#else
|
||||||
|
nest->_output << ends;
|
||||||
|
char *c_str = nest->_output.str();
|
||||||
|
string generated_file = c_str;
|
||||||
|
delete[] c_str;
|
||||||
|
#endif // HAVE_SSTREAM
|
||||||
|
|
||||||
if (!compare_output(generated_file, nest->_params,
|
if (!compare_output(generated_file, nest->_params,
|
||||||
(nest->_flags & OF_notouch) != 0)) {
|
(nest->_flags & OF_notouch) != 0)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -167,7 +167,11 @@ private:
|
|||||||
WriteState *_write_state;
|
WriteState *_write_state;
|
||||||
PPScope *_scope;
|
PPScope *_scope;
|
||||||
string _params;
|
string _params;
|
||||||
|
#ifdef HAVE_SSTREAM
|
||||||
ostringstream _output;
|
ostringstream _output;
|
||||||
|
#else
|
||||||
|
ostrstream _output;
|
||||||
|
#endif
|
||||||
vector<string> _words;
|
vector<string> _words;
|
||||||
int _flags;
|
int _flags;
|
||||||
BlockNesting *_next;
|
BlockNesting *_next;
|
||||||
|
@ -3128,10 +3128,11 @@ expand_function(const string &funcname,
|
|||||||
PPScope nested_scope(_named_scopes);
|
PPScope nested_scope(_named_scopes);
|
||||||
nested_scope.define_formals(funcname, sub->_formals, params);
|
nested_scope.define_formals(funcname, sub->_formals, params);
|
||||||
|
|
||||||
// This won't compile older C++ libraries that do not have
|
#ifdef HAVE_SSTREAM
|
||||||
// ostrstring. (The earlier interface was ostrstream, which is
|
|
||||||
// functionally equivalent but slightly different.)
|
|
||||||
ostringstream ostr;
|
ostringstream ostr;
|
||||||
|
#else
|
||||||
|
ostrstream ostr;
|
||||||
|
#endif
|
||||||
|
|
||||||
PPCommandFile command(&nested_scope);
|
PPCommandFile command(&nested_scope);
|
||||||
command.set_output(&ostr);
|
command.set_output(&ostr);
|
||||||
@ -3151,15 +3152,19 @@ expand_function(const string &funcname,
|
|||||||
|
|
||||||
// Now get the output. We split it into words and then reconnect
|
// Now get the output. We split it into words and then reconnect
|
||||||
// it, to replace all whitespace with spaces.
|
// it, to replace all whitespace with spaces.
|
||||||
// ostr << ends;
|
#ifdef HAVE_SSTREAM
|
||||||
string str = ostr.str();
|
string str = ostr.str();
|
||||||
|
#else
|
||||||
|
ostr << ends;
|
||||||
|
char *c_str = ostr.str();
|
||||||
|
string str = c_str;
|
||||||
|
delete[] c_str;
|
||||||
|
#endif
|
||||||
|
|
||||||
vector<string> results;
|
vector<string> results;
|
||||||
tokenize_whitespace(str, results);
|
tokenize_whitespace(str, results);
|
||||||
|
|
||||||
string result = repaste(results, " ");
|
string result = repaste(results, " ");
|
||||||
// delete[] str;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,12 +20,16 @@
|
|||||||
#ifdef HAVE_IOSTREAM
|
#ifdef HAVE_IOSTREAM
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#ifdef HAVE_SSTREAM
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#else
|
#else // HAVE_SSTREAM
|
||||||
|
#include <strstream>
|
||||||
|
#endif // HAVE_SSTREAM
|
||||||
|
#else // HAVE_IOSTREAM
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
#include <strstream.h>
|
#include <strstream.h>
|
||||||
#endif
|
#endif // HAVE_IOSTREAM
|
||||||
|
|
||||||
#if defined(HAVE_CYGWIN) || defined(WIN32_VC)
|
#if defined(HAVE_CYGWIN) || defined(WIN32_VC)
|
||||||
// Either Cygwin or Visual C++ is a Win32 environment.
|
// Either Cygwin or Visual C++ is a Win32 environment.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user