OSDN Git Service

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