Commit 28f25da6c34f7f6c3c1aa19346f3b964c5481c9c

Thomas de Grivel 2020-05-07T16:02:43

fix compilation and loading on windows

diff --git a/Makefile.am b/Makefile.am
index 2ae2a68..6fbb2c5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,2 @@
 
 SUBDIRS = librtbuf cli gtk lib
-
-if ENABLE_NSIS
-rtbuf-${PACKAGE_VERSION}_setup.exe: .libs/rtbuf.exe .libs/rtbuf-gtk.exe
-	makensis rtbuf.nsi
-all: rtbuf-${PACKAGE_VERSION}_setup.exe
-endif # ENABLE_NSIS
diff --git a/configure.ac b/configure.ac
index ff0d9cb..8d98a7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ if test -d /usr/lib; then
 fi
 
 CPPFLAGS="-I${PWD}/librtbuf/include -I${PWD}/lib/include $CPPFLAGS"
-CFLAGS="-std=c89 -W -Wall -Werror"
+CFLAGS="$CFLAGS -std=c89 -W -Wall -Werror -D_BSD_SOURCE"
 
 AC_CHECK_FUNC([strlcpy], [echo using system strlcpy],
 	      AC_SEARCH_LIBS([strlcpy], [bsd],
diff --git a/gtk/rtbuf_gtk_library.c b/gtk/rtbuf_gtk_library.c
index aae3bf3..fc1f56b 100644
--- a/gtk/rtbuf_gtk_library.c
+++ b/gtk/rtbuf_gtk_library.c
@@ -142,8 +142,8 @@ void rtbuf_gtk_library_load_file (const char *path, size_t prefix_len)
     rtbuf_gtk_library_load_file_1(path, len, prefix_len, 3);
   else if (strncmp(&path[len - 7], ".so.0.0", 7) == 0)
     rtbuf_gtk_library_load_file_1(path, len, prefix_len, 7);
-  else if (strncmp(&path[len - 4], ".dll", 4) == 0)
-    rtbuf_gtk_library_load_file_1(path, len, prefix_len, 4);
+  else if (strncmp(&path[len - 6], "-0.dll", 6) == 0)
+    rtbuf_gtk_library_load_file_1(path, len, prefix_len, 6);
 }
 
 int is_directory (const char *path)
diff --git a/lib/music.c b/lib/music.c
index c1c9c56..a2fd911 100644
--- a/lib/music.c
+++ b/lib/music.c
@@ -20,9 +20,6 @@
 #include <rtbuf/rtbuf.h>
 #include <rtbuf/music.h>
 
-extern double log2 (double);
-extern double exp2 (double);
-
 int    g_rtbuf_music_init = 0;
 double g_rtbuf_music_tune = 0.0;
 
diff --git a/lib/portaudio/Makefile.am b/lib/portaudio/Makefile.am
index a2aa5f0..5bebc5d 100644
--- a/lib/portaudio/Makefile.am
+++ b/lib/portaudio/Makefile.am
@@ -1,3 +1,4 @@
+if ENABLE_PORTAUDIO
 CLEANFILES =
 rtbuf_includedir = $(includedir)/rtbuf/portaudio
 rtbuf_include_HEADERS =
@@ -11,3 +12,4 @@ input_la_LIBADD = ${PORTAUDIO_LIBS} ../librtbuf_signal.la
 rtbuf_lib_LTLIBRARIES += output.la
 output_la_LDFLAGS = -no-undefined -module -shared
 output_la_LIBADD = ${PORTAUDIO_LIBS} ../librtbuf_signal.la
+endif
diff --git a/librtbuf/rtbuf_lib.c b/librtbuf/rtbuf_lib.c
index e08d7d3..bf0e875 100644
--- a/librtbuf/rtbuf_lib.c
+++ b/librtbuf/rtbuf_lib.c
@@ -122,7 +122,7 @@ const char * rtbuf_lib_find_in_path (const char *name)
     if (access(lib_path, R_OK) == 0)
       return lib_path;
     g_str_reset(ext);
-    g_str_append(".dll", 5);
+    g_str_append("-0.dll", 7);
     printf("lib find in path \"%s\"\n", lib_path);
     if (access(lib_path, R_OK) == 0)
       return lib_path;