summaryrefslogtreecommitdiff
path: root/lib/make/known-architectures/linux
blob: 55f74bb69648687f30522c39203f594ae2359d83 (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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
#! /bin/sh
# /*@@
#   @file      linux
#   @date      Thu Jul 15 21:30:04 1999
#   @author    Tom Goodale
#   @desc 
#  
#   @enddesc
#   @version $Header$ 
# @@*/

if test "$CCTK_CONFIG_STAGE" = "preferred-compilers" ; then

:

else

# Determine which Fortran 90 compiler is in use
  LINUX_F90_COMP=

  if test -n "$F90" ; then 
    if test "`$F90 -V 2>&1 | grep -i f90 | grep -i vast`" ; then 
        LINUX_F90_COMP=pacific
    elif test "`$F90 -V 2>&1 | grep -i f90 | grep -i absoft`" ; then 
        LINUX_F90_COMP=absoft
    elif test "`$F90 -V 2>&1 | grep -i fujitsu`" ; then 
        LINUX_F90_COMP=fujitsu
    elif test "`$F90 -V 2>&1 | grep -i f90 | grep -i pgf90`" ; then
        LINUX_F90_COMP=portland
    elif test "`$F90 -v 2>&1 | grep -i g77`" ; then
        LINUX_F90_COMP=gnu77
    elif test "`$F90 -? 2>&1 | grep -i absoft`" ; then
        LINUX_F90_COMP=absoft77
    elif test "`$F90 --version 2>&1 | grep -i lahey/fujitsu`" ; then
       LINUX_F90_COMP=lahey          
    elif test "`$F90 -v 2>&1 | grep -i SGIcc`" ; then
       LINUX_F90_COMP=SGI          
    elif test "`$F90 -V 2>&1 | grep -i intel`" ; then
       LINUX_F90_COMP=Intel          
    elif test "$F90" = "none" ; then
       LINUX_F90_COMP=none
    else
        echo Unknown Linux f90 compiler.
        echo Please add appropriate information to 
        echo $srcdir/known-architectures/linux-gnu
        echo ad send the updated file to CactusMaint
        echo We will try anyway ...
    fi
  elif test -n "$F77" ; then 
    if test "`$F77 -v 2>&1 | grep -i g77`" ; then
        LINUX_F90_COMP=gnu77
    elif test "`$F77 -? 2>&1 | grep -i absoft`" ; then
        LINUX_F90_COMP=absoft77
    elif test "`$F90 -V 2>&1 | grep -i intel`" ; then
       LINUX_F90_COMP=Intel          
    else
        echo Unknown Linux f77 compiler.
        echo Please add appropriate information to 
        echo $srcdir/known-architectures/linux-gnu
        echo ad send the updated file to CactusMaint
        echo We will try anyway ...
    fi
  else
    LINUX_F90_COMP=none
  fi

# find out if we have egcs or not, LIBS is either g2c or f2c
  LINUX_G77_USES_LIBG2C=

  if test "$LINUX_F90_COMP" = "gnu77" ; then
    if test -n "`$F77 -v 2>&1 | grep g2c`" ; then
      LINUX_G77_USES_LIBG2C=yes
    else
      LINUX_G77_USES_LIBG2C=no
    fi
  fi

#Set the appropriate flags
  case "$LINUX_F90_COMP" in
     gnu77)
       if test "$LINUX_G77_USES_LIBG2C" = "yes" ; then
         : ${LIBS="g2c m"} 
       fi
       if test "$LINUX_G77_USES_LIBG2C" = "no" ; then
         : ${LIBS="f2c m"} 
       fi
       : ${F77_DEBUG_FLAGS="-g"}
       : ${F90_DEBUG_FLAGS="-g"}
       : ${F77_WARN_FLAGS="-Wall"}
       : ${F90_WARN_FLAGS="-Wall"}
       ;;
     pacific)
       if test "$LINUX_G77_USES_LIBG2C" = "yes" ; then
         : ${LIBS="vast90 g2c m"} 
       fi
       if test "$LINUX_G77_USES_LIBG2C" = "no" ; then
         : ${LIBS="vast90 f2c m"} 
       fi
       : ${F77_DEBUG_FLAGS="-g"}
       : ${F90_DEBUG_FLAGS="-g"}
       : ${F77_WARN_FLAGS="-Wall"}
       : ${F90_WARN_FLAGS="-Wall"}
       ;;
     absoft)
       : ${LIBS="f90math fio f77math m"} 
       : ${F90_OPTIMISE_FLAGS="-s -O"}
       : ${F77_OPTIMISE_FLAGS="-s -O"}
       # Test if it is a version of the absoft compiler which has the library in a custom place.
       if test -n "$ABSOFT" ; then
         : ${LIBDIRS='$(ABSOFT)/lib'}
       fi 
       : ${F77_DEBUG_FLAGS="-g"}
       : ${F90_DEBUG_FLAGS="-g"}
       : ${F77_WARN_FLAGS="-m0"}
       : ${F90_WARN_FLAGS="-m0"}
       ;;
     absoft77)
       : ${LIBS="fio f77math m"}
       F90FLAGS="-f"
       # Test if it is a version of the absoft compiler which has the library in a custom place.
       if test -n "$ABSOFT" ; then
         : ${LIBDIRS='$(ABSOFT)/lib'}
       fi 
       : ${F77_DEBUG_FLAGS="-g"}
       : ${F90_DEBUG_FLAGS="-g"}
       : ${F77_WARN_FLAGS="-m0"}
       : ${F90_WARN_FLAGS="-m0"}
       ;;
     nag)
       : ${LIBS="f90 nagfl90 nag m"} 
       F90FLAGS="$F90FLAGS -N140" 
       ;;
     portland)
       : ${LIBS="pgftnrtl pgf90rtl pgf90 pgf90_rpm1 pghpf2 pgc m"}
       : ${LIBDIRS='$(PGI)/linux86/lib'} 
       : ${F77_DEBUG_FLAGS="-g"}
       : ${F90_DEBUG_FLAGS="-g"}
       ;;
     fujitsu)
       : ${LIBS="fj9i6 fj9e6 fj9f6"} 
       ;;
     lahey)
       : ${F77_DEBUG_FLAGS="-g --chk"}
       : ${F90_DEBUG_FLAGS="-g --chk"}
       : ${F77_WARN_FLAGS="--warn"}
       : ${F90_WARN_FLAGS="--warn"}
       : ${F77_OPTIMISE_FLAGS="-O"}
       : ${F90_OPTIMISE_FLAGS="-O"}         
       if test -n "$LAHEY" ; then
         : ${LIBDIRS="$LAHEY/lib"}
       else
         if test -d '/usr/local/lf9555/lib' ; then
	   : ${LIBDIRS="/usr/local/lf9555/lib"}
         elif test -d '/usr/local/lf9560/lib' ; then
	   : ${LIBDIRS="/usr/local/lf9560/lib"}
         fi
       fi
       if test -z "${LIBDIRS}" ; then
         echo "Unable to locate LAHEY installation directory"
         echo "Please configure with LAHEY=... or set LAHEY in your environment"
         exit 2
       fi
       if test -f "${LIBDIRS}/libfccx86_6a.a" ; then
         : ${LIBS="fj9i6 fj9f6 fj9e6 fccx86_6a"}
       else
         : ${LIBS="fj9i6 fj9e6 fj9f6"} 
       fi       
       ;;
     SGI)
       : ${LIBS="fortran ffio m"} 
       ;;
     Intel)
       : ${LIBS="IEPCF90 F90 C m"}
       ;;
     none)
       : ${LIBS="m"} 
       ;;
     *)
       echo Unknown Linux f90 compiler.
       echo Please add appropriate information to 
       echo $srcdir/known-architectures/linux-gnu
       echo and send the updated file to CactusMaint
       echo We will try anyway ...
       ;;
  esac    

