Skip to content

BLD: add CFLAGS -fgnu89-inline on FreeBSD 10+ #11398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/source/whatsnew/v0.17.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,7 @@ Bug Fixes
- Fixed a bug that prevented the construction of an empty series of dtype
``datetime64[ns, tz]`` (:issue:`11245`).
- Bug in ``DataFrame.to_dict()`` produces a ``np.datetime64`` object instead of ``Timestamp`` when only datetime is present in data (:issue:`11327`)



- Bug in the link-time error caused by C ``inline`` functions on FreeBSD 10+ (with ``clang``) (:issue:`10510`)
25 changes: 24 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import shutil
import warnings
import re
import platform
from distutils.version import LooseVersion

# versioning
Expand Down Expand Up @@ -289,7 +290,10 @@ def run(self):


class CheckingBuildExt(build_ext):
"""Subclass build_ext to get clearer report if Cython is necessary."""
"""
Subclass build_ext to get clearer report if Cython is necessary.
Also, add some platform based compiler flags.
"""

def check_cython_extensions(self, extensions):
for ext in extensions:
Expand All @@ -302,8 +306,27 @@ def check_cython_extensions(self, extensions):

def build_extensions(self):
self.check_cython_extensions(self.extensions)
self.add_gnu_inline_flag(self.extensions)
build_ext.build_extensions(self)

def add_gnu_inline_flag(self, extensions):
'''
Add CFLAGS `-fgnu89-inline` for clang on FreeBSD 10+
'''
if not platform.system() == 'FreeBSD':
return

try:
bsd_release = float(platform.release().split('-')[0])
except ValueError: # unknow freebsd version
return

if bsd_release < 10: # 9 or earlier still using gcc42
return

for ext in extensions:
ext.extra_compile_args += ['-fgnu89-inline']


class CythonCommand(build_ext):
"""Custom distutils command subclassed from Cython.Distutils.build_ext
Expand Down