configure.in 12.6 KB
Newer Older
1
dnl
bjornroche's avatar
bjornroche committed
2
dnl portaudio V19 configure.in script
3
dnl
bjornroche's avatar
bjornroche committed
4
dnl Dominic Mazzoni, Arve Knudsen
5 6 7 8 9 10 11
dnl

dnl Require autoconf >= 2.13
AC_PREREQ(2.13)

dnl Init autoconf and make sure configure is being called
dnl from the right directory
bjornroche's avatar
bjornroche committed
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
AC_INIT([include/portaudio.h])

dnl Specify options

AC_ARG_WITH(alsa, 
            [  --with-alsa (default=yes)],
            with_alsa=$withval, with_alsa="yes")

AC_ARG_WITH(jack, 
            [  --with-jack (default=yes)],
            with_jack=$withval, with_jack="yes")

AC_ARG_WITH(oss, 
            [  --with-oss (default=yes)],
            with_oss=$withval, with_oss="yes")

AC_ARG_WITH(asihpi,
            [  --with-asihpi (default=auto)],
            with_asihpi=$withval, with_asihpi="yes")

AC_ARG_WITH(host_os, 
            [  --with-host_os (no default)],
            host_os=$withval)

AC_ARG_WITH(winapi,
            [  --with-winapi ((wmme/directx/asio) default=wmme)],
            with_winapi=$withval, with_winapi="wmme")

dnl Mac API added for ASIO, can have other api's listed
AC_ARG_WITH(macapi,
            [  --with-macapi ((asio/core/sm) default=core)],
            with_macapi=$withval, with_macapi="core")

AC_ARG_WITH(asiodir,
            [  --with-asiodir (default=/usr/local/asiosdk2)],
            with_asiodir=$withval, with_asiodir="/usr/local/asiosdk2")

AC_ARG_WITH(dxdir,
            [  --with-dxdir (default=/usr/local/dx7sdk)],
            with_dxdir=$withval, with_dxdir="/usr/local/dx7sdk")

AC_ARG_ENABLE(debug-output,
            [  --enable-debug-output],
            [if test x$enableval != xno ; then
                AC_DEFINE(PA_ENABLE_DEBUG_OUTPUT,,[Enable debugging messages])
             fi
            ])

AC_ARG_ENABLE(cxx,
            [  --enable-cxx (default=no)],
            enable_cxx=$enableval, enable_cxx="no")

AC_ARG_ENABLE(mac-debug,
            [  --enable-mac-debug (default=no)],
            enable_mac_debug=$enableval, enable_mac_debug="no")

AC_ARG_ENABLE(mac-universal,
            [  --enable-mac-universal (default=yes)],
            enable_mac_universal=$enableval, enable_mac_universal="yes")

dnl Checks for programs.
73 74

AC_PROG_CC
bjornroche's avatar
bjornroche committed
75 76
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
77
AC_PROG_INSTALL
bjornroche's avatar
bjornroche committed
78
AC_PROG_LN_S
79 80
AC_PATH_PROG(AR, ar, no)
if [[ $AR = "no" ]] ; then
bjornroche's avatar
bjornroche committed
81
    AC_MSG_ERROR("Could not find ar - needed to create a library")
82 83
fi

bjornroche's avatar
bjornroche committed
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
dnl This must be one of the first tests we do or it will fail...
AC_C_BIGENDIAN

dnl checks for various host APIs and arguments to configure that
dnl turn them on or off

AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
AC_CHECK_LIB(hpi, HPI_SubSysCreate, have_asihpi=yes, have_asihpi=no, -lm)
AC_CHECK_LIB(ossaudio, _oss_ioctl, have_libossaudio=yes, have_libossaudio=no)

dnl Determine the host description for the subsequent test.
dnl PKG_CHECK_MODULES seems to check and set the host variable also, but
dnl that then requires pkg-config availability which is not standard on
dnl MinGW systems and can be a pain to install.
dnl AC_CANONICAL_HOST

PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)

dnl checks for header files
AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h])

dnl sizeof checks: we will need a 16-bit and a 32-bit type

AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)

save_LIBS="${LIBS}"
AC_CHECK_LIB(rt, clock_gettime, [rt_libs=" -lrt"])
LIBS="${LIBS}${rt_libs}"
DLL_LIBS="${DLL_LIBS}${rt_libs}"
AC_CHECK_FUNCS([clock_gettime nanosleep])
LIBS="${save_LIBS}"

dnl LT_RELEASE=19
LT_CURRENT=2
LT_REVISION=0
LT_AGE=0

AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

dnl extra variables
128
AC_SUBST(OTHER_OBJS)
129 130
AC_SUBST(PADLL)
AC_SUBST(SHARED_FLAGS)
bjornroche's avatar
bjornroche committed
131
AC_SUBST(THREAD_CFLAGS)
132
AC_SUBST(DLL_LIBS)
bjornroche's avatar
bjornroche committed
133 134 135
AC_SUBST(CXXFLAGS)
AC_SUBST(NASM)
AC_SUBST(NASMOPT)
136

bjornroche's avatar
bjornroche committed
137 138 139 140 141 142 143 144 145 146 147 148 149 150
dnl -g is optional on darwin
if ( echo "${host_os}" | grep ^darwin >> /dev/null ) &&
      [[ "$enable_mac_universal" = "yes" ] &&
       [ "$enable_mac_debug" != "yes" ]] ; then
   CFLAGS="-O2 -Wall -pedantic -pipe -fPIC -DNDEBUG"
else
   CFLAGS=${CFLAGS:-"-g -O2 -Wall -pedantic -pipe -fPIC"}
fi

if [[ $ac_cv_c_bigendian = "yes" ]] ; then
   CFLAGS="$CFLAGS -DPA_BIG_ENDIAN"
else
   CFLAGS="$CFLAGS -DPA_LITTLE_ENDIAN"
fi
151 152 153

case "${host_os}" in
  darwin* )
bjornroche's avatar
bjornroche committed
154
        dnl Mac OS X configuration
155

bjornroche's avatar
bjornroche committed
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
        AC_DEFINE(PA_USE_COREAUDIO)

        CFLAGS="$CFLAGS -Werror"
        LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon"

        if test "x$enable_mac_universal" = "xyes" ; then
           mac_version_min="-mmacosx-version-min=10.3"
           if [[ -d /Developer/SDKs/MacOSX10.5.sdk ]] ; then
              mac_arches="-arch i386 -arch ppc -arch x86_64 -arch ppc64"
              mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
           else
              mac_arches="-arch i386 -arch ppc"
              mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk"
           fi
        else
           mac_arches=""
           mac_sysroot=""
           mac_version=""
        fi
        SHARED_FLAGS="$LIBS -dynamiclib $mac_arches $mac_sysroot $mac_version_min"
        CFLAGS="-std=c99 $CFLAGS $mac_arches $mac_sysroot $mac_version_min"
        OTHER_OBJS="src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o src/hostapi/coreaudio/pa_mac_core.o src/hostapi/coreaudio/pa_mac_core_utilities.o src/hostapi/coreaudio/pa_mac_core_blocking.o src/common/pa_ringbuffer.o"
        PADLL="libportaudio.dylib"
        if [[ $with_macapi = "asio" ]] ; then
            if [[ $with_asiodir ]] ; then
              ASIODIR="$with_asiodir"
            else
              ASIODIR="/usr/local/asiosdk2"
            fi
            echo "ASIODIR: $ASIODIR"

            OTHER_OBJS="src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/host/asiodrivers.o $ASIODIR/common/asio.o $ASIODIR/host/mac/asioshlib.o"
            CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/mac -I$ASIODIR/common"
            CXXFLAGS="$CFLAGS"
        fi
        ;;
192

193
  mingw* )
bjornroche's avatar
bjornroche committed
194
        dnl MingW configuration
195

bjornroche's avatar
bjornroche committed
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
        echo "WINAPI: $with_winapi"
        if [[ $with_winapi = "directx" ]] ; then
            if [[ $with_dxdir ]] ; then
              DXDIR="$with_dxdir"
            else
              DXDIR="/usr/local/dx7sdk"
            fi
            echo "DXDIR: $DXDIR"
            OTHER_OBJS="src/hostapi/dsound/pa_win_ds.o src/hostapi/dsound/pa_win_ds_dynlink.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o"
            LIBS="-lwinmm -lm -ldsound -lole32"
            PADLL="portaudio.dll"
            THREAD_CFLAGS="-mthreads"
            SHARED_FLAGS="-shared"
            DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L./dx7sdk/lib -ldsound -lole32"
            #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
            #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO"
            CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I$DXDIR/include -DPA_NO_WMME -DPA_NO_ASIO" -DPA_NO_WDMKS
        elif [[ $with_winapi = "asio" ]] ; then
            if [[ $with_asiodir ]] ; then
              ASIODIR="$with_asiodir"
            else
              ASIODIR="/usr/local/asiosdk2"
            fi
            echo "ASIODIR: $ASIODIR"


            OTHER_OBJS="src/hostapi/asio/pa_asio.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/common/asio.o $ASIODIR/host/asiodrivers.o $ASIODIR/host/pc/asiolist.o"
            LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid"
            PADLL="portaudio.dll"
            THREAD_CFLAGS="-mthreads"
            SHARED_FLAGS="-shared"
            DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lstdc++ -lole32 -luuid"
            CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -I\$(top_srcdir)/src/common -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/pc -I$ASIODIR/common -I$ASIODIR/host -DPA_NO_WMME -DPA_NO_DS -DPA_NO_WDMKS -DWINDOWS"
            CXXFLAGS="$CFLAGS"
        elif [[ $with_winapi = "wdmks" ]] ; then
            if [[ $with_dxdir ]] ; then
              DXDIR="$with_dxdir"
            else
              DXDIR="/usr/local/dx7sdk"
            fi
            echo "DXDIR: $DXDIR"
            OTHER_OBJS="src/hostapi/wdmks/pa_win_wdmks.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o"
            LIBS="-lwinmm -lm -luuid -lsetupapi -lole32"
            PADLL="portaudio.dll"
            THREAD_CFLAGS="-mthreads"
            SHARED_FLAGS="-shared"
            DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L./dx7sdk/lib -luuid -lsetupapi -lole32"
            #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
            #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO"
            CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -I$DXDIR/include -DPA_NO_WMME -DPA_NO_DS -DPA_NO_ASIO"
        else   # WMME default
            OTHER_OBJS="src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o"
            LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid"
            PADLL="portaudio.dll"
            THREAD_CFLAGS="-mthreads"
            SHARED_FLAGS="-shared"
            DLL_LIBS="${DLL_LIBS} -lwinmm"
            CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -DPA_NO_DS -DPA_NO_ASIO -DPA_NO_WDMKS"
        fi
        ;;
256

257
  cygwin* )
bjornroche's avatar
bjornroche committed
258 259 260 261 262 263 264 265 266 267
        dnl Cygwin configuration

        OTHER_OBJS="src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o"
        CFLAGS="$CFLAGS -DPA_NO_DS -DPA_NO_WDMKS -DPA_NO_ASIO -DPA_NO_WASAPI"
        LIBS="-lwinmm -lm"
        PADLL="portaudio.dll"
        THREAD_CFLAGS="-mthreads"
        SHARED_FLAGS="-shared"
        DLL_LIBS="${DLL_LIBS} -lwinmm"
        ;;
268

bjornroche's avatar
bjornroche committed
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
  irix* )
        dnl SGI IRIX audio library (AL) configuration (Pieter, oct 2-13, 2003).
        dnl The 'dmedia' library is needed to read the Unadjusted System Time (UST).
        dnl
        AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([IRIX posix thread library not found!]))
        AC_CHECK_LIB(audio,   alOpenPort,     , AC_MSG_ERROR([IRIX audio library not found!]))
        AC_CHECK_LIB(dmedia,  dmGetUST,       , AC_MSG_ERROR([IRIX digital media library not found!]))

        dnl See the '#ifdef PA_USE_SGI' in file pa_unix/pa_unix_hostapis.c
        dnl which selects the appropriate PaXXX_Initialize() function.
        dnl
        AC_DEFINE(PA_USE_SGI)

        dnl The _REENTRANT option for pthread safety. Perhaps not necessary but it 'll do no harm.
        dnl
        THREAD_CFLAGS="-D_REENTRANT"
    
        OTHER_OBJS="pa_sgi/pa_sgi.o src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o"

        dnl SGI books say -lpthread should be the last of the libs mentioned.
        dnl
        LIBS="-lm -ldmedia -laudio -lpthread"
        PADLL="libportaudio.so"
        SHARED_FLAGS=""
        ;;
294

295
  *)
bjornroche's avatar
bjornroche committed
296
        dnl Unix configuration
297

bjornroche's avatar
bjornroche committed
298
        AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"],
299 300
                AC_MSG_ERROR([libpthread not found!]))

bjornroche's avatar
bjornroche committed
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
        if [[ $have_alsa = "yes" ] && [ $with_alsa != "no" ]] ; then
           DLL_LIBS="$DLL_LIBS -lasound"
           LIBS="$LIBS -lasound"
           OTHER_OBJS="$OTHER_OBJS src/hostapi/alsa/pa_linux_alsa.o"
           AC_DEFINE(PA_USE_ALSA)
        fi

        if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then
           DLL_LIBS="$DLL_LIBS $JACK_LIBS"
           CFLAGS="$CFLAGS $JACK_CFLAGS"
           OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o src/common/pa_ringbuffer.o"
           AC_DEFINE(PA_USE_JACK)
        fi

        if [[ $with_oss != "no" ]] ; then
           OTHER_OBJS="$OTHER_OBJS src/hostapi/oss/pa_unix_oss.o"
           if [[ $have_libossaudio = "yes" ]] ; then
                   DLL_LIBS="$DLL_LIBS -lossaudio"
                   LIBS="$LIBS -lossaudio"
           fi      
           AC_DEFINE(PA_USE_OSS)
        fi
323

bjornroche's avatar
bjornroche committed
324 325 326 327 328 329
        if [[ $have_asihpi = "yes" ] && [ $with_asihpi != "no" ]] ; then
           LIBS="$LIBS -lhpi"
           DLL_LIBS="$DLL_LIBS -lhpi"
           OTHER_OBJS="$OTHER_OBJS src/hostapi/asihpi/pa_linux_asihpi.o"
           AC_DEFINE(PA_USE_ASIHPI)
        fi
330

bjornroche's avatar
bjornroche committed
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
        DLL_LIBS="$DLL_LIBS -lm -lpthread"
        LIBS="$LIBS -lm -lpthread"
        PADLL="libportaudio.so"

        ## support sun cc compiler flags
        case "${host_os}" in
           solaris*)
              SHARED_FLAGS="-G"
              THREAD_CFLAGS="-mt"
              ;;
           *)
              SHARED_FLAGS="-shared -fPIC"
              THREAD_CFLAGS="-pthread"
              ;;
        esac

        OTHER_OBJS="$OTHER_OBJS src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o"
esac
CFLAGS="$CFLAGS $THREAD_CFLAGS"

if test "$enable_cxx" = "yes"; then
   AC_CONFIG_SUBDIRS([bindings/cpp])
   ENABLE_CXX_TRUE=""
   ENABLE_CXX_FALSE="#"
else
   ENABLE_CXX_TRUE="#"
   ENABLE_CXX_FALSE=""
fi
AC_SUBST(ENABLE_CXX_TRUE)
AC_SUBST(ENABLE_CXX_FALSE)
361

bjornroche's avatar
bjornroche committed
362
AC_OUTPUT([Makefile portaudio-2.0.pc])