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
|
# this code has been developped by Somanos Sar from CENA
# $Id$
use 5.00404;
use Cwd;
use Config;
use File::Basename;
use Carp;
BEGIN
{
my $IsWin32 = ($^O eq 'MSWin32' || $Config{'ccflags'} =~ /-D_?WIN32_?/);
}
my %opt = parse_opt();
# tcl / tk libraries are not needed for perl!
#my $tkConfig = $opt{'--tkConfig'};
#my $tclConfig = $opt{'--tclConfig'};
#$tkConfig = guess_libs('tkConfig.sh') if (!($tkConfig and -d $tkConfig));
#$tclConfig = guess_libs('tclConfig.sh') if (!($tclConfig and -d $tclConfig));
print "Trying to find a libGL by myself (may be long)...\n";
my $gl_lib = guess_libs('libGL.so');
if ($gl_lib)
{
my $gl_lib_a = guess_libs('libGL.a');
if ($gl_lib_a) {
warn ("you have both libGL.so [in $gl_lib] and libGL.a [in $gl_lib_a].
Tk::Zinc may have trouble building a correct libTkzinc3.x.yy.so library.
We suggest you to put the libGL.a aside ....")
}
$gl_lib = 'yes';
}
else
{
$gl_lib = 'no';
}
# Directories
my $prefix = $Config{'prefix'};
# in fact for the CPAN, the default prefix is /usr/local
#$prefix = '/usr/local';
$prefix = $opt{'--prefix'} if ($opt{'--prefix'});
#############################################
# SUBROUTINES
#############################################
# Try to guess which library are to be use for tk and tcl
sub guess_libs
{
my $lib_name = shift;
my @libs = split(/[ \t]+/, $Config{'libpth'});
foreach my $lib (@libs)
{
my @configs = (`find /usr/lib -name $lib_name`, `find /usr/local/lib -name $lib_name` , );
if (@configs)
{
print "Using $configs[0]\n";
$configs[0] = dirname($configs[0]);
return $configs[0];
}
}
return undef;
}
# Parse option from command line
sub parse_opt
{
my $args = join(/_IFS_/, @ARGV);
my @tokens = split(/_IFS_/, $args);
my %options;
foreach my $token (@tokens)
{
my ($key, $value) = split(/[ =]+/, $token);
$options{$key} = $value;
}
return %options;
}
#print "Installing in $prefix gl_lib=$gl_lib\n";
my @args = ("./configure",
"--enable-ptk=yes",
"--enable-gl=$gl_lib",
"--enable-shared=yes",
# "--prefix=$prefix",
# INSTALL_PERL=\"yes\""
);
print "\nConfiguring with... ", join (' ', @args), "\n";
system (@args);
|