1dnl
2dnl configure.ac for xsystem35
3dnl -----
4AC_INIT(configure.ac)
5AC_CANONICAL_TARGET
6
7dnl
8dnl Require autoconf version 2.59
9dnl
10AC_PREREQ(2.59)
11
12dnl
13dnl EXTRAxxx is for misc CFLAGS and LIBS
14dnl
15EXTRACFLAGS=
16EXTRALIBS=
17EXTRALDFLAGS="-rdynamic"
18
19dnl
20dnl versions
21dnl
22XSYS35_MAJOR=1
23XSYS35_MINOR=7
24XSYS35_MICRO=3
25XSYS35_EXTRA=pre5
26
27XSYS35_VERSION=$XSYS35_MAJOR.$XSYS35_MINOR.$XSYS35_MICRO$XSYS35_EXTRA
28VERSION_MA=$XSYS35_MAJOR.$XSYS35_MINOR.$XSYS35_MICRO
29VERSION_MI=$XSYS35_EXTRA
30AC_SUBST(VERSION_MA)
31AC_SUBST(VERSION_MI)
32
33dnl
34dnl For automake.
35dnl
36VERSION=$XSYS35_VERSION
37PACKAGE=xsystem35
38
39dnl
40dnl Initialize automake stuff
41dnl
42AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
43AM_CONFIG_HEADER(config.h)
44AM_MAINTAINER_MODE
45
46dnl
47dnl Pick up m4 macros
48dnl
49dnl AM_ACLOCAL_INCLUDE(m4)
50AM_ACLOCAL_INCLUDE(macros)
51
52dnl
53dnl add subdirectory for libltdl
54dnl
55dnl AC_CONFIG_SUBDIRS(libltdl)
56
57dnl
58dnl Checks for programs.
59dnl
60AC_PROG_CC
61dnl AC_PROG_INSTALL
62dnl AC_PROG_MAKE_SET
63dnl AC_ISC_POSIX
64dnl AC_C_VAR_FUNC
65
66dnl
67dnl Check for libltdl
68dnl
69AC_CONFIG_SUBDIRS(libltdl)
70AC_LIBTOOL_DLOPEN
71AC_LIBLTDL_CONVENIENCE([libltdl])
72AC_LIB_LTDL
73AC_PROG_LIBTOOL
74AC_SUBST([LTDLINCL])
75AC_SUBST([LIBLTDL])
76
77dnl AM_PROG_LIBTOOL
78dnl AC_SUBST(INCLTDL)
79dnl AC_SUBST(LIBLTDL)
80dnl AC_SUBST(LIBADD_DL)
81dnl AC_LIBLTDL_INSTALLABLE
82dnl AC_WITH_LTDL
83
84dnl
85dnl Check for gettext
86dnl
87AM_GNU_GETTEXT([external])
88AM_GNU_GETTEXT_VERSION(0.11.5)
89
90dnl
91dnl Checks for header files.
92dnl
93AC_PATH_X
94
95dnl
96dnl Checks for typedefs, structures, and compiler characteristics.
97dnl
98dnl AC_C_CONST
99dnl AC_C_INLINE
100dnl AC_TYPE_PID_T
101dnl AC_TYPE_SIZE_T
102dnl AC_HEADER_TIME
103dnl AC_STRUCT_TM
104AC_C_BIGENDIAN
105AC_CHECK_HEADERS(libgen.h)
106
107
108dnl
109dnl Check X11
110dnl
111AC_PATH_XTRA
112AC_SUBST(X_CFLAGS)
113AC_SUBST(X_LIBS)
114
115dnl
116dnl Checks for library functions.
117dnl
118AC_CHECK_FUNCS(gettimeofday mkdtemp)
119
120dnl
121dnl zlib
122dnl
123AC_CHECK_LIB(z, zlibVersion,
124	[ AC_CHECK_HEADER(zlib.h,
125          have_zlib=yes
126          ZLIB_LIBS="-lz",)], AC_MSG_ERROR(zlib needed))
127AC_SUBST(ZLIB_LIBS)
128
129
130
131dnl
132dnl check pkg-config program
133dnl
134dnl AC_PATH_PROG(PKGCONFIG,pkg-config,no)
135dnl enable_pkgc=no
136dnl if test x"$PKGCONFIG" != "xno"; then
137dnl   AC_ARG_ENABLE(pkg-config,
138dnl      [  --enable-pkg-config     Enable pkg-config for check glib|gtk [default=no]],
139dnl      [enable_pkgc=yes])
140dnl fi
141
142dnl
143dnl check glib
144dnl
145no_glib12=no
146must_gtk=no
147AM_PATH_GLIB(1.2.0,
148  AC_DEFINE(ENABLE_GLIB,1,[Define this if you have glib >= 1.2.0]),
149    [AC_MSG_RESULT(No glib-1.2 found. Next check glib-2.0)
150     no_glib12=yes
151    ]
152  )
153
154if test "x$no_glib12" = xyes; then
155  AM_PATH_GLIB_2_0(2.0.0,
156    AC_DEFINE(ENABLE_GLIB,1,[Define this if you have glib >= 1.2.0]),
157    [AC_MSG_RESULT(No glib-2.x found. Next check glib-1.0 in gtk)
158     must_gtk=yes
159    ]
160  )
161fi
162
163dnl if test x"$enable_pkgc" = "xno"; then
164dnl  AM_PATH_GLIB(1.2.0,
165dnl	       AC_DEFINE(ENABLE_GLIB,1,[Define this if you have glib >= 1.2.0]),must_gtk=yes)
166dnl  if test x"$must_gtk" = "xyes"; then
167dnl    AC_MSG_RESULT("May be 1.0.x ?. You can't be disable gtk")
168dnl  fi
169dnl else
170dnl  AC_ARG_WITH(glib-target,
171dnl             [  --with-glib-target       target glib [default=glib]],
172dnl             [glibtarget="glib$withval"],[glibtarget="glib"])
173dnl  PKG_CHECK_MODULES(BASE_DEPENDENCEIS, $glibtarget >= 1.2.0)
174dnl  GLIB_CFLAGS="`$PKGCONFIG --cflags $glibtarget`"
175dnl  GLIB_LIBS="`$PKGCONFIG --libs $glibtarget`"
176dnl  AC_DEFINE(ENABLE_GLIB,1,[Define this if you have glib >= 1.2.0])
177dnl fi
178
179dnl
180dnl check for gtk
181dnl
182AC_ARG_ENABLE(gtk,
183  [  --enable-gtk            Enable gtk-based widget [default=yes]],,
184  [enable_gtk=yes])
185if test "x$must_gtk" = xyes; then
186  if test "x$enable_gtk" != xyes; then
187    enable_gtk=yes
188  fi
189fi
190
191no_gtk1x=no
192have_gtk=no
193if test "x$enable_gtk" = xyes; then
194  AM_PATH_GTK(1.0.0,
195    AC_DEFINE(ENABLE_GTK,1,[Define this if you have gtk+ >= 1.0.0]),
196    [AC_MSG_RESULT(No gtk-1.x found. Next check gtk-2.x)
197     no_gtk1x=yes
198    ]
199  )
200  if test "x$no_gtk1x" = xyes; then
201    AM_PATH_GTK_2_0(2.0.0,
202      AC_DEFINE(ENABLE_GTK,1,[Define this if you have gtk+ >= 1.0.0]),
203      AC_MSG_ERROR(*** check for GTK failed ***)
204    )
205  fi
206  have_gtk=yes
207fi
208
209
210dnl if test x"$enable_gtk" = "xyes"; then
211dnl   if test x"$enable_pkgc" = "xno"; then
212dnl    AM_PATH_GTK(1.0.0,
213dnl                AC_DEFINE(ENABLE_GTK,1,[Define this if you have gtk+ >= 1.0.0]),
214dnl		AC_MSG_ERROR(*** check for GTK failed ***))
215dnl  else
216dnl    AC_ARG_WITH(gtk-target,
217dnl               [  --with-gtk-target       target gtk+ [default=gtk+]],
218dnl               [gtktarget="gtk+$withval"],[gtktarget="gtk+"])
219dnl    PKG_CHECK_MODULES(BASE_DEPENDENCEIS, $gtktarget >= 1.0.0)
220dnl    GTK_CFLAGS="`$PKGCONFIG --cflags $gtktarget`"
221dnl    GTK_LIBS="`$PKGCONFIG --libs $gtktarget`"
222dnl     AC_DEFINE(ENABLE_GTK,1,[Define this if you have gtk+ >= 1.0.0])
223dnl   fi
224dnl   have_gtk=yes
225dnl fi
226
227AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = xyes)
228SRC_MENU=
229if test "x$have_gtk" = xyes ; then
230  SRC_MENU="menu.c menu_callback.c menu_gui.c"
231else
232  SRC_MENU="menu_null.c"
233fi
234AC_SUBST(SRC_MENU)
235
236dnl for gtk-1.0
237if test "x$must_gtk" = xyes; then
238  GLIB_CFLAGS="$GTK_CFLAGS"
239  GLIB_LIBS="$GTK_LIBS"
240fi
241
242
243dnl
244dnl audio check
245dnl
246AC_ARG_ENABLE(audio,
247  [  --enable-audio[=mode_list]  Enable audio (Specify comma separated mode list):
248                              default:  Automatically select audio device.
249                              oss:      OSS (Open Sound System) device
250                              sun:      sun style interface
251                              alsa:     ALSA pcm device
252                              esd:      EsounD],
253  [ enable_audio=$enableval],
254  [ enable_audio=yes])
255
256dnl yes -> default
257test "x$enable_audio" = xyes && enable_audio=default
258
259if test "x$enable_audio" != xno; then
260  for i in `echo $enable_audio | sed 's/,/ /g'`; do
261    eval "enable_$i=yes"
262  done
263  if test "x$enable_default" = xyes; then
264    enable_audio=default
265  fi
266fi
267
268if test "x$enable_audio" = xdefault; then
269  case "$target" in
270    *-*-linux*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
271      enable_oss=yes
272      ;;
273    *-*-solaris*)
274      enable_sun=yes
275      ;;
276    *)
277      enable_esd=yes
278      ;;
279  esac
280fi
281
282
283dnl
284dnl Sun style audio interface
285dnl
286have_sunaudio=no
287if test "x$enable_sun" = xyes; then
288  AC_MSG_CHECKING(for Sun audio support)
289  AC_TRY_COMPILE([
290            #include <sys/types.h>
291            #include <sys/audioio.h>
292        ],[
293            audio_info_t audio_info;
294            AUDIO_INITINFO(&audio_info);
295        ],[
296            have_sunaudio=yes
297        ])
298  AC_MSG_RESULT($have_sunaudio)
299  if test "x$have_sunaudio" = xyes; then
300    AC_DEFINE(ENABLE_SUNAUDIO,1,[define this if you use sun stlye audio interface])
301 fi
302fi
303
304
305dnl
306dnl OSS
307dnl
308have_ossaudio=no
309if test "x$enable_oss" = xyes; then
310  AC_MSG_CHECKING(for OSS audio support)
311  case "$target" in
312      *-*-netbsd*)
313        EXTRALIBS="$EXTRALIBS -lossaudio"
314        have_ossaudio=yes
315        ;;
316      *-*-openbsd*)
317        EXTRACFLAGS="$EXTRACFLAGS -I/usr/local/lib/oss/include"
318        EXTRALIBS="$EXTRALIBS -lossaudio"
319        have_ossaudio=yes
320        ;;
321      *-*-linux*|*-*-freebsd*)
322        have_ossaudio=yes
323        ;;
324      *)
325        have_ossaudio=no
326        ;;
327  esac
328  AC_MSG_RESULT($have_ossaudio)
329  if test "x$have_ossaudio" = xyes; then
330    AC_DEFINE(ENABLE_OSS,1,[define this if you use OSS audio interface])
331  fi
332fi
333
334
335dnl
336dnl ALSA
337dnl
338dnl if test x"$enable_alsa" = "xyes"; then
339dnl   AM_PATH_ALSA(0.5.0,
340dnl           [ AC_DEFINE(ENABLE_ALSA,1,[Define this if you have Alsa (libasound) installed])
341dnl           if test x"$have_alsa09" = "xyes"; then
342dnl             AC_DEFINE(ENABLE_ALSA09,1,[Define this if you have alsa 0.9.x and more installed])
343dnl           fi
344dnl           if test x"$have_alsa05" = "xyes"; then
345dnl             AC_DEFINE(ENABLE_ALSA05,1,[Define this if you have alsa 0.5.x installed])
346dnl           fi
347dnl         ],
348dnl   AC_MSG_RESULT(*** All of ALSA dependent parts will be disabled ***))
349dnl fi
350
351if test "x$enable_alsa" = xyes; then
352  AM_PATH_ALSA(0.9.0,
353               [ AC_DEFINE(ENABLE_ALSA09,1,[Define this if you have alsa 0.9.x and more installed])
354                 have_alsa09=yes
355               ],
356               have_alsa09=no)
357  if test "x$have_alsa09" = xno; then
358    AM_PATH_ALSA(0.5.0,
359                 [ AC_DEFINE(ENABLE_ALSA05,1,[Define this if you have 0.5.x <= alsa < 0.9.0 installed])
360                   have_alsa05=yes
361                 ],
362                 have_alsa05=no)
363  fi
364  if test "x$have_alsa09" = xno -a "x$have_alsa05" = xno; then
365    AC_MSG_RESULT(*** All of ALSA dependent parts will be disabled ***)
366  else
367    AC_DEFINE(ENABLE_ALSA,1,[Define this if you have Alsa (libasound) installed])
368  fi
369fi
370
371
372dnl
373dnl ESD
374dnl
375no_esd=yes
376if test "x$enable_esd" = xyes; then
377  AM_PATH_ESD(0.2.8,
378	  AC_DEFINE(ENABLE_ESD,1,[Define this if you have ESD (libesd) installed]),
379	  AC_MSG_RESULT(*** All of ESD dependent parts will be disabled ***))
380fi
381
382
383dnl
384dnl Turn on default audio output mode
385dnl
386DEFAULT_PLAYMODE=
387AC_ARG_WITH(default-output,
388  [  --with-default-output=<mode>  Specify default output mode (optional):
389                                   default|oss|alsa|esd|sun],
390  [ if test "$enable_audio" != no; then
391      DEFAULT_PLAYMODE=$withval
392      eval "enable_$DEFAULT_PLAYMODE=yes"
393    else
394      AC_MSG_WARN(--with-default-output=$withval: audio is not enabled)
395    fi]
396)
397AC_MSG_CHECKING(default output mode)
398if test "x$DEFAULT_PLAYMODE" = x; then
399  DEFAULT_PLAYMODE=`echo $enable_audio | sed 's/,.*//'`
400fi
401case ".$DEFAULT_PLAYMODE" in
402  .default)  def_am=AUDIO_PCM_ANY ;;
403  .oss)      def_am=AUDIO_PCM_OSS ;;
404  .alsa)     def_am=AUDIO_PCM_ALSA ;;
405  .esd)      def_am=AUDIO_PCM_ESD ;;
406  .sun)      def_am=AUDIO_PCM_SUN ;;
407  *)         def_am= ;;
408esac
409if test "x$have_alsa09" = xyes; then
410  if test "x$def_am" != x; then
411    def_am="$def_am09"
412  fi
413fi
414AC_MSG_RESULT($def_am)
415if test "x$def_am" != x; then
416  AC_DEFINE_UNQUOTED(DEFAULT_AUDIO_MODE, $def_am, [default audio mode])
417fi
418
419
420
421dnl
422dnl OSS/ALSA/ESD
423dnl
424SRC_AUDIO=
425if test "x$have_ossaudio" = xyes; then
426  SRC_AUDIO="$SRC_AUDIO audio_oss.c"
427fi
428if test "x$have_sunaudio" = xyes; then
429  SRC_AUDIO="$SRC_AUDIO audio_sun.c"
430fi
431if test "x$have_alsa05" = xyes; then
432  SRC_AUDIO="$SRC_AUDIO audio_alsa.c"
433fi
434if test "x$have_alsa09" = xyes; then
435  SRC_AUDIO="$SRC_AUDIO audio_alsa09.c"
436fi
437if test "x$no_esd" != xyes; then
438  SRC_AUDIO="$SRC_AUDIO audio_esd.c"
439fi
440AC_SUBST(SRC_AUDIO)
441
442dnl
443dnl cdrom device
444dnl
445AC_ARG_ENABLE(cdrom,
446  [  --enable-cdrom[=mode_list]  Enable CD-adio (Specify comma separated mode list):
447                              (default:  Automatically select cdrom device)
448                              linux:    linux API (Linux/Solaris)
449                              bsd:      BSD API (FreeBSD/NetBSD/OpenBSD)
450                              irix:     IRIX API
451                              mp3:      play mp3 file using external/piped player],
452  [ enable_cdrom=$enableval],
453  [ enable_cdrom=yes])
454
455dnl yes -> default
456test "x$enable_cdrom" = xyes -a enable_cdrom=default
457
458if test "x$enable_cdrom" != xno; then
459  for i in `echo $enable_cdrom | sed 's/,/ /g'`; do
460    eval "enable_cd_$i=yes"
461  done
462  if test "x$enable_cd_default" = xyes; then
463    enable_cdrom=default
464  fi
465fi
466
467if test "x$enable_cdrom" = xdefault; then
468  case "$target" in
469    *-*-linux*|*-*-solaris*)
470      enable_cd_linux=yes
471      ;;
472    *-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
473      enable_cd_bsd=yes
474      ;;
475    *-irix*)
476      enable_cd_irix=yes
477      ;;
478    *-dec-*)
479      enable_cd_mp3=yes
480      ;;
481    *)
482      AC_MSG_WARN(No --enable-cdrom=default cdrom for $target)
483      ;;
484  esac
485fi
486
487SRC_CDROM=
488if test "x$enable_cd_linux" = xyes; then
489  SRC_CDROM="cdrom.Linux.c"
490  AC_DEFINE(ENABLE_CDROM_LINUX,1,[Define this if your use cdrom ioctl in linux or Solaris])
491elif test "x$enable_cd_bsd" = xyes; then
492  SRC_CDROM="$SRC_CROM cdrom.FreeBSD.c"
493  AC_DEFINE(ENABLE_CDROM_BSD,1,[Define this if you use cdrom iotctl in *BSD])
494elif test "x$enable_cd_irix" = xyes; then
495  SRC_CDROM="$SRC_CDROM cdrom.Irix.c"
496  AC_DEFINE(ENABLE_CDROM_IRIX,1,[Define this if you use cdrom ctrl library in IRX])
497else
498  SRC_CDROM="$SRC_CDROM cdrom.empty.c"
499fi
500if test "x$enable_cd_mp3" = xyes; then
501  SRC_CDROM="$SRC_CDROM cdrom.mp3.c"
502  AC_DEFINE(ENABLE_CDROM_MP3,1,[Define this if you use external player for cdrom audio])
503fi
504AC_SUBST(SRC_CDROM)
505
506AC_ARG_WITH(cdromdev,    [  --with-cdromdev=#       CDROM Device Name. [default=/dev/cdrom]],	cdromdev="$withval",cdromdev="/dev/cdrom")
507AC_DEFINE_UNQUOTED(CDROM_DEVICE,"$cdromdev",[cdrom device])
508
509dnl
510dnl Check if X_LOCALE definition is necessary
511dnl
512AC_ARG_WITH(locale, [  --with-locale=LOCALE    locale name you want to use(ex. ja_JP.ujis) ])
513AC_MSG_CHECKING(need -DX_LOCALE)
514
515AC_TRY_RUN([
516#include <stdio.h>
517#include <locale.h>
518
519int
520main ()
521{
522  return setlocale (LC_ALL, "${with_locale}") == NULL;
523}],
524need_x_locale=no,
525need_x_locale=yes,
526need_x_locale=no)
527AC_MSG_RESULT($need_x_locale)
528
529if test "x$need_x_locale" = xyes; then
530  EXTRACFLAGS="$EXTRACFLAGS -DX_LOCALE"
531fi
532
533dnl
534dnl OS dependent param
535dnl
536case "$target" in
537  *-*-linux*)
538    ;;
539  *-*-freebsd*)
540    EXTRALIBS="$EXTRALIBS -lxpg4"
541    EXTRACFLAGS="$EXTRACFLAGS -I/usr/local/include"
542    EXTRALDFLAGS="$EXTRALDFLAGS -L/usr/local/lib"
543    ;;
544  *-irix*)
545    chk_rgb=yes
546    EXTRALIBS="$EXTRALIBS -lcdaudio -lds -lmediad"
547    ;;
548  sparc-*)
549    chk_rgb=yes
550    ;;
551esac
552
553dnl
554dnl Force to set Color RGB order (need to check for sparc)
555dnl
556if test "x$chk_rgb" = xyes; then
557  AC_ARG_ENABLE(bgr,
558    [  --enable-bgr            Color order is BGR [default is no for most arch]
559                          You should check whether your X server is RGB or
560                          BGR order, especially in sparc architecture.],,
561    [ enable_bgr=yes ])
562fi
563if test "x$enable_bgr" = xyes; then
564  AC_DEFINE(BGR_ORDER,1,[Define this if X11 Pixmap color order is BGR])
565else
566  AC_DEFINE(RGB_ORDER,1,[Define this if X11 Pixmap color order is RGB])
567fi
568
569dnl
570dnl set ALSA param
571dnl
572if test "x$have_alsa" = xyes ; then
573    AC_ARG_WITH(alsa-card,    [  --with-alsa-card=#      ALSA Card No.],
574	alsacard="$withval",alsacard="0")
575    AC_ARG_WITH(alsa-pcmdev,  [  --with-alsa-pcmdev=#    ALSA PCM device No.],
576	alsapcmdev="$withval",alsapcmdev="0")
577    AC_ARG_WITH(alsa-mixerdev,[  --with-alsa-mixerdev=#  ALSA Mixer device No.],
578	alsamixerdev="$withval",alsamixerdev="0")
579    ALSACARD=$alsacard
580    AC_DEFINE_UNQUOTED(ALSACARD,"$alsacard",[alsa card no])
581    MIXERDEV_ALSA=$alsamixerdev
582    AUDIODEV_ALSA=$alsapcmdev
583    AC_DEFINE_UNQUOTED(AUDIODEV_ALSA,"$AUDIODEV_ALSA",[aduio device])
584    AC_DEFINE_UNQUOTED(MIXERDEV_ALSA,"$MIXERDEV_ALSA",[mixer device])
585    AC_CHECK_LIB(asound,snd_mixer_element_read,ALSAMIX_H=mixer_alsa.h)
586    AC_SUBST(ALSAMIX_H)
587fi
588
589dnl
590dnl set OSS param
591dnl
592if test "x$have_ossaudio" = xyes ; then
593    AC_ARG_WITH(audiodev,[  --with-oss-audiodev=DEVFILE DSP DEVICE],
594       audiodev="$withval",ossaudiodev="/dev/dsp")
595    AC_ARG_WITH(mixerdev,[  --with-oss-mixerdev=DEVFILE MIXER DEVICE],
596       mixerdev="Ec$withval",ossmixerdev="/dev/mixer")
597    AUDIODEV_OSS=$ossaudiodev
598    MIXERDEV_OSS=$ossmixerdev
599    AC_DEFINE_UNQUOTED(AUDIODEV_OSS,"$AUDIODEV_OSS",[aduio device])
600    AC_DEFINE_UNQUOTED(MIXERDEV_OSS,"$MIXERDEV_OSS",[mixer device])
601fi
602
603
604dnl
605dnl Select Midi Play Methods
606dnl
607AC_ARG_ENABLE(midi,
608  [  --enable-midi[=mode_list]  Enable midi (Specify comma separated mode list):
609                             extp:     External midi player(default)
610                             raw:      Raw midi interface
611                             seq:      Sequencer interface],
612  [ enable_midi=$enableval],
613  [ enable_midi=yes])
614
615dnl yes -> default
616test "x$enable_midi" = xyes && enable_midi=default
617
618if test "x$enable_midi" != xno; then
619  for i in `echo $enable_midi | sed 's/,/ /g'`; do
620    eval "enable_midi_$i=yes"
621  done
622fi
623
624if test "x$enable_midi" = xdefault; then
625  case "$target" in
626    *)
627      enable_midi_extp=yes
628      ;;
629  esac
630fi
631
632SRC_MIDI=
633if test "x$enable_midi_extp" = xyes; then
634  SRC_MIDI="midi.extplayer.c"
635  AC_DEFINE(ENABLE_MIDI_EXTPLAYER,1,[define this if you use external midi player])
636fi
637if test "x$enable_midi_raw" = xyes || test "x$enable_midi_seq" = xyes; then
638  SRC_MIDI="$SRC_MIDI midi.rawmidi.c midifile.c"
639  if  test "x$enable_midi_raw" = xyes; then
640    AC_DEFINE(ENABLE_MIDI_RAWMIDI,1,[define this if you use oss raw midi interface])
641  fi
642  if  test "x$enable_midi_seq" = xyes; then
643    AC_DEFINE(ENABLE_MIDI_SEQMIDI,1,[define thsi if you use oss sequencer interface])
644  fi
645fi
646AC_SUBST(SRC_MIDI)
647
648dnl
649dnl set midi player
650dnl
651AC_ARG_WITH(midi-player,[  --with-midi-player=xxx  External Midi Player [default=playmidi -4]],
652	midiplayer="$withval",midiplayer="playmidi -4")
653AC_DEFINE_UNQUOTED(MIDI_PLAYER,"$midiplayer",[midi player])
654
655dnl
656dnl Quiet mode for external midi player
657dnl
658AC_ARG_ENABLE(qmidi,[  --enable-qmidi          No display midi stdout],
659	  AC_DEFINE(QUITE_MIDI,1,[define this if you stop midi stdout]))
660
661dnl
662dnl Midi device for rawmidi mode
663dnl
664AC_ARG_WITH(mididev,    [  --with-mididev=#        MIDI Raw Device Name. [default=/dev/midi]], mididev="$withval", mididev="/dev/midi")
665AC_DEFINE_UNQUOTED(MIDI_DEVICE,"$mididev",[midi device])
666
667dnl
668dnl Sequencer device for seqmidi mode
669dnl
670AC_ARG_WITH(seqdev,    [  --with-seqdev=#         MIDI Sequencer Device Name. [default=/dev/sequencer]], mididev="$withval", seqdev="/dev/sequencer")
671AC_DEFINE_UNQUOTED(SEQ_DEVICE,"$seqdev",[sequencer device])
672
673
674dnl
675dnl general cachae size
676dnl
677AC_ARG_WITH(cachesize,[  --with-cachesize=#      General Cache size (MB)],
678  AC_DEFINE_UNQUOTED(CACHE_TOTALSIZE,$withval,[General Cache size (MB)]))
679
680
681dnl
682dnl SDL
683dnl
684SRC_GRAPHDEV="xcore_draw.c xcore_video.c xcore_mode.c xcore_event.c xcore_cursor.c xcore_maskupdate.c image.c"
685AC_ARG_ENABLE(sdl,
686	  [  --enable-sdl            SDL [default=no]    ],,
687	  [ enable_sdl=no ])
688if test "x$enable_sdl" = xyes ; then
689  KEEPLIBS=$LIBS
690  KEEPCFLAGS=$CFLAGS
691  KEEPLDFLAGS=$LDFLAGS
692  AM_PATH_SDL(1.0.0,have_sdl=yes,have_sdl=no)
693  LIBS=$SDL_LIBS
694  CFLAGS=$SDL_CFLAGS
695  AC_CHECK_LIB(SDL,SDL_NumJoysticks,have_sdljoy=yes)
696  AC_MSG_CHECKING(for SDL RLE accell)
697  sdlrle=no
698  sdlralpha=no
699  AC_TRY_RUN([
700#include <SDL.h>
701int main( int argc,char **argv) {
702#ifndef SDL_RLEACCEL
703  exit(1);
704#else
705  exit(0);
706#endif
707}
708  ],
709    AC_MSG_RESULT("yes");sdlrle=yes,
710    AC_MSG_RESULT("no"),
711    AC_MSG_RESULT("unknown")
712  )
713  if test "x$sdlrle" = xyes ; then
714    AC_MSG_CHECKING(for SDL alpha value)
715    AC_TRY_RUN([
716#include <SDL.h>
717int main( int argc,char **argv) {
718	SDL_Surface *s1,*s2;
719	unsigned short *x;
720	s1=SDL_AllocSurface(SDL_SWSURFACE,8,8,16,0,0,0,0);
721	s2=SDL_AllocSurface(SDL_SWSURFACE,8,8,16,0,0,0,0);
722	SDL_FillRect(s1,NULL,0);
723	SDL_FillRect(s2,NULL,0xFFFF);
724	SDL_SetAlpha(s2,SDL_SRCALPHA|SDL_RLEACCEL,255);
725	SDL_BlitSurface(s2,NULL,s1,NULL);
726	x=s1->pixels;
727	if( *x )
728		exit(1);
729	exit(0);
730}
731      ],
732      AC_MSG_RESULT("normal"),
733      AC_MSG_RESULT("revese");sdlralpha=yes,
734      AC_MSG_RESULT("unknown")
735    )
736  fi
737  LIBS=$KEEPLIBS
738  CFLAGS=$KEEPCFLAGS
739  LDFLAGS=$KEEPLDFLAGS
740fi
741if test "x$have_sdl" = xyes ; then
742  AC_DEFINE(ENABLE_SDL,1,[define this if you use SDL])
743  SDL=1
744  SRC_GRAPHDEV="sdl_video.c sdl_mode.c sdl_draw.c sdl_event.c sdl_image.c sdl_cursor.c image.c"
745  AC_SUBST(SDL)
746  if test "x$sdlrle" = xyes ; then
747    AC_DEFINE(HAVE_SDLRLE,1,[define this if you have SDLRLE])
748  fi
749  if test "x$sdlralpha" = xyes ; then
750    AC_DEFINE(HAVE_SDLRALPHA,1,[define this if you have SDLRALPHA])
751  fi
752fi
753AC_SUBST(SRC_GRAPHDEV)
754
755dnl
756dnl joystick
757dnl
758AC_ARG_ENABLE(joy,
759  [  --enable-joy            Use joystick (only linux and SDL) [default=no]],,
760  [  enable_joy=no] )
761if test "x$enable_joy" = xyes ; then
762  if test "x$have_sdljoy" = xyes ; then
763    AC_DEFINE(HAVE_SDLJOY,1,[define this if you use SDL joystick interface])
764    JOY_S=joystick_sdl
765  else
766    AC_CHECK_HEADERS(linux/joystick.h,
767      [JOY_S=joystick_linux],
768      [JOY_S=joystick_dmy])
769  fi
770else
771  JOY_S=joystick_dmy
772fi
773AC_SUBST(JOY_S)
774
775AC_ARG_WITH(joydev,    [  --with-joydev=#         Joystick Device Name. [default=/dev/js0]],	joydev="$withval",joydev="/dev/js0")
776AC_DEFINE_UNQUOTED(JOY_DEVICE,"$joydev",[joystick device])
777
778
779dnl
780dnl FreeType (Font)
781dnl
782have_ttf=no
783SRC_FONT=
784if test "x$have_sdl" = xyes; then
785  if test "x$enable_gtk" = xyes; then
786    SRC_FONT="font_gtk.c"
787    AC_DEFINE(ENABLE_GTKFONT,1,[define this if you use gtk(gdk) font interface])
788  fi
789else
790  SRC_FONT="font_x11.c"
791  AC_DEFINE(ENABLE_X11FONT,1,[define this if you use X11 font interface])
792fi
793AC_CHECK_FT2(2.0.0,
794	     AC_DEFINE(ENABLE_FT2,1,[Define this if you have freetype2 installed]))
795if test "x$no_ft" = xyes; then
796  AM_PATH_FREETYPE(1.0.0,
797	AC_DEFINE(ENABLE_TTF,1,[Define this if you have old(1.x) freetype installed]) have_ttf=yes,have_ttf=no)
798fi
799if test "x$no_ft" != xyes; then
800   SRC_FONT="$SRC_FONT font_freetype2.c cp932tojis0213.c"
801   EXTRALIBS="$EXTRALIBS $FT2_LIBS"
802   EXTRACFLAGS="$EXTRACFLAGS $FT2_CFLAGS"
803elif test "x$have_ttf" = xyes; then
804   SRC_FONT="$SRC_FONT font_ttf.c"
805   EXTRALIBS="$EXTRALIBS $FREETYPE_LIBS"
806   EXTRACFLAGS="$EXTRACFLAGS $FREETYPE_INCLUDES"
807fi
808dnl
809dnl check null
810if test x"SRC_FONT" = "x"; then
811  AC_MSG_ERROR("*** No font device available ***");
812fi
813AC_SUBST(SRC_FONT)
814
815
816dnl
817dnl XFree86extendions
818dnl
819AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
820	[ AC_DEFINE(HAVE_XF86VMODE,1,[Define this if you have libXxf86vm installed])
821        XXF86VM_LIB="-lXxf86vm"],,
822	$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
823X_LIBS="$X_LIBS $XXF86VM_LIB -lXext"
824
825AC_ARG_ENABLE(xrender,
826  [  --enable-xrender        Use XRender extension (future work) [default=disable]],,
827  enable_xrender="no")
828if test "x$enable-xrender" = xyes; then
829  AC_DEFINE(ENABLE_XRENDER,1,[define this if you use X11 render etension])
830fi
831
832
833dnl
834dnl MMX
835dnl
836SRC_ABLEND=
837AC_PATH_PROG(HAVE_NASM,nasm,no)
838if test "x$HAVE_NASM" != xno; then
839  case "$target" in
840    *i*86-*)
841      AC_ARG_ENABLE(mmx,
842           [  --enable-mmx            MMX support [default=yes]],,
843           [ enable_mmx=yes ])
844      if test "x$enable_mmx" = xyes ; then
845        AC_DEFINE(ENABLE_MMX,1,[define this if you want to use MMX instructions])
846        SRC_ABLEND="alpha_blend16.s haveunit.s"
847      fi;;
848  esac
849fi
850AC_SUBST(SRC_ABLEND)
851
852
853dnl
854dnl Vorbis input
855dnl
856AM_PATH_OGG(
857           [ AM_PATH_VORBIS([],
858                            AC_MSG_ERROR([OGG/VORBIS needed]))
859           ],
860           AC_MSG_ERROR([OGG/VORBIS needed]))
861AM_CONDITIONAL(HAVE_VORBIS, [test "x$no_ogg" != xyes -a "x$no_vorbis" != xyes])
862
863dnl
864dnl Test for libjpeg
865dnl
866JPEG_CFLAGS=""
867JPEG_LIBS=""
868available_jpeg=no
869AC_ARG_WITH(libjpeg-prefix,
870   [  --with-libjpeg-prefix=PFX Prefix where libjpeg is install(optional)], libjpeg_prefix="$withval", libjpeg_prefix="")
871
872if test "x$libjpeg_prefix" != x ; then
873  JPEG_CFLAGS="-I$libjpeg_prefix/include"
874  JPEG_LIBS="-L$libjpeg_prefix/lib"
875fi
876
877ac_save_CFLAGS="$CFLAGS"
878ac_save_LIBS="$LIBS"
879CFLAGS="$CFLAGS $JPEG_CFLAGS"
880LIBS="$LIBS $JPEG_LIBS"
881
882AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
883   available_jpeg=yes,
884   available_jpeg=no)
885
886if test "x$available_jpeg" = xyes; then
887   AC_MSG_CHECKING([for jpeglib.h])
888   AC_TRY_CPP(
889[#include <stdio.h>
890#undef PACKAGE
891#undef VERSION
892#undef HAVE_STDLIB_H
893#include <jpeglib.h>],
894      available_jpeg=yes,
895      available_jpeg=no)
896   AC_MSG_RESULT($available_jpeg)
897   if test "x$available_jpeg" = xyes; then
898     JPEG_LIBS="$JPEG_LIBS -ljpeg"
899   fi
900fi
901CFLAGS="$ac_save_CFLAGS"
902LIBS="$ac_save_LIBS"
903
904if test "x$available_jpeg" != xyes; then
905   AC_MSG_ERROR(libjpeg needed)
906fi
907
908AM_CONDITIONAL(ENABLE_JPEG, test "x$available_jpeg" = xyes)
909AC_SUBST(JPEG_CFLAGS)
910AC_SUBST(JPEG_LIBS)
911
912enable_jpeg=$available_jpeg
913
914
915dnl
916dnl debugging
917dnl
918AC_ARG_ENABLE(debug, [  --enable-debug          Turn on debugging [default=no]],,enable_debug=no)
919
920if test "x$enable_debug" = xyes; then
921  DEBUG_CFLAGS="-g"
922  if test "x$GCC" = xyes; then
923    DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
924  fi
925  AC_DEFINE(DEBUG,1,[Define this if you want to Debug])
926else
927  CFLAGS="`echo $CFLAGS | sed 's/-g//g'`"
928  DEBUG_CFLAGS=""
929fi
930AC_SUBST(DEBUG_CFLAGS)
931
932
933dnl
934dnl Some infos:
935dnl
936echo "xsystem35 summary:"
937echo "------------------"
938
939dnl Audio
940echo " * audio output:"
941if test "x$have_ossaudio" = xyes; then
942    echo "    - oss (Open Sound System)"
943fi
944if test "x$have_sunaudio" = xyes; then
945    echo "    - sun ()"
946fi
947if test "x$no_alsa" != xyes; then
948  if test "x$have_alsa05" = xyes; then
949    echo "    - alsa05 (Alsa 0.5.x)"
950  fi
951  if test "x$have_alsa09" = xyes; then
952    echo "    - alsa09 (Alsa 0.9.x)"
953  fi
954fi
955if test "x$no_esd" != xyes; then
956  echo "    - esd (Enlightened Sound Daemon)"
957fi
958echo ""
959
960dnl CDROM
961echo " * cdrom output:"
962if test "x$enable_cd_linux" = xyes; then
963  echo "    - Linux|Solaris ioctl"
964fi
965if test "x$enable_cd_bsd" = xyes; then
966  echo "    - *BSD ioctl"
967fi
968if test "x$enable_cd_irix" = xyes; then
969  echo "    - Irix cdrom library"
970fi
971if test "x$enable_cd_mp3" = xyes; then
972  echo "    - External player (wav|mp3|ogg...)"
973fi
974echo ""
975
976dnl MIDI
977echo " * midi output:"
978if test "x$enable_midi_raw" = xyes; then
979  echo "    - raw midi interface"
980fi
981if test "x$enable_midi_seq" = xyes; then
982  echo "    - OSS sequencer interface"
983fi
984if test "x$enable_midi_extp" = xyes; then
985  echo "    - External MIDI Player"
986fi
987echo ""
988
989dnl font
990echo " * font device:"
991if test "x$have_sdl" = xyes; then
992  if test "x$enable_gtk" = xyes; then
993    echo "    - gtk(gdk) font"
994  fi
995else
996  echo "    - x11 font"
997fi
998if test "x$have_ttf" = xyes; then
999  echo "    - old truetype font library"
1000fi
1001if test "x$no_ft" != xyes; then
1002  echo "    - freetype2 library"
1003fi
1004echo ""
1005
1006echo "----"
1007
1008AC_SUBST(EXTRACFLAGS)
1009AC_SUBST(EXTRALIBS)
1010AC_SUBST(EXTRALDFLAGS)
1011AC_CONFIG_FILES([
1012po/Makefile.in
1013Makefile
1014xsystem35.spec
1015modules/ShArray/Makefile
1016modules/ShCalc/Makefile
1017modules/ShString/Makefile
1018modules/ShPort/Makefile
1019modules/nDEMO/Makefile
1020modules/nDEMOE/Makefile
1021modules/NIGHTDLL/Makefile
1022modules/oujimisc/Makefile
1023modules/RandMT/Makefile
1024modules/Math/Makefile
1025modules/Gpx/Makefile
1026modules/MsgSkip/Makefile
1027modules/ShSound/Makefile
1028modules/ShGraph/Makefile
1029modules/dDemo/Makefile
1030modules/oDEMO/Makefile
1031modules/SACT/Makefile
1032modules/tDemo/Makefile
1033modules/eDemo/Makefile
1034modules/eeDemo/Makefile
1035modules/Confirm/Makefile
1036modules/AliceLogo/Makefile
1037modules/NightDemonDemo/Makefile
1038modules/lib/Makefile
1039modules/Makefile
1040src/Makefile
1041macros/Makefile
1042])
1043AC_OUTPUT
1044