diff --git a/build/openal.cbd b/build/openal.cbd
index d18e62d..74af061 100644
--- a/build/openal.cbd
+++ b/build/openal.cbd
@@ -23,7 +23,7 @@ CFLAGS += ' -DUSE_OPENAL'
 # --
 
 do ifplat unix
-   LDFLAGS += ' `openal-config --libs`'
+   LDFLAGS += ' -lopenal'
 else
    LDFLAGS += ' -lOpenAL32'
 done
diff --git a/build/alleggl.cbd b/build/alleggl.cbd
index e2708ff..e826371 100644
--- a/build/alleggl.cbd
+++ b/build/alleggl.cbd
@@ -22,7 +22,7 @@ CFLAGS += ' -DUSE_ALLEGROGL'
 
 # --
 
-LIBAGL = agl
+LIBAGL = alleggl
 
 ifopt debug LIBAGL = 'agld'

diff --git a/src/apu.cpp b/src/apu.cpp
index af59f1c..893a798 100644
--- a/src/apu.cpp
+++ b/src/apu.cpp
@@ -1930,7 +1930,7 @@ static void amplify(real& sample)
          gain -= releaseRate;
       }
 
-      real output = (1.0 / max(gain, EPSILON));
+      real output = (1.0 / MAX(gain, EPSILON));
       output = fixf(output, apu_agc_gain_floor, apu_agc_gain_ceiling);
       sample *= output;
    }
diff --git a/src/audio.cpp b/src/audio.cpp
index b9650dc..c21c05e 100644
--- a/src/audio.cpp
+++ b/src/audio.cpp
@@ -7,6 +7,7 @@
    You must read and accept the license prior to use. */
 
 #include <allegro.h>
+#include <cstdio>
 #include <cstdlib>
 #include <cstring>
 #include <vector>
@@ -234,7 +235,7 @@ void audio_update(void)
          const unsigned queuedFrames = (audioQueue.size() / audio_channels);
          if(queuedFrames > 0) {
             // Determine how many frames we want to make room for.
-            const unsigned framesToAdd = min(queuedFrames, audio_buffer_size_frames);
+            const unsigned framesToAdd = MIN(queuedFrames, audio_buffer_size_frames);
             // Make room for the frames in the buffer.
             const unsigned framesToMove = (audioBufferedFrames - framesToAdd);
             if(framesToMove > 0) {
@@ -258,7 +259,7 @@ void audio_update(void)
          // Determine how many frames are available in the buffer.
          const unsigned bufferableFrames = (audio_buffer_size_frames - audioBufferedFrames);
          // Determine the number of frames to copy to the buffer.
-         const unsigned framesToCopy = min(queuedFrames, bufferableFrames);
+         const unsigned framesToCopy = MIN(queuedFrames, bufferableFrames);
 
          // Copy frames to the buffer.
          for(unsigned frame = 0; frame < framesToCopy; frame++) {
diff --git a/src/include/common.h b/src/include/common.h
index be28795..e2d21d1 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -41,8 +41,10 @@ extern "C" {
 #define true   TRUE
 #define false  FALSE
 
+/*
 #define min(x,y)   MIN((x),(y))
 #define max(x,y)   MAX((x),(y))
+*/
 
 #define true_or_false(x)   ((x) ? true : false)
 
