1 |
|
dnl Process this file with autoconf to produce a configure script. |
2 |
|
dnl Written in 2002 by Christian Bauer |
3 |
|
|
4 |
< |
AC_INIT([SheepShaver], 2.2, [Christian.Bauer@uni-mainz.de], SheepShaver) |
4 |
> |
AC_INIT([SheepShaver], 2.3, [Christian.Bauer@uni-mainz.de], SheepShaver) |
5 |
|
AC_CONFIG_SRCDIR(main_unix.cpp) |
6 |
|
AC_PREREQ(2.52) |
7 |
|
AC_CONFIG_HEADER(config.h) |
14 |
|
dnl cores for the configure tests since some are intended to dump core. |
15 |
|
ulimit -c 0 |
16 |
|
|
17 |
+ |
dnl Invite Cygwin users to build within the Windows/ directory |
18 |
+ |
case $target_os in |
19 |
+ |
*cygwin* | *mingw32*) |
20 |
+ |
AC_MSG_ERROR([You can only build the Windows version from its directory, Cygwin/X11 is not supported.]) |
21 |
+ |
;; |
22 |
+ |
esac |
23 |
+ |
|
24 |
|
dnl Options. |
25 |
|
AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes]) |
26 |
|
AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto]) |
125 |
|
|
126 |
|
dnl Checks for libraries. |
127 |
|
AC_CHECK_LIB(posix4, sem_init) |
128 |
+ |
AC_CHECK_LIB(m, cos) |
129 |
|
|
130 |
|
dnl Do we need SDL? |
131 |
|
WANT_SDL=no |
143 |
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
144 |
|
AC_PATH_PROG(sdl_config, "sdl-config") |
145 |
|
if [[ -n "$sdl_config" ]]; then |
146 |
< |
case $target_os in |
147 |
< |
# Special treatment for Cygwin so that we can still use the POSIX layer |
148 |
< |
*cygwin*) |
149 |
< |
sdl_cflags="-I`$sdl_config --prefix`/include/SDL" |
150 |
< |
sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL" |
151 |
< |
;; |
144 |
< |
*) |
145 |
< |
sdl_cflags=`$sdl_config --cflags` |
146 |
< |
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
147 |
< |
sdl_libs=`$sdl_config --static-libs` |
148 |
< |
else |
149 |
< |
sdl_libs=`$sdl_config --libs` |
150 |
< |
fi |
151 |
< |
;; |
152 |
< |
esac |
146 |
> |
sdl_cflags=`$sdl_config --cflags` |
147 |
> |
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
148 |
> |
sdl_libs=`$sdl_config --static-libs` |
149 |
> |
else |
150 |
> |
sdl_libs=`$sdl_config --libs` |
151 |
> |
fi |
152 |
|
CFLAGS="$CFLAGS $sdl_cflags" |
153 |
|
CXXFLAGS="$CXXFLAGS $sdl_cflags" |
154 |
|
LIBS="$LIBS $sdl_libs" |
191 |
|
]) |
192 |
|
]) |
193 |
|
AC_CHECK_FUNCS(pthread_cancel) |
194 |
< |
AC_CHECK_FUNCS(pthread_cond_init) |
194 |
> |
AC_CHECK_FUNCS(pthread_cond_init pthread_testcancel) |
195 |
|
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
196 |
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
197 |
|
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
332 |
|
AC_HEADER_TIME |
333 |
|
AC_STRUCT_TM |
334 |
|
|
335 |
+ |
dnl Check whether sys/socket.h defines type socklen_t. |
336 |
+ |
dnl (extracted from ac-archive/Miscellaneous) |
337 |
+ |
AC_CACHE_CHECK([for socklen_t], |
338 |
+ |
ac_cv_type_socklen_t, [ |
339 |
+ |
AC_TRY_COMPILE([ |
340 |
+ |
#include <sys/types.h> |
341 |
+ |
#include <sys/socket.h> |
342 |
+ |
], [socklen_t len = 42; return 0;], |
343 |
+ |
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
344 |
+ |
dnl When cross-compiling, do not assume anything. |
345 |
+ |
ac_cv_type_socklen_t="guessing no" |
346 |
+ |
) |
347 |
+ |
]) |
348 |
+ |
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
349 |
+ |
AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.]) |
350 |
+ |
fi |
351 |
+ |
|
352 |
|
dnl Check whether struct sigaction has sa_restorer member. |
353 |
|
AC_CACHE_CHECK([whether struct sigaction has sa_restorer], |
354 |
|
ac_cv_signal_sa_restorer, [ |
440 |
|
saved_LIBS="$LIBS" |
441 |
|
LIBS="$LIBS -framework $1" |
442 |
|
AC_TRY_LINK( |
443 |
< |
[$2], [int main(void) { return 0; }], |
443 |
> |
[$2], [], |
444 |
|
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] |
445 |
|
) |
446 |
|
]) |
453 |
|
dnl Check for some MacOS X frameworks |
454 |
|
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
455 |
|
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
456 |
+ |
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>]) |
457 |
|
|
458 |
|
dnl Select system-dependant sources. |
459 |
|
SERIALSRC=serial_unix.cpp |
468 |
|
AUDIOSRC=audio_oss_esd.cpp |
469 |
|
SCSISRC=Linux/scsi_linux.cpp |
470 |
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
471 |
< |
EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c ppc_asm.S" |
471 |
> |
EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S" |
472 |
|
fi |
473 |
|
;; |
474 |
|
freebsd*) |
477 |
|
netbsd*) |
478 |
|
ETHERSRC=ether_unix.cpp |
479 |
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
480 |
< |
EXTRASYSSRCS="NetBSD/paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S" |
480 |
> |
EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S" |
481 |
|
fi |
482 |
|
;; |
483 |
|
darwin*) |
484 |
|
ETHERSRC=ether_unix.cpp |
485 |
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
486 |
< |
EXTRASYSSRCS="Darwin/paranoia.cpp ppc_asm.S" |
486 |
> |
EXTRASYSSRCS="paranoia.cpp ppc_asm.S" |
487 |
|
fi |
488 |
< |
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
488 |
> |
if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then |
489 |
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp" |
490 |
|
fi |
491 |
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
492 |
|
EXTFSSRC=../MacOSX/extfs_macosx.mm |
493 |
|
fi |
494 |
|
;; |
495 |
< |
cygwin*) |
496 |
< |
SERIALSRC="../dummy/serial_dummy.cpp" |
495 |
> |
irix*) |
496 |
> |
ETHERSRC=ether_unix.cpp |
497 |
> |
AUDIOSRC=Irix/audio_irix.cpp |
498 |
> |
LIBS="$LIBS -laudio" |
499 |
> |
WANT_ESD=no |
500 |
> |
|
501 |
> |
dnl Check if our compiler supports -IPA (MIPSPro) |
502 |
> |
HAVE_IPA=no |
503 |
> |
ocflags="$CFLAGS" |
504 |
> |
CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"` |
505 |
> |
AC_MSG_CHECKING(if "-IPA" works) |
506 |
> |
dnl Do a test compile of an empty function |
507 |
> |
AC_TRY_COMPILE([#if defined __GNUC__ |
508 |
> |
# error GCC does not support IPA yet |
509 |
> |
#endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
510 |
> |
CFLAGS="$ocflags" |
511 |
|
;; |
512 |
|
esac |
513 |
|
|
535 |
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
536 |
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
537 |
|
else |
538 |
< |
case "$target_os" in |
508 |
< |
cygwin*) |
509 |
< |
EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp" |
510 |
< |
;; |
511 |
< |
*) |
512 |
< |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
513 |
< |
;; |
514 |
< |
esac |
538 |
> |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
539 |
|
fi |
540 |
|
else |
541 |
|
VIDEOSRCS="video_x.cpp" |
963 |
|
|
964 |
|
dnl Check addressing mode to use |
965 |
|
AC_MSG_CHECKING([for addressing mode to use]) |
942 |
– |
case "$os_target" in |
943 |
– |
cygwin*) |
944 |
– |
WANT_ADDRESSING_MODE="direct,cygwin-hack" |
945 |
– |
NATMEM_OFFSET= |
946 |
– |
;; |
947 |
– |
esac |
966 |
|
if [[ "$EMULATED_PPC" != "yes" ]]; then |
967 |
|
if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then |
968 |
|
AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.]) |
1194 |
|
dnl Check for GCC 2.7 or higher. |
1195 |
|
HAVE_GCC27=no |
1196 |
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
1197 |
< |
AC_EGREP_CPP(xyes, |
1198 |
< |
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
1199 |
< |
xyes |
1200 |
< |
#endif |
1201 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
1197 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5) |
1198 |
> |
# error gcc < 2.7 |
1199 |
> |
typedef syntax error; |
1200 |
> |
#endif |
1201 |
> |
]])], |
1202 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC27=yes], |
1203 |
> |
[AC_MSG_RESULT(no)]) |
1204 |
|
|
1205 |
|
dnl Check for GCC 3.0 or higher. |
1206 |
|
HAVE_GCC30=no |
1207 |
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
1208 |
< |
AC_EGREP_CPP(xyes, |
1209 |
< |
[#if __GNUC__ >= 3 |
1210 |
< |
xyes |
1211 |
< |
#endif |
1212 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
1208 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) |
1209 |
> |
# error gcc < 3 |
1210 |
> |
typedef syntax error; |
1211 |
> |
#endif |
1212 |
> |
]])], |
1213 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC30=yes], |
1214 |
> |
[AC_MSG_RESULT(no)]) |
1215 |
|
|
1216 |
|
dnl Check for ICC. |
1217 |
|
AC_MSG_CHECKING(for ICC) |
1255 |
|
CFLAGS="$SAVED_CFLAGS" |
1256 |
|
fi |
1257 |
|
|
1258 |
< |
dnl Add -mdynamic-no-pic for MacOS X |
1259 |
< |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1258 |
> |
dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X) |
1259 |
> |
if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1260 |
|
SAVED_CFLAGS="$CFLAGS" |
1261 |
|
CFLAGS="$CFLAGS -mdynamic-no-pic" |
1262 |
|
AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic], |
1295 |
|
i?86:elf) |
1296 |
|
ac_cv_use_dyngen=yes |
1297 |
|
;; |
1298 |
+ |
mips:elf) |
1299 |
+ |
ac_cv_use_dyngen=yes |
1300 |
+ |
;; |
1301 |
|
powerpc:mach) |
1302 |
|
ac_cv_use_dyngen=yes |
1303 |
|
;; |
1304 |
+ |
i?86:mach) |
1305 |
+ |
ac_cv_use_dyngen=yes |
1306 |
+ |
;; |
1307 |
|
*:*) |
1308 |
|
ac_cv_use_dyngen=no |
1309 |
|
;; |
1313 |
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1314 |
|
DYNGEN_CC=$CXX |
1315 |
|
else |
1316 |
< |
for p in /usr/bin /usr/local/bin; do |
1316 |
> |
for p in /usr/bin /usr/local/bin /usr/freeware/bin; do |
1317 |
|
gxx="$p/g++" |
1318 |
|
if [[ -x "$gxx" ]]; then |
1319 |
|
DYNGEN_CC="$gxx" |
1328 |
|
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then |
1329 |
|
case $host_cpu in |
1330 |
|
i?86) |
1331 |
< |
DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2" |
1331 |
> |
DYNGEN_OP_FLAGS="-fomit-frame-pointer" |
1332 |
> |
;; |
1333 |
> |
mips) |
1334 |
> |
DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls" |
1335 |
|
;; |
1336 |
|
powerpc) |
1337 |
|
if [[ "x$ac_cv_object_format" = "xmach" ]]; then |
1339 |
|
fi |
1340 |
|
;; |
1341 |
|
esac |
1342 |
< |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1342 |
> |
have_dyngen_gcc3=no |
1343 |
> |
case "x`$DYNGEN_CC -dumpversion`" in |
1344 |
> |
x[12].*) ;; |
1345 |
> |
x*) have_dyngen_gcc3=yes ;; |
1346 |
> |
esac |
1347 |
> |
if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then |
1348 |
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0" |
1349 |
|
else |
1350 |
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0" |
1351 |
|
fi |
1352 |
< |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -fno-exceptions -g0" |
1353 |
< |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1352 |
> |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0" |
1353 |
> |
if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then |
1354 |
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls" |
1355 |
|
fi |
1356 |
+ |
if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then |
1357 |
+ |
DYNGEN_CFLAGS="-O2 $CFLAGS" |
1358 |
+ |
DYNGEN_CXXFLAGS="-O2 $CXXFLAGS" |
1359 |
+ |
else |
1360 |
+ |
DYNGEN_CFLAGS="\$(CFLAGS)" |
1361 |
+ |
DYNGEN_CXXFLAGS="\$(CXXFLAGS)" |
1362 |
+ |
fi |
1363 |
|
else |
1364 |
|
WANT_JIT=no |
1365 |
|
fi |
1408 |
|
CPPFLAGS="$CPPFLAGS -DUSE_JIT" |
1409 |
|
fi |
1410 |
|
|
1411 |
+ |
dnl Higher level optimizations with MIPSPro compilers are possible |
1412 |
+ |
if [[ "x$HAVE_IPA" = "xyes" ]]; then |
1413 |
+ |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1414 |
+ |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1415 |
+ |
CXXFLAGS="-LANG:std $CXXFLAGS" |
1416 |
+ |
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" |
1417 |
+ |
fi |
1418 |
+ |
|
1419 |
|
dnl Generate Makefile. |
1420 |
|
AC_SUBST(PERL) |
1421 |
|
AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen]) |
1422 |
|
AC_SUBST(DYNGENSRCS) |
1423 |
|
AC_SUBST(DYNGEN_CC) |
1424 |
+ |
AC_SUBST(DYNGEN_CFLAGS) |
1425 |
+ |
AC_SUBST(DYNGEN_CXXFLAGS) |
1426 |
|
AC_SUBST(DYNGEN_OP_FLAGS) |
1427 |
|
AC_SUBST(SYSSRCS) |
1428 |
|
AC_SUBST(CPUSRCS) |