comparison configure @ 29651:151a1c2a5658

Use a compilation check to distinguish between x86 and x86_64, uname and CFLAGS checks alone are not reliable.
author reimar
date Sat, 19 Sep 2009 13:36:58 +0000
parents df76c6b66c8e
children 224efd8fe6eb
comparison
equal deleted inserted replaced
29650:df76c6b66c8e 29651:151a1c2a5658
1390 # Maybe uname -m (machine hardware name) returns something we 1390 # Maybe uname -m (machine hardware name) returns something we
1391 # recognize. 1391 # recognize.
1392 1392
1393 # x86/x86pc is used by QNX 1393 # x86/x86pc is used by QNX
1394 case "$(uname -m 2>&1)" in 1394 case "$(uname -m 2>&1)" in
1395 i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;; 1395 x86_64|amd64|i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;;
1396 ia64) host_arch=ia64 ;; 1396 ia64) host_arch=ia64 ;;
1397 x86_64|amd64)
1398 if [ -n "$($_cc -dumpmachine | sed -n '/^x86_64-/p;/^amd64-/p')" -a \
1399 -z "$(echo $CFLAGS $_cc | grep -- -m32)" ]; then
1400 host_arch=x86_64
1401 else
1402 host_arch=i386
1403 fi
1404 ;;
1405 macppc|ppc) host_arch=ppc ;; 1397 macppc|ppc) host_arch=ppc ;;
1406 ppc64) host_arch=ppc64 ;; 1398 ppc64) host_arch=ppc64 ;;
1407 alpha) host_arch=alpha ;; 1399 alpha) host_arch=alpha ;;
1408 sparc) host_arch=sparc ;; 1400 sparc) host_arch=sparc ;;
1409 sparc64) host_arch=sparc64 ;; 1401 sparc64) host_arch=sparc64 ;;
1440 if test $(echo $host_arch) != "x86_64" ; then 1432 if test $(echo $host_arch) != "x86_64" ; then
1441 host_arch=$(echo $host_arch | tr '_' '-') 1433 host_arch=$(echo $host_arch | tr '_' '-')
1442 fi 1434 fi
1443 fi 1435 fi
1444 1436
1445 echo "Detected operating system: $system_name"
1446 echo "Detected host architecture: $host_arch"
1447
1448 if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then
1449 die "Runtime CPU detection only works for x86, x86-64 and PPC!"
1450 fi
1451
1452
1453 extra_cflags="-I. $extra_cflags" 1437 extra_cflags="-I. $extra_cflags"
1454 _timer=timer-linux.c 1438 _timer=timer-linux.c
1455 _getch=getch2.c 1439 _getch=getch2.c
1456 if freebsd ; then 1440 if freebsd ; then
1457 extra_ldflags="$extra_ldflags -L/usr/local/lib" 1441 extra_ldflags="$extra_ldflags -L/usr/local/lib"
1528 TMPS="$I/mplayer-conf-$RANDOM-$$.S" 1512 TMPS="$I/mplayer-conf-$RANDOM-$$.S"
1529 1513
1530 rm -f "$TMPLOG" 1514 rm -f "$TMPLOG"
1531 echo configuration: $_configuration > "$TMPLOG" 1515 echo configuration: $_configuration > "$TMPLOG"
1532 echo >> "$TMPLOG" 1516 echo >> "$TMPLOG"
1517
1518
1519 if x86 ; then
1520 cat > $TMPC << EOF
1521 int main(void) {
1522 int test[sizeof(char *)-7];
1523 return 0;
1524 }
1525 EOF
1526 cc_check && host_arch=x86_64 || host_arch=i386
1527 fi
1528
1529 echo "Detected operating system: $system_name"
1530 echo "Detected host architecture: $host_arch"
1531
1532 if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then
1533 die "Runtime CPU detection only works for x86, x86-64 and PPC!"
1534 fi
1533 1535
1534 1536
1535 # Checking CC version... 1537 # Checking CC version...
1536 # Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure) 1538 # Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure)
1537 if test "$(basename $_cc)" = "icc" || test "$(basename $_cc)" = "ecc"; then 1539 if test "$(basename $_cc)" = "icc" || test "$(basename $_cc)" = "ecc"; then