diff options
author | Doug Evans <dje@google.com> | 2010-05-27 01:36:22 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2010-05-27 01:36:22 +0000 |
commit | ec685c5ecafd5bf8876d332a0eb17f206c8d733a (patch) | |
tree | 43c7b35df1a8370a158b8967a7a78a49f8e105bf /gdb/python | |
parent | 65f08db7b30535d233e1706b7b451add2b64d9c2 (diff) | |
download | gdb-ec685c5ecafd5bf8876d332a0eb17f206c8d733a.zip gdb-ec685c5ecafd5bf8876d332a0eb17f206c8d733a.tar.gz gdb-ec685c5ecafd5bf8876d332a0eb17f206c8d733a.tar.bz2 |
* configure.ac: Try to use python's distutils to fetch compilation
parameters.
* configure: Regenerate.
* python/python-config.py: New file.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/python-config.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py new file mode 100644 index 0000000..285a227 --- /dev/null +++ b/gdb/python/python-config.py @@ -0,0 +1,54 @@ +# Program to fetch python compilation parameters. +# Copied from python-config of the 2.6.5 release. + +import sys +import os +import getopt +from distutils import sysconfig + +valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', + 'ldflags', 'help'] + +def exit_with_usage(code=1): + print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0], + '|'.join('--'+opt for opt in valid_opts)) + sys.exit(code) + +try: + opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) +except getopt.error: + exit_with_usage() + +if not opts: + exit_with_usage() + +opt = opts[0][0] + +pyver = sysconfig.get_config_var('VERSION') +getvar = sysconfig.get_config_var + +if opt == '--help': + exit_with_usage(0) + +elif opt == '--prefix': + print sysconfig.PREFIX + +elif opt == '--exec-prefix': + print sysconfig.EXEC_PREFIX + +elif opt in ('--includes', '--cflags'): + flags = ['-I' + sysconfig.get_python_inc(), + '-I' + sysconfig.get_python_inc(plat_specific=True)] + if opt == '--cflags': + flags.extend(getvar('CFLAGS').split()) + print ' '.join(flags) + +elif opt in ('--libs', '--ldflags'): + libs = getvar('LIBS').split() + getvar('SYSLIBS').split() + libs.append('-lpython'+pyver) + # add the prefix/lib/pythonX.Y/config dir, but only if there is no + # shared library in prefix/lib/. + if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'): + libs.insert(0, '-L' + getvar('LIBPL')) + print ' '.join(libs) + |