handle recognition of solaris better.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23739 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-10-03 14:49:01 +00:00
parent dd4837555b
commit d1a63cf3bc

View file

@ -952,7 +952,8 @@ static void determineOperatingSystem()
{ {
if (_operatingSystem == 0) if (_operatingSystem == 0)
{ {
NSString *os = [NSBundle _gnustep_target_os]; NSString *os = nil;
BOOL parseOS = YES;
#if defined(__MINGW32__) #if defined(__MINGW32__)
OSVERSIONINFOW osver; OSVERSIONINFOW osver;
@ -978,6 +979,7 @@ static void determineOperatingSystem()
if (uname(&uts) == 0) if (uname(&uts) == 0)
{ {
os = [NSString stringWithCString: uts.sysname encoding: [NSString defaultCStringEncoding]]; os = [NSString stringWithCString: uts.sysname encoding: [NSString defaultCStringEncoding]];
os = [os lowercaseString];
/* Get the operating system version ... usually the version string /* Get the operating system version ... usually the version string
* is pretty horrible, and the kernel release string actually * is pretty horrible, and the kernel release string actually
* makes more sense. * makes more sense.
@ -985,6 +987,14 @@ static void determineOperatingSystem()
_operatingSystemVersion = [[NSString alloc] _operatingSystemVersion = [[NSString alloc]
initWithCString: uts.release initWithCString: uts.release
encoding: [NSString defaultCStringEncoding]]; encoding: [NSString defaultCStringEncoding]];
/* Hack for sunos/solaris ... sunos version 5 is solaris
*/
if ([os isEqualToString: @"sunos"] == YES
&& [_operatingSystemVersion intValue] > 4)
{
os = @"solaris";
}
} }
#endif /* HAVE_SYS_UTSNAME_H */ #endif /* HAVE_SYS_UTSNAME_H */
#endif /* __MINGW32__ */ #endif /* __MINGW32__ */
@ -995,6 +1005,16 @@ static void determineOperatingSystem()
_operatingSystemVersion = @"0.0"; _operatingSystemVersion = @"0.0";
} }
while (parseOS == YES)
{
NSString *fallback = [NSBundle _gnustep_target_os];
if (os == nil)
{
os = fallback;
}
parseOS = NO;
if ([os hasPrefix: @"linux"] == YES) if ([os hasPrefix: @"linux"] == YES)
{ {
_operatingSystemName = @"GSGNULinuxOperatingSystem"; _operatingSystemName = @"GSGNULinuxOperatingSystem";
@ -1048,7 +1068,14 @@ static void determineOperatingSystem()
_operatingSystemName = @"NSOSF1OperatingSystem"; _operatingSystemName = @"NSOSF1OperatingSystem";
_operatingSystem = NSOSF1OperatingSystem; _operatingSystem = NSOSF1OperatingSystem;
} }
else if (_operatingSystem == 0 && [os isEqual: fallback] == NO)
{
os = fallback;
parseOS = YES; // Try again with fallback
}
}
if (_operatingSystem == 0)
{ {
NSWarnFLog(@"Unable to determine O/S ... assuming GNU/Linux"); NSWarnFLog(@"Unable to determine O/S ... assuming GNU/Linux");
_operatingSystemName = @"GSGNULinuxOperatingSystem"; _operatingSystemName = @"GSGNULinuxOperatingSystem";