/[MITgcm]/MITgcm/tools/suggest_optfile_names
ViewVC logotype

Annotation of /MITgcm/tools/suggest_optfile_names

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Fri Jul 30 20:53:25 2004 UTC (19 years, 8 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint58l_post, checkpoint64z, checkpoint57t_post, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint57o_post, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint58e_post, mitgcm_mapl_00, checkpoint58u_post, checkpoint58w_post, checkpoint57m_post, checkpoint55c_post, checkpoint54e_post, checkpoint57s_post, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint57k_post, checkpoint55d_pre, checkpoint57d_post, checkpoint57g_post, checkpoint64, checkpoint65, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint57b_post, checkpoint57c_pre, checkpoint58r_post, checkpoint55j_post, checkpoint56b_post, checkpoint57i_post, checkpoint57y_post, checkpoint57e_post, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint55h_post, checkpoint58n_post, checkpoint58x_post, checkpoint57g_pre, checkpoint55b_post, checkpoint58t_post, checkpoint58h_post, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint56c_post, checkpoint57y_pre, checkpoint55, checkpoint57f_pre, checkpoint57a_post, checkpoint58q_post, checkpoint54f_post, checkpoint57v_post, checkpoint59q, checkpoint59p, checkpoint55g_post, checkpoint59r, checkpoint58j_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint55f_post, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint57r_post, checkpoint59, checkpoint58, checkpoint57a_pre, checkpoint55i_post, checkpoint57, checkpoint56, eckpoint57e_pre, checkpoint57h_done, checkpoint58f_post, checkpoint57x_post, checkpoint57n_post, checkpoint58d_post, checkpoint58c_post, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint57f_post, checkpoint58a_post, checkpoint58i_post, checkpoint57q_post, checkpoint58g_post, checkpoint58o_post, checkpoint57z_post, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint57c_post, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint58y_post, checkpoint55e_post, checkpoint58k_post, checkpoint58v_post, checkpoint55a_post, checkpoint58s_post, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint58p_post, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint57j_post, checkpoint61z, checkpoint61x, checkpoint61y, checkpoint58b_post, checkpoint57h_pre, checkpoint58m_post, checkpoint57l_post, checkpoint57h_post, checkpoint56a_post, checkpoint55d_post, HEAD
Changes since 1.1: +1 -0 lines
 o first (small) steps towards cleaning up the optfiles

1 edhill 1.1 #! /usr/bin/env bash
2     #
3     #
4    
5     look_for_makedepend() {
6    
7     # The "original" makedepend is part of the Imake system that is
8     # most often distributed with XFree86 or with an XFree86 source
9     # package. As a result, many machines (eg. generic Linux) do not
10     # have a system-default "makedepend" available. For those
11     # systems, we have two fall-back options:
12     #
13     # 1) a makedepend implementation shipped with the cyrus-imapd
14     # package: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
15     #
16     # 2) a known-buggy xmakedpend shell script
17     #
18     # So the choices are, in order:
19     #
20     # 1) use the user-specified program
21     # 2) use a system-wide default
22     # 3) locally build and use the cyrus implementation
23     # 4) fall back to the buggy local xmakedpend script
24     #
25     if test "x${MAKEDEPEND}" = x ; then
26     which makedepend > /dev/null 2>&1
27     RV0=$?
28     cat <<EOF >> genmake_tc.f
29     program test
30     write(*,*) 'test'
31     stop
32     end
33     EOF
34     makedepend genmake_tc.f > /dev/null 2>&1
35     RV1=$?
36     if test "x${RV0}${RV1}" = x00 ; then
37     MAKEDEPEND=makedepend
38     else
39     echo " a system-default makedepend was not found."
40    
41     # Try to build the cyrus implementation
42     build_cyrus_makedepend
43     RETVAL=$?
44     if test "x$RETVAL" != x0 ; then
45     MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
46     fi
47     rm -f ./genmake_cy_md
48     fi
49     else
50     # echo "MAKEDEPEND=${MAKEDEPEND}"
51     echo "${MAKEDEPEND}" | grep -i cyrus > /dev/null 2>&1
52     RETVAL=$?
53     if test x"$RETVAL" = x0 ; then
54     build_cyrus_makedepend
55     fi
56     fi
57 edhill 1.2 rm -f genmake_tc*
58 edhill 1.1 }
59    
60    
61     build_cyrus_makedepend() {
62     rm -f ./genmake_cy_md
63     (
64     cd $ROOTDIR/tools/cyrus-imapd-makedepend \
65     && ./configure > /dev/null 2>&1 \
66     && make > /dev/null 2>&1
67     if test -x ./makedepend.exe ; then
68     $LN ./makedepend.exe ./makedepend
69     fi
70     ./makedepend ifparser.c > /dev/null 2>&1 \
71     && echo "true"
72     ) > ./genmake_cy_md
73     grep true ./genmake_cy_md > /dev/null 2>&1
74     RETVAL=$?
75     rm -f ./genmake_cy_md
76     if test "x$RETVAL" = x0 ; then
77     MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend'
78     return 0
79     else
80     echo "WARNING: unable to build cyrus-imapd-makedepend"
81     return 1
82     fi
83     }
84    
85    
86     find_possible_configs() {
87    
88     tmp1=`uname`"_"`uname -m`
89     tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
90     tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
91     tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`
92     tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
93     tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`
94     PLATFORM=$tmp3
95     echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32
96     OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
97     echo " The platform appears to be: $PLATFORM"
98    
99     echo "test" > test
100     ln -s ./test link
101     RETVAL=$?
102     if test "x${RETVAL}" = x0 ; then
103     LN="ln -s"
104     else
105     echo "Error: \"ln -s\" does not appear to work on this system!"
106     echo " For help, please contact <MITgcm-support@mitgcm.org>."
107     exit 1
108     fi
109     rm -f test link
110    
111     if test "x$CPP" = x ; then
112     CPP="cpp -traditional -P"
113     fi
114    
115     look_for_makedepend
116    
117     #================================================================
118     # look for possible C compilers
119     tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc"
120     p_CC=
121     for c in $tmp ; do
122     rm -f ./genmake_hello.c ./genmake_hello
123     cat >> genmake_hello.c << EOF
124     #include <stdio.h>
125     int main(int argc, char **argv) {
126     printf("Hello!\n");
127     return 0;
128     }
129     EOF
130     $c -o genmake_hello genmake_hello.c > /dev/null 2>&1
131     RETVAL=$?
132     if test "x${RETVAL}" = x0 ; then
133     p_CC="$p_CC $c"
134     fi
135     done
136     rm -f ./genmake_hello.c ./genmake_hello
137     if test "x${p_CC}" = x ; then
138     cat 1>&2 <<EOF
139    
140     Error: No C compilers were found in your path. Please specify one using:
141    
142     1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"),
143     2) the CC or MITGCM_CC environment variables.
144    
145     EOF
146     exit 1
147     else
148     echo " The possible C compilers found in your path are:"
149     echo " "$p_CC
150     if test "x$CC" = x ; then
151     CC=`echo $p_CC | $AWK '{print $1}'`
152     echo " Setting C compiler to: "$CC
153     fi
154     fi
155    
156     #================================================================
157     # look for possible FORTRAN compilers
158     tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95"
159     p_FC=
160     for c in $tmp ; do
161     rm -f ./hello.f ./hello
162     cat >> hello.f <<EOF
163     program hello
164     do i=1,3
165     print *, 'hello world : ', i
166     enddo
167     end
168     EOF
169     $c -o hello hello.f > /dev/null 2>&1
170     RETVAL=$?
171     if test "x${RETVAL}" = x0 ; then
172     p_FC="$p_FC $c"
173     fi
174     done
175     rm -f ./hello.f ./hello
176     if test "x${p_FC}" = x ; then
177     cat 1>&2 <<EOF
178    
179     Error: No Fortran compilers were found in your path. Please specify one using:
180    
181     1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"),
182     2) a command-line option (eg. "-fc NAME"), or
183     3) the FC or MITGCM_FC environment variables.
184    
185     EOF
186     exit 1
187     else
188     echo " The possible FORTRAN compilers found in your path are:"
189     echo " "$p_FC
190     if test "x$FC" = x ; then
191     FC=`echo $p_FC | $AWK '{print $1}'`
192     echo " Setting FORTRAN compiler to: "$FC
193     fi
194     fi
195    
196     if test "x$OPTFILE" = x ; then
197     OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$FC
198     if test ! -r $OPTFILE ; then
199     echo " I looked for the file "$OPTFILE" but did not find it"
200     fi
201     fi
202     if test "x$OPTFILE" = x ; then
203     cat 1>&2 <<EOF
204    
205     Error: No options file was found in: $ROOTDIR/tools/build_options/
206     that matches this platform ("$PLATFORM") and the compilers found in
207     your path. Please specify an "optfile" using:
208    
209     1) the command line (eg. "-optfile=path/to/OPTFILE"), or
210     2) the MITGCM_OF environment variable.
211    
212     If you need help, please contact the developers at <MITgcm-support@mitgcm.org>.
213    
214     EOF
215     exit 1
216     fi
217    
218     }
219    
220    
221     AWK=awk
222    
223     if test "x${ROOTDIR}" = x ; then
224     tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'`
225     if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then
226     ROOTDIR=".."
227     else
228     for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do
229     if test -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ; then
230     ROOTDIR=$d
231     printf "Warning: ROOTDIR unspecified but there appears to be"
232     echo " a copy of MITgcm at \"$ROOTDIR\""
233     break
234     fi
235     done
236     fi
237     fi
238    
239     tmp1=`uname`"_"`uname -m`
240     tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
241     tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
242     tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`
243     tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
244     tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`
245     PLATFORM=$tmp3
246     echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32
247     echo " The platform appears to be: $PLATFORM"
248     echo " And possible optfiles are: "
249     OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
250     for i in $OFLIST ; do
251     echo " $i"
252     done
253    
254     find_possible_configs
255    
256     echo
257     echo " The default optfile is: "$PLATFORM"_"$FC
258    

  ViewVC Help
Powered by ViewVC 1.1.22