aboutsummaryrefslogtreecommitdiff
path: root/pd/src/configure.in
blob: 6ea60a50eacb3b30fe1911f29900134fb3bf4835 (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
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
dnl Process this file with autoconf to produce a configure script.
AC_INIT(d_arithmetic.c)

AC_SUBST(alsa, yes)
AC_SUBST(jack, no)
AC_SUBST(portaudio, no)
AC_SUBST(portmidi, no)
AC_SUBST(binarymode, -m755)
AC_SUBST(fftw, no)
AC_SUBST(PDLIB)
AC_SUBST(CPPFLAGS)
AC_SUBST(MORECFLAGS)
AC_SUBST(EXT)
AC_SUBST(USE_DEBUG_CFLAGS, no)
AC_SUBST(SYSSRC)
AC_SUBST(TCLTK_FRAMEWORKS_PATH)
AC_SUBST(TCLTK_FRAMEWORKS_PATH)
AC_SUBST(STRIPFLAG)
AC_SUBST(GUINAME)
AC_SUBST(GUIFLAGS)
AC_SUBST(OSNUMBER)
AC_SUBST(EXTERNTARGET)
AC_SUBST(ASIOSRC)

dnl other defaults

dnl check for features

AC_ARG_ENABLE(alsa,     [  --enable-alsa           alsa audio driver], 
    alsa=$enableval)
AC_ARG_ENABLE(jack,     [  --enable-jack           jack audio server],
    jack=$enableval)
AC_ARG_ENABLE(portaudio,[  --enable-portaudio      portaudio],
    portaudio=$enableval)
AC_ARG_ENABLE(portmidi, [  --enable-portmidi       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(setuid,   [  --enable-setuid         install as setuid (linux)],
    setuid=$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 Checks for libraries.
dnl Checking for `dlopen' function in -ldl:
AC_CHECK_LIB(dl, dlopen,PDLIB="$PDLIB -ldl",
                 echo "dynamic link support required" || exit 1)

dnl Checking for `sin' function in -lffm:
dnl ffm is the fast math library on the alpha
AC_CHECK_LIB(ffm, sin,PDLIB="$PDLIB -lffm")

dnl Checking for `sin' function in -lm:
AC_CHECK_LIB(m, sin,PDLIB="$PDLIB -lm",
	         echo "math library required" || exit 1)

dnl Checking for `pthread_create' function in -pthread
AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread",
    AC_CHECK_LIB(pthreadGC2, pthread_create, PDLIB="$PDLIB -lpthreadGC2",
        AC_CHECK_LIB(pthreadGC1, pthread_create, PDLIB="$PDLIB -lpthreadGC1",
            AC_CHECK_LIB(pthreadGC, pthread_create, PDLIB="$PDLIB -lpthreadGC",
         echo "pthreads required"; exit 1))))

dnl Check for fftw package
if test x$fftw == "xyes";
then
AC_CHECK_LIB(fftw, fftw_one,PDLIB="$PDLIB -lfftw",
    echo "fftw package not found - using built-in FFT"; fftw=no)
fi

dnl look for tcl 8.x... do I really have to go through all this!?

foundit=no
if test $foundit == "no";
then
    AC_CHECK_HEADER(tcl.h,foundit=yes,)
fi
if test $foundit == "no";
then
    AC_CHECK_HEADER(tcl8.7/tcl.h,
    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.7";foundit=yes,)
fi
if test $foundit == "no";
then
    AC_CHECK_HEADER(tcl8.6/tcl.h,
    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.6";foundit=yes,)
fi
if test $foundit == "no";
then
    AC_CHECK_HEADER(tcl8.5/tcl.h,
    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.5";foundit=yes,)
fi
if test $foundit == "no";
then
    AC_CHECK_HEADER(tcl8.4/tcl.h,
    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.4";foundit=yes,)
fi
if test $foundit == "no";
then
    AC_CHECK_HEADER(tcl8.4/tcl.h,
    	GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.4";foundit=yes,)
fi
if test $foundit == "no";
then
    AC_CHECK_HEADER(tcl8.3/tcl.h,
    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.3";foundit=yes,)
fi
if test $foundit == "no";
then
    AC_CHECK_HEADER(tcl8.2/tcl.h,
    	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.2";foundit=yes,)
fi
if test $foundit == "no";
then
    echo no tcl header found
	 echo bolding trying without...
#    exit -1
fi

AC_CHECK_LIB(tcl85, main,,
	AC_CHECK_LIB(tcl8.5, main,,
        AC_CHECK_LIB(tcl84, main,,
	    AC_CHECK_LIB(tcl8.4, main,,
		AC_CHECK_LIB(tcl8.3, main,,
		    AC_CHECK_LIB(tcl8.2, main,,
        		            AC_CHECK_LIB(tcl8.0, main,,
                            echo no tcl library found; exit 1)))))))

AC_CHECK_LIB(tk85, main,,
	AC_CHECK_LIB(tk8.5, main,,
       AC_CHECK_LIB(tk84, main,,
	    AC_CHECK_LIB(tk8.4, main,,
		AC_CHECK_LIB(tk8.3, main,,
		    AC_CHECK_LIB(tk8.2, main,,
        		            AC_CHECK_LIB(tk8.0, main,,
                            echo no tk library found; exit 1)))))))


if test `uname -s` == Linux;
then
    dnl Ckecking for ALSA
    echo .................... alsa= $alsa
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,PDLIB="$PDLIB -lasound" ; alsa="yes",alsa="no")
    fi

    dnl Checking for JACK

    if test x$jack == xyes; then
        AC_CHECK_LIB(rt,shm_open,LIBS="$LIBS -lrt")
        AC_CHECK_LIB(jack,jack_set_xrun_callback,LIBS="$LIBS -ljack";jack=xrun,jack=no)
        AC_CHECK_LIB(jack,jack_set_error_function,LIBS="$LIBS -ljack";jack=yes,jack=no)
    fi

    LDFLAGS="-Wl,-export-dynamic"
    if test "$static" = "yes"; then 
      LDFLAGS="$LDFLAGS -static"
    fi 
    EXT=pd_linux
    CPPFLAGS="-DDL_OPEN -DPA_USE_OSS -DUNIX -DUNISTD\
    	-DUSEAPI_OSS \
        -I../portaudio/pa_common -I../portaudio/pablio \
        -I../portmidi/pm_common \
        -I../portmidi/pm_linux \
	-fno-strict-aliasing"
    SYSSRC="s_midi_oss.c s_audio_oss.c"
    if test x$alsa == "xyes";
    then
    	SYSSRC=$SYSSRC" 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$portaudio == "xyes";


    then
    	CPPFLAGS=$CPPFLAGS" -DUSEAPI_PORTAUDIO -DPA19"
	SYSSRC="s_audio_pa.c \
    	s_audio_pablio.c     \
	s_audio_paring.c     \
	../portaudio/pa_common/pa_allocation.c  \
	../portaudio/pa_common/pa_converters.c  \
	../portaudio/pa_common/pa_cpuload.c     \
	../portaudio/pa_common/pa_dither.c      \
	../portaudio/pa_common/pa_front.c       \
	../portaudio/pa_common/pa_process.c     \
	../portaudio/pa_common/pa_skeleton.c    \
	../portaudio/pa_common/pa_stream.c      \
	../portaudio/pa_common/pa_trace.c       \
	../portaudio/pa_unix/pa_unix_hostapis.c \
	../portaudio/pa_unix/pa_unix_util.c     \
	../portaudio/pa_unix_oss/pa_unix_oss.c "$SYSSRC
	if test x$alsa == "xyes";
	then
	    SYSSRC=$SYSSRC" ../portaudio/pa_linux_alsa/pa_linux_alsa.c"
	    CPPFLAGS=$CPPFLAGS" -Wno-error"
    	fi
    fi
    if test x$setuid == "xyes";
    then
    	binarymode="-m4755"
    fi
    STRIPFLAG=-s
    GUINAME="pd-gui"
    if test x$USE_DEBUG_CFLAGS == "xyes";
    then
	MORECFLAGS=$MORECFLAGS" -g"
    else
	MORECFLAGS=$MORECFLAGS" -O6 -funroll-loops -fomit-frame-pointer"
    fi
    if test x$jack == "xyes";
    then
        LDFLAGS=$LDFLAGS" -lrt -ljack"
    fi
    if test x$jack == "xrun";
    then
        LDFLAGS=$LDFLAGS" -lrt -ljack"
    fi

    echo MORECFLAGS --------------- $MORECFLAGS
    OSNUMBER=0

fi

if test `uname -s` == Darwin;
then
    LDFLAGS="-Wl -framework CoreAudio \
        -framework AudioUnit -framework AudioToolbox \
        -framework Carbon -framework CoreMIDI"
    EXT=pd_darwin
    CPPFLAGS="-DDL_OPEN -DMACOSX -DUNISTD -I/usr/X11R6/include \
	-I../portaudio/pa_common -I../portaudio/pablio \
	-I../portmidi/pm_common -I../portmidi/pm_mac \
	-I../portmidi/porttime \
	-DUSEAPI_PORTAUDIO -DPA19 -DPA_USE_COREAUDIO"
    if test `uname -r` = 7.9.0;
    then
        MORECFLAGS="-DMACOSX3 -DPA_BIG_ENDIAN -Wno-error"
    	EXTERNTARGET=d_ppc
    else
        MORECFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk \
            -arch i386 -arch ppc -Wno-error"
    	EXTERNTARGET=d_fat
        LDFLAGS=$LDFLAGS" -arch i386 -arch ppc"
    fi
    SYSSRC="s_midi_pm.c s_audio_pa.c \
    	s_audio_pablio.c     \
	s_audio_paring.c     \
	../portaudio/pa_common/pa_allocation.c  \
	../portaudio/pa_common/pa_converters.c  \
	../portaudio/pa_common/pa_cpuload.c     \
	../portaudio/pa_common/pa_dither.c      \
	../portaudio/pa_common/pa_front.c       \
	../portaudio/pa_common/pa_process.c     \
	../portaudio/pa_common/pa_skeleton.c    \
	../portaudio/pa_common/pa_stream.c      \
	../portaudio/pa_common/pa_trace.c       \
	../portaudio/pa_unix/pa_unix_util.c     \
	../portaudio/pa_mac_core/pa_mac_core.c  \
	../portaudio/pa_mac/pa_mac_hostapis.c   \
        ../portmidi/pm_mac/pmmac.c \
        ../portmidi/pm_mac/pmmacosxcm.c \
        ../portmidi/pm_common/pmutil.c \
        ../portmidi/pm_common/portmidi.c \
        ../portmidi/porttime/ptmacosx_cf.c "
    STRIPFLAG=""
    GUINAME="libPdTcl.dylib"

# find the Tcl/Tk Frameworks
 	 if test -d "../../Frameworks";
    then
        # Miller's location
        TCLTK_FRAMEWORKS_PATH="../../Frameworks"
 	 elif test -d "/Library/Frameworks";
	 then
        # get it from the default install location
        TCLTK_FRAMEWORKS_PATH="/Library/Frameworks"
    else
        # Panther has Tcl here; Tiger has Tcl and Tk here
        TCLTK_FRAMEWORKS_PATH="/System/Library/Frameworks"
    fi		 
    GUIFLAGS="-F$TCLTK_FRAMEWORKS_PATH -framework Tcl -framework Tk \
        -I$TCLTK_FRAMEWORKS_PATH/Tk.framework/Versions/Current/Headers \
        -I$TCLTK_FRAMEWORKS_PATH/Tcl.framework/Versions/Current/Headers \
        -I$TCLTK_FRAMEWORKS_PATH/Tcl.framework/Versions/8.4/PrivateHeaders"
    if test x$USE_DEBUG_CFLAGS == "xyes";
    then
	MORECFLAGS=$MORECFLAGS" -g"
    else
	MORECFLAGS=$MORECFLAGS" -O2"
    fi
    OSNUMBER=2
    if test x$jack == "xyes";
    then
    	LDFLAGS=$LDFLAGS" -weak_framework Jack"
    fi
    if test x$jack == "xrun";
    then
        LDFLAGS=$LDFLAGS" -weak_framework Jack"
    fi
fi

# only Windows uses ASIO, for the rest, set to blank
ASIOSRC=

if test `uname -s` == MINGW32_NT-5.0;
then
    EXT=dll
    MORECFLAGS="-DUSEAPI_PORTAUDIO -DPA19 -DMSW -DPA_NO_DS -DPD_INTERNAL \
        -I../portaudio/pa_common -I../portaudio/pablio \
        -mwindows -mms-bitfields "$MORECFLAGS
    PDLIB=$PDLIB" -lwsock32 -lwinmm -lole32 -lstdc++"

    SYSSRC="s_audio_pa.c s_audio_pablio.c s_audio_paring.c \
        s_audio_mmio.c s_midi_mmio.c \
        ../portaudio/pa_common/pa_allocation.c  \
        ../portaudio/pa_common/pa_converters.c  \
        ../portaudio/pa_common/pa_cpuload.c     \
        ../portaudio/pa_common/pa_dither.c      \
        ../portaudio/pa_common/pa_front.c       \
        ../portaudio/pa_common/pa_process.c     \
        ../portaudio/pa_common/pa_skeleton.c    \
        ../portaudio/pa_common/pa_stream.c      \
        ../portaudio/pa_common/pa_trace.c       \
        ../portaudio/pa_win/pa_win_util.c       \
        ../portaudio/pa_win/pa_win_hostapis.c   \
        ../portaudio/pa_win_wmme/pa_win_wmme.c"
	 ASIOSRC="../portaudio/pa_asio/iasiothiscallresolver.cpp \
	 ../portaudio/pa_asio/pa_asio.cpp ../asio/asio.cpp \
	 ../asio/asiodrivers.cpp ../asio/asiolist.cpp"
    STRIPFLAG="--strip-unneeded"
    GUINAME="pdtcl.dll"
    GUIFLAGS=
fi

# support for jack, on either linux or darwin:

if test x$jack == "xyes";
then
    MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK"
    SYSSRC=$SYSSRC" s_audio_jack.c"
fi
if test x$jack == "xrun";
then
    MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK -DJACK_XRUN"
    SYSSRC=$SYSSRC" s_audio_jack.c"
fi

if test x$fftw == "xyes";
then
    SYSSRC=$SYSSRC" d_fft_fftw.c d_fftroutine.c"
    LDFLAGS=$LDFLAGS" -lfftw"
else
    SYSSRC=$SYSSRC" d_fft_mayer.c d_fftroutine.c"
fi

# extra flags for alpha machines
if test `uname -m | awk '{print $1}'` = alpha;
then
    MORECFLAGS=$MORECFLAGS" -mieee -mcpu=ev56"
fi

# test for compaq compiler---not sure what this does or how to test it.
if test x$CC == xccc;
then
    MORECFLAGS=$MORECFLAGS"  -g3 -D__COMPAQC__ -arch host"
fi

## JMZ{
##  this does not do very much, but i guess it is a good idea to use it...
AC_SYS_LARGEFILE
## test, whether we can use _LARGEFILE64_SOURCE to 
## enable large-file reading via "open64" (and lseek64");
if test "x$enable_largefile" != "xno"; then
## the following should run on autoconf>2.54 (which pd is not using)
dnl  AC_LINK_IFELSE ( [AC_LANG_PROGRAM([[
dnl                          #define _LARGEFILE64_SOURCE
dnl                          #include <sys/types.h>
dnl                          #include <sys/stat.h>
dnl                          #include <fcntl.h>
dnl                      ]],[[ open64(0,0); ]])], 
dnl                   [ MORECFLAGS=$MORECFLAGS" -D_LARGEFILE64_SOURCE" ], )
## and this is for autoconf<2.50
AC_TRY_LINK( [
                                        #define _LARGEFILE64_SOURCE
                                        #include <sys/types.h>
                                        #include <sys/stat.h>
                                        #include <fcntl.h>
                                       ],[ open64(0,0); ],
                [ MORECFLAGS=$MORECFLAGS" -D_LARGEFILE64_SOURCE" ], )
fi
## }JMZ: end of large-file support section

if test -d ../obj
then echo -n
else mkdir ../obj
fi

if test -d ../bin
then echo -n
else mkdir ../bin
fi

AC_OUTPUT(makefile)