Skip to content
Snippets Groups Projects
Commit a651a3ab authored by deuce's avatar deuce
Browse files

On the BSDs, the speaker device headers only exist on platforms which

support it.  Therefore, check for the appropriate header, and make the
/dev/speaker code dependant on it.
parent 7957b116
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,14 @@ ifeq ($(shell if [ -c /dev/random ] ; then echo YES ; fi),YES)
XPDEV-MT_CFLAGS += -DHAS_DEV_RANDOM -DRANDOM_DEV=\"/dev/random\"
XPDEV_CFLAGS += -DHAS_DEV_RANDOM -DRANDOM_DEV=\"/dev/random\"
endif
ifeq ($(shell if [ -f /usr/include/machine/speaker.h ] ; then echo YES ; fi),YES)
XPDEV-MT_CFLAGS += -DHAS_MACHINE_SPEAKER_H
XPDEV_CFLAGS += -DHAS_MACHINE_SPEAKER_H
endif
ifeq ($(shell if [ -f /usr/include/machine/spkr.h ] ; then echo YES ; fi),YES)
XPDEV-MT_CFLAGS += -DHAS_MACHINE_SPKR_H
XPDEV_CFLAGS += -DHAS_MACHINE_SPKR_H
endif
# FreeBSD, OpenBSD, NetBSD, Linux, SunOS, and Darwin all have random()/srandom()
ifeq ($(os),freebsd)
......
......@@ -31,9 +31,9 @@
#include <sys/kbio.h>
#include <sys/kbd.h>
#endif
#if defined(__OpenBSD__) || defined(__NetBSD__)
#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(HAS_MACHINE_SPKR_H)
#include <machine/spkr.h>
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__) && defined(HAS_MACHINE_SPEAKER_H)
#include <machine/speaker.h>
#endif
#endif
......@@ -354,7 +354,7 @@ void DLLCALL unix_beep(int freq, int dur)
{
static int console_fd=-1;
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
#if (defined(__FreeBSD__) && defined(HAS_MACHINE_SPEAKER_H)) || ((defined(__OpenBSD__) || defined(__NetBSD__)) && defined(HAS_MACHINE_SPKR_H))
int speaker_fd=-1;
tone_t tone;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment