Skip to content
Snippets Groups Projects
Commit a34cad5f authored by Leslie Linden's avatar Leslie Linden
Browse files

EXP-779 FIX -- Help > About Second Life Reports Kernel Version Twice, Instead of OS Version

Modified Mac OS_VERSION string to include OS X version number in addition to Kernel version info.
DARWIN llcommon build now depends on Carbon in order to provide this functionality.

Reviewed by Richard.
parent 90cad613
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment