1 |
|
dnl Process this file with autoconf to produce a configure script. |
2 |
|
dnl Written in 2002 by Christian Bauer et al. |
3 |
|
|
4 |
< |
AC_INIT(main_unix.cpp) |
4 |
> |
AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII) |
5 |
> |
AC_CONFIG_SRCDIR(main_unix.cpp) |
6 |
|
AC_PREREQ(2.52) |
7 |
|
AC_CONFIG_HEADER(config.h) |
8 |
|
|
9 |
+ |
dnl Aliases for PACKAGE and VERSION macros. |
10 |
+ |
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.]) |
11 |
+ |
AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.]) |
12 |
+ |
|
13 |
+ |
dnl Some systems do not put corefiles in the currect directory, avoid saving |
14 |
+ |
dnl cores for the configure tests since some are intended to dump core. |
15 |
+ |
ulimit -c 0 |
16 |
+ |
|
17 |
|
dnl Video options. |
18 |
|
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
19 |
|
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) |
78 |
|
HAVE_M68K=no |
79 |
|
HAVE_SPARC=no |
80 |
|
HAVE_POWERPC=no |
81 |
+ |
HAVE_X86_64=no |
82 |
|
case "$target_cpu" in |
83 |
< |
i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;; |
84 |
< |
m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;; |
85 |
< |
sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;; |
86 |
< |
powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;; |
87 |
< |
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;; |
83 |
> |
i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;; |
84 |
> |
m68k* ) HAVE_M68K=yes;; |
85 |
> |
sparc* ) HAVE_SPARC=yes;; |
86 |
> |
powerpc* ) HAVE_POWERPC=yes;; |
87 |
> |
x86_64* ) HAVE_X86_64=yes;; |
88 |
|
esac |
79 |
– |
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
89 |
|
|
90 |
|
dnl Checks for programs. |
91 |
|
AC_PROG_CC |
112 |
|
AC_CHECK_LIB(Hcurses, tgetent, , |
113 |
|
AC_CHECK_LIB(curses, tgetent)))))) |
114 |
|
AC_CHECK_LIB(readline, readline) |
106 |
– |
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
115 |
|
else |
116 |
|
AC_MSG_RESULT(no) |
117 |
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
194 |
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
195 |
|
LIBS="$LIBS $GTK_LIBS" |
196 |
|
UISRCS=prefs_editor_gtk.cpp |
197 |
+ |
dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if |
198 |
+ |
dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which |
199 |
+ |
dnl includes <libintl.h> |
200 |
+ |
AM_GNU_GETTEXT |
201 |
|
B2_PATH_GNOMEUI([ |
202 |
|
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.]) |
203 |
|
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS" |
227 |
|
|
228 |
|
dnl Checks for header files. |
229 |
|
AC_HEADER_STDC |
230 |
< |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
230 |
> |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h mach/mach.h) |
231 |
> |
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
232 |
|
|
233 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
234 |
|
AC_C_BIGENDIAN |
373 |
|
LIBS="$LIBS -laudio" |
374 |
|
WANT_ESD=no |
375 |
|
|
376 |
< |
dnl Check if our compiler supports -Ofast (MIPSPro) |
377 |
< |
HAVE_OFAST=no |
376 |
> |
dnl Check if our compiler supports -IPA (MIPSPro) |
377 |
> |
HAVE_IPA=no |
378 |
|
ocflags="$CFLAGS" |
379 |
< |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'` |
380 |
< |
AC_MSG_CHECKING(if "-Ofast" works) |
379 |
> |
CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"` |
380 |
> |
AC_MSG_CHECKING(if "-IPA" works) |
381 |
|
dnl Do a test compile of an empty function |
382 |
< |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no)) |
382 |
> |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
383 |
|
CFLAGS="$ocflags" |
384 |
|
|
385 |
|
;; |
558 |
|
|
559 |
|
fi dnl HAVE_MMAP_VM |
560 |
|
|
561 |
+ |
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory |
562 |
+ |
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000], |
563 |
+ |
ac_cv_pagezero_hack, [ |
564 |
+ |
ac_cv_pagezero_hack=no |
565 |
+ |
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then |
566 |
+ |
ac_cv_pagezero_hack=yes |
567 |
+ |
dnl might as well skip the test for mmap-able low memory |
568 |
+ |
ac_cv_can_map_lm=no |
569 |
+ |
fi |
570 |
+ |
]) |
571 |
+ |
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack", |
572 |
+ |
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.]) |
573 |
+ |
|
574 |
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
575 |
|
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000], |
576 |
|
ac_cv_can_map_lm, [ |
579 |
|
AC_TRY_RUN([ |
580 |
|
#include "vm_alloc.cpp" |
581 |
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
582 |
< |
volatile char * lm; |
582 |
> |
volatile char * lm = 0; |
583 |
|
if (vm_init() < 0) exit(1); |
584 |
< |
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
584 |
> |
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
585 |
|
lm[0] = 'z'; |
586 |
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
587 |
|
vm_exit(); exit(0); |
655 |
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
656 |
|
[Define if your system requires sigactions to be reinstalled.]) |
657 |
|
|
658 |
< |
dnl Check if extended signals are supported. |
659 |
< |
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
660 |
< |
ac_cv_have_extended_signals, [ |
658 |
> |
dnl Check if Mach exceptions supported. |
659 |
> |
AC_CACHE_CHECK([whether your system supports Mach exceptions], |
660 |
> |
ac_cv_have_mach_exceptions, [ |
661 |
|
AC_LANG_SAVE |
662 |
|
AC_LANG_CPLUSPLUS |
663 |
|
AC_TRY_RUN([ |
664 |
< |
#define HAVE_SIGINFO_T 1 |
664 |
> |
#define HAVE_MACH_EXCEPTIONS 1 |
665 |
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
666 |
|
#include "vm_alloc.cpp" |
667 |
|
#include "sigsegv.cpp" |
668 |
< |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
668 |
> |
], [ |
669 |
> |
sigsegv_recovery=mach |
670 |
> |
ac_cv_have_mach_exceptions=yes |
671 |
> |
], |
672 |
> |
ac_cv_have_mach_exceptions=no, |
673 |
|
dnl When cross-compiling, do not assume anything. |
674 |
< |
ac_cv_have_extended_signals=no |
674 |
> |
ac_cv_have_mach_exceptions=no |
675 |
|
) |
676 |
|
AC_LANG_RESTORE |
677 |
|
] |
678 |
|
) |
679 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
680 |
< |
[Define if your system support extended signals.]) |
679 |
> |
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
680 |
> |
[Define if your system supports Mach exceptions.]) |
681 |
> |
|
682 |
> |
dnl Otherwise, check if extended signals are supported. |
683 |
> |
if [[ -z "$sigsegv_recovery" ]]; then |
684 |
> |
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
685 |
> |
ac_cv_have_extended_signals, [ |
686 |
> |
AC_LANG_SAVE |
687 |
> |
AC_LANG_CPLUSPLUS |
688 |
> |
AC_TRY_RUN([ |
689 |
> |
#define HAVE_SIGINFO_T 1 |
690 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
691 |
> |
#include "vm_alloc.cpp" |
692 |
> |
#include "sigsegv.cpp" |
693 |
> |
], [ |
694 |
> |
sigsegv_recovery=siginfo |
695 |
> |
ac_cv_have_extended_signals=yes |
696 |
> |
], |
697 |
> |
ac_cv_have_extended_signals=no, |
698 |
> |
dnl When cross-compiling, do not assume anything. |
699 |
> |
ac_cv_have_extended_signals=no |
700 |
> |
) |
701 |
> |
AC_LANG_RESTORE |
702 |
> |
] |
703 |
> |
) |
704 |
> |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
705 |
> |
[Define if your system support extended signals.]) |
706 |
> |
fi |
707 |
|
|
708 |
|
dnl Otherwise, check for subterfuges. |
709 |
< |
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
709 |
> |
if [[ -z "$sigsegv_recovery" ]]; then |
710 |
|
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
711 |
|
ac_cv_have_sigcontext_hack, [ |
712 |
|
AC_LANG_SAVE |
716 |
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
717 |
|
#include "vm_alloc.cpp" |
718 |
|
#include "sigsegv.cpp" |
719 |
< |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
719 |
> |
], [ |
720 |
> |
sigsegv_recovery=sigcontext |
721 |
> |
ac_cv_have_sigcontext_hack=yes |
722 |
> |
], |
723 |
> |
ac_cv_have_sigcontext_hack=no, |
724 |
|
dnl When cross-compiling, do not assume anything. |
725 |
|
ac_cv_have_sigcontext_hack=no |
726 |
|
) |
752 |
|
|
753 |
|
dnl Can we do Video on SEGV Signals ? |
754 |
|
CAN_VOSF=no |
755 |
< |
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
755 |
> |
if [[ -n "$sigsegv_recovery" ]]; then |
756 |
|
CAN_VOSF=yes |
757 |
|
fi |
758 |
|
|
759 |
+ |
dnl A dummy program that returns always true |
760 |
+ |
BLESS=/bin/true |
761 |
+ |
|
762 |
|
dnl Determine the addressing mode to use |
763 |
|
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
764 |
|
ADDRESSING_MODE="real" |
769 |
|
case $am in |
770 |
|
real) |
771 |
|
dnl Requires ability to mmap() Low Memory globals |
772 |
< |
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
772 |
> |
if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then |
773 |
|
continue |
774 |
|
fi |
775 |
< |
dnl Requires VOSF screen updates |
775 |
> |
dnl Requires VOSF screen updates |
776 |
|
if [[ "x$CAN_VOSF" = "xno" ]]; then |
777 |
|
continue |
778 |
|
fi |
780 |
|
ADDRESSING_MODE="real" |
781 |
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
782 |
|
DEFINES="$DEFINES -DREAL_ADDRESSING" |
783 |
+ |
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then |
784 |
+ |
BLESS=Darwin/lowmem |
785 |
+ |
LDFLAGS="$LDFLAGS -pagezero_size 0x2000" |
786 |
+ |
fi |
787 |
|
break |
788 |
|
;; |
789 |
|
direct) |
836 |
|
dnl Check for GCC 2.7 or higher. |
837 |
|
HAVE_GCC27=no |
838 |
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
839 |
< |
AC_EGREP_CPP(yes, |
839 |
> |
AC_EGREP_CPP(xyes, |
840 |
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
841 |
< |
yes |
841 |
> |
xyes |
842 |
|
#endif |
843 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
844 |
|
|
845 |
|
dnl Check for GCC 3.0 or higher. |
846 |
|
HAVE_GCC30=no |
847 |
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
848 |
< |
AC_EGREP_CPP(yes, |
848 |
> |
AC_EGREP_CPP(xyes, |
849 |
|
[#if __GNUC__ >= 3 |
850 |
< |
yes |
850 |
> |
xyes |
851 |
|
#endif |
852 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
853 |
|
|
887 |
|
CAN_JIT=no |
888 |
|
JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp" |
889 |
|
|
890 |
< |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
890 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
891 |
|
dnl i386 CPU |
892 |
< |
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
892 |
> |
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\"" |
893 |
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
894 |
|
ASM_OPTIMIZATIONS=i386 |
895 |
< |
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
896 |
< |
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
897 |
< |
JITSRCS="cpufast1_nf.s cpufast2_nf.s cpufast3_nf.s cpufast4_nf.s cpufast5_nf.s cpufast6_nf.s cpufast7_nf.s cpufast8_nf.s $JITSRCS" |
895 |
> |
DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE" |
896 |
> |
JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS" |
897 |
> |
CAN_JIT=yes |
898 |
> |
fi |
899 |
> |
elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then |
900 |
> |
dnl x86-64 CPU |
901 |
> |
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE" |
902 |
> |
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
903 |
> |
ASM_OPTIMIZATIONS="x86-64" |
904 |
> |
DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS" |
905 |
|
fi |
832 |
– |
CAN_JIT=yes |
906 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
907 |
|
dnl SPARC CPU |
908 |
|
case "$target_os" in |
945 |
|
WANT_JIT_DEBUG=no |
946 |
|
fi |
947 |
|
fi |
948 |
+ |
|
949 |
+ |
dnl IEEE core is the only FPU emulator to use with the JIT compiler |
950 |
+ |
case $FPE_CORE_TEST_ORDER in |
951 |
+ |
ieee*) ;; |
952 |
+ |
*) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;; |
953 |
+ |
esac |
954 |
+ |
FPE_CORE_TEST_ORDER="ieee" |
955 |
|
else |
956 |
|
WANT_JIT=no |
957 |
|
WANT_JIT_DEBUG=no |
1159 |
|
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
1160 |
|
fi |
1161 |
|
|
1162 |
< |
dnl Or if we have -Ofast |
1163 |
< |
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
1164 |
< |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
1165 |
< |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
1162 |
> |
dnl Or if we have -IPA (MIPSPro compilers) |
1163 |
> |
if [[ "x$HAVE_IPA" = "xyes" ]]; then |
1164 |
> |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1165 |
> |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1166 |
|
CXXFLAGS="-LANG:std $CXXFLAGS" |
1167 |
< |
LDFLAGS="$LDFLAGS -ipa" |
1167 |
> |
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" |
1168 |
|
fi |
1169 |
|
|
1170 |
|
dnl Generate Makefile. |
1172 |
|
AC_SUBST(SYSSRCS) |
1173 |
|
AC_SUBST(CPUINCLUDES) |
1174 |
|
AC_SUBST(CPUSRCS) |
1175 |
< |
AC_OUTPUT(Makefile) |
1175 |
> |
AC_SUBST(BLESS) |
1176 |
> |
AC_CONFIG_FILES([Makefile]) |
1177 |
> |
AC_OUTPUT |
1178 |
|
|
1179 |
|
dnl Print summary. |
1180 |
|
echo |
1193 |
|
echo Floating-Point emulation core .......... : $FPE_CORE |
1194 |
|
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS |
1195 |
|
echo Addressing mode ........................ : $ADDRESSING_MODE |
1196 |
+ |
echo Bad memory access recovery type ........ : $sigsegv_recovery |
1197 |
|
echo |
1198 |
|
echo "Configuration done. Now type \"make\" (or \"gmake\")." |