From patchwork Fri Feb 21 01:27:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Welche X-Patchwork-Id: 3693061 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4B3279F1EE for ; Fri, 21 Feb 2014 01:27:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 048542012B for ; Fri, 21 Feb 2014 01:27:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CE87020123 for ; Fri, 21 Feb 2014 01:27:40 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 02E872619E1; Fri, 21 Feb 2014 02:27:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id CB7CA26172B; Fri, 21 Feb 2014 02:27:28 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 81C41261737; Fri, 21 Feb 2014 02:27:26 +0100 (CET) Received: from ppsw-42.csi.cam.ac.uk (ppsw-42.csi.cam.ac.uk [131.111.8.142]) by alsa0.perex.cz (Postfix) with ESMTP id 75DC6261717 for ; Fri, 21 Feb 2014 02:27:18 +0100 (CET) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from host-80-41-63-10.as13285.net ([80.41.63.10]:65505 helo=quantz) by ppsw-42.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.159]:587) with esmtpsa (LOGIN:prlw1) (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) id 1WGetZ-0003tO-7F (Exim 4.82_3-c0e5623) (return-path ); Fri, 21 Feb 2014 01:27:17 +0000 Date: Fri, 21 Feb 2014 01:27:04 +0000 From: Patrick Welche To: Takashi Iwai Message-ID: <20140221012704.GA15861@quantz> References: <20140110153700.GC1173@quark.internal.precedence.co.uk> <20140114101709.GB160@quark.internal.precedence.co.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] alsa on non-linux X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" 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 X-Virus-Scanned: ClamAV using ClamSMTP 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.) 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. local.h includes the appropriate endian.h vs sys/endian.h file & defines the relevant macros. type_compat.h doesn't seem to be used anywhere? So I left it alone. pcm_file.c includes pcm_local.h which includes local.h, so I removed the #include (Still far from being able to compile alsa-lib, but it's a start...) Cheers, Patrick From 5885d2e79dfd8f788177a95c70967d9a3c9a2cb6 Mon Sep 17 00:00:00 2001 From: Patrick Welche Date: Fri, 21 Feb 2014 01:18:01 +0000 Subject: [PATCH] Portability fix: look for sys/endian.h as well as endian.h - define __BYTE_ORDER and friends. - adjust asoundlib.h accordingly. --- configure.in | 19 +++++++++++++++++-- include/asoundlib-head.h | 1 - include/local.h | 18 +++++++++++++++++- src/pcm/pcm_file.c | 1 - 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index bb56eb6..60d4ae1 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,21 @@ 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 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..31408a4 100644 --- a/include/asoundlib-head.h +++ b/include/asoundlib-head.h @@ -35,7 +35,6 @@ #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