This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The separation of 64-bitness and largefileness continues
[metaconfig.git] / U / perl / uselfs.U
1 ?RCS: $Id$
2 ?RCS:
3 ?RCS: Copyright (c) 1999 Jarkko Hietaniemi
4 ?RCS:
5 ?RCS: You may distribute under the terms of either the GNU General Public
6 ?RCS: License or the Artistic License, as specified in the README file.
7 ?RCS:
8 ?MAKE:uselargefiles: Myread Oldconfig Setvar test lseeksize fpossize \
9         fpostype Compile echo n c cat lseektype rm
10 ?MAKE:  -pick add $@ %<
11 ?Y:TOP
12 ?S:uselargefiles:
13 ?S:     This variable conditionally defines the USE_LARGE_FILES symbol,
14 ?S:     and indicates that large file interfaces should be used when
15 ?S:     available.  The use64bits symbol will also be turned on if necessary.
16 ?S:.
17 ?C:USE_LARGE_FILES:
18 ?C:     This symbol, if defined, indicates that large file support
19 ?C:     should be used when available.  The USE_64_BITS symbol will
20 ?C:     also be turned on if necessary.
21 ?C:.
22 ?H:?%<:#ifndef USE_LARGE_FILES
23 ?H:?%<:#$uselargefiles  USE_LARGE_FILES         /**/
24 ?H:?%<:#endif
25 ?H:.
26 ?F:!uselfs.cbu !try
27 ?T:yyy zzz
28 ?LINT:set uselargefiles
29 ?LINT:extern use64bits
30 ?LINT:change use64bits
31 ?LINT:change lseeksize
32 ?LINT:change fpossize
33
34 case "$lseeksize:$fpossize" in
35 8:8) cat <<EOM
36
37 You can have files larger than 2 gigabytes.
38 EOM
39    val="$define" ;;
40 *) cat <<EOM
41
42 Perl can be built to understand large files (files larger than 2 gigabytes)
43 on some systems.  To do so, Configure must be run with -Duselargefiles.
44
45 If this doesn't make any sense to you, just accept the default 'y'.
46 EOM
47    case "$uselargefiles" in
48    "$undef"|false|[nN]*) dflt='n' ;;
49    *)   dflt='y' ;;
50    esac
51    rp='Try to understand large files, if available?'
52    . ./myread
53    case "$ans" in
54    y|Y)         val="$define" ;;
55    *)           val="$undef"  ;;
56    esac
57    ;;
58 esac
59 set uselargefiles
60 eval $setvar
61 case "$uselargefiles" in
62 "$define")
63 : Look for a hint-file generated 'call-back-unit'.  If the
64 : user has specified that a large files perl is to be built,
65 : we may need to set or change some other defaults.
66         if $test -f uselfs.cbu; then
67                 echo "Your platform has some specific hints for large file builds, using them..."
68                 . ./uselfs.cbu
69                 echo " "
70                 $echo $n "Rechecking to see how big your file offsets are...$c" >&4
71                 $cat >try.c <<EOCP
72 #include <sys/types.h>
73 #include <stdio.h>
74 int main()
75 {
76     printf("%d\n", (int)sizeof($lseektype));
77     return(0); 
78 }
79 EOCP
80                 set try
81                 if eval $compile_ok; then
82                         lseeksize=`./try`
83                         $echo " $lseeksize bytes." >&4
84                 else
85                         dflt="$lseeksize"
86                         echo " "
87                         echo "(I can't seem to compile the test program.  Guessing...)"
88                         rp="What is the size of your file offsets (in bytes)?"
89                         . ./myread
90                         lseeksize="$ans"
91                 fi
92                 case "$fpostype" in
93                 *_t) zzz="$fpostype"    ;;
94                 *)   zzz="fpos_t"       ;;
95                 esac
96                 $echo $n "Rechecking the size of $zzz...$c" >&4 
97                 $cat > try.c <<EOCP
98 #include <sys/types.h>
99 #include <stdio.h>
100 int main() {
101     printf("%d\n", (int)sizeof($fpostype));
102     exit(0);
103 }
104 EOCP
105                 set try
106                 if eval $compile_ok; then
107                         yyy=`./try`
108                         dflt="$lseeksize"
109                         case "$yyy" in
110                         '')     echo " "
111                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
112                                 ;;
113                         *)      fpossize=$yyy
114                                 echo " $fpossize bytes."
115                                 ;;
116                         esac
117                 else
118                         dflt="$fpossize"
119                         echo " "
120                         echo "(I can't compile the test program.  Guessing...)" >&4
121                         rp="What is the size of your file positions (in bytes)?"
122                         . ./myread
123                         fpossize="$ans"
124                 fi
125                 $rm -f try.c try
126         fi
127         ;;
128 esac
129