~ubuntu-branches/ubuntu/trusty/atlas/trusty

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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#!/bin/sh
#
# BFI configure-like script to bootstrap ATLAS's C-based config scripts
# dependencies: sed, pwd
# shell built-in deps: echo, test
#
cc=gcc
cflags="-g -w"
prefix=/usr/local/atlas
incinstdir=ATL_NoOverride
libinstdir=ATL_NoOverride
flapack=ATL_NoOverride
f77=1
#
# path is configure path without trailing configure :)
#
path=`echo $0 | sed -e "s/configure$//"`
#
# blddir is present directory
#
blddir=`pwd`
#
# If on cygwin, prefix blddir with /cygdrive/[c,d]/
#
if [ -d /cygdrive ]
then
   if [ -d /cygdrive/c/cygwin/$blddir ]
   then
        blddir=/cygdrive/c/cygwin/$blddir
   else
      if [ -d /cygdrive/d/cygwin/$blddir ]
      then
        blddir=/cygdrive/d/cygwin/$blddir
      fi
   fi
fi
#
# topdir is simply path if the line does not begin with "../" and is
#  blddir/path otherwise
chk=`echo "$path" | sed -e "s/^\.\.\///"`
if test "$chk" = "$path"
then
   topdir="$path"
else
   topdir="$blddir"/"$path"
fi
#
# Error out if topdir == blddir
#
touch $blddir/TstBld973.txt
if [ -f "$topdir/TstBld973.txt" ]
then
   echo "ATLAS can no longer be  configured in the exact source directory,"
   echo "create a subdir such as MyObj.  See ATLAS/INSTALL.txt for help."
   rm $blddir/TstBld973.txt
   exit 1
fi
rm $blddir/TstBld973.txt

#
# grab --cc=<c comp> and --cflags=<flags> to be used to build ATLAS's ANSI C
# config.c, and save the rest of the arguments to by passed to the 
# soon-to-be-built xconfig
#
#echo other args=$*
bitwidth=0
rdbitwidth=0
for arg in "$@"
do
   handled=0
   flag=`echo "$arg" | sed -e "s/--help//"`
   if test "$flag" != "$arg"
   then
      echo "ATLAS config includes this script, and probes written in C."
      echo "Therefore, configure flags are union of script and probe flags."
      echo "This configure script accepts the following flags:"
      echo "   --cc=<C compiler> : compiler to compile configure probes"
      echo "   --cflags='<flags>' : flags for above"
      echo "   --prefix=<dirname> : Toplevel installation directory."
      echo "                        Default: /usr/local/atlas"
      echo "   --incdir=<dirname> : Installation dir for include files"
      echo "                        Default: $prefix/include"
      echo "   --libdir=<dirname> : Installation dir for libraries"
      echo "                        Default: $prefix/lib"
      echo "   --nof77 : You have no Fortran compiler installed.  Note that"
      echo "             this will disallow building the F77 interface, and"
      echo "             some of the tests (eg, standard BLAS testers)"
      echo "  --with-netlib-lapack=<path to lapack.a>"
      echo "     Use this library to build a mixed netlib/ATLAS LAPACK."
      echo "     The two libs will be merged so they must be built wt compatible compilers."
      echo "Attempting to build xconfig to get probe flags:"
      rm -f Makefile > /dev/null 2>&1
      echo BLDdir="$blddir" > Makefile
      echo TOPdir="$topdir" >> Makefile
      echo CC="$cc" >> Makefile
      echo CFLAGS="$cflags" >> Makefile
      cat "$path"/CONFIG/src/Makefile >> Makefile
      make xconfig > /dev/null 2>&1
      ./xconfig --help
      rm -f Makefile xconfig atlconf_misc.o 2>&1
      exit 1
   fi
#
# Look for config flag -b <bidwidth>, if we find it set bitwidth to read next
# args val, but don't set handled, since flag must be passed to config as well
#
   if test $rdbitwidth -eq 1
   then
      rdbitwidth=0
      if test "$arg" -eq "64"
      then
         bitwidth=64
      fi
      if test "$arg" -eq "32"
      then
         bitwidth=32
      fi
   fi
   if test "$arg" = "-b"
   then
      rdbitwidth=1
   fi
