summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 7109cc746127b479d0807346deb947564d009df1 (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
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
# Configuration script for Snd
#
# we now depend completely on pc (pkgconfig) files.
#   Motif apparently has none.
#   gmp, mpfr, and mpc deliberately have none!


AC_INIT(snd, 19.8, bil@ccrma.stanford.edu, ftp://ccrma-ftp.stanford.edu/pub/Lisp/snd-19.tar.gz)

AC_CONFIG_SRCDIR(snd.c)
AC_CANONICAL_HOST # needed by case $host below
AC_CONFIG_HEADERS(mus-config.h)
AC_CONFIG_FILES(makefile)
AC_PROG_CC

# AC_HEADER_STDC
AC_PROG_INSTALL

MAKE_TARGET="snd"
AUDIO_SYSTEM="None"
RANDOM_FEATURES=""
OPTIONAL_LIBRARIES=""
LOCAL_LANGUAGE="None"
GRAPHICS_TOOLKIT="None"

PACKAGE=Snd
VERSION=19.8

#--------------------------------------------------------------------------------
# configuration options
#   --with-motif          use Motif
#   --with-gtk            use Gtk (the default)
#   --with-alsa           use ALSA if possible (the default)
#   --with-oss            use OSS 
#   --with-jack           use Jack
#   --without-audio       stub out all audio
#   --with-gmp            include multiprecision arithmetic via gmp, mpfr, and mpc
#   --disable-deprecated  do not include any deprecated stuff (in gtk, motif, s7, sndlib, clm, etc)
#   --with-ladspa         include LADSPA plugin support (Linux)
#   --with-gui            make Snd with(out) any graphics support
#   --with-forth          use Forth as the extension language
#   --with-ruby           use Ruby as the extension language
#   --with-s7             use s7 as the extension language (default = yes)
#   --with-pure-s7        s7 WITH_PURE_S7
#   --with-s7-history     s7 WITH_HISTORY
#   --with-s7-profiling   s7 WITH_PROFILE
#   --with-extension-language use some extension language (default=yes)
#   --with-temp-dir       directory to use for temp files
#   --with-save-dir       directory to use for saved-state files
#   --with-doc-dir        directory to search for documentation
#   --with-gl             include OpenGL support (default=no, Motif only)
#   --with-gl2ps          include gl2ps (Motif only)
#   --with-editres 	  include EditRes in xm
#   --without-gsl         omit GSL even if it exists
#   --without-fftw        omit FFTW even if it exists
#   --with-pulseaudio     use PulseAudio
#   --with-portaudio      use portaudio
#   --with-webserver      use webserver


AC_ARG_WITH(gtk,         [  --with-gtk		  use Gtk to build Snd])
AC_ARG_WITH(gui,         [  --with-gui  	      	  make Snd with graphics support])
AC_ARG_WITH(gl,          [  --with-gl		  include OpenGL support, Motif only])
AC_ARG_WITH(gl2ps,       [  --with-gl2ps		  include gl2ps, Motif only])
AC_ARG_WITH(motif,	 [  --with-motif	  	  use libXm to build Snd])
AC_ARG_WITH(editres,     [  --with-editres	  include editres in xm])

AC_ARG_WITH(alsa,        [  --with-alsa		  use ALSA])
AC_ARG_WITH(oss,         [  --with-oss		  use OSS])
AC_ARG_WITH(jack,        [  --with-jack		  use JACK])
AC_ARG_WITH(ladspa,	 [  --with-ladspa  	  include support for LADSPA plugins, Linux only])
AC_ARG_WITH(pulseaudio,  [  --with-pulseaudio 	  use PulseAudio, default=no])
AC_ARG_WITH(portaudio,   [  --with-portaudio 	  use portaudio, default=no])

AC_ARG_WITH(extension-language, [  --with-extension-language use some extension language, default=yes])
AC_ARG_WITH(s7,          [  --with-s7  	          use S7, default=yes])
AC_ARG_WITH(forth,       [  --with-forth	  	  use Forth as the extension language])
AC_ARG_WITH(ruby,        [  --with-ruby             use Ruby as the extension language])

AC_ARG_WITH(pure-s7,     [  --with-pure-s7	  s7 WITH_PURE_S7])
AC_ARG_WITH(s7-history,  [  --with-s7-history	  s7 WITH_HISTORY])
AC_ARG_WITH(s7-profiling, [  --with-s7-profiling	  s7 WITH_PROFILE])

AC_ARG_WITH(gsl,         [  --with-gsl		  use GSL, default=yes])
AC_ARG_WITH(fftw,        [  --with-fftw		  use fftw, default=yes])
AC_ARG_WITH(gmp,         [  --with-gmp		  include multiprecision arithmetic via gmp, mpfr, and mpc, default=no])
AC_ARG_WITH(audio,       [  --without-audio         don't include any audio functionality])

AC_ARG_WITH(temp-dir,    [  --with-temp-dir	  directory to use for temp files], AC_DEFINE_UNQUOTED(MUS_DEFAULT_TEMP_DIR, "${withval}"))
AC_ARG_WITH(save-dir,    [  --with-save-dir	  directory to use for saved-state files], AC_DEFINE_UNQUOTED(MUS_DEFAULT_SAVE_DIR, "${withval}"))
AC_ARG_WITH(doc-dir,     [  --with-doc-dir	  directory to search for documentation], AC_DEFINE_UNQUOTED(MUS_DEFAULT_DOC_DIR, "${withval}"))
AC_ARG_WITH(webserver,   [  --with-webserver 	  use webserver, default=no])

AC_ARG_ENABLE(deprecated,[  --disable-deprecated	  do not include any deprecated stuff from gtk, s7, motif, clm, snd, or sndlib])


AC_C_BIGENDIAN
AC_CHECK_SIZEOF(void *)
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)



#--------------------------------------------------------------------------------
# fftw
#--------------------------------------------------------------------------------

FFTW_LIBS=""
FFTW_CFLAGS=""
if test "$with_fftw" != no; then
  AC_MSG_CHECKING(for fftw3)
  if test x$PKG_CONFIG != xno ; then
    if $PKG_CONFIG fftw3 --exists ; then
      FFTW_LIBS="`$PKG_CONFIG fftw3 --libs`"
      FFTW_CFLAGS="`$PKG_CONFIG fftw3 --cflags`"
      AC_DEFINE(HAVE_FFTW3)
      OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES fftw-`$PKG_CONFIG fftw3 --modversion`"
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
fi
AC_SUBST(FFTW_LIBS)
AC_SUBST(FFTW_CFLAGS)




#--------------------------------------------------------------------------------
# GMP, MPFR, MPC
#--------------------------------------------------------------------------------

# no pc files -- deliberately! We'll just add the libraries and let the chips fall...

GMP_LIBS=""

if test "$with_gmp" = yes ; then
  GMP_LIBS="-lgmp -lmpfr -lmpc -lm"  
  AC_DEFINE(WITH_GMP)
  OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES gmp mpfr mpc"
fi

AC_SUBST(GMP_LIBS)



#--------------------------------------------------------------------------------
# GSL
#--------------------------------------------------------------------------------

GSL_LIBS=""
GSL_CFLAGS=""

if test "$with_gsl" != no; then
  AC_MSG_CHECKING(for gsl)
  if test x$PKG_CONFIG != xno ; then
    if $PKG_CONFIG gsl --exists ; then
      GSL_LIBS="`$PKG_CONFIG gsl --libs`"
      GSL_CFLAGS="`$PKG_CONFIG gsl --cflags`"
      AC_DEFINE(HAVE_GSL)
      OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES gsl-`$PKG_CONFIG gsl --modversion`"
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
fi

AC_SUBST(GSL_LIBS)
AC_SUBST(GSL_CFLAGS)



#--------------------------------------------------------------------------------
# Ladspa
#--------------------------------------------------------------------------------

if test "$with_ladspa" = yes ; then
  AC_DEFINE(HAVE_LADSPA)
  RANDOM_FEATURES="$RANDOM_FEATURES ladspa"
fi



#--------------------------------------------------------------------------------
# graphics
#--------------------------------------------------------------------------------

# graphics: motif chosen if --with-motif
#           no gui chosen if --without-gui
#           gtk chosen if neither of above and we can find gtk-2.0.pc or gtk-3.0.pc, or gtk4.pc?
#           else no gui

XLIBS=""
XFLAGS=""

GX_FILES=""
GX_HEADERS=""

GTK_FILES=""
GTK_HEADERS=""
GTK_CFLAGS=""
GTK_LIBS=""
GTK_LD_LIBS=""

ac_snd_gui_choice=none

if test "$with_motif" = no && test "$with_gtk" = no ; then
  with_gui=no
fi

if test "$with_gui" = no ; then
  AC_DEFINE(USE_NO_GUI)
  GX_FILES="NO_GUI_O_FILES"
  GX_HEADERS="NO_GUI_HEADERS"
  ac_snd_gui_choice=no
fi


#--------------------------------------------------------------------------------
# X/Motif
#--------------------------------------------------------------------------------

# here as in the gmp case, we simply set up the libs/flags and hope for the best

if test "$with_motif" = yes ; then
  AC_PATH_XTRA

  GTK_FLAGS="$X_CFLAGS"
  X_POST_LIBS="-lX11 $X_EXTRA_LIBS -lXext"
  case "$host" in
    *-apple-*)
      X_POST_LIBS="$X_POST_LIBS -lSM -lICE"
      ;;
    *-*-linux*) 
      X_POST_LIBS="$X_POST_LIBS -lSM -lICE -lXft"
      ;;
  esac
  X_PRE_LIBS="$X_LIBS $X_PRE_LIBS -lXm -lXt"

  GX_FILES="MOTIF_O_FILES"
  GX_HEADERS="SND_X_HEADERS"

  if test "$with_editres" = yes ; then
    AC_DEFINE(WITH_EDITRES)
    OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES editres"
    X_PRE_LIBS="$X_PRE_LIBS -lXmu"
  fi

  GTK_LIBS="$X_PRE_LIBS $X_POST_LIBS -lXpm"
  AC_DEFINE(USE_MOTIF)
  GRAPHICS_TOOLKIT="Motif"
  ac_snd_gui_choice=Motif
fi


#--------------------------------------------------------------------------------
# Gtk
#--------------------------------------------------------------------------------

if test "$ac_snd_gui_choice" = none ; then
  if test x$PKG_CONFIG != xno ; then

#    m4_foreach([gtk_version], [[gtk4], [gtk+-3.0], [gtk+-2.0]],
     m4_foreach([gtk_version], [[gtk+-3.0], [gtk+-2.0]],
       [
       if test "$ac_snd_gui_choice" = none ; then
         if $PKG_CONFIG gtk_version --exists ; then
           GTK_CFLAGS="`$PKG_CONFIG gtk_version --cflags`"
           GTK_LIBS="`$PKG_CONFIG gtk_version --libs`"
           GTK_LD_LIBS="`$PKG_CONFIG gtk_version --libs-only-L` `$PKG_CONFIG gtk_version --libs-only-l`"
           ac_snd_gui_choice=gtk
           GRAPHICS_TOOLKIT=Gtk-`$PKG_CONFIG gtk_version --modversion`
         fi
       fi
       ])
 
    if test "$ac_snd_gui_choice" = gtk ; then  
      GX_FILES="GTK_O_FILES"
      GX_HEADERS="SND_G_HEADERS"
      AC_DEFINE(USE_GTK)
 
      if test x$PKG_CONFIG != xno ; then
        CAIRO_CFLAGS="`$PKG_CONFIG cairo --cflags-only-I`"
        AC_SUBST(CAIRO_CFLAGS)
      fi
    fi
  fi
fi


#--------------------------------------------------------------------------------
# no GUI
#--------------------------------------------------------------------------------

if test "$ac_snd_gui_choice" = none ; then
  AC_DEFINE(USE_NO_GUI)
  GX_FILES="NO_GUI_O_FILES"
  GX_HEADERS="NO_GUI_HEADERS"
fi

# fallback on no-gui
if test "$with_gui" = no ; then
  AC_DEFINE(USE_NO_GUI)
  GX_FILES="NO_GUI_O_FILES"
  GX_HEADERS="NO_GUI_HEADERS"
  ac_snd_gui_choice=no
fi


AC_SUBST(XLIBS)
AC_SUBST(XFLAGS)

AC_SUBST(GX_FILES)
AC_SUBST(GX_HEADERS)

AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LD_LIBS)




#--------------------------------------------------------------------------------
# OpenGL
#--------------------------------------------------------------------------------

GL_LIBS=""
GL_FILES=""
GL_FLAGS=""

if test "$with_gl" = yes ; then
  if test x$PKG_CONFIG != xno ; then
    if $PKG_CONFIG gl --exists ; then

      GL_CFLAGS="`$PKG_CONFIG gl --cflags`"
      GL_LIBS="`$PKG_CONFIG gl --libs`"
      GL_FILES="gl.o"
      AC_DEFINE(HAVE_GL)	    
      OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES openGL"

      if $PKG_CONFIG glu --exists ; then
          AC_DEFINE(HAVE_GLU)
          GL_CFLAGS="$GL_CFLAGS `$PKG_CONFIG glu --cflags`"
          GL_LIBS="$GL_LIBS `$PKG_CONFIG glu --libs`"
      fi

      if test "$with_gl2ps" = yes ; then
        AC_DEFINE(WITH_GL2PS)
        RANDOM_FEATURES="$RANDOM_FEATURES gl2ps"
        GL_FILES="$GL_FILES gl2ps.o"
      fi
    fi
  fi
fi

AC_SUBST(GL_LIBS)
AC_SUBST(GL_FILES)
AC_SUBST(GL_FLAGS)



#--------------------------------------------------------------------------------
# language
#--------------------------------------------------------------------------------

# language choice: ruby if --with-ruby and we can find a ruby pc file
#                  forth if --with-forth
#                  none if --without-extension-language
#                  s7 otherwise

XEN_LIBS=""
XEN_CFLAGS=""
ac_snd_extension_language=none

if test "$with_extension_language" = no ; then
  ac_snd_extension_language=no
  LOCAL_LANGUAGE="None"
fi


#--------------------------------------------------------------------------------
# Ruby
#--------------------------------------------------------------------------------

# Yuri suggests: ruby -r rbconfig -e 'C = RbConfig::CONFIG' -e 'puts C["ruby_version"]' | sed -E 's|([[:digit:]]+\.[[:digit:]]+).*|\1|'

if test "$with_ruby" = yes ; then
  if test x$PKG_CONFIG != xno ; then
    m4_foreach([ruby_version], [[ruby-2.6], [ruby-2.5], [ruby-2.4], [ruby-2.3], [ruby-2.2], [ruby-2.1], [ruby-2.0], [ruby], [ruby-1.9.3], [ruby-1.9], [ruby-1.8]],
      [
      if test "$ac_snd_extension_language" = none ; then
        if $PKG_CONFIG ruby_version --exists ; then
          AC_DEFINE(HAVE_RUBY)
          XEN_CFLAGS="-fPIC `$PKG_CONFIG ruby_version --cflags`"
          # this depends on building ruby itself with the --enable-shared flag
          XEN_LIBS="`$PKG_CONFIG ruby_version --libs`"
          LOCAL_LANGUAGE=Ruby-`$PKG_CONFIG ruby_version --modversion`
          ac_snd_extension_language=Ruby
          if test "$ac_snd_gui_choice" = gtk ; then
            S7_LIB="xg.o"
          else
            S7_LIB=""
          fi
          AC_SUBST(S7_LIB)
        fi
      fi
      ])
  fi
fi


#--------------------------------------------------------------------------------
# Forth
#--------------------------------------------------------------------------------

if test "$with_forth" = yes ; then
  AC_PATH_PROG([FTH], [fth], [no])
  AC_MSG_CHECKING([for Forth])
  if test "${FTH}" != no ; then
    XEN_CFLAGS=`${FTH} --no-init-file --eval .cflags`
    XEN_LIBS=`${FTH} --no-init-file --eval .libs`
    AC_MSG_RESULT([yes])
    AC_DEFINE(HAVE_FORTH)
    LOCAL_LANGUAGE="Forth"
    ac_snd_extension_language=Forth
    if test "$ac_snd_gui_choice" = gtk ; then
      S7_LIB="xg.o"
    else
      S7_LIB=""
    fi
    AC_SUBST(S7_LIB)
  else
    AC_MSG_RESULT([no])
  fi
fi


#--------------------------------------------------------------------------------
# s7 (the default)
#--------------------------------------------------------------------------------

if test "$with_s7" != no && test "$ac_snd_extension_language" = none ; then
  AC_DEFINE(HAVE_SCHEME)	
  ac_snd_extension_language=s7
  LOCAL_LANGUAGE="s7"
  if test "$ac_snd_gui_choice" = gtk ; then
    S7_LIB="s7.o libgtk_s7.o"
  else
    S7_LIB="s7.o"
  fi
  AC_SUBST(S7_LIB)
fi

AC_SUBST(XEN_LIBS)
AC_SUBST(XEN_CFLAGS)




#--------------------------------------------------------------------------------
# OGG, Flac, Speex, Mpeg, Timidity, TTA, Wavpack
# --------------------------------------------------------------------------------

AC_PATH_PROG(PATH_OGGDEC, oggdec, no) # OGG read
AC_PATH_PROG(PATH_OGGENC, oggenc, no) # OGG write

if test "$PATH_OGGDEC" != "no" ; then
  if test "$PATH_OGGENC" != "no" ; then
    AC_DEFINE(HAVE_OGG)
    AC_DEFINE_UNQUOTED(PATH_OGGDEC, "${PATH_OGGDEC}")
    AC_DEFINE_UNQUOTED(PATH_OGGENC, "${PATH_OGGENC}")
  fi
fi


AC_PATH_PROG(PATH_MPG123, mpg123, no) # MPEG read/write?

if test "$PATH_MPG123" != "no" ; then
  AC_DEFINE(HAVE_MPEG)
  AC_DEFINE_UNQUOTED(PATH_MPG123, "${PATH_MPG123}")
fi


AC_PATH_PROG(PATH_MPG321, mpg321, no) # MPEG read/write?

if test "$PATH_MPG321" != "no" ; then
  AC_DEFINE(HAVE_MPEG)
  AC_DEFINE(HAVE_MPG321)
  AC_DEFINE_UNQUOTED(PATH_MPG321, "${PATH_MPG321}")
fi


AC_PATH_PROG(PATH_SPEEXDEC, speexdec, no) # Speex read
AC_PATH_PROG(PATH_SPEEXENC, speexenc, no) # Speex write

if test "$PATH_SPEEXDEC" != "no" ; then
  if test "$PATH_SPEEXENC" != "no" ; then
    AC_DEFINE(HAVE_SPEEX)
    AC_DEFINE_UNQUOTED(PATH_SPEEXDEC, "${PATH_SPEEXDEC}")
    AC_DEFINE_UNQUOTED(PATH_SPEEXENC, "${PATH_SPEEXENC}")
  fi
fi


AC_PATH_PROG(PATH_FLAC, flac, no) # Flac read/write

if test "$PATH_FLAC" != "no" ; then
  AC_DEFINE(HAVE_FLAC)
  AC_DEFINE_UNQUOTED(PATH_FLAC, "${PATH_FLAC}")
fi


AC_PATH_PROG(PATH_TIMIDITY, timidity, no) # Timidity for .mid -> .wav

if test "$PATH_TIMIDITY" != "no" ; then
  AC_DEFINE(HAVE_TIMIDITY)
  AC_DEFINE_UNQUOTED(PATH_TIMIDITY, "${PATH_TIMIDITY}")
fi


AC_PATH_PROG(PATH_WAVPACK, wavpack, no)
AC_PATH_PROG(PATH_WVUNPACK, wvunpack, no)

if test "$PATH_WAVPACK" != "no" ; then
  if test "$PATH_WVUNPACK" != "no" ; then
    AC_DEFINE(HAVE_WAVPACK)
    AC_DEFINE_UNQUOTED(PATH_WAVPACK, "${PATH_WAVPACK}")
    AC_DEFINE_UNQUOTED(PATH_WVUNPACK, "${PATH_WVUNPACK}")
  fi
fi




#--------------------------------------------------------------------------------
# Audio
#--------------------------------------------------------------------------------

AUDIO_LIB=""
JACK_LIBS=""
JACK_FLAGS=""

if test "$with_audio" != no ; then

  if test "$with_pulseaudio" = yes ; then
    AC_DEFINE(MUS_PULSEAUDIO)
    AUDIO_LIB="-lpulse-simple -lpulse"
    AUDIO_SYSTEM=pulseaudio
  fi
  
  if test "$with_portaudio" = yes ; then
    AC_DEFINE(MUS_PORTAUDIO)
    AUDIO_SYSTEM=portaudio
    AUDIO_LIB="-lportaudio"
  fi

  if test "$with_jack" = yes ; then
    if test "$with_alsa" = yes ; then 
      AUDIO_SYSTEM=ALSA+JACK
    else
      AUDIO_SYSTEM=JACK
    fi
    AC_DEFINE(MUS_JACK)
    if test x$PKG_CONFIG != xno ; then
      if $PKG_CONFIG jack --exists ; then    
        JACK_LIBS="`$PKG_CONFIG jack --libs`"
        JACK_FLAGS="`$PKG_CONFIG jack --cflags`"
        if $PKG_CONFIG samplerate --exists ; then    
  	  JACK_LIBS="$JACK_LIBS `$PKG_CONFIG samplerate --libs`"
  	  JACK_FLAGS="$JACK_FLAGS `$PKG_CONFIG samplerate --cflags`"
        else
          JACK_LIBS="$JACK_LIBS -lsamplerate"
        fi
      else
        JACK_LIBS="-ljack -lsamplerate"
      fi
    else
      JACK_LIBS="-ljack -lsamplerate"
    fi
  JACK_LIBS="$JACK_LIBS -lpthread"
  fi

  if test "$with_alsa" = yes ; then
    AC_DEFINE(HAVE_ALSA)
    AUDIO_LIB="-lasound"
    if test "$with_jack" = yes ; then
      AUDIO_SYSTEM=ALSA+JACK
    else
      AUDIO_SYSTEM=ALSA
    fi
  fi

  if test "$with_oss" = yes ; then
    AC_DEFINE(HAVE_OSS)
    AUDIO_SYSTEM=OSS
  fi

  if test "$AUDIO_SYSTEM" = None ; then
    case "$host" in
      *-*-linux*) 
        AUDIO_SYSTEM=ALSA
        AC_DEFINE(HAVE_ALSA)
        AUDIO_LIB="-lasound"
	;;
      *-*-sunos4*) 
	AUDIO_SYSTEM=Sun
        ;;
      *-*-solaris*) 
	AUDIO_SYSTEM=Sun
        ;;
      *-*-hpux*) 
	AUDIO_SYSTEM=Hpux
        ;;
      *-*-bsdi*) 
	AC_DEFINE(HAVE_OSS)
	AUDIO_SYSTEM=OSS
        ;;
      *-*-freebsd*)
	AC_DEFINE(HAVE_OSS)
	AUDIO_SYSTEM=OSS
	;;
      *-*-openbsd*) 
	AUDIO_SYSTEM=OpenBSD
	AUDIO_LIB="-lsndio"
        ;;
      *-*-netbsd*) 
	AUDIO_SYSTEM=NetBSD
        ;;
      *-*-cygwin*)
	if test "$with_jack" != yes ; then 
	  AUDIO_SYSTEM=Windows
	fi
	;;
      *-*-mingw*)
	audio_system=Windows
	;;
      *-apple-*)
	if test "$with_jack" != yes ; then 
	  AUDIO_SYSTEM=MacOSX
	  AUDIO_LIB="-framework CoreAudio -framework CoreFoundation -framework CoreMIDI"
        else
          AUDIO_SYSTEM=JACK
	  JACK_LIBS="-framework CoreAudio -framework CoreServices -framework AudioUnit -L/usr/local/lib -ljack -lsamplerate"
          JACK_FLAGS="-I/usr/local/include"
	fi
	;;
    esac
  fi
fi

AC_MSG_CHECKING([for audio system])
AC_MSG_RESULT($AUDIO_SYSTEM)

if test "$AUDIO_SYSTEM" != None ; then
  AC_DEFINE(WITH_AUDIO)
fi

AC_SUBST(AUDIO_LIB)
AC_SUBST(JACK_LIBS)
AC_SUBST(JACK_FLAGS)



#--------------------------------------------------------------------------------
# compiler/loader flags
#--------------------------------------------------------------------------------

LIBS=""
LDSO_FLAGS=""
SO_FLAGS=""
SO_LD="ld"
# the SO_* stuff here is for consistency with the sndlib configure script

case "$host" in
  *-*-linux*) 
    LDSO_FLAGS="-shared"
    LIBS="$LIBS -lm -ldl"
    if test "$GCC" = yes ; then
      SO_FLAGS="-fPIC $SO_FLAGS"
      SO_LD="$CC"
    fi
    ;;

  *-*-kfreebsd*|*-*-gnu*)
      LDSO_FLAGS="-shared"
      LIBS="$LIBS -lm -ldl"
      if test "$GCC" = yes ; then
        SO_FLAGS="-fPIC $SO_FLAGS"
      fi

      AUDIO_SYSTEM=OSS

      if test "$with_jack" = yes ; then
             if test "$with_oss" != yes ; then
               AUDIO_SYSTEM=JACK
             fi
      fi

      case $AUDIO_SYSTEM in
          JACK)
              AC_DEFINE(HAVE_JACK_IN_LINUX)
              AC_DEFINE(HAVE_OSS)
              AUDIO_LIB="-lsamplerate"
              ;;
          OSS)
              AC_DEFINE(HAVE_OSS)
              AUDIO_SYSTEM=OSS
              ;;
      esac
      ;;

  *-*-sunos4*) 
    LIBS="$LIBS -lm"
    ;;

  *-*-solaris*) 
    LIBS="$LIBS -lm"
    LDSO_FLAGS="-G"
    ;;

  *-*-hpux*) 
    LDSO_FLAGS="+z -Ae +DA1.1"
    if test "$GCC" = yes ; then
      SO_FLAGS="-fPIC $SO_FLAGS"
    fi
    ;;

  *-*-bsdi*) 
    LIBS="$LIBS -lm"
    if test "$GCC" = yes ; then
      SO_FLAGS="-fPIC $SO_FLAGS"
    fi
    ;;

  *-*-freebsd*)
    LIBS="$LIBS -lm"
    if test "$GCC" = yes ; then
      SO_LD="$CC"
      SO_FLAGS="-fPIC $SO_FLAGS"
      CFLAGS="-fPIC $CFLAGS"
      LDSO_FLAGS="-shared"
    fi
    ;;

  *-*-openbsd*) 
    LIBS="$LIBS -lm"
    if test "$GCC" = yes ; then
      SO_LD="$CC"
      SO_FLAGS="-fPIC $SO_FLAGS"
      CFLAGS="-ftrampolines $CFLAGS"
      LDSO_FLAGS="-shared"
    fi
    ;;

  *-*-netbsd*) 
    LIBS="$LIBS -lm"
    if test "$GCC" = yes ; then
      SO_LD="$CC"
      SO_FLAGS="-fPIC $SO_FLAGS"
      LDSO_FLAGS="-shared"
    fi
    ;;

  *-*-mingw*)
    LIBS="$LIBS -lwinmm -lwsock32"
    LDFLAGS="$LDFLAGS -mwindows"
    SO_INSTALL=":"
    SO_LD=":"
    ;;

  *-apple-*)
    SO_LD="$CC"	
    LDSO_FLAGS="-dynamic -bundle -undefined suppress -flat_namespace"
    ;;
