ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
(Generate patch)

Comparing BasiliskII/src/Unix/configure.ac (file contents):
Revision 1.70 by gbeauche, 2006-07-19T21:22:41Z vs.
Revision 1.79 by asvitkine, 2010-07-28T01:10:24Z

# Line 26 | Line 26 | dnl SDL options.
26   AC_ARG_ENABLE(sdl-static,    [  --enable-sdl-static     use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
27   AC_ARG_ENABLE(sdl-video,     [  --enable-sdl-video      use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no])
28   AC_ARG_ENABLE(sdl-audio,     [  --enable-sdl-audio      use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
29 + AC_ARG_ENABLE(sdl-framework,    [  --enable-sdl-framework  use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no])
30 + AC_ARG_ENABLE(sdl-framework-prefix,    [  --enable-sdl-framework-prefix=PFX    default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks])
31  
32   dnl JIT compiler options.
33   AC_ARG_ENABLE(jit-compiler,  [  --enable-jit-compiler   enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
# Line 101 | Line 103 | case "$target_cpu" in
103    x86_64* ) HAVE_X86_64=yes;;
104   esac
105  
106 + dnl Check if we should really be assuming x86_64 even if we detected HAVE_I386 above.
107 + if [[ "x$HAVE_I386" = "xyes" ]]; then
108 +  AC_TRY_RUN([
109 +    int main(void) {
110 +        #if defined(__x86_64__)
111 +                return 0;
112 +        #else
113 +                return 1;
114 +        #endif
115 +    }
116 +  ], [
117 +    HAVE_I386=no
118 +    HAVE_X86_64=yes
119 +  ])
120 + fi
121 +
122   dnl Checks for programs.
123   AC_PROG_CC
124   AC_PROG_CC_C_O
# Line 118 | Line 136 | if [[ "x$WANT_MON" = "xyes" ]]; then
136    if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
137      AC_MSG_RESULT(yes)
138      AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
139 <    MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
139 >    MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c $mon_srcdir/disass/mips-dis.c $mon_srcdir/disass/mips-opc.c $mon_srcdir/disass/mips16-opc.c"
140      CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
141      AC_CHECK_LIB(ncurses, tgetent, ,
142 <      AC_CHECK_LIB(termcap, tgetent, ,
143 <        AC_CHECK_LIB(termlib, tgetent, ,
144 <          AC_CHECK_LIB(terminfo, tgetent, ,
145 <            AC_CHECK_LIB(Hcurses, tgetent, ,
146 <              AC_CHECK_LIB(curses, tgetent))))))
142 >      [AC_CHECK_LIB(termcap, tgetent, ,
143 >        [AC_CHECK_LIB(termlib, tgetent, ,
144 >          [AC_CHECK_LIB(terminfo, tgetent, ,
145 >            [AC_CHECK_LIB(Hcurses, tgetent, ,
146 >              [AC_CHECK_LIB(curses, tgetent)])])])])])
147      AC_CHECK_LIB(readline, readline)
148    else
149      AC_MSG_RESULT(no)
# Line 140 | Line 158 | AC_CHECK_LIB(rt, timer_create)
158   AC_CHECK_LIB(rt, shm_open)
159   AC_CHECK_LIB(m, cos)
160  
161 + dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES)
162 + dnl AC_TRY_LINK uses main() but SDL needs main to take args,
163 + dnl therefore main is undefined with #undef.
164 + dnl Framework can be in an custom location.
165 + AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [
166 +  AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])
167 +  AC_CACHE_CHECK([whether compiler supports framework $1],
168 +    ac_Framework, [
169 +    saved_LIBS="$LIBS"
170 +    LIBS="$LIBS -framework $1"
171 +    if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then
172 +      if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
173 +        LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
174 +      fi
175 +    fi
176 +    saved_CPPFLAGS="$CPPFLAGS"
177 +    CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers"
178 +    AC_TRY_LINK(
179 +      [$2
180 + #undef main], [],
181 +      [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no);
182 + LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"]
183 +    )
184 +  ])
185 +  AS_IF([test AS_VAR_GET(ac_Framework) = yes],
186 +    [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
187 +  )
188 +  AS_VAR_POPDEF([ac_Framework])
189 + ])
190 +
191   dnl Do we need SDL?
192   WANT_SDL=no
193   if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
# Line 154 | Line 202 | if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; th
202    SDL_SUPPORT="$SDL_SUPPORT audio"
203   fi
204   if [[ "x$WANT_SDL" = "xyes" ]]; then
205 <  AC_PATH_PROG(sdl_config, "sdl-config")
206 <  if [[ -n "$sdl_config" ]]; then
159 <    case $target_os in
160 <    # Special treatment for Cygwin so that we can still use the POSIX layer
161 <    *cygwin*)
162 <      sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
163 <      sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
164 <      ;;
165 <    *)
166 <      sdl_cflags=`$sdl_config --cflags`
167 <      if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
168 <        sdl_libs=`$sdl_config --static-libs`
169 <      else
170 <        sdl_libs=`$sdl_config --libs`
171 <      fi
172 <      ;;
173 <    esac
174 <    CFLAGS="$CFLAGS $sdl_cflags"
175 <    CXXFLAGS="$CXXFLAGS $sdl_cflags"
176 <    LIBS="$LIBS $sdl_libs"
205 >  if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
206 >    AC_CHECK_SDLFRAMEWORK(SDL, [#include <SDL.h>])
207    else
208 <    WANT_SDL=no
208 >    ac_cv_framework_SDL=no
209 >  fi
210 >  if [[ "x$ac_cv_framework_SDL" = "xno" ]]; then
211 >    AC_PATH_PROG(sdl_config, "sdl-config")
212 >    if [[ -n "$sdl_config" ]]; then
213 >      case $target_os in
214 >      # Special treatment for Cygwin so that we can still use the POSIX layer
215 >      *cygwin*)
216 >        sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
217 >        sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
218 >        ;;
219 >      *)
220 >        sdl_cflags=`$sdl_config --cflags`
221 >        if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
222 >          sdl_libs=`$sdl_config --static-libs`
223 >        else
224 >          sdl_libs=`$sdl_config --libs`
225 >        fi
226 >        ;;
227 >      esac
228 >      CFLAGS="$CFLAGS $sdl_cflags"
229 >      CXXFLAGS="$CXXFLAGS $sdl_cflags"
230 >      LIBS="$LIBS $sdl_libs"
231 >    else
232 >      WANT_SDL=no
233 >    fi
234    fi
235    SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
236   else
# Line 412 | Line 467 | mips-sony-bsd|mips-sony-newsos4)
467   *-*-cygwin*)
468          no_dev_ptmx=1
469          ;;
470 + *-*-darwin*)
471 +        no_dev_ptmx=1
472 +        ;;
473   esac
474  
475   if test -z "$no_dev_ptmx" ; then
# Line 430 | Line 488 | AC_CHECK_FILE([/dev/ptc],
488                  have_dev_ptc=1
489          ]
490   )
433
491   dnl (end of code from openssh-3.2.2p1 configure.ac)
492  
436
493   dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
494   dnl doesn't work or is unimplemented. On these systems (mostly older
495   dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
# Line 580 | Line 636 | darwin*)
636      EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
637    fi
638    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
639 <    EXTFSSRC=../MacOSX/extfs_macosx.mm
639 >    EXTFSSRC=../MacOSX/extfs_macosx.cpp
640    fi
641    ;;
642   cygwin*)
# Line 611 | Line 667 | AC_SUBST(SLIRP_SRCS)
667   dnl SDL overrides
668   if [[ "x$WANT_SDL" = "xyes" ]]; then
669    AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
670 +  if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
671 +    EXTRASYSSRCS="$EXTRASYSSRCS ../SDL/SDLMain.m"
672 +  fi
673   fi
674   if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
675    AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
# Line 870 | Line 929 | AC_CACHE_CHECK([whether we can map Low M
929    ]
930   )
931  
873 dnl Check if we have POSIX shared memory support
874 AC_CACHE_CHECK([whether POSIX shared memory is working],
875  ac_cv_have_posix_shm, [
876  AC_LANG_SAVE
877  AC_LANG_CPLUSPLUS
878  AC_TRY_RUN([
879    #define HAVE_POSIX_SHM
880    #include "vm_alloc.cpp"
881    int main(void) { /* returns 0 if we have working POSIX shm */
882      if (vm_init() < 0) exit(2);
883      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
884      if (m1 == VM_MAP_FAILED) exit(3);
885      vm_exit(); exit(0);
886    }
887  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
888  dnl When cross-compiling, do not assume anything.
889  ac_cv_have_posix_shm="guessing no"
890  )
891  AC_LANG_RESTORE
892  ]
893 )
894 AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
895  [Define if your system supports POSIX shared memory.])
896
897 dnl Check if we have working 33-bit memory addressing
898 AC_CACHE_CHECK([whether 33-bit memory addressing is working],
899  ac_cv_have_33bit_addressing, [
900  AC_LANG_SAVE
901  AC_LANG_CPLUSPLUS
902  AC_TRY_RUN([
903    #define USE_33BIT_ADDRESSING 1
904    #include "vm_alloc.cpp"
905    int main(void) { /* returns 0 if we have working 33-bit addressing */
906      if (sizeof(void *) < 8) exit(1);
907      if (vm_init() < 0) exit(2);
908      volatile char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
909      if (m1 == VM_MAP_FAILED) exit(3);
910      volatile char *m2 = m1 + (1L << 32);
911      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
912      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
913      vm_exit(); exit(0);
914    }
915  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
916  dnl When cross-compiling, do not assume anything.
917  ac_cv_have_33bit_addressing="guessing no"
918  )
919  AC_LANG_RESTORE
920  ]
921 )
922
932   dnl Check signal handlers need to be reinstalled
933   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
934    ac_cv_signal_need_reinstall, [
# Line 987 | Line 996 | AC_CACHE_CHECK([whether your system supp
996    AC_LANG_SAVE
997    AC_LANG_CPLUSPLUS
998    AC_TRY_RUN([
999 +    #define HAVE_UNISTD_H 1
1000 +    #define HAVE_MACH_VM 1
1001 +    #define HAVE_MACH_TASK_SELF 1
1002      #define HAVE_MACH_EXCEPTIONS 1
1003      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1004      #include "vm_alloc.cpp"
# Line 1341 | Line 1353 | elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HA
1353      DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1354      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"
1355      CAN_JIT=yes
1344    WANT_33BIT_ADDRESSING=yes
1356    fi
1357   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1358    dnl SPARC CPU
# Line 1398 | Line 1409 | else
1409    JITSRCS=""
1410   fi
1411  
1401 dnl Use 33-bit memory addressing?
1402 if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1403  use_33bit_addressing=yes
1404 fi
1405 AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1406  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1407
1412   dnl Utility macro used by next two tests.
1413   dnl AC_EXAMINE_OBJECT(C source code,
1414   dnl     commands examining object file,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines