OSDN Git Service

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