+Tue Jun 30 14:03:34 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * aclocal.m4 (GCC_NEED_DECLARATION): Accept an optional second
+ argument, which is typically preprocessor code used to draw in
+ additional header files when looking for a function declaration.
+ (GCC_NEED_DECLARATIONS): Likewise.
+
+ * configure.in (GCC_NEED_DECLARATIONS): Add checks for getrlimit
+ and setrlimit, search for them in sys/resource.h.
+
+ * acconfig.h: Add stubs for NEED_DECLARATION_GETRLIMIT and
+ NEED_DECLARATION_SETRLIMIT.
+
+ * system.h: Prototype getrlimit/setrlimit if necessary.
+
Tue Jun 30 10:54:48 1998 Mark Mitchell <mark@markmitchell.com>
* rtl.texi: Don't say that RTX_INTEGRATED_P is unused.
/* Whether getwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETWD
+/* Whether getrlimit must be declared even if <sys/resource.h> is included. */
+#undef NEED_DECLARATION_GETRLIMIT
+
+/* Whether setrlimit must be declared even if <sys/resource.h> is included. */
+#undef NEED_DECLARATION_SETRLIMIT
+
/* Define if you want expensive run-time checks. */
#undef ENABLE_CHECKING
@TOP@
dnl See whether we need a declaration for a function.
+dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
AC_DEFUN(GCC_NEED_DECLARATION,
[AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(gcc_cv_decl_needed_$1,
#endif
#ifndef HAVE_INDEX
#define index strchr
-#endif],
+#endif
+$2],
[char *(*pfn) = (char *(*)) $1],
eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
])dnl
dnl Check multiple functions to see whether each needs a declaration.
+dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
AC_DEFUN(GCC_NEED_DECLARATIONS,
[for ac_func in $1
do
-GCC_NEED_DECLARATION($ac_func)
+GCC_NEED_DECLARATION($ac_func, $2)
done
])
/* Whether getwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETWD
+/* Whether getrlimit must be declared even if <sys/resource.h> is included. */
+#undef NEED_DECLARATION_GETRLIMIT
+
+/* Whether setrlimit must be declared even if <sys/resource.h> is included. */
+#undef NEED_DECLARATION_SETRLIMIT
+
+/* Define if you want expensive run-time checks. */
+#undef ENABLE_CHECKING
+
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
#ifndef HAVE_INDEX
#define index strchr
#endif
+
+int main() {
+char *(*pfn) = (char *(*)) $ac_func
+; return 0; }
+EOF
+if { (eval echo configure:1985: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ eval "gcc_cv_decl_needed_$ac_func=no"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "gcc_cv_decl_needed_$ac_func=yes"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$gcc_cv_decl_needed_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ gcc_tr_decl=NEED_DECLARATION_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $gcc_tr_decl 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+done
+
+
+for ac_func in getrlimit setrlimit
+do
+echo $ac_n "checking whether $ac_func must be declared""... $ac_c" 1>&6
+echo "configure:2014: checking whether $ac_func must be declared" >&5
+if eval "test \"`echo '$''{'gcc_cv_decl_needed_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2019 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifndef HAVE_RINDEX
+#define rindex strrchr
+#endif
+#ifndef HAVE_INDEX
+#define index strchr
+#endif
+#include <sys/types.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
int main() {
char *(*pfn) = (char *(*)) $ac_func
; return 0; }
EOF
-if { (eval echo configure:1984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2051: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "gcc_cv_decl_needed_$ac_func=no"
else
echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:2011: checking for sys_siglist declaration in signal.h or unistd.h" >&5
+echo "configure:2078: checking for sys_siglist declaration in signal.h or unistd.h" >&5
if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2016 "configure"
+#line 2083 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
char *msg = *(sys_siglist + 1);
; return 0; }
EOF
-if { (eval echo configure:2028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_decl_sys_siglist=yes
else
# Figure out what assembler alignment features are present.
echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6
-echo "configure:5151: checking assembler alignment features" >&5
+echo "configure:5218: checking assembler alignment features" >&5
gcc_cv_as=
gcc_cv_as_alignment_features=
if [ -x as$host_exeext ]; then
GCC_NEED_DECLARATIONS(malloc realloc calloc free bcopy bzero bcmp \
index rindex getenv atol sbrk abort atof strerror getcwd getwd)
+GCC_NEED_DECLARATIONS(getrlimit setrlimit, [
+#include <sys/types.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+])
+
AC_DECL_SYS_SIGLIST
# File extensions
extern char *sys_errlist[];
#endif /* HAVE_STRERROR */
+#ifdef HAVE_GETRLIMIT
+# ifdef NEED_DECLARATION_GETRLIMIT
+# ifndef getrlimit
+extern int getrlimit ();
+# endif
+# endif
+#endif
+
+#ifdef HAVE_SETRLIMIT
+# ifdef NEED_DECLARATION_SETRLIMIT
+# ifndef setrlimit
+extern int setrlimit ();
+# endif
+# endif
+#endif
+
/* HAVE_VOLATILE only refers to the stage1 compiler. We also check
__STDC__ and assume gcc sets it and has volatile in stage >=2. */
#if !defined(HAVE_VOLATILE) && !defined(__STDC__) && !defined(volatile)