Fixed ==/!= mismatch.
[wine/testsucceed.git] / tools / winapi / setup.pm
blobe123a7c32eecad2347cd1890d598abc6e6b083f3
1 package setup;
3 use strict;
5 BEGIN {
6 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
7 require Exporter;
9 @ISA = qw(Exporter);
10 @EXPORT = qw();
11 @EXPORT_OK = qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
13 use vars qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
15 my $tool = $0;
16 $tool =~ s%^(?:.*?/)?([^/]+)$%$1%;
18 if(defined($current_dir) && defined($wine_dir) &&
19 defined($winapi_dir) && defined($winapi_check_dir))
21 # Nothing
22 } elsif($0 =~ m%^(.*?)/?tools/([^/]+)/[^/]+$%) {
23 my $dir = $2;
25 if(defined($1) && $1 ne "")
27 $wine_dir = $1;
28 } else {
29 $wine_dir = ".";
33 require Cwd;
34 my $cwd = Cwd::cwd();
36 if($wine_dir =~ /^\./) {
37 $current_dir = ".";
38 my $pwd; chomp($pwd = `pwd`);
39 foreach my $n (1..((length($wine_dir) + 1) / 3)) {
40 $pwd =~ s/\/([^\/]*)$//;
41 $current_dir = "$1/$current_dir";
43 $current_dir =~ s%/\.$%%;
44 } elsif($wine_dir eq $cwd) {
45 $wine_dir = ".";
46 $current_dir = ".";
47 } elsif($cwd =~ m%^$wine_dir/(.*?)?$%) {
48 $current_dir = $1;
49 $wine_dir = ".";
50 foreach my $dir (split(m%/%, $current_dir)) {
51 $wine_dir = "../$wine_dir";
53 $wine_dir =~ s%/\.$%%;
54 } else {
55 print STDERR "$tool: You must run this tool in the main Wine directory or a sub directory\n";
56 exit 1;
59 $winapi_dir = "$wine_dir/tools/winapi";
60 $winapi_dir =~ s%^\./%%;
62 $winapi_check_dir = "$wine_dir/tools/winapi_check";
63 $winapi_check_dir =~ s%^\./%%;
65 push @INC, ($winapi_dir, $winapi_check_dir);
66 } else {
67 print STDERR "$tool: You must run this tool in the main Wine directory or a sub directory\n";
68 exit 1;