[PATCH] Include the right headers from compile time checks

Jan Gerber <[email protected]> Sun, 02 Mar 2014 18:37:42 +0100
Newsgroups gmane.comp.audio.compression.speex.devel
Message-ID <[email protected]>
Include the type headers detected in configure
in the same way its done in ogg.

Fowllow up to ef80120166c3a2552f77008f40c59a84577a36b5

---
 configure.ac                          | 13 +++++++++++++
 include/speex/speex_config_types.h.in | 15 +++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

_______________________________________________
Speex-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/speex-dev
0001-PATCH-Include-the-right-headers-from-compile-time-ch.patch (text/x-patch, 1.8 KB)
diff --git a/configure.ac b/configure.ac
index 07ebff2..b0f25d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -250,6 +250,16 @@ 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])
 
+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)
+
+
 
 AC_CHECK_SIZEOF([int16_t])
 AC_CHECK_SIZEOF([uint16_t])
@@ -303,6 +313,9 @@ 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(INCLUDE_INTTYPES_H)
+AC_SUBST(INCLUDE_STDINT_H)
+AC_SUBST(INCLUDE_SYS_TYPES_H)
 AC_SUBST([SIZE16])
 AC_SUBST([USIZE16])
 AC_SUBST([SIZE32])
diff --git a/include/speex/speex_config_types.h.in b/include/speex/speex_config_types.h.in
index 02b82fd..915af8a 100644
--- a/include/speex/speex_config_types.h.in
+++ b/include/speex/speex_config_types.h.in
@@ -1,11 +1,18 @@
 #ifndef __SPEEX_TYPES_H__
 #define __SPEEX_TYPES_H__
 
-#if defined HAVE_STDINT_H
-#  include <stdint.h>
-#elif defined HAVE_INTTYPES_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>
-#elif defined HAVE_SYS_TYPES_H
+#endif
+#if INCLUDE_STDINT_H
+#  include <stdint.h>
+#endif
+#if INCLUDE_SYS_TYPES_H
 #  include <sys/types.h>
 #endif