forked from thestk/rtmidi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.library
388 lines (329 loc) · 11.6 KB
/
configure.library
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# -*- Autoconf -*-
m4_ifdef([rtmididir],,
AC_MSG_FAILURE([[you must add "m4""_define(rtmididir,[path/to/rtmidi])" to your configure.ac]]))
dnl NOTE: aclocal will not find configure.version.
dnl but that is OK, since there are only version definitions that don't bother aclocal
m4_ifdef([rtmidi_current],,
m4_include(rtmididir[/configure.version]))
AC_SUBST(RTMIDI_SO_VERSION,[rtmidi_so_version_info])
AC_SUBST(RTMIDI_PACKAGE_VERSION,[ac_rtmidi_version])
# Checks for package options and external software
AC_CANONICAL_HOST
# initialize the variables for the makefile
AC_SUBST(noinst_LIBRARIES)
AC_SUBST(noinst_PROGRAMS)
AC_SUBST(TESTS)
dnl AC_SUBST(SUBDIRS)
AC_SUBST(lib_LTLIBRARIES)
AC_SUBST(EXTRA_DIST)
AC_SUBST(rtmidi_visibility)
AC_SUBST(rtmidi_pkconfig_requirements)
AM_CONDITIONAL(RTMIDI_STANDALONE,test "$rtmidi_standalone" = "yes")
# Checks for programs.
AC_PROG_CXX
AM_PROG_AR
dnl AC_PATH_PROG(AR, ar, no)
dnl if [[ $AR = "no" ]] ; then
dnl AC_MSG_ERROR("Could not find ar - needed to create a library");
dnl fi
LT_INIT([win32-dll])
AC_LANG_PUSH(C++)
AX_CXX_COMPILE_STDCXX(11)
rtmidi_test_flags="-Wall -Wextra"
rtmidi_visibility="-fvisibility=hidden"
# Checks for header files.
AC_HEADER_STDC
#AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
# make rtmididir available for sed
rtmidi_dir="rtmididir"
# Check version number coherency between RtMidi.h and configure.ac
AC_MSG_CHECKING([that version numbers are coherent])
RTMIDI_HEADER_VERSION=`sed -n 's/#define RTMIDI_VERSION "\(.*\)"/\1/p' "$srcdir/$rtmidi_dir/RtMidi.h"`
AS_IF(
[test "x$RTMIDI_HEADER_VERSION" != "x$RTMIDI_PACKAGE_VERSION"],
[AC_MSG_FAILURE([testing RTMIDI_VERSION==RTMIDI_PACKAGE_VERSION failed, check that RtMidi.h defines RTMIDI_VERSION as "$RTMIDI_PACKAGE_VERSION" or that the version information in configure.version has been updated.])])
set +x
AC_ARG_WITH(rtmidi-suffix,
AS_HELP_STRING([--with-rtmidi-suffix],[add a suffix to the RtMidi library. Default is ac_rtmidi_suffix]),
[AS_IF(test "x$with_rtmidi_suffix" = "xno",
[ rtmidi_suffix=ac_rtmidi_suffix],
[ rtmidi_suffix="$with_rtmidi_suffix"])],
[ rtmidi_suffix=ac_rtmidi_suffix])
AC_SUBST(rtmidi_suffix)
# Check for debug
AC_MSG_CHECKING(whether to compile debug version)
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],[enable various debug output]),
[
AC_SUBST( RTMIDI_CPPFLAGS, [-D__RTMIDI_DEBUG__] )
AC_SUBST( RTMIDI_CXXFLAGS, [-g -O0] )
AC_SUBST( object_path, [Debug] )
AC_MSG_RESULT(yes)],
[AC_SUBST( RTMIDI_CPPFLAGS, [] )
AC_SUBST( RTMIDI_CXXFLAGS, [-O3] )
AC_SUBST( object_path, [Release] )
rtmidi_visibility="${rtmidi_visibility} -fvisibility=hidden"
AC_MSG_RESULT(no)])
# Checks for doxygen
AC_CHECK_PROG( DOXYGEN, [doxygen], [doxygen] )
AM_CONDITIONAL( MAKE_DOC, [test "x${DOXYGEN}" != x] )
# Copy doc files to build dir if necessary
AC_CONFIG_LINKS( rtmididir[/doc/doxygen/footer.html:]rtmididir[/doc/doxygen/footer.html] )
AC_CONFIG_LINKS( rtmididir[/doc/doxygen/header.html:]rtmididir[/doc/doxygen/header.html] )
AC_CONFIG_LINKS( rtmididir[/doc/doxygen/tutorial.txt:]rtmididir[/doc/doxygen/tutorial.txt] )
AC_CONFIG_LINKS( rtmididir[/doc/images/ccrma.gif:]rtmididir[/doc/images/ccrma.gif] )
AC_CONFIG_LINKS( rtmididir[/doc/images/mcgill.gif:]rtmididir[/doc/images/mcgill.gif] )
dnl # Set paths if prefix is defined
dnl if test "x$prefix" != "x" && test "x$prefix" != "xNONE"; then
dnl LIBS="$LIBS -L$prefix/lib"
dnl CPPFLAGS="$CPPFLAGS -I$prefix/include"
dnl fi
# Check compiler and use -Wall if supported.
for flag in $rtmidi_test_flags
do
tmpcxxflags="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $flag"
AC_MSG_CHECKING([whether $CXX supports $flag])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT([yes])],
[CXXFLAGS="$tmpcxxflags"
AC_MSG_RESULT([no])])
AC_LANG_PUSH(C)
tmpcflags="$CFLAGS"
CFLAGS="$CFLAGS $flag"
AC_MSG_CHECKING([whether $CC supports $flag])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT([yes])],
[CFLAGS="$tmpcflags"
AC_MSG_RESULT([no])])
AC_LANG_POP(C)
done
# Check compiler and use -Wall if supported.
tmpcflags="$CFLAGS"
tmpcxxflags="$CXXFLAGS"
rtmidi_visibility_result=""
for flag in $rtmidi_visibility
do
CXXFLAGS="$tmpcxxflags $rtmidi_visibility_result $flag"
AC_MSG_CHECKING([whether $CXX supports $flag])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[
rtmidi_visibility_result="$rtmidi_visibility_result $flag"
AC_MSG_RESULT([yes])
],[AC_MSG_RESULT([no])])
done
rtmidi_visibility="$rtmidi_visibility_result"
dnl mudflap is not possible with g++ 4.7.1 and wxWidgets 2.8
dnl tmpcxxflags="$CXXFLAGS"
dnl tmplibs="$LIBS"
dnl CXXFLAGS="$CXXFLAGS -fmudflapth"
dnl LIBS="-lmudflapth"
dnl AC_MSG_CHECKING([whether $CXX supports -fmudflapth -lmudflapth])
dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
dnl [AC_MSG_RESULT([yes])],
dnl [CXXFLAGS="$tmpcxxflags"
dnl LIBS="$tmplibs"]
dnl [AC_MSG_RESULT([no])])
dnl
AC_ARG_ENABLE(address-sanitizer,
AS_HELP_STRING([--enable-address-sanitizer],[Enable gcc/clang address santizer]),
[AS_IF(test "$enableval" = yes,
AC_LANG_PUSH(C++)
for flag in -fsanitize=address -fno-omit-frame-pointer -fno-common
do
tmpcxxflags="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $flag"
AC_MSG_CHECKING([whether $CXX supports $flag])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT([yes])],
[CXXFLAGS="$tmpcxxflags"
AC_MSG_RESULT([no])])
AC_LANG_PUSH(C)
tmpcflags="$CFLAGS"
CFLAGS="$CFLAGS $flag"
AC_MSG_CHECKING([whether $CC supports $flag])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT([yes])],
[CFLAGS="$tmpcflags"
AC_MSG_RESULT([no])])
AC_LANG_POP(C)
done
AC_LANG_POP(C++)
)
]
)
AC_ARG_ENABLE(thread-sanitizer,
AS_HELP_STRING([--enable-thread-sanitizer],[Enable gcc/clang thread santizer]),
[AS_IF(test "$enableval" = yes,
AC_LANG_PUSH(C++)
for flag in -fsanitize=thread -fno-omit-frame-pointer -fno-common -fPIC
do
tmpcxxflags="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $flag"
AC_MSG_CHECKING([whether $CXX supports $flag])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT([yes])],
[CXXFLAGS="$tmpcxxflags"
AC_MSG_RESULT([no])])
AC_LANG_PUSH(C)
tmpcflags="$CFLAGS"
CFLAGS="$CFLAGS $flag"
AC_MSG_CHECKING([whether $CC supports $flag])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT([yes])],
[CFLAGS="$tmpcflags"
AC_MSG_RESULT([no])])
AC_LANG_POP(C)
done
for flag in -pie
do
tmpldflags="$LDFLAGS"
LDFLAGS="$LDFLAGS $flag"
AC_MSG_CHECKING([whether $LD supports $flag])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[AC_MSG_RESULT([yes])],
[LDFLAGS="$tmpldflags"
AC_MSG_RESULT([no])])
done
AC_LANG_POP(C++)
)
]
)
dnl AC_SUBST( sharedlib, ["librtmidi.so"] )
dnl AC_SUBST( sharedname, ["librtmidi.so.\$(RELEASE)"] )
dnl AC_SUBST( libflags, ["-shared -Wl,-soname,\$(SHARED).\$(MAJOR) -o \$(SHARED).\$(RELEASE)"] )
dnl case $host in
dnl *-apple*)
dnl AC_SUBST( sharedlib, ["librtmidi.dylib"] )
dnl AC_SUBST( sharedname, ["librtmidi.\$(RELEASE).dylib"] )
dnl AC_SUBST( libflags, ["-dynamiclib -o librtmidi.\$(RELEASE).dylib"] )
dnl esac
dnl sem_timedwait may not be availlable on Mac OS X
# Check for POSIX semaphore support
AC_CHECK_HEADER([semaphore.h], [
AC_CHECK_LIB(pthread, sem_timedwait,
AC_DEFINE([HAVE_SEMAPHORE],[1],[Define to 1 if you have POSIX semaphore support on your system.]),
AC_MSG_WARN([POSIX semaphore support not found; data may be lost on closePort]))
])
AC_MSG_CHECKING(whether to check all apis)
AC_ARG_ENABLE(apisearch,
AS_HELP_STRING([--disable-apisearch],[disable all unrequested apis]),
[
AS_IF([test "x$enableval" = "xno"],[
AC_MSG_RESULT(no)
AS_IF([test "x$with_alsa" = "x"],[with_alsa=no])
AS_IF([test "x$with_jack" = "x"],[with_jack=no])
AS_IF([test "x$with_winmm" = "x"],[with_winmm=no])
AS_IF([test "x$with_winks" = "x"],[with_winks=no])
AS_IF([test "x$with_coremidi" = "x"],[with_coremidi=no])
],[AC_MSG_RESULT(yes)])
],[AC_MSG_RESULT(yes)])
AC_SUBST( RTMIDI_API, [""] )
AC_SUBST( RTMIDI_LIB_CFLAGS, [""] )
AC_SUBST( RTMIDI_LIBS, [""] )
AC_MSG_CHECKING(for MIDI API)
RTMIDI_HAVE_VIRTUAL_DEVICES=no
rtmidi_check_jack=auto
case $host in
*linux*)
PLATFORM=linux
dnl with_winmm=no
dnl with_winks=no
dnl with_coremidi=no
# Checks for pthread library.
;;
darwin*|*apple*)
PLATFORM=macosx
# Check for CoreAudio framework
dnl with_winmm=no
dnl with_winks=no
dnl with_alsa=no
;;
*winnt*|*interix*|cygwin*|*mingw*|uwin*)
PLATFORM=windows
dnl with_alsa=no
dnl with_coremidi=no
# I can't get the following check to work so just manually add the library
# or could try the following? AC_LIB_WINMM([midiOutGetNumDevs])
# AC_CHECK_LIB(winmm, midiInGetNumDevs, , AC_MSG_ERROR(Windows MIDI support requires the winmm library!) )],)
AC_CACHE_CHECK([where to find support dlls], [ac_cv_rtmidi_ts_mingw_dll_dirs],
[
gccsearchdirs=`$CXX $CXXFLAGS -print-search-dirs|\
sed -e '/^libraries:/ { s/^libraries: *=\?//; /;\([0-9a-zA-Z]\):/ { s,;\([0-9a-zA-Z]\):,:/\1/,g;s,^\([0-9a-zA-Z]\):,/\1/,g; s,\\\\,/,g } ; p } ; d'` ; \
gccsearchdirs="$WINEDLLPATH:$gccsearchdirs:\
/usr/share/doc/mingw32-runtime:\
/usr/$host/bin:\
/usr/$host/lib:\
/usr/bin/$host/:\
/usr/lib/$host/:\
/usr/lib/$host/lib:\
/usr/lib/$host/bin:\
/usr/bin/$host/lib:\
/usr/bin/$host/bin:\
/mingw/lib:\
/mingw/bin:\
/usr/lib:\
/lib:\
/usr/bin:\
/bin"
SEARCHDIRS="$PWD:$PWD/.libs"
old_FS="$IFS"
IFS=:
for d in $gccsearchdirs ;
do
AS_IF(test -d "$d",[ SEARCHDIRS="$SEARCHDIRS:$d" ])
done
IFS="$old_FS"
ac_cv_rtmidi_ts_mingw_dll_dirs="$SEARCHDIRS"
])
AC_SUBST(DLLSEARCHPATH,"$ac_cv_rtmidi_ts_mingw_dll_dirs")
rtmidicopydlls=true
;;
*)
# Default case for unknown realtime systems.
AC_MSG_WARN([
Your target system could not be recognized. $PACKAGE depends on
a working MIDI configuration for your System. We are trying all
supported APIs. The result may be varying.
Please contact the development team at
$PACKAGE_BUGREPORT
and provide the following information:
* The output of configure
* The description of your System.
])
;;
esac
AC_ARG_WITH(jack,
AS_HELP_STRING([--with-jack],[choose JACK server support (needs libjack to be installed)]),[
echo running jack:
AS_IF([test "x$with_jack" = "xno"],,[RTMIDI_LIB_JACK ])
],[ echo runnning jack 2 ; RTMIDI_LIB_JACK(,[true]) ])
AC_ARG_WITH(alsa, AS_HELP_STRING([--with-alsa],[choose native ALSA sequencer API support]),[
AS_IF([test "x$with_alsa" = "xno"],,[ RTMIDI_LIB_ALSA ])
],[ RTMIDI_LIB_ALSA(,[true]) ])
AC_ARG_WITH(winmm, AS_HELP_STRING([--with-winmm],[choose native Windows Multimedia API support]),[
AS_IF([test "x$with_winmm" = "xno"],,[RTMIDI_LIB_WINMM ])
],[ RTMIDI_LIB_WINMM(,[true]) ])
AC_ARG_WITH(winks, AS_HELP_STRING([--with-winks],[choose native Windows kernel streaming API support]),[
AS_IF([test "x$with_winks" = "xno"],,[ RTMIDI_LIB_WINKS ])
],[ RTMIDI_LIB_WINKS(,[true]) ])
AC_ARG_WITH(coremidi, AS_HELP_STRING([--with-coremidi],[choose native CoreAudio API support]),[
AS_IF([test "x$with_coremidi" = "xno"],,[RTMIDI_LIB_COREMIDI ])
],[ RTMIDI_LIB_COREMIDI(,[true]) ])
AS_IF([test "x$RTMIDI_API" = "x"],[
AC_MSG_WARN("No suitable MIDI interface found. Using dummy driver")
RTMIDI_API="-D__RTMIDI_DUMMY__"
])
AM_CONDITIONAL(RTMIDI_HAVE_VIRTUAL_DEVICES,test "$RTMIDI_HAVE_VIRTUAL_DEVICES" == yes)
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.18.3])
if test "x$rtmidicopydlls" = "x"
then
rtmidicopydlls=false
fi
AM_CONDITIONAL(RTMIDICOPYDLLS,$rtmidicopydlls && test -n "$DLLSEARCHPATH")
AX_CHECK_FALLTHROUGH_SYNTAX
AC_DEFINE_UNQUOTED(RTMIDI_FALLTHROUGH,
[$ax_cv_check_cxx_fallthrough_syntax_],
[syntax for switch case fallthrough attributes in C++])
AC_LANG_POP(C++)