All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Patrick Welche <prlw1@cam.ac.uk>
Cc: alsa-devel@alsa-project.org
Subject: Re: alsa on non-linux
Date: Mon, 24 Feb 2014 11:03:35 +0100	[thread overview]
Message-ID: <s5hlhx0ygi0.wl%tiwai@suse.de> (raw)
In-Reply-To: <20140223111248.GA971@quantz>

At Sun, 23 Feb 2014 11:12:48 +0000,
Patrick Welche wrote:
> 
> 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
> > <stdarg.h> 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.

Thanks, applied now.

> (Fancy a patch to rename configure.in configure.ac, s/INCLUDES/AM_CPPFLAGS/?)

Not bad, but I'm too tired to follow stupid policy changes of
auto-tools, so basically I don't care much unless the upstream really
breaks it :)



Takashi

> Cheers,
> 
> Patrick
> >From b14f62d1345b563e9b8f525efb00f30312b17cc2 Mon Sep 17 00:00:00 2001
> From: Patrick Welche <prlw1@cam.ac.uk>
> 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 <prlw1@cam.ac.uk>
> ---
>  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 <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 71b5c29..1ec611e 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 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 <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 7123025..b1f2330 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.8.5.4
> 

  reply	other threads:[~2014-02-24 10:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-10 15:37 alsa on non-linux Patrick Welche
2014-01-13 12:13 ` Takashi Iwai
2014-01-14 10:17   ` Patrick Welche
2014-01-14 13:23     ` Takashi Iwai
2014-02-21  1:27       ` Patrick Welche
2014-02-21 11:04         ` Takashi Iwai
2014-02-23 11:12           ` Patrick Welche
2014-02-24 10:03             ` Takashi Iwai [this message]
2014-02-25 12:40               ` Patrick Welche
2014-02-26  7:17                 ` Takashi Iwai
2014-01-14 14:04     ` Clemens Ladisch
2014-01-16 13:27       ` Patrick Welche
2014-01-16 13:46         ` Takashi Iwai
2014-02-25 12:45           ` Patrick Welche
2014-02-26  7:20             ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hlhx0ygi0.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=prlw1@cam.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.