From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick Welche Subject: Re: alsa on non-linux Date: Sun, 23 Feb 2014 11:12:48 +0000 Message-ID: <20140223111248.GA971@quantz> References: <20140110153700.GC1173@quark.internal.precedence.co.uk> <20140114101709.GB160@quark.internal.precedence.co.uk> <20140221012704.GA15861@quantz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="u3/rZRmxL6MmkK24" Return-path: Received: from ppsw-52.csi.cam.ac.uk (ppsw-52.csi.cam.ac.uk [131.111.8.152]) by alsa0.perex.cz (Postfix) with ESMTP id D42ED265083 for ; Sun, 23 Feb 2014 12:13:03 +0100 (CET) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Iwai Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 21, 2014 at 12:04:03PM +0100, Takashi Iwai wrote: > At Fri, 21 Feb 2014 01:27:04 +0000, > Patrick Welche wrote: > > > > On Tue, Jan 14, 2014 at 02:23:01PM +0100, Takashi Iwai wrote: > > > BTW, about your patch: I don't think it's good to embed the endianness > > > in asoundlib.h. It makes the header file appearing differently, > > > depending on the architecture, which is rather confusing. > > > > Is this more what you have in mind? (Less portable than autoconf, but > > not set at configure time.) > > Yes, I supposed something like that. > > > > > The four files which included endian.h were: > > > > - include/asoundlib-head.h > > - include/local.h > > - include/sound/type_compat.h > > - src/pcm/pcm_file.c > > > > The endian.h line(s) in asoundlib.h is now generated by configure. > > Looks almost good, but I prefer seeing it just after #include > instead of the middle in alsa/* inclusions. > > Other than that, all look good to me. > Could you fix and resubmit with your sign-off? Version 2 with some of asoundlib-head.h moved to configure.in. (Fancy a patch to rename configure.in configure.ac, s/INCLUDES/AM_CPPFLAGS/?) Cheers, Patrick --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Portability-fix-look-for-sys-endian.h-as-well-as-end_v2.patch" >>From b14f62d1345b563e9b8f525efb00f30312b17cc2 Mon Sep 17 00:00:00 2001 From: Patrick Welche Date: Sun, 23 Feb 2014 11:02:28 +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 --- 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 bb56eb6..9463b5a 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 " >> include/asoundlib.h +if test "$ac_cv_header_sys_endian_h" = "yes"; then +cat >> include/asoundlib.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 < +#include +#include +#include +#include +#include +#include +EOF test "$build_pcm" = "yes" && echo "#include " >> include/asoundlib.h test "$build_rawmidi" = "yes" && echo "#include " >> include/asoundlib.h test "$build_pcm" = "yes" && echo "#include " >> include/asoundlib.h diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h index 71b5c29..1ec611e 100644 --- a/include/asoundlib-head.h +++ b/include/asoundlib-head.h @@ -35,19 +35,6 @@ #include #include #include -#include #include #include #include - -#ifndef __GNUC__ -#define __inline__ inline -#endif - -#include -#include -#include -#include -#include -#include -#include diff --git a/include/local.h b/include/local.h index 9464efa..2fe9a27 100644 --- a/include/local.h +++ b/include/local.h @@ -22,13 +22,30 @@ #ifndef __LOCAL_H #define __LOCAL_H +#include "config.h" + #include #include #include #include #include #include +#ifdef HAVE_ENDIAN_H #include +#elif defined(HAVE_SYS_ENDIAN_H) +#include +#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 #include #include @@ -36,7 +53,6 @@ #include #include -#include "config.h" #ifdef SUPPORT_RESMGR #include #endif diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index 7123025..b1f2330 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -26,7 +26,6 @@ * */ -#include #include #include #include -- 1.8.5.4 --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --u3/rZRmxL6MmkK24--