Fix cross compiling from Linux with mingw32msvc.

This commit is contained in:
Erik de Castro Lopo 2004-03-04 22:02:43 +00:00
parent 77b9f512b7
commit 8c3991675b
6 changed files with 78 additions and 22 deletions

View File

@ -99,9 +99,14 @@ unset ac_cv_sizeof_off_t
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
if test "x$ac_cv_sizeof_off_t" = "x8" ; then
if test "x$target_os" = "xmingw32msvc" ; then
TYPEOF_SF_COUNT_T="__int64"
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
SIZEOF_SF_COUNT_T=8
elif test "x$ac_cv_sizeof_off_t" = "x8" ; then
# If sizeof (off_t) is 8, no further checking is needed.
TYPEOF_SF_COUNT_T="off_t"
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
SIZEOF_SF_COUNT_T=8
else
# Check for common 64 bit file offset types.
@ -137,7 +142,9 @@ else
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
if test "x$ac_cv_sizeof_off_t" = "x$pre_largefile_sizeof_off_t" ; then
if test "x$ac_cv_sizeof_off_t" = "x8" ; then
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
elif test "x$ac_cv_sizeof_off_t" = "x$pre_largefile_sizeof_off_t" ; then
AC_MSG_WARN([[This machine does not seem to support 64 bit file offsets.]])
TYPEOF_SF_COUNT_T="off_t"
SIZEOF_SF_COUNT_T=$ac_cv_sizeof_off_t
@ -152,9 +159,7 @@ else
fi
fi
if test $SIZEOF_SF_COUNT_T = 8 ; then
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
elif test $SIZEOF_SF_COUNT_T = 4 ; then
if test $SIZEOF_SF_COUNT_T = 4 ; then
SF_COUNT_MAX="0x7FFFFFFF"
fi
@ -167,6 +172,7 @@ AC_SUBST(SIZEOF_SF_COUNT_T)
AC_DEFINE_UNQUOTED([SF_COUNT_MAX],${SF_COUNT_MAX}, [Set to maximum allowed value of sf_count_t type.])
AC_SUBST(SF_COUNT_MAX)
AC_CHECK_TYPES(ssize_t)
AC_CHECK_SIZEOF(ssize_t,4)
#====================================================================================
@ -200,9 +206,11 @@ case "$target_os" in
AC_C99_FUNC_LRINT
AC_C99_FUNC_LRINTF
if test x$ac_cv_c99_lrint = xno || test x$ac_cv_c99_lrintf = xno ; then
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
if test "x$ac_cv_c99_lrint" = "xno" ; then
if test "x$ac_cv_c99_lrintf" = "xno" ; then
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
fi
fi
;;
esac
@ -227,6 +235,7 @@ AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
# Target OS specific stuff.
OS_SPECIFIC_CFLAGS=""
OS_SPECIFIC_LINKS=""
os_is_win32=0
os_is_macosx=0
@ -238,11 +247,16 @@ case "$target_os" in
;;
mingw32msvc)
os_is_win32=1
AC_CHECK_HEADERS(wintypes.h mmreg.h)
OS_SPECIFIC_CFLAGS=""
OS_SPECIFIC_LINKS=""
TYPEOF_SF_COUNT_T="__int64"
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFi64"
## AC_CHECK_HEADERS(wintypes.h)
AC_CHECK_HEADERS(mmreg.h)
if x$ac_cv_header_mmreg_h != xyes ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** Can't find mmreg.h which means that we can't build a working ]])
AC_MSG_WARN([[*** sndfile-play program. The library can however be built. ]])
AC_MSG_WARN([[*** To correct this, you can grab the mmmreg.h file from the ]])
AC_MSG_WARN([[*** WINE project : http://www.winehq.com/. ]])
AC_MSG_WARN([[******************************************************************]])
fi
;;
*)
OS_SPECIFIC_CFLAGS=""

View File

@ -41,7 +41,8 @@
#include <sys/ioctl.h>
#include <sys/audioio.h>
#elif (defined (_WIN32) || defined (WIN32))
#elif (defined (_WIN32) || defined (WIN32)) && HAVE_MMREG_H
#define WIN32_WITH_MMREG_H
#include <windows.h>
#include <mmsystem.h>
#include <mmreg.h>
@ -322,7 +323,7 @@ macosx_play (int argc, char *argv [])
** point to data instead of short*. It plain sucks!
*/
#if (defined (_WIN32) || defined (WIN32))
#if WIN32_WITH_MMREG_H
#define WIN32_BUFFER_LEN (1<<15)
@ -578,7 +579,7 @@ main (int argc, char *argv [])
if (argc < 2)
{
printf ("\nUsage : %s <input sound file>\n\n", argv [0]) ;
#if (defined (_WIN32) || defined (WIN32))
#if WIN32_WITH_MMREG_H
printf ("This is a Unix style command line application which\n"
"should be run in a MSDOS box or Command Shell window.\n\n") ;
printf ("Sleeping for 5 seconds before exiting.\n\n") ;
@ -604,7 +605,7 @@ main (int argc, char *argv [])
macosx_play (argc, argv) ;
#elif (defined (sun) && defined (unix))
solaris_play (argc, argv) ;
#elif (defined (_WIN32) || defined (WIN32))
#elif WIN32_WITH_MMREG_H
win32_play (argc, argv) ;
#elif defined (__BEOS__)
printf ("This program cannot be compiled on BeOS.\n") ;

View File

@ -449,7 +449,7 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
#include <io.h>
#ifndef HAVE_SSIZE_T
typedef int ssize_t ;
typedef long ssize_t ;
#endif
/* Win32 */ static void
@ -870,7 +870,7 @@ psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
#include <direct.h>
#ifndef HAVE_SSIZE_T
typedef int ssize_t ;
typedef long ssize_t ;
#endif
/* Win32 */ int

View File

@ -18,14 +18,27 @@
/* Some defines that microsoft 'forgot' to implement. */
#ifndef S_IRWXU
#define S_IRWXU 0000700 /* rwx, owner */
#endif
#ifndef S_IRUSR
#define S_IRUSR 0000400 /* read permission, owner */
#endif
#ifndef S_IWUSR
#define S_IWUSR 0000200 /* write permission, owner */
#endif
#ifndef S_IXUSR
#define S_IXUSR 0000100 /* execute/search permission, owner */
#endif
#define S_IRWXG 0000070 /* rwx, group */
#define S_IRGRP 0000040 /* read permission, group */
#define S_IWGRP 0000020 /* write permission, grougroup */
#define S_IXGRP 0000010 /* execute/search permission, group */
#define S_IRWXO 0000007 /* rwx, other */
#define S_IROTH 0000004 /* read permission, other */
#define S_IWOTH 0000002 /* write permission, other */

View File

@ -26,6 +26,10 @@
#include <stdlib.h>
#include <string.h>
#if (OS_IS_WIN32 == 0)
/* This test program doesn't work on win32. */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -331,6 +335,19 @@ file_exists (const char *filename)
return 1 ;
} /* file_exists */
#else
int
main (void)
{
puts ("This test doesn't work on win32.") ;
return 0 ;
}
#endif
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch

View File

@ -33,10 +33,21 @@
#include <sys/types.h>
#include <sys/stat.h>
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include "utils.h"
#ifndef WIFEXITED
#define WIFEXITED(s) (((s) & 0xff) == 0)
#endif
#ifndef WEXITSTATUS
#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
#endif
static size_t file_length (const char *filename) ;
static int file_exists (const char *filename) ;
static void stdio_test (const char *filetype) ;
@ -71,7 +82,7 @@ stdio_test (const char *filetype)
snprintf (buffer, sizeof (buffer), "./stdout_test %s > stdio.%s", filetype, filetype) ;
if ((retval = system (buffer)))
{ retval = WEXITSTATUS (retval) ;
{ retval = WIFEXITED (retval) ? WEXITSTATUS (retval) : 1 ;
printf ("%s : %s", buffer, (strerror (retval))) ;
exit (1) ;
} ;
@ -84,14 +95,14 @@ stdio_test (const char *filetype)
snprintf (buffer, sizeof (buffer), "./stdin_test %s < stdio.%s", filetype, filetype) ;
if ((retval = system (buffer)))
{ retval = WEXITSTATUS (retval) ;
{ retval = WIFEXITED (retval) ? WEXITSTATUS (retval) : 1 ;
printf ("%s : %s", buffer, (strerror (retval))) ;
exit (1) ;
} ;
snprintf (buffer, sizeof (buffer), "rm stdio.%s", filetype) ;
if ((retval = system (buffer)))
{ retval = WEXITSTATUS (retval) ;
{ retval = WIFEXITED (retval) ? WEXITSTATUS (retval) : 1 ;
printf ("%s : %s", buffer, (strerror (retval))) ;
exit (1) ;
} ;