# C compiler

  case "$CC" in
    ecc)
      : ${C_DEPEND='$(CC) -M $(CPPFLAGS)'}
      ;;
      *)
      :
      ;;
   esac

#Set the appropriate warning and debugging flags
  case "$CC" in
    gcc)
      : ${C_DEBUG_FLAGS="-g"}
      : ${C_WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-declarations"}
      ;;
    ecc)
      : ${C_DEBUG_FLAGS="-g"}
      : ${C_WARN_FLAGS="-w2"}
      ;;
      *)
      : ${C_DEBUG_FLAGS="-g"}
#      : ${C_WARN_FLAGS="-Wall"}
      ;;
  esac

  case "$CXX" in
    [cg]++)
      : ${CXX_DEBUG_FLAGS="-g"}
      : ${CXX_WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-declarations"}
      ;;
      *)
      : ${CXX_DEBUG_FLAGS="-g"}
#      : ${C_WARN_FLAGS="-Wall"}
      ;;
  esac


# Cache stuff

  if test -z "$L2_CACHELINE_BYTES" ; then
    case "$host_cpu" in 
       i?86)
        L2_CACHELINE_BYTES=32
        echo "Setting L2_CACHELINE_BYTES to $L2_CACHELINE_BYTES"
        ;;
       *)
        echo "Don't know cache size for cpu $host_cpu"
        ;;
     esac
  fi

  if test -z "$L2_CACHE_SIZE" ; then

    if test "x$cross_compiling" = "xno" ; then
      TEMP_CACHE_SIZE="`cat /proc/cpuinfo | perl -nae 'if(m:cache: && ! $dunnit) {print $F[3]; $dunnit=1}'`"
      if test -n "$TEMP_CACHE_SIZE" ; then
        L2_CACHE_SIZE="$TEMP_CACHE_SIZE*1024"
        echo "Setting L2_CACHE_SIZE to $L2_CACHE_SIZE bytes"
      else
        echo "Unable to determine L2 Cache size on this machine. "
      fi
    else
      echo "Cross compiling - unable to determine L2 cache size" 
    fi
  fi

  if test "x$cross_compiling" = "xyes" ; then
    case "$host_cpu" in
      i?86)
        ENDIAN=little
        SIZEOF_LONG_LONG=8
        SIZEOF_LONG_INT=4
        SIZEOF_INT=4
        SIZEOF_SHORT_INT=2

        SIZEOF_LONG_DOUBLE=8
        SIZEOF_DOUBLE=8
        SIZEOF_FLOAT=4

        SIZEOF_POINTER=4
      ;;
      ia64)
        ENDIAN=little
        SIZEOF_LONG_LONG=8
        SIZEOF_LONG_INT=8
        SIZEOF_INT=4
        SIZEOF_SHORT_INT=2

        SIZEOF_LONG_DOUBLE=8
        SIZEOF_DOUBLE=8
        SIZEOF_FLOAT=4

        SIZEOF_POINTER=8
      ;;
      *)
        echo "Don't know details for cross-compilation to $host_cpu"
    esac
  fi

# MPI stuff
#
# Linux has no native MPI, so we don't set any NATIVE_MPI_XXX variables.
# This is caught by lib/make/extras/MPI/NATIVE then.

fi