-
Notifications
You must be signed in to change notification settings - Fork 6
/
configure
executable file
·100 lines (92 loc) · 2.42 KB
/
configure
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
#!/usr/bin/perl
use strict;
use Cwd qw(abs_path);
use Getopt::Long;
our $VERSION = 2.2;
Getopt::Long::Configure(qw(bundling no_ignore_case require_order));
my %opts = (
prefix => "/usr/local",
);
my $plver = $^V;
$plver =~ s/v|\.\d+$//g;
$opts{plprefix} = "$opts{prefix}/lib/perl5/site_lib/$plver/";
exit 1 if !GetOptions(\%opts, qw(help|h geodb=s plprefix=s prefix=s));
if ($opts{help}) {
print "'configure' configures Savors for different environments\n";
print "\n";
print "Usage: $0 [OPTION]...\n";
print "\n";
print "Defaults for the options are specified in brackets.\n";
print "\n";
print "Configuration:\n";
print " --help display this help and exit\n";
print " --geodb=PATH location of IP2Location DB11 database\n";
print " --plprefix=DIR perl installation directory [$opts{plprefix}]\n";
print " --prefix=DIR installation directory [$opts{prefix}]\n";
print "\n";
print "Report bugs to <pkolano\@gmail.com>\n";
exit 0;
}
$opts{geodb} = abs_path($opts{geodb}) if ($opts{geodb});
$opts{prefix} =~ s/\/*$/\//;
$opts{plprefix} =~ s/\/*$/\//;
my $error = 0;
my @pl_mods = qw(
GD
Imager
IO::Pty
Tk
);
foreach my $mod (@pl_mods) {
print "checking for perl module $mod...";
if (!system("perl -M$mod -e '1' 2>/dev/null")) {
print "yes\n";
} else {
print "no\n";
print "*** ERROR: Can't find perl module $mod\n";
$error = 1;
}
}
print "\n";
my @py_mods = qw(
cython
numpy
PIL
);
foreach my $mod (@py_mods) {
print "checking for python module $mod...";
if (!system("python -c 'import $mod' 2>/dev/null")) {
print "yes\n";
} else {
print "no\n";
print "*** ERROR: Can't find python module $mod\n";
$error = 1;
}
}
print "\n";
my @cmds = (
"dot -V",
"mscgen -l",
);
foreach my $cmd (@cmds) {
print "checking for command $cmd...";
if (!system("$cmd >/dev/null 2>/dev/null")) {
print "yes\n";
} else {
print "no\n";
print "*** ERROR: Can't find command $cmd\n";
$error = 1;
}
}
print "\n";
if ($error) {
print "configuration failed...check output for errors\n";
exit 1;
} else {
print "configuration succeeded...creating Makefile.config\n";
open(FILE, ">Makefile.config");
while (my ($key, $val) = each %opts) {
print FILE uc($key) . "=" . $val . "\n";
}
close FILE;
}