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]) |
142 |
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
143 |
|
AC_PATH_PROG(sdl_config, "sdl-config") |
144 |
|
if [[ -n "$sdl_config" ]]; then |
145 |
< |
case $target_os in |
146 |
< |
# Special treatment for Cygwin so that we can still use the POSIX layer |
147 |
< |
*cygwin*) |
148 |
< |
sdl_cflags="-I`$sdl_config --prefix`/include/SDL" |
149 |
< |
sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL" |
150 |
< |
;; |
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 |
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 |
|
CFLAGS="$CFLAGS $sdl_cflags" |
152 |
|
CXXFLAGS="$CXXFLAGS $sdl_cflags" |
153 |
|
LIBS="$LIBS $sdl_libs" |
183 |
|
AC_CHECK_LIB(pthread, pthread_create, , [ |
184 |
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
185 |
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
186 |
< |
AC_MSG_ERROR([You need pthreads to run Basilisk II.]) |
186 |
> |
dnl XXX remove when no pthreads case is merged |
187 |
> |
AC_MSG_ERROR([You need pthreads to run SheepShaver.]) |
188 |
> |
HAVE_PTHREADS=no |
189 |
|
]) |
190 |
|
]) |
191 |
|
]) |
192 |
|
AC_CHECK_FUNCS(pthread_cancel) |
193 |
+ |
AC_CHECK_FUNCS(pthread_cond_init pthread_testcancel) |
194 |
|
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
195 |
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
196 |
|
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
196 |
– |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
197 |
– |
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
198 |
– |
fi |
197 |
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
198 |
|
SEMSRC= |
199 |
|
AC_CHECK_FUNCS(sem_init, , [ |
203 |
|
]) |
204 |
|
;; |
205 |
|
esac |
206 |
+ |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
207 |
+ |
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
208 |
+ |
fi |
209 |
|
|
210 |
|
dnl We use FBDev DGA if possible. |
211 |
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
296 |
|
dnl Checks for header files. |
297 |
|
AC_HEADER_STDC |
298 |
|
AC_HEADER_SYS_WAIT |
299 |
< |
AC_CHECK_HEADERS(malloc.h) |
299 |
> |
AC_CHECK_HEADERS(malloc.h stdint.h) |
300 |
|
AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h) |
300 |
– |
AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h) |
301 |
|
AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h) |
302 |
< |
AC_CHECK_HEADERS(linux/if.h, [], [], [ |
303 |
< |
#if HAVE_SYS_SOCKET_H |
304 |
< |
# include <sys/socket.h> |
302 |
> |
AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h) |
303 |
> |
AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h) |
304 |
> |
AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [ |
305 |
> |
#ifdef HAVE_SYS_TYPES_H |
306 |
> |
#include <sys/types.h> |
307 |
> |
#endif |
308 |
> |
#ifdef HAVE_SYS_SOCKET_H |
309 |
> |
#include <sys/socket.h> |
310 |
|
#endif |
311 |
|
]) |
312 |
< |
AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h) |
312 |
> |
AC_CHECK_HEADERS(AvailabilityMacros.h) |
313 |
> |
AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h) |
314 |
|
AC_CHECK_HEADERS(fenv.h) |
315 |
|
|
316 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
331 |
|
AC_HEADER_TIME |
332 |
|
AC_STRUCT_TM |
333 |
|
|
334 |
+ |
dnl Check whether sys/socket.h defines type socklen_t. |
335 |
+ |
dnl (extracted from ac-archive/Miscellaneous) |
336 |
+ |
AC_CACHE_CHECK([for socklen_t], |
337 |
+ |
ac_cv_type_socklen_t, [ |
338 |
+ |
AC_TRY_COMPILE([ |
339 |
+ |
#include <sys/types.h> |
340 |
+ |
#include <sys/socket.h> |
341 |
+ |
], [socklen_t len = 42; return 0;], |
342 |
+ |
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
343 |
+ |
dnl When cross-compiling, do not assume anything. |
344 |
+ |
ac_cv_type_socklen_t="guessing no" |
345 |
+ |
) |
346 |
+ |
]) |
347 |
+ |
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
348 |
+ |
AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.]) |
349 |
+ |
fi |
350 |
+ |
|
351 |
|
dnl Check whether struct sigaction has sa_restorer member. |
352 |
|
AC_CACHE_CHECK([whether struct sigaction has sa_restorer], |
353 |
|
ac_cv_signal_sa_restorer, [ |
364 |
|
fi |
365 |
|
|
366 |
|
dnl Checks for library functions. |
367 |
< |
AC_CHECK_FUNCS(strdup strlcpy cfmakeraw) |
367 |
> |
AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw) |
368 |
|
AC_CHECK_FUNCS(nanosleep) |
369 |
|
AC_CHECK_FUNCS(sigaction signal) |
370 |
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
371 |
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
349 |
– |
AC_CHECK_FUNCS(posix_memalign memalign valloc) |
372 |
|
AC_CHECK_FUNCS(exp2f log2f exp2 log2) |
373 |
|
AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc) |
374 |
+ |
AC_CHECK_FUNCS(poll inet_aton) |
375 |
|
|
376 |
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
377 |
|
AC_CHECK_FUNCS(mach_task_self task_self) |
452 |
|
dnl Check for some MacOS X frameworks |
453 |
|
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
454 |
|
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
455 |
+ |
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>]) |
456 |
|
|
457 |
|
dnl Select system-dependant sources. |
458 |
|
SERIALSRC=serial_unix.cpp |
463 |
|
EXTRASYSSRCS= |
464 |
|
case "$target_os" in |
465 |
|
linux*) |
466 |
< |
ETHERSRC=Linux/ether_linux.cpp |
466 |
> |
ETHERSRC=ether_unix.cpp |
467 |
|
AUDIOSRC=audio_oss_esd.cpp |
468 |
|
SCSISRC=Linux/scsi_linux.cpp |
469 |
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
470 |
< |
EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c ppc_asm.S" |
470 |
> |
EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S" |
471 |
|
fi |
472 |
|
;; |
473 |
+ |
freebsd*) |
474 |
+ |
ETHERSRC=ether_unix.cpp |
475 |
+ |
;; |
476 |
|
netbsd*) |
477 |
+ |
ETHERSRC=ether_unix.cpp |
478 |
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
479 |
< |
EXTRASYSSRCS="NetBSD/paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S" |
479 |
> |
EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S" |
480 |
|
fi |
481 |
|
;; |
482 |
|
darwin*) |
483 |
+ |
ETHERSRC=ether_unix.cpp |
484 |
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
485 |
< |
EXTRASYSSRCS="Darwin/paranoia.cpp ppc_asm.S" |
485 |
> |
EXTRASYSSRCS="paranoia.cpp ppc_asm.S" |
486 |
|
fi |
487 |
< |
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
487 |
> |
if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then |
488 |
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp" |
489 |
|
fi |
490 |
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
491 |
|
EXTFSSRC=../MacOSX/extfs_macosx.mm |
492 |
|
fi |
493 |
|
;; |
465 |
– |
cygwin*) |
466 |
– |
SERIALSRC="../dummy/serial_dummy.cpp" |
467 |
– |
;; |
494 |
|
esac |
495 |
|
|
496 |
+ |
dnl Is the slirp library supported? |
497 |
+ |
if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then |
498 |
+ |
AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) |
499 |
+ |
SLIRP_SRCS="\ |
500 |
+ |
../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ |
501 |
+ |
../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \ |
502 |
+ |
../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \ |
503 |
+ |
../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \ |
504 |
+ |
../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \ |
505 |
+ |
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c" |
506 |
+ |
fi |
507 |
+ |
AC_SUBST(SLIRP_SRCS) |
508 |
+ |
|
509 |
|
dnl SDL overrides |
510 |
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
511 |
|
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.]) |
517 |
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
518 |
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
519 |
|
else |
520 |
< |
case "$target_os" in |
482 |
< |
cygwin*) |
483 |
< |
EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp" |
484 |
< |
;; |
485 |
< |
*) |
486 |
< |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
487 |
< |
;; |
488 |
< |
esac |
520 |
> |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
521 |
|
fi |
522 |
|
else |
523 |
|
VIDEOSRCS="video_x.cpp" |
945 |
|
|
946 |
|
dnl Check addressing mode to use |
947 |
|
AC_MSG_CHECKING([for addressing mode to use]) |
916 |
– |
case "$os_target" in |
917 |
– |
cygwin*) |
918 |
– |
WANT_ADDRESSING_MODE="direct,cygwin-hack" |
919 |
– |
NATMEM_OFFSET= |
920 |
– |
;; |
921 |
– |
esac |
948 |
|
if [[ "$EMULATED_PPC" != "yes" ]]; then |
949 |
|
if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then |
950 |
|
AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.]) |
1176 |
|
dnl Check for GCC 2.7 or higher. |
1177 |
|
HAVE_GCC27=no |
1178 |
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
1179 |
< |
AC_EGREP_CPP(xyes, |
1180 |
< |
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
1181 |
< |
xyes |
1182 |
< |
#endif |
1183 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
1179 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5) |
1180 |
> |
# error gcc < 2.7 |
1181 |
> |
#endif |
1182 |
> |
]])], |
1183 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC27=yes], |
1184 |
> |
[AC_MSG_RESULT(no)]) |
1185 |
|
|
1186 |
|
dnl Check for GCC 3.0 or higher. |
1187 |
|
HAVE_GCC30=no |
1188 |
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
1189 |
< |
AC_EGREP_CPP(xyes, |
1190 |
< |
[#if __GNUC__ >= 3 |
1191 |
< |
xyes |
1192 |
< |
#endif |
1193 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
1189 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) |
1190 |
> |
# error gcc < 3 |
1191 |
> |
#endif |
1192 |
> |
]])], |
1193 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC30=yes], |
1194 |
> |
[AC_MSG_RESULT(no)]) |
1195 |
|
|
1196 |
|
dnl Check for ICC. |
1197 |
|
AC_MSG_CHECKING(for ICC) |
1222 |
|
rm -rf conftest* |
1223 |
|
]) |
1224 |
|
|
1225 |
+ |
dnl Add -fno-strict-aliasing for slirp sources |
1226 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1227 |
+ |
SAVED_CFLAGS="$CFLAGS" |
1228 |
+ |
CFLAGS="$CFLAGS -fno-strict-aliasing" |
1229 |
+ |
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], |
1230 |
+ |
ac_cv_gcc_no_strict_aliasing, [ |
1231 |
+ |
AC_TRY_COMPILE([],[], |
1232 |
+ |
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")], |
1233 |
+ |
[ac_cv_gcc_no_strict_aliasing=no]) |
1234 |
+ |
]) |
1235 |
+ |
CFLAGS="$SAVED_CFLAGS" |
1236 |
+ |
fi |
1237 |
+ |
|
1238 |
+ |
dnl Add -mdynamic-no-pic for MacOS X |
1239 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1240 |
+ |
SAVED_CFLAGS="$CFLAGS" |
1241 |
+ |
CFLAGS="$CFLAGS -mdynamic-no-pic" |
1242 |
+ |
AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic], |
1243 |
+ |
ac_cv_gcc_mdynamic_no_pic, [ |
1244 |
+ |
AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no]) |
1245 |
+ |
]) |
1246 |
+ |
if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then |
1247 |
+ |
CXXFLAGS="$CXXFLAGS -mdynamic-no-pic" |
1248 |
+ |
else |
1249 |
+ |
CFLAGS="$SAVED_CFLAGS" |
1250 |
+ |
fi |
1251 |
+ |
fi |
1252 |
+ |
|
1253 |
|
dnl CPU emulator sources |
1254 |
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
1255 |
|
CPUSRCS="\ |