Basic support for plain UNIX-style builds on OSX.

This commit is contained in:
Christian Speckner 2017-08-30 23:12:50 +02:00
parent 2930e74333
commit fd85f9d0d5
2 changed files with 59 additions and 18 deletions

41
configure vendored
View File

@ -378,10 +378,32 @@ echocheck "compiler version"
have_clang=no have_clang=no
cc_check_define __clang_version__ && have_clang=yes cc_check_define __clang_version__ && have_clang=yes
if test $have_clang = no; then
cc_check_define __clang__ && have_clang=yes
fi
have_gcc=no have_gcc=no
cc_check_define __GNUC__ && have_gcc=yes cc_check_define __GNUC__ && have_gcc=yes
if test "$have_clang" = yes; then if test "$have_clang" = yes; then
is_xcode=$( $CXX -dM -E -x c /dev/null | grep __apple_build_version__ )
if test -n "$is_xcode"; then
clang_minor=$( $CXX -dM -E -x c /dev/null | grep __clang_minor__ | sed 's/.*\([0-9][0-9]*\).*/\1/' )
clang_patch=$( $CXX -dM -E -x c /dev/null | grep __clang_patchlevel__ | sed 's/.*\([0-9][0-9]*\).*/\1/' )
clang_major=$( $CXX -dM -E -x c /dev/null | grep __clang_major__ | sed 's/.*\([0-9][0-9]*\).*/\1/' )
cxx_version="$clang_major.$clang_minor.$clang_patch"
cxx_name="XCode $cxx_version"
if test $clang_major -ge 8; then
cxx_version="$cxx_version, ok"
cxx_verc_fail=no
else
cxx_version="$cxx_version, bad"
cxx_verc_fail=bad
fi
else
cxx_name=`( $cc -v ) 2>&1 | tail -n 1 | cut -d ' ' -f 1` cxx_name=`( $cc -v ) 2>&1 | tail -n 1 | cut -d ' ' -f 1`
cxx_version=$( $CXX -dM -E -x c /dev/null | grep __clang_version__ | sed 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/g' 2>&1) cxx_version=$( $CXX -dM -E -x c /dev/null | grep __clang_version__ | sed 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/g' 2>&1)
if test "$?" -gt 0; then if test "$?" -gt 0; then
@ -403,6 +425,7 @@ if test "$have_clang" = yes; then
cxx_verc_fail=yes cxx_verc_fail=yes
;; ;;
esac esac
fi
CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS"
_make_def_HAVE_GCC3='HAVE_GCC3 = 1' _make_def_HAVE_GCC3='HAVE_GCC3 = 1'
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
@ -516,6 +539,10 @@ else
DEFINES="$DEFINES -DUNIX" DEFINES="$DEFINES -DUNIX"
_host_os=unix _host_os=unix
;; ;;
darwin*)
DEFINES="$DEFINES -DUNIX -DDARWIN"
_host_os=darwin
;;
irix*) irix*)
DEFINES="$DEFINES -DUNIX" DEFINES="$DEFINES -DUNIX"
_ranlib=: _ranlib=:
@ -695,12 +722,18 @@ fi
LIBS="$LIBS `$_sdlconfig $_sdl_conf_libs`" LIBS="$LIBS `$_sdlconfig $_sdl_conf_libs`"
LD=$CXX LD=$CXX
case $_host_os in case $_host_os in
unix) unix)
DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY" DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY"
MODULES="$MODULES $SRC/unix" MODULES="$MODULES $SRC/unix"
INCLUDES="$INCLUDES -I$SRC/unix" INCLUDES="$INCLUDES -I$SRC/unix"
;; ;;
darwin)
DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY -DOSX_KEYS"
MODULES="$MODULES $SRC/unix"
INCLUDES="$INCLUDES -I$SRC/unix"
;;
win32) win32)
DEFINES="$DEFINES -DBSPF_WINDOWS -DHAVE_GETTIMEOFDAY" DEFINES="$DEFINES -DBSPF_WINDOWS -DHAVE_GETTIMEOFDAY"
MODULES="$MODULES $SRC/windows" MODULES="$MODULES $SRC/windows"
@ -803,3 +836,11 @@ EOF
# This should be taken care of elsewhere, but I'm not sure where # This should be taken care of elsewhere, but I'm not sure where
rm -f stella-conf* rm -f stella-conf*
if test "$_host_os" = darwin; then
cat <<EOI
WARNING: plain UNIX-style builds on OSX without XCode have decraded functionality
and are unsupported. Continue on your own risk...
EOI
fi

View File

@ -167,7 +167,7 @@ class EventHandler
inline bool kbdAlt(int mod) const inline bool kbdAlt(int mod) const
{ {
#ifndef BSPF_MAC_OSX #if defined(BSPF_MAC_OSX) || defined(OSX_KEYS)
return (mod & KBDM_ALT); return (mod & KBDM_ALT);
#else #else
return (mod & KBDM_GUI); return (mod & KBDM_GUI);