~ubuntu-branches/ubuntu/feisty/basilisk2/feisty

« back to all changes in this revision

Viewing changes to src/MacOSX/configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2005-07-30 20:42:20 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050730204220-1nl1cg2jkjvy63ry
Tags: 0.9.20050730-1
* New upstream CVS snapshot.
* Build-depend on virtual libsdl-dev (not libsdl1.2-dev).
* Invoke init rules also on clean (to separate better from official
  builds).
* Update URL of upstream source in debian/copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
dnl Mac OS X configuration driver
2
 
dnl $Id: configure.in,v 1.10 2003/06/03 12:40:02 nigel Exp $
 
2
dnl $Id: configure.in,v 1.16 2005/06/12 23:36:33 gbeauche Exp $
3
3
dnl Process this file with autoconf to produce a configure script.
4
4
dnl Based on Unix/configure.in
5
5
dnl Written in 1999 by Christian Bauer et al.
6
6
 
 
7
dnl autoconf on 10.1 doesn't understand these
 
8
dnl AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII)
 
9
dnl AC_CONFIG_SRCDIR(main_macosx.mm)
7
10
AC_INIT(main_macosx.mm)
8
11
AC_PREREQ(2.12)
9
12
AC_CONFIG_HEADER(config.h)
10
13
 
 
14
dnl Aliases for PACKAGE and VERSION macros.
 
15
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
 
16
AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
 
17
 
 
18
dnl Some systems do not put corefiles in the currect directory, avoid saving
 
19
dnl cores for the configure tests since some are intended to dump core.
 
20
ulimit -c 0
 
21
 
11
22
dnl Video options.
12
23
AC_ARG_ENABLE(multiwin,
13
24
[  --enable-multiwin    allow multiple emulator windows [default=no]], [ENABLE_MULTIPLE=$enableval], [ENABLE_MULTIPLE=no])
52
63
AC_CANONICAL_HOST
53
64
AC_CANONICAL_TARGET
54
65
 
55
 
dnl Target OS type
56
 
OS_TYPE=darwin
 
66
dnl Target OS type (target is host if not cross-compiling).
 
67
case "$target_os" in
 
68
  linux*)       OS_TYPE=linux;;
 
69
  netbsd*)      OS_TYPE=netbsd;;
 
70
  freebsd*)     OS_TYPE=freebsd;;
 
71
  solaris*)     OS_TYPE=solaris;;
 
72
  darwin*)      OS_TYPE=darwin;;
 
73
  *)            OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;;
 
74
esac
57
75
DEFINES="$DEFINES -DOS_$OS_TYPE"
58
76
 
59
77
dnl Target CPU type.
78
96
AC_PROG_MAKE_SET
79
97
AC_PROG_INSTALL
80
98
 
81
 
dnl MacOS 10.2 (and later?) have a particular header for defining the OS version
82
 
AC_CHECK_HEADER(AvailabilityMacros.h)
83
 
if [[ "x$ac_cv_header_AvailabilityMacros_h" = "xyes" ]]; then
84
 
  AC_DEFINE(AVAILABILITYMACROS, 1, [Header specific to 10.2 and later.])
85
 
fi
86
 
 
87
99
dnl We use mon if possible.
88
100
MONSRCS=
89
101
if [[ "x$WANT_MON" = "xyes" ]]; then
101
113
            AC_CHECK_LIB(Hcurses, tgetent, ,
102
114
              AC_CHECK_LIB(curses, tgetent))))))
103
115
    AC_CHECK_LIB(readline, readline)
104
 
    AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
105
116
  else
106
117
    AC_MSG_RESULT(no)
107
118
    AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
109
120
  fi
110
121
fi
111
122
 
112
 
dnl We want pthreads.
113
 
HAVE_PTHREADS=yes
 
123
dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
 
124
HAVE_PTHREADS=yes
 
125
AC_CHECK_LIB(pthread, pthread_create, , [
 
126
  AC_CHECK_LIB(c_r, pthread_create, , [
 
127
    AC_CHECK_LIB(PTL, pthread_create, , [
 
128
      HAVE_PTHREADS=no
 
129
    ])
 
130
  ])
 
131
])
 
132
dnl OS X does have pthreads, but not in any of the above locations:
 
133
HAVE_PTHREADS=yes
 
134
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
 
135
  AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
 
