~rabbits/public-inbox

[ORCA tool] Better way to check compiler?

Details
Message ID
<CQLW8O5DHNTE.250SAPMT3AS6L@grinningface>
DKIM signature
pass
Download raw message
Hi,

I absolutely love POSIX shell, so when I read that the build script is
written in POSIX shell and automatically detects your compiler I just
had to take a look. Upon doing that, I noticed some interesting behavior
and wanted to ask y’all about that:

So right away I noticed that `tool` defaults to using `cc` if $CC isn’t
set, but `cc` is now deprecated in favor of `c99` acording to POSIX
[2][3]. Is this intenteded, and if so may I ask why?

After that, tool checks if the os is cygwin and CC is mingw, and if so
defaults to gcc. Why does it default to gcc here when it previously
defaults to cc? Also, the comment mentions that this might mess people
up who have clang installed but not gcc, which is correct, and wonders
whether that’s even possible, which it is. Might I suggest testing for
the existance of various compilers using `command -v` to make sure
you’re using one the user has installed?

Finally, I noticed that if CC is clang, tool sets cc_exe to different
things depending on the os. As users can customize their systems so that
they don’t behave in the default way, wouldn’t it also make more sense
here to check for various incarnations of clang with `command -v` before
setting cc_exe?

[1]: https://git.sr.ht/~rabbits/orca/tree/main/item/tool
[2]: https://pubs.opengroup.org/onlinepubs/7908799/xcu/cc.html
[3]: https://pubs.opengroup.org/onlinepubs/009604499/utilities/c99.html

Cheers,
-- 
DJ Chase
They, Them, Theirs
{gemini,https,ipns}://dj-chase.com/

PS: This is a friendly email :-). I’m not great with communicating tone.
Reply to thread Export thread (mbox)