rm -f ${LIB}/types.c
# Default to our preferred type.
if [ "$foo" = __SIZE_TYPE__ ]; then foo="unsigned long int"; fi
- sed -e "s/typedef[ a-z_]*[ ]size_t/typedef $foo size_t/" ${LIB}/$file > ${LIB}/${file}.sed
+ sed -e "s/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef $foo size_t/" ${LIB}/$file > ${LIB}/${file}.sed
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
rm ${LIB}/$file
fi
# Fix this file to avoid interfering with stddef.h, but don't mistakenly
-# match e.g. ssize_t present in AIX for the ps/2.
+# match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
+# set) size_t.
file=sys/types.h
if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
if [ -r ${LIB}/$file ]; then
echo Fixing $file
-sed -e '/[ ]size_t.*;/i\
+sed -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
#ifndef _GCC_SIZE_T\
#define _GCC_SIZE_T' \
- -e '/[ ]size_t.*;/a\
+ -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/a\
#endif' ${LIB}/$file > ${LIB}/${file}.sed
rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
if cmp $file ${LIB}/$file >/dev/null 2>&1; then
fi
fi
+# There are several name conflicts with C++ reserved words in X11
+# header files. These are fixed in some versions, so don't do the
+# fixes if we find __cplusplus in the file. These were found on the
+# RS/6000.
+
+# class in X11/ShellP.h
+file=X11/ShellP.h
+if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
+ mkdir ${LIB}/sys 2>/dev/null
+ cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
+ chmod +w ${LIB}/$file 2>/dev/null
+ chmod a+r ${LIB}/$file 2>/dev/null
+fi
+
+if [ -r ${LIB}/$file ]; then
+ if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
+ true;
+ else
+ echo Fixing $file, field class
+ sed -e '/char [*]class;/i\
+#ifdef __cplusplus\
+ char *c_class;\
+#else' \
+ -e '/char [*]class;/a\
+#endif' ${LIB}/$file > ${LIB}/${file}.sed
+ rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+ fi
+ if cmp $file ${LIB}/$file >/dev/null 2>&1; then
+ rm -f ${LIB}/$file
+ fi
+fi
+# new in Xm/Traversal.h
+file=Xm/Traversal.h
+if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
+ mkdir ${LIB}/sys 2>/dev/null
+ cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
+ chmod +w ${LIB}/$file 2>/dev/null
+ chmod a+r ${LIB}/$file 2>/dev/null
+fi
+
+if [ -r ${LIB}/$file ]; then
+ if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
+ true;
+ else
+ echo Fixing $file, field new
+ sed -e '/Widget old, new;/i\
+#ifdef __cplusplus\
+ Widget old, c_new;\
+#else' \
+ -e '/Widget old, new;/a\
+#endif' ${LIB}/$file > ${LIB}/${file}.sed
+ rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+ fi
+ if cmp $file ${LIB}/$file >/dev/null 2>&1; then
+ rm -f ${LIB}/$file
+ fi
+fi
+# class in Xm/BaseClassI.h
+file=Xm/BaseClassI.h
+if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
+ mkdir ${LIB}/sys 2>/dev/null
+ cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
+ chmod +w ${LIB}/$file 2>/dev/null
+ chmod a+r ${LIB}/$file 2>/dev/null
+fi
+
+if [ -r ${LIB}/$file ]; then
+ if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
+ true;
+ else
+ echo Fixing $file, prototype parameter name
+ sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.sed
+ rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
+ fi
+ if cmp $file ${LIB}/$file >/dev/null 2>&1; then
+ rm -f ${LIB}/$file
+ fi
+fi
+
+
# NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
# Note that version 3 of the NeXT system has wait.h in a different directory,
# so that this code won't do anything. But wait.h in version 3 has a
fi
done
+# This file on SunOS 4 has a very large macro. When the sed loop
+# tries pull it in, it overflows the pattern space size of the SunOS
+# sed (GNU sed does not have this problem). Since the file does not
+# require fixing, we remove it from the fixed directory.
+file=sundev/ipi_error.h
+if [ -r ${LIB}/$file ]; then
+ echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
+ rm -f ${LIB}/$file
+fi
+
echo 'Removing unneeded directories:'
cd $LIB
files=`find . -type d -print | sort -r`