| 1 |
# Process this file with autoconf to produce a configure script. |
| 2 |
AC_INIT(RtMidi, 5.0.0, [email protected], rtmidi) |
| 3 |
AC_CONFIG_AUX_DIR(config) |
| 4 |
AC_CONFIG_SRCDIR(RtMidi.cpp) |
| 5 |
AC_CONFIG_FILES([rtmidi-config rtmidi.pc Makefile tests/Makefile doc/Makefile doc/doxygen/Doxyfile]) |
| 6 |
AM_INIT_AUTOMAKE([1.14 -Wall -Werror foreign subdir-objects]) |
| 7 |
|
| 8 |
# libtool version: current:revision:age |
| 9 |
# |
| 10 |
# If the library source code has changed at all since the last update, then |
| 11 |
# increment revision (`c:r:a' becomes `c:r+1:a'). |
| 12 |
# |
| 13 |
# If any interfaces have been added, removed, or changed since the last update, |
| 14 |
# increment current, and set revision to 0. |
| 15 |
# |
| 16 |
# If any interfaces have been added since the last public release, then |
| 17 |
# increment age. |
| 18 |
# |
| 19 |
# If any interfaces have been removed since the last public release, then set |
| 20 |
# age to 0. |
| 21 |
m4_define([lt_current], 6) |
| 22 |
m4_define([lt_revision], 0) |
| 23 |
m4_define([lt_age], 0) |
| 24 |
|
| 25 |
m4_define([lt_version_info], [lt_current:lt_revision:lt_age]) |
| 26 |
m4_define([lt_current_minus_age], [m4_eval(lt_current - lt_age)]) |
| 27 |
|
| 28 |
SO_VERSION=lt_version_info |
| 29 |
AC_SUBST(SO_VERSION) |
| 30 |
AC_SUBST(LIBS) |
| 31 |
AC_SUBST(api) |
| 32 |
AC_SUBST(req) |
| 33 |
AC_SUBST(req_libs) |
| 34 |
|
| 35 |
api="" |
| 36 |
req="" |
| 37 |
req_libs="" |
| 38 |
|
| 39 |
# Fill GXX with something before test. |
| 40 |
GXX="no" |
| 41 |
|
| 42 |
# if the user did not provide any CXXFLAGS, we can override them |
| 43 |
AS_IF([test "x$CXXFLAGS" = "x" ], [override_cxx=yes], [override_cxx=no]) |
| 44 |
AS_IF([test "x$CFLAGS" = "x" ], [override_c=yes], [override_c=no]) |
| 45 |
|
| 46 |
# Check version number coherency between RtMidi.h and configure.ac |
| 47 |
AC_MSG_CHECKING([that version numbers are coherent]) |
| 48 |
RTMIDI_VERSION=`sed -n 's/#define RTMIDI_VERSION "\(.*\)"/\1/p' $srcdir/RtMidi.h` |
| 49 |
AS_IF( |
| 50 |
[test "x$RTMIDI_VERSION" != "x$PACKAGE_VERSION"], |
| 51 |
[AC_MSG_FAILURE([testing RTMIDI_VERSION==PACKAGE_VERSION failed, check that RtMidi.h defines RTMIDI_VERSION as "$PACKAGE_VERSION" or that the first line of configure.ac has been updated.])]) |
| 52 |
|
| 53 |
# Enable some nice automake features if they are available |
| 54 |
m4_ifdef([AM_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) |
| 55 |
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 56 |
|
| 57 |
# standards version |
| 58 |
m4_include([m4/ax_cxx_compile_stdcxx.m4]) |
| 59 |
AX_CXX_COMPILE_STDCXX(11, noext, mandatory) |
| 60 |
|
| 61 |
# configure flags |
| 62 |
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [enable various debugging output])]) |
| 63 |
AC_ARG_WITH(jack, [AS_HELP_STRING([--with-jack], [choose JACK server support])]) |
| 64 |
AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa], [choose native ALSA sequencer API support (linux only)])]) |
| 65 |
AC_ARG_WITH(core, [AS_HELP_STRING([--with-core], [ choose CoreMIDI API support (mac only)])]) |
| 66 |
AC_ARG_WITH(winmm, [AS_HELP_STRING([--with-winmm], [ choose Windows MultiMedia (MM) API support (win32 only)])]) |
| 67 |
AC_ARG_WITH(winks, [AS_HELP_STRING([--with-winks], [ choose kernel streaming support (win32 only)])]) |
| 68 |
AC_ARG_WITH(webmidi, [AS_HELP_STRING([--with-webmidi], [ choose Web MIDI support])]) |
| 69 |
|
| 70 |
|
| 71 |
# Checks for programs. |
| 72 |
AC_PROG_CXX(g++ CC c++ cxx) |
| 73 |
AM_PROG_AR |
| 74 |
AC_PATH_PROG(AR, ar, no) |
| 75 |
AS_IF([test "x$AR" = "xno"], [ |
| 76 |
AC_MSG_ERROR([Could not find ar - needed to create a library]) |
| 77 |
]) |
| 78 |
|
| 79 |
LT_INIT([win32-dll]) |
| 80 |
AC_CONFIG_MACRO_DIR([m4]) |
| 81 |
|
| 82 |
# Checks for header files. |
| 83 |
AC_HEADER_STDC |
| 84 |
#AC_CHECK_HEADERS(sys/ioctl.h unistd.h) |
| 85 |
|
| 86 |
# Check for POSIX semaphore support |
| 87 |
AC_CHECK_HEADER([semaphore.h], [ |
| 88 |
AC_CHECK_LIB(pthread, sem_init, |
| 89 |
AC_DEFINE([HAVE_SEMAPHORE],[1],[Define to 1 if you have POSIX semaphore support on your system.]), |
| 90 |
AC_MSG_WARN([POSIX semaphore support not found; data may be lost on closePort])) |
| 91 |
]) |
| 92 |
|
| 93 |
|
| 94 |
# check for debug |
| 95 |
AC_MSG_CHECKING(whether to compile debug version) |
| 96 |
debugflags="" |
| 97 |
object_path=Release |
| 98 |
AS_CASE([${enable_debug}], |
| 99 |
[ yes ], [ |
| 100 |
AC_MSG_RESULT([yes]) |
| 101 |
CPPFLAGS="-D__RTMIDI_DEBUG ${CPPFLAGS}" |
| 102 |
debugflags="${debugflags} -g" |
| 103 |
object_path=Debug |
| 104 |
], |
| 105 |
[ no ], [ |
| 106 |
AC_MSG_RESULT([no!]) |
| 107 |
debugflags="${debugflags} -O3" |
| 108 |
], [ |
| 109 |
AC_MSG_RESULT([no]) |
| 110 |
]) |
| 111 |
# For debugging and optimization ... overwrite default because it has both -g and -O2 |
| 112 |
AS_IF([test "x$debugflags" != x], |
| 113 |
AS_IF([test "x$override_cxx" = "xyes" ], CXXFLAGS="$CXXFLAGS $debugflags", CXXFLAGS="$debugflags $CXXFLAGS") |
| 114 |
AS_IF([test "x$override_c" = "xyes" ], CFLAGS="$CFLAGS $debugflags", CFLAGS="$debugflags $CFLAGS") |
| 115 |
) |
| 116 |
|
| 117 |
# Check compiler and use -Wall if gnu. |
| 118 |
AS_IF([test "x$GXX" = "xyes"], [ |
| 119 |
CXXFLAGS="-Wall -Wextra ${CXXFLAGS}" |
| 120 |
]) |
| 121 |
|
| 122 |
# Checks for doxygen |
| 123 |
AC_CHECK_PROG( DOXYGEN, [doxygen], [doxygen] ) |
| 124 |
AM_CONDITIONAL( MAKE_DOC, [test "x${DOXYGEN}" != x] ) |
| 125 |
|
| 126 |
# Copy doc files to build dir if necessary |
| 127 |
AC_CONFIG_LINKS( [doc/doxygen/footer.html:doc/doxygen/footer.html] ) |
| 128 |
AC_CONFIG_LINKS( [doc/doxygen/header.html:doc/doxygen/header.html] ) |
| 129 |
AC_CONFIG_LINKS( [doc/doxygen/tutorial.txt:doc/doxygen/tutorial.txt] ) |
| 130 |
AC_CONFIG_LINKS( [doc/images/ccrma.gif:doc/images/ccrma.gif] ) |
| 131 |
AC_CONFIG_LINKS( [doc/images/mcgill.gif:doc/images/mcgill.gif] ) |
| 132 |
|
| 133 |
# Checks for package options and external software |
| 134 |
AC_CANONICAL_HOST |
| 135 |
|
| 136 |
# Aggregate options into a single string. |
| 137 |
AS_IF([test "x$with_jack" = "xyes"], [systems="$systems jack"]) |
| 138 |
AS_IF([test "x$with_alsa" = "xyes"], [systems="$systems alsa"]) |
| 139 |
AS_IF([test "x$with_core" = "xyes"], [systems="$systems core"]) |
| 140 |
AS_IF([test "x$with_winmm" = "xyes"], [systems="$systems winmm"]) |
| 141 |
AS_IF([test "x$with_winks" = "xyes"], [systems="$systems winks"]) |
| 142 |
AS_IF([test "x$with_webmidi" = "xyes"], [systems="$systems webmidi"]) |
| 143 |
AS_IF([test "x$with_dummy" = "xyes"], [systems="$systems dummy"]) |
| 144 |
required=" $systems " |
| 145 |
|
| 146 |
# If none, assign defaults if any are known for this OS. |
| 147 |
# User must specified with-* options for any unknown OS. |
| 148 |
AS_IF([test "x$systems" = "x"], |
| 149 |
AS_CASE([$host], |
| 150 |
[*-*-linux*], [systems="alsa jack"], |
| 151 |
[*-*-gnu], [systems="jack"], |
| 152 |
[*-*-kfreebsd*-gnu], [systems="jack"], |
| 153 |
[*-apple*], [systems="core jack"], |
| 154 |
[*-mingw32*], [systems="winmm winks jack"], |
| 155 |
[*-mingw64*], [systems="winmm winks jack"] |
| 156 |
)) |
| 157 |
|
| 158 |
# If any were specifically requested disabled, do it. |
| 159 |
AS_IF([test "x$with_jack" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v jack`]) |
| 160 |
AS_IF([test "x$with_alsa" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v alsa`]) |
| 161 |
AS_IF([test "x$with_winmm" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v winmm`]) |
| 162 |
AS_IF([test "x$with_winks" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v winks`]) |
| 163 |
AS_IF([test "x$with_core" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v core`]) |
| 164 |
AS_IF([test "x$with_webmidi" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v webmidi`]) |
| 165 |
AS_IF([test "x$with_dummy" = "xno"], [systems=`echo $systems|tr ' ' \\\\n|grep -v dummy`]) |
| 166 |
systems=" `echo $systems|tr \\\\n ' '` " |
| 167 |
|
| 168 |
# For each MIDI system, check if it is selected and found. |
| 169 |
# Note: Order specified above is not necessarily respected. However, |
| 170 |
# *actual* priority is set at run-time, see RtMidiIn::openMidiApi and RtMidiOut::openMidiApi. |
| 171 |
# One AS_CASE per system, since they are not mutually-exclusive. |
| 172 |
|
| 173 |
AS_CASE(["$systems"], [*" jack "*], [ |
| 174 |
AC_CHECK_LIB(jack, jack_client_open, |
| 175 |
[api="$api -D__UNIX_JACK__" |
| 176 |
req="$req jack" |
| 177 |
need_pthread=yes |
| 178 |
found="$found Jack" |
| 179 |
LIBS="-ljack $LIBS"], |
| 180 |
AS_CASE(["$required"], [*" jack "*], |
| 181 |
AC_MSG_ERROR([JACK support requires the jack library!]))) |
| 182 |
AC_CHECK_LIB(jack, jack_port_rename, AC_DEFINE(JACK_HAS_PORT_RENAME), ) |
| 183 |
]) |
| 184 |
|
| 185 |
AS_CASE(["$systems"], [*" alsa "*], [ |
| 186 |
AC_CHECK_LIB(asound, snd_seq_open, |
| 187 |
[api="$api -D__LINUX_ALSA__" |
| 188 |
req="$req alsa" |
| 189 |
need_pthread=yes |
| 190 |
found="$found ALSA" |
| 191 |
LIBS="-lasound $LIBS"], |
| 192 |
AS_CASE(["$required"], [*" alsa "*], |
| 193 |
AC_MSG_ERROR([ALSA support requires the asound library!]))) |
| 194 |
]) |
| 195 |
|
| 196 |
AS_CASE(["$systems"], [*" core "*], [ |
| 197 |
AC_CHECK_HEADER(CoreMIDI/CoreMIDI.h, |
| 198 |
[api="$api -D__MACOSX_CORE__" |
| 199 |
req_libs="$req_libs -framework CoreMIDI -framework CoreAudio -framework CoreFoundation" |
| 200 |
need_pthread=yes |
| 201 |
found="$found CoreMIDI", |
| 202 |
LIBS="$LIBS -framework CoreMIDI -framework CoreFoundation -framework CoreAudio"], |
| 203 |
AS_CASE(["$required"], [*" core "*], |
| 204 |
AC_MSG_ERROR([CoreMIDI header files not found!]))) |
| 205 |
]) |
| 206 |
|
| 207 |
AS_CASE(["$systems"], [*" winmm "*], [ |
| 208 |
AC_CHECK_HEADERS(windows.h mmsystem.h, |
| 209 |
[api="$api -D__WINDOWS_MM__" |
| 210 |
CPPFLAGS="-I$srcdir/include $CPPFLAGS" |
| 211 |
need_ole32=yes |
| 212 |
found="$found WinMM" |
| 213 |
api="$api -D__WINDOWS_MM__" |
| 214 |
LIBS="-lwinmm ${LIBS}"]) |
| 215 |
]) |
| 216 |
|
| 217 |
AS_CASE(["$systems"], [*" winks "*], [ |
| 218 |
AC_CHECK_HEADERS(windows.h audioclient.h avrt.h mmdeviceapi.h, |
| 219 |
[api="$api -D__WINDOWS_WINKS__" |
| 220 |
CPPFLAGS="-I$srcdir/include $CPPFLAGS" |
| 221 |
need_ole32=yes |
| 222 |
found="$found kernel-streaming" |
| 223 |
api="$api -D__WINDOWS_WINKS__" |
| 224 |
LIBS="-lsetupapi -lksuser ${LIBS}"]) |
| 225 |
]) |
| 226 |
|
| 227 |
AS_CASE(["$systems"], [*" webmidi "*], [ |
| 228 |
AC_CHECK_HEADERS(emscripten.h, |
| 229 |
[api="$api -D__WEB_MIDI_API__" |
| 230 |
found="$found Web MIDI"]) |
| 231 |
]) |
| 232 |
|
| 233 |
AS_IF([test -n "$need_ole32"], [LIBS="-lole32 $LIBS"]) |
| 234 |
|
| 235 |
AS_IF([test -n "$need_pthread"],[ |
| 236 |
AC_MSG_CHECKING([for pthread]) |
| 237 |
AC_CHECK_LIB(pthread, pthread_create, , |
| 238 |
AC_MSG_ERROR([RtAudio requires the pthread library!]))]) |
| 239 |
|
| 240 |
AC_MSG_CHECKING([for MIDI API]) |
| 241 |
|
| 242 |
# Error case: no known realtime systems found. |
| 243 |
AS_IF([test x"$api" = "x"], [ |
| 244 |
AC_MSG_RESULT([none]) |
| 245 |
AC_MSG_ERROR([No known system type found for MIDI support!]) |
| 246 |
], [ |
| 247 |
AC_MSG_RESULT([$found]) |
| 248 |
]) |
| 249 |
|
| 250 |
CPPFLAGS="$CPPFLAGS $api" |
| 251 |
|
| 252 |
AC_OUTPUT |
| 253 |
|
| 254 |
chmod oug+x rtmidi-config |