You can compile Python in various ways. I\'d like to find out with which options my Python was compiled.
Concrete use-case: was my Python compiled with readline? I k
To build on mirk's answer, to find the configure flags that were actually used during the build, the value you're looking for is CONFIG_ARGS.
For example, this is the output for an Ubuntu-compiled Python:
>>> print distutils.sysconfig.get_config_var('CONFIG_ARGS')
'--enable-shared' '--prefix=/usr' '--enable-ipv6'
'--enable-unicode=ucs4' '--with-dbmliborder=bdb:gdbm'
'--with-system-expat' '--with-system-ffi' '--with-fpe ctl'
'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-D_FORTIFY_SOURCE=2 -g
-fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security ' 'LDFLAGS=-Wl,-Bs ymbolic-functions
-Wl,-z,relro'