OSDN Git Service

Fix bogus recursive <stdlib.h> in NEWS-OS 4.0C.
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 May 1995 21:01:15 +0000 (21:01 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 May 1995 21:01:15 +0000 (21:01 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9825 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fixincludes

index 8c7efc0..e4d6f0c 100755 (executable)
@@ -1587,6 +1587,35 @@ if [ -r ${LIB}/$file ]; then
   fi
 fi
 
+# fix bogus recursive stdlib.h in NEWS-OS 4.0C
+file=stdlib.h
+if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
+  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
+  echo Fixing $file, recursive inclusion
+  sed -e '/^#include <stdlib.h>/i\
+#if 0
+' \
+      -e '/^#include <stdlib.h>/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
+    rm -f ${LIB}/$file
+  else
+    # Find any include directives that use "file".
+    for include in `egrep '^[       ]*#[    ]*include[      ]*"[^/]' ${LIB}/$file | sed -e 's/^[    ]*#[    ]*include[      ]*"\([^"]*\)".*$/\1/'`; do
+      dir=`echo $file | sed -e s'|/[^/]*$||'`
+      required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
+    done
+  fi
+fi
+
 # Avoid nested comments on Ultrix 4.3.
 file=rpc/svc.h
 if [ -r $file ] && [ ! -r ${LIB}/$file ]; then