configure.ac 23.1 KB
Newer Older
1
# Configuration script for Snd
2 3 4 5 6
#
# we now depend completely on pc (pkgconfig) files.
#   Motif apparently has none.
#   gmp, mpfr, and mpc deliberately have none!

7

8
AC_INIT(snd, 18.1, bil@ccrma.stanford.edu, ftp://ccrma-ftp.stanford.edu/pub/Lisp/snd-18.tar.gz)
9 10

AC_CONFIG_SRCDIR(snd.c)
11 12 13
AC_CANONICAL_HOST # needed by case $host below
AC_CONFIG_HEADERS(mus-config.h)
AC_CONFIG_FILES(makefile)
14
AC_PROG_CC
15 16

# AC_HEADER_STDC
17 18 19 20 21 22 23 24 25 26
AC_PROG_INSTALL

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

PACKAGE=Snd
27
VERSION=18.1
28 29 30

#--------------------------------------------------------------------------------
# configuration options
31 32
#   --with-motif          use Motif
#   --with-gtk            use Gtk+ (the default)
33 34 35
#   --with-alsa           use ALSA if possible (the default)
#   --with-oss            use OSS 
#   --with-jack           use Jack
36
#   --without-audio       stub out all audio
37
#   --with-gmp            include multiprecision arithmetic via gmp, mpfr, and mpc
38
#   --disable-deprecated  do not include any deprecated stuff (in gtk, motif, s7, sndlib, clm, etc)
39
#   --with-ladspa         include LADSPA plugin support (Linux)
40
#   --with-gui            make Snd with(out) any graphics support
41 42
#   --with-forth          use Forth as the extension language
#   --with-ruby           use Ruby as the extension language
43 44 45 46
#   --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
47 48 49 50
#   --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
51 52
#   --with-gl             include OpenGL support (default=no, Motif only)
#   --with-gl2ps          include gl2ps (Motif only)
53 54 55 56
#   --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
57
#   --with-portaudio      use portaudio
58
#   --with-webserver      use webserver
59 60 61


AC_ARG_WITH(gtk,         [  --with-gtk		  use Gtk+ to build Snd])
62
AC_ARG_WITH(gui,         [  --with-gui  	      	  make Snd with graphics support])
63 64
AC_ARG_WITH(gl,          [  --with-gl		  include OpenGL support, Motif only])
AC_ARG_WITH(gl2ps,       [  --with-gl2ps		  include gl2ps, Motif only])
65 66
AC_ARG_WITH(motif,	 [  --with-motif	  	  use libXm to build Snd])
AC_ARG_WITH(editres,     [  --with-editres	  include editres in xm])
67 68 69 70

AC_ARG_WITH(alsa,        [  --with-alsa		  use ALSA])
AC_ARG_WITH(oss,         [  --with-oss		  use OSS])
AC_ARG_WITH(jack,        [  --with-jack		  use JACK])
71
AC_ARG_WITH(ladspa,	 [  --with-ladspa  	  include support for LADSPA plugins, Linux only])
72 73 74 75 76 77 78
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])
79

80 81 82 83
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])

84 85 86
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])
87
AC_ARG_WITH(audio,       [  --without-audio         don't include any audio functionality])
88

89 90 91
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}"))
92
AC_ARG_WITH(weebserver,  [  --with-webserver 	  use webserver, default=no])
93

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

96

97
AC_C_BIGENDIAN
98
AC_CHECK_SIZEOF(void *)
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
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)
116
      OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES fftw-`$PKG_CONFIG fftw3 --modversion`"
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi
fi
AC_SUBST(FFTW_LIBS)
AC_SUBST(FFTW_CFLAGS)




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

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

135 136 137
GMP_LIBS=""

if test "$with_gmp" = yes ; then
138 139 140
  GMP_LIBS="-lgmp -lmpfr -lmpc -lm"  
  AC_DEFINE(WITH_GMP)
  OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES gmp mpfr mpc"
141 142 143 144 145 146 147 148 149 150 151 152
fi

AC_SUBST(GMP_LIBS)



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

GSL_LIBS=""
GSL_CFLAGS=""
153

154
if test "$with_gsl" != no; then
155 156 157 158 159 160
  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)
161
      OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES gsl-`$PKG_CONFIG gsl --modversion`"
162 163 164
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
165
    fi
166
  fi
167 168
fi

169 170 171 172
AC_SUBST(GSL_LIBS)
AC_SUBST(GSL_CFLAGS)


173

174 175 176 177
#--------------------------------------------------------------------------------
# Ladspa
#--------------------------------------------------------------------------------

178 179 180
if test "$with_ladspa" = yes ; then
  AC_DEFINE(HAVE_LADSPA)
  RANDOM_FEATURES="$RANDOM_FEATURES ladspa"
181 182 183
fi


184

185
#--------------------------------------------------------------------------------
186
# graphics
187 188
#--------------------------------------------------------------------------------

