[Python-Dev] Re: [Python-checkins] CVS: python/dist/src configure.in,1.177,1.178 configure,1.169,1.170

Greg Ward gward@mems-exchange.org
Wed, 8 Nov 2000 09:02:49 -0500

On 07 November 2000, Thomas Wouters said:
> Sorry for the late remark (I did see your earlier message) but after reading
> the patch I realized 'OPT' isn't the right place for this. 'OPT' should be
> for non-essential stuff: warnings, debug-info and optimizations. Removing
> things from OPT shouldn't break anything, and neither should adding options
> that fit in the categories above. (Barring broken compilers, of course.)
> Instead, the -fPIC option should be added to CFLAGS, I think. The Python
> autoconf setup is slightly less versatile than most, though, since it's
> doggone hard to near impossible to change things like OPT, CC, CFLAGS, etc,
> without editing configure(.in) :P If noone else does it before me, I'll see
> about fixing at least the -fPIC thing later, when I find some time ;P

Good point -- fixing CFLAGS instead of OPT sounds right to me.  I'm not
really sure on where to do this, though.

Ooh, I just noticed this in configure.in:

  # DG/UX requires some fancy ld contortions to produce a .so from an .a
  case $MACHDEP in
        OPT="$OPT -pic"

No prize for guessing that "-pic" on the DG/UX compiler has a similar
effect to GCC's -fPIC, and based on the comment this is required.  I'm
guessing this should be in CFLAGS as well.

Oh wait: CFLAGS is not exported from configure.in -- it's *only* defined
in the Makefile.  From Makefile.in:

  CFLAGS=		$(OPT) -I. $(DEFS)

IOW, it looks like OPT is used for all non-preprocessor compiler flags,
whether they're "frills" like optimization/debugging or not.

Conclusion: my patch (add "-fPIC" to OPT instead of CFLAGS) does the
right thing, but for the wrong reason.  Fixing it would require a little
more involved surgery on configure.in and the Makefiles.  And it would
also require reexamining every use of OPT in configure.in (not too hard,
"grep -c OPT" only finds 16 matches).  IMHO this would be a good thing:
if we do it right, it should make it easier to tweak OPT, CC, CFLAGS and
so forth at config time or at make time.

I'm willing to spend some time on this; does anyone think it's a
pointless waste of time?