OSDN Git Service

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