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>
This commit is contained in:
Patrick Welche 2014-02-23 11:12:48 +00:00 committed by Takashi Iwai
parent 1af088e39b
commit 7a6e8ca348
4 changed files with 48 additions and 17 deletions

View file

@ -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

View file

@ -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>

View file

@ -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

View file

@ -26,7 +26,6 @@
*
*/
#include <endian.h>
#include <byteswap.h>
#include <ctype.h>
#include <string.h>