This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python does not honor "CFLAGS" environment variable
Type: Stage:
Components: Build Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, loewis, tebeka
Priority: normal Keywords:

Created on 2007-11-16 18:19 by tebeka, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (8)
msg57588 - (view) Author: Miki Tebeka (tebeka) * Date: 2007-11-16 18:19
Setting CFLAGS environment variable do not show up in the build process,
the gcc flags do not include the CFLAGS flags.
msg57589 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-11-16 18:28
This depends on the version of Make used.  See the man page for Make.
msg57590 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-11-16 18:39
In all versions of make, "make CFLAGS=..." should work fine (although
that's not an environment variable).
msg57591 - (view) Author: Miki Tebeka (tebeka) * Date: 2007-11-16 19:05
I'll try to be clearer:
`./configure --help` states (at the end):
    Some influential environment variables:
      CC          C compiler command
      CFLAGS      C compiler flags
      LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries  in a
                  nonstandard directory <lib dir>
      CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
                  headers in a nonstandard directory <include dir>
      CPP         C preprocessor

    Use these variables to override the choices made by `configure' or
to help
    it to find libraries and programs with nonstandard names/locations.

What I've tried to do is compile Python with gprof, adding the -pg flag.
So I ran `CFLAGS=-pg ./configure`, the resulting Makefile did not
contained the -pg in the CFLAGS (or OPT) variables.

Using `make CFLAGS=XXX` will override the CFLAGS definition in the
Makefile, I just want to add to it.
msg57592 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-11-16 19:24
I think you misunderstand. Passing a variable to configure makes that
setting have effect *during the configure run*.
msg57594 - (view) Author: Miki Tebeka (tebeka) * Date: 2007-11-16 19:53
OK, let's close it then.
(However note that in two projects I've checked - vim and pcre the
CFLAGS environment variable do get reflected in the build process)

Any "standard" way to add custom compilation flags?.
msg57595 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-11-16 20:06
> Any "standard" way to add custom compilation flags?.

Beats me. I'm no autoconf expert.
msg57596 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-11-16 20:17
> Any "standard" way to add custom compilation flags?.

See the README. Set OPT to influence the optimization flags;
set EXTRA_CFLAGS otherwise.
History
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45794
2007-11-16 20:17:11loewissetmessages: + msg57596
2007-11-16 20:06:08gvanrossumsetstatus: open -> closed
resolution: wont fix
messages: + msg57595
2007-11-16 19:53:49tebekasetmessages: + msg57594
2007-11-16 19:24:39gvanrossumsetmessages: + msg57592
2007-11-16 19:05:18tebekasetmessages: + msg57591
2007-11-16 18:39:33loewissetnosy: + loewis
messages: + msg57590
2007-11-16 18:28:51gvanrossumsetnosy: + gvanrossum
messages: + msg57589
2007-11-16 18:19:39tebekacreate