1# Process this file with autoconf to produce a configure script. 2AC_INIT(STK, 4.6.2, gary.scavone@mcgill.ca, stk) 3AC_CONFIG_AUX_DIR(config) 4AC_CONFIG_SRCDIR(src/Stk.cpp) 5AC_CONFIG_FILES(Makefile src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile projects/eguitar/Makefile) 6 7# Fill GXX with something before test. 8AC_SUBST( GXX, ["no"] ) 9 10# standards version 11m4_include([m4/ax_cxx_compile_stdcxx.m4]) 12AX_CXX_COMPILE_STDCXX(11, noext, mandatory) 13 14# Checks for programs. 15AC_PROG_CXX(g++ CC c++ cxx) 16AC_PROG_RANLIB 17AC_PATH_PROG(AR, ar, no) 18if [[ $AR = "no" ]] ; then 19 AC_MSG_ERROR("Could not find ar - needed to create a library"); 20fi 21 22# Checks for header files. 23AC_HEADER_STDC 24AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h termio.h unistd.h) 25 26# Checks for typedefs, structures, and compiler characteristics. 27AC_C_CONST 28AC_TYPE_SIZE_T 29AC_HEADER_TIME 30AC_C_BIGENDIAN 31AC_EGREP_CPP(yes, 32[#ifndef WORDS_BIGENDIAN 33 yes 34#endif 35], [AC_SUBST( byte_order, [-D__LITTLE_ENDIAN__] )] ) 36 37AC_MSG_CHECKING(for RAWWAVE_PATH argument) 38AC_SUBST( rawwaves, $RAWWAVE_PATH ) 39AC_MSG_RESULT($RAWWAVE_PATH) 40 41AC_MSG_CHECKING(for INCLUDE_PATH argument) 42AC_SUBST( include, $INCLUDE_PATH ) 43AC_MSG_RESULT($INCLUDE_PATH) 44 45# Check for realtime support disable 46AC_MSG_CHECKING(whether to compile realtime support) 47AC_ARG_ENABLE(realtime, 48 [ --disable-realtime = only compile generic non-realtime classes], 49 realtime=$enableval) 50if test "$realtime" = "no"; then 51 AC_SUBST( sound_api, [] ) 52else 53 AC_SUBST( realtime, [yes] ) 54fi 55AC_MSG_RESULT($realtime) 56 57AC_MSG_CHECKING(whether to build the static library) 58AC_ARG_ENABLE(static, 59 [ --disable-static = do not compile static library ], 60 build_static=$enableval, 61 build_static=yes) 62AC_SUBST(build_static) 63AC_MSG_RESULT($build_static) 64 65AC_MSG_CHECKING(whether to build the shared library) 66AC_ARG_ENABLE(shared, 67 [ --enable-shared = compile the shared library ], 68 build_shared=$enableval, 69 build_shared=no) 70AC_SUBST(build_shared) 71AC_MSG_RESULT($build_shared) 72 73if test x$build_static = xno -a x$build_shared = xno ; then 74 AC_MSG_ERROR([ both static and shared libraries are disabled], 1) 75fi 76 77# Check for math library 78AC_CHECK_LIB(m, cos, , AC_MSG_ERROR(math library is needed!)) 79 80# Check for debug 81AC_MSG_CHECKING(whether to compile debug version) 82AC_ARG_ENABLE(debug, 83 [ --enable-debug = enable various debug output], 84 debug=$enableval) 85if test "$debug" = "yes"; then 86 AC_SUBST( cppflag, ["-D_STK_DEBUG_ -D__RTAUDIO_DEBUG__ -D__RTMIDI_DEBUG__"] ) 87 AC_SUBST( cxxflag, ["-g"] ) 88 AC_SUBST( object_path, [Debug] ) 89else 90 AC_SUBST( debug, [no] ) 91 AC_SUBST( cppflag, [] ) 92 AC_SUBST( object_path, [Release] ) 93fi 94AC_MSG_RESULT($debug) 95 96# Checks for functions 97if test $realtime = yes; then 98 AC_CHECK_FUNCS(select socket) 99 AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], ) 100fi 101 102# For -I and -D flags 103CPPFLAGS="$CPPFLAGS $cppflag" 104 105# For debugging and optimization ... overwrite default because it has both -g and -O2 106CXXFLAGS="$CXXFLAGS $cxxflag" 107 108# Check compiler and use -Wall if gnu. 109if [test $GXX = "yes" ;] then 110 AC_SUBST( cxxflag, [-Wall] ) 111fi 112 113CXXFLAGS="$CXXFLAGS $cxxflag" 114 115AC_CANONICAL_HOST 116 117basesharedname="libstk-\$(RELEASE)" 118 119AC_SUBST( sharedlib, ["libstk.so"] ) 120AC_SUBST( sharedname, [${basesharedname}.so] ) 121AC_SUBST( libflags, ["-shared -Wl,-soname,${basesharedname}.so -o $sharedname"] ) 122case $host in 123 *-apple*) 124 AC_SUBST( sharedlib, ["libstk.dylib"] ) 125 AC_SUBST( sharedname, ["${basesharedname}.dylib"] ) 126 AC_SUBST( libflags, ["-dynamiclib -install_name \$(libdir)/${basesharedname}.dylib -o ${basesharedname}.dylib"] ) 127esac 128 129if test $realtime = yes; then 130 # Checks for package options and external software 131 AC_MSG_CHECKING(for audio API) 132 133 AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)]) 134 AS_IF([test "x$with_jack" == "xyes"], [ 135api="$api -D__UNIX_JACK__" 136 AC_MSG_RESULT(using JACK) 137 AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))]) 138 139 case $host in 140 *-*-netbsd*) 141 AS_IF([test "$api" == ""], [ 142 AC_MSG_RESULT(using OSS) 143 api="$api -D__LINUX_OSS__" 144 LIBS="$LIBS -lossaudio" 145 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))]) 146 ;; 147 148 *-*-dragonfly*) 149 AS_IF([test "$api" == ""], [ 150 AC_MSG_RESULT(using OSS) 151 api="$api -D__LINUX_OSS__" 152 LIBS="$LIBS -lossaudio" 153 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))]) 154 ;; 155 156 *-*-linux*|*-*-dragonfly*) 157 # Look for ALSA flag 158 #AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)]) 159 #AS_IF([test "x$with_alsa" == "xyes"], [ 160 #api="$api -D__LINUX_ALSA__" 161 #AC_MSG_RESULT(using ALSA) 162 #AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))]) 163 164 # Look for OSS flag 165 AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (unixes only)]) 166 AS_IF([test "x$with_oss" == "xyes"], [ 167 api="$api -D__LINUX_OSS__" 168 AC_MSG_RESULT(using OSS) 169 #AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(OSS support requires ALSA for RtMidi!))]) 170 171 # If no audio api flags specified, use ALSA 172 #AS_IF([test "$api" == ""], [ 173 # AC_MSG_RESULT(using ALSA) 174 # AC_SUBST( api, [-D__LINUX_ALSA__] ) 175 # AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!)) 176 #]) 177 178 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!)) 179 ;; 180 181 *-apple*) 182 # Look for Core flag 183 AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)]) 184 AS_IF([test "x$with_core" == "xyes"], [ 185 api="$api -D__MACOSX_CORE__" 186 AC_MSG_RESULT(using CoreAudio) 187 AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] ) 188 LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework CoreMIDI" ]) 189 190 # If no audio api flags specified, use CoreAudio 191 AS_IF([test "$api" == ""], [ 192 AC_SUBST( api, [-D__MACOSX_CORE__] ) 193 AC_MSG_RESULT(using CoreAudio) 194 AC_CHECK_HEADER(CoreAudio/CoreAudio.h, 195 [], 196 [AC_MSG_ERROR(CoreAudio header files not found!)] ) 197 AC_SUBST( LIBS, ["-framework CoreAudio -framework CoreFoundation -framework CoreMIDI"] ) 198 ]) 199 200 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!)) 201 ;; 202 203 *-mingw32*) 204 AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)]) 205 AS_IF([test "x$with_asio" == "xyes"], [ 206 api="$api -D__WINDOWS_ASIO__" 207 AC_MSG_RESULT(using ASIO) 208 AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] ) ]) 209 210 # Look for DirectSound flag 211 AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)]) 212 AS_IF([test "x$with_ds" == "xyes"], [ 213 api="$api -D__WINDOWS_DS__" 214 AC_MSG_RESULT(using DirectSound) 215 LIBS="-ldsound $LIBS" ]) 216 217 # Look for WASAPI flag 218 AC_ARG_WITH(wasapi, [ --with-wasapi = choose Windows Audio Session API support (windoze only)]) 219 AS_IF([test "x$with_wasapi" == "xyes"], [ 220 api="$api -D__WINDOWS_WASAPI__" 221 AC_MSG_RESULT(using WASAPI) 222 LIBS="-luuid -lksuser $LIBS" ]) 223 224 # If no audio api flags specified, use DirectSound 225 AS_IF([test "$api" == ""], [ 226 AC_SUBST( api, [-D__WINDOWS_DS__] ) 227 AC_MSG_RESULT(using DirectSound) 228 LIBS="-ldsound -lwinmm $LIBS" 229 ]) 230 231 api="$api -D__WINDOWS_MM__" 232 LIBS="-lole32 -lwinmm -lwsock32 $LIBS" 233 ;; 234 235 *) 236 # Default case for unknown realtime systems. 237 AC_MSG_ERROR(Unknown system type for realtime support ... try --disable-realtime argument!) 238 ;; 239 esac 240 241CPPFLAGS="$CPPFLAGS $api" 242fi 243 244AC_OUTPUT 245