/[MITgcm]/MITgcm/tools/genmake2
ViewVC logotype

Diff of /MITgcm/tools/genmake2

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

revision 1.90 by edhill, Tue Jul 27 20:59:19 2004 UTC revision 1.91 by edhill, Fri Jul 30 14:31:40 2004 UTC
# Line 269  find_possible_configs()  { Line 269  find_possible_configs()  {
269    
270      look_for_makedepend      look_for_makedepend
271    
272      # look for possible fortran compilers      #================================================================
273        #  look for possible C compilers
274        tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc"
275        p_CC=
276        for c in $tmp ; do
277            rm -f ./genmake_hello.c  ./genmake_hello
278            cat >> genmake_hello.c << EOF
279    #include <stdio.h>
280    int main(int argc, char **argv) {
281      printf("Hello!\n");
282      return 0;
283    }
284    EOF
285            $c -o genmake_hello genmake_hello.c > /dev/null 2>&1
286            RETVAL=$?
287            if test "x${RETVAL}" = x0 ; then
288                p_CC="$p_CC $c"
289            fi
290        done
291        rm -f ./genmake_hello.c ./genmake_hello
292        if test "x${p_CC}" = x ; then
293            cat 1>&2 <<EOF
294    
295    Error: No C compilers were found in your path.  Please specify one using:
296    
297        1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"),
298        2) the CC or MITGCM_CC environment variables.
299    
300    EOF
301            exit 1
302        else
303            echo "  The possible C compilers found in your path are:"
304            echo "   "$p_CC
305            if test "x$CC" = x ; then
306                CC=`echo $p_CC | $AWK '{print $1}'`
307                echo "  Setting C compiler to: "$CC
308            fi
309        fi
310    
311        #================================================================
312        #  look for possible FORTRAN compilers
313      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"
314      p_FC=      p_FC=
315      for c in $tmp ; do      for c in $tmp ; do
# Line 295  Error: No Fortran compilers were found i Line 335  Error: No Fortran compilers were found i
335    
336      1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"),      1) an "optfile" on (eg. "-optfile=path/to/OPTFILE"),
337      2) a command-line option (eg. "-fc NAME"), or      2) a command-line option (eg. "-fc NAME"), or
338      3) the MITGCM_FC environment variable.      3) the FC or MITGCM_FC environment variables.
339    
340  EOF  EOF
341          exit 1          exit 1
# Line 466  Usage: "$0" [OPTIONS] Line 506  Usage: "$0" [OPTIONS]
506            will search for a working compiler by trying a list of            will search for a working compiler by trying a list of
507            "usual suspects" such as g77, f77, etc.            "usual suspects" such as g77, f77, etc.
508    
509        -cc NAME | --cc NAME | -cc=NAME | --cc=NAME
510              Use "NAME" as the C compiler.  By default, genmake
511              will search for a working compiler by trying a list of
512              "usual suspects" such as gcc, c89, cc, etc.
513    
514      -[no]ieee | --[no]ieee      -[no]ieee | --[no]ieee
515            Do or don't use IEEE numerics.  Note that this option            Do or don't use IEEE numerics.  Note that this option
516            *only* works if it is supported by the OPTFILE that            *only* works if it is supported by the OPTFILE that
# Line 524  WARNING: Please contact <MITgcm-support@ Line 569  WARNING: Please contact <MITgcm-support@
569  EOF  EOF
570          return 1          return 1
571      fi      fi
572      c_tcall=`nm genmake_test.o | grep 'T ' | grep tcall | cut -d ' ' -f 3`      c_tcall=`nm genmake_test.o 2>/dev/null | grep 'T ' | grep tcall | cut -d ' ' -f 3`
573      RETVAL=$?      RETVAL=$?
574      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
575          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
# Line 554  WARNING: Please contact <MITgcm-support@ Line 599  WARNING: Please contact <MITgcm-support@
599  EOF  EOF
600          return 1          return 1
601      fi      fi
602      f_tcall=`nm genmake_tcomp.o | grep 'T ' | grep tcall | cut -d ' ' -f 3`      f_tcall=`nm genmake_tcomp.o 2>/dev/null | grep 'T ' | grep tcall | cut -d ' ' -f 3`
603      RETVAL=$?      RETVAL=$?
604      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
605          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
# Line 631  EOF Line 676  EOF
676    
677    
678  check_netcdf_libs()  {  check_netcdf_libs()  {
679        echo "" > genmake_tnc.log
680      cat <<EOF > genmake_tnc.for      cat <<EOF > genmake_tnc.for
681        program fgennc        program fgennc
682  #include "netcdf.inc"  #include "netcdf.inc"
# Line 644  check_netcdf_libs()  { Line 690  check_netcdf_libs()  {
690        end        end
691  EOF  EOF
692      #echo "$CPP $DEFINES $INCLUDES"      #echo "$CPP $DEFINES $INCLUDES"
693      $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f  \      $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null  \
694          &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1          &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1
695      RET_COMPILE=$?      RET_COMPILE=$?
696      test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1      test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
# Line 653  EOF Line 699  EOF
699          HAVE_NETCDF=t          HAVE_NETCDF=t
700      else      else
701          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
702          $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f  \          $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null  \
703              &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \              &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \
704              $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1              $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1
705          RET_COMPILE=$?          RET_COMPILE=$?
# Line 683  LN= Line 729  LN=
729  S64=  S64=
730  KPP=  KPP=
731  FC=  FC=
732    CC=
733  CPP=  CPP=
734  LINK=  LINK=
735  DEFINES=  DEFINES=
# Line 913  for ac_option in $@ ; do Line 960  for ac_option in $@ ; do
960  #               ac_prev=cpp ;;  #               ac_prev=cpp ;;
961  #           -cpp=* | --cpp=*)  #           -cpp=* | --cpp=*)
962  #               CPP=$ac_optarg ;;  #               CPP=$ac_optarg ;;
963                        
964            -cc | --cc)
965                ac_prev=CC ;;
966            -cc=* | --cc=*)
967                CC=$ac_optarg ;;
968            
969          -fortran | --fortran | -fc | --fc)          -fortran | --fortran | -fc | --fc)
970              ac_prev=FC ;;              ac_prev=FC ;;
971          -fc=* | --fc=*)          -fc=* | --fc=*)
# Line 1069  if test "x${AD_OPTFILE}" != xNONE ; then Line 1121  if test "x${AD_OPTFILE}" != xNONE ; then
1121      fi      fi
1122  fi  fi
1123    
1124  #  Check that FC, LINK, CPP, S64, LN, and MAKE are defined.  If not,  #  Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined.  If not,
1125  #  either set defaults or complain and abort!  #  either set defaults or complain and abort!
1126  if test ! "x$BASH" = x ; then  if test ! "x$BASH" = x ; then
1127      # add a trailing space so that it works within the Makefile syntax (see below)      # add a trailing space so that it works within the Makefile syntax (see below)
# Line 1084  Error: no Fortran compiler: please speci Line 1136  Error: no Fortran compiler: please speci
1136    3) the "./genmake_local" file    3) the "./genmake_local" file
1137  EOF  EOF
1138      exit 1      exit 1
1139    fi
1140    if test "x$CC" = x ; then
1141        cat <<EOF 1>&2
1142    
1143    Error: no C compiler: please specify using one of the following:
1144      1) within the options file ("CC=...") as specified by "-of=OPTFILE"
1145      2) the "-cc=XXX" command-line option
1146      3) the "./genmake_local" file
1147    EOF
1148        exit 1
1149  fi  fi
1150  if test "x$LINK" = x ; then  if test "x$LINK" = x ; then
1151      LINK=$FC      LINK=$FC

Legend:
Removed from v.1.90  
changed lines
  Added in v.1.91

  ViewVC Help
Powered by ViewVC 1.1.22