13 |
|
|
14 |
|
dnl FPU emulation core. |
15 |
|
AC_ARG_ENABLE(fpe, |
16 |
< |
[ --enable-fpe=which specify which fpu emulator to use [default=opt]], |
16 |
> |
[ --enable-fpe=FPE specify which fpu emulator to use [default=auto]], |
17 |
|
[ case "$enableval" in |
18 |
< |
dnl default is fpu_x86.cpp if i386 architecture, fpu_uae.cpp otherwise |
19 |
< |
default) FPE_CORE="default";; |
20 |
< |
ieee) FPE_CORE="ieee";; |
21 |
< |
uae) FPE_CORE="uae";; |
22 |
< |
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: default, uae, ieee]);; |
18 |
> |
dnl default is always ieee, if architecture has this fp format |
19 |
> |
auto) FPE_CORE_TEST_ORDER="ieee uae";; |
20 |
> |
ieee) FPE_CORE_TEST_ORDER="ieee";; |
21 |
> |
uae) FPE_CORE_TEST_ORDER="uae";; |
22 |
> |
x86) FPE_CORE_TEST_ORDER="x86";; |
23 |
> |
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);; |
24 |
|
esac |
25 |
|
], |
26 |
< |
[ FPE_CORE="default" |
26 |
> |
[ FPE_CORE_TEST_ORDER="ieee uae" |
27 |
|
]) |
28 |
|
|
29 |
|
dnl Addressing modes. |
796 |
|
dnl Select appropriate CPU source and REGPARAM define. |
797 |
|
ASM_OPTIMIZATIONS=none |
798 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
798 |
– |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
799 |
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
800 |
|
dnl i386 CPU |
801 |
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
803 |
|
ASM_OPTIMIZATIONS=i386 |
804 |
|
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
805 |
|
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
806 |
– |
FPUSRCS="../uae_cpu/fpu_x86.cpp" |
806 |
|
fi |
807 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
808 |
|
dnl SPARC CPU |
833 |
|
CPUSRCS="asm_support.s" |
834 |
|
fi |
835 |
|
|
836 |
< |
dnl Select appropriate FPU source. |
837 |
< |
dnl 1. Optimized X86 assembly core if target is i386 architecture. |
838 |
< |
SAVED_DEFINES=$DEFINES |
839 |
< |
if [[ "x$FPE_CORE" = "xdefault" ]]; then |
840 |
< |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
841 |
< |
DEFINES="$DEFINES -DFPU_X86" |
842 |
< |
FPE_CORE_STR="i386 optimized core" |
843 |
< |
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
844 |
< |
FPE_CORE="i386" |
836 |
> |
dnl Utility macro used by next two tests. |
837 |
> |
dnl AC_EXAMINE_OBJECT(C source code, |
838 |
> |
dnl commands examining object file, |
839 |
> |
dnl [commands to run if compile failed]): |
840 |
> |
dnl |
841 |
> |
dnl Compile the source code to an object file; then convert it into a |
842 |
> |
dnl printable representation. All unprintable characters and |
843 |
> |
dnl asterisks (*) are replaced by dots (.). All white space is |
844 |
> |
dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the |
845 |
> |
dnl output, but runs of newlines are compressed to a single newline. |
846 |
> |
dnl Finally, line breaks are forcibly inserted so that no line is |
847 |
> |
dnl longer than 80 columns and the file ends with a newline. The |
848 |
> |
dnl result of all this processing is in the file conftest.dmp, which |
849 |
> |
dnl may be examined by the commands in the second argument. |
850 |
> |
dnl |
851 |
> |
AC_DEFUN([gcc_AC_EXAMINE_OBJECT], |
852 |
> |
[AC_LANG_SAVE |
853 |
> |
AC_LANG_C |
854 |
> |
dnl Next bit cribbed from AC_TRY_COMPILE. |
855 |
> |
cat > conftest.$ac_ext <<EOF |
856 |
> |
[#line __oline__ "configure" |
857 |
> |
#include "confdefs.h" |
858 |
> |
$1 |
859 |
> |
]EOF |
860 |
> |
if AC_TRY_EVAL(ac_compile); then |
861 |
> |
od -c conftest.o | |
862 |
> |
sed ['s/^[0-7]*[ ]*/ / |
863 |
> |
s/\*/./g |
864 |
> |
s/ \\n/*/g |
865 |
> |
s/ [0-9][0-9][0-9]/./g |
866 |
> |
s/ \\[^ ]/./g'] | |
867 |
> |
tr -d ' |
868 |
> |
' | tr -s '*' ' |
869 |
> |
' | fold | sed '$a\ |
870 |
> |
' > conftest.dmp |
871 |
> |
$2 |
872 |
> |
ifelse($3, , , else |
873 |
> |
$3 |
874 |
> |
)dnl |
875 |
> |
fi |
876 |
> |
rm -rf conftest* |
877 |
> |
AC_LANG_RESTORE]) |
878 |
> |
|
879 |
> |
dnl Floating point format probe. |
880 |
> |
dnl The basic concept is the same as the above: grep the object |
881 |
> |
dnl file for an interesting string. We have to watch out for |
882 |
> |
dnl rounding changing the values in the object, however; this is |
883 |
> |
dnl handled by ignoring the least significant byte of the float. |
884 |
> |
dnl |
885 |
> |
dnl Does not know about VAX G-float or C4x idiosyncratic format. |
886 |
> |
dnl It does know about PDP-10 idiosyncratic format, but this is |
887 |
> |
dnl not presently supported by GCC. S/390 "binary floating point" |
888 |
> |
dnl is in fact IEEE (but maybe we should have that in EBCDIC as well |
889 |
> |
dnl as ASCII?) |
890 |
> |
dnl |
891 |
> |
AC_DEFUN([gcc_AC_C_FLOAT_FORMAT], |
892 |
> |
[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format, |
893 |
> |
[gcc_AC_EXAMINE_OBJECT( |
894 |
> |
[/* This will not work unless sizeof(double) == 8. */ |
895 |
> |
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1]; |
896 |
> |
|
897 |
> |
/* This structure must have no internal padding. */ |
898 |
> |
struct possibility { |
899 |
> |
char prefix[8]; |
900 |
> |
double candidate; |
901 |
> |
char postfix[8]; |
902 |
> |
}; |
903 |
> |
|
904 |
> |
#define C(cand) { "\nformat:", cand, ":tamrof\n" } |
905 |
> |
struct possibility table [] = |
906 |
> |
{ |
907 |
> |
C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */ |
908 |
> |
C( 3.53802595280598432000e+18), /* D__float - VAX */ |
909 |
> |
C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */ |
910 |
> |
C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */ |
911 |
> |
C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */ |
912 |
> |
};], |
913 |
> |
[if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
914 |
> |
ac_cv_c_float_format='IEEE (big-endian)' |
915 |
> |
elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then |
916 |
> |
ac_cv_c_float_format='IEEE (big-endian)' |
917 |
> |
elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then |
918 |
> |
ac_cv_c_float_format='IEEE (little-endian)' |
919 |
> |
elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then |
920 |
> |
ac_cv_c_float_format='IEEE (little-endian)' |
921 |
> |
elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then |
922 |
> |
ac_cv_c_float_format='VAX D-float' |
923 |
> |
elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then |
924 |
> |
ac_cv_c_float_format='PDP-10' |
925 |
> |
elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
926 |
> |
ac_cv_c_float_format='IBM 370 hex' |
927 |
|
else |
928 |
< |
FPE_CORE="uae" |
929 |
< |
fi |
928 |
> |
AC_MSG_ERROR(Unknown floating point format) |
929 |
> |
fi], |
930 |
> |
[AC_MSG_ERROR(compile failed)]) |
931 |
> |
]) |
932 |
> |
# IEEE is the default format. If the float endianness isn't the same |
933 |
> |
# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN |
934 |
> |
# (which is a tristate: yes, no, default). This is only an issue with |
935 |
> |
# IEEE; the other formats are only supported by a few machines each, |
936 |
> |
# all with the same endianness. |
937 |
> |
format=IEEE_FLOAT_FORMAT |
938 |
> |
fbigend= |
939 |
> |
case $ac_cv_c_float_format in |
940 |
> |
'IEEE (big-endian)' ) |
941 |
> |
if test $ac_cv_c_bigendian = no; then |
942 |
> |
fbigend=1 |
943 |
> |
fi |
944 |
> |
;; |
945 |
> |
'IEEE (little-endian)' ) |
946 |
> |
if test $ac_cv_c_bigendian = yes; then |
947 |
> |
fbigend=0 |
948 |
> |
fi |
949 |
> |
;; |
950 |
> |
'VAX D-float' ) |
951 |
> |
format=VAX_FLOAT_FORMAT |
952 |
> |
;; |
953 |
> |
'PDP-10' ) |
954 |
> |
format=PDP10_FLOAT_FORMAT |
955 |
> |
;; |
956 |
> |
'IBM 370 hex' ) |
957 |
> |
format=IBM_FLOAT_FORMAT |
958 |
> |
;; |
959 |
> |
esac |
960 |
> |
AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format, |
961 |
> |
[Define to the floating point format of the host machine.]) |
962 |
> |
if test -n "$fbigend"; then |
963 |
> |
AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend, |
964 |
> |
[Define to 1 if the host machine stores floating point numbers in |
965 |
> |
memory with the word containing the sign bit at the lowest address, |
966 |
> |
or to 0 if it does it the other way around. |
967 |
> |
|
968 |
> |
This macro should not be defined if the ordering is the same as for |
969 |
> |
multi-word integers.]) |
970 |
|
fi |
971 |
+ |
]) |
972 |
+ |
|
973 |
+ |
dnl Select appropriate FPU source. |
974 |
+ |
gcc_AC_C_FLOAT_FORMAT |
975 |
+ |
AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h) |
976 |
|
|
977 |
< |
dnl 2. JIT-FPU only supports IEEE-based implementation. |
978 |
< |
if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then |
979 |
< |
AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation]) |
980 |
< |
FPE_CORE="ieee" |
981 |
< |
dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten |
982 |
< |
DEFINES=$SAVED_DEFINES |
983 |
< |
fi |
984 |
< |
|
985 |
< |
dnl 3. Choose either IEEE-based implementation or the old UAE core. |
986 |
< |
if [[ "x$FPE_CORE" = "xieee" ]]; then |
987 |
< |
AC_CHECK_HEADERS(fenv.h) |
988 |
< |
AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept) |
989 |
< |
AC_CHECK_FUNCS(fegetround fesetround) |
990 |
< |
DEFINES="$DEFINES -DFPU_IEEE" |
991 |
< |
FPE_CORE_STR="ieee-based fpu core" |
992 |
< |
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
993 |
< |
elif [[ "x$FPE_CORE" = "xuae" ]]; then |
994 |
< |
DEFINES="$DEFINES -DFPU_UAE" |
995 |
< |
FPE_CORE_STR="original uae core" |
996 |
< |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
977 |
> |
for fpe in $FPE_CORE_TEST_ORDER; do |
978 |
> |
case $fpe in |
979 |
> |
ieee) |
980 |
> |
if echo "$ac_cv_c_float_format" | grep -q IEEE; then |
981 |
> |
FPE_CORE="IEEE fpu core" |
982 |
> |
DEFINES="$DEFINES -DFPU_IEEE" |
983 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
984 |
> |
break |
985 |
> |
fi |
986 |
> |
;; |
987 |
> |
x86) |
988 |
> |
if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then |
989 |
> |
FPE_CORE="i387 fpu core" |
990 |
> |
DEFINES="$DEFINES -DFPU_X86" |
991 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
992 |
> |
break |
993 |
> |
fi |
994 |
> |
;; |
995 |
> |
uae) |
996 |
> |
FPE_CORE="uae fpu core" |
997 |
> |
DEFINES="$DEFINES -DFPU_UAE" |
998 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
999 |
> |
break |
1000 |
> |
;; |
1001 |
> |
*) |
1002 |
> |
AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core]) |
1003 |
> |
;; |
1004 |
> |
esac |
1005 |
> |
done |
1006 |
> |
if [[ "x$FPE_CORE" = "x" ]]; then |
1007 |
> |
AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER]) |
1008 |
|
fi |
1009 |
|
|
1010 |
|
dnl Check for certain math functions |
1051 |
|
echo GTK user interface ..................... : $WANT_GTK |
1052 |
|
echo mon debugger support ................... : $WANT_MON |
1053 |
|
echo Running m68k code natively ............. : $WANT_NATIVE_M68K |
1054 |
< |
echo Floating-Point emulation core .......... : $FPE_CORE_STR |
1054 |
> |
echo Floating-Point emulation core .......... : $FPE_CORE |
1055 |
|
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS |
1056 |
|
echo Addressing mode ........................ : $ADDRESSING_MODE |
1057 |
|
echo |