old_contents: from distutils.core import setup
  import numpy as np
  import sys, os
  
  from util.cyutil import cythonize # my version of Cython.Build.cythonize
  
  # NOTE: distutils makes no sense
  
  extra_link_args = []
  extra_compile_args = ['-DHMM_TEMPS_ON_HEAP','-DTEMPS_ON_STACK']
  
  if '--with-old-clang' in sys.argv:
      sys.argv.remove('--with-old-clang')
      extra_compile_args.append('-stdlib=libc++')
      extra_link_args.append('-stdlib=libc++')
  
  if '--with-openmp' in sys.argv:
      sys.argv.remove('--with-openmp')
      extra_compile_args.append('-fopenmp')
      extra_link_args.append('-fopenmp')
  
  if '--with-native' in sys.argv:
      sys.argv.remove('--with-native')
      extra_compile_args.append('-march=native')
  
  if '--with-mkl' in sys.argv:
      sys.argv.remove('--with-mkl')
      extra_compile_args.extend(['-m64','-l' + os.environ['MKLROOT'] + '/include'])
      extra_link_args.extend(('-Wl,--start-group %(MKLROOT)s/lib/intel64/libmkl_intel_lp64.a %(MKLROOT)s/lib/intel64/libmkl_core.a %(MKLROOT)s/lib/intel64/libmkl_sequential.a -Wl,--end-group -lm' % {'MKLROOT':os.environ['MKLROOT']}).split(' '))
  
  ext_modules = cythonize('**/*.pyx')
  for e in ext_modules:
      e.extra_compile_args.extend(extra_compile_args)
      e.extra_link_args.extend(extra_link_args)
  
  setup(
      ext_modules=ext_modules,
      include_dirs=[np.get_include(),],
  )
  
  
new_contents: from distutils.core import setup
  import numpy as np
  import sys, os
  
  from util.cyutil import cythonize # my version of Cython.Build.cythonize
  
  # NOTE: distutils makes no sense
  
  extra_link_args = []
  extra_compile_args = ['-DHMM_TEMPS_ON_HEAP','-DTEMPS_ON_STACK']
  
  if '--with-old-clang' in sys.argv:
      sys.argv.remove('--with-old-clang')
      extra_compile_args.append('-stdlib=libc++')
      extra_link_args.append('-stdlib=libc++')
  
  if '--with-openmp' in sys.argv:
      sys.argv.remove('--with-openmp')
      extra_compile_args.append('-fopenmp')
      extra_link_args.append('-fopenmp')
  
  if '--with-native' in sys.argv:
      sys.argv.remove('--with-native')
      extra_compile_args.append('-march=native')
  
  if '--with-mkl' in sys.argv:
      sys.argv.remove('--with-mkl')
      extra_compile_args.extend(['-m64','-l' + os.environ['MKLROOT'] + '/include','-DEIGEN_USE_MKL_ALL'])
      extra_link_args.extend(('-Wl,--start-group %(MKLROOT)s/lib/intel64/libmkl_intel_lp64.a %(MKLROOT)s/lib/intel64/libmkl_core.a %(MKLROOT)s/lib/intel64/libmkl_sequential.a -Wl,--end-group -lm' % {'MKLROOT':os.environ['MKLROOT']}).split(' '))
  
  ext_modules = cythonize('**/*.pyx')
  for e in ext_modules:
      e.extra_compile_args.extend(extra_compile_args)
      e.extra_link_args.extend(extra_link_args)
  
  setup(
      ext_modules=ext_modules,
      include_dirs=[np.get_include(),],
  )
  
  
subject: tweak mkl build