forked from hoppet-code/hoppet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·85 lines (69 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
#!/usr/bin/perl -w
#
# script to configure hoppet. To find out more type
#
# ./configure --help
#
# GPS created 2009-09-05
#----------------------------------------------------------------------
use Cwd;
$usage="
Usage:
./configure [--prefix=...] [FC='...'] [FFLAGS='...'] [LDFLAGS='...']
--prefix='...' sets the location for installation
--mod-prefix='...' sets the location for installation of modules (by default prefix/include/hoppet)
FC='...' sets the fortran (and f90) compiler
FFLAGS='...' sets the fortran (and f90) compiler options
LDLAGS='...' sets the link options
";
if ($#ARGV >=0 && ($ARGV[0] eq "-h" || $ARGV[0] eq "--help")) {
print "$usage";
exit;
}
$configline=$0." ".join(" ",@ARGV);
$prefix="/usr/local";
$modPrefix="";
foreach $arg (@ARGV) {
if ($arg =~ /^--prefix=(.*)/) { $prefix= $1;}
elsif ($arg =~ /^--mod-prefix=(.*)/) { $modPrefix= $1;}
else {push @args, "\"".$arg."\"";}
}
push @args, "--prefix=$prefix";
if (!$modPrefix) {$modPrefix = "$prefix/include/hoppet";}
push @args, "--mod-prefix=$modPrefix";
# NB: src comes last, because from src onwards we will include an option to install modules
@dirs=split(" ","example_f90 benchmarking benchmarking/test_acc src");
$topdir = getcwd;
#chdir "src";
# now generate the makefiles
foreach $dir (@dirs) {
# when we reach src, ensure that modules get installed
if ($dir eq "src") {push @args, "--install-modules";}
chdir $dir;
print "Creating makefile in ".getcwd."\n";
# find out what we're already up to
$mkmk=`grep -v '^#' mkmk | grep makef95makefile`;
chomp($mkmk);
$mkmk =~ s/\$[^ ]+//g;
$mkmk =~ s/-remake.*//;
$mkmk .= " ".join(" ",@args);
#print $mkmk."\n";
print $dir, $mkmk,"\n";
system($mkmk);
chdir $topdir;
}
# get things ready for the hoppet-config script
$version=`grep 'Welcome to' src/welcome_message.f90 | sed -e 's/.*v\. //' -e 's/ .*//'`;
chomp $version;
$prefix=`cat src/.makef95.prefix`;
chomp $prefix;
($escprefix = $prefix) =~ s/\//\\\//g;
($escmodprefix = $modPrefix) =~ s/\//\\\//g;
system("sed -e 's/\@prefix\@/$escprefix/' -e 's/\@modprefix\@/$escmodprefix/' -e 's/\@VERSION\@/$version/' hoppet-config.in > hoppet-config");
system("chmod +x hoppet-config");
# write a file config.log
open (LOG,">config.log") || die "Could not open config.log";
print LOG "# the last configure that was run was\n";
print LOG "$configline\n";
print LOG "prefix=$prefix\n";
close LOG;