This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
metaconfig unit change for #16099.
[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 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: 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 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 ?LINT:set d_closedir d_void_closedir
47 : see if closedir exists
48 set closedir d_closedir
49 eval $inlibc
50
51 @if VOID_CLOSEDIR || d_void_closedir
52 ?X: The following contortions are designed so we can call closedir()
53 ?X: and check whether it returns a value.  The contortions are designed
54 ?X:     to portably pick up the correct directory header, for those
55 ?X:     systems that support various mutually incompatible directory functions.
56 ?X:     This is from perl5's perl.h
57 case "$d_closedir" in
58 "$define")
59         echo " "
60         echo "Checking whether closedir() returns a status..." >&4
61         cat > try.c <<EOM
62 #$i_dirent I_DIRENT             /**/
63 #$i_sysdir I_SYS_DIR            /**/
64 #$i_sysndir I_SYS_NDIR          /**/
65 #$i_systypes I_SYS_TYPES        /**/
66
67 #if defined(I_SYS_TYPES)
68 #include <sys/types.h>
69 #endif
70 #if defined(I_DIRENT)
71 #include <dirent.h>
72 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
73 #include <sys/dir.h>
74 #endif
75 #else
76 #ifdef I_SYS_NDIR
77 #include <sys/ndir.h>
78 #else
79 #ifdef I_SYS_DIR
80 #ifdef hp9000s500
81 #include <ndir.h>       /* may be wrong in the future */
82 #else
83 #include <sys/dir.h>
84 #endif
85 #endif
86 #endif
87 #endif 
88 int main() { return closedir(opendir(".")); }
89 EOM
90         set try
91         if eval $compile_ok; then
92                 if $run ./try > /dev/null 2>&1 ; then
93                         echo "Yes, it does."
94                         val="$undef"
95                 else
96                         echo "No, it doesn't."
97                         val="$define"
98                 fi
99         else
100                 echo "(I can't seem to compile the test program--assuming it doesn't)"
101                 val="$define"
102         fi
103         ;;
104 *)
105         val="$undef";
106         ;;
107 esac
108 set d_void_closedir
109 eval $setvar
110 $rm -f try try.*
111 @end