Added support for MinGW32 build and some fixes for gcc Darwin build.

This commit is contained in:
Element Green 2003-06-12 10:59:52 +00:00
parent 3472cc18ad
commit 6cc13e3060
9 changed files with 209 additions and 36 deletions

View file

@ -1,3 +1,18 @@
2003-06-12 Josh Green <jgreen@users.sourceforge.net>
* Makefile.am: Added autogen.sh to EXTRA_DIST
* acinclude.m4: Added AM_PATH_READLINE macro for readline detection
and prefix configuration.
* configure.ac: Support for MinGW32 build, Darwin build fixes,
configure CFLAGS input value now honored, fixes to CoreAudio support,
and better readline detection and config.
* src/Makefile.am: Now conditionally compiling CoreAudio and Windows
sources, added config_*.h files to EXTRA_DIST, some stuff for MinGW32
build, READLINE_LIBS and READLINE_CFLAGS now used.
* src/fluid_dsound.c: Fixed some warnings by adding "void" for
empty parameter procedure declarations.
* src/fluidsynth.c: Don't include config_win32.h if MinGW32.
* src/fluidsynth_priv.h: Stuff for MinGW32 and Darwin builds.
2003-06-09 Josh Green <jgreen@users.sourceforge.net>
* src/fluid_alsa.c: Added calls to pthread_attr_setschedparam to

View file

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = src doc include
EXTRA_DIST = TODO acconfig.h acinclude.m4 fluidsynth.pc.in
EXTRA_DIST = TODO acconfig.h acinclude.m4 fluidsynth.pc.in autogen.sh
DISTCLEANFILES = fluidsynth.pc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = fluidsynth.pc

View file

@ -264,3 +264,72 @@ dnl That should be it. Now just export out symbols:
AC_SUBST(ALSA_CFLAGS)
AC_SUBST(ALSA_LIBS)
])
dnl Configure Paths for readline (Josh Green 2003-06-10)
dnl
dnl AM_PATH_READLINE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for readline, and define READLINE_CFLAGS and
dnl READLINE_LIBS as appropriate.
dnl enables arguments --with-readline-prefix=
AC_DEFUN(AM_PATH_READLINE,
[dnl Save the original CFLAGS, and LIBS
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
readline_found=yes
dnl
dnl Setup configure options
dnl
AC_ARG_WITH(readline-prefix,
[ --with-readline-prefix=PATH Path where readline is (optional)],
[readline_prefix="$withval"], [readline_prefix=""])
AC_MSG_CHECKING(for readline)
dnl Add readline to the LIBS path
READLINE_LIBS="-lreadline"
if test "${readline_prefix}" != "" ; then
READLINE_LIBS="-L${readline_prefix}/lib $READLINE_LIBS"
READLINE_CFLAGS="-I${readline_prefix}/include"
else
READLINE_CFLAGS=""
fi
LIBS="$READLINE_LIBS $LIBS"
CFLAGS="$READLINE_CFLAGS $CFLAGS"
AC_TRY_COMPILE([
#include <readline/readline.h>
], [
void main(void)
{
#ifndef readline
return (1);
#else
return (0);
#endif
}
],
[AC_MSG_RESULT(found.)],
[AC_MSG_RESULT(not present.)
readline_found=no]
)
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"
if test "x$readline_found" = "xyes" ; then
ifelse([$1], , :, [$1])
else
READLINE_CFLAGS=""
READLINE_LIBS=""
ifelse([$2], , :, [$2])
fi
dnl That should be it. Now just export out symbols:
AC_SUBST(READLINE_CFLAGS)
AC_SUBST(READLINE_LIBS)
])

View file

@ -30,6 +30,7 @@ dnl Check for programs
AC_PROG_CC
AC_PROG_INSTALL
dnl AC_PROG_RANLIB
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
@ -38,12 +39,36 @@ AC_CHECK_LIB(pthread, pthread_create)
dnl Check for header files
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h stdlib.h stdio.h math.h errno.h stdarg.h unistd.h sys/mman.h sys/types.h sys/time.h sys/stat.h fcntl.h sys/socket.h netinet/in.h netinet/tcp.h arpa/inet.h limits.h pthread.h signal.h)
AC_CHECK_HEADERS(string.h stdlib.h stdio.h math.h errno.h stdarg.h unistd.h sys/mman.h sys/types.h sys/time.h sys/stat.h fcntl.h sys/socket.h netinet/in.h netinet/tcp.h arpa/inet.h limits.h pthread.h signal.h windows.h)
dnl Compiler and machine specs
AC_C_INLINE
AC_C_INLINE
AC_C_BIGENDIAN
LIBFLUID_LIBS="-lm"
dnl Machine specific checks and defines
case "${host_os}" in
darwin*)
AC_DEFINE(DARWIN, 1, [Define if building for Mac OS X Darwin])
;;
mingw*)
mingw32_support="yes"
CFLAGS="$CFLAGS -mms-bitfields"
AC_DEFINE(MINGW32, 1, [Define if using the MinGW32 environment])
LIBFLUID_LIBS="-ldsound -lwinmm"
LIBFLUID_CPPFLAGS="-DFLUIDSYNTH_DLL_EXPORTS"
LIBFLUID_LDFLAGS="-no-undefined"
FLUID_CPPFLAGS="-DFLUIDSYNTH_NOT_A_DLL"
;;
esac
AC_SUBST(LIBFLUID_LIBS)
AC_SUBST(LIBFLUID_CPPFLAGS)
AC_SUBST(LIBFLUID_LDFLAGS)
AC_SUBST(FLUID_CPPFLAGS)
AM_CONDITIONAL(MINGW32_SUPPORT, test "$mingw32_support" == "yes")
ENABLE_FLOAT_SAMPLES=yes
AC_ARG_ENABLE(double,
@ -123,21 +148,21 @@ AC_ARG_ENABLE(debug,
case "$ENABLE_DEBUG" in
no)
CFLAGS="${FCCFLAGS} -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused -Winline"
CFLAGS="${CFLAGS} ${FCCFLAGS} -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused -Winline"
AC_DEFINE(DEBUG, 0, [Define to activate debugging message])
;;
yes)
if test "${ENABLE_FUNCTIONCHECK}" = "yes"; then
CFLAGS="${FCCFLAGS} -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused"
CFLAGS="${CFLAGS} ${FCCFLAGS} -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused"
else
CFLAGS="${FCCFLAGS} -g -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused"
CFLAGS="${CFLAGS} ${FCCFLAGS} -g -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused"
fi
AC_DEFINE(DEBUG, 1, [Define to activate debugging message])
;;
*)
CFLAGS="${FCCFLAGS} -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused -Winline"
CFLAGS="${CFLAGS} ${FCCFLAGS} -O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused -Winline"
AC_DEFINE(DEBUG, 0, [Define to activate debugging message])
;;
@ -204,7 +229,7 @@ AC_ARG_ENABLE(coreaudio,
esac
])
COREAUDIO_SUPPORT=0
COREAUDIO_SUPPORT=0
if test "$fluid_enable_coreaudio" = "yes"; then
AC_CHECK_HEADER(AudioHardware.h, COREAUDIO_FOUND="yes", COREAUDIO_FOUND="no")
if test "$COREAUDIO_FOUND" = "yes"; then
@ -215,15 +240,18 @@ else
COREAUDIO_FOUND="no"
fi
AM_CONDITIONAL(COREAUDIO_SUPPORT, test "$COREAUDIO_SUPPORT" = "1")
dnl
dnl The following scripts checks for readline and ncurses support.
dnl I copied and adapted it from DataDisplayDebugger's (DDD)
dnl configure.in, written by Andreas Zeller <zeller@gnu.org>.
dnl
WITH_READLINE=yes
have_termcap=false
dnl Check for readline support (Josh Green 2003-06-10)
AM_PATH_READLINE(HAVE_READLINE=1, HAVE_READLINE=0)
if test $HAVE_READLINE -ne 1 ; then
WITH_READLINE=no
else
WITH_READLINE=yes
fi
AC_ARG_WITH(readline,
[ --with-readline Use the readline library for line editing [default=yes]],[
@ -232,6 +260,12 @@ AC_ARG_WITH(readline,
fi
])
dnl
dnl The following script checks for ncurses support.
dnl I copied and adapted it from DataDisplayDebugger's (DDD)
dnl configure.in, written by Andreas Zeller <zeller@gnu.org>.
dnl
dnl Look for the tgetent() function - either in libtermcap, libcurses
dnl
dnl On FreeBSD systems, `-lmytinfo' is preferred to `-lncurses'.
@ -240,16 +274,16 @@ dnl
dnl On Linux ELF systems, `-lncurses' is preferred to `-ltermcap'.
dnl Reported by jdassen@wi.leidenuniv.nl (J.H.M. Dassen)
dnl
have_termcap=false
if test "x${WITH_READLINE}" = "xyes"; then
_termlib="mytinfo ncurses curses termcap terminfo termlib"
for termlib in ${_termlib}; do
AC_CHECK_LIB(${termlib}, tgetent, [LIBREADLINE="-l${termlib}"; have_termcap=true; break])
AC_CHECK_LIB(${termlib}, tgetent,
[READLINE_LIBS="$READLINE_LIBS -l${termlib}"; have_termcap=true; break])
done
fi
AC_SUBST(LIBREADLINE)
if test "x${have_termcap}" = "xtrue"; then
LIBREADLINE="-lreadline $LIBREADLINE";
AC_DEFINE(WITH_READLINE, 1, [Define to use the readline library for line editing])
fi
@ -368,8 +402,6 @@ else
echo "LADSPA support: no"
fi
if test "${longlong}" = "yes"; then
echo "use long long: yes"
else

View file

@ -1,12 +1,25 @@
## Process this file with automake to produce Makefile.in
# Tests for optional drivers
if COREAUDIO_SUPPORT
fluid_coreaudio = fluid_coreaudio.c
endif
if MINGW32_SUPPORT
fluid_windows = fluid_dll.c fluid_dsound.c fluid_winmidi.c
endif
# Extra files and optional drivers
EXTRA_DIST = fluid_dll.c fluid_dsound.c fluid_winmidi.c fluid_portaudio.c \
fluid_dsp_core.c fluid_coreaudio.c fluid_sndmgr.c
fluid_coreaudio.c fluid_dsp_core.c fluid_sndmgr.c \
config_macos.h config_macosx.h config.macosx_pb.h config_win32.h
lib_LTLIBRARIES = libfluidsynth.la
bin_PROGRAMS = fluidsynth
libfluidsynth_la_SOURCES = \
$(fluid_coreaudio) \
$(fluid_windows) \
fluid_adriver.c \
fluid_adriver.h \
fluid_alsa.c \
@ -65,14 +78,15 @@ libfluidsynth_la_SOURCES = \
fluid_voice.c \
fluid_voice.h
INCLUDES = -I$(srcdir)/../include $(LADCCA_CFLAGS)
INCLUDES = -I$(srcdir)/../include $(LADCCA_CFLAGS) $(READLINE_CFLAGS)
libfluidsynth_la_LIBADD = -lm @LIBREADLINE@ $(LADCCA_LIBS)
libfluidsynth_la_LIBADD = $(LIBFLUID_LIBS) $(LADCCA_LIBS) $(READLINE_LIBS)
libfluidsynth_la_LDFLAGS = \
-version-info @LIBFLUIDSYNTH_MAJ@:@LIBFLUIDSYNTH_MIN@:0 \
-export-dynamic @FCLDFLAGS@
-export-dynamic @FCLDFLAGS@ $(LIBFLUID_LDFLAGS)
libfluidsynth_la_CPPFLAGS = $(LIBFLUID_CPPFLAGS)
fluidsynth_SOURCES = fluidsynth.c
fluidsynth_LDADD = libfluidsynth.la
fluidsynth_LDFLAGS = @FCLDFLAGS@
fluidsynth_CPPFLAGS = $(FLUIDSYNTH_CPPFLAGS)

View file

@ -6,6 +6,9 @@
/* whether or not we are supporting CoreAudio */
#undef COREAUDIO_SUPPORT
/* Define if building for Mac OS X Darwin */
#undef DARWIN
/* Define to activate debugging message */
#undef DEBUG
@ -120,6 +123,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define to enable JACK driver */
#undef JACK_SUPPORT
@ -129,6 +135,9 @@
/* Define to enable MidiShare driver */
#undef MIDISHARE_SUPPORT
/* Define if using the MinGW32 environment */
#undef MINGW32
/* Define to enable OSS driver */
#undef OSS_SUPPORT

View file

@ -38,8 +38,8 @@ new_fluid_dsound_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth);
int delete_fluid_dsound_audio_driver(fluid_audio_driver_t* data);
DWORD WINAPI fluid_dsound_audio_run(LPVOID lpParameter);
int fluid_win32_create_window();
int fluid_win32_destroy_window();
int fluid_win32_create_window(void);
int fluid_win32_destroy_window(void);
long FAR PASCAL fluid_win32_wndproc(HWND hWnd, unsigned message, WPARAM wParam, LPARAM lParam);
char* fluid_win32_error(HRESULT hr);
@ -371,7 +371,7 @@ long FAR PASCAL fluid_win32_wndproc(HWND hWnd, unsigned message, WPARAM wParam,
return(0L);
}
int fluid_win32_create_window()
int fluid_win32_create_window(void)
{
WNDCLASS myClass;
myClass.hCursor = LoadCursor( NULL, IDC_ARROW );
@ -397,7 +397,7 @@ int fluid_win32_create_window()
return 0;
}
int fluid_win32_destroy_window()
int fluid_win32_destroy_window(void)
{
if (fluid_wnd != NULL) {
DestroyWindow(fluid_wnd);

View file

@ -34,14 +34,14 @@
#include "fluidsynth.h"
#ifdef WIN32
#include "config_win32.h"
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#if defined(WIN32) && !defined(MINGW32)
#include "config_win32.h"
#endif
#ifdef HAVE_SIGNAL_H
#include "signal.h"
#endif

View file

@ -26,7 +26,7 @@
#include "config.h"
#endif
#ifdef WIN32
#if defined(WIN32) && !defined(MINGW32)
#include "config_win32.h"
#endif
@ -102,7 +102,6 @@
#include <pthread.h>
#endif
#if HAVE_IO_H
#include <io.h>
#endif
@ -111,6 +110,29 @@
#include <windows.h>
#endif
/* MinGW32 special defines */
#ifdef MINGW32
#include <stdint.h>
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define DSOUND_SUPPORT 1
#define WINMIDI_SUPPORT 1
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define WITHOUT_SERVER 1
#endif
/* Darwin special defines (taken from config_macosx.h) */
#ifdef DARWIN
#define MACINTOSH
#define __Types__
#endif
#include "fluidsynth.h"
@ -142,7 +164,19 @@ typedef int fluid_socket_t;
/** Integer types */
#if defined(_WIN32)
#if defined(MINGW32)
/* Windows using MinGW32 */
typedef int8_t sint8;
typedef uint8_t uint8;
typedef int16_t sint16;
typedef uint16_t uint16;
typedef int32_t sint32;
typedef uint32_t uint32;
typedef int64_t sint64;
typedef uint64_t uint64;
#elif defined(_WIN32)
/* Windows */
typedef signed __int8 sint8;