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) |
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 |
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 |
+ |
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 |
|
|
514 |
|
dnl Is the slirp library supported? |
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) |