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(PACKAGE, PACKAGE_NAME, [Alias to PACKAGE for i18n.]) |
11 |
+ |
AC_DEFINE(VERSION, PACKAGE_VERSION, [Alias to VERSION for i18n.]) |
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 |
|
;; |
566 |
|
AC_TRY_RUN([ |
567 |
|
#include "vm_alloc.cpp" |
568 |
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
569 |
< |
volatile char * lm; |
569 |
> |
volatile char * lm = 0; |
570 |
|
if (vm_init() < 0) exit(1); |
571 |
< |
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
571 |
> |
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
572 |
|
lm[0] = 'z'; |
573 |
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
574 |
|
vm_exit(); exit(0); |
642 |
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
643 |
|
[Define if your system requires sigactions to be reinstalled.]) |
644 |
|
|
645 |
< |
dnl Check if extended signals are supported. |
646 |
< |
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
647 |
< |
ac_cv_have_extended_signals, [ |
645 |
> |
dnl Check if Mach exceptions supported. |
646 |
> |
AC_CACHE_CHECK([whether your system supports Mach exceptions], |
647 |
> |
ac_cv_have_mach_exceptions, [ |
648 |
|
AC_LANG_SAVE |
649 |
|
AC_LANG_CPLUSPLUS |
650 |
|
AC_TRY_RUN([ |
651 |
< |
#define HAVE_SIGINFO_T 1 |
651 |
> |
#define HAVE_MACH_EXCEPTIONS 1 |
652 |
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
653 |
|
#include "vm_alloc.cpp" |
654 |
|
#include "sigsegv.cpp" |
655 |
< |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
655 |
> |
], [ |
656 |
> |
sigsegv_recovery=mach |
657 |
> |
ac_cv_have_mach_exceptions=yes |
658 |
> |
], |
659 |
> |
ac_cv_have_mach_exceptions=no, |
660 |
|
dnl When cross-compiling, do not assume anything. |
661 |
< |
ac_cv_have_extended_signals=no |
661 |
> |
ac_cv_have_mach_exceptions=no |
662 |
|
) |
663 |
|
AC_LANG_RESTORE |
664 |
|
] |
665 |
|
) |
666 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
667 |
< |
[Define if your system support extended signals.]) |
666 |
> |
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
667 |
> |
[Define if your system supports Mach exceptions.]) |
668 |
> |
|
669 |
> |
dnl Otherwise, check if extended signals are supported. |
670 |
> |
if [[ -z "$sigsegv_recovery" ]]; then |
671 |
> |
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
672 |
> |
ac_cv_have_extended_signals, [ |
673 |
> |
AC_LANG_SAVE |
674 |
> |
AC_LANG_CPLUSPLUS |
675 |
> |
AC_TRY_RUN([ |
676 |
> |
#define HAVE_SIGINFO_T 1 |
677 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
678 |
> |
#include "vm_alloc.cpp" |
679 |
> |
#include "sigsegv.cpp" |
680 |
> |
], [ |
681 |
> |
sigsegv_recovery=siginfo |
682 |
> |
ac_cv_have_extended_signals=yes |
683 |
> |
], |
684 |
> |
ac_cv_have_extended_signals=no, |
685 |
> |
dnl When cross-compiling, do not assume anything. |
686 |
> |
ac_cv_have_extended_signals=no |
687 |
> |
) |
688 |
> |
AC_LANG_RESTORE |
689 |
> |
] |
690 |
> |
) |
691 |
> |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
692 |
> |
[Define if your system support extended signals.]) |
693 |
> |
fi |
694 |
|
|
695 |
|
dnl Otherwise, check for subterfuges. |
696 |
< |
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
696 |
> |
if [[ -z "$sigsegv_recovery" ]]; then |
697 |
|
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
698 |
|
ac_cv_have_sigcontext_hack, [ |
699 |
|
AC_LANG_SAVE |
703 |
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
704 |
|
#include "vm_alloc.cpp" |
705 |
|
#include "sigsegv.cpp" |
706 |
< |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
706 |
> |
], [ |
707 |
> |
sigsegv_recovery=sigcontext |
708 |
> |
ac_cv_have_sigcontext_hack=yes |
709 |
> |
], |
710 |
> |
ac_cv_have_sigcontext_hack=no, |
711 |
|
dnl When cross-compiling, do not assume anything. |
712 |
|
ac_cv_have_sigcontext_hack=no |
713 |
|
) |
739 |
|
|
740 |
|
dnl Can we do Video on SEGV Signals ? |
741 |
|
CAN_VOSF=no |
742 |
< |
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
742 |
> |
if [[ -n "$sigsegv_recovery" ]]; then |
743 |
|
CAN_VOSF=yes |
744 |
|
fi |
745 |
|
|
816 |
|
dnl Check for GCC 2.7 or higher. |
817 |
|
HAVE_GCC27=no |
818 |
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
819 |
< |
AC_EGREP_CPP(yes, |
819 |
> |
AC_EGREP_CPP(xyes, |
820 |
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
821 |
< |
yes |
821 |
> |
xyes |
822 |
|
#endif |
823 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
824 |
|
|
825 |
|
dnl Check for GCC 3.0 or higher. |
826 |
|
HAVE_GCC30=no |
827 |
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
828 |
< |
AC_EGREP_CPP(yes, |
828 |
> |
AC_EGREP_CPP(xyes, |
829 |
|
[#if __GNUC__ >= 3 |
830 |
< |
yes |
830 |
> |
xyes |
831 |
|
#endif |
832 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
833 |
|
|
867 |
|
CAN_JIT=no |
868 |
|
JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp" |
869 |
|
|
870 |
< |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
870 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
871 |
|
dnl i386 CPU |
872 |
|
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\"" |
873 |
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
874 |
|
ASM_OPTIMIZATIONS=i386 |
875 |
|
DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE" |
876 |
< |
JITSRCS="cpuemu1_nf.s cpuemu2_nf.s cpuemu3_nf.s cpuemu4_nf.s cpuemu5_nf.s cpuemu6_nf.s cpuemu7_nf.s cpuemu8_nf.s $JITSRCS" |
876 |
> |
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" |
877 |
> |
CAN_JIT=yes |
878 |
> |
fi |
879 |
> |
elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then |
880 |
> |
dnl x86-64 CPU |
881 |
> |
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE" |
882 |
> |
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
883 |
> |
ASM_OPTIMIZATIONS="x86-64" |
884 |
> |
DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS" |
885 |
|
fi |
831 |
– |
CAN_JIT=yes |
886 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
887 |
|
dnl SPARC CPU |
888 |
|
case "$target_os" in |
1139 |
|
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
1140 |
|
fi |
1141 |
|
|
1142 |
< |
dnl Or if we have -Ofast |
1143 |
< |
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
1144 |
< |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
1145 |
< |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
1142 |
> |
dnl Or if we have -IPA (MIPSPro compilers) |
1143 |
> |
if [[ "x$HAVE_IPA" = "xyes" ]]; then |
1144 |
> |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1145 |
> |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1146 |
|
CXXFLAGS="-LANG:std $CXXFLAGS" |
1147 |
< |
LDFLAGS="$LDFLAGS -ipa" |
1147 |
> |
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" |
1148 |
|
fi |
1149 |
|
|
1150 |
|
dnl Generate Makefile. |
1152 |
|
AC_SUBST(SYSSRCS) |
1153 |
|
AC_SUBST(CPUINCLUDES) |
1154 |
|
AC_SUBST(CPUSRCS) |
1155 |
< |
AC_OUTPUT(Makefile) |
1155 |
> |
AC_CONFIG_FILES([Makefile]) |
1156 |
> |
AC_OUTPUT |
1157 |
|
|
1158 |
|
dnl Print summary. |
1159 |
|
echo |
1172 |
|
echo Floating-Point emulation core .......... : $FPE_CORE |
1173 |
|
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS |
1174 |
|
echo Addressing mode ........................ : $ADDRESSING_MODE |
1175 |
+ |
echo Bad memory access recovery type ........ : $sigsegv_recovery |
1176 |
|
echo |
1177 |
|
echo "Configuration done. Now type \"make\" (or \"gmake\")." |