Codebase list alsa-lib / b33ef3f
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
14 changed file(s) with 52 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
334334 fi
335335
336336 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])
338338
339339 dnl Check for resmgr support...
340340 AC_MSG_CHECKING(for resmgr support)
2626 #define bswap_16 bswap16
2727 #define bswap_32 bswap32
2828 #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
2934 #elif defined (__sun)
3035 #include <sys/byteorder.h>
3136 #define bswap_16 BSWAP_16
3333 #include <endian.h>
3434 #elif defined(HAVE_SYS_ENDIAN_H)
3535 #include <sys/endian.h>
36 #else
37 #error Header defining endianness not defined
38 #endif
3639 #ifndef __BYTE_ORDER
3740 #define __BYTE_ORDER BYTE_ORDER
3841 #endif
4144 #endif
4245 #ifndef __BIG_ENDIAN
4346 #define __BIG_ENDIAN BIG_ENDIAN
44 #endif
45 #else
46 #error Header defining endianness not defined
4747 #endif
4848 #include <stdarg.h>
4949 #include <poll.h>
8484 #define versionsort64 versionsort
8585 #define alphasort64 alphasort
8686 #define ino64_t ino_t
87 #define fstat64 fstat
88 #define stat64 stat
8789 #endif
8890
8991 #define _snd_config_iterator list_head
22
33 #ifndef DOC_HIDDEN
44 #include <stdint.h>
5 #ifdef __linux__
5 #if defined(__linux__)
66 #include <linux/types.h>
77 #else
88 typedef uint8_t __u8;
1414 typedef int32_t __s32;
1515 typedef int64_t __s64;
1616
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
1724 #include <endian.h>
18 #include <byteswap.h>
1925 #if __BYTE_ORDER == __LITTLE_ENDIAN
2026 #define __cpu_to_le32(x) (x)
2127 #define __cpu_to_be32(x) bswap_32(x)
2733 #define __cpu_to_le16(x) bswap_16(x)
2834 #define __cpu_to_be16(x) (x)
2935 #endif
36 #endif
3037
3138 #define __le32_to_cpu __cpu_to_le32
3239 #define __be32_to_cpu __cpu_to_be32
3340 #define __le16_to_cpu __cpu_to_le16
3441 #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
4442 #endif
4543
4644 #ifndef __kernel_long_t
1515 #ifndef __LINUX_UAPI_SND_ASOC_H
1616 #define __LINUX_UAPI_SND_ASOC_H
1717
18 #if defined(__linux__)
1819 #include <linux/types.h>
20 #endif
1921
2022 /*
2123 * Maximum number of channels topology kcontrol can represent.
5353
5454 static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED)
5555 {
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
5665 int fd;
5766 struct list_head *i;
5867 //assert(siginfo->si_code == SI_SIGIO);
6574 if (h->fd == fd && h->callback)
6675 h->callback(h);
6776 }
77 #endif
6878 }
6979
7080 /**
41144114 if (!S_ISDIR(st.st_mode))
41154115 return config_file_open(root, fn);
41164116 #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)
41184118 #define SORTFUNC versionsort64
41194119 #else
41204120 #define SORTFUNC alphasort64
659659
660660 #include <stdio.h>
661661 #include <string.h>
662 #if HAVE_MALLOC_H
662663 #include <malloc.h>
664 #endif
663665 #include <stdarg.h>
664666 #include <signal.h>
665667 #include <ctype.h>
4343 *
4444 */
4545
46 #if !defined(__OpenBSD__)
4647 union semun {
4748 int val; /* Value for SETVAL */
4849 struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
4950 unsigned short *array; /* Array for GETALL, SETALL */
51 #if defined(__linux__)
5052 struct seminfo *__buf; /* Buffer for IPC_INFO (Linux specific) */
53 #endif
5154 };
55 #endif
5256
5357 /*
5458 * FIXME:
1919
2020 #include "config.h"
2121 #include <stdio.h>
22 #if HAVE_MALLOC_H
2223 #include <malloc.h>
24 #endif
2325 #include <string.h>
2426 #include <poll.h>
2527 #include <sys/mman.h>
2727 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2828 */
2929
30 #if HAVE_MALLOC_H
3031 #include <malloc.h>
32 #endif
3133 #include "local.h"
3234
3335 #ifndef DOC_HIDDEN
2323 #ifdef HAVE_SYS_SHM_H
2424
2525 #include <stdio.h>
26 #include <stdlib.h>
27 #if HAVE_MALLOC_H
2628 #include <malloc.h>
29 #endif
2730 #include <string.h>
2831 #include <errno.h>
2932 #include <poll.h>
29062906 snprintf(filename, sizeof(filename), "%s/ucm2/conf.virt.d",
29072907 snd_config_topdir());
29082908
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)
29102910 #define SORTFUNC versionsort64
29112911 #else
29122912 #define SORTFUNC alphasort64
3131 #include <sys/wait.h>
3232 #include <limits.h>
3333 #include <dirent.h>
34
35 #if defined(__NetBSD__) || defined(__OpenBSD__)
36 #include <signal.h>
37 extern char **environ;
38 #endif
3439
3540 static pthread_mutex_t fork_lock = PTHREAD_MUTEX_INITIALIZER;
3641