Lines Matching +full:multi +full:- +full:attr
2 # https://www.gnu.org/software/autoconf-archive/ax_pthread.html
7 # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
18 # needed for multi-threaded programs (defaults to the value of CC
36 # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
44 # ACTION-IF-FOUND is a list of shell commands to run if a threads library
45 # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
46 # is not found. If ACTION-IF-FOUND is not specified, the default action
129 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
130 # libraries is broken (non-POSIX).
134 # starting with a "-" are C compiler flags, and remaining items are
136 # any flags at all, and "pthread-config" which is a program returning
139 ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pth…
144 # pthreads: AIX (must check this before -lpthread)
145 # none: in case threads are in libc; should be tried before -Kthread and
147 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
148 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
149 # (Note: HP C rejects this with "bad form for `-t' option")
150 # -pthreads: Solaris/gcc (Note: HP C also rejects)
151 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
153 # -D_REENTRANT too), HP C (must be checked before -lpthread, which
154 # is present but should not be used directly; and before -mthreads,
155 # because the compiler interprets this as "-mt" + "-hreads")
156 # -mthreads: Mingw32/gcc, Lynx/gcc
158 # --thread-safe: KAI C++
159 # pthread-config: use pthread-config program (for GNU Pth library)
165 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
166 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
168 ax_pthread_flags="-kthread lthread $ax_pthread_flags"
173 # From the cc(1) man page: "[-mt] Sets various -D flags to enable
174 # multi-threading and also sets -lpthread."
176 ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
181 # IBM z/OS requires a feature-test macro to be defined in order to
192 …[AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])…
198 # (non-functional) versions of the pthreads routines, so link-based
203 # standard Solaris way of linking pthreads (-mt -lpthread).
205 ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
217 [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
228 # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
230 # Note that for GCC and Clang -pthread generally implies -lpthread,
231 # except when -nostdlib is passed.
235 # [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
236 # To solve this, first try -pthread together with -lpthread for GCC
239 [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
241 # Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
244 [ax_pthread_flags="-pthread,-lpthread -pthread"])
247 # The presence of a feature test macro requesting re-entrant function
261 ax_pthread_check_macro="--"
264 AS_IF([test "x$ax_pthread_check_macro" = "x--"],
283 -*)
288 pthread-config)
289 AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
291 PTHREAD_CFLAGS="`pthread-config --cflags`"
292 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
296 AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
297 PTHREAD_LIBS="-l$ax_pthread_try_flag"
308 # need a special flag -Kthread to make this header compile.)
309 # We check for pthread_join because it is in -lpthread on IRIX
311 # due to DEC craziness with -lpthreads. We check for
313 # functions on Solaris that doesn't have a non-functional libc stub.
323 /* To avoid any unused-parameter or
324 unused-but-set-parameter warning. */
328 [pthread_t th; pthread_attr_t attr;
331 pthread_attr_init(&attr);
349 # Clang needs special handling, because older versions handle the -pthread
354 # Clang takes -pthread; it has never supported any other flag
360 # (Note 2: On some systems, notably Darwin, -pthread is not needed
363 # -pthread does define _REENTRANT, and while the Darwin headers
364 # ignore this macro, third-party headers might not.)
368 # taking place, the -pthread option has no effect ("argument unused
369 # during compilation"). They expect -pthread to be passed in only
380 # Even though use of the -pthread flag in linking would only print
381 # a warning, this can be a nuisance for well-run software projects
382 # that build with -Werror. So if the active version of Clang has
385 …E_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
389 # links in two steps (.c -> .o, .o -> exe) instead of one
390 # (.c -> exe), because the warning occurs only in the second
397 … for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
399 … CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
435 … [int attr = $ax_pthread_attr; return attr /* ; */])],
446 uses a non-standard name on your system.])
455 ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
505 test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
506 test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
513 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: