Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 0740e7ecc98898210a20a005a8b9ae25807ec1dbac03e843714a4d221fa8bb72
Ticket: e058307eef73cf21cf6805ad7c778e1024f9eb7d
Use of values.h breaks build of Tk trunk on macOS
User & Date: fvogel on 2017-11-18 14:47:00
Changes

  1. comment changed to:
    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
    
  2. icomment:
    I think the commit that changed the behaviour is [bf8e546c42d6973c] (removal of float.h)
    
  3. login: "fvogel"
  4. mimetype: "text/x-fossil-wiki"