#
   flag=`echo "$arg" | sed -e "s/--prefix=//"`
   if test "$flag" != "$arg"
   then
      prefix="$flag"
      handled=1
   fi
#
   flag=`echo "$arg" | sed -e "s/--libdir=//"`
   if test "$flag" != "$arg"
   then
      libinstdir="$flag"
      handled=1
   fi
#
   flag=`echo "$arg" | sed -e "s/--incdir=//"`
   if test "$flag" != "$arg"
   then
      incinstdir="$flag"
      handled=1
   fi
#
   flag=`echo "$arg" | sed -e "s/--with-netlib-lapack=//"`
   if test "$flag" != "$arg"
   then
      flapack="$flag"
      pass="$pass -Ss flapack $flapack"
      handled=1
   fi
#
   flag=`echo "$arg" | sed -e "s/--nof77//"`
   if test "$flag" != "$arg"
   then
      f77=0
      pass="$pass -Si nof77 1"
      handled=1
   fi
#
   flag=`echo "$arg" | sed -e "s/--cc=//"`
   if test "$flag" != "$arg"
   then
      cc="$flag"
       handled=1
   else
      flag=`echo "$arg" | sed -e "s/--cflags=//"`
      if test "$flag" != "$arg"
      then
         handled=1
         cflags="$flag"
      fi
   fi
   if test $handled -eq 0
   then
#
#     Get rid of leading and trailing spaces
#
      arg=`echo "$arg" | sed -e "s/^ +//"`
      arg=`echo "$arg" | sed -e "s/ +$//"`
# 
#     If flag have internal spaces, surround it with ''
#
      flag=`echo "$arg" | sed -e "s/ //"`
      if (test "$flag" != "$arg")
      then
         pass="$pass '`echo "$arg"`'"
      else
         pass="$pass $arg"
      fi
   fi
done
OSGUESS=`uname`
flag=`echo "$OSGUESS" | sed -e "s/AIX//"`
#
# Need to do some special crap for AIX installs
if test "$flag" != "$OSGUESS"
then
   if test $bitwidth -eq 64
   then
      export OBJECT_MODE=64
      if test $cc = "gcc"
      then
         flag=`echo "$cflags" | sed -e "s/-maix//"`
         if test "$flag" = "$cflags"
         then
             cflags="$cflags -maix64"
         fi
      fi
   else
      export OBJECT_MODE=32
   fi
fi
if test $incinstdir = "ATL_NoOverride"
then
   incinstdir='$(DESTDIR)/include'
fi
if test $libinstdir = "ATL_NoOverride"
then
   libinstdir='$(DESTDIR)/lib'
fi
#
# Create the Makefile and copy the compiler info file
#
echo BLDdir="$blddir" > Makefile
echo TOPdir="$topdir" >> Makefile
echo DESTDIR="$prefix" >> Makefile
echo INCINSTdir="$incinstdir" >> Makefile
echo LIBINSTdir="$libinstdir" >> Makefile
echo CC="$cc" >> Makefile
echo CFLAGS="$cflags" >> Makefile
if test $f77 -eq 0
then
   echo TESTS=C_test >> Makefile
   echo PTTESTS=C_pttest >> Makefile
else
   echo TESTS=test >> Makefile
   echo PTTESTS=pttest >> Makefile
fi
cat "$path"/CONFIG/src/Makefile >> Makefile
cp "$path"/CONFIG/src/atlcomp.txt .
#
# Build and run xconfig
#
make -f Makefile xconfig
echo ./xconfig -d s "$topdir" -d b "$blddir" "$pass"
#./xconfig -d s "$topdir" -d b "$blddir" `echo "$pass"`
echo ./xconfig -d s "$topdir" -d b "$blddir" "$pass" | /bin/sh
ierr=$?
if test $ierr -ne 0
then
   echo xconfig exited with $ierr
   exit $ierr
fi
#
# Build subdirectory structure and copy all makefiles
#
make -f Makefile make_subdirs
cp -f "$path"/Make.top .
cp -f "$path"/CONFIG/src/ATLrun.sh bin/.
make -f Makefile startup
if test $flapack != "ATL_NoOverride"
then
   cp -f $flapack lib/liblapack.a
   ar d lib/liblapack.a lsame.o xerbla.o csrot.o zdrot.o
fi
echo "DONE configure"
#