Jack2 1.9.12

systemdeps.h
1 /*
2 Copyright (C) 2004-2012 Grame
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __jack_systemdeps_h__
21 #define __jack_systemdeps_h__
22
23 #ifndef POST_PACKED_STRUCTURE
24
25 #ifdef __GNUC__
26 /* POST_PACKED_STRUCTURE needs to be a macro which
27 expands into a compiler directive. The directive must
28 tell the compiler to arrange the preceding structure
29 declaration so that it is packed on byte-boundaries rather
30 than use the natural alignment of the processor and/or
31 compiler.
32 */
33
34 #define PRE_PACKED_STRUCTURE
35 #define POST_PACKED_STRUCTURE __attribute__((__packed__))
36
37 #else
38
39 #ifdef _MSC_VER
40 #define PRE_PACKED_STRUCTURE1 __pragma(pack(push,1))
41 #define PRE_PACKED_STRUCTURE PRE_PACKED_STRUCTURE1
42 /* PRE_PACKED_STRUCTURE needs to be a macro which
43 expands into a compiler directive. The directive must
44 tell the compiler to arrange the following structure
45 declaration so that it is packed on byte-boundaries rather
46 than use the natural alignment of the processor and/or
47 compiler.
48 */
49 #define POST_PACKED_STRUCTURE ;__pragma(pack(pop))
50 /* and POST_PACKED_STRUCTURE needs to be a macro which
51 restores the packing to its previous setting */
52 #else
53 #define PRE_PACKED_STRUCTURE
54 #define POST_PACKED_STRUCTURE
55 #endif /* _MSC_VER */
56
57 #endif /* __GNUC__ */
58
59 #endif
60
61 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(GNU_WIN32)
62
63 #ifdef __MINGW32__
64 # include <winsock2.h> // mingw gives warning if we include windows.h before winsock2.h
65 #endif
66
67 #include <windows.h>
68
69 #ifdef _MSC_VER /* Microsoft compiler */
70 #define __inline__ inline
71 #if (!defined(int8_t) && !defined(_STDINT_H))
72 #define __int8_t_defined
73 typedef char int8_t;
74 typedef unsigned char uint8_t;
75 typedef short int16_t;
76 typedef unsigned short uint16_t;
77 typedef long int32_t;
78 typedef unsigned long uint32_t;
79 typedef LONGLONG int64_t;
80 typedef ULONGLONG uint64_t;
81 #endif
82 #elif __MINGW32__ /* MINGW */
83 #include <stdint.h>
84 #include <sys/types.h>
85 #else /* other compilers ...*/
86 #include <inttypes.h>
87 #include <pthread.h>
88 #include <sys/types.h>
89 #endif
90
91 #if !defined(_PTHREAD_H) && !defined(PTHREAD_WIN32)
92
96 typedef HANDLE jack_native_thread_t;
97 #else
98 #ifdef PTHREAD_WIN32 // Added by JE - 10-10-2011
99 #include <ptw32/pthread.h> // Makes sure we #include the ptw32 version !
100 #endif
101
105 typedef pthread_t jack_native_thread_t;
106 #endif
107
108 #endif /* _WIN32 && !__CYGWIN__ && !GNU_WIN32 */
109
110 #if defined(__APPLE__) || defined(__linux__) || defined(__sun__) || defined(sun) || defined(__unix__) || defined(__CYGWIN__) || defined(GNU_WIN32)
111
112 #if defined(__CYGWIN__) || defined(GNU_WIN32)
113 #include <stdint.h>
114 #endif
115 #include <inttypes.h>
116 #include <pthread.h>
117 #include <sys/types.h>
118
123 typedef pthread_t jack_native_thread_t;
124
125 #endif /* __APPLE__ || __linux__ || __sun__ || sun */
126
127 #if defined(__arm__) || defined(__aarch64__) || defined(__mips__) || defined(__ppc__) || defined(__powerpc__)
128 #undef POST_PACKED_STRUCTURE
129 #define POST_PACKED_STRUCTURE
130 #endif /* __arm__ || __aarch64__ || __ppc__ || __powerpc__ */
131
132 #endif /* __jack_systemdeps_h__ */