1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#!/usr/bin/perl -w
#
# This Makefile.PL is an interface to ./configure intended to be used
# by automatic CPAN builds. It just checks that some needed environment
# variables are set and eventually tries to guess their value...
#
# You should use it instead of the ./configure program ;
# it accepts the same options.
#
use strict;
my $libname = "libqt-mt.so";
my @prefix = ('/usr', '/usr/local');
my $res="";
my %p;
my @alt;
exec "./configure --help" if grep /^-?-h(elp)?$/, @ARGV;
unless ($ENV{'TQTDIR'} or grep /--with-qt-dir/, @ARGV)
{
print "\n!!!!!!!!!!!! WARNING !!!!!!!!!!!!\n".
" Your TQTDIR environment variable is not set and you\n".
"did not use the '--with-qt-dir=' commandline option.\n".
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n";
print "Nevermind, I'll try to guess TQt's location.\n";
sleep(6);
for(@prefix)
{
my $stdpath = $_."/lib/qt3/lib";
if(-s $stdpath."/$libname")
{
push @alt, glob($stdpath."/$libname*");
print "Found what looks like a TQt-3 tree in $_/lib/qt3\n";
sleep(1);
}
}
unless (@alt)
{
@alt=`locate $libname 2>/dev/null`;
if(!check_exit_status($?) || !@alt)
{
print "mmh... locate did not help. We'll try a find then.\n";
sleep(2);
print "Scanning local file system (ctrl-c to abort)...\n";
@alt=`find / -name "$libname*" 2>/dev/null`;
}
}
if(!check_exit_status($?) || !@alt)
{
print "Still no luck... I'll give up and let ./configure work it out\n";
}
elsif(@alt>1)
{
print "We have several answers. I'll try to discriminate a bit...\n";
sleep(3);
for(@alt) { /(.*)\/lib\// and $p{$1}++ }
if(keys %p == 1)
{
$res = each %p;
}
else
{
my ($ver,$tmp)=(0,0);
for(@alt)
{
/$libname(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?$/o;
$tmp = (($1?$1:0)*100)+(($2?$2:0)*10)+($3?$3:0);
if($tmp>=$ver)
{
$ver = $tmp;
$res = (/(.*)\/lib\//)[0]
}
}
$res = each %p if keys %p ==1;
}
print $res?"OK. We can try --with-qt-dir=$res.\n":"No, that's too fuzzy. I'll give up and let ./configure decide.\n";
}
else
{
($res=$alt[0])=~s|(.*)/lib/.*|$1|;
print "Fine. We'll try with --with-qt-dir=$res.\n";
}
sleep(3);
}
unshift(@ARGV, "--with-qt-dir=$res") if $res;
unless ($ENV{'KDEDIR'} or grep /--prefix/, @ARGV)
{
print "\n!!!!!!!!!!!! WARNING !!!!!!!!!!!!\n".
" Your KDEDIR environment variable is not set and you\n".
"did not use the '--prefix=' commandline option.\n";
print "KDE-3 isn't required at all. However, if it's installed on your system,\n".
"it is much better to specify it's location since PerlTQt uses (or build, if\n".
"it can't find it) a KDE library named smokeqt.\n";
print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n";
sleep(5);
}
print "\nNow starting ./configure ...\n\n";
exec join " ", "./configure", @ARGV;
#--------------------------------------------------------------#
sub check_exit_status
{
my $a = 0xFFFF & shift;
if( !$a )
{
return 1;
}
elsif( $a == 0xFF00 )
{
#die "\nSystem call failed: $!\n";
}
elsif( $a > 0x80 )
{
# non-zero status.
}
else
{
if( $a & 0x80 )
{
#die "\nProgram coredumped with signal ". ($a & ~0x80);
}
die "\nProgram interrupted by signal $a\n";
}
return 0;
}
|