* configure.in: Call AC_HEADER_SYS_WAIT.
authorIan Lance Taylor <ian@airs.com>
Mon, 25 Sep 1995 16:22:43 +0000 (16:22 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 25 Sep 1995 16:22:43 +0000 (16:22 +0000)
* configure: Rebuild.
* config.in: Rebuild.
* dlltool.c: Include "libiberty.h" and "bucomm.h".  Don't include
<stdio.h>, <stdlib.h>, or <string.h>.  Don't include <wait.h>.
Include <sys/types.h>.  Use HAVE_SYS_WAIT_H to control whether to
include <sys/wait.h> or define the wait macros by hand.  Don't
declare xmalloc.
(gen_lib_file): Don't assume that sprintf returns the number of
characters; use strlen instead.

binutils/ChangeLog
binutils/configure
binutils/dlltool.c

index 9f59928..06e63ea 100644 (file)
@@ -1,3 +1,16 @@
+Mon Sep 25 12:05:34 1995  Ian Lance Taylor  <ian@cygnus.com>
+
+       * configure.in: Call AC_HEADER_SYS_WAIT.
+       * configure: Rebuild.
+       * config.in: Rebuild.
+       * dlltool.c: Include "libiberty.h" and "bucomm.h".  Don't include
+       <stdio.h>, <stdlib.h>, or <string.h>.  Don't include <wait.h>.
+       Include <sys/types.h>.  Use HAVE_SYS_WAIT_H to control whether to
+       include <sys/wait.h> or define the wait macros by hand.  Don't
+       declare xmalloc.
+       (gen_lib_file): Don't assume that sprintf returns the number of
+       characters; use strlen instead.
+
 Fri Sep 22 17:16:41 1995  Ian Lance Taylor  <ian@cygnus.com>
 
        * objdump.c (disassemble_data): Don't use the old BFD based
index c23c094..c71b90b 100755 (executable)
@@ -785,6 +785,46 @@ else
 fi
 done
 
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 794 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() { return 0; }
+int t() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+if eval $ac_compile; then
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=yes
+else
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
 for ac_func in sbrk utimes
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
@@ -792,7 +832,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 796 "configure"
+#line 836 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -842,7 +882,7 @@ if eval "test \"`echo '$''{'bu_cv_decl_time_t_time_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 846 "configure"
+#line 886 "configure"
 #include "confdefs.h"
 #include <time.h>
 int main() { return 0; }
@@ -874,7 +914,7 @@ if eval "test \"`echo '$''{'bu_cv_decl_time_t_types_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 878 "configure"
+#line 918 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() { return 0; }
@@ -908,7 +948,7 @@ if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 912 "configure"
+#line 952 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_TIME_H
@@ -944,7 +984,7 @@ if eval "test \"`echo '$''{'bu_cv_decl_needed_fprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 948 "configure"
+#line 988 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() { return 0; }
index 2b18bef..c3ac358 100644 (file)
 
 #define PAGE_SIZE 4096
 #define PAGE_MASK (-PAGE_SIZE)
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "getopt.h"
 #include "bfd.h"
-#include <wait.h>
+#include "libiberty.h"
+#include "bucomm.h"
+#include "getopt.h"
+
+#include <sys/types.h>
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#else
+#ifndef WIFEXITED
+#define WIFEXITED(w)   (((w)&0377) == 0)
+#endif
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
+#endif
+#ifndef WTERMSIG
+#define WTERMSIG(w)    ((w) & 0177)
+#endif
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(w) (((w) >> 8) & 0377)
+#endif
+#endif
 
 char *ar_name = "ar";
 char *as_name = "as";
@@ -184,7 +201,6 @@ char *def_file;
 
 char *program_name;
 char *strrchr ();
-char *xmalloc ();
 char *strdup ();
 
 static int machine;
@@ -1092,10 +1108,12 @@ gen_lib_file ()
     {
       if (sol == 0)
        {
-         sol = sprintf (outfile, "crs %s", output_filename);
+         sprintf (outfile, "crs %s", output_filename);
+         sol = strlen (outfile);
        }
 
-      sol += sprintf (outfile + sol, " %ss%d.o", prefix, i);
+      sprintf (outfile + sol, " %ss%d.o", prefix, i);
+      sol = strlen (outfile);
 
       if (sol >100)
        {