This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
usethreads.U: Rmv unused variable
[metaconfig.git] / U / threads / usethreads.U
1 ?RCS: $Id: usethreads.U,v $
2 ?RCS:
3 ?RCS: Copyright (c) 1998-2000 Andy Dougherty
4 ?RCS:
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.
7 ?RCS:
8 ?RCS: $Log: usethreads.U,v $
9 ?RCS:
10 ?MAKE:usethreads useithreads d_oldpthreads usereentrant: \
11         Myread Oldconfig Setvar test cat
12 ?MAKE:  -pick add $@ %<
13 ?Y:TOP
14 ?S:usethreads:
15 ?S:     This variable conditionally defines the USE_THREADS symbol,
16 ?S:     and indicates that Perl should be built to use threads.
17 ?S:.
18 ?S:useithreads:
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.
22 ?S:.
23 ?X: I'm putting old_pthreads in this unit because it might eventually
24 ?X: be part of an automatic determination to see if we can use threads
25 ?X: at all.
26 ?S:d_oldpthreads:
27 ?S:     This variable conditionally defines the OLD_PTHREADS_API symbol,
28 ?S:     and indicates that Perl should be built to use the old
29 ?S:     draft POSIX threads API.  This is only potentially meaningful if
30 ?S:     usethreads is set.
31 ?S:.
32 ?S:usereentrant:
33 ?S:     This variable conditionally defines the USE_REENTRANT_API symbol,
34 ?S:     which indicates that the thread code may try to use the various
35 ?S:     _r versions of library functions.  This is only potentially
36 ?S:     meaningful if usethreads is set and is very experimental, it is
37 ?S:     not even prompted for.
38 ?S:.
39 ?C:USE_ITHREADS:
40 ?C:     This symbol, if defined, indicates that Perl should be built to
41 ?C:     use the interpreter-based threading implementation.
42 ?C:.
43 ?C:USE_THREADS:
44 ?C:     This symbol, if defined, indicates that Perl should
45 ?C:     be built to use threads.  At present, it is a synonym for
46 ?C:     and USE_ITHREADS, but eventually the source ought to be
47 ?C:     changed to use this to mean _any_ threading implementation.
48 ?C:.
49 ?C:OLD_PTHREADS_API:
50 ?C:     This symbol, if defined, indicates that Perl should
51 ?C:     be built to use the old draft POSIX threads API.
52 ?C:.
53 ?C:USE_REENTRANT_API:
54 ?C:     This symbol, if defined, indicates that Perl should
55 ?C:     try to use the various _r versions of library functions.
56 ?C:     This is extremely experimental.
57 ?C:.
58 ?H:#$useithreads        USE_ITHREADS            /**/
59 ?H:#$usethreads         USE_THREADS             /**/
60 ?H:#$d_oldpthreads      OLD_PTHREADS_API                /**/
61 ?H:#$usereentrant       USE_REENTRANT_API       /**/
62 ?H:.
63 ?LINT:set usethreads d_oldpthreads
64 ?INIT:: set usethreads on the Configure command line to enable threads.
65 ?INIT:usereentrant='undef'
66 ?F:!usethreads.cbu
67 : Do we want threads support and if so, what type
68 ?X: We should really have some explanatory text here, and some
69 ?X: automatic setting of sensible defaults.
70 case "$usethreads" in
71 $define|true|[yY]*)     dflt='y';;
72 *)     # Catch case where user specified ithreads but
73        # forgot -Dusethreads (A.D. 4/2002)
74        case "$useithreads" in
75        *$define*)       dflt='y';;
76        *)               dflt='n';;
77        esac
78        ;;
79 esac
80 cat <<EOM
81
82 Perl can be built to offer a form of threading support on some systems
83 To do so, Configure can be run with -Dusethreads.
84
85 Note that Perl built with threading support runs slightly slower
86 and uses slightly more memory than plain Perl.
87
88 If this doesn't make any sense to you, just accept the default '$dflt'.
89 EOM
90 rp='Build a threading Perl?'
91 . ./myread
92 case "$ans" in
93 y|Y)    val="$define" ;;
94 *)      val="$undef" ;;
95 esac
96 set usethreads
97 eval $setvar
98
99 useithreads="$usethreads"
100
101 ?X: Check out what kind of threads API we have
102 case "$d_oldpthreads" in
103 '')     : Configure tests would be welcome here.  For now, assume undef.
104         val="$undef" ;;
105 *)      val="$d_oldpthreads" ;;
106 esac
107 set d_oldpthreads
108 eval $setvar
109
110 ?X: In general, -lpthread needs to come before -lc but after other
111 ?X: libraries such as -lgdbm and such like. We assume here that -lc
112 ?X: is present in libswanted. If that fails to be true, then this
113 ?X: can be changed to add pthread to the very end of libswanted.
114
115 : Look for a hint-file generated 'call-back-unit'.  If the
116 : user has specified that a threading perl is to be built,
117 : we may need to set or change some other defaults.
118 if $test -f usethreads.cbu; then
119     echo "Your platform has some specific hints regarding threaded builds, using them..."
120     . ./usethreads.cbu
121 else
122     case "$usethreads" in
123         "$define"|true|[yY]*)
124                 $cat <<EOM
125 (Your platform does not have any specific hints for threaded builds.
126  Assuming POSIX threads, then.)
127 EOM
128         ;;
129     esac
130 fi
131