Merge pull request #4324 from FernetMenta/wasapi
[vuplus_xbmc] / lib / timidity / configure.in
1 dnl TiMidity++ -- MIDI to WAVE converter and player
2 dnl Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
3 dnl Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>
4 dnl
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 2 of the License, or
8 dnl (at your option) any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; if not, write to the Free Software
17 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19 dnl configure.in created from configure.scan
20 dnl by URABE, Shyouhei <root@mput.dip.jp> on 2002.07.06
21
22 dnl variable note:
23 dnl CFLAGS      - Flags for compile.
24 dnl CPPFLAGS    - Flags for cpp
25 dnl LDFLAGS     - Flags for linker
26 dnl             ac_cpp:     $CPP $CPPFLAGS
27 dnl             ac_compile: ${CC-cc} -c $CFLAGS $CPPFLAGS
28 dnl             ac_link:    ${CC-cc} -o * $CFLAGS $CPPFLAGS $LDFLAGS *.c $LIBS
29 dnl EXTRACFLAGS - Extra flags to compile.  Adds to CFLAGS.
30 dnl EXTRADEFS   - Extra define macros.  Adds to CPPFLAGS.
31 dnl EXTRALIBS   - Extra libraries  Adds to LIBS.
32 dnl SYSEXTRAS   - Additional source codes to compile.
33 dnl lib_*_opt   - Optional libraries. Adds to LIBS.
34 dnl LIBRARY_PATH
35 dnl             - add to -L LDFLAGS
36 dnl C_INCLUDE_PATH
37 dnl             - add to -I CPPFLAGS
38 dnl CYGNUS      - `yes' if cygnus windows environment.
39 dnl MSYS        - `yes' if Mingw windows environment.
40 dnl WISH        - wish
41 dnl LN_S        - ln -s
42 dnl tcltk_dep   - make dependencies for tcl/tk interface
43 dnl
44 dnl so          - File extension of shared object library.
45 dnl SHLD        - Linker to make shared object library.
46 dnl SHLDFLAGS   - Link flags to link shared object library.
47 dnl SHCFLAGS    - Additional flags to compile shared object library.
48 dnl               (such as -fPIC)
49
50 # This is a autoscan-generated configure.scan.
51 # AC_PREREQ(2.56)
52
53 # "AC_INIT(timidity/timidity.c)" is obsolate yet.
54 AC_INIT([TiMidity++],[2.13.2],[root@mput.dip.jp],[TiMidity++])
55 AC_CONFIG_AUX_DIR([autoconf])
56 AC_CANONICAL_TARGET
57 AM_INIT_AUTOMAKE([gnu dist-bzip2])
58 AC_CONFIG_SRCDIR([timidity/timidity.c])
59 AC_CONFIG_HEADERS([config.h interface.h])
60 AM_MAINTAINER_MODE
61
62 SHELL=${CONFIG_SHELL-"/bin/sh"}
63 WISH=${WISH-"wish"}
64
65 dnl to use contains() macro (see autoconf/acinclude.m4)
66 CONTAINS_INIT
67
68 # Check for compiler options -- such as debug flags.
69
70 dnl "--enable-debug" turnes -g on.
71 AC_MSG_CHECKING(if --enable-debug option specified)
72 AC_ARG_ENABLE(debug,
73   [  --enable-debug          Build a debugging version.],
74   [timidity_cv_debug="yes"], [timidity_cv_debug="no"])
75 if test "x$timidity_cv_debug" = "xyes"; then
76   AC_DEFINE(DEBUG,1,Define to 1 if you are in debug mode)
77   CFLAGS=${CFLAGS-"-g"}
78 fi
79 if test "x$timidity_cv_debug" = "xno"; then
80   AC_DEFINE(NDEBUG,1,Define to 1 if you are NOT in debug mode)
81 fi
82 AC_MSG_RESULT($timidity_cv_debug)
83
84 CFLAGS=${CFLAGS-"-O2"}
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   [  --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   [  --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   [  --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   [  --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
158 # Checks for programs.
159 AM_PATH_LISPDIR
160 AC_PROG_CC
161 AC_PROG_GCC_TRADITIONAL
162 AC_PROG_INSTALL
163 AC_PROG_AWK
164 AC_PROG_RANLIB
165 AC_PROG_LN_S
166 CHECK_COMPILER_OPTION(rdynamic)
167
168 # Checks for target dependencies
169
170 AC_ARG_WITH(elf,
171   [  --with-elf              create ELF shared object instead of AOUT ],
172   [ ELFFORMAT=$withval ], [ ELFFORMAT="yes" ])
173
174 # AC_ARG_WITH(simd,
175 #  [  --with-simd             create SIMD friendly binary (default is no) ],
176 #  [ SIMD=$withval ], [ SIMD="no" ])
177
178 case "$target" in
179   *-*-hpux*)
180     EXTRADEFS="-DHPUX"
181     test -n "$SHLD" || SHLD="ld -b"
182     so="sl"
183     ;;
184   *-sgi-irix*)
185     dnl IRIX cc needs -signed option
186     case ".$CC" in .cc*) EXTRACFLAGS="-signed";; esac
187     test -n "$SHLD" || SHLD="cc -shared -all"
188     so="so"
189     ;;
190   *-*-netbsd*)
191     test -n "$SHLD" || SHLD="$CC -shared -nostartfiles"
192     so="so"
193     ;;
194
195   *-*-freebsd2*)
196     dnl EXTRALIBS="$EXTRALIBS -lxpg4"
197     test -n "$SHLD" || SHLD="ld -Bshareable"
198     so="so"
199     ;;
200   *-*-freebsd*)
201     if test "$ELFFORMAT" = yes; then
202         test -n "$SHLD" || SHLD="ld -Bshareable"
203     else
204         SHCFLAGS=-aou
205         SHLDFLAGS="-L/usr/X11R6/lib/aout $SHLDFLAGS"
206         test -n "$SHLD" || SHLD="env OBJFORMAT=aout ld -shared"
207     fi
208     dnl EXTRALIBS="$EXTRALIBS -lxpg4"
209     so="so"
210     ;;
211
212 #  *-*-freebsd*)
213 #    EXTRALIBS="$EXTRALIBS -lxpg4"
214 #    test -n "$SHLD" || SHLD="ld -Bshareable"
215 #    so="so"
216 #  ;;
217
218   *-*-cygwin*)
219     EXTRADEFS="-D__W32__"
220     # ??
221     case "x${CC} " in
222       "xbcc32 "*) 
223 #        test -n "$SHLD" || SHLD="tlink32 -Tpd"
224         test -n "$SHLD" || SHLD="BCC32 -WD"
225         BORLANDC=yes
226         BORLANDC_LDFLAGS="kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib user32.lib shell32.lib cw32mt.lib"
227                 BORLANDC_START='C0X32.OBJ'
228         CFLAGS="$CFLAGS  -tWM -VM"
229         EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32"
230         ;;
231       "xwcc386_w.sh "*)
232          WATCOM_C=yes
233          CFLAGS="$CFLAGS -br -5s -zk0 -bm -zp=16 -w=4 -D_WINDOWS -DWIN32 -DINCLUDE_WINDOWS_H"
234          WATCOM_LDFLAGS=
235          EXTRALIBS="$EXTRALIBS kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib"
236          ;;
237       "xcl "*)
238          test -n "$SHLD" || SHLD="link -dll" 
239          VCPP_LDFLAGS="-nologo -incremental:no  -nodefaultlib:libc.lib -nodefaultlib:msvcrt.lib kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib"
240          CFLAGS="$CFLAGS -nologo -Zp16 -MT -W3 -GX  -Ob2"
241          EXTRADEFS="$EXTRADEFS -DNDEBUG -D_WINDOWS -DWIN32 -DMBCS -D_MT -YX  -FD -c"
242          VCPP=yes
243          ;;
244       "xgcc"*) test -n "$SHLD" || SHLD="gcc -mdll" ;;
245       *) test -n "$SHLD" || SHLD="unknown" ;;
246     esac
247     so="dll"
248     CYGNUS=yes
249     lib_user32_test=-luser32
250     ;;
251   *-*-mingw*)
252     EXTRADEFS="-D__W32__"
253     # ??
254     case "x${CC} " in
255       "xbcc32 "*) 
256 #        test -n "$SHLD" || SHLD="tlink32 -Tpd"
257         test -n "$SHLD" || SHLD="BCC32 -WD"
258         BORLANDC=yes
259         BORLANDC_LDFLAGS="kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib user32.lib shell32.lib cw32mt.lib"
260         BORLANDC_START='C0X32.OBJ'
261         CFLAGS="$CFLAGS  -tWM -VM"
262         EXTRADEFS="$EXTRADEFS -D_WINDOWS -DWIN32"
263         ;;
264       "xwcc386_w.sh "*)
265          WATCOM_C=yes
266          CFLAGS="$CFLAGS -br -5s -zk0 -bm -zp=16 -w=4 -D_WINDOWS -DWIN32 -DINCLUDE_WINDOWS_H"
267          WATCOM_LDFLAGS=
268          EXTRALIBS="$EXTRALIBS kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib"
269          ;;
270       "xcl "*) 
271          test -n "$SHLD" || SHLD="link -dll"
272          VCPP=yes
273          VCPP_LDFLAGS="-nologo -incremental:no  -nodefaultlib:libc.lib -nodefaultlib:msvcrt.lib kernel32.lib winspool.lib comdlg32.lib advapi32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib user32.lib shell32.lib libcmt.lib"
274          CFLAGS="$CFLAGS -nologo -Zp16 -MT -W3 -GX  -Ob2"
275          EXTRADEFS="$EXTRADEFS -DNDEBUG -D_WINDOWS -DWIN32 -DMBCS -D_MT -YX  -FD -c"
276          ;;
277       "xgcc"*) test -n "$SHLD" || SHLD="gcc -mdll" ;;
278       *) test -n "$SHLD" || SHLD="unknown" ;;
279     esac
280     so="dll"
281     MSYS=yes
282     lib_user32_test=-luser32
283     ;;
284   *-dec-*)
285     EXTRADEFS="-DDEC"
286     test -n "$SHLD" || SHLD="ld -Bdynamic -G"
287     so="so"
288     ;;
289   *-*-solaris*)
290     EXTRADEFS="-DSOLARIS"
291     test -n "$SHLD" || SHLD="/usr/ccs/bin/ld -G"
292     so="so"
293     ;;
294   *-*-nextstep*)
295     test -n "$SHLD" || SHLD="/usr/ccs/bin/ld -G"
296     so="so"
297     ;;
298   *-*-darwin*)
299     if test "x$SIMD" = "xyes"; then
300        AC_DEFINE(USE_ALTIVEC,1,Define to 1 if you use altivec)
301        # EXTRACFLAGS="$EXTRACFLAGS -faltivec -mabi=altivec -maltivec" # for GCC3.
302        EXTRACFLAGS="$EXTRACFLAGS -faltivec"
303     else
304        AC_DEFINE(USE_ALTIVEC,0,Define to 1 if you use altivec)
305     fi
306     CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
307     LDOPTS="-dynamic -undefined suppress -flat_namespace $LDOPTS"
308     test -n "$SHLD" || SHLD="$CC -dynamic -bundle -undefined suppress -flat_namespace $LDFLAGS"
309     so="bundle"
310     ;;
311   *)
312     test -n "$SHLD" || \
313       if test "x$GCC" = xyes; then
314         SHLD="$CC -shared"
315       else
316         SHLD="ld -Bdynamic -G"
317       fi
318     so="so"
319     ;;
320 esac
321
322 dnl For .exe
323 dnl AC_EXEEX # obsolate
324
325 # Checks for libraries.
326 AC_CHECK_LIB(m,sqrt)
327 AC_CHECK_LIB(socket,socket)
328 AC_CHECK_LIB(dl,dlopen,lib_dl_opt=-ldl)
329 AC_CHECK_LIB(objc,NSLinkModule,lib_dl_opt=-lobjc) # Mac OS X need this.
330 if test "x$VCPP" != "xyes" && test "x$BORLANDC" != "xyes" && test "x$WATCOM_C" != "xyes"; then
331 AC_CHECK_LIB(xpg4,setlocale) # Mac OS X (and maybe NetBSD) need this.
332 fi
333 AC_CHECK_FUNCS(gethostbyname,,[ AC_CHECK_LIB(nsl,gethostbyname) ])
334 AC_PATH_XTRA
335
336 # Checks for X
337 if test "x$with_x" = xyes; then
338   if test "x$have_x" = xno; then
339     if test "x$x_config_flag" = xyes; then
340       AC_MSG_ERROR(Could not configure X)
341     else
342       AC_MSG_WARN(Could not configure X)
343     fi
344   fi
345 fi
346 if test "x$with_x" = xyes -a "x$have_x" = xyes; then
347   if test "x$x_libraries" != x; then
348     ldflags_x_opt="-L$x_libraries"
349     LDFLAGS="$LDFLAGS $ldflags_x_opt"
350     SHLDFLAGS="$SHLDFLAGS $ldflags_x_opt"
351   else
352     ldflags_x_opt=
353   fi
354   if test "x$x_includes" != x; then
355     CPPFLAGS="$CPPFLAGS -I$x_includes"
356   fi
357
358   AC_CHECK_LIB(X11,XOpenDisplay)
359   AC_MSG_CHECKING(X11 version 6)
360   AC_CACHE_VAL(timidity_cv_x11_version_6,
361     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[
362 #if XlibSpecificationRelease < 6
363 fail;
364 #endif
365 ]])],[timidity_cv_x11_version_6=yes],[timidity_cv_x11_version_6=no]))
366   if test "$timidity_cv_x11_version_6" = "yes"; then
367     AC_MSG_RESULT(6 or newer)
368     dnl AC_DEFINE(HAVE_X11R6)
369   else
370     AC_MSG_RESULT(before 6)
371   fi
372
373   dnl checking order required
374   KEEPLIBS=$LIBS
375   AC_CHECK_LIB(Xext,XShapeCombineMask,have_xext=yes; LIBS="-lXext $LIBS",have_xext=no)
376   AC_CHECK_LIB(ICE,IceConnectionNumber)
377   AC_CHECK_LIB(SM,SmcOpenConnection,have_xprelibs=yes; LIBS="-lSM $LIBS",have_xprelibs=no)
378   AC_CHECK_LIB(Xt,XtVaAppInitialize,have_xt=yes; LIBS="-lXt $LIBS",have_xt=no)
379   AC_CHECK_LIB(Xmu,XmuInternAtom,LIBS="-lXmu $LIBS")
380   AC_CHECK_FUNCS(XmuRegisterExternalAgent)
381   AC_CHECK_LIB(Xaw3d,XawInitializeWidgetSet,have_xaw=3d,
382    [ AC_CHECK_LIB(Xaw,XawInitializeWidgetSet,have_xaw=yes,have_xaw=no) ])
383   AC_CHECK_LIB(Xm,XmCreateForm,have_xm=yes,have_xm=no)
384   AC_CHECK_FUNCS(XShmCreatePixmap)
385   LIBS=$KEEPLIBS
386 fi
387 dnl End of X configure
388
389 # Checks for header files.
390 AC_HEADER_STDC
391 AC_HEADER_STDBOOL
392 AC_HEADER_SYS_WAIT
393 if test "x$WATCOM_C" != xyes ; then
394 AC_HEADER_TIME
395 fi
396 AC_HEADER_DIRENT
397 AC_CHECK_HEADERS( \
398   [arpa/inet.h \
399   errno.h \
400   getopt.h \
401   glob.h \
402   dlfcn.h \
403   fcntl.h \
404   inttypes.h \
405   limits.h \
406   machine/endian.h \
407   malloc.h \
408   memory.h \
409   netdb.h \
410   netinet/in.h \
411   nlist.h \
412   stddef.h \
413   stdlib.h \
414   stdint.h \
415   string.h \
416   strings.h \
417   stropts.h \
418   soundcard.h \
419   alsa/asoundlib.h \
420   sys/asoundlib.h \
421   sys/audioio.h \
422   sys/awe_voice.h\
423   sys/ioctl.h \
424   sys/ipc.h \
425   sys/param.h \
426   sys/shm.h \
427   sys/socket.h \
428   sys/soundcard.h \
429   sys/param.h \
430   sys/time.h \
431   sys/types.h \
432   sys/sysctl.h \
433   termios.h \
434   unistd.h \
435   X11/Xlib.h])
436 AC_CHECK_HEADERS(\
437   [X11/extensions/XShm.h X11/Xmu/ExtAgent.h],[],[],[
438 #ifdef HAVE_X11_XLIB_H
439 #include <X11/Xlib.h>
440 #endif
441   ])
442 AC_CHECK_HEADER(string.h,, [ AC_DEFINE(NO_STRING_H,1,Define to 1 if you do not have <string.h>.)])
443
444 # Checks for typedefs, structures, and compiler characteristics.
445 if test "x$WATCOM_C" != xyes ; then
446 AC_C_BIGENDIAN
447 fi
448 AC_C_CHAR_UNSIGNED
449 AC_C_CONST
450 AC_C_INLINE
451 AC_C_VOLATILE
452 AC_C_STRINGIZE
453 AC_C_PROTOTYPES
454 AC_STRUCT_TM
455 AC_TYPE_SIZE_T
456 AC_TYPE_OFF_T
457 AC_TYPE_PID_T
458
459 dnl keyword "volatile" check
460 AC_CACHE_CHECK(volatile declaration,timidity_cv_type_volatile,
461   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[volatile int x]])],[timidity_cv_type_volatile=yes],[timidity_cv_type_volatile=no]))
462 if test $timidity_cv_type_volatile = no; then
463   AC_DEFINE(NO_VOLATILE,1,Define to 1 if you cannot use volatile keyword)
464 fi
465
466 dnl union usenum check
467 AC_CACHE_CHECK(union semun declaration,timidity_cv_type_union_semun,
468   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
469 #include <sys/types.h>
470 #include <sys/ipc.h>
471 #include <sys/sem.h>
472 ]], [[union semun x]])],[timidity_cv_type_union_semun=yes],[timidity_cv_type_union_semun=no]))
473 if test $timidity_cv_type_union_semun = yes; then
474   AC_DEFINE(HAVE_UNION_SEMUN,1,Define to 1 if you use semun keyword)
475 fi
476
477 dnl Cygnus and Mingw memory struct optiontest
478 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
479         case "x${CC}" in
480         "xgcc"*) 
481                 msnative_struct=''
482             AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
483             if test -z "$ac_cv_prog_CC"; then
484                         our_gcc="$CC"
485                 else
486                         our_gcc="$ac_cv_prog_CC"
487                 fi
488                 case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
489                         2.)
490                 if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
491                         msnative_struct='-fnative-struct'
492                 fi
493                 ;;
494                         *)
495                 if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
496                         msnative_struct='-mms-bitfields'
497                 fi
498                 ;;
499                 esac
500                 if test x"$msnative_struct" = x ; then
501                         AC_MSG_RESULT([no way])
502                         AC_MSG_WARN([produced binary will be incompatible with windows' GUI ])
503                 else
504                         CFLAGS="$CFLAGS $msnative_struct"
505                         CPPFLAGS="$CPPFLAGS $msnative_struct"
506                         AC_MSG_RESULT([${msnative_struct}])
507                 fi
508                 ;;
509         *) 
510                 ;;
511         esac
512 fi
513 dnl Cygnus Mingw32 mmsystem check
514 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
515   AC_CACHE_CHECK(Cygwin new mmsystem,timidity_cv_header_new_mmsystem,
516     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
517 #include <windows.h>
518 #include <mmsystem.h>
519 ]], [[return WOM_OPEN != 0x3BB]])],[timidity_cv_header_new_mmsystem=yes],[timidity_cv_header_new_mmsystem=no]))
520   if test $timidity_cv_header_new_mmsystem = yes; then
521     AC_DEFINE(HAVE_NEW_MMSYSTEM,1,Define to 1 if you have <mmsystem.h> file)
522   fi
523 fi
524
525 # Checks for library functions.
526 AC_FUNC_ERROR_AT_LINE
527 AC_FUNC_FORK
528 AC_FUNC_MEMCMP
529 AC_FUNC_MMAP
530 AC_FUNC_SETVBUF_REVERSED
531 AC_TYPE_SIGNAL
532 if test "x$VCPP" != xyes && test "x$BORLANDC" != xyes && test "x$WATCOM_C" != "xyes"; then
533 AC_FUNC_VPRINTF
534 fi
535 AC_CHECK_FUNCS( \
536   [alarm \
537   dup2 \
538   floor \
539   getcwd \
540   getopt \
541   gethostbyname \
542   gettimeofday \
543   getwd \
544   isatty \
545   memchr \
546   memmove \
547   memset \
548   modf \
549   munmap \
550   popen \
551   pow \
552   select \
553   signal \
554   socket \
555   sleep \
556   vsnprintf \
557   snprintf \
558   sqrt \
559   strchr \
560   strdup \
561   strstr \
562   strerror \
563   strcasecmp \
564   strncasecmp \
565   strrchr \
566   strstr \
567   strtol \
568   strlcat \
569   strlcpy \
570   usleep])
571 if test "x$VCPP" = xyes; then
572   AC_DEFINE(RETSIGTYPE,int)
573   AC_DEFINE(HAVE_GETCWD,int)
574 fi
575 if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then
576   AC_DEFINE(HAVE_GETHOSTBYNAME,1)
577   AC_DEFINE(HAVE_POPEN,1)
578   AC_DEFINE(popen,_popen,[for VC])
579   AC_DEFINE(pclose,_pclose,[for VC])
580   AC_DEFINE(HAVE_SELECT,1)
581   AC_DEFINE(HAVE_SNPRINTF,1)
582   AC_DEFINE(HAVE_STRDUP,1)
583   AC_DEFINE(HAVE_STRERROR,1)
584   AC_DEFINE(HAVE_STRNCASECMP,1)
585   AC_DEFINE(HAVE_STRSTR,1)
586   AC_DEFINE(snprintf,_snprintf,[for VC])
587   AC_DEFINE(HAVE_SOCKET,1)
588   AC_DEFINE(HAVE_VSNPRINTF,1)
589   AC_DEFINE(vsnprintf,_vsnprintf,[for VC])
590   AC_DEFINE(TIMID_VERSION,[$(PACKAGE_VERSION)],[for windows gui])
591 fi
592
593 AC_CHECK_FUNC(getopt_long,
594          AC_DEFINE([HAVE_GETOPT_LONG],1,[Define to 1 if you have `getopt_long function'])
595          tm_cv_needgetopt="no",
596          tm_cv_needgetopt="yes")
597 AM_CONDITIONAL([NEEDGETOPT], test "x$tm_cv_needgetopt" = "xyes")
598
599 # Checks on cygnus and MYSYS
600 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes; then
601   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
602   *yes*)
603     AC_CHECK_FUNC(opendir,,
604   [ EXTRADEFS="$EXTRADEFS -D__W32READDIR__"
605     W32READDIR=yes ])
606     ;;
607   *)EXTRADEFS="$EXTRADEFS -D__W32READDIR__"
608     W32READDIR=yes
609     ;;
610   esac
611   if test "x$enable_network" = "xyes"; then
612         if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then
613       EXTRALIBS="$EXTRALIBS  wsock32.lib"
614       EXTRADEFS="$EXTRADEFS -DWINSOCK" 
615     else
616       AC_CHECK_FUNC(socket,,
617        WAPI_CHECK_LIB(wsock32,WSAStartup,
618              [#include <winsock.h>],
619              [WSAStartup(0,0);],
620          [ EXTRALIBS="$EXTRALIBS -lwsock32"
621           EXTRADEFS="$EXTRADEFS -DWINSOCK" ]
622        )
623       )
624     fi
625   fi
626 fi
627
628 # Checks on extra paths
629
630 dnl tcltk paths
631 AC_ARG_WITH(tcl-includes,
632   [  --with-tcl-includes=DIR Tcl include file path ],
633   [ if test ! -d $withval; then
634       AC_MSG_WARN($withval is not found.)
635     fi
636     tcl_include_dir="-I$withval"
637   ])
638 AC_ARG_WITH(tcl-libs,
639   [  --with-tcl-libs=DIR     Tcl library file path ],
640   [ if test ! -d $withval; then
641       AC_MSG_WARN($withval is not found.)
642     fi
643     tcl_libdir="-L$withval" ])
644 AC_ARG_WITH(tk-includes,
645   [  --with-tk-includes=DIR  Tk include file path ],
646   [ if test ! -d $withval; then
647       AC_MSG_WARN($withval is not found.)
648     fi
649     tk_includes="-I$withval" ])
650 AC_ARG_WITH(tk-libs,
651   [  --with-tk-libs=DIR      Tk library file path ],
652   [ if test ! -d $withval; then
653       AC_MSG_WARN($withval is not found.)
654     fi
655     tk_libdir="-L$withval" ])
656
657 dnl offix paths
658 AC_ARG_WITH(offix-includes,
659   [  --with-offix-includes=DIR Offix include file path ],
660   [ if test ! -d $withval; then
661       AC_MSG_WARN($withval is not found.)
662     fi
663     offix_include_dir="-I$withval" ])
664 AC_ARG_WITH(offix-libs,
665   [  --with-offix-libs=DIR   Offix include file path ],
666   [ if test ! -d $withval; then
667       AC_MSG_WARN($withval is not found.)
668     fi
669     offix_lib_dir="-L$withval" ])
670
671
672 #
673 # audio section
674 #
675 dnl default(d): auto selection
676 dnl oss(d):     OSS /dev/dsp
677 dnl alsa(d):    ALSA pcm device
678 dnl sun(d):     SunOS /dev/audio
679 dnl hpux(d):    HPUX /dev/audio
680 dnl irix(d):    IRIX audio
681 dnl mme(d):     OSF/1 MME
682 dnl sb_dsp(d):  BSD/OS 2.0 /dev/sb_dsp
683 dnl w32(d):     Windows MMS
684 dnl darwin(d):  Mac OS X pcm device
685 dnl alsa(s):    ALSA pcm device
686 dnl alib(A):    HPUX network audio (Alib)
687 dnl nas(n):     Network Audio System
688 dnl arts(R):    aRts
689 dnl esd(e):     EsounD
690 dnl portaudio(p) PortAudio
691 dnl vorbis(v):  Ogg Vorbis
692 dnl flac(F):    FLAC / OggFLAC
693 dnl speex(S):   Ogg Speex
694 dnl gogo(g):    MP3 GOGO
695 dnl jack(j):    JACK
696 dnl ao(O):      Libao
697
698 audio_targets='default oss alsa sun hpux irix mme sb_dsp w32 alib nas arts esd vorbis flac gogo portaudio jack ao'
699
700 AC_ARG_WITH(nas-library,
701   [  --with-nas-library=library NAS absolute library path(Don't use -laudio)])
702 AC_ARG_WITH(nas-includes,
703   [  --with-nas-includes=DIR NAS include files are in dir])
704
705
706 AC_ARG_ENABLE(audio,
707   [  --enable-audio[=mode_list] Enable audio (Specify comma separated mode list):
708                               default:   Automatically select audio device.
709                               oss:       OSS /dev/dsp
710                               sun:       SunOS /dev/audio
711                               hpux:      HPUX /dev/audio
712                               irix:      IRIX audio library
713                               mme:       OSF/1 MME
714                               sb_dsp:    BSD/OS 2.0 /dev/sb_dsp
715                               w32:       Windows MMS
716                               darwin:    Darwin CoreAudio
717                               alsa:      ALSA pcm device
718                               alib:      HPUX network audio (Alib)
719                               nas:       NAS - Network Audio System
720                               arts:      aRts
721                               esd:       EsounD - Enlightened Sound Daemon
722                               portaudio: PortAudio
723                               jack:      JACK
724                               ao:        Libao
725                               vorbis:    Ogg Vorbis
726                               flac:      FLAC / OggFLAC
727                               speex:     Ogg Speex
728                               gogo:      MP3 GOGO (Only Windows is supported)],
729   [ enable_audio=$enableval
730     have_audio_opt=yes ],
731   [ enable_audio=yes
732     have_audio_opt=no ])
733
734 dnl yes -> default
735 test "x$enable_audio" = xyes && enable_audio=default
736
737 if test "x$enable_audio" != xno; then
738   for i in `echo $enable_audio | sed 's/,/ /g'`; do
739     eval "au_enable_$i=yes"
740   done
741 fi
742
743 dnl Turn on default output mode
744 DEFAULT_PLAYMODE=
745 AC_ARG_WITH(default-output,
746   [  --with-default-output=<mode>  Specify default output mode (optional):
747                                 (default|alsa|alib|arts|nas|
748                                 esd|wav|au|aiff|list|vorbis|flac|speex|
749                                 gogo|portaudio|jack|ao)],
750   [ if test "$enable_audio" != no; then
751     DEFAULT_PLAYMODE=$withval
752     eval "au_enable_$DEFAULT_PLAYMODE=yes"
753   else
754     AC_MSG_WARN(--with-default-output=$withval: audio is not enabled)
755   fi])
756
757 dnl compatibility matters.
758 dnl AC_ARG_ENABLE(esd,
759 dnl   [  --enable-esd         EsounD (Obsoleted.  Use --enable-audio=esd)],
760 dnl   [ au_enable_esd=$enableval ])
761 dnl AC_ARG_ENABLE(nas,
762 dnl   [  --enable-nas         NAS  (Obsoleted.  Use --enable-audio=nas)],
763 dnl   [ au_enable_nas=$enableval ])
764 dnl AC_ARG_ENABLE(alsa,
765 dnl   [  --enable-alsa        ALSA   (Obsoleted.  Use --enable-audio=alsa)],
766 dnl   [ au_enable_alsa=$enableval ])
767
768 dnl target-specific defaults
769 if test "x$au_enable_default" = xyes; then
770   case "$target" in
771   *-*-linux*|*-*-freebsd*)
772     au_enable_oss=yes
773     ;;
774   *-*-bsdi2.0)
775     au_enable_sb_dsp=yes
776     ;;
777   *-*-bsdi2.1|*-*-bsdi3.?|*-*-bsdi4.?)
778     au_enable_oss=yes
779     ;;
780   *-*-hpux*)
781     au_enable_hpux=yes
782     ;;
783   *-dec-*)
784     au_enable_mme=yes
785     ;;
786   *irix*)
787     au_enable_irix=yes
788     ;;
789   *-*-sunos4*)
790     au_enable_sun=yes
791     ;;
792   *-*-solaris*)
793     au_enable_sun=yes
794     ;;
795   *-*-netbsd*)
796     au_enable_sun=yes
797     ;;
798   *-*-cygwin*)
799     au_enable_w32=yes
800     ;;
801   *-*-mingw*)
802     au_enable_w32=yes
803     ;;
804   *-*-darwin*)
805     au_enable_darwin=yes
806     ;;
807   *)
808     AC_MSG_WARN(No --enable-audio=default audio for $target)
809     ;;
810   esac
811 fi
812
813
814 # Each audio mode's configurations
815 dnl oss
816 AC_MSG_CHECKING(enable_audio=oss)
817 if test "x$au_enable_oss" = xyes; then
818   EXTRADEFS="$EXTRADEFS -DAU_OSS"
819   SYSEXTRAS="$SYSEXTRAS oss_a.c"
820   if test "x$ac_cv_header_sys_soundcard_h" = xyes; then
821     AC_MSG_RESULT(yes - <sys/soundcard.h>)
822   else
823     case "$target" in
824       *linux*|*freebsd*)
825         dnl <linux/soundcard.h> or <machine/soundcard.h>
826         AC_MSG_RESULT(yes)
827         ;;
828       *)
829         if test "x$ac_cv_header_soundcard_h" = xyes; then
830           AC_MSG_RESULT(yes - <soundcard.h>)
831         else
832           AC_MSG_WARN(<sys/soundcard.h> is not found)
833         fi
834         ;;
835     esac
836   fi
837   AC_CHECK_LIB(ossaudio,open)
838
839   dnl Why OpenBSD use /dev/audio instead of /dev/dsp for OSS
840   case "$target" in
841     *openbsd*)
842       if test ! -e "/dev/dsp"; then
843         oss_device=/dev/audio
844       fi
845       ;;
846   esac
847 else
848   AC_MSG_RESULT(no)
849 fi
850
851 dnl SunOS's
852 AC_MSG_CHECKING(enable_audio=sun)
853 if test "x$au_enable_sun" = xyes; then
854   case "$target" in
855     *-*-sunos4*)
856       if test -f /usr/demo/SOUND/libaudio.a; then
857         EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/libaudio.a"
858         AC_MSG_RESULT(yes)
859       else
860         AC_MSG_RESULT(Notice: libaudio.a is not found [(ignore)])
861       fi
862       ;;
863     *-*-solaris*)
864       if test -f /usr/demo/SOUND/lib/libaudio.a; then
865         EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/lib/libaudio.a"
866         AC_MSG_RESULT(yes)
867       else
868         AC_MSG_RESULT(Notice: libaudio.a is not found [(ignore)])
869       fi
870       ;;
871     *)   AC_MSG_RESULT(yes)
872       ;;
873   esac
874   EXTRADEFS="$EXTRADEFS -DAU_SUN"
875   SYSEXTRAS="$SYSEXTRAS sun_a.c"
876 else
877   AC_MSG_RESULT(no)
878 fi
879
880 dnl HP-UX's
881 AC_MSG_CHECKING(enable_audio=hpux)
882 if test "x$au_enable_hpux" = xyes; then
883   case "$target" in
884     *-*-hpux*) AC_MSG_RESULT(yes) ;;
885     *) AC_MSG_WARN(may not work on $target) ;;
886   esac
887   EXTRADEFS="$EXTRADEFS -DAU_HPUX_AUDIO"
888   SYSEXTRAS="$SYSEXTRAS hpux_d_a.c"
889 else
890   AC_MSG_RESULT(no)
891 fi
892
893 dnl Irix's
894 AC_MSG_CHECKING(enable_audio=irix)
895 if test "x$au_enable_irix" = xyes; then
896   case "$target" in
897     *-sgi-irix5*|*-sgi-irix6.2)
898       EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_OLDAL"
899       AC_MSG_RESULT(yes)
900       ;;
901     *-sgi-irix6*)
902       EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_NEWAL"
903       AC_MSG_RESULT(yes)
904       ;;
905     *) AC_MSG_WARN(may not work on $target) ;;
906   esac
907   SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_al.c"
908   EXTRALIBS="$EXTRASLIBS -laudio"
909 else
910   AC_MSG_RESULT(no)
911 fi
912
913 dnl OSF/1 MME
914 AC_MSG_CHECKING(enable_audio=mme)
915 if test "x$au_enable_mme" = xyes; then
916   case "$target" in
917     *-dec-*) AC_MSG_RESULT(yes) ;;
918     *) AC_MSG_WARN(may not work on $target) ;;
919   esac
920   EXTRADEFS="$EXTRADEFS -DAU_DEC -DAU_AUDRIV"
921   SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_mme.c"
922   CPPFLAGS="$CPPFLAGS -I/usr/opt/MME210/include"
923   EXTRALIBS="$EXTRALIBS /usr/opt/MME220/lib/libmme.a"
924 else
925   AC_MSG_RESULT(no)
926 fi
927
928 dnl BSD/OS's sb_dsp
929 AC_MSG_CHECKING(enable_audio=sb_dsp)
930 if test "x$au_enable_sb_dsp" = xyes; then
931   case "$target" in
932     *-*-bsdi2.0) AC_MSG_RESULT(yes) ;;
933     *) AC_MSG_WARN(may not work on $target) ;;
934   esac
935   EXTRADEFS="$EXTRADEFS -DAU_BSDI -DDEFAULT_RATE=22500"
936   SYSEXTRAS="$SYSEXTRAS bsd20_a.c"
937 else
938   AC_MSG_RESULT(no)
939 fi
940
941 dnl Windows' MME
942 AC_MSG_CHECKING(enable_audio=w32)
943 if test "x$au_enable_w32" = xyes; then
944   case "$target" in
945     *-*-cygwin*)
946      AC_MSG_RESULT(yes)
947      ;;
948     *-*-mingw32)
949      AC_MSG_RESULT(yes)
950      ;;
951     *)
952      AC_MSG_WARN(may not work on $target)
953      ;;
954   esac
955   SYSEXTRAS="$SYSEXTRAS w32_a.c"
956   if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then
957         EXTRALIBS="$EXTRALIBS winmm.lib"
958   else
959     EXTRALIBS="$EXTRALIBS -lwinmm"
960   fi
961   EXTRADEFS="$EXTRADEFS -DAU_W32"
962 else
963   AC_MSG_RESULT(no)
964 fi
965
966 dnl Mac OS X / darwin-x86
967 AC_MSG_CHECKING(enable_audio=darwin)
968 if test "x$au_enable_darwin" = xyes; then
969   EXTRADEFS="$EXTRADEFS -DAU_DARWIN"
970   SYSEXTRAS="$SYSEXTRAS darwin_a.c"
971   EXTRALIBS="$EXTRALIBS -framework CoreAudio"
972   dnl just say yes or no :-P
973   case "$target" in
974     *-*-darwin*)
975      AC_MSG_RESULT(yes);;
976    *)
977      AC_MSG_WARN(may not work on $target)
978      ;;
979   esac
980 else
981   AC_MSG_RESULT(no)
982 fi
983
984
985 dnl alsa - Advanced Linux Sound Architecture
986 AC_MSG_CHECKING(enable_audio=alsa)
987 if test "x$au_enable_alsa" = xyes; then
988   AC_MSG_RESULT([yes, configuring alsa])
989   KEEPCFLAGS=$CFLAGS
990   KEEPLIBS=$LIBS
991   KEEPLDFLAGS=$LDFLAGS
992   AM_PATH_ALSA()
993   if test "x$alsa_found" = "xyes" ; then
994     dnl AC_MSG_RESULT(yes)
995     EXTRADEFS="$EXTRADEFS -DAU_ALSA"
996     SYSEXTRAS="$SYSEXTRAS alsa_a.c"
997     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ALSA_CFLAGS)
998     LIBS="$LIBS $ALSA_LIBS"
999     AC_CHECK_FUNCS(snd_seq_port_info_set_timestamping)
1000   else
1001     AC_MSG_WARN(Couldn't configure alsa.)
1002     CFLAGS=$KEEPCFLAGS
1003     LIBS=$KEEPLIBS
1004     LDFLAGS=$KEEPLDFLAGS
1005   fi
1006 else
1007   AC_MSG_RESULT(no)
1008 fi
1009
1010 dnl HP-UX Alib
1011 AC_MSG_CHECKING(enable_audio=alib)
1012 if test "x$au_enable_alib" = xyes; then
1013   case "$target" in
1014     *-*-hpux*) AC_MSG_RESULT(yes) ;;
1015     *) AC_MSG_WARN(may not work on $target) ;;
1016   esac
1017   SYSEXTRAS="$SYSEXTRAS hpux_a.c"
1018   EXTRADEFS="$EXTRADEFS -DAU_HPUX_ALIB"
1019   if test -d /opt/audio/include; then
1020     CPPFLAGS="$CPPFLAGS -I/opt/audio/include"
1021   fi
1022   if test -d /opt/audio/lib; then
1023     EXTRALIBS="$EXTRALIBS -L/opt/audio/lib"
1024   fi
1025   EXTRALIBS="$EXTRALIBS -lAlib"
1026 else
1027   AC_MSG_RESULT(no)
1028 fi
1029
1030 dnl nas
1031 AC_MSG_CHECKING(enable_audio=nas)
1032 if test "x$au_enable_nas" = xyes; then
1033   if test "x$with_x" != xyes; then
1034     AC_MSG_ERROR(nas: --with-x option must be specified)
1035   fi
1036   EXTRADEFS="$EXTRADEFS -DAU_NAS"
1037   SYSEXTRAS="$SYSEXTRAS nas_a.c"
1038
1039   dnl -laudio conflicts another audio library,
1040   dnl so I specify NAS library with absolete path.
1041
1042   if test "x$with_nas_library" != x; then
1043     AC_MSG_RESULT($with_nas_library);
1044     EXTRALIBS="$EXTRALIBS $with_nas_library"
1045   else
1046     AC_MSG_RESULT()
1047     MY_SEARCH_LIBS(AuOpenServer,
1048         [$x_libraries/libaudio.a \
1049          /usr/lib/libaudio.so \
1050          /usr/lib/libaudio.a ],
1051         [ AC_MSG_RESULT(NAS: $timidity_cv_search_AuOpenServer)
1052           EXTRALIBS="$EXTRALIBS $timidity_cv_search_AuOpenServer"],
1053         [AC_MSG_WARN(NAS library is not found.)])
1054   fi
1055   test "x$with_nas_includes" != x && CPPFLAGS="$CPPFLAGS -I$with_nas_includes"
1056   lib_xt_opt=-lXt
1057   if test "x$have_xext" = xyes; then
1058     lib_xext_opt=-lXext
1059   fi
1060   if test "x$have_xprelibs" = xyes; then
1061     lib_xprelibs_opt='-lSM -lICE'
1062   fi
1063 else
1064   AC_MSG_RESULT(no)
1065 fi
1066
1067 dnl aRts of KDE
1068 AC_MSG_CHECKING(enable_audio=arts)
1069 if test "x$au_enable_arts" = xyes; then
1070   AC_MSG_RESULT([yes, configuring aRts])
1071   KEEPCFLAGS=$CFLAGS
1072   KEEPLIBS=$LIBS
1073   KEEPLDFLAGS=$LDFLAGS
1074   AM_PATH_ARTS()
1075   CFLAGS=$KEEPCFLAGS
1076   LIBS=$KEEPLIBS
1077   LDFLAGS=$KEEPLDFLAGS
1078   if test "x$no_arts" = x; then
1079     dnl AC_MSG_RESULT(aRts: Enabled)
1080     EXTRADEFS="$EXTRADEFS -DAU_ARTS"
1081     SYSEXTRAS="$SYSEXTRAS aRts_a.c"
1082     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ARTS_CFLAGS)
1083     LIBS="$LIBS $ARTS_LIBS"
1084   else
1085     AC_MSG_WARN(aRts: Couldn't configure)
1086   fi
1087 else
1088   AC_MSG_RESULT(no)
1089 fi
1090
1091 dnl EsounD
1092 AC_MSG_CHECKING(enable_audio=esd)
1093 if test "x$au_enable_esd" = xyes; then
1094   AC_MSG_RESULT([yes, configuring esd])
1095   KEEPCFLAGS=$CFLAGS
1096   KEEPLIBS=$LIBS
1097   KEEPLDFLAGS=$LDFLAGS
1098   AM_PATH_ESD()
1099   CFLAGS=$KEEPCFLAGS
1100   LIBS=$KEEPLIBS
1101   LDFLAGS=$KEEPLDFLAGS
1102   if test "x$no_esd" = x; then
1103     dnl AC_MSG_RESULT(EsounD: Enabled)
1104     EXTRADEFS="$EXTRADEFS -DAU_ESD"
1105     SYSEXTRAS="$SYSEXTRAS esd_a.c"
1106     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ESD_CFLAGS)
1107     LIBS="$LIBS $ESD_LIBS"
1108   else
1109     AC_MSG_WARN(EsounD: Couldn't configure)
1110   fi
1111 else
1112   AC_MSG_RESULT(no)
1113 fi
1114
1115 dnl portaudio E
1116 AC_MSG_CHECKING(enable_audio=portaudio)
1117 if test "x$au_enable_portaudio" = xyes; then
1118   AC_MSG_RESULT(yes)
1119   if test "x$CYGNUS" = xyes ||test "x$MSYS" = xyes; then
1120         SYSEXTRAS="$SYSEXTRAS portaudio_a.c w32_portaudio_dll.c"
1121         EXTRALIBS="$EXTRALIBS -lportaudio"
1122         EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO -DAU_PORTAUDIO_DLL"
1123   else
1124         SYSEXTRAS="$SYSEXTRAS portaudio_a.c"
1125         EXTRALIBS="$EXTRALIBS -lportaudio"
1126         EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO"
1127   fi
1128 else
1129   AC_MSG_RESULT(no)
1130 fi
1131
1132 dnl JACK
1133 AC_MSG_CHECKING(enable_audio=jack)
1134 if test "x$au_enable_jack" = xyes; then
1135   AC_MSG_RESULT(yes)
1136   SYSEXTRAS="$SYSEXTRAS jack_a.c"
1137   EXTRALIBS="$EXTRALIBS $(pkg-config --libs jack)"
1138   EXTRADEFS="$EXTRADEFS -DAU_JACK $(pkg-config --cflags jack)"
1139 else
1140   AC_MSG_RESULT(no)
1141 fi
1142
1143 dnl AO
1144 AC_MSG_CHECKING(enable_audio=ao)
1145 if test "x$au_enable_ao" = xyes; then
1146   AC_MSG_RESULT([yes, configuring ao])
1147   XIPH_PATH_AO()
1148   if test "x$no_ao" = "x" ; then
1149     # AC_MSG_RESULT(yes)
1150     EXTRADEFS="$EXTRADEFS -DAU_AO"
1151     SYSEXTRAS="$SYSEXTRAS ao_a.c"
1152     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$AO_CFLAGS)
1153     LIBS="$LIBS $AO_LIBS"
1154   else
1155     AC_MSG_WARN(Couldn't configure libao.)
1156   fi
1157 else
1158   AC_MSG_RESULT(no)
1159 fi
1160
1161 dnl ogg's vorbis
1162 AC_MSG_CHECKING(enable_audio=vorbis)
1163 if test "x$au_enable_vorbis" = xyes; then
1164   AC_MSG_RESULT([yes, configuring vorbis])
1165   AM_PATH_OGG([
1166     AM_PATH_VORBIS([
1167       have_vorbis=yes
1168       SYSEXTRAS="$SYSEXTRAS vorbis_a.c"
1169       EXTRADEFS="$EXTRADEFS -DAU_VORBIS $OGG_CFLAGS $VORBIS_CFLAGS"
1170       EXTRALIBS="$EXTRALIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
1171       if test "x$CYGNUS" = "xyes"; then
1172       EXTRADEFS="-DAU_VORBIS_DLL $EXTRADEFS"
1173           SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c"
1174       fi
1175       if test "x$MSYS" = "xyes"; then
1176       EXTRADEFS="-DAU_VORBIS_DLL $EXTRADEFS"
1177           SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c"
1178       fi
1179     ],[
1180       AC_MSG_WARN([Unable to configure vorbis, but ogg is there (???)])
1181     ])
1182   ],[
1183     AC_MSG_WARN(Unable to configure vorbis!)
1184     have_vorbis=no
1185   ])
1186 else
1187   AC_MSG_RESULT(no)
1188 fi
1189
1190 dnl libFLAC - Free Lossless Audio Codec
1191 if test "x$CYGNUS" = xyes || test "x$MSYS" = xyes ; then
1192   AC_MSG_CHECKING(enable_audio=flac)
1193   if test "x$au_enable_flac" = xyes; then
1194     AC_MSG_RESULT([yes, configuring flac])
1195     SYSEXTRAS="$SYSEXTRAS flac_a.c w32_libFLAC_dll.c w32_libOggFLAC_dll.c"
1196     AM_PATH_LIBFLAC([
1197       EXTRADEFS="$EXTRADEFS -DAU_FLAC -DAU_FLAC_DLL"
1198       EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBFLAC_CFLAGS)
1199       LIBS="$LIBS $LIBFLAC_LIBS"
1200     ])
1201     AM_PATH_LIBOGGFLAC([
1202       EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC -DAU_OGGFLAC_DLL"
1203       EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBOGGFLAC_CFLAGS)
1204       LIBS="$LIBS $LIBOGGFLAC_LIBS"
1205     ])
1206   else
1207     AC_MSG_RESULT(no)
1208   fi
1209 else
1210   AC_MSG_CHECKING(enable_audio=flac)
1211   if test "x$au_enable_flac" = xyes; then
1212     AC_MSG_RESULT([yes, configuring flac])
1213     SYSEXTRAS="$SYSEXTRAS flac_a.c"
1214     AM_PATH_LIBFLAC([
1215       EXTRADEFS="$EXTRADEFS -DAU_FLAC"
1216       EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBFLAC_CFLAGS)
1217       LIBS="$LIBS $LIBFLAC_LIBS"
1218     ])
1219     AM_PATH_LIBOGGFLAC([
1220       EXTRADEFS="$EXTRADEFS -DAU_OGGFLAC"
1221       EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$LIBOGGFLAC_CFLAGS)
1222       LIBS="$LIBS $LIBOGGFLAC_LIBS"
1223     ])
1224   else
1225     AC_MSG_RESULT(no)
1226   fi
1227 fi
1228 dnl ogg's speex
1229 AC_MSG_CHECKING(enable_audio=speex)
1230 if test "x$au_enable_speex" = xyes; then
1231   AC_CACHE_VAL(have_speex,
1232   [AC_TRY_LINK([
1233   #include <speex.h>
1234   #include <ogg/ogg.h>
1235   ],
1236   [
1237     SpeexBits *dummy;
1238   ],
1239   [have_speex=yes], [have_speex=no])])
1240   AC_MSG_RESULT($have_speex)
1241   if test "x$have_speex" = xyes; then
1242     SYSEXTRAS="$SYSEXTRAS speex_a.c"
1243     EXTRALIBS="$EXTRALIBS -lspeex -logg"
1244     EXTRADEFS="$EXTRADEFS -DAU_SPEEX"
1245   fi
1246 else
1247   AC_MSG_RESULT(no)
1248 fi
1249
1250 dnl Win32 Gogo-no-coder
1251 AC_MSG_CHECKING(enable_audio=gogo)
1252 if test "x$au_enable_gogo" = xyes; then
1253   if test "x$CYGNUS" = "xyes"; then
1254     AC_MSG_RESULT(yes, configuring gogo)
1255   else
1256     if test "x$MSYS" = "xyes"; then
1257     AC_MSG_RESULT(yes, configuring gogo)
1258     else
1259       AC_MSG_WARN(May be gogo is not supported.  You need hack the gogo_a.c)
1260     fi
1261   fi
1262   have_gogo=yes
1263   SYSEXTRAS="$SYSEXTRAS gogo_a.c w32_gogo.c"
1264   EXTRADEFS="$EXTRADEFS -DAU_GOGO -DAU_GOGO_DLL"
1265   EXTRALIBS="$EXTRALIBS -lgogo"
1266 else
1267   AC_MSG_RESULT(no)
1268 fi
1269
1270 dnl Pseudo audio device (Undocumented).
1271 if test "x$au_enable_none" = xyes; then
1272     EXTRADEFS="$EXTRADEFS -DAU_NONE -DAU_AUDRIV"
1273     SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_none.c"
1274 fi
1275 dnl
1276 dnl TIMIDITY_OUTPUT_ID
1277 dnl
1278 AC_MSG_CHECKING(default output mode)
1279 if test "x$DEFAULT_PLAYMODE" = x; then
1280   DEFAULT_PLAYMODE=`echo $enable_audio | sed 's/,.*//'`
1281 fi
1282 case ".$DEFAULT_PLAYMODE" in
1283   .default)  TIMIDITY_OUTPUT_ID=d ;;
1284   .oss)      TIMIDITY_OUTPUT_ID=d ;;
1285   .alsa)     TIMIDITY_OUTPUT_ID=s ;;
1286   .sun)      TIMIDITY_OUTPUT_ID=d ;;
1287   .hpux)     TIMIDITY_OUTPUT_ID=d ;;
1288   .irix)     TIMIDITY_OUTPUT_ID=d ;;
1289   .mme)      TIMIDITY_OUTPUT_ID=d ;;
1290   .sb_dsp)   TIMIDITY_OUTPUT_ID=d ;;
1291   .darwin)   TIMIDITY_OUTPUT_ID=d ;;
1292   .w32)      TIMIDITY_OUTPUT_ID=d ;;
1293   .alib)     TIMIDITY_OUTPUT_ID=A ;;
1294   .nas)      TIMIDITY_OUTPUT_ID=n ;;
1295   .arts)     TIMIDITY_OUTPUT_ID=R ;;
1296   .esd)      TIMIDITY_OUTPUT_ID=e ;;
1297   .portaudio)      TIMIDITY_OUTPUT_ID=p ;;  
1298   .wav)      TIMIDITY_OUTPUT_ID=w ;;
1299   .au)       TIMIDITY_OUTPUT_ID=u ;;
1300   .aiff)     TIMIDITY_OUTPUT_ID=a ;;
1301   .list)     TIMIDITY_OUTPUT_ID=l ;;
1302   .vorbis)   TIMIDITY_OUTPUT_ID=v ;;
1303   .flac)     TIMIDITY_OUTPUT_ID=F ;;
1304   .speex)    TIMIDITY_OUTPUT_ID=S ;;
1305   .gogo)     TIMIDITY_OUTPUT_ID=g ;;
1306   .jack)     TIMIDITY_OUTPUT_ID=j ;;
1307   *)         TIMIDITY_OUTPUT_ID= ;;
1308 esac
1309 AC_MSG_RESULT($DEFAULT_PLAYMODE/$TIMIDITY_OUTPUT_ID)
1310
1311 #
1312 # Interface Section
1313 #
1314
1315 interface_targets='dynamic ncurses slang motif tcltk emacs vt100 xaw xskin gtk alsaseq winsyn winsyng portmidisyng'
1316
1317 AC_ARG_ENABLE(interface,
1318   [  --enable-interface=[interface_list]
1319                           Comma separated interface list ],
1320   [ for i in `echo $enableval | sed 's/,/ /g'`; do
1321       eval "enable_$i=yes"
1322     done ])
1323
1324 #  Dynamic link configuration
1325 AC_ARG_ENABLE(dynamic,
1326   [  --enable-dynamic        Enable dynamic link interface   (default is no)
1327   --enable-dynamic=dynamic_list
1328                           Comma separated dynamic interface list],
1329   [ dnl --enable-dynamic=yes to --enable-dynamic=dynamic
1330     if test "x$enable_dynamic" = xyes; then
1331       enable_dynamic=dynamic
1332     elif test "x$enable_dynamic" != xno; then
1333       for i in `echo $enableval | sed 's/,/ /g'`; do
1334         eval "enable_$i=dynamic"
1335       done
1336     fi])
1337
1338 join_targets=
1339 for i in $interface_targets; do
1340   eval "join_targets=$join_targets\$enable_$i"
1341 done
1342
1343 case ".$join_targets" in
1344 .*dynamic*) NEEDDLOPEN=yes;;
1345 *)          NEEDDLOPEN=no;;
1346 esac
1347
1348 dnl check -fpic option for gcc
1349 if test "x$GCC" = xyes; then SHCFLAGS="$SHCFLAGS -fPIC"; fi
1350 case "x$enable_ump" in xyes|xdynamic) EXTRACFLAGS="$EXTRACFLAGS -DXP_UNIX $SHCFLAGS";; esac
1351
1352 dnl Which type of dynamic loader?
1353 if test "$NEEDDLOPEN" = "yes"; then
1354   have_dl=no
1355
1356   WAPI_CHECK_FUNC(LoadLibrary,,[LoadLibrary(0);],have_dl=w32)
1357   test $wapi_cv_func_LoadLibrary = yes && have_dl=w32
1358
1359   if test "$have_dl" = "no"; then
1360     AC_CHECK_FUNC(shl_load,have_dl=hpux)
1361   fi
1362   if test "$have_dl" = "no"; then
1363     dnl darwin has both dyld and libdl: in case user installed dlcompat.
1364     dnl dyld is recommended because libdl is a wrapper for dyld.
1365     AC_CHECK_FUNC(NSLinkModule,have_dl=dyld)
1366   fi
1367   if test "$have_dl" = "no" -a "x$ac_cv_lib_dl_dlopen" = xyes; then
1368     have_dl=dlopen
1369   fi
1370   if test "$have_dl" = "no"; then
1371     AC_CHECK_FUNC(dlopen,have_dl=dlopen)
1372   fi
1373   if test "$have_dl" = "no"; then
1374     AC_CHECK_FUNC(dld_init,have_dl=dld)
1375   fi
1376   if test "$have_dl" = "no"; then
1377     AC_CHECK_LIB(dld,dld_init,have_dl=dld;lib_dl_opt=-ldld)
1378   fi
1379
1380   AC_MSG_CHECKING(dynamic link method)
1381   case "$have_dl" in
1382     dlopen)
1383       AC_MSG_RESULT(use dl_dlopen.c)
1384       SYSEXTRAS="$SYSEXTRAS dl_dlopen.c"
1385       CHECK_DLSYM_UNDERSCORE(AC_DEFINE(DLSYM_NEEDS_UNDERSCORE,1,Define to 1 if you have to add "_" to every identifiers.))
1386       ;;
1387     dld)
1388       AC_MSG_RESULT(use dl_dld.c)
1389       SYSEXTRAS="$SYSEXTRAS dl_dld.c"
1390       ;;
1391     hpux)
1392       AC_MSG_RESULT(use dl_hpux.c)
1393       SYSEXTRAS="$SYSEXTRAS dl_hpux.c"
1394       LDFLAGS="$LDFLAGS -Wl,-E $LDFLAGS"
1395       ;;
1396     w32)
1397       AC_MSG_RESULT(use dl_w32.c)
1398       SYSEXTRAS="$SYSEXTRAS dl_w32.c"
1399       ;;
1400     dyld)
1401       AC_MSG_RESULT(use dl_dyld.c)
1402       SYSEXTRAS="$SYSEXTRAS dl_dyld.c"
1403       ;;
1404     *)
1405       NEEDDLOPEN="no"
1406       AC_MSG_WARN(no method to open a shared object)
1407       ;;
1408   esac
1409 fi
1410
1411 if test "$NEEDDLOPEN" = "yes"; then
1412   MY_DEFINE(IA_DYNAMIC)
1413   AC_DEFINE_UNQUOTED(SHARED_LIB_EXT,".$so", shared library extention)
1414   dnl needless?
1415   dnl EXTRADEFS="$EXTRADEFS \$(DEF_SHLIB_DIR)"
1416   test "x$GCC" = xyes -a "x$timidity_cv_ccoption_rdynamic" = xyes  && timidity_LDFLAGS="-rdynamic"
1417 fi
1418
1419 AM_CONDITIONAL(NEEDDLOPEN, test "$NEEDDLOPEN" = "yes")
1420
1421 dnl
1422 dnl Each interface section
1423 dnl
1424
1425 dnl ncurses
1426 AM_CONDITIONAL(ENABLE_NCURSES, false)
1427 CONFIG_INTERFACE(ncurses,NCURSES,n,
1428   [  --enable-ncurses        Enable ncurses interface        (default is no)],
1429   [ AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h)
1430
1431 dnl #include <ncurses/curses.h> is failure on Plamo Linux 1.3/ncurses 1.9.9e
1432 dnl because <ncurses/curses.h> includes <unctrl.h>:
1433 dnl /usr/include/ncurses/curses.h:34: unctrl.h: No such file or directory
1434 dnl But surely there is unctl.h at /usr/include/ncurses/unctrl.h.
1435 dnl configure must check ncurses header with -I/usr/include/ncurses option.
1436
1437   case "$ac_cv_header_curses_h$ac_cv_header_ncurses_curses_h$ac_cv_header_ncurses_h" in
1438     *yes*);;
1439     *)  for i in /usr/include /usr/local/include; do
1440           if test -f "$i/ncurses/curses.h" -a -f "$i/ncurses/unctrl.h"; then
1441             AC_MSG_WARN(ncurses test is failure.  Please check config.h and common.makefile later)
1442             CPPFLAGS="$CPPFLAGS -I$i/ncurses"
1443             break
1444           fi
1445         done
1446         ;;
1447     esac
1448
1449     AC_CHECK_LIB(ncurses,initscr,lib_curses_opt=-lncurses,
1450       [ dnl checking pdcurses
1451         AC_CHECK_LIB(curses,PDC_set_ctrl_break,
1452           [ lib_curses_opt=-lcurses
1453             AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
1454             lib_user32_opt="$lib_user32_test"
1455           ],
1456           [ dnl checking libpdcurses
1457             AC_CHECK_LIB(pdcurses,PDC_set_ctrl_break,
1458             [ lib_curses_opt=-lpdcurses
1459               AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
1460               lib_user32_opt="$lib_user32_test"
1461             ],
1462             [ dnl OpenBSD use -lcurses instead of -lncurses.
1463               case "$target" in
1464                 *openbsd*)
1465                   AC_CHECK_LIB(curses,initscr,lib_curses_opt=-lcurses,
1466                     [ AC_MSG_WARN(ncurses interface is not enabled)
1467                       enable_ncurses=no ])
1468                   ;;
1469                 *)
1470                   if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then
1471                     lib_curses_opt=libpdcurses.lib
1472                     AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
1473                   else
1474                     AC_MSG_WARN(ncurses interface is not enabled)
1475                     enable_ncurses=no
1476                   fi
1477                   ;;
1478               esac
1479             ])
1480         ],
1481         $lib_user32_test)
1482       ])
1483   ],
1484   [ LIBS="$LIBS $lib_curses_opt"
1485     case "$target" in
1486        *-*-freebsd[123]*)
1487          EXTRALIBS="$EXTRALIBS -lmytinfo"
1488          ;;
1489      esac
1490     INTERFACE_SRCS="$INTERFACE_SRCS ncurs_c.c"
1491   ],
1492   [ n_so_libs="$lib_curses_opt"
1493     case "$target" in
1494        *-*-freebsd[123]*)
1495          EXTRALIBS="$EXTRALIBS -lmytinfo"
1496          ;;
1497      esac])
1498
1499 dnl slang
1500 AM_CONDITIONAL(ENABLE_SLANG, false)
1501 CONFIG_INTERFACE(slang,SLANG,s,
1502   [  --enable-slang          Enable slang interface          (default is no)],
1503   [ AC_CHECK_LIB(slang,SLang_init_tty,:,
1504     [ enable_slang=no
1505       AC_MSG_WARN(slang interface is not enabled)
1506     ])
1507     AC_CHECK_HEADERS(slang/slang.h slang.h)
1508   ],
1509   [ LIBS="$LIBS -lslang"
1510     INTERFACE_SRCS="$INTERFACE_SRCS slang_c.c"
1511   ],
1512   [ s_so_libs="-lslang"
1513     AC_CHECK_LIB(termcap,initscr,s_so_libs="$s_so_libs -ltermcap")
1514   ])
1515
1516 dnl Motif
1517 AM_CONDITIONAL(ENABLE_MOTIF, false)
1518 CONFIG_INTERFACE(motif,MOTIF,m,
1519   [  --enable-motif          Enable motif interface          (default is no)],
1520   [ if test "x$with_x" != xyes; then
1521         AC_MSG_ERROR(motif: --with-x option must be specified)
1522     fi
1523     if test "x$have_xm" != xyes; then
1524       AC_MSG_WARN(Motif library is not found.)
1525       enable_motif=no
1526     fi
1527   ],
1528   [ lib_xm_opt=-lXm
1529     lib_xt_opt=-lXt
1530     lib_xext_opt=-lXext
1531     if test "x$have_xprelibs" = xyes; then
1532         lib_xprelibs_opt='-lSM -lICE'
1533     fi
1534     INTERFACE_SRCS="$INTERFACE_SRCS motif_c.c motif_i.c motif_p.c"
1535   ],
1536   [ if test x$have_xprelibs = xyes; then
1537       m_so_libs="-lXext -lSM -lICE"
1538     fi
1539     m_so_libs="$ldflags_x_opt -lXm -lXt $m_so_libs -lX11"
1540   ])
1541
1542 dnl Tcl/Tk
1543 AM_CONDITIONAL(ENABLE_TCLTK, false)
1544 CONFIG_INTERFACE(tcltk,TCLTK,k,
1545   [  --enable-tcltk          Enable tcltk interface          (default is no)],
1546   [ if test "x$with_x" != xyes; then
1547         AC_MSG_ERROR(tcltk: --with-x option must be specified)
1548     fi
1549
1550     dnl save flags
1551     KEEPCPPFLAGS=$CPPFLAGS
1552     KEEPLDFLAGS=$LDFLAGS
1553     KEEPLIBS=$LIBS
1554
1555     CPPFLAGS="$tcl_include_dir $tk_includes $CPPFLAGS"
1556     LDFLAGS="$tcl_libdir $tk_libdir $LDFLAGS"
1557     LIBS="$LIBS $lib_dl_opt"
1558
1559     tcl_lib=
1560     tk_lib=
1561     for l in tcl tcl8.4 tcl8.3 tcl8.0jp tcl7.6jp tcl80jp tcl76jp tcl8.0 tcl7.6 tcl80 tcl76; do
1562       case "x$tcl_lib" in x) AC_CHECK_LIB($l,Tcl_Init,tcl_lib=-l$l);; esac
1563     done
1564     LIBS="$LIBS $tcl_lib"
1565     for l in tk tk8.4 tk8.3 tk8.0jp tk4.2jp tk80jp tk42jp tk8.0 tk4.2 tk80 tk42; do
1566       case "x$tk_lib" in x) AC_CHECK_LIB($l,Tk_Init,tk_lib=-l$l);; esac
1567     done
1568
1569     LIBS=$KEEPLIBS
1570     if test "x$tcl_lib" = x -o "x$tk_lib" = x; then
1571       CPPFLAGS=$KEEPCPPFLAGS
1572       LDFLAGS=$KEEPLDFLAGS
1573       enable_tcltk=no
1574       AC_MSG_WARN(tcl/tk is not enable)
1575     else
1576       tcltk_dep='tclIndex'
1577     fi
1578   ],
1579   [ LIBS=`echo $LIBS | sed "s/-lX11/$tk_lib $tcl_lib -lX11/"`
1580     case "$target" in
1581       *-*-bsdi*)
1582         EXTRALIBS="$EXTRALIBS -lipc"
1583         ;;
1584     esac
1585     INTERFACE_SRCS="$INTERFACE_SRCS tk_c.c"
1586   ],
1587   [ k_so_libs="$tcl_libdir $tk_libdir $tcl_lib $tk_lib $lib_dl_opt"
1588     case "$target" in
1589       *-*-bsdi*)
1590         k_so_libs="$k_so_libs -lipc"
1591         ;;
1592     esac
1593     k_so_libs="$k_so_libs -lX11 -lm"
1594   ])
1595 AM_CONDITIONAL(ENABLE_DYNAMIC_TCLTK, test "x$enable_tcltk" = "xdynamic")
1596
1597 dnl Emacs
1598 AM_CONDITIONAL(ENABLE_EMACS, false)
1599 CONFIG_INTERFACE(emacs,EMACS,e,
1600   [  --enable-emacs          Enable emacs interface          (default is no)],
1601   ,
1602   [ ELFILES="$ELFILES timidity.el"
1603     INTERFACE_SRCS="$INTERFACE_SRCS emacs_c.c"
1604   ],
1605   [ ELFILES="$ELFILES timidity.el" ])
1606
1607 dnl VT100
1608 AM_CONDITIONAL(ENABLE_VT100, false)
1609 CONFIG_INTERFACE(vt100,VT100,T,
1610   [  --enable-vt100          Enable VT100 interface          (default is no)],
1611   ,
1612   [ INTERFACE_SRCS="$INTERFACE_SRCS vt100_c.c vt100.c" ])
1613
1614 dnl X Athena Widget
1615 AM_CONDITIONAL(ENABLE_XAW, false)
1616 CONFIG_INTERFACE(xaw,XAW,a,
1617   [  --enable-xaw            Enable athena interface         (default is no)],
1618   [ if test "x$with_x" != xyes; then
1619         AC_MSG_ERROR(xaw: --with-x option must be specified)
1620     fi
1621     if test "x$have_xaw" != "xyes" -a "x$have_xaw" != "x3d"; then
1622       AC_MSG_WARN(X Athena Widget library is not found.)
1623       enable_xaw=no
1624     fi ],
1625   [ dnl Add -lXext -lSM -lICE -lXmu -lXt {-lXaw|-lXaw3d}
1626     if test "x$have_xext" = xyes; then
1627       lib_xext_opt=-lXext
1628     fi
1629     if test "x$have_xprelibs" = xyes; then
1630       lib_xprelibs_opt='-lSM -lICE'
1631     fi
1632     lib_xmu_opt=-lXmu
1633     lib_xt_opt=-lXt
1634     if test "x$have_xaw" = x3d; then
1635       AC_DEFINE(XAW3D,1,Define to 1 if you have libXaw3d.)
1636       lib_xaw_opt=-lXaw3d
1637     else
1638       lib_xaw_opt=-lXaw
1639     fi
1640     INTERFACE_SRCS="$INTERFACE_SRCS xaw_c.c xaw_i.c"
1641   ],
1642   [ if test "x$have_xext" = xyes; then
1643       a_so_libs="-lXext -lX11"
1644     else
1645       a_so_libs="-lX11"
1646     fi
1647     case "$target" in
1648       *darwin*)
1649         a_so_libs="$a_so_libs -lcc_dynamic"
1650         ;;
1651     esac
1652     if test "x$have_xprelibs" = xyes; then
1653       a_so_libs="-lSM -lICE $a_so_libs"
1654     fi
1655     if test "x$have_xaw" = xyes; then
1656       a_so_libs="-lXaw -lXmu -lXt $a_so_libs"
1657     elif test "x$have_xaw" = x3d; then
1658       AC_DEFINE(XAW3D,1,Define to 1 if you have libXaw3d.)
1659       a_so_libs="-lXaw3d -lXmu -lXt $a_so_libs"
1660     fi
1661     a_so_libs="$ldflags_x_opt $a_so_libs"
1662   ])
1663 AM_CONDITIONAL(ENABLE_DYNAMIC_XAW, test "x$enable_xaw" = "xdynamic")
1664
1665 dnl X skin
1666 AM_CONDITIONAL(ENABLE_XSKIN, false)
1667 CONFIG_INTERFACE(xskin,XSKIN,i,
1668   [  --enable-xskin          Enable X skin interface         (default is no)],
1669   [ if test "x$with_x" != xyes; then
1670         AC_MSG_ERROR(xskin: --with-x option must be specified)
1671     fi
1672   ],
1673   [ INTERFACE_SRCS="$INTERFACE_SRCS xskin_c.c xskin_i.c xskin_loadBMP.c xskin_spectrum.c" ],
1674   [ i_so_libs="$ldflags_x_opt -lX11" ])
1675
1676 dnl GTK+
1677 AM_CONDITIONAL(ENABLE_GTK, false)
1678 CONFIG_INTERFACE(gtk, GTK, g,
1679   [  --enable-gtk            Enable GTK+ interface           (default is no)],
1680   [ AM_PATH_GTK_2_0(2.0.0,
1681     [AC_DEFINE(HAVE_GTK_2,1,Define to 1 if you have GTK+ 2.x)],
1682     [AM_PATH_GTK(1.1.3,,enable_gtk=no)]) ],
1683   [ LIBS="$LIBS $GTK_LIBS"
1684     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$GTK_CFLAGS)
1685     INTERFACE_SRCS="$INTERFACE_SRCS gtk_c.c gtk_i.c gtk_p.c"
1686   ],
1687   [ if test "x$GCC" = xyes; then
1688         dnl Do not include -rdynamic option in $g_so_libs.
1689         for i in $GTK_LIBS; do
1690             case "x$i" in
1691                 x-rdynamic) ;;
1692                 *) g_so_libs="$g_so_libs $i" ;;
1693             esac
1694         done
1695     else
1696         g_so_libs="$GTK_LIBS"
1697     fi
1698     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$GTK_CFLAGS) ])
1699
1700 dnl TiMidity Network MIDI Server
1701 AM_CONDITIONAL(ENABLE_SERVER, false)
1702 CONFIG_INTERFACE(server,SERVER,r,
1703   [  --enable-server         Enable server interface         (default is no)],
1704   ,
1705   [ INTERFACE_SRCS="$INTERFACE_SRCS server_c.c"
1706     AC_CHECK_HEADERS(sys/soundcard.h)
1707   ])
1708
1709 dnl TiMidity ALSA sequencer server
1710 AM_CONDITIONAL(ENABLE_ALSASEQ, false)
1711 CONFIG_INTERFACE(alsaseq,ALSASEQ,A,
1712   [  --enable-alsaseq        Enable ALSA sequencer server interface
1713                                                           (default is no)],
1714   ,
1715   [ INTERFACE_SRCS="$INTERFACE_SRCS alsaseq_c.c"
1716     AM_PATH_ALSA
1717   ])
1718
1719 dnl TiMidity Windows synthesizer server
1720 AM_CONDITIONAL(ENABLE_WINSYN, false)
1721 CONFIG_INTERFACE(winsyn,WINSYN,W,
1722   [  --enable-winsyn        Enable Windows Synthesizer interface
1723                                                           (default is no)],
1724   ,
1725   [ INTERFACE_SRCS="$INTERFACE_SRCS winsyn_c.c rtsyn_common.c rtsyn_winmm.c" ])
1726
1727 dnl TiMidity PortMIDI synthesizer server
1728 AM_CONDITIONAL(ENABLE_PORTMIDISYN, false)
1729 CONFIG_INTERFACE(portmidisyn,PORTMIDISYN,P,
1730   [  --enable-portmidisyn        Enable PortMIDI Synthesizer interface
1731                                                           (default is no)],
1732   ,
1733   [ INTERFACE_SRCS="$INTERFACE_SRCS portmidisyn_c.c rtsyn_common.c rtsyn_portmidi.c" ])
1734
1735 dnl TiMidity Windows GUI synthesizer server
1736 AM_CONDITIONAL(ENABLE_W32G_SYN, false)
1737 CONFIG_INTERFACE(winsyng,W32G_SYN,W,
1738   [  --enable-winsyng        Enable Windows GUI Synthesizer interface
1739                                                           (default is no)],
1740   ,
1741   [ 
1742   if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then
1743     INTERFACE_SRCS="$INTERFACE_SRCS w32g_ini.c w32g_pref.c w32g_syn.c w32g_utl.c winsyn_c.c rtsyn_common.c rtsyn_winmm.c"
1744     lib_w32gui_opt='gdi32.lib comctl32.lib comdlg32.lib ole32.lib'
1745     lib_user32_opt='user32.lib'
1746     if test "x$VCPP" = xyes; then
1747           VCPP_LDFLAGS="$VCPP_LDFLAGS -subsystem:windows "
1748         fi
1749         if test "x$BORLANDC" = xyes; then
1750           BORLANDC_START='C0W32.OBJ'
1751           CFLAGS="$CFLAGS -tW"
1752           lib_w32gui_opt="-aa $lib_w32gui_opt"
1753         fi
1754         if test "x$WATCOM_C" = xyes; then
1755           CFLAGS="$CFLAGS -bw"
1756           WATCOM_LDFLAGS="$WATCOM_LDFLAGS SYS nt_win"
1757         fi
1758   else
1759         lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32 -lole32'
1760     lib_user32_opt='-luser32'
1761     LDFLAGS="-mwindows $LDFLAGS"
1762     INTERFACE_SRCS="$INTERFACE_SRCS w32g_ini.c w32g_pref.c w32g_syn_escaped.c w32g_utl.c winsyn_c.c rtsyn_common.c rtsyn_winmm.c"
1763   fi
1764   ])
1765
1766
1767 dnl Windows GUI
1768 AM_CONDITIONAL(ENABLE_W32GUI, false)
1769 CONFIG_INTERFACE(w32gui, W32GUI, w,
1770   [  --enable-w32gui         Enable Windows GUI interface    (default is no)],
1771   ,
1772   [ 
1773   if test "x$VCPP" = xyes || test "x$BORLANDC" = xyes || test "x$WATCOM_C" = xyes; then
1774         INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.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"
1775     lib_w32gui_opt='gdi32.lib comctl32.lib comdlg32.lib ole32.lib'
1776     lib_user32_opt='user32.lib'
1777     if test "x$VCPP" = xyes; then
1778           VCPP_LDFLAGS="$VCPP_LDFLAGS -subsystem:windows "
1779         fi
1780         if test "x$BORLANDC" = xyes; then
1781           BORLANDC_START='C0W32.OBJ'
1782           CFLAGS="$CFLAGS -tW"
1783           lib_w32gui_opt="-aa $lib_w32gui_opt"
1784         fi
1785         if test "x$WATCOM_C" = xyes; then
1786           CFLAGS="$CFLAGS -bw"
1787           WATCOM_LDFLAGS="$WATCOM_LDFLAGS SYS nt_win"
1788         fi
1789   else
1790     lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32 -lole32'
1791     lib_user32_opt='-luser32'
1792     LDFLAGS="-mwindows $LDFLAGS"
1793     INTERFACE_SRCS="$INTERFACE_SRCS w32g_c.c w32g_ini.c w32g_i.c w32g_playlist.c w32g_utl.c w32g_pref.c w32g_subwin_escaped.c w32g_subwin2.c w32g_subwin3.c w32g_ut2.c w32g_dib.c  wrdt_w32g.c w32g_mag.c"
1794   fi
1795   ])
1796
1797 dnl UMP configuration
1798 AM_CONDITIONAL(ENABLE_PLUGIN, false)
1799 CONFIG_INTERFACE(ump, PLUGIN, p,
1800   [  --enable-ump            UMP configuration               (default is no)],
1801   [ if test ! -d ump; then
1802         AC_MSG_ERROR(UMP Package is not exists.  Can't configure it.)
1803     fi
1804     AC_CHECK_HEADER(X11/xpm.h,,AC_MSG_ERROR([UMP Package needs xpm.h[,] but could not find it.]))
1805     AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,:,AC_MSG_ERROR([UMP Package needs libXpm.a[,] but could not find it.]))
1806     if test "x$have_xext" = xyes; then
1807       lib_xext_opt=-lXext
1808     fi
1809     if test "x$have_xprelibs" = xyes; then
1810       lib_xprelibs_opt='-lSM -lICE'
1811     fi
1812     lib_xmu_opt=-lXmu
1813     lib_xt_opt=-lXt
1814   ])
1815
1816
1817 dnl Offix support
1818 dnl this rely on  CFLAGS and LIBS
1819 AC_ARG_ENABLE(offix,
1820   [  --enable-offix          Enable offix support            (default is no)],
1821   [ if test "$enableval" = "yes"; then
1822       KEEPCPPFLAGS=$CPPFLAGS
1823       KEEPLIBS=$LIBS
1824       KEEPLDFLAGS=$LDFLAGS
1825       CPPFLAGS="$CPPFLAGS $offix_include_dir"
1826       LDFLAGS="$LDFLAGS $offix_lib_dir"
1827       LIBS="$LIBS $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11"
1828       AC_CHECK_LIB(Dnd,DndInitialize,[
1829         LIBS=$KEEPLIBS
1830         lib_offix_opt="-lDnd"
1831         AC_DEFINE(OFFIX,1,Define to 1 if you need offix support)
1832       ],
1833       [ LDFLAGS=$KEEPLDFLAGS
1834         CPPFLAGS=$KEEPCPPFLAGS
1835         LIBS=$KEEPLIBS
1836       ])
1837     fi
1838   ])
1839
1840 dnl Network section
1841 AC_ARG_ENABLE(network,
1842   [  --enable-network        Enable network support          (default is no)],
1843   [ if test "$enableval" = "yes"; then
1844       AC_DEFINE(SUPPORT_SOCKET,1,Define to 1 if you need network support)
1845     fi ])
1846 AM_CONDITIONAL(ENABLE_NETWORK, test "x$enable_network" = "xyes")
1847
1848 dnl Sound Spectrogram Viewer
1849 AC_ARG_ENABLE(spectrogram,
1850   [  --enable-spectrogram    Enable Sound Spectrogram Viewer (default is no)],
1851   [ if test "$enableval" = "yes"; then
1852       if test "x$with_x" != xyes; then
1853         AC_MSG_ERROR(spectrogram: --with-x option must be specified)
1854       fi
1855       AC_DEFINE(SUPPORT_SOUNDSPEC,1,Define to 1 if you need spectrogram vewer.)
1856     fi ])
1857 AM_CONDITIONAL(ENABLE_SOUND_SPEC, test "x$enable_spectrogram" = "xyes")
1858
1859 dnl Wave Spline Interpolations
1860 AC_ARG_ENABLE(spline,
1861   [  --enable-spline=[method]  Specify spline method.
1862                                   one of no,linear,cubic,lagrange,newton,gauss
1863                                                           (default is linear)],
1864   [ case "x$enableval" in
1865       xlinear)
1866         AC_DEFINE(DEFAULT_RESAMPLATION,resample_linear,Define resampler.)
1867         ;;
1868       xcubic)
1869         AC_DEFINE(DEFAULT_RESAMPLATION,resample_cspline,Define resampler.)
1870         ;;
1871       xlagrange)
1872         AC_DEFINE(DEFAULT_RESAMPLATION,resample_lagrange,Define resampler.)
1873         ;;
1874       xnewton)
1875         AC_DEFINE(DEFAULT_RESAMPLATION,resample_newton,Define resampler.)
1876         ;;
1877       xgauss)
1878         AC_DEFINE(DEFAULT_RESAMPLATION,resample_gauss,Define resampler.)
1879         ;;
1880       xno)
1881         AC_DEFINE(DEFAULT_RESAMPLATION,resample_none,Define resampler.)
1882         ;;
1883       *)
1884         AC_MSG_ERROR(Invalid method of --enable-spline)
1885         ;;
1886     esac ])
1887
1888 dnl WRD interface
1889 AC_ARG_ENABLE(wrd,
1890   [  --enable-wrd            Enable WRD interface for X      (default is no)],
1891   [ if test "$enableval" = "yes"; then
1892       if test "x$with_x" != xyes; then
1893         AC_MSG_ERROR(wrd: --with-x option must be specified)
1894       fi
1895       AC_DEFINE(WRDT_X,1,Define to 1 if you need wrd support for X.)
1896       enable_sherry_wrd=yes
1897       AC_CHECK_LIB(z,zlibVersion,:,enable_sherry_wrd=no)
1898       AC_CHECK_HEADER(png.h,,enable_sherry_wrd=no)
1899       AC_CHECK_LIB(png,png_init_io,:,enable_sherry_wrd=no,-lz)
1900       if test "$enable_sherry_wrd" = yes; then
1901         AC_DEFINE(ENABLE_SHERRY,1,Define to 1 if you enable Sherry WRD)
1902         lib_zip_opt=-lz
1903         lib_png_opt=-lpng
1904       else
1905          AC_MSG_WARN([Sherry WRD is disabled: png.h, libpng.a, libz.a are required])
1906       fi
1907       if test "x$have_xext" = xyes; then
1908         lib_xext_opt=-lXext
1909       fi
1910     fi ])
1911
1912 dnl end of interfaces
1913
1914
1915 #
1916 # Finish up
1917 #
1918
1919 AM_CONDITIONAL(ENABLE_WRD, test "x$enable_wrd" = "xyes")
1920 AM_CONDITIONAL(CYGNUS, test "x$CYGNUS" = xyes)
1921 AM_CONDITIONAL(MSYS, test "x$MSYS" = xyes)
1922 AM_CONDITIONAL(VCPP, test "x$VCPP" = xyes)
1923 AM_CONDITIONAL(BORLANDC, test "x$BORLANDC" = xyes)
1924 AM_CONDITIONAL(WATCOM_C, test "x$WATCOM_C" = xyes)
1925
1926 AM_CONDITIONAL(W32READDIR, test "x$W32READDIR" = "xyes")
1927
1928 SET_UNIQ_WORDS(LDFLAGS,$LDFLAGS)
1929 SET_UNIQ_WORDS(SHLDFLAGS,$SHLDFLAGS)
1930 SET_UNIQ_WORDS(CFLAGS,$EXTRACFLAGS $CFLAGS)
1931 SET_UNIQ_WORDS(CPPFLAGS,$CPPFLAGS $EXTRADEFS)
1932
1933 if test "x$oss_device" != x; then
1934   AC_DEFINE_UNQUOTED(OSS_DEVICE,"$oss_device", oss device name)
1935 fi
1936
1937 if test "x$TIMIDITY_OUTPUT_ID" != x; then
1938   AC_DEFINE_UNQUOTED(TIMIDITY_OUTPUT_ID,"$TIMIDITY_OUTPUT_ID", the output specification)
1939 fi
1940
1941 if test "x$with_x" = xyes; then
1942   dnl Order of X-library is: -lXm -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11
1943   LIBS=`echo $LIBS | sed "s/-lX11/$lib_offix_opt $lib_xm_opt $lib_xaw_opt $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11/"`
1944 fi
1945 LIBS="$LIBS $lib_dl_opt $lib_png_opt $lib_zip_opt $lib_user32_opt $lib_w32gui_opt $EXTRALIBS"
1946 SHLD="$SHLD $SHLDFLAGS"
1947
1948 AC_SUBST(BORLANDC_START)
1949 AC_SUBST(BORLANDC_LDFLAGS)
1950 AC_SUBST(SHELL)
1951 AC_SUBST(timidity_LDFLAGS)
1952 AC_SUBST(WATCOM_LDFLAGS)
1953 AC_SUBST(VCPP_LDFLAGS)
1954 AC_SUBST(SYSEXTRAS)
1955 AC_SUBST(EXTRALIBS)
1956 AC_SUBST(NETSRCS)
1957 AC_SUBST(ELFILES)
1958 AC_SUBST(SHLD)
1959 AC_SUBST(SHCFLAGS)
1960 AC_SUBST(dynamic_targets)
1961 AC_SUBST(so)
1962 AC_SUBST(LN_S)
1963 AC_SUBST(WISH)
1964 AC_SUBST(tcltk_dep)
1965 AC_SUBST(program_transform_name)
1966 AC_SUBST(INTERFACE_SRCS)
1967 AC_SUBST(pkgdatadir)
1968 AC_SUBST(pkglibdir)
1969
1970 AC_CONFIG_FILES([
1971   Makefile
1972   autoconf/Makefile
1973   common.makefile
1974   configs/Makefile
1975   doc/Makefile
1976   doc/C/Makefile
1977   doc/ja_JP.eucJP/Makefile
1978   interface/Makefile
1979   interface/motif_bitmaps/Makefile
1980   interface/bitmaps/Makefile
1981   interface/pixmaps/Makefile
1982   libarc/Makefile
1983   libunimod/Makefile
1984   timidity/Makefile
1985   utils/Makefile
1986   script/Makefile
1987   TiMidity.ad
1988   TiMidity-uj.ad
1989 ])
1990 AC_OUTPUT