diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 78 |
1 files changed, 57 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac index beb5b6c7..263e1f17 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -307,26 +307,41 @@ AC_ARG_ENABLE([[thread-names]], | |||
307 | [], [enable_thread_names='auto']) | 307 | [], [enable_thread_names='auto']) |
308 | 308 | ||
309 | if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; then | 309 | if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; then |
310 | # Check for pthread_setname_np() | 310 | # Check for thread name function |
311 | HAVE_THREAD_NAME_FUNC="no" | ||
311 | SAVE_LIBS="$LIBS" | 312 | SAVE_LIBS="$LIBS" |
312 | SAVE_CFLAGS="$CFLAGS" | 313 | SAVE_CFLAGS="$CFLAGS" |
313 | LIBS="$PTHREAD_LIBS $LIBS" | 314 | LIBS="$PTHREAD_LIBS $LIBS" |
314 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | 315 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
315 | AC_CHECK_HEADERS([pthread_np.h]) | 316 | AC_CHECK_HEADERS([pthread_np.h]) |
316 | 317 | ||
317 | AC_MSG_CHECKING([[for pthread_setname_np(3) in NetBSD or OSF1 form]]) | 318 | # If pthread_setname_np(3) is not declared, it's not possible to detect |
318 | AC_LINK_IFELSE( | 319 | # form of pthread_setname_np(3) due to C "feature" "implicit declaration". |
319 | [AC_LANG_PROGRAM([[ | 320 | AC_CHECK_DECL([[pthread_setname_np]],[],[],[[ |
321 | #include <pthread.h> | ||
322 | #ifdef HAVE_PTHREAD_NP_H | ||
323 | #include <pthread_np.h> | ||
324 | #endif | ||
325 | ]]) | ||
326 | |||
327 | AS_IF([[test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], | ||
328 | [AC_MSG_CHECKING([[for pthread_setname_np(3) in NetBSD or OSF1 form]]) | ||
329 | AC_LINK_IFELSE( | ||
330 | [AC_LANG_PROGRAM([[ | ||
320 | #include <pthread.h> | 331 | #include <pthread.h> |
321 | #ifdef HAVE_PTHREAD_NP_H | 332 | #ifdef HAVE_PTHREAD_NP_H |
322 | #include <pthread_np.h> | 333 | #include <pthread_np.h> |
323 | #endif | 334 | #endif |
324 | ]], [[int res = pthread_setname_np(pthread_self(), "name", 0);]])], | 335 | ]], [[int res = pthread_setname_np(pthread_self(), "name", 0);]])], |
325 | [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_NETBSD]], [[1]], [Define if you have NetBSD form (or OSF1 form) of pthread_setname_np(3) function.]) | 336 | [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_NETBSD]], [[1]], [Define if you have NetBSD form (or OSF1 form) of pthread_setname_np(3) function.]) |
326 | AC_MSG_RESULT([[yes]])], | 337 | HAVE_THREAD_NAME_FUNC="yes" |
327 | [AC_MSG_RESULT([[no]]) | 338 | AC_MSG_RESULT([[yes]])], |
339 | [AC_MSG_RESULT([[no]])] | ||
340 | ) | ||
341 | ]) | ||
328 | 342 | ||
329 | AC_MSG_CHECKING([[for pthread_setname_np(3) in GNU/Linux form]]) | 343 | AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], |
344 | [AC_MSG_CHECKING([[for pthread_setname_np(3) in GNU/Linux form]]) | ||
330 | AC_LINK_IFELSE( | 345 | AC_LINK_IFELSE( |
331 | [AC_LANG_PROGRAM([[ | 346 | [AC_LANG_PROGRAM([[ |
332 | #include <pthread.h> | 347 | #include <pthread.h> |
@@ -335,32 +350,53 @@ if test "x$enable_thread_names" != "xno" && test "x$USE_THREADS" = "xposix"; the | |||
335 | #endif | 350 | #endif |
336 | ]], [[int res = pthread_setname_np(pthread_self(), "name");]])], | 351 | ]], [[int res = pthread_setname_np(pthread_self(), "name");]])], |
337 | [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_GNU]], [[1]], [Define if you have GNU/Linux form of pthread_setname_np(3) function.]) | 352 | [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_GNU]], [[1]], [Define if you have GNU/Linux form of pthread_setname_np(3) function.]) |
353 | HAVE_THREAD_NAME_FUNC="yes" | ||
338 | AC_MSG_RESULT([[yes]])], | 354 | AC_MSG_RESULT([[yes]])], |
339 | [AC_MSG_RESULT([[no]]) | 355 | [AC_MSG_RESULT([[no]])] |
356 | ) | ||
357 | ]) | ||
340 | 358 | ||
341 | AC_MSG_CHECKING([[for pthread_setname_np(3) in Darwin form]]) | 359 | AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes" && test "x$ac_cv_have_decl_pthread_setname_np" = "xyes"]], |
342 | AC_LINK_IFELSE( | 360 | [AC_MSG_CHECKING([[for pthread_setname_np(3) in Darwin form]]) |
343 | [AC_LANG_PROGRAM([[ | 361 | AC_LINK_IFELSE( |
362 | [AC_LANG_PROGRAM([[ | ||
344 | #include <pthread.h> | 363 | #include <pthread.h> |
345 | #ifdef HAVE_PTHREAD_NP_H | 364 | #ifdef HAVE_PTHREAD_NP_H |
346 | #include <pthread_np.h> | 365 | #include <pthread_np.h> |
347 | #endif | 366 | #endif |
348 | ]], [[int res = pthread_setname_np("name");]])], | 367 | ]], [[int res = pthread_setname_np("name");]])], |
349 | [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_DARWIN]], [[1]], [Define if you have Darwin form of pthread_setname_np(3) function.]) | 368 | [AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP_DARWIN]], [[1]], [Define if you have Darwin form of pthread_setname_np(3) function.]) |
350 | AC_MSG_RESULT([[yes]])], | 369 | HAVE_THREAD_NAME_FUNC="yes" |
351 | [AC_MSG_RESULT([[no]]) | 370 | AC_MSG_RESULT([[yes]])], |
371 | [AC_MSG_RESULT([[no]])] | ||
372 | ) | ||
373 | ]) | ||
352 | 374 | ||
353 | AC_MSG_CHECKING([[for pthread_setname_np(3) in FreeBSD form]]) | 375 | AS_IF([[test "x$HAVE_THREAD_NAME_FUNC" != "xyes"]], |
354 | AC_LINK_IFELSE( | 376 | [ |
355 | [AC_LANG_PROGRAM([[ | 377 | AC_CHECK_DECL([[pthread_setname_np]], |
378 | [ | ||
379 | AC_MSG_CHECKING([[for pthread_set_name_np(3) in FreeBSD form]]) | ||
380 | AC_LINK_IFELSE( | ||
381 | [AC_LANG_PROGRAM([[ | ||
356 | #include <pthread.h> | 382 | #include <pthread.h> |
357 | #ifdef HAVE_PTHREAD_NP_H | 383 | #ifdef HAVE_PTHREAD_NP_H |
358 | #include <pthread_np.h> | 384 | #include <pthread_np.h> |
359 | #endif | 385 | #endif |
360 | ]], [[pthread_set_name_np(pthread_self(), "name");]])], | 386 | ]], [[pthread_set_name_np(pthread_self(), "name");]])], |
361 | [AC_DEFINE([[HAVE_PTHREAD_SET_NAME_NP_FREEBSD]], [[1]], [Define if you have FreeBSD form of pthread_set_name_np(3) function.]) | 387 | [AC_DEFINE([[HAVE_PTHREAD_SET_NAME_NP_FREEBSD]], [[1]], [Define if you have FreeBSD form of pthread_set_name_np(3) function.]) |
362 | AC_MSG_RESULT([[yes]])], | 388 | HAVE_THREAD_NAME_FUNC="yes" |
363 | [AC_MSG_RESULT([[no]])] ) ]) ]) ]) | 389 | AC_MSG_RESULT([[yes]])], |
390 | [AC_MSG_RESULT([[no]])] | ||
391 | ) | ||
392 | ],[],[[ | ||
393 | #include <pthread.h> | ||
394 | #ifdef HAVE_PTHREAD_NP_H | ||
395 | #include <pthread_np.h> | ||
396 | #endif | ||
397 | ]] | ||
398 | ) | ||
399 | ]) | ||
364 | 400 | ||
365 | LIBS="$SAVE_LIBS" | 401 | LIBS="$SAVE_LIBS" |
366 | CFLAGS="$SAVE_CFLAGS" | 402 | CFLAGS="$SAVE_CFLAGS" |