Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure script does not honour honor CC environement variable #5418

Closed
vicuna opened this issue Dec 9, 2011 · 8 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link

commented Dec 9, 2011

Original bug ID: 5418
Reporter: michi
Status: closed (set by @damiendoligez on 2015-01-20T17:03:11Z)
Resolution: won't fix
Priority: low
Severity: trivial
Platform: All
OS: All
OS Version: All
Version: 3.12.1
Target version: 4.02.2+dev / +rc1
Category: ~DO NOT USE (was: OCaml general)
Tags: patch
Monitored by: mww

Bug description

OCaml's configure script does not honor some environment variables used by some other configure scripts to convey configuration options. Taking these variables into account makes OCaml build procedure blend smoothly in OS packages systems.

The targeted variables are: CC, AS.

File attachments

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 17, 2011

Comment author: meyer

Hello,

I am not sure what kind of improvement it gives over -cc and -as command line options. In particular, how it should interact with these.

My worry is also that it's too implicit. Why not to say ./configure -cc ${CC} -as ${AS} ?

However I'm not maintaining any packages, so I have no strong evidence if such tweak to environment would work out much better. If you provide some examples how it will improve packaging I'd be grateful.

Best,
Wojciech

@vicuna

This comment has been minimized.

Copy link
Author

commented Feb 6, 2012

Comment author: michi

Hi Wojciech,

Mantis Bug Tracker wrote:

I am not sure what kind of improvement it gives over -cc and -as command line
options. In particular, how it should interact with these.

My worry is also that it's too implicit. Why not to say ./configure -cc ${CC}
-as ${AS} ?

This way of passing arguments to configure files is consistent with the way to pass arguments to Makefiles. GNU Autotools (autoconf et al.) also stick to this convention.

(Most probably, people working on a project requiring fancy compiler options have a shell code snippet setting CC, CFLAGS, etc. that they can source before starting to work in the project.)

However I'm not maintaining any packages, so I have no strong evidence if such
tweak to environment would work out much better. If you provide some examples
how it will improve packaging I'd be grateful.

Taking CC into account makes packaging easier, because CC just works the same way as with other packages. At that time, the FreeBSD port patches ocaml's Makefiles to let them understand CC.

If you are open for a patch, I will submit you a more accurate version than the one I sent the first time.

Best,
Michael

@vicuna

This comment has been minimized.

Copy link
Author

commented Feb 8, 2012

Comment author: @damiendoligez

I tend to agree with Wojciech, it's too implicit. More than once I've had a spurious environment variable that caused strange errors and wasted a lot of my time.

See the discussion of #5385 for an example.

Also, it's not clear whether you want to change the behaviour of "configure" or the Makefiles themselves.

@vicuna

This comment has been minimized.

Copy link
Author

commented Feb 8, 2012

Comment author: michi

It seems that the FreeBSD port will keep its patch to the upstream build system for quite a long time… which is also fine, as far as I am concerned.

However, while I agree that configuration options passed by environment variable may be a bit implicit (and it sometimes bate me as well), I would like to make two points:

  1. There is many build systems using environment variables like CC, CFLAGS and so on as parameters. At least the BSD build system (bsd.prog.mk for instance), the gnu autotools, and virtually all make-alike utility comes with default rules involving these environment variables. So environment variables like CC, CFLAGS, and so on, are stamped use with caution and caution they deserve.

  2. What is broken is not the use environment variables to pass options to a procedure, but inconditionnaly setting them! I have some projects requiring paricular environment variables to be set. Instead of globally setting these variables, I have a .tcshrc file in the root dir of the project, say ~/project/x and an alias project_x='cd ~/project/x && source .tcshrc' which sets me ready to work on the project.

Console programs in KDE or OS-X also have a notion of profile that gives another convenient way to associate custom shells to projects.

Best regards,
Michael

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 21, 2012

Comment author: @avsm

I don't quite understand why the FreeBSD port needs to patch any Makefiles. The OpenBSD port simply passes:

CONFIGURE_ARGS+=-cc '${CC} ${CFLAGS}'

which lets the ports system work fine with a custom CC and/or CFLAGS.

@vicuna

This comment has been minimized.

Copy link
Author

commented Nov 1, 2012

Comment author: michi

While porting ocaml-4.00.1 I decided to switch the old strategy I inherited with the port to the one you suggested.

Meanwhile I noticed that gcc is hardcoded Makefile portions generating dependencies (grep for 'gcc -MM'). The concerned files are:

find . -name Makefile | xargs grep -l 'gcc -MM'
./asmrun/Makefile
./byterun/Makefile
./otherlibs/bigarray/Makefile
./otherlibs/graph/Makefile
./otherlibs/num/Makefile
./otherlibs/str/Makefile
./otherlibs/systhreads/Makefile
./otherlibs/threads/Makefile
./otherlibs/unix/Makefile

As FreeBSD maintainer of the port, I am interested in using clang as a compiler and 'clang -MM' does the same work as 'gcc -MM'.

I made simple tests, and it seems that 'gcc/clang -MM' works fine when given superfluous options, so it could be an acceptable solution to replace 'gcc -MM' by '${CC} -MM'.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jul 11, 2013

Comment author: @damiendoligez

I don't like having gcc hard-coded in the Makefiles. We should see if we can change that.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jan 20, 2015

Comment author: @damiendoligez

For making configure depend on environment variables: we don't want that.

For using $(CC) instead of gcc to generate dependencies: done in trunk (rev 15784).

@vicuna vicuna closed this Jan 20, 2015

@vicuna vicuna added the wontfix label Mar 14, 2019

@vicuna vicuna added this to the 4.02.2 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.