136
fi
114
137
AC_CHECK_FUNCS(pthread_cancel)
115
138
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
116
139
AC_CHECK_FUNCS(pthread_mutexattr_settype)
135
158
 
136
159
dnl Checks for header files.
137
160
AC_HEADER_STDC
138
 
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
 
161
AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
 
162
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
 
163
AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
139
164
 
140
165
dnl Checks for typedefs, structures, and compiler characteristics.
141
166
AC_C_BIGENDIAN
150
175
AC_CHECK_SIZEOF(long double, 12)
151
176
AC_CHECK_SIZEOF(void *, 4)
152
177
AC_TYPE_OFF_T
153
 
dnl These two symbols are not defined in 10.1's autoconf files:
 
178
dnl These two symbols are not defined in 10.1's autoconf:
154
179
dnl AC_CHECK_TYPE(loff_t, off_t)
155
180
dnl AC_CHECK_TYPE(caddr_t, [char *])
156
 
dnl which causes problems for autoheader.
157
181
dnl We define loff_t as a typedef of off_t in sysdeps.h if we don't have LOFF_T
 
182
dnl OS X does have caddr_t, but the above check doesn't work, so we have to do:
 
183
AC_DEFINE(HAVE_CADDR_T, 1, [The type "caddr_t" does exist on MacOS X.])
158
184
AC_TYPE_SIZE_T
159
185
AC_TYPE_SIGNAL
160
186
AC_HEADER_TIME
188
214
AC_CHECK_FUNCS(mach_task_self task_self)
189
215
 
190
216
dnl Select system-dependant source files.
191
 
DEFINES="$DEFINES -DBSD_COMP"
 
217
  DEFINES="$DEFINES -DBSD_COMP"
 
218
  CXXFLAGS="$CXXFLAGS -fpermissive"
192
219
  dnl Check for the CAM library
193
220
  AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) 
194
221
  if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
368
395
 
369
396
fi dnl HAVE_MMAP_VM
370
397
 
 
398
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
 
399
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
 
400
  ac_cv_pagezero_hack, [
 
401
  ac_cv_pagezero_hack=no 
 
402
  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
 
403
    ac_cv_pagezero_hack=yes
 
404
    dnl might as well skip the test for mmap-able low memory
 
405
    ac_cv_can_map_lm=no
 
406
  fi
 
407
])
 
408
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
 
409
  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
 
410
 
371
411
dnl Check if we can mmap 0x2000 bytes from 0x0000
372
412
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
373
413
  ac_cv_can_map_lm, [
376
416
  AC_TRY_RUN([
377
417
    #include "../Unix/vm_alloc.cpp"
378
418
    int main(void) { /* returns 0 if we could map the lowmem globals */
379
 
      volatile char * lm;
 
419
      volatile char * lm = 0;
380
420
      if (vm_init() < 0) exit(1);
381
 
      if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
 
421
      if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
382
422
      lm[0] = 'z';
383
423
      if (vm_release((char *)lm, 0x2000) < 0) exit(1);
384
424
      vm_exit(); exit(0);
452
492
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
453
493
  [Define if your system requires sigactions to be reinstalled.])
454
494
 
455
 
dnl Check if extended signals are supported.
456
 
AC_CACHE_CHECK([whether your system supports extended signal handlers],
457
 
  ac_cv_have_extended_signals, [
 
495
dnl Check if Mach exceptions supported.
 
496
AC_CACHE_CHECK([whether your system supports Mach exceptions],
 
497
  ac_cv_have_mach_exceptions, [
458
498
  AC_LANG_SAVE
459
499
  AC_LANG_CPLUSPLUS
460
500
  AC_TRY_RUN([
461
 
    #define HAVE_SIGINFO_T 1
 
501
    #define HAVE_MACH_EXCEPTIONS 1
462
502
    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
463
503
    #include "../Unix/vm_alloc.cpp"
464
504
    #include "../Unix/sigsegv.cpp"
465
 
  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
 
505
  ], [
 
506
  sigsegv_recovery=mach
 
507
  ac_cv_have_mach_exceptions=yes
 
508
  ],
 
509
  ac_cv_have_mach_exceptions=no,
466
510
  dnl When cross-compiling, do not assume anything.
467
 
  ac_cv_have_extended_signals=no
 
511
  ac_cv_have_mach_exceptions=no
468
512
  )
469
513
  AC_LANG_RESTORE
470
514
  ]
471
515
)
472
 
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
473
 
  [Define if your system support extended signals.])
474
 
 
475
 
dnl This program never returns (exits) on OS X
 
516
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
 
517
  [Define if your system supports Mach exceptions.])
 
518
 
 
519
dnl Otherwise, check if extended signals are supported.
 
520
if [[ -z "$sigsegv_recovery" ]]; then
 
521
  AC_CACHE_CHECK([whether your system supports extended signal handlers],
 
522
    ac_cv_have_extended_signals, [
 
523
    AC_LANG_SAVE
 
524
    AC_LANG_CPLUSPLUS
 
525
    AC_TRY_RUN([
 
526
      #define HAVE_SIGINFO_T 1
 
527
      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
 
528
      #include "../Unix/vm_alloc.cpp"
 
529
      #include "../Unix/sigsegv.cpp"
 
530
    ], [
 
531
    sigsegv_recovery=siginfo
 
532
    ac_cv_have_extended_signals=yes
 
533
    ],
 
534
    ac_cv_have_extended_signals=no,
 
535
    dnl When cross-compiling, do not assume anything.
 
536
    ac_cv_have_extended_signals=no
 
537
    )
 
538
    AC_LANG_RESTORE
 
539
    ]
 
540
  )
 
541
  AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
 
542
    [Define if your system support extended signals.])
 
543
fi
 
544
 
476
545
dnl Otherwise, check for subterfuges.
477
 
dnl if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
478
 
dnl   AC_CACHE_CHECK([whether we then have a subterfuge for your system],
479
 
dnl   ac_cv_have_sigcontext_hack, [
480
 
dnl     AC_LANG_SAVE
481
 
dnl     AC_LANG_CPLUSPLUS
482
 
dnl     AC_TRY_RUN([
483
 
dnl       #define HAVE_SIGCONTEXT_SUBTERFUGE 1
484
 
dnl       #define CONFIGURE_TEST_SIGSEGV_RECOVERY
485
 
dnl       #include "../Unix/vm_alloc.cpp"
486
 
dnl       #include "../Unix/sigsegv.cpp"
487
 
dnl     ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
488
 
dnl     dnl When cross-compiling, do not assume anything.
489
 
dnl     ac_cv_have_sigcontext_hack=no
490
 
dnl     )
491
 
dnl     AC_LANG_RESTORE
492
 
dnl   ])
493
 
dnl   AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
494
 
dnl     [Define if we know a hack to replace siginfo_t->si_addr member.])
495
 
dnl fi
 
546
if [[ -z "$sigsegv_recovery" ]]; then
 
547
  AC_CACHE_CHECK([whether we then have a subterfuge for your system],
 
548
  ac_cv_have_sigcontext_hack, [
 
549
    AC_LANG_SAVE
 
550
    AC_LANG_CPLUSPLUS
 
551
    AC_TRY_RUN([
 
552
      #define HAVE_SIGCONTEXT_SUBTERFUGE 1
 
553
      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
 
554
      #include "../Unix/vm_alloc.cpp"
 
555
      #include "../Unix/sigsegv.cpp"
 
556
    ], [
 
557
    sigsegv_recovery=sigcontext
 
558
    ac_cv_have_sigcontext_hack=yes
 
559
    ],
 
560
    ac_cv_have_sigcontext_hack=no,
 
561
    dnl When cross-compiling, do not assume anything.
 
562
    ac_cv_have_sigcontext_hack=no
 
563
    )
 
564
    AC_LANG_RESTORE
 
565
  ])
 
566
  AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
 
567
    [Define if we know a hack to replace siginfo_t->si_addr member.])
 
568
fi
496
569
 
497
570
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
498
571
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
516
589
 
517
590
dnl Can we do Video on SEGV Signals ?
518
591
CAN_VOSF=no
519
 
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
 
592
if [[ -n "$sigsegv_recovery" ]]; then
520
593
  CAN_VOSF=yes
521
594
fi
522
595
 
 
596
dnl A dummy program that returns always true
 
597
BLESS=/usr/bin/touch
 
598
 
523
599
dnl Determine the addressing mode to use
524
600
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
525
601
  ADDRESSING_MODE="real"
530
606
    case $am in
531
607
    real)
532
608
      dnl Requires ability to mmap() Low Memory globals
