[Distutils] linking with libm

Ralf Schmitt ralf at systemexit.de
Wed Nov 23 16:07:43 CET 2011

Oscar Benjamin <oscar.benjamin at bristol.ac.uk> writes:

> Would it be slightly better to test just for the existence of the LIBM
> configuration variable rather than its value? I don't know of an
> example, but I guess a system could have libm but use a compiler with a
> different linker argument format.
> e.g.
> if 'libm' in sysconfig.get_config_vars()

No, the following is from OS X:
| >>> from distutils import sysconfig
| >>> sysconfig.get_config_var("LIBM")
| ''

> Is there a more general way to discover if the compiler that is going to
> be used knows of a library with a specified name? Something like
> if get_compiler_type().library_exists(libname)

It's probably possible with some custom distutils command, but it's also
not worth it IMHO.

More information about the Distutils-SIG mailing list