diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/CMakeLists.txt | 6 | ||||
-rw-r--r-- | indra/llcommon/indra_constants.h | 8 | ||||
-rw-r--r-- | indra/llcommon/llsys.cpp | 62 | ||||
-rw-r--r-- | indra/llcommon/llversionviewer.h | 2 |
4 files changed, 68 insertions, 10 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 22e0705036..d3dca73db4 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -287,6 +287,12 @@ target_link_libraries( ${GOOGLE_PERFTOOLS_LIBRARIES} ) +if (DARWIN) + include(CMakeFindFrameworks) + find_library(CARBON_LIBRARY Carbon) + target_link_libraries(llcommon ${CARBON_LIBRARY}) +endif (DARWIN) + add_dependencies(llcommon stage_third_party_libs) if (LL_TESTS) diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 95cb606240..d0f287657e 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -312,6 +312,14 @@ const F32 CHAT_SHOUT_RADIUS = 100.f; const F32 CHAT_MAX_RADIUS = CHAT_SHOUT_RADIUS; const F32 CHAT_MAX_RADIUS_BY_TWO = CHAT_MAX_RADIUS / 2.f; +// squared editions of the above for distance checks +const F32 CHAT_WHISPER_RADIUS_SQUARED = CHAT_WHISPER_RADIUS * CHAT_WHISPER_RADIUS; +const F32 CHAT_NORMAL_RADIUS_SQUARED = CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS; +const F32 CHAT_SHOUT_RADIUS_SQUARED = CHAT_SHOUT_RADIUS * CHAT_SHOUT_RADIUS; +const F32 CHAT_MAX_RADIUS_SQUARED = CHAT_SHOUT_RADIUS_SQUARED; +const F32 CHAT_MAX_RADIUS_BY_TWO_SQUARED = CHAT_MAX_RADIUS_BY_TWO * CHAT_MAX_RADIUS_BY_TWO; + + // this times above gives barely audible radius const F32 CHAT_BARELY_AUDIBLE_FACTOR = 2.0f; diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 10cdc7087b..ca2d3f9181 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -46,6 +46,7 @@ # include <sys/sysctl.h> # include <sys/utsname.h> # include <stdint.h> +# include <Carbon/Carbon.h> #elif LL_LINUX # include <errno.h> # include <sys/utsname.h> @@ -318,7 +319,58 @@ LLOSInfo::LLOSInfo() : } mOSString += compatibility_mode; +#elif LL_DARWIN + + // Initialize mOSStringSimple to something like: + // "Mac OS X 10.6.7" + { + const char * DARWIN_PRODUCT_NAME = "Mac OS X"; + + SInt32 major_version, minor_version, bugfix_version; + OSErr r1 = Gestalt(gestaltSystemVersionMajor, &major_version); + OSErr r2 = Gestalt(gestaltSystemVersionMinor, &minor_version); + OSErr r3 = Gestalt(gestaltSystemVersionBugFix, &bugfix_version); + + if((r1 == noErr) && (r2 == noErr) && (r3 == noErr)) + { + mMajorVer = major_version; + mMinorVer = minor_version; + mBuild = bugfix_version; + + std::stringstream os_version_string; + os_version_string << DARWIN_PRODUCT_NAME << " " << mMajorVer << "." << mMinorVer << "." << mBuild; + + // Put it in the OS string we are compiling + mOSStringSimple.append(os_version_string.str()); + } + else + { + mOSStringSimple.append("Unable to collect OS info"); + } + } + + // Initialize mOSString to something like: + // "Mac OS X 10.6.7 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386" + struct utsname un; + if(uname(&un) != -1) + { + mOSString = mOSStringSimple; + mOSString.append(" "); + mOSString.append(un.sysname); + mOSString.append(" "); + mOSString.append(un.release); + mOSString.append(" "); + mOSString.append(un.version); + mOSString.append(" "); + mOSString.append(un.machine); + } + else + { + mOSString = mOSStringSimple; + } + #else + struct utsname un; if(uname(&un) != -1) { @@ -334,15 +386,7 @@ LLOSInfo::LLOSInfo() : // Simplify 'Simple' std::string ostype = mOSStringSimple.substr(0, mOSStringSimple.find_first_of(" ", 0)); - if (ostype == "Darwin") - { - // Only care about major Darwin versions, truncate at first '.' - S32 idx1 = mOSStringSimple.find_first_of(".", 0); - std::string simple = mOSStringSimple.substr(0, idx1); - if (simple.length() > 0) - mOSStringSimple = simple; - } - else if (ostype == "Linux") + if (ostype == "Linux") { // Only care about major and minor Linux versions, truncate at second '.' std::string::size_type idx1 = mOSStringSimple.find_first_of(".", 0); diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index ae2bd0d78b..08026c38a6 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 6; -const S32 LL_VERSION_PATCH = 4; +const S32 LL_VERSION_PATCH = 8; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; |