summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-27 07:10:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-27 07:10:11 +0000
commit6245e02cd37b98d2d41efda697408ae5dd36119e (patch)
tree04690312424cfde1894e177809aca43250186eb1 /configure.in
parent1ebf8916b239ab04f0a3b542f04486013fcb16b3 (diff)
configure.in: define SET_THREAD_NAME
* configure.in (SET_THREAD_NAME): define according to pthread_setname_np variations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in47
1 files changed, 47 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 3dfe0ab8fe..c954866597 100644
--- a/configure.in
+++ b/configure.in
@@ -2452,6 +2452,53 @@ if test x"$enable_pthread" = xyes; then
else
AC_CHECK_FUNCS(pthread_attr_init)
fi
+ if test "$ac_cv_func_pthread_setname_np" = yes; then
+ AC_CACHE_CHECK([type of pthread_setname_np], [rb_cv_func_pthread_setname_np_type],
+ [rb_cv_func_pthread_setname_np_type=
+ if test "$rb_cv_func_pthread_setname_np_type" = ""; then
+ AC_TRY_COMPILE([
+ @%:@include <pthread.h>
+ @%:@ifdef HAVE_PTHREAD_NP_H
+ @%:@include <pthread_np.h>
+ @%:@endif
+ ],
+ [if (pthread_setname_np(pthread_self(), "")) return 1;],
+ [rb_cv_func_pthread_setname_np_type=$rb_cv_func_pthread_setname_np_type,linux])
+ fi
+ if test "$rb_cv_func_pthread_setname_np_type" = ""; then
+ AC_TRY_COMPILE([
+ @%:@include <pthread.h>
+ @%:@ifdef HAVE_PTHREAD_NP_H
+ @%:@include <pthread_np.h>
+ @%:@endif
+ ],
+ [if (pthread_setname_np(pthread_self(), "", NULL)) return 1;],
+ [rb_cv_func_pthread_setname_np_type=$rb_cv_func_pthread_setname_np_type,bsd])
+ fi
+ if test "$rb_cv_func_pthread_setname_np_type" = ""; then
+ AC_TRY_COMPILE([
+ @%:@include <pthread.h>
+ @%:@ifdef HAVE_PTHREAD_NP_H
+ @%:@include <pthread_np.h>
+ @%:@endif
+ ],
+ [if (pthread_setname_np("")) return 1;],
+ [rb_cv_func_pthread_setname_np_type=$rb_cv_func_pthread_setname_np_type,darwin])
+ fi
+ rb_cv_func_pthread_setname_np_type=${rb_cv_func_pthread_setname_np_type@%:@,}
+ ]
+ )
+ AS_CASE(["$rb_cv_func_pthread_setname_np_type"],
+ [linux],
+ [AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_setname_np(pthread_self(), name))],
+ [bsd],
+ [AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_setname_np(pthread_self(), name, NULL))],
+ [darwin],
+ [AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_setname_np(name))],
+ [*],
+ [AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), (void)0)],
+ )
+ fi
fi
if test x"$ac_cv_header_ucontext_h" = xyes; then
if test x"$rb_with_pthread" = xyes; then