This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
metaconfig: more thready fixes.
[metaconfig.git] / U / threads / d_ttyname_r.U
1 ?RCS: $Id$
2 ?RCS:
3 ?RCS: Copyright (c) 1999 Jarkko Hietaniemi
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 ?MAKE:d_ttyname_r ttyname_r_proto: Inlibc Protochk i_systypes i_unistd
9 ?MAKE:  -pick add $@ %<
10 ?S:d_ttyname_r:
11 ?S:     This variable conditionally defines the HAS_TTYNAME_R symbol,
12 ?S:     which indicates to the C prospam that the ttyname_r()
13 ?S:     routine is available.
14 ?S:.
15 ?S:ttyname_r_proto:
16 ?S:     This variable encodes the prototype of ttyname_r.
17 ?S:.
18 ?C:HAS_TTYNAME_R:
19 ?C:     This symbol, if defined, indicates that the ttyname_r routine
20 ?C:     is available to ttyname re-entrantly.
21 ?C:.
22 ?C:TTYNAME_R_PROTO:
23 ?C:     This symbol encodes the prototype of ttyname_r.
24 ?C:      13     int   ttyname_r(int, char *, int)
25 ?C:      14     char* ttyname_r(int, char *, int)
26 ?C:      21     int   ttyname_r(int, char *, size_t)
27 ?C:     The 21 is preferred since it's the SUSv3/POSIX 1001.3-2001 one.
28 ?C:.
29 ?H:#$d_ttyname_r HAS_TTYNAME_R          /**/
30 ?H:#define TTYNAME_R_PROTO $ttyname_r_proto     /**/
31 ?H:.
32 ?T:try hdrs
33 ?LINT:set d_ttyname_r
34 : see if ttyname_r exists
35 set ttyname_r d_ttyname_r
36 eval $inlibc
37 case "$d_ttyname_r" in
38 "$define")
39         hdrs="$i_systypes sys/types.h $i_unistd unistd.h"
40         try='extern int ttyname_r(int, char *, size_t);'
41         if ./protochk "$try" $hdrs; then
42                 echo "Your system has $try"
43                 ttyname_r_proto=21
44         else
45                 try='extern int ttyname_r(int, char *, int);'
46                 if ./protochk "$try" $hdrs; then
47                         echo "Your system has $try"
48                         ttyname_r_proto=13
49                 else
50                         try='extern char* ttyname_r(int, char *, int);'
51                         if ./protochk "$try" $hdrs; then
52                                 echo "Your system has $try"
53                                 ttyname_r_proto=14
54                         else
55                                 echo "I do not recognize the prototype of your ttyname_r, not using it." >&4
56                                 d_ttyname_r="$undef"
57                                 ttyname_r_proto=0
58
59                         fi
60                 fi
61         fi
62         ;;
63 *)      ttyname_r_proto=0 ;;
64 esac
65