189 190 191 192
# 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
#           else no gui
193

194 195
XLIBS=""
XFLAGS=""
196

197 198
GX_FILES=""
GX_HEADERS=""
199

200 201 202 203 204
GTK_FILES=""
GTK_HEADERS=""
GTK_CFLAGS=""
GTK_LIBS=""
GTK_LD_LIBS=""
205

206
ac_snd_gui_choice=none
207

208 209 210 211 212
if test "$with_motif" = no && test "$with_gtk" = no ; then
  with_gui=no
fi

if test "$with_gui" = no ; then
213 214 215
  AC_DEFINE(USE_NO_GUI)
  GX_FILES="NO_GUI_O_FILES"
  GX_HEADERS="NO_GUI_HEADERS"
216 217
  ac_snd_gui_choice=no
fi
218 219


220 221 222
#--------------------------------------------------------------------------------
# X/Motif
#--------------------------------------------------------------------------------
223

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

226 227
if test "$with_motif" = yes ; then
  AC_PATH_XTRA
228

229 230 231 232 233 234 235 236 237 238 239
  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"
240

241 242
  GX_FILES="MOTIF_O_FILES"
  GX_HEADERS="SND_X_HEADERS"
243

244 245 246 247
  if test "$with_editres" = yes ; then
    AC_DEFINE(WITH_EDITRES)
    OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES editres"
    X_PRE_LIBS="$X_PRE_LIBS -lXmu"
248 249
  fi

250 251 252 253 254
  GTK_LIBS="$X_PRE_LIBS $X_POST_LIBS -lXpm"
  AC_DEFINE(USE_MOTIF)
  GRAPHICS_TOOLKIT="Motif"
  ac_snd_gui_choice=Motif
fi
255 256 257 258 259 260


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

261 262
if test "$ac_snd_gui_choice" = none ; then
  if test x$PKG_CONFIG != xno ; then
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284

     m4_foreach([gtk_version], [[gtk+-4.0], [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)
285
      fi
286
    fi
287 288
  fi
fi
289 290


291 292 293 294
#--------------------------------------------------------------------------------
# no GUI
#--------------------------------------------------------------------------------

295
if test "$ac_snd_gui_choice" = none ; then
296 297 298
  AC_DEFINE(USE_NO_GUI)
  GX_FILES="NO_GUI_O_FILES"
  GX_HEADERS="NO_GUI_HEADERS"
299 300 301 302 303 304 305 306
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
307 308
fi

309

310 311 312
AC_SUBST(XLIBS)
AC_SUBST(XFLAGS)

313 314 315
AC_SUBST(GX_FILES)
AC_SUBST(GX_HEADERS)

316 317 318 319 320
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LD_LIBS)


321

322

323 324 325 326 327 328 329
#--------------------------------------------------------------------------------
# OpenGL
#--------------------------------------------------------------------------------

GL_LIBS=""
GL_FILES=""
GL_FLAGS=""
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351

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
352 353 354 355 356 357 358 359 360
    fi
  fi
fi

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


361

362
#--------------------------------------------------------------------------------
363
# language
364 365
#--------------------------------------------------------------------------------

366 367 368 369
# 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
370

371 372 373
XEN_LIBS=""
XEN_CFLAGS=""
ac_snd_extension_language=none
374

375 376 377 378
if test "$with_extension_language" = no ; then
  ac_snd_extension_language=no
  LOCAL_LANGUAGE="None"
fi
379

380

381 382 383 384
#--------------------------------------------------------------------------------
# Ruby
#--------------------------------------------------------------------------------

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

387 388
if test "$with_ruby" = yes ; then
  if test x$PKG_CONFIG != xno ; then
389
    m4_foreach([ruby_version], [[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]],
390 391 392 393
      [
      if test "$ac_snd_extension_language" = none ; then
        if $PKG_CONFIG ruby_version --exists ; then
          AC_DEFINE(HAVE_RUBY)
394
          XEN_CFLAGS="-fPIC `$PKG_CONFIG ruby_version --cflags`"
395 396
          # this depends on building ruby itself with the --enable-shared flag
          XEN_LIBS="`$PKG_CONFIG ruby_version --libs`"
397
          LOCAL_LANGUAGE=Ruby-`$PKG_CONFIG ruby_version --modversion`
398
          ac_snd_extension_language=Ruby
399 400
        fi
      fi
401
      ])
402
  fi
403 404 405 406 407 408 409
fi


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

410 411 412 413 414 415 416 417 418 419 420 421 422
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
  else
    AC_MSG_RESULT([no])
  fi
423 424 425 426
fi


#--------------------------------------------------------------------------------
427
# s7 (the default)
428 429
#--------------------------------------------------------------------------------

430 431 432 433 434 435
if test "$with_s7" != no && test "$ac_snd_extension_language" = none ; then
  AC_DEFINE(HAVE_SCHEME)	
  ac_snd_extension_language=s7
  LOCAL_LANGUAGE="s7"
  S7_LIB="s7.o"
  AC_SUBST(S7_LIB)
436 437
fi

438 439
AC_SUBST(XEN_LIBS)
AC_SUBST(XEN_CFLAGS)
440 441 442 443 444




#--------------------------------------------------------------------------------
445
# OGG, Flac, Speex, Mpeg, Timidity, TTA, Wavpack
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
# --------------------------------------------------------------------------------

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)
472
  AC_DEFINE(HAVE_MPG321)
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
  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




#--------------------------------------------------------------------------------
520
# Audio
521 522
#--------------------------------------------------------------------------------

523 524 525 526 527 528 529 530
AUDIO_LIB=""
JACK_LIBS=""
JACK_FLAGS=""

if test "$with_audio" != no ; then

  if test "$with_pulseaudio" = yes ; then
    AC_DEFINE(MUS_PULSEAUDIO)
531
    AUDIO_LIB="-lpulse-simple -lpulse"
532 533 534 535 536 537 538
    AUDIO_SYSTEM=pulseaudio
  fi
  
  if test "$with_portaudio" = yes ; then
    AC_DEFINE(MUS_PORTAUDIO)
    AUDIO_SYSTEM=portaudio
    AUDIO_LIB="-lportaudio"
539 540
  fi

541 542 543 544 545 546 547 548 549 550 551 552 553 554
  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`"
555
        else
556
          JACK_LIBS="$JACK_LIBS -lsamplerate"
557
        fi
558 559
      else
        JACK_LIBS="-ljack -lsamplerate"
560
      fi
561 562
    else
      JACK_LIBS="-ljack -lsamplerate"
563
    fi
564
  JACK_LIBS="$JACK_LIBS -lpthread"
565 566
  fi

567 568 569 570 571 572 573 574 575
  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
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
  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
        ;;
      *-*-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
633

634 635
AC_MSG_CHECKING([for audio system])
AC_MSG_RESULT($AUDIO_SYSTEM)
636

637 638
if test "$AUDIO_SYSTEM" != None ; then
  AC_DEFINE(WITH_AUDIO)
639 640
fi

641 642 643 644
AC_SUBST(AUDIO_LIB)
AC_SUBST(JACK_LIBS)
AC_SUBST(JACK_FLAGS)

645 646 647


#--------------------------------------------------------------------------------
648
# compiler/loader flags
649 650
#--------------------------------------------------------------------------------

651 652 653 654 655
LIBS=""
LDSO_FLAGS=""
SO_FLAGS=""
SO_LD="ld"
# the SO_* stuff here is for consistency with the sndlib configure script
656

657 658 659 660 661 662 663 664 665
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
    ;;
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
  *-*-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
      ;;

695 696 697 698 699 700 701 702 703 704 705 706 707
  *-*-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"
708
    fi
709 710 711 712 713 714
    ;;

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

718 719 720 721 722 723 724 725 726
  *-*-freebsd*)
    LIBS="$LIBS -lm"
    if test "$GCC" = yes ; then
      SO_LD="$CC"
      SO_FLAGS="-fPIC $SO_FLAGS"
      CFLAGS="-fPIC $CFLAGS"
      LDSO_FLAGS="-shared"
    fi
    ;;
727

728 729 730 731 732 733 734 735 736
  *-*-openbsd*) 
    LIBS="$LIBS -lm"
    if test "$GCC" = yes ; then
      SO_LD="$CC"
      SO_FLAGS="-fPIC $SO_FLAGS"
      CFLAGS="-ftrampolines $CFLAGS"
      LDSO_FLAGS="-shared"
    fi
    ;;
737

738 739 740 741 742 743
  *-*-netbsd*) 
    LIBS="$LIBS -lm"
    if test "$GCC" = yes ; then
      SO_LD="$CC"
      SO_FLAGS="-fPIC $SO_FLAGS"
      LDSO_FLAGS="-shared"
744
    fi
745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762
    ;;

  *-*-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)
763 764


765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784
#--------------------------------------------------------------------------------
# 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)


785 786 787 788 789

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

790
CFLAGS="-O2 -I. $CFLAGS"
791 792
ORIGINAL_LDFLAGS="$LDFLAGS"

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

800 801 802


#--------------------------------------------------------------------------------
803
# disable-deprecated
804 805
#--------------------------------------------------------------------------------

806 807 808
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)
809 810
fi

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
#--------------------------------------------------------------------------------
# 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


837

838 839 840
#--------------------------------------------------------------------------------
# output
#--------------------------------------------------------------------------------
841

842
AC_SUBST(INSTALL)
843 844 845 846 847 848 849 850 851 852 853 854
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
855
  LIBS...................: $LIBS
856 857 858 859 860 861 862 863
  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
])
864