Version 2.1
[rtaudio.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(RtAudio, 2.1, gary@ccrma.stanford.edu, rtaudio)
3 AC_CONFIG_SRCDIR(RtAudio.cpp)
4 AC_CONFIG_FILES(tests/Makefile)
5
6 # Checks for programs.
7 AC_PROG_CC
8 AC_PROG_CXX(CC g++ c++ cxx)
9
10 # Checks for libraries.
11 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
12
13 # Checks for header files.
14 AC_HEADER_STDC
15 AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
16
17 # Checks for typedefs, structures, and compiler characteristics.
18 AC_C_CONST
19
20 # Check for debug
21 AC_MSG_CHECKING(whether to compile debug version)
22 AC_ARG_ENABLE(debug,
23   [  --enable-debug = enable various debug output],
24   [AC_SUBST( debug, [-D__RTAUDIO_DEBUG__] ) AC_SUBST( cflags, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
25   [AC_SUBST( debug, [] ) AC_SUBST( cflags, [-O2] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
26
27 # Check compiler and use -Wall if gnu.
28 if test $GXX = "yes" ; then
29   AC_SUBST( warn, [-Wall] )
30 fi
31
32 # Checks for package options and external software
33 AC_CANONICAL_HOST
34 AC_MSG_CHECKING(for audio API)
35 case $host in
36   *-*-linux*)
37   AC_ARG_WITH(alsa, [  --with-alsa = choose native ALSA API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_ALSA__] ) AC_MSG_RESULT(using ALSA) ], [AC_SUBST( sound_api, [-D__LINUX_OSS__] ) AC_MSG_RESULT(using OSS)])
38
39   if test $sound_api = -D__LINUX_ALSA__; then
40     AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
41   fi
42   ;;
43
44   *-sgi*)
45   AC_SUBST( sound_api, [-D__IRIX_AL__] )
46   AC_MSG_RESULT(using IRIX AL)
47   AC_CHECK_LIB(audio, alOpenPort, , AC_MSG_ERROR(IRIX audio support requires the audio library!) )
48   ;;
49
50   *-apple*)
51   # Check for CoreAudio framework
52   AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
53     [AC_SUBST( sound_api, [-D__MACOSX_CORE__] )],
54     [AC_MSG_ERROR(CoreAudio header files not found!)] )
55   AC_SUBST( frameworks, ["-framework CoreAudio"] )
56   AC_CHECK_LIB(stdc++, printf, , AC_MSG_ERROR(RtAudio requires the C++ library!) )
57   ;;
58
59   *)
60   # Default case for unknown realtime systems.
61   AC_MSG_ERROR(Unknown system type for realtime support!)
62   ;;
63 esac
64
65 # Checks for library functions.
66 AC_PROG_GCC_TRADITIONAL
67
68 AC_OUTPUT