533
 
      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
 
609
      if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
534
610
        continue
535
611
      fi
536
 
          dnl Requires VOSF screen updates
 
612
      dnl Requires VOSF screen updates
537
613
      if [[ "x$CAN_VOSF" = "xno" ]]; then
538
614
        continue
539
615
      fi
541
617
      ADDRESSING_MODE="real"
542
618
      WANT_VOSF=yes dnl we can use VOSF and we need it actually
543
619
      DEFINES="$DEFINES -DREAL_ADDRESSING"
 
620
      AC_DEFINE(REAL_ADDRESSING, 1, [Emulated memory is memory mapped to actual address.])
 
621
      if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
 
622
        BLESS=Darwin/lowmem
 
623
        LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
 
624
      fi
544
625
      break
545
626
      ;;
546
627
    direct)
549
630
        ADDRESSING_MODE="direct"
550
631
        WANT_VOSF=yes dnl we can use VOSF and we need it actually
551
632
        DEFINES="$DEFINES -DDIRECT_ADDRESSING"
 
633
        AC_DEFINE(DIRECT_ADDRESSING, 1, [Emulated memory is an offset from actual address.])
552
634
        break
553
635
      fi
554
636
      ;;
593
675
dnl Check for GCC 2.7 or higher.
594
676
HAVE_GCC27=no
595
677
AC_MSG_CHECKING(for GCC 2.7 or higher)
596
 
AC_EGREP_CPP(yes,
 
678
AC_EGREP_CPP(xyes,
597
679
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
598
 
  yes
 
680
  xyes
599
681
#endif
600
682
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
601
683
 
602
684
dnl Check for GCC 3.0 or higher.
603
685
HAVE_GCC30=no
604
686
AC_MSG_CHECKING(for GCC 3.0 or higher)
605
 
AC_EGREP_CPP(yes,
 
687
AC_EGREP_CPP(xyes,
606
688
[#if __GNUC__ >= 3
607
 
  yes
 
689
  xyes
608
690
#endif
609
691
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
610
692
 
926
1008
  LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
927
1009
fi
928
1010
 
 
1011
dnl
 
1012
dnl Some Mac OS X specific stuff:
 
1013
dnl
 
1014
 
 
1015
dnl MacOS 10.2 (and later?) have a particular header for defining the OS version
 
1016
AC_CHECK_HEADER(AvailabilityMacros.h)
 
1017
if [[ "x$ac_cv_header_AvailabilityMacros_h" = "xyes" ]]; then
 
1018
  AC_DEFINE(AVAILABILITYMACROS, 1, [Header specific to 10.2 and later.])
 
1019
fi
 
1020
 
 
1021
dnl Which IDE do we use?
 
1022
if test -d "/Developer/Applications/Xcode.app"; then
 
1023
  IDE=xcodebuild
 
1024
  PROJECT=BasiliskII.xcode
 
1025
  IDEARGS="-project BasiliskII.xcode"
 
1026
else
 
1027
  IDE=pbxbuild
 
1028
  PROJECT=BasiliskII.pbproj
 
1029
  IDEARGS=""
 
1030
fi
 
1031
 
929
1032
dnl Generate Makefile.
930
1033
AC_SUBST(DEFINES)
931
1034
AC_SUBST(SYSSRCS)
932
1035
AC_SUBST(CPUINCLUDES)
933
1036
AC_SUBST(CPUSRCS)
 
1037
AC_SUBST(BLESS)
 
1038
AC_SUBST(IDE)
 
1039
AC_SUBST(PROJECT)
 
1040
AC_SUBST(IDEARGS)
 
1041
dnl autoconf on 10.1 doesn't understand these
 
1042
dnl AC_CONFIG_FILES([Makefile])
 
1043
dnl AC_OUTPUT
934
1044
AC_OUTPUT(Makefile)
935
1045
 
936
1046
dnl Print summary.
945
1055
echo Floating-Point emulation core .......... : $FPE_CORE
946
1056
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
947
1057
echo Addressing mode ........................ : $ADDRESSING_MODE
 
1058
echo Bad memory access recovery type ........ : $sigsegv_recovery
 
1059
echo Mac OS X development environment ....... : $IDE
948
1060
echo
949
1061
echo "Configuration done. Now type \"make\" (or \"make ide\")."
950
 
 
951