OSDN Git Service

[filter] Fix AVX builds
[timidity41/timidity41.git] / configure.in
1 dnl TiMidity++ -- MIDI to WAVE converter and player
2 dnl Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
3 dnl Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
4 dnl
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 2 of the License, or
8 dnl (at your option) any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; if not, write to the Free Software
17 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19 dnl configure.in created from configure.scan
20 dnl by URABE, Shyouhei <root@mput.dip.jp> on 2002.07.06
21
22 dnl variable note:
23 dnl CFLAGS      - Flags for compile.
24 dnl CPPFLAGS    - Flags for cpp
25 dnl LDFLAGS     - Flags for linker
26 dnl             ac_cpp:     $CPP $CPPFLAGS
27 dnl             ac_compile: ${CC-cc} -c $CFLAGS $CPPFLAGS
28 dnl             ac_link:    ${CC-cc} -o * $CFLAGS $CPPFLAGS $LDFLAGS *.c $LIBS
29 dnl EXTRACFLAGS - Extra flags to compile.  Adds to CFLAGS.
30 dnl EXTRADEFS   - Extra define macros. Adds to CPPFLAGS.
31 dnl EXTRALIBS   - Extra libraries  Adds to LIBS.
32 dnl SYSEXTRAS   - Additional source codes to compile.
33 dnl lib_*_opt   - Optional libraries. Adds to LIBS.
34 dnl LIBRARY_PATH
35 dnl             - add to -L LDFLAGS
36 dnl C_INCLUDE_PATH
37 dnl             - add to -I CPPFLAGS
38 dnl CYGNUS      - `yes' if cygnus windows environment.
39 dnl MSYS        - `yes' if Mingw windows environment.
40 dnl WISH        - wish
41 dnl TCLSH       - tclsh
42 dnl LN_S        - ln -s
43 dnl tcltk_dep   - make dependencies for tcl/tk interface
44 dnl
45 dnl so          - File extension of shared object library.
46 dnl SHLD        - Linker to make shared object library.
47 dnl SHLDFLAGS   - Link flags to link shared object library.
48 dnl SHCFLAGS    - Additional flags to compile shared object library.
49 dnl               (such as -fPIC)
50
51 # This is a autoscan-generated configure.scan.
52 # AC_PREREQ(2.56)
53
54 # "AC_INIT(timidity/timidity.c)" is obsolate yet.
55 AC_INIT([TiMidity++],[2.15.0],[timidity-talk@lists.sourceforge.net],[TiMidity++])
56 AC_CONFIG_AUX_DIR([autoconf])
57 AC_CANONICAL_TARGET
58 AM_INIT_AUTOMAKE([gnu dist-bzip2])
59 AC_CONFIG_SRCDIR([timidity/timidity.c])
60 AC_CONFIG_HEADERS([config.h interface.h])
61 AM_MAINTAINER_MODE
62
63 SHELL=${CONFIG_SHELL-"/bin/sh"}
64 WISH=${WISH-"wish"}
65 TCLSH=${TCLSH-"tclsh"}
66
67 dnl to use contains() macro (see autoconf/acinclude.m4)
68 CONTAINS_INIT
69
70 # Check for compiler options -- such as debug flags.
71
72 dnl "--enable-debug" turnes -g on.
73 AC_MSG_CHECKING(if --enable-debug option specified)
74 AC_ARG_ENABLE(debug,
75               AS_HELP_STRING([--enable-debug], [Build a debugging version.]),
76               [timidity_cv_debug="yes"], [timidity_cv_debug="no"])
77 if test "x$timidity_cv_debug" = xyes; then
78   AC_DEFINE(DEBUG,1,Define to 1 if you are in debug mode)
79   CFLAGS=${CFLAGS-"-g"}
80 fi
81 if test "x$timidity_cv_debug" = "xno"; then
82   AC_DEFINE(NDEBUG,1,Define to 1 if you are NOT in debug mode)
83 fi
84 AC_MSG_RESULT($timidity_cv_debug)
85
86 if test "x$CFLAGS" = "x"; then
87   NOCFLAGS="yes"
88 fi
89
90 dnl --with-x turns on if `--with-x' is NOT specified.
91 if test "x$with_x" = "x"; then
92   with_x=yes
93 else
94   x_config_flag=yes
95 fi
96
97 # Checking gcc environment
98 for i in `echo $LIBRARY_PATH|sed -e 's,:, ,g'`; do
99   LDFLAGS="$LDFLAGS -L${i}"
100 done
101 for i in `echo $C_INCLUDE_PATH|sed -e 's,:, ,g'`; do
102   CPPFLAGS="$CPPFLAGS -I${i}"
103 done
104
105 # add $prefix if specified.
106 if test "x$prefix" != xNONE -a "x$prefix" != "x$ac_default_prefix" -a "x$prefix" != "x/usr"; then
107   LDFLAGS="-L$prefix/lib $LDFLAGS"
108   SHLDFLAGS="-L$prefix/lib $SHLDFLAGS"
109   CPPFLAGS="-I$prefix/include $CPPFLAGS"
110 fi
111
112 dnl add --with-includes, --with-libraries
113 AC_ARG_WITH(includes,
114   AS_HELP_STRING([--with-includes=DIR], [Specify include directories (colon separated)]),
115   [ j=' '
116     for i in `echo "$withval"|sed -e 's,:, ,g'`; do
117       j="${j}-I${i} "
118     done
119     CPPFLAGS="$j$CPPFLAGS"
120   ])
121
122 AC_ARG_WITH(libraries,
123   AS_HELP_STRING([--with-libraries=DIR], [Specify library directories (colon separated)]),
124   [ j=' '
125     for i in `echo "$withval"|sed -e 's,:, ,g'`; do
126       j="${j}-L${i} "
127     done
128     LDFLAGS="$j$LDFLAGS"
129   ])
130
131
132 dnl a bit hairly yet.(20020718:mput)
133 dnl CPPFLAGS="$CPPFLAGS \$(DEF_PKGDATADIR) \$(DEF_PKGLIBDIR) \$(DEF_DEFAULT_PATH)"
134 AC_ARG_WITH(default-path,
135   AS_HELP_STRING([--with-default-path=DIR], [Where timidity.cfg is  (PREFIX/share/timidity)]),
136   [pkgdatadir=$withval],
137   [
138    if test "x$prefix" != "xNONE"; then
139       pkgdatadir='${prefix}/share/timidity'
140    else
141       pkgdatadir='/usr/local/share/timidity'
142    fi
143   ])
144 tmpdefpath="`eval \"echo ${pkgdatadir}\"`"
145 AC_DEFINE_UNQUOTED(DEFAULT_PATH,"$tmpdefpath",place to install patches)
146 AC_DEFINE(PKGDATADIR,DEFAULT_PATH,a compatibility matter. ignore it.)
147
148 AC_ARG_WITH(module-dir,
149   AS_HELP_STRING([--with-module-dir=DIR], [Where to install interfaces (PREFIX/lib/timidity)]),
150   [pkglibdir=$withval],
151   [
152    if test "x$prefix" != "xNONE"; then
153       pkglibdir='${prefix}/lib/timidity'
154    else
155       pkglibdir='/usr/local/lib/timidity'
156    fi
157   ])
158 tmplibdir="`eval \"echo ${pkglibdir}\"`"
159 AC_DEFINE_UNQUOTED(PKGLIBDIR,"$tmplibdir",place to install modules)
160
161 AC_ARG_WITH(xaw-resource-prefix,
162   AS_HELP_STRING([--with-xaw-resource-prefix=DIR], [What prefix to install X resource files to (optional, used by Xaw/Motif interfaces)]),
163   [xawresdir=$withval], [])
164 AM_CONDITIONAL(XAW_INSTALL_RESOURCE_FILES, test "x$xawresdir" != "x")
165 AC_SUBST(xawresdir)
166
167 # Checks for programs.
168 AM_PATH_LISPDIR
169 AC_PROG_CC
170 AC_PROG_GCC_TRADITIONAL
171 AC_PROG_INSTALL
172 AC_PROG_AWK
173 AC_CHECK_PROG([AR], [${ac_tool_prefix}ar], [${ac_tool_prefix}ar])
174 AC_PROG_RANLIB
175 AC_PROG_LN_S
176 AC_CHECK_PROG([WINDRES], [${ac_tool_prefix}windres], [${ac_tool_prefix}windres])
177 CHECK_COMPILER_OPTION(rdynamic)
178
179 if test "x$NOCFLAGS" = xyes; then
180   if test "x$GCC" = xyes; then
181     CFLAGS="-O2"
182   else
183     CFLAGS=""
184   fi
185 fi
186
187 # Checks for target dependencies
188
189 AC_ARG_WITH(elf,
190   AS_HELP_STRING([--with-elf], [create ELF shared object instead of AOUT]),
191   [ ELFFORMAT=$withval ], [ ELFFORMAT="yes" ])
192
193 # AC_ARG_WITH(simd,
194 #  AS_HELP_STRING([--with-simd], [create SIMD friendly binary (default is no) ]),
195 #  [ SIMD=$withval ], [ SIMD="no" ])
196
197 case "$target" in
198   *-*-hpux*)
199     EXTRADEFS="-DHPUX"
200     test -n "$SHLD" || SHLD="ld -b"
201     so="sl"
202     ;;
203   *-sgi-irix*)
204     dnl IRIX cc needs -signed option
205     case ".$CC" in .cc*) EXTRACFLAGS="-signed";; esac
206     test -n "$SHLD" || SHLD="cc -shared -all"
207     so="so"
208     ;;
209   *-*-netbsd*)
210     test -n "$SHLD" || SHLD="$CC -shared -nostartfiles"
211     so="so"
212     ;;
213
214   *-*-freebsd2*)
215     dnl EXTRALIBS="$EXTRALIBS -lxpg4"
216     test -n "$SHLD" || SHLD="ld -Bshareable"
217     so="so"
218     ;;
219   *-*-freebsd*)
220     if test "$ELFFORMAT" = yes; then
221         test -n "$SHLD" || SHLD="ld -Bshareable"
222     else
223         SHCFLAGS=-aou
224         SHLDFLAGS="-L/usr/X11R6/lib/aout $SHLDFLAGS"
225         test -n "$SHLD" || SHLD="env OBJFORMAT=aout ld -shared"
226     fi
227     dnl EXTRALIBS="$EXTRALIBS -lxpg4"
228     so="so"
229     ;;
230
231 #  *-*-freebsd*)
232 #    EXTRALIBS="$EXTRALIBS -lxpg4"
233 #    test -n "$SHLD" || SHLD="ld -Bshareable"
234 #    so="so"
235 #  ;;
236
237   *-*-cygwin*|*-*-mingw*)
238     case "$target" in
239       *-*-cygwin*)
240         CYGNUS=yes
241         ;;
242       *-*-mingw*)
243         MSYS=yes
244         ;;
245     esac
246     WIN32=yes
247     EXTRADEFS="-D__W32__"
248     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}"
249     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/speex"
250     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/rcpcv"
251     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/portaudio/pa_common"
252     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/portmidi/pm_common"
253     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/portmidi/porttime"
254     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/libao"
255     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/libmpg123/include"
256     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/opus"
257     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/pdcurses"
258     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/ogg"
259     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/vorbis"
260     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/OggFLAC"
261     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/FLAC"
262     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/gogo"
263     EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/Winamp"
264     CPPFLAGS="$CPPFLAGS -I. -I../cygwin/"
265     # ??
266     case "x${CC} " in
267       "xbcc32 "*|xbcc32) 
268 #        test -n "$SHLD" || SHLD="tlink32 -Tpd"
269         test -n "$SHLD" || SHLD="BCC32 -WD"
270         BORLANDC=yes
271         BORLANDC_LDFLAGS="kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib ws2_32.lib user32.lib shell32.lib cw32mt.lib"
272         BORLANDC_START='C0X32.OBJ'
273         CFLAGS="$CFLAGS  -tWM -VM"
274         EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32"
275         ;;
276       "xcc "*|xcc) 
277         test -n "$SHLD" || SHLD="polink -DLL"
278         POCC=yes
279          case " $CFLAGS " in
280            *" -MT "*)  NODEF="-nodefaultlib:pocrt.lib -nodefaultlib:crt.lib -defaultlib:crtmt.lib"  ;;
281            *" -MD "*)  NODEF="-nodefaultlib:crtmt.lib -nodefaultlib:crt.lib -defaultlib:pocrt.lib"  ;;
282            *) CFLAGS="$CFLAGS -MT"; NODEF="-nodefaultlib:pocrt.lib -nodefaultlib:crtmt.lib -defaultlib:crt.lib" ;;
283          esac
284         POCC_LDFLAGS="$NODEF winmm.lib ws2_32.lib user32.lib kernel32.lib shell32.lib gdi32.lib comctl32.lib comdlg32.lib ole32.lib advapi32.lib oldnames.lib"
285         CFLAGS="$CFLAGS -Ze -D__POCC__OLDNAMES"
286         EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32"
287         ;;
288       "xdmc "*|xdmc) 
289         test -n "$SHLD" || SHLD="dmc -WD"
290         DMC=yes
291         DMC_LDFLAGS="winmm.lib ws2_32.lib user32.lib kernel32.lib shell32.lib gdi32.lib comctl32.lib comdlg32.lib ole32.lib advapi32.lib"
292         CFLAGS="$CFLAGS  -mn -j0"
293         DLLFLAG=" "
294         EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32"
295         ;;
296       "xwcc386_w.sh "*|xwcc386)
297          WATCOM_C=yes
298          CFLAGS="$CFLAGS -br -bm -5s -zk0 -zp=16 -w=4 -D_WINDOWS -DWIN32 -DINCLUDE_WINDOWS_H"
299          DLLFLAG=" "
300          WATCOM_LDFLAGS=
301          EXTRALIBS="$EXTRALIBS kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib user32.lib shell32.lib"
302          ;;
303       "xcl "*|xcl) 
304          test -n "$SHLD" || SHLD="link -dll"
305          VCPP=yes
306          case " $CFLAGS " in
307            *" -MT "*)  NODEF="-nodefaultlib:msvcrt.lib -nodefaultlib:msvcrtd.lib -nodefaultlib:libcmtd.lib -nodefaultlib:libc.lib -nodefaultlib:libcd.lib"  ;;
308            *" -MD "*)  NODEF="-nodefaultlib:libcmt.lib -nodefaultlib:libcmtd.lib -nodefaultlib:msvcrtd.lib -nodefaultlib:libc.lib -nodefaultlib:libcd.lib"  ;;
309            *" -MTd "*) NODEF="-nodefaultlib:msvcrt.lib -nodefaultlib:msvcrtd.lib -nodefaultlib:libcmt.lib -nodefaultlib:libc.lib -nodefaultlib:libcd.lib"  ;;
310            *" -MDd "*) NODEF="-nodefaultlib:libcmt.lib -nodefaultlib:libcmtd.lib -nodefaultlib:msvcrt.lib -nodefaultlib:libc.lib -nodefaultlib:libcd.lib"  ;;
311            *) CFLAGS="$CFLAGS -MT"; NODEF="-nodefaultlib:msvcrt.lib -nodefaultlib:msvcrtd.lib -nodefaultlib:libcmtd.lib -nodefaultlib:libc.lib -nodefaultlib:libcd.lib"  ;;
312          esac
313          VCPP_LDFLAGS="-nologo -incremental:no  $NODEF kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib  ws2_32.lib user32.lib shell32.lib"
314          CFLAGS="$CFLAGS -nologo -Zp16 -W3 -GX  -Ob2"
315          EXTRADEFS="$EXTRADEFS -DNDEBUG -D_WINDOWS -DWIN32 -DMBCS -D_MT -YX  -FD -c"
316          ;;
317       x*gcc*) test -n "$SHLD" || SHLD="gcc -mdll"; MINGWGCC=yes ;;
318       *) test -n "$SHLD" || SHLD="unknown" ;;
319     esac
320     so="dll"
321     MSYS=yes
322     lib_user32_test=-luser32
323     ;;
324   *-dec-*)
325     EXTRADEFS="-DDEC"
326     test -n "$SHLD" || SHLD="ld -Bdynamic -G"
327     so="so"
328     ;;
329   *-*-solaris*)
330     EXTRADEFS="-DSOLARIS"
331     test -n "$SHLD" || SHLD="/usr/ccs/bin/ld -G"
332     so="so"
333     ;;
334   *-*-nextstep*)
335     test -n "$SHLD" || SHLD="/usr/ccs/bin/ld -G"
336     so="so"
337     ;;
338   *-*-darwin*)
339     if test "x$SIMD" = xyes; then
340        AC_DEFINE(USE_ALTIVEC,1,Define to 1 if you use altivec)
341        # EXTRACFLAGS="$EXTRACFLAGS -faltivec -mabi=altivec -maltivec" # for GCC3.
342        EXTRACFLAGS="$EXTRACFLAGS -faltivec"
343     else
344        AC_DEFINE(USE_ALTIVEC,0,Define to 1 if you use altivec)
345     fi
346     CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
347     LDOPTS="-dynamic -undefined suppress -flat_namespace $LDOPTS"
348     test -n "$SHLD" || SHLD="$CC -dynamic -bundle -undefined suppress -flat_namespace $LDFLAGS"
349     so="bundle"
350     ;;
351   *)
352     test -n "$SHLD" || \
353       if test "x$GCC" = xyes; then
354         SHLD="$CC -shared"
355       else
356         SHLD="ld -Bdynamic -G"
357       fi
358     so="so"
359     ;;
360 esac
361
362 dnl For .exe
363 dnl AC_EXEEX # obsolate
364
365 # Checks for libraries.
366 AC_CHECK_LIB(m,sqrt)
367 AC_CHECK_LIB(socket,socket)
368 AC_CHECK_LIB(dl,dlopen,lib_dl_opt=-ldl)
369 AC_CHECK_LIB(objc,NSLinkModule,lib_dl_opt=-lobjc) # Mac OS X need this.
370 if test "x$VCPP" != xyes && test "x$BORLANDC" != xyes && test "x$WATCOM_C" != xyes && test "x$POCC" != xyes; then
371 AC_CHECK_LIB(xpg4,setlocale) # Mac OS X (and maybe NetBSD) need this.
372 fi
373 AC_CHECK_FUNCS(gethostbyname,,[ AC_CHECK_LIB(nsl,gethostbyname) ])
374 AC_PATH_XTRA
375
376 dnl Xft for trace window
377 AC_ARG_ENABLE(xft,
378   AS_HELP_STRING([--enable-xft], [Enable use of Xft in X trace mode]))
379
380 AC_ARG_WITH(xawlib,
381   [  --with-xawlib=lib     Try to link to these xaw widget libraries by the
382                            order specified by the comma separated value list:
383                              xaw: libXaw
384                              xaw3d: Xaw3d
385                              neXtaw: neXtaw
386                              XawPlus: XawPlus
387                              default is --with-xawlib=xaw3d,xaw],
388   [ with_xawlib="$withval" ], [ with_xawlib="xaw3d,xaw" ])
389
390 # Checks for X
391 if test "x$with_x" = xyes; then
392   if test "x$have_x" = "xno"; then
393     if test "x$x_config_flag" = xyes; then
394       AC_MSG_ERROR(Could not configure X)
395     else
396       AC_MSG_WARN(Could not configure X)
397     fi
398   fi
399 fi
400 if test "x$with_x" = xyes -a "x$have_x" = xyes; then
401   if test "x$x_libraries" != "x"; then
402     ldflags_x_opt="-L$x_libraries"
403     LDFLAGS="$LDFLAGS $ldflags_x_opt"
404     SHLDFLAGS="$SHLDFLAGS $ldflags_x_opt"
405   else
406     ldflags_x_opt=
407   fi
408   if test "x$x_includes" != "x"; then
409     CPPFLAGS="$CPPFLAGS -I$x_includes"
410   fi
411
412   AC_CHECK_LIB(X11,XOpenDisplay,
413   AC_DEFINE(HAVE_LIBX11,1,Define to 1 if you have the `X11' library (-lX11).))
414   AC_MSG_CHECKING(X11 version 6)
415   AC_CACHE_VAL(timidity_cv_x11_version_6,
416     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[
417 #if XlibSpecificationRelease < 6
418 fail;
419 #endif
420 ]])],[timidity_cv_x11_version_6=yes],[timidity_cv_x11_version_6=no]))
421   if test "$timidity_cv_x11_version_6" = "yes"; then
422     AC_MSG_RESULT(6 or newer)
423     dnl AC_DEFINE(HAVE_X11R6)
424   else
425     AC_MSG_RESULT(before 6)
426   fi
427
428   dnl checking order required
429   KEEPLIBS=$LIBS
430   AC_CHECK_LIB(Xext,XShapeCombineMask,have_xext=yes; LIBS="-lXext $LIBS",have_xext=no)
431   AC_CHECK_LIB(ICE,IceConnectionNumber)
432   AC_CHECK_LIB(SM,SmcOpenConnection,have_xprelibs=yes; LIBS="-lSM $LIBS",have_xprelibs=no)
433   AC_CHECK_LIB(Xt,XtVaAppInitialize,have_xt=yes; LIBS="-lXt $LIBS",have_xt=no)
434   AC_CHECK_LIB(Xmu,XmuInternAtom,LIBS="-lXmu $LIBS")
435   AC_CHECK_FUNCS(XmuRegisterExternalAgent)
436   if test "x$enable_xft" = xyes; then
437     AC_CHECK_LIB(Xft,XftInit,
438                  AC_DEFINE(HAVE_LIBXFT,1,Define to 1 if you have the 'Xft' library.),
439                  enable_xft=no)
440   fi
441   for i in `echo $with_xawlib | sed 's/,/ /g'`; do
442   case "$i" in
443   "xaw")
444     AC_CHECK_LIB(Xaw,XawInitializeWidgetSet,have_xaw=yes,have_xaw=no)
445     ;;
446   "xaw3d") 
447     AC_CHECK_LIB(Xaw3d,XawInitializeWidgetSet,
448       [ have_xaw=3d;
449           AC_CHECK_HEADER(X11/Xaw3d/Tip.h,
450           AC_DEFINE(HAVE_XAW3D_TIP,1,Define to 1 if you have the <X11/Xaw3d/Tip.h> header file.),
451           )
452       ],
453       have_xaw=no
454     )
455     ;;
456   "neXtaw")
457     AC_CHECK_LIB(neXtaw,XawInitializeWidgetSet,have_xaw=next,have_xaw=no)
458     ;;
459   "XawPlus")
460     AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData)
461     AC_CHECK_LIB(XawPlus,XawInitializeWidgetSet,have_xaw=plus,have_xaw=no)
462     ;;
463   *)
464     have_xaw=no
465     ;;
466   esac
467   if test "x$have_xaw" != "xno"; then break; fi
468   done
469   AC_CHECK_LIB(Xm,XmCreateForm,have_xm=yes,have_xm=no)
470   AC_CHECK_FUNCS(XShmCreatePixmap)
471   LIBS=$KEEPLIBS
472 fi
473 dnl End of X configure
474
475 # Checks for header files.
476 AC_HEADER_STDC
477 #AC_HEADER_STDBOOL
478 AC_HEADER_SYS_WAIT
479 if test "x$WATCOM_C" != xyes ; then
480 AC_HEADER_TIME
481 fi
482 AC_HEADER_DIRENT
483 AC_CHECK_HEADERS( \
484   [arpa/inet.h \
485   errno.h \
486   getopt.h \
487   glob.h \
488   dlfcn.h \
489   dld.h \
490   fcntl.h \
491   inttypes.h \
492   limits.h \
493   machine/endian.h \
494   malloc.h \
495   memory.h \
496   netdb.h \
497   netinet/in.h \
498   nlist.h \
499   pthread.h \
500   pthreads.h \
501   stddef.h \
502   stdlib.h \
503   stdint.h \
504   string.h \
505   strings.h \
506   stropts.h \
507   soundcard.h \
508   alsa/asoundlib.h \
509   sys/asoundlib.h \
510   sys/audioio.h \
511   sys/awe_voice.h\
512   sys/ioctl.h \
513   sys/ipc.h \
514   sys/param.h \
515   sys/shm.h \
516   sys/socket.h \
517   sys/soundcard.h \
518   sys/param.h \
519   sys/time.h \
520   sys/types.h \
521   sys/stat.h \
522   sys/sysctl.h \
523   termios.h \
524   X11/Xlib.h])
525
526 if test "x$DMC" != xyes ; then
527 AC_CHECK_HEADERS([ \
528   unistd.h \
529   ])
530 fi
531
532 AC_CHECK_HEADERS(\
533   [X11/extensions/XShm.h X11/Xmu/ExtAgent.h],[],[],[
534 #ifdef HAVE_X11_XLIB_H
535 #include <X11/Xlib.h>
536 #endif
537   ])
538 AC_CHECK_HEADER(string.h,, [ AC_DEFINE(NO_STRING_H,1,Define to 1 if you do not have <string.h>.)])
539
540 # Checks for typedefs, structures, and compiler characteristics.
541 if test "x$WATCOM_C" != xyes ; then
542 AC_C_BIGENDIAN
543 fi
544 AC_C_CHAR_UNSIGNED
545 AC_C_CONST
546 AC_C_INLINE
547 AC_C_VOLATILE
548 AC_C_STRINGIZE
549 AC_C_PROTOTYPES
550 AC_STRUCT_TM
551 if test "x$DMC" != xyes ; then
552 AC_TYPE_SIZE_T
553 fi
554 if test "x$POCC" != xyes ; then
555 AC_TYPE_OFF_T
556 AC_TYPE_PID_T
557 fi
558
559 # Older versions of MinGW do not define ssize_t in sys/types
560 AC_MSG_CHECKING([for ssize_t])
561 AC_CACHE_VAL(ac_cv_type_$1,
562 [AC_EGREP_CPP([ssize_t@<:@^a-zA-Z_0-9@:>@],
563 [#include <sys/types.h>
564 #if STDC_HEADERS
565 #include <stdlib.h>
566 #include <stddef.h>
567 #endif], [ac_cv_type_ssize_t=yes], [ac_cv_type_ssize_t=no])])
568
569 AC_MSG_RESULT([$ac_cv_type_ssize_t])
570 if test $ac_cv_type_ssize_t = yes; then
571   AC_DEFINE(HAVE_SSIZE_T, 1,
572     [Define to 1 if the system has the type `ssize_t'.])
573 fi
574
575 dnl keyword "volatile" check
576 AC_CACHE_CHECK(volatile declaration,timidity_cv_type_volatile,
577   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[volatile int x]])],[timidity_cv_type_volatile=yes],[timidity_cv_type_volatile=no]))
578 if test $timidity_cv_type_volatile = no; then
579   AC_DEFINE(NO_VOLATILE,1,Define to 1 if you cannot use volatile keyword)
580 fi
581
582 dnl union usenum check
583 AC_CACHE_CHECK(union semun declaration,timidity_cv_type_union_semun,
584   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
585 #include <sys/types.h>
586 #include <sys/ipc.h>
587 #include <sys/sem.h>
588 ]], [[union semun x]])],[timidity_cv_type_union_semun=yes],[timidity_cv_type_union_semun=no]))
589 if test $timidity_cv_type_union_semun = yes; then
590   AC_DEFINE(HAVE_UNION_SEMUN,1,Define to 1 if you use semun keyword)
591 fi
592
593 dnl Cygnus and Mingw memory struct optiontest
594 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
595         case "x${CC}" in
596         "xgcc"*) 
597             msnative_struct=''
598             AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
599             if test -z "$ac_cv_prog_CC"; then
600                         our_gcc="$CC"
601                 else
602                         our_gcc="$ac_cv_prog_CC"
603                 fi
604                 case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
605                         2.)
606                 if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
607                         msnative_struct='-fnative-struct'
608                 fi
609                 ;;
610                         *)
611                 if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
612                         msnative_struct='-mms-bitfields'
613                 fi
614                 ;;
615                 esac
616                 if test x"$msnative_struct" = "x"; then
617                         AC_MSG_RESULT([no way])
618                         AC_MSG_WARN([produced binary will be incompatible with windows' GUI ])
619                 else
620                         CFLAGS="$CFLAGS $msnative_struct"
621                         CPPFLAGS="$CPPFLAGS $msnative_struct"
622                         AC_MSG_RESULT([${msnative_struct}])
623                 fi
624                 ;;
625         *) 
626                 ;;
627         esac
628 fi
629 dnl Cygnus Mingw32 mmsystem check
630 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
631   AC_CACHE_CHECK(Cygwin new mmsystem,timidity_cv_header_new_mmsystem,
632     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
633 #define _WIN32_WINDOWS 0x0400
634 #include <windows.h>
635 #include <mmsystem.h>
636 ]], [[return WOM_OPEN != 0x3BB]])],[timidity_cv_header_new_mmsystem=yes],[timidity_cv_header_new_mmsystem=no]))
637   if test $timidity_cv_header_new_mmsystem = yes; then
638     AC_DEFINE(HAVE_NEW_MMSYSTEM,1,Define to 1 if you have <mmsystem.h> file)
639   fi
640 fi
641
642 # Checks for library functions.
643 AC_FUNC_ERROR_AT_LINE
644 if test "x$DMC" != xyes ; then
645 AC_FUNC_FORK
646 fi
647 AC_FUNC_MEMCMP
648 if test "x$DMC" != xyes ; then
649 AC_FUNC_MMAP
650 fi
651 AC_FUNC_SETVBUF_REVERSED
652 AC_TYPE_SIGNAL
653 if test "x$GCC" == xyes; then
654 AC_DEFINE(VOID_SIGHANDLER)
655 fi
656 if test "x$VCPP" != xyes && test "x$BORLANDC" != xyes && test "x$WATCOM_C" != xyes && test "x$POCC" != xyes; then
657 AC_FUNC_VPRINTF
658 fi
659 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(HAVE_PTHREAD_CREATE,1,[Define to 1 if you have the `pthread_create' function.])])
660 AC_CHECK_FUNCS( \
661   [alarm \
662   dup2 \
663   floor \
664   fseeko \
665   ftello \
666   getcwd \
667   gethostbyname \
668   getopt \
669   gettimeofday \
670   getwd \
671   isatty \
672   memchr \
673   memmove \
674   memset \
675   mkstemp \
676   modf \
677   munmap \
678   popen \
679   pow \
680   select \
681   signal \
682   socket \
683   sleep \
684   vsnprintf \
685   snprintf \
686   sqrt \
687   strchr \
688   strdup \
689   strstr \
690   strerror \
691   strcasecmp \
692   strncasecmp \
693   strrchr \
694   strstr \
695   strtol \
696   strlcat \
697   strlcpy \
698   usleep])
699 if test "x$VCPP" = xyes; then
700   AC_DEFINE(RETSIGTYPE,int)
701   AC_DEFINE(HAVE_GETCWD,1)
702 fi
703 if test "x$POCC" = xyes; then
704   AC_DEFINE(HAVE_GETCWD,1)
705   AC_DEFINE(HAVE_GETHOSTBYNAME,1)
706   AC_DEFINE(HAVE_POPEN,1)
707   AC_DEFINE(HAVE_SELECT,1)
708   AC_DEFINE(HAVE_SNPRINTF,1)
709   AC_DEFINE(HAVE_STRDUP,1)
710   AC_DEFINE(HAVE_STRERROR,1)
711   AC_DEFINE(HAVE_STRCASECMP,1)
712   AC_DEFINE(HAVE_STRSTR,1)
713   AC_DEFINE(HAVE_SOCKET,1)
714   AC_DEFINE(HAVE_VSNPRINTF,1)
715   AC_DEFINE(HAVE_GETOPT,1)
716   AC_DEFINE(TIMID_VERSION,[$(PACKAGE_VERSION)],[for windows gui])
717 fi
718 if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then
719   AC_DEFINE(HAVE_GETHOSTBYNAME,1)
720   AC_DEFINE(HAVE_POPEN,1)
721   AC_DEFINE(popen,_popen,[for VC])
722   AC_DEFINE(pclose,_pclose,[for VC])
723   AC_DEFINE(HAVE_SELECT,1)
724   AC_DEFINE(HAVE_SNPRINTF,1)
725   AC_DEFINE(HAVE_STRDUP,1)
726   AC_DEFINE(HAVE_STRERROR,1)
727   AC_DEFINE(HAVE_STRNCASECMP,1)
728   AC_DEFINE(HAVE_STRSTR,1)
729   AC_DEFINE(snprintf,_snprintf,[for VC])
730   AC_DEFINE(HAVE_SOCKET,1)
731   AC_DEFINE(HAVE_VSNPRINTF,1)
732 dnl  AC_DEFINE(vsnprintf,_vsnprintf,[for VC])
733   AC_DEFINE(TIMID_VERSION,[$(PACKAGE_VERSION)],[for windows gui])
734 fi
735
736 AC_CHECK_FUNC(getopt_long,
737          AC_DEFINE([HAVE_GETOPT_LONG],1,[Define to 1 if you have `getopt_long' function])
738          tm_cv_needgetopt="no",
739          tm_cv_needgetopt="yes")
740 AM_CONDITIONAL([NEEDGETOPT], test "x$tm_cv_needgetopt" = xyes)
741
742 AC_CHECK_FUNC(open_memstream, [
743          AC_DEFINE([HAVE_OPEN_MEMSTREAM],1,[Define to 1 if you have `open_memstream' function])
744          ])
745
746 dnl ***
747 dnl *** va_copy checks (from GLIB)
748 dnl ***
749
750 AC_CACHE_CHECK([for an implementation of va_copy()],lib_cv_va_copy,[
751         AC_RUN_IFELSE([AC_LANG_SOURCE([[
752         #include <stdarg.h>
753         void f (int i, ...) {
754         va_list args1, args2;
755         va_start (args1, i);
756         va_copy (args2, args1);
757         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
758           exit (1);
759         va_end (args1); va_end (args2);
760         }
761         int main() {
762           f (0, 42);
763           return 0;
764         }]])],
765         [lib_cv_va_copy=yes],
766         [lib_cv_va_copy=no],
767         [lib_cv_va_copy=no])
768 ])
769
770 AC_CACHE_CHECK([for an implementation of __va_copy()],lib_cv___va_copy,[
771         AC_RUN_IFELSE([AC_LANG_SOURCE([[
772         #include <stdarg.h>
773         void f (int i, ...) {
774         va_list args1, args2;
775         va_start (args1, i);
776         __va_copy (args2, args1);
777         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
778           exit (1);
779         va_end (args1); va_end (args2);
780         }
781         int main() {
782           f (0, 42);
783           return 0;
784         }]])],
785         [lib_cv___va_copy=yes],
786         [lib_cv___va_copy=no],
787         [lib_cv___va_copy=no])
788 ])
789
790 if test "x$lib_cv_va_copy" = xyes; then
791   va_copy_func=va_copy
792 else if test "x$lib_cv___va_copy" = xyes; then
793   va_copy_func=__va_copy
794 fi
795 fi
796
797 if test -n "$va_copy_func"; then
798   AC_DEFINE_UNQUOTED(VA_COPY,$va_copy_func,[A 'va_copy' style function])
799 fi
800
801 AC_CACHE_CHECK([whether va_lists can be copied by value],lib_cv_va_val_copy,[
802         AC_RUN_IFELSE([AC_LANG_SOURCE([[
803         #include <stdarg.h>
804         void f (int i, ...) {
805         va_list args1, args2;
806         va_start (args1, i);
807         args2 = args1;
808         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
809           exit (1);
810         va_end (args1); va_end (args2);
811         }
812         int main() {
813           f (0, 42);
814           return 0;
815         }]])],
816         [lib_cv_va_val_copy=yes],
817         [lib_cv_va_val_copy=no],
818         [lib_cv_va_val_copy=no])
819 ])
820
821 if test "x$lib_cv_va_val_copy" = "xno"; then
822   AC_DEFINE(VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
823 fi
824
825 # Checks on cygnus and MYSYS
826 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
827   case "$ac_cv_header_dirent_dirent_h$ac_cv_header_dirent_sys_ndir_h$ac_cv_header_dirent_sys_dir_h$ac_cv_header_dirent_ndir_h" in
828   *yes*)
829     AC_CHECK_FUNC(opendir,,
830   [ EXTRADEFS="$EXTRADEFS -D__W32READDIR__"
831     W32READDIR=yes ])
832     ;;
833   *)EXTRADEFS="$EXTRADEFS -D__W32READDIR__"
834     W32READDIR=yes
835     ;;
836   esac
837   if test "x$enable_network" = "xyes"; then
838     if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes || test "x$DMC" = xyes || test "x$POCC" = xyes; then
839       EXTRALIBS="$EXTRALIBS  ws2_32.lib"
840       EXTRADEFS="$EXTRADEFS -DWINSOCK" 
841     else
842       AC_CHECK_FUNC(socket,,
843        WAPI_CHECK_LIB(ws2_32,WSAStartup,
844          [#include <winsock.h>],
845          [WSAStartup(0,0);],
846          [ EXTRALIBS="$EXTRALIBS -lws2_32"
847           EXTRADEFS="$EXTRADEFS -DWINSOCK" ]
848        )
849       )
850     fi
851   fi
852 fi
853
854 # Checks on extra paths
855
856 dnl tcltk paths
857 AC_ARG_WITH(tcl-includes,
858   AS_HELP_STRING([--with-tcl-includes=DIR], [Tcl include file path]),
859   [ if test ! -d $withval; then
860       AC_MSG_WARN($withval is not found.)
861     fi
862     tcl_include_dir="-I$withval"
863   ])
864 AC_ARG_WITH(tcl-libs,
865   AS_HELP_STRING([--with-tcl-libs=DIR], [Tcl library file path]),
866   [ if test ! -d $withval; then
867       AC_MSG_WARN($withval is not found.)
868     fi
869     tcl_libdir="-L$withval" ])
870 AC_ARG_WITH(tk-includes,
871   AS_HELP_STRING([--with-tk-includes=DIR], [Tk include file path]),
872   [ if test ! -d $withval; then
873       AC_MSG_WARN($withval is not found.)
874     fi
875     tk_includes="-I$withval" ])
876 AC_ARG_WITH(tk-libs,
877   AS_HELP_STRING([--with-tk-libs=DIR], [Tk library file path]),
878   [ if test ! -d $withval; then
879       AC_MSG_WARN($withval is not found.)
880     fi
881     tk_libdir="-L$withval" ])
882
883 dnl offix paths
884 AC_ARG_WITH(offix-includes,
885   AS_HELP_STRING([--with-offix-includes=DIR], [Offix include file path]),
886   [ if test ! -d $withval; then
887       AC_MSG_WARN($withval is not found.)
888     fi
889     offix_include_dir="-I$withval" ])
890 AC_ARG_WITH(offix-libs,
891   AS_HELP_STRING([--with-offix-libs=DIR], [Offix include file path]),
892   [ if test ! -d $withval; then
893       AC_MSG_WARN($withval is not found.)
894     fi
895     offix_lib_dir="-L$withval" ])
896
897 # audio encoder/decoder libraries
898
899 dnl ogg's vorbis
900 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
901   have_ogg=yes
902   have_vorbis=yes
903   AC_DEFINE(HAVE_OGG,1, [Define to 1 if you have the <ogg/ogg.h> header file.])
904   AC_DEFINE(HAVE_LIBVORBIS,1, [Define to 1 if you have the <vorbis/codec.h> header file.])
905 else
906   XIPH_PATH_OGG([
907     have_ogg=yes
908     AC_DEFINE(HAVE_OGG,1, [Define to 1 if you have the <ogg/ogg.h> header file.])
909     XIPH_PATH_VORBIS([
910       have_vorbis=yes
911       AC_DEFINE(HAVE_LIBVORBIS,1, [Define to 1 if you have the <vorbis/codec.h> header file.])
912     ],[
913       have_vorbis=no
914     ])
915   ],[
916     have_ogg=no
917   ])
918 fi
919
920 dnl FLAC
921 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
922   have_flac=yes
923   AC_DEFINE(HAVE_LIBFLAC,1, [Define to 1 if you have the <FLAC/all.h> header file.])
924 else
925   AC_CHECK_HEADER(FLAC/all.h, [ 
926     have_flac=yes
927     AC_DEFINE(HAVE_LIBFLAC,1, [Define to 1 if you have the <FLAC/all.h> header file.])
928   ],[
929     have_flac=no
930   ])
931 fi
932
933 dnl OggFLAC
934 dnl if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
935 dnl   have_oggflac=yes
936 dnl   AC_DEFINE(HAVE_LIBOGGFLAC,1, [Define to 1 if you have the <OggFLAC/all.h> header file.])
937 dnl else
938 dnl   AC_CHECK_HEADER(OggFLAC/all.h, [ 
939 dnl     have_oggflac=yes
940 dnl     AC_DEFINE(HAVE_LIBOGGFLAC,1, [Define to 1 if you have the <OggFLAC/all.h> header file.])
941 dnl   ],[
942 dnl    have_oggflac=no
943 dnl  ])
944 dnl fi
945
946 dnl GoGo-No-Coda
947 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
948   have_libgogo=yes
949   AC_DEFINE(HAVE_LIBGOGO,1, [Define to 1 if you have the <gogo/gogo.h> header file.])
950 else
951   AC_CHECK_HEADER(gogo/gogo.h, [ 
952     have_libgogo=yes
953     AC_DEFINE(HAVE_LIBGOGO,1, [Define to 1 if you have the <gogo/gogo.h> header file.])
954   ],[
955     have_libgogo=no
956   ])
957 fi
958
959 dnl mpg123
960 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
961   have_mpg123=yes
962   AC_DEFINE(HAVE_LIBMPG123,1, [Define to 1 if you have the <mpg123.h> header file.])
963 else
964   AC_CHECK_HEADER(mpg123.h, [ 
965     have_mpg123=yes
966     AC_DEFINE(HAVE_LIBMPG123,1, [Define to 1 if you have the <mpg123.h> header file.])
967     EXTRALIBS="$EXTRALIBS -lmpg123"
968   ],[
969     have_mpg123=no
970   ])
971 fi
972
973
974 #
975 # audio section
976 #
977 dnl default(d):  auto selection
978 dnl oss(d):      OSS /dev/dsp
979 dnl alsa(d):     ALSA pcm device
980 dnl sun(d):      SunOS /dev/audio
981 dnl hpux(d):     HPUX /dev/audio
982 dnl irix(d):     IRIX audio
983 dnl mme(d):      OSF/1 MME
984 dnl sb_dsp(d):   BSD/OS 2.0 /dev/sb_dsp
985 dnl w32(d):      Windows MMS
986 dnl darwin(d):   Mac OS X pcm device
987 dnl alsa(s):     ALSA pcm device
988 dnl alib(A):     HPUX network audio (Alib)
989 dnl nas(n):      Network Audio System
990 dnl arts(R):     aRts
991 dnl esd(e):      EsounD
992 dnl portaudio(p) PortAudio
993 dnl portaudio(O) PortAudio (w32; DirectSound)
994 dnl portaudio(P) PortAudio (w32; WDM KernelStreaming)
995 dnl portaudio(K) PortAudio (w32; WDM KernelStreaming)
996 dnl portaudio(W) PortAudio (w32; WASAPI)
997 dnl w32ks(k):    Windows WDM KernelStreaming
998 dnl w32wasapi(x) Windows WASAPI
999 dnl npipe(N):    Windows named pipe
1000 dnl vorbis(v):   Ogg Vorbis
1001 dnl flac(F):     FLAC / OggFLAC
1002 dnl opus(U):     Ogg Opus
1003 dnl speex(S):    Ogg Speex
1004 dnl gogo(g):     MP3 GOGO
1005 dnl lame(L):     LAME
1006 dnl jack(j):     JACK
1007 dnl ao(O):       Libao
1008 dnl benchmark(b) Benchmark
1009 dnl macintosh(m) Macintosh pcm device
1010 dnl macqt(q):    Macintosh QuickTime pcm device
1011 dnl aiff(a):     output AIFF audio file
1012 dnl sun(u):      output Sun audio file
1013 dnl raw(r):      output raw sound data
1014 dnl volumecalc(V) output analyze text
1015 dnl wave(w):     output RIFF WAVE sound data
1016
1017 audio_targets='default oss alsa sun hpux irix mme sb_dsp w32 w32ks w32wasapi alib nas arts esd vorbis flac opus lame gogo portaudio npipe jack ao'
1018
1019 AC_ARG_WITH(nas-library,
1020   AS_HELP_STRING([--with-nas-library=library], [NAS absolute library path(Don't use -laudio)]))
1021 AC_ARG_WITH(nas-includes,
1022   AS_HELP_STRING([--with-nas-includes=DIR], [NAS include files are in dir]))
1023
1024
1025 AC_ARG_ENABLE(audio,
1026   [  --enable-audio[=mode_list] Enable audio (Specify comma separated mode list):
1027                               default:   Automatically select audio device.
1028                               oss:       OSS /dev/dsp
1029                               sun:       SunOS /dev/audio
1030                               hpux:      HPUX /dev/audio
1031                               irix:      IRIX audio library
1032                               mme:       OSF/1 MME
1033                               sb_dsp:    BSD/OS 2.0 /dev/sb_dsp
1034                               w32:       Windows MMS
1035                               w32ks:     Windows WDM KernelStreaming
1036                               w32wasapi: Windows WASAPI
1037                               darwin:    Darwin CoreAudio
1038                               alsa:      ALSA pcm device
1039                               alib:      HPUX network audio (Alib)
1040                               nas:       NAS - Network Audio System
1041                               arts:      aRts
1042                               esd:       EsounD - Enlightened Sound Daemon
1043                               portaudio: PortAudio
1044                               npipe:     Named Pipe(windows)
1045                               jack:      JACK
1046                               ao:        Libao
1047                               vorbis:    Ogg Vorbis
1048                               flac:      FLAC / OggFLAC
1049                               opus:      Ogg Opus
1050                               speex:     Ogg Speex
1051                               gogo:      MP3 GOGO (Only Windows is supported)
1052                               lame:      LAME (Only Windows is supported)
1053                               benchmark: Benchmark
1054 ],
1055   [ enable_audio=$enableval
1056     have_audio_opt=yes ],
1057   [ enable_audio=yes
1058     have_audio_opt=no ])
1059
1060 dnl yes -> default
1061 test "x$enable_audio" = xyes && enable_audio=default
1062
1063 if test "x$enable_audio" != "xno"; then
1064   for i in `echo $enable_audio | sed 's/,/ /g'`; do
1065     eval "au_enable_$i=yes"
1066   done
1067 fi
1068
1069 dnl Turn on default output mode
1070 DEFAULT_PLAYMODE=
1071 AC_ARG_WITH(default-output,
1072   AS_HELP_STRING([--with-default-output=<mode>],
1073   [Specify default output mode (optional):
1074                                 (default|alsa|alib|arts|nas|
1075                                 esd|wav|au|aiff|list|vorbis|flac|opus|speex|
1076                                 lame|gogo|portaudio|npipe|jack|ao)]),
1077   [ if test "$enable_audio" != no; then
1078     DEFAULT_PLAYMODE=$withval
1079     eval "au_enable_$DEFAULT_PLAYMODE=yes"
1080   else
1081     AC_MSG_WARN([--with-default-output=$withval: audio is not enabled])
1082   fi])
1083
1084 dnl compatibility matters.
1085 dnl AC_ARG_ENABLE(esd,
1086 dnl   [  --enable-esd         EsounD (Obsoleted.  Use --enable-audio=esd)],
1087 dnl   [ au_enable_esd=$enableval ])
1088 dnl AC_ARG_ENABLE(nas,
1089 dnl   [  --enable-nas         NAS  (Obsoleted.  Use --enable-audio=nas)],
1090 dnl   [ au_enable_nas=$enableval ])
1091 dnl AC_ARG_ENABLE(alsa,
1092 dnl   [  --enable-alsa        ALSA   (Obsoleted.  Use --enable-audio=alsa)],
1093 dnl   [ au_enable_alsa=$enableval ])
1094
1095 dnl target-specific defaults
1096 if test "x$au_enable_default" = xyes; then
1097   case "$target" in
1098   *-*-linux*)
1099     au_enable_alsa=yes
1100     if test "x$DEFAULT_PLAYMODE" = "x"; then
1101       DEFAULT_PLAYMODE="alsa"
1102     fi
1103     ;;
1104   *-*-freebsd*)
1105     au_enable_oss=yes
1106     ;;
1107   *-*-bsdi2.0)
1108     au_enable_sb_dsp=yes
1109     ;;
1110   *-*-bsdi2.1|*-*-bsdi3.?|*-*-bsdi4.?)
1111     au_enable_oss=yes
1112     ;;
1113   *-*-hpux*)
1114     au_enable_hpux=yes
1115     ;;
1116   *-dec-*)
1117     au_enable_mme=yes
1118     ;;
1119   *irix*)
1120     au_enable_irix=yes
1121     ;;
1122   *-*-sunos4*)
1123     au_enable_sun=yes
1124     ;;
1125   *-*-solaris*)
1126     au_enable_sun=yes
1127     ;;
1128   *-*-netbsd*)
1129     au_enable_sun=yes
1130     ;;
1131   *-*-openbsd*)
1132     au_enable_sun=yes
1133     ;;
1134   *-*-cygwin*)
1135     au_enable_w32=yes
1136     ;;
1137   *-*-mingw*)
1138     au_enable_w32=yes
1139     ;;
1140   *-*-darwin*)
1141     au_enable_darwin=yes
1142     ;;
1143   *)
1144     AC_MSG_WARN(No --enable-audio=default audio for $target)
1145     ;;
1146   esac
1147 fi
1148
1149
1150 # Each audio mode's configurations
1151 dnl oss
1152 AC_MSG_CHECKING(enable_audio=oss)
1153 if test "x$au_enable_oss" = xyes; then
1154   EXTRADEFS="$EXTRADEFS -DAU_OSS"
1155   SYSEXTRAS="$SYSEXTRAS oss_a.c"
1156   if test "x$ac_cv_header_sys_soundcard_h" = xyes; then
1157     AC_MSG_RESULT(yes - <sys/soundcard.h>)
1158   else
1159     case "$target" in
1160       *linux*|*freebsd*)
1161         dnl <linux/soundcard.h> or <machine/soundcard.h>
1162         AC_MSG_RESULT(yes)
1163         ;;
1164       *)
1165         if test "x$ac_cv_header_soundcard_h" = xyes; then
1166           AC_MSG_RESULT(yes - <soundcard.h>)
1167         else
1168           AC_MSG_WARN(<sys/soundcard.h> is not found)
1169         fi
1170         ;;
1171     esac
1172   fi
1173   AC_CHECK_LIB(ossaudio,open)
1174
1175   dnl Why OpenBSD use /dev/audio instead of /dev/dsp for OSS
1176   case "$target" in
1177     *openbsd*)
1178       if test ! -e "/dev/dsp"; then
1179         oss_device=/dev/audio
1180       fi
1181       ;;
1182   esac
1183 else
1184   AC_MSG_RESULT(no)
1185 fi
1186
1187 dnl SunOS's
1188 AC_MSG_CHECKING(enable_audio=sun)
1189 if test "x$au_enable_sun" = xyes; then
1190   case "$target" in
1191     *-*-sunos4*)
1192       if test -f /usr/demo/SOUND/libaudio.a; then
1193         EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/libaudio.a"
1194         AC_MSG_RESULT(yes)
1195       else
1196         AC_MSG_RESULT(Notice: libaudio.a is not found [(ignore)])
1197       fi
1198       ;;
1199     *-*-solaris*)
1200       if test -f /usr/demo/SOUND/lib/libaudio.a; then
1201         EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/lib/libaudio.a"
1202         AC_MSG_RESULT(yes)
1203       else
1204         AC_MSG_RESULT(Notice: libaudio.a is not found [(ignore)])
1205       fi
1206       ;;
1207     *)   AC_MSG_RESULT(yes)
1208       ;;
1209   esac
1210   EXTRADEFS="$EXTRADEFS -DAU_SUN"
1211   SYSEXTRAS="$SYSEXTRAS sun_a.c"
1212 else
1213   AC_MSG_RESULT(no)
1214 fi
1215
1216 dnl HP-UX's
1217 AC_MSG_CHECKING(enable_audio=hpux)
1218 if test "x$au_enable_hpux" = xyes; then
1219   case "$target" in
1220     *-*-hpux*) AC_MSG_RESULT(yes) ;;
1221     *) AC_MSG_WARN(may not work on $target) ;;
1222   esac
1223   EXTRADEFS="$EXTRADEFS -DAU_HPUX_AUDIO"
1224   SYSEXTRAS="$SYSEXTRAS hpux_d_a.c"
1225 else
1226   AC_MSG_RESULT(no)
1227 fi
1228
1229 dnl Irix's
1230 AC_MSG_CHECKING(enable_audio=irix)
1231 if test "x$au_enable_irix" = xyes; then
1232   case "$target" in
1233     *-sgi-irix5*|*-sgi-irix6.2)
1234       EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_OLDAL"
1235       AC_MSG_RESULT(yes)
1236       ;;
1237     *-sgi-irix6*)
1238       EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_NEWAL"
1239       AC_MSG_RESULT(yes)
1240       ;;
1241     *) AC_MSG_WARN(may not work on $target) ;;
1242   esac
1243   SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_al.c"
1244   EXTRALIBS="$EXTRASLIBS -laudio"
1245 else
1246   AC_MSG_RESULT(no)
1247 fi
1248
1249 dnl OSF/1 MME
1250 AC_MSG_CHECKING(enable_audio=mme)
1251 if test "x$au_enable_mme" = xyes; then
1252   case "$target" in
1253     *-dec-*) AC_MSG_RESULT(yes) ;;
1254     *) AC_MSG_WARN(may not work on $target) ;;
1255   esac
1256   EXTRADEFS="$EXTRADEFS -DAU_DEC -DAU_AUDRIV"
1257   SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_mme.c"
1258   CPPFLAGS="$CPPFLAGS -I/usr/opt/MME210/include"
1259   EXTRALIBS="$EXTRALIBS /usr/opt/MME220/lib/libmme.a"
1260 else
1261   AC_MSG_RESULT(no)
1262 fi
1263
1264 dnl BSD/OS's sb_dsp
1265 AC_MSG_CHECKING(enable_audio=sb_dsp)
1266 if test "x$au_enable_sb_dsp" = xyes; then
1267   case "$target" in
1268     *-*-bsdi2.0) AC_MSG_RESULT(yes) ;;
1269     *) AC_MSG_WARN(may not work on $target) ;;
1270   esac
1271   EXTRADEFS="$EXTRADEFS -DAU_BSDI -DDEFAULT_RATE=22500"
1272   SYSEXTRAS="$SYSEXTRAS bsd20_a.c"
1273 else
1274   AC_MSG_RESULT(no)
1275 fi
1276
1277 dnl Windows' MME
1278 AC_MSG_CHECKING(enable_audio=w32)
1279 if test "x$au_enable_w32" = xyes; then
1280   case "$target" in
1281     *-*-cygwin*)
1282      AC_MSG_RESULT(yes)
1283      ;;
1284     *-*-mingw*)
1285      AC_MSG_RESULT(yes)
1286      ;;
1287     *)
1288      AC_MSG_WARN(may not work on $target)
1289      ;;
1290   esac
1291   SYSEXTRAS="$SYSEXTRAS w32_a.c"
1292   if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes || test "x$DMC" = xyes || test "x$POCC" = xyes; then
1293     EXTRALIBS="$EXTRALIBS winmm.lib"
1294   else
1295     EXTRALIBS="$EXTRALIBS -lwinmm"
1296   fi
1297   EXTRADEFS="$EXTRADEFS -DAU_W32"
1298 else
1299   AC_MSG_RESULT(no)
1300 fi
1301
1302 dnl Mac OS X / darwin-x86
1303 AC_MSG_CHECKING(enable_audio=darwin)
1304 if test "x$au_enable_darwin" = xyes; then
1305   EXTRADEFS="$EXTRADEFS -DAU_DARWIN"
1306   SYSEXTRAS="$SYSEXTRAS darwin_a.c"
1307   EXTRALIBS="$EXTRALIBS -framework CoreAudio"
1308   dnl just say yes or no :-P
1309   case "$target" in
1310     *-*-darwin*)
1311      AC_MSG_RESULT(yes);;
1312    *)
1313      AC_MSG_WARN(may not work on $target)
1314      ;;
1315   esac
1316 else
1317   AC_MSG_RESULT(no)
1318 fi
1319
1320
1321 dnl alsa - Advanced Linux Sound Architecture
1322 AC_MSG_CHECKING(enable_audio=alsa)
1323 if test "x$au_enable_alsa" = xyes; then
1324   AC_MSG_RESULT([yes, configuring alsa])
1325   KEEPCFLAGS=$CFLAGS
1326   KEEPLIBS=$LIBS
1327   KEEPLDFLAGS=$LDFLAGS
1328   AM_PATH_ALSA()
1329   if test "x$alsa_found" = xyes ; then
1330     dnl AC_MSG_RESULT(yes)
1331     EXTRADEFS="$EXTRADEFS -DAU_ALSA"
1332     SYSEXTRAS="$SYSEXTRAS alsa_a.c"
1333     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ALSA_CFLAGS)
1334     LIBS="$LIBS $ALSA_LIBS"
1335     AC_CHECK_FUNCS(snd_seq_port_info_set_timestamping)
1336   else
1337     AC_MSG_WARN(Couldn't configure alsa.)
1338     CFLAGS=$KEEPCFLAGS
1339     LIBS=$KEEPLIBS
1340     LDFLAGS=$KEEPLDFLAGS
1341   fi
1342 else
1343   AC_MSG_RESULT(no)
1344 fi
1345
1346 dnl HP-UX Alib
1347 AC_MSG_CHECKING(enable_audio=alib)
1348 if test "x$au_enable_alib" = xyes; then
1349   case "$target" in
1350     *-*-hpux*) AC_MSG_RESULT(yes) ;;
1351     *) AC_MSG_WARN(may not work on $target) ;;
1352   esac
1353   SYSEXTRAS="$SYSEXTRAS hpux_a.c"
1354   EXTRADEFS="$EXTRADEFS -DAU_HPUX_ALIB"
1355   if test -d /opt/audio/include; then
1356     CPPFLAGS="$CPPFLAGS -I/opt/audio/include"
1357   fi
1358   if test -d /opt/audio/lib; then
1359     EXTRALIBS="$EXTRALIBS -L/opt/audio/lib"
1360   fi
1361   EXTRALIBS="$EXTRALIBS -lAlib"
1362 else
1363   AC_MSG_RESULT(no)
1364 fi
1365
1366 dnl nas
1367 AC_MSG_CHECKING(enable_audio=nas)
1368 if test "x$au_enable_nas" = xyes; then
1369   if test "x$with_x" != xyes; then
1370     AC_MSG_ERROR(nas: --with-x option must be specified)
1371   fi
1372   EXTRADEFS="$EXTRADEFS -DAU_NAS"
1373   SYSEXTRAS="$SYSEXTRAS nas_a.c"
1374
1375   dnl -laudio conflicts another audio library,
1376   dnl so I specify NAS library with absolete path.
1377
1378   if test "x$with_nas_library" != "x"; then
1379     AC_MSG_RESULT($with_nas_library);
1380     EXTRALIBS="$EXTRALIBS $with_nas_library"
1381   else
1382     AC_MSG_RESULT()
1383     MY_SEARCH_LIBS(AuOpenServer,
1384         [$x_libraries/libaudio.a \
1385          /usr/lib/libaudio.so \
1386          /usr/lib/libaudio.a ],
1387         [ AC_MSG_RESULT(NAS: $timidity_cv_search_AuOpenServer)
1388           EXTRALIBS="$EXTRALIBS $timidity_cv_search_AuOpenServer"],
1389         [AC_MSG_WARN(NAS library is not found.)])
1390   fi
1391   test "x$with_nas_includes" != "x" && CPPFLAGS="$CPPFLAGS -I$with_nas_includes"
1392   lib_xt_opt=-lXt
1393   if test "x$have_xext" = xyes; then
1394     lib_xext_opt=-lXext
1395   fi
1396   if test "x$have_xprelibs" = xyes; then
1397     lib_xprelibs_opt='-lSM -lICE'
1398   fi
1399 else
1400   AC_MSG_RESULT(no)
1401 fi
1402
1403 dnl aRts of KDE
1404 AC_MSG_CHECKING(enable_audio=arts)
1405 if test "x$au_enable_arts" = xyes; then
1406   AC_MSG_RESULT([yes, configuring aRts])
1407   dnl **** Check for aRts Sound Server ****
1408   AC_PATH_PROG(ARTSCCONFIG, artsc-config)
1409   if test x$ARTSCCONFIG != "x" -a x$ARTSCCONFIG != x'"$ARTSCCONFIG"';
1410   then
1411     ARTSC_CFLAGS=""
1412     for i in `$ARTSCCONFIG --cflags`
1413     do
1414       case "$i" in
1415         -I*) ARTSC_CFLAGS="$ARTSC_CFLAGS $i";;
1416       esac
1417     done
1418     ARTSC_LIBS=`$ARTSCCONFIG --libs`
1419     save_CFLAGS="$CFLAGS"
1420     CFLAGS="$CFLAGS $ARTSC_CFLAGS"
1421     AC_TRY_COMPILE([#include <artsc.h>],[arts_stream_t stream;],
1422         [AC_SUBST(ARTSLIBS, $ARTSC_LIBS)
1423          AC_SUBST(ARTSINCL, $ARTSC_CFLAGS)
1424          AC_DEFINE(HAVE_ARTS, 1, [Define if you have ARTS sound server])
1425            have_arts="yes"
1426          ])
1427     CFLAGS="$save_CFLAGS"
1428   fi
1429
1430   if test "$have_arts" = "yes"; then
1431     dnl AC_MSG_RESULT(aRts: Enabled)
1432     EXTRADEFS="$EXTRADEFS -DAU_ARTS"
1433     SYSEXTRAS="$SYSEXTRAS aRts_a.c"
1434     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ARTSC_CFLAGS)
1435     LIBS="$LIBS $ARTSC_LIBS"
1436   else
1437     AC_MSG_WARN(aRts: Couldn't configure)
1438   fi
1439 else
1440   AC_MSG_RESULT(no)
1441 fi
1442
1443 dnl EsounD
1444 AC_MSG_CHECKING(enable_audio=esd)
1445 if test "x$au_enable_esd" = xyes; then
1446   AC_MSG_RESULT([yes, configuring esd])
1447   KEEPCFLAGS=$CFLAGS
1448   KEEPLIBS=$LIBS
1449   KEEPLDFLAGS=$LDFLAGS
1450   AM_PATH_ESD()
1451   CFLAGS=$KEEPCFLAGS
1452   LIBS=$KEEPLIBS
1453   LDFLAGS=$KEEPLDFLAGS
1454   if test "x$no_esd" = "x"; then
1455     dnl AC_MSG_RESULT(EsounD: Enabled)
1456     EXTRADEFS="$EXTRADEFS -DAU_ESD"
1457     SYSEXTRAS="$SYSEXTRAS esd_a.c"
1458     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ESD_CFLAGS)
1459     LIBS="$LIBS $ESD_LIBS"
1460   else
1461     AC_MSG_WARN(EsounD: Couldn't configure)
1462   fi
1463 else
1464   AC_MSG_RESULT(no)
1465 fi
1466
1467 dnl portaudio
1468 AC_MSG_CHECKING(enable_audio=portaudio)
1469 if test "x$au_enable_portaudio" = xyes; then
1470   AC_MSG_RESULT(yes)
1471   if test "x$CYGNUS" = xyes ||test "x$MSYS" = xyes; then
1472     AC_ARG_ENABLE(dynamic-portaudio,
1473                 AS_HELP_STRING([--dynamic-portaudio], [Dynamic Link PortAudio.]),
1474                 [timidity_cv_dynamic_portaudio="yes"], [timidity_cv_dynamic_portaudio="no"])
1475     if test "x$timidity_cv_dynamic_portaudio" = xyes; then
1476         SYSEXTRAS="$SYSEXTRAS portaudio_a.c w32_portaudio_dll.c"
1477 dnl     EXTRALIBS="$EXTRALIBS -lportaudio"
1478         CPPFLAGS="$CPPFLAGS -I../portaudio/pa_common/"
1479         EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO -DAU_PORTAUDIO_DLL -DPORTAUDIO_V19"
1480     else
1481 dnl     SYSEXTRAS="$SYSEXTRAS portaudio_a.c"
1482         SYSEXTRAS="$SYSEXTRAS portaudio_a.c w32_portaudio_dll.c"
1483 dnl     EXTRALIBS="$EXTRALIBS -lportaudio"
1484         CPPFLAGS="$CPPFLAGS -I../portaudio/pa_common/"
1485 dnl     EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO -DPORTAUDIO_V19"
1486         EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO -DAU_PORTAUDIO_DLL -DPORTAUDIO_V19"
1487     fi
1488   else
1489         SYSEXTRAS="$SYSEXTRAS portaudio_a.c"
1490         EXTRALIBS="$EXTRALIBS -lportaudio"
1491         EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO"
1492   fi
1493 else
1494   AC_MSG_RESULT(no)
1495 fi
1496
1497 dnl npipe (windows named pipe)
1498 if test "x$CYGNUS" = xyes ||test "x$MSYS" = xyes; then
1499   AC_MSG_CHECKING(enable_audio=npipe)
1500   if test "x$au_enable_npipe" = xyes; then
1501     AC_MSG_RESULT(yes)
1502       SYSEXTRAS="$SYSEXTRAS npipe_a.c"
1503       EXTRADEFS="$EXTRADEFS -DAU_NPIPE"
1504   else
1505     AC_MSG_RESULT(no)
1506   fi
1507 fi
1508
1509 dnl JACK
1510 AC_MSG_CHECKING(enable_audio=jack)
1511 if test "x$au_enable_jack" = xyes; then
1512   AC_MSG_RESULT(yes)
1513   SYSEXTRAS="$SYSEXTRAS jack_a.c"
1514   EXTRALIBS="$EXTRALIBS $(pkg-config --libs jack)"
1515   EXTRADEFS="$EXTRADEFS -DAU_JACK $(pkg-config --cflags jack)"
1516 else
1517   AC_MSG_RESULT(no)
1518 fi
1519
1520 dnl AO
1521 AC_MSG_CHECKING(enable_audio=ao)
1522 if test "x$au_enable_ao" = xyes; then
1523   AC_MSG_RESULT([yes, configuring ao])
1524   XIPH_PATH_AO()
1525   if test "x$no_ao" = "x" ; then
1526     # AC_MSG_RESULT(yes)
1527     EXTRADEFS="$EXTRADEFS -DAU_AO"
1528     SYSEXTRAS="$SYSEXTRAS ao_a.c"
1529     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$AO_CFLAGS)
1530     LIBS="$LIBS $AO_LIBS"
1531   else
1532     AC_MSG_WARN(Couldn't configure libao.)
1533   fi
1534 else
1535   AC_MSG_RESULT(no)
1536 fi
1537
1538 dnl ogg's vorbis
1539 AC_MSG_CHECKING(enable_audio=vorbis)
1540 if test "x$au_enable_vorbis" = xyes; then
1541   AC_MSG_RESULT([yes, configuring vorbis])
1542   if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
1543     AC_ARG_ENABLE(dynamic-vorbis,
1544                 AS_HELP_STRING([--dynamic-vorbis], [Dynamic Link OggVorbis.]),
1545                 [timidity_cv_dynamic_vorbis="yes"], [timidity_cv_dynamic_vorbis="no"])
1546     if test "x$timidity_cv_dynamic_vorbis" = xyes; then
1547       have_vorbis=yes
1548       EXTRADEFS="$EXTRADEFS -DAU_VORBIS -DAU_VORBIS_DLL"
1549       SYSEXTRAS="$SYSEXTRAS vorbis_a.c w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c"
1550     else
1551       AC_CHECK_HEADER(vorbis/vorbisenc.h,, [ 
1552         have_vorbis=yes
1553         EXTRADEFS="$EXTRADEFS -DAU_VORBIS"
1554         SYSEXTRAS="$SYSEXTRAS vorbis_a.c"
1555       ])
1556     fi
1557   else
1558     XIPH_PATH_OGG([
1559       XIPH_PATH_VORBIS([
1560         have_vorbis=yes
1561         SYSEXTRAS="$SYSEXTRAS vorbis_a.c"
1562         EXTRADEFS="$EXTRADEFS -DAU_VORBIS $OGG_CFLAGS $VORBIS_CFLAGS"
1563         EXTRALIBS="$EXTRALIBS $VORBIS_LIBS $VORBISENC_LIBS $VORBISFILE_LIBS $OGG_LIBS"
1564         if test "x$MINGWGCC" = xyes ; then
1565           EXTRADEFS="-DAU_VORBIS_DLL $EXTRADEFS"
1566           SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c"
1567         fi
1568       ],[
1569         AC_MSG_WARN([Unable to configure vorbis, but ogg is there (???)])
1570       ])
1571     ],[
1572       AC_MSG_WARN(Unable to configure vorbis!)
1573       have_vorbis=no
1574     ])
1575   fi
1576 else
1577   AC_MSG_RESULT(no)
1578 fi
1579
1580 dnl libFLAC - Free Lossless Audio Codec
1581 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes ; then
1582   AC_MSG_CHECKING(enable_audio=flac)
1583   if test "x$au_enable_flac" = xyes; then
1584     AC_MSG_RESULT([yes, configuring flac])
1585     have_flac=yes
1586     SYSEXTRAS="$SYSEXTRAS flac_a.c w32_libFLAC_dll.c w32_libOggFLAC_dll.c"
1587     EXTRADEFS="$EXTRADEFS -DAU_FLAC -DAU_FLAC_DLL -DAU_OGGFLAC"
1588 dnl    AC_CHECK_HEADER(FLAC/all.h, [ 
1589 dnl      EXTRADEFS="$EXTRADEFS -DAU_FLAC -DAU_FLAC_DLL"
1590 dnl    ])
1591 dnl    AC_CHECK_HEADER(OggFLAC/all.h, [ 
1592 dnl      EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC -DAU_OGGFLAC_DLL"
1593 dnl    ])
1594 dnl    AM_PATH_LIBFLAC([
1595 dnl      EXTRADEFS="$EXTRADEFS -DAU_FLAC -DAU_FLAC_DLL"
1596 dnl      EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBFLAC_CFLAGS)
1597 dnl      LIBS="$LIBS $LIBFLAC_LIBS"
1598 dnl    ])
1599 dnl    AM_PATH_LIBOGGFLAC([
1600 dnl      EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC -DAU_OGGFLAC_DLL"
1601 dnl      EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBOGGFLAC_CFLAGS)
1602 dnl      LIBS="$LIBS $LIBOGGFLAC_LIBS"
1603 dnl    ])
1604   else
1605     AC_MSG_RESULT(no)
1606   fi
1607 else
1608   AC_MSG_CHECKING(enable_audio=flac)
1609   if test "x$au_enable_flac" = xyes; then
1610     AC_MSG_RESULT([yes, configuring flac])
1611     SYSEXTRAS="$SYSEXTRAS flac_a.c"
1612     AM_PATH_LIBFLAC([
1613       have_flac=yes
1614       EXTRADEFS="$EXTRADEFS -DAU_FLAC"
1615       EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBFLAC_CFLAGS)
1616       LIBS="$LIBS $LIBFLAC_LIBS"
1617     ])
1618     AM_PATH_LIBOGGFLAC([
1619       have_oggflac=yes
1620       EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC"
1621       EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBOGGFLAC_CFLAGS)
1622       LIBS="$LIBS $LIBOGGFLAC_LIBS"
1623     ])
1624   else
1625     AC_MSG_RESULT(no)
1626   fi
1627 fi
1628
1629 dnl ogg's opus
1630 AC_MSG_CHECKING(enable_audio=opus)
1631 if test "x$au_enable_opus" = xyes; then
1632   AC_MSG_RESULT([yes, configuring opus])
1633   if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
1634     AC_ARG_ENABLE(dynamic-opus,
1635                 AS_HELP_STRING([--dynamic-opus], [Dynamic Link Opus.]),
1636                 [timidity_cv_dynamic_opus="yes"], [timidity_cv_dynamic_opus="no"])
1637     if test "x$timidity_cv_dynamic_opus" = xyes; then
1638       AC_CHECK_HEADER(opus/opus.h,, [ 
1639         have_opus=yes
1640         EXTRADEFS="-DAU_OPUS -DAU_OPUS_DLL $EXTRADEFS"
1641         SYSEXTRAS="$SYSEXTRAS w32g_opus_dll.c w32g_ogg_dll.c"
1642       ])
1643     else
1644       AC_CHECK_HEADER(opus/opus.h,, [
1645         have_opus=yes
1646         EXTRADEFS="-DAU_OPUS -DAU_OPUS_DLL $EXTRADEFS"
1647         EXTRALIBS="$EXTRALIBS $OPUS_LIBS $OGG_LIBS"
1648       ])
1649     fi
1650   else
1651   XIPH_PATH_OGG([
1652     XIPH_PATH_OPUS([
1653       have_opus=yes
1654       SYSEXTRAS="$SYSEXTRAS opus_a.c"
1655       EXTRADEFS="$EXTRADEFS -DAU_OPUS $OGG_CFLAGS $OPUS_CFLAGS"
1656       EXTRALIBS="$EXTRALIBS $OPUS_LIBS $OGG_LIBS"
1657       if test "x$MINGWGCC" = xyes ; then
1658         EXTRADEFS="-DAU_OPUS_DLL $EXTRADEFS"
1659         SYSEXTRAS="$SYSEXTRAS w32g_opus_dll.c w32g_ogg_dll.c"
1660       fi
1661     ],[
1662       AC_MSG_WARN([Unable to configure opus, but ogg is there (???)])
1663     ])
1664   ],[
1665     AC_MSG_WARN(Unable to configure opus!)
1666     have_opus=no
1667   ])
1668   fi
1669 else
1670   AC_MSG_RESULT(no)
1671 fi
1672
1673 dnl ogg's speex
1674 AC_MSG_CHECKING(enable_audio=speex)
1675 if test "x$au_enable_speex" = xyes; then
1676   AC_MSG_RESULT(yes, configuring speex)
1677   if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
1678     have_speex=yes
1679     SYSEXTRAS="$SYSEXTRAS speex_a.c"
1680     EXTRALIBS="$EXTRALIBS -lspeex -logg"
1681     EXTRADEFS="$EXTRADEFS -DAU_SPEEX"
1682     dnl EXTRADEFS="$EXTRADEFS -DAU_SPEEX -DAU_SPEEX_DLL"
1683     dnl SYSEXTRAS="$SYSEXTRAS w32g_speex_dll.c"
1684   else
1685     AC_CACHE_VAL(timidity_cv_have_speex,
1686     [AC_TRY_LINK([
1687     #include <speex/speex.h>
1688     #include <ogg/ogg.h>
1689     ],
1690     [
1691       SpeexBits *dummy;
1692     ],
1693     [have_speex=yes], [have_speex=no])])
1694     AC_MSG_RESULT($have_speex)
1695     if test "x$have_speex" = xyes; then
1696       SYSEXTRAS="$SYSEXTRAS speex_a.c"
1697       EXTRALIBS="$EXTRALIBS -lspeex -logg"
1698       EXTRADEFS="$EXTRADEFS -DAU_SPEEX"
1699     fi
1700   fi
1701 else
1702   AC_MSG_RESULT(no)
1703 fi
1704
1705 dnl Win32 Gogo-no-coder
1706 AC_MSG_CHECKING(enable_audio=gogo)
1707 if test "x$au_enable_gogo" = xyes; then
1708   if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
1709     AC_MSG_RESULT(yes, configuring gogo)
1710   else
1711     AC_MSG_WARN(May be gogo is not supported.  You need hack the gogo_a.c)
1712   fi
1713   AC_CHECK_HEADER(gogo/gogo.h, [ 
1714     have_gogo=yes
1715   ])
1716   SYSEXTRAS="$SYSEXTRAS gogo_a.c w32_gogo.c"
1717   EXTRADEFS="$EXTRADEFS -DAU_GOGO -DAU_GOGO_DLL"
1718 dnl  EXTRALIBS="$EXTRALIBS -lgogo"
1719 else
1720   AC_MSG_RESULT(no)
1721 fi
1722
1723 dnl Win32 LAME
1724 AC_MSG_CHECKING(enable_audio=lame)
1725 if test "x$au_enable_lame" = xyes; then
1726   if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
1727     AC_MSG_RESULT([yes, configuring lame])
1728     have_lame=yes
1729   else
1730     AC_MSG_WARN(May be lame is not supported.  You need hack the lame_a.c)
1731   fi
1732 dnl  AC_CHECK_HEADERS(timidity/BladeMP3EncDLL.h timidity/LameEnc.h, [ 
1733 dnl    have_lame=yes
1734 dnl  ],,
1735 dnl  [[
1736 dnl  #if HAVE_BLADEMP3ENCDLL_H
1737 dnl  # include "windows.h"
1738 dnl  # include "BladeMP3EncDLL.h"
1739 dnl  #endif
1740 dnl  ]])
1741   SYSEXTRAS="$SYSEXTRAS lame_a.c"
1742   EXTRADEFS="$EXTRADEFS -DAU_LAME"
1743 dnl  EXTRALIBS="$EXTRALIBS"
1744 else
1745   AC_MSG_RESULT(no)
1746 fi
1747
1748 dnl Benchmark
1749 AC_MSG_CHECKING(enable_audio=benchmark)
1750 if test "x$au_enable_npipe" = xno; then
1751   AC_MSG_RESULT(no)
1752 else
1753   AC_MSG_RESULT(yes)
1754 dnl  SYSEXTRAS="$SYSEXTRAS benchmark_a.c"
1755   EXTRADEFS="$EXTRADEFS -DAU_BENCHMARK"
1756 fi
1757
1758 dnl Pseudo audio device (Undocumented).
1759 if test "x$au_enable_none" = xyes; then
1760     EXTRADEFS="$EXTRADEFS -DAU_NONE -DAU_AUDRIV"
1761     SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_none.c"
1762 fi
1763 dnl
1764 dnl TIMIDITY_OUTPUT_ID
1765 dnl
1766 AC_MSG_CHECKING(default output mode)
1767 if test "x$DEFAULT_PLAYMODE" = "x"; then
1768   DEFAULT_PLAYMODE=`echo $enable_audio | sed 's/,.*//'`
1769 fi
1770 case ".$DEFAULT_PLAYMODE" in
1771   .default)    TIMIDITY_OUTPUT_ID=d ;;
1772   .oss)        TIMIDITY_OUTPUT_ID=d ;;
1773   .alsa)       TIMIDITY_OUTPUT_ID=s ;;
1774   .sun)        TIMIDITY_OUTPUT_ID=d ;;
1775   .hpux)       TIMIDITY_OUTPUT_ID=d ;;
1776   .irix)       TIMIDITY_OUTPUT_ID=d ;;
1777   .mme)        TIMIDITY_OUTPUT_ID=d ;;
1778   .sb_dsp)     TIMIDITY_OUTPUT_ID=d ;;
1779   .darwin)     TIMIDITY_OUTPUT_ID=d ;;
1780   .w32)        TIMIDITY_OUTPUT_ID=d ;;
1781   .alib)       TIMIDITY_OUTPUT_ID=A ;;
1782   .nas)        TIMIDITY_OUTPUT_ID=n ;;
1783   .arts)       TIMIDITY_OUTPUT_ID=R ;;
1784   .esd)        TIMIDITY_OUTPUT_ID=e ;;
1785   .portaudio)  TIMIDITY_OUTPUT_ID=p ;;  
1786   .npipe)      TIMIDITY_OUTPUT_ID=N ;;
1787   .wav)        TIMIDITY_OUTPUT_ID=w ;;
1788   .au)         TIMIDITY_OUTPUT_ID=u ;;
1789   .aiff)       TIMIDITY_OUTPUT_ID=a ;;
1790   .list)       TIMIDITY_OUTPUT_ID=l ;;
1791   .vorbis)     TIMIDITY_OUTPUT_ID=v ;;
1792   .flac)       TIMIDITY_OUTPUT_ID=F ;;
1793   .opus)       TIMIDITY_OUTPUT_ID=U ;;
1794   .speex)      TIMIDITY_OUTPUT_ID=S ;;
1795   .gogo)       TIMIDITY_OUTPUT_ID=g ;;
1796   .lame)       TIMIDITY_OUTPUT_ID=L ;;
1797   .jack)       TIMIDITY_OUTPUT_ID=j ;;
1798   .ao)         TIMIDITY_OUTPUT_ID=O ;;
1799   *)           TIMIDITY_OUTPUT_ID= ;;
1800 esac
1801 AC_MSG_RESULT($DEFAULT_PLAYMODE/$TIMIDITY_OUTPUT_ID)
1802
1803
1804 #
1805 # Interface Section
1806 #
1807
1808 interface_targets='dynamic ncurses slang motif tcltk emacs vt100 xaw xskin gtk alsaseq winsyn winsyng portmidisyng npsyn'
1809
1810 AC_ARG_ENABLE(interface,
1811   AS_HELP_STRING([--enable-interface=[interface_list]], [Comma separated interface list]),
1812   [ for i in `echo $enableval | sed 's/,/ /g'`; do
1813       eval "enable_$i=yes"
1814     done ])
1815
1816 #  Dynamic link configuration
1817 AC_ARG_ENABLE(dynamic,
1818   AS_HELP_STRING([--enable-dynamic], [Enable dynamic link interface (default is no)])
1819   AS_HELP_STRING([--enable-dynamic=dynamic_list] [Comma separated dynamic interface list]),
1820   [ dnl --enable-dynamic=yes to --enable-dynamic=dynamic
1821     if test "x$enable_dynamic" = xyes; then
1822       enable_dynamic=dynamic
1823     elif test "x$enable_dynamic" != "xno"; then
1824       for i in `echo $enableval | sed 's/,/ /g'`; do
1825         eval "enable_$i=dynamic"
1826       done
1827     fi])
1828
1829 join_targets=
1830 for i in $interface_targets; do
1831   eval "join_targets=$join_targets\$enable_$i"
1832 done
1833
1834 case ".$join_targets" in
1835 .*dynamic*) NEEDDLOPEN=yes;;
1836 *)          NEEDDLOPEN=no;;
1837 esac
1838
1839 dnl check -fpic option for gcc
1840 if test "x$GCC" = xyes; then SHCFLAGS="$SHCFLAGS -fPIC"; fi
1841 case "x$enable_ump" in xyes|xdynamic) EXTRACFLAGS="$EXTRACFLAGS -DXP_UNIX $SHCFLAGS";; esac
1842
1843 dnl check -masm option for gcc
1844 dnl if test "x$GCC" = xyes; then EXTRACFLAGS="$EXTRACFLAGS -masm=intel"; fi
1845
1846 dnl Which type of dynamic loader?
1847 if test "$NEEDDLOPEN" = "yes"; then
1848   have_dl=no
1849   KEEPLIBS=$LIBS
1850   LIBS=""
1851
1852     AC_CHECK_FUNC(socket,,
1853      WAPI_CHECK_LIB(ws2_32,WSAStartup,
1854        [#include <winsock.h>],
1855        [WSAStartup(0,0);],
1856        [ EXTRALIBS="$EXTRALIBS -lws2_32"
1857         EXTRADEFS="$EXTRADEFS -DWINSOCK" ]
1858      )
1859     )
1860   WAPI_CHECK_FUNC(LoadLibrary,,[LoadLibrary((LPSTR)0);],have_dl=w32)
1861   test $wapi_cv_func_LoadLibrary = yes && have_dl=w32
1862
1863   if test "$have_dl" = "no"; then
1864     AC_CHECK_FUNC(shl_load,have_dl=hpux)
1865   fi
1866   if test "$have_dl" = "no"; then
1867     dnl darwin has both dyld and libdl: in case user installed dlcompat.
1868     dnl dyld is recommended because libdl is a wrapper for dyld.
1869     AC_CHECK_FUNC(NSLinkModule,have_dl=dyld)
1870   fi
1871   if test "$have_dl" = "no" -a "x$ac_cv_lib_dl_dlopen" = xyes; then
1872     have_dl=dlopen
1873   fi
1874   if test "$have_dl" = "no"; then
1875     AC_CHECK_FUNC(dlopen,have_dl=dlopen)
1876   fi
1877   if test "$have_dl" = "no"; then
1878     AC_CHECK_FUNC(dld_init,have_dl=dld)
1879   fi
1880   if test "$have_dl" = "no"; then
1881     AC_CHECK_LIB(dld,dld_init,have_dl=dld;lib_dl_opt=-ldld)
1882   fi
1883
1884   AC_MSG_CHECKING(dynamic link method)
1885   case "$have_dl" in
1886     dlopen)
1887       AC_MSG_RESULT(use dl_dlopen.c)
1888       SYSEXTRAS="$SYSEXTRAS dl_dlopen.c"
1889       CHECK_DLSYM_UNDERSCORE(AC_DEFINE(DLSYM_NEEDS_UNDERSCORE,1,Define to 1 if you have to add "_" to every identifiers.))
1890       ;;
1891     dld)
1892       AC_MSG_RESULT(use dl_dld.c)
1893       SYSEXTRAS="$SYSEXTRAS dl_dld.c"
1894       ;;
1895     hpux)
1896       AC_MSG_RESULT(use dl_hpux.c)
1897       SYSEXTRAS="$SYSEXTRAS dl_hpux.c"
1898       LDFLAGS="$LDFLAGS -Wl,-E $LDFLAGS"
1899       ;;
1900     w32)
1901       AC_MSG_RESULT(use dl_w32.c)
1902       SYSEXTRAS="$SYSEXTRAS dl_w32.c"
1903       ;;
1904     dyld)
1905       AC_MSG_RESULT(use dl_dyld.c)
1906       SYSEXTRAS="$SYSEXTRAS dl_dyld.c"
1907       ;;
1908     *)
1909       NEEDDLOPEN="no"
1910       AC_MSG_WARN(no method to open a shared object)
1911       ;;
1912   esac
1913
1914   LIBS=$KEEPLIBS
1915 fi
1916
1917 if test "$NEEDDLOPEN" = "yes"; then
1918   MY_DEFINE(IA_DYNAMIC)
1919   AC_DEFINE_UNQUOTED(SHARED_LIB_EXT,".$so", shared library extention)
1920   dnl needless?
1921   dnl EXTRADEFS="$EXTRADEFS \$(DEF_SHLIB_DIR)"
1922   if test "x$GCC" = xyes; then
1923     if test "x$timidity_cv_ccoption_rdynamic" = xyes; then
1924       timidity_LDFLAGS="-rdynamic"
1925     else
1926       timidity_LDFLAGS="-Wl,--export-dynamic"
1927     fi
1928   fi
1929 fi
1930
1931 AM_CONDITIONAL(NEEDDLOPEN, test "$NEEDDLOPEN" = "yes")
1932
1933 dnl xdnd support
1934 AC_ARG_ENABLE(xdnd,
1935   AS_HELP_STRING([--enable-xdnd], [Enable xdnd support             (default is no)]),
1936   [ if test "$enableval" = "yes"; then
1937     AC_DEFINE(XDND,1,Define to 1 if you want xdnd support.)
1938     XDND_SRCS="xdnd.c"
1939     enable_xdnd=yes
1940     fi
1941   ])
1942 AM_CONDITIONAL(ENABLE_XDND, test "x$enable_xdnd" = xyes)
1943
1944 dnl
1945 dnl Each interface section
1946 dnl
1947
1948 dnl ncurses
1949 AM_CONDITIONAL(ENABLE_NCURSES, false)
1950 CONFIG_INTERFACE(ncurses,NCURSES,n,
1951   AS_HELP_STRING([--enable-ncurses], [Enable ncurses interface        (default is no)]),
1952   [ AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h)
1953
1954 dnl #include <ncurses/curses.h> is failure on Plamo Linux 1.3/ncurses 1.9.9e
1955 dnl because <ncurses/curses.h> includes <unctrl.h>:
1956 dnl /usr/include/ncurses/curses.h:34: unctrl.h: No such file or directory
1957 dnl But surely there is unctl.h at /usr/include/ncurses/unctrl.h.
1958 dnl configure must check ncurses header with -I/usr/include/ncurses option.
1959
1960   case "$ac_cv_header_curses_h$ac_cv_header_ncurses_curses_h$ac_cv_header_ncurses_h" in
1961     *yes*);;
1962     *)  for i in /usr/include /usr/local/include; do
1963           if test -f "$i/ncurses/curses.h" -a -f "$i/ncurses/unctrl.h"; then
1964             AC_MSG_WARN(ncurses test is failure.  Please check config.h and common.makefile later)
1965             CPPFLAGS="$CPPFLAGS -I$i/ncurses"
1966             break
1967           fi
1968         done
1969         ;;
1970     esac
1971
1972     AC_CHECK_LIB(ncurses,initscr,lib_curses_opt=-lncurses,
1973       [ dnl checking pdcurses
1974         AC_CHECK_LIB(curses,PDC_set_ctrl_break,
1975           [ lib_curses_opt=-lcurses
1976             AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
1977             lib_user32_opt="$lib_user32_test"
1978             AC_CHECK_LIB(curses, vwprintw,
1979               AC_DEFINE(HAVE_VWPRINTW, 1,
1980                 [Define to 1 if you have the `vwprintw' function.]))
1981           ],
1982           [ dnl checking libpdcurses
1983             AC_CHECK_LIB(pdcurses,PDC_set_ctrl_break,
1984             [ lib_curses_opt=-lpdcurses
1985               AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
1986               lib_user32_opt="$lib_user32_test"
1987               AC_CHECK_LIB(pdcurses, vwprintw,
1988                 AC_DEFINE(HAVE_VWPRINTW, 1,
1989                   [Define to 1 if you have the `vwprintw' function.]))
1990             ],
1991             [ dnl OpenBSD use -lcurses instead of -lncurses.
1992               case "$target" in
1993                 *openbsd*)
1994                   AC_CHECK_LIB(curses,initscr,lib_curses_opt=-lcurses,
1995                     [ AC_MSG_WARN(ncurses interface is not enabled)
1996                       enable_ncurses=no ])
1997                   ;;
1998                 *-cygwin*|*-mingw*)
1999                   lib_curses_opt=-lpdcurses
2000                   EXTRAINCS="$EXTRAINCS -I\${top_srcdir}/pdcurses"
2001                   timidity_LDFLAGS="$timidity_LDFLAGS -L\${top_srcdir}/pdcurses/win32"
2002                   AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
2003                   AC_DEFINE(HAVE_VWPRINTW, 1,
2004                     [Define to 1 if you have the `vwprintw' function.])
2005                   AC_MSG_RESULT([use internal pdcurses])
2006                   ;;
2007                 *)
2008                   if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes || test "x$DMC" = xyes || test "x$POCC" = xyes; then
2009                     lib_curses_opt=libpdcurses.lib
2010                     AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
2011                     AC_CHECK_LIB(pdcurses, vwprintw,
2012                       AC_DEFINE(HAVE_VWPRINTW, 1,
2013                         [Define to 1 if you have the `vwprintw' function.]))
2014                   else
2015                     AC_MSG_WARN(ncurses interface is not enabled)
2016                     enable_ncurses=no
2017                   fi
2018                   ;;
2019               esac
2020             ])
2021         ],
2022         $lib_user32_test)
2023       ])
2024   ],
2025   [ LIBS="$LIBS $lib_curses_opt"
2026     case "$target" in
2027        *-*-freebsd[123]*)
2028          EXTRALIBS="$EXTRALIBS -lmytinfo"
2029          ;;
2030      esac
2031     INTERFACE_SRCS="$INTERFACE_SRCS ncurs_c.c"
2032   ],
2033   [ n_so_libs="$lib_curses_opt"
2034     case "$target" in
2035        *-*-freebsd[123]*)
2036          EXTRALIBS="$EXTRALIBS -lmytinfo"
2037          ;;
2038      esac])
2039
2040 dnl slang
2041 AM_CONDITIONAL(ENABLE_SLANG, false)
2042 CONFIG_INTERFACE(slang,SLANG,s,
2043   AS_HELP_STRING([--enable-slang], [Enable slang interface          (default is no)]),
2044   [ AC_CHECK_LIB(slang,SLang_init_tty,:,
2045     [ enable_slang=no
2046       AC_MSG_WARN(slang interface is not enabled)
2047     ])
2048     AC_CHECK_HEADERS(slang/slang.h slang.h)
2049   ],
2050   [ case "$target" in
2051        *openbsd*)
2052         AC_CHECK_LIB(termcap,initscr,
2053                      [ LIBS="$LIBS -lslang -ltermcap"
2054                        INTERFACE_SRCS="$INTERFACE_SRCS slang_c.c"
2055                      ]
2056                      [ AC_MSG_WARN(slang interface is not enabled)
2057                        enable_slang=no
2058                      ])
2059         ;;
2060        *)
2061         LIBS="$LIBS -lslang"
2062         INTERFACE_SRCS="$INTERFACE_SRCS slang_c.c"
2063        ;;
2064     esac
2065   ],
2066   [ s_so_libs="-lslang"
2067     AC_CHECK_LIB(termcap,initscr,s_so_libs="$s_so_libs -ltermcap")
2068   ])
2069
2070 dnl Motif
2071 AM_CONDITIONAL(ENABLE_MOTIF, false)
2072 CONFIG_INTERFACE(motif,MOTIF,m,
2073   AS_HELP_STRING([--enable-motif], [Enable motif interface          (default is no)]),
2074   [ if test "x$with_x" != xyes; then
2075         AC_MSG_ERROR(motif: --with-x option must be specified)
2076     fi
2077     if test "x$have_xm" != xyes; then
2078       AC_MSG_WARN(Motif library is not found.)
2079       enable_motif=no
2080     fi
2081   ],
2082   [ lib_xm_opt=-lXm
2083     lib_xt_opt=-lXt
2084     lib_xext_opt=-lXext
2085     if test "x$have_xprelibs" = xyes; then
2086         lib_xprelibs_opt='-lSM -lICE'
2087     fi
2088     INTERFACE_SRCS="$INTERFACE_SRCS motif_c.c motif_i.c motif_p.c"
2089   ],
2090   [ if test x$have_xprelibs = xyes; then
2091       m_so_libs="-lXext -lSM -lICE"
2092     fi
2093     m_so_libs="$ldflags_x_opt -lXm -lXt $m_so_libs -lX11"
2094   ])
2095
2096 dnl Tcl/Tk
2097 AM_CONDITIONAL(ENABLE_TCLTK, false)
2098 CONFIG_INTERFACE(tcltk,TCLTK,k,
2099   AS_HELP_STRING([--enable-tcltk], [Enable tcltk interface          (default is no)]),
2100   [ if test "x$with_x" != xyes; then
2101         AC_MSG_ERROR(tcltk: --with-x option must be specified)
2102     fi
2103
2104     dnl save flags
2105     KEEPCPPFLAGS=$CPPFLAGS
2106     KEEPLDFLAGS=$LDFLAGS
2107     KEEPLIBS=$LIBS
2108
2109     CPPFLAGS="$tcl_include_dir $tk_includes $CPPFLAGS"
2110     LDFLAGS="$tcl_libdir $tk_libdir $LDFLAGS"
2111     LIBS="$LIBS $lib_dl_opt"
2112
2113     tcl_lib=
2114     tk_lib=
2115     for l in tcl tcl8.6 tcl8.5 tcl8.4 tcl84 tcl8.3 tcl8.0jp tcl7.6jp tcl80jp tcl76jp tcl8.0 tcl7.6 tcl80 tcl76; do
2116       case "x$tcl_lib" in x) AC_CHECK_LIB($l,Tcl_Init,tcl_lib=-l$l);; esac
2117     done
2118     LIBS="$LIBS $tcl_lib"
2119     for l in tk tk8.6 tk8.5 tk8.4 tcl84 tk8.3 tk8.0jp tk4.2jp tk80jp tk42jp tk8.0 tk4.2 tk80 tk42; do
2120       case "x$tk_lib" in x) AC_CHECK_LIB($l,Tk_Init,tk_lib=-l$l);; esac
2121     done
2122
2123     LIBS=$KEEPLIBS
2124     if test "x$tcl_lib" = "x" -o "x$tk_lib" = "x"; then
2125       CPPFLAGS=$KEEPCPPFLAGS
2126       LDFLAGS=$KEEPLDFLAGS
2127       enable_tcltk=no
2128       AC_MSG_WARN(tcl/tk is not enable)
2129     else
2130       tcltk_dep='tclIndex'
2131     fi
2132   ],
2133   [ LIBS="$tk_lib $tcl_lib -lX11 $LIBS"
2134     case "$target" in
2135       *-*-bsdi*)
2136         EXTRALIBS="$EXTRALIBS -lipc"
2137         ;;
2138     esac
2139     INTERFACE_SRCS="$INTERFACE_SRCS tk_c.c"
2140   ],
2141   [ k_so_libs="$tcl_libdir $tk_libdir $tcl_lib $tk_lib $lib_dl_opt"
2142     case "$target" in
2143       *-*-bsdi*)
2144         k_so_libs="$k_so_libs -lipc"
2145         ;;
2146     esac
2147     k_so_libs="$k_so_libs -lX11 -lm"
2148   ])
2149 AM_CONDITIONAL(ENABLE_DYNAMIC_TCLTK, test "x$enable_tcltk" = "xdynamic")
2150
2151 dnl Emacs
2152 AM_CONDITIONAL(ENABLE_EMACS, false)
2153 CONFIG_INTERFACE(emacs,EMACS,e,
2154   AS_HELP_STRING([--enable-emacs], [Enable emacs interface          (default is no)]),
2155   ,
2156   [ ELFILES="$ELFILES timidity.el"
2157     INTERFACE_SRCS="$INTERFACE_SRCS emacs_c.c"
2158   ],
2159   [ AM_CONDITIONAL(ENABLE_EMACS, true)
2160     ELFILES="$ELFILES timidity.el" ])
2161
2162 dnl VT100
2163 AM_CONDITIONAL(ENABLE_VT100, false)
2164 CONFIG_INTERFACE(vt100,VT100,T,
2165   AS_HELP_STRING([--enable-vt100], [Enable VT100 interface          (default is no)]),
2166   ,
2167   [ INTERFACE_SRCS="$INTERFACE_SRCS vt100_c.c vt100.c" ])
2168
2169 dnl X Athena Widget
2170 AM_CONDITIONAL(ENABLE_XAW, false)
2171 CONFIG_INTERFACE(xaw,XAW,a,
2172   AS_HELP_STRING([--enable-xaw], [Enable athena interface         (default is no)]),
2173   [ if test "x$with_x" != xyes; then
2174         AC_MSG_ERROR(xaw: --with-x option must be specified)
2175     fi
2176     if test "x$have_xaw" = "xno"; then
2177       AC_MSG_WARN(X Athena Widget library is not found.)
2178       enable_xaw=no
2179     fi ],
2180   [ dnl Add -lXext -lSM -lICE -lXmu -lXt {-lXaw|-lXaw3d}
2181     if test "x$have_xext" = xyes; then
2182       lib_xext_opt=-lXext
2183     fi
2184     if test "x$have_xprelibs" = xyes; then
2185       lib_xprelibs_opt='-lSM -lICE'
2186     fi
2187     lib_xmu_opt=-lXmu
2188     lib_xt_opt=-lXt
2189     if test "x$enable_xft" = xyes && test "x$have_xaw" != "xno"; then
2190       XFT_CFLAGS="$(pkg-config --cflags xft)";
2191       EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$XFT_CFLAGS)
2192       lib_xft_opt="-lXft";
2193     fi
2194     case "$have_xaw" in
2195       "yes")
2196         lib_xaw_opt=-lXaw
2197         ;;
2198       "3d")
2199         AC_DEFINE(XAW3D,1,Define to 1 if you use libXaw3d.)
2200         lib_xaw_opt=-lXaw3d
2201         ;;
2202       "plus")
2203         AC_DEFINE(XAWPLUS,1,Define to 1 if you use libXawPlus.)
2204         lib_xaw_opt="-lXpm -lXawPlus"
2205         ;;
2206       "next")
2207         AC_DEFINE(NEXTAW,1,Define to 1 if you use libneXtaw.)
2208         lib_xaw_opt=-lneXtaw
2209         ;;
2210     esac
2211     INTERFACE_SRCS="$INTERFACE_SRCS xaw_c.c xaw_i.c x_trace.c $XDND_SRCS"
2212   ],
2213   [ if test "x$have_xext" = xyes; then
2214       a_so_libs="-lXext -lX11"
2215     else
2216       a_so_libs="-lX11"
2217     fi
2218     case "$target" in
2219       *darwin*)
2220         a_so_libs="$a_so_libs -lcc_dynamic"
2221         ;;
2222     esac
2223     if test "x$have_xprelibs" = xyes; then
2224       a_so_libs="-lSM -lICE $a_so_libs"
2225     fi
2226     case "$have_xaw" in
2227       "yes")
2228         a_so_libs="-lXaw -lXmu -lXt $a_so_libs"
2229         ;;
2230       "3d")
2231         AC_DEFINE(XAW3D,1,Define to 1 if you use libXaw3d.)
2232         a_so_libs="-lXaw3d -lXmu -lXt $a_so_libs"
2233         ;;
2234       "plus")
2235         AC_DEFINE(XAWPLUS,1,Define to 1 if you use libXawPlus.)
2236         a_so_libs="-lXawPlus -lXpm -lXmu -lXt $a_so_libs"
2237         ;;
2238       "next")
2239         AC_DEFINE(NEXTAW,1,Define to 1 if you use libneXtaw.)
2240         a_so_libs="-lneXtaw -lXmu -lXt $a_so_libs"
2241         ;;
2242     esac
2243     if test "x$enable_xft" = xyes && test "x$have_xaw" != "xno"; then
2244       XFT_CFLAGS="$(pkg-config --cflags xft)";
2245       EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$XFT_CFLAGS)
2246       a_so_libs="$a_so_libs -lXft";
2247     fi
2248     a_so_libs="$ldflags_x_opt $a_so_libs"
2249   ])
2250 AM_CONDITIONAL(ENABLE_DYNAMIC_XAW, test "x$enable_xaw" = "xdynamic")
2251
2252 dnl X skin
2253 AM_CONDITIONAL(ENABLE_XSKIN, false)
2254 CONFIG_INTERFACE(xskin,XSKIN,i,
2255   AS_HELP_STRING([--enable-xskin], [Enable X skin interface         (default is no)]),
2256   [ if test "x$with_x" != xyes; then
2257         AC_MSG_ERROR(xskin: --with-x option must be specified)
2258     fi
2259   ],
2260   [ INTERFACE_SRCS="$INTERFACE_SRCS xskin_c.c xskin_i.c xskin_loadBMP.c xskin_spectrum.c" ],
2261   [ i_so_libs="$ldflags_x_opt -lX11" ])
2262
2263 dnl GTK+
2264 AM_CONDITIONAL(ENABLE_GTK, false)
2265 CONFIG_INTERFACE(gtk, GTK, g,
2266   AS_HELP_STRING([--enable-gtk], [Enable GTK+ interface           (default is no)]),
2267   [ AM_PATH_GTK_2_0(2.0.0,
2268     [AC_DEFINE(HAVE_GTK_2,1,Define to 1 if you have GTK+ 2.x)],
2269     [AM_PATH_GTK(1.1.3,,enable_gtk=no)]) ],
2270   [ LIBS="$LIBS $GTK_LIBS"
2271     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$GTK_CFLAGS)
2272     INTERFACE_SRCS="$INTERFACE_SRCS gtk_c.c gtk_i.c gtk_p.c"
2273   ],
2274   [ if test "x$GCC" = xyes; then
2275         dnl Do not include -rdynamic option in $g_so_libs.
2276         for i in $GTK_LIBS; do
2277             case "x$i" in
2278                 x-rdynamic) ;;
2279                 *) g_so_libs="$g_so_libs $i" ;;
2280             esac
2281         done
2282     else
2283         g_so_libs="$GTK_LIBS"
2284     fi
2285     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$GTK_CFLAGS) ])
2286
2287 dnl TiMidity Network MIDI Server
2288 AM_CONDITIONAL(ENABLE_SERVER, false)
2289 CONFIG_INTERFACE(server,SERVER,r,
2290   AS_HELP_STRING([--enable-server], [Enable server interface         (default is no)]),
2291   ,
2292   [ INTERFACE_SRCS="$INTERFACE_SRCS server_c.c"
2293     AC_CHECK_HEADERS(sys/soundcard.h)
2294   ])
2295
2296 dnl TiMidity ALSA sequencer server
2297 AM_CONDITIONAL(ENABLE_ALSASEQ, false)
2298 CONFIG_INTERFACE(alsaseq,ALSASEQ,A,
2299   AS_HELP_STRING([--enable-alsaseq], [Enable ALSA sequencer server interface
2300                                                           (default is no)]),
2301   [ INTERFACE_SRCS="$INTERFACE_SRCS alsaseq_c.c"
2302   ],
2303   [ AM_PATH_ALSA
2304   ],
2305   [ MY_DEFINE(IA_ALSASEQ)
2306   ])
2307
2308 dnl TiMidity Windows synthesizer server
2309 AM_CONDITIONAL(ENABLE_WINSYN, false)
2310 CONFIG_INTERFACE(winsyn,WINSYN,W,
2311   AS_HELP_STRING([--enable-winsyn], [Enable Windows Synthesizer interface
2312                                                           (default is no)]),
2313   ,
2314   [ WINSYN="yes"; INTERFACE_SRCS="$INTERFACE_SRCS winsyn_c.c rtsyn_common.c rtsyn_winmm.c"; ])
2315
2316 dnl TiMidity PortMIDI synthesizer server
2317 AM_CONDITIONAL(ENABLE_PORTMIDISYN, false)
2318 CONFIG_INTERFACE(portmidisyn,PORTMIDISYN,P,
2319   AS_HELP_STRING([--enable-portmidisyn], [Enable PortMIDI Synthesizer interface
2320                                                           (default is no)]),
2321   ,
2322   [ INTERFACE_SRCS="$INTERFACE_SRCS rtsyn_common.c rtsyn_portmidi.c portmidisyn_c.c";
2323     if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
2324         LIBS="$LIBS -lportmidi";
2325     fi ])
2326
2327 dnl TiMidity NamedPipe synthesizer server
2328 AM_CONDITIONAL(ENABLE_NPSYN, false)
2329 CONFIG_INTERFACE(npsyn,NPSYN,W,
2330   AS_HELP_STRING([--enable-npsyn], [Enable Windows Named Pipe Synthesizer interface
2331                                                           (default is no)]),
2332   ,
2333   [ NPSYN="yes"; INTERFACE_SRCS="$INTERFACE_SRCS npsyn_c.c rtsyn_common.c rtsyn_npipe.c"; ])
2334
2335
2336
2337 dnl TiMidity Windows GUI synthesizer server
2338 AM_CONDITIONAL(ENABLE_W32G_SYN, false)
2339 CONFIG_INTERFACE(winsyng,W32G_SYN,W,
2340   AS_HELP_STRING([--enable-winsyng], [Enable Windows GUI Synthesizer interface
2341                                                           (default is no)]),
2342   ,
2343   [ 
2344   W32G_GUI=yes
2345   if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes || test "x$DMC" = xyes || test "x$POCC" = xyes; then
2346     INTERFACE_SRCS="$INTERFACE_SRCS w32g_ini.c w32g_pref.c w32g_syn.c w32g_utl.c w32g_soundspec.c winsyn_c.c rtsyn_common.c rtsyn_winmm.c"
2347     lib_w32gui_opt='gdi32.lib comctl32.lib comdlg32.lib ole32.lib shlwapi.lib'
2348     lib_user32_opt='user32.lib'
2349     EXTRADEFS="$EXTRADEFS -D__W32G__ -DTWSYNG32"
2350     if test "x$VCPP" = xyes; then
2351           VCPP_LDFLAGS="$VCPP_LDFLAGS -subsystem:windows "
2352         fi
2353         if test "x$BORLANDC" = xyes; then
2354           BORLANDC_START='C0W32.OBJ'
2355           CFLAGS="$CFLAGS -tW"
2356           lib_w32gui_opt="-aa $lib_w32gui_opt"
2357         fi
2358         if test "x$WATCOM_C" = xyes; then
2359           CFLAGS="$CFLAGS -bw"
2360           WATCOM_LDFLAGS="$WATCOM_LDFLAGS SYS nt_win"
2361         fi
2362         if test "x$DMC" = xyes; then
2363           DLLFLAG="-WA"
2364           lib_w32gui_opt="$lib_w32gui_opt -L/exet:nt/su:windows:4.0"
2365         fi
2366     if test "x$POCC" = xyes; then
2367           POCC_LDFLAGS="$POCC_LDFLAGS -subsystem:windows "
2368     fi
2369   else
2370     lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32 -lole32 -lshlwapi'
2371     lib_user32_opt='-luser32'
2372     EXTRADEFS="$EXTRADEFS -D__W32G__ -DTWSYNG32"
2373     LDFLAGS="-mwindows $LDFLAGS"
2374     INTERFACE_SRCS="$INTERFACE_SRCS w32g_ini.c w32g_pref.c w32g_syn.c w32g_utl.c w32g_soundspec.c winsyn_c.c rtsyn_common.c rtsyn_winmm.c"
2375   fi
2376   ])
2377
2378
2379 dnl Windows GUI
2380 AM_CONDITIONAL(ENABLE_W32GUI, false)
2381 CONFIG_INTERFACE(w32gui, W32GUI, w,
2382   AS_HELP_STRING([--enable-w32gui], [Enable Windows GUI interface    (default is no)]),
2383   ,
2384   [
2385   W32G_GUI=yes 
2386   if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes || test "x$DMC" = xyes || test "x$POCC" = xyes; then
2387     INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_soundspec.c w32g_pref.c w32g_subwin.c w32g_subwin2.c w32g_subwin3.c w32g_ut2.c w32g_dib.c  wrdt_w32g.c w32g_mag.c"
2388     lib_w32gui_opt='gdi32.lib comctl32.lib comdlg32.lib ole32.lib shlwapi.lib'
2389     lib_user32_opt='user32.lib'
2390     EXTRADEFS="$EXTRADEFS -D__W32G__ "
2391     if test "x$VCPP" = xyes; then
2392           VCPP_LDFLAGS="$VCPP_LDFLAGS -subsystem:windows "
2393         fi
2394         if test "x$BORLANDC" = xyes; then
2395           BORLANDC_START='C0W32.OBJ'
2396           CFLAGS="$CFLAGS -tW"
2397           lib_w32gui_opt="-aa $lib_w32gui_opt"
2398         fi
2399         if test "x$WATCOM_C" = xyes; then
2400           CFLAGS="$CFLAGS -bw"
2401           WATCOM_LDFLAGS="$WATCOM_LDFLAGS SYS nt_win"
2402         fi
2403         if test "x$DMC" = xyes; then
2404           lib_w32gui_opt="$lib_w32gui_opt -L/SU:window"
2405           DLLFLAG="-WA"
2406         fi
2407     if test "x$POCC" = xyes; then
2408           POCC_LDFLAGS="$POCC_LDFLAGS -subsystem:windows "
2409     fi
2410   else
2411     lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32 -lole32 -lshlwapi'
2412     lib_user32_opt='-luser32'
2413     EXTRADEFS="$EXTRADEFS -D__W32G__ "
2414     LDFLAGS="-mwindows $LDFLAGS"
2415     INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_soundspec.c w32g_pref.c w32g_subwin.c w32g_subwin2.c w32g_subwin3.c w32g_ut2.c w32g_dib.c  wrdt_w32g.c w32g_mag.c"
2416   fi
2417   ])
2418
2419 dnl UMP configuration
2420 AM_CONDITIONAL(ENABLE_PLUGIN, false)
2421 CONFIG_INTERFACE(ump, PLUGIN, p,
2422   AS_HELP_STRING([--enable-ump], [UMP configuration               (default is no)]),
2423   [ if test ! -d ump; then
2424         AC_MSG_ERROR(UMP Package is not exists.  Can't configure it.)
2425     fi
2426     AC_CHECK_HEADER(X11/xpm.h,,AC_MSG_ERROR([UMP Package needs xpm.h[,] but could not find it.]))
2427     AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,:,AC_MSG_ERROR([UMP Package needs libXpm.a[,] but could not find it.]))
2428     if test "x$have_xext" = xyes; then
2429       lib_xext_opt=-lXext
2430     fi
2431     if test "x$have_xprelibs" = xyes; then
2432       lib_xprelibs_opt='-lSM -lICE'
2433     fi
2434     lib_xmu_opt=-lXmu
2435     lib_xt_opt=-lXt
2436   ])
2437
2438 dnl Window Driver interface
2439 AC_ARG_ENABLE(windrv,
2440   AS_HELP_STRING([--enable-windrv], [Windows Driver interface(requires winsyn) ]),
2441   [ if test "$enableval" = "yes"; then
2442       if test "x$VCPP" != xyes && test "x$MINGWGCC" != xyes && test "x$BORLANDC" != xyes && test "x$WATCOM_C" != xyes && test "x$DMC" != xyes && test "x$POCC" != xyes; then
2443         AC_MSG_ERROR(windrv: Only Support VC++ or Mingw or Borland C or Open Watcom PellesC and Digital Mars)
2444           elif test "x$WINSYN" != xyes; then
2445         AC_MSG_ERROR(windrv: Driver must have winsyn interface)
2446           else
2447     AC_DEFINE(WINDRV,1,Define to 1 if you cpmpile windos driver.)
2448     WINDRV=yes
2449     if test "x$WATCOM_C" = xyes; then DLLFLAG="-bd" ;fi
2450     if test "x$DMC" = xyes; then DLLFLAG="-WD" ;fi
2451     CFLAGS="$CFLAGS -DANOTHER_MAIN "
2452       fi
2453     fi ])
2454 CFLAGS="$CFLAGS $DLLFLAG "
2455
2456 dnl Offix support
2457 dnl this rely on  CFLAGS and LIBS
2458 AC_ARG_ENABLE(offix,
2459   AS_HELP_STRING([--enable-offix], [Enable offix support            (default is no)]),
2460   [ if test "$enableval" = "yes"; then
2461       KEEPCPPFLAGS=$CPPFLAGS
2462       KEEPLIBS=$LIBS
2463       KEEPLDFLAGS=$LDFLAGS
2464       CPPFLAGS="$CPPFLAGS $offix_include_dir"
2465       LDFLAGS="$LDFLAGS $offix_lib_dir"
2466       LIBS="$LIBS $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11"
2467       AC_CHECK_LIB(Dnd,DndInitialize,[
2468         LIBS=$KEEPLIBS
2469         lib_offix_opt="-lDnd"
2470         AC_DEFINE(OFFIX,1,Define to 1 if you need offix support)
2471       ],
2472       [ LDFLAGS=$KEEPLDFLAGS
2473         CPPFLAGS=$KEEPCPPFLAGS
2474         LIBS=$KEEPLIBS
2475       ])
2476     fi
2477   ])
2478
2479 dnl Network section
2480 AC_ARG_ENABLE(network,
2481   AS_HELP_STRING([--enable-network], [Enable network support          (default is no)]),
2482   [ if test "$enableval" = "yes"; then
2483       AC_DEFINE(SUPPORT_SOCKET,1,Define to 1 if you need network support)
2484     fi ])
2485 AM_CONDITIONAL(ENABLE_NETWORK, test "x$enable_network" = xyes)
2486
2487 dnl Multi-thread support
2488 AC_ARG_ENABLE(thread,
2489   AS_HELP_STRING([--enable-thread], [Enable thread support           (default is no)]),
2490   [ if test "$enableval" = "yes"; then
2491       AC_DEFINE(ENABLE_THREAD,1,Define to 1 if you need thread support)
2492     fi ])
2493 AM_CONDITIONAL(ENABLE_THREAD, test "x$enable_thread" = xyes)
2494
2495 dnl LargeFile Source support
2496 AC_ARG_ENABLE(largefile,
2497   AS_HELP_STRING([--enable-largefile], [Enable LargeFile Source support (default is no)]),
2498   [ if test "$enableval" = "yes"; then
2499       AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support])
2500       AC_DEFINE(_LARGEFILE_SOURCE, 1, [Define for ftello and fseeko extension.])
2501     fi ])
2502 AM_CONDITIONAL(ENABLE_LARGEFILE, test "x$enable_largefile" = xyes)
2503
2504 dnl Sound Spectrogram Viewer
2505 AC_ARG_ENABLE(spectrogram,
2506   AS_HELP_STRING([--enable-spectrogram], [Enable Sound Spectrogram Viewer (default is no)]),
2507   [ if test "$enableval" = "yes"; then
2508       if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
2509         if test "x$W32G_GUI" = xyes; then
2510           AC_MSG_RESULT(use w32g_soundspec.c)
2511           AC_DEFINE(W32SOUNDSPEC,1,Define to 1 if you need spectrogram viewer.)
2512         else
2513           AC_MSG_RESULT(use w32_soundspec.c)
2514           AC_DEFINE(W32SOUNDSPEC,1,Define to 1 if you need spectrogram viewer.)
2515           SYSEXTRAS="$SYSEXTRAS w32_soundspec.c"
2516           lib_w32gui_opt='-lgdi32'
2517         fi
2518       elif test "x$with_x" = xyes; then
2519         LIBS="-lX11 $LIBS"
2520       else
2521         AC_MSG_ERROR(spectrogram: --with-x option must be specified)
2522       fi
2523       AC_DEFINE(SUPPORT_SOUNDSPEC,1,Define to 1 if you need spectrogram viewer.)
2524     fi ])
2525
2526 AM_CONDITIONAL(W32SOUNDSPEC, test "x$enable_spectrogram" = xyes -a "x$WIN32" = xyes)
2527 AM_CONDITIONAL(ENABLE_SOUND_SPEC, test "x$enable_spectrogram" = xyes -a "x$with_x" = xyes)
2528
2529 dnl Wave Resample Interpolations
2530 AC_ARG_ENABLE(spline,
2531   AS_HELP_STRING([--enable-spline=[method]],
2532     [Specify spline method.  one of no,linear,cubic,lagrange,newton,gauss,sharp,linerper,sine,square (default is gauss)]),
2533   [ case "x$enableval" in
2534       xlinear)
2535         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,1,Define resampler num.)
2536         AC_DEFINE(DEFAULT_RESAMPLATION,resample_linear,Define resampler.)
2537         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,0,Define resampler order.)
2538         ;;
2539       xcubic)
2540         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,2,Define resampler num.)
2541         AC_DEFINE(DEFAULT_RESAMPLATION,resample_cspline,Define resampler.)
2542         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,0,Define resampler order.)
2543         ;;
2544       xlagrange)
2545         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,3,Define resampler num.)
2546         AC_DEFINE(DEFAULT_RESAMPLATION,resample_lagrange,Define resampler.)
2547         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,0,Define resampler order.)
2548         ;;
2549       xnewton)
2550         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,4,Define resampler num.)
2551         AC_DEFINE(DEFAULT_RESAMPLATION,resample_newton,Define resampler.)
2552         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,11,Define resampler order.)
2553         ;;
2554       xgauss)
2555         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,5,Define resampler num.)
2556         AC_DEFINE(DEFAULT_RESAMPLATION,resample_gauss,Define resampler.)
2557         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,24,Define resampler order.)
2558         ;;
2559       xsharp)
2560         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,6,Define resampler num.)
2561         AC_DEFINE(DEFAULT_RESAMPLATION,resample_sharp,Define resampler.)
2562         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,2,Define resampler order.)
2563         ;;
2564       xlinerper)
2565         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,7,Define resampler num.)
2566         AC_DEFINE(DEFAULT_RESAMPLATION,resample_liner_p,Define resampler.)
2567         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,100,Define resampler order.)
2568         ;;
2569       xsine)
2570         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,8,Define resampler num.)
2571         AC_DEFINE(DEFAULT_RESAMPLATION,resample_sine,Define resampler.)
2572         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,0,Define resampler order.)
2573         ;;
2574       xsquare)
2575         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,9,Define resampler num.)
2576         AC_DEFINE(DEFAULT_RESAMPLATION,resample_square,Define resampler.)
2577         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,0,Define resampler order.)
2578         ;;
2579       xno)
2580         AC_DEFINE(DEFAULT_RESAMPLATION_NUM,0,Define resampler num.)
2581         AC_DEFINE(DEFAULT_RESAMPLATION,resample_none,Define resampler.)
2582         AC_DEFINE(DEFAULT_RESAMPLATION_ORDER,0,Define resampler order.)
2583         ;;
2584       *)
2585         AC_MSG_ERROR(Invalid method of --enable-spline)
2586         ;;
2587     esac ])
2588
2589 dnl Wave Resample Filter
2590 AC_ARG_ENABLE(filter,
2591   AS_HELP_STRING([--enable-filter=[method]],
2592     [Specify filter method.  one of no,lpf12,lpf24,lpfbw,lpf12x2,lpf24x2,lpf6,lpf18,lpftfo,hpfbw,bpfbw (default is no)]),
2593   [ case "x$enableval" in
2594       xlpf12)
2595         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,1,Define resampler filter.)
2596         ;;
2597       xlpf24)
2598         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,2,Define resampler filter.)
2599         ;;
2600       xlpfbw)
2601         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,3,Define resampler filter.)
2602         ;;
2603       xlpf12x2)
2604         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,4,Define resampler filter.)
2605         ;;
2606       xlpf24x2)
2607         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,5,Define resampler filter.)
2608         ;;
2609       xlpf6)
2610         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,6,Define resampler filter.)
2611         ;;
2612       xlpf8)
2613         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,7,Define resampler filter.)
2614         ;;
2615       xlpftfo)
2616         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,8,Define resampler filter.)
2617         ;;
2618       xhpfbw)
2619         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,9,Define resampler filter.)
2620         ;;
2621       xbpfbw)
2622         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,10,Define resampler filter.)
2623         ;;
2624       xno)
2625         AC_DEFINE(DEFAULT_RESAMPLATION_FILTER,0,Define resampler filter.)
2626         ;;
2627       *)
2628         AC_MSG_ERROR(Invalid method of --enable-filter)
2629         ;;
2630     esac ])
2631
2632 dnl WRD interface
2633 AC_ARG_ENABLE(wrd,
2634   AS_HELP_STRING([--enable-wrd], [Enable WRD interface      (default is no)]),
2635   [ if test "$enableval" = "yes"; then
2636       if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
2637         LIBS="-lgdi32 $LIBS"
2638         INTERFACE_SRCS="$INTERFACE_SRCS wrdt_wcon.c wrdt_tty.c"
2639       elif test "x$with_x" = xyes; then
2640         LIBS="-lX11 $LIBS"
2641         AC_DEFINE(WRDT_X,1,Define to 1 if you need wrd support for X.)
2642         enable_sherry_wrd=yes
2643         AC_CHECK_LIB(z,zlibVersion,:,enable_sherry_wrd=no)
2644         AC_CHECK_HEADER(png.h,,enable_sherry_wrd=no)
2645         AC_CHECK_LIB(png,png_init_io,:,enable_sherry_wrd=no,-lz)
2646         if test "$enable_sherry_wrd" = yes; then
2647           AC_DEFINE(ENABLE_SHERRY,1,Define to 1 if you enable Sherry WRD)
2648           lib_zip_opt=-lz
2649           lib_png_opt=-lpng
2650         else
2651            AC_MSG_WARN([Sherry WRD is disabled: png.h, libpng.a, libz.a are required])
2652         fi
2653         if test "x$have_xext" = xyes; then
2654           lib_xext_opt=-lXext
2655         fi
2656       else
2657         AC_MSG_ERROR(wrd: --with-x option must be specified)
2658       fi
2659     fi ])
2660
2661
2662 dnl end of interfaces
2663
2664
2665 dnl
2666 dnl Data section
2667 dnl
2668
2669 dnl Internal audio datatype format
2670 if test "${enable_datatype}" = ""; then
2671   AC_DEFINE(DATA_T_DOUBLE,1,[Define to 1 if you need `double' audio data type.])
2672   AC_DEFINE(VERSION_DATA_T,"f64",[Define version information prefix.])
2673 else
2674   AC_ARG_ENABLE(datatype,
2675     AS_HELP_STRING([--enable-datatype=[type]],
2676       [Specify audio data type.  one of int32,float,double (default is double)]),
2677     [ case "x$enableval" in
2678         xint32)
2679           AC_DEFINE(DATA_T_INT32,1,[Define to 1 if you need `int32' audio data type.])
2680           AC_DEFINE(VERSION_DATA_T,"i32",[Define version information prefix.])
2681           ;;
2682         xfloat)
2683           AC_DEFINE(DATA_T_FLOAT,1,[Define to 1 if you need `float' audio data type.])
2684           AC_DEFINE(VERSION_DATA_T,"f32",[Define version information prefix.])
2685           ;;
2686         xdouble)
2687           AC_DEFINE(DATA_T_DOUBLE,1,[Define to 1 if you need `double' audio data type.])
2688           AC_DEFINE(VERSION_DATA_T,"f64",[Define version information prefix.])
2689           ;;
2690         *)
2691           AC_MSG_ERROR(Invalid type of --enable-datatype)
2692           ;;
2693       esac ])
2694 fi
2695
2696 dnl Ext-Instruction
2697 if test "${enable_ext_instruct}" != ""; then
2698   AC_ARG_ENABLE(ext-instruct,
2699     AS_HELP_STRING([--enable-ext-instruct=[instruction]],
2700       [Specify arch optimize flag.  one of none,mmx,sse,sse2,sse3,ssse3,sse41,sse42,avx,avx2 (default is none)]),
2701     [ case "x$enableval" in
2702         xnone)
2703           ;;
2704         xmmx)
2705           AC_DEFINE(USE_MMX,1,[Define to 1 if you need MMX instructions.])
2706           AC_DEFINE(VERSION_EXT_INST,"mmx",[Define ext-instruction information prefix.])
2707           if test "x$GCC" = xyes; then
2708             CFLAGS="$CFLAGS -mmmx"
2709           fi
2710           ;;
2711         xsse)
2712           AC_DEFINE(USE_SSE,1,[Define to 1 if you need SSE instructions.])
2713           AC_DEFINE(VERSION_EXT_INST,"sse",[Define ext-instruction information prefix.])
2714           if test "x$GCC" = xyes; then
2715             CFLAGS="$CFLAGS -msse -mfpmath=sse,387"
2716           fi
2717           ;;
2718         xsse2)
2719           AC_DEFINE(USE_SSE2,1,[Define to 1 if you need SSE2 instructions.])
2720           AC_DEFINE(VERSION_EXT_INST,"sse2",[Define ext-instruction information prefix.])
2721           if test "x$GCC" = xyes; then
2722             CFLAGS="$CFLAGS -msse2 -mfpmath=sse,387"
2723           fi
2724           ;;
2725         xsse3)
2726           AC_DEFINE(USE_SSE3,1,[Define to 1 if you need SSE3 instructions.])
2727           AC_DEFINE(VERSION_EXT_INST,"sse3",[Define ext-instruction information prefix.])
2728           if test "x$GCC" = xyes; then
2729             CFLAGS="$CFLAGS -msse3 -mfpmath=sse,387"
2730           fi
2731           ;;
2732         xssse3)
2733           AC_DEFINE(USE_SSSE3,1,[Define to 1 if you need SSSE3 instructions.])
2734           AC_DEFINE(VERSION_EXT_INST,"ssse3",[Define ext-instruction information prefix.])
2735           if test "x$GCC" = xyes; then
2736             CFLAGS="$CFLAGS -mssse3 -mfpmath=sse,387"
2737           fi
2738           ;;
2739         xsse41)
2740           AC_DEFINE(USE_SSE4,1,[Define to 1 if you need SSE4 instructions.])
2741           AC_DEFINE(USE_SSE41,1,[Define to 1 if you need SSE4.1 instructions.])
2742           AC_DEFINE(VERSION_EXT_INST,"sse41",[Define ext-instruction information prefix.])
2743           if test "x$GCC" = xyes; then
2744             CFLAGS="$CFLAGS -msse4.1 -mfpmath=sse,387"
2745           fi
2746           ;;
2747         xsse42)
2748           AC_DEFINE(USE_SSE4,1,[Define to 1 if you need SSE4 instructions.])
2749           AC_DEFINE(USE_SSE42,1,[Define to 1 if you need SSE4.2 instructions.])
2750           AC_DEFINE(VERSION_EXT_INST,"sse42",[Define ext-instruction information prefix.])
2751           if test "x$GCC" = xyes; then
2752             CFLAGS="$CFLAGS -msse4.2 -mfpmath=sse,387"
2753           fi
2754           ;;
2755         xavx)
2756           AC_DEFINE(USE_AVX,1,[Define to 1 if you need AVX instructions.])
2757           AC_DEFINE(VERSION_EXT_INST,"avx",[Define ext-instruction information prefix.])
2758           if test "x$GCC" = xyes; then
2759             CFLAGS="$CFLAGS -mavx -mfpmath=sse,387"
2760           fi
2761           ;;
2762         xavx2)
2763           AC_DEFINE(USE_AVX2,1,[Define to 1 if you need AVX2 instructions.])
2764           AC_DEFINE(VERSION_EXT_INST,"avx2",[Define ext-instruction information prefix.])
2765           if test "x$GCC" = xyes; then
2766             CFLAGS="$CFLAGS -mavx2 -mfpmath=sse,387"
2767           fi
2768           ;;
2769         *)
2770           AC_MSG_ERROR(Invalid type of --enable-datatype)
2771           ;;
2772       esac ])
2773 fi
2774
2775
2776 #
2777 # Finish up
2778 #
2779
2780 AM_CONDITIONAL(ENABLE_WRD, test "x$enable_wrd" = xyes)
2781 AM_CONDITIONAL(W32G_GUI, test "x$W32G_GUI" = xyes)
2782 AM_CONDITIONAL(WINDRV, test "x$WINDRV" = xyes)
2783 AM_CONDITIONAL(CYGNUS, test "x$CYGNUS" = xyes)
2784 AM_CONDITIONAL(MSYS, test "x$MSYS" = xyes)
2785 AM_CONDITIONAL(VCPP, test "x$VCPP" = xyes)
2786 AM_CONDITIONAL(POCC, test "x$POCC" = xyes)
2787 AM_CONDITIONAL(BORLANDC, test "x$BORLANDC" = xyes)
2788 AM_CONDITIONAL(WATCOM_C, test "x$WATCOM_C" = xyes)
2789 AM_CONDITIONAL(DMC, test "x$DMC" = xyes)
2790 AM_CONDITIONAL(MINGWGCC, test "x$MINGWGCC" = xyes)
2791
2792 AM_CONDITIONAL(W32READDIR, test "x$W32READDIR" = xyes)
2793
2794 SET_UNIQ_WORDS(LDFLAGS,$LDFLAGS)
2795 SET_UNIQ_WORDS(SHLDFLAGS,$SHLDFLAGS)
2796 SET_UNIQ_WORDS(CFLAGS,$EXTRACFLAGS $CFLAGS)
2797 SET_UNIQ_WORDS(CPPFLAGS,$CPPFLAGS $EXTRADEFS)
2798
2799 if test "x$oss_device" != "x"; then
2800   AC_DEFINE_UNQUOTED(OSS_DEVICE,"$oss_device", oss device name)
2801 fi
2802
2803 if test "x$TIMIDITY_OUTPUT_ID" != "x"; then
2804   AC_DEFINE_UNQUOTED(TIMIDITY_OUTPUT_ID,"$TIMIDITY_OUTPUT_ID", the output specification)
2805 fi
2806
2807 if test "x$au_enable_nas"      = xyes -o \
2808         "x$enable_motif"       = xyes -o \
2809         "x$enable_tcltk"       = xyes -o \
2810         "x$enable_xaw"         = xyes -o \
2811         "x$enable_xskin"       = xyes -a "x$with_x" = xyes; then
2812   dnl Order of X-library is: -lXdnd -lXm -lXaw -lXft -lXmu -lXt -lSM -lICE -lXext -lX11
2813   LIBS="$lib_offix_opt $lib_xm_opt $lib_xaw_opt $lib_xft_opt $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11 $LIBS"
2814 fi
2815 LIBS="$LIBS $lib_dl_opt $lib_png_opt $lib_zip_opt $lib_user32_opt $lib_w32gui_opt $EXTRALIBS"
2816 SHLD="$SHLD $SHLDFLAGS"
2817
2818 AC_SUBST(BORLANDC_START)
2819 AC_SUBST(BORLANDC_LDFLAGS)
2820 AC_SUBST(SHELL)
2821 AC_SUBST(timidity_LDFLAGS)
2822 AC_SUBST(WATCOM_LDFLAGS)
2823 AC_SUBST(DMC_LDFLAGS)
2824 AC_SUBST(VCPP_LDFLAGS)
2825 AC_SUBST(POCC_LDFLAGS)
2826 AC_SUBST(SYSEXTRAS)
2827 AC_SUBST(EXTRALIBS)
2828 AC_SUBST(EXTRAINCS)
2829 AC_SUBST(EXTRADEFS)
2830 AC_SUBST(NETSRCS)
2831 AC_SUBST(ELFILES)
2832 AC_SUBST(SHLD)
2833 AC_SUBST(SHCFLAGS)
2834 AC_SUBST(dynamic_targets)
2835 AC_SUBST(so)
2836 AC_SUBST(LN_S)
2837 AC_SUBST(WISH)
2838 AC_SUBST(TCLSH)
2839 AC_SUBST(tcltk_dep)
2840 AC_SUBST(program_transform_name)
2841 AC_SUBST(INTERFACE_SRCS)
2842 AC_SUBST(pkgdatadir)
2843 AC_SUBST(pkglibdir)
2844
2845 AC_CONFIG_FILES([
2846   Makefile
2847   autoconf/Makefile
2848   common.makefile
2849   configs/Makefile
2850   doc/Makefile
2851   doc/C/Makefile
2852   doc/ja_JP.eucJP/Makefile
2853   doc/ja_JP.utf8/Makefile
2854   interface/Makefile
2855   interface/motif_bitmaps/Makefile
2856   interface/bitmaps/Makefile
2857   interface/pixmaps/Makefile
2858   libarc/Makefile
2859   libunimod/Makefile
2860   timidity/Makefile
2861   windrv/Makefile
2862   utils/Makefile
2863   script/Makefile
2864   TiMidity.ad
2865   TiMidity-uj.ad
2866 ])
2867 AC_OUTPUT