From: Michael Meffie Date: Mon, 16 Apr 2018 14:42:49 +0000 (-0400) Subject: autoconf: update pthread checks X-Git-Tag: debian/1.8.4_pre1-1~9^2^2~42 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2771714dc485ed3ca70d66e538709ddf703f8ece;p=packages%2Fo%2Fopenafs.git autoconf: update pthread checks Replace obsolete AC_TRY_COMPILE with AC_COMPILE_IFELSE. Replace shell if/then conditionals with AS_IF macros. Reformat indentation and quoting. This change was done manually, since autoupdate copes poorly with the old, nested AC_TRY_COMPILE macros. Reviewed-on: https://gerrit.openafs.org/13018 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Andrew Deason Reviewed-by: Marcio Brito Barbosa (cherry picked from commit c5def62d7be4891f534b753374acbf5b524701eb) Change-Id: I5cc8e5712dd742d20be92d04728eddbecf9c216c Reviewed-on: https://gerrit.openafs.org/13481 Reviewed-by: Mark Vitale Reviewed-by: Marcio Brito Barbosa Reviewed-by: Cheyenne Wills Tested-by: Andrew Deason Reviewed-by: Andrew Deason Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand --- diff --git a/src/cf/pthread.m4 b/src/cf/pthread.m4 index 02292c5ac..0661c749c 100644 --- a/src/cf/pthread.m4 +++ b/src/cf/pthread.m4 @@ -1,76 +1,71 @@ -AC_DEFUN([OPENAFS_PTHREAD_CHECKS],[ -PTHREAD_LIBS=error -if test "x$MKAFS_OSTYPE" = OBSD; then - PTHREAD_LIBS="-pthread" -fi -if test "x$MKAFS_OSTYPE" = xDFBSD; then - PTHREAD_LIBS="-pthread" -fi -if test "x$PTHREAD_LIBS" = xerror; then - AC_CHECK_LIB(pthread, pthread_attr_init, - PTHREAD_LIBS="-lpthread") -fi -if test "x$PTHREAD_LIBS" = xerror; then - AC_CHECK_LIB(pthreads, pthread_attr_init, - PTHREAD_LIBS="-lpthreads") -fi -if test "x$PTHREAD_LIBS" = xerror; then - AC_CHECK_LIB(c_r, pthread_attr_init, - PTHREAD_LIBS="-lc_r") -fi -if test "x$PTHREAD_LIBS" = xerror; then - AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="") -fi -if test "x$PTHREAD_LIBS" = xerror; then - # pthread_attr_init is a macro under HPUX 11.0 and 11.11 - AC_CHECK_LIB(pthread, pthread_attr_destroy, - PTHREAD_LIBS="-lpthread") -fi -if test "x$PTHREAD_LIBS" = xerror; then - AC_MSG_WARN(*** Unable to locate working posix thread library ***) -fi -AC_SUBST(PTHREAD_LIBS) -]) +AC_DEFUN([OPENAFS_PTHREAD_CHECKS], +[PTHREAD_LIBS=error +AS_IF([test "x$MKAFS_OSTYPE" = OBSD], + [PTHREAD_LIBS="-pthread"]) +AS_IF([test "x$MKAFS_OSTYPE" = xDFBSD], + [PTHREAD_LIBS="-pthread"]) +AS_IF([test "x$PTHREAD_LIBS" = xerror], + [AC_CHECK_LIB([pthread], [pthread_attr_init], + [PTHREAD_LIBS="-lpthread"])]) +AS_IF(["x$PTHREAD_LIBS" = xerror], + [AC_CHECK_LIB([pthreads], [pthread_attr_init], + [PTHREAD_LIBS="-lpthreads"])]) +AS_IF([test "x$PTHREAD_LIBS" = xerror], + [AC_CHECK_LIB([c_r], [pthread_attr_init], + [PTHREAD_LIBS="-lc_r"])]) +AS_IF([test "x$PTHREAD_LIBS" = xerror], + [AC_CHECK_FUNC([pthread_attr_init], [PTHREAD_LIBS=""])]) +AS_IF([test "x$PTHREAD_LIBS" = xerror], + [# pthread_attr_init is a macro under HPUX 11.0 and 11.11 + AC_CHECK_LIB([pthread], [pthread_attr_destroy], + [PTHREAD_LIBS="-lpthread"])]) +AS_IF([test "x$PTHREAD_LIBS" = xerror], + [AC_MSG_WARN([*** Unable to locate working posix thread library ***])]) +AC_SUBST([PTHREAD_LIBS]) +]) # OPENAFS_PTHREADS_CHECKS -AC_DEFUN([OPENAFS_MORE_PTHREAD_CHECKS],[ -dnl Look for "non-portable" pthreads functions. +AC_DEFUN([OPENAFS_MORE_PTHREAD_CHECKS], +[dnl Look for "non-portable" pthreads functions. save_LIBS="$LIBS" LIBS="$LIBS $PTHREAD_LIBS" AC_CHECK_FUNCS([ \ - pthread_set_name_np \ - pthread_setname_np \ + pthread_set_name_np \ + pthread_setname_np \ ]) - dnl Sadly, there are three different versions of pthread_setname_np. dnl Try to cater for all of them. -if test "$ac_cv_func_pthread_setname_np" = "yes" ; then - AC_MSG_CHECKING([for signature of pthread_setname_np]) - AC_TRY_COMPILE([ -#include -#ifdef HAVE_PTHREAD_NP_H -#include -#endif -], [pthread_setname_np(pthread_self(), "test", (void *)0)], [ - AC_MSG_RESULT([three arguments]) - pthread_setname_np_args=3], [ - AC_TRY_COMPILE([ -#include -#ifdef HAVE_PTHREAD_NP_H -#include -#endif -], [pthread_setname_np(pthread_self(), "test")], [ - AC_MSG_RESULT([two arguments]) - pthread_setname_np_args=2], [ - AC_TRY_COMPILE([ -#include -#ifdef HAVE_PTHREAD_NP_H -#include -#endif -], [pthread_setname_np("test")], [ - AC_MSG_RESULT([one argument]) - pthread_setname_np_args=1], [pthread_setname_np_args=0]) -]) -]) -AC_DEFINE_UNQUOTED([PTHREAD_SETNAME_NP_ARGS], $pthread_setname_np_args, [Number of arguments required by pthread_setname_np() function]) -fi -]) +AS_IF([test "$ac_cv_func_pthread_setname_np" = "yes"], + [AC_MSG_CHECKING([for signature of pthread_setname_np]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include + #ifdef HAVE_PTHREAD_NP_H + #include + #endif], + [pthread_setname_np(pthread_self(), "test", (void *)0)])], + [AC_MSG_RESULT([three arguments]) + pthread_setname_np_args=3], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include + #ifdef HAVE_PTHREAD_NP_H + #include + #endif], + [pthread_setname_np(pthread_self(), "test")])], + [AC_MSG_RESULT([two arguments]) + pthread_setname_np_args=2], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include + #ifdef HAVE_PTHREAD_NP_H + #include + #endif], + [pthread_setname_np("test")])], + [AC_MSG_RESULT([one argument]) + pthread_setname_np_args=1], + [pthread_setname_np_args=0])])]) + AC_DEFINE_UNQUOTED( + [PTHREAD_SETNAME_NP_ARGS], + [$pthread_setname_np_args], + [Number of arguments required by pthread_setname_np() function])]) +]) # OPENAFS_MORE_PTHREAD_CHECKS