Changeset 1325 for trunk/scons


Ignore:
Timestamp:
04/12/07 12:07:38 (18 years ago)
Author:
mar637
Message:

Changes to use casacore instead of casa_asap/aips++\nAdded atnf PKSIO library snapshot to external and linking against this local copy

Location:
trunk/scons
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scons/utils.py

    r1184 r1325  
    1414        env.PrependUnique(LIBPATH = [os.path.join(path, "lib")])
    1515    env.AddCustomPath = AddCustomPath
     16
     17    def AddCustomPackage(pkgname=None):
     18        if pkgname is None:
     19            return
     20        pkgroot = env.get("%sroot" % pkgname, None)
     21        pkgincd = env.get("%sincdir" % pkgname, None)
     22        pkglibd = env.get("%slibdir" % pkgname, None)
     23        incd = None
     24        libd = None
     25        if pkgroot is not None:
     26            incd = os.path.join(pkgroot, "include")
     27            libd = os.path.join(pkgroot, "lib")
     28        else:       
     29            if pkgincd is not None:
     30                incd = pkgincd
     31            if pkglibd is not None:
     32                libd = pkglibd
     33        if incd is not None:
     34            if not os.path.exists(incd):
     35                print "Custom %s include dir '%s' not found" % (pkgname, incd)
     36                env.Exit(1)
     37            env.PrependUnique(CPPPATH = [incd])
     38        if libd is not None:
     39            if not os.path.exists(libd):
     40                print "Custom %s lib dir '%s' not found" % (pkgname, libd)
     41                env.Exit(1)
     42            env.PrependUnique(LIBPATH = [libd])
     43
     44    env.AddCustomPackage = AddCustomPackage
     45
     46    def CheckFortran(conf):
     47           
     48        if not conf.env.has_key("FORTRAN"):
     49            # auto-detect fortran
     50            detect_fortran = conf.env.Detect(['gfortran', 'g77', 'f77'])
     51            conf.env["FORTRAN"] = detect_fortran
     52            fdict = {'gfortran': 'gfortran', 'g77': 'g2c', 'f77': 'f2c'}
     53            f2clib = conf.env.get("f2clib", fdict[detect_fortran])
     54            if not conf.CheckLib(f2clib):
     55                env.Exit(1)
     56        else:
     57            if not conf.env.has_key("f2clib"):
     58                print "A custom fortran compiler also needs f2clib defined"
     59                env.Exit(1)
     60            else:
     61                if not conf.CheckLib(env["f2clib"]):
     62                    env.Exit(1)
     63        if conf.env["FORTRAN"].startswith("g77"):
     64            fflags = ["-Wno-globals", "-fno-second-underscore"]
     65            conf.env.Append(SHFORTRANFLAGS=fflags)
     66            conf.env.Append(FORTRANFLAGS=fflags)
     67    env.CheckFortran = CheckFortran
    1668
    1769    def WalkDirTree(targetroot, sourceroot, sources):
Note: See TracChangeset for help on using the changeset viewer.