mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 17:41:05 +00:00
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:
parent
dd4837555b
commit
d1a63cf3bc
1 changed files with 81 additions and 54 deletions
|
@ -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,60 +1005,77 @@ static void determineOperatingSystem()
|
||||||
_operatingSystemVersion = @"0.0";
|
_operatingSystemVersion = @"0.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([os hasPrefix: @"linux"] == YES)
|
while (parseOS == YES)
|
||||||
{
|
{
|
||||||
_operatingSystemName = @"GSGNULinuxOperatingSystem";
|
NSString *fallback = [NSBundle _gnustep_target_os];
|
||||||
_operatingSystem = GSGNULinuxOperatingSystem;
|
|
||||||
|
if (os == nil)
|
||||||
|
{
|
||||||
|
os = fallback;
|
||||||
|
}
|
||||||
|
parseOS = NO;
|
||||||
|
|
||||||
|
if ([os hasPrefix: @"linux"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"GSGNULinuxOperatingSystem";
|
||||||
|
_operatingSystem = GSGNULinuxOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os hasPrefix: @"mingw"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"NSWindowsNTOperatingSystem";
|
||||||
|
_operatingSystem = NSWindowsNTOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os isEqualToString: @"cygwin"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"GSCygwinOperatingSystem";
|
||||||
|
_operatingSystem = GSCygwinOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os hasPrefix: @"bsd"] == YES
|
||||||
|
|| [os hasPrefix: @"freebsd"] == YES
|
||||||
|
|| [os hasPrefix: @"netbsd"] == YES
|
||||||
|
|| [os hasPrefix: @"openbsd"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"GSBSDOperatingSystem";
|
||||||
|
_operatingSystem = GSBSDOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os hasPrefix: @"beos"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"GSBeOperatingSystem";
|
||||||
|
_operatingSystem = GSBeOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os hasPrefix: @"darwin"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"NSMACHOperatingSystem";
|
||||||
|
_operatingSystem = NSMACHOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os hasPrefix: @"solaris"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"NSSolarisOperatingSystem";
|
||||||
|
_operatingSystem = NSSolarisOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os hasPrefix: @"hpux"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"NSHPUXOperatingSystem";
|
||||||
|
_operatingSystem = NSHPUXOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os hasPrefix: @"sunos"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"NSSunOSOperatingSystem";
|
||||||
|
_operatingSystem = NSSunOSOperatingSystem;
|
||||||
|
}
|
||||||
|
else if ([os hasPrefix: @"osf"] == YES)
|
||||||
|
{
|
||||||
|
_operatingSystemName = @"NSOSF1OperatingSystem";
|
||||||
|
_operatingSystem = NSOSF1OperatingSystem;
|
||||||
|
}
|
||||||
|
if (_operatingSystem == 0 && [os isEqual: fallback] == NO)
|
||||||
|
{
|
||||||
|
os = fallback;
|
||||||
|
parseOS = YES; // Try again with fallback
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ([os hasPrefix: @"mingw"] == YES)
|
|
||||||
{
|
if (_operatingSystem == 0)
|
||||||
_operatingSystemName = @"NSWindowsNTOperatingSystem";
|
|
||||||
_operatingSystem = NSWindowsNTOperatingSystem;
|
|
||||||
}
|
|
||||||
else if ([os isEqualToString: @"cygwin"] == YES)
|
|
||||||
{
|
|
||||||
_operatingSystemName = @"GSCygwinOperatingSystem";
|
|
||||||
_operatingSystem = GSCygwinOperatingSystem;
|
|
||||||
}
|
|
||||||
else if ([os hasPrefix: @"bsd"] == YES
|
|
||||||
|| [os hasPrefix: @"freebsd"] == YES
|
|
||||||
|| [os hasPrefix: @"netbsd"] == YES
|
|
||||||
|| [os hasPrefix: @"openbsd"] == YES)
|
|
||||||
{
|
|
||||||
_operatingSystemName = @"GSBSDOperatingSystem";
|
|
||||||
_operatingSystem = GSBSDOperatingSystem;
|
|
||||||
}
|
|
||||||
else if ([os hasPrefix: @"beos"] == YES)
|
|
||||||
{
|
|
||||||
_operatingSystemName = @"GSBeOperatingSystem";
|
|
||||||
_operatingSystem = GSBeOperatingSystem;
|
|
||||||
}
|
|
||||||
else if ([os hasPrefix: @"darwin"] == YES)
|
|
||||||
{
|
|
||||||
_operatingSystemName = @"NSMACHOperatingSystem";
|
|
||||||
_operatingSystem = NSMACHOperatingSystem;
|
|
||||||
}
|
|
||||||
else if ([os hasPrefix: @"solaris"] == YES)
|
|
||||||
{
|
|
||||||
_operatingSystemName = @"NSSolarisOperatingSystem";
|
|
||||||
_operatingSystem = NSSolarisOperatingSystem;
|
|
||||||
}
|
|
||||||
else if ([os hasPrefix: @"hpux"] == YES)
|
|
||||||
{
|
|
||||||
_operatingSystemName = @"NSHPUXOperatingSystem";
|
|
||||||
_operatingSystem = NSHPUXOperatingSystem;
|
|
||||||
}
|
|
||||||
else if ([os hasPrefix: @"sunos"] == YES)
|
|
||||||
{
|
|
||||||
_operatingSystemName = @"NSSunOSOperatingSystem";
|
|
||||||
_operatingSystem = NSSunOSOperatingSystem;
|
|
||||||
}
|
|
||||||
else if ([os hasPrefix: @"osf"] == YES)
|
|
||||||
{
|
|
||||||
_operatingSystemName = @"NSOSF1OperatingSystem";
|
|
||||||
_operatingSystem = NSOSF1OperatingSystem;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
NSWarnFLog(@"Unable to determine O/S ... assuming GNU/Linux");
|
NSWarnFLog(@"Unable to determine O/S ... assuming GNU/Linux");
|
||||||
_operatingSystemName = @"GSGNULinuxOperatingSystem";
|
_operatingSystemName = @"GSGNULinuxOperatingSystem";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue