summaryrefslogtreecommitdiff
path: root/configure.ac
blob: fdabdbf9c84ffcc98fb1196bd5c929196e399a0f (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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# Filename: configure.in

AC_INIT([drumgizmo], m4_esyscmd([cat version.h | cut -d'"' -f2 | xargs echo -n]))dnl"

AC_CONFIG_SRCDIR([src/drumgizmo.cc])
AM_INIT_AUTOMAKE

AC_PROG_CXX
#AM_PROG_CC_C_O

AC_PROG_LIBTOOL
AM_PROG_LIBTOOL

AM_CONFIG_HEADER(config.h)
AC_STDC_HEADERS

need_jack=no

dnl ======================
dnl Init pkg-config
dnl ======================
PKG_PROG_PKG_CONFIG(0.23)

HUGIN_PARM="-DDISABLE_HUGIN"
AC_ARG_WITH(debug,  [  --with-debug            Build with debug support])
if test x$with_debug == xyes; then
    AC_MSG_WARN([*** Building with debug support!])
    CXXFLAGS="$CXXFLAGS -Wall -Werror -g"
    HUGIN_PARM=""
fi 
CXXFLAGS="$CXXFLAGS $HUGIN_PARM"

AC_ARG_WITH(experimental,  [  --with-experimental     Build with experimental features])
if test x$with_experimental == xyes; then
    AC_MSG_WARN([*** Building with experimental support!])
    CXXFLAGS="$CXXFLAGS -DEXPERIMENTAL"
fi 

AC_ARG_ENABLE(pugl,  [  --enable-pugl             Build with Pugl support])
if test x$enable_pugl == xyes; then
    AC_MSG_WARN([*** Building with pugl support!])
    CXXFLAGS="$CXXFLAGS -DPUGL -lGL -lGLU -lglut"
fi 
AM_CONDITIONAL([ENABLE_PUGL], [test "x$enable_pugl" = "xyes"])

AC_ARG_WITH(test,  [  --with-test             Build unit tests])
if test x$with_test == xyes; then
    AC_MSG_WARN([*** Building unittests!])
		AM_PATH_CPPUNIT(1.9.6)
		AC_OUTPUT(test/Makefile)
fi 

dnl ======================
dnl Compile LV2 plugin
dnl ======================
AC_ARG_ENABLE([lv2],
[  --enable-lv2   Compile the LV2 plugin [default=yes]],,
        [enable_lv2="yes"])
if test "x$enable_lv2" = "xyes"; then
	 enable_lv2=yes 
   dnl ======================
   dnl Check for lv2core
   dnl ======================
   PKG_CHECK_MODULES(LV2, lv2 >= 1.0)

   dnl ======================
   dnl Check for Xlib
   dnl ======================
   PKG_CHECK_MODULES(X11, x11 >= 1.0)
else
	 AC_MSG_RESULT([*** LV2 plugin will not be compiled ***])
   enable_lv2=no
fi
AM_CONDITIONAL([ENABLE_LV2], [test "x$enable_lv2" = "xyes"])

#dnl ======================
#dnl Compile VST plugin
#dnl ======================
#AC_ARG_ENABLE([vst],
#[  --enable-vst   Compile the VST plugin [default=yes]],,
#        [enable_vst="yes"])
#if test "x$enable_vst" = "xyes"; then
#	 enable_vst=yes 
#   dnl ======================
#   dnl Check for vstcore
#   dnl ======================
#   PKG_CHECK_MODULES(VST, vstcore >= 4.1)
#else
#	 AC_MSG_RESULT([*** VST plugin will not be compiled ***])
#   enable_vst=no
#fi
#AM_CONDITIONAL([ENABLE_VST], [test "x$enable_vst" = "xyes"])

dnl ======================
dnl Compile AU plugin
dnl ======================
#AC_ARG_ENABLE([au],
#[  --enable-au   Compile the audio units plugin [default=no]],,
#        [enable_au="no"])
#if test "x$enable_au" = "xyes"; then
#	 enable_au=yes 
#else
#	 AC_MSG_RESULT([*** Audio Units plugin will not be compiled ***])
#   enable_au=no
#fi
#AM_CONDITIONAL([ENABLE_AU], [test "x$enable_au" = "xyes"])

dnl ======================
dnl Compile cli client
dnl ======================
AC_ARG_ENABLE([cli],
[  --enable-cli   Compile the command line interface [default=yes]],,
        [enable_cli="yes"])
if test "x$enable_cli" = "xyes"; then
	 enable_cli=yes 

   dnl ======================
   dnl Check for getopt
   dnl ======================
   AC_HAVE_HEADERS(getopt.h)
   
   dnl ***
   dnl *** Input plugins
   dnl ***
   
   dnl *** Dummy
   AC_ARG_ENABLE([input_dummy],
   [  --disable-input-dummy       Disable input dummy plugin [default=enabled]],,
           [enable_input_dummy="yes"])
   if test "x$enable_input_dummy" = "xyes"; then
   	 have_input_dummy=yes 
   else
   	 AC_MSG_RESULT([*** input dummy plugin disabled per user request ***])
      have_input_dummy=no
   fi
   
   dnl *** Test
   AC_ARG_ENABLE([input_test],
   [  --disable-input-test        Disable input test plugin [default=enabled]],,
           [enable_input_test="yes"])
   if test "x$enable_input_test" = "xyes"; then
   	 have_input_test=yes 
   else
   	 AC_MSG_RESULT([*** input test plugin disabled per user request ***])
      have_input_test=no
   fi
   
   dnl *** Jackmidi
   AC_ARG_ENABLE([input_jackmidi],
   [  --disable-input-jackmidi    Disable input jackmidi plugin [default=enabled]],,
           [enable_input_jackmidi="yes"])
   if test "x$enable_input_jackmidi" = "xyes"; then
   	 have_input_jackmidi=yes 
		 need_jack=yes
   else
   	 AC_MSG_RESULT([*** input jackmidi plugin disabled per user request ***])
      have_input_jackmidi=no
   fi
   
   dnl *** Midifile
   AC_ARG_ENABLE([input_midifile],
   [  --disable-input-midifile    Disable input midifile plugin [default=enabled]],,
           [enable_input_midifile="yes"])
   if test "x$enable_input_midifile" = "xyes"; then
   	 have_input_midifile=yes
   	 dnl ======================
   	 dnl Check for libsmf
   	 dnl ======================
   	 PKG_CHECK_MODULES(SMF, smf >= 1.2)
   else
   	 AC_MSG_RESULT([*** input midifile plugin disabled per user request ***])
      have_input_midifile=no
   fi   
   
   INPUT_PLUGINS="midifile jackmidi dummy test"
   AC_SUBST(INPUT_PLUGINS)
   
   
   dnl ***
   dnl *** Output plugins
   dnl ***
   
   dnl *** dummy
   AC_ARG_ENABLE([output_dummy],
   [  --disable-output-dummy      Disable output dummy plugin [default=enabled]],,
           [enable_output_dummy="yes"])
   if test "x$enable_output_dummy" = "xyes"; then
   	 have_output_dummy=yes 
   else
   	 AC_MSG_RESULT([*** output dummy plugin disabled per user request ***])
      have_output_dummy=no
   fi
   
   dnl *** Jackaudio
   AC_ARG_ENABLE([output_jackaudio],
   [  --disable-output-jackaudio  Disable output jack plugin [default=enabled]],,
           [enable_output_jackaudio="yes"])
   if test "x$enable_output_jackaudio" = "xyes"; then
   	 have_output_jackaudio=yes 
		 need_jack=yes
   else
   	 AC_MSG_RESULT([*** output jack plugin disabled per user request ***])
      have_output_jackaudio=no
   fi

   dnl *** alsa
   AC_ARG_ENABLE([output_alsa],
   [  --disable-output-alsa       Disable output alsa plugin [default=enabled]],,
           [enable_output_alsa="yes"])
   if test "x$enable_output_alsa" = "xyes"; then
   	 have_output_alsa=yes 
   	 dnl ======================
   	 dnl Check for alsa library
   	 dnl ======================
   	 PKG_CHECK_MODULES(ALSA, alsa >= 1.0.18)
   else
   	 AC_MSG_RESULT([*** output alsa plugin disabled per user request ***])
      have_output_alsa=no
   fi
   
   dnl *** wavfile
   AC_ARG_ENABLE([output_wavfile],
   [  --disable-output-wavfile    Disable output wavfile plugin [default=enabled]],,
           [enable_output_wavfile="yes"])
   if test "x$enable_output_wavfile" = "xyes"; then
   	 have_output_wavfile=yes 
   else
   	 AC_MSG_RESULT([*** output wavfile plugin disabled per user request ***])
      have_output_wavfile=no
   fi
   
   OUTPUT_PLUGINS="dummy alsa wavfile jackaudio"
   AC_SUBST(OUTPUT_PLUGINS)
   
   dnl
   dnl Setup plugin paths
   dnl
   dgplugindir=${libdir}/drumgizmo
   AC_SUBST([dgplugindir])
   
   INPUT_PLUGIN_DIR=${dgplugindir}/input
   OUTPUT_PLUGIN_DIR=${dgplugindir}/output
   AC_SUBST([INPUT_PLUGIN_DIR])
   AC_SUBST([OUTPUT_PLUGIN_DIR])
   
   AC_DEFINE_UNQUOTED(INPUT_PLUGIN_DIR, "${prefix}/lib/drumgizmo/input",
     [Input plugin dir])
   AC_DEFINE_UNQUOTED(OUTPUT_PLUGIN_DIR, "${prefix}/lib/drumgizmo/output",
     [Output plugin dir])
else
	 AC_MSG_RESULT([*** Command line interface disabled per user request ***])
   enable_cli=no
fi
AM_CONDITIONAL([ENABLE_CLI], [test "x$enable_cli" == "xyes"])
AM_CONDITIONAL([HAVE_INPUT_DUMMY], [test "x$have_input_dummy" = "xyes"])
AM_CONDITIONAL([HAVE_INPUT_TEST], [test "x$have_input_test" = "xyes"])
AM_CONDITIONAL([HAVE_INPUT_JACKMIDI], [test "x$have_input_jackmidi" = "xyes"])
AM_CONDITIONAL([HAVE_INPUT_MIDIFILE], [test "x$have_input_midifile" = "xyes"])
AM_CONDITIONAL([HAVE_OUTPUT_DUMMY], [test "x$have_output_dummy" = "xyes"])
AM_CONDITIONAL([HAVE_OUTPUT_ALSA], [test "x$have_output_alsa" = "xyes"])
AM_CONDITIONAL([HAVE_OUTPUT_WAVFILE], [test "x$have_output_wavfile" = "xyes"])
AM_CONDITIONAL([HAVE_OUTPUT_JACKAUDIO], [test "x$have_output_jackaudio" = "xyes"])


AC_ARG_ENABLE([editor],
[  --disable-editor       Disable Qt editor [default=enabled]],,
        [enable_editor="yes"])
if test "x$enable_editor" = "xyes"; then
	 have_editor=yes 
   dnl ======================
   dnl Check for Qt
   dnl ======================
   PKG_CHECK_MODULES(QT, QtCore QtGui QtXml >= 4.5)
   AC_CHECK_PROGS(QT_MOC, [moc4 moc-qt4 moc], [])
   AC_CHECK_PROGS(QT_RCC, [rcc4 rcc-qt4 rcc], [])
   AC_CHECK_PROGS(QT_UIC, [uic4 uic-qt4 uic], [])
   if (test "$QT_MOC" = ""); then
     AC_MSG_ERROR([QT4 moc is required.])
   fi
   if (test "$QT_RCC" = ""); then
     AC_MSG_ERROR([QT4 rcc is required.])
   fi
   if (test "$QT_UIC" = ""); then
     AC_MSG_ERROR([QT4 uic is required.])
   fi

   dnl ======================
   dnl Check for libao
   dnl ======================
   PKG_CHECK_MODULES(AO, ao >= 0.8.8)
else
	 AC_MSG_RESULT([*** Qt Drumkit Editor disabled per user request ***])
   have_editor=no
fi
AM_CONDITIONAL([HAVE_EDITOR], [test "x$have_editor" = "xyes"])

dnl ======================
dnl Check for sndfile
dnl ======================
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.20)

AC_ARG_WITH(resample,  [  --with-resample             Build with resample support])
if test x$with_resample == xyes; then
   AC_MSG_WARN([*** Building resample support!])
   AC_DEFINE(WITH_RESAMPLE, [], [Use resample])

   dnl ======================
   dnl Check for libsamplerate
   dnl ======================
   PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.7)
fi 

#dnl ======================
#dnl Check for libpng
#dnl ======================
PKG_CHECK_MODULES(PNG, libpng >= 1.2)

#dnl ======================
#dnl Check for zlib
#dnl ======================
#PKG_CHECK_MODULES(ZLIB, zlib >= 1.2.7)

dnl ======================
dnl Check for the pthread library
dnl ======================
tmp_CXXFLAGS="$CXXFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_LIBS="$LIBS"
CXXFLAGS=""
CPPFLAGS=""
CFLAGS=""
LDFLAGS=""
LIBS=""
AC_CHECK_HEADER(pthread.h, , AC_MSG_ERROR([*** pthread header file not found!]))
AC_CHECK_LIB(pthread,  pthread_mutex_init, , AC_MSG_ERROR([*** pthread library not found!]))
PTHREAD_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
PTHREAD_LIBS="$LDFLAGS $LIBS"
CXXFLAGS="$tmp_CXXFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)

