summaryrefslogtreecommitdiff
path: root/configure.ac
blob: e1b7e05684cccadf636fdc681c344415219ffccd (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
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
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
AC_PROG_OBJC
AC_PROG_OBJCXX
AM_PROG_CC_C_O
AC_PROG_MKDIR_P

LT_INIT

AC_CONFIG_HEADERS(config.h)

AC_SYS_LARGEFILE

AM_SILENT_RULES([yes])

need_jack=no

dnl ===========================
dnl Compile with C++11 support.
dnl ===========================
AC_LANG_PUSH([C++])
TMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-std=c++11
AC_MSG_CHECKING([whether CXX supports -std=c++11])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
	[AC_MSG_RESULT([yes])],
	[
	 AC_MSG_RESULT([no])
	 CXXFLAGS=-std=c++0x
	 AC_MSG_CHECKING([whether CXX supports -std=c++0x])
	 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
	 	[AC_MSG_RESULT([yes])],
	 	[
	 	 AC_MSG_RESULT([no])
	 	 AC_MSG_ERROR([Compiler does not support c++11])
	 	]
	 )
]
)
CXXFLAGS="$TMP_CXXFLAGS $CXXFLAGS"
OBJCXXFLAGS="$OBJCXXFLAGS $CXXFLAGS"
AC_LANG_POP([C++])

dnl ===========================
dnl Check for override /final keywords support
dnl ===========================
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([whether 'override' and 'final' keywords are supported])
AC_COMPILE_IFELSE(
	[AC_LANG_SOURCE(
		[
			class A { virtual void foo() {} };
			class B : public A { virtual void foo() override {} };
			class C : public B { virtual void foo() final {} };
		]
	 )
	],
	[AC_MSG_RESULT([yes])],
	[AC_MSG_RESULT([no (deploying fix)])
	 CXXFLAGS="$CXXFLAGS -Doverride=\"\" -Dfinal=\"\""
	]
)
AC_LANG_POP([C++])

dnl ===========================
dnl Check for -ffloat-store support
dnl ===========================
AC_LANG_PUSH([C++])
TMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-Wall -Werror -ffloat-store"
AC_MSG_CHECKING([whether CXX supports -ffloat-store])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
	[AC_MSG_RESULT([yes])
	 FLOAT_STORE="-ffloat-store"
	],
	[AC_MSG_RESULT([no])
	 FLOAT_STORE=""
	]
)
AC_SUBST(FLOAT_STORE)
CXXFLAGS="$TMP_CXXFLAGS"
AC_LANG_POP([C++])

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

HUGIN_PARM="-DDISABLE_HUGIN"
AC_ARG_WITH([debug],
	AS_HELP_STRING([--with-debug], [Build with debug support]))

dnl ===========================
dnl Check for -Wl,--no-undefined or -Wl,-undefined,error support
dnl ===========================
AC_LANG_PUSH([C++])
TMP_CXXFLAGS="$CXXFLAGS"
TMP_LDFLAGS="$LDFLAGS"
AC_MSG_CHECKING([whether linker supports '-Wl,-no-undefined'])
CXXFLAGS="-Wall -Werror"
LDFLAGS="-no-undefined"
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
	[ AC_MSG_RESULT([yes])
		NO_UNDEFINED_PARAM=-Wl,-no-undefined
	],
	[ AC_MSG_RESULT([no])
		AC_MSG_CHECKING([whether linker supports '-Wl,-undefined,error'])
		LDFLAGS="-undefined,error"
		AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
			[AC_MSG_RESULT([yes])
				NO_UNDEFINED_PARAM=-Wl,-undefined,error
			],
			[AC_MSG_RESULT([no])
				NO_UNDEFINED_PARAM=""
			]
		)
	]
)
CXXFLAGS="$TMP_CXXFLAGS"
LDFLAGS="$TMP_LDFLAGS"
AC_LANG_POP([C++])

dnl ===========================
dnl Set up debug compile args if the user requested it
dnl ===========================
AS_IF([test "x$with_debug" = "xyes"],
      [AC_MSG_WARN([*** Building with debug support!])
	     DEBUG_FLAGS="-Wall -Werror -g $NO_UNDEFINED_PARAM"
	     HUGIN_PARM=""]
)
AC_SUBST(DEBUG_FLAGS)

CXXFLAGS="$CXXFLAGS $HUGIN_PARM"


dnl ===========================
dnl Enable/disable NLS support
dnl ===========================
AC_ARG_WITH([nls],
            AS_HELP_STRING([--with-nls],
                           [Build with nls support (default nls enabled)]),
            [],
            [with_nls=yes])
            AS_IF([test "x$with_nls" == "xyes"],
                  [AC_MSG_RESULT([*** Building with nls support!])
                   AC_CHECK_PROGS([XGETTEXT], [xgettext])
                   AC_CHECK_PROGS([MSGMERGE], [msgmerge])
                   AC_CHECK_PROGS([MSGFMT], [msgfmt])
                   AC_DEFINE_UNQUOTED([WITH_NLS], , [Build with nls support])],
                  [AC_MSG_WARN([*** Building without nls support!])]
)
AM_CONDITIONAL([WITH_NLS], [test "x$with_nls" = "xyes"])


dnl ===========================
dnl Check for GUI backend
dnl ===========================
AC_CANONICAL_HOST
AC_ARG_ENABLE([gui],
	AS_HELP_STRING([--enable-gui[=backend]], [Use specified gui backend. Can be x11, win32, cocoa, pugl-x11, pugl-win32, pugl-cocoa or auto [default=auto]]),,
        [enable_gui="auto"])

AS_IF([test "x$enable_gui" = "xyes"], [enable_gui="auto"])

AS_IF([test "x$enable_gui" = "xauto"],
      [AC_MSG_RESULT([Auto setting gui based on host: $host_os])
	     AS_CASE([$host_os],
		      [darwin*], [enable_gui="cocoa"],
		      [linux*|*bsd*], [enable_gui="x11"],
		      [msys|mingw*|windows*|winnt|cygwin], [enable_gui="win32"],

		      AC_MSG_ERROR([Your platform is not currently supported])
	     )]
)

AS_IF(
  [test "x$enable_gui" = "xx11"],
  [AC_MSG_RESULT([Setting gui backend to X11])
  PKG_CHECK_MODULES(X11, x11 >= 1.0)
  PKG_CHECK_MODULES(XEXT, xext >= 1.0)
  GUI_CPPFLAGS="-DUI_X11 $X11_CFLAGS $XEXT_CFLAGS"
  GUI_LIBS="$X11_LIBS $XEXT_LIBS"],

  [test "x$enable_gui" = "xwin32"],
  [AC_MSG_RESULT([Setting gui backend to Win32])
  GUI_CPPFLAGS="-DUI_WIN32"
  GUI_LIBS="-lgdi32 -lsetupapi -lws2_32 -lcomctl32"],

  [test "x$enable_gui" = "xcocoa"],
  [AC_MSG_RESULT([Setting gui backend to Cocoa])
  GUI_CPPFLAGS="-DUI_COCOA"
  GUI_LIBS="-framework Cocoa"
	],

  [test "x$enable_gui" = "xpugl-x11"],
  [AC_MSG_RESULT([Setting gui backend to Pugl-X11])
  PKG_CHECK_MODULES(X11, x11 >= 1.0)
  PKG_CHECK_MODULES(XEXT, xext >= 1.0)
  GUI_CPPFLAGS="-DUI_PUGL -DPUGL_HAVE_GL $X11_CFLAGS $XEXT_CFLAGS"
  GUI_LIBS="-lGL $X11_LIBS $XEXT_LIBS"],

  [test "x$enable_gui" = "xpugl-win32"],
  [AC_MSG_RESULT([Setting gui backend to Pugl-Win32])
  GUI_CPPFLAGS="-DUI_PUGL -DPUGL_HAVE_GL"
  GUI_LIBS="-lopengl32 -lgdi32 -luser32 -lsetupapi -lws2_32 -lcomctl32"],

  [test "x$enable_gui" = "xpugl-cocoa"],
  [AC_MSG_RESULT([Setting gui backend to Pugl-Cocoa])
  GUI_CPPFLAGS="-DUI_PUGL -DPUGL_HAVE_GL"
  GUI_LIBS="-framework OpenGL -framework Cocoa"],

  AC_MSG_ERROR([*** No GUI backend has been selected ***])
)

AC_SUBST(GUI_CPPFLAGS)
AC_SUBST(GUI_LIBS)

AM_CONDITIONAL([ENABLE_X11], [test "x$enable_gui" = "xx11"])
AM_CONDITIONAL([ENABLE_WIN32], [test "x$enable_gui" = "xwin32"])
AM_CONDITIONAL([ENABLE_COCOA], [test "x$enable_gui" = "xcocoa"])
AM_CONDITIONAL([ENABLE_PUGL_X11], [test "x$enable_gui" = "xpugl-x11"])
AM_CONDITIONAL([ENABLE_PUGL_WIN32], [test "x$enable_gui" = "xpugl-win32"])
AM_CONDITIONAL([ENABLE_PUGL_COCOA], [test "x$enable_gui" = "xpugl-cocoa"])

dnl ===========================
dnl Custom number of outputs?
dnl ===========================
AC_ARG_ENABLE([custom-channel-count],
	AS_HELP_STRING([--enable-custom-channel-count[=count]], [Compile with specified number of output channels [default=16]]),,
        [enable_custom_channel_count="16"])
AC_DEFINE_UNQUOTED([NUM_CHANNELS], [$enable_custom_channel_count], [Number of output channels])

dnl ======================
dnl Compile unit tests
dnl ======================
AC_ARG_WITH([test],
	AS_HELP_STRING([--with-test], [Build unit tests]))

AM_CONDITIONAL([ENABLE_TESTS], [test "x$with_test" = "xyes"])

dnl ======================
dnl Compile LV2 plugin
dnl ======================
AC_ARG_ENABLE([lv2],
	AS_HELP_STRING([--enable-lv2], [Compile the LV2 plugin [default=no]]),,
        [enable_lv2="no"])

AS_IF(
  [test "x$enable_lv2" = "xyes"],
  [enable_lv2=yes
	 dnl ======================
	 dnl Check for lv2core
	 dnl ======================
	 PKG_CHECK_MODULES(LV2, lv2 >= 1.0)

	 dnl ======================
	 dnl Check for dl 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(dlfcn.h, , AC_MSG_ERROR([*** dlfcn.h header file not found!]))
	 AC_CHECK_LIB(c,  dlopen, ,
		AC_CHECK_LIB(dl, dlopen, , AC_MSG_ERROR([*** library conaining dlopen not found!])))
	 DL_CFLAGS="$CXXFLAGS $CPPFLAGS $CFLAGS"
	 DL_LIBS="$LDFLAGS $LIBS"
	 CXXFLAGS="$tmp_CXXFLAGS"
	 CPPFLAGS="$tmp_CPPFLAGS"
	 CFLAGS="$tmp_CFLAGS"
	 LDFLAGS="$tmp_LDFLAGS"
	 LIBS="$tmp_LIBS"
	 AC_SUBST(DL_CFLAGS)
	 AC_SUBST(DL_LIBS)

	 AC_ARG_WITH([lv2dir],
		AS_HELP_STRING([--with-lv2dir=DIR],
		               [Use DIR as the lv2 plugin directory [default=LIBDIR/lv2]]),
	  [LV2DIR=$with_lv2dir],
	  [LV2DIR='$(libdir)/lv2'])
	 AC_SUBST(LV2DIR)
	],

  [AC_MSG_RESULT([*** LV2 plugin will not be compiled ***])
   enable_lv2=no]
)

AM_CONDITIONAL([ENABLE_LV2], [test "x$enable_lv2" = "xyes"])

dnl ======================
dnl Compile VST plugin
dnl ======================
AC_ARG_WITH([vst_sources],
	AS_HELP_STRING([--with-vst-sources], [Point this to the vstsdk24 directory]))
AC_ARG_ENABLE([vst],
	AS_HELP_STRING([--enable-vst], [Compile the VST plugin [default=no]]),,
        [enable_vst="no"])

AS_IF(
  [test "x$enable_vst" = "xyes"],
  [enable_vst=yes
  VST_CPPFLAGS="-D__int64='long long int'"

	# Set up platform specific workarounds for the VST SDK
	AS_CASE([$host_os],
		[darwin*], [ ],
		[linux*|*bsd*], [VST_CPPFLAGS="$VST_CPPFLAGS -D__cdecl="],
		[msys|mingw*|windows*|winnt|cygwin], [ ],
		AC_MSG_ERROR([Your platform is not currently supported])
	)

  VST_SOURCE_PATH="$with_vst_sources"
  AC_SUBST(VST_SOURCE_PATH)
  AC_SUBST(VST_CPPFLAGS)
  AC_CONFIG_FILES(plugin/Makefile.mingw32)],

  [AC_MSG_RESULT([*** VST plugin will not be compiled ***])
   enable_vst=no]
)

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],
	AS_HELP_STRING([--enable-cli], [Compile the command line interface [default=yes]]),,
        [enable_cli="yes"])


AS_IF(
  [test "x$enable_cli" = "xyes"],
  [enable_cli=yes

  dnl ======================
  dnl Check for getopt
  dnl ======================
  AC_CHECK_HEADERS(getopt.h)

  dnl ======================
  dnl Check for wordexp
  dnl ======================
  AC_CHECK_FUNCS([wordexp])

  dnl ***
  dnl *** Input plugins
  dnl ***

  dnl *** Dummy
  AC_ARG_ENABLE([input_dummy],
		AS_HELP_STRING([--disable-input-dummy], [Disable input dummy plugin [default=enabled]]),,
           [enable_input_dummy="yes"])

  AS_IF(
    [test "x$enable_input_dummy" = "xyes"],
    [have_input_dummy=yes],

    [AC_MSG_RESULT([*** input dummy plugin disabled per user request ***])
     have_input_dummy=no]
  )

  dnl *** Test
  AC_ARG_ENABLE([input_test],
		AS_HELP_STRING([--disable-input-test], [Disable input test plugin [default=enabled]]),,
           [enable_input_test="yes"])

  AS_IF(
    [test "x$enable_input_test" = "xyes"],
    [have_input_test=yes],

    [AC_MSG_RESULT([*** input test plugin disabled per user request ***])
    have_input_test=no]
  )

  dnl *** Jackmidi
  AC_ARG_ENABLE([input_jackmidi],
    AS_HELP_STRING([--disable-input-jackmidi], [Disable input jackmidi plugin [default=enabled]]),,
           [enable_input_jackmidi="yes"])

  AS_IF(
    [test "x$enable_input_jackmidi" = "xyes"],
    [have_input_jackmidi=yes
    need_jack=yes],

    [AC_MSG_RESULT([*** input jackmidi plugin disabled per user request ***])
    have_input_jackmidi=no]
  )

  dnl *** Midifile
  AC_ARG_ENABLE([input_midifile],
		AS_HELP_STRING([--disable-input-midifile], [Disable input midifile plugin [default=enabled]]),,
           [enable_input_midifile="yes"])

  AS_IF(
    [test "x$enable_input_midifile" = "xyes"],
    [have_input_midifile=yes
		 dnl ======================
		 dnl Check for libsmf
		 dnl ======================
		 PKG_CHECK_MODULES(SMF, smf >= 1.2)],

    [AC_MSG_RESULT([*** input midifile plugin disabled per user request ***])
     have_input_midifile=no]
  )

  dnl *** oss
  case $host_os in
    freebsd*)
      enable_oss_midi_value=yes
      ;;
    *)
      enable_oss_midi_value=no
      ;;
  esac
  AC_ARG_ENABLE([input_oss],
    AS_HELP_STRING(
      [--disable-input-oss],
      [Disable input oss plugin [enabled by default on FreeBSD, disabled otherwise]]),,
    [enable_input_ossmidi=$enable_oss_midi_value]
  )

  AS_IF(
    [test "x$enable_input_ossmidi" = "xyes"],
    [AC_MSG_CHECKING(for OSS in)
      AC_COMPILE_IFELSE(
        [AC_LANG_SOURCE([[
          #include <sys/soundcard.h>
          #ifndef AFMT_S32_NE
          # error no oss
          #endif
        ]])],
        [
          have_input_ossmidi=yes
          AC_MSG_RESULT(yes)
        ],
        [AC_MSG_FAILURE([no OSS headers found])]
    )],

    [AC_MSG_RESULT([*** input ossmidi plugin disabled per user request ***])
    have_input_ossmidi=no]
  )

  INPUT_PLUGINS="midifile jackmidi dummy test ossmidi"
  AC_SUBST(INPUT_PLUGINS)

  dnl ***
  dnl *** Output plugins
  dnl ***

  dnl *** dummy
  AC_ARG_ENABLE([output_dummy],
		AS_HELP_STRING([--disable-output-dummy], [Disable output dummy plugin [default=enabled]]),,
           [enable_output_dummy="yes"])

  AS_IF(
    [test "x$enable_output_dummy" = "xyes"],
    [have_output_dummy=yes],

    [AC_MSG_RESULT([*** output dummy plugin disabled per user request ***])
     have_output_dummy=no]
  )

  dnl *** Jackaudio
  AC_ARG_ENABLE([output_jackaudio],
		AS_HELP_STRING([--disable-output-jackaudio], [Disable output jack plugin [default=enabled]]),,
           [enable_output_jackaudio="yes"])

  AS_IF(
    [test "x$enable_output_jackaudio" = "xyes"],
    [have_output_jackaudio=yes
     need_jack=yes],

    [AC_MSG_RESULT([*** output jack plugin disabled per user request ***])
     have_output_jackaudio=no]
  )

  dnl *** alsa
  AC_ARG_ENABLE([output_alsa],
		AS_HELP_STRING([--disable-output-alsa], [Disable output alsa plugin [default=enabled]]),,
           [enable_output_alsa="yes"])

  AS_IF(
    [test "x$enable_output_alsa" = "xyes"],
    [have_output_alsa=yes
     dnl ======================
     dnl Check for alsa library
     dnl ======================
     PKG_CHECK_MODULES(ALSA, alsa >= 1.0.18)],

    [AC_MSG_RESULT([*** output alsa plugin disabled per user request ***])
     have_output_alsa=no]
  )

  dnl *** wavfile
  AC_ARG_ENABLE([output_wavfile],
		AS_HELP_STRING([--disable-output-wavfile], [Disable output wavfile plugin [default=enabled]]),,
           [enable_output_wavfile="yes"])

  AS_IF(
    [test "x$enable_output_wavfile" = "xyes"],
    [have_output_wavfile=yes],

    [AC_MSG_RESULT([*** output wavfile plugin disabled per user request ***])
     have_output_wavfile=no]
  )

  dnl *** oss
  case $host_os in
    freebsd*)
      enable_oss_value=yes
      ;;
    *)
      enable_oss_value=no
      ;;
  esac
  AC_ARG_ENABLE([output_oss],
    AS_HELP_STRING(
      [--disable-output-oss],
      [Disable output oss plugin [enabled by default on FreeBSD, disabled otherwise]]),,
    [enable_output_oss=$enable_oss_value]
  )

  AS_IF(
    [test "x$enable_output_oss" = "xyes"],
    [AC_MSG_CHECKING(for OSS out)
      AC_COMPILE_IFELSE(
        [AC_LANG_SOURCE([[
          #include <sys/soundcard.h>
          #ifndef AFMT_S32_NE
          # error no oss
          #endif
        ]])],
        [
          have_output_oss=yes
          AC_MSG_RESULT(yes)
        ],
        [AC_MSG_FAILURE([no OSS headers found])]
    )],

    [AC_MSG_RESULT([*** output oss plugin disabled per user request ***])
    have_output_oss=no]
  )

  OUTPUT_PLUGINS="dummy alsa wavfile jackaudio oss"
  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_MSG_RESULT([*** Command line interface disabled per user request ***])
   enable_cli=no]
)

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_OSSMIDI], [test "x$have_input_ossmidi" = "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"])
AM_CONDITIONAL([HAVE_OUTPUT_OSS], [test "x$have_output_oss" = "xyes"])

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

