jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
4.9KB

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