This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove trailing whitespace on meta-lines in unit files
[metaconfig.git] / dist / U / d_closedir.U
1 ?RCS: $Id$
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, 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 4.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         cc ccflags ldflags libs Setvar rm
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:!closedir
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 > closedir.c <<EOM
63 #$i_dirent I_DIRENT             /**/
64 #$i_sysdir I_SYS_DIR            /**/
65 #$i_sysndir I_SYS_NDIR          /**/
66
67 #if defined(I_DIRENT)
68 #include <dirent.h>
69 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
70 #include <sys/dir.h>
71 #endif
72 #else
73 #ifdef I_SYS_NDIR
74 #include <sys/ndir.h>
75 #else
76 #ifdef I_SYS_DIR
77 #ifdef hp9000s500
78 #include <ndir.h>       /* may be wrong in the future */
79 #else
80 #include <sys/dir.h>
81 #endif
82 #endif
83 #endif
84 #endif 
85 int main() { return closedir(opendir(".")); }
86 EOM
87         if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then
88                 if ./closedir > /dev/null 2>&1 ; then
89                         echo "Yes, it does."
90                         val="$undef"
91                 else
92                         echo "No, it doesn't."
93                         val="$define"
94                 fi
95         else
96                 echo "(I can't seem to compile the test program--assuming it doesn't)"
97                 val="$define"
98         fi
99         ;;
100 *)
101         val="$undef";
102         ;;
103 esac
104 set d_void_closedir
105 eval $setvar
106 $rm -f closedir*
107 @end