File: configure

package info (click to toggle)
libc-sparc 5.3.12-3
  • links: PTS
  • area: main
  • in suites: potato, slink
  • size: 17,608 kB
  • ctags: 44,718
  • sloc: ansic: 163,548; asm: 5,080; makefile: 3,340; lex: 521; sh: 439; yacc: 401; awk: 28
file content (455 lines) | stat: -rwxr-xr-x 9,737 bytes parent folder | download | duplicates (2)
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
#! /bin/sh
#
# Changes by H.J.Lu
# Original version Mitchum Dsouza <m.dsouza@mrc-apu.cam.ac.uk>
#
# Simple libc configuration script tested with `bash' and `ksh' and
# Sun `sh'

# The following two are the ANSI sequences for start and end embolden
case $TERM in
vt*|ansi*|con*|xterm*|linux*)
  S=
  E=
  ;;
*)
  S=
  E=
  ;;
esac

# Define some defaults
TARGET_OS=linux
HOST_ROOTDIR=/usr
HOST_BINDIR=${HOST_ROOTDIR}/bin
TARGET_ROOTDIR=/
STATIC_SHARED=
SPEED=fast
BAD_GCCVERSION="Invalid gcc version"
LIBGCC=`gcc --print-libgcc-file-name`
MALLOC=malloc-930716
OLD_GCC=true

# We have to do that to make sure we have the right configuration.
(cd gcc; rm -f config.h  hconfig.h tconfig.h tm.h)

# Get the latest nys directory
NYSDIR="`echo nys* | awk '{print $NF}'`"

if [ -f ./config.in ]; then 
#	 grep = ./config.in | .
	eval `grep = ./config.in`
fi

response() {
	echo -n "$1 [$2] ? " 1> /dev/tty
	read answer
	if [ x${answer} = x ]; then
		echo $2
	else
		echo ${answer}
	fi
}

getresponse ()
{
  OLD_TARGET_MACHINE=${TARGET_MACHINE}

  case ${TARGET_ARCH} in
  i*86|pentium)
    TMP=4 
    ;;
  *)
    TMP=m;
    ;;
  esac
  TARGET_ARCH=`response "Build 386, 486, 586, SPARC or m68k library code 3/4/5/s/m" "${TMP}"`

  case i${TARGET_ARCH} in
  i5)
    TARGET_MACHINE=i586-linux
    TARGET_ARCH_x86=5;
    TARGET_ARCH=i386;
    ;;
  i4)
    TARGET_MACHINE=i486-linux
    TARGET_ARCH_x86=4;
    TARGET_ARCH=i386;
    ;;
  i3)
    TARGET_MACHINE=i386-linux
    TARGET_ARCH_x86=3;
    TARGET_ARCH=i386;
    ;;
  im)
    TARGET_MACHINE=m68k-linux
    TARGET_ARCH_x86=;
    TARGET_ARCH=m68k;
    ;;
  is)
    TARGET_MACHINE=sparc-linux
    TARGET_ARCH_x86=;
    TARGET_ARCH=sparc;
    ;;
  *)
    echo Unknown arch: \"${TARGET_ARCH}\".
    exit 1
    ;;
  esac

  TARGET_MACHINE=`response "The target platform" "${TARGET_MACHINE}"`
  TARGET_OS=`response "The target OS" "${TARGET_OS}"`

  TMP=a
  STATIC_SHARED=`response "Build targets (static,shared/all) s/a" "${TMP}"`
  case i${STATIC_SHARED} in
  is)
    STATIC_SHARED=true
    ;;
  *)
    STATIC_SHARED=
    ;;
  esac
  
  get_host_rootdir $TARGET_MACHINE
  HOST_ROOTDIR=`response "Root path to $TARGET_MACHINE related files" "${HOST_ROOTDIR}"`
  HOST_BINDIR=`response "Bin path to gcc" "${HOST_BINDIR}"`
  GCCVERSION=`response "The gcc version" "${GCCVERSION}"`

  TMP=f
  SPEED=`response "Fast build/save space (fast default) f/s" "${TMP}"`
  case i${SPEED}x in
  ifx)
    SPEED=fast
    ;;
  *)
    SPEED=
    ;;
  esac

  MAKE=`response "GNU \\\`make' executable" "${MAKE}"`
  TARGET_ROOTDIR=`response "Root path to installation dirs" "${TARGET_ROOTDIR}"`

  if [ x${NYSDIR} != x ]; then
  TMP=n
  NYS=`response "Build a NYS libc from ${NYSDIR} (n default)  y/n" "${TMP}"`
  case i${NYS}x in
  iyx)
    NYS=true
    ;;
  *)
    NYS=
    ;;
  esac
  fi

  TMP=g
  MALLOC=`response "GNU malloc-93076/dl-malloc (GNU default) g/d" "${TMP}"`
  case i${MALLOC}x in
  igx)
    MALLOC=malloc-930716
    ;;
  *)
    MALLOC=dl-malloc
    ;;
  esac

  TMP=o
  OLD_GCC=`response "Old/new gcc (old default) o/n" "${TMP}"`

  case i${OLD_GCC}x in
  iox)
    OLD_GCC=true
    ;;
  *)
    OLD_GCC=false
    ;;
  esac

}

