Commit 0946af36 authored by Monty's avatar Monty
Browse files

autoconf changes to handle looking for bit-width types on yet more
platforms without barfing.  Cleaner than before, hopefully works
better too.

Monty

svn path=/trunk/vorbis/; revision=605
parent f03fc45f
This diff is collapsed.
# $Id: configure.in,v 1.20 2000/08/15 09:09:31 xiphmont Exp $ # $Id: configure.in,v 1.21 2000/08/30 06:09:21 xiphmont Exp $
AC_INIT(lib/mdct.c) AC_INIT(lib/mdct.c)
#AC_CONFIG_HEADER(config.h) #AC_CONFIG_HEADER(config.h)
...@@ -176,27 +176,142 @@ dummy="__noconf" ...@@ -176,27 +176,142 @@ dummy="__noconf"
# X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS" # X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS"
#fi #fi
# check macro modified from Jon Shiring's to compensate for autoconf's lagging
# behind the times on type madness
AC_MSG_CHECKING(for int16_t)
AC_CACHE_VAL(has_int16_t,
[AC_TRY_RUN([
#ifdef __BEOS__
#include <inttypes.h>
#else
#include <sys/types.h>
#endif
int16_t foo;
int main() {return 0;}
],
has_int16_t=yes,
has_int16_t=no,
has_int16_t=no
)])
AC_MSG_RESULT($has_int16_t)
AC_MSG_CHECKING(for int32_t)
AC_CACHE_VAL(has_int32_t,
[AC_TRY_RUN([
#ifdef __BEOS__
#include <inttypes.h>
#else
#include <sys/types.h>
#endif
int32_t foo;
int main() {return 0;}
],
has_int32_t=yes,
has_int32_t=no,
has_int32_t=no
)])
AC_MSG_RESULT($has_int32_t)
AC_MSG_CHECKING(for uint32_t)
AC_CACHE_VAL(has_uint32_t,
[AC_TRY_RUN([
#ifdef __BEOS__
#include <inttypes.h>
#else
#include <sys/types.h>
#endif
uint32_t foo;
int main() {return 0;}
],
has_uint32_t=yes,
has_uint32_t=no,
has_uint32_t=no
)])
AC_MSG_RESULT($has_uint32_t)
AC_MSG_CHECKING(for u_int32_t)
AC_CACHE_VAL(has_u_int32_t,
[AC_TRY_RUN([
#ifdef __BEOS__
#include <inttypes.h>
#else
#include <sys/types.h>
#endif
u_int32_t foo;
int main() {return 0;}
],
has_u_int32_t=yes,
has_u_int32_t=no,
has_u_int32_t=no
)])
AC_MSG_RESULT($has_u_int32_t)
AC_MSG_CHECKING(for int64_t)
AC_CACHE_VAL(has_int64_t,
[AC_TRY_RUN([
#ifdef __BEOS__
#include <inttypes.h>
#else
#include <sys/types.h>
#endif
int64_t foo;
int main() {return 0;}
],
has_int64_t=yes,
has_int64_t=no,
has_int64_t=no
)])
AC_MSG_RESULT($has_int64_t)
AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(long long)
case 2 in
$ac_cv_sizeof_short) SIZE16="short";;
$ac_cv_sizeof_int) SIZE16="int";;
esac
case 4 in if test x$has_int16_t = "xyes" ; then
$ac_cv_sizeof_short) SIZE32="short";; SIZE16="int16_t"
$ac_cv_sizeof_int) SIZE32="int";; else
$ac_cv_sizeof_long) SIZE32="long";; case 2 in
esac $ac_cv_sizeof_short) SIZE16="short";;
$ac_cv_sizeof_int) SIZE16="int";;
esac
fi
if test x$has_int32_t = "xyes" ; then
SIZE32="int32_t"
else
case 4 in
$ac_cv_sizeof_short) SIZE32="short";;
$ac_cv_sizeof_int) SIZE32="int";;
$ac_cv_sizeof_long) SIZE32="long";;
esac
fi
if test x$has_uint32_t = "xyes" ; then
USIZE32="uint32_t"
else
if test x$has_u_int32_t = "xyes" ; then
USIZE32="u_int32_t"
else
case 4 in
$ac_cv_sizeof_short) USIZE32="unsigned short";;
$ac_cv_sizeof_int) USIZE32="unsigned int";;
$ac_cv_sizeof_long) USIZE32="unsigned long";;
esac
fi
fi
if test x$has_int64_t = "xyes" ; then
SIZE64="int64_t"
else
case 8 in case 8 in
$ac_cv_sizeof_int) SIZE64="int";; $ac_cv_sizeof_int) SIZE64="int";;
$ac_cv_sizeof_long) SIZE64="long";; $ac_cv_sizeof_long) SIZE64="long";;
$ac_cv_sizeof_long_long) SIZE64="long long";; $ac_cv_sizeof_long_long) SIZE64="long long";;
esac esac
fi
if test -z "$SIZE16"; then if test -z "$SIZE16"; then
AC_MSG_ERROR(No 16 bit type found on this platform!) AC_MSG_ERROR(No 16 bit type found on this platform!)
...@@ -204,6 +319,9 @@ fi ...@@ -204,6 +319,9 @@ fi
if test -z "$SIZE32"; then if test -z "$SIZE32"; then
AC_MSG_ERROR(No 32 bit type found on this platform!) AC_MSG_ERROR(No 32 bit type found on this platform!)
fi fi
if test -z "$USIZE32"; then
AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
fi
if test -z "$SIZE64"; then if test -z "$SIZE64"; then
AC_MSG_WARN(No 64 bit type found on this platform!) AC_MSG_WARN(No 64 bit type found on this platform!)
fi fi
...@@ -225,6 +343,7 @@ AC_CHECK_FUNCS(gettimeofday select strcspn strerror strspn sigaction) ...@@ -225,6 +343,7 @@ AC_CHECK_FUNCS(gettimeofday select strcspn strerror strspn sigaction)
AC_SUBST(SIZE16) AC_SUBST(SIZE16)
AC_SUBST(SIZE32) AC_SUBST(SIZE32)
AC_SUBST(USIZE32)
AC_SUBST(SIZE64) AC_SUBST(SIZE64)
AC_SUBST(OPT) AC_SUBST(OPT)
AC_SUBST(LIBS) AC_SUBST(LIBS)
...@@ -238,6 +357,7 @@ AC_SUBST(pthread_lib) ...@@ -238,6 +357,7 @@ AC_SUBST(pthread_lib)
AC_CONFIG_SUBDIRS(vorbis-tools/libao) AC_CONFIG_SUBDIRS(vorbis-tools/libao)
AC_OUTPUT(Makefile lib/Makefile examples/Makefile vorbis-tools/Makefile\ AC_OUTPUT(Makefile lib/Makefile examples/Makefile include/vorbis/os_types.h\
vorbis-tools/Makefile\
vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile) vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile)
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
******************************************************************** ********************************************************************
function: simple example decoder function: simple example decoder
last mod: $Id: decoder_example.c,v 1.11 2000/08/15 01:05:26 xiphmont Exp $ last mod: $Id: decoder_example.c,v 1.12 2000/08/30 06:09:21 xiphmont Exp $
********************************************************************/ ********************************************************************/
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <console.h> /* CodeWarrior's Mac "command-line" support */ #include <console.h> /* CodeWarrior's Mac "command-line" support */
#endif #endif
int16_t convbuffer[4096]; /* take 8k out of the data segment, not the stack */ ogg_int16_t convbuffer[4096]; /* take 8k out of the data segment, not the stack */
int convsize=4096; int convsize=4096;
int main(int argc, char **argv){ int main(int argc, char **argv){
...@@ -236,7 +236,7 @@ int main(int argc, char **argv){ ...@@ -236,7 +236,7 @@ int main(int argc, char **argv){
/* convert doubles to 16 bit signed ints (host order) and /* convert doubles to 16 bit signed ints (host order) and
interleave */ interleave */
for(i=0;i<vi.channels;i++){ for(i=0;i<vi.channels;i++){
int16_t *ptr=convbuffer+i; ogg_int16_t *ptr=convbuffer+i;
double *mono=pcm[i]; double *mono=pcm[i];
for(j=0;j<bout;j++){ for(j=0;j<bout;j++){
int val=mono[j]*32767.; int val=mono[j]*32767.;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
******************************************************************** ********************************************************************
function: libvorbis codec headers function: libvorbis codec headers
last mod: $Id: codec.h,v 1.27 2000/08/23 10:27:14 xiphmont Exp $ last mod: $Id: codec.h,v 1.28 2000/08/30 06:09:21 xiphmont Exp $
********************************************************************/ ********************************************************************/
...@@ -171,7 +171,7 @@ typedef struct { ...@@ -171,7 +171,7 @@ typedef struct {
int *lacing_vals; /* The values that will go to the segment table */ int *lacing_vals; /* The values that will go to the segment table */
int64_t *pcm_vals; /* pcm_pos values for headers. Not compact ogg_int64_t *pcm_vals; /* pcm_pos values for headers. Not compact
this way, but it is simple coupled to the this way, but it is simple coupled to the
lacing fifo */ lacing fifo */
long lacing_storage; long lacing_storage;
...@@ -188,12 +188,12 @@ typedef struct { ...@@ -188,12 +188,12 @@ typedef struct {
of a logical bitstream */ of a logical bitstream */
long serialno; long serialno;
int pageno; int pageno;
int64_t packetno; /* sequence number for decode; the framing ogg_int64_t packetno; /* sequence number for decode; the framing
knows where there's a hole in the data, knows where there's a hole in the data,
but we need coupling so that the codec but we need coupling so that the codec
(which is in a seperate abstraction (which is in a seperate abstraction
layer) also knows about the gap */ layer) also knows about the gap */
int64_t pcmpos; ogg_int64_t pcmpos;
} ogg_stream_state; } ogg_stream_state;
...@@ -206,8 +206,8 @@ typedef struct { ...@@ -206,8 +206,8 @@ typedef struct {
long b_o_s; long b_o_s;
long e_o_s; long e_o_s;
int64_t frameno; ogg_int64_t frameno;
int64_t packetno; /* sequence number for decode; the framing ogg_int64_t packetno; /* sequence number for decode; the framing
knows where there's a hole in the data, knows where there's a hole in the data,
but we need coupling so that the codec but we need coupling so that the codec
(which is in a seperate abstraction (which is in a seperate abstraction
...@@ -248,13 +248,13 @@ typedef struct vorbis_dsp_state{ ...@@ -248,13 +248,13 @@ typedef struct vorbis_dsp_state{
long nW; long nW;
long centerW; long centerW;
int64_t frameno; ogg_int64_t frameno;
int64_t sequence; ogg_int64_t sequence;
int64_t glue_bits; ogg_int64_t glue_bits;
int64_t time_bits; ogg_int64_t time_bits;
int64_t floor_bits; ogg_int64_t floor_bits;
int64_t res_bits; ogg_int64_t res_bits;
/* local lookup storage */ /* local lookup storage */
void *ve; /* envelope lookup */ void *ve; /* envelope lookup */
...@@ -296,8 +296,8 @@ typedef struct vorbis_block{ ...@@ -296,8 +296,8 @@ typedef struct vorbis_block{
int mode; int mode;
int eofflag; int eofflag;
int64_t frameno; ogg_int64_t frameno;
int64_t sequence; ogg_int64_t sequence;
vorbis_dsp_state *vd; /* For read-only access of configuration */ vorbis_dsp_state *vd; /* For read-only access of configuration */
/* local storage to avoid remallocing; it's up to the mapping to /* local storage to avoid remallocing; it's up to the mapping to
...@@ -381,7 +381,7 @@ extern int ogg_page_version(ogg_page *og); ...@@ -381,7 +381,7 @@ extern int ogg_page_version(ogg_page *og);
extern int ogg_page_continued(ogg_page *og); extern int ogg_page_continued(ogg_page *og);
extern int ogg_page_bos(ogg_page *og); extern int ogg_page_bos(ogg_page *og);
extern int ogg_page_eos(ogg_page *og); extern int ogg_page_eos(ogg_page *og);
extern int64_t ogg_page_frameno(ogg_page *og); extern ogg_int64_t ogg_page_frameno(ogg_page *og);
extern int ogg_page_serialno(ogg_page *og); extern int ogg_page_serialno(ogg_page *og);
extern int ogg_page_pageno(ogg_page *og); extern int ogg_page_pageno(ogg_page *og);
......
...@@ -14,27 +14,42 @@ ...@@ -14,27 +14,42 @@
******************************************************************** ********************************************************************
function: #ifdef jail to whip a few platforms into the UNIX ideal. function: #ifdef jail to whip a few platforms into the UNIX ideal.
last mod: $Id: os_types.h,v 1.7 2000/08/30 01:40:12 xiphmont Exp $ last mod: $Id: os_types.h.in,v 1.1 2000/08/30 06:09:21 xiphmont Exp $
********************************************************************/ ********************************************************************/
#if defined (_WIN32) #if defined (_WIN32)
#if !defined(__GNUC__) #if !defined(__GNUC__)
typedef __int64 int64_t; /* MSVC/Borland */
typedef __int16 int16_t; typedef __int64 ogg_int64_t;
#define vorbis_size32_t int typedef __int32 ogg_int32_t;
typedef unsigned __int32 ogg_int32_t;
typedef __int16 ogg_int16_t;
#else #else
/* Cygwin */
#include <_G_config.h> #include <_G_config.h>
typedef _G_int64_t int64_t; typedef _G_int64_t ogg_int64_t;
typedef _G_int32_t int32_t; typedef _G_int32_t ogg_int32_t;
typedef _G_int16_t int16_t; typedef unsigned _G_int32_t ogg_int32_t;
#endif typedef _G_int16_t ogg_int16_t;
#endif #endif
#else
#ifdef __BEOS__ #ifdef __BEOS__
/* Be */
#include <inttypes.h> #include <inttypes.h>
#endif #endif
/* filled in by configure */
typedef @SIZE16@ ogg_int16_t;
typedef @SIZE32@ ogg_int32_t;
typedef @USIZE32@ ogg_uint32_t;
typedef @SIZE64@ ogg_int64_t;
#endif
#endif #endif
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
******************************************************************** ********************************************************************
function: stdio-based convenience library for opening/seeking/decoding function: stdio-based convenience library for opening/seeking/decoding
last mod: $Id: vorbisfile.h,v 1.6 2000/06/15 12:17:03 xiphmont Exp $ last mod: $Id: vorbisfile.h,v 1.7 2000/08/30 06:09:21 xiphmont Exp $
********************************************************************/ ********************************************************************/
...@@ -39,7 +39,7 @@ extern "C" ...@@ -39,7 +39,7 @@ extern "C"
*/ */
typedef struct { typedef struct {
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
int (*seek_func) (void *datasource, int64_t offset, int whence); int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
int (*close_func) (void *datasource); int (*close_func) (void *datasource);
long (*tell_func) (void *datasource); long (*tell_func) (void *datasource);
} ov_callbacks; } ov_callbacks;
...@@ -48,22 +48,22 @@ typedef struct { ...@@ -48,22 +48,22 @@ typedef struct {
typedef struct { typedef struct {
void *datasource; /* Pointer to a FILE *, etc. */ void *datasource; /* Pointer to a FILE *, etc. */
int seekable; int seekable;
int64_t offset; ogg_int64_t offset;
int64_t end; ogg_int64_t end;
ogg_sync_state oy; ogg_sync_state oy;
/* If the FILE handle isn't seekable (eg, a pipe), only the current /* If the FILE handle isn't seekable (eg, a pipe), only the current
stream appears */ stream appears */
int links; int links;
int64_t *offsets; ogg_int64_t *offsets;
int64_t *dataoffsets; ogg_int64_t *dataoffsets;
long *serialnos; long *serialnos;
int64_t *pcmlengths; ogg_int64_t *pcmlengths;
vorbis_info *vi; vorbis_info *vi;
vorbis_comment *vc; vorbis_comment *vc;
/* Decoding working state local storage */ /* Decoding working state local storage */
int64_t pcm_offset; ogg_int64_t pcm_offset;
int decode_ready; int decode_ready;
long current_serialno; long current_serialno;
int current_link; int current_link;
...@@ -91,16 +91,16 @@ extern long ov_streams(OggVorbis_File *vf); ...@@ -91,16 +91,16 @@ extern long ov_streams(OggVorbis_File *vf);
extern long ov_seekable(OggVorbis_File *vf); extern long ov_seekable(OggVorbis_File *vf);
extern long ov_serialnumber(OggVorbis_File *vf,int i); extern long ov_serialnumber(OggVorbis_File *vf,int i);
extern int64_t ov_raw_total(OggVorbis_File *vf,int i); extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
extern int64_t ov_pcm_total(OggVorbis_File *vf,int i); extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
extern double ov_time_total(OggVorbis_File *vf,int i); extern double ov_time_total(OggVorbis_File *vf,int i);
extern int ov_raw_seek(OggVorbis_File *vf,long pos); extern int ov_raw_seek(OggVorbis_File *vf,long pos);
extern int ov_pcm_seek(OggVorbis_File *vf,int64_t pos); extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
extern int ov_time_seek(OggVorbis_File *vf,double pos); extern int ov_time_seek(OggVorbis_File *vf,double pos);
extern int64_t ov_raw_tell(OggVorbis_File *vf); extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
extern int64_t ov_pcm_tell(OggVorbis_File *vf); extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
extern double ov_time_tell(OggVorbis_File *vf); extern double ov_time_tell(OggVorbis_File *vf);
extern vorbis_info *ov_info(OggVorbis_File *vf,int link); extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
......
# vorbis makefile configured for use with gcc on any platform # vorbis makefile configured for use with gcc on any platform
# $Id: Makefile.in,v 1.33 2000/07/12 09:36:17 xiphmont Exp $ # $Id: Makefile.in,v 1.34 2000/08/30 06:09:21 xiphmont Exp $
############################################################################### ###############################################################################
# # # #
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# (unless, of course, you know what you are doing :) ########################## # (unless, of course, you know what you are doing :) ##########################
@SET_MAKE@ @SET_MAKE@
FLAGS=-I. -I../include @CFLAGS@ -Dvorbis_size32_t='@SIZE32@' FLAGS=-I. -I../include @CFLAGS@
OPT=@OPT@ $(FLAGS) OPT=@OPT@ $(FLAGS)
DEBUG=@DEBUG@ $(FLAGS) DEBUG=@DEBUG@ $(FLAGS)
PROFILE=@PROFILE@ $(FLAGS) PROFILE=@PROFILE@ $(FLAGS)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
function: code raw [Vorbis] packets into framed OggSquish stream and function: code raw [Vorbis] packets into framed OggSquish stream and
decode Ogg streams back into raw packets decode Ogg streams back into raw packets
last mod: $Id: framing.c,v 1.24 2000/08/15 09:09:42 xiphmont Exp $ last mod: $Id: framing.c,v 1.25 2000/08/30 06:09:21 xiphmont Exp $
note: The CRC code is directly derived from public domain code by note: The CRC code is directly derived from public domain code by
Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html
...@@ -44,9 +44,9 @@ int ogg_page_eos(ogg_page *og){ ...@@ -44,9 +44,9 @@ int ogg_page_eos(ogg_page *og){
return((int)(og->header[5]&0x04)); return((int)(og->header[5]&0x04));
} }
int64_t ogg_page_frameno(ogg_page *og){ ogg_int64_t ogg_page_frameno(ogg_page *og){
unsigned char *page=og->header; unsigned char *page=og->header;
int64_t pcmpos=page[13]&(0xff); ogg_int64_t pcmpos=page[13]&(0xff);
pcmpos= (pcmpos<<8)|(page[12]&0xff); pcmpos= (pcmpos<<8)|(page[12]&0xff);
pcmpos= (pcmpos<<8)|(page[11]&0xff); pcmpos= (pcmpos<<8)|(page[11]&0xff);
pcmpos= (pcmpos<<8)|(page[10]&0xff); pcmpos= (pcmpos<<8)|(page[10]&0xff);
...@@ -73,10 +73,10 @@ int ogg_page_pageno(ogg_page *og){ ...@@ -73,10 +73,10 @@ int ogg_page_pageno(ogg_page *og){
/* helper to initialize lookup for direct-table CRC */ /* helper to initialize lookup for direct-table CRC */
static unsigned vorbis_size32_t crc_lookup[256]; static ogg_uint32_t crc_lookup[256];
static int crc_ready=0; static int crc_ready=0;
static unsigned vorbis_size32_t _ogg_crc_entry(unsigned long index){ static ogg_uint32_t _ogg_crc_entry(unsigned long index){
int i; int i;
unsigned long r; unsigned long r;
...@@ -115,7 +115,7 @@ int ogg_stream_init(ogg_stream_state *os,int serialno){ ...@@ -115,7 +115,7 @@ int ogg_stream_init(ogg_stream_state *os,int serialno){
os->lacing_storage=1024; os->lacing_storage=1024;
os->lacing_vals=malloc(os->lacing_storage*sizeof(int)); os->lacing_vals=malloc(os->lacing_storage*sizeof(int));
os->pcm_vals=malloc(os->lacing_storage*sizeof(int64_t)); os->pcm_vals=malloc(os->lacing_storage*sizeof(ogg_int64_t));
/* initialize the crc_lookup table if not done */ /* initialize the crc_lookup table if not done */
_ogg_crc_init(); _ogg_crc_init();
...@@ -161,7 +161,7 @@ static void _os_lacing_expand(ogg_stream_state *os,int needed){ ...@@ -161,7 +161,7 @@ static void _os_lacing_expand(ogg_stream_state *os,int needed){
if(os->lacing_storage<=os->lacing_fill+needed){ if(os->lacing_storage<=os->lacing_fill+needed){
os->lacing_storage+=(needed+32); os->lacing_storage+=(needed+32);
os->lacing_vals=realloc(os->lacing_vals,os->lacing_storage*sizeof(int)); os->lacing_vals=realloc(os->lacing_vals,os->lacing_storage*sizeof(int));
os->pcm_vals=realloc(os->pcm_vals,os->lacing_storage*sizeof(int64_t)); os->pcm_vals=realloc(os->pcm_vals,os->lacing_storage*sizeof(ogg_int64_t));
} }
} }
...@@ -170,7 +170,7 @@ static void _os_lacing_expand(ogg_stream_state *os,int needed){ ...@@ -170,7 +170,7 @@ static void _os_lacing_expand(ogg_stream_state *os,int needed){
perform the checksum silmultaneously with other copies */ perform the checksum silmultaneously with other copies */
static void _os_checksum(ogg_page *og){ static void _os_checksum(ogg_page *og){
unsigned vorbis_size32_t crc_reg=0; ogg_uint32_t crc_reg=0;
int i;