summaryrefslogtreecommitdiff
path: root/lib/make/known-architectures/irix
blob: 3cc7a586340fe11193fd62790f0fc68280cd9202 (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
#! /bin/sh
#  /*@@
#    @file      irix
#    @date      Thu Feb 25 12:20:53 1999
#    @author    Tom Goodale
#    @desc
#               Known architectures file for SGI Irix systems
#    @enddesc
#    @version   $Header: /mnt/data2/cvs2svn/cvs-repositories/Cactus/lib/make/known-architectures/irix,v 1.41 2004-07-05 16:11:50 tradke Exp $
#  @@*/

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

  # extract the CPU type from hinv output
  # (assumes all processors are of equal type :-)
  IRIX_CPU="`hinv -t cpu | tail -1 | sed 's/^[^R]*R\([01-9]*\).*$/\1/'`"

  if test -z "$IRIX_BITS" ; then
    if test -n "`uname | grep 64`" ; then
       IRIX_BITS=64
    else
       IRIX_BITS=32
    fi
  fi

  # use the Cactus preprocessor for Fortran
  if test -z "$FPP"; then
    FPP='$(PERL) $(CCTK_HOME)/lib/sbin/cpp.pl'
    echo Setting FPP to $FPP
  fi

  # use the native SGI compilers by default
  if test -z "$CC"; then
    CC='cc'
    echo Setting C compiler to $CC
  fi

  if test -z "$CXX"; then
    CXX='CC'
    echo Setting C++ compiler to $CXX
  fi

  if test -z "$LD"; then
    LD='CC'
    echo Setting linker to $LD
  fi


else


  # Find out which version of the C++ compiler is installed
  IRIX_CVERSION="`versions c++_dev | grep , | tail -1 | sed 's:.*, ::'`"

  IRIX_CMAJ="`echo $IRIX_CVERSION | sed 's:\([^. ]*\)\.\([^. ]*\).*:\1:'`"
  IRIX_CMIN="`echo $IRIX_CVERSION | sed 's:\([^. ]*\)\.\([^. ]*\).*:\2:'`"

  if test $IRIX_CMAJ -gt 7 -o \( $IRIX_CMAJ -eq 7 -a $IRIX_CMIN -gt 2 \) ; then
    IRIX_CCOMP='new'
  else
    IRIX_CCOMP='old'
  fi

  case "$IRIX_CPU" in
    4???)
       IRIX_FLAGS='-mips3' ;;
    8???)
       IRIX_FLAGS='-mips3' ;;
    10???)
       IRIX_FLAGS='-mips4 -r10000' ;;
    12???)
       if test $IRIX_CCOMP = 'old'; then
         IRIX_FLAGS='-mips4 -r10000'
       else
         IRIX_FLAGS='-mips4 -r12000'
       fi
       ;;
    *)
       IRIX_FLAGS='-mips4' ;;
  esac

  # Find out which version of the Fortran compilers is installed
  IRIX_FVERSION="`versions ftn_dev | grep , | tail -1 | sed 's:.*, ::'`"

  IRIX_FMAJ="`echo $IRIX_FVERSION | sed 's:\([^. ]*\)\.\([^. ]*\).*:\1:'`"
  IRIX_FMIN="`echo $IRIX_FVERSION | sed 's:\([^. ]*\)\.\([^. ]*\).*:\2:'`"

  if test $IRIX_FMAJ -gt 7 -o \( $IRIX_FMAJ -eq 7 -a $IRIX_FMIN -ge 2 \) ; then
    IRIX_FLIBS='fortran ftn ftn90'
  else
    IRIX_FLIBS='ftn ftn90'
  fi

  # now set the compiler flags
  if test $IRIX_BITS = 64; then
    IRIX_BITS_FLAG='-64'
    : ${F90FLAGS="-r10000 -TARG:proc=r10000 $IRIX_BITS_FLAG -mips4"}
    : ${LIBS="malloc perfex fpe $IRIX_FLIBS m"}

    # Reduce the optimization level for debug configurations down to 1.
    # This is necessary in order to prevent the compiler from generating
    # conditional load/store ops which may cause problems on array accesses
    # which have been passed in from C to Fortran as a NULL pointer.
    if test -n "$DEBUG" -a "x$DEBUG" != 'xno' ; then
      : ${F90_OPTIMISE_FLAGS='-O1 -OPT:roundoff=3:IEEE_arithmetic=3:const_copy_limit=100000'}
    else
      : ${F90_OPTIMISE_FLAGS='-O3 -OPT:roundoff=3:IEEE_arithmetic=3:const_copy_limit=100000'}
    fi
  else
    IRIX_BITS_FLAG='-n32'
    : ${F90FLAGS="$IRIX_BITS_FLAG -mips3"}
    : ${LIBS="malloc fpe $IRIX_FLIBS m"}

    # Reduce the optimization level for debug configurations down to 1.
    # This is necessary in order to prevent the compiler from generating
    # conditional load/store ops which may cause problems on array accesses
    # which have been passed in from C to Fortran as a NULL pointer.
    if test -n "$DEBUG" -a "x$DEBUG" != 'xno' ; then
      : ${F90_OPTIMISE_FLAGS='-O1 -OPT:roundoff=3:IEEE_arithmetic=3:fold_arith_limit=10000:const_copy_limit=100000'}
    else
      : ${F90_OPTIMISE_FLAGS='-O3 -OPT:roundoff=3:IEEE_arithmetic=3:fold_arith_limit=10000:const_copy_limit=100000'}
    fi
  fi

  if test "`basename $CC`" = 'cc'; then
    : ${CFLAGS="$IRIX_BITS_FLAG $IRIX_FLAGS"}
    : ${C_OPTIMISE_FLAGS='-O3 -INLINE -OPT:Olimit=100000'}
    : ${C_DEBUG_FLAGS='-g3'}
    : ${C_WARN_FLAGS='-fullwarn'}
  fi
  if test "`basename $CXX`" = 'CC'; then
    # switch off automatic template instantiation
    : ${CXXFLAGS="-no_auto_include -ptused $IRIX_BITS_FLAG $IRIX_FLAGS"}
    : ${CXX_OPTIMISE_FLAGS='-O3 -INLINE -OPT:Olimit=100000'}
    : ${CXX_DEBUG_FLAGS='-g3'}
    : ${CXX_WARN_FLAGS='-fullwarn'}
  fi
  if test "`basename $LD`" = 'CC'; then
    : ${LDFLAGS="$IRIX_BITS_FLAG -Wl,\"-woff 84\",\"-woff 85\""}
  fi

  : ${F77FLAGS="$F90FLAGS"}
  : ${F77_OPTIMISE_FLAGS="$F90_OPTIMISE_FLAGS"}
  : ${F90_DEBUG_FLAGS='-g3'}
  : ${F77_DEBUG_FLAGS='-g3'}
  : ${F90_WARN_FLAGS='-fullwarn'}
  : ${F77_WARN_FLAGS='-fullwarn'}

  # Cache stuff
  if test -z "$CACHELINE_BYTES" ; then
    CACHELINE_BYTES=128
    echo "Setting CACHELINE_BYTES to $CACHELINE_BYTES"
  fi

  if test -z "$CACHE_SIZE" ; then
    TEMP_CACHE_SIZE="`hinv | perl -ne 'if (m/Secondary.*cache/) { s/^.*: (.*)( on P.*)?$/$1/ ; s/ Mbyte.*/\*1024/ ; s/ Kbyte.*//; print}' | sort | head -n1`"
    if test -n "$TEMP_CACHE_SIZE" ; then
      CACHE_SIZE="$TEMP_CACHE_SIZE*1024"
      echo "Setting CACHE_SIZE to $CACHE_SIZE bytes"
    else
      echo 'Unable to determine Cache size on this machine.'
    fi
  fi

  # MPI stuff
  if test -n "$MPI" ; then
    if test -e "/usr/lib${IRIX_BITS}/libmpi++.so" ; then
      NATIVE_MPI_LIBS='mpi mpi++'
    else
      NATIVE_MPI_LIBS='mpi'
    fi
  fi

fi