showdefaults ()
{
  echo 
  echo *******Current defaults********
  echo
  if [ -n "${TARGET_ARCH_x86}" ]; then
    echo "Build ${S}${TARGET_MACHINE}${E} library for ${S}i${TARGET_ARCH_x86}86${E} running ${S}${TARGET_OS}${E}"
  else
    echo "Build ${S}${TARGET_MACHINE}${E} library for ${S}${TARGET_ARCH}${E} running ${S}${TARGET_OS}${E}"
  fi
  if [ x${STATIC_SHARED} = x"true" ]; then
    echo "Build targets are ${S}static and shared libraries only${E}."
  else
    echo "Build targets are ${S}static, shared, debug and profile libraries${E}."
  fi
  echo "Root path to ${S}${TARGET_MACHINE}${E} related files is ${S}${HOST_ROOTDIR}${E}"
  echo "Bin path to gcc is ${S}${HOST_BINDIR}${E}"
  echo "The version of gcc to be used is ${S}${GCCVERSION}${E}"
  if [ x${SPEED} = x"fast" ]; then
    echo "Build option is ${S}fast build${E}."
  else
    echo "Build option is ${S}save space${E}."
  fi
  echo "GNU \`make' executable is ${S}${MAKE}${E}"
  echo "Use ${S}${MALLOC}${E}"
  if [ x${OLD_GCC} = x"true" ]; then
    echo "Use ${S}old gcc${E}."
  else
    echo "Use ${S}new gcc with the crtbegin[S]/crtend[S].o patch${E}."
  fi
  echo "Root path to installation dirs is ${S}${TARGET_ROOTDIR}${E}"
  if [ x${NYS} != x -a x${NYSDIR} != x ]; then
    echo "Build a NYS libc from ${S}${NYSDIR}${E}."
  fi

  echo
}

get_gnu_make ()
{
  make_list="make gmake gnumake"
  gf=0
  v=

  for m in $make_list
  do
    $m -v 2> /dev/null | grep GNU > /dev/null 2>&1
    if [ $? = 0 ]; then
      gf=1
      TMP=`$m -v 2> /dev/null | head -1 | grep GNU | cut -f4 -d' '`
      v="$TMP $v"
      case $TMP in
      3.7*|3.8*|3.9*|4*|5*|6*|7*|8*|9*)
        MAKE=$m
        return
       ;;
      esac
    fi
  done

  if [ $gf = 1 ]; then
    echo GNU make version, $v are found. Need GNU make 3.70 or above.
  else
    echo No GNU make is found. Need GNU make 3.70 or above.
  fi
  exit 1
}

get_target_rootdir ()
{
  if [ -d /home/linux ]; then
    TARGET_ROOTDIR=/home/linux
  fi
}

get_host_rootdir ()
{
  target=$1
#  LIBGCC=`gcc --print-libgcc-file-name`

  if [ ${LIBGCC} != libgcc.a ]; then
    position=2
    TMP=`echo $LIBGCC | cut -f$position -d'/'`
    HOST_ROOTDIR=
    HOST_ROOTDIR=$HOST_ROOTDIR/$TMP
    until [ $TMP = "lib" ]
    do
      position=`expr $position + 1`
      TMP=`echo $LIBGCC | cut -f$position -d'/'`
      HOST_ROOTDIR=$HOST_ROOTDIR/$TMP
    done
    HOST_ROOTDIR=`(cd $HOST_ROOTDIR/..; pwd)`
    HOST_BINDIR=${HOST_ROOTDIR}/bin
  fi
}

get_default_gcc_version ()
{
#  LIBGCC=`gcc -b $1 --print-libgcc-file-name`

  if [ ${LIBGCC} != libgcc.a ]; then
    position=2
    TMP=`echo $LIBGCC | cut -f$position -d'/'`
    until [ $TMP = "gcc-lib" ]
    do
      position=`expr $position + 1`
      TMP=`echo $LIBGCC | cut -f$position -d'/'`
    done
    position=`expr $position + 2`
    GCCVERSION=`echo $LIBGCC | cut -f$position -d'/'`
  else
    GCCVERSION="${BAD_GCCVERSION}"
  fi
}

get_default_gcc_target ()
{
#  LIBGCC=`gcc --print-libgcc-file-name`

  if [ ${LIBGCC} != libgcc.a ]; then
    position=2
    TMP=`echo $LIBGCC | cut -f$position -d'/'`
    until [ $TMP = "gcc-lib" ]
    do
      position=`expr $position + 1`
      TMP=`echo $LIBGCC | cut -f$position -d'/'`
    done
    position=`expr $position + 1`
    DEFAULT_GCC_TARGET=`echo $LIBGCC | cut -f$position -d'/'`
  fi
}

