.TH PYTHON\-CONFIG 1 "November 27, 2011"
.SH NAME
python\-config \- output build options for python C/C++ extensions or embedding
.SH SYNOPSIS
.BI "python\-config"
[
.BI "\-\-prefix"
]
[
.BI "\-\-exec\-prefix"
]
[
.BI "\-\-includes"
]
[
.BI "\-\-libs"
]
[
.BI "\-\-cflags"
]
[
.BI "\-\-ldflags"
]
[
.BI "\-\-extension\-suffix"
]
[
.BI "\-\-configdir"
]
[
.BI "\-\-help"
]
.SH DESCRIPTION
.B python\-config
helps compiling and linking programs, which embed the Python interpreter, or
extension modules that can be loaded dynamically (at run time) into
the interpreter.
.SH OPTIONS
.TP
.BI "\-\-cflags"
print the C compiler flags.
.TP
.BI "\-\-ldflags"
print the flags that should be passed to the linker.
.TP
.BI "\-\-includes"
similar to \fI\-\-cflags\fP but only with \-I options (path to python header files).
.TP
.BI "\-\-libs"
similar to \fI\-\-ldflags\fP but only with \-l options (used libraries).
.TP
.BI "\-\-prefix"
prints the prefix (base directory) under which python can be found.
.TP
.BI "\-\-exec\-prefix"
print the prefix used for executable program directories (such as bin, sbin, etc).
.TP
.BI "\-\-extension\-suffix"
print suffix used for extension modules (including the _d modified for debug builds).
.TP
.BI "\-\-configdir"
prints the path to the configuration directory under which the Makefile, etc. can be found).
.TP
.BI "\-\-help"
print the usage message.
.PP

.SH EXAMPLES
To build the singe\-file c program \fIprog\fP against the python library, use
.PP
.RS
gcc $(python\-config \-\-cflags \-\-ldflags) progr.cpp \-o progr.cpp
.RE
.PP
The same in a makefile:
.PP
.RS
CFLAGS+=$(shell python\-config \-\-cflags)
.RE
.RS
LDFLAGS+=$(shell python\-config \-\-ldflags)
.RE
.RS
all: progr
.RE

To build a dynamically loadable python module, use
.PP
.RS
gcc $(python\-config \-\-cflags \-\-ldflags) \-shared \-fPIC progr.cpp \-o progr.so
.RE

.SH "SEE ALSO"
python (1)
.br
http://docs.python.org/extending/extending.html
.br
/usr/share/doc/python/faq/extending.html

.SH AUTHORS
This manual page was written by Johann Felix Soden <johfel@gmx.de>
for the Debian project (and may be used by others).
