add NetBSD/OpenBSD build support (except test/)
Fixes: https://github.com/alsa-project/alsa-lib/pull/250
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
SASANO Takayoshi authored 1 year, 9 months ago
Jaroslav Kysela committed 1 year, 6 months ago
334 | 334 |
fi
|
335 | 335 |
|
336 | 336 |
dnl Check for headers
|
337 | |
AC_CHECK_HEADERS([endian.h sys/endian.h sys/shm.h])
|
|
337 |
AC_CHECK_HEADERS([endian.h sys/endian.h sys/shm.h malloc.h])
|
338 | 338 |
|
339 | 339 |
dnl Check for resmgr support...
|
340 | 340 |
AC_MSG_CHECKING(for resmgr support)
|
26 | 26 |
#define bswap_16 bswap16
|
27 | 27 |
#define bswap_32 bswap32
|
28 | 28 |
#define bswap_64 bswap64
|
|
29 |
#elif defined(__OpenBSD__)
|
|
30 |
#include <sys/endian.h>
|
|
31 |
#define bswap_16 swap16
|
|
32 |
#define bswap_32 swap32
|
|
33 |
#define bswap_64 swap64
|
29 | 34 |
#elif defined (__sun)
|
30 | 35 |
#include <sys/byteorder.h>
|
31 | 36 |
#define bswap_16 BSWAP_16
|
33 | 33 |
#include <endian.h>
|
34 | 34 |
#elif defined(HAVE_SYS_ENDIAN_H)
|
35 | 35 |
#include <sys/endian.h>
|
|
36 |
#else
|
|
37 |
#error Header defining endianness not defined
|
|
38 |
#endif
|
36 | 39 |
#ifndef __BYTE_ORDER
|
37 | 40 |
#define __BYTE_ORDER BYTE_ORDER
|
38 | 41 |
#endif
|
|
41 | 44 |
#endif
|
42 | 45 |
#ifndef __BIG_ENDIAN
|
43 | 46 |
#define __BIG_ENDIAN BIG_ENDIAN
|
44 | |
#endif
|
45 | |
#else
|
46 | |
#error Header defining endianness not defined
|
47 | 47 |
#endif
|
48 | 48 |
#include <stdarg.h>
|
49 | 49 |
#include <poll.h>
|
|
84 | 84 |
#define versionsort64 versionsort
|
85 | 85 |
#define alphasort64 alphasort
|
86 | 86 |
#define ino64_t ino_t
|
|
87 |
#define fstat64 fstat
|
|
88 |
#define stat64 stat
|
87 | 89 |
#endif
|
88 | 90 |
|
89 | 91 |
#define _snd_config_iterator list_head
|
2 | 2 |
|
3 | 3 |
#ifndef DOC_HIDDEN
|
4 | 4 |
#include <stdint.h>
|
5 | |
#ifdef __linux__
|
|
5 |
#if defined(__linux__)
|
6 | 6 |
#include <linux/types.h>
|
7 | 7 |
#else
|
8 | 8 |
typedef uint8_t __u8;
|
|
14 | 14 |
typedef int32_t __s32;
|
15 | 15 |
typedef int64_t __s64;
|
16 | 16 |
|
|
17 |
#if defined(__sun)
|
|
18 |
#include <sys/byteorder.h>
|
|
19 |
#define __cpu_to_le32 LE_32(x)
|
|
20 |
#define __cpu_to_be32 BE_32(x)
|
|
21 |
#define __cpu_to_le16 LE_16(x)
|
|
22 |
#define __cpu_to_be16 BE_16(x)
|
|
23 |
#else
|
17 | 24 |
#include <endian.h>
|
18 | |
#include <byteswap.h>
|
19 | 25 |
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
20 | 26 |
#define __cpu_to_le32(x) (x)
|
21 | 27 |
#define __cpu_to_be32(x) bswap_32(x)
|
|
27 | 33 |
#define __cpu_to_le16(x) bswap_16(x)
|
28 | 34 |
#define __cpu_to_be16(x) (x)
|
29 | 35 |
#endif
|
|
36 |
#endif
|
30 | 37 |
|
31 | 38 |
#define __le32_to_cpu __cpu_to_le32
|
32 | 39 |
#define __be32_to_cpu __cpu_to_be32
|
33 | 40 |
#define __le16_to_cpu __cpu_to_le16
|
34 | 41 |
#define __be16_to_cpu __cpu_to_be16
|
35 | |
|
36 | |
#define __le64 __u64
|
37 | |
#define __le32 __u32
|
38 | |
#define __le16 __u16
|
39 | |
#define __le8 __u8
|
40 | |
#define __be64 __u64
|
41 | |
#define __be32 __u32
|
42 | |
#define __be16 __u16
|
43 | |
#define __be8 __u8
|
44 | 42 |
#endif
|
45 | 43 |
|
46 | 44 |
#ifndef __kernel_long_t
|
15 | 15 |
#ifndef __LINUX_UAPI_SND_ASOC_H
|
16 | 16 |
#define __LINUX_UAPI_SND_ASOC_H
|
17 | 17 |
|
|
18 |
#if defined(__linux__)
|
18 | 19 |
#include <linux/types.h>
|
|
20 |
#endif
|
19 | 21 |
|
20 | 22 |
/*
|
21 | 23 |
* Maximum number of channels topology kcontrol can represent.
|
53 | 53 |
|
54 | 54 |
static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED)
|
55 | 55 |
{
|
|
56 |
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
|
57 |
/* siginfo_t does not have si_fd */
|
|
58 |
struct list_head *i;
|
|
59 |
list_for_each(i, &snd_async_handlers) {
|
|
60 |
snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist);
|
|
61 |
if (h->callback)
|
|
62 |
h->callback(h);
|
|
63 |
}
|
|
64 |
#else
|
56 | 65 |
int fd;
|
57 | 66 |
struct list_head *i;
|
58 | 67 |
//assert(siginfo->si_code == SI_SIGIO);
|
|
65 | 74 |
if (h->fd == fd && h->callback)
|
66 | 75 |
h->callback(h);
|
67 | 76 |
}
|
|
77 |
#endif
|
68 | 78 |
}
|
69 | 79 |
|
70 | 80 |
/**
|
4114 | 4114 |
if (!S_ISDIR(st.st_mode))
|
4115 | 4115 |
return config_file_open(root, fn);
|
4116 | 4116 |
#ifndef DOC_HIDDEN
|
4117 | |
#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
|
|
4117 |
#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__sun) && !defined(ANDROID)
|
4118 | 4118 |
#define SORTFUNC versionsort64
|
4119 | 4119 |
#else
|
4120 | 4120 |
#define SORTFUNC alphasort64
|
43 | 43 |
*
|
44 | 44 |
*/
|
45 | 45 |
|
|
46 |
#if !defined(__OpenBSD__)
|
46 | 47 |
union semun {
|
47 | 48 |
int val; /* Value for SETVAL */
|
48 | 49 |
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
|
49 | 50 |
unsigned short *array; /* Array for GETALL, SETALL */
|
|
51 |
#if defined(__linux__)
|
50 | 52 |
struct seminfo *__buf; /* Buffer for IPC_INFO (Linux specific) */
|
|
53 |
#endif
|
51 | 54 |
};
|
|
55 |
#endif
|
52 | 56 |
|
53 | 57 |
/*
|
54 | 58 |
* FIXME:
|
19 | 19 |
|
20 | 20 |
#include "config.h"
|
21 | 21 |
#include <stdio.h>
|
|
22 |
#if HAVE_MALLOC_H
|
22 | 23 |
#include <malloc.h>
|
|
24 |
#endif
|
23 | 25 |
#include <string.h>
|
24 | 26 |
#include <poll.h>
|
25 | 27 |
#include <sys/mman.h>
|
27 | 27 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
28 | 28 |
*/
|
29 | 29 |
|
|
30 |
#if HAVE_MALLOC_H
|
30 | 31 |
#include <malloc.h>
|
|
32 |
#endif
|
31 | 33 |
#include "local.h"
|
32 | 34 |
|
33 | 35 |
#ifndef DOC_HIDDEN
|
23 | 23 |
#ifdef HAVE_SYS_SHM_H
|
24 | 24 |
|
25 | 25 |
#include <stdio.h>
|
|
26 |
#include <stdlib.h>
|
|
27 |
#if HAVE_MALLOC_H
|
26 | 28 |
#include <malloc.h>
|
|
29 |
#endif
|
27 | 30 |
#include <string.h>
|
28 | 31 |
#include <errno.h>
|
29 | 32 |
#include <poll.h>
|
2906 | 2906 |
snprintf(filename, sizeof(filename), "%s/ucm2/conf.virt.d",
|
2907 | 2907 |
snd_config_topdir());
|
2908 | 2908 |
|
2909 | |
#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
|
|
2909 |
#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__sun) && !defined(ANDROID)
|
2910 | 2910 |
#define SORTFUNC versionsort64
|
2911 | 2911 |
#else
|
2912 | 2912 |
#define SORTFUNC alphasort64
|
31 | 31 |
#include <sys/wait.h>
|
32 | 32 |
#include <limits.h>
|
33 | 33 |
#include <dirent.h>
|
|
34 |
|
|
35 |
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
36 |
#include <signal.h>
|
|
37 |
extern char **environ;
|
|
38 |
#endif
|
34 | 39 |
|
35 | 40 |
static pthread_mutex_t fork_lock = PTHREAD_MUTEX_INITIALIZER;
|
36 | 41 |
|