OSDN Git Service

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