1
AC_INIT([src/mednafen.cpp])
3
AC_USE_SYSTEM_EXTENSIONS
4
AC_CONFIG_MACRO_DIR([m4])
7
# Avoid trailing and leading zeroes in the decimal version components to avoid confusing not-so-learned people.
9
MEDNAFEN_VERSION='0.9.18-WIP'
10
MEDNAFEN_VERSION_NUMERIC=0x000918
14
AM_INIT_AUTOMAKE([mednafen], $MEDNAFEN_VERSION)
15
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
16
AM_CONFIG_HEADER([include/config.h:include/config.h.in])
33
# sizeof tests need to come after largefile support macros
35
AC_CHECK_TYPE(ptrdiff_t,long)
37
AC_CHECK_SIZEOF(short)
40
AC_CHECK_SIZEOF(long long)
41
AC_CHECK_SIZEOF(double)
42
AC_CHECK_SIZEOF(__int64)
43
AC_CHECK_SIZEOF(void *)
44
AC_CHECK_SIZEOF(size_t)
45
AC_CHECK_SIZEOF(ptrdiff_t)
46
AC_CHECK_SIZEOF(off_t)
48
AC_CHECK_FUNCS(memcmp memcpy memmove memset mmap munmap madvise signal sigaction fcntl getenv putenv setenv gettimeofday getpwuid getuid usleep strerror strerror_r ftello fopen64 fseeko64 ftello64 fstat64)
49
AC_CHECK_HEADERS(fcntl.h)
54
# Check for any libraries that need to be linked against for clock_gettime().
56
# (posix4 is apparently used by much older versions of Solaris according to tar, pre-7, so maybe it's not necessary
58
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
59
AC_CHECK_FUNCS(clock_gettime)
61
AC_DEFINE(MINILZO_HAVE_CONFIG_H, [1], [Define if config.h is present])
63
AC_CHECK_HEADER([OpenGL/gl.h],HAVE_OPENGL_GL_H=true, HAVE_OPENGL_GL_H=false)
66
AC_DEFINE(HAVE_APPLE_OPENGL_FRAMEWORK, [1], [Define if we should include from OpenGL instead of GL])
69
CFLAGS="-I${x_includes} ${CFLAGS}"
70
CPPFLAGS="-I${x_includes} ${CFLAGS}"
72
AC_CHECK_HEADER([GL/gl.h],HAVE_GL_GL_H=true, HAVE_GL_GL_H=false)
74
if test x$HAVE_GL_GL_H = xfalse; then
75
AC_MSG_ERROR([*** OpenGL header file not found!])
86
AC_CHECK_LIB([z], [zlibVersion],[], AC_MSG_ERROR([*** zlib not found!]))
89
dnl Check for libvorbisidec (tremor)
90
AC_CHECK_LIB([vorbisidec], [ov_read], [], AC_MSG_ERROR([*** libvorbisidec not found!]))
91
LIBS="$LIBS -lvorbisidec"
93
dnl -fno-unit-at-a-time
97
dnl MATH_OPTIMIZER_FLAGS is used in the automake files where it doesn't break code
98
MATH_OPTIMIZER_FLAGS="-ffast-math"
99
AC_SUBST(MATH_OPTIMIZER_FLAGS)
101
AX_CFLAGS_GCC_OPTION([-fomit-frame-pointer], OPTIMIZER_FLAGS)
102
AX_CFLAGS_GCC_OPTION([-finline-limit=6000], OPTIMIZER_FLAGS)
103
AX_CFLAGS_GCC_OPTION([--param large-function-growth=800], OPTIMIZER_FLAGS)
104
AX_CFLAGS_GCC_OPTION([--param inline-unit-growth=175], OPTIMIZER_FLAGS)
105
AX_CFLAGS_GCC_OPTION([--param max-inline-insns-single=10000], OPTIMIZER_FLAGS)
106
AX_CFLAGS_GCC_OPTION([-fno-strict-overflow], OPTIMIZER_FLAGS)
109
AX_CFLAGS_GCC_OPTION([-Wall], WARNING_FLAGS)
110
AX_CFLAGS_GCC_OPTION([-Winline], WARNING_FLAGS)
111
AX_CFLAGS_GCC_OPTION([-Wshadow], WARNING_FLAGS)
112
AX_CFLAGS_GCC_OPTION([-Wempty-body], WARNING_FLAGS)
113
AX_CFLAGS_GCC_OPTION([-Wignored-qualifiers], WARNING_FLAGS)
116
AX_CFLAGS_GCC_OPTION([-fno-unit-at-a-time], GBA_EXTRA_FLAGS)
117
AC_SUBST(GBA_EXTRA_FLAGS)
120
AX_CFLAGS_GCC_OPTION([-fsigned-char], MDFN_COMPAT_FLAGS)
122
CFLAGS="$MDFN_COMPAT_FLAGS $WARNING_FLAGS $OPTIMIZER_FLAGS $CFLAGS"
123
CPPFLAGS="$MDFN_COMPAT_FLAGS $WARNING_FLAGS $OPTIMIZER_FLAGS $CPPFLAGS"
125
AM_CONDITIONAL(WANT_DEBUGGER, false)
127
AC_ARG_ENABLE(debugger,
128
AC_HELP_STRING([--enable-debugger], [build with internal debugger [[default=yes]]]),
129
, enable_debugger=yes)
131
if test x$enable_debugger = xyes; then
132
AC_DEFINE([WANT_DEBUGGER], [1], [Define if we are compiling with debugger.])
133
AM_CONDITIONAL(WANT_DEBUGGER, true)
136
AC_ARG_ENABLE(cjk-fonts,
137
AC_HELP_STRING([--enable-cjk-fonts], [build with internal CJK(Chinese, Japanese, Korean) fonts [[default=yes]]]),
138
, enable_cjk_fonts=yes)
140
if test x$enable_cjk_fonts = xyes; then
141
AC_DEFINE([WANT_INTERNAL_CJK], [1], [Define if we are compiling with internal CJK fonts.])
145
dnl The code that uses $enable_altivec is lower, in the CPU architecture section.
147
AC_ARG_ENABLE(altivec,
148
AC_HELP_STRING([--enable-altivec], [use AltiVec extensions on PowerPC/POWER ISA processors [[default=yes]]]),
149
, enable_altivec=yes)
152
AM_CONDITIONAL(WANT_GB_EMU, false)
153
AM_CONDITIONAL(WANT_GBA_EMU, false)
154
AM_CONDITIONAL(WANT_LYNX_EMU, false)
155
AM_CONDITIONAL(WANT_MD_EMU, false)
156
AM_CONDITIONAL(WANT_SMS_EMU, false)
157
AM_CONDITIONAL(WANT_NES_EMU, false)
158
AM_CONDITIONAL(WANT_NGP_EMU, false)
159
AM_CONDITIONAL(WANT_PCE_EMU, false)
160
AM_CONDITIONAL(WANT_PCE_FAST_EMU, false)
161
AM_CONDITIONAL(WANT_PCFX_EMU, false)
162
AM_CONDITIONAL(WANT_PSX_EMU, false)
163
AM_CONDITIONAL(WANT_SMS_EMU, false)
164
AM_CONDITIONAL(WANT_SNES_EMU, false)
165
AM_CONDITIONAL(WANT_VB_EMU, false)
166
AM_CONDITIONAL(WANT_WSWAN_EMU, false)
169
AC_HELP_STRING([--enable-gb], [build with GameBoy emulation [[default=yes]]]),
172
if test x$enable_gb = xyes; then
173
AC_DEFINE([WANT_GB_EMU], [1], [Define if we are compiling with GB emulation.])
174
AM_CONDITIONAL(WANT_GB_EMU, true)
178
AC_HELP_STRING([--enable-gba], [build with GameBoy Advance emulation [[default=yes]]]),
181
if test x$enable_gba = xyes; then
182
AC_DEFINE([WANT_GBA_EMU], [1], [Define if we are compiling with GBA emulation.])
183
AM_CONDITIONAL(WANT_GBA_EMU, true)
187
AC_HELP_STRING([--enable-lynx], [build with Atari Lynx emulation [[default=yes]]]),
190
if test x$enable_lynx = xyes; then
191
AC_DEFINE([WANT_LYNX_EMU], [1], [Define if we are compiling with Lynx emulation.])
192
AM_CONDITIONAL(WANT_LYNX_EMU, true)
196
AC_HELP_STRING([--enable-md], [build with Sega Genesis/MegaDrive emulation [[default=yes]]]),
199
if test x$enable_md = xyes; then
200
AC_DEFINE([WANT_MD_EMU], [1], [Define if we are compiling with Sega Genesis/MegaDrive emulation.])
201
AM_CONDITIONAL(WANT_MD_EMU, true)
205
AC_HELP_STRING([--enable-nes], [build with Nintendo Entertainment System emulation [[default=yes]]]),
208
if test x$enable_nes = xyes; then
209
AC_DEFINE([WANT_NES_EMU], [1], [Define if we are compiling with NES emulation.])
210
AM_CONDITIONAL(WANT_NES_EMU, true)
214
AC_HELP_STRING([--enable-ngp], [build with Neo Geo Pocket emulation [[default=yes]]]),
217
if test x$enable_ngp = xyes; then
218
AC_DEFINE([WANT_NGP_EMU], [1], [Define if we are compiling with NGP emulation.])
219
AM_CONDITIONAL(WANT_NGP_EMU, true)
223
AC_HELP_STRING([--enable-pce], [build with PC Engine(TurboGrafx 16) emulation [[default=yes]]]),
226
if test x$enable_pce = xyes; then
227
AC_DEFINE([WANT_PCE_EMU], [1], [Define if we are compiling with PCE emulation.])
228
AM_CONDITIONAL(WANT_PCE_EMU, true)
231
AC_ARG_ENABLE(pce-fast,
232
AC_HELP_STRING([--enable-pce-fast], [build the separate, fast PC Engine(TurboGrafx 16) emulation [[default=yes]]]),
233
, enable_pce_fast=yes)
235
if test x$enable_pce_fast = xyes; then
236
AC_DEFINE([WANT_PCE_FAST_EMU], [1], [Define if we are compiling with separate fast PCE emulation.])
237
AM_CONDITIONAL(WANT_PCE_FAST_EMU, true)
241
AC_HELP_STRING([--enable-pcfx], [build with PC-FX emulation [[default=yes]]]),
244
if test x$enable_pcfx = xyes; then
245
AC_DEFINE([WANT_PCFX_EMU], [1], [Define if we are compiling with PC-FX emulation.])
246
AM_CONDITIONAL(WANT_PCFX_EMU, true)
250
AC_HELP_STRING([--enable-psx], [build with PlayStation emulation [[default=no]]]),
253
if test x$enable_psx = xyes; then
254
AC_DEFINE([WANT_PSX_EMU], [1], [Define if we are compiling with PlayStation emulation.])
255
AM_CONDITIONAL(WANT_PSX_EMU, true)
259
AC_HELP_STRING([--enable-sms], [build with SMS+GG emulation [[default=yes]]]),
262
if test x$enable_sms = xyes; then
263
AC_DEFINE([WANT_SMS_EMU], [1], [Define if we are compiling with SMS+GG emulation.])
264
AM_CONDITIONAL(WANT_SMS_EMU, true)
268
AC_HELP_STRING([--enable-snes], [build with SNES emulation [[default=yes]]]),
271
if test x$enable_snes = xyes; then
272
AC_DEFINE([WANT_SNES_EMU], [1], [Define if we are compiling with SNES emulation.])
273
AM_CONDITIONAL(WANT_SNES_EMU, true)
277
AC_HELP_STRING([--enable-vb], [build with Virtual Boy emulation [[default=yes]]]),
280
if test x$enable_vb = xyes; then
281
AC_DEFINE([WANT_VB_EMU], [1], [Define if we are compiling with Virtual Boy emulation.])
282
AM_CONDITIONAL(WANT_VB_EMU, true)
287
AC_HELP_STRING([--enable-wswan], [build with WonderSwan emulation [[default=yes]]]),
290
if test x$enable_wswan = xyes; then
291
AC_DEFINE([WANT_WSWAN_EMU], [1], [Define if we are compiling with WonderSwan emulation.])
292
AM_CONDITIONAL(WANT_WSWAN_EMU, true)
295
AM_CONDITIONAL(HAVE_OSSDSP, false)
296
AM_CONDITIONAL(HAVE_ALSA, false)
297
AM_CONDITIONAL(HAVE_DIRECTSOUND, false)
298
AM_CONDITIONAL(HAVE_SDL, false)
299
AM_CONDITIONAL(HAVE_JACK, false)
301
dnl Check* functions ripped from SDL's autoconf file, with heavy modifications
302
dnl See if the ALSA audio interface is supported
307
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
309
if test x$enable_alsa = xyes; then
310
AM_PATH_ALSA(1.0.0, have_alsa=yes, have_alsa=no)
312
# Restore all flags from before the ALSA detection runs
313
CFLAGS="$alsa_save_CFLAGS"
314
LDFLAGS="$alsa_save_LDFLAGS"
315
LIBS="$alsa_save_LIBS"
317
if test x$have_alsa = xyes; then
318
AM_CONDITIONAL(HAVE_ALSA, true)
319
AC_DEFINE([HAVE_ALSA], [1], [Define if we are compiling with ALSA support.])
320
LIBS="$LIBS $ALSA_LIBS"
321
CFLAGS="$CFLAGS $ALSA_CFLAGS"
322
CPPFLAGS="$CPPFLAGS $ALSA_CFLAGS"
330
AC_HELP_STRING([--enable-jack], [support the JACK audio API [[default=yes]]]),
332
if test x$enable_jack = xyes; then
333
PKG_CHECK_MODULES(JACK, jack, [have_jack=yes], [have_jack=no])
335
if test x$have_jack = xyes; then
336
AM_CONDITIONAL(HAVE_JACK, true)
337
AC_DEFINE([HAVE_JACK], [1], [Define if we are compiling with JACK support.])
338
LIBS="$LIBS $JACK_LIBS"
339
CFLAGS="$CFLAGS $JACK_CFLAGS"
340
CPPFLAGS="$CPPFLAGS $JACK_CFLAGS"
349
AM_PATH_SDL($SDL_VERSION, HAVE_SDL=true, HAVE_SDL=false)
352
AM_CONDITIONAL(HAVE_SDL, true)
353
AC_DEFINE([HAVE_SDL], [1], [Define if we are compiling with SDL sound support.])
357
AC_MSG_ERROR([*** SDL 1.2.x not found!])
360
AC_ARG_WITH([SDL_net],
361
[AS_HELP_STRING([--with-SDL_net],
362
[support network play @<:@default=yes@:>@])],
367
AC_ARG_WITH([libcdio],
368
[AS_HELP_STRING([--with-libcdio],
369
[support physical CD reading @<:@default=yes@:>@])],
373
AC_ARG_WITH([libsndfile],
374
[AS_HELP_STRING([--with-libsndfile],
375
[support various sound file formats in ripped CD images @<:@default=yes@:>@])],
377
[with_libsndfile=yes])
379
#AC_ARG_WITH([ogg-vorbis],
380
# [AS_HELP_STRING([--with-ogg-vorbis],
381
# [support Ogg Vorbis playback for ripped CD images @<:@default=yes@:>@])],
383
# [with_oggvorbis=yes])
386
AM_CONDITIONAL(WIN32, false)
387
AM_CONDITIONAL(UNIX, false)
388
if expr x"$target" : 'x.*-mingw*' > /dev/null; then
391
AC_CHECK_HEADER([dsound.h],HAVE_DIRECTSOUND=true, HAVE_DIRECTSOUND=false)
395
AM_CONDITIONAL(HAVE_DIRECTSOUND,true)
396
AC_DEFINE([HAVE_DIRECTSOUND], [1], [Define if we are compiling with DirectSound support.])
397
LIBS="-ldxguid -lwinmm -ldsound $LIBS"
400
AC_DEFINE([PSS_STYLE],[2], [Defines the filesystem path-separator type.])
401
AC_DEFINE([WIN32], [1], [Define if we are compiling for Win32.])
402
AM_CONDITIONAL(WIN32, true)
404
LIBS="-mwindows -lwsock32 $LIBS -ldsound -lwinmm"
406
if test x$with_libcdio = xyes; then
408
AC_DEFINE([HAVE_LIBCDIO], [1], [Define if we are compiling with libcdio support.])
411
if test x$with_libsndfile = xyes; then
412
SNDFILE_LIBS="-lsndfile"
414
AC_DEFINE([HAVE_LIBSNDFILE], [1], [Define if we are compiling with libsndfile support.])
420
if test x$with_libcdio = xyes; then
421
PKG_CHECK_MODULES(LIBCDIO, libcdio, [], AC_MSG_ERROR([*** libcdio not found!]))
422
AC_DEFINE([HAVE_LIBCDIO], [1], [Define if we are compiling with libcdio support.])
426
if test x$with_libsndfile = xyes; then
427
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, [], AC_MSG_ERROR([*** libsndfile >= 1.0.2 not found!]))
428
AC_DEFINE([HAVE_LIBSNDFILE], [1], [Define if we are compiling with libsndfile support.])
431
AC_DEFINE([PSS_STYLE],[1], [Defines the filesystem path-separator type.])
432
AC_CHECK_HEADER([sys/soundcard.h],[AM_CONDITIONAL(HAVE_OSSDSP,true) AC_DEFINE([HAVE_OSSDSP], [1], [Define if we are compiling with OSS support.])])
434
if expr x"$target" : 'x.*beos' > /dev/null; then
435
CFLAGS="-no-fpic $CFLAGS"
436
CPPFLAGS="-no-fpic $CPPFLAGS"
441
if test x$with_SDL_net = xyes; then
444
dnl FIXME: The following library check breaks cross-compiling for Win32
445
dnl AC_CHECK_LIB([SDL_net], [SDLNet_Init],[],[HAS_SDL_NET=no])
447
CFLAGS_SDLNET_BACK="$CFLAGS"
448
CPPFLAGS_SDLNET_BACK="$CPPFLAGS"
449
CFLAGS="$CFLAGS $SDL_CFLAGS"
450
CPPFLAGS="$CFLAGS $SDL_CFLAGS"
451
AC_CHECK_HEADER([SDL_net.h],[], [HAS_SDL_NET=no])
452
if test x$HAS_SDL_NET = xno; then
453
AC_MSG_ERROR([*** SDL_net not found!])
455
CFLAGS="$CFLAGS_SDLNET_BACK"
456
CPPFLAGS="$CPPFLAGS_SDLNET_BACK"
458
AC_DEFINE([HAVE_SDL_NET], [1], [Define if we are compiling with SDL_net support.])
459
LIBS="$LIBS -lSDL_net"
462
AM_CONDITIONAL(ARCH_X86, false)
463
AM_CONDITIONAL(ARCH_X86_32, false)
464
AM_CONDITIONAL(ARCH_X86_64, false)
465
AM_CONDITIONAL(ARCH_POWERPC, false)
466
AM_CONDITIONAL(ARCH_POWERPC_ALTIVEC, false)
473
case "$target_cpu" in
475
AC_DEFINE([ARCH_X86], [1], [Define if we are compiling for 32-bit or 64-bit x86 architectures.])
476
AM_CONDITIONAL(ARCH_X86, true)
477
AC_DEFINE([ARCH_X86_64], [1], [Define if we are compiling for 64-bit x86 architectures.])
478
AM_CONDITIONAL(ARCH_X86_64, true)
480
dnl MMX, SSE, and SSE2 here should be unnecessary, but put them in just in case.
489
AC_DEFINE([ARCH_X86], [1], [Define if we are compiling for 32-bit or 64-bit x86 architectures.])
490
AM_CONDITIONAL(ARCH_X86, true)
491
AC_DEFINE([ARCH_X86_32], [1], [Define if we are compiling for 32-bit x86 architectures.])
492
AM_CONDITIONAL(ARCH_X86_32, true)
500
AC_DEFINE([ARCH_POWERPC], [1], [Define if we are compiling for PPC architectures.])
501
AM_CONDITIONAL(ARCH_POWERPC, true)
503
if test x$enable_altivec = xyes; then
505
AX_CFLAGS_GCC_OPTION([-faltivec], ALTIVEC_FLAGS)
506
AX_CFLAGS_GCC_OPTION([-maltivec], ALTIVEC_FLAGS)
507
if test "x$ALTIVEC_FLAGS" != "x"; then
508
CFLAGS="$CFLAGS $ALTIVEC_FLAGS"
509
CPPFLAGS="$CFLAGS $ALTIVEC_FLAGS"
510
AC_DEFINE([ARCH_POWERPC_ALTIVEC], [1], [Define if we are compiling with AltiVec usage.])
511
AM_CONDITIONAL(ARCH_POWERPC_ALTIVEC, true)
513
AC_CHECK_HEADER([altivec.h],
514
AC_DEFINE([HAVE_ALTIVEC_H], [1], [Define if altivec.h is present and usable.]),
521
AX_CFLAGS_GCC_OPTION([-mieee], TRIO_CFLAGS)
526
AC_SUBST(SSE2_CFLAGS)
527
AC_SUBST(SSE3_CFLAGS)
528
AC_SUBST(TRIO_CFLAGS)
530
AC_C_BIGENDIAN([AC_DEFINE([MSB_FIRST],[1],[Define on big-endian platforms.])],
532
AC_DEFINE([LSB_FIRST],[1],[Define on little-endian platforms.])
533
AC_DEFINE([MPC_LITTLE_ENDIAN],[1],[Define on little-endian platforms.])
535
AC_DEFINE_UNQUOTED([MEDNAFEN_VERSION],"$MEDNAFEN_VERSION", [Mednafen version definition.])
536
AC_DEFINE_UNQUOTED([MEDNAFEN_VERSION_NUMERIC],$MEDNAFEN_VERSION_NUMERIC, [Mednafen version numeric.])
538
AC_DEFINE([MPC_FIXED_POINT], [1], [Define to use fixed-point MPC decoder.])
540
AC_DEFINE([BLIP_BUFFER_ACCURACY], [20], [Blip Buffer resample ratio accuracy.])
541
AC_DEFINE([BLIP_PHASE_BITS], [8], [Blip Buffer phase bits count.])
542
AC_DEFINE([BLIP_MAX_QUALITY], [32], [Blip Buffer maximum quality.])
544
LIBS="$SNDFILE_LIBS $LIBCDIO_LIBS $LIBS"
545
CFLAGS="$LIBCDIO_CFLAGS $SNDFILE_CFLAGS $CFLAGS"
546
CPPFLAGS="$LIBCDIO_CFLAGS $SNDFILE_CFLAGS $CPPFLAGS"
549
AC_OUTPUT([Makefile src/Makefile src/drivers/Makefile src/sexyal/Makefile src/mpcdec/Makefile src/trio/Makefile src/gb/Makefile src/gba/Makefile src/lynx/Makefile src/pce/Makefile src/pce_fast/Makefile src/pcfx/Makefile src/psx/Makefile src/sms/Makefile src/vb/Makefile src/wswan/Makefile src/nes/Makefile src/snes/Makefile src/ngp/Makefile src/sound/Makefile src/hw_cpu/Makefile src/hw_misc/Makefile src/hw_sound/Makefile src/hw_video/Makefile src/md/Makefile src/demo/Makefile src/desa68/Makefile po/Makefile.in intl/Makefile])