OSDN Git Service

ja_JP.ujis: Move to ja_JP.eucJP
[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++],[2.13.0-rc2],[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 gogo(g):    MP3 GOGO
612 dnl jack(j):    JACK
613
614 audio_targets='default oss alsa sun hpux irix mme sb_dsp w32 alib nas arts esd vorbis gogo portaudio jack'
615
616 AC_ARG_WITH(nas-library,
617   [  --with-nas-library=library NAS absolute library path(Don't use -laudio)])
618 AC_ARG_WITH(nas-includes,
619   [  --with-nas-includes=DIR NAS include files are in dir])
620
621
622 AC_ARG_ENABLE(audio,
623   [  --enable-audio[=mode_list] Enable audio (Specify comma separated mode list):
624                               default:   Automatically select audio device.
625                               oss:       OSS /dev/dsp
626                               sun:       SunOS /dev/audio
627                               hpux:      HPUX /dev/audio
628                               irix:      IRIX audio library
629                               mme:       OSF/1 MME
630                               sb_dsp:    BSD/OS 2.0 /dev/sb_dsp
631                               w32:       Windows MMS
632                               darwin:    Darwin CoreAudio
633                               alsa:      ALSA pcm device
634                               alib:      HPUX network audio (Alib)
635                               nas:       NAS - Network Audio System
636                               arts:      aRts
637                               esd:       EsounD - Enlightened Sound Daemon
638                               portaudio: PortAudio
639                               jack:      JACK
640                               vorbis:    Ogg Vorbis
641                               gogo:      MP3 GOGO (Only Windows is supported)],
642   [ enable_audio=$enableval
643     have_audio_opt=yes ],
644   [ enable_audio=yes
645     have_audio_opt=no ])
646
647 dnl yes -> default
648 test "x$enable_audio" = xyes && enable_audio=default
649
650 if test "x$enable_audio" != xno; then
651   for i in `echo $enable_audio | sed 's/,/ /g'`; do
652     eval "au_enable_$i=yes"
653   done
654 fi
655
656 dnl Turn on default output mode
657 DEFAULT_PLAYMODE=
658 AC_ARG_WITH(default-output,
659   [  --with-default-output=<mode>  Specify default output mode (optional):
660                                 (default|alsa|alib|arts|nas|
661                                 esd|wav|au|aiff|list|vorbis|
662                                 gogo|portaudio|jack)],
663   [ if test "$enable_audio" != no; then
664     DEFAULT_PLAYMODE=$withval
665     eval "au_enable_$DEFAULT_PLAYMODE=yes"
666   else
667     AC_MSG_WARN(--with-default-output=$withval: audio is not enabled)
668   fi])
669
670 dnl compatibility matters.
671 dnl AC_ARG_ENABLE(esd,
672 dnl   [  --enable-esd         EsounD (Obsoleted.  Use --enable-audio=esd)],
673 dnl   [ au_enable_esd=$enableval ])
674 dnl AC_ARG_ENABLE(nas,
675 dnl   [  --enable-nas         NAS  (Obsoleted.  Use --enable-audio=nas)],
676 dnl   [ au_enable_nas=$enableval ])
677 dnl AC_ARG_ENABLE(alsa,
678 dnl   [  --enable-alsa        ALSA   (Obsoleted.  Use --enable-audio=alsa)],
679 dnl   [ au_enable_alsa=$enableval ])
680
681 dnl target-specific defaults
682 if test "x$au_enable_default" = xyes; then
683   case "$target" in
684   *-*-linux*|*-*-freebsd*)
685     au_enable_oss=yes
686     ;;
687   *-*-bsdi2.0)
688     au_enable_sb_dsp=yes
689     ;;
690   *-*-bsdi2.1|*-*-bsdi3.?|*-*-bsdi4.?)
691     au_enable_oss=yes
692     ;;
693   *-*-hpux*)
694     au_enable_hpux=yes
695     ;;
696   *-dec-*)
697     au_enable_mme=yes
698     ;;
699   *irix*)
700     au_enable_irix=yes
701     ;;
702   *-*-sunos4*)
703     au_enable_sun=yes
704     ;;
705   *-*-solaris*)
706     au_enable_sun=yes
707     ;;
708   *-*-netbsd*)
709     au_enable_sun=yes
710     ;;
711   *-*-cygwin*)
712     au_enable_w32=yes
713     ;;
714   *-*-mingw*)
715     au_enable_w32=yes
716     ;;
717   *-*-darwin*)
718     au_enable_darwin=yes
719     ;;
720   *)
721     AC_MSG_WARN(No --enable-audio=default audio for $target)
722     ;;
723   esac
724 fi
725
726
727 # Each audio mode's configurations
728 dnl oss
729 AC_MSG_CHECKING(enable_audio=oss)
730 if test "x$au_enable_oss" = xyes; then
731   EXTRADEFS="$EXTRADEFS -DAU_OSS"
732   SYSEXTRAS="$SYSEXTRAS oss_a.c"
733   if test "x$ac_cv_header_sys_soundcard_h" = xyes; then
734     AC_MSG_RESULT(yes - <sys/soundcard.h>)
735   else
736     case "$target" in
737       *linux*|*freebsd*)
738         dnl <linux/soundcard.h> or <machine/soundcard.h>
739         AC_MSG_RESULT(yes)
740         ;;
741       *)
742         if test "x$ac_cv_header_soundcard_h" = xyes; then
743           AC_MSG_RESULT(yes - <soundcard.h>)
744         else
745           AC_MSG_WARN(<sys/soundcard.h> is not found)
746         fi
747         ;;
748     esac
749   fi
750   AC_CHECK_LIB(ossaudio,open)
751
752   dnl Why OpenBSD use /dev/audio instead of /dev/dsp for OSS
753   case "$target" in
754     *openbsd*)
755       if test ! -e "/dev/dsp"; then
756         oss_device=/dev/audio
757       fi
758       ;;
759   esac
760 else
761   AC_MSG_RESULT(no)
762 fi
763
764 dnl SunOS's
765 AC_MSG_CHECKING(enable_audio=sun)
766 if test "x$au_enable_sun" = xyes; then
767   case "$target" in
768     *-*-sunos4*)
769       if test -f /usr/demo/SOUND/libaudio.a; then
770         EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/libaudio.a"
771         AC_MSG_RESULT(yes)
772       else
773         AC_MSG_RESULT(Notice: libaudio.a is not found [(ignore)])
774       fi
775       ;;
776     *-*-solaris*)
777       if test -f /usr/demo/SOUND/lib/libaudio.a; then
778         EXTRALIBS="$EXTRALIBS /usr/demo/SOUND/lib/libaudio.a"
779         AC_MSG_RESULT(yes)
780       else
781         AC_MSG_RESULT(Notice: libaudio.a is not found [(ignore)])
782       fi
783       ;;
784     *)   AC_MSG_RESULT(yes)
785       ;;
786   esac
787   EXTRADEFS="$EXTRADEFS -DAU_SUN"
788   SYSEXTRAS="$SYSEXTRAS sun_a.c"
789 else
790   AC_MSG_RESULT(no)
791 fi
792
793 dnl HP-UX's
794 AC_MSG_CHECKING(enable_audio=hpux)
795 if test "x$au_enable_hpux" = xyes; then
796   case "$target" in
797     *-*-hpux*) AC_MSG_RESULT(yes) ;;
798     *) AC_MSG_WARN(may not work on $target) ;;
799   esac
800   EXTRADEFS="$EXTRADEFS -DAU_HPUX_AUDIO"
801   SYSEXTRAS="$SYSEXTRAS hpux_d_a.c"
802 else
803   AC_MSG_RESULT(no)
804 fi
805
806 dnl Irix's
807 AC_MSG_CHECKING(enable_audio=irix)
808 if test "x$au_enable_irix" = xyes; then
809   case "$target" in
810     *-sgi-irix5*|*-sgi-irix6.2)
811       EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_OLDAL"
812       AC_MSG_RESULT(yes)
813       ;;
814     *-sgi-irix6*)
815       EXTRADEFS="$EXTRADEFS -DAU_AUDRIV -DSGI_NEWAL"
816       AC_MSG_RESULT(yes)
817       ;;
818     *) AC_MSG_WARN(may not work on $target) ;;
819   esac
820   SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_al.c"
821   EXTRALIBS="$EXTRASLIBS -laudio"
822 else
823   AC_MSG_RESULT(no)
824 fi
825
826 dnl OSF/1 MME
827 AC_MSG_CHECKING(enable_audio=mme)
828 if test "x$au_enable_mme" = xyes; then
829   case "$target" in
830     *-dec-*) AC_MSG_RESULT(yes) ;;
831     *) AC_MSG_WARN(may not work on $target) ;;
832   esac
833   EXTRADEFS="$EXTRADEFS -DAU_DEC -DAU_AUDRIV"
834   SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_mme.c"
835   CPPFLAGS="$CPPFLAGS -I/usr/opt/MME210/include"
836   EXTRALIBS="$EXTRALIBS /usr/opt/MME220/lib/libmme.a"
837 else
838   AC_MSG_RESULT(no)
839 fi
840
841 dnl BSD/OS's sb_dsp
842 AC_MSG_CHECKING(enable_audio=sb_dsp)
843 if test "x$au_enable_sb_dsp" = xyes; then
844   case "$target" in
845     *-*-bsdi2.0) AC_MSG_RESULT(yes) ;;
846     *) AC_MSG_WARN(may not work on $target) ;;
847   esac
848   EXTRADEFS="$EXTRADEFS -DAU_BSDI -DDEFAULT_RATE=22500"
849   SYSEXTRAS="$SYSEXTRAS bsd20_a.c"
850 else
851   AC_MSG_RESULT(no)
852 fi
853
854 dnl Windows' MME
855 AC_MSG_CHECKING(enable_audio=w32)
856 if test "x$au_enable_w32" = xyes; then
857   case "$target" in
858     *-*-cygwin*)
859      AC_MSG_RESULT(yes)
860      ;;
861     *-*-mingw32)
862      AC_MSG_RESULT(yes)
863      ;;
864     *)
865      AC_MSG_WARN(may not work on $target)
866      ;;
867   esac
868   SYSEXTRAS="$SYSEXTRAS w32_a.c"
869   EXTRALIBS="$EXTRALIBS -lwinmm"
870   EXTRADEFS="$EXTRADEFS -DAU_W32"
871 else
872   AC_MSG_RESULT(no)
873 fi
874
875 dnl Mac OS X / darwin-x86
876 AC_MSG_CHECKING(enable_audio=darwin)
877 if test "x$au_enable_darwin" = xyes; then
878   EXTRADEFS="$EXTRADEFS -DAU_DARWIN"
879   SYSEXTRAS="$SYSEXTRAS darwin_a.c"
880   EXTRALIBS="$EXTRALIBS -framework CoreAudio"
881   dnl just say yes or no :-P
882   case "$target" in
883     *-*-darwin*)
884      AC_MSG_RESULT(yes);;
885    *)
886      AC_MSG_WARN(may not work on $target)
887      ;;
888   esac
889 else
890   AC_MSG_RESULT(no)
891 fi
892
893
894 dnl alsa - Advanced Linux Sound Architecture
895 AC_MSG_CHECKING(enable_audio=alsa)
896 if test "x$au_enable_alsa" = xyes; then
897   AC_MSG_RESULT([yes, configuring alsa])
898   KEEPCFLAGS=$CFLAGS
899   KEEPLIBS=$LIBS
900   KEEPLDFLAGS=$LDFLAGS
901   AM_PATH_ALSA()
902   if test "x$alsa_found" = "xyes" ; then
903     dnl AC_MSG_RESULT(yes)
904     EXTRADEFS="$EXTRADEFS -DAU_ALSA"
905     SYSEXTRAS="$SYSEXTRAS alsa_a.c"
906     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ALSA_CFLAGS)
907     LIBS="$KEEPLIBS $ALSA_LIBS"
908     AC_CHECK_FUNCS(snd_seq_port_info_set_timestamping)
909   else
910     AC_MSG_WARN(Couldn't configure alsa.)
911     CFLAGS=$KEEPCFLAGS
912     LIBS=$KEEPLIBS
913     LDFLAGS=$KEEPLDFLAGS
914   fi
915 else
916   AC_MSG_RESULT(no)
917 fi
918
919 dnl HP-UX Alib
920 AC_MSG_CHECKING(enable_audio=alib)
921 if test "x$au_enable_alib" = xyes; then
922   case "$target" in
923     *-*-hpux*) AC_MSG_RESULT(yes) ;;
924     *) AC_MSG_WARN(may not work on $target) ;;
925   esac
926   SYSEXTRAS="$SYSEXTRAS hpux_a.c"
927   EXTRADEFS="$EXTRADEFS -DAU_HPUX_ALIB"
928   if test -d /opt/audio/include; then
929     CPPFLAGS="$CPPFLAGS -I/opt/audio/include"
930   fi
931   if test -d /opt/audio/lib; then
932     EXTRALIBS="$EXTRALIBS -L/opt/audio/lib"
933   fi
934   EXTRALIBS="$EXTRALIBS -lAlib"
935 else
936   AC_MSG_RESULT(no)
937 fi
938
939 dnl nas
940 AC_MSG_CHECKING(enable_audio=nas)
941 if test "x$au_enable_nas" = xyes; then
942   if test "x$with_x" != xyes; then
943     AC_MSG_ERROR(nas: --with-x option must be specified)
944   fi
945   EXTRADEFS="$EXTRADEFS -DAU_NAS"
946   SYSEXTRAS="$SYSEXTRAS nas_a.c"
947
948   dnl -laudio conflicts another audio library,
949   dnl so I specify NAS library with absolete path.
950
951   if test "x$with_nas_library" != x; then
952     AC_MSG_RESULT($with_nas_library);
953     EXTRALIBS="$EXTRALIBS $with_nas_library"
954   else
955     AC_MSG_RESULT()
956     MY_SEARCH_LIBS(AuOpenServer,
957         [$x_libraries/libaudio.a \
958          /usr/lib/libaudio.so \
959          /usr/lib/libaudio.a ],
960         [ AC_MSG_RESULT(NAS: $timidity_cv_search_AuOpenServer)
961           EXTRALIBS="$EXTRALIBS $timidity_cv_search_AuOpenServer"],
962         [AC_MSG_WARN(NAS library is not found.)])
963   fi
964   test "x$with_nas_includes" != x && CPPFLAGS="$CPPFLAGS -I$with_nas_includes"
965   lib_xt_opt=-lXt
966   if test "x$have_xext" = xyes; then
967     lib_xext_opt=-lXext
968   fi
969   if test "x$have_xprelibs" = xyes; then
970     lib_xprelibs_opt='-lSM -lICE'
971   fi
972 else
973   AC_MSG_RESULT(no)
974 fi
975
976 dnl aRts of KDE
977 AC_MSG_CHECKING(enable_audio=arts)
978 if test "x$au_enable_arts" = xyes; then
979   AC_MSG_RESULT([yes, configuring aRts])
980   KEEPCFLAGS=$CFLAGS
981   KEEPLIBS=$LIBS
982   KEEPLDFLAGS=$LDFLAGS
983   AM_PATH_ARTS()
984   CFLAGS=$KEEPCFLAGS
985   LIBS=$KEEPLIBS
986   LDFLAGS=$KEEPLDFLAGS
987   if test "x$no_arts" = x; then
988     dnl AC_MSG_RESULT(aRts: Enabled)
989     EXTRADEFS="$EXTRADEFS -DAU_ARTS"
990     SYSEXTRAS="$SYSEXTRAS aRts_a.c"
991     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ARTS_CFLAGS)
992     LIBS="$LIBS $ARTS_LIBS"
993   else
994     AC_MSG_WARN(aRts: Couldn't configure)
995   fi
996 else
997   AC_MSG_RESULT(no)
998 fi
999
1000 dnl EsounD
1001 AC_MSG_CHECKING(enable_audio=esd)
1002 if test "x$au_enable_esd" = xyes; then
1003   AC_MSG_RESULT([yes, configuring esd])
1004   KEEPCFLAGS=$CFLAGS
1005   KEEPLIBS=$LIBS
1006   KEEPLDFLAGS=$LDFLAGS
1007   AM_PATH_ESD()
1008   CFLAGS=$KEEPCFLAGS
1009   LIBS=$KEEPLIBS
1010   LDFLAGS=$KEEPLDFLAGS
1011   if test "x$no_esd" = x; then
1012     dnl AC_MSG_RESULT(EsounD: Enabled)
1013     EXTRADEFS="$EXTRADEFS -DAU_ESD"
1014     SYSEXTRAS="$SYSEXTRAS esd_a.c"
1015     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$ESD_CFLAGS)
1016     LIBS="$LIBS $ESD_LIBS"
1017   else
1018     AC_MSG_WARN(EsounD: Couldn't configure)
1019   fi
1020 else
1021   AC_MSG_RESULT(no)
1022 fi
1023
1024 dnl portaudio E
1025 AC_MSG_CHECKING(enable_audio=portaudio)
1026 if test "x$au_enable_portaudio" = xyes; then
1027   AC_MSG_RESULT(yes)
1028   SYSEXTRAS="$SYSEXTRAS portaudio_a.c"
1029   EXTRALIBS="$EXTRALIBS -lportaudio"
1030   EXTRADEFS="$EXTRADEFS -DAU_PORTAUDIO"
1031 else
1032   AC_MSG_RESULT(no)
1033 fi
1034
1035 dnl JACK
1036 AC_MSG_CHECKING(enable_audio=jack)
1037 if test "x$au_enable_jack" = xyes; then
1038   AC_MSG_RESULT(yes)
1039   SYSEXTRAS="$SYSEXTRAS jack_a.c"
1040   EXTRALIBS="$EXTRALIBS $(pkg-config --libs jack)"
1041   EXTRADEFS="$EXTRADEFS -DAU_JACK $(pkg-config --cflags jack)"
1042 else
1043   AC_MSG_RESULT(no)
1044 fi
1045
1046 dnl ogg's vorbis
1047 AC_MSG_CHECKING(enable_audio=vorbis)
1048 if test "x$au_enable_vorbis" = xyes; then
1049   AC_MSG_RESULT([yes, configuring vorbis])
1050   AM_PATH_OGG([
1051     AM_PATH_VORBIS([
1052       have_vorbis=yes
1053       SYSEXTRAS="$SYSEXTRAS vorbis_a.c"
1054       EXTRADEFS="$EXTRADEFS -DAU_VORBIS $OGG_CFLAGS $VORBIS_CFLAGS"
1055       EXTRALIBS="$EXTRALIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
1056       if test "x$CYGNUS" = "xyes"; then
1057       EXTRADEFS="-DAU_VORBIS_DLL $EXTRALIBS"
1058           SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c"
1059       fi
1060       if test "x$MINGW" = "xyes"; then
1061       EXTRADEFS="-DAU_VORBIS_DLL $EXTRALIBS"
1062           SYSEXTRAS="$SYSEXTRAS w32g_vorbisenc_dll.c w32g_vorbis_dll.c w32g_ogg_dll.c"
1063       fi
1064     ],[
1065       AC_MSG_WARN([Unable to configure vorbis, but ogg is there (???)])
1066     ])
1067   ],[
1068     AC_MSG_WARN(Unable to configure vorbis!)
1069     have_vorbis=no
1070   ])
1071 else
1072   AC_MSG_RESULT(no)
1073 fi
1074
1075 dnl Win32 Gogo-no-coder
1076 AC_MSG_CHECKING(enable_audio=gogo)
1077 if test "x$au_enable_gogo" = xyes; then
1078   if test "x$CYGNUS" = "xyes"; then
1079     AC_MSG_RESULT(yes, configuring gogo)
1080   else
1081     if test "x$MINGW" = "xyes"; then
1082     AC_MSG_RESULT(yes, configuring gogo)
1083     else
1084       AC_MSG_WARN(May be gogo is not supported.  You need hack the gogo_a.c)
1085     fi
1086   fi
1087   have_gogo=yes
1088   SYSEXTRAS="$SYSEXTRAS gogo_a.c w32_gogo.c"
1089   EXTRADEFS="$EXTRADEFS -DAU_GOGO -DAU_GOGO_DLL"
1090   EXTRALIBS="$EXTRALIBS -lgogo"
1091 else
1092   AC_MSG_RESULT(no)
1093 fi
1094
1095 dnl Pseudo audio device (Undocumented).
1096 if test "x$au_enable_none" = xyes; then
1097     EXTRADEFS="$EXTRADEFS -DAU_NONE -DAU_AUDRIV"
1098     SYSEXTRAS="$SYSEXTRAS audriv_a.c audriv_none.c"
1099 fi
1100 dnl
1101 dnl TIMIDITY_OUTPUT_ID
1102 dnl
1103 AC_MSG_CHECKING(default output mode)
1104 if test "x$DEFAULT_PLAYMODE" = x; then
1105   DEFAULT_PLAYMODE=`echo $enable_audio | sed 's/,.*//'`
1106 fi
1107 case ".$DEFAULT_PLAYMODE" in
1108   .default)  TIMIDITY_OUTPUT_ID=d ;;
1109   .oss)      TIMIDITY_OUTPUT_ID=d ;;
1110   .alsa)     TIMIDITY_OUTPUT_ID=s ;;
1111   .sun)      TIMIDITY_OUTPUT_ID=d ;;
1112   .hpux)     TIMIDITY_OUTPUT_ID=d ;;
1113   .irix)     TIMIDITY_OUTPUT_ID=d ;;
1114   .mme)      TIMIDITY_OUTPUT_ID=d ;;
1115   .sb_dsp)   TIMIDITY_OUTPUT_ID=d ;;
1116   .darwin)   TIMIDITY_OUTPUT_ID=d ;;
1117   .w32)      TIMIDITY_OUTPUT_ID=d ;;
1118   .alib)     TIMIDITY_OUTPUT_ID=A ;;
1119   .nas)      TIMIDITY_OUTPUT_ID=n ;;
1120   .arts)     TIMIDITY_OUTPUT_ID=R ;;
1121   .esd)      TIMIDITY_OUTPUT_ID=e ;;
1122   .portaudio)      TIMIDITY_OUTPUT_ID=p ;;  
1123   .wav)      TIMIDITY_OUTPUT_ID=w ;;
1124   .au)       TIMIDITY_OUTPUT_ID=u ;;
1125   .aiff)     TIMIDITY_OUTPUT_ID=a ;;
1126   .list)     TIMIDITY_OUTPUT_ID=l ;;
1127   .vorbis)   TIMIDITY_OUTPUT_ID=v ;;
1128   .gogo)     TIMIDITY_OUTPUT_ID=g ;;
1129   .jack)     TIMIDITY_OUTPUT_ID=j ;;
1130   *)         TIMIDITY_OUTPUT_ID= ;;
1131 esac
1132 AC_MSG_RESULT($DEFAULT_PLAYMODE/$TIMIDITY_OUTPUT_ID)
1133
1134 #
1135 # Interface Section
1136 #
1137
1138 interface_targets='dynamic ncurses slang motif tcltk emacs vt100 xaw xskin gtk alsaseq winsyn winsyng portmidisyng'
1139
1140 AC_ARG_ENABLE(interface,
1141   [  --enable-interface=[interface_list]
1142                           Comma separated interface list ],
1143   [ for i in `echo $enableval | sed 's/,/ /g'`; do
1144       eval "enable_$i=yes"
1145     done ])
1146
1147 #  Dynamic link configuration
1148 AC_ARG_ENABLE(dynamic,
1149   [  --enable-dynamic        Enable dynamic link interface   (default is no)
1150   --enable-dynamic=dynamic_list
1151                           Comma separated dynamic interface list],
1152   [ dnl --enable-dynamic=yes to --enable-dynamic=dynamic
1153     if test "x$enable_dynamic" = xyes; then
1154       enable_dynamic=dynamic
1155     elif test "x$enable_dynamic" != xno; then
1156       for i in `echo $enableval | sed 's/,/ /g'`; do
1157         eval "enable_$i=dynamic"
1158       done
1159     fi])
1160
1161 join_targets=
1162 for i in $interface_targets; do
1163   eval "join_targets=$join_targets\$enable_$i"
1164 done
1165
1166 case ".$join_targets" in
1167 .*dynamic*) NEEDDLOPEN=yes;;
1168 *)          NEEDDLOPEN=no;;
1169 esac
1170
1171 dnl check -fpic option for gcc
1172 if test "x$GCC" = xyes; then SHCFLAGS="$SHCFLAGS -fPIC"; fi
1173 case "x$enable_ump" in xyes|xdynamic) EXTRACFLAGS="$EXTRACFLAGS -DXP_UNIX $SHCFLAGS";; esac
1174
1175 dnl Which type of dynamic loader?
1176 if test "$NEEDDLOPEN" = "yes"; then
1177   have_dl=no
1178
1179   WAPI_CHECK_FUNC(LoadLibrary,,[LoadLibrary(0);],have_dl=w32)
1180   test $wapi_cv_func_LoadLibrary = yes && have_dl=w32
1181
1182   if test "$have_dl" = "no"; then
1183     AC_CHECK_FUNC(shl_load,have_dl=hpux)
1184   fi
1185   if test "$have_dl" = "no"; then
1186     dnl darwin has both dyld and libdl: in case user installed dlcompat.
1187     dnl dyld is recommended because libdl is a wrapper for dyld.
1188     AC_CHECK_FUNC(NSLinkModule,have_dl=dyld)
1189   fi
1190   if test "$have_dl" = "no" -a "x$ac_cv_lib_dl_dlopen" = xyes; then
1191     have_dl=dlopen
1192   fi
1193   if test "$have_dl" = "no"; then
1194     AC_CHECK_FUNC(dlopen,have_dl=dlopen)
1195   fi
1196   if test "$have_dl" = "no"; then
1197     AC_CHECK_FUNC(dld_init,have_dl=dld)
1198   fi
1199   if test "$have_dl" = "no"; then
1200     AC_CHECK_LIB(dld,dld_init,have_dl=dld;lib_dl_opt=-ldld)
1201   fi
1202
1203   AC_MSG_CHECKING(dynamic link method)
1204   case "$have_dl" in
1205     dlopen)
1206       AC_MSG_RESULT(use dl_dlopen.c)
1207       SYSEXTRAS="$SYSEXTRAS dl_dlopen.c"
1208       CHECK_DLSYM_UNDERSCORE(AC_DEFINE(DLSYM_NEEDS_UNDERSCORE,1,Define to 1 if you have to add "_" to every identifiers.))
1209       ;;
1210     dld)
1211       AC_MSG_RESULT(use dl_dld.c)
1212       SYSEXTRAS="$SYSEXTRAS dl_dld.c"
1213       ;;
1214     hpux)
1215       AC_MSG_RESULT(use dl_hpux.c)
1216       SYSEXTRAS="$SYSEXTRAS dl_hpux.c"
1217       LDFLAGS="$LDFLAGS -Wl,-E $LDFLAGS"
1218       ;;
1219     w32)
1220       AC_MSG_RESULT(use dl_w32.c)
1221       SYSEXTRAS="$SYSEXTRAS dl_w32.c"
1222       ;;
1223     dyld)
1224       AC_MSG_RESULT(use dl_dyld.c)
1225       SYSEXTRAS="$SYSEXTRAS dl_dyld.c"
1226       ;;
1227     *)
1228       NEEDDLOPEN="no"
1229       AC_MSG_WARN(no method to open a shared object)
1230       ;;
1231   esac
1232 fi
1233
1234 if test "$NEEDDLOPEN" = "yes"; then
1235   MY_DEFINE(IA_DYNAMIC)
1236   AC_DEFINE_UNQUOTED(SHARED_LIB_EXT,".$so", shared library extention)
1237   dnl needless?
1238   dnl EXTRADEFS="$EXTRADEFS \$(DEF_SHLIB_DIR)"
1239   test "x$GCC" = xyes -a "x$timidity_cv_ccoption_rdynamic" = xyes  && timidity_LDFLAGS="-rdynamic"
1240 fi
1241
1242 AM_CONDITIONAL(NEEDDLOPEN, test "$NEEDDLOPEN" = "yes")
1243
1244 dnl
1245 dnl Each interface section
1246 dnl
1247
1248 dnl ncurses
1249 AM_CONDITIONAL(ENABLE_NCURSES, false)
1250 CONFIG_INTERFACE(ncurses,NCURSES,n,
1251   [  --enable-ncurses        Enable ncurses interface        (default is no)],
1252   [ AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h)
1253
1254 dnl #include <ncurses/curses.h> is failure on Plamo Linux 1.3/ncurses 1.9.9e
1255 dnl because <ncurses/curses.h> includes <unctrl.h>:
1256 dnl /usr/include/ncurses/curses.h:34: unctrl.h: No such file or directory
1257 dnl But surely there is unctl.h at /usr/include/ncurses/unctrl.h.
1258 dnl configure must check ncurses header with -I/usr/include/ncurses option.
1259
1260   case "$ac_cv_header_curses_h$ac_cv_header_ncurses_curses_h$ac_cv_header_ncurses_h" in
1261     *yes*);;
1262     *)  for i in /usr/include /usr/local/include; do
1263           if test -f "$i/ncurses/curses.h" -a -f "$i/ncurses/unctrl.h"; then
1264             AC_MSG_WARN(ncurses test is failure.  Please check config.h and common.makefile later)
1265             CPPFLAGS="$CPPFLAGS -I$i/ncurses"
1266             break
1267           fi
1268         done
1269         ;;
1270     esac
1271
1272     AC_CHECK_LIB(ncurses,initscr,lib_curses_opt=-lncurses,
1273       [ dnl checking pdcurses
1274         AC_CHECK_LIB(curses,PDC_set_ctrl_break,
1275           [ lib_curses_opt=-lcurses
1276             AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
1277             lib_user32_opt="$lib_user32_test"
1278           ],
1279           [ dnl checking libpdcurses
1280             AC_CHECK_LIB(pdcurses,PDC_set_ctrl_break,
1281             [ lib_curses_opt=-lpdcurses
1282               AC_DEFINE(USE_PDCURSES,1,Define to 1 if you use PDcurses)
1283               lib_user32_opt="$lib_user32_test"
1284             ],
1285             [ dnl OpenBSD use -lcurses instead of -lncurses.
1286               case "$target" in
1287                 *openbsd*)
1288                   AC_CHECK_LIB(curses,initscr,lib_curses_opt=-lcurses,
1289                     [ AC_MSG_WARN(ncurses interface is not enabled)
1290                       enable_ncurses=no ])
1291                   ;;
1292                 *)
1293                   AC_MSG_WARN(ncurses interface is not enabled)
1294                   enable_ncurses=no
1295                   ;;
1296               esac
1297             ])
1298         ],
1299         $lib_user32_test)
1300       ])
1301   ],
1302   [ LIBS="$LIBS $lib_curses_opt"
1303     case "$target" in
1304        *-*-freebsd[123]*)
1305          EXTRALIBS="$EXTRALIBS -lmytinfo"
1306          ;;
1307      esac
1308     INTERFACE_SRCS="$INTERFACE_SRCS ncurs_c.c"
1309   ],
1310   [ n_so_libs="$lib_curses_opt"
1311     case "$target" in
1312        *-*-freebsd[123]*)
1313          EXTRALIBS="$EXTRALIBS -lmytinfo"
1314          ;;
1315      esac])
1316
1317 dnl slang
1318 AM_CONDITIONAL(ENABLE_SLANG, false)
1319 CONFIG_INTERFACE(slang,SLANG,s,
1320   [  --enable-slang          Enable slang interface          (default is no)],
1321   [ AC_CHECK_LIB(slang,SLang_init_tty,:,
1322     [ enable_slang=no
1323       AC_MSG_WARN(slang interface is not enabled)
1324     ])
1325     AC_CHECK_HEADERS(slang/slang.h slang.h)
1326   ],
1327   [ LIBS="$LIBS -lslang"
1328     INTERFACE_SRCS="$INTERFACE_SRCS slang_c.c"
1329   ],
1330   [ s_so_libs="-lslang"
1331     AC_CHECK_LIB(termcap,initscr,s_so_libs="$s_so_libs -ltermcap")
1332   ])
1333
1334 dnl Motif
1335 AM_CONDITIONAL(ENABLE_MOTIF, false)
1336 CONFIG_INTERFACE(motif,MOTIF,m,
1337   [  --enable-motif          Enable motif interface          (default is no)],
1338   [ if test "x$with_x" != xyes; then
1339         AC_MSG_ERROR(motif: --with-x option must be specified)
1340     fi
1341     if test "x$have_xm" != xyes; then
1342       AC_MSG_WARN(Motif library is not found.)
1343       enable_motif=no
1344     fi
1345   ],
1346   [ lib_xm_opt=-lXm
1347     lib_xt_opt=-lXt
1348     lib_xext_opt=-lXext
1349     if test "x$have_xprelibs" = xyes; then
1350         lib_xprelibs_opt='-lSM -lICE'
1351     fi
1352     INTERFACE_SRCS="$INTERFACE_SRCS motif_c.c motif_i.c motif_p.c"
1353   ],
1354   [ if test x$have_xprelibs = xyes; then
1355       m_so_libs="-lXext -lSM -lICE"
1356     fi
1357     m_so_libs="$ldflags_x_opt -lXm -lXt $m_so_libs -lX11"
1358   ])
1359
1360 dnl Tcl/Tk
1361 AM_CONDITIONAL(ENABLE_TCLTK, false)
1362 CONFIG_INTERFACE(tcltk,TCLTK,k,
1363   [  --enable-tcltk          Enable tcltk interface          (default is no)],
1364   [ if test "x$with_x" != xyes; then
1365         AC_MSG_ERROR(tcltk: --with-x option must be specified)
1366     fi
1367
1368     dnl save flags
1369     KEEPCPPFLAGS=$CPPFLAGS
1370     KEEPLDFLAGS=$LDFLAGS
1371     KEEPLIBS=$LIBS
1372
1373     CPPFLAGS="$tcl_include_dir $tk_includes $CPPFLAGS"
1374     LDFLAGS="$tcl_libdir $tk_libdir $LDFLAGS"
1375     LIBS="$LIBS $lib_dl_opt"
1376
1377     tcl_lib=
1378     tk_lib=
1379     for l in tcl tcl8.4 tcl8.3 tcl8.0jp tcl7.6jp tcl80jp tcl76jp tcl8.0 tcl7.6 tcl80 tcl76; do
1380       case "x$tcl_lib" in x) AC_CHECK_LIB($l,Tcl_Init,tcl_lib=-l$l);; esac
1381     done
1382     LIBS="$LIBS $tcl_lib"
1383     for l in tk tk8.4 tk8.3 tk8.0jp tk4.2jp tk80jp tk42jp tk8.0 tk4.2 tk80 tk42; do
1384       case "x$tk_lib" in x) AC_CHECK_LIB($l,Tk_Init,tk_lib=-l$l);; esac
1385     done
1386
1387     LIBS=$KEEPLIBS
1388     if test "x$tcl_lib" = x -o "x$tk_lib" = x; then
1389       CPPFLAGS=$KEEPCPPFLAGS
1390       LDFLAGS=$KEEPLDFLAGS
1391       enable_tcltk=no
1392       AC_MSG_WARN(tcl/tk is not enable)
1393     else
1394       tcltk_dep='tclIndex'
1395     fi
1396   ],
1397   [ LIBS=`echo $LIBS | sed "s/-lX11/$tk_lib $tcl_lib -lX11/"`
1398     case "$target" in
1399       *-*-bsdi*)
1400         EXTRALIBS="$EXTRALIBS -lipc"
1401         ;;
1402     esac
1403     INTERFACE_SRCS="$INTERFACE_SRCS tk_c.c"
1404   ],
1405   [ k_so_libs="$tcl_libdir $tk_libdir $tcl_lib $tk_lib $lib_dl_opt"
1406     case "$target" in
1407       *-*-bsdi*)
1408         k_so_libs="$k_so_libs -lipc"
1409         ;;
1410     esac
1411     k_so_libs="$k_so_libs -lX11 -lm"
1412   ])
1413 AM_CONDITIONAL(ENABLE_DYNAMIC_TCLTK, test "x$enable_tcltk" = "xdynamic")
1414
1415 dnl Emacs
1416 AM_CONDITIONAL(ENABLE_EMACS, false)
1417 CONFIG_INTERFACE(emacs,EMACS,e,
1418   [  --enable-emacs          Enable emacs interface          (default is no)],
1419   ,
1420   [ ELFILES="$ELFILES timidity.el"
1421     INTERFACE_SRCS="$INTERFACE_SRCS emacs_c.c"
1422   ],
1423   [ ELFILES="$ELFILES timidity.el" ])
1424
1425 dnl VT100
1426 AM_CONDITIONAL(ENABLE_VT100, false)
1427 CONFIG_INTERFACE(vt100,VT100,T,
1428   [  --enable-vt100          Enable VT100 interface          (default is no)],
1429   ,
1430   [ INTERFACE_SRCS="$INTERFACE_SRCS vt100_c.c vt100.c" ])
1431
1432 dnl X Athena Widget
1433 AM_CONDITIONAL(ENABLE_XAW, false)
1434 CONFIG_INTERFACE(xaw,XAW,a,
1435   [  --enable-xaw            Enable athena interface         (default is no)],
1436   [ if test "x$with_x" != xyes; then
1437         AC_MSG_ERROR(xaw: --with-x option must be specified)
1438     fi
1439     if test "x$have_xaw" != "xyes" -a "x$have_xaw" != "x3d"; then
1440       AC_MSG_WARN(X Athena Widget library is not found.)
1441       enable_xaw=no
1442     fi ],
1443   [ dnl Add -lXext -lSM -lICE -lXmu -lXt {-lXaw|-lXaw3d}
1444     if test "x$have_xext" = xyes; then
1445       lib_xext_opt=-lXext
1446     fi
1447     if test "x$have_xprelibs" = xyes; then
1448       lib_xprelibs_opt='-lSM -lICE'
1449     fi
1450     lib_xmu_opt=-lXmu
1451     lib_xt_opt=-lXt
1452     if test "x$have_xaw" = x3d; then
1453       AC_DEFINE(XAW3D,1,Define to 1 if you have libXaw3d.)
1454       lib_xaw_opt=-lXaw3d
1455     else
1456       lib_xaw_opt=-lXaw
1457     fi
1458     INTERFACE_SRCS="$INTERFACE_SRCS xaw_c.c xaw_i.c"
1459   ],
1460   [ if test "x$have_xext" = xyes; then
1461       a_so_libs="-lXext -lX11"
1462     else
1463       a_so_libs="-lX11"
1464     fi
1465     case "$target" in
1466       *darwin*)
1467         a_so_libs="$a_so_libs -lcc_dynamic"
1468         ;;
1469     esac
1470     if test "x$have_xprelibs" = xyes; then
1471       a_so_libs="-lSM -lICE $a_so_libs"
1472     fi
1473     if test "x$have_xaw" = xyes; then
1474       a_so_libs="-lXaw -lXmu -lXt $a_so_libs"
1475     elif test "x$have_xaw" = x3d; then
1476       AC_DEFINE(XAW3D,1,Define to 1 if you have libXaw3d.)
1477       a_so_libs="-lXaw3d -lXmu -lXt $a_so_libs"
1478     fi
1479     a_so_libs="$ldflags_x_opt $a_so_libs"
1480   ])
1481 AM_CONDITIONAL(ENABLE_DYNAMIC_XAW, test "x$enable_xaw" = "xdynamic")
1482
1483 dnl X skin
1484 AM_CONDITIONAL(ENABLE_XSKIN, false)
1485 CONFIG_INTERFACE(xskin,XSKIN,i,
1486   [  --enable-xskin          Enable X skin interface         (default is no)],
1487   [ if test "x$with_x" != xyes; then
1488         AC_MSG_ERROR(xskin: --with-x option must be specified)
1489     fi
1490   ],
1491   [ INTERFACE_SRCS="$INTERFACE_SRCS xskin_c.c xskin_i.c xskin_loadBMP.c xskin_spectrum.c" ],
1492   [ i_so_libs="$ldflags_x_opt -lX11" ])
1493
1494 dnl GTK+
1495 AM_CONDITIONAL(ENABLE_GTK, false)
1496 CONFIG_INTERFACE(gtk, GTK, g,
1497   [  --enable-gtk            Enable GTK+ interface           (default is no)],
1498   [ AM_PATH_GTK(1.1.3,,enable_gtk=no) ],
1499   [ LIBS="$LIBS $GTK_LIBS"
1500     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$GTK_CFLAGS)
1501     INTERFACE_SRCS="$INTERFACE_SRCS gtk_c.c gtk_i.c gtk_p.c"
1502   ],
1503   [ if test "x$GCC" = xyes; then
1504         dnl Do not include -rdynamic option in $g_so_libs.
1505         for i in $GTK_LIBS; do
1506             case "x$i" in
1507                 x-rdynamic) ;;
1508                 *) g_so_libs="$g_so_libs $i" ;;
1509             esac
1510         done
1511     else
1512         g_so_libs="$GTK_LIBS"
1513     fi
1514     EXTRACT_CPPFLAGS(CPPFLAGS,CFLAGS,$GTK_CFLAGS) ])
1515
1516 dnl TiMidity Network MIDI Server
1517 AM_CONDITIONAL(ENABLE_SERVER, false)
1518 CONFIG_INTERFACE(server,SERVER,r,
1519   [  --enable-server         Enable server interface         (default is no)],
1520   ,
1521   [ INTERFACE_SRCS="$INTERFACE_SRCS server_c.c"
1522     AC_CHECK_HEADERS(sys/soundcard.h)
1523   ])
1524
1525 dnl TiMidity ALSA sequencer server
1526 AM_CONDITIONAL(ENABLE_ALSASEQ, false)
1527 CONFIG_INTERFACE(alsaseq,ALSASEQ,A,
1528   [  --enable-alsaseq        Enable ALSA sequencer server interface
1529                                                           (default is no)],
1530   ,
1531   [ INTERFACE_SRCS="$INTERFACE_SRCS alsaseq_c.c"
1532     AM_PATH_ALSA
1533   ])
1534
1535 dnl TiMidity Windows synthesizer server
1536 AM_CONDITIONAL(ENABLE_WINSYN, false)
1537 CONFIG_INTERFACE(winsyn,WINSYN,W,
1538   [  --enable-winsyn        Enable Windows Synthesizer interface
1539                                                           (default is no)],
1540   ,
1541   [ INTERFACE_SRCS="$INTERFACE_SRCS winsyn_c.c rtsyn_common.c rtsyn_winmm.c" ])
1542
1543 dnl TiMidity PortMIDI synthesizer server
1544 AM_CONDITIONAL(ENABLE_PORTMIDISYN, false)
1545 CONFIG_INTERFACE(portmidisyn,PORTMIDISYN,P,
1546   [  --enable-portmidisyn        Enable PortMIDI Synthesizer interface
1547                                                           (default is no)],
1548   ,
1549   [ INTERFACE_SRCS="$INTERFACE_SRCS portmidisyn_c.c rtsyn_common.c rtsyn_portmidi.c" ])
1550
1551 dnl TiMidity Windows GUI synthesizer server
1552 AM_CONDITIONAL(ENABLE_W32G_SYN, false)
1553 CONFIG_INTERFACE(winsyng,W32G_SYN,W,
1554   [  --enable-winsyng        Enable Windows GUI Synthesizer interface
1555                                                           (default is no)],
1556   ,
1557   [ lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32 -lole32'
1558     lib_user32_opt='-luser32'
1559     LDFLAGS="-mwindows $LDFLAGS"
1560     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"
1561   ])
1562
1563
1564 dnl Windows GUI
1565 AM_CONDITIONAL(ENABLE_W32GUI, false)
1566 CONFIG_INTERFACE(w32gui, W32GUI, w,
1567   [  --enable-w32gui         Enable Windows GUI interface    (default is no)],
1568   ,
1569   [ lib_w32gui_opt='-lgdi32 -lcomctl32 -lcomdlg32 -lole32'
1570     lib_user32_opt='-luser32'
1571     LDFLAGS="-mwindows $LDFLAGS"
1572     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"
1573   ])
1574
1575 dnl UMP configuration
1576 AM_CONDITIONAL(ENABLE_PLUGIN, false)
1577 CONFIG_INTERFACE(ump, PLUGIN, p,
1578   [  --enable-ump            UMP configuration               (default is no)],
1579   [ if test ! -d ump; then
1580         AC_MSG_ERROR(UMP Package is not exists.  Can't configure it.)
1581     fi
1582     AC_CHECK_HEADER(X11/xpm.h,,AC_MSG_ERROR([UMP Package needs xpm.h[,] but could not find it.]))
1583     AC_CHECK_LIB(Xpm,XpmCreatePixmapFromData,:,AC_MSG_ERROR([UMP Package needs libXpm.a[,] but could not find it.]))
1584     if test "x$have_xext" = xyes; then
1585       lib_xext_opt=-lXext
1586     fi
1587     if test "x$have_xprelibs" = xyes; then
1588       lib_xprelibs_opt='-lSM -lICE'
1589     fi
1590     lib_xmu_opt=-lXmu
1591     lib_xt_opt=-lXt
1592   ])
1593
1594
1595 dnl Offix support
1596 dnl this rely on  CFLAGS and LIBS
1597 AC_ARG_ENABLE(offix,
1598   [  --enable-offix          Enable offix support            (default is no)],
1599   [ if test "$enableval" = "yes"; then
1600       KEEPCPPFLAGS=$CPPFLAGS
1601       KEEPLIBS=$LIBS
1602       KEEPLDFLAGS=$LDFLAGS
1603       CPPFLAGS="$CPPFLAGS $offix_include_dir"
1604       LDFLAGS="$LDFLAGS $offix_lib_dir"
1605       LIBS="$LIBS $lib_xmu_opt $lib_xt_opt $lib_xprelibs_opt $lib_xext_opt -lX11"
1606       AC_CHECK_LIB(Dnd,DndInitialize,[
1607         LIBS=$KEEPLIBS
1608         lib_offix_opt="-lDnd"
1609         AC_DEFINE(OFFIX,1,Define to 1 if you need offix support)
1610       ],
1611       [ LDFLAGS=$KEEPLDFLAGS
1612         CPPFLAGS=$KEEPCPPFLAGS
1613         LIBS=$KEEPLIBS
1614       ])
1615     fi
1616   ])
1617
1618 dnl Network section
1619 AC_ARG_ENABLE(network,
1620   [  --enable-network        Enable network support          (default is no)],
1621   [ if test "$enableval" = "yes"; then
1622       AC_DEFINE(SUPPORT_SOCKET,1,Define to 1 if you need network support)
1623     fi ])
1624 AM_CONDITIONAL(ENABLE_NETWORK, test "x$enable_network" = "xyes")
1625
1626 dnl Sound Spectrogram Viewer
1627 AC_ARG_ENABLE(spectrogram,
1628   [  --enable-spectrogram    Enable Sound Spectrogram Viewer (default is no)],
1629   [ if test "$enableval" = "yes"; then
1630       if test "x$with_x" != xyes; then
1631         AC_MSG_ERROR(spectrogram: --with-x option must be specified)
1632       fi
1633       AC_DEFINE(SUPPORT_SOUNDSPEC,1,Define to 1 if you need spectrogram vewer.)
1634     fi ])
1635 AM_CONDITIONAL(ENABLE_SOUND_SPEC, test "x$enable_spectrogram" = "xyes")
1636
1637 dnl Wave Spline Interpolations
1638 AC_ARG_ENABLE(spline,
1639   [  --enable-spline=[method]  Specify spline method.
1640                                   one of no,linear,cubic,lagrange,newton,gauss
1641                                                           (default is linear)],
1642   [ case "x$enableval" in
1643       xlinear)
1644         AC_DEFINE(LINEAR_INTERPOLATION,1,Define to 1 if you use linear interpolation.)
1645         ;;
1646       xcubic)
1647         AC_DEFINE(CSPLINE_INTERPOLATION,1,Define to 1 if you use cubic-spline interpolation.)
1648         ;;
1649       xlagrange)
1650         AC_DEFINE(LAGRANGE_INTERPOLATION,1,Define to 1 if you use Lagrange-polynomial interpolation.)
1651         ;;
1652       xnewton)
1653         AC_DEFINE(NEWTON_INTERPOLATION,1,Define to 1 if you use Newton-polynomial interpolation.)
1654         ;;
1655       xgauss)
1656         AC_DEFINE(GAUSS_INTERPOLATION,1,Define to 1 if you use Gauss interpolation.)
1657         ;;
1658       xno)
1659         AC_DEFINE(NO_INTERPOLATION,1,Define to 1 if you do not use complemention.)
1660         ;;
1661       *)
1662         AC_MSG_ERROR(Invalid method of --enable-spline)
1663         ;;
1664     esac ])
1665
1666 dnl WRD interface
1667 AC_ARG_ENABLE(wrd,
1668   [  --enable-wrd            Enable WRD interface for X      (default is no)],
1669   [ if test "$enableval" = "yes"; then
1670       if test "x$with_x" != xyes; then
1671         AC_MSG_ERROR(wrd: --with-x option must be specified)
1672       fi
1673       AC_DEFINE(WRDT_X,1,Define to 1 if you need wrd support for X.)
1674       enable_sherry_wrd=yes
1675       AC_CHECK_LIB(z,zlibVersion,:,enable_sherry_wrd=no)
1676       AC_CHECK_HEADER(png.h,,enable_sherry_wrd=no)
1677       AC_CHECK_LIB(png,png_init_io,:,enable_sherry_wrd=no,-lz)
1678       if test "$enable_sherry_wrd" = yes; then
1679         AC_DEFINE(ENABLE_SHERRY,1,Define to 1 if you enable Sherry WRD)
1680         lib_zip_opt=-lz
1681         lib_png_opt=-lpng
1682       else
1683          AC_MSG_WARN([Sherry WRD is disabled: png.h, libpng.a, libz.a are required])
1684       fi
1685       if test "x$have_xext" = xyes; then
1686         lib_xext_opt=-lXext
1687       fi
1688     fi ])
1689
1690 dnl end of interfaces
1691
1692
1693 #
1694 # Finish up
1695 #
1696
1697 AM_CONDITIONAL(ENABLE_WRD, test "x$enable_wrd" = "xyes")
1698
1699 AM_CONDITIONAL(CYGNUS, test "x$CYGNUS" = xyes)
1700 AM_CONDITIONAL(MINGW, test "x$MINGW" = xyes)
1701 AM_CONDITIONAL(W32READDIR, test "x$W32READDIR" = "xyes")
1702
1703 SET_UNIQ_WORDS(LDFLAGS,$LDFLAGS)
1704 SET_UNIQ_WORDS(SHLDFLAGS,$SHLDFLAGS)
1705 SET_UNIQ_WORDS(CFLAGS,$EXTRACFLAGS $CFLAGS)
1706 SET_UNIQ_WORDS(CPPFLAGS,$CPPFLAGS $EXTRADEFS)
1707
1708 if test "x$oss_device" != x; then
1709   AC_DEFINE_UNQUOTED(OSS_DEVICE,"$oss_device", oss device name)
1710 fi
1711
1712 if test "x$TIMIDITY_OUTPUT_ID" != x; then
1713   AC_DEFINE_UNQUOTED(TIMIDITY_OUTPUT_ID,"$TIMIDITY_OUTPUT_ID", the output specification)
1714 fi
1715
1716 if test "x$with_x" = xyes; then
1717   dnl Order of X-library is: -lXm -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11
1718   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/"`
1719 fi
1720 LIBS="$LIBS $lib_dl_opt $lib_png_opt $lib_zip_opt $lib_user32_opt $lib_w32gui_opt $EXTRALIBS"
1721 SHLD="$SHLD $SHLDFLAGS"
1722
1723 AC_SUBST(SHELL)
1724 AC_SUBST(timidity_LDFLAGS)
1725 AC_SUBST(SYSEXTRAS)
1726 AC_SUBST(EXTRALIBS)
1727 AC_SUBST(NETSRCS)
1728 AC_SUBST(ELFILES)
1729 AC_SUBST(SHLD)
1730 AC_SUBST(SHCFLAGS)
1731 AC_SUBST(dynamic_targets)
1732 AC_SUBST(so)
1733 AC_SUBST(LN_S)
1734 AC_SUBST(WISH)
1735 AC_SUBST(tcltk_dep)
1736 AC_SUBST(program_transform_name)
1737 AC_SUBST(INTERFACE_SRCS)
1738 AC_SUBST(pkgdatadir)
1739 AC_SUBST(pkglibdir)
1740
1741 AC_CONFIG_FILES([
1742   Makefile
1743   autoconf/Makefile
1744   common.makefile
1745   configs/Makefile
1746   doc/Makefile
1747   doc/C/Makefile
1748   doc/ja_JP.eucJP/Makefile
1749   interface/Makefile
1750   interface/motif_bitmaps/Makefile
1751   interface/bitmaps/Makefile
1752   interface/pixmaps/Makefile
1753   libarc/Makefile
1754   libunimod/Makefile
1755   timidity/Makefile
1756   utils/Makefile
1757   script/Makefile
1758   TiMidity.ad
1759   TiMidity-uj.ad
1760 ])
1761 AC_OUTPUT