Changeset 26102e in git


Ignore:
Timestamp:
Nov 15, 2016, 3:24:54 PM (7 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
99d898f8fea12000aad60ac8b2dbce9e4536d2ba
Parents:
895ba2662ac351e7ae9a9f15027a52e48c6bea77
Message:
update m4/ax_pthread.m4
File:
1 edited

Legend:

Unmodified
Added
Removed
  • m4/ax_pthread.m4

    r895ba26 r26102e  
    2020#
    2121#   NOTE: You are assumed to not only compile your program with these flags,
    22 #   but also link it with them as well. e.g. you should link with
     22#   but also to link with them as well. For example, you might link with
    2323#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
    2424#
    25 #   If you are only building threads programs, you may wish to use these
     25#   If you are only building threaded programs, you may wish to use these
    2626#   variables in your default LIBS, CFLAGS, and CC:
    2727#
     
    3131#
    3232#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
    33 #   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
    34 #   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
     33#   has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
     34#   that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
    3535#
    3636#   Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
     
    8383#   exception to the GPL to apply to your modified version as well.
    8484
    85 #serial 21
     85#serial 23
    8686
    8787AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
    8888AC_DEFUN([AX_PTHREAD], [
    8989AC_REQUIRE([AC_CANONICAL_HOST])
     90AC_REQUIRE([AC_PROG_CC])
     91AC_REQUIRE([AC_PROG_SED])
    9092AC_LANG_PUSH([C])
    9193ax_pthread_ok=no
    9294
    9395# We used to check for pthread.h first, but this fails if pthread.h
    94 # requires special compiler flags (e.g. on True64 or Sequent).
     96# requires special compiler flags (e.g. on Tru64 or Sequent).
    9597# It gets checked for in the link test anyway.
    9698
     
    98100# etcetera environment variables, and if threads linking works using
    99101# them:
    100 if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
    101         save_CFLAGS="$CFLAGS"
     102if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
     103        ax_pthread_save_CC="$CC"
     104        ax_pthread_save_CFLAGS="$CFLAGS"
     105        ax_pthread_save_LIBS="$LIBS"
     106        AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
    102107        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    103         save_LIBS="$LIBS"
    104108        LIBS="$PTHREAD_LIBS $LIBS"
    105         AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
    106         AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
     109        AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
     110        AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
    107111        AC_MSG_RESULT([$ax_pthread_ok])
    108         if test x"$ax_pthread_ok" = xno; then
     112        if test "x$ax_pthread_ok" = "xno"; then
    109113                PTHREAD_LIBS=""
    110114                PTHREAD_CFLAGS=""
    111115        fi
    112         LIBS="$save_LIBS"
    113         CFLAGS="$save_CFLAGS"
     116        CC="$ax_pthread_save_CC"
     117        CFLAGS="$ax_pthread_save_CFLAGS"
     118        LIBS="$ax_pthread_save_LIBS"
    114119fi
    115120
     
    124129# which is a program returning the flags for the Pth emulation library.
    125130
    126 ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
     131ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
    127132
    128133# The ordering *is* (sometimes) important.  Some notes on the
     
    133138#       other compiler flags to prevent continual compiler warnings
    134139# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
    135 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
    136 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
    137 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
    138 # -pthreads: Solaris/gcc
     140# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
     141#           (Note: HP C rejects this with "bad form for `-t' option")
     142# -pthreads: Solaris/gcc (Note: HP C also rejects)
     143# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
     144#      doesn't hurt to check since this sometimes defines pthreads and
     145#      -D_REENTRANT too), HP C (must be checked before -lpthread, which
     146#      is present but should not be used directly; and before -mthreads,
     147#      because the compiler interprets this as "-mt" + "-hreads")
    139148# -mthreads: Mingw32/gcc, Lynx/gcc
    140 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
    141 #      doesn't hurt to check since this sometimes defines pthreads too;
    142 #      also defines -D_REENTRANT)
    143 #      ... -mt is also the pthreads flag for HP/aCC
    144149# pthread: Linux, etcetera
    145150# --thread-safe: KAI C++
    146151# pthread-config: use pthread-config program (for GNU Pth library)
    147152
    148 case ${host_os} in
     153case $host_os in
     154
     155        freebsd*)
     156
     157        # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
     158        # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
     159
     160        ax_pthread_flags="-kthread lthread $ax_pthread_flags"
     161        ;;
     162
     163        hpux*)
     164
     165        # From the cc(1) man page: "[-mt] Sets various -D flags to enable
     166        # multi-threading and also sets -lpthread."
     167
     168        ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
     169        ;;
     170
     171        openedition*)
     172
     173        # IBM z/OS requires a feature-test macro to be defined in order to
     174        # enable POSIX threads at all, so give the user a hint if this is
     175        # not set. (We don't define these ourselves, as they can affect
     176        # other portions of the system API in unpredictable ways.)
     177
     178        AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
     179            [
     180#            if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
     181             AX_PTHREAD_ZOS_MISSING
     182#            endif
     183            ],
     184            [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
     185        ;;
     186
    149187        solaris*)
    150188
    151189        # On Solaris (at least, for some versions), libc contains stubbed
    152190        # (non-functional) versions of the pthreads routines, so link-based
    153         # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
    154         # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
    155         # a function called by this macro, so we could check for that, but
    156         # who knows whether they'll stub that too in a future libc.)  So,
    157         # we'll just look for -pthreads and -lpthread first:
    158 
    159         ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
    160         ;;
    161 
    162         darwin*)
    163         ax_pthread_flags="-pthread $ax_pthread_flags"
     191        # tests will erroneously succeed. (N.B.: The stubs are missing
     192        # pthread_cleanup_push, or rather a function called by this macro,
     193        # so we could check for that, but who knows whether they'll stub
     194        # that too in a future libc.)  So we'll check first for the
     195        # standard Solaris way of linking pthreads (-mt -lpthread).
     196
     197        ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
    164198        ;;
    165199esac
    166200
    167 # Clang doesn't consider unrecognized options an error unless we specify
    168 # -Werror. We throw in some extra Clang-specific options to ensure that
    169 # this doesn't happen for GCC, which also accepts -Werror.
    170 
    171 AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
    172 save_CFLAGS="$CFLAGS"
    173 ax_pthread_extra_flags="-Werror"
    174 CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
    175 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
    176                   [AC_MSG_RESULT([yes])],
    177                   [ax_pthread_extra_flags=
    178                    AC_MSG_RESULT([no])])
    179 CFLAGS="$save_CFLAGS"
    180 
    181 if test x"$ax_pthread_ok" = xno; then
    182 for flag in $ax_pthread_flags; do
    183 
    184         case $flag in
     201# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
     202
     203AS_IF([test "x$GCC" = "xyes"],
     204      [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"])
     205
     206# The presence of a feature test macro requesting re-entrant function
     207# definitions is, on some systems, a strong hint that pthreads support is
     208# correctly enabled
     209
     210case $host_os in
     211        darwin* | hpux* | linux* | osf* | solaris*)
     212        ax_pthread_check_macro="_REENTRANT"
     213        ;;
     214
     215        aix*)
     216        ax_pthread_check_macro="_THREAD_SAFE"
     217        ;;
     218
     219        *)
     220        ax_pthread_check_macro="--"
     221        ;;
     222esac
     223AS_IF([test "x$ax_pthread_check_macro" = "x--"],
     224      [ax_pthread_check_cond=0],
     225      [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
     226
     227# Are we compiling with Clang?
     228
     229AC_CACHE_CHECK([whether $CC is Clang],
     230    [ax_cv_PTHREAD_CLANG],
     231    [ax_cv_PTHREAD_CLANG=no
     232     # Note that Autoconf sets GCC=yes for Clang as well as GCC
     233     if test "x$GCC" = "xyes"; then
     234        AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
     235            [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
     236#            if defined(__clang__) && defined(__llvm__)
     237             AX_PTHREAD_CC_IS_CLANG
     238#            endif
     239            ],
     240            [ax_cv_PTHREAD_CLANG=yes])
     241     fi
     242    ])
     243ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
     244
     245ax_pthread_clang_warning=no
     246
     247# Clang needs special handling, because older versions handle the -pthread
     248# option in a rather... idiosyncratic way
     249
     250if test "x$ax_pthread_clang" = "xyes"; then
     251
     252        # Clang takes -pthread; it has never supported any other flag
     253
     254        # (Note 1: This will need to be revisited if a system that Clang
     255        # supports has POSIX threads in a separate library.  This tends not
     256        # to be the way of modern systems, but it's conceivable.)
     257
     258        # (Note 2: On some systems, notably Darwin, -pthread is not needed
     259        # to get POSIX threads support; the API is always present and
     260        # active.  We could reasonably leave PTHREAD_CFLAGS empty.  But
     261        # -pthread does define _REENTRANT, and while the Darwin headers
     262        # ignore this macro, third-party headers might not.)
     263
     264        PTHREAD_CFLAGS="-pthread"
     265        PTHREAD_LIBS=
     266
     267        ax_pthread_ok=yes
     268
     269        # However, older versions of Clang make a point of warning the user
     270        # that, in an invocation where only linking and no compilation is
     271        # taking place, the -pthread option has no effect ("argument unused
     272        # during compilation").  They expect -pthread to be passed in only
     273        # when source code is being compiled.
     274        #
     275        # Problem is, this is at odds with the way Automake and most other
     276        # C build frameworks function, which is that the same flags used in
     277        # compilation (CFLAGS) are also used in linking.  Many systems
     278        # supported by AX_PTHREAD require exactly this for POSIX threads
     279        # support, and in fact it is often not straightforward to specify a
     280        # flag that is used only in the compilation phase and not in
     281        # linking.  Such a scenario is extremely rare in practice.
     282        #
     283        # Even though use of the -pthread flag in linking would only print
     284        # a warning, this can be a nuisance for well-run software projects
     285        # that build with -Werror.  So if the active version of Clang has
     286        # this misfeature, we search for an option to squash it.
     287
     288        AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
     289            [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
     290            [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
     291             # Create an alternate version of $ac_link that compiles and
     292             # links in two steps (.c -> .o, .o -> exe) instead of one
     293             # (.c -> exe), because the warning occurs only in the second
     294             # step
     295             ax_pthread_save_ac_link="$ac_link"
     296             ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
     297             ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
     298             ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
     299             ax_pthread_save_CFLAGS="$CFLAGS"
     300             for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
     301                AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
     302                CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
     303                ac_link="$ax_pthread_save_ac_link"
     304                AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
     305                    [ac_link="$ax_pthread_2step_ac_link"
     306                     AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
     307                         [break])
     308                    ])
     309             done
     310             ac_link="$ax_pthread_save_ac_link"
     311             CFLAGS="$ax_pthread_save_CFLAGS"
     312             AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
     313             ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
     314            ])
     315
     316        case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
     317                no | unknown) ;;
     318                *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
     319        esac
     320
     321fi # $ax_pthread_clang = yes
     322
     323if test "x$ax_pthread_ok" = "xno"; then
     324for ax_pthread_try_flag in $ax_pthread_flags; do
     325
     326        case $ax_pthread_try_flag in
    185327                none)
    186328                AC_MSG_CHECKING([whether pthreads work without any flags])
    187329                ;;
    188330
     331                -mt,pthread)
     332                AC_MSG_CHECKING([whether pthreads work with -mt -lpthread])
     333                PTHREAD_CFLAGS="-mt"
     334                PTHREAD_LIBS="-lpthread"
     335                ;;
     336
    189337                -*)
    190                 AC_MSG_CHECKING([whether pthreads work with $flag])
    191                 PTHREAD_CFLAGS="$flag"
     338                AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
     339                PTHREAD_CFLAGS="$ax_pthread_try_flag"
    192340                ;;
    193341
    194342                pthread-config)
    195343                AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
    196                 if test x"$ax_pthread_config" = xno; then continue; fi
     344                AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
    197345                PTHREAD_CFLAGS="`pthread-config --cflags`"
    198346                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
     
    200348
    201349                *)
    202                 AC_MSG_CHECKING([for the pthreads library -l$flag])
    203                 PTHREAD_LIBS="-l$flag"
     350                AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
     351                PTHREAD_LIBS="-l$ax_pthread_try_flag"
    204352                ;;
    205353        esac
    206354
    207         save_LIBS="$LIBS"
    208         save_CFLAGS="$CFLAGS"
     355        ax_pthread_save_CFLAGS="$CFLAGS"
     356        ax_pthread_save_LIBS="$LIBS"
     357        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    209358        LIBS="$PTHREAD_LIBS $LIBS"
    210         CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
    211359
    212360        # Check for various functions.  We must include pthread.h,
     
    219367        # functions on Solaris that doesn't have a non-functional libc stub.
    220368        # We try pthread_create on general principles.
     369
    221370        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
     371#                       if $ax_pthread_check_cond
     372#                        error "$ax_pthread_check_macro must be defined"
     373#                       endif
    222374                        static void routine(void *a) { a = 0; }
    223375                        static void *start_routine(void *a) { return a; }],
     
    228380                        pthread_cleanup_push(routine, 0);
    229381                        pthread_cleanup_pop(0) /* ; */])],
    230                 [ax_pthread_ok=yes],
    231                 [])
    232 
    233         LIBS="$save_LIBS"
    234         CFLAGS="$save_CFLAGS"
     382            [ax_pthread_ok=yes],
     383            [])
     384
     385        CFLAGS="$ax_pthread_save_CFLAGS"
     386        LIBS="$ax_pthread_save_LIBS"
    235387
    236388        AC_MSG_RESULT([$ax_pthread_ok])
    237         if test "x$ax_pthread_ok" = xyes; then
    238                 break;
    239         fi
     389        AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
    240390
    241391        PTHREAD_LIBS=""
     
    245395
    246396# Various other checks:
    247 if test "x$ax_pthread_ok" = xyes; then
    248         save_LIBS="$LIBS"
     397if test "x$ax_pthread_ok" = "xyes"; then
     398        ax_pthread_save_CFLAGS="$CFLAGS"
     399        ax_pthread_save_LIBS="$LIBS"
     400        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    249401        LIBS="$PTHREAD_LIBS $LIBS"
    250         save_CFLAGS="$CFLAGS"
    251         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    252402
    253403        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
    254         AC_MSG_CHECKING([for joinable pthread attribute])
    255         attr_name=unknown
    256         for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
    257             AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
    258                            [int attr = $attr; return attr /* ; */])],
    259                 [attr_name=$attr; break],
    260                 [])
    261         done
    262         AC_MSG_RESULT([$attr_name])
    263         if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
    264             AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
    265                                [Define to necessary symbol if this constant
    266                                 uses a non-standard name on your system.])
    267         fi
    268 
    269         AC_MSG_CHECKING([if more special flags are required for pthreads])
    270         flag=no
    271         case ${host_os} in
    272             aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
    273             osf* | hpux*) flag="-D_REENTRANT";;
    274             solaris*)
    275             if test "$GCC" = "yes"; then
    276                 flag="-D_REENTRANT"
    277             else
    278                 # TODO: What about Clang on Solaris?
    279                 flag="-mt -D_REENTRANT"
    280             fi
    281             ;;
    282         esac
    283         AC_MSG_RESULT([$flag])
    284         if test "x$flag" != xno; then
    285             PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
    286         fi
     404        AC_CACHE_CHECK([for joinable pthread attribute],
     405            [ax_cv_PTHREAD_JOINABLE_ATTR],
     406            [ax_cv_PTHREAD_JOINABLE_ATTR=unknown
     407             for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
     408                 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
     409                                                 [int attr = $ax_pthread_attr; return attr /* ; */])],
     410                                [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
     411                                [])
     412             done
     413            ])
     414        AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
     415               test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
     416               test "x$ax_pthread_joinable_attr_defined" != "xyes"],
     417              [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
     418                                  [$ax_cv_PTHREAD_JOINABLE_ATTR],
     419                                  [Define to necessary symbol if this constant
     420                                   uses a non-standard name on your system.])
     421               ax_pthread_joinable_attr_defined=yes
     422              ])
     423
     424        AC_CACHE_CHECK([whether more special flags are required for pthreads],
     425            [ax_cv_PTHREAD_SPECIAL_FLAGS],
     426            [ax_cv_PTHREAD_SPECIAL_FLAGS=no
     427             case $host_os in
     428             solaris*)
     429             ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
     430             ;;
     431             esac
     432            ])
     433        AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
     434               test "x$ax_pthread_special_flags_added" != "xyes"],
     435              [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
     436               ax_pthread_special_flags_added=yes])
    287437
    288438        AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
    289             [ax_cv_PTHREAD_PRIO_INHERIT], [
    290                 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
    291                                                 [[int i = PTHREAD_PRIO_INHERIT;]])],
    292                     [ax_cv_PTHREAD_PRIO_INHERIT=yes],
    293                     [ax_cv_PTHREAD_PRIO_INHERIT=no])
     439            [ax_cv_PTHREAD_PRIO_INHERIT],
     440            [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
     441                                             [[int i = PTHREAD_PRIO_INHERIT;]])],
     442                            [ax_cv_PTHREAD_PRIO_INHERIT=yes],
     443                            [ax_cv_PTHREAD_PRIO_INHERIT=no])
    294444            ])
    295         AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
    296             [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
    297 
    298         LIBS="$save_LIBS"
    299         CFLAGS="$save_CFLAGS"
     445        AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
     446               test "x$ax_pthread_prio_inherit_defined" != "xyes"],
     447              [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
     448               ax_pthread_prio_inherit_defined=yes
     449              ])
     450
     451        CFLAGS="$ax_pthread_save_CFLAGS"
     452        LIBS="$ax_pthread_save_LIBS"
    300453
    301454        # More AIX lossage: compile with *_r variant
    302         if test "x$GCC" != xyes; then
     455        if test "x$GCC" != "xyes"; then
    303456            case $host_os in
    304457                aix*)
    305458                AS_CASE(["x/$CC"],
    306                   [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
    307                   [#handle absolute path differently from PATH based program lookup
    308                    AS_CASE(["x$CC"],
    309                      [x/*],
    310                      [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
    311                      [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
     459                    [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
     460                    [#handle absolute path differently from PATH based program lookup
     461                     AS_CASE(["x$CC"],
     462                         [x/*],
     463                         [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
     464                         [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
    312465                ;;
    313466            esac
     
    322475
    323476# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
    324 if test x"$ax_pthread_ok" = xyes; then
     477if test "x$ax_pthread_ok" = "xyes"; then
    325478        ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
    326479        :
Note: See TracChangeset for help on using the changeset viewer.