Opened 8 years ago

Closed 8 years ago

#1329 closed enhancement (worksforme)

try-compile: optional argument to specify output file

Reported by: Ivan Raikov Owned by:
Priority: major Milestone: 4.12.0
Component: unknown Version: 4.11.0
Keywords: Cc:
Estimated difficulty: trivial

Description

try-compile provides the -o argument with a temporary path to the compiler, however it is sometimes useful to override it and specify the output executable explicitly. For example, the sundials egg setup script compiles a program that when run outputs the version string of the detected SUNDIALS installation, which is then used for conditional compilation. To do this, the script needs to provide its own -o argument, which unfortunately conflicts with the -o already provided by try-compile.

Change History (4)

comment:1 Changed 8 years ago by Mario Domenech Goulart

Note that the example you mention as use-case breaks cross-compilation.

comment:2 in reply to:  1 Changed 8 years ago by Ivan Raikov

Do I understand correctly that in the case of cross-compilation try-compile will create an executable for the target platform rather than the host platform? Is there a better way to extract the version number of a C library that is defined as a macro?

Replying to mario:

Note that the example you mention as use-case breaks cross-compilation.

comment:3 Changed 8 years ago by Mario Domenech Goulart

Hi Ivan. Yes, that's the issue. Maybe in the case of cross-compilation the setup script should expect this information to be provided. If I remember correctly, the crypt egg handles a similar problem.

comment:4 Changed 8 years ago by Ivan Raikov

Resolution: worksforme
Status: newclosed

Thanks for the suggestion to look at crypt. It seems that in the case of cross-compilation, the crypt setup procedure lets the user control the compilation process via environment variables, and in the normal case it uses a Scheme program to detect native features, so I just implemented the same for sundials and no longer rely on try-compile to produce executables in the current directory.

Note: See TracTickets for help on using tickets.