From: Manfred Hollstein Date: Tue, 9 Dec 1997 07:55:17 +0000 (+0000) Subject: configure.in: Check for functions getrlimit and setrlimit. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0a232106fc0b44b5174f179c4efffbc11b186b92;p=gcc.git configure.in: Check for functions getrlimit and setrlimit. * configure.in: Check for functions getrlimit and setrlimit. * cccp.c (main): Check HAVE_GETRLIMIT and HAVE_SETRLIMIT in addition to RLIMIT_STACK to see if we can call getrlimit and setrlimit. From-SVN: r17023 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 516e94b7a4a..8447f251a75 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Tue Dec 9 00:57:38 1997 Manfred Hollstein + + * configure.in: Check for functions getrlimit and setrlimit. + * cccp.c (main): Check HAVE_GETRLIMIT and HAVE_SETRLIMIT in addition + to RLIMIT_STACK to see if we can call getrlimit and setrlimit. + Mon Dec 8 23:53:26 1997 Jay Sachs * Makefile.in (compare*): Handle losing behavior from 4.4bsd make. diff --git a/gcc/cccp.c b/gcc/cccp.c index bf57c685dbc..381d5e9aae1 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -1230,7 +1230,7 @@ main (argc, argv) /* Target-name to write with the dependency information. */ char *deps_target = 0; -#ifdef RLIMIT_STACK +#if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT) /* Get rid of any avoidable limit on stack size. */ { struct rlimit rlim; diff --git a/gcc/configure b/gcc/configure index e2adcd2f3c7..0c0dfd4f0a2 100755 --- a/gcc/configure +++ b/gcc/configure @@ -2415,14 +2415,124 @@ else fi done +for ac_func in getrlimit +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2422: checking for $ac_func" >&5 +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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + +for ac_func in setrlimit +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2477: checking for $ac_func" >&5 +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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:2421: checking whether malloc must be declared" >&5 +echo "configure:2531: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2449,7 +2559,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:2453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_malloc=no else @@ -2471,12 +2581,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:2475: checking whether realloc must be declared" >&5 +echo "configure:2585: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2503,7 +2613,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:2507: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_realloc=no else @@ -2525,12 +2635,12 @@ EOF fi echo $ac_n "checking whether calloc must be declared""... $ac_c" 1>&6 -echo "configure:2529: checking whether calloc must be declared" >&5 +echo "configure:2639: checking whether calloc must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_calloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2557,7 +2667,7 @@ int main() { char *(*pfn) = (char *(*)) calloc ; return 0; } EOF -if { (eval echo configure:2561: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2671: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_calloc=no else @@ -2579,12 +2689,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:2583: checking whether free must be declared" >&5 +echo "configure:2693: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2611,7 +2721,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:2615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_free=no else @@ -2633,12 +2743,12 @@ EOF fi echo $ac_n "checking whether index must be declared""... $ac_c" 1>&6 -echo "configure:2637: checking whether index must be declared" >&5 +echo "configure:2747: checking whether index must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_index'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2665,7 +2775,7 @@ int main() { char *(*pfn) = (char *(*)) index ; return 0; } EOF -if { (eval echo configure:2669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_index=no else @@ -2687,12 +2797,12 @@ EOF fi echo $ac_n "checking whether rindex must be declared""... $ac_c" 1>&6 -echo "configure:2691: checking whether rindex must be declared" >&5 +echo "configure:2801: checking whether rindex must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_rindex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2719,7 +2829,7 @@ int main() { char *(*pfn) = (char *(*)) rindex ; return 0; } EOF -if { (eval echo configure:2723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_rindex=no else @@ -2741,12 +2851,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:2745: checking whether getenv must be declared" >&5 +echo "configure:2855: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2773,7 +2883,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:2777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_getenv=no else @@ -2796,12 +2906,12 @@ fi echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:2800: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "configure:2910: 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 < #include @@ -2813,7 +2923,7 @@ int main() { char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:2817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else diff --git a/gcc/configure.in b/gcc/configure.in index 90875936339..30fed7002ae 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -172,6 +172,8 @@ AC_CHECK_FUNCS(bcmp) AC_CHECK_FUNCS(index) AC_CHECK_FUNCS(rindex) AC_CHECK_FUNCS(kill) +AC_CHECK_FUNCS(getrlimit) +AC_CHECK_FUNCS(setrlimit) GCC_NEED_DECLARATION(malloc) GCC_NEED_DECLARATION(realloc)