- audio_linux.cpp renamed to audio_oss_esd.cpp (now also used under FreeBSD)

and added support for ESD
- medium removal is allowed for CD-ROM on exit
- added mkinstalldirs to "make install" target
This commit is contained in:
cebix 1999-10-23 17:58:00 +00:00
parent 20ba496c92
commit 6d8e94c1dd
11 changed files with 994 additions and 443 deletions

View File

@ -1,3 +1,11 @@
V0.8 -
- medium removal is allowed in CDROMExit()
- Unix: added support for ESD audio output; merged with OSS audio
and put in a new "audio_oss_esd.cpp" file which is also used under
FreeBSD 3.x
- Unix: added mkinstalldirs to "make install" target
- Unix: cleaned up the configure script
V0.8 (snapshot) - 21.Oct.1999
- sony.cpp/disk.cpp/cdrom.cpp: disk insertions are now checked for
by an interrupt routine

View File

@ -62,13 +62,15 @@ $(APP): $(OBJ_DIR) $(OBJS)
modules:
cd Linux/NetDriver; make
install: $(APP)
install: $(APP) installdirs
$(INSTALL_PROGRAM) $(APP) $(bindir)/$(APP)
-$(INSTALL_DATA) $(APP).1 $(man1dir)/$(APP).1
$(INSTALL) -d $(datadir)/$(APP)
$(INSTALL_DATA) keycodes $(datadir)/$(APP)/keycodes
$(INSTALL_DATA) fbdevices $(datadir)/$(APP)/fbdevices
installdirs:
$(SHELL) mkinstalldirs $(bindir) $(man1dir) $(datadir)/$(APP)
uninstall:
rm -f $(bindir)/$(APP)
rm -f $(man1dir)/$(APP).1

View File

