egallesio / STklos

STklos Scheme
http://stklos.net
GNU General Public License v2.0
70 stars 17 forks source link

Fix unreachable code in configure script #489

Closed ryandesign closed 1 year ago

ryandesign commented 1 year ago

This PR offers three commits to collectively address the realization that there is a block of code in the configure script that is unreachable:

https://github.com/egallesio/STklos/blob/393b8f4ecf4117c8c23e3c32ce3caa050218fb03/configure.ac#L95-L112

That case statement switches on the OS_NAME_VERSION variable but that variable is not defined until later in the script.

Prior to 67ea10f7 the case statement switched on the OS variable which did exist, having been defined by the shlib-options script which is invoked before the case statement:

https://github.com/egallesio/STklos/blob/393b8f4ecf4117c8c23e3c32ce3caa050218fb03/configure.ac#L93


In the first commit, I stop defining _XOPEN_SOURCE on Darwin 10 because that's not needed with the currently bundled version of gc.

In the second commit, I stop adding the MacPorts include path on Darwin 10 because hopefully that's not needed since the configure script finds dependencies (except gmp) with pkg-config. (And if it were needed it would be needed on all Darwin versions not just 10.)

In the third commit I make the case statement operational again by having it look at the OS variable again. Now, unknown operating systems are once again greeted with an error message, and on Solaris -DSOLARIS is once again added to CFLAGS and -lsocket -lrt -lnsl -lpthread is once again added to LIBS. I don't know whether this is good or bad for Solaris — either the Solaris build has been broken for 13 years and this will fix it, or the Solaris build has been working fine without these flags and adding them may break it. This is the only code I could find that checks if SOLARIS is defined:

https://github.com/egallesio/STklos/blob/393b8f4ecf4117c8c23e3c32ce3caa050218fb03/src/system.c#L1817-L1824

egallesio commented 1 year ago

Thanks a lot Ryan for this PR (and the very detailed explanation). About SOLARIS, as you said, it is very probable that it doesn't work for several years (however, I haven't seen such a machine, or a Solaris user for years :wink:)