Browse Source

allow disabling ALSA in command-line when compiling

Wei Mingzhi 6 years ago
parent
commit
28e861dac9
2 changed files with 5 additions and 6 deletions
  1. 3 3
      native_midi/native_midi_common.c
  2. 2 3
      unix/Makefile

+ 3 - 3
native_midi/native_midi_common.c

@@ -295,19 +295,19 @@ static int ReadMIDIFile(MIDIFile *mididata, SDL_RWops *rw)
 	SDL_RWread(rw, &ID, 1, 4);
 	if (BE_LONG(ID) != 'MThd')
 		return 0;
-	
+
 	/* Header size must be 6 */
 	SDL_RWread(rw, &size, 1, 4);
 	size = BE_LONG(size);
 	if (size != 6)
 		return 0;
-	
+
 	/* We only support format 0 and 1, but not 2 */
 	SDL_RWread(rw, &format, 1, 2);
 	format = BE_SHORT(format);
 	if (format != 0 && format != 1)
 		return 0;
-	
+
 	SDL_RWread(rw, &tracks, 1, 2);
 	tracks = BE_SHORT(tracks);
 	mididata->nTracks = tracks;

+ 2 - 3
unix/Makefile

@@ -14,9 +14,8 @@ DEPFLAGS = -MT $@ -MMD -MP -MF $*$(INTER).Td
 
 GTEST_DIR = ../3rd/googletest/googletest
 
-
-ALSA_INSTALLED := $(shell echo "int main(){}" | gcc -o /dev/null -x c - -lasound 2>/dev/null && echo found)
-ifdef ALSA_INSTALLED
+USE_ALSA ?= $(shell echo "int main(){}" | gcc -o /dev/null -x c - -lasound 2>/dev/null && echo 1)
+ifeq (${USE_ALSA},1)
 	MIDI_CFILES = $(wildcard ../native_midi/*.c) native_midi_alsa.c
 	MIDI_CPPFILES =
 	MIDI_LDFLAGS = -lasound