This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
metaconfig unit changes for #15418.
[metaconfig.git] / U / threads / d_ttyname_r.U
1 ?RCS: $Id: d_ttyname_r.U,v 0RCS:
2 ?RCS: Copyright (c) 2002 Jarkko Hietaniemi
3 ?RCS:
4 ?RCS: You may distribute under the terms of either the GNU General Public
5 ?RCS: License or the Artistic License, as specified in the README file.
6 ?RCS:
7 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
8 ?RCS:
9 ?MAKE:d_ttyname_r ttyname_r_proto: Inlibc Protochk Hasproto i_systypes i_systime i_unistd usethreads
10 ?MAKE:  -pick add $@ %<
11 ?S:d_ttyname_r:
12 ?S:     This variable conditionally defines the HAS_TTYNAME_R symbol,
13 ?S:     which indicates to the C program that the ttyname_r()
14 ?S:     routine is available.
15 ?S:.
16 ?S:ttyname_r_proto:
17 ?S:     This variable encodes the prototype of ttyname_r.
18 ?S:.
19 ?C:HAS_TTYNAME_R:
20 ?C:     This symbol, if defined, indicates that the ttyname_r routine
21 ?C:     is available to ttyname re-entrantly.
22 ?C:.
23 ?C:TTYNAME_R_PROTO:
24 ?C:     This symbol encodes the prototype of ttyname_r.
25 ?C:.
26 ?H:#$d_ttyname_r HAS_TTYNAME_R     /**/
27 ?H:#define TTYNAME_R_PROTO $ttyname_r_proto        /**/
28 ?H:.
29 ?T:try hdrs d_ttyname_r_proto
30 ?LINT:set d_ttyname_r
31 ?LINT:set ttyname_r_proto
32 : see if ttyname_r exists
33 set ttyname_r d_ttyname_r
34 eval $inlibc
35 case "$d_ttyname_r" in
36 "$define")
37         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
38         case "unistd" in
39         time)
40                 hdrs="$hdrs $i_systime sys/time.h"
41                 ;;
42         esac
43         case "$d_ttyname_r_proto:$usethreads" in
44         ":define")      d_ttyname_r_proto=define
45                 set d_ttyname_r_proto ttyname_r $hdrs
46                 eval $hasproto ;;
47         *)      ;;
48         esac
49         case "$d_ttyname_r_proto" in
50         define)
51         case "$ttyname_r_proto" in
52         ''|0) try='int ttyname_r(int, char*, size_t);'
53         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
54         esac
55         case "$ttyname_r_proto" in
56         ''|0) try='int ttyname_r(int, char*, int);'
57         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
58         esac
59         case "$ttyname_r_proto" in
60         ''|0) try='char* ttyname_r(int, char*, int);'
61         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
62         esac
63         case "$ttyname_r_proto" in
64         ''|0)   d_ttyname_r=undef
65                 ttyname_r_proto=0
66                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
67         * )     case "$ttyname_r_proto" in
68                 REENTRANT_PROTO*) ;;
69                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
70                 esac
71                 echo "Prototype: $try" ;;
72         esac
73         ;;
74         *)      case "$usethreads" in
75                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
76                 esac
77                 d_ttyname_r=undef
78                 ttyname_r_proto=0
79                 ;;
80         esac
81         ;;
82 *)      ttyname_r_proto=0
83         ;;
84 esac
85