dnl ======================
dnl Check for eXpat library
dnl ======================
tmp_CXXFLAGS="$CXXFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
tmp_CFLAGS="$CFLAGS"
tmp_LDFLAGS="$LDFLAGS"
tmp_LIBS="$LIBS"
CXXFLAGS=""
CPPFLAGS=""
CFLAGS=""
LDFLAGS=""
LIBS=""
AC_CHECK_HEADER(expat.h, , AC_MSG_ERROR([*** eXpat header file not found!]))
AC_CHECK_LIB(expat, XML_ParserCreate, , AC_MSG_ERROR([*** eXpat library not found!]))
EXPAT_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
EXPAT_LIBS="$LDFLAGS $LIBS"
CXXFLAGS="$tmp_CXXFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS"
LDFLAGS="$tmp_LDFLAGS"
LIBS="$tmp_LIBS"
AC_SUBST(EXPAT_CFLAGS)
AC_SUBST(EXPAT_LIBS)

dnl ===========================
dnl Check for SSE instructions
dnl ===========================
AC_ARG_ENABLE([sse],
[  --enable-sse[=level]   Enable SSE Level 1, 2, 3 or auto [default=auto]],,
        [enable_sse="auto"])
if test "x$enable_sse" = "xyes"; then
  enable_sse="auto"
