cross-plat-dev-utils/check_os.pm
changeset 2 39c28ec933dd
equal deleted inserted replaced
1:820b22e13ff1 2:39c28ec933dd
       
     1 #!/usr/bin/perl
       
     2 # Copyright (c) 2010 Symbian Foundation Ltd
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of the License "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Mike Kinghan, mikek@symbian.org, for Symbian Foundation Ltd - initial contribution.
       
    10 
       
    11 # Subroutines to check the host OS.
       
    12 
       
    13 use strict;
       
    14 
       
    15 sub check_os($)
       
    16 {
       
    17 	my $osname = shift;
       
    18 	return ($^O =~ /^$osname/) ? 1 : 0;
       
    19 }
       
    20 
       
    21 sub os_is_windows()
       
    22 {
       
    23 	return check_os("MSWin");
       
    24 }
       
    25 
       
    26 sub os_is_linux()
       
    27 {
       
    28 	return check_os("linux");
       
    29 }
       
    30 
       
    31 sub require_os_windows()
       
    32 {
       
    33 	unless(os_is_windows()) {
       
    34 		die ("*** Windows host required ***");
       
    35 	}
       
    36 }
       
    37 
       
    38 sub require_os_linux()
       
    39 {
       
    40 	unless(os_is_linux()) {
       
    41 		die ("*** Linux host required ***");
       
    42 	}
       
    43 }
       
    44 
       
    45 
       
    46 1;
       
    47