Index: mac_files/gtk-2.0/gtk.immodules
===================================================================
--- mac_files/gtk-2.0/gtk.immodules	(revision 0)
+++ mac_files/gtk-2.0/gtk.immodules	(revision 0)
@@ -0,0 +1,34 @@
+# GTK+ Input Method Modules file
+# Automatically generated file, do not edit
+#
+# ModulesPath = /var/root/.gtk-2.0/2.4.0/powerpc-apple-darwin7.6.0/immodules:/var/root/.gtk-2.0/2.4.0/immodules:/var/root/.gtk-2.0/powerpc-apple-darwin7.6.0/immodules:/var/root/.gtk-2.0/immodules:${DYLD_LIBRARY_PATH}/gtk-2.0/2.4.0/powerpc-apple-darwin7.6.0/immodules:${CWD}/lib/gtk-2.0/2.4.0/immodules:${CWD}/lib/gtk-2.0/powerpc-apple-darwin7.6.0/immodules:${CWD}/lib/gtk-2.0/immodules
+#
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-am-et.so" 
+"am_et" "Amharic (EZ+)" "gtk20" "${CWD}/share/locale" "am" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-cedilla.so" 
+"cedilla" "Cedilla" "gtk+" "${CWD}/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-cyrillic-translit.so" 
+"cyrillic_translit" "Cyrillic (Transliterated)" "gtk20" "${CWD}/share/locale" "" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-inuktitut.so" 
+"inuktitut" "Inukitut (Transliterated)" "gtk20" "${CWD}/share/locale" "iu" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-ipa.so" 
+"ipa" "IPA" "gtk20" "${CWD}/share/locale" "" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-thai-broken.so" 
+"thai_broken" "Thai (Broken)" "gtk20" "${CWD}/share/locale" "" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-ti-er.so" 
+"ti_er" "Tigrigna-Eritrean (EZ+)" "gtk20" "${CWD}/share/locale" "ti" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-ti-et.so" 
+"ti_et" "Tigrigna-Ethiopian (EZ+)" "gtk20" "${CWD}/share/locale" "ti" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-viqr.so" 
+"viqr" "Vietnamese (VIQR)" "gtk20" "${CWD}/share/locale" "vi" 
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/immodules/im-xim.so" 
+"xim" "X Input Method" "gtk20" "${CWD}/share/locale" "ko:ja:th:zh" 
Index: mac_files/gtk-2.0/gdk-pixbuf.loaders
===================================================================
--- mac_files/gtk-2.0/gdk-pixbuf.loaders	(revision 0)
+++ mac_files/gtk-2.0/gdk-pixbuf.loaders	(revision 0)
@@ -0,0 +1,113 @@
+# GdkPixbuf Image Loader Modules file
+# Automatically generated file, do not edit
+#
+# LoaderDir = ${CWD}/lib/gtk-2.0/2.10.0/loaders
+#
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/io-wmf.so"
+"wmf" 0 "gtk20" "Windows Metafile"
+"image/x-wmf" ""
+"wmf" ""
+"\327\315\306\232" "" 100
+"\001" "" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-ani.so"
+"ani" 0 "gtk20" "The ANI image format"
+"application/x-navi-animation" ""
+"ani" ""
+"RIFF    ACON" "    xxxx    " 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-bmp.so"
+"bmp" 0 "gtk20" "The BMP image format"
+"image/bmp" "image/x-bmp" "image/x-MS-bmp" ""
+"bmp" ""
+"BM" "" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-gif.so"
+"gif" 0 "gtk20" "The GIF image format"
+"image/gif" ""
+"gif" ""
+"GIF8" "" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-ico.so"
+"ico" 1 "gtk20" "The ICO image format"
+"image/x-icon" ""
+"ico" "cur" ""
+"  \001   " "zz znz" 100
+"  \002   " "zz znz" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-jpeg.so"
+"jpeg" 1 "gtk20" "The JPEG image format"
+"image/jpeg" ""
+"jpeg" "jpe" "jpg" ""
+"\377\330" "" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-pcx.so"
+"pcx" 0 "gtk20" "The PCX image format"
+"image/x-pcx" ""
+"pcx" ""
+"\n \001" "" 100
+"\n\002\001" "" 100
+"\n\003\001" "" 100
+"\n\004\001" "" 100
+"\n\005\001" "" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-png.so"
+"png" 1 "gtk20" "The PNG image format"
+"image/png" ""
+"png" ""
+"\211PNG\r\n\032\n" "" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-pnm.so"
+"pnm" 0 "gtk20" "The PNM/PBM/PGM/PPM image format family"
+"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" ""
+"pnm" "pbm" "pgm" "ppm" ""
+"P1" "" 100
+"P2" "" 100
+"P3" "" 100
+"P4" "" 100
+"P5" "" 100
+"P6" "" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-ras.so"
+"ras" 0 "gtk20" "The Sun raster image format"
+"image/x-cmu-raster" "image/x-sun-raster" ""
+"ras" ""
+"Y\246j\225" "" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-tga.so"
+"tga" 0 "gtk20" "The Targa image format"
+"image/x-tga" ""
+"tga" "targa" ""
+" \001\001" "x  " 100
+" \001\t" "x  " 100
+"  \002" "xz " 99
+"  \003" "xz " 100
+"  \n" "xz " 100
+"  \013" "xz " 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-tiff.so"
+"tiff" 0 "gtk20" "The TIFF image format"
+"image/tiff" ""
+"tiff" "tif" ""
+"MM *" "  z " 100
+"II* " "   z" 100
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-wbmp.so"
+"wbmp" 0 "gtk20" "The WBMP image format"
+"image/vnd.wap.wbmp" ""
+"wbmp" ""
+" " "z" 1
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-xbm.so"
+"xbm" 0 "gtk20" "The XBM image format"
+"image/x-xbitmap" ""
+"xbm" ""
+"#define " "" 100
+"/*" "" 50
+
+"${DYLD_LIBRARY_PATH}/gtk-2.0/2.10.0/loaders/libpixbufloader-xpm.so"
+"xpm" 0 "gtk20" "The XPM image format"
+"image/x-xpixmap" ""
+"xpm" ""
+"/* XPM */" "" 100
+
Index: mac_files/Info.plist
===================================================================
--- mac_files/Info.plist	(revision 0)
+++ mac_files/Info.plist	(revision 0)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleDocumentTypes</key>
+	<array>
+		<dict>
+			<key>CFBundleTypeExtensions</key>
+			<array>
+				<string>aqualung</string>
+			</array>
+			<key>CFBundleTypeOSTypes</key>
+			<array>
+				<string>****</string>
+				<string>fold</string>
+			</array>
+			<key>CFBundleTypeRole</key>
+			<string>Viewer</string>
+		</dict>
+	</array>
+	<key>CFBundleExecutable</key>
+	<string>aqualung</string>
+	<key>CFBundleGetInfoString</key>
+	<string>Aqualung</string>
+	<key>CFBundleIconFile</key>
+	<string>appIcon.icns</string>
+	<key>CFBundleIdentifier</key>
+	<string>net.sourceforge.aqualung</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>Aqualung</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersions</key>
+	<string>0.9beta</string>
+	<key>CFBundleSignature</key>
+	<string>Aqlg</string>
+	<key>CFBundleVersion</key>
+	<string>0.9beta</string>
+	<key>LSUIElement</key>
+	<string>0</string>
+	<key>NSMainNibFile</key>
+	<string>MainMenu</string>
+	<key>NSPrincipalClass</key>
+	<string>NSApplication</string>
+</dict>
+</plist>
Index: mac_files/aqualung.bundle
===================================================================
--- mac_files/aqualung.bundle	(revision 0)
+++ mac_files/aqualung.bundle	(revision 0)
@@ -0,0 +1,33 @@
+<?xml version="1.0"?> <!--*- mode: xml -*-->
+<app-bundle>
+	<meta>
+		<prefix name="aqualung">/opt/aqualung/</prefix>
+		<prefix name="default">${env:PREFIX}</prefix>
+		<!-- <prefix name="opt">/opt/local/</prefix> -->
+		<prefix name="usr">/usr/local</prefix>
+		<prefix name="gtk">/opt/aqualung/gtk/inst</prefix>
+		<!-- <prefix name="frameworks">/Library/Frameworks</prefix> -->
+		<destination overwrite="yes">${env:HOME}/Desktop</destination>
+	</meta>
+
+	
+	<plist>${project}/Info.plist</plist>
+
+	<!-- Optionally specify a launcher script to use. Builtin script is
+		used if not specified.  -->
+	<!--launcher-script>${prefix}/launcher.sh</launcher-script-->
+
+	<!-- The executable for the application -->
+  	<main-binary>${prefix:aqualung}/bin/aqualung</main-binary>
+
+	<!-- Modules for GTK+ (image loaders, etc) -->
+	<binary>${prefix:aqualung}/bin</binary>
+<!--	<binary>${prefix:aqualung}/lib</binary> -->
+        <binary>${prefix:gtk}/lib/gtk-2.0/2.10.0/loaders</binary>
+	<binary>${prefix:gtk}/lib/gtk-2.0/2.10.0/immodules</binary>
+
+	<!-- Any additional data, like images, or Glade files -->
+	<data dest="${bundle}/Contents/Resources/share/aqualung">${project}/share/aqualung</data>
+	<data dest="${bundle}/Contents/Resources">${project}/share/aqualung/appIcon.icns</data>
+	<data dest="${bundle}/Contents/Resources/etc/gtk-2.0">${project}/etc/gtk-2.0</data>
+</app-bundle>
\ No newline at end of file
Index: src/utils.c
===================================================================
--- src/utils.c	(revision 1043)
+++ src/utils.c	(working copy)
@@ -31,6 +31,13 @@
 #include "httpc.h"
 #include "utils.h"
 
