1 ?RCS: $Id: usethreads.U,v $
3 ?RCS: Copyright (c) 1998-2000 Andy Dougherty
5 ?RCS: You may distribute under the terms of either the GNU General Public
6 ?RCS: License or the Artistic License, as specified in the README file.
8 ?RCS: $Log: usethreads.U,v $
10 ?MAKE:usethreads useithreads use5005threads d_oldpthreads usereentrant: \
11 Myread Oldconfig Setvar test cat useperlio patchlevel
12 ?MAKE: -pick add $@ %<
15 ?S: This variable conditionally defines the USE_THREADS symbol,
16 ?S: and indicates that Perl should be built to use threads.
19 ?S: This variable conditionally defines the USE_ITHREADS symbol,
20 ?S: and indicates that Perl should be built to use the interpreter-based
21 ?S: threading implementation.
24 ?S: This variable conditionally defines the USE_5005THREADS symbol,
25 ?S: and indicates that Perl should be built to use the 5.005-based
26 ?S: threading implementation. Only valid up to 5.8.x.
28 ?X: I'm putting old_pthreads in this unit because it might eventually
29 ?X: be part of an automatic determination to see if we can use threads
32 ?S: This variable conditionally defines the OLD_PTHREADS_API symbol,
33 ?S: and indicates that Perl should be built to use the old
34 ?S: draft POSIX threads API. This is only potentially meaningful if
35 ?S: usethreads is set.
38 ?S: This variable conditionally defines the USE_REENTRANT_API symbol,
39 ?S: which indicates that the thread code may try to use the various
40 ?S: _r versions of library functions. This is only potentially
41 ?S: meaningful if usethreads is set and is very experimental, it is
42 ?S: not even prompted for.
45 ?C: This symbol, if defined, indicates that Perl should be built to
46 ?C: use the interpreter-based threading implementation.
49 ?C: This symbol, if defined, indicates that Perl should be built to
50 ?C: use the 5.005-based threading implementation.
51 ?C: Only valid up to 5.8.x.
54 ?C: This symbol, if defined, indicates that Perl should
55 ?C: be built to use threads. At present, it is a synonym for
56 ?C: USE_5005THREADS for perl older than 5.8 and USE_ITHREADS
57 ?C: for 5.8.x and newer, but eventually the source ought to be
58 ?C: changed to use this to mean _any_ threading implementation.
61 ?C: This symbol, if defined, indicates that Perl should
62 ?C: be built to use the old draft POSIX threads API.
65 ?C: This symbol, if defined, indicates that Perl should
66 ?C: try to use the various _r versions of library functions.
67 ?C: This is extremely experimental.
69 ?H:#$use5005threads USE_5005THREADS /**/
70 ?H:#$useithreads USE_ITHREADS /**/
71 ?H:?%<:#if defined(USE_5005THREADS) && !defined(USE_ITHREADS)
72 ?H:?%<:#define USE_THREADS /* until src is revised*/
74 ?H:#$d_oldpthreads OLD_PTHREADS_API /**/
75 ?H:#$usereentrant USE_REENTRANT_API /**/
77 ?LINT:set usethreads useithreads use5005threads d_oldpthreads usereentrant
78 ?INIT:: set usethreads on the Configure command line to enable threads.
79 ?INIT:usereentrant='undef'
81 ?X: We should really have some explanatory text here, and some
82 ?X: automatic setting of sensible defaults.
84 $define|true|[yY]*) dflt='y';;
85 *) # Catch case where user specified ithreads or 5005threads but
86 # forgot -Dusethreads (A.D. 4/2002)
87 case "$useithreads$use5005threads" in
90 "$define") dflt='y' ;;
100 Perl can be built to take advantage of threads on some systems.
101 To do so, Configure can be run with -Dusethreads.
103 Note that Perl built with threading support runs slightly slower
104 and uses more memory than plain Perl. The current implementation
105 is believed to be stable, but it is fairly new, and so should be
106 treated with caution.
108 If this doesn't make any sense to you, just accept the default '$dflt'.
110 rp='Build a threading Perl?'
113 y|Y) val="$define" ;;
119 if $test $patchlevel -lt 9; then
120 case "$usethreads" in
124 Since release 5.6, Perl has had two different threading implementations,
125 the newer interpreter-based version (ithreads) with one interpreter per
126 thread, and the older 5.005 version (5005threads).
127 The 5005threads version is effectively unmaintained and will probably be
128 removed in Perl 5.10, so there should be no need to build a Perl using it
129 unless needed for backwards compatibility with some existing 5.005threads
133 : Default to ithreads unless overridden on command line or with
136 case "$use5005threads" in
137 $define|true|[yY]*) dflt='n';;
139 case "$useithreads" in
140 $undef|false|[nN]*) dflt='n';;
142 rp='Use the newer interpreter-based ithreads?'
145 y|Y) val="$define" ;;
150 : Now set use5005threads to the opposite value.
151 case "$useithreads" in
152 $define) val="$undef" ;;
160 use5005threads="$undef"
164 ?X: This is not supposed to be possible but with some trickery, maybe.
165 case "$useithreads$use5005threads" in
169 You cannot have both the ithreads and the 5.005 threads enabled
170 at the same time. Disabling the 5.005 threads since they are
171 much less stable than the ithreads.
174 use5005threads="$undef"
179 : perl-5.9.x and later
181 if test X"$usethreads" = "X$define"; then
182 case "$use5005threads" in
186 5.005 threads has been removed for 5.10. Perl will be built using ithreads.
193 use5005threads="$undef"
194 useithreads="$usethreads"
197 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
200 *** To build with ithreads you must also use the PerlIO layer.
201 *** Cannot continue, aborting.
207 ?X: Check out what kind of threads api we have
208 case "$d_oldpthreads" in
209 '') : Configure tests would be welcome here. For now, assume undef.
211 *) val="$d_oldpthreads" ;;
216 ?X: In general, -lpthread needs to come before -lc but after other
217 ?X: libraries such as -lgdbm and such like. We assume here that -lc
218 ?X: is present in libswanted. If that fails to be true, then this
219 ?X: can be changed to add pthread to the very end of libswanted.
221 : Look for a hint-file generated 'call-back-unit'. If the
222 : user has specified that a threading perl is to be built,
223 : we may need to set or change some other defaults.
224 if $test -f usethreads.cbu; then
225 echo "Your platform has some specific hints regarding threaded builds, using them..."
228 case "$usethreads" in
229 "$define"|true|[yY]*)
231 (Your platform does not have any specific hints for threaded builds.
232 Assuming POSIX threads, then.)