Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Use of values.h breaks build of Tk trunk on macOS

Closed / Fixede058307eef73cf21cf6805ad7c778e1024f9eb7dCreated 9 years agoUpdated 9 years ago
Descriptionplain2017-11-17 21:19:51
After check-in [49ecc78c8b] tclUnixPort.h contains the following

#include <float.h>
#ifndef NO_VALUES_H
#   include <values.h>
#endif

The Macintosh does not have values.h.  Somehow this is detected by the Tcl
configure script, causing -DNO_VALUES_H to be added to CFLAGS.  With this, the
core-8-branch of Tcl builds correctly.  However, the trunk branch of Tk now
fails to build.

There are two parts to this failure.

1) The Mac port of Tk uses the unix/configure script which either does
not check for values.h or perhaps was built on a unix system that does have
values.h.  (There is no autoconf in the XCode toolchain.) In any case,
-DNO_VALUES_H does not get added to the CFLAGS when building Tk.

2) Because TkMacOSXNotify.c needs to use a stub function defined in
TclMacOSXNotify.c, it includes tclInt.h which in turn includes tclUnixPort.h.
Because of the code above, this include fails since NO_VALUES_H is not
defined and values.h does not exist.

When I look at values.h on my linux system I find this comment:

/* This interface is obsolete.  New programs should use
   <limits.h> and/or <float.h> instead of <values.h>.  */

So it would seem to me that, in addition to getting rid of compat/float.h
Tcl should get rid of all references to values.h.  There is no issue with
limits.h.  Both Tcl and Tk include limits.h on the macintosh and on unix
systems.  Moreover the first of the four lines above would suffice, according
to the comment.  If the other three lines are removed then I have verfied that
both Tcl and Tk build correctly on the Macintosh.  With those three lines
gone, the various references to NO_VALUES_H in the configuration code could
also be removed.  There is exactly one place where NO_VALUES_H is used in a
header file and that place would have been removed.

While it would be possible to fix the Tk build by defining NO_VALUES_H in,
say, TkMacOSXPrivate.h it seems cleaner to just get rid of all references
to values.h since it is obsolete for unix and missing on macOS.

- Marc Culler
Referenced by1
fvogelwiki2017-11-18 14:47:00

I think the commit that changed the behaviour is [bf8e546c42d6973c] (removal of float.h)

jan.nijtmansplain2017-11-20 09:01:27
Fully agreed with Marc's analysis. Fixed now on core-8-branch and trunk.

Thanks for the report!
jan.nijtmans Closed ticket [e058307eef]. [History diff]2017-11-20 09:01:39
Log in (anonymous is fine) to add a comment.