diff options
author | Ron <ron@debian.org> | 2013-12-07 20:31:56 +0400 |
---|---|---|
committer | Ron <ron@debian.org> | 2013-12-07 20:31:56 +0400 |
commit | ef80120166c3a2552f77008f40c59a84577a36b5 (patch) | |
tree | 9040bc356b2f053d3007b5a92ee8bb74b135296d /configure.ac | |
parent | 8aa51a2074b2dd272d9a7e3f164d8efdd6c229cc (diff) |
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.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 86 |
1 files changed, 56 insertions, 30 deletions
diff --git a/configure.ac b/configure.ac index 40606ea..0626347 100644 --- a/configure.ac +++ b/configure.ac @@ -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 |