This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Metaconfig unit changes for #11000.
[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 run \
14         use64bitint use64bitall
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 ?F:!uselargefiles.cbu
45 ?INIT:ccflags_uselargefiles=''
46 ?INIT:ldflags_uselargefiles=''
47 ?INIT:libswanted_uselargefiles=''
48 ?T:yyy zzz
49 ?LINT:set uselargefiles
50 ?LINT:change lseeksize
51 ?LINT:change fpossize
52 ?LINT:extern uselfs
53 ?LINT:use uselfs
54 ?LINT:use use64bitint
55 ?LINT:use use64bitall
56
57 # Backward compatibility (uselfs is deprecated).
58 case "$uselfs" in
59 "$define"|true|[yY]*)
60         cat <<EOM >&4
61
62 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
63 EOM
64         uselargefiles="$define"
65         ;;
66 esac                          
67
68 case "$lseeksize:$fpossize" in
69 8:8) cat <<EOM
70
71 You can have files larger than 2 gigabytes.
72 EOM
73    val="$define" ;;
74 *)    case "$uselargefiles" in
75    "$undef"|false|[nN]*) dflt='n' ;;
76    *)   dflt='y' ;;
77    esac
78    cat <<EOM
79
80 Perl can be built to understand large files (files larger than 2 gigabytes)
81 on some systems.  To do so, Configure can be run with -Duselargefiles.
82
83 If this doesn't make any sense to you, just accept the default '$dflt'.
84 EOM
85    rp='Try to understand large files, if available?'
86    . ./myread
87    case "$ans" in
88    y|Y)         val="$define" ;;
89    *)           val="$undef"  ;;
90    esac
91    ;;
92 esac
93 set uselargefiles
94 eval $setvar
95 case "$uselargefiles" in
96 "$define")
97 : Look for a hint-file generated 'call-back-unit'.  If the
98 : user has specified that a large files perl is to be built,
99 : we may need to set or change some other defaults.
100         if $test -f uselargefiles.cbu; then
101                 echo "Your platform has some specific hints for large file builds, using them..."
102                 . ./uselargefiles.cbu
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 int main() {
135     printf("%d\n", (int)sizeof($fpostype));
136     exit(0);
137 }
138 EOCP
139                 set try
140                 if eval $compile_ok; then
141                         yyy=`$run ./try`
142                         dflt="$lseeksize"
143                         case "$yyy" in
144                         '')     echo " "
145                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
146                                 ;;
147                         *)      fpossize=$yyy
148                                 echo " $fpossize bytes." >&4
149                                 ;;
150                         esac
151                 else
152                         dflt="$fpossize"
153                         echo " "
154                         echo "(I can't compile the test program.  Guessing...)" >&4
155                         rp="What is the size of your file positions (in bytes)?"
156                         . ./myread
157                         fpossize="$ans"
158                 fi
159                 $rm -f try.c try
160         fi
161         ;;
162 esac
163