290 |
} |
} |
291 |
|
|
292 |
|
|
293 |
# Guess possible config options for this host |
# look for possible C compilers |
294 |
find_possible_configs() { |
look_for_C_compilers() { |
|
|
|
|
tmp1=`uname`"_"`uname -m` |
|
|
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
|
|
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
|
|
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 |
|
295 |
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc" |
tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc" |
296 |
p_CC= |
p_CC= |
297 |
for c in $tmp ; do |
for c in $tmp ; do |
328 |
echo " Setting C compiler to: "$CC |
echo " Setting C compiler to: "$CC |
329 |
fi |
fi |
330 |
fi |
fi |
331 |
|
} |
332 |
|
|
333 |
|
# Guess possible config options for this host |
334 |
|
find_possible_optfile() { |
335 |
|
|
336 |
|
tmp1=`uname`"_"`uname -m` |
337 |
|
tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
338 |
|
tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` |
339 |
|
tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` |
340 |
|
tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` |
341 |
|
tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` |
342 |
|
PLATFORM=$tmp3 |
343 |
|
echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 |
344 |
|
OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` |
345 |
|
echo " The platform appears to be: $PLATFORM" |
346 |
|
|
347 |
|
# echo "test" > test |
348 |
|
# ln -s ./test link |
349 |
|
# RETVAL=$? |
350 |
|
# if test "x${RETVAL}" = x0 ; then |
351 |
|
# LN="ln -s" |
352 |
|
# else |
353 |
|
# echo "Error: \"ln -s\" does not appear to work on this system!" |
354 |
|
# echo " For help, please contact <MITgcm-support@mitgcm.org>." |
355 |
|
# exit 1 |
356 |
|
# fi |
357 |
|
# rm -f test link |
358 |
|
# |
359 |
|
# if test "x$CPP" = x ; then |
360 |
|
# CPP="cpp -traditional -P" |
361 |
|
# fi |
362 |
|
# |
363 |
|
# look_for_makedepend |
364 |
|
# |
365 |
|
# look_for_C_compilers |
366 |
|
|
367 |
#================================================================ |
#================================================================ |
368 |
# look for possible FORTRAN compilers |
# look for possible FORTRAN compilers |
418 |
echo " I looked for the file "$OPTFILE" but did not find it" |
echo " I looked for the file "$OPTFILE" but did not find it" |
419 |
fi |
fi |
420 |
fi |
fi |
421 |
# 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 |
|
422 |
if test "x$OPTFILE" = x ; then |
if test "x$OPTFILE" = x ; then |
423 |
cat 1>&2 <<EOF |
cat 1>&2 <<EOF |
424 |
|
|
649 |
if test ! "x$FC_NAMEMANGLE" = x ; then |
if test ! "x$FC_NAMEMANGLE" = x ; then |
650 |
return 0 |
return 0 |
651 |
fi |
fi |
652 |
echo "running: get_fortran_c_namemangling()" >> $LOGFILE |
echo " running: get_fortran_c_namemangling()" >> $LOGFILE |
653 |
|
|
654 |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
default_nm="#define FC_NAMEMANGLE(X) X ## _" |
655 |
|
|
656 |
cat > genmake_test.c <<EOF |
cat > genmake_test.c <<EOF |
657 |
void tcall( char * string ) { tsub( string ); } |
void tcall( char * string ) { tsub( string ); } |
658 |
EOF |
EOF |
659 |
$MAKE genmake_test.o >> $LOGFILE 2>&1 |
# $MAKE genmake_test.o >> $LOGFILE 2>&1 |
660 |
|
COMM="$CC $CFLAGS -c genmake_test.c" |
661 |
|
echo ' '$COMM >> $LOGFILE |
662 |
|
$COMM >> $LOGFILE 2>&1 |
663 |
RETVAL=$? |
RETVAL=$? |
664 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
665 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
666 |
cat <<EOF>> $LOGFILE |
cat <<EOF>> $LOGFILE |
667 |
|
|
668 |
WARNING: C test compile fails |
WARNING: C test compile fails |
669 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
670 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
671 |
EOF |
EOF |
672 |
return 1 |
return 1 |
673 |
fi |
fi |
677 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
678 |
cat <<EOF>> $LOGFILE |
cat <<EOF>> $LOGFILE |
679 |
|
|
680 |
WARNING: The "nm" command failed. |
WARNING: The "nm" command failed. |
681 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
682 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here |
683 |
EOF |
EOF |
684 |
return 1 |
return 1 |
685 |
fi |
fi |
689 |
call tsub( string ) |
call tsub( string ) |
690 |
end |
end |
691 |
EOF |
EOF |
692 |
$FC $FFLAGS -c genmake_tcomp.$FS >> $LOGFILE 2>&1 |
COMM="$FC $FFLAGS -c genmake_tcomp.$FS" |
693 |
|
echo ' '$COMM >> $LOGFILE |
694 |
|
$COMM >> $LOGFILE 2>&1 |
695 |
RETVAL=$? |
RETVAL=$? |
696 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
697 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
698 |
cat <<EOF>> $LOGFILE |
cat <<EOF>> $LOGFILE |
699 |
|
|
700 |
WARNING: FORTRAN test compile fails -- please see '$LOGFILE' |
WARNING: FORTRAN test compile fails -- please see '$LOGFILE' |
701 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
702 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
703 |
EOF |
EOF |
704 |
return 1 |
return 1 |
705 |
fi |
fi |
709 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
710 |
cat <<EOF>> $LOGFILE |
cat <<EOF>> $LOGFILE |
711 |
|
|
712 |
WARNING: The "nm" command failed. |
WARNING: The "nm" command failed. |
713 |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE' |
714 |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here. |
715 |
EOF |
EOF |
716 |
return 1 |
return 1 |
717 |
fi |
fi |
737 |
|
|
738 |
# cleanup the testing files |
# cleanup the testing files |
739 |
rm -f genmake_tcomp.* genmake_test.* |
rm -f genmake_tcomp.* genmake_test.* |
740 |
|
|
741 |
|
echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE |
742 |
} |
} |
743 |
|
|
744 |
|
|
784 |
DEFINES="$DEFINES -DHAVE_CLOC" |
DEFINES="$DEFINES -DHAVE_CLOC" |
785 |
fi |
fi |
786 |
rm -f genmake_tc* |
rm -f genmake_tc* |
787 |
|
echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE |
788 |
} |
} |
789 |
|
|
790 |
|
|
847 |
DEFINES="$DEFINES -DHAVE_SIGREG" |
DEFINES="$DEFINES -DHAVE_SIGREG" |
848 |
fi |
fi |
849 |
rm -f genmake_tc* |
rm -f genmake_tc* |
850 |
|
echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE |
851 |
} |
} |
852 |
|
|
853 |
|
|
896 |
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
897 |
fi |
fi |
898 |
rm -f genmake_tc* |
rm -f genmake_tc* |
899 |
|
echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE |
900 |
} |
} |
901 |
|
|
902 |
|
|
944 |
DEFINES="$DEFINES -DHAVE_STAT" |
DEFINES="$DEFINES -DHAVE_STAT" |
945 |
fi |
fi |
946 |
rm -f genmake_tc* |
rm -f genmake_tc* |
947 |
|
echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE |
948 |
} |
} |
949 |
|
|
950 |
|
|
1037 |
fi |
fi |
1038 |
fi |
fi |
1039 |
rm -f genmake_tnc* |
rm -f genmake_tnc* |
1040 |
|
echo " --> set HAVE_NETCDF='$HAVE_NETCDF'" >> $LOGFILE |
1041 |
} |
} |
1042 |
|
|
1043 |
|
|
1449 |
if test "x$MITGCM_OF" = x ; then |
if test "x$MITGCM_OF" = x ; then |
1450 |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
1451 |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
1452 |
find_possible_configs |
find_possible_optfile |
1453 |
else |
else |
1454 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
1455 |
fi |
fi |
1519 |
EOF |
EOF |
1520 |
exit 1 |
exit 1 |
1521 |
fi |
fi |
1522 |
|
|
1523 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
1524 |
CC=cc |
look_for_C_compilers |
1525 |
|
# CC=cc |
1526 |
# cat <<EOF 1>&2 |
# cat <<EOF 1>&2 |
1527 |
# Error: no C compiler: please specify using one of the following: |
# Error: no C compiler: please specify using one of the following: |
1528 |
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" |
1531 |
# EOF |
# EOF |
1532 |
# exit 1 |
# exit 1 |
1533 |
fi |
fi |
1534 |
|
|
1535 |
if test "x$LINK" = x ; then |
if test "x$LINK" = x ; then |
1536 |
LINK=$FC |
LINK=$FC |
1537 |
fi |
fi |
1539 |
MAKE="make" |
MAKE="make" |
1540 |
fi |
fi |
1541 |
if test "x$CPP" = x ; then |
if test "x$CPP" = x ; then |
1542 |
CPP=cpp |
CPP="cpp -traditional -P" |
1543 |
fi |
fi |
1544 |
#EH3 === UGLY === |
#EH3 === UGLY === |
1545 |
# 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 |
1566 |
else |
else |
1567 |
rm -f test_cpp |
rm -f test_cpp |
1568 |
fi |
fi |
1569 |
|
|
1570 |
look_for_makedepend |
look_for_makedepend |
1571 |
|
|
1572 |
|
# Check that soft-link command is set and usable |
1573 |
if test "x$LN" = x ; then |
if test "x$LN" = x ; then |
1574 |
LN="ln -s" |
LN="ln -s" |
1575 |
fi |
fi |
1579 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
1580 |
cat <<EOF 1>&2 |
cat <<EOF 1>&2 |
1581 |
|
|
1582 |
Error: The command "ln -s" failed -- please specify a working soft-link |
Error: The command "$LN" failed -- please specify a working soft-link |
1583 |
command in the optfile. |
command in the optfile. |
1584 |
|
|
1585 |
EOF |
EOF |
1832 |
done |
done |
1833 |
echo |
echo |
1834 |
|
|
1835 |
if test "x${PLATFORM}" = x ; then |
#if test "x${PLATFORM}" = x ; then |
1836 |
PLATFORM=$p_PLATFORM |
# PLATFORM=$p_PLATFORM |
1837 |
fi |
#fi |
1838 |
|
|
1839 |
if test "x${EXEDIR}" = x ; then |
if test "x${EXEDIR}" = x ; then |
1840 |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |
tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` |