@ -168,3 +168,169 @@ main ()
AC_SUBST(GTK_LIBS)
rm -f conf.gtktest
])
# Configure paths for ESD
# Manish Singh 98-9-30
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS
dnl
AC_DEFUN(AM_PATH_ESD,
[dnl
dnl Get the cflags and libraries from the esd-config script
dnl
AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)],
esd_prefix="$withval", esd_prefix="")
AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)],
esd_exec_prefix="$withval", esd_exec_prefix="")
AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program],
, enable_esdtest=yes)
if test x$esd_exec_prefix != x ; then
esd_args="$esd_args --exec-prefix=$esd_exec_prefix"
if test x${ESD_CONFIG+set} != xset ; then
ESD_CONFIG=$esd_exec_prefix/bin/esd-config
fi
fi
if test x$esd_prefix != x ; then
esd_args="$esd_args --prefix=$esd_prefix"
if test x${ESD_CONFIG+set} != xset ; then
ESD_CONFIG=$esd_prefix/bin/esd-config
fi
fi
AC_PATH_PROG(ESD_CONFIG, esd-config, no)
min_esd_version=ifelse([$1], ,0.2.7,$1)
AC_MSG_CHECKING(for ESD - version >= $min_esd_version)
no_esd=""
if test "$ESD_CONFIG" = "no" ; then
no_esd=yes
else
ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags`
ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs`
esd_major_version=`$ESD_CONFIG $esd_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
esd_minor_version=`$ESD_CONFIG $esd_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_esdtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $ESD_CFLAGS"
LIBS="$LIBS $ESD_LIBS"
dnl
dnl Now check if the installed ESD is sufficiently new. (Also sanity
dnl checks the results of esd-config to some extent
dnl
rm -f conf.esdtest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <esd.h>
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.esdtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_esd_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_esd_version");
exit(1);
}
if (($esd_major_version > major) ||
(($esd_major_version == major) && ($esd_minor_version > minor)) ||
(($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version);
printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n");
printf("*** to point to the correct copy of esd-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_esd" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$ESD_CONFIG" = "no" ; then
echo "*** The esd-config script installed by ESD could not be found"
echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the ESD_CONFIG environment variable to the"
echo "*** full path to esd-config."
else
if test -f conf.esdtest ; then
:
else
echo "*** Could not run ESD test program, checking why..."
CFLAGS="$CFLAGS $ESD_CFLAGS"
LIBS="$LIBS $ESD_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <esd.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding ESD or finding the wrong"
echo "*** version of ESD. If it is not finding ESD, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means ESD was incorrectly installed"
echo "*** or that you have moved ESD since it was installed. In the latter case, you"
echo "*** may want to edit the esd-config script: $ESD_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
ESD_CFLAGS=""
ESD_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(ESD_CFLAGS)
AC_SUBST(ESD_LIBS)
rm -f conf.esdtest
])

View File

@ -1,5 +1,5 @@
/*
* audio_linux.cpp - Audio support, Linux (OSS) implementation
* audio_oss_esd.cpp - Audio support, implementation for OSS and ESD (Linux and FreeBSD)
*
* Basilisk II (C) 1997-1999 Christian Bauer
*
@ -21,12 +21,19 @@
#include "sysdeps.h"
#include <sys/ioctl.h>
#include <linux/soundcard.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#ifdef __linux__
#include <linux/soundcard.h>
#endif
#ifdef __FreeBSD__
#include <machine/soundcard.h>
#endif
#include "cpu_emulation.h"
#include "main.h"
#include "prefs.h"
@ -34,6 +41,10 @@
#include "audio.h"
#include "audio_defs.h"
#if ENABLE_ESD
#include <esd.h>
#endif
#define DEBUG 0
#include "debug.h"
@ -46,16 +57,20 @@ uint16 audio_sample_sizes[] = {16};
int audio_num_channel_counts = 1;
uint16 audio_channel_counts[] = {2};
// Constants
#define DSP_NAME "/dev/dsp"
// Global variables
static int dsp_fd = -1; // fd of /dev/dsp
static int mixer_fd = -1; // fd of /dev/mixer
static sem_t audio_irq_done_sem; // Signal from interrupt to streaming thread: data block read
static bool sem_inited = false; // Flag: audio_irq_done_sem initialized
static pthread_t stream_thread; // Audio streaming thread
static pthread_attr_t stream_thread_attr; // Streaming thread attributes
static bool stream_thread_active = false;
static int sound_buffer_size; // Size of sound buffer in bytes
static bool little_endian = false; // Flag: DSP accepts only little-endian 16-bit sound data
static int audio_fd = -1; // fd of /dev/dsp or ESD
static int mixer_fd = -1; // fd of /dev/mixer
static sem_t audio_irq_done_sem; // Signal from interrupt to streaming thread: data block read
static bool sem_inited = false; // Flag: audio_irq_done_sem initialized
static int sound_buffer_size; // Size of sound buffer in bytes
static bool little_endian = false; // Flag: DSP accepts only little-endian 16-bit sound data
static pthread_t stream_thread; // Audio streaming thread
static pthread_attr_t stream_thread_attr; // Streaming thread attributes
static bool stream_thread_active = false; // Flag: streaming thread installed
static volatile bool stream_thread_cancel = false; // Flag: cancel streaming thread
// Prototypes
static void *stream_func(void *arg);
@ -65,6 +80,86 @@ static void *stream_func(void *arg);
* Initialization
*/
// Init using /dev/dsp, returns false on error
bool audio_init_dsp(void)
{
printf("Using " DSP_NAME " audio output\n");
// Get supported sample formats
unsigned long format;
ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &format);
if ((format & (AFMT_U8 | AFMT_S16_BE | AFMT_S16_LE)) == 0) {
WarningAlert(GetString(STR_AUDIO_FORMAT_WARN));
close(audio_fd);
audio_fd = -1;
return false;
}
if (format & (AFMT_S16_BE | AFMT_S16_LE))
audio_sample_sizes[0] = 16;
else
audio_sample_sizes[0] = 8;
if (!(format & AFMT_S16_BE))
little_endian = true;
// Set DSP parameters
format = AudioStatus.sample_size == 8 ? AFMT_U8 : (little_endian ? AFMT_S16_LE : AFMT_S16_BE);
ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format);
int frag = 0x0004000c; // Block size: 4096 frames
ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag);
int stereo = (AudioStatus.channels == 2);
ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo);
int rate = AudioStatus.sample_rate >> 16;
ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate);
// Get sound buffer size
ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &audio_frames_per_block);
D(bug("DSP_GETBLKSIZE %d\n", audio_frames_per_block));
sound_buffer_size = (AudioStatus.sample_size >> 3) * AudioStatus.channels * audio_frames_per_block;
return true;
}
// Init using ESD, returns false on error
bool audio_init_esd(void)
{
#if ENABLE_ESD
printf("Using ESD audio output\n");
// ESD audio format
esd_format_t format = ESD_STREAM | ESD_PLAY;
if (AudioStatus.sample_size == 8)
format |= ESD_BITS8;
else
format |= ESD_BITS16;
if (AudioStatus.channels == 1)
format |= ESD_MONO;
else
format |= ESD_STEREO;
#if WORDS_BIGENDIAN
little_endian = false;
#else
little_endian = true;
#endif
// Open connection to ESD server
audio_fd = esd_play_stream(format, AudioStatus.sample_rate >> 16, NULL, NULL);
if (audio_fd < 0) {
char str[256];
sprintf(str, GetString(STR_NO_ESD_WARN), strerror(errno));
WarningAlert(str);
return false;
}
// Sound buffer size = 4096 frames
audio_frames_per_block = 4096;
sound_buffer_size = (AudioStatus.sample_size >> 3) * AudioStatus.channels * audio_frames_per_block;
return true;
#else
ErrorAlert("Basilisk II has been compiled with ESD support disabled.");
return false;
#endif
}
void AudioInit(void)
{
char str[256];
@ -81,44 +176,20 @@ void AudioInit(void)
if (PrefsFindBool("nosound"))
return;
// Open /dev/dsp
dsp_fd = open("/dev/dsp", O_WRONLY);
if (dsp_fd < 0) {
sprintf(str, GetString(STR_NO_AUDIO_DEV_WARN), "/dev/dsp", strerror(errno));
// Try to open /dev/dsp
audio_fd = open(DSP_NAME, O_WRONLY);
if (audio_fd < 0) {
#if ENABLE_ESD
if (!audio_init_esd())
return;
#else
sprintf(str, GetString(STR_NO_AUDIO_DEV_WARN), DSP_NAME, strerror(errno));
WarningAlert(str);
return;
}
// Get supported sample formats
unsigned long format;
ioctl(dsp_fd, SNDCTL_DSP_GETFMTS, &format);
if ((format & (AFMT_U8 | AFMT_S16_BE | AFMT_S16_LE)) == 0) {
WarningAlert(GetString(STR_AUDIO_FORMAT_WARN));
close(dsp_fd);
dsp_fd = -1;
return;
}
if (format & (AFMT_S16_BE | AFMT_S16_LE))
audio_sample_sizes[0] = 16;
else
audio_sample_sizes[0] = 8;
if (!(format & AFMT_S16_BE))
little_endian = true;
// Set DSP parameters
format = AudioStatus.sample_size == 8 ? AFMT_U8 : (little_endian ? AFMT_S16_LE : AFMT_S16_BE);
ioctl(dsp_fd, SNDCTL_DSP_SETFMT, &format);
int frag = 0x0004000c; // Block size: 4096 frames
ioctl(dsp_fd, SNDCTL_DSP_SETFRAGMENT, &frag);
int stereo = (AudioStatus.channels == 2);
ioctl(dsp_fd, SNDCTL_DSP_STEREO, &stereo);
int rate = AudioStatus.sample_rate >> 16;
ioctl(dsp_fd, SNDCTL_DSP_SPEED, &rate);
// Get sound buffer size
ioctl(dsp_fd, SNDCTL_DSP_GETBLKSIZE, &audio_frames_per_block);
D(bug("DSP_GETBLKSIZE %d\n", audio_frames_per_block));
sound_buffer_size = (AudioStatus.sample_size >> 3) * AudioStatus.channels * audio_frames_per_block;
#endif
} else
if (!audio_init_dsp())
return;
// Try to open /dev/mixer
mixer_fd = open("/dev/mixer", O_RDWR);
@ -156,7 +227,10 @@ void AudioExit(void)
{
// Stop stream and delete semaphore
if (stream_thread_active) {
stream_thread_cancel = true;
#ifdef HAVE_PTHREAD_CANCEL
pthread_cancel(stream_thread);
#endif
pthread_join(stream_thread, NULL);
stream_thread_active = false;
}
@ -164,8 +238,8 @@ void AudioExit(void)
sem_destroy(&audio_irq_done_sem);
// Close /dev/dsp
if (dsp_fd > 0)
close(dsp_fd);
if (audio_fd > 0)
close(audio_fd);
// Close /dev/mixer
if (mixer_fd > 0)
@ -205,7 +279,7 @@ static void *stream_func(void *arg)
int16 *last_buffer = new int16[sound_buffer_size / 2];
memset(silent_buffer, 0, sound_buffer_size);
for (;;) {
while (!stream_thread_cancel) {
if (AudioStatus.num_sources) {
// Trigger audio interrupt to get new buffer
@ -228,7 +302,7 @@ static void *stream_func(void *arg)
// Send data to DSP
if (work_size == sound_buffer_size && !little_endian)
write(dsp_fd, Mac2HostAddr(ReadMacInt32(apple_stream_info + scd_buffer)), sound_buffer_size);
write(audio_fd, Mac2HostAddr(ReadMacInt32(apple_stream_info + scd_buffer)), sound_buffer_size);
else {
// Last buffer or little-endian DSP
if (little_endian) {
@ -238,7 +312,7 @@ static void *stream_func(void *arg)
} else
memcpy(last_buffer, Mac2HostAddr(ReadMacInt32(apple_stream_info + scd_buffer)), work_size);
memset((uint8 *)last_buffer + work_size, 0, sound_buffer_size - work_size);
write(dsp_fd, last_buffer, sound_buffer_size);
write(audio_fd, last_buffer, sound_buffer_size);
}
D(bug("stream: data written\n"));
} else
@ -247,10 +321,9 @@ static void *stream_func(void *arg)
} else {
// Audio not active, play silence
silence: write(dsp_fd, silent_buffer, sound_buffer_size);
silence: write(audio_fd, silent_buffer, sound_buffer_size);
}
}
ioctl(dsp_fd, SNDCTL_DSP_SYNC);
delete[] silent_buffer;
delete[] last_buffer;
return NULL;

View File

@ -72,3 +72,9 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the posix4 library (-lposix4). */
#undef HAVE_LIBPOSIX4
/* Define if you have the pthread library (-lpthread). */
#undef HAVE_LIBPTHREAD

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,12 @@ AC_CONFIG_HEADER(config.h)
dnl Options.
WANT_XF86_DGA=yes
WANT_FBDEV_DGA=yes
WANT_ESD=yes
WANT_UI=yes
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension (default)], [WANT_XF86_DGA=$enableval], [])
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb (default)], [WANT_FBDEV_DGA=$enableval], [])
AC_ARG_ENABLE(ui, [ --enable-ui use GTK user interface (default)], [WANT_UI=$enableval], [])
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [])
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [])
AC_ARG_ENABLE(esd, [ --enable-esd Enlightened Sound Daemon support [default=yes]], [WANT_ESD=$enableval], [])
AC_ARG_ENABLE(ui, [ --enable-ui use GTK user interface [default=yes]], [WANT_UI=$enableval], [])
dnl Checks for programs.
AC_PROG_CC
@ -21,51 +23,45 @@ AC_PROG_MAKE_SET
AC_PROG_INSTALL
dnl Checks for libraries.
AC_CHECK_LIB(posix4, sem_init)
dnl We need X11.
AC_PATH_XTRA
if [[ "x$no_x" = "xyes" ]]; then
AC_MSG_ERROR([You need X11 to run Basilisk II.])
fi
CFLAGS="$CFLAGS $X_CFLAGS"
CXXFLAGS="$CXXFLAGS $X_CFLAGS"
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
STATICLIBS=
dnl We need pthreads.
AC_CHECK_LIB(pthread, pthread_create, HAVE_PTHREADS=yes, HAVE_PTHREADS=no)
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
dnl Check even the libc_r (FreeBSD)
AC_CHECK_LIB(c_r, pthread_create, HAVE_PTHREADS=yes, HAVE_PTHREADS=no)
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
dnl Or maybe the user has PTL (NetBSD)
AC_CHECK_LIB(PTL, pthread_create, HAVE_PTHREADS=yes, HAVE_PTHREADS=no)
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
dnl We need pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
AC_CHECK_LIB(pthread, pthread_create, , [
AC_CHECK_LIB(c_r, pthread_create, , [
AC_CHECK_LIB(PTL, pthread_create, , [
AC_MSG_ERROR([You need pthreads to run Basilisk II.])
else
LIBS="$LIBS -lPTL"
fi
else
LIBS="$LIBS -lc_r"
fi
else
LIBS="$LIBS -lpthread"
fi
AC_CHECK_FUNCS(pthread_cancel)
])
])
])
dnl We use DGA if possible.
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
SEMSRCS=
AC_CHECK_FUNCS(sem_init, , [
SEMSRCS=posix_sem.cpp
])
dnl We use DGA (XFree86 or fbdev) if possible.
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no)
if [[ "x$HAVE_DGA" = "xno" ]]; then
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
else
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
DEFINES="$DEFINES -DENABLE_XF86_DGA=1"
LIBS="$LIBS -lXxf86dga"
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.])
WANT_FBDEV_DGA=no
fi
fi
], [
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
])
else
DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
fi
@ -76,32 +72,31 @@ else
fi
dnl We use GTK+ if possible.
UISRCS=../dummy/prefs_editor_dummy.cpp
if [[ "x$WANT_UI" = "xyes" ]]; then
AM_PATH_GTK(1.2.0)
if [[ "x$no_gtk" = "xyes" ]]; then
echo "Did not find gtk+, disabling user interface."
WANT_UI=no
GTK_CFLAGS=
GTK_LIBS=
else
AM_PATH_GTK(1.2.0, [
DEFINES="$DEFINES -DENABLE_GTK=1"
fi
CFLAGS="$CFLAGS $GTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
UISRCS=prefs_editor_gtk.cpp
], [
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
WANT_UI=no
])
fi
dnl We need POSIX.4 semaphores (and other POSIX.4 blessings).
SEMSRCS=
AC_CHECK_FUNCS(sem_init)
if [[ "x$ac_cv_func_sem_init" = "xno" ]]; then
AC_CHECK_LIB(posix4, sem_init, HAVE_LIBPOSIX4=yes, HAVE_LIBPOSIX4=no)
if [[ "x$HAVE_LIBPOSIX4" = "xno" ]]; then
dnl Emulate semaphores with pthread mutexes
SEMSRCS="posix_sem.cpp"
else
LIBS="$LIBS -lposix4"
fi
dnl We use ESD if possible.
if [[ "x$WANT_ESD" = "xyes" ]]; then
AM_PATH_ESD(0.2.8, [
DEFINES="$DEFINES -DENABLE_ESD=1"
CFLAGS="$CFLAGS $ESD_CFLAGS"
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
LIBS="$LIBS $ESD_LIBS"
], [
AC_MSG_WARN([Could not find ESD, disabling ESD support.])
WANT_ESD=no
])
fi
dnl Checks for header files.
@ -125,13 +120,14 @@ AC_STRUCT_TM
dnl Checks for library functions.
AC_CHECK_FUNCS(strdup cfmakeraw)
AC_CHECK_FUNCS(nanosleep clock_gettime timer_create)
AC_CHECK_FUNCS(pthread_cancel)
dnl Select system-dependant source files.
SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp"
if MACHINE=`uname -a 2>/dev/null`; then
case "$MACHINE" in
Linux*)
SYSSRCS="Linux/ether_linux.cpp Linux/scsi_linux.cpp Linux/audio_linux.cpp"
SYSSRCS="Linux/ether_linux.cpp Linux/scsi_linux.cpp audio_oss_esd.cpp"
;;
FreeBSD*3.*)
dnl Check for the CAM library
@ -146,7 +142,7 @@ if MACHINE=`uname -a 2>/dev/null`; then
dnl to access directly to the functions in the kernel :) --Orlando
AC_MSG_ERROR([Cannot find kernel includes for CAM library.])
fi
SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.cpp"
SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp audio_oss_esd.cpp"
CXXFLAGS="$CXXFLAGS -I/sys"
CFLAGS="$CFLAGS -I/sys"
LIBS="$LIBS -lcam"
@ -180,14 +176,7 @@ if MACHINE=`uname -a 2>/dev/null`; then
;;
esac
fi
if [[ "x$WANT_UI" = "xyes" ]]; then
SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp"
else
SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp"
fi
if [[ "x$SEMSRCS" != "x" ]]; then
SYSSRCS="$SYSSRCS $SEMSRCS"
fi
SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS"
dnl Check for i386 CPU.
HAVE_I386=no
@ -272,7 +261,6 @@ CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cp
dnl Generate Makefile.
AC_SUBST(DEFINES)
AC_SUBST(STATICLIBS)
AC_SUBST(SYSSRCS)
AC_SUBST(CPUINCLUDES)
AC_SUBST(CPUSRCS)

