ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JSOC/moreconfigure.pl
(Generate patch)

Comparing moreconfigure.pl (file contents):
Revision 1.10 by arta, Sun Aug 29 04:43:24 2010 UTC vs.
Revision 1.11 by arta, Wed Jan 19 20:40:37 2011 UTC

# Line 15 | Line 15 | use constant GFORTMINOR => 2;
15  
16   my($arg);
17   my($pos);
18 + my($outdir);
19   my($outfile);
20 + my($customdefsfile);
21   my($major);
22   my($minor);
23   my($hasicc);
24   my($hasifort);
25   my($hasgcc);
26   my($hasgfort);
27 + my($skipautocomp);
28 + my($line);
29  
30   while ($arg = shift(@ARGV))
31   {
32 <    if (($pos = index($arg, "-f", 0)) == 0)
32 >    if (($pos = index($arg, "-d", 0)) == 0)
33 >    {
34 >        $outdir = substr($arg, 2);
35 >    }
36 >    elsif (($pos = index($arg, "-f", 0)) == 0)
37      {
38          $outfile = substr($arg, 2);
39      }
40 +    elsif (($pos = index($arg, "-c", 0)) == 0)
41 +    {
42 +        $customdefsfile = substr($arg, 2);
43 +    }
44   }
45  
46 + $outfile = "$outdir/$outfile";
47 +
48   $hasicc = 0;
49   $hasifort = 0;
50   $hasgcc = 0;
51   $hasgfort = 0;
52 + $skipautocomp = 0;
53  
54 < if (defined($outfile))
54 > if (defined($outdir) && defined($outfile))
55   {
56 <    # Try icc
57 <    $ans = `icc -V 2>&1`;      
56 >   # Check to see if user does not want to auto-configure compiler make variables
57 >   # Read the file containing the defs (right now, customizeddefs.h for Stanford,
58 >   # localization.h for non-Stanford).
59 >   if (defined($customdefsfile) && -e $customdefsfile)
60 >   {
61 >      if (open(DEFSFILE, "<$customdefsfile"))
62 >      {
63 >         my($doautocomp) = 0;
64 >
65 >         while (defined($line = <DEFSFILE>))
66 >         {
67 >            if ($line =~ /AUTOSELCOMP\s+(.+)/)
68 >            {
69 >               $doautocomp = $1;
70 >               $skipautocomp = !$doautocomp;
71 >               last;
72 >            }
73 >         }
74  
75 <    if (defined($ans) && $ans =~ /Version\s+(\d+)\.(\d+)/)
76 <    {
77 <        $major = $1;
78 <        $minor = $2;
75 >         close(DEFSFILE);
76 >      }
77 >   }
78 >
79 >   if (!$skipautocomp)
80 >   {
81 >      # Try icc
82 >      $ans = `icc -V 2>&1`;      
83 >
84 >      if (defined($ans) && $ans =~ /Version\s+(\d+)\.(\d+)/)
85 >      {
86 >         $major = $1;
87 >         $minor = $2;
88  
89 <        if (IsVersion($major, $minor, ICCMAJOR, ICCMINOR))
90 <        {
89 >         if (IsVersion($major, $minor, ICCMAJOR, ICCMINOR))
90 >         {
91              $hasicc = 1;
92 <        }
93 <    }
92 >         }
93 >      }
94  
95 <    # Try gcc
96 <    if (!$hasicc)
97 <    {
98 <        $ans = `gcc -v 2>&1`;
99 <        if (defined($ans) && $ans =~ /gcc\s+version\s+(\d+)\.(\d+)/)
100 <        {
95 >      # Try gcc
96 >      if (!$hasicc)
97 >      {
98 >         $ans = `gcc -v 2>&1`;
99 >         if (defined($ans) && $ans =~ /gcc\s+version\s+(\d+)\.(\d+)/)
100 >         {
101              $major = $1;
102              $minor = $2;
103  
104              if (IsVersion($major, $minor, GCCMAJOR, GCCMINOR))
105              {
106 <                $hasgcc = 1;
106 >               $hasgcc = 1;
107              }
108 <        }
109 <    }
108 >         }
109 >      }
110  
111 <    # Try ifort
112 <    $ans = `ifort -V 2>&1`;
113 <    if (defined($ans) && $ans =~ /Version\s+(\d+)\.(\d+)/)
114 <    {
115 <        $major = $1;
116 <        $minor = $2;
111 >      # Try ifort
112 >      $ans = `ifort -V 2>&1`;
113 >      if (defined($ans) && $ans =~ /Version\s+(\d+)\.(\d+)/)
114 >      {
115 >         $major = $1;
116 >         $minor = $2;
117  
118 <        if (IsVersion($major, $minor, IFORTMAJOR, IFORTMINOR))
119 <        {
118 >         if (IsVersion($major, $minor, IFORTMAJOR, IFORTMINOR))
119 >         {
120              $hasifort = 1;
121 <        }
122 <    }
121 >         }
122 >      }
123  
124 <    # Try gfortran
125 <    if (!$hasifort)
126 <    {
127 <        $ans = `gfortran -v 2>&1`;
128 <        if (defined($ans) && $ans =~ /gcc\s+version\s+(\d+)\.(\d+)/)
129 <        {
124 >      # Try gfortran
125 >      if (!$hasifort)
126 >      {
127 >         $ans = `gfortran -v 2>&1`;
128 >         if (defined($ans) && $ans =~ /gcc\s+version\s+(\d+)\.(\d+)/)
129 >         {
130              $major = $1;
131              $minor = $2;
132  
133              if (IsVersion($major, $minor, GFORTMAJOR, GFORTMINOR))
134              {
135 <                $hasgfort = 1;
135 >               $hasgfort = 1;
136              }
137 <        }
138 <    }
137 >         }
138 >      }
139 >   }
140  
141      open(OUTFILE, ">>$outfile") || die "Couldn't open file $outfile for writing.\n";
142  
143      # Error messages
144 <    if (!$hasicc && !$hasgcc)
104 <    {
105 <        print "Fatal error: Acceptable C compiler not found! You will be unable to build the DRMS library.\n";
106 <    }
107 <    elsif ($hasicc)
108 <    {
109 <        print OUTFILE "COMPILER = icc\n";
110 <    }
111 <    else
112 <    {
113 <        print OUTFILE "COMPILER = gcc\n";
114 <    }
115 <
116 <    if (!$hasifort && !$hasgfort)
117 <    {
118 <        print "Warning: Acceptable Fortran compiler not found! Fortran interface will not be built, and you will be unable to build Fortran modules.\n";
119 <    }
120 <    elsif ($hasifort)
121 <    {
122 <        print OUTFILE "FCOMPILER = ifort\n";
123 <    }
124 <    else
144 >    if (!$skipautocomp)
145      {
146 <        print OUTFILE "FCOMPILER = gfortran\n";
146 >       if (!$hasicc && !$hasgcc)
147 >       {
148 >          print "Fatal error: Acceptable C compiler not found! You will be unable to build the DRMS library.\n";
149 >       }
150 >       elsif ($hasicc)
151 >       {
152 >          print OUTFILE "COMPILER = icc\n";
153 >       }
154 >       else
155 >       {
156 >          print OUTFILE "COMPILER = gcc\n";
157 >       }
158 >
159 >       if (!$hasifort && !$hasgfort)
160 >       {
161 >          print "Warning: Acceptable Fortran compiler not found! Fortran interface will not be built, and you will be unable to build Fortran modules.\n";
162 >       }
163 >       elsif ($hasifort)
164 >       {
165 >          print OUTFILE "FCOMPILER = ifort\n";
166 >       }
167 >       else
168 >       {
169 >          print OUTFILE "FCOMPILER = gfortran\n";
170 >       }
171      }
172  
173      # Print out env var override logic - otherwise we lose this logic in make_basic.mk

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines