Closed tatokis closed 4 years ago
this seems to be a glibc specific macro. Are you sure this won't break for example some BSD variants?
Can you please remind me: What was the reason we needed _GNU_SOURCE
/_DEFAULT_SOURCE
/... in the first place?
@ValleyBell if I'm not mistaken, gcc by default compiles code as -std=gnu90. I don't remember off the top of my head why, but I needed -std=c99, which means certain functions such as usleep, clock_gettime and strdup are undefined. Adding the _DEFAULT_SOURCE/_GNU_SOURCE definitions makes glibc define those.
@superctr musl and other libcs should support _GNU_SOURCE.
BSDs shouldn't be affected by _GNU_SOURCE.
That said usleep is undefined in FreeBSD with both DBUS=0 and DBUS=1. It also fails to compile because it tries to include <linux/soundcard.h>, but that's an easy fix.
Another error happens dueto the sed command I use to generate the XDG .desktop file, as I used a GNU specific one. It is, however, also not related to the issue.
gmake --ignore-errors
(with DBUS=1) results in a working build that just throws an error at sed.
Perhaps we should also change this to something that includes all BSDs, as it's resposible for including linux/soundcard.h
Stream.c:#elif defined(__APPLE__) || defined(__OpenBSD__)
Output from branch dated before DBUS support was merged:
Another thing I noticed, is that audio is sped up when running vgmplay in FreeBSD, however I am not sure what the cause of that is, and it's the same with both DBUS=0 and DBUS=1. Perhaps it's related to usleep?
Either way, to sum it up, in FreeBSD with both DBUS=1 (_GNU_SOURCE) and DBUS=0 it behaves the same way.
Old distros seem to have trouble with _DEFAULT_SOURCE, so instead of additionally defining _BSD_SOURCE and _POSIX_C_SOURCE, use _GNU_SOURCE instead as it implies both and more.
https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html