[xiph-commits] r17566 - in trunk/ogg: . include/ogg
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Tue Oct 26 03:56:31 PDT 2010
Author: xiphmont
Date: 2010-10-26 03:56:31 -0700 (Tue, 26 Oct 2010)
New Revision: 17566
Modified:
trunk/ogg/configure.in
trunk/ogg/include/ogg/config_types.h.in
trunk/ogg/include/ogg/os_types.h
Log:
Update/modernize the configure type checking, account for the fact that
int types might come from one of three different includes on a modern
system. Try, if possible, to use types that don't rely on any of the
includes such that the oldest systems have more of a fighting chance.
Addresses Trac #849
Modified: trunk/ogg/configure.in
===================================================================
--- trunk/ogg/configure.in 2010-10-25 21:17:23 UTC (rev 17565)
+++ trunk/ogg/configure.in 2010-10-26 10:56:31 UTC (rev 17566)
@@ -85,186 +85,64 @@
dnl Checks for header files.
AC_HEADER_STDC
+INCLUDE_INTTYPES_H=0
+INCLUDE_STDINT_H=0
+INCLUDE_SYS_TYPES_H=0
+AC_CHECK_HEADER(inttypes.h,INCLUDE_INTTYPES_H=1)
+AC_CHECK_HEADER(stdint.h,INCLUDE_STDINT_H=1)
+AC_CHECK_HEADER(sys/types.h,INCLUDE_SYS_TYPES_H=1)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl Check for types
-AC_MSG_CHECKING(for int16_t)
-AC_CACHE_VAL(has_cv_int16_t,
-[AC_TRY_RUN([
-#if defined __BEOS__ && !defined __HAIKU__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-int16_t foo;
-int main() {return 0;}
-],
-has_cv_int16_t=yes,
-has_cv_int16_t=no,
-has_cv_int16_t=no
-)])
-AC_MSG_RESULT($has_cv_int16_t)
+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(int64_t)
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
-AC_MSG_CHECKING(for int32_t)
-AC_CACHE_VAL(has_cv_int32_t,
-[AC_TRY_RUN([
-#if defined __BEOS__ && !defined __HAIKU__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-int32_t foo;
-int main() {return 0;}
-],
-has_cv_int32_t=yes,
-has_cv_int32_t=no,
-has_cv_int32_t=no
-)])
-AC_MSG_RESULT($has_cv_int32_t)
+case 2 in
+ $ac_cv_sizeof_short) SIZE16="short";;
+ $ac_cv_sizeof_int) SIZE16="int";;
+ $ac_cv_sizeof_int16_t) SIZE16="int16_t";;
+esac
-AC_MSG_CHECKING(for uint32_t)
-AC_CACHE_VAL(has_cv_uint32_t,
-[AC_TRY_RUN([
-#if defined __BEOS__ && !defined __HAIKU__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-uint32_t foo;
-int main() {return 0;}
-],
-has_cv_uint32_t=yes,
-has_cv_uint32_t=no,
-has_cv_uint32_t=no
-)])
-AC_MSG_RESULT($has_cv_uint32_t)
+case 2 in
+ $ac_cv_sizeof_short) USIZE16="unsigned short";;
+ $ac_cv_sizeof_int) USIZE16="unsigned int";;
+ $ac_cv_sizeof_u_int16_t) USIZE16="u_int16_t";;
+ $ac_cv_sizeof_uint16_t) USIZE16="uint16_t";;
+esac
-AC_MSG_CHECKING(for uint16_t)
-AC_CACHE_VAL(has_cv_uint16_t,
-[AC_TRY_RUN([
-#if defined __BEOS__ && !defined __HAIKU__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-uint16_t foo;
-int main() {return 0;}
-],
-has_cv_uint16_t=yes,
-has_cv_uint16_t=no,
-has_cv_uint16_t=no
-)])
-AC_MSG_RESULT($has_cv_uint16_t)
+case 4 in
+ $ac_cv_sizeof_short) SIZE32="short";;
+ $ac_cv_sizeof_int) SIZE32="int";;
+ $ac_cv_sizeof_long) SIZE32="long";;
+ $ac_cv_sizeof_int32_t) SIZE32="int32_t";;
+esac
-AC_MSG_CHECKING(for u_int32_t)
-AC_CACHE_VAL(has_cv_u_int32_t,
-[AC_TRY_RUN([
-#if defined __BEOS__ && !defined __HAIKU__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-u_int32_t foo;
-int main() {return 0;}
-],
-has_cv_u_int32_t=yes,
-has_cv_u_int32_t=no,
-has_cv_u_int32_t=no
-)])
-AC_MSG_RESULT($has_cv_u_int32_t)
+case 4 in
+ $ac_cv_sizeof_short) USIZE32="unsigned short";;
+ $ac_cv_sizeof_int) USIZE32="unsigned int";;
+ $ac_cv_sizeof_long) USIZE32="unsigned long";;
+ $ac_cv_sizeof_u_int32_t) USIZE32="u_int32_t";;
+ $ac_cv_sizeof_uint32_t) USIZE32="uint32_t";;
+esac
-AC_MSG_CHECKING(for u_int16_t)
-AC_CACHE_VAL(has_cv_u_int16_t,
-[AC_TRY_RUN([
-#if defined __BEOS__ && !defined __HAIKU__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-u_int16_t foo;
-int main() {return 0;}
-],
-has_cv_u_int16_t=yes,
-has_cv_u_int16_t=no,
-has_cv_u_int16_t=no
-)])
-AC_MSG_RESULT($has_cv_u_int16_t)
-
-AC_MSG_CHECKING(for int64_t)
-AC_CACHE_VAL(has_cv_int64_t,
-[AC_TRY_RUN([
-#if defined __BEOS__ && !defined __HAIKU__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-int64_t foo;
-int main() {return 0;}
-],
-has_cv_int64_t=yes,
-has_cv_int64_t=no,
-has_cv_int64_t=no
-)])
-AC_MSG_RESULT($has_cv_int64_t)
-
-AC_CHECK_SIZEOF(short,2)
-AC_CHECK_SIZEOF(int,4)
-AC_CHECK_SIZEOF(long,4)
-AC_CHECK_SIZEOF(long long,8)
-
-
-if test x$has_cv_int16_t = "xyes" ; then
- SIZE16="int16_t"
-else
- case 2 in
- $ac_cv_sizeof_short) SIZE16="short";;
- $ac_cv_sizeof_int) SIZE16="int";;
- esac
-fi
-
-if test x$has_cv_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_cv_uint32_t = "xyes" ; then
- USIZE32="uint32_t"
-else
- if test x$has_cv_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_cv_uint16_t = "xyes" ; then
- USIZE16="uint16_t"
-else
- if test x$has_cv_u_int16_t = "xyes" ; then
- USIZE16="u_int16_t"
- else
- case 2 in
- $ac_cv_sizeof_short) USIZE16="unsigned short";;
- $ac_cv_sizeof_int) USIZE16="unsigned int";;
- $ac_cv_sizeof_long) USIZE16="unsigned long";;
- esac
- fi
-fi
-
-if test x$has_cv_int64_t = "xyes" ; then
- SIZE64="int64_t"
-else
case 8 in
- $ac_cv_sizeof_int) SIZE64="int";;
- $ac_cv_sizeof_long) SIZE64="long";;
- $ac_cv_sizeof_long_long) SIZE64="long long";;
+ $ac_cv_sizeof_int) SIZE64="int";;
+ $ac_cv_sizeof_long) SIZE64="long";;
+ $ac_cv_sizeof_long_long) SIZE64="long long";;
+ $ac_cv_sizeof_int64_t) SIZE64="int64_t";;
esac
-fi
if test -z "$SIZE16"; then
AC_MSG_ERROR(No 16 bit type found on this platform!)
@@ -288,6 +166,9 @@
dnl Make substitutions
AC_SUBST(LIBTOOL_DEPS)
+AC_SUBST(INCLUDE_INTTYPES_H)
+AC_SUBST(INCLUDE_STDINT_H)
+AC_SUBST(INCLUDE_SYS_TYPES_H)
AC_SUBST(SIZE16)
AC_SUBST(USIZE16)
AC_SUBST(SIZE32)
Modified: trunk/ogg/include/ogg/config_types.h.in
===================================================================
--- trunk/ogg/include/ogg/config_types.h.in 2010-10-25 21:17:23 UTC (rev 17565)
+++ trunk/ogg/include/ogg/config_types.h.in 2010-10-26 10:56:31 UTC (rev 17566)
@@ -2,6 +2,20 @@
#define __CONFIG_TYPES_H__
/* these are filled in by configure */
+#define INCLUDE_INTTYPES_H @INCLUDE_INTTYPES_H@
+#define INCLUDE_STDINT_H @INCLUDE_STDINT_H@
+#define INCLUDE_SYS_TYPES_H @INCLUDE_SYS_TYPES_H@
+
+#if INCLUDE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if INCLUDE_STDINT_H
+# include <stdint.h>
+#endif
+#if INCLUDE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
typedef @SIZE16@ ogg_int16_t;
typedef @USIZE16@ ogg_uint16_t;
typedef @SIZE32@ ogg_int32_t;
Modified: trunk/ogg/include/ogg/os_types.h
===================================================================
--- trunk/ogg/include/ogg/os_types.h 2010-10-25 21:17:23 UTC (rev 17565)
+++ trunk/ogg/include/ogg/os_types.h 2010-10-26 10:56:31 UTC (rev 17566)
@@ -68,7 +68,7 @@
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
-# include <sys/types.h>
+# include <inttypes.h>
typedef int16_t ogg_int16_t;
typedef u_int16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
@@ -140,7 +140,6 @@
#else
-# include <sys/types.h>
# include <ogg/config_types.h>
#endif
More information about the commits
mailing list