mirror of git://gcc.gnu.org/git/gcc.git
configure.in: Check for sys/sysmp.h and sysmp.
* configure.in: Check for sys/sysmp.h and sysmp. * physmem.c: Pull upstream copy, add support for irix6. * config.in, configure: Regenerated. From-SVN: r63237
This commit is contained in:
parent
934b8c40fe
commit
64c7e556ab
|
@ -1,3 +1,10 @@
|
||||||
|
2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
|
* configure.in: Check for sys/sysmp.h and sysmp.
|
||||||
|
* physmem.c: Pull upstream copy, add support for irix6.
|
||||||
|
|
||||||
|
* config.in, configure: Regenerated.
|
||||||
|
|
||||||
2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
2003-02-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* physmem.c (physmem_total, physmem_available): De-ANSI-fy.
|
* physmem.c (physmem_total, physmem_available): De-ANSI-fy.
|
||||||
|
|
|
@ -180,6 +180,9 @@
|
||||||
/* Define if you have the sysconf function. */
|
/* Define if you have the sysconf function. */
|
||||||
#undef HAVE_SYSCONF
|
#undef HAVE_SYSCONF
|
||||||
|
|
||||||
|
/* Define if you have the sysmp function. */
|
||||||
|
#undef HAVE_SYSMP
|
||||||
|
|
||||||
/* Define if you have the times function. */
|
/* Define if you have the times function. */
|
||||||
#undef HAVE_TIMES
|
#undef HAVE_TIMES
|
||||||
|
|
||||||
|
@ -237,6 +240,9 @@
|
||||||
/* Define if you have the <sys/stat.h> header file. */
|
/* Define if you have the <sys/stat.h> header file. */
|
||||||
#undef HAVE_SYS_STAT_H
|
#undef HAVE_SYS_STAT_H
|
||||||
|
|
||||||
|
/* Define if you have the <sys/sysmp.h> header file. */
|
||||||
|
#undef HAVE_SYS_SYSMP_H
|
||||||
|
|
||||||
/* Define if you have the <sys/time.h> header file. */
|
/* Define if you have the <sys/time.h> header file. */
|
||||||
#undef HAVE_SYS_TIME_H
|
#undef HAVE_SYS_TIME_H
|
||||||
|
|
||||||
|
|
|
@ -1356,7 +1356,7 @@ else
|
||||||
fi
|
fi
|
||||||
echo "$ac_t""$CPP" 1>&6
|
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
|
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
|
||||||
do
|
do
|
||||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||||
|
@ -1738,7 +1738,7 @@ funcs="$funcs waitpid"
|
||||||
vars="sys_errlist sys_nerr sys_siglist"
|
vars="sys_errlist sys_nerr sys_siglist"
|
||||||
|
|
||||||
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
|
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
|
||||||
checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic"
|
checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
|
||||||
|
|
||||||
# These are neither executed nor required, but they help keep
|
# These are neither executed nor required, but they help keep
|
||||||
# autoheader happy without adding a bunch of text to acconfig.h.
|
# autoheader happy without adding a bunch of text to acconfig.h.
|
||||||
|
@ -2128,7 +2128,7 @@ else
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_func in pstat_getstatic pstat_getdynamic
|
for ac_func in pstat_getstatic pstat_getdynamic sysmp
|
||||||
do
|
do
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
echo "configure:2135: checking for $ac_func" >&5
|
echo "configure:2135: checking for $ac_func" >&5
|
||||||
|
|
|
@ -142,7 +142,7 @@ AC_SUBST_FILE(host_makefile_frag)
|
||||||
# It's OK to check for header files. Although the compiler may not be
|
# 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
|
# able to link anything, it had better be able to at least compile
|
||||||
# something.
|
# 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)
|
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)
|
||||||
AC_HEADER_SYS_WAIT
|
AC_HEADER_SYS_WAIT
|
||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ funcs="$funcs waitpid"
|
||||||
vars="sys_errlist sys_nerr sys_siglist"
|
vars="sys_errlist sys_nerr sys_siglist"
|
||||||
|
|
||||||
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
|
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
|
||||||
checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic"
|
checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
|
||||||
|
|
||||||
# These are neither executed nor required, but they help keep
|
# These are neither executed nor required, but they help keep
|
||||||
# autoheader happy without adding a bunch of text to acconfig.h.
|
# autoheader happy without adding a bunch of text to acconfig.h.
|
||||||
|
@ -219,7 +219,7 @@ if test "x" = "y"; then
|
||||||
AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
|
AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
|
||||||
AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
|
AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
|
||||||
AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
|
AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
|
||||||
AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic)
|
AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp)
|
||||||
AC_CHECK_FUNCS(realpath canonicalize_file_name)
|
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_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_NERR, 1, [Define if you have the sys_nerr variable.])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Calculate the size of physical memory.
|
/* Calculate the size of physical memory.
|
||||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
along with this program; if not, write to the Free Software Foundation,
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/* Written by Paul Eggert. */
|
/* Written by Paul Eggert and Jim Meyering. */
|
||||||
|
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
|
@ -29,6 +29,12 @@
|
||||||
# include <sys/pstat.h>
|
# include <sys/pstat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_SYS_SYSMP_H
|
||||||
|
#include <sys/sysmp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "libiberty.h"
|
||||||
|
|
||||||
/* Return the total amount of physical memory. */
|
/* Return the total amount of physical memory. */
|
||||||
double
|
double
|
||||||
physmem_total ()
|
physmem_total ()
|
||||||
|
@ -43,7 +49,7 @@ physmem_total ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_PSTAT_GETSTATIC
|
#if HAVE_PSTAT_GETSTATIC
|
||||||
{
|
{ /* This works on hpux11. */
|
||||||
struct pst_static pss;
|
struct pst_static pss;
|
||||||
if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0))
|
if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0))
|
||||||
{
|
{
|
||||||
|
@ -55,6 +61,19 @@ physmem_total ()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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)
|
||||||
|
{
|
||||||
|
double pagesize = sysconf (_SC_PAGESIZE);
|
||||||
|
double pages = realmem.physmem;
|
||||||
|
if (0 <= pages && 0 <= pagesize)
|
||||||
|
return pages * pagesize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Return 0 if we can't determine the value. */
|
/* Return 0 if we can't determine the value. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +92,7 @@ physmem_available ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC
|
#if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC
|
||||||
{
|
{ /* This works on hpux11. */
|
||||||
struct pst_static pss;
|
struct pst_static pss;
|
||||||
struct pst_dynamic psd;
|
struct pst_dynamic psd;
|
||||||
if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0)
|
if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0)
|
||||||
|
@ -87,6 +106,40 @@ physmem_available ()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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)
|
||||||
|
{
|
||||||
|
double pagesize = sysconf (_SC_PAGESIZE);
|
||||||
|
double pages = realmem.availrmem;
|
||||||
|
if (0 <= pages && 0 <= pagesize)
|
||||||
|
return pages * pagesize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Guess 25% of physical memory. */
|
/* Guess 25% of physical memory. */
|
||||||
return physmem_total () / 4;
|
return physmem_total () / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
printf ("%12.f %12.f\n", physmem_total (), physmem_available ());
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
/*
|
||||||
|
Local Variables:
|
||||||
|
compile-command: "gcc -DDEBUG -DHAVE_CONFIG_H -I.. -g -O -Wall -W physmem.c"
|
||||||
|
End:
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue