fix gcc option detection

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2757 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2005-07-15 15:16:38 +00:00
parent 6239880f15
commit 1bbfefb37c
2 changed files with 20 additions and 5 deletions

View file

@ -33,6 +33,12 @@
Type: feature
Changed: linkcheck/checker/httpurl.py
* Fix detection code of supported GCC command line options. this
fixes a build error on some Unix systems (eg. FreeBSD).
Type: bugfix
Closes: SF bug #1238906
Changed: setup.py
3.0 "The Jacket" (released 8.7.2005)
* Catch all check errors, not just the ones inside of URL checking.

View file

@ -25,6 +25,7 @@ if sys.version_info < (2, 4, 0, 'final', 0):
raise SystemExit, "The installation script of this program requires" + \
" Python 2.4.0 or later."
import os
import popen2
import platform
import stat
import re
@ -197,13 +198,21 @@ class MyDistribution (distutils.dist.Distribution, object):
def cc_supports_option (cc, option):
"""
Check if the given C compiler supports the given option.
@return: True if the compiler supports the option, else False
@rtype: bool
"""
prog = "int main(){}\n"
cc_cmd = "%s -E %s -" % (cc[0], option)
_in, _out = os.popen4(cc_cmd)
_in.write(prog)
_in.close()
while _out.read(): pass
return _out.close() is None
pipe = popen2.Popen4(cc_cmd)
pipe.tochild.write(prog)
pipe.tochild.close()
status = pipe.wait()
if os.WIFEXITED(status):
return os.WEXITSTATUS(status)==0
return False
class MyBuildExt (build_ext, object):