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
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
|
# NOTE!!!
# ./configure is not a source file (not written by someone), it's generated from
# ./configure.in, but it's still put in the CVS and releases so that people don't
# have to have autoconf installed.
AC_INIT
AC_CONFIG_SRCDIR([kernel.c])
AC_SUBST(oss, yes)
AC_SUBST(alsa, yes)
AC_SUBST(jack, yes)
AC_SUBST(portaudio, yes)
AC_SUBST(portmidi, yes)
AC_SUBST(fftw, yes)
AC_SUBST(CPPFLAGS)
AC_SUBST(MORECFLAGS)
AC_SUBST(EXT)
AC_SUBST(USE_DEBUG_CFLAGS, no)
AC_SUBST(AUDIOSRC)
AC_SUBST(MIDISRC)
AC_SUBST(STRIPFLAG)
AC_SUBST(EXTERNTARGET)
AC_SUBST(LIBSUFFIX)
AC_SUBST(LDSOFLAGS)
AC_SUBST(WATCHDOG)
AC_SUBST(WLIB)
AC_SUBST(EXE)
AC_SUBST(WSTRIP)
AC_SUBST(STRIP)
AC_CONFIG_HEADERS([config.h:config.h.in])
dnl Checks for features.
AC_ARG_ENABLE(alsa, [ --enable-oss audio via OSS], alsa=$enableval)
AC_ARG_ENABLE(alsa, [ --enable-alsa audio via ALSA], alsa=$enableval)
AC_ARG_ENABLE(jack, [ --enable-jack audio via JACK], jack=$enableval)
AC_ARG_ENABLE(portaudio,[ --enable-portaudio audio via PortAudio], portaudio=$enableval)
AC_ARG_ENABLE(portmidi, [ --enable-portmidi MIDI via PortMidi], portmidi=$enableval)
AC_ARG_ENABLE(debug, [ --enable-debug debugging support], USE_DEBUG_CFLAGS=$enableval)
AC_ARG_ENABLE(static, [ --enable-static link statically], static=$enableval)
AC_ARG_ENABLE(fftw, [ --enable-fftw use FFTW package], fftw=$enableval)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CPP
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/ioctl.h sys/time.h unistd.h bstring.h)
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday select socket strerror)
AC_FUNC_ALLOCA
dnl added for win32 (for patko)
AC_CHECK_FUNCS(asprintf)
AC_CHECK_FUNCS(vasprintf)
# audio APIs may accumulate, but there must be only one MIDI API (??)
AUDIOSRC=""
MIDISRC="s_midi_none.c"
WLIB=""
STRIP="meuhhhhh"
if test `uname -s` = Linux; then
LDFLAGS="-Wl,-export-dynamic "
EXT=pd_linux
LIBSUFFIX=.so
CPPFLAGS="-DDL_OPEN -DPA_USE_OSS -DUNIX -DUNISTD"
MORECFLAGS="-fno-strict-aliasing"
STRIPFLAG=-s
STRIP="echo"
LDSOFLAGS="-shared"
WATCHDOG=pd-watchdog
EXE=""
WSTRIP=""
fi
if test `uname -s` = Darwin; then
LDFLAGS=""
EXT=pd_darwin
LIBSUFFIX=.dylib
CPPFLAGS="-DMACOSX -DUNISTD -I/usr/X11R6/include -DPA_USE_COREAUDIO"
CPPFLAGS=$CPPFLAGS" -DDL_OPEN" # 0.40
MORECFLAGS=""
STRIPFLAG=""
# LDSOFLAGS="-dylib -bundle -flat_namespace -undefined suppress"
# LDSOFLAGS="-dylib -flat_namespace"
# Charles Turner told me to use this:
LDSOFLAGS="-dynamiclib -Wl,-single_module"
EXTERNTARGET=pd_darwin
### this comes from pd 0.40
# if test `uname -r` = 7.9.0; then
# CPPFLAGS=$CPPFLAGS" -DMACOSX3"
# EXTERNTARGET=d_ppc
# else
# CPPFLAGS=$CPPFLAGS" -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
# MORECFLAGS=$MORECFLAGS" -arch i386 -arch ppc"
# EXTERNTARGET=d_fat
# LDFLAGS=$LDFLAGS" -arch i386 -arch ppc"
# fi
WATCHDOG=pd-watchdog
EXE=""
WSTRIP=""
fi
if test `uname -s | cut -f1 -d_` = CYGWIN; then
LDFLAGS="-Wl,-export-dynamic "
EXT=dll
LIBSUFFIX=.dll
CPPFLAGS="-DDL_OPEN -DPA_USE_OSS -DUNIX -DUNISTD"
MORECFLAGS="-fno-strict-aliasing"
STRIPFLAG=-s
LDSOFLAGS="-shared"
EXE=.exe
WSTRIP=""
fi
if test `uname -s | cut -f1 -d_` = MINGW32; then
LDFLAGS="-lm -lpthreadGC2 -lwsock32 -lwinmm -lole32 -L../src -lpd"
EXT=dll
LIBSUFFIX=.dll
CPPFLAGS="-DMSW \
-DPD_INTERNAL -DPD "
MORECFLAGS="-mms-bitfields"
STRIPFLAG=-s
LDSOFLAGS="-shared"
# AUDIOSRC="s_audio_mmio.c"
MIDISRC="s_midi_mmio.c"
STRIP="strip --strip-unneeded -R .note -R .comment"
EXPORT="-Wl, --export-all-symbols -Wl, --out-implib=pd.a"
WLIB=$WLIB"$LDFLAGS $EXPORT; $STRIP libpd.dll"
EXE=.exe
WATCHDOG=pd.com
WSTRIP=$STRIP $DESTDIR$bindir/pd.exe
fi
if test `uname -m` = x86_64; then
MORECFLAGS=$MORECFLAGS" -fPIC"
fi
if test "$static" = yes; then LDFLAGS="$LDFLAGS -static"; fi
dnl Checking for `dlopen' function in -ldl:
AC_CHECK_LIB(dl, dlopen,LDFLAGS="$LDFLAGS -ldl", echo "dynamic link support required" || exit 1)
dnl Checking for `sin' function in -lffm (ffm is the fast math library on the alpha)
AC_CHECK_LIB(ffm, sin,LDFLAGS="$LDFLAGS -lffm")
dnl Checking for `sin' function in -lm:
AC_CHECK_LIB(m, sin,LDFLAGS="$LDFLAGS -lm", echo "math library required" || exit 1)
dnl Checking for `pthread_create' function in -pthread
AC_CHECK_LIB(pthread, pthread_create,LDFLAGS="$LDFLAGS -lpthread", echo "pthreads required" || exit 1)
if test x$oss = xyes; then
AC_CHECK_HEADER(linux/soundcard.h,oss="yes",oss="no")
fi
dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
if test x$alsa = xyes; then
AC_CHECK_LIB(asound,snd_pcm_info,LDFLAGS="$LDFLAGS -lasound" ; alsa="yes",alsa="no")
fi
if test x$jack = xyes; then
AC_CHECK_LIB(rt,shm_open,LIBS="$LIBS -lrt")
AC_CHECK_LIB(jack,jack_set_xrun_callback,jack=xrun,jack=no)
AC_CHECK_LIB(jack,jack_set_error_function,jack=yes,jack=no)
fi
dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
if test x$portaudio = xyes; then
AC_CHECK_LIB(portaudio,Pa_GetDeviceCount,LDFLAGS=$LDFLAGS" -lportaudio" ; portaudio=yes,portaudio=no)
fi
if test x$portmidi = xyes; then
AC_CHECK_LIB(porttime,Pt_Started ,LDFLAGS=$LDFLAGS" -lporttime")
AC_CHECK_LIB(portmidi,Pm_Initialize,LDFLAGS=$LDFLAGS" -lportmidi" ; portmidi=yes,portmidi=no)
fi
if test x$USE_DEBUG_CFLAGS = xyes; then
MORECFLAGS=$MORECFLAGS" -O1 -g"
else
MORECFLAGS=$MORECFLAGS" -O3 -funroll-loops -fomit-frame-pointer"
fi
if test x$oss = xyes; then
AUDIOSRC=$AUDIOSRC" s_audio_oss.c"
MIDISRC="s_midi_oss.c"
CPPFLAGS=$CPPFLAGS" -DUSEAPI_OSS"
fi
if test x$alsa = xyes; then
# the alsa midi is weird, it needs to have another MIDI module at once, so i put it in "audio" instead.
AUDIOSRC=$AUDIOSRC" s_audio_alsa.c s_audio_alsamm.c s_midi_alsa.c"
CPPFLAGS=$CPPFLAGS" -DPA_USE_ALSA -DUSEAPI_ALSA"
LDFLAGS=$LDFLAGS" -lasound"
fi
if test x$jack = xyes; then
AUDIOSRC=$AUDIOSRC" s_audio_jack.c"
if test x$jack != xno; then
if test `uname -s` = Linux; then
if test x$jack = "xyes"; then LDFLAGS=$LDFLAGS" -lrt -ljack"; fi
if test x$jack = "xrun"; then LDFLAGS=$LDFLAGS" -lrt -ljack"; fi
fi
if test `uname -s` = Darwin; then
LDFLAGS=$LDFLAGS" -weak_framework Jackmp" # 0.40
else
LIBS="$LIBS -ljack"
fi
CPPFLAGS=$CPPFLAGS" -DUSEAPI_JACK"
fi
if test x$jack = "xrun"; then CPPFLAGS=$CPPFLAGS" -DJACK_XRUN"; fi
fi
if test x$portaudio = xyes; then
CPPFLAGS=$CPPFLAGS" -DUSEAPI_PORTAUDIO -DPA19"
AUDIOSRC=$AUDIOSRC" s_audio_portaudio.c"
if test `uname -s` = Darwin; then
LDFLAGS=$LDFLAGS" -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework Carbon"
fi
fi
if test x$portmidi = xyes; then
MIDISRC="s_midi_pm.c"
MIDIFLAGS="-DUSEAPI_PORTMIDI"
if test `uname -s` = Darwin; then
LDFLAGS=$LDFLAGS" -framework CoreMIDI"
fi
fi
CPPFLAGS=$CPPFLAGS" $MIDIFLAGS"
if test x$fftw = "xyes"; then
AC_CHECK_LIB(fftw3f, fftwf_forget_wisdom ,LDFLAGS=$LDFLAGS" -lfftw3f",fftw=no)
fi
AC_C_BIGENDIAN(bigendian=yes,bigendian=no,bigendian=maybe)
if test x$bigendian = "xyes"; then
CPPFLAGS=$CPPFLAGS" -DBIGENDIAN"
fi
AC_CONFIG_FILES([makefile])
AC_OUTPUT
|