PATCH: Support older POSIX header order requirement

Loren James Rittle rittle@latour.rsch.comm.mot.com
Fri Jun 7 15:36:00 GMT 2002


>>> I will produce a patch that reorders them in
>>> testsuite/testsuite_hooks.cc and the related configure tests.

>> Thanks.  I thought we'd gotten this right from the start...  Huh.

> Well, I too thought that it worked in some form for my port way back.

Assumption: Any system that has a reasonable POSIX <sys/resource.h>
surely has a reasonable <sys/time.h> and it is always correct to move
<unistd.h> to the front of the include list.  But I'd like Phil's
commit approval for mainline. ;-)

(Rebuilt libstdc++-v3 on i386-unknown-freebsd4.6

	* acinclude.m4 (GLIBCPP_CHECK_SETRLIMIT_ancilliary): Reorder and
	include all required headers for test against older POSIX standard.
	(GLIBCPP_CHECK_SETRLIMIT): Likewise.
	(ac_setrlimit): Likewise.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/testsuite_hooks.cc: Reorder and include all
	required headers for use against older POSIX standard.

Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.207
diff -c -r1.207 acinclude.m4
*** acinclude.m4	27 May 2002 14:54:46 -0000	1.207
--- acinclude.m4	7 Jun 2002 22:15:07 -0000
***************
*** 1971,1978 ****
  dnl Check for headers for, and arguments to, the setrlimit() function.
  dnl Used only in testsuite_hooks.h.
  AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
!   AC_TRY_COMPILE([#include <sys/resource.h>
!                   #include <unistd.h>
                   ], [ int f = RLIMIT_$1 ; ],
                   [glibcpp_mresult=1], [glibcpp_mresult=0])
    AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
--- 1971,1979 ----
  dnl Check for headers for, and arguments to, the setrlimit() function.
  dnl Used only in testsuite_hooks.h.
  AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
!   AC_TRY_COMPILE([#include <unistd.h>
!                   #include <sys/time.h>
!                   #include <sys/resource.h>
                   ], [ int f = RLIMIT_$1 ; ],
                   [glibcpp_mresult=1], [glibcpp_mresult=0])
    AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
***************
*** 1980,1986 ****
  ])
  AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
    setrlimit_have_headers=yes
!   AC_CHECK_HEADERS(sys/resource.h unistd.h,
                     [],
                     setrlimit_have_headers=no)
    # If don't have the headers, then we can't run the tests now, and we
--- 1981,1987 ----
  ])
  AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
    setrlimit_have_headers=yes
!   AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
                     [],
                     setrlimit_have_headers=no)
    # If don't have the headers, then we can't run the tests now, and we
***************
*** 1994,2001 ****
  
      # Check for rlimit, setrlimit.
      AC_CACHE_VAL(ac_setrlimit, [
!       AC_TRY_COMPILE([#include <sys/resource.h>
! 		      #include <unistd.h>
  		     ], 
                       [ struct rlimit r; setrlimit(0, &r);], 
                       [ac_setrlimit=yes], [ac_setrlimit=no])
--- 1995,2003 ----
  
      # Check for rlimit, setrlimit.
      AC_CACHE_VAL(ac_setrlimit, [
!       AC_TRY_COMPILE([#include <unistd.h>
!                   #include <sys/time.h>
!                   #include <sys/resource.h>
  		     ], 
                       [ struct rlimit r; setrlimit(0, &r);], 
                       [ac_setrlimit=yes], [ac_setrlimit=no])
Index: testsuite/testsuite_hooks.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/testsuite_hooks.cc,v
retrieving revision 1.2
diff -c -r1.2 testsuite_hooks.cc
*** testsuite/testsuite_hooks.cc	7 Jun 2002 20:25:04 -0000	1.2
--- testsuite/testsuite_hooks.cc	7 Jun 2002 22:15:07 -0000
***************
*** 30,37 ****
  #include <testsuite_hooks.h>
  
  #ifdef _GLIBCPP_MEM_LIMITS
- #include <sys/resource.h>
  #include <unistd.h>
  
  void
  __set_testsuite_memlimit(float __size)
--- 30,38 ----
  #include <testsuite_hooks.h>
  
  #ifdef _GLIBCPP_MEM_LIMITS
  #include <unistd.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
  
  void
  __set_testsuite_memlimit(float __size)



More information about the Libstdc++ mailing list