Opened 18 years ago
Closed 18 years ago
#1099 closed defect (fixed)
Remove '/usr/include/sys' from "xtrapath" in "psconfig.csh.in" under "darwin" case statement
| Reported by: | Michael Wood-Vasey | Owned by: | eugene |
|---|---|---|---|
| Priority: | highest | Milestone: | |
| Component: | psconfig | Version: | 2.5 |
| Severity: | major | Keywords: | |
| Cc: |
Description
In 'psconfig.csh.in' there is the following snippet of code for darwin but for nobody else:
case darwin:
case darwin_x86:
set xtralibs = ( $xtralibs "/sw/lib" )
set xtrapath = ( $xtrapath "/sw/include" "/usr/include/sys")
breaksw;
The "/usr/include/sys" is a mistake and should be removed. Here's why:
The 'xtrapath' gets added onto CPATH.
# add to CPATH if not found
foreach name ($xtrapath)
echo $CPATH | grep $name > /dev/null
if ($status == 0) continue
setenv CPATH {$CPATH}{$name}:
end
CPATH is included before any other include directories, including the default system directories. However, system include directories get _removed_ from CPATH and put back in their normal place after the surviving CPATH directories. This is a defined feature but certainly not what was expected by who ever added '/usr/include/sys' to the 'xtrapath' definition above.
Here's what happens when you sort through the priorities. CPATH is set to include /usr/include and /usr/include/sys. But /usr/include is in the default system list and so gets _rejected_ from CPATH. However, /usr/include/sys is not in the default system list because one is always supposed to refer to such files as #include <sys/time.h>. Thus /usr/include/sys gets kept in the list of include directories to search _before_ the
system directories and thus /usr/include/sys gets searched before /usr/include. This causes problems when there are files of the same name in /usr/include and /usr/include/sys because they will be found in '/usr/include/sys' everytime and never be found in '/usr/include'. The proper behavior is the opposite.
Fixing this will be critical in allow people to compile on Mac OS X/Darwin.

Done.