diff options
author | DJ Delorie <dj@redhat.com> | 2003-02-22 17:08:34 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2003-02-22 17:08:34 +0000 |
commit | cc529274241cd4e72f7d03479b34f3779df479f1 (patch) | |
tree | cb29b6c945ccc680414d46c9ee7128aaf8b3923d | |
parent | b631436bb9381026916d8f10ba0e115a189502c0 (diff) | |
download | gdb-cc529274241cd4e72f7d03479b34f3779df479f1.zip gdb-cc529274241cd4e72f7d03479b34f3779df479f1.tar.gz gdb-cc529274241cd4e72f7d03479b34f3779df479f1.tar.bz2 |
merge from gcc
-rw-r--r-- | libiberty/ChangeLog | 15 | ||||
-rw-r--r-- | libiberty/Makefile.in | 1 | ||||
-rw-r--r-- | libiberty/config.in | 12 | ||||
-rwxr-xr-x | libiberty/configure | 114 | ||||
-rw-r--r-- | libiberty/configure.in | 9 | ||||
-rw-r--r-- | libiberty/physmem.c | 57 |
6 files changed, 142 insertions, 66 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 3e129d2..d15e15a 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,18 @@ +2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in: Check for sys/systemcfg.h and + _system_configuration. + * physmem.c: Add support for AIX. Tweek formatting as per + upstream coreutils beta. + +2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + Richard Earnshaw <rearnsha@arm.com> + Geoffrey Keating <geoffk@apple.com> + + * configure.in: Check for sys/sysctl.h and sysctl. + * physmem.c: Add support for *bsd and darwin. + * Makefile.in: Generate depedency for physmem.o. + 2003-02-21 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Use getsysinfo on diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index a12ebb1..0641796 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -466,6 +466,7 @@ pex-msdos.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ pex-os2.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h pex-unix.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h pex-win32.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h +physmem.o: config.h $(INCDIR)/libiberty.h putenv.o: config.h $(INCDIR)/ansidecl.h random.o: $(INCDIR)/ansidecl.h regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h diff --git a/libiberty/config.in b/libiberty/config.in index cd2e735..f0e1746 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -183,6 +183,9 @@ /* Define if you have the sysconf function. */ #undef HAVE_SYSCONF +/* Define if you have the sysctl function. */ +#undef HAVE_SYSCTL + /* Define if you have the sysmp function. */ #undef HAVE_SYSMP @@ -249,12 +252,18 @@ /* Define if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H +/* Define if you have the <sys/sysctl.h> header file. */ +#undef HAVE_SYS_SYSCTL_H + /* Define if you have the <sys/sysinfo.h> header file. */ #undef HAVE_SYS_SYSINFO_H /* Define if you have the <sys/sysmp.h> header file. */ #undef HAVE_SYS_SYSMP_H +/* Define if you have the <sys/systemcfg.h> header file. */ +#undef HAVE_SYS_SYSTEMCFG_H + /* Define if you have the <sys/table.h> header file. */ #undef HAVE_SYS_TABLE_H @@ -282,6 +291,9 @@ /* Define if you have the sys_siglist variable. */ #undef HAVE_SYS_SIGLIST +/* Define if you have the _system_configuration variable. */ +#undef HAVE__SYSTEM_CONFIGURATION + /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ diff --git a/libiberty/configure b/libiberty/configure index 4d5b9ac..3f46ebf 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -1356,7 +1356,7 @@ else fi echo "$ac_t""$CPP" 1>&6 -for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h +for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -1735,11 +1735,11 @@ funcs="$funcs waitpid" # Also in the old function.def file: alloca, vfork, getopt. -vars="sys_errlist sys_nerr sys_siglist" +vars="sys_errlist sys_nerr sys_siglist _system_configuration" checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp" -checkfuncs="$checkfuncs getsysinfo table" +checkfuncs="$checkfuncs getsysinfo table sysctl" # These are neither executed nor required, but they help keep # autoheader happy without adding a bunch of text to acconfig.h. @@ -2129,7 +2129,7 @@ else fi done - for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table + for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2136: checking for $ac_func" >&5 @@ -2251,6 +2251,10 @@ EOF #define HAVE_SYS_SIGLIST 1 EOF + cat >> confdefs.h <<\EOF +#define HAVE__SYSTEM_CONFIGURATION 1 +EOF + fi # For each of these functions, if the host does not provide the @@ -2445,7 +2449,7 @@ if test -z "${setobjs}"; then # We haven't set the list of objects yet. Use the standard autoconf # tests. This will only work if the compiler works. echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2449: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2453: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2456,12 +2460,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2460 "configure" +#line 2464 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2487,19 +2491,19 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2491: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2495: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross for ac_func in $funcs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2498: checking for $ac_func" >&5 +echo "configure:2502: 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 <<EOF -#line 2503 "configure" +#line 2507 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2522,7 +2526,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2549,12 +2553,12 @@ done echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2553: checking whether alloca needs Cray hooks" >&5 +echo "configure:2557: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2558 "configure" +#line 2562 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -2579,12 +2583,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2583: checking for $ac_func" >&5 +echo "configure:2587: 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 <<EOF -#line 2588 "configure" +#line 2592 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2607,7 +2611,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2633,7 +2637,7 @@ fi fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2637: checking stack direction for C alloca" >&5 +echo "configure:2641: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2641,7 +2645,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2645 "configure" +#line 2649 "configure" #include "confdefs.h" find_stack_direction () { @@ -2660,7 +2664,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:2664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2682,17 +2686,17 @@ EOF ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2686: checking for vfork.h" >&5 +echo "configure:2690: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2691 "configure" +#line 2695 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2717,18 +2721,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2721: checking for working vfork" >&5 +echo "configure:2725: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2727: checking for vfork" >&5 +echo "configure:2731: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2732 "configure" +#line 2736 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -2751,7 +2755,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:2755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2773,7 +2777,7 @@ fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext <<EOF -#line 2777 "configure" +#line 2781 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -2868,7 +2872,7 @@ main() { } } EOF -if { (eval echo configure:2872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2900,12 +2904,12 @@ fi for ac_func in _doprnt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2904: checking for $ac_func" >&5 +echo "configure:2908: 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 <<EOF -#line 2909 "configure" +#line 2913 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2928,7 +2932,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2958,12 +2962,12 @@ done for ac_func in _doprnt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2962: checking for $ac_func" >&5 +echo "configure:2966: 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 <<EOF -#line 2967 "configure" +#line 2971 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2986,7 +2990,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3014,19 +3018,19 @@ done for v in $vars; do echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:3018: checking for $v" >&5 +echo "configure:3022: checking for $v" >&5 if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3023 "configure" +#line 3027 "configure" #include "confdefs.h" int *p; int main() { extern int $v []; p = $v; ; return 0; } EOF -if { (eval echo configure:3030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "libiberty_cv_var_$v=yes" else @@ -3052,12 +3056,12 @@ EOF for ac_func in $checkfuncs do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3056: checking for $ac_func" >&5 +echo "configure:3060: 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 <<EOF -#line 3061 "configure" +#line 3065 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3080,7 +3084,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3105,12 +3109,12 @@ fi done echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:3109: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:3113: checking whether canonicalize_file_name must be declared" >&5 if eval "test \"`echo '$''{'libiberty_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3114 "configure" +#line 3118 "configure" #include "confdefs.h" #include "confdefs.h" @@ -3132,7 +3136,7 @@ int main() { char *(*pfn) = (char *(*)) canonicalize_file_name ; return 0; } EOF -if { (eval echo configure:3136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libiberty_cv_decl_needed_canonicalize_file_name=no else @@ -3168,17 +3172,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3172: checking for $ac_hdr" >&5 +echo "configure:3176: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3177 "configure" +#line 3181 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3207,12 +3211,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3211: checking for $ac_func" >&5 +echo "configure:3215: 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 <<EOF -#line 3216 "configure" +#line 3220 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3235,7 +3239,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3260,7 +3264,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3264: checking for working mmap" >&5 +echo "configure:3268: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3268,7 +3272,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 3272 "configure" +#line 3276 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -3408,7 +3412,7 @@ main() } EOF -if { (eval echo configure:3412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3432,7 +3436,7 @@ fi echo $ac_n "checking for working strncmp""... $ac_c" 1>&6 -echo "configure:3436: checking for working strncmp" >&5 +echo "configure:3440: checking for working strncmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3440,7 +3444,7 @@ else ac_cv_func_strncmp_works=no else cat > conftest.$ac_ext <<EOF -#line 3444 "configure" +#line 3448 "configure" #include "confdefs.h" /* Test by Jim Wilson and Kaveh Ghazi. @@ -3504,7 +3508,7 @@ main () } EOF -if { (eval echo configure:3508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_strncmp_works=yes else diff --git a/libiberty/configure.in b/libiberty/configure.in index 3b842fc..5b38660 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -142,7 +142,7 @@ AC_SUBST_FILE(host_makefile_frag) # It's OK to check for header files. Although the compiler may not be # able to link anything, it had better be able to at least compile # something. -AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h) +AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h) AC_HEADER_SYS_WAIT AC_HEADER_TIME @@ -204,11 +204,11 @@ funcs="$funcs waitpid" # Also in the old function.def file: alloca, vfork, getopt. -vars="sys_errlist sys_nerr sys_siglist" +vars="sys_errlist sys_nerr sys_siglist _system_configuration" checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp" -checkfuncs="$checkfuncs getsysinfo table" +checkfuncs="$checkfuncs getsysinfo table sysctl" # These are neither executed nor required, but they help keep # autoheader happy without adding a bunch of text to acconfig.h. @@ -220,11 +220,12 @@ if test "x" = "y"; then AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf) AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal) AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs) - AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo table) + AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl) AC_CHECK_FUNCS(realpath canonicalize_file_name) AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) + AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, [Define if you have the _system_configuration variable.]) fi # For each of these functions, if the host does not provide the diff --git a/libiberty/physmem.c b/libiberty/physmem.c index 2011f02..80fdd79 100644 --- a/libiberty/physmem.c +++ b/libiberty/physmem.c @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Written by Paul Eggert and Jim Meyering. */ +/* Written by Paul Eggert. */ #if HAVE_CONFIG_H # include <config.h> @@ -30,16 +30,30 @@ #endif #if HAVE_SYS_SYSMP_H -#include <sys/sysmp.h> +# include <sys/sysmp.h> #endif #if HAVE_SYS_SYSINFO_H && HAVE_MACHINE_HAL_SYSINFO_H -# include <sys/sysinfo.h> -# include <machine/hal_sysinfo.h> +# include <sys/sysinfo.h> +# include <machine/hal_sysinfo.h> #endif #if HAVE_SYS_TABLE_H -# include <sys/table.h> +# include <sys/table.h> +#endif + +#include <sys/types.h> + +#if HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif + +#if HAVE_SYS_SYSCTL_H +# include <sys/sysctl.h> +#endif + +#if HAVE_SYS_SYSTEMCFG_H +# include <sys/systemcfg.h> #endif #include "libiberty.h" @@ -73,7 +87,7 @@ physmem_total () #if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE { /* This works on irix6. */ struct rminfo realmem; - if (sysmp(MP_SAGET, MPSA_RMINFO, &realmem, sizeof(realmem)) == 0) + if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0) { double pagesize = sysconf (_SC_PAGESIZE); double pages = realmem.physmem; @@ -98,6 +112,23 @@ physmem_total () } #endif +#if HAVE_SYSCTL && defined HW_PHYSMEM + { /* This works on *bsd and darwin. */ + unsigned int physmem; + size_t len = sizeof(physmem); + static int mib[2] = {CTL_HW, HW_PHYSMEM}; + + if (sysctl(mib, ARRAY_SIZE(mib), &physmem, &len, NULL, 0) == 0 + && len == sizeof (physmem)) + return (double)physmem; + } +#endif + +#if HAVE__SYSTEM_CONFIGURATION + /* This works on AIX. */ + return _system_configuration.physmem; +#endif + /* Return 0 if we can't determine the value. */ return 0; } @@ -133,7 +164,7 @@ physmem_available () #if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE { /* This works on irix6. */ struct rminfo realmem; - if (sysmp(MP_SAGET, MPSA_RMINFO, &realmem, sizeof(realmem)) == 0) + if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0) { double pagesize = sysconf (_SC_PAGESIZE); double pages = realmem.availrmem; @@ -158,6 +189,18 @@ physmem_available () } #endif +#if HAVE_SYSCTL && defined HW_USERMEM + { /* This works on *bsd and darwin. */ + unsigned int usermem; + size_t len = sizeof(usermem); + static int mib[2] = {CTL_HW, HW_USERMEM}; + + if (sysctl(mib, ARRAY_SIZE(mib), &usermem, &len, NULL, 0) == 0 + && len == sizeof (usermem)) + return (double)usermem; + } +#endif + /* Guess 25% of physical memory. */ return physmem_total () / 4; } |