/[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.211 by jmc, Tue Nov 2 22:45:07 2010 UTC revision 1.212 by jmc, Thu Nov 4 18:01:22 2010 UTC
# Line 290  build_embed_encode() Line 290  build_embed_encode()
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
# Line 360  EOF Line 328  EOF
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
# Line 415  EOF Line 418  EOF
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    
# Line 656  get_fortran_c_namemangling()  { Line 649  get_fortran_c_namemangling()  {
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
# Line 681  EOF Line 677  EOF
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
# Line 693  EOF Line 689  EOF
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
# Line 711  EOF Line 709  EOF
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
# Line 739  EOF Line 737  EOF
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    
# Line 784  EOF Line 784  EOF
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    
# Line 846  EOF Line 847  EOF
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    
# Line 894  EOF Line 896  EOF
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    
# Line 941  EOF Line 944  EOF
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    
# Line 1033  EOF Line 1037  EOF
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    
# Line 1444  if test "x${OPTFILE}" = x ; then Line 1449  if test "x${OPTFILE}" = x ; then
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
# Line 1514  Error: no Fortran compiler: please speci Line 1519  Error: no Fortran compiler: please speci
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"
# Line 1524  if test "x$CC" = x ; then Line 1531  if test "x$CC" = x ; then
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
# Line 1531  if test "x$MAKE" = x ; then Line 1539  if test "x$MAKE" = x ; then
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
# Line 1558  EOF Line 1566  EOF
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
# Line 1568  RETVAL=$? Line 1579  RETVAL=$?
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
# Line 1821  for d in $MODS ; do Line 1832  for d in $MODS ; do
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}'`

Legend:
Removed from v.1.211  
changed lines
  Added in v.1.212

  ViewVC Help
Powered by ViewVC 1.1.22