def configure(ctx):
  #always assume that I need a dedicated include file.
  
  if ctx.options.lapack_apple:
    ctx.start_msg("Check apple lapack")
    if sys.platform.lower()!="darwin":
      ctx.end_msg("not on darwin ! Got '%s'"%sys.platform,color="YELLOW")
      raise Errors.WafError("cannot find apple lapack")
    ctx.end_msg("ok")
    lapack_extradefs = ["HAS_LAPACK"]
    lapack_libs = ["BLAS","LAPACK"]
    lapack_includes = ["lapack_clik.h"]
    lapack_extradefs += ["LAPACK_CLIK"]
    ctx.options.lapack_include = osp.join(ctx.env.PREFIX,"include")
    ctx.options.lapack_lib = "/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current"
    do_include(ctx,"%s_")

  elif ctx.options.lapack_mkl:
    # parse version
    ctx.start_msg("Check mkl version")
    if ctx.options.lapack_mkl_version.strip()[:4] not in ("10.0","10.1","10.2","10.3"):
      ctx.end_msg(ctx.options.lapack_mkl_version.strip(),color="YELLOW")
      raise Errors.WafError("Cannot understand mkl version '%s'"%ctx.options.lapack_mkl_version.strip())
    version = int(ctx.options.lapack_mkl_version.strip()[:4].split(".")[1])
    ctx.end_msg("10.%d"%version)
    lapack_extradefs = ["HAS_LAPACK"]
    lapack_extradefs += ["HAS_MKL"]
    lapack_includes = ["mkl_lapack.h","mkl_blas.h"]
    lapack_libs = []
    tag = sys.platform.lower()
    if tag=="darwin":
      pass
    elif "linux" in tag:
      tag="linux"
    else:
      raise Errors.WafError(tag%"unknown platform '%s'")
    tag+="_10.%d"%version
    mopt = ctx.env.mopt
    if "64" in mopt:
      tag+="_64"
    else:
      tag +="_32"

    if sys.platform.lower()!='darwin':
      #I need to create my own lapack ! 
      cmdline = """gcc -shared -Bdynamic  %(func_list)s  -Wl,--start-group %(ars)s  -Wl,--end-group %(Lomp)s %(omp)s -o "%(res)s" """
      cmdlist = {}
      cmdlist["func_list"] = " ".join(["-u %s_"%v for v in lapack_funcs.split()])
      cmdlist["ars"] = " ".join([osp.join(mkl_options[tag][0]%(ctx.options.lapack_mkl),"lib%s.a"%v.strip()) for v in mkl_options[tag][1].split("-l") if v.strip() and v.strip()[:3]=="mkl"])
      cmdlist["Lomp"] = " ".join("-L%s"%v.strip() for v in ctx.env.LIBPATH_fc_runtime if v.strip())
      cmdlist["omp"] = " ".join([v.strip() for v in mkl_options[tag][1].split() if v.strip() and "mkl" not in v])
      cmdlist["res"] = osp.join(ctx.env.LIBDIR,ctx.env.cshlib_PATTERN%"clik_mkl")
      cmdline = cmdline%cmdlist
      #print cmdline
      ctx.start_msg("create specific mkl lib")
      llgo,llge = ctx.cmd_and_log(cmdline, output=waflib.Context.BOTH)
      #print llgo
      #print llge
      ctx.end_msg(cmdlist["res"])
      ctx.options.lapack_link = "-lclik_mkl "+cmdlist["omp"]
      ctx.options.lapack_lib = ctx.env.LIBDIR+":".join([""]+ctx.env.LIBPATH_fc_runtime)
      ctx.options.lapack_include =  ctx.options.lapack_mkl+"/include"

    else:
      ctx.options.lapack_link = mkl_options[tag][1]
      ctx.options.lapack_lib = mkl_options[tag][0]%(ctx.options.lapack_mkl)+":".join([""]+ctx.env.LIBPATH_fc_runtime)
      if "framework" in ctx.options.lapack_mkl.lower():
        ctx.options.lapack_include =  ctx.options.lapack_mkl+"/Headers"
      else:
        ctx.options.lapack_include =  ctx.options.lapack_mkl+"/include"

    #try:
    #  atl.conf_lib(ctx,"lapack",lapack_libs,lapack_funcs.split(),lapack_includes,defines=lapack_extradefs,install=installlapack)
    #except Exception,e:
    #  pass

  #lapack_extradefs = ["HAS_LAPACK"]
  #lapack_libs = ["BLAS","LAPACK"]
  #lapack_includes = ["lapack.h","blas.h"]

  #if "mkl" in ctx.options.lapack_lib.lower() or "mkl" in ctx.options.lapack_include.lower() or "mkl" in ctx.options.lapack_link or ctx.options.lapack_mkl:
  #  ctx.env.mkl = True
  #  lapack_extradefs += ["HAS_MKL"]
  #  lapack_includes = ["mkl_lapack.h","mkl_blas.h"]
  #  if ctx.options.lapack_mkl:
  #    if ctx.env.has_ifort==False:
  #      raise Exception("cannot use MKL without ifort")
  #    if "framework" in ctx.options.lapack_mkl.lower():
  #      # guess we are on macosx
  #      # get the path of the framework
  #      if ctx.options.lapack_mkl[-1] == "/":
  #        fpath,fname = osp.split(ctx.options.lapack_mkl[:-1])
  #      else:
  #        fpath,fname = osp.split(ctx.options.lapack_mkl)
  #      fname = fname.split(".")[0]
  #      ctx.options.lapack_include =  ctx.options.lapack_mkl+"/Headers"
  #      ctx.options.lapack_lib =  ctx.options.lapack_mkl+"/Libraries/universal"
  #      if ctx.options.lapack_link=="":
  #        ctx.options.lapack_link = "-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core"
  #    else:
  #      # assume it's 10 on linux
  #      # check whether it's 10.3
  #      if ctx.options.m32:
  #        libsuffix="/lib/32"
  #        libdep = "-lmkl_intel"
  #      else:
  #        libsuffix="/lib/em64t"
  #        libdep = "-lmkl_intel_lp64"
  #      if ctx.options.lapack_link=="":
  #        ctx.options.lapack_link = "-lmkl_lapack -lmkl_intel_thread -lmkl_core -liomp5 -lm -lpthread -lmkl_def" + libdep
  #      if not ctx.options.m32 and osp.exists(ctx.options.lapack_mkl+"/lib/intel64"):
  #        libsuffix="/lib/intel64"
  #        ctx.options.lapack_link = "-lmkl_intel_thread -lmkl_core -liomp5 -lm -lpthread -lmkl_def" + libdep
  #      ctx.options.lapack_include=ctx.options.lapack_mkl+"/include"
  #      ctx.options.lapack_lib=ctx.options.lapack_mkl+libsuffix+":".join([""]+ctx.env.LIBPATH_fc_runtime)
  elif atl.upgrade(ctx,"lapack") or ctx.options.lapack_islocal or ctx.options.lapack_forceinstall or atl.shouldIinstall_all(ctx,"lapack"):
    ctx.env.append_value("LIBPATH_lapack",ctx.env.LIBPATH_fc_runtime)
    ctx.env.append_value("RPATH_lapack",ctx.env.RPATH_fc_runtime)
    ctx.env.append_value("LIB_lapack",ctx.env.LIB_fc_runtime)
    lapack_libs = ["lapack_clik","blas_clik"]
    lapack_includes = ["lapack_clik.h"]
    lapack_extradefs = ["HAS_LAPACK"]
    lapack_extradefs += ["LAPACK_CLIK"]
  else:
    lapack_libs = []
    lapack_includes = ["lapack_clik.h"]
    lapack_extradefs = ["HAS_LAPACK"]
    lapack_extradefs += ["LAPACK_CLIK"]
    do_include(ctx)

  atl.conf_lib(ctx,"lapack",lapack_libs,lapack_funcs.split(),lapack_includes,defines=lapack_extradefs,install=installlapack)
dataset/ETHPy150Open baudren/montepython_public/wrapper_wmap/waf_tools/any_lapack.py/configure/swapped operands of `%`