Make it possible to compile without CoreMIDI and CoreAudio on Mac OS X using a non-Apple compiler. Give some feedback to user in this case. (modified version of patch by krcroft with input from jmarsh, Dominus and Qbix)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4281
This commit is contained in:
parent
a2e7d257e5
commit
8f3474ecfd
3 changed files with 42 additions and 3 deletions
28
configure.ac
28
configure.ac
|
@ -189,6 +189,33 @@ CXXFLAGS="$CXXFLAGS -mno-ms-bitfields"
|
|||
],[AC_MSG_RESULT([no])])
|
||||
CFLAGS="$BACKUP_CFLAGS"
|
||||
|
||||
dnl When on macOS, enable support for Apple's Core MIDI and/or Core Audio if our compiler can #include their headers
|
||||
case "$host" in
|
||||
*-*-darwin*)
|
||||
AC_MSG_CHECKING(if compiler supports Apple's Core MIDI headers)
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <CoreMIDI/MIDIServices.h>
|
||||
int blah() { return 0; }
|
||||
]])], [AC_MSG_RESULT(yes);LIBS="$LIBS -framework CoreMIDI";AC_DEFINE([C_SUPPORTS_COREMIDI], [],
|
||||
[Compiler supports Core MIDI headers])],
|
||||
AC_MSG_RESULT(no);AC_MSG_WARN([Compiler can't compile Apple headers. CoreMIDI functionality disabled. Please use the Apple compiler!]))
|
||||
|
||||
AC_MSG_CHECKING(if compiler supports Apple's Core Audio headers)
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <AudioToolbox/AUGraph.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
int blah() { return 0; }
|
||||
]])], [AC_MSG_RESULT(yes);LIBS="$LIBS -framework AudioUnit -framework AudioToolbox";AC_DEFINE([C_SUPPORTS_COREAUDIO], [],
|
||||
[Compiler supports Core Audio headers])],
|
||||
AC_MSG_RESULT(no);AC_MSG_WARN([Compiler can't compile Apple headers. CoreAudio functionality disabled. Please use the Apple compiler!]))
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING(if compiler supports Apple's MIDI headers)
|
||||
AC_MSG_RESULT([no, not on Apple])
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl enable disable alsa and pass it's cflags to CXXFLAGS
|
||||
AC_ARG_ENABLE(alsa-midi,
|
||||
AC_HELP_STRING([--enable-alsa-midi],[compile with alsa midi support (default yes)]),
|
||||
|
@ -564,7 +591,6 @@ case "$host" in
|
|||
dnl to do more to distinguish them.
|
||||
dnl For now I am lazy and do not add proper detection code.
|
||||
AC_DEFINE(MACOSX, 1, [Compiling on Mac OS X])
|
||||
LIBS="$LIBS -framework CoreMIDI -framework AudioUnit -framework AudioToolbox"
|
||||
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2).])
|
||||
;;
|
||||
*-*-linux*)
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#ifndef DOSBOX_MIDI_H
|
||||
#define DOSBOX_MIDI_H
|
||||
|
||||
#ifndef DOSBOX_DOSBOX_H
|
||||
#include "dosbox.h"
|
||||
#endif
|
||||
|
||||
#ifndef DOSBOX_PROGRAMS_H
|
||||
#include "programs.h"
|
||||
#endif
|
||||
|
@ -27,7 +31,10 @@
|
|||
class MidiHandler {
|
||||
public:
|
||||
MidiHandler();
|
||||
virtual bool Open(const char * /*conf*/) { return true; };
|
||||
virtual bool Open(const char * /*conf*/) {
|
||||
LOG_MSG("No working midi device found/selected! Please check your settings and/or compilation environment.");
|
||||
return true;
|
||||
};
|
||||
virtual void Close(void) {};
|
||||
virtual void PlayMsg(Bit8u * /*msg*/) {};
|
||||
virtual void PlaySysex(Bit8u * /*sysex*/,Bitu /*len*/) {};
|
||||
|
|
|
@ -68,12 +68,18 @@ MidiHandler::MidiHandler(){
|
|||
|
||||
MidiHandler Midi_none;
|
||||
|
||||
/* Include different midi drivers, lowest ones get checked first for default */
|
||||
/* Include different midi drivers, lowest ones get checked first for default.
|
||||
Each header provides an independent midi interface. */
|
||||
|
||||
#if defined(MACOSX)
|
||||
|
||||
#if defined(C_SUPPORTS_COREMIDI)
|
||||
#include "midi_coremidi.h"
|
||||
#endif
|
||||
|
||||
#if defined(C_SUPPORTS_COREAUDIO)
|
||||
#include "midi_coreaudio.h"
|
||||
#endif
|
||||
|
||||
#elif defined (WIN32)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue