mirror of git://gcc.gnu.org/git/gcc.git
acinclude.m4 (GLIBCXX_CHECK_SC_NPROC_ONLN): Define.
* acinclude.m4 (GLIBCXX_CHECK_SC_NPROC_ONLN): Define. (GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP): Define. (GLIBCXX_CHECK_SYSCTL_HW_NCPU): Define. * configure.ac: Use new checks. * configure: Regenerate. * config.h.in: Regenerate. * src/thread.cc: Check new config macros. * testsuite/lib/libstdc++.exp: Likewise. From-SVN: r181084
This commit is contained in:
parent
51e674b7f1
commit
5ee360d069
|
@ -1,3 +1,14 @@
|
||||||
|
2011-11-07 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||||
|
|
||||||
|
* acinclude.m4 (GLIBCXX_CHECK_SC_NPROC_ONLN): Define.
|
||||||
|
(GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP): Define.
|
||||||
|
(GLIBCXX_CHECK_SYSCTL_HW_NCPU): Define.
|
||||||
|
* configure.ac: Use new checks.
|
||||||
|
* configure: Regenerate.
|
||||||
|
* config.h.in: Regenerate.
|
||||||
|
* src/thread.cc: Check new config macros.
|
||||||
|
* testsuite/lib/libstdc++.exp: Likewise.
|
||||||
|
|
||||||
2011-11-07 Jonathan Wakely <jwakely.gcc@gmail.com>
|
2011-11-07 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||||
|
|
||||||
* config/abi/pre/gnu.ver: Fix exports for string::pop_back.
|
* config/abi/pre/gnu.ver: Fix exports for string::pop_back.
|
||||||
|
|
|
@ -3459,6 +3459,94 @@ AC_DEFUN([GLIBCXX_CHECK_SC_NPROCESSORS_ONLN], [
|
||||||
AC_LANG_RESTORE
|
AC_LANG_RESTORE
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl Check whether sysconf(_SC_NPROC_ONLN) is available in <unistd.h>, and define _GLIBCXX_USE_SC_NPROC_ONLN.
|
||||||
|
dnl
|
||||||
|
AC_DEFUN([GLIBCXX_CHECK_SC_NPROC_ONLN], [
|
||||||
|
|
||||||
|
AC_LANG_SAVE
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fno-exceptions"
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for _SC_NPROC_ONLN])
|
||||||
|
AC_CACHE_VAL(glibcxx_cv_SC_NPROC_ONLN, [
|
||||||
|
GCC_TRY_COMPILE_OR_LINK(
|
||||||
|
[#include <unistd.h>],
|
||||||
|
[int n = sysconf(_SC_NPROC_ONLN);],
|
||||||
|
[glibcxx_cv_SC_NPROC_ONLN=yes],
|
||||||
|
[glibcxx_cv_SC_NPROC_ONLN=no])
|
||||||
|
])
|
||||||
|
if test $glibcxx_cv_SC_NPROC_ONLN = yes; then
|
||||||
|
AC_DEFINE(_GLIBCXX_USE_SC_NPROC_ONLN, 1, [Define if _SC_NPROC_ONLN is available in <unistd.h>.])
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($glibcxx_cv_SC_NPROC_ONLN)
|
||||||
|
|
||||||
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||||
|
AC_LANG_RESTORE
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl Check whether pthread_num_processors_np is available in <pthread.h>, and define _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP.
|
||||||
|
dnl
|
||||||
|
AC_DEFUN([GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP], [
|
||||||
|
|
||||||
|
AC_LANG_SAVE
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fno-exceptions"
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for pthreads_num_processors_np])
|
||||||
|
AC_CACHE_VAL(glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP, [
|
||||||
|
GCC_TRY_COMPILE_OR_LINK(
|
||||||
|
[#include <pthread.h>],
|
||||||
|
[int n = pthread_num_processors_np();],
|
||||||
|
[glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=yes],
|
||||||
|
[glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=no])
|
||||||
|
])
|
||||||
|
if test $glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP = yes; then
|
||||||
|
AC_DEFINE(_GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP, 1, [Define if pthreads_num_processors_np is available in <pthread.h>.])
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP)
|
||||||
|
|
||||||
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||||
|
AC_LANG_RESTORE
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl
|
||||||
|
dnl Check whether sysctl is available in <pthread.h>, and define _GLIBCXX_USE_SYSCTL_HW_NCPU.
|
||||||
|
dnl
|
||||||
|
AC_DEFUN([GLIBCXX_CHECK_SYSCTL_HW_NCPU], [
|
||||||
|
|
||||||
|
AC_LANG_SAVE
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fno-exceptions"
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for hw.ncpu sysctl])
|
||||||
|
AC_CACHE_VAL(glibcxx_cv_SYSCTL_HW_NCPU, [
|
||||||
|
GCC_TRY_COMPILE_OR_LINK(
|
||||||
|
[
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
int count;
|
||||||
|
size_t size = sizeof(count);
|
||||||
|
int mib[] = { CTL_HW, HW_NCPU };
|
||||||
|
sysctl(mib, 2, &count, &size, NULL, 0);
|
||||||
|
],
|
||||||
|
[glibcxx_cv_SYSCTL_HW_NCPU=yes],
|
||||||
|
[glibcxx_cv_SYSCTL_HW_NCPU=no])
|
||||||
|
])
|
||||||
|
if test $glibcxx_cv_SYSCTL_HW_NCPU = yes; then
|
||||||
|
AC_DEFINE(_GLIBCXX_USE_SYSCTL_HW_NCPU, 1, [Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>.])
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($glibcxx_cv_SYSCTL_HW_NCPU)
|
||||||
|
|
||||||
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||||
|
AC_LANG_RESTORE
|
||||||
|
])
|
||||||
|
|
||||||
# Macros from the top-level gcc directory.
|
# Macros from the top-level gcc directory.
|
||||||
m4_include([../config/gc++filt.m4])
|
m4_include([../config/gc++filt.m4])
|
||||||
|
|
|
@ -831,6 +831,9 @@
|
||||||
/* Define if NLS translations are to be used. */
|
/* Define if NLS translations are to be used. */
|
||||||
#undef _GLIBCXX_USE_NLS
|
#undef _GLIBCXX_USE_NLS
|
||||||
|
|
||||||
|
/* Define if pthreads_num_processors_np is available in <pthread.h>. */
|
||||||
|
#undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP
|
||||||
|
|
||||||
/* Define if /dev/random and /dev/urandom are available for the random_device
|
/* Define if /dev/random and /dev/urandom are available for the random_device
|
||||||
of TR1 (Chapter 5.1). */
|
of TR1 (Chapter 5.1). */
|
||||||
#undef _GLIBCXX_USE_RANDOM_TR1
|
#undef _GLIBCXX_USE_RANDOM_TR1
|
||||||
|
@ -841,6 +844,12 @@
|
||||||
/* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */
|
/* Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>. */
|
||||||
#undef _GLIBCXX_USE_SC_NPROCESSORS_ONLN
|
#undef _GLIBCXX_USE_SC_NPROCESSORS_ONLN
|
||||||
|
|
||||||
|
/* Define if _SC_NPROC_ONLN is available in <unistd.h>. */
|
||||||
|
#undef _GLIBCXX_USE_SC_NPROC_ONLN
|
||||||
|
|
||||||
|
/* Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>. */
|
||||||
|
#undef _GLIBCXX_USE_SYSCTL_HW_NCPU
|
||||||
|
|
||||||
/* Define if code specialized for wchar_t should be used. */
|
/* Define if code specialized for wchar_t should be used. */
|
||||||
#undef _GLIBCXX_USE_WCHAR_T
|
#undef _GLIBCXX_USE_WCHAR_T
|
||||||
|
|
||||||
|
|
|
@ -20132,6 +20132,256 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ac_ext=cpp
|
||||||
|
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||||
|
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||||
|
|
||||||
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fno-exceptions"
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _SC_NPROC_ONLN" >&5
|
||||||
|
$as_echo_n "checking for _SC_NPROC_ONLN... " >&6; }
|
||||||
|
if test "${glibcxx_cv_SC_NPROC_ONLN+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
|
||||||
|
if test x$gcc_no_link = xyes; then
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <unistd.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
int n = sysconf(_SC_NPROC_ONLN);
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||||
|
glibcxx_cv_SC_NPROC_ONLN=yes
|
||||||
|
else
|
||||||
|
glibcxx_cv_SC_NPROC_ONLN=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
else
|
||||||
|
if test x$gcc_no_link = xyes; then
|
||||||
|
as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
|
||||||
|
fi
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <unistd.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
int n = sysconf(_SC_NPROC_ONLN);
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_cxx_try_link "$LINENO"; then :
|
||||||
|
glibcxx_cv_SC_NPROC_ONLN=yes
|
||||||
|
else
|
||||||
|
glibcxx_cv_SC_NPROC_ONLN=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $glibcxx_cv_SC_NPROC_ONLN = yes; then
|
||||||
|
|
||||||
|
$as_echo "#define _GLIBCXX_USE_SC_NPROC_ONLN 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_SC_NPROC_ONLN" >&5
|
||||||
|
$as_echo "$glibcxx_cv_SC_NPROC_ONLN" >&6; }
|
||||||
|
|
||||||
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||||
|
ac_ext=c
|
||||||
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
|
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ac_ext=cpp
|
||||||
|
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||||
|
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||||
|
|
||||||
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fno-exceptions"
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthreads_num_processors_np" >&5
|
||||||
|
$as_echo_n "checking for pthreads_num_processors_np... " >&6; }
|
||||||
|
if test "${glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
|
||||||
|
if test x$gcc_no_link = xyes; then
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <pthread.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
int n = pthread_num_processors_np();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||||
|
glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=yes
|
||||||
|
else
|
||||||
|
glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
else
|
||||||
|
if test x$gcc_no_link = xyes; then
|
||||||
|
as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
|
||||||
|
fi
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <pthread.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
int n = pthread_num_processors_np();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_cxx_try_link "$LINENO"; then :
|
||||||
|
glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=yes
|
||||||
|
else
|
||||||
|
glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP = yes; then
|
||||||
|
|
||||||
|
$as_echo "#define _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP" >&5
|
||||||
|
$as_echo "$glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP" >&6; }
|
||||||
|
|
||||||
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||||
|
ac_ext=c
|
||||||
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
|
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ac_ext=cpp
|
||||||
|
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||||
|
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||||
|
|
||||||
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||||
|
CXXFLAGS="$CXXFLAGS -fno-exceptions"
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for hw.ncpu sysctl" >&5
|
||||||
|
$as_echo_n "checking for hw.ncpu sysctl... " >&6; }
|
||||||
|
if test "${glibcxx_cv_SYSCTL_HW_NCPU+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
|
||||||
|
if test x$gcc_no_link = xyes; then
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
int count;
|
||||||
|
size_t size = sizeof(count);
|
||||||
|
int mib[] = { CTL_HW, HW_NCPU };
|
||||||
|
sysctl(mib, 2, &count, &size, NULL, 0);
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||||
|
glibcxx_cv_SYSCTL_HW_NCPU=yes
|
||||||
|
else
|
||||||
|
glibcxx_cv_SYSCTL_HW_NCPU=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
else
|
||||||
|
if test x$gcc_no_link = xyes; then
|
||||||
|
as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
|
||||||
|
fi
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
int count;
|
||||||
|
size_t size = sizeof(count);
|
||||||
|
int mib[] = { CTL_HW, HW_NCPU };
|
||||||
|
sysctl(mib, 2, &count, &size, NULL, 0);
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_cxx_try_link "$LINENO"; then :
|
||||||
|
glibcxx_cv_SYSCTL_HW_NCPU=yes
|
||||||
|
else
|
||||||
|
glibcxx_cv_SYSCTL_HW_NCPU=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $glibcxx_cv_SYSCTL_HW_NCPU = yes; then
|
||||||
|
|
||||||
|
$as_echo "#define _GLIBCXX_USE_SYSCTL_HW_NCPU 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_SYSCTL_HW_NCPU" >&5
|
||||||
|
$as_echo "$glibcxx_cv_SYSCTL_HW_NCPU" >&6; }
|
||||||
|
|
||||||
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||||
|
ac_ext=c
|
||||||
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
|
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check for available headers.
|
# Check for available headers.
|
||||||
for ac_header in endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
|
for ac_header in endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
|
||||||
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
|
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
|
||||||
|
|
|
@ -174,6 +174,9 @@ AC_CHECK_HEADERS(sys/sysinfo.h)
|
||||||
GLIBCXX_CHECK_GET_NPROCS
|
GLIBCXX_CHECK_GET_NPROCS
|
||||||
AC_CHECK_HEADERS(unistd.h)
|
AC_CHECK_HEADERS(unistd.h)
|
||||||
GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
|
GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
|
||||||
|
GLIBCXX_CHECK_SC_NPROC_ONLN
|
||||||
|
GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
|
||||||
|
GLIBCXX_CHECK_SYSCTL_HW_NCPU
|
||||||
|
|
||||||
# Check for available headers.
|
# Check for available headers.
|
||||||
AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
|
AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
|
||||||
|
|
|
@ -30,9 +30,27 @@
|
||||||
#if defined(_GLIBCXX_USE_GET_NPROCS)
|
#if defined(_GLIBCXX_USE_GET_NPROCS)
|
||||||
# include <sys/sysinfo.h>
|
# include <sys/sysinfo.h>
|
||||||
# define _GLIBCXX_NPROCS get_nprocs()
|
# define _GLIBCXX_NPROCS get_nprocs()
|
||||||
|
#elif defined(_GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP)
|
||||||
|
# define _GLIBCXX_NPROCS pthread_num_processors_np()
|
||||||
|
#elif defined(_GLIBCXX_USE_SYSCTL_HW_NCPU)
|
||||||
|
# include <stddef.h>
|
||||||
|
# include <sys/sysctl.h>
|
||||||
|
static inline int get_nprocs()
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
size_t size = sizeof(count);
|
||||||
|
int mib[] = { CTL_HW, HW_NCPU };
|
||||||
|
if (!sysctl(mib, 2, &count, &size, NULL, 0))
|
||||||
|
return count;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
# define _GLIBCXX_NPROCS get_nprocs()
|
||||||
#elif defined(_GLIBCXX_USE_SC_NPROCESSORS_ONLN)
|
#elif defined(_GLIBCXX_USE_SC_NPROCESSORS_ONLN)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# define _GLIBCXX_NPROCS sysconf(_SC_NPROCESSORS_ONLN)
|
# define _GLIBCXX_NPROCS sysconf(_SC_NPROCESSORS_ONLN)
|
||||||
|
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
|
||||||
|
# include <unistd.h>
|
||||||
|
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
|
||||||
#else
|
#else
|
||||||
# define _GLIBCXX_NPROCS 0
|
# define _GLIBCXX_NPROCS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1673,13 +1673,12 @@ proc check_v3_target_nprocs { } {
|
||||||
set f [open $src "w"]
|
set f [open $src "w"]
|
||||||
puts $f "#include <bits/c++config.h>"
|
puts $f "#include <bits/c++config.h>"
|
||||||
puts $f "#if defined(_GLIBCXX_USE_GET_NPROCS)"
|
puts $f "#if defined(_GLIBCXX_USE_GET_NPROCS)"
|
||||||
puts $f "#elif defined(_GLIBCXX_USE_SYSCONF)"
|
puts $f "#elif defined(_GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP)"
|
||||||
puts $f "# include <unistd.h>"
|
puts $f "#elif defined(_GLIBCXX_USE_SYSCTL_HW_NCPU)"
|
||||||
puts $f "# if !defined(_SC_NPROCESSORS_ONLN)"
|
puts $f "#elif defined(_GLIBCXX_USE_SC_NPROCESSORS_ONLN)"
|
||||||
puts $f "# error No sysconf option"
|
puts $f "#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)"
|
||||||
puts $f "# endif"
|
|
||||||
puts $f "#else"
|
puts $f "#else"
|
||||||
puts $f "# error No get_nprocs or sysconf"
|
puts $f "# error hardware_concurrency not implemented"
|
||||||
puts $f "#endif"
|
puts $f "#endif"
|
||||||
close $f
|
close $f
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue