Re: SETPGRP and autoconf

Daniel Jacobowitz
2001-07-27T10:21:00Z

On Thu, Jul 26, 2001 at 01:16:13PM -0400, Andrew Cagney wrote:
> native - already covered, test works
> cross debugger - N/A procfs et.al. do not need the results of the test
> canadian cross - try headers; test is against the build systems
> build-X-host cross compiler and not the build systems build-X-build
> native compiler.
>
> I can't see anyone trying to canadian-cross GDB to anything but a fairly
> modern operating system, consequently, the headers test should work.

How does this look?

Only gotcha - I regenerated configure (not included) with autoconf
2.13, and the existing one claims to be autoconf 2.13, but they have
some noticeable differences - -site-file for instance. Is there a
particular autoconf I should be using?

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer

2001-07-27 Daniel Jacobowitz <drow@mvista.com>

* configure.in: Only invoke AC_FUNC_SETPGRP if not cross-compiling.
Check for SETPGRP_VOID separately if cross-compiling and ISO C
headers are available.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.68
diff -u -r1.68 configure.in
--- configure.in 2001/07/27 16:35:27 1.68
+++ configure.in 2001/07/27 17:14:08
@@ -134,7 +134,24 @@
AC_CHECK_FUNCS(setpgid setpgrp sbrk sigaction isascii bzero bcopy btowc poll sigprocmask)
AC_FUNC_VFORK
AC_FUNC_ALLOCA
-AC_FUNC_SETPGRP
+dnl AC_FUNC_SETPGRP does not work if cross compiling
+dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
+if test "$cross_compiling" = no; then
+ AC_FUNC_SETPGRP
+else
+ AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
+ [AC_TRY_COMPILE([
+#include <unistd.h>
+], [
+ if (setpgrp(1,1) == -1)
+ exit (0);
+ else
+ exit (1);
+], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
+if test $ac_cv_func_setpgrp_void = yes; then
+ AC_DEFINE(SETPGRP_VOID, 1)
+fi
+fi

# Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
# since sigsetjmp might only be defined as a macro.