OSDN Git Service

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