FIND_PATH(MKL_INCLUDE_DIR
  NAMES fftw/fftw3.f
  HINTS $ENV{MKL_HOME}/include $ENV{MKLROOT}/include)

FIND_PATH(MKL_LIBRARY_DIR
  NAMES libmkl_core.so libmkl_core.a
  HINTS $ENV{MKL_HOME}/lib $ENV{MKLROOT}/lib
  $ENV{MKL_HOME}/lib/intel64 $ENV{MKLROOT}/lib/intel64
  $ENV{MKL_HOME}/lib/em64t $ENV{MKLROOT}/lib/em64t)

FIND_LIBRARY(MKL_INTEL
  NAMES mkl_intel_lp64
  HINTS ${MKL_LIBRARY_DIR})

FIND_LIBRARY(MKL_GNU
  NAMES mkl_gf_lp64
  HINTS ${MKL_LIBRARY_DIR})

FIND_LIBRARY(MKL_SEQUENTIAL
  NAMES mkl_sequential
  HINTS ${MKL_LIBRARY_DIR})

FIND_LIBRARY(MKL_CORE
  NAMES mkl_core
  HINTS ${MKL_LIBRARY_DIR})

FIND_LIBRARY(MKL_RT
  NAMES mkl_rt
  HINTS ${MKL_LIBRARY_DIR})

MARK_AS_ADVANCED(MKL_INCLUDE_DIR)
MARK_AS_ADVANCED(MKL_LIBRARY_DIR)
MARK_AS_ADVANCED(MKL_INTEL)
MARK_AS_ADVANCED(MKL_GNU)
MARK_AS_ADVANCED(MKL_RT)
MARK_AS_ADVANCED(MKL_SEQUENTIAL)
MARK_AS_ADVANCED(MKL_CORE)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  MKL
  DEFAULT_MSG
  MKL_INCLUDE_DIR)
