# HG changeset patch # User Markus Mützel # Date 1593706570 -7200 # Node ID d5311ca8f94507dd3d632f84a52652f8aa501c9b # Parent 1151ed869686fa1a09a577fcea7d0df1cce63cb9# Parent 9e7b2625e5744cfbb01bdd67a3487c75a7ef957a maint: merge stable to default. diff -r 1151ed869686 -r d5311ca8f945 configure.ac --- a/configure.ac Thu Jul 02 15:11:19 2020 +0900 +++ b/configure.ac Thu Jul 02 18:16:10 2020 +0200 @@ -549,6 +549,12 @@ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" +dnl Check if glibc uses wrong stack size +OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE +AM_CONDITIONAL([OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE], + [test $octave_cv_broken_pthread_stacksize = yes]) + + ### Test whether the compiler supports OpenMP. dnl This is enabled by default to allow the option of using OpenMP in dnl loadable modules. diff -r 1151ed869686 -r d5311ca8f945 libinterp/octave-value/ov-java.cc --- a/libinterp/octave-value/ov-java.cc Thu Jul 02 15:11:19 2020 +0900 +++ b/libinterp/octave-value/ov-java.cc Thu Jul 02 18:16:10 2020 +0200 @@ -763,6 +763,9 @@ // Hard-coded options for the jvm. vm_args.add ("-Djava.class.path=" + initial_class_path ()); +#if defined (HAVE_BROKEN_PTHREAD_STACKSIZE) + vm_args.add ("-Djdk.lang.processReaperUseDefaultStackSize=true"); +#endif vm_args.add ("-Xrs"); // Additional options given by file java.opts. diff -r 1151ed869686 -r d5311ca8f945 m4/acinclude.m4 --- a/m4/acinclude.m4 Thu Jul 02 15:11:19 2020 +0900 +++ b/m4/acinclude.m4 Thu Jul 02 18:16:10 2020 +0200 @@ -187,6 +187,74 @@ fi ]) dnl +dnl Check if pthread stack size accounts for thread-local storage. +dnl +dnl This program should succeed if the pthread library allocates memory +dnl for thread-local (__thread) variables independently of the +dnl requested thread stack size. +dnl +dnl It will fail if (as in the current version of glibc) the storage +dnl for thread-local variables is subtracted from the memory allocated +dnl for the thread stack. (This can cause problems for Java and for +dnl other libraries.) +dnl +dnl This bug is tracked in glibc at: +dnl https://sourceware.org/bugzilla/show_bug.cgi?id=11787 +dnl +AC_DEFUN([OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE], [ + AC_CACHE_CHECK([whether pthread stack size does not account for thread-local storage], + [octave_cv_broken_pthread_stacksize], + [AC_LANG_PUSH(C) + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +#include +#include + +static char __thread data[100 * 1024]; + +static void * threadfunc(void *arg) +{ + return data; +} + ]], [[ + pthread_attr_t attr; + pthread_t thread; + int errnum; + + pthread_attr_init (&attr); + errnum = pthread_attr_setstacksize (&attr, 64 * 1024); + if (errnum != 0) + { + fprintf (stderr, "pthread_attr_setstacksize: %s\n", strerror(errnum)); + return 1; + } + errnum = pthread_create (&thread, &attr, &threadfunc, NULL); + if (errnum != 0) + { + fprintf (stderr, "pthread_create: %s\n", strerror(errnum)); + return 1; + } + errnum = pthread_join (thread, NULL); + if (errnum != 0) + { + fprintf (stderr, "pthread_join: %s\n", strerror(errnum)); + return 1; + } + + pthread_attr_destroy (&attr); + return 0; + ]])], + octave_cv_broken_pthread_stacksize=no, + octave_cv_broken_pthread_stacksize=yes, + octave_cv_broken_pthread_stacksize=no) + AC_LANG_POP(C) + ]) + if test $octave_cv_broken_pthread_stacksize = yes; then + AC_DEFINE(HAVE_BROKEN_PTHREAD_STACKSIZE, 1, + [Define to 1 if pthread stack size does not account for thread-local storage.]) + fi +]) +dnl dnl Check whether CXSparse is version 2.2 or later dnl FIXME: This test uses a version number. It potentially could dnl be re-written to actually call a function, but is it worth it?