/[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.135 by edhill, Thu Nov 17 20:06:08 2005 UTC revision 1.138 by edhill, Sun Dec 4 13:57:08 2005 UTC
# Line 353  EOF Line 353  EOF
353      else      else
354          echo "  The possible FORTRAN compilers found in your path are:"          echo "  The possible FORTRAN compilers found in your path are:"
355          echo "   "$p_FC          echo "   "$p_FC
356          if test "x$FC" = x ; then      fi
357              FC=`echo $p_FC | $AWK '{print $1}'`  
358              echo "  Setting FORTRAN compiler to: "$FC      #  Use the first of the compilers found in the current PATH
359          fi      #  that has a correctly-named optfile
360        if test "x$OPTFILE" = x  -a  "x$FC" = x ; then
361            for i in $p_FC ; do
362                OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i
363                if test -r $OPTFILE ; then
364                    echo "  Setting OPTFILE to: "$OPTFILE
365                    break
366                fi
367            done
368      fi      fi
369    
370      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
# Line 689  EOF Line 697  EOF
697  }  }
698    
699    
700    check_HAVE_SIGREG()  {
701        get_fortran_c_namemangling
702        cat <<EOF > genmake_tc_1.c
703    $FC_NAMEMANGLE
704    #include <stdlib.h>
705    #include <stdio.h>
706    #include <signal.h>
707    #include <errno.h>
708    #include <ucontext.h>
709    
710    int * ip;
711    
712    static void killhandler(
713        unsigned int sn, siginfo_t  si, struct ucontext *sc )
714    {
715        *ip = *ip + 1;
716        return;
717    }
718    
719    void FC_NAMEMANGLE(sigreg) (int * aip)
720    {
721        struct sigaction s;
722        ip = aip;
723        s.sa_flags = SA_SIGINFO;
724        s.sa_sigaction = (void *)killhandler;
725        if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) {
726            printf("Sigaction returned error = %d\n", errno);
727            exit(0);
728        }
729        return;
730    }
731    EOF
732        make genmake_tc_1.o >> genmake_warnings 2>&1
733        RET_C=$?
734        cat <<EOF > genmake_tc_2.$FS
735          program hello
736          integer anint
737          common /iv/ anint
738          external sigreg
739          call sigreg(anint)
740          end
741    EOF
742        echo >> genmake_warnings
743        echo "running: check_HAVE_SIGREG()" >> genmake_warnings
744        cat genmake_tc_2.$FS >> genmake_warnings
745        COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
746        echo $COMM >> genmake_warnings
747        $COMM >> genmake_warnings 2>&1
748        RETVAL=$?
749        if test "x$RETVAL" = x0 ; then
750            HAVE_SIGREG=t
751            DEFINES="$DEFINES -DHAVE_SIGREG"
752        fi
753        rm -f genmake_tc*
754    }
755    
756    
757  check_HAVE_SETRLSTK()  {  check_HAVE_SETRLSTK()  {
758      get_fortran_c_namemangling      get_fortran_c_namemangling
759      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
# Line 1447  if test "x$HAVE_SETRLSTK" != x ; then Line 1512  if test "x$HAVE_SETRLSTK" != x ; then
1512      echo "yes"      echo "yes"
1513  else  else
1514      echo "no"      echo "no"
1515    fi
1516    rm -f genmake_t*
1517    
1518    printf "  Can we register a signal handler using $FC...  "
1519    check_HAVE_SIGREG
1520    if test "x$HAVE_SIGREG" != x ; then
1521        echo "yes"
1522    else
1523        echo "no"
1524  fi  fi
1525  rm -f genmake_t*  rm -f genmake_t*
1526    

Legend:
Removed from v.1.135  
changed lines
  Added in v.1.138

  ViewVC Help
Powered by ViewVC 1.1.22