import numpy as np
import os


def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    config = Configuration('mle', parent_package, top_path)
    common_include_dir = os.path.join(config.path_in_package, '..', '..', '..', 'util', 'include')

    config.add_extension('mle_trev',
                         sources=['mle_trev.pyx',
                                  'src/_mle_trev.c',
                                  ],
                         include_dirs=['src/', np.get_include(), common_include_dir]
                         )

    config.add_extension('mle_trev_given_pi',
                         sources=['mle_trev_given_pi.pyx',
                                  'src/_mle_trev_given_pi.c'],
                         include_dirs=['src/', np.get_include(), common_include_dir])

    config.add_extension('newton.objective_sparse',
                         sources=['newton/objective_sparse.pyx'],
                         include_dirs=[np.get_include()])

    config.add_subpackage('newton')

    return config

@@ -230,74 +230,193 @@
 ath.
-join(config.path_in_package, '..', '..', '..', 'util', 'include')%0A
+abspath(os.path.join(os.path.dirname(__file__),%0A                                                      '..', '..', '..', 'util', 'include'))%0A    assert os.path.exists(common_include_dir)
 %0A   
@@ -554,44 +554,8 @@
 v.c'
-,%0A                                  
 %5D,%0A 
@@ -641,34 +641,8 @@
 dir%5D
-%0A                         
 )%0A%0A 

fix include path