This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
2bc52d8409cd7cfe596f705f3c105284cef15ef2
[metaconfig.git] / U / typedefs / gidsign.U
1 ?RCS:
2 ?RCS: Copyright (c) 1999, Jarkko Hietaniemi
3 ?RCS:
4 ?RCS: You may redistribute only under the terms of the Artistic License,
5 ?RCS: as specified in the README file that comes with the distribution.
6 ?RCS: You may reuse parts of this distribution only within the terms of
7 ?RCS: that same Artistic License; a copy of which may be found at the root
8 ?RCS: of the source tree for dist 3.0.
9 ?RCS:
10 ?MAKE:gidsign: Myread Typedef gidtype Compile run
11 ?MAKE:  -pick add $@ %<
12 ?S:gidsign:
13 ?S:     This variable contains the signedness of a gidtype.
14 ?S:     1 for unsigned, -1 for signed.
15 ?S:.
16 ?C:Gid_t_sign:
17 ?C:     This symbol holds the signedess of a Gid_t.
18 ?C:     1 for unsigned, -1 for signed.
19 ?C:.
20 ?H:#define Gid_t_sign   $gidsign                /* GID sign */
21 ?H:.
22 ?T:yyy zzz
23 ?F:!try
24 : Check if GID is signed
25 echo " "
26 case "$gidtype" in
27 *_t) zzz="$gidtype"     ;;
28 *)   zzz="gid"          ;;
29 esac
30 echo "Checking the sign of $zzz..." >&4
31 cat > try.c <<EOCP
32 #include <sys/types.h>
33 #include <stdio.h>
34 int main() {
35         $gidtype foo = -1;
36         if (foo < 0)
37                 printf("-1\n");
38         else
39                 printf("1\n");
40 }
41 EOCP
42 set try
43 if eval $compile; then
44         yyy=`$run ./try`
45         case "$yyy" in
46         '')     gidsign=1
47                 echo "(I can't execute the test program--guessing unsigned.)" >&4
48                 ;;
49         *)      gidsign=$yyy
50                 case "$gidsign" in
51                  1) echo "Your $zzz is unsigned." ;;
52                 -1) echo "Your $zzz is signed."   ;;
53                 esac
54                 ;;
55         esac
56 else
57         gidsign=1
58         echo "(I can't compile the test program--guessing unsigned.)" >&4
59 fi
60
61