This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Mass update of *headers* in dist/U from git
[metaconfig.git] / dist / U / d_access.U
CommitLineData
33a01fd2 1?RCS: $Id$
d8875586
MBT
2?RCS:
3?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4?RCS:
33a01fd2 5?RCS: You may redistribute only under the terms of the Artistic License,
d8875586
MBT
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
33a01fd2 8?RCS: that same Artistic License; a copy of which may be found at the root
d8875586
MBT
9?RCS: of the source tree for dist 4.0.
10?RCS:
11?RCS: $Log: d_access.U,v $
12?RCS: Revision 3.0 1993/08/18 12:05:42 ram
13?RCS: Baseline for dist 3.0 netwide release.
14?RCS:
15?MAKE:d_access: test +cc cat +cppflags h_fcntl h_sysfile rm Inlibc Findhdr
16?MAKE: -pick add $@ %<
17?S:d_access:
18?S: This variable conditionally defines HAS_ACCESS if the access() system
19?S: call is available to check for access permissions using real IDs.
20?S:.
21?C:HAS_ACCESS:
22?C: This manifest constant lets the C program know that the access()
23?C: system call is available to check for accessibility using real UID/GID.
24?C: (always present on UNIX.)
25?C:.
26?H:#$d_access HAS_ACCESS /**/
27?H:.
28?W:%<:R_OK W_OK X_OK F_OK
29?LINT:set d_access
30?LINT:change h_fcntl h_sysfile
31: access call always available on UNIX
32set access d_access
33eval $inlibc
34
35: locate the flags for 'access()'
36case "$d_access" in
37"$define")
38 echo " "
39 $cat >access.c <<'EOCP'
40#include <sys/types.h>
41#ifdef I_FCNTL
42#include <fcntl.h>
43#endif
44#ifdef I_SYS_FILE
45#include <sys/file.h>
46#endif
47#ifdef I_UNISTD
48#include <unistd.h>
49#endif
50int main() {
51 exit(R_OK);
52}
53EOCP
54 : check sys/file.h first, no particular reason here
55 if $test `./findhdr sys/file.h` && \
56 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
57 h_sysfile=true;
58 echo "<sys/file.h> defines the *_OK access constants." >&4
59 elif $test `./findhdr fcntl.h` && \
60 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
61 h_fcntl=true;
62 echo "<fcntl.h> defines the *_OK access constants." >&4
63@if I_UNISTD
64 elif $test `./findhdr unistd.h` && \
65 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
66 echo "<unistd.h> defines the *_OK access constants." >&4
67@end
68 else
69 echo "I can't find the four *_OK access constants--I'll use mine." >&4
70 fi
71 ;;
72esac
73$rm -f access*
74