alsa/0029-Portability-fix-look-for-sys-endian.h-as-well-as-end.patch
Takashi Iwai 62cc03c4bc Accepting request 225572 from home:tiwai:branches:multimedia:libs
- Update alsa-info.sh to match dmesg with snd_
- Run spec-cleaner
- Add missing Loopback.conf manually
- Upstream fixes: minor clean ups, 2.1 PCM channel config support,
  portability improvements, PCM float format conversion fix,
  fix for ioplug 32bit hwptr wrap, etc.
  0020-minor-malloc-changes.patch
  0021-alsa-lib-minor-typo-in-pcm-doc.patch
  0022-control_hw-fix-potential-memory-leak.patch
  0023-pcm-initialize-pcm_dmix-monotonic-field.patch
  0024-pcm-initialize-monotonic-field-for-dshare-and-dsnoop.patch
  0025-pcm-use-CLOCK_REALTIME-for-non-monotonic-ts.patch
  0026-alsa-lib-heavy-pcm-atomics-cleanup.patch
  0027-conf-Add-basic-infrastructure-for-2.1-surround-sound.patch
  0028-conf-Add-surround-2.1-support-to-all-cards.patch
  0029-Portability-fix-look-for-sys-endian.h-as-well-as-end.patch
  0030-autotools-update-style.patch
  0031-pcm-Insert-linear-to-float-conversion-when-rate-or-c.patch
  0032-pcm-route-Allow-chmap-syntax-for-slave-channels-in-t.patch
  0033-pcm-route-Select-slave-chmap-based-on-ttable-informa.patch
  0034-conf-Allow-2.1-surround-to-use-different-number-of-c.patch
  0035-pcm-Wrap-hw_ptr-to-boundary-in-pcm_ioplug.patch
  0036-src-conf-cards-Add-missing-entry-for-Loopback.conf.patch

OBS-URL: https://build.opensuse.org/request/show/225572
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=152
2014-03-11 11:08:29 +00:00

151 lines
3.9 KiB
Diff

From 7a6e8ca348c4c2640cbc337914d1376333fdbc17 Mon Sep 17 00:00:00 2001
From: Patrick Welche <prlw1@cam.ac.uk>
Date: Sun, 23 Feb 2014 11:12:48 +0000
Subject: [PATCH] Portability fix: look for sys/endian.h as well as endian.h
- define __BYTE_ORDER and friends.
- adjust asoundlib.h accordingly.
Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
configure.in | 33 +++++++++++++++++++++++++++++++--
include/asoundlib-head.h | 13 -------------
include/local.h | 18 +++++++++++++++++-
src/pcm/pcm_file.c | 1 -
4 files changed, 48 insertions(+), 17 deletions(-)
diff --git a/configure.in b/configure.in
index bb56eb653ccc..9463b5ad4766 100644
--- a/configure.in
+++ b/configure.in
@@ -309,8 +309,8 @@ fi
AC_SUBST(ALSA_DEPLIBS)
-dnl Check for wordexp.h
-AC_CHECK_HEADERS([wordexp.h])
+dnl Check for headers
+AC_CHECK_HEADERS([wordexp.h endian.h sys/endian.h])
dnl Check for resmgr support...
AC_MSG_CHECKING(for resmgr support)
@@ -660,6 +660,35 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
dnl Create asoundlib.h dynamically according to configure options
echo "Creating asoundlib.h..."
cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h
+test "$ac_cv_header_endian_h" = "yes" && echo "#include <endian.h>" >> include/asoundlib.h
+if test "$ac_cv_header_sys_endian_h" = "yes"; then
+cat >> include/asoundlib.h <<EOF
+#include <sys/endian.h>
+#ifndef __BYTE_ORDER
+#define __BYTE_ORDER BYTE_ORDER
+#endif
+#ifndef __LITTLE_ENDIAN
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#endif
+#ifndef __BIG_ENDIAN
+#define __BIG_ENDIAN BIG_ENDIAN
+#endif
+EOF
+fi
+cat >> include/asoundlib.h <<EOF
+
+#ifndef __GNUC__
+#define __inline__ inline
+#endif
+
+#include <alsa/asoundef.h>
+#include <alsa/version.h>
+#include <alsa/global.h>
+#include <alsa/input.h>
+#include <alsa/output.h>
+#include <alsa/error.h>
+#include <alsa/conf.h>
+EOF
test "$build_pcm" = "yes" && echo "#include <alsa/pcm.h>" >> include/asoundlib.h
test "$build_rawmidi" = "yes" && echo "#include <alsa/rawmidi.h>" >> include/asoundlib.h
test "$build_pcm" = "yes" && echo "#include <alsa/timer.h>" >> include/asoundlib.h
diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h
index 71b5c29f61c4..1ec611e56b8e 100644
--- a/include/asoundlib-head.h
+++ b/include/asoundlib-head.h
@@ -35,19 +35,6 @@
#include <string.h>
#include <fcntl.h>
#include <assert.h>
-#include <endian.h>
#include <sys/poll.h>
#include <errno.h>
#include <stdarg.h>
-
-#ifndef __GNUC__
-#define __inline__ inline
-#endif
-
-#include <alsa/asoundef.h>
-#include <alsa/version.h>
-#include <alsa/global.h>
-#include <alsa/input.h>
-#include <alsa/output.h>
-#include <alsa/error.h>
-#include <alsa/conf.h>
diff --git a/include/local.h b/include/local.h
index 9464efa49642..2fe9a273f0b0 100644
--- a/include/local.h
+++ b/include/local.h
@@ -22,13 +22,30 @@
#ifndef __LOCAL_H
#define __LOCAL_H
+#include "config.h"
+
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
+#ifdef HAVE_ENDIAN_H
#include <endian.h>
+#elif defined(HAVE_SYS_ENDIAN_H)
+#include <sys/endian.h>
+#ifndef __BYTE_ORDER
+#define __BYTE_ORDER BYTE_ORDER
+#endif
+#ifndef __LITTLE_ENDIAN
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#endif
+#ifndef __BIG_ENDIAN
+#define __BIG_ENDIAN BIG_ENDIAN
+#endif
+#else
+#error Header defining endianness not defined
+#endif
#include <stdarg.h>
#include <sys/poll.h>
#include <sys/types.h>
@@ -36,7 +53,6 @@
#include <linux/types.h>
#include <linux/ioctl.h>
-#include "config.h"
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c
index 712302598a9f..b1f23304633f 100644
--- a/src/pcm/pcm_file.c
+++ b/src/pcm/pcm_file.c
@@ -26,7 +26,6 @@
*
*/
-#include <endian.h>
#include <byteswap.h>
#include <ctype.h>
#include <string.h>
--
1.9.0