fi
#AC_MSG_RESULT([SSE: $enable_sse])
if test "x$enable_sse" = "x3"; then
  AC_MSG_RESULT([Setting sse level 3])
  SSEFLAGS="-DSSE -msse -msse2 -mss3"
elif test "x$enable_sse" = "x2"; then
  AC_MSG_RESULT([Setting sse level 2])
  SSEFLAGS="-DSSE -msse -msse2"
elif test "x$enable_sse" = "x1"; then
  AC_MSG_RESULT([Setting sse level 1])
  SSEFLAGS="-DSSE -msse"
elif test "x$enable_sse" = "xauto"; then
  AC_MSG_RESULT([Auto setting sse level])
  AC_MSG_CHECKING([for sse3 instructions])
  if grep -q "sse3" /proc/cpuinfo
  then
    AC_MSG_RESULT([yes])
    SSEFLAGS="-msse3"
    AC_SUBST(SSEFLAGS)
  else
    AC_MSG_RESULT([no])
  fi
  AC_MSG_CHECKING([for sse2 instructions])
  if grep -q "sse2" /proc/cpuinfo
  then
    AC_MSG_RESULT([yes])
    SSEFLAGS="$SSEFLAGS -msse2"
    AC_SUBST(SSEFLAGS)
  else
    AC_MSG_RESULT([no])
  fi
  AC_MSG_CHECKING([for sse instructions])
  if grep -q "sse" /proc/cpuinfo
  then
    AC_MSG_RESULT([yes])
    SSEFLAGS="$SSEFLAGS -DSSE -msse"
    AC_SUBST(SSEFLAGS)
  else
    AC_MSG_RESULT([no])
  fi
else 
  AC_MSG_RESULT([*** Disabling SSE ***])
fi

if test "x$need_jack" = "xyes"
then
  dnl ======================
  dnl Check for jack
  dnl ======================
  PKG_CHECK_MODULES(JACK, jack >= 0.120.1)
fi

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)



#	au/Makefile

AC_OUTPUT(
	Makefile
	tools/Makefile
	src/Makefile
	vst/Makefile
	lv2/Makefile
	plugingui/Makefile
	include/Makefile
	drumgizmo/Makefile
	drumgizmo/input/Makefile
	drumgizmo/input/dummy/Makefile
	drumgizmo/input/test/Makefile
	drumgizmo/input/jackmidi/Makefile
	drumgizmo/input/midifile/Makefile
	drumgizmo/output/Makefile
	drumgizmo/output/dummy/Makefile
	drumgizmo/output/alsa/Makefile
	drumgizmo/output/jackaudio/Makefile
	drumgizmo/output/wavfile/Makefile
  dgedit/Makefile)