summaryrefslogtreecommitdiff
path: root/numpy/distutils/tests/test_ccompiler.py
blob: 8b4a56b79085933d38367a4009de92df89a142af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import division, absolute_import, print_function

from distutils.ccompiler import new_compiler

from numpy.distutils.numpy_distribution import NumpyDistribution

def test_ccompiler():
    '''
    scikit-image/scikit-image issue 4369
    We unconditionally add ``-std-c99`` to the gcc compiler in order
    to support c99 with very old gcc compilers. However the same call
    is used to get the flags for the c++ compiler, just with a kwarg.
    Make sure in this case, where it would not be legal, the option is **not** added
    '''
    dist = NumpyDistribution()
    compiler = new_compiler()
    compiler.customize(dist)
    if hasattr(compiler, 'compiler') and 'gcc' in compiler.compiler[0]:
        assert 'c99' in ' '.join(compiler.compiler)

    compiler = new_compiler()
    compiler.customize(dist, need_cxx=True)
    if hasattr(compiler, 'compiler') and 'gcc' in compiler.compiler[0]:
        assert 'c99' not in ' '.join(compiler.compiler)