diff --git a/gdb/config.in b/gdb/config.in index 187b42ca29b..db63aeaec75 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -586,9 +586,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H -/* Define to 1 if you have the `waitpid' function. */ -#undef HAVE_WAITPID - /* Define to 1 if you have the header file. */ #undef HAVE_WAIT_H diff --git a/gdb/configure b/gdb/configure index 138c2a153b7..de750f4fafe 100755 --- a/gdb/configure +++ b/gdb/configure @@ -29924,7 +29924,6 @@ for ac_func in \ sigsetmask \ ttrace \ use_default_colors \ - waitpid \ wresize \ do : diff --git a/gdb/configure.ac b/gdb/configure.ac index d638b8f3c8e..230c0be79c7 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1389,7 +1389,6 @@ AC_CHECK_FUNCS([ \ sigsetmask \ ttrace \ use_default_colors \ - waitpid \ wresize \ ]) diff --git a/gdbsupport/config.in b/gdbsupport/config.in index 8467072752a..0beacf22c05 100644 --- a/gdbsupport/config.in +++ b/gdbsupport/config.in @@ -319,6 +319,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H +/* Define to 1 if you have the `wait' function. */ +#undef HAVE_WAIT + +/* Define to 1 if you have the `waitpid' function. */ +#undef HAVE_WAITPID + /* Define to 1 if you have the header file. */ #undef HAVE_WAIT_H diff --git a/gdbsupport/configure b/gdbsupport/configure index 87980f6870f..67a48c47305 100755 --- a/gdbsupport/configure +++ b/gdbsupport/configure @@ -13948,6 +13948,22 @@ else fi +for ac_func in \ + waitpid \ + wait + +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + # Check the return and argument types of ptrace. diff --git a/gdbsupport/configure.ac b/gdbsupport/configure.ac index b30b4365f53..92e2a852111 100644 --- a/gdbsupport/configure.ac +++ b/gdbsupport/configure.ac @@ -56,6 +56,11 @@ AM_CONDITIONAL(SELFTEST, $enable_unittests) AM_CONDITIONAL(HAVE_PIPE_OR_PIPE2, [test x$ac_cv_func_pipe = xyes -o x$ac_cv_func_pipe2 = xyes ]) +AC_CHECK_FUNCS([ \ + waitpid \ + wait + ]) + # Check the return and argument types of ptrace. GDB_AC_PTRACE diff --git a/gdbsupport/eintr.h b/gdbsupport/eintr.h index 3980e3f5ac1..4cab8f9d48d 100644 --- a/gdbsupport/eintr.h +++ b/gdbsupport/eintr.h @@ -71,11 +71,13 @@ handle_eintr (ErrorValType errval, const Fun &f, const Args &... args) return ret; } +#ifdef HAVE_WAITPID inline pid_t waitpid (pid_t pid, int *wstatus, int options) { return gdb::handle_eintr (-1, ::waitpid, pid, wstatus, options); } +#endif /* HAVE_WAITPID */ inline int open (const char *pathname, int flags) @@ -83,11 +85,13 @@ open (const char *pathname, int flags) return gdb::handle_eintr (-1, ::open, pathname, flags); } +#ifdef HAVE_WAIT inline pid_t wait (int *wstatus) { return gdb::handle_eintr (-1, ::wait, wstatus); } +#endif /* HAVE_WAIT */ inline int close (int fd)