esac

AC_SUBST(LDSO_FLAGS)
AC_SUBST(SO_FLAGS)
AC_SUBST(SO_LD)


#--------------------------------------------------------------------------------
# webserver
#--------------------------------------------------------------------------------

WEBSERVER_LIBS=""
WEBSERVER_FILES=""

if test "$with_webserver" = yes ; then
  AC_DEFINE(ENABLE_WEBSERVER)

  WEBSERVER_FILES="s7webserver/s7webserver.o s7webserver/qhttpserver-master/lib/libqhttpserver.a"
  WEBSERVER_LIBS="`pkg-config --libs QtNetwork` -lstdc++"
  
  RANDOM_FEATURES="$RANDOM_FEATURES webserver"
fi

AC_SUBST(WEBSERVER_LIBS)
AC_SUBST(WEBSERVER_FILES)



#--------------------------------------------------------------------------------
# export-dynamic
#--------------------------------------------------------------------------------

CFLAGS="-O2 -I. $CFLAGS"
ORIGINAL_LDFLAGS="$LDFLAGS"

case "$host" in
  *-*-linux* | *-*-bsdi* | *-*-freebsd* | *-*-openbsd* | *-*-netbsd*) 
    if test "$CC" = "gcc" || test "$CC" = "g++" || test "$CC" = "cc" ; then
      LDFLAGS="$LDFLAGS -Wl,-export-dynamic"
    fi
esac



#--------------------------------------------------------------------------------
# disable-deprecated
#--------------------------------------------------------------------------------

if test "$enable_deprecated" = no ; then
  CFLAGS="-DGTK_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DCAIRO_DISABLE_DEPRECATED -DGSL_DISABLE_DEPRECATED -Wall $CFLAGS"
  AC_DEFINE(DISABLE_DEPRECATED)
fi


#--------------------------------------------------------------------------------
# pure-s7
#--------------------------------------------------------------------------------

if test "$with_pure_s7" = yes ; then
  CFLAGS="-DWITH_PURE_S7 $CFLAGS"
fi

#--------------------------------------------------------------------------------
# s7-history
#--------------------------------------------------------------------------------

if test "$with_s7_history" = yes ; then
  CFLAGS="-DWITH_HISTORY $CFLAGS"
fi

#--------------------------------------------------------------------------------
# s7-profiling
#--------------------------------------------------------------------------------

if test "$with_s7_profiling" = yes ; then
  CFLAGS="-DWITH_S7_PROFILE $CFLAGS"
fi



#--------------------------------------------------------------------------------
# output
#--------------------------------------------------------------------------------

AC_SUBST(INSTALL)
AC_SUBST(CFLAGS)
AC_SUBST(ORIGINAL_LDFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(MAKE_TARGET)
AC_OUTPUT

AC_MSG_RESULT([
  Options selected
  -------------------------
  Snd version ...........: $VERSION
  CFLAGS ................: $CFLAGS
  LDFLAGS ...............:$LDFLAGS
  LIBS...................: $LIBS
  prefix.................: ${prefix}
  extension language.....: $LOCAL_LANGUAGE
  audio system...........: $AUDIO_SYSTEM
  graphics toolkit.......: $GRAPHICS_TOOLKIT
  optional libraries.....:$OPTIONAL_LIBRARIES
  random features........:$RANDOM_FEATURES
  environs...............: $host $CC
])