From 27f14fc2e3442f6827c6ed06135deace2fc0f2e5 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Mon, 29 Sep 2003 21:18:08 +0000 Subject: [PATCH] os x changes. --- dtool/Config.pp | 28 ++++++++++++++----- dtool/LocalSetup.pp | 3 ++ dtool/Package.pp | 5 +++- dtool/pptempl/Global.pp | 5 +++- dtool/src/dtoolbase/dtoolbase.h | 2 +- dtool/src/dtoolbase/dtoolbase_cc.h | 5 ++++ dtool/src/dtoolutil/load_dso.cxx | 21 +++++++++++++- dtool/src/interrogate/interrogate.cxx | 2 +- dtool/src/interrogate/parse_file.cxx | 8 ++++-- .../src/test_interrogate/test_interrogate.cxx | 8 ++++-- 10 files changed, 69 insertions(+), 18 deletions(-) diff --git a/dtool/Config.pp b/dtool/Config.pp index f4677dc94f..27c68afa85 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -1,5 +1,5 @@ // -// Config.pp +// dtool/Config.pp // // This file defines certain configuration variables that are written // into the various make scripts. It is processed by ppremake (along @@ -43,13 +43,13 @@ // store only the variable references themselves, and expand them when // the variable is later referenced. It is very similar to the // relationship between := and = in GNU Make. -// +// dtool/Config.pp + // In general, #defer is used in this file, to allow the user to // redefine critical variables in his or her own Config.pp file. - // What kind of build scripts are we generating? This selects a // suitable template file from the ppremake system files. The // allowable choices, at present, are: @@ -69,6 +69,8 @@ #define BUILD_TYPE gmsvc #elif $[eq $[PLATFORM], Cygwin] #define BUILD_TYPE gmsvc +#elif $[eq $[PLATFORM], osx] + #define BUILD_TYPE osx #else #define BUILD_TYPE unix #endif @@ -461,6 +463,8 @@ #define USE_COMPILER MIPS #elif $[eq $[PLATFORM], Linux] #define USE_COMPILER GCC +#elif $[eq $[PLATFORM], osx] + #define USE_COMPILER GCC #endif @@ -572,8 +576,13 @@ // How to generate a static C or C++ library. $[target] is the // name of the library to generate, and $[sources] is the list of .o // files that will go into the library. -#defer STATIC_LIB_C ar cru $[target] $[sources] -#defer STATIC_LIB_C++ ar cru $[target] $[sources] +#if $[eq $[PLATFORM], osx] + #defer STATIC_LIB_C libtool -static -o $[target] $[sources] + #defer STATIC_LIB_C++ libtool -static -o $[target] $[sources] +#else + #defer STATIC_LIB_C ar cru $[target] $[sources] + #defer STATIC_LIB_C++ ar cru $[target] $[sources] +#endif // How to run ranlib, if necessary, after generating a static library. // $[target] is the name of the library. Set this to the empty string @@ -584,8 +593,13 @@ // as above, and $[libs] is a space-separated list of dependent // libraries, and $[lpath] is a space-separated list of directories in // which those libraries can be found. -#defer SHARED_LIB_C $[CC] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] -#defer SHARED_LIB_C++ $[CXX] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] +#if $[eq $[PLATFORM], osx] + #defer SHARED_LIB_C $[CC] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] + #defer SHARED_LIB_C++ $[CXX] -dynamic -dynamiclib -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] +#else + #defer SHARED_LIB_C $[CC] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] + #defer SHARED_LIB_C++ $[CXX] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] +#endif // How to install a data file or executable file. $[local] is the // local name of the file to install, and $[dest] is the name of the diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index b3b6256096..f53ea6fb6f 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -148,6 +148,9 @@ $[cdefine HAVE_NAMESPACE] /* Define if fstream::open() accepts a third parameter for umask. */ $[cdefine HAVE_OPEN_MASK] +/* Define if the some header file defines wchar_t. */ +$[cdefine HAVE_WCHAR_T] + /* Define if the header file defines wstring. */ $[cdefine HAVE_WSTRING] diff --git a/dtool/Package.pp b/dtool/Package.pp index afd16c8d36..ac31ec3983 100644 --- a/dtool/Package.pp +++ b/dtool/Package.pp @@ -55,8 +55,11 @@ // True if we are building on some flavor of Windows. #define WINDOWS_PLATFORM $[or $[eq $[PLATFORM],Win32],$[eq $[PLATFORM],Cygwin]] +// True if we are building on some flavor of OS X. +#define OSX_PLATFORM $[or $[eq $[PLATFORM],Darwin],$[eq $[PLATFORM],osx]] + // True if we are building on some flavor of Unix. -#define UNIX_PLATFORM $[not $[WINDOWS_PLATFORM]] +#define UNIX_PLATFORM $[and $[not $[WINDOWS_PLATFORM]],$[not $[OSX_PLATFORM]]] diff --git a/dtool/pptempl/Global.pp b/dtool/pptempl/Global.pp index b018392643..83a52e6a71 100644 --- a/dtool/pptempl/Global.pp +++ b/dtool/pptempl/Global.pp @@ -6,7 +6,6 @@ // different kinds of build_types. // - // We start off by defining a number of map variables. These are // special variables that can be used to look up a particular named // scope according to a key (that is, according to the value of some @@ -389,6 +388,8 @@ #if $[WINDOWS_PLATFORM] #set alt_libs $[alt_libs] $[WIN_SYS_LIBS] $[components $[WIN_SYS_LIBS],$[active_component_libs] $[transitive_link]] + #elif $[OSX_PLATFORM] + #set alt_libs $[alt_libs] $[OSX_SYS_LIBS] $[components $[OSX_SYS_LIBS],$[active_component_libs] $[transitive_link]] #else #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_component_libs] $[transitive_link]] #endif @@ -486,6 +487,8 @@ #end get_depend_libs +// dtool/pptempl/Global.pp + // Define a few directories that will be useful. #define install_dir $[$[upcase $[PACKAGE]]_INSTALL] diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index d14303bd28..1f62899694 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -24,7 +24,7 @@ #ifndef DTOOLBASE_H #define DTOOLBASE_H -#include +#include "dtool_config.h" #ifdef WIN32_VC /* These warning pragmas must appear before anything else for VC++ to diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index f12a6e7f20..f889bb4ee2 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -80,6 +80,11 @@ using namespace std; #define TYPENAME #endif +#ifndef HAVE_WCHAR_T +// Some C++ libraries (os x 3.1) don't define this. +typedef unsigned short wchar_t; +#endif + #ifndef HAVE_WSTRING // Some C++ libraries (gcc 2.95) don't define this. typedef basic_string wstring; diff --git a/dtool/src/dtoolutil/load_dso.cxx b/dtool/src/dtoolutil/load_dso.cxx index e5ac4e6d88..e86f1ac096 100644 --- a/dtool/src/dtoolutil/load_dso.cxx +++ b/dtool/src/dtoolutil/load_dso.cxx @@ -18,7 +18,26 @@ #include "load_dso.h" -#if defined(PENV_PS2) +#if 1 || defined(PENV_OSX) +// These are not used on Macintosh OS X + +void * +load_dso(const Filename &) { + return (void *) NULL; +} + +bool +unload_dso(void *dso_handle) { + return false; +} + +string +load_dso_error() { + const char *message="load_dso_error() unsupported on PS2"; + return message; +} + +#elif defined(PENV_PS2) // The playstation2 can't do any of this stuff, so these functions are B O G U S diff --git a/dtool/src/interrogate/interrogate.cxx b/dtool/src/interrogate/interrogate.cxx index b2aee8ae48..f05c861c3a 100644 --- a/dtool/src/interrogate/interrogate.cxx +++ b/dtool/src/interrogate/interrogate.cxx @@ -27,7 +27,7 @@ // If our system getopt() doesn't come with getopt_long_only(), then use // the GNU flavor that we've got in tool for this purpose. #ifndef HAVE_GETOPT_LONG_ONLY -#include "gnu_getopt.h" + #include "gnu_getopt.h" #else #ifdef HAVE_GETOPT_H #include diff --git a/dtool/src/interrogate/parse_file.cxx b/dtool/src/interrogate/parse_file.cxx index a7106aeb15..f2efca80f6 100644 --- a/dtool/src/interrogate/parse_file.cxx +++ b/dtool/src/interrogate/parse_file.cxx @@ -28,10 +28,12 @@ #include -#ifndef HAVE_GETOPT -#include +#ifndef HAVE_GETOPT_LONG_ONLY + #include "gnu_getopt.h" #else -#include + #ifdef HAVE_GETOPT_H + #include + #endif #endif CPPParser parser; diff --git a/dtool/src/test_interrogate/test_interrogate.cxx b/dtool/src/test_interrogate/test_interrogate.cxx index 6c4b4bad84..c63d48816d 100644 --- a/dtool/src/test_interrogate/test_interrogate.cxx +++ b/dtool/src/test_interrogate/test_interrogate.cxx @@ -26,10 +26,12 @@ #include -#ifndef HAVE_GETOPT -#include +#ifndef HAVE_GETOPT_LONG_ONLY + #include "gnu_getopt.h" #else -#include + #ifdef HAVE_GETOPT_H + #include + #endif #endif