1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
#!/bin/sh
echo This script will ask you several questions related to the configuration
echo of your system. To choose the default answer \(the one printed between
echo the brackets\), simply press Enter.
echo
echo "Checking echo to see how to suppress newlines..."
if (echo "hi\c"; echo " ") | grep c >/dev/null 2>&1 ; then
echo "...using -n."; n=-n; c=
else
cat <<EOM
...using \c
EOM
n=; c='\c'
fi
echo $n ..."The star should be here-->$c"; echo '*'
if test -r config.in; then . config.in; fi
# TODO : gestion du echo -n...
# On determine OS et on met en place les flags bizarres.
syst=`uname -a | awk '{print $1$3}'`
case $syst in
SunOS5*)
ostype=solaris
defC=/usr/local/bin/gcc
machtype=sparc
make=/usr/ccs/bin/make
;;
Linux*)
fpucw=`grep __setfpucw /usr/include/fpu_control.h`
if test -z "$fpucw"; then special="$special -DLIBC211"; fi; # for __setfpucw
ostype=linux
defC=/usr/bin/gcc
make=/usr/bin/make
machtype=`uname -a | awk '{print $11}'`
;;
OSF*)
special="-D__STDC__ $special -mfp-rounding-mode=d -mieee-with-inexact";
ostype=alpha
defC=/usr/local/bin/gcc
make=/usr/local/gnu/bin/make # pour $LDLIBS des tests
machtype=dec
;;
SunOS4*)
ostype=sunos
machtype=sparc
defC=/usr/local/gnu/bin/gcc
make=/usr/local/gnu/bin/make
# Si on veut utiliser cc, faire gaffe aux prototypes a la K&R et pas ANSI.
;;
*)
ostype=unknown
make=/usr/local/gnu/bin/make
machtype=default;;
# we should try to look for gcc there
esac
echo You seem to be using a $machtype running $ostype.
echo
while :; do
echo $n "Which C compiler are you going to use [$defC] ? $c"
read ans
case "$ans" in
'')
ans="$defC"
break
;;
*)
if test -x "$ans"; then break; fi
echo $n "*** $ans: file does not exist or execution permission denied"
esac
done
defC=$ans
echo Using compiler $defC
echo
echo I now need to know where to find the GMP distribution. I do not actually
echo need the full distribution, but only the following include files :
echo gmp.h, gmp-impl.h, gmp-mparam.h, longlong.h, stack-alloc.h
while :; do
echo $n "Where should I look for these files [$inc] ? $c"
read ans
case "$ans" in
'')
ans=$inc
;;
*)
;;
esac
if test -r "$ans"/gmp.h -a -r "$ans"/gmp-impl.h -a -r "$ans"/gmp-mparam.h -a -r "$ans"/longlong.h -a -r "$ans"/stack-alloc.h;
then incflags="-I$ans"
break;
fi;
# ad hoc installation
if test -r "$ans"/gmp.h -a \
-r "$ans"/gmp-impl.h -a \
-r "$ans"/mpn/gmp-mparam.h -a \
-r "$ans"/longlong.h -a \
-r stack-alloc.h;
then
incflags="-I$ans -I$ans/mpn "
break;
fi; # gmp distrib
echo I could not find some of the files at that place, or could not read
echo some of them. Please try again.
echo
done
inc=$ans
echo
echo If you wish to compile a program with the mpfr library, you will need
echo the gmp library. In particular, in order to compile the tests, you will
echo need it. Could you tell me where to find it ?
echo $n "(You can lie, I won't check) path for the libgmp.a file [$lib] ? $c"
read ans
if test -z "$ans"; then ans=$lib; fi;
if test -d "$ans" -a -r "$ans/libgmp.a"; then lib="$ans/libgmp.a"; fi;
olib=$ans
echo
echo Unless you know what you are doing, you should not override the defaults
echo for the following.
echo $n "Flags for floating point rounding modes [$special] ? $c"
read ans
case "$ans" in
'')
ans="$special"
;;
*)
;;
esac
special=$ans
echo
echo $n "What supplementary (optimization/debugging) flags are you willing to use [$cflags] ? $c"
read ans
case "$ans" in
'')
ans="$cflags"
;;
*)
;;
esac
cflags=$ans
echo
echo Now dumping the Makefile.
cat > config.in<<EOF
special=$special
inc=$inc
lib=$olib
cflags="$cflags"
EOF
cat > Makefile <<EOF
#
# Makefile automatically generated by Configure. Do not edit !!
#
CC=$defC
CFLAGS=$special $incflags $cflags -D$ostype
OBJS=add.o div_2exp.o neg.o set_dfl_prec.o set_str_raw.o agm.o get_str.o print_raw.o set_dfl_rnd.o sqrt.o clear.o init.o rnd_mode.o set_f.o sub.o cmp.o mul.o round.o set_prec.o cmp_ui.o mul_2exp.o set.o set_si.o div.o mul_ui.o set_d.o set_str.o
dft: libmpfr.a
all: libmpfr.a tests
clean:
-rm libmpfr.a \$(OBJS)
libmpfr.a: \$(OBJS)
ar cr libmpfr.a \$(OBJS)
ranlib libmpfr.a
tests: mpfr.h libmpfr.a
-cd tests; $make all
add.o: mpfr.h
div_2exp.o: mpfr.h
neg.o: mpfr.h
set_dfl_prec.o: mpfr.h
set_str_raw.o: mpfr.h
agm.o: mpfr.h
get_str.o: mpfr.h
print_raw.o: mpfr.h
set_dfl_rnd.o: mpfr.h
sqrt.o: mpfr.h
clear.o: mpfr.h
init.o: mpfr.h
rnd_mode.o: mpfr.h
set_f.o: mpfr.h
sub.o: mpfr.h
cmp.o: mpfr.h
mul.o: mpfr.h
round.o: mpfr.h
set_prec.o: mpfr.h
cmp_ui.o: mpfr.h
mul_2exp.o: mpfr.h
set.o: mpfr.h
set_si.o: mpfr.h
div.o: mpfr.h
mul_ui.o: mpfr.h
set_d.o: mpfr.h
set_str.o: mpfr.h
EOF
cat > tests/Makefile <<EOF
CC=$defC
CFLAGS=$special $incflags -I.. $cflags -D$ostype
LDLIBS=../libmpfr.a $lib -lm
TESTS=tadd tcmp2 tget_str tmul_ui tset_f tsqrt tagm tcmp_ui tmul tround tset_si tcmp tdiv tmul_2exp tset_d tset_str
tests all: \$(TESTS)
for i in \$(TESTS); do \
echo Testing \$\$i; \
./\$\$i; \
done
clean:
-rm \$(TESTS)
EOF
|