-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
289 lines (250 loc) · 8.35 KB
/
configure.ac
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
AC_PREREQ(2.59)
AC_INIT(pd,0.43.0)
AC_CONFIG_SRCDIR(src/m_pd.c)
AC_CONFIG_AUX_DIR([m4/config])
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4/generated])
AC_CANONICAL_HOST
# you will need to install iPhone XCode on Mac OS X to use this:
PD_CHECK_IPHONE(IPHONEOS=yes, IPHONEOS=no, AC_MSG_ERROR([iPhoneOS SDK not available]))
PD_CHECK_ANDROID(ANDROID=yes, ANDROID=no , AC_MSG_ERROR([Android SDK not available]))
case $host in
*darwin*)
if test "x${IPHONEOS}" = "xno"; then
portaudio=yes
portmidi=yes
MACOSX=yes
EXTERNAL_CFLAGS="-fPIC"
EXTERNAL_EXTENSION=d_fat
else
portaudio=no
EXTERNAL_CFLAGS=
EXTERNAL_EXTENSION=pd_darwin
fi
CFLAGS="$CFLAGS -O3 -funroll-loops"
INCLUDES="$INCLUDES -I/sw/include"
LDFLAGS="$LDFLAGS -L/sw/lib"
EXTERNAL_LDFLAGS="-bundle -undefined dynamic_lookup"
;;
*linux*|GNU|GNU/kFreeBSD)
# GNU and GNU/kFreeBSD are for Debian, were they are treated very similar to linux
if test "x${host}" = "xGNU"; then
HURD=yes
fi
if test "x${ANDROID}" = "xno"; then
LINUX=yes
portaudio=yes
CFLAGS="$CFLAGS -O6 -funroll-loops"
fi
EXTERNAL_CFLAGS="-fPIC"
EXTERNAL_LDFLAGS="-Wl,--export-dynamic -shared -fPIC"
EXTERNAL_EXTENSION=pd_linux
;;
*mingw*)
WINDOWS=yes
MINGW=yes
asio=yes
portaudio=yes
CFLAGS="$CFLAGS -O6 -funroll-loops -DWINVER=0x0501 -D_WIN32_WINNT=0x0501"
EXTERNAL_CFLAGS="-mms-bitfields"
EXTERNAL_LDFLAGS="-s -shared -Wl,--enable-auto-import -lpd"
EXTERNAL_EXTENSION=dll
;;
*cygwin*)
WINDOWS=yes
CYGWIN=yes
portaudio=yes
CFLAGS="$CFLAGS -O6 -funroll-loops"
EXTERNAL_CFLAGS=
EXTERNAL_LDFLAGS="-Wl,--export-dynamic -shared -lpd"
EXTERNAL_EXTENSION=dll
;;
esac
AC_ARG_ENABLE([double-precision],
[AS_HELP_STRING([--enable-double-precision], [force the use of 64-bit double as the base number format])],
[doubleprecision=$enableval])
# In m_pd.h, PD_FLOAT_PRECISION is set to the same bitness as the CPU
# arch. These options allow you to force either way.
#
# force 64-bit double
if test x$doubleprecision = xyes; then
AC_DEFINE(PD_FLOAT_PRECISION, 64)
echo "forcing 64-bit double as base number"
fi
# force 32-bit float
if test x$doubleprecision = xno; then
AC_DEFINE(PD_FLOAT_PRECISION, 32)
echo "forcing 32-bit float as base number"
fi
PD_CHECK_UNIVERSAL(ARCH, universal=yes, universal=no)
AM_CONDITIONAL(UNIVERSAL, test x$universal = xyes)
if test "x${universal}" = "xyes"; then
CFLAGS="${CFLAGS} ${ARCH_CFLAGS}"
LDFLAGS="${LDFLAGS} ${ARCH_LDFLAGS}"
fi
AM_CONDITIONAL(ANDROID, test x$ANDROID = xyes)
AM_CONDITIONAL(IPHONEOS, test x$IPHONEOS = xyes)
AM_CONDITIONAL(LINUX, test x$LINUX = xyes)
AM_CONDITIONAL(HURD, test x$HURD = xyes)
AM_CONDITIONAL(MACOSX, test x$MACOSX = xyes)
AM_CONDITIONAL(WINDOWS, test x$WINDOWS = xyes)
AM_CONDITIONAL(CYGWIN, test x$MINGW = xyes)
AM_CONDITIONAL(MINGW, test x$MINGW = xyes)
# Configure libtool
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_LN_S
#AC_PROG_GREP
#AC_PROG_SED
AC_SUBST(EXTERNTARGET)
AC_SUBST(INCLUDES)
AC_SUBST(EXTERNAL_EXTENSION)
AC_SUBST(EXTERNAL_CFLAGS)
AC_SUBST(EXTERNAL_LDFLAGS)
dnl Checks for libraries.
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIBM
# AC_CHECK_LIBM computes LIBM but does not add to LIBS, hence we add it in
# src/Makefile.am under pd_LDFLAGS as well
# Checking for `pthread_create' function in -pthread (MinGW uses unusual names)
## CHECK whether this can be replaced by AX_PTHREAD
AC_CHECK_LIB([pthread], [pthread_create],LIBS="-lpthread $LIBS",
AC_CHECK_LIB([pthreadGC2], [pthread_create], LIBS="-lpthreadGC2 $LIBS",
AC_CHECK_LIB([pthreadGC1], [pthread_create], LIBS="-lpthreadGC1 $LIBS",
AC_CHECK_LIB([pthreadGC], [pthread_create], LIBS="-lpthreadGC $LIBS",
AC_MSG_WARN([pthreads required])))))
AC_HEADER_STDC
dnl Cygwin has sys/soundcard.h but Pd isn't ready for Cygwin since it only
dnl includes OSS for UNIX
AC_CHECK_HEADER(sys/soundcard.h, [oss=yes], [oss=no])
AM_CONDITIONAL(OSS, test x$oss = xyes)
AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [coreaudio=yes], [coreaudio=no])
dnl AC_CHECK_HEADER(Jackmp/jack.h, [jack=yes], [jack=no])
dnl portaudio/CoreAudio doesn't work with iPhone
test x$IPHONEOS = xyes && coreaudio=no
AM_CONDITIONAL(COREAUDIO, test x$coreaudio = xyes)
dnl TODO implement debug and static
#AC_ARG_ENABLE(static, [ --enable-static link statically],
# static=$enableval)
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [use debugging support])],
[debug=$enableval])
if test x$debug = xyes; then
CFLAGS="$CFLAGS -g -fno-omit-frame-pointer -Wstrict-aliasing=3"
else
# -fomit-frame-pointer causes problems when debugging
CFLAGS="$CFLAGS -fomit-frame-pointer"
fi
dnl ALSA
dnl shouldn't we use AM_PATH_ALSA from /usr/share/aclocal/alsa.m4
dnl alternatively we could use pkg-config
AC_ARG_ENABLE([alsa],
[AS_HELP_STRING([--disable-alsa],
[do not use ALSA audio driver])],
[alsa=$enableval], [alsa=yes])
AS_IF([test x$alsa = xyes], [
AC_CHECK_LIB(asound,snd_pcm_info,LIBS="$LIBS -lasound",alsa=no)])
AM_CONDITIONAL(ALSA, test x$alsa = xyes)
dnl ASIO
AC_ARG_ENABLE([asio],
[AS_HELP_STRING([--enable-asio],
[use ASIO audio driver])],
[asio=$enableval])
AS_IF([test x$asio = xyes], [
AC_CHECK_FILE([asio/ASIOSDK2/common/asio.h],[asio=yes],[asio=no])])
AM_CONDITIONAL(ASIO, test x$asio = xyes)
dnl JACK
dnl shouldn't we use pkg-config?
dnl TODO support jack xrun
AC_ARG_ENABLE([jack],
[AS_HELP_STRING([--enable-jack],
[use JACK audio server])],
[jack=$enableval])
dnl on Mac OS X, use the JackOSX.com Jackmp.framework not the jack lib.
dnl this is set in src/Makefile.am based on the JACK var
AS_IF([test x$MACOSX != xyes], [
AS_IF([test x$jack = xyes], [
AC_CHECK_LIB(rt,shm_open,LIBS="$LIBS -lrt")
AC_CHECK_LIB(jack,jack_set_xrun_callback,LIBS="$LIBS -ljack";jack=xrun)
AC_CHECK_LIB(jack,jack_set_error_function,LIBS="$LIBS -ljack";jack=yes,
jack=no)])])
AM_CONDITIONAL(JACK, test x$jack = xyes)
dnl portaudio
AC_ARG_ENABLE([portaudio],
[AS_HELP_STRING([--disable-portaudio],
[do not use portaudio])],
[portaudio=$enableval])
AM_CONDITIONAL(PORTAUDIO, test x$portaudio = xyes)
dnl portmidi
AC_ARG_ENABLE([portmidi],
[AS_HELP_STRING([--enable-portmidi],
[use portmidi])],
[portmidi=$enableval])
AM_CONDITIONAL(PORTMIDI, test x$portmidi = xyes)
if test x$portmidi = xyes; then echo Using included portmidi; fi
dnl fftw v2
AC_ARG_ENABLE([fftw],
[AS_HELP_STRING([--enable-fftw],
[use FFTW package])],
[fftw=$enableval])
if test x$fftw = xyes; then
AC_CHECK_LIB(fftw, fftw_one, [LIBS="$LIBS -lfftw"],
[AC_MSG_NOTICE([fftw package not found - using built-in FFT]); fftw=no])
fi
AM_CONDITIONAL(FFTW, test x$fftw = xyes)
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/soundcard.h sys/time.h sys/timeb.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([dup2 floor getcwd gethostbyname gettimeofday memmove memset pow regcomp select socket sqrt strchr strerror strrchr strstr strtol])
# check for programs
AC_CHECK_PROG(HAVE_MSGFMT, [msgfmt], yes, no)
test x$HAVE_MSGFMT = xyes || AC_MSG_WARN([Install GNU gettext with msgfmt if you want localizations to be compiled!])
AM_CONDITIONAL(MSGFMT, test x$HAVE_MSGFMT = xyes)
# Specify what files are to be created.
AC_CONFIG_FILES([Makefile
asio/Makefile
man/Makefile
portaudio/Makefile
portmidi/Makefile
tcl/Makefile
po/Makefile
src/Makefile
extra/Makefile
extra/bonk~/GNUmakefile
extra/choice/GNUmakefile
extra/expr~/GNUmakefile
extra/fiddle~/GNUmakefile
extra/loop~/GNUmakefile
extra/lrshift~/GNUmakefile
extra/pd~/GNUmakefile
extra/pique/GNUmakefile
extra/sigmund~/GNUmakefile
extra/stdout/GNUmakefile
pd.pc
])
AC_OUTPUT
dnl output some messages at the end
AS_IF([test x$windows = xyes], [
AS_IF([test x$asio = xno], [
AC_MSG_RESULT(
ASIO SDK not found! You need to download asiosdk2.2.zip from:
http://www.steinberg.net/en/company/3rd_party_developer.html)])])