This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
7b51195c690888547507e8d6c670c8bb908cd266
[metaconfig.git] / U / compline / d_open3.U
1 ?RCS: $Id: d_open3.U,v 3.0.1.2 1997/02/28 15:37:12 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4 ?RCS:
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
10 ?RCS:
11 ?RCS: $Log: d_open3.U,v $
12 ?RCS: Revision 3.0.1.2  1997/02/28  15:37:12  ram
13 ?RCS: patch61: added ?F: metalint hint
14 ?RCS:
15 ?RCS: Revision 3.0.1.1  1995/07/25  13:58:26  ram
16 ?RCS: patch56: added knowledge of the O_NONBLOCK symbol
17 ?RCS:
18 ?RCS: Revision 3.0  1993/08/18  12:06:44  ram
19 ?RCS: Baseline for dist 3.0 netwide release.
20 ?RCS:
21 ?MAKE:d_open3: Compile test cat h_fcntl h_sysfile rm_try Setvar Findhdr run i_stdlib
22 ?MAKE:  -pick add $@ %<
23 ?X:     It would be easy to separate the h_O_stuff from this.
24 ?X:     Is there a reason to do so? -- HMS
25 ?S:d_open3:
26 ?S:     This variable conditionally defines the HAS_OPEN3 manifest constant,
27 ?S:     which indicates to the C program that the 3 argument version of
28 ?S:     the open(2) function is available.
29 ?S:.
30 ?C:HAS_OPEN3 (OPEN3):
31 ?C:     This manifest constant lets the C program know that the three
32 ?C:     argument form of open(2) is available.
33 ?C:.
34 ?H:#$d_open3 HAS_OPEN3          /**/
35 ?H:.
36 ?W:%<:O_RDONLY O_WRONLY O_RDWR O_NDELAY O_APPEND O_SYNC O_CREAT O_TRUNC
37 ?W:%<:O_EXCL O_NONBLOCK
38 ?F:!try
39 ?LINT:set d_open3
40 ?LINT:change h_fcntl h_sysfile
41 : Locate the flags for 'open()'
42 echo " "
43 $cat >try.c <<EOCP
44 #include <sys/types.h>
45 #ifdef I_FCNTL
46 #include <fcntl.h>
47 #endif
48 #ifdef I_SYS_FILE
49 #include <sys/file.h>
50 #endif
51 #$i_stdlib I_STDLIB
52 #ifdef I_STDLIB
53 #include <stdlib.h>
54 #endif
55 int main() {
56         if(O_RDONLY);
57 #ifdef O_TRUNC
58         exit(0);
59 #else
60         exit(1);
61 #endif
62 }
63 EOCP
64 : check sys/file.h first to get FREAD on Sun
65 if $test `./findhdr sys/file.h` && \
66                 set try -DI_SYS_FILE && eval $compile; then
67         h_sysfile=true;
68         echo "<sys/file.h> defines the O_* constants..." >&4
69         if $run ./try; then
70                 echo "and you have the 3 argument form of open()." >&4
71                 val="$define"
72         else
73                 echo "but not the 3 argument form of open().  Oh, well." >&4
74                 val="$undef"
75         fi
76 elif $test `./findhdr fcntl.h` && \
77                 set try -DI_FCNTL && eval $compile; then
78         h_fcntl=true;
79         echo "<fcntl.h> defines the O_* constants..." >&4
80         if $run ./try; then
81                 echo "and you have the 3 argument form of open()." >&4
82                 val="$define"
83         else
84                 echo "but not the 3 argument form of open().  Oh, well." >&4
85                 val="$undef"
86         fi
87 else
88         val="$undef"
89         echo "I can't find the O_* constant definitions!  You got problems." >&4
90 fi
91 set d_open3
92 eval $setvar
93 $rm_try
94