anchor.diff:  { stdenv, fetchurl, gfortran, tolerateCpuTimingInaccuracy ? true, shared ? false
  -, cpuConfig ? if stdenv.isi686 then "-b 32 -A 18 -V 1" else "-b 64 -A 31 -V 384"
  +, cpuConfig ? if stdenv.isi686 then "-b 32 -A 12 -V 1" else "-b 64 -A 14 -V 384"
  +, cacheEdge ? "262144"
  +, threads ? "0"
   }:
   
   # Atlas detects the CPU and optimizes its build accordingly. This is great when
  
positive.code:     license = stdenv.lib.licenses.bsd3;
  
      longDescription = ''
        The ATLAS (Automatically Tuned Linear Algebra Software) project is an ongoing
        research effort focusing on applying empirical techniques in order to provide
        portable performance. At present, it provides C and Fortran77 interfaces to a
        portably efficient BLAS implementation, as well as a few routines from LAPACK.
      '';
  
      maintainers = with stdenv.lib.maintainers; [ ttuegel ];
  
negative.code:   patches = optional tolerateCpuTimingInaccuracy ./disable-timing-accuracy-check.patch;
  
    # Configure outside of the source directory.
    preConfigure = ''
      mkdir build
      cd build
      configureScript=../configure
    '';
  
    # * -fPIC is passed even in non-shared builds so that the ATLAS code can be
    #   used to inside of shared libraries, like Octave does.
    #
    # * -t 0 disables use of multi-threading. It's not quite clear what the
    #   consequences of that setting are and whether it's necessary or not.
    configureFlags = [
      "-Fa alg"
      "-fPIC"
      "-t ${threads}"
      cpuConfig
    ] ++ optional shared "--shared";
  
    postConfigure = ''
      if [[ -n "${cacheEdge}" ]]; then
        echo '#define CacheEdge ${cacheEdge}' >> include/atlas_cacheedge.h
        echo '#define CacheEdge ${cacheEdge}' >> include/atlas_tcacheedge.h
      fi
    '';
  
    doCheck = true;
  
    postInstall = ''
      # Avoid name collision with the real lapack (ATLAS only builds a partial
      # lapack).
      mv $out/lib/liblapack.a $out/lib/liblapack_atlas.a
    '';
  
    meta = {
      homepage = "http://math-atlas.sourceforge.net/";
  