This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
/\=/ does not require \ even in older awk
[metaconfig.git] / U / compline / d_closedir.U
1 ?RCS: $Id: d_closedir.U,v 3.0.1.3 1997/02/28 15:31:26 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 License,
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 License; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
10 ?RCS:
11 ?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
12 ?RCS:
13 ?RCS: $Log: d_closedir.U,v $
14 ?RCS: Revision 3.0.1.3  1997/02/28  15:31:26  ram
15 ?RCS: patch61: added ?F: metalint hint
16 ?RCS:
17 ?RCS: Revision 3.0.1.2  1994/10/29  16:11:18  ram
18 ?RCS: patch36: added 'ldflags' to the test compile line (ADO)
19 ?RCS:
20 ?RCS: Revision 3.0.1.1  1994/08/29  16:07:21  ram
21 ?RCS: patch32: created by ADO
22 ?RCS:
23 ?MAKE:d_closedir d_void_closedir: Inlibc i_dirent i_sysdir i_sysndir \
24         i_systypes Compile Setvar rm_try run
25 ?MAKE:  -pick add $@ %<
26 ?S:d_closedir:
27 ?S:     This variable conditionally defines HAS_CLOSEDIR if closedir() is
28 ?S:     available.
29 ?S:.
30 ?C:HAS_CLOSEDIR:
31 ?C:     This symbol, if defined, indicates that the closedir() routine is
32 ?C:     available.
33 ?C:.
34 ?H:#$d_closedir HAS_CLOSEDIR            /**/
35 ?H:.
36 ?S:d_void_closedir:
37 ?S:     This variable conditionally defines VOID_CLOSEDIR if closedir()
38 ?S:     does not return a value.
39 ?S:.
40 ?C:VOID_CLOSEDIR:
41 ?C:     This symbol, if defined, indicates that the closedir() routine
42 ?C:     does not return a value.
43 ?C:.
44 ?H:#$d_void_closedir VOID_CLOSEDIR              /**/
45 ?H:.
46 ?F:!try
47 ?LINT:set d_closedir d_void_closedir
48 : see if closedir exists
49 set closedir d_closedir
50 eval $inlibc
51
52 @if VOID_CLOSEDIR || d_void_closedir
53 ?X: The following contortions are designed so we can call closedir()
54 ?X: and check whether it returns a value.  The contortions are designed
55 ?X:     to portably pick up the correct directory header, for those
56 ?X:     systems that support various mutually incompatible directory functions.
57 ?X:     This is from perl5's perl.h
58 case "$d_closedir" in
59 "$define")
60         echo " "
61         echo "Checking whether closedir() returns a status..." >&4
62         cat > try.c <<EOM
63 #$i_dirent I_DIRENT             /**/
64 #$i_sysdir I_SYS_DIR            /**/
65 #$i_sysndir I_SYS_NDIR          /**/
66 #$i_systypes I_SYS_TYPES        /**/
67
68 #if defined(I_SYS_TYPES)
69 #include <sys/types.h>
70 #endif
71 #if defined(I_DIRENT)
72 #include <dirent.h>
73 #else
74 #ifdef I_SYS_NDIR
75 #include <sys/ndir.h>
76 #else
77 #ifdef I_SYS_DIR
78 #include <sys/dir.h>
79 #endif
80 #endif
81 #endif
82 int main() { return closedir(opendir(".")); }
83 EOM
84         set try
85         if eval $compile_ok; then
86                 if $run ./try > /dev/null 2>&1 ; then
87                         echo "Yes, it does."
88                         val="$undef"
89                 else
90                         echo "No, it doesn't."
91                         val="$define"
92                 fi
93         else
94                 echo "(I can't seem to compile the test program--assuming it doesn't)"
95                 val="$define"
96         fi
97         ;;
98 *)
99         val="$undef";
100         ;;
101 esac
102 set d_void_closedir
103 eval $setvar
104 $rm_try
105 @end
106