This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix .gitignore: only ignore 'perl' in root of repo, not U/perl subdir
[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 \
9         ccflags_uselargefiles \
10         ldflags_uselargefiles \
11         libswanted_uselargefiles: \
12         Myread Oldconfig Setvar test lseeksize fpossize \
13         fpostype Compile echo n c cat lseektype rm_try run \
14         use64bitint use64bitall i_stdlib
15 ?MAKE:  -pick add $@ %<
16 ?Y:TOP
17 ?S:uselargefiles:
18 ?S:     This variable conditionally defines the USE_LARGE_FILES symbol,
19 ?S:     and indicates that large file interfaces should be used when
20 ?S:     available.
21 ?S:.
22 ?S:ccflags_uselargefiles:
23 ?S:     This variable contains the compiler flags needed by large file builds
24 ?S:     and added to ccflags by hints files.
25 ?S:.
26 ?S:ldflags_uselargefiles:
27 ?S:     This variable contains the loader flags needed by large file builds
28 ?S:     and added to ldflags by hints files.
29 ?S:.
30 ?S:libswanted_uselargefiles:
31 ?S:     This variable contains the libraries needed by large file builds
32 ?S:     and added to ldflags by hints files.  It is a space separated list
33 ?S:     of the library names without the "lib" prefix or any suffix, just
34 ?S:     like libswanted..
35 ?S:.
36 ?C:USE_LARGE_FILES:
37 ?C:     This symbol, if defined, indicates that large file support
38 ?C:     should be used when available.
39 ?C:.
40 ?H:?%<:#ifndef USE_LARGE_FILES
41 ?H:?%<:#$uselargefiles  USE_LARGE_FILES         /**/
42 ?H:?%<:#endif
43 ?H:.
44 ?INIT:ccflags_uselargefiles=''
45 ?INIT:ldflags_uselargefiles=''
46 ?INIT:libswanted_uselargefiles=''
47 ?T:yyy zzz
48 ?F:!uselargefiles.cbu !try
49 ?LINT:change lseeksize
50 ?LINT:change fpossize
51 ?LINT:extern uselfs
52 ?LINT:use use64bitint
53 ?LINT:use use64bitall
54 : Check for large file support
55 # Backward compatibility (uselfs is deprecated).
56 case "$uselfs" in
57 "$define"|true|[yY]*)
58         cat <<EOM >&4
59
60 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
61 EOM
62         uselargefiles="$define"
63         ;;
64 esac
65
66 case "$lseeksize:$fpossize" in
67 8:8) cat <<EOM
68
69 You can have files larger than 2 gigabytes.
70 EOM
71    val="$define" ;;
72 *)    case "$uselargefiles" in
73    "$undef"|false|[nN]*) dflt='n' ;;
74    *)   dflt='y' ;;
75    esac
76    cat <<EOM
77
78 Perl can be built to understand large files (files larger than 2 gigabytes)
79 on some systems.  To do so, Configure can be run with -Duselargefiles.
80
81 If this doesn't make any sense to you, just accept the default '$dflt'.
82 EOM
83    rp='Try to understand large files, if available?'
84    . ./myread
85    case "$ans" in
86    y|Y)         val="$define" ;;
87    *)           val="$undef"  ;;
88    esac
89    ;;
90 esac
91 set uselargefiles
92 eval $setvar
93 : Look for a hint-file generated 'call-back-unit'.  If the
94 : user has specified that a large files perl is to be built,
95 : we may need to set or change some other defaults.
96 if $test -f uselargefiles.cbu; then
97         echo "Your platform has some specific hints regarding large file builds, using them..."
98         . ./uselargefiles.cbu
99 fi
100 case "$uselargefiles" in
101 "$define")
102         if $test -f uselargefiles.cbu; then
103                 echo " "
104                 echo "Rechecking to see how big your file offsets are..." >&4
105                 $cat >try.c <<EOCP
106 #include <sys/types.h>
107 #include <stdio.h>
108 int main()
109 {
110     printf("%d\n", (int)sizeof($lseektype));
111     return(0);
112 }
113 EOCP
114                 set try
115                 if eval $compile_ok; then
116                         lseeksize=`$run ./try`
117                         $echo "Your file offsets are now $lseeksize bytes long."
118                 else
119                         dflt="$lseeksize"
120                         echo " "
121                         echo "(I can't seem to compile the test program.  Guessing...)"
122                         rp="What is the size of your file offsets (in bytes)?"
123                         . ./myread
124                         lseeksize="$ans"
125                 fi
126                 case "$fpostype" in
127                 *_t) zzz="$fpostype"    ;;
128                 *)   zzz="fpos_t"       ;;
129                 esac
130                 $echo $n "Rechecking the size of $zzz...$c" >&4
131                 $cat > try.c <<EOCP
132 #include <sys/types.h>
133 #include <stdio.h>
134 #$i_stdlib I_STDLIB
135 #ifdef I_STDLIB
136 #include <stdlib.h>
137 #endif
138 int main() {
139     printf("%d\n", (int)sizeof($fpostype));
140     return(0);
141 }
142 EOCP
143                 set try
144                 if eval $compile_ok; then
145                         yyy=`$run ./try`
146                         dflt="$lseeksize"
147                         case "$yyy" in
148                         '')     echo " "
149                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
150                                 ;;
151                         *)      fpossize=$yyy
152                                 echo " $fpossize bytes." >&4
153                                 ;;
154                         esac
155                 else
156                         dflt="$fpossize"
157                         echo " "
158                         echo "(I can't compile the test program.  Guessing...)" >&4
159                         rp="What is the size of your file positions (in bytes)?"
160                         . ./myread
161                         fpossize="$ans"
162                 fi
163                 $rm_try
164         fi
165         ;;
166 esac
167