get_target_info ()
{
#  LIBGCC=`gcc --print-libgcc-file-name`

  if [ ${LIBGCC} != libgcc.a ]; then
    position=2
    TMP=`echo $LIBGCC | cut -f$position -d'/'`
    GCC_LIB_DIR=
    GCC_LIB_DIR=$GCC_LIB_DIR/$TMP
    until [ $TMP = "gcc-lib" ]
    do
      position=`expr $position + 1`
      TMP=`echo $LIBGCC | cut -f$position -d'/'`
      GCC_LIB_DIR=$GCC_LIB_DIR/$TMP
    done
    TARGET_MACHINE=`(cd $GCC_LIB_DIR; echo *linux*)`
    if [ xx"${TARGET_MACHINE}"xx != xxxx ]; then
      if [ `echo $TARGET_MACHINE | wc -w` != 1 ]; then
	echo More than one Linux targets found:
	echo "	$TARGET_MACHINE"
	echo $TARGET_MACHINE | grep $DEFAULT_GCC_TARGET > /dev/null
	if [ $? = 0 ]; then
	  TARGET_MACHINE=$DEFAULT_GCC_TARGET
	else
	  TARGET_MACHINE=`echo $TARGET_MACHINE | cut -f1 -d ' '`
	fi
	echo \"$TARGET_MACHINE\" is chosen.
      fi
      TARGET_OS=linux
      case $TARGET_MACHINE in
      *586*)
	TARGET_ARCH_x86=5
	TARGET_ARCH=i386
	;;
      *486*)
	TARGET_ARCH_x86=4
	TARGET_ARCH=i386
	;;
      *386*)
	TARGET_ARCH_x86=3
	TARGET_ARCH=i386
	;;
      *68*)
	TARGET_ARCH_x86=
	TARGET_ARCH=m68k
	;;
      *sparc*)
	TARGET_ARCH_x86=
	TARGET_ARCH=sparc
	;;
      *)
	echo Oops: Unknown target machine "$TARGET_MACHINE".
	;;
      esac
    fi
  fi
}

get_host_info ()
{
  # First check out who you are.
  HOST_OS=`uname -s`

  case $HOST_OS in
  [Ll][Ii][Nn][Uu][Xx])
    HOST_OS=linux
    HOST_ROOTDIR=/usr
    HOST_BINDIR=${HOST_ROOTDIR}/bin
    TARGET_ROOTDIR=/
    get_default_gcc_target
    TARGET_ARCH=`uname -m`
    case $TARGET_ARCH in
    *386*)
     TARGET_ARCH_x86=3
     TARGET_ARCH=i386
     ;;
    *486*)
     TARGET_ARCH_x86=4
     TARGET_ARCH=i386
     ;;
    *586*)
     TARGET_ARCH_x86=5
     TARGET_ARCH=i386
     ;;
    *68*)
     TARGET_ARCH_x86=
     TARGET_ARCH=m68k
     ;;
    esac
    ;;
  *)
    get_host_rootdir $TARGET_MACHINE
    get_target_rootdir
    ;;
  esac
}

get_default_gcc_target
get_target_info
get_host_info
get_gnu_make
get_default_gcc_version $TARGET_MACHINE
#GCCVERSION=`gcc --version`
get_host_rootdir $TARGET_MACHINE

showdefaults
if [ "${GCCVERSION}" = "${BAD_GCCVERSION}" ]; then
  echo Please provide a valid gcc version: ${S}${BAD_GCCVERSION}${E}!
  echo
  ans=n
else
  ans=`response "Values correct (y/n)" "y"`
fi

while [ x${ans} != x -a x${ans} != xy ]
do
  getresponse
  showdefaults
  if [ "${GCCVERSION}" = "${BAD_GCCVERSION}" ]; then
    echo Please provide a valid gcc version: ${S}${BAD_GCCVERSION}${E}!
    echo
    ans=n
  else
    ans=`response "Values correct (y/n)" "y"`
  fi
done

rm -f config.in

{
  echo STATIC_SHARED="${STATIC_SHARED}"
  echo MAKE="${MAKE}"
  echo SPEED="${SPEED}"
  echo HOST_ROOTDIR="${HOST_ROOTDIR}"
  echo HOST_BINDIR="${HOST_BINDIR}"
  echo TARGET_ROOTDIR="${TARGET_ROOTDIR}"
  echo ifeq \(\$\(ELF\), true\)
  echo TARGET_MACHINE="${TARGET_MACHINE}"
  echo else
  echo TARGET_MACHINE="${TARGET_MACHINE}aout"
  echo endif
  echo TARGET_OS="${TARGET_OS}"
  echo TARGET_ARCH="${TARGET_ARCH}"
  echo TARGET_ARCH_x86="${TARGET_ARCH_x86}"
  echo MALLOC="${MALLOC}"
  echo OLD_GCC="${OLD_GCC}"
  echo GCCVERSION="${GCCVERSION}"
  if [ x${NYS} != x -a x${NYSDIR} != x ]; then
	echo NYS="${NYS}"
	echo NYSDIR="${NYSDIR}"
	echo MAKE="${MAKE} NYS=${NYS}" 
  fi
} > config.in