321 |
|
|
322 |
#================================================================ |
#================================================================ |
323 |
# look for possible FORTRAN compilers |
# look for possible FORTRAN compilers |
324 |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" |
tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 gfortran" |
325 |
p_FC= |
p_FC= |
326 |
for c in $tmp ; do |
for c in $tmp ; do |
327 |
rm -f ./hello.f ./hello |
rm -f ./hello.f ./hello |
527 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
528 |
is being used. |
is being used. |
529 |
|
|
530 |
|
-ts | --ts |
531 |
|
Produce timing information per timestep |
532 |
|
|
533 |
-mpi | --mpi |
-mpi | --mpi |
534 |
Include MPI header files and link to MPI libraries |
Include MPI header files and link to MPI libraries |
535 |
-mpi=PATH | --mpi=PATH |
-mpi=PATH | --mpi=PATH |
671 |
RET_C=$? |
RET_C=$? |
672 |
cat <<EOF > genmake_tc_2.$FS |
cat <<EOF > genmake_tc_2.$FS |
673 |
program hello |
program hello |
674 |
Real*8 wtime |
REAL*8 wtime |
675 |
external cloc |
external cloc |
676 |
call cloc(wtime) |
call cloc(wtime) |
677 |
print *," HELLO WORLD", wtime |
print *," HELLO WORLD", wtime |
678 |
end program hello |
end |
679 |
EOF |
EOF |
680 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
681 |
RET_F=$? |
RET_F=$? |
689 |
} |
} |
690 |
|
|
691 |
|
|
692 |
|
check_HAVE_SETRLSTK() { |
693 |
|
get_fortran_c_namemangling |
694 |
|
cat <<EOF > genmake_tc_1.c |
695 |
|
$FC_NAMEMANGLE |
696 |
|
#include <sys/time.h> |
697 |
|
#include <sys/resource.h> |
698 |
|
#include <unistd.h> |
699 |
|
void FC_NAMEMANGLE(setrlstk) () |
700 |
|
{ |
701 |
|
struct rlimit rls; |
702 |
|
rls.rlim_cur = RLIM_INFINITY; |
703 |
|
rls.rlim_max = RLIM_INFINITY; |
704 |
|
setrlimit(RLIMIT_STACK, &rls); |
705 |
|
return; |
706 |
|
} |
707 |
|
EOF |
708 |
|
make genmake_tc_1.o >> genmake_warnings 2>&1 |
709 |
|
RET_C=$? |
710 |
|
cat <<EOF > genmake_tc_2.$FS |
711 |
|
program hello |
712 |
|
external setrlstk |
713 |
|
call setrlstk() |
714 |
|
end |
715 |
|
EOF |
716 |
|
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
717 |
|
RET_F=$? |
718 |
|
test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 |
719 |
|
RETVAL=$? |
720 |
|
if test "x$RETVAL" = x0 ; then |
721 |
|
HAVE_SETRLSTK=t |
722 |
|
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
723 |
|
fi |
724 |
|
rm -f genmake_tc* |
725 |
|
} |
726 |
|
|
727 |
|
|
728 |
check_HAVE_STAT() { |
check_HAVE_STAT() { |
729 |
get_fortran_c_namemangling |
get_fortran_c_namemangling |
730 |
cat <<EOF > genmake_tc_1.c |
cat <<EOF > genmake_tc_1.c |
753 |
integer nbyte |
integer nbyte |
754 |
call tfsize(nbyte) |
call tfsize(nbyte) |
755 |
print *," HELLO WORLD", nbyte |
print *," HELLO WORLD", nbyte |
756 |
end program hello |
end |
757 |
EOF |
EOF |
758 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 |
759 |
RET_F=$? |
RET_F=$? |
873 |
NOOPTFLAGS= |
NOOPTFLAGS= |
874 |
MPI= |
MPI= |
875 |
MPIPATH= |
MPIPATH= |
876 |
|
TS= |
877 |
|
|
878 |
# DEFINES checked by test compilation |
# DEFINES checked by test compilation or command-line |
879 |
HAVE_SYSTEM= |
HAVE_SYSTEM= |
880 |
HAVE_FDATE= |
HAVE_FDATE= |
881 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
882 |
HAVE_CLOC= |
HAVE_CLOC= |
883 |
|
HAVE_SETRLSTK= |
884 |
HAVE_STAT= |
HAVE_STAT= |
885 |
HAVE_NETCDF= |
HAVE_NETCDF= |
886 |
HAVE_ETIME= |
HAVE_ETIME= |
887 |
|
IGNORE_TIME= |
888 |
|
|
889 |
MODS= |
MODS= |
890 |
TOOLSDIR= |
TOOLSDIR= |
930 |
|
|
931 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
932 |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
933 |
gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS" |
gm_s2="FC CPP IEEE TS MPI JAM DUMPSTATE STANDARDDIRS" |
934 |
|
|
935 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
936 |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
1110 |
-noieee | --noieee) |
-noieee | --noieee) |
1111 |
IEEE= ;; |
IEEE= ;; |
1112 |
|
|
1113 |
|
-ts | --ts) |
1114 |
|
TS=true ;; |
1115 |
|
|
1116 |
-mpi | --mpi) |
-mpi | --mpi) |
1117 |
MPI=true ;; |
MPI=true ;; |
1118 |
-mpi=* | --mpi=*) |
-mpi=* | --mpi=*) |
1136 |
ac_prev=TAMC_EXTRA ;; |
ac_prev=TAMC_EXTRA ;; |
1137 |
-tamc_extra=* | --tamc_extra=*) |
-tamc_extra=* | --tamc_extra=*) |
1138 |
TAMC_EXTRA=$ac_optarg ;; |
TAMC_EXTRA=$ac_optarg ;; |
1139 |
|
|
1140 |
|
-ignoretime | -ignore_time | --ignoretime | --ignore_time) |
1141 |
|
IGNORE_TIME="-DIGNORE_TIME" ;; |
1142 |
|
|
1143 |
-*) |
-*) |
1144 |
echo "Error: unrecognized option: "$ac_option |
echo "Error: unrecognized option: "$ac_option |
1196 |
|
|
1197 |
# Find the MITgcm ${THISVER} |
# Find the MITgcm ${THISVER} |
1198 |
if test -f "${ROOTDIR}/doc/tag-index" ; then |
if test -f "${ROOTDIR}/doc/tag-index" ; then |
1199 |
THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1` |
THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1` |
1200 |
fi |
fi |
1201 |
|
|
1202 |
if test "x$MAKEFILE" = x ; then |
if test "x$MAKEFILE" = x ; then |
1348 |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
1349 |
fi |
fi |
1350 |
|
|
1351 |
|
if test ! "x$TS" = x ; then |
1352 |
|
echo " Turning on timing per timestep" |
1353 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP" |
1354 |
|
fi |
1355 |
|
|
1356 |
printf "\n=== Checking system libraries ===\n" |
printf "\n=== Checking system libraries ===\n" |
1357 |
printf " Do we have the system() command using $FC... " |
printf " Do we have the system() command using $FC... " |
1358 |
cat > genmake_tcomp.$FS <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1375 |
printf " Do we have the fdate() command using $FC... " |
printf " Do we have the fdate() command using $FC... " |
1376 |
cat > genmake_tcomp.$FS <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1377 |
program hello |
program hello |
1378 |
CHARACTER(128) string |
CHARACTER*(128) string |
1379 |
string = ' ' |
string = ' ' |
1380 |
call fdate( string ) |
call fdate( string ) |
1381 |
print *, string |
print *, string |
1424 |
fi |
fi |
1425 |
rm -f genmake_t* |
rm -f genmake_t* |
1426 |
|
|
1427 |
|
printf " Can we unlimit the stack size using $FC... " |
1428 |
|
check_HAVE_SETRLSTK |
1429 |
|
if test "x$HAVE_SETRLSTK" != x ; then |
1430 |
|
echo "yes" |
1431 |
|
else |
1432 |
|
echo "no" |
1433 |
|
fi |
1434 |
|
rm -f genmake_t* |
1435 |
|
|
1436 |
printf " Can we use stat() through C calls... " |
printf " Can we use stat() through C calls... " |
1437 |
check_HAVE_STAT |
check_HAVE_STAT |
1438 |
if test "x$HAVE_STAT" != x ; then |
if test "x$HAVE_STAT" != x ; then |
1449 |
else |
else |
1450 |
echo "no" |
echo "no" |
1451 |
fi |
fi |
1452 |
|
DEFINES="$DEFINES $IGNORE_TIME" |
1453 |
|
|
1454 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
1455 |
printf " Adding MODS directories: " |
printf " Adding MODS directories: " |
2087 |
cat ad_flow_files.inc >> $MAKEFILE |
cat ad_flow_files.inc >> $MAKEFILE |
2088 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2089 |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
2090 |
echo 'F90FILES = $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE |
echo 'F90FILES = $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE |
2091 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
2092 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2093 |
echo '.SUFFIXES:' >> $MAKEFILE |
echo '.SUFFIXES:' >> $MAKEFILE |