+#ifdef DARWIN
+#include <string.h>
+// Variables to replace the #define'd constants on OS X
+  char d[256];
+  char p[256];
+  char e[256];
+#endif
 
 extern options_t options;
 
@@ -645,7 +652,78 @@
 	xml_load_int(doc, node, name, var + idx);
 }
 
+#ifdef DARWIN
+int osx_scandir(const char * dirname, struct dirent *** namelist,
+		int (*selector)(const struct dirent *),
+		int (*cmp)(const void *, const void *)) {
 
+	int no = 0;
+	*namelist = NULL;
+	char * entry;
+	struct dirent * de;
+	GDir * dir = g_dir_open(dirname, 0, NULL);
+	if (dir == NULL)
+		return -1;
 
+	while ((entry = (char *)g_dir_read_name(dir)) != NULL) {
+
+		char fullname[MAXLEN];
+
+		if ((de = malloc(sizeof(struct dirent))) == NULL) {
+			return 0;
+		}
+
+		strcpy(de->d_name, entry);
+		snprintf(fullname, MAXLEN-1, "%s" PATHSEP "%s", dirname, de->d_name);
+
+		if (g_file_test(fullname, G_FILE_TEST_IS_REGULAR)) {
+			de->d_type = DT_REG;
+		} else if (g_file_test(fullname, G_FILE_TEST_IS_SYMLINK)) {
+			de->d_type = DT_LNK;
+		} else if (g_file_test(fullname, G_FILE_TEST_IS_DIR)) {
+			de->d_type = DT_DIR;
+		} else {
+			de->d_type = DT_UNKNOWN;
+		}
+
+		if ((selector != NULL) && (selector(de) == 0)) {
+			continue;
+		}
+
+		*namelist = realloc(*namelist, (no+1) * sizeof(struct dirent *));
+		(*namelist)[no] = de;
+		++no;
+	}
+
+	g_dir_close(dir);
+
+	qsort(*namelist, no, sizeof(struct dirent *), cmp);
+
+	return no;
+}
+
+char* osx_data_dir()
+{
+	snprintf(d, 255, "%s/aqualung", getenv("XDG_DATA_DIRS"));
+	printf("Result of osx_data_dir() = %s\n", d);
+	return d;
+}
+
+char* osx_skin_dir()
+{
+	snprintf(p, 255, "%s/skin", osx_data_dir());
+	printf("Result of osx_skin_dir() = %s\n", p);
+	return p;
+}
+
+char* osx_locale_dir()
+{
+
+	snprintf(e, 255, "%s/locale", osx_data_dir());
+	printf("Result of osx_locale_dir() = %s\n", e);
+	return e;
+}
+#endif
+
 // vim: shiftwidth=8:tabstop=8:softtabstop=8:
 
