
GMSH_FOUND = true
gmsh = Sys.which("gmsh")
gmsh_jl = ""

if gmsh === nothing
  s = """
  No gmsh installation found in the system.
  Install gmsh and make sure that the gmsh executable
  can be found via the PATH environment variable.
  """
  @warn s
  GMSH_FOUND = false
else
  gmsh_root = dirname(gmsh)[1:end-4]
  gmsh_jl = joinpath(gmsh_root,"lib","gmsh.jl")
  @info "Using the gmsh Julia API found in $gmsh_jl"
end

if ! isfile(gmsh_jl)
  @warn "gmsh Julia API not found"
  GMSH_FOUND = false
end

open("deps.jl","w") do f
  println(f, "# This file is automatically generated")
  println(f, "# Do not edit")
  println(f)
  println(f, :(const GMSH_FOUND = $GMSH_FOUND))
  println(f, :(const gmsh_jl    = $gmsh_jl))
end

