[Numpy-discussion] Overview of extra build options in svn's numpy.distutils
David M. Cooke
cookedm at physics.mcmaster.ca
Tue Jun 12 16:12:56 EDT 2007
Hi,
Looks like I broke more stuff than I intended when I merged my
distutils-revamp branch. Not that I didn't expect something to break,
this stuff is fragile!
The main purpose of the merge was to allow the user to configure more
stuff regarding how things are compiled with Fortran. For instance,
here's my ~/.pydistutils.cfg
[config_fc]
fcompiler=gnu95
f77exec=gfortran-mp-4.2
f90exec=gfortran-mp-4.2
#opt = -g -Wall -O2
f77flags=-g -Wall -O
(I use gfortran 4.2 on my MacBook, installed using MacPorts.) Other
options to set are listed in numpy/distutils/fcompiler/__init__.py,
in the FCompiler class.
distutils config_fc key, [environment variable]
distutils flags for config_fc section
compiler - Fortran compiler to use (the numpy.distutils name, like
gnu95 or intel)
noopt - don't compile with optimisations
noarch - don't compile with host architecture optimisations
debug - compile with debug optimisations
verbose - spew more stuff to the console when doing distutils stuff
executables:
f77exec [F77] - executable for Fortran 77
f90exec [F90] - executable for Fortran 90
ldshared [LDSHARED] - executable for shared libraries for Fortran
ld [LD] - executable for linker for Fortran
ar [AR] - library archive maker (for .a files)
ranlib [RANLIB] - some things need ranlib run over the libraries.
flags:
f77flags [F77FLAGS] - compiler flags for Fortran 77 compiler
f90flags [F90FLAGS] - compiler flags for Fortran 90 compiler
freeflags [FREEFLAGS] - compiler flags for free-format Fortran 90
opt [FOPT] - optimisation flags for all Fortran compilers (used if
noopt is false)
arch [FARCH] - architecture-specific flags for Fortran (used if
noarch is false)
fdebug [FDEBUG] - debug-specific flags for Fortran (used if debug is
true)
fflags [FFLAGS] - extra compiler flags
ldflags [LDFLAGS] - extra linker flags
arflags [ARFLAGS] - extra library archiver flags
There's also more central logic for finding executables, which should
be more flexible, and takes care of, for instance, using the
specified F77 compiler for the linker if the linker isn't specified,
or the F90 compiler if either isn't, etc.
Some of this type of stuff should be done for the C compiler, but
isn't, as that would be messier with regards to hooking into Python's
distutils.
Personally, I think Python's distutils is a poorly laid-out
framework, that is in need of serious refactoring. However, that's a
lot of work, and I'm not going to do it right away...
--
|>|\/|<
/------------------------------------------------------------------\
|David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca
More information about the NumPy-Discussion
mailing list