[前][次][番号順一覧][スレッド一覧]

ruby-changes:33123

From: nobu <ko1@a...>
Date: Fri, 28 Feb 2014 09:51:42 +0900 (JST)
Subject: [ruby-changes:33123] nobu:r45202 (trunk): configure.in: check arguments of pthread_setname_np

nobu	2014-02-28 09:51:37 +0900 (Fri, 28 Feb 2014)

  New Revision: 45202

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45202

  Log:
    configure.in: check arguments of pthread_setname_np
    
    * configure.in (SET_THREAD_NAME): check proper arguments of
      pthread_setname_np() and fix definition on BSDs.

  Modified files:
    trunk/configure.in
Index: configure.in
===================================================================
--- configure.in	(revision 45201)
+++ configure.in	(revision 45202)
@@ -2453,51 +2453,31 @@ if test x"$enable_pthread" = xyes; then https://github.com/ruby/ruby/blob/trunk/configure.in#L2453
       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_CACHE_CHECK([arguments of pthread_setname_np], [rb_cv_func_pthread_setname_np_arguments],
+	    [rb_cv_func_pthread_setname_np_arguments=
+	    for mac in \
+		"(pthread_self(), name)" \
+		"(pthread_self(), "%s", name)" \
+		"(name)" \
+		; do
 		AC_TRY_COMPILE([
 		    @%:@include <pthread.h>
 		    @%:@ifdef HAVE_PTHREAD_NP_H
 		    @%:@include <pthread_np.h>
 		    @%:@endif
+		    @%:@define SET_THREAD_NAME(name) pthread_setname_np${mac}
 		    ],
-		    [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@%:@,}
+		    [if (SET_THREAD_NAME("conftest")) return 1;],
+		    [rb_cv_func_pthread_setname_np_arguments="${mac}"
+		    break])
+	    done
 	    ]
 	)
-	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)],
-	)
+	if test -n "${rb_cv_func_pthread_setname_np_arguments}"; then
+	    AC_DEFINE(SET_THREAD_NAME(name), pthread_setname_np${rb_cv_func_pthread_setname_np_arguments})
+	else
+	    AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), (void)0)
+	fi
     fi
 fi
 if test x"$ac_cv_header_ucontext_h" = xyes; then

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]