On Wed, Mar 7, 2012 at 12:35 PM, Skipper Seabold <jsseab...@gmail.com> wrote:
> Is there a way to use numpy.distuils to programmatically check for a C
> compiler at build time in a platform independent way?

Wading through the numpy/distutils code some more. Would something as
simple as this work all the time? Seems to do the trick for me.

from distutils.dist import Distribution
from distutils.command.config import config as distutils_config
from distutils import log

dummy_c_text = r'''
void do_nothing(void);
int main(void) {
    do_nothing();
    return 0;
}
'''

def has_c_compiler():
    c = distutils_config(Distribution())
    try:
        success = c.try_compile(dummy_c_text)
        return True
    except:
        log.info("No C compiler detected of files.")
        return False

Skipper
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to