Commit ef801201 authored by Ron's avatar Ron

Prefer the stdint types if available

This is similar to the change we did in libogg some time back,
it means the generated header is less likely to vary unnecessarily
between system architectures.
parent 8aa51a20
......@@ -250,38 +250,64 @@ AM_CONDITIONAL(BUILD_VORBIS_PSY, [test "x$vorbis_psy" = "xyes"])
PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [AC_DEFINE([USE_SPEEXDSP], [], [Use SpeexDSP library])], [speexdsp_failed=yes])
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
if test x$has_char16 = "xyes" ; then
case 1 in
$ac_cv_sizeof_short) SIZE16="short";;
$ac_cv_sizeof_int) SIZE16="int";;
esac
else
case 2 in
$ac_cv_sizeof_short) SIZE16="short";;
$ac_cv_sizeof_int) SIZE16="int";;
esac
fi
if test x$has_char16 = "xyes" ; then
case 2 in
$ac_cv_sizeof_int) SIZE32="int";;
$ac_cv_sizeof_long) SIZE32="long";;
$ac_cv_sizeof_short) SIZE32="short";;
esac
else
case 4 in
$ac_cv_sizeof_int) SIZE32="int";;
$ac_cv_sizeof_long) SIZE32="long";;
$ac_cv_sizeof_short) SIZE32="short";;
esac
fi
AC_CHECK_SIZEOF([int16_t])
AC_CHECK_SIZEOF([uint16_t])
AC_CHECK_SIZEOF([u_int16_t])
AC_CHECK_SIZEOF([int32_t])
AC_CHECK_SIZEOF([uint32_t])
AC_CHECK_SIZEOF([u_int32_t])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AS_IF([test "$has_char16" = "yes"],
[
SIZEOF16=1
SIZEOF32=2
],[
SIZEOF16=2
SIZEOF32=4
])
case $SIZEOF16 in
$ac_cv_sizeof_int16_t) SIZE16="int16_t";;
$ac_cv_sizeof_short) SIZE16="short";;
$ac_cv_sizeof_int) SIZE16="int";;
esac
case $SIZEOF16 in
$ac_cv_sizeof_uint16_t) USIZE16="uint16_t";;
$ac_cv_sizeof_u_int16_t) USIZE16="u_int16_t";;
$ac_cv_sizeof_short) USIZE16="unsigned short";;
$ac_cv_sizeof_int) USIZE16="unsigned int";;
esac
case $SIZEOF32 in
$ac_cv_sizeof_int32_t) SIZE32="int32_t";;
$ac_cv_sizeof_int) SIZE32="int";;
$ac_cv_sizeof_long) SIZE32="long";;
$ac_cv_sizeof_short) SIZE32="short";;
esac
case $SIZEOF32 in
$ac_cv_sizeof_uint32_t) USIZE32="uint32_t";;
$ac_cv_sizeof_u_int32_t) USIZE32="u_int32_t";;
$ac_cv_sizeof_short) USIZE32="unsigned short";;
$ac_cv_sizeof_int) USIZE32="unsigned int";;
$ac_cv_sizeof_long) USIZE32="unsigned long";;
esac
AS_IF([test -z "$SIZE16"],[AC_MSG_ERROR([No 16 bit type found on this platform!])])
AS_IF([test -z "$SIZE32"],[AC_MSG_ERROR([No 32 bit type found on this platform!])])
AS_IF([test -z "$USIZE16"],[AC_MSG_ERROR([No unsigned 16 bit type found on this platform!])])
AS_IF([test -z "$USIZE32"],[AC_MSG_ERROR([No unsigned 32 bit type found on this platform!])])
AC_SUBST([SIZE16])
AC_SUBST([USIZE16])
AC_SUBST([SIZE32])
AC_SUBST([USIZE32])
AC_SUBST(SIZE16)
AC_SUBST(SIZE32)
AC_CONFIG_FILES([
Makefile libspeex/Makefile src/Makefile doc/Makefile Speex.spec
......
#ifndef __SPEEX_TYPES_H__
#define __SPEEX_TYPES_H__
/* these are filled in by configure */
#if defined HAVE_STDINT_H
# include <stdint.h>
#elif defined HAVE_INTTYPES_H
# include <inttypes.h>
#elif defined HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
typedef @SIZE16@ spx_int16_t;
typedef unsigned @SIZE16@ spx_uint16_t;
typedef @USIZE16@ spx_uint16_t;
typedef @SIZE32@ spx_int32_t;
typedef unsigned @SIZE32@ spx_uint32_t;
typedef @USIZE32@ spx_uint32_t;
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment