fixincludes (sys/utsname.h): Provide forward declaration of struct utsname on Ultrix...
authorRainer Orth <ro@TechFak.Uni-Bielefeld.DE>
Sun, 3 Jan 1999 20:16:10 +0000 (20:16 +0000)
committerJeff Law <law@gcc.gnu.org>
Sun, 3 Jan 1999 20:16:10 +0000 (13:16 -0700)
        * fixincludes (sys/utsname.h): Provide forward declaration of
        struct utsname on Ultrix V4.[35].

From-SVN: r24470

gcc/ChangeLog
gcc/fixincludes

index 0f6a7680acba919b5fd6af6b29cace60402d2a83..9321e7bf9ed5b917ed8504fb483c86e4d7ed6891 100644 (file)
@@ -1,5 +1,8 @@
 Sun Jan  3 21:01:04 1999  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
+       * fixincludes (sys/utsname.h): Provide forward declaration of
+       struct utsname on Ultrix V4.[35].
+
        * mips.md (div_trap): Use local labels instead of dot-relative
        branches.
 
index 09e10bbed54718648873f47dc30090e216ea0c37..5943dc26518a9897fd2e4b08d54fc756ad1e101c 100755 (executable)
@@ -1657,6 +1657,34 @@ if [ -r ${LIB}/$file ]; then
   fi
 fi
 
+# sys/utsname.h on Ultrix V4.[35] puts the declaration of uname before the
+# definition of struct utsname, so the prototype (added by fixproto) causes
+# havoc.
+file=sys/utsname.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
+fi
+
+if [ -r ${LIB}/$file ] \
+  && grep 'ULTRIX' ${LIB}/$file >/dev/null; then
+  echo Fixing $file, uname declaration
+  sed -e '/^[  ]*extern[       ]*int[  ]*uname();$/i\
+struct utsname;
+'\
+    ${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
+
 # sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition
 # of struct rusage, so the prototype (added by fixproto) causes havoc.
 file=sys/wait.h