Revision ac0df51d configure

b/configure
33 33
make="make"
34 34
install="install"
35 35
strip="strip"
36
cpu=`test $(uname -s) = AIX && uname -p || uname -m`
36

  
37
# parse CC options first
38
for opt do
39
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
40
  case "$opt" in
41
  --cross-prefix=*) cross_prefix="$optarg"
42
  ;;
43
  --cc=*) cc="$optarg"
44
  ;;
45
  esac
46
done
47

  
48
# OS specific
49
# Using uname is really, really broken.  Once we have the right set of checks
50
# we can eliminate it's usage altogether
51

  
52
cc="${cross_prefix}${cc}"
53
ar="${cross_prefix}${ar}"
54
strip="${cross_prefix}${strip}"
55

  
56
# check that the C compiler works.
57
cat > $TMPC <<EOF
58
int main(void) {}
59
EOF
60

  
61
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
62
  : C compiler works ok
63
else
64
    echo "ERROR: \"$cc\" either does not exist or does not work"
65
    exit 1
66
fi
67

  
68
check_define() {
69
cat > $TMPC <<EOF
70
#if !defined($1)
71
#error Not defined
72
#endif
73
int main(void) { return 0; }
74
EOF
75
  $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
76
}
77

  
78
if check_define __i386__ ; then
79
  cpu="i386"
80
elif check_define __x86_64__ ; then
81
  cpu="x86_64"
82
else
83
  cpu=`test $(uname -s) = AIX && uname -p || uname -m`
84
fi
85

  
37 86
target_list=""
38 87
case "$cpu" in
39 88
  i386|i486|i586|i686|i86pc|BePC)
......
122 171
fdt="yes"
123 172

  
124 173
# OS specific
125
targetos=`uname -s`
174
if check_define __linux__ ; then
175
  targetos="Linux"
176
elif check_define _WIN32 ; then
177
  targetos='MINGW32'
178
else
179
  targetos=`uname -s`
180
fi
126 181
case $targetos in
127 182
CYGWIN*)
128 183
mingw32="yes"
......
264 319
  --source-path=*) source_path="$optarg"
265 320
  source_path_used="yes"
266 321
  ;;
267
  --cross-prefix=*) cross_prefix="$optarg"
322
  --cross-prefix=*)
268 323
  ;;
269
  --cc=*) cc="$optarg"
324
  --cc=*)
270 325
  ;;
271 326
  --host-cc=*) host_cc="$optarg"
272 327
  ;;
......
487 542
exit 1
488 543
fi
489 544

  
490
cc="${cross_prefix}${cc}"
491
ar="${cross_prefix}${ar}"
492
strip="${cross_prefix}${strip}"
493

  
494
# check that the C compiler works.
495
cat > $TMPC <<EOF
496
int main(void) {}
497
EOF
498

  
499
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
500
  : C compiler works ok
501
else
502
    echo "ERROR: \"$cc\" either does not exist or does not work"
503
    exit 1
504
fi
505

  
506
# check compiler to see if we're on mingw32
507
cat > $TMPC <<EOF
508
#include <windows.h>
509
#ifndef _WIN32
510
#error not windows
511
#endif
512
int main(void) {}
513
EOF
514

  
515
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
516
    mingw32="yes"
517
fi
518

  
519 545
if test "$mingw32" = "yes" ; then
520 546
    linux="no"
521 547
    EXESUF=".exe"

Also available in: Unified diff