dnl ======================
dnl Check for the rt library
dnl ======================
AC_HAVE_LIBRARY([rt],[],[])

dnl ======================
dnl Check for the atomic library
dnl ======================
AC_HAVE_LIBRARY([atomic],[],[])

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"
# Add extra (platform specific) libs for semaphore support?
AS_CASE([$host_os],
		      [darwin*], [PTHREAD_LIBS="$PTHREAD_LIBS -framework CoreServices"],
		      [linux*|*bsd*], [],
		      [msys|mingw*|windows*|winnt|cygwin], [],
					[])
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)

dnl ===========================
dnl Check for SSE instructions
dnl ===========================
AC_ARG_ENABLE([sse],
	AS_HELP_STRING([--enable-sse[=level]], [Enable SSE Level 1, 2, 3 or auto [default=auto]]),,
        [enable_sse="auto"])

AS_IF([test "x$enable_sse" = "xyes"], [enable_sse="auto"])

#AC_MSG_RESULT([SSE: $enable_sse])

AS_IF([test "x$enable_sse" = "x3"],
      [AC_MSG_RESULT([Setting sse level 3])
       SSEFLAGS="-DSSE -msse -msse2 -msse3"],

      [test "x$enable_sse" = "x2"],
      [AC_MSG_RESULT([Setting sse level 2])
       SSEFLAGS="-DSSE -msse -msse2"],

      [test "x$enable_sse" = "x1"],
      [AC_MSG_RESULT([Setting sse level 1])
       SSEFLAGS="-DSSE -msse"],

      [test "x$enable_sse" = "xauto"],
      [AC_MSG_RESULT([Auto setting sse level])

       AC_MSG_CHECKING([for sse3 instructions])
       AS_IF([grep -q "sse3" /proc/cpuinfo],
             [AC_MSG_RESULT([yes])
              SSEFLAGS="-msse3"
              AC_SUBST(SSEFLAGS)],

             [AC_MSG_RESULT([no])]
       )

       AC_MSG_CHECKING([for sse2 instructions])
       AS_IF([grep -q "sse2" /proc/cpuinfo],
             [AC_MSG_RESULT([yes])
              SSEFLAGS="$SSEFLAGS -msse2"
              AC_SUBST(SSEFLAGS)],

             [AC_MSG_RESULT([no])]
       )

       AC_MSG_CHECKING([for sse instructions])
       AS_IF([grep -q "sse" /proc/cpuinfo],
             [AC_MSG_RESULT([yes])
              SSEFLAGS="$SSEFLAGS -DSSE -msse"
              AC_SUBST(SSEFLAGS)],

             [AC_MSG_RESULT([no])]
       )],

      [AC_MSG_RESULT([*** Disabling SSE ***])]
)

dnl ======================
dnl Check for jack
dnl ======================
AS_IF([test "x$need_jack" = "xyes"], [PKG_CHECK_MODULES(JACK, jack >= 0.120.1)])

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

AC_CONFIG_FILES(
	Makefile
	tools/Makefile
	src/Makefile
	plugin/Makefile
	plugin/vst/Makefile
	plugingui/Makefile
	plugingui/locale/Makefile
	man/Makefile
	test/Makefile
	test/dgreftest/Makefile
	test/uitests/Makefile
	drumgizmo/Makefile)

AC_OUTPUT()