Patchwork [2,of,6] setup: add a function to test header files

login
register
mail settings
Submitter Jun Wu
Date March 21, 2017, 12:04 a.m.
Message ID <3706485e7df866252949.1490054675@localhost.localdomain>
Download mbox | patch
Permalink /patch/19480/
State Accepted
Headers show

Comments

Jun Wu - March 21, 2017, 12:04 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1490049081 25200
#      Mon Mar 20 15:31:21 2017 -0700
# Node ID 3706485e7df8662529498360cc09584b185dfcc7
# Parent  272f2d2a56cad143c899d4beb4b36610f68e6310
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 3706485e7df8
setup: add a function to test header files

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -128,4 +128,8 @@  def hasfunction(cc, funcname):
     return cancompile(cc, code)
 
+def hasheader(cc, headername):
+    code = '#include <%s>\nint main(void) { return 0; }\n' % headername
+    return cancompile(cc, code)
+
 # py2exe needs to be installed to work
 try: