OSDN Git Service

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