[Distutils] linking with libm

Mark Sienkiewicz sienkiew at stsci.edu
Wed Nov 23 23:42:40 CET 2011

On 11/23/11 10:07, Ralf Schmitt wrote:
> 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")
> | ''
> `----

It may not matter.  On my Mac (Snow Leopard), it wants to use built-in functions provided by gcc for everything that I've tried that is in -lm on other machines.  There is a /usr/lib/libm.dylib, but a little searching (/bin, /usr/bin, my own custom python install) did not find anything on my machine that actually uses it.

"cc c.c" and "cc c.c -lm" produce identical a.out files.

More information about the Distutils-SIG mailing list