Mercurial > hg
changeset 30408:ce9a3033c118
setup: test setproctitle before building osutil
We are going to use setproctitle (provided by FreeBSD) if it's available in
the next patch. Therefore provide a macro to give some clues to the C
pre-processor so it could choose code path wisely.
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 11 Nov 2016 20:45:40 +0000 |
parents | e1677cc29da6 |
children | 0852161588c6 |
files | setup.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py Sat Nov 12 13:36:17 2016 +0100 +++ b/setup.py Fri Nov 11 20:45:40 2016 +0000 @@ -67,6 +67,7 @@ from setuptools import setup else: from distutils.core import setup +from distutils.ccompiler import new_compiler from distutils.core import Command, Extension from distutils.dist import Distribution from distutils.command.build import build @@ -553,8 +554,14 @@ 'mercurial/compat.h', 'mercurial/util.h'] +osutil_cflags = [] osutil_ldflags = [] +# platform specific macros: HAVE_SETPROCTITLE +for plat, func in [(re.compile('freebsd'), 'setproctitle')]: + if plat.search(sys.platform) and hasfunction(new_compiler(), func): + osutil_cflags.append('-DHAVE_%s' % func.upper()) + if sys.platform == 'darwin': osutil_ldflags += ['-framework', 'ApplicationServices'] @@ -575,6 +582,7 @@ 'mercurial/pathencode.c'], depends=common_depends), Extension('mercurial.osutil', ['mercurial/osutil.c'], + extra_compile_args=osutil_cflags, extra_link_args=osutil_ldflags, depends=common_depends), Extension('hgext.fsmonitor.pywatchman.bser',