make .POSIX CC=c17

Brian Inglis Brian.Inglis@SystematicSW.ab.ca
Tue Nov 3 18:49:57 GMT 2026


Thanks Phillip,

Actually that same suggestion was made by our Cygwin make package maintainer.

Looking at getconf variables:

https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_port.html#tag_24_03_02

it appears that the best selection might be:

	POSIX2_SW_DEV

"The system supports the Software Development Utilities option.
This option is required by many systems, even those in which actual software 
development does not occur.
The make utility, in particular, is required by many application software 
packages as they are installed onto the system.
If POSIX2_C_DEV is supported, POSIX2_SW_DEV is almost a mandatory requirement 
because of ar and make."

perhaps with fallback to POSIX2_UPE and/or POSIX2_VERSION:

	$ getconf POSIX2_SW_DEV
	202405
	$ getconf POSIX2_UPE
	202405
	$ getconf POSIX2_VERSION
	202405

and our maintainer also suggested some mechanism to override the desired version 
might be desirable for legacy builds, perhaps one or more of the above as in:

	https://www.gnu.org/software/make/manual/html_node/Overriding.html

for example `make` could support:

	$ make POSIX_SW_DEV=200809	# => .POSIX CC=c99

might be useful for Heirloom suite packages, Freexian Debian ELTS, CIP SLTS 
Linux kernels, and similar.

Cheers!

On 2026-11-03 01:37, Philip Guenther wrote:
> Being compliant to a POSIX version is, in the end, a property of the
> system and runtime configuration, possibly including environment
> variable settings.
> While there *have* been systems released that have provided *runtime*
> environments for multiple versions of standard, where the behavior of
> utilities was tightened by the newer standard to break that system's
> backward compatibility, I don't know of any Open Source systems that
> have gone the route of supporting that.
> (I recall using some version of Solaris 2.x where they documented that
> a compliant, uh, SUSv3, iirc, environment required setting PATH to
> include /usr/xpg3 (?) before certain other dirs, while a SUSv4(?) env
> required /usr/xpg4 before those same dirs.  Or something like that;
> this was something like 25+ years ago.)
> 
> I feel the POSIX view on the C compiler and make utilities are kind of
> a "individually make sense, bad in practice" result:
> * POSIX has required incompatible changes to utility behavior (c.f.
> that Solaris xpg3/xpg4 thing)
> * ...but instead of specing a fixed name for the C compiler and then
> requiring it to behave to match the runtime environment in effect
> (perhaps because that would turn into "why don't we just specify 'cc'
> and fix/break the 'cc' option parsing behavior that everyone depends
> on" fight), they specified per-C-version binaries
> * but that then requires 'make' to change behavior, based on runtime
> environment!
> 
> Maybe GNU make, after going into .POSIX mode, should invoke "getconf
> _POSIX2_VERSION" and set CC based on the output of that, falling back
> to c99 or whatever seems good at time of release.  Will that make the
> most people happy, complying to the version which the rest of the base
> system is saying it complies with?  Certainly seems better than
> complying with a standard that the base system does _not_ comply,
> resulting in 100% failed compiles when $(CC) doesn't exist...

> On Sun, Nov 1, 2026 at 9:57 AM Brian Inglis wrote:
>> SUS V5 POSIX Issue 8 2024 sets CC=c17.
>> Simple patch to src/read.c is at bottom.
>> But you may want to decide if you are going to do anything with the changed
>> requirement about backward/forward compatibility?
>> Perhaps also support .POSIX2008 and .POSIX2024, default to former or latter?
>>
>> https://cgit.git.savannah.gnu.org/cgit/make.git/tree/src/read.c#n1899
>> ...
>> check_specials (struct nameseq *files, int set_default)
>> ...
>>         if (!posix_pedantic && streq (nm, ".POSIX"))
>> ...
>>              /* These default values are based on IEEE Std 1003.1-2008.
>>                 It requires '-O 1' for [CF]FLAGS, but GCC doesn't allow
>>                 space between -O and the number so omit it here.  */
>> -          define_variable_cname ("CC", "c99", o_default, 0);
>> +          define_variable_cname ("CC", "c17", o_default, 0);
-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                 -- Antoine de Saint-Exupéry


More information about the Cygwin-apps mailing list