summaryrefslogtreecommitdiff
path: root/configure
blob: 0f9f84483145dff130edc43374c6955b68a3477f (plain)
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
#!/bin/sh

if ! which perl >/dev/null
then
 echo You need to have Perl in your PATH
 exit 1
fi

perl -e '
 use strict;
 $|=1;
 sub check {
   my $f = shift;
   my $s = shift; 
   my $r = 0;
   print "Checking for GNU G++ $f.$s\n"; 
   if ( `g++ -v 2> g++.version && tail -n 1 g++.version` =~ / $f\.$s/ ) {
     `echo $f.$s >> g++.version`;
     `echo g++ >> g++.version`;
     $r = 1; 	
   } else {
     if (`g++$f$s -v 2> g++.version && tail -n 1 g++.version` =~ / $f\.$s/) {
       `echo $f.$s >> g++.version`;
       `echo g++$f$s >> g++.version`;
       $r = 1;
     }
   }
   print "No " if $r == 0;
   print "GNU G++ $f.$s found!\n";
   return $r;
 }
 print "Checking compiler version\n";
 my $r = 0;
 for (my $i = 4; $i > 0 && $r == 0; --$i ) {
    $r = &check(3,$i);
 }
 if ($r == 0) {
  print "No suitable g++ compiler found!\n"; 
  print "Please install a right version of GNU G++!\n";
  exit(1);
 }
 
 system("sh -c \"scripts/config.sh\"");
 chdir("src");
 system("./configure ".join(" ", @ARGV));
 chdir("..");

 exit(0);
' `echo "$*" | sed "s/-//g"` 

echo You are ready to type gmake now!