1dnl DGen/SDL v1.33
2dnl At long last, the configure script!
3
4AC_INIT(
5	[DGen/SDL],
6	[1.33],
7	[zamaz@users.sourceforge.net],
8	[dgen-sdl],
9	[http://sourceforge.net/projects/dgen],
10)
11
12dnl We'll need machine type later.
13AC_CANONICAL_SYSTEM
14
15dnl Initialize Automake.
16AM_INIT_AUTOMAKE([silent-rules])
17AM_SILENT_RULES([yes])
18AM_PROG_AS
19
20dnl Check for standard programs.
21AC_PROG_CC
22AC_PROG_CC_C99
23AC_PROG_CPP
24AC_PROG_CXX
25AC_PROG_CXXCPP
26AC_PROG_INSTALL
27AC_PROG_LN_S
28AC_PROG_RANLIB
29
30dnl Set the value of make, if make doesn't already.
31AC_PROG_MAKE_SET
32
33dnl We're using C.
34AC_LANG([C])
35
36dnl Check endianness.
37AC_C_BIGENDIAN
38
39dnl Cross compilation stuff.
40AS_IF(
41	[test "x$cross_compiling" = xno],
42	[CC_FOR_BUILD="${CC}"]
43	[CXX_FOR_BUILD="${CXX}"]
44	[CPPFLAGS_FOR_BUILD="${CPPFLAGS}"]
45	[CFLAGS_FOR_BUILD="${CFLAGS}"]
46	[CXXFLAGS_FOR_BUILD="${CXXFLAGS}"]
47	[LDFLAGS_FOR_BUILD="${LDFLAGS}"]
48	[OBJEXT_FOR_BUILD="${OBJEXT}"]
49	[EXEEXT_FOR_BUILD="${EXEEXT}"]
50)
51AS_IF(
52	[test "x$cross_compiling" = xyes],
53	[AC_MSG_CHECKING([for host C compiler])]
54	[CC_FOR_BUILD="${CC_FOR_BUILD-cc}"]
55	[AC_MSG_RESULT([$CC_FOR_BUILD])]
56	[AC_MSG_CHECKING([for host C++ compiler])]
57	[CXX_FOR_BUILD="${CXX_FOR_BUILD-c++}"]
58	[AC_MSG_RESULT([$CXX_FOR_BUILD])]
59	[AC_MSG_CHECKING([for suffix of host object files])]
60	[
61{
62	# Sane values by default.
63	OBJEXT_FOR_BUILD=o
64	EXEEXT_FOR_BUILD=
65	# Try to compile a program, find out default extensions.
66	EXT_SUCCESS=0
67	rm -f conftest*
68	cat <<EOF > conftest.c &&
69int main(void) { return 0; }
70EOF
71	$CC_FOR_BUILD -c conftest.c &&
72	rm -f conftest.c &&
73	for file in conftest.*
74	do
75		test -f $file ||
76		! continue
77		OBJEXT_FOR_BUILD="${file##*.}"
78		test -z "$OBJEXT_FOR_BUILD" &&
79		! continue
80		break
81	done &&
82	for ext in '' '.exe'
83	do
84		$CC_FOR_BUILD -o conftest$ext $file &&
85		./conftest$ext ||
86		! continue
87		EXEEXT_FOR_BUILD="$ext"
88		break
89	done &&
90	EXT_SUCCESS=1
91	rm -f conftest*
92} 1>&AS_MESSAGE_LOG_FD 2>&1
93	]
94	[AS_IF(
95		[test "x$EXT_SUCCESS" = x1],
96		[AC_MSG_RESULT([$OBJEXT_FOR_BUILD])]
97		[AC_MSG_CHECKING([for suffix of host executables])]
98		[AS_IF(
99			[test "x$EXEEXT_FOR_BUILD" = x],
100			[AC_MSG_RESULT([none])],
101			[AC_MSG_RESULT([$EXEEXT_FOR_BUILD])]
102		)],
103		[AC_MSG_RESULT([unable to determine])]
104		[AC_MSG_FAILURE([can't cross-compile if host objects \
105extension isn't known])]
106	)]
107)
108
109dnl Libraries used by dgen_tobin.
110TOBIN_LIBS="${LIBS} ${TOBIN_LIBS}"
111
112dnl Check for SDL libs.
113AM_PATH_SDL([1.2.0], [], [AC_MSG_ERROR([SDL version >= 1.2.0 not found.])])
114CFLAGS="$CFLAGS $SDL_CFLAGS"
115CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
116LIBS="$LIBS $SDL_LIBS"
117
118dnl Check for the SDL_WM_ToggleFullScreen function.
119AC_CHECK_FUNCS([SDL_WM_ToggleFullScreen])
120
121dnl Check for ftello().
122AC_CHECK_FUNCS([ftello])
123
124dnl Debugging?
125AC_ARG_ENABLE(
126	[debug],
127	[AS_HELP_STRING(
128		[--enable-debug],
129		[enable internal debugging [default=no]]
130	)],
131	[USE_DEBUG=$enableval],
132	[USE_DEBUG=no]
133)
134
135dnl Check for joystick support.
136AC_ARG_ENABLE(
137	[joystick],
138	[AS_HELP_STRING(
139		[--enable-joystick],
140		[enable joystick support [default=auto]]
141	)],
142	[USE_JOYSTICK=$enableval],
143	[USE_JOYSTICK=auto]
144)
145AS_IF(
146	[test "x$USE_JOYSTICK" != xno],
147	[AC_CHECK_HEADER(
148		[SDL_joystick.h],
149		[USE_JOYSTICK=yes],
150		[USE_JOYSTICK=no]
151	)]
152)
153AS_IF(
154	[test "x$enable_joystick" = xyes -a "x$USE_JOYSTICK" = xno],
155	[AC_MSG_FAILURE([joystick support seems unavailable])]
156)
157
158dnl Check for OpenGL support.
159AC_ARG_ENABLE(
160	[opengl],
161	[AS_HELP_STRING(
162		[--enable-opengl],
163		[enable OpenGL support [default=auto]]
164	)],
165	[USE_OPENGL=$enableval],
166	[USE_OPENGL=auto]
167)
168AS_IF(
169	[test "x$USE_OPENGL" != xno],
170	[AC_CHECK_HEADER(
171		[SDL_opengl.h],
172		[AC_SEARCH_LIBS(
173			[glEnd],
174			[GL opengl32 gl],
175			[USE_OPENGL=yes],
176			[AS_IF(
177				[test "x$cross_compiling" = xyes],
178				dnl When nothing works, use brute force.
179				[USE_OPENGL=no]
180				[AC_CHECK_LIB(
181					[GL],
182					[main],
183					[LIBS="-lGL $LIBS"]
184					[USE_OPENGL=yes]
185				)]
186				[AC_CHECK_LIB(
187					[opengl32],
188					[main],
189					[LIBS="-lopengl32 $LIBS"]
190					[USE_OPENGL=yes]
191				)]
192				[AC_CHECK_LIB(
193					[gl],
194					[main],
195					[LIBS="-lgl $LIBS"]
196					[USE_OPENGL=yes]
197				)],
198				[USE_OPENGL=no]
199			)]
200		)],
201		[USE_OPENGL=no]
202	)]
203)
204AS_IF(
205	[test "x$enable_opengl" = xyes -a "x$USE_OPENGL" = xno],
206	[AC_MSG_FAILURE([OpenGL support seems unavailable])]
207)
208
209dnl Check for threads support.
210AC_ARG_ENABLE(
211	[threads],
212	[AS_HELP_STRING(
213		[--enable-threads],
214		[enable multi-threading support [default=auto]]
215	)],
216	[USE_THREADS=$enableval],
217	[USE_THREADS=auto]
218)
219AS_IF(
220	[test "x$USE_THREADS" != xno],
221	[AC_CHECK_HEADER(
222		[SDL_thread.h],
223		[USE_THREADS=yes],
224		[USE_THREADS=no]
225	)]
226)
227AS_IF(
228	[test "x$enable_threads" = xyes -a "x$USE_THREADS" = xno],
229	[AC_MSG_FAILURE([multi-threading support seems unavailable])]
230)
231
232dnl Check for libarchive. Note that older versions of libarchive don't have
233dnl archive_read_support_format_raw().
234AC_ARG_WITH(
235	[libarchive],
236	[AS_HELP_STRING(
237		[--with-libarchive],
238		[use libarchive for compressed ROMs [default=auto]]
239	)],
240	[USE_LIBARCHIVE=$withval],
241	[USE_LIBARCHIVE=auto]
242)
243AS_IF(
244	[test "x$USE_LIBARCHIVE" != xno],
245	[AC_CHECK_HEADER(
246		[archive.h],
247		[AC_CHECK_LIB(
248			[archive],
249			[archive_read_support_format_raw],
250			[LIBS="-larchive $LIBS"]
251			[TOBIN_LIBS="-larchive $TOBIN_LIBS"]
252			[USE_LIBARCHIVE=yes],
253			[USE_LIBARCHIVE=no]
254		)],
255		[USE_LIBARCHIVE=no]
256	)]
257)
258
259dnl Check for glob.h.
260AC_CHECK_HEADERS([glob.h])
261
262dnl Try to add shell32.
263AC_CHECK_LIB([shell32], [main])
264
265dnl Check for ASM availability.
266AC_ARG_ENABLE(
267	[asm],
268	[AS_HELP_STRING(
269		[--disable-asm],
270		[disable all ASM-related options [default=auto]]
271	)],
272	[USE_ASM=$enableval],
273	[USE_ASM=auto]
274)
275USE_X86_ASM=no
276USE_ARM_ASM=no
277AS_IF(
278	[test "x$USE_ASM" != xno],
279	[AS_CASE(
280		[$target],
281
282		[i?86-*],
283		[AC_PATH_PROG([NASM], [nasm])]
284		[AS_IF(
285			[test "x$NASM" != x],
286			[USE_ASM=yes]
287			[USE_X86_ASM=yes],
288			[USE_ASM=no]
289		)],
290
291		[arm*-*],
292		[AC_MSG_NOTICE([ARM-specific ASM routines enabled])]
293		[USE_ASM=yes]
294		[USE_ARM_ASM=yes],
295
296		[AC_MSG_NOTICE([no ASM routines available for this target])]
297		[USE_ASM=unavailable]
298		[NASM=]
299	)]
300)
301AS_IF(
302	[test "x$enable_asm" = xyes -a "x$USE_ASM" = xno],
303	[AC_MSG_FAILURE([unable to enable ASM routines])]
304)
305
306dnl Check for NASM output format.
307AC_ARG_WITH(
308	[nasm-format],
309	[AC_HELP_STRING(
310		[--with-nasm-format[[=format]]],
311		[use this output format for NASM (see "nasm -hf" output for]
312		[available formats) [default=auto]]
313	)],
314	[NASM_FORMAT=$withval],
315	[AS_IF([test "x$NASM" != x], [NASM_FORMAT=auto], [NASM_FORMAT=])]
316)
317AS_IF(
318	[test "x$NASM_FORMAT" = xauto],
319	[AC_MSG_CHECKING([for nasm output format])]
320	[AS_CASE(
321		[$target],
322
323		[i?86-*mingw*],
324		[NASM_FORMAT=win32],
325
326		[x86_64-*mingw*],
327		[NASM_FORMAT=win64],
328
329		[i?86-*],
330		[NASM_FORMAT=elf32],
331
332		[x86_64-*],
333		[NASM_FORMAT=elf64],
334
335		[AC_MSG_RESULT([failed])]
336		[AC_MSG_ERROR(
337			[can't determine what format NASM should use, \
338please specify --with-nasm-format=format]
339		)]
340	)]
341	[AC_MSG_RESULT([$NASM_FORMAT])]
342	[AC_MSG_WARN([NASM format auto-detection is crappy at best])],
343	[AS_IF(
344		[test "x$NASM_FORMAT" != x],
345		[AC_MSG_NOTICE([NASM output format is $NASM_FORMAT])]
346	)]
347)
348
349dnl Check for the need to prefix ASM globals with underscores.
350dnl For ELF, also add -DNASM_STACK_NOEXEC.
351AS_IF(
352	[! test -z "$NASM_FORMAT"],
353	[AC_MSG_CHECKING([whether ASM globals require an underscore])]
354	[AS_CASE(
355		[$NASM_FORMAT],
356
357		[elf*],
358		[AC_MSG_RESULT([no])]
359		[NASM="$NASM -DNASM_STACK_NOEXEC"],
360
361		[AC_MSG_RESULT([yes])]
362		[NASM="$NASM --prefix _"]
363	)]
364)
365
366dnl Crap TV filters support.
367AC_ARG_ENABLE(
368	[ctv],
369	[AC_HELP_STRING([--disable-ctv], [disable Crap TV filters])],
370	[USE_CTV=$enableval],
371	[USE_CTV=yes]
372)
373
374dnl hqx filters support.
375AC_ARG_ENABLE(
376	[hqx],
377	[AS_HELP_STRING([--disable-hqx], [disable hqx filters])],
378	[USE_HQX=$enableval],
379	[USE_HQX=yes]
380)
381
382dnl scale2x filters support.
383AC_ARG_ENABLE(
384	[scale2x],
385	[AS_HELP_STRING([--disable-scale2x], [disable scale2x filters])],
386	[USE_SCALE2X=$enableval],
387	[USE_SCALE2X=yes]
388)
389
390dnl x86-specific ASM options.
391AC_ARG_ENABLE(
392	[x86-mmx],
393	[AC_HELP_STRING([--enable-x86-mmx], [enable MMX memcpy])],
394	dnl If --disable-asm isn't specified, MMX must be auto-detected,
395	dnl unless forced via --enable-x86-mmx.
396	[USE_X86_MMX=$enableval],
397	[AS_IF(
398		[test "x$USE_X86_ASM" != xno],
399		[USE_X86_MMX=auto],
400		[USE_X86_MMX=no]
401	)]
402)
403AC_ARG_ENABLE(
404	[x86-ctv],
405	[AC_HELP_STRING([--enable-x86-ctv], [enable ASM Crap TV filters])],
406	dnl Disable this if --disable-ctv is given.
407	[AS_IF(
408		[test "x$USE_CTV" != xno],
409		[USE_X86_CTV=$enableval],
410		[USE_X86_CTV=no]
411	)],
412	[AS_IF(
413		[test "x$USE_CTV" != xno],
414		[USE_X86_CTV=$USE_X86_ASM],
415		[USE_X86_CTV=no]
416	)]
417)
418AC_ARG_ENABLE(
419	[x86-tiles],
420	[AC_HELP_STRING([--enable-x86-tiles], [enable ASM tiles])],
421	[USE_X86_TILES=$enableval],
422	[USE_X86_TILES=$USE_X86_ASM]
423)
424AC_ARG_ENABLE(
425	[x86-mz80],
426	[AC_HELP_STRING([--enable-x86-mz80], [use ASM version of MZ80])],
427	[USE_X86_MZ80=$enableval],
428	[USE_X86_MZ80=$USE_X86_ASM]
429)
430
431dnl If MMX is to be automatically enabled, make sure it is actually supported.
432AS_IF(
433	[test "x$USE_X86_MMX" = xauto],
434	[AC_MSG_CHECKING([for MMX support])]
435	[AS_IF(
436		[test "x$cross_compiling" = xyes],
437		USE_X86_MMX=$USE_X86_ASM
438		[AC_MSG_RESULT([$USE_X86_ASM (untested)])],
439		[
440{
441	cat <<EOF > conftest.asm &&
442bits 32
443section .text
444global main
445main:
446	emms
447	xor eax, eax	; Return value of 0
448	ret
449EOF
450	$NASM -f $NASM_FORMAT -o conftest.$OBJEXT -- conftest.asm &&
451	$CC -o conftest$EXEEXT conftest.$OBJEXT &&
452	./conftest$EXEEXT &&
453	USE_X86_MMX=yes ||
454	USE_X86_MMX=no
455	rm -f conftest*
456} 1>&AS_MESSAGE_LOG_FD 2>&1
457		]
458		[AC_MSG_RESULT([$USE_X86_MMX])]
459	)]
460)
461
462AS_IF(
463	[test "x$USE_X86_ASM" = xno &&	\
464	 test "x$USE_X86_MMX" = xyes -o	\
465	 "x$USE_X86_CTV" = xyes -o	\
466	 "x$USE_X86_TILES" = xyes -o	\
467	 "x$USE_X86_MZ80" = xyes],
468	[AC_MSG_FAILURE(
469		[x86 ASM support is unavailable, you can't use x86 options]
470	)]
471)
472
473dnl CPU emulators.
474AC_ARG_WITH(
475	[star],
476	[AS_HELP_STRING(
477		[--with-star],
478		[include StarScream CPU core [default=auto]]
479	)],
480	[WITH_STAR=$withval],
481	[WITH_STAR=$USE_X86_ASM]
482)
483AS_IF(
484	[test "x$WITH_STAR" = xyes -a "x$USE_X86_ASM" = xno],
485	[AC_MSG_FAILURE(
486		[StarScream can only be enabled on x86 targets with a \
487working ASM support]
488	)]
489)
490
491AC_ARG_WITH(
492	[musa],
493	[AS_HELP_STRING(
494		[--with-musa],
495		[include Musashi CPU core [default=yes]]
496	)],
497	[WITH_MUSA=$withval],
498	[WITH_MUSA=yes]
499)
500AS_IF(
501	[test "x$WITH_MUSA" != xyes -a "x$WITH_STAR" != xyes],
502	[AC_MSG_WARN([neither Musashi nor StarScream are enabled])]
503)
504
505AC_ARG_WITH(
506	[cyclone],
507	[AS_HELP_STRING(
508		[--with-cyclone],
509		[include Cyclone 68000 CPU core [default=auto]]
510	)],
511	[WITH_CYCLONE=$withval],
512	[WITH_CYCLONE=$USE_ARM_ASM]
513)
514AS_IF(
515	[test "x$WITH_CYCLONE" = xyes -a "x$USE_ARM_ASM" = xno],
516	[AC_MSG_FAILURE(
517		[Cyclone 68000 can only be enabled on ARM targets with a \
518working ASM support]
519	)]
520)
521
522AC_ARG_WITH(
523	[mz80],
524	[AS_HELP_STRING(
525		[--with-mz80],
526		[include MZ80 CPU core [default=yes]]
527	)],
528	[WITH_MZ80=$withval],
529	[WITH_MZ80=yes]
530)
531
532AC_ARG_WITH(
533	[cz80],
534	[AS_HELP_STRING(
535		[--with-cz80],
536		[include CZ80 CPU core [default=yes]]
537	)],
538	[WITH_CZ80=$withval],
539	[WITH_CZ80=yes]
540)
541
542AC_ARG_WITH(
543	[drz80],
544	[AS_HELP_STRING(
545		[--with-drz80],
546		[include DrZ80 CPU core [default=auto]]
547	)],
548	[WITH_DRZ80=$withval],
549	[WITH_DRZ80=$USE_ARM_ASM]
550)
551AS_IF(
552	[test "x$WITH_DRZ80" = xyes -a "x$USE_ARM_ASM" = xno],
553	[AC_MSG_FAILURE(
554		[DrZ80 can only be enabled on ARM targets with a \
555working ASM support]
556	)]
557)
558
559dnl Check if debugger should be enabled.
560AC_ARG_ENABLE(
561	[debugger],
562	[AS_HELP_STRING(
563		[--enable-debugger],
564		[enable debugger [default=no]]
565	)],
566	[USE_DEBUGGER=$enableval],
567	[USE_DEBUGGER=no]
568)
569
570dnl Check if dZ80 is to be included.
571AC_ARG_WITH(
572	[dz80],
573	[AS_HELP_STRING(
574		[--with-dz80],
575		[include dZ80 disassembler in debugger [default=auto]],
576	)],
577	[WITH_DZ80=$withval],
578	[WITH_DZ80=$USE_DEBUGGER]
579)
580AS_IF(
581	[test "x$WITH_DZ80" = xyes -a "x$USE_DEBUGGER" != xyes],
582	[AC_MSG_FAILURE([dZ80 is only meaningful if debugger is also enabled])]
583)
584
585dnl Check if VDP debugging should be enabled.
586AC_ARG_ENABLE(
587	[debug-vdp],
588	[AS_HELP_STRING(
589		[--enable-debug-vdp],
590		[enable extra debugging for the VDP [default=auto]]
591	)],
592	[USE_DEBUG_VDP=$enableval],
593	[USE_DEBUG_VDP=auto]
594)
595AS_IF(
596	[test "x$USE_DEBUG_VDP" != xno -a "x$USE_DEBUG_VDP" != xyes],
597	[AS_IF(
598		[test "x$USE_DEBUG" = xyes -o "x$USE_DEBUGGER" = xyes],
599		[USE_DEBUG_VDP=yes],
600		[USE_DEBUG_VDP=no]
601	)]
602)
603
604dnl Check if Sega Pico emulation should be enabled.
605AC_ARG_ENABLE(
606	[pico],
607	[AS_HELP_STRING(
608		[--enable-pico],
609		[enable Sega Pico emulation (experimental) [default=no]]
610	)],
611	[USE_PICO=$enableval],
612	[USE_PICO=no]
613)
614
615dnl Check if VGM dumping functionality should be enabled.
616AC_ARG_ENABLE(
617	[vgmdump],
618	[AS_HELP_STRING(
619		[--enable-vgmdump],
620		[enable VGM dumping [default=no]]
621	)],
622	[USE_VGMDUMP=$enableval],
623	[USE_VGMDUMP=no]
624)
625
626dnl Check for Doxygen.
627AC_ARG_WITH(
628	[doxygen],
629	[AS_HELP_STRING(
630		[--with-doxygen],
631		[build Doxygen documentation [default=auto]]
632	)],
633	[WITH_DOXYGEN=$withval],
634	[WITH_DOXYGEN=auto]
635)
636AS_IF(
637	[test "x$WITH_DOXYGEN" != xno],
638	[AC_CHECK_PROGS([DOXYGEN], [doxygen])]
639	[AS_IF(
640		[test "x$DOXYGEN" = x],
641		[AS_IF(
642			[test "x$WITH_DOXYGEN" = xyes],
643			[AC_MSG_FAILURE(
644				[Doxygen not found, try --without-doxygen.]
645			)],
646			[WITH_DOXYGEN=no]
647		)],
648		[WITH_DOXYGEN=yes]
649	)]
650)
651
652dnl Prevent dgen_tobin from being linked with unnecessary libraries.
653DGEN_LIBS="$LIBS"
654LIBS="$TOBIN_LIBS"
655
656dnl Define everything.
657AS_IF([test "x$USE_OPENGL" = xyes], [AC_DEFINE([WITH_OPENGL])])
658AS_IF([test "x$USE_LIBARCHIVE" = xyes], [AC_DEFINE([WITH_LIBARCHIVE])])
659AS_IF([test "x$USE_DEBUGGER" = xyes], [AC_DEFINE([WITH_DEBUGGER])])
660AS_IF([test "x$WITH_DZ80" = xyes], [AC_DEFINE([WITH_DZ80])])
661AS_IF([test "x$USE_DEBUG" != xyes], [AC_DEFINE([NDEBUG])])
662AS_IF([test "x$USE_DEBUG_VDP" = xyes], [AC_DEFINE([WITH_DEBUG_VDP])])
663AS_IF([test "x$USE_PICO" = xyes], [AC_DEFINE([WITH_PICO])])
664AS_IF([test "x$USE_VGMDUMP" = xyes], [AC_DEFINE([WITH_VGMDUMP])])
665AS_IF([test "x$USE_JOYSTICK" = xyes], [AC_DEFINE([WITH_JOYSTICK])])
666AS_IF([test "x$USE_THREADS" = xyes], [AC_DEFINE([WITH_THREADS])])
667AS_IF([test "x$WITH_MUSA" = xyes], [AC_DEFINE([WITH_MUSA])])
668AS_IF([test "x$WITH_STAR" = xyes], [AC_DEFINE([WITH_STAR])])
669AS_IF([test "x$WITH_MZ80" = xyes], [AC_DEFINE([WITH_MZ80])])
670AS_IF([test "x$WITH_CZ80" = xyes], [AC_DEFINE([WITH_CZ80])])
671AS_IF([test "x$WITH_DRZ80" = xyes], [AC_DEFINE([WITH_DRZ80])])
672AS_IF([test "x$WITH_CYCLONE" = xyes], [AC_DEFINE([WITH_CYCLONE])])
673AS_IF([test "x$USE_ASM" = xyes], [AC_DEFINE([WITH_ASM])])
674AS_IF(
675	[test "x$USE_X86_ASM" = xyes],
676	[AC_DEFINE([WITH_X86_ASM])]
677	[AC_DEFINE([HAVE_MEMCPY_H])]
678)
679AS_IF([test "x$USE_CTV" = xyes], [AC_DEFINE([WITH_CTV])])
680AS_IF([test "x$USE_HQX" = xyes], [AC_DEFINE([WITH_HQX])])
681AS_IF([test "x$USE_SCALE2X" = xyes], [AC_DEFINE([WITH_SCALE2X])])
682AS_IF([test "x$USE_X86_MZ80" = xyes], [AC_DEFINE([WITH_X86_MZ80])])
683AS_IF([test "x$USE_X86_MMX" = xyes], [AC_DEFINE([WITH_X86_MMX])])
684AS_IF([test "x$USE_X86_CTV" = xyes], [AC_DEFINE([WITH_X86_CTV])])
685AS_IF([test "x$USE_X86_TILES" = xyes], [AC_DEFINE([WITH_X86_TILES])])
686
687AM_CONDITIONAL([WITH_DEBUG_VDP], [test "x$USE_DEBUG_VDP" = xyes])
688AM_CONDITIONAL([WITH_PICO], [test "x$USE_PICO" = xyes])
689AM_CONDITIONAL([WITH_VGMDUMP], [test "x$USE_VGMDUMP" = xyes])
690AM_CONDITIONAL([WITH_DEBUGGER], [test "x$USE_DEBUGGER" = xyes])
691AM_CONDITIONAL([WITH_DZ80], [test "x$WITH_DZ80" = xyes])
692AM_CONDITIONAL([WITH_CTV], [test "x$USE_CTV" = xyes])
693AM_CONDITIONAL([WITH_HQX], [test "x$USE_HQX" = xyes])
694AM_CONDITIONAL([WITH_SCALE2X], [test "x$USE_SCALE2X" = xyes])
695AM_CONDITIONAL([WITH_MUSA], [test "x$WITH_MUSA" = xyes])
696AM_CONDITIONAL([WITH_STAR], [test "x$WITH_STAR" = xyes])
697AM_CONDITIONAL([WITH_MZ80], [test "x$WITH_MZ80" = xyes])
698AM_CONDITIONAL([WITH_CZ80], [test "x$WITH_CZ80" = xyes])
699AM_CONDITIONAL([WITH_DRZ80], [test "x$WITH_DRZ80" = xyes])
700AM_CONDITIONAL([WITH_CYCLONE], [test "x$WITH_CYCLONE" = xyes])
701AM_CONDITIONAL([WITH_X86_ASM], [test "x$USE_X86_ASM" = xyes])
702AM_CONDITIONAL([WITH_X86_MZ80], [test "x$USE_X86_MZ80" = xyes])
703AM_CONDITIONAL([WITH_X86_MMX], [test "x$USE_X86_MMX" = xyes])
704AM_CONDITIONAL([WITH_X86_CTV], [test "x$USE_X86_CTV" = xyes])
705AM_CONDITIONAL([WITH_X86_TILES], [test "x$USE_X86_TILES" = xyes])
706AM_CONDITIONAL([WITH_DOXYGEN], [test "x$WITH_DOXYGEN" = xyes])
707AM_COND_IF([WITH_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
708
709AC_SUBST(CC_FOR_BUILD)
710AC_SUBST(CXX_FOR_BUILD)
711AC_SUBST(CPPFLAGS_FOR_BUILD)
712AC_SUBST(CFLAGS_FOR_BUILD)
713AC_SUBST(CXXFLAGS_FOR_BUILD)
714AC_SUBST(LDFLAGS_FOR_BUILD)
715AC_SUBST(OBJEXT_FOR_BUILD)
716AC_SUBST(EXEEXT_FOR_BUILD)
717AC_SUBST(NASM)
718AC_SUBST(NASM_FORMAT)
719AC_SUBST(DGEN_LIBS)
720
721dnl The following shuts up automake when overriding *FLAGS macros.
722CPPFLAGS_B=CPPFLAGS
723CFLAGS_B=CFLAGS
724CXXFLAGS_B=CXXFLAGS
725LDFLAGS_B=LDFLAGS
726AC_SUBST(CPPFLAGS_B)
727AC_SUBST(CFLAGS_B)
728AC_SUBST(CXXFLAGS_B)
729AC_SUBST(LDFLAGS_B)
730
731dnl Done!
732AC_OUTPUT(
733	[Makefile]
734	[star/Makefile]
735	[musa/Makefile]
736	[cyclone/Makefile]
737	[mz80/Makefile]
738	[sdl/Makefile]
739	[doc/Makefile]
740)
741
742AC_MSG_NOTICE([
743
744Front-end
745  OpenGL: $USE_OPENGL
746  Joystick: $USE_JOYSTICK
747  Multi-threading: $USE_THREADS
748  Crap TV filters: $USE_CTV
749  hqx filters: $USE_HQX
750  scale2x filters: $USE_SCALE2X
751  Compressed ROMs: $USE_LIBARCHIVE
752  Debugger: $USE_DEBUGGER
753  dZ80 disassembler: $WITH_DZ80
754  Debugging: $USE_DEBUG
755  VDP debugging: $USE_DEBUG_VDP
756  Sega Pico: $USE_PICO
757  VGM dumping: $USE_VGMDUMP
758
759CPU cores
760  Musashi M68K: $WITH_MUSA
761  StarScream: $WITH_STAR
762  Cyclone: $WITH_CYCLONE
763  MZ80: $WITH_MZ80
764  CZ80: $WITH_CZ80
765  DrZ80: $WITH_DRZ80
766
767ASM support ($USE_ASM)
768  x86 ASM
769    MZ80: $USE_X86_MZ80
770    MMX memcpy: $USE_X86_MMX
771    Crap TV filters: $USE_X86_CTV
772    Tiles: $USE_X86_TILES
773  ARM ASM
774    Cyclone: $WITH_CYCLONE
775    DrZ80: $WITH_DRZ80
776
777Doxygen documentation: $WITH_DOXYGEN
778])
779