Index: src/utils.h
===================================================================
--- src/utils.h	(revision 1043)
+++ src/utils.h	(working copy)
@@ -24,6 +24,27 @@
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 
+#ifdef DARWIN
+#include <sys/types.h>
+#include <sys/dir.h>
+#include <sys/dirent.h>
+
+#define PATHSEP ":"
+#define scandir osx_scandir
+
+#define AQUALUNG_SKINDIR osx_skin_dir()
+#define AQUALUNG_DATADIR osx_data_dir()
+#define AQUALUNG_LOCALEDIR osx_locale_dir()
+
+// Functions to call since a #define'd constant
+// does not work for a bundle that can be installed nearly anywhere
+#include <string.h>
+
+char* osx_data_dir();
+char* osx_skin_dir();
+char* osx_locale_dir();
+#endif
+
 #include <config.h>
 #include "common.h"
 
@@ -90,6 +111,11 @@
 void xml_load_float(xmlDocPtr doc, xmlNodePtr node, char * varname, float * var);
 void xml_load_int_array(xmlDocPtr doc, xmlNodePtr node, char * varname, int * var, int idx);
 
+#ifdef DARWIN
+int osx_scandir(const char * dir, struct dirent *** namelist,
+	    int (*selector)(const struct dirent *),
+	    int (*cmp)(const void *, const void *));
+#endif
 
 #endif /* _UTILS_H */
 
Index: src/transceiver.c
===================================================================
--- src/transceiver.c	(revision 1043)
+++ src/transceiver.c	(working copy)
@@ -29,7 +29,12 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+
+#ifndef DARWIN
 #include <gdk/gdkx.h>
+#else
+#include <glib.h>
+#endif
 
 #include "common.h"
 #include "transceiver.h"
Index: src/gui_main.c
===================================================================
--- src/gui_main.c	(revision 1043)
+++ src/gui_main.c	(working copy)
@@ -2330,14 +2330,20 @@
 
         GdkPixbuf * pixbuf;
 	GtkWidget * widget;
+	GError	  * gerror = 0;
 
 	if ((widget = gtk_bin_get_child(GTK_BIN(button))) != NULL) {
+		fprintf(stderr, "Destroying widget.\n");
 		gtk_widget_destroy(widget);
 	}
 
-	if ((pixbuf = gdk_pixbuf_new_from_file(imgpath, NULL)) != NULL) {
+	if ((pixbuf = gdk_pixbuf_new_from_file(imgpath, &gerror)) != NULL) {
 		widget = gtk_image_new_from_pixbuf(pixbuf);
+		fprintf(stderr, "Getting new image at: %s\n", imgpath);
 	} else {
+		if (&gerror != NULL) {
+			fprintf(stderr, "Error Message: %s\n", gerror->message);
+		}
 		widget = gtk_label_new(alt);
 	}
 
@@ -2351,8 +2357,10 @@
 	char path[MAXLEN];
 
 	sprintf(path, "%s/%s", skin_path, "prev.png");
+	fprintf(stderr, "%s/%s\n", skin_path, "prev.png");
 	button_set_content(prev_button, path, "prev");
 	sprintf(path, "%s/%s", skin_path, "stop.png");
+	fprintf(stderr, "%s/%s\n", skin_path, "stop.png");
 	button_set_content(stop_button, path, "stop");
 	sprintf(path, "%s/%s", skin_path, "next.png");
 	button_set_content(next_button, path, "next");
Index: src/decoder/dec_mod.h
===================================================================
--- src/decoder/dec_mod.h	(revision 1043)
+++ src/decoder/dec_mod.h	(working copy)
@@ -24,7 +24,7 @@
 
 #ifdef HAVE_MOD
 #include <sys/mman.h>
-#ifdef __FreeBSD__
+#if defined (__FreeBSD__) || defined (DARWIN)
 #include <sys/types.h>
 #endif /* __FreeBSD__ */
 #include <sys/stat.h>
Index: src/skin.c
===================================================================
--- src/skin.c	(revision 1043)
+++ src/skin.c	(working copy)
@@ -35,6 +35,10 @@
 #include "i18n.h"
 #include "skin.h"
 
+#ifdef DARWIN
+#include "utils.h"
+#endif
+
 extern options_t options;
 
 extern GtkWidget * main_window;
@@ -58,6 +62,9 @@
 
 	char rcpath[MAXLEN];
 	
+	// TODO: Figure out why the button skins are not being applied properly.  I can't figure this out
+	fprintf(stderr, "This is the skin path attempting to apply: %s\n", path);
+	// That was a debug line not needed.
 	sprintf(rcpath, "%s/rc", path);
 	gtk_rc_parse(rcpath);
 
Index: src/about.c
===================================================================
--- src/about.c	(revision 1043)
+++ src/about.c	(working copy)
@@ -28,6 +28,7 @@
 #include "version.h"
 #include "i18n.h"
 #include "about.h"
+#include "utils.h"
 
 
 GtkWidget * about_window;
Index: src/plugin.c
===================================================================
--- src/plugin.c	(revision 1043)
+++ src/plugin.c	(working copy)
@@ -42,8 +42,11 @@
 #include "trashlist.h"
 #include "plugin.h"
 
+#ifdef DARWIN
+#include "utils.h"
+#endif
 
-#ifdef __FreeBSD__
+#if defined (__FreeBSD__) || defined (DARWIN)
 #define dirent64 dirent
 #define scandir64 scandir
 #define alphasort64 alphasort
@@ -152,7 +155,11 @@
 	if ((str = getenv("LADSPA_RDF_PATH"))) {
 		snprintf(lrdf_path, MAXLEN-1, "%s:", str);
 	} else {
+#ifndef DARWIN
                 strncat(lrdf_path, "/usr/local/share/ladspa/rdf:/usr/share/ladspa/rdf:", MAXLEN-1);
+#else
+                strncat(lrdf_path, "/Library/Audio/Plug-Ins/LADSPA/rdf:", MAXLEN-1);
+#endif
 	}
 
 	for (i = 0; lrdf_path[i] != '\0'; i++) {
@@ -298,8 +305,12 @@
 	char * directory;
 
 	if (!(ladspa_path = getenv("LADSPA_PATH"))) {
+#ifdef DARWIN
+		find_plugins("/Library/Audio/Plug-Ins/LADSPA");
+#else
 		find_plugins("/usr/lib/ladspa");
 		find_plugins("/usr/local/lib/ladspa");
+#endif /* DARWIN */
 	} else {
 		ladspa_path = strdup(ladspa_path);
 		directory = strtok(ladspa_path, ":");
Index: src/build_store.c
===================================================================
--- src/build_store.c	(revision 1043)
+++ src/build_store.c	(working copy)
@@ -32,7 +32,7 @@
 #include <gtk/gtk.h>
 #include <sys/stat.h>
 
-#ifdef _WIN32
+#if defined (_WIN32)
 #include <glib.h>
 #else
 #include <pthread.h>
@@ -50,7 +50,6 @@
 #include "build_store.h"
 #include "cddb_lookup.h"
 
-
 extern options_t options;
 extern GtkTreeStore * music_store;
 
Index: src/cover.c
===================================================================
--- src/cover.c	(revision 1043)
+++ src/cover.c	(working copy)
@@ -38,6 +38,10 @@
 #include "i18n.h"
 #include "options.h"
 
+#ifdef DARWIN
+#include "utils.h"
+#endif
+
 extern options_t options;
 
 extern gint cover_show_flag;
Index: configure.ac
===================================================================
--- configure.ac	(revision 1043)
+++ configure.ac	(working copy)
@@ -34,6 +34,7 @@
    freebsd="no"
    openbsd="no"
    linux="no"
+   darwin="no"
    if test "$buildtype" = "debug"; then
 	   AC_MSG_ERROR([Sorry, debug build under Cygwin is unsupported!])
    fi
@@ -47,6 +48,7 @@
    freebsd="yes"
    openbsd="no"
    linux="no"
+   darwin="no"
    if test "$buildtype" = "debug"; then
 	   AC_MSG_ERROR([Sorry, debug build under FreeBSD is unsupported!])
    fi
@@ -60,6 +62,7 @@
    freebsd="no"
    openbsd="yes"
    linux="no"
+   darwin="no"
    if test "$buildtype" = "debug"; then
 	   AC_MSG_ERROR([Sorry, debug build under OpenBSD is unsupported!])
    fi
@@ -73,12 +76,29 @@
    freebsd="no"
    openbsd="no"
    linux="yes"
+   darwin="no"
    platform="Linux"
    AC_MSG_RESULT(Linux)
 fi
+if test `uname -a | grep Darwin | wc -l` = "1"  ; then
+   PLATFORM_CFLAGS=""
+   PLATFORM_LIBS=""
+   win32="no"
+   freebsd="no"
+   openbsd="no"
+   linux="no"
+   darwin="yes"
+   if test "$buildtype" = "debug"; then
+     AC_MSG_ERROR([Sorry, debug build under Darwin is unsupported!])
+   fi
+   platform="Darwin"
+   AC_MSG_RESULT(Darwin)
+   AC_DEFINE([DARWIN], [1], [Defined if Darwin platform is detected.])
+fi
 
 
 
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_RANLIB
@@ -686,11 +706,22 @@
 if test "$cdda" = "no"; then
 	AC_MSG_RESULT(no)
 else
-        if test $win32 = "no" ; then
-	        AC_CHECK_LIB(cdio, cdio_open, [lib=yes], [lib=no])
-        else
+        if test "$win32" = "yes" ; then
 	        AC_CHECK_LIB(cdio, cdio_open, [lib=yes], [lib=no], [-lwinmm])
         fi
+        if test "$freebsd" = "yes" ; then
+          AC_CHECK_LIB(cdio, cdio_open, [lib=yes], [lib=no])
+        fi
+        if test "$openbsd" = "yes" ; then
+          AC_CHECK_LIB(cdio, cdio_open, [lib=yes], [lib=no])
+        fi
+        if test "$linux" = "yes" ; then
+          AC_CHECK_LIB(cdio, cdio_open, [lib=yes], [lib=no])
+        fi
+        if test "$darwin" = "yes" ; then
+          AC_CHECK_LIB(cdio, cdio_open, [lib=yes], [lib=no]. [-lcdio])
+        fi
+
 	if test "$lib" = "yes"; then
 		AC_MSG_CHECKING(whether libcdio_paranoia version >= 0.76)
 		if `pkg-config --exists 'libcdio_paranoia >= 0.76'`; then
@@ -841,11 +872,18 @@
 
 
 # Compiler and linker variables
+if test "$darwin" = "no" ; then
 AQUALUNG_SKINDIR="-DAQUALUNG_SKINDIR=\\\"$datadir/aqualung/skin\\\""
+fi
 AQUALUNG_LOCALEDIR="-DAQUALUNG_LOCALEDIR=\\\"$datadir/locale\\\""
 AQUALUNG_DATADIR="-DAQUALUNG_DATADIR=\\\"$datadir/aqualung\\\""
 
+if test "$darwin" = "yes" ; then
+  CFLAGS="$CFLAGS $BUILD_CFLAGS -Wall $PLATFORM_CFLAGS -D_GNU_SOURCE"
+fi
+if test "$darwin" = "no" ; then
 CFLAGS="$CFLAGS $BUILD_CFLAGS -Wall $PLATFORM_CFLAGS $AQUALUNG_SKINDIR $AQUALUNG_LOCALEDIR $AQUALUNG_DATADIR -D_GNU_SOURCE"
+fi
 CXXFLAGS="$CFLAGS"
 CPPFLAGS="$gtk_CFLAGS $glib_CFLAGS $xml_CFLAGS $alsa_CFLAGS $jack_CFLAGS $cdda_CFLAGS"
 LIBS="decoder/libdecoder.a encoder/libencoder.a $gtk_LIBS $glib_LIBS $xml_LIBS $jack_LIBS $lrdf_LIBS $src_LIBS $alsa_LIBS $sndio_LIBS $oss_LIBS $sndfile_LIBS $flac_LIBS $ogg_LIBS $wavpack_LIBS $speex_LIBS $mad_LIBS $mod_LIBS $mpc_LIBS $mac_LIBS $lavc_LIBS $vorbisenc_LIBS $lame_LIBS $cdda_LIBS $cddb_LIBS $ifp_LIBS $PLATFORM_LIBS $z_LIBS $bz2_LIBS"

