5 # fixinc.interix -- Install modified versions of Interix system include
8 # Based on fixinc.sco script by Ian Lance Taylor (ian@airs.com)).
9 # With modifications by Douglas Rupp (drupp@cs.washington.edu)
11 # Copyright (C) 1999 Free Software Foundation, Inc.
13 # This file is part of GNU CC.
15 # GNU CC is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2, or (at your option)
20 # GNU CC is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with GNU CC; see the file COPYING. If not, write to
27 # the Free Software Foundation, 59 Temple Place - Suite 330,
28 # Boston, MA 02111-1307, USA.
30 # ?????? fixup comment
31 # This script munges the native include files provided with Windows NT
32 # 3.5 SDK systems so as to provide a reasonable namespace when
33 # compiling with gcc. The header files by default do not
34 # provide many essential definitions and declarations if
35 # __STDC__ is 1. This script modifies the header files to check
36 # for __STRICT_ANSI__ being defined instead. Once munged, the
37 # resulting new system include files are placed in a directory
38 # that GNU C will search *before* searching the Include
41 # See README-fixinc for more information.
43 # Fail if no arg to specify a directory for the output.
45 then echo fixincludes
: no output directory specified
49 # Directory in which to store the results.
52 # Make sure it exists.
53 if [ ! -d $LIB ]; then
57 ORIG_DIR
=`${PWDCMD-pwd}`
59 # Make LIB absolute if it is relative.
60 # Don't do this if not necessary, since may screw up automounters.
65 cd $LIB; LIB
=`${PWDCMD-pwd}`
69 echo 'Building fixincludes in ' ${LIB}
71 # Determine whether this filesystem has symbolic links.
72 if ln -s X
$LIB/ShouldNotExist
2>/dev
/null
; then
73 rm -f $LIB/ShouldNotExist
79 echo 'Making directories:'
80 # Directory containing the original header files.
82 if [ $# -eq 0 ] ; then
88 for INPUT
in ${INLIST} ; do
93 files
=`ls -LR | sed -n s/:$//p`
95 files
=`find . -type d -print | sed '/^\.$/d'`
98 if [ "x$files" = x
]; then
99 echo No files found
in $INPUT\
; skipped
103 for file in $files; do
105 if [ ! -d $LIB/$file ]
106 then mkdir
$LIB/$file
110 # treetops gets an alternating list
111 # of old directories to copy
112 # and the new directories to copy to.
113 treetops
="${INPUT} ${LIB}"
116 while [ $# != 0 ]; do
117 # $1 is an old directory to copy, and $2 is the new directory to copy to.
118 echo "Finding header files in $1:"
121 files
=`find . -name '*.[hH]' -type f -print`
122 echo "Checking header files in $1; transforming into directory $2:"
123 for file in $files; do
125 if [ -r $file ]; then
126 cp $file $2/$file >/dev
/null
2>&1 ||
echo "Can't copy $file"
127 chmod +w
,a
+r
$2/$file
129 # The following have been removed from the sed command below
130 # because it is more useful to leave these things in.
131 # The only reason to remove them was for -pedantic,
132 # which isn't much of a reason. -- rms.
135 # s/!__STDC__/!defined (__STRICT_ANSI__)/g
137 sed -e '/#[ ]*include.*[<"][A-Za-z]:\\/ s,\\,/,g' \
138 -e '/#[ ]*include.*[<"][A-Za-z]:\// s,\([A-Za-z]\):/,//\1/,' \
139 -e '\,#[ ]*include.*[<"]//[A-Za-z]/, y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,' \
140 -e '\,#[ ]*INCLUDE.*[<"]//[A-Za-z]/, s,INCLUDE,include,' \
141 $2/$file > $2/$file.
sed
143 mv $2/$file.
sed $2/$file
144 if cmp $file $2/$file >/dev
/null
2>&1; then
155 echo 'Removing unneeded directories:'
156 # (Rmdir leaf to root, and if the rmdir fails, who cares....)
158 files
=`find . -type d -print | sort -r`
159 for file in $files; do
160 rmdir $LIB/$file > /dev
/null
2>&1
163 done # for include directory list
165 if [ x
${INSTALL_ASSERT_H} != x
]
168 rm -f include
/assert.h
169 cp ${srcdir}/assert.h include
/assert.h ||
exit 1
170 chmod a
+r include
/assert.h