1dnl ----------------------------------------------------------------
2dnl  $Id: configure.in,v 1.19 2002/10/31 16:39:53 torsten_paul Exp $
3dnl
4dnl  Process this file with autoconf to produce a configure script.
5dnl ----------------------------------------------------------------
6
7AC_INIT(include/kc/kc.h)
8AC_CONFIG_AUX_DIR(config)
9
10AC_GNU_SOURCE
11AC_CANONICAL_HOST
12AC_CANONICAL_TARGET
13
14dnl -----------------------
15dnl  declare extra options
16dnl -----------------------
17
18AC_ARG_ENABLE(static-z80ex, [  --enable-static-z80ex   link Z80 emulation statically [default=no]],,enable_static_z80ex=no)
19AC_ARG_ENABLE(sound,        [  --enable-sound          enable sound using libSDL (broken!) [default=no]],,enable_sound=no)
20AC_ARG_ENABLE(libaudiofile, [  --enable-libaudiofile   enable usage of libaudiofile if present [default=yes]],,enable_libaudiofile=yes)
21AC_ARG_ENABLE(libsndfile,   [  --enable-libsndfile     enable usage of libsndfile if present [default=yes]],,enable_libsndfile=yes)
22AC_ARG_ENABLE(libflac,      [  --enable-libflac        enable usage of libFLAC 1.0.x if present [default=yes]],,enable_libflac=yes)
23AC_ARG_ENABLE(libvorbis,    [  --enable-libvorbis      enable usage of libvorbis if present [default=yes]],,enable_libvorbis=yes)
24AC_ARG_ENABLE(libtheora,    [  --enable-libtheora      enable usage of libtheora if present [default=yes]],,enable_libtheora=yes)
25AC_ARG_ENABLE(libxvidcore,  [  --enable-libxvidcore    enable usage of libxvidcore if present [default=yes]],,enable_libxvidcore=yes)
26AC_ARG_ENABLE(libdirac,     [  --enable-libdirac       enable usage of libdirac if present [default=yes]],,enable_libdirac=yes)
27AC_ARG_ENABLE(libschroedinger, [  --enable-libschroedinger enable usage of libschroedinger if present [default=yes]],,enable_libschroedinger=yes)
28AC_ARG_ENABLE(libavformat,  [  --enable-libavformat    enable usage of libavformat if present [default=yes]],,enable_libavformat=yes)
29AC_ARG_ENABLE(libgif,       [  --enable-libgif         enable usage of libgif if present [default=yes]],,enable_libgif=yes)
30AC_ARG_ENABLE(libvncserver, [  --enable-libvncserver   enable usage of libvncserver if present [default=yes]],,enable_libvncserver=yes)
31AC_ARG_ENABLE(libmp3lame,   [  --enable-libmp3lame     enable usage of libmp3lame if present [default=yes]],,enable_libmp3lame=yes)
32AC_ARG_ENABLE(ms-bitfields, [  --enable-ms-bitfields   enable usage of gcc -mms-bitfields on MinGW [default=yes]],,enable_ms_bitfields=yes)
33AC_ARG_WITH(ui,             [  --with-ui=UI            use User Interface UI (gtk or sdl) [default=auto]],,with_ui=auto)
34AC_ARG_WITH(debug_level,    [  --with-debug-level=L    set debug level to L (0..3) [default=1]])
35
36dnl ---------------------
37dnl  set package version
38dnl ---------------------
39
40. ./VERSION
41
42VERSION=$KCEMU_VERSION
43
44AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", "package name")
45AC_DEFINE_UNQUOTED(VERSION, "$VERSION", "package version")
46
47AC_DEFINE_UNQUOTED(KCEMU_MAJOR_VERSION, $KCEMU_MAJOR_VERSION, "KCemu major version")
48AC_DEFINE_UNQUOTED(KCEMU_MINOR_VERSION, $KCEMU_MINOR_VERSION, "KCemu minor version")
49AC_DEFINE_UNQUOTED(KCEMU_MICRO_VERSION, $KCEMU_MICRO_VERSION, "KCemu micro version")
50AC_DEFINE_UNQUOTED(KCEMU_EXTRA_VERSION, $KCEMU_EXTRA_VERSION, "KCemu extra version")
51AC_DEFINE_UNQUOTED(KCEMU_EXTRA_VERSION_TEXT, "$KCEMU_EXTRA_VERSION_TEXT", "KCemu extra version text")
52AC_DEFINE_UNQUOTED(KCEMU_VERSION, "$KCEMU_VERSION", "KCemu version")
53
54AC_DEFINE(PACKAGE_URL, "$PACKAGE_URL", "KCemu Homepage")
55AC_DEFINE(PACKAGE_NAME, "$PACKAGE-$KCEMU_VERSION")
56AC_DEFINE(PACKAGE_STRING, "$PACKAGE-$KCEMU_VERSION")
57AC_DEFINE(PACKAGE_VERSION, "$KCEMU_VERSION")
58AC_DEFINE(PACKAGE_TARNAME, "$PACKAGE-${KCEMU_VERSION}.tar.gz")
59AC_DEFINE(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT")
60
61AC_SUBST(PACKAGE)
62AC_SUBST(PACKAGE_URL)
63AC_SUBST(PACKAGE_NAME)
64AC_SUBST(PACKAGE_STRING)
65AC_SUBST(PACKAGE_VERSION)
66AC_SUBST(PACKAGE_TARNAME)
67AC_SUBST(PACKAGE_BUGREPORT)
68
69AC_SUBST(VERSION)
70AC_SUBST(KCEMU_MAJOR_VERSION)
71AC_SUBST(KCEMU_MINOR_VERSION)
72AC_SUBST(KCEMU_MICRO_VERSION)
73AC_SUBST(KCEMU_EXTRA_VERSION)
74AC_SUBST(KCEMU_EXTRA_VERSION_TEXT)
75
76dnl ---------------------
77dnl  initialize automake
78dnl ---------------------
79
80AM_CONFIG_HEADER(include/kc/config.h)
81AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
82
83dnl ---------------------
84dnl  checks for programs
85dnl ---------------------
86
87AC_PROG_CC
88
89if test x$enable_ms_bitfields = xyes; then
90	dnl
91	dnl  check for compiler-flag -mms-bitfields needed for mingw/cygwin
92	dnl  it defines the bit-field layout to be MS Visual C/C++ compatible
93	dnl
94	ac_save_CFLAGS=$CFLAGS
95	CFLAGS="-mms-bitfields"
96	AC_CACHE_CHECK(whether $CC accepts $CFLAGS, ac_cv_prog_cc_mms_bitfields,
97		  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_mms_bitfields=yes],
98	                                                  [ac_cv_prog_cc_mms_bitfields=no])])
99	if test $ac_cv_prog_cc_mms_bitfields = yes; then
100		use_ms_bitfields="$CFLAGS"
101	else
102		use_ms_bitfields="$CFLAGS"
103	fi
104	CFLAGS="$ac_save_CFLAGS"
105fi
106
107AC_PROG_CXX
108AC_PROG_INSTALL
109AC_PROG_LN_S
110AC_PROG_RANLIB
111AC_CHECK_TOOL(RC, windres, :)
112
113AC_PROG_MAKE_SET
114
115dnl -------------------
116dnl  check debug level
117dnl -------------------
118
119AC_MSG_CHECKING(which debug level is requested)
120DBG_LEVEL=1
121if test "x$with_debug_level" = "x0"; then
122  DBG_LEVEL=0
123elif test "x$with_debug_level" = "x1"; then
124  DBG_LEVEL=1
125elif test "x$with_debug_level" = "x2"; then
126  DBG_LEVEL=2
127elif test "x$with_debug_level" = "x3"; then
128  DBG_LEVEL=3
129fi
130AC_MSG_RESULT($DBG_LEVEL)
131AC_DEFINE_UNQUOTED(DBG_LEVEL, $DBG_LEVEL, "debug level")
132
133dnl ----------------------------
134dnl  check for arnold assembler
135dnl ----------------------------
136
137AC_CHECK_PROG(HAVE_ASL, asl, "yes", "no")
138AC_CHECK_PROG(HAVE_P2BIN, p2bin, "yes", "no")
139
140AM_CONDITIONAL(COMPILE_Z80_ASM, false)
141if test "x$HAVE_ASL" = "xyes"; then
142  if test "x$HAVE_P2BIN" = "xyes"; then
143    AM_CONDITIONAL(COMPILE_Z80_ASM, true)
144  fi
145fi
146
147dnl -----------------------------------
148dnl  check on which system we will run
149dnl -----------------------------------
150
151AM_CONDITIONAL(TARGET_MINGW, false)
152AM_CONDITIONAL(TARGET_LINUX, false)
153AM_CONDITIONAL(TARGET_FREEBSD, false)
154
155case "$host_os" in
156	beos)
157		AC_MSG_ERROR([
158***
159*** BeOS is not supported anymore.
160***])
161		;;
162
163	mingw32*)
164		HOST_OS="MinGW"
165		HOST_OS_MINGW=1
166		AM_CONDITIONAL(TARGET_MINGW, true)
167		AC_DEFINE_UNQUOTED(HOST_OS_MINGW, $HOST_OS_MINGW, "host os is MinGW")
168		CFLAGS="$CFLAGS $use_ms_bitfields"
169		CXXFLAGS="$CXXFLAGS $use_ms_bitfields"
170		LDFLAGS="$LDFLAGS $use_ms_bitfields -mwindows"
171		;;
172
173	freebsd*)
174		HOST_OS="FreeBSD"
175		HOST_OS_FREEBSD=1
176		AM_CONDITIONAL(TARGET_FREEBSD, true)
177		AC_DEFINE_UNQUOTED(HOST_OS_FREEBSD, $HOST_OS_FREEBSD, "host os is FreeBSD")
178		;;
179	*)
180		HOST_OS="Linux"
181		HOST_OS_LINUX=1
182		AM_CONDITIONAL(TARGET_LINUX, true)
183		AC_DEFINE_UNQUOTED(HOST_OS_LINUX, $HOST_OS_LINUX, "host os is Linux")
184		;;
185esac
186
187AC_DEFINE_UNQUOTED(HOST_OS, "$HOST_OS", "host os")
188
189dnl ---------------------------------------------------------------
190dnl  checks for typedefs, structures, and compiler characteristics
191dnl ---------------------------------------------------------------
192
193AC_C_CONST
194AC_C_INLINE
195AC_HEADER_TIME
196
197dnl -------------------------------
198dnl  check for common header files
199dnl -------------------------------
200
201AC_PATH_X
202AC_HEADER_STDC
203AC_CHECK_HEADERS(sys/time.h mcheck.h)
204
205dnl ----------------------------------
206dnl  check for common C++ header files
207dnl ----------------------------------
208
209AC_LANG_PUSH(C++)
210AC_LANG_POP(C++)
211
212dnl --------------------------------------
213dnl  checks for various library functions
214dnl --------------------------------------
215AC_TYPE_SIGNAL
216AC_CHECK_FUNCS(gettimeofday strstr strchr strrchr strtol strcasecmp strncasecmp mtrace)
217AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R, 1, "localtime_r"))
218AC_CHECK_FUNC(localtime, AC_DEFINE(HAVE_LOCALTIME, 1, "localtime"))
219AC_CHECK_FUNC(getopt,
220	      have_getopt=yes
221	      AC_DEFINE(HAVE_GETOPT, 1, "getopt() available"))
222AC_CHECK_FUNC(getopt_long,
223	      have_getopt_long=yes
224	      AC_DEFINE(HAVE_GETOPT_LONG, 1, "getopt_long() available"))
225
226AC_MSG_CHECKING(whether to use the included getopt library)
227if test x$have_getopt = xyes -o x$have_getopt_long = xyes; then
228	use_included_getopt=no
229	AM_CONDITIONAL(USE_INCLUDED_GETOPT, false)
230else
231	use_included_getopt=yes
232	AM_CONDITIONAL(USE_INCLUDED_GETOPT, true)
233	AC_DEFINE(USE_INCLUDED_GETOPT, 1, "use included getopt")
234        AC_DEFINE(HAVE_GETOPT, 1, "getopt() available")
235        AC_DEFINE(HAVE_GETOPT_LONG, 1, "getopt_long() available")
236fi
237AC_MSG_RESULT($use_included_getopt)
238
239dnl -------------------
240dnl  configure gettext
241dnl -------------------
242
243ALL_LINGUAS="en de"
244AM_PO_SUBDIRS
245AM_GNU_GETTEXT([no-libtool])
246dnl MinGW hack, libintl is there but configure failes with
247dnl error undefined reference to `__nl_expand_alias'
248if test "x$HOST_OS" = "xMinGW"; then
249	LTLIBINTL=""
250	LIBINTL=""
251	INTLLIBS="-lintl"
252	INTLOBJS=""
253	USE_INCLUDED_LIBINTL=no
254	BUILD_INCLUDED_LIBINTL=no
255	AC_MSG_WARN([Disable building libintl for MinGW compilation])
256fi
257if test "x$USE_INCLUDED_LIBINTL" = "xyes"; then
258	AC_DEFINE(USE_INCLUDED_LIBINTL, 1, "use included libintl")
259fi
260
261dnl -----------------------------
262dnl  check for common libraries
263dnl -----------------------------
264dnl
265dnl  on mingw the libz dll has to be linked
266dnl  with -lzdll instead of -lz
267dnl
268AC_CHECK_LIB(z, crc32, have_libz=-lz, have_libz=no)
269if test x$have_libz = xno; then
270   AC_CHECK_LIB(zdll, crc32, have_libz=-lzdll, have_libz=no)
271fi
272if test x$have_libz = xno; then
273   AC_MSG_ERROR(Cannot link libz -- check CFLAGS/LDFLAGS)
274else
275   LIBS="$LIBS $have_libz"
276fi
277
278AC_CHECK_LIB(m, pow,,AC_MSG_WARN(Cannot link libm -- check CFLAGS/LDFLAGS))
279
280AM_CONDITIONAL(HAVE_CPPUNIT, false)
281
282dnl -----------------------
283dnl  initialize pkg-config
284dnl -----------------------
285PKG_PROG_PKG_CONFIG(0.20)
286PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.16.1)
287
288_sep=""
289_gtk_libs_temp=""
290for lib in $GTK_LIBS
291do
292	if test "x-lfreetype" = "x$lib"; then
293		echo "removing 'freetype' from library list GTK_LIBS"
294		continue
295	elif test "x-lfontconfig" = "x$lib"; then
296		echo "removing 'fontconfig' from library list GTK_LIBS"
297		continue
298	elif test "x-latk-1.0" = "x$lib"; then
299		echo "removing 'atk-1.0' from library list GTK_LIBS"
300		continue
301	fi
302
303	_gtk_libs_temp="$_gtk_libs_temp$_sep$lib"
304	_sep=" "
305done
306GTK_LIBS="$_gtk_libs_temp"
307
308if test x$cross_compiling = xno; then
309	PKG_CHECK_MODULES(X11, x11 >= 1.1)
310	PKG_CHECK_MODULES(XMU, xmu >= 1.0)
311fi
312
313dnl -----------------------
314dnl  check for z80ex
315dnl -----------------------
316
317req_z80ex_api=1
318min_z80ex_version_major=1
319min_z80ex_version_minor=18
320
321min_z80ex_version="${min_z80ex_version_major}.${min_z80ex_version_minor}"
322AC_CHECK_LIB(z80ex, z80ex_create, have_libz80ex=yes, have_libz80ex=no)
323if test x$have_libz80ex = xyes; then
324	Z80EX_LIBS="-lz80ex -lz80ex_dasm"
325	AC_MSG_CHECKING(for z80ex - api = $req_z80ex_api - version >= $min_z80ex_version)
326	if test x$cross_compiling = xno; then
327		ac_save_CFLAGS="$CFLAGS"
328		ac_save_LIBS="$LIBS"
329		CFLAGS="$CFLAGS $Z80EX_CFLAGS"
330		LIBS="$Z80EX_LIBS $LIBS"
331		AC_TRY_RUN([
332#include <stdio.h>
333#include <z80ex/z80ex.h>
334
335int
336main()
337{
338  Z80EX_VERSION *v = z80ex_get_version();
339
340  if (v->API_revision != $req_z80ex_api)
341    return 1;
342  if (v->major < $min_z80ex_version_major)
343    return 2;
344  if ((v->major == $min_z80ex_version_major) && (v->minor < $min_z80ex_version_minor))
345    return 3;
346
347  return 0;
348}
349],AC_MSG_RESULT(yes),have_libz80ex=no)
350		CFLAGS="$ac_save_CFLAGS"
351		LIBS="$ac_save_LIBS"
352		AC_SUBST(Z80EX_LIBS)
353                z80_emulation_type="dynamic"
354	else
355		AC_MSG_RESULT([cross compiling; assumed OK...])
356	fi
357fi
358if test x$have_libz80ex = xno; then
359	AC_MSG_ERROR([
360***
361*** Can not find required library z80ex.
362***])
363fi
364
365AC_MSG_CHECKING(if static linking of z80ex is requested)
366if test "x$enable_static_z80ex" = "xyes"; then
367	AC_MSG_RESULT(yes)
368	AC_MSG_CHECKING(for path of static z80ex libraries)
369	z80ex_so=`gcc $LDFLAGS -lz80ex -Wl,--trace /dev/null 2>/dev/null | grep -- '-lz80ex' | sed -e 's/.*(//; s/).*//;'`
370	z80ex_path=`dirname "$z80ex_so"`
371	z80ex_lib="$z80ex_path/libz80ex.a"
372	z80ex_dasm_lib="$z80ex_path/libz80ex_dasm.a"
373	if test -f "$z80ex_lib" -a -f "$z80ex_dasm_lib"; then
374		AC_MSG_RESULT([$z80ex_path])
375		Z80EX_LIBS="$z80ex_lib $z80ex_dasm_lib"
376                z80_emulation_type="static"
377	else
378		AC_MSG_ERROR([
379***
380*** Can not find path for static z80ex library.
381***])
382	fi
383else
384	AC_MSG_RESULT(no)
385fi
386
387dnl ---------------------------------
388dnl  check for theoraenc library
389dnl ---------------------------------
390have_theora=no
391min_theora="1.0"
392min_theoraenc="1.1.1"
393if test "x$enable_libtheora" = xyes; then
394	PKG_CHECK_MODULES(LIBTHEORA11, theoraenc >= $min_theoraenc,
395	[
396                have_theora=yes
397                have_theora_version=" (version 1.1)"
398                AC_DEFINE(HAVE_LIBTHEORA, 1, "have libtheora")
399                AC_DEFINE(HAVE_LIBTHEORA11, 1, "have libtheora version 1.1")
400                LIBTHEORA_CFLAGS="$LIBTHEORA11_CFLAGS"
401                LIBTHEORA_LIBS="$LIBTHEORA11_LIBS"
402		AC_SUBST(LIBTHEORA_CFLAGS)
403		AC_SUBST(LIBTHEORA_LIBS)
404	],[
405                PKG_CHECK_MODULES(LIBTHEORA10, theoraenc >= $min_theora theoradec >= $min_theora,
406                [
407                        have_theora=yes
408                        have_theora_version=" (version 1.0)"
409                        AC_DEFINE(HAVE_LIBTHEORA, 1, "have libtheora")
410                        AC_DEFINE(HAVE_LIBTHEORA10, 1, "have libtheora version 1.0")
411                        LIBTHEORA_CFLAGS="$LIBTHEORA10_CFLAGS"
412                        LIBTHEORA_LIBS="$LIBTHEORA10_LIBS"
413                        AC_SUBST(LIBTHEORA_CFLAGS)
414                        AC_SUBST(LIBTHEORA_LIBS)
415                ],[
416                        AC_MSG_WARN([
417***
418*** Unable to find theora library (with version number >= $min_theora)!
419***
420*** This is NO ERROR. It only means you can't capture video in
421*** theora/ogg format.
422***
423*** If you are still annoyed by this warning you can tell ./configure
424*** not to check for this library by using --disable-libtheora
425***])
426                ])
427	])
428fi
429
430dnl ---------------------------------
431dnl  check for libavformat library
432dnl ---------------------------------
433have_avformat=no
434min_libavformat="52.41.0"
435if test "x$enable_libavformat" = xyes; then
436	PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= $min_libavformat,
437	[
438                have_avformat=yes
439                AC_DEFINE(HAVE_LIBAVFORMAT, 1, "have libavformat")
440		AC_SUBST(LIBAVFORMAT_CFLAGS)
441		AC_SUBST(LIBAVFORMAT_LIBS)
442	],[
443		AC_MSG_WARN([
444***
445*** Unable to find avformat library (with version number >= $min_libavformat)!
446***
447*** This is NO ERROR. It only means you can't capture video in
448*** avi format.
449***
450*** If you are still annoyed by this warning you can tell ./configure
451*** not to check for this library by using --disable-libavformat
452***])
453	])
454fi
455
456dnl ---------------------------------
457dnl  check for libdirac
458dnl ---------------------------------
459have_dirac=no
460min_libdirac="1.0.2"
461if test "x$enable_libdirac" = xyes; then
462	PKG_CHECK_MODULES(LIBDIRAC, dirac >= $min_libdirac,
463	[
464                have_dirac=yes
465                AC_DEFINE(HAVE_LIBDIRAC, 1, "have libdirac")
466		AC_SUBST(LIBDIRAC_CFLAGS)
467		AC_SUBST(LIBDIRAC_LIBS)
468	],[
469		AC_MSG_WARN([
470***
471*** Unable to find dirac library (with version number >= $min_libdirac)!
472***
473*** This is NO ERROR. It only means you can't capture video in
474*** dirac format.
475***
476*** If you are still annoyed by this warning you can tell ./configure
477*** not to check for this library by using --disable-libdirac
478***])
479	])
480fi
481
482dnl ---------------------------------
483dnl  check for libschroedinger
484dnl ---------------------------------
485have_libschroedinger=no
486min_libschroedinger="1.0.8"
487if test "x$enable_libschroedinger" = xyes; then
488	PKG_CHECK_MODULES(LIBSCHROEDINGER, schroedinger-1.0 >= $min_libschroedinger,
489	[
490                have_libschroedinger=yes
491                AC_DEFINE(HAVE_LIBSCHROEDINGER, 1, "have libschroedinger")
492		AC_SUBST(LIBSCHROEDINGER_CFLAGS)
493		AC_SUBST(LIBSCHROEDINGER_LIBS)
494	],[
495		AC_MSG_WARN([
496***
497*** Unable to find schroedinger library (with version number >= $min_libschroedinger)!
498***
499*** This is NO ERROR. It only means you can't capture video in
500*** schroedinger format.
501***
502*** If you are still annoyed by this warning you can tell ./configure
503*** not to check for this library by using --disable-libschroedinger
504***])
505	])
506fi
507
508dnl ---------------------------------
509dnl  check for libxvidcore
510dnl ---------------------------------
511have_libxvidcore=no
512min_libxvidcore="1.2.2"
513if test "x$enable_libxvidcore" = xyes; then
514        AC_CHECK_LIB(xvidcore,
515                     xvid_encore,
516                     have_libxvidcore=yes,
517                     have_libxvidcore=no)
518        if test x$have_libxvidcore = xyes; then
519                XVIDCORE_LIBS="-lxvidcore"
520                AC_SUBST(XVIDCORE_LIBS)
521                AC_DEFINE(HAVE_LIBXVIDCORE, 1, "have libxvidcore")
522        else
523		AC_MSG_WARN([
524***
525*** Unable to find libxvidcore (with version number >= $min_libxvidcore)!
526***
527*** This is NO ERROR. It only means you can't capture video in
528*** mpeg4 format.
529***
530*** If you are still annoyed by this warning you can tell ./configure
531*** not to check for this library by using --disable-libxvidcore
532***])
533        fi
534fi
535
536dnl ---------------------------------
537dnl  check for libgif
538dnl ---------------------------------
539if test "x$enable_libgif" = xyes; then
540        AC_CHECK_LIB(gif,
541                     EGifSetGifVersion,
542                     have_libgif=yes,
543                     have_libgif=no)
544        if test x$have_libgif = xyes; then
545                LIBGIF_LIBS="-lgif"
546                AC_SUBST(LIBGIF_LIBS)
547                AC_DEFINE(HAVE_LIBGIF, 1, "have libgif")
548        else
549		AC_MSG_WARN([
550***
551*** Unable to find libgif!
552***
553*** This is NO ERROR. It only means you can't capture video in
554*** animated GIF format.
555***
556*** If you are still annoyed by this warning you can tell ./configure
557*** not to check for this library by using --disable-libgif
558***])
559        fi
560fi
561
562dnl ---------------------------------
563dnl  check for libvncserver
564dnl ---------------------------------
565have_libvncserver=no
566min_libvncserver="0.9"
567if test "x$enable_libvncserver" = xyes; then
568        AC_CHECK_LIB(vncserver,
569                     rfbGetScreen,
570                     have_libvncserver=yes,
571                     have_libvncserver=no)
572        if test x$have_libvncserver = xyes; then
573                VNCSERVER_LIBS="-lvncserver -lvncclient -ljpeg"
574                AC_SUBST(VNCSERVER_LIBS)
575                AC_DEFINE(HAVE_LIBVNCSERVER, 1, "have libvncserver")
576        else
577		AC_MSG_WARN([
578***
579*** Unable to find libvncserver (with version number >= $min_libvncserver)!
580***
581*** This is NO ERROR. It only means you can't connect to KCemu
582*** using a VNC client.
583***
584*** If you are still annoyed by this warning you can tell ./configure
585*** not to check for this library by using --disable-libvncserver
586***])
587        fi
588fi
589
590_sep=""
591_vncserver_libs_temp=""
592for lib in $VNCSERVER_LIBS
593do
594	if test "x-ljpeg" = "x$lib"; then
595		echo "removing 'jpeg' from library list VNCSERVER_LIBS"
596		continue
597	fi
598
599	_vncserver_libs_temp="$_vncserver_libs_temp$_sep$lib"
600	_sep=" "
601done
602VNCSERVER_LIBS="$_vncserver_libs_temp"
603
604dnl ---------------------
605dnl  check for libsndfile
606dnl ---------------------
607have_libsndfile=no
608if test x$enable_libsndfile = xyes; then
609	AC_CHECK_LIB(sndfile,
610		     sf_open_read,
611		     have_libsndfile=yes,
612		     have_libsndfile=no)
613	if test x$have_libsndfile = xyes; then
614		SNDFILE_LIBS=-lsndfile
615		AC_SUBST(SNDFILE_LIBS)
616		AC_DEFINE(HAVE_LIBSNDFILE, 1, "have libsndfile")
617		AC_DEFINE(HAVE_LIBSNDFILE_V0, 1, "have libsndfile version 0.0.x")
618	else
619		AC_CHECK_LIB(sndfile,
620			     sf_open,
621			     have_libsndfile=yes,
622			     have_libsndfile=no)
623		if test x$have_libsndfile = xyes; then
624			SNDFILE_LIBS=-lsndfile
625			AC_SUBST(SNDFILE_LIBS)
626			AC_DEFINE(HAVE_LIBSNDFILE, 1, "have libsndfile")
627			AC_DEFINE(HAVE_LIBSNDFILE_V1, 1, "have libnsndfile version 1.0.x")
628		else
629			AC_MSG_WARN([
630***
631*** Unable to find sndfile library! The audio loader module which
632*** requires this library will be disabled.
633***
634*** This is NO ERROR. It only means you can't playback certain
635*** audio file types (e.g. .WAV, .PCM, .AU, .SND) in the emulated
636*** tape recorder.
637***
638*** If you are still annoyed by this warning you can tell ./configure
639*** not to check for this library by using --disable-libsndfile
640***])
641		fi
642	fi
643fi
644
645dnl -----------------------
646dnl  check for libaudiofile
647dnl -----------------------
648have_libaudiofile=no
649if test x$enable_libaudiofile = xyes; then
650	AC_CHECK_LIB(audiofile, afOpenFile, have_libaudiofile=yes, have_libaudiofile=no)
651	if test x$have_libaudiofile = xyes; then
652		AUDIOFILE_LIBS=-laudiofile
653		AC_SUBST(AUDIOFILE_LIBS)
654		AC_DEFINE(HAVE_LIBAUDIOFILE, 1, "have libaudiofile")
655	else
656		AC_MSG_WARN([
657***
658*** Unable to find audiofile library! The audio loader module which
659*** requires this library will be disabled.
660***
661*** This is NO ERROR. It only means you can't playback certain
662*** audio file types (e.g. .WAV, .AIFF, .AU) in the emulated
663*** tape recorder.
664***
665*** If you are still annoyed by this warning you can tell ./configure
666*** not to check for this library by using --disable-libaudiofile
667***])
668	fi
669fi
670
671dnl ---------------------
672dnl  check for libmp3lame
673dnl ---------------------
674have_libmp3lame=no
675if test x$enable_libmp3lame = xyes; then
676	AC_CHECK_LIB(mp3lame, lame_decode1_headers, have_libmp3lame=yes, have_libmp3lame=no)
677	if test x$have_libmp3lame = xyes; then
678		MP3LAME_LIBS=-lmp3lame
679		AC_SUBST(MP3LAME_LIBS)
680		AC_DEFINE(HAVE_LIBMP3LAME, 1, "have libmp3lame")
681	else
682		AC_MSG_WARN([
683***
684*** Unable to find libmp3lame (part of MP3 encoder LAME)! The audio
685*** loader module which requires this library will be disabled.
686***
687*** This is NO ERROR. It only means you can't playback certain
688*** audio file types (e.g. .MP3) in the emulated tape recorder.
689***
690*** If you are still annoyed by this warning you can tell ./configure
691*** not to check for this library by using --disable-libmp3lame
692***])
693	fi
694fi
695
696dnl --------------------
697dnl  check for libvorbis
698dnl --------------------
699have_libvorbis=no
700if test x$enable_libvorbis = xyes; then
701	AC_CHECK_LIB(vorbisfile, ov_open, have_libvorbis=yes, have_libvorbis=no, -lvorbis)
702	if test x$have_libvorbis = xyes; then
703		VORBIS_LIBS="-lvorbisfile -lvorbis"
704		AC_SUBST(VORBIS_LIBS)
705		AC_DEFINE(HAVE_LIBVORBIS, 1, "have libvorbis")
706	else
707		AC_MSG_WARN([
708***
709*** Unable to find libvorbis library! The audio loader module which
710*** requires this library will be disabled.
711***
712*** This is NO ERROR. It only means you can't playback certain
713*** audio file types (e.g. .OGG) in the emulated tape recorder.
714***
715*** If you are still annoyed by this warning you can tell ./configure
716*** not to check for this library by using --disable-libvorbis
717***])
718	fi
719fi
720
721dnl ------------------
722dnl  check for libflac
723dnl ------------------
724have_libflac=no
725if test x$enable_libflac = xyes; then
726	AC_CHECK_LIB(FLAC, FLAC__file_decoder_process_metadata, have_libflac=yes, have_libflac=no)
727	if test x$have_libflac = xyes; then
728		F_L_A_C_LIBS=-lFLAC
729		AC_SUBST(F_L_A_C_LIBS)
730		AC_DEFINE(HAVE_LIBFLAC, 1, "have libFLAC")
731	else
732		AC_MSG_WARN([
733***
734*** Unable to find libFLAC library! The audio loader module which
735*** requires this library will be disabled.
736***
737*** Currently only libFLAC 1.0.x is supported!
738***
739*** This is NO ERROR. It only means you can't playback certain
740*** audio file types (e.g. .FLAC) in the emulated tape recorder.
741***
742*** If you are still annoyed by this warning you can tell ./configure
743*** not to check for this library by using --disable-libflac
744***])
745	fi
746fi
747
748dnl -------------------------------------
749dnl  check for system specific libraries
750dnl -------------------------------------
751
752dnl --------------
753dnl  check for OSS
754dnl --------------
755
756AC_CHECK_HEADERS(sys/soundcard.h)
757AC_CHECK_HEADERS(machine/soundcard.h)
758if test x$ac_cv_header_sys_soundcard_h = xyes -o x$ac_cv_header_machine_soundcard_h = xyes; then
759	AC_DEFINE(HAVE_OSS, 1, "have oss")
760else
761	AC_MSG_WARN([
762***
763*** Unable to find OSS header file soundcard.h! The audio loader
764*** module which requires OSS will be disabled.
765***
766*** This is NO ERROR. It only means you can't directly load programs
767*** by reading directly from the soundcard line input.
768***])
769fi
770
771dnl --------------------------------------
772dnl  check for libSDL if sound is enabled
773dnl --------------------------------------
774
775if test x$enable_sound = xyes; then
776	AC_DEFINE(ENABLE_SOUND, 1, "enable sound")
777	AM_PATH_SDL(1.2.0, have_libsdl=yes, have_libsdl=no)
778fi
779
780if test x$have_libsdl = xyes; then
781	AC_DEFINE(HAVE_LIBSDL, 1, "have libSDL")
782else
783	if test x$enable_sound = xyes; then
784		AC_MSG_WARN([
785***
786*** Unable to find SDL library (see http://www.libsdl.org/)
787*** Sound is disabled!
788***])
789		enable_sound=no
790	fi
791fi
792
793AC_OUTPUT([
794	Makefile
795	include/Makefile
796	include/kc/Makefile
797	include/kc/prefs/Makefile
798	include/kc/kcnet/Makefile
799	include/kc/kramermc/Makefile
800	include/kc/muglerpc/Makefile
801	include/kc/vcs80/Makefile
802	include/kc/c80/Makefile
803	include/sys/Makefile
804	include/getopt/Makefile
805	include/cmd/Makefile
806	include/ui/Makefile
807	include/ui/gtk/Makefile
808	include/ui/generic/Makefile
809	include/fileio/Makefile
810	include/libdbg/Makefile
811	include/libtape/Makefile
812	include/libdisk/Makefile
813	include/libaudio/Makefile
814	include/libgtkex/Makefile
815	asm/Makefile
816	asm/autostart/Makefile
817	src/Makefile
818	src/kc/kcemu.rc
819	src/kc/Makefile
820	src/kc/prefs/Makefile
821	src/kc/kcnet/Makefile
822	src/kc/kramermc/Makefile
823	src/kc/muglerpc/Makefile
824	src/kc/vcs80/Makefile
825	src/kc/c80/Makefile
826	src/sys/Makefile
827	src/sys/mingw/Makefile
828	src/sys/linux/Makefile
829	src/getopt/Makefile
830	src/cmd/Makefile
831	src/ui/Makefile
832	src/ui/gtk/Makefile
833	src/ui/generic/Makefile
834	src/fileio/Makefile
835	src/libdbg/Makefile
836	src/libtape/Makefile
837	src/libdisk/Makefile
838	src/libaudio/Makefile
839	src/libgtkex/Makefile
840	src/util/Makefile
841	test/Makefile
842	test/kc/Makefile
843	test/kc/prefs/Makefile
844	test/libaudio/Makefile
845	test/libaudio/data/Makefile
846	test/libgtkex/Makefile
847	roms/Makefile
848	roms/z1013/Makefile
849	roms/z9001/Makefile
850	roms/kc85/Makefile
851	roms/poly880/Makefile
852	roms/lc80/Makefile
853	roms/a5105/Makefile
854	roms/kramermc/Makefile
855	roms/muglerpc/Makefile
856	roms/vcs80/Makefile
857	roms/c80/Makefile
858	tapes/Makefile
859        disks/Makefile
860	images/Makefile
861	images/original/Makefile
862	doc/Makefile
863	doc/kcemu-help.xml
864	intl/Makefile
865	man/Makefile
866	man/man1/Makefile
867	debian/Makefile
868	rpm/Makefile
869	rpm/KCemu.spec
870	po/Makefile.in
871	conf/Makefile
872	setup/Makefile
873	setup/KCemuSetup.nsi],
874	[])
875
876
877
878
879echo ""
880echo ""
881echo "KCemu configuration summary:"
882echo "----------------------------"
883echo ""
884echo "- version        : KCemu $KCEMU_VERSION"
885echo ""
886echo "- architecture   : $HOST_OS"
887echo "- host system    : $host"
888echo "- install prefix : $prefix"
889echo ""
890echo "- z80 emulation  : $z80_emulation_type"
891echo "- sound          : $enable_sound"
892echo "- debug level    : $DBG_LEVEL"
893echo ""
894echo "- audio:"
895echo ""
896echo "  * sndfile      : $have_libsndfile"
897echo "  * audiofile    : $have_libaudiofile"
898echo "  * vorbis       : $have_libvorbis"
899echo "  * mp3lame      : $have_libmp3lame"
900echo "  * FLAC         : $have_libflac"
901echo ""
902echo "- video:"
903echo ""
904echo "  * theora       : $have_theora$have_theora_version"
905echo "  * avformat     : $have_avformat"
906echo "  * dirac        : $have_dirac"
907echo "  * schroedinger : $have_libschroedinger"
908echo "  * xvid         : $have_libxvidcore"
909echo "  * vncserver    : $have_libvncserver"
910echo ""
911echo ""
912