1#											   -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4#AC_PREREQ(2.60)
5AC_INIT(brighton/brightonhelp.h)
6
7BRISTOL_MAJOR_VERSION=0
8BRISTOL_MINOR_VERSION=60
9BRISTOL_MICRO_VERSION=10
10
11BRISTOL_API_CURRENT=0
12BRISTOL_API_REVISION=610
13BRISTOL_API_AGE=0
14
15AC_SUBST(BRISTOL_MAJOR_VERSION)
16AC_SUBST(BRISTOL_MINOR_VERSION)
17AC_SUBST(BRISTOL_MICRO_VERSION)
18
19BRISTOL_VERSION=${BRISTOL_MAJOR_VERSION}.${BRISTOL_MINOR_VERSION}.${BRISTOL_MICRO_VERSION}
20AC_SUBST(BRISTOL_VERSION)
21
22BRISTOL_SO_VERSION=${BRISTOL_API_CURRENT}:${BRISTOL_API_REVISION}:${BRISTOL_API_AGE}
23AC_SUBST(BRISTOL_SO_VERSION)
24
25#AM_INIT_AUTOMAKE([-Wall -Werror foreign])
26AM_INIT_AUTOMAKE(bristol,${BRISTOL_VERSION})
27
28AM_CONFIG_HEADER([config.h])
29AC_CONFIG_MACRO_DIR([m4])
30# Checks for libraries.
31AC_PROG_LIBTOOL
32
33# Checks for programs.
34AC_PROG_CC
35AC_PROG_INSTALL
36AC_PROG_MAKE_SET
37
38# if we have a previous version pan the build
39showErrMsg1()
40{
41	echo
42	echo "*************************************************************"
43	echo "*                                                           *"
44	echo "*  A previous bristol installation exists on this system.   *"
45	echo "*                                                           *"
46	echo "*  If you have bristol installed from your package manager  *"
47	echo "*  you really need to remove it first. If you have it from  *"
48	echo "*  a previous bristol build then you can remove it with a   *"
49	echo "*  'make uninstall' from the previous build dir.            *"
50	echo "*                                                           *"
51	echo "*  If you understand the risks or just want to be lazy then *"
52	echo "*  you can override this test with --disable-version-check  *"
53	echo "*  however the author advises against such a workaround.    *"
54	echo "*                                                           *"
55	echo "*************************************************************"
56	echo
57	exit 1
58}
59
60TRY_VC=yes
61AC_ARG_ENABLE(version_check, [  --disable-version-check	ignore preinstalled versions], TRY_VC=no , TRY_VC=yes )
62if test "x$TRY_VC" = 'xyes'
63then
64	which startBristol > /dev/null 2>&1
65	if test $? == 0; then showErrMsg1; fi
66	which bristol > /dev/null 2>&1
67	if test $? == 0; then showErrMsg1; fi
68	if test -f ${prefix}/bin/bristol; then showErrMsg1; fi
69fi
70
71# Checks for header files.
72
73AC_ARG_ENABLE(oss, [  --disable-oss			ignore OSS driver ],
74			TRY_OSS=$enableval , TRY_OSS=yes )
75
76if test "x$TRY_OSS" = "xyes"
77then
78HAVE_OSS=true
79BRISTOL_HAS_OSS=1
80AC_CHECK_HEADER(sys/soundcard.h, [], [HAVE_OSS=false])
81
82if test $HAVE_OSS = "false"; then
83	BRISTOL_HAS_OSS=0
84fi
85else
86HAVE_OSS=false
87BRISTOL_HAS_OSS=0
88fi
89AC_SUBST(BRISTOL_HAS_OSS)
90
91# The brighton library requires 4 X11 header files and cannot proceed without
92# them. We should check here for their availability.
93CFLAGS="$CFLAGS -I/usr/X11R6/include"
94CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
95HAVE_XHEADERS=true
96AC_CHECK_HEADER(X11/X.h, [], [HAVE_XHEADERS=false])
97AC_CHECK_HEADER(X11/Xlib.h, [], [HAVE_XHEADERS=false])
98AC_CHECK_HEADER(X11/Xutil.h, [], [HAVE_XHEADERS=false])
99AC_CHECK_HEADER(X11/Xos.h, [], [HAVE_XHEADERS=false])
100AC_CHECK_HEADER(X11/Xatom.h, [], [HAVE_XHEADERS=false])
101
102# Checks for typedefs, structures, and compiler characteristics.
103
104# Checks for X11 library functions.
105BRIGHTON_HAS_X11=
106BRIGHTON_X11_DIR=
107BRIGHTON_LIBX11=
108BRIGHTON_LIBB11=-lC11
109BRIGHTON_LIBXLIBS=-L../libbrightonC11/.libs
110AC_ARG_ENABLE(x11, [  --disable-x11			disable X11 interface ],
111	TRY_X11=$enableval , TRY_X11=yes )
112
113if test $HAVE_XHEADERS = "false"
114then
115	TRY_X11=no
116fi
117
118AC_CHECK_HEADERS([X11/extensions/XShm.h], [x11_shm_found="true"], [x11_shm_found="false"],
119[
120#include <X11/Xlib.h>
121#include <sys/ipc.h>
122#include <sys/shm.h>
123])
124# Force this for now - pure build time options, no header dependency
125
126if test "x$TRY_X11" = "xyes"
127then
128	BRIGHTON_HAS_X11=-DBRIGHTON_HAS_X11
129	BRIGHTON_X11_DIR=libbrightonX11
130	BRIGHTON_LIBB11=-lB11
131	BRIGHTON_LIBX11=-lX11
132	BRIGHTON_LIBXEXT=
133	BRIGHTON_LIBXLIBS=-L../libbrightonX11/.libs
134
135	AC_ARG_ENABLE(ximage, [  --disable-ximage		ignore XImage interface ],
136			TRY_XIMAGE=$enableval , TRY_XIMAGE=yes )
137	if test "x$TRY_XIMAGE" = "xyes"
138	then
139		BRIGHTON_HAS_XIMAGE=-DBRIGHTON_XIMAGE
140		AC_SUBST(BRIGHTON_HAS_XIMAGE)
141		if test "x$x11_shm_found" = "xtrue"
142		then
143		AC_ARG_ENABLE(shmimage, [  --disable-shmimage		ignore XShmImage interface ],
144			TRY_SHMIMAGE=$enableval , TRY_SHMIMAGE=no )
145			if test "x$TRY_SHMIMAGE" = "xyes"
146			then
147				BRIGHTON_HAS_SHMIMAGE=-DBRIGHTON_SHMIMAGE
148				BRIGHTON_LIBXEXT=-lXext
149				AC_SUBST(BRIGHTON_HAS_SHMIMAGE)
150			fi
151		fi
152	fi
153fi
154AC_SUBST(BRIGHTON_X11_DIR)
155AC_SUBST(BRIGHTON_HAS_X11)
156AC_SUBST(BRIGHTON_LIBX11)
157AC_SUBST(BRIGHTON_LIBB11)
158AC_SUBST(BRIGHTON_LIBXEXT)
159AC_SUBST(BRIGHTON_LIBXLIBS)
160
161BRR=${BRISTOL_RAMP_RATE:-10}
162AC_SUBST(BRR)
163
164_BRISTOL_VOICES=${BRISTOL_VOICECOUNT:-32}
165AC_SUBST(_BRISTOL_VOICES)
166
167BRISTOL_LIN_ATTACK=-DBRISTOL_LIN_ATTACK
168AC_ARG_ENABLE(exp-attack, [  --enable-exp-attack		enable exponential attack], USE_EXP_ATTACK=yes , USE_EXP_ATTACK=no )
169if test "x$USE_EXP_ATTACK" == "xyes"
170then
171	BRISTOL_LIN_ATTACK=
172fi
173AC_SUBST(BRISTOL_LIN_ATTACK)
174
175BRISTOL_SEM_OPEN=
176BRISTOL_SEMAPHORE=
177AC_ARG_ENABLE(semaphore, [  --enable-semaphore		enable engine semaphores ],
178			USE_SEMAPHORE=yes , USE_SEMAPHORE=no )
179if test "x$USE_SEMAPHORE" == "xyes"
180then
181	BRISTOL_SEMAPHORE=-DBRISTOL_SEMAPHORE
182
183	# Checks for sem_open use.
184	AC_ARG_ENABLE(sem-open, [  --enable-sem-open		use sem_open interface ],
185			   USE_SEM_OPEN=yes , USE_SEM_OPEN=no )
186	if test "x$USE_SEM_OPEN" = "xyes"
187	then
188		BRISTOL_SEM_OPEN=-DBRISTOL_SEM_OPEN
189	fi
190fi
191AC_SUBST(BRISTOL_SEM_OPEN)
192AC_SUBST(BRISTOL_SEMAPHORE)
193
194BRISTOL_BARRIER=
195AC_ARG_ENABLE(memory-barrier, [  --enable-memory-barrier	enable ringbuffer barrier],
196			USE_BARRIER=yes , USE_BARRIER=no )
197if test "x$USE_BARRIER" == "xyes"
198then
199	BRISTOL_BARRIER=-DUSE_MLOCK
200fi
201AC_SUBST(BRISTOL_BARRIER)
202
203# Checks for autozoom feature requested
204BRIGHTON_HAS_AUTOZOOM=-DBRIGHTON_HAS_ZOOM=1
205AC_ARG_ENABLE(autozoom, [  --disable-autozoom		disable window autozoom on Enter],
206			TRY_AZ=no , TRY_AZ=yes )
207if test "x$TRY_AZ" = "xno"
208then
209	BRIGHTON_HAS_AUTOZOOM=-DBRIGHTON_HAS_ZOOM=0
210fi
211AC_SUBST(BRIGHTON_HAS_AUTOZOOM)
212
213
214# Checks for old audio device close/open on error.
215AC_ARG_ENABLE(drain, [  --disable-drain		no reopen of audio dev on error ],
216			TRY_DRAIN=$enableval , TRY_DRAIN=yes )
217if test "x$TRY_DRAIN" = "xyes"
218then
219	BRISTOL_HAS_DRAIN=-D_BRISTOL_DRAIN
220	AC_SUBST(BRISTOL_HAS_DRAIN)
221fi
222
223PKG_PROG_PKG_CONFIG
224
225# Checks for library functions.
226AC_ARG_ENABLE(alsa, [  --disable-alsa		ignore ALSA driver ],
227	TRY_ALSA=$enableval , TRY_ALSA=yes )
228AC_CHECK_HEADER(alsa/asoundlib.h, alsa_found="true", alsa_found="false")
229
230HAVE_ALSA=false
231BRISTOL_HAS_ALSA=0
232if test "x$TRY_ALSA" = "xyes" -a "x$alsa_found" = "xtrue";
233then
234	# check for ALSA >= 1.0.0
235	PKG_CHECK_MODULES(ALSA, alsa >= 1.0.0,
236		 [HAVE_ALSA=true
237			  BRISTOL_HAS_ALSA=1
238			 ], [true]
239	)
240else
241	ALSA_CFLAGS=
242	ALSA_LIBS=
243	AC_SUBST(ALSA_CFLAGS)
244	AC_SUBST(ALSA_LIBS)
245fi
246AC_SUBST(BRISTOL_HAS_ALSA)
247
248AC_ARG_ENABLE(liblo, [  --disable-liblo		ignore LIBLO driver ],
249			TRY_LIBLO=$enableval , TRY_LIBLO=yes )
250
251# needs liblo and liblo-dev to work - have to see the header files anyway.
252HAVE_LIBLO=false
253BRISTOL_HAS_LIBLO=0
254if test "x$TRY_LIBLO" = "xyes" ;
255then
256	# check for LIBLO >= 1.0.0
257	PKG_CHECK_MODULES(LIBLO, liblo >= 0.22.0,
258		 [HAVE_LIBLO=true
259			  BRISTOL_HAS_LIBLO=1
260			 ], [true]
261	)
262else
263	LIBLO_CFLAGS=
264	LIBLO_LIBS=
265	AC_SUBST(LIBLO_CFLAGS)
266	AC_SUBST(LIBLO_LIBS)
267fi
268AC_SUBST(BRISTOL_HAS_LIBLO)
269
270jack_session_found="false"
271HAVE_JACK_MIDI="false"
272
273AC_ARG_ENABLE(jack, [  --disable-jack		ignore JACK driver ],
274	TRY_JACK=$enableval , TRY_JACK=yes )
275AC_CHECK_HEADER(jack/jack.h, jack_found="true", jack_found="false")
276
277DEFAULT_AUDIO_FLAG=-alsa
278DEFAULT_JACK=no
279DEFAULT_JACK_MIDI=no
280BRISTOL_JACK_DEFAULT=
281BRISTOL_JACK_DEFAULT_MIDI=
282BRISTOL_JACK_MULTI_CLOSE=-DBRISTOL_JACK_MULTI_CLOSE
283HAVE_JACK="false"
284JACK_SC=yes
285if test "x$TRY_JACK" = "xyes" -a "x$jack_found" = "xtrue";
286then
287	# check for JACK >= 0.99.0
288	PKG_CHECK_MODULES(JACK, jack >= 0.99.0,
289		 [HAVE_JACK="true"
290			  JACK_DEFAULT_DRIVER="jack"
291			  BRISTOL_HAS_JACK=-D_BRISTOL_JACK
292			 ], [true]
293	)
294	AC_SUBST(JACK_LIBS)
295	AC_SUBST(BRISTOL_HAS_JACK)
296
297	AC_CHECK_HEADER(jack/session.h, jack_session_found="true", jack_session_found="false")
298 	if test "$jack_session_found" = "true"; then
299		AC_DEFINE(JACK_SESSION, 1, [Define to enable jack session support])
300		BRISTOL_HAS_JACK_SESSION=-D_BRISTOL_JACK_SESSION
301		AC_SUBST(BRISTOL_HAS_JACK_SESSION)
302	fi
303
304	AC_ARG_ENABLE(jack-midi, [  --disable-jack-midi		ignore JACK MIDI driver ],
305			TRY_JACK_MIDI=$enableval , TRY_JACK_MIDI=yes )
306	if test "x$TRY_JACK_MIDI" = "xyes" ;
307	then
308		# check for JACK >= 0.99.0
309		PKG_CHECK_MODULES(JACK, jack >= 0.109.0,
310			 [HAVE_JACK_MIDI="true"
311				  BRISTOL_HAS_JACK_MIDI=-D_BRISTOL_JACK_MIDI
312				 ], [true]
313		)
314		AC_SUBST(BRISTOL_HAS_JACK_MIDI)
315	else
316		HAVE_JACK_MIDI="false"
317	fi
318	AM_CONDITIONAL(HAVE_JACK_MIDI, $HAVE_JACK_MIDI)
319
320	AC_ARG_ENABLE(jack-single-close, [  --disable-jack-single-close	disable Jack selective closedown],
321		JACK_SC=$enableval , JACK_SC=yes )
322	if test "x$JACK_SC" = "xyes"
323	then
324		BRISTOL_JACK_MULTI_CLOSE=
325	fi
326
327	AC_ARG_ENABLE(jack-default-audio, [  --enable-jack-default-audio	enable Jack as default Audio driver],
328		DEFAULT_JACK=$enableval , DEFAULT_JACK=no )
329	if test "x$DEFAULT_JACK" = "xyes"
330	then
331		DEFAULT_AUDIO_FLAG=-jack
332		BRISTOL_JACK_DEFAULT=-DBRISTOL_JACK_DEFAULT
333		AC_SUBST(BRISTOL_JACK_DEFAULT)
334	fi
335
336	AC_ARG_ENABLE(jack-default-midi, [  --enable-jack-default-midi	enable Jack as default Midi driver],
337		DEFAULT_JACK_MIDI=$enableval , DEFAULT_JACK_MIDI=no )
338	if test "x$DEFAULT_JACK_MIDI" = "xyes"
339	then
340		BRISTOL_JACK_DEFAULT_MIDI=-DBRISTOL_JACK_DEFAULT_MIDI
341		AC_SUBST(BRISTOL_JACK_DEFAULT_MIDI)
342	fi
343
344else
345	JACK_CFLAGS=
346	JACK_LIBS=
347	AC_SUBST(JACK_CFLAGS)
348	AC_SUBST(JACK_LIBS)
349fi
350AM_CONDITIONAL(HAVE_JACK, $HAVE_JACK)
351AM_CONDITIONAL(HAVE_JACK_MIDI, $HAVE_JACK_MIDI)
352AC_SUBST(DEFAULT_AUDIO_FLAG)
353AC_SUBST(BRISTOL_JACK_MULTI_CLOSE)
354
355## See about pulse audio
356TRY_PA=no
357BRISTOL_HAS_PA=
358BRISTOL_PA_DIR=
359BRISTOL_LIB_PA=
360BRISTOL_LIBPALIBS=
361AC_ARG_ENABLE(pulseaudio, [  --enable-pulseaudio		enable pulse audio drivers], TRY_PA=yes , TRY_PA=no )
362AC_CHECK_HEADER(pulse/pulseaudio.h, [HAVE_PA_HEADERS=true], [HAVE_PA_HEADERS=false])
363if test x$TRY_PA = 'xyes'
364then
365	if test $HAVE_PA_HEADERS = 'true'
366	then
367		BRISTOL_HAS_PA=-DBRISTOL_PA
368		BRISTOL_PA_DIR=libbristolpulse
369		BRISTOL_LIB_PA='-lbristolpulse -lpulse -lpulse-simple'
370		BRISTOL_LIBPALIBS=-L$BPALIBS
371	else
372		$TRY_PA=no
373	fi
374fi
375AC_SUBST(BRISTOL_HAS_PA)
376AC_SUBST(BRISTOL_PA_DIR)
377AC_SUBST(BRISTOL_LIB_PA)
378AC_SUBST(BRISTOL_LIBPALIBS)
379
380if test $prefix = "NONE"; then
381	prefix=$ac_default_prefix
382fi
383
384BRISTOL_DIR=$prefix/share/bristol
385AC_SUBST(BRISTOL_DIR)
386
387AC_CONFIG_FILES([Makefile libbrightonC11/Makefile libbrightonX11/Makefile libbrighton/Makefile libbvg/Makefile libbristolaudio/Makefile libbristolmidi/Makefile libbristolic/Makefile libbristol/Makefile brighton/Makefile bristol/Makefile bin/startBristol bin/Makefile])
388AC_OUTPUT
389
390echo
391echo $PACKAGE $VERSION :
392echo
393echo \| Build with OSS support ......................... : $HAVE_OSS
394echo \| Build with ALSA support ........................ : $HAVE_ALSA
395if test $HAVE_ALSA = "false" && test $TRY_ALSA = "yes" ; then
396	echo \| Bristol needs libasound2-dev to be installed for ALSA support.
397fi
398echo \| Build with JACK support ........................ : $HAVE_JACK
399if test $HAVE_JACK = "false" && test $TRY_JACK = "yes" ; then
400	echo \| Bristol needs jackd and libjack-dev to be installed for JACK support.
401fi
402echo \| Build with JACK MIDI support ................... : $HAVE_JACK_MIDI
403#
404# This will be 0.50.5
405echo \| Build with JACK Session support ................ : $jack_session_found
406
407if test x$TRY_PA = 'xyes' ; then
408echo \| Build with PA support .......................... : true
409fi
410
411if test $DEFAULT_JACK = "yes"; then
412echo \| Default audio drivers .......................... : jack
413else
414echo \| Default audio drivers .......................... : alsa
415fi
416
417if test $DEFAULT_JACK_MIDI = "yes"; then
418echo \| Default MIDI drivers ........................... : jack
419else
420echo \| Default MIDI drivers ........................... : alsa
421fi
422
423if test $USE_SEMAPHORE = "yes"; then
424echo \| Build with semaphore support.................... : true
425if test $USE_SEM_OPEN = "yes"; then
426echo \| Build with sem_open ............................ : true
427fi
428fi
429
430if test $USE_BARRIER == "yes"; then
431echo \| Build with jrb memory barrier .................. : true
432fi
433
434echo \| Build with Graphical Interface ................. : $HAVE_XHEADERS
435if test "x$TRY_X11" = "xyes"; then
436echo \| Compile with GUI support ....................... : true
437if test "x$TRY_SHMIMAGE" = "xyes"; then
438echo \| Build with XShmImage support ................... : true
439fi
440if test $TRY_XIMAGE != "yes"; then
441echo \| Build with XImage support ...................... : false
442else
443if test $HAVE_XHEADERS = "false"; then
444	echo \| Bristol needs libX11-dev installed to support a grpahical interface
445fi
446fi
447else
448echo \| Compile with X11 support ....................... : false
449fi
450echo \| Bin directory .................................. : ${prefix}/bin
451echo \| Lib directory .................................. : ${prefix}/lib
452echo \| Data directory ................................. : $BRISTOL_DIR
453echo \| Default voicecount ............................. : BRISTOL_VOICECOUNT=$_BRISTOL_VOICES
454if test $BRR != 10; then
455echo \| Envelope max ramp time ......................... : $BRR seconds
456fi
457if test x$USE_EXP_ATTACK == "xyes"; then
458echo \| Envelope attack type ........................... : exponential
459fi
460echo \| author ......................................... : Nick Copeland
461echo \| email .......................................... : nickycopeland@hotmail.com
462echo \| web ............................................ : http://bristol.sf.net
463echo
464echo execute \'make install\' then \'startBristol\'
465echo
466if test -f ${BRISTOL_DIR}/bitmaps/blueprints/mini.xpm ; then
467echo To get the benefits of the compressed bitmaps you are advised to run a
468echo \'make uninstall\' before building this release.
469echo
470fi
471