290 |
} |
} |
291 |
|
|
292 |
|
|
293 |
# Guess possible config options for this host |
# look for possible C compilers |
294 |
find_possible_configs() { |
look_for_C_compilers() { |
295 |
|
echo >> $LOGFILE |
296 |
tmp1=`uname`"_"`uname -m` |
echo "running: look_for_C_compilers()" >> $LOGFILE |
297 |
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
rm -f ./genmake_hello.c ./genmake_hello |
298 |
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
cat >> genmake_hello.c << EOF |
|
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
|
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
|
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
|
|
PLATFORM=$tmp3 |
|
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
|
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
|
|
echo " The platform appears to be: $PLATFORM" |
|
|
|
|
|
echo "test" > test |
|
|
ln -s ./test link |
|
|
RETVAL=$? |
|
|
if test "x${RETVAL}" = x0 ; then |
|
|
LN="ln -s" |
|
|
else |
|
|
echo "Error: \"ln -s\" does not appear to work on this system!" |
|
|
echo " For help, please contact <MITgcm-support@mitgcm.org>." |
|
|
exit 1 |
|
|
fi |
|
|
rm -f test link |
|
|
|
|
|
if test "x$CPP" = x ; then |
|
|
CPP="cpp -traditional -P" |
|
|
fi |
|
|
|
|
|
look_for_makedepend |
|
|
|
|
|
#================================================================ |
|
|
# look for possible C compilers |
|
|
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc" |
|
|
p_CC= |
|
|
for c in $tmp ; do |
|
|
rm -f ./genmake_hello.c ./genmake_hello |
|
|
cat >> genmake_hello.c << EOF |
|
299 |
#include <stdio.h> |
#include <stdio.h> |
300 |
int main(int argc, char **argv) { |
int main(int argc, char **argv) { |
301 |
printf("Hello!\n"); |
printf("Hello!\n"); |
302 |
return 0; |
return 0; |
303 |
} |
} |
304 |
EOF |
EOF |
305 |
$c -o genmake_hello genmake_hello.c > /dev/null 2>&1 |
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc" |
306 |
|
p_CC= |
307 |
|
for c in $tmp ; do |
308 |
|
COMM="$c $CFLAGS -o genmake_hello genmake_hello.c" |
309 |
|
echo $COMM >> $LOGFILE |
310 |
|
$COMM >> $LOGFILE 2>&1 |
311 |
RETVAL=$? |
RETVAL=$? |
312 |
if test "x${RETVAL}" = x0 ; then |
if test "x${RETVAL}" = x0 ; then |
313 |
|
echo " $c test successful" >> $LOGFILE |
314 |
p_CC="$p_CC $c" |
p_CC="$p_CC $c" |
315 |
fi |
fi |
316 |
done |
done |
326 |
EOF |
EOF |
327 |
exit 1 |
exit 1 |
328 |
else |
else |
329 |
echo " The possible C compilers found in your path are:" |
echo " The possible C compilers found in your path are: $p_CC" | tee -a $LOGFILE |
|
echo " "$p_CC |
|
330 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
331 |
CC=`echo $p_CC | $AWK '{print $1}'` |
CC=`echo $p_CC | $AWK '{print $1}'` |
332 |
echo " Setting C compiler to: "$CC |
echo " Setting C compiler to: "$CC |
333 |
fi |
fi |
334 |
fi |
fi |
335 |
|
echo " --> set CC='$CC'" >> $LOGFILE |
336 |
|
} |
337 |
|
|
338 |
|
# Guess possible config options for this host |
339 |
|
find_possible_optfile() { |
340 |
|
|
341 |
|
tmp1=`uname`"_"`uname -m` |
342 |
|
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
343 |
|
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
344 |
|
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
345 |
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
346 |
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
347 |
|
PLATFORM=$tmp3 |
348 |
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
349 |
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
350 |
|
echo " The platform appears to be: $PLATFORM" |
351 |
|
|
352 |
|
# echo "test" > test |
353 |
|
# ln -s ./test link |
354 |
|
# RETVAL=$? |
355 |
|
# if test "x${RETVAL}" = x0 ; then |
356 |
|
# LN="ln -s" |
357 |
|
# else |
358 |
|
# echo "Error: \"ln -s\" does not appear to work on this system!" |
359 |
|
# echo " For help, please contact <MITgcm-support@mitgcm.org>." |
360 |
|
# exit 1 |
361 |
|
# fi |
362 |
|
# rm -f test link |
363 |
|
# |
364 |
|
# if test "x$CPP" = x ; then |
365 |
|
# CPP="cpp -traditional -P" |
366 |
|
# fi |
367 |
|
# |
368 |
|
# look_for_makedepend |
369 |
|
# |
370 |
|
# look_for_C_compilers |
371 |
|
|
372 |
#================================================================ |
#================================================================ |
373 |
# look for possible FORTRAN compilers |
# look for possible FORTRAN compilers |
423 |
echo " I looked for the file "$OPTFILE" but did not find it" |
echo " I looked for the file "$OPTFILE" but did not find it" |
424 |
fi |
fi |
425 |
fi |
fi |
426 |
# echo " The options file: $p_OF" |
|
|
# echo " appears to match so we'll use it." |
|
|
# for i in $p_FC ; do |
|
|
#p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
|
|
#if test -r $p_OF ; then |
|
|
# OPTFILE=$p_OF |
|
|
# echo " The options file: $p_OF" |
|
|
# echo " appears to match so we'll use it." |
|
|
# break |
|
|
#fi |
|
|
# done |
|
427 |
if test "x$OPTFILE" = x ; then |
if test "x$OPTFILE" = x ; then |
428 |
cat 1>&2 <<EOF |
cat 1>&2 <<EOF |
429 |
|
|
654 |
if test ! "x$FC_NAMEMANGLE" = x ; then |
if test ! "x$FC_NAMEMANGLE" = x ; then |
655 |
return 0 |
return 0 |
656 |
fi |
fi |
657 |
echo "running: get_fortran_c_namemangling()" >> $LOGFILE |
echo " running: get_fortran_c_namemangling()" >> $LOGFILE |
658 |
|
|
659 |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
660 |
|
|
661 |
cat > genmake_test.c <<EOF |
cat > genmake_test.c <<EOF |
662 |
void tcall( char * string ) { tsub( string ); } |
void tcall( char * string ) { tsub( string ); } |
663 |
EOF |
EOF |
664 |
$MAKE genmake_test.o >> $LOGFILE 2>&1 |
# $MAKE genmake_test.o >> $LOGFILE 2>&1 |
665 |
|
COMM="$CC $CFLAGS -c genmake_test.c" |
666 |
|
echo ' '$COMM >> $LOGFILE |
667 |
|
$COMM >> $LOGFILE 2>&1 |
668 |
RETVAL=$? |
RETVAL=$? |
669 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
670 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
671 |
cat <<EOF>> $LOGFILE |
cat <<EOF>> $LOGFILE |
672 |
|
|
673 |
WARNING: C test compile fails |
WARNING: C test compile fails |
674 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
675 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
676 |
EOF |
EOF |
677 |
return 1 |
return 1 |
678 |
fi |
fi |
682 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
683 |
cat <<EOF>> $LOGFILE |
cat <<EOF>> $LOGFILE |
684 |
|
|
685 |
WARNING: The "nm" command failed. |
WARNING: The "nm" command failed. |
686 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
687 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
688 |
EOF |
EOF |
689 |
return 1 |
return 1 |
690 |
fi |
fi |
694 |
call tsub( string ) |
call tsub( string ) |
695 |
end |
end |
696 |
EOF |
EOF |
697 |
$FC $FFLAGS -c genmake_tcomp.$FS >> $LOGFILE 2>&1 |
COMM="$FC $FFLAGS -c genmake_tcomp.$FS" |
698 |
|
echo ' '$COMM >> $LOGFILE |
699 |
|
$COMM >> $LOGFILE 2>&1 |
700 |
RETVAL=$? |
RETVAL=$? |
701 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
702 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
703 |
cat <<EOF>> $LOGFILE |
cat <<EOF>> $LOGFILE |
704 |
|
|
705 |
WARNING: FORTRAN test compile fails -- please see '$LOGFILE' |
WARNING: FORTRAN test compile fails -- please see '$LOGFILE' |
706 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
707 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
708 |
EOF |
EOF |
709 |
return 1 |
return 1 |
710 |
fi |
fi |
714 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
715 |
cat <<EOF>> $LOGFILE |
cat <<EOF>> $LOGFILE |
716 |
|
|
717 |
WARNING: The "nm" command failed. |
WARNING: The "nm" command failed. |
718 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
719 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
720 |
EOF |
EOF |
721 |
return 1 |
return 1 |
722 |
fi |
fi |
742 |
|
|
743 |
# cleanup the testing files |
# cleanup the testing files |
744 |
rm -f genmake_tcomp.* genmake_test.* |
rm -f genmake_tcomp.* genmake_test.* |
745 |
|
|
746 |
|
echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE |
747 |
} |
} |
748 |
|
|
749 |
|
|
789 |
DEFINES="$DEFINES -DHAVE_CLOC" |
DEFINES="$DEFINES -DHAVE_CLOC" |
790 |
fi |
fi |
791 |
rm -f genmake_tc* |
rm -f genmake_tc* |
792 |
|
echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE |
793 |
} |
} |
794 |
|
|
795 |
|
|
852 |
DEFINES="$DEFINES -DHAVE_SIGREG" |
DEFINES="$DEFINES -DHAVE_SIGREG" |
853 |
fi |
fi |
854 |
rm -f genmake_tc* |
rm -f genmake_tc* |
855 |
|
echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE |
856 |
} |
} |
857 |
|
|
858 |
|
|
901 |
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
902 |
fi |
fi |
903 |
rm -f genmake_tc* |
rm -f genmake_tc* |
904 |
|
echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE |
905 |
} |
} |
906 |
|
|
907 |
|
|
949 |
DEFINES="$DEFINES -DHAVE_STAT" |
DEFINES="$DEFINES -DHAVE_STAT" |
950 |
fi |
fi |
951 |
rm -f genmake_tc* |
rm -f genmake_tc* |
952 |
|
echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE |
953 |
} |
} |
954 |
|
|
955 |
|
|
1042 |
fi |
fi |
1043 |
fi |
fi |
1044 |
rm -f genmake_tnc* |
rm -f genmake_tnc* |
1045 |
|
echo " --> set HAVE_NETCDF='$HAVE_NETCDF'" >> $LOGFILE |
1046 |
} |
} |
1047 |
|
|
1048 |
|
|
1454 |
if test "x$MITGCM_OF" = x ; then |
if test "x$MITGCM_OF" = x ; then |
1455 |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
1456 |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
1457 |
find_possible_configs |
find_possible_optfile |
1458 |
else |
else |
1459 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
1460 |
fi |
fi |
1524 |
EOF |
EOF |
1525 |
exit 1 |
exit 1 |
1526 |
fi |
fi |
1527 |
|
|
1528 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
1529 |
CC=cc |
look_for_C_compilers |
1530 |
|
# CC=cc |
1531 |
# cat <<EOF 1>&2 |
# cat <<EOF 1>&2 |
1532 |
# Error: no C compiler: please specify using one of the following: |
# Error: no C compiler: please specify using one of the following: |
1533 |
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
1536 |
# EOF |
# EOF |
1537 |
# exit 1 |
# exit 1 |
1538 |
fi |
fi |
1539 |
|
|
1540 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
1541 |
LINK=$FC |
LINK=$FC |
1542 |
fi |
fi |
1544 |
MAKE="make" |
MAKE="make" |
1545 |
fi |
fi |
1546 |
if test "x$CPP" = x ; then |
if test "x$CPP" = x ; then |
1547 |
CPP=cpp |
CPP="cpp -traditional -P" |
1548 |
fi |
fi |
1549 |
#EH3 === UGLY === |
#EH3 === UGLY === |
1550 |
# The following is an ugly little hack to check for $CPP in /lib/ and |
# The following is an ugly little hack to check for $CPP in /lib/ and |
1571 |
else |
else |
1572 |
rm -f test_cpp |
rm -f test_cpp |
1573 |
fi |
fi |
1574 |
|
|
1575 |
look_for_makedepend |
look_for_makedepend |
1576 |
|
|
1577 |
|
# Check that soft-link command is set and usable |
1578 |
if test "x$LN" = x ; then |
if test "x$LN" = x ; then |
1579 |
LN="ln -s" |
LN="ln -s" |
1580 |
fi |
fi |
1584 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
1585 |
cat <<EOF 1>&2 |
cat <<EOF 1>&2 |
1586 |
|
|
1587 |
Error: The command "ln -s" failed -- please specify a working soft-link |
Error: The command "$LN" failed -- please specify a working soft-link |
1588 |
command in the optfile. |
command in the optfile. |
1589 |
|
|
1590 |
EOF |
EOF |
1837 |
done |
done |
1838 |
echo |
echo |
1839 |
|
|
1840 |
if test "x${PLATFORM}" = x ; then |
#if test "x${PLATFORM}" = x ; then |
1841 |
PLATFORM=$p_PLATFORM |
# PLATFORM=$p_PLATFORM |
1842 |
fi |
#fi |
1843 |
|
|
1844 |
if test "x${EXEDIR}" = x ; then |
if test "x${EXEDIR}" = x ; then |
1845 |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |