summaryrefslogtreecommitdiff
path: root/portaudio/bindings/cpp/build/gnu/configure.ac
blob: 5457c53420da289775c26c4892820b1c86e5cc64 (plain)
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
#
# PortAudioCpp V19 autoconf input file
# Shamelessly ripped from the PortAudio one by Dominic Mazzoni
# Ludwig Schwardt
#

# Require autoconf >= 2.13
AC_PREREQ(2.13)

AC_INIT([PortAudioCpp], [12])
AC_CONFIG_SRCDIR([../../include/portaudiocpp/PortAudioCpp.hxx])

###### Top-level directory of pacpp
###### This makes it easy to shuffle the build directories
###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)!
PACPP_ROOT="../.."

######
###### SET THIS TO PORTAUDIO DIRECTORY
######
PORTAUDIO="$PACPP_ROOT/../portaudio"

# Various other variables and flags

PACPP_INC="$PACPP_ROOT/include"
INCLUDES="-I$PACPP_INC -I$PORTAUDIO -I$PORTAUDIO/pa_common"
CFLAGS="-g -O2 -Wall -ansi -pedantic $INCLUDES"
CXXFLAGS="$CFLAGS"
PALIBDIR="$PORTAUDIO/lib"

# Checks for programs

AC_PROG_CC
AC_PROG_CXX
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PATH_PROG(AR, ar, no)
if [[ $AR = "no" ]] ; then
    AC_MSG_ERROR("Could not find ar - needed to create a library");
fi

# This must be one of the first tests we do or it will fail...
AC_C_BIGENDIAN

# Transfer these variables to the Makefile
AC_SUBST(PACPP_ROOT)
AC_SUBST(PORTAUDIO)
AC_SUBST(PADLL)
AC_SUBST(PACPP_DLL)
AC_SUBST(PACPP_INC)
AC_SUBST(SHARED_FLAGS)
AC_SUBST(DLL_LIBS)
AC_SUBST(CXXFLAGS)

##################### CHECK FOR INSTALLED PACKAGES ############################

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

AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)

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

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

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

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

AC_ARG_WITH(oss, 
            [  --with-oss (default=yes)],
            with_oss=$withval, with_oss="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")

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

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")


##################### HOST-SPECIFIC LIBRARY SETTINGS ##########################

case "${host_os}" in
  darwin* )
	# Mac OS X configuration

	LIBS="-framework AudioUnit -framework AudioToolbox -framework CoreAudio";
	PADLL="libportaudio.dylib";
	PACPP_DLL="libportaudiocpp.dylib";
	SHARED_FLAGS="-framework AudioUnit -framework AudioToolbox";
	SHARED_FLAGS="$SHARED_FLAGS -framework CoreAudio -dynamiclib";
        if [[ $with_macapi = "asio" ]] ; then
            if [[ $with_asiodir ]] ; then
              ASIODIR="$with_asiodir";
            else
              ASIODIR="/usr/local/asiosdk2";
            fi
            echo "ASIODIR: $ASIODIR";
        fi
	;;

  mingw* )
        # MingW configuration

        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"
	    LIBS="-L$PALIBDIR -lportaudio"
            LIBS="$LIBS -lwinmm -lm -ldsound -lole32";
            PADLL="portaudio.dll";
            PACPP_DLL="portaudiocpp.dll";
            SHARED_FLAGS="-shared -mthreads";
            DLL_LIBS="-lwinmm -lm -L./dx7sdk/lib -ldsound -lole32";
            CFLAGS="$CFLAGS -DPA_NO_WMME -DPA_NO_ASIO";
	    CXXFLAGS="$CFLAGS"
        elif [[ $with_winapi = "asio" ]] ; then
            if [[ $with_asiodir ]] ; then
              ASIODIR="$with_asiodir";
            else
              ASIODIR="/usr/local/asiosdk2";
            fi
            echo "ASIODIR: $ASIODIR"

	    LIBS="-L$PALIBDIR -lportaudio"
            LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid";
            PADLL="portaudio.dll";
            PACPP_DLL="portaudiocpp.dll";
            SHARED_FLAGS="-shared -mthreads";
            DLL_LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid";
            CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -DPA_NO_WMME -DPA_NO_DS -DWINDOWS";
            CXXFLAGS="$CFLAGS";
        else   # WMME default
	    LIBS="-L$PALIBDIR -lportaudio"
            LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid";
            PADLL="portaudio.dll";
            PACPP_DLL="portaudiocpp.dll";
            SHARED_FLAGS="-shared -mthreads";
            DLL_LIBS="-lwinmm";
            CFLAGS="$CFLAGS -DPA_NO_DS -DPA_NO_ASIO";
            CXXFLAGS="$CFLAGS";
        fi
        ;;

  cygwin* )
	# Cygwin configuration

	LIBS="-L$PALIBDIR -lportaudio"
	LIBS="$LIBS -lwinmm -lm";
	PADLL="portaudio.dll";
	PACPP_DLL="portaudiocpp.dll";
	SHARED_FLAGS="-shared -mthreads";
	DLL_LIBS="-lwinmm";
	;;

  *)
	# Unix OSS configuration

   AC_CHECK_LIB(pthread, pthread_create,
                ,
                AC_MSG_ERROR([libpthread not found!]))
	
	LIBS="$LIBS -L$PALIBDIR -lportaudio"
	
	if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then
   	      	LIBS="$LIBS $JACK_LIBS"
		CFLAGS="$CFLAGS $JACK_CFLAGS"
                AC_DEFINE(PA_USE_JACK)
	fi

	if [[ $have_alsa = "yes" ] && [ $with_alsa != "no" ]] ; then
                LIBS="$LIBS -lasound"
                AC_DEFINE(PA_USE_ALSA)
	fi

	if [[ $with_oss != "no" ]] ; then
		AC_DEFINE(PA_USE_OSS)
	fi
	LIBS="$LIBS -lm -lpthread";
	PADLL="libportaudio.so";
	PACPP_DLL="libportaudiocpp.so";
	SHARED_FLAGS="-shared";
esac

AC_CONFIG_FILES([Makefile])
AC_OUTPUT