View File

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id$
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

View File

@ -43,6 +43,7 @@ user_string_def platform_strings[] = {
{STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."},
{STR_SCSI_DEVICE_NOT_SCSI_WARN, "%s doesn't seem to comply to the Generic SCSI API. SCSI Manager access to this device will be disabled."},
{STR_NO_AUDIO_DEV_WARN, "Cannot open %s (%s). Audio output will be disabled."},
{STR_NO_ESD_WARN, "Cannot open ESD connection. Audio output will be disabled."},
{STR_AUDIO_FORMAT_WARN, "Audio hardware doesn't support signed 16 bit format. Audio output will be disabled."},
{STR_KEYCODE_FILE_WARN, "Cannot open keycode translation file %s (%s)."},
{STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."},

View File

@ -34,6 +34,7 @@ enum {
STR_SCSI_DEVICE_OPEN_WARN,
STR_SCSI_DEVICE_NOT_SCSI_WARN,
STR_NO_AUDIO_DEV_WARN,
STR_NO_ESD_WARN,
STR_AUDIO_FORMAT_WARN,
STR_KEYCODE_FILE_WARN,
STR_KEYCODE_VENDOR_WARN,

View File

@ -310,6 +310,7 @@ void CDROMExit(void)
{
DriveInfo *info = first_drive_info, *next;
while (info != NULL) {
SysAllowRemoval(info->fh);
Sys_close(info->fh);
next = info->next;
delete info;