1 dnl Process this file with autoconf to produce a configure script.
4 AM_INIT_AUTOMAKE(lxdream, 0.9)
6 AM_CONFIG_HEADER(config.h)
12 AC_CHECK_SIZEOF([void *])
17 AC_PATH_PROG(POD2MAN, [pod2man])
18 AC_PATH_PROG(POD2HTML, [pod2html])
20 dnl ---------------- enable/with flags ------------------
22 AC_ARG_ENABLE( strict-warn,
23 AS_HELP_STRING( [--enable-strict-warn], [Enable strict compilation warnings]),
24 [CFLAGS="$CFLAGS -Werror -Wall -Wno-unused"], [])
25 AC_ARG_ENABLE( translator,
26 AS_HELP_STRING( [--disable-translator], [Disable the SH4 translator (Enabled by default)]),
27 [true], [enable_translator=yes] )
28 AC_ARG_ENABLE( optimized,
29 AS_HELP_STRING( [--disable-optimized], [Disable compile-time optimizations (Enabled by default)]),
30 [true], [enable_optimized=yes] )
31 AC_ARG_ENABLE( profiled,
32 AS_HELP_STRING( [--enable-profiled], [Enable profiling build]),
33 [if test "$enableval" == "yes"; then
37 AS_HELP_STRING( [--enable-trace], [Enable generation of IO traces (warning: hurts performance)]),
38 [if test "$enableval" == "yes"; then
39 AC_DEFINE(ENABLE_TRACE_IO, 1, [Enable IO tracing])
42 AS_HELP_STRING( [--enable-watch], [Enable watchpoints in the debugger (warning: hurts performance)]),
43 [if test "$enableval" == "yes"; then
44 AC_DEFINE(ENABLE_WATCH, 1, [Enable watchpoints])
46 AC_ARG_ENABLE( sh4stats,
47 AS_HELP_STRING( [--enable-sh4stats], [Enable statistics on executed sh4 instructions]),
48 [if test "$enableval" == "yes"; then
49 AC_DEFINE(ENABLE_SH4STATS, 1, [Enable SH4 statistics])
52 AS_HELP_STRING( [--with-osmesa], [Build with the osmesa GL library (software rendering)]),
55 AS_HELP_STRING( [--with-gtk], [Build with the GTK UI. Default on X11 systems]), [with_gtk=yes], [with_gtk=x11] )
57 AS_HELP_STRING( [--with-esd], [Build with support for the ESounD audio system]) )
59 AS_HELP_STRING( [--with-pulse], [Build with support for the PulseAudio audio system]) )
63 if test "x$enable_optimized" = "xyes"; then
64 CFLAGS="-g -O2 -msse2 -mfpmath=sse"
65 if test "x$enable_profiled" != "xyes"; then
66 dnl -fomit-frame-pointer can't be used with -pg
67 CFLAGS="$CFLAGS -fexceptions -fomit-frame-pointer"
68 AC_DEFINE(HAVE_EXCEPTIONS, [1], [Have exception stack-frame information])
70 AC_DEFINE(HAVE_FASTCALL, [1], [Use fast register-passing calling conventions])
75 if test "x$enable_profiled" = "xyes"; then
77 LDFLAGS="$LDFLAGS -pg";
80 if test "x$GCC" = "xyes"; then
81 CFLAGS="$CFLAGS -fno-strict-aliasing"
85 dnl ------------ Check if we're building on Darwin --------------
87 dnl For starters, do we have a working objective-c compiler?
88 lxdream_save_cppflags="$CPPFLAGS"
89 CPPFLAGS="$CPPFLAGS -x objective-c"
90 AC_TRY_COMPILE([@interface Foo @end],, [
92 AC_CHECK_HEADER([Cocoa/Cocoa.h], [
95 LIBS="$LIBS -framework AppKit"
96 LIBS="$LIBS -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -framework OpenGL"
97 CPPFLAGS="$CPPFLAGS -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_4 -mdynamic-no-pic"
98 LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"
99 AC_DEFINE(HAVE_COCOA,[1],[Have Cocoa framework])
100 AC_DEFINE(APPLE_BUILD,[1],[Building on an apple platform. Things are different...])
101 if test "x$with_gtk" = "xx11"; then
106 ], [CPPFLAGS="$lxdream_save_cppflags"] )
107 AM_CONDITIONAL(GUI_COCOA, [test "$HAVE_COCOA" = 'yes' -a "$with_gtk" = "no"])
108 if test "x$HAVE_COCOA" = 'xyes' -a "x$with_gtk" = "xno"; then
109 AC_DEFINE(OSX_BUNDLE, [1], [Generating a bundled application])
112 dnl ----------- Check for mandatory dependencies --------------
113 dnl Check for libpng (required)
114 PKG_CHECK_MODULES(LIBPNG, [libpng] )
116 dnl Implied by libpng, but check explicitly just in case
117 AC_CHECK_LIB(z, uncompress, [], [
118 echo "Zlib (libz.so) could not be found, but is required."
121 if test "x$with_gtk" = "xno"; then
122 dnl Check for GLIB only
123 PKG_CHECK_MODULES(GLIB, glib-2.0)
126 PKG_CHECK_MODULES(GTK, gtk+-2.0, [
128 AC_DEFINE([HAVE_GTK],1,[Have GTK libraries])
131 dnl Which GTK port do we have?
132 LIBS="$LIBS $GTK_LIBS"
133 AC_CHECK_FUNC(gdk_x11_display_get_xdisplay, [
135 AC_DEFINE([HAVE_GTK_X11],1,[Building with GTK+X11]) ], [])
136 AC_CHECK_FUNC(gdk_quartz_window_get_nsview, [
138 AC_DEFINE([HAVE_GTK_OSX],1,[Building with GTK+Cocoa]) ], [])
141 AM_CONDITIONAL(GUI_GTK, [test "$HAVE_GTK" = 'yes'])
143 dnl ------------------ Video driver support -------------------
144 AS_IF([test "x$with_osmesa" != xno], [
146 dnl User requested OSMesa (ie pure software rendering)
147 AC_CHECK_LIB([OSMesa], [OSMesaCreateContext], [],
148 [AC_MSG_FAILURE( [--with-osmesa was given, but OSMesa library could not be found])])
149 AC_CHECK_HEADER([GL/osmesa.h], [],
150 [AC_MSG_FAILURE( [--with-osmesa was given, but osmesa.h could not be found])])
152 VIDEO_DRIVERS="$VIDEO_DRIVERS osmesa"
153 AC_DEFINE([HAVE_OSMESA],1,[Building with the OSMesa video driver]) ], [
155 dnl Otherwise we want a real GL library (unless we're on darwin, in which case it's already
156 dnl taken care of above).
157 if test "x$APPLE_BUILD" != 'xyes'; then
158 AC_CHECK_LIB(GL, glVertex3f, [], [
159 AC_MSG_FAILURE( ["The OpenGL library (libGL.so) could not be found, but is required."])])
160 AC_CHECK_HEADER([GL/gl.h], [], [
161 AC_MSG_FAILURE( ["The OpenGL header files (eg GL/gl.h) could not be found, but are required."])])
163 AC_CHECK_FUNC(NSOpenGLGetVersion, [
165 VIDEO_DRIVERS="$VIDEO_DRIVERS nsgl"
166 AC_DEFINE([HAVE_NSGL],1, [Have NSOpenGL support]) ] )
169 dnl Now work out how to get from the UI to GL - this is usually the painful part.
170 if test "x$HAVE_GTK_X11" = "xyes"; then
171 if test "x$APPLE_BUILD" = "xyes"; then
172 LIBS="$LIBS -L/usr/X11/lib -lGL"
174 AC_CHECK_FUNC(glXQueryVersion, [
176 VIDEO_DRIVERS="$VIDEO_DRIVERS glx"
177 AC_DEFINE([HAVE_GLX], 1, [Have GLX support]) ] )
184 AM_CONDITIONAL(VIDEO_OSMESA, [test "x$HAVE_OSMESA" = "xyes"])
185 AM_CONDITIONAL(VIDEO_GLX, [test "x$HAVE_GLX" = "xyes"])
186 AM_CONDITIONAL(VIDEO_NSGL, [test "x$HAVE_NSGL" = "xyes"])
188 dnl Check for optional (but highly desireable) OpenGL features
189 AC_CHECK_FUNC(glGenFramebuffersEXT, [ AC_DEFINE([HAVE_OPENGL_FBO],1,[Have EXT_framebuffer_object support]) ], [])
190 AC_CHECK_FUNC(glCreateShader, [ AC_DEFINE([HAVE_OPENGL_SHADER],1,[Have 2.0 shader support]) ], [])
191 AC_CHECK_FUNC(glCreateShaderObjectARB, [ AC_DEFINE([HAVE_OPENGL_SHADER_ARB],1,[Have ARB shader support]) ], [])
192 AC_CHECK_FUNC(glClampColorARB, [ AC_DEFINE([HAVE_OPENGL_CLAMP_COLOR],1,[Have Color Clamp]) ], [])
195 dnl ------------------- SH4 translator target -------------------
197 if test "x$enable_translator" != "xno"; then
199 i386|i486|i586|i686|x86_64)
201 AC_DEFINE_UNQUOTED(SH4_TRANSLATOR,[TARGET_X86], [SH4 Translator to use (if any)] );;
204 AM_CONDITIONAL(BUILD_SH4X86, [test "$SH4_TRANSLATOR" = "x86"])
206 dnl ------------------ Optional driver support -------------------
207 dnl Check for Apple CoreAudio
208 AC_CHECK_HEADER([CoreAudio/CoreAudio.h], [
210 LIBS="$LIBS -framework CoreAudio"
211 AUDIO_DRIVERS="$AUDIO_DRIVERS osx"
212 AC_DEFINE([HAVE_CORE_AUDIO], 1, [Have Apple CoreAudio support]) ],[true ])
213 AM_CONDITIONAL( AUDIO_OSX, [test "$HAVE_CORE_AUDIO" = 'yes'] )
215 dnl Check for pulseaudio
216 if test "x$with_pulse" != "xno"; then
217 PKG_CHECK_MODULES(PULSE, [libpulse-simple], [
219 AUDIO_DRIVERS="$AUDIO_DRIVERS pulse"
220 AC_DEFINE([HAVE_PULSE],1,[Have pulseaudio support])
222 if test "x$with_pulse" = "xyes"; then
223 AC_MSG_FAILURE( [PulseAudio audio package could not be found (but was required)] )
227 AM_CONDITIONAL( AUDIO_PULSE, [test "$HAVE_PULSE" = 'yes'] )
230 if test "x$with_esd" != "xno"; then
231 PKG_CHECK_MODULES(ESOUND, [esound], [
233 AUDIO_DRIVERS="$AUDIO_DRIVERS esd"
234 AC_DEFINE([HAVE_ESOUND],1,[Have esound support])
236 if test "x$with_esd" = "xyes"; then
237 AC_MSG_FAILURE( [ESounD audio package could not be found (but was required)] )
241 AM_CONDITIONAL( AUDIO_ESOUND, [test "$HAVE_ESOUND" = 'yes'] )
243 dnl Check for alsa support
244 PKG_CHECK_MODULES(ALSA, [alsa], [
246 AUDIO_DRIVERS="$AUDIO_DRIVERS alsa"
247 AC_DEFINE([HAVE_ALSA],1,[Have alsa support]) ], [true])
248 AM_CONDITIONAL( AUDIO_ALSA, [test "$HAVE_ALSA" = 'yes'] )
251 dnl Check for native cdrom support. There can be only one.
252 AC_CHECK_HEADER([linux/cdrom.h], [CDROM_DRIVER=linux], [true])
253 AC_CHECK_HEADER([IOKit/IOKitLib.h], [
255 LIBS="$LIBS -framework IOKit"],[true])
256 AM_CONDITIONAL(CDROM_LINUX, [test "x$CDROM_DRIVER" = "xlinux"])
257 AM_CONDITIONAL(CDROM_OSX, [test "x$CDROM_DRIVER" = "xosx"])
258 AM_CONDITIONAL(CDROM_NONE, [test "x$CDROM_DRIVER" = "x"])
260 AC_CHECK_HEADER([linux/joystick.h], [
261 HAVE_LINUX_JOYSTICK_H=yes
262 AC_DEFINE([HAVE_LINUX_JOYSTICK], 1, [Have linux joystick support]) ],
263 [ echo "Linux Joystick support not found, building without it."] )
264 AM_CONDITIONAL(JOY_LINUX, [test "$HAVE_LINUX_JOYSTICK_H" = "yes"])
266 dnl Check for cross-compiler availability - needed for system tests
267 AC_PATH_PROG(SHCC, [sh-elf-gcc])
268 AC_PATH_PROG(SHLD, [sh-elf-ld])
269 AC_PATH_PROG(SHOBJCOPY, [sh-elf-objcopy])
270 AC_PATH_PROG(ARMCC, [arm-elf-gcc])
271 AC_PATH_PROG(ARMLD, [arm-elf-ld])
272 AC_PATH_PROG(ARMOBJCOPY, [arm-elf-objcopy])
274 if test "x$SHCC" = "x" -o "x$SHLD" = "x" -o "x$SHOBJCOPY" = "x"; then
276 echo "Warning: SH4 cross-compiler not found, system tests will be disabled."
280 if test "x$ARMCC" = "x" -o "x$ARMLD" = "x" -o "x$ARMOBJCOPY" = "x"; then
282 echo "Warning: ARM cross-compiler not found, AICA tests will be disabled."
286 AM_CONDITIONAL(BUILD_SYSTEST, [test "$BUILD_SH" = "yes"])
287 AM_CONDITIONAL(BUILD_ARMTEST, [test "$BUILD_ARM" = "yes"])
290 dnl ----------------------- All done, finish up -----------------------
291 GETTEXT_PACKAGE=lxdream
292 AC_SUBST(GETTEXT_PACKAGE)
293 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[translation domain])
295 dnl Add the languages which your application supports here.
296 ALL_LINGUAS="de es it pt_BR"
308 dnl ------------------------- Print out a summary ----------------------
311 echo "Configuration complete"
314 if test "x$HAVE_GTK" = x; then
315 if test "x$HAVE_COCOA" = x; then
316 echo " User interface: none"
318 echo " User interface: Cocoa"
321 echo " User interface: GTK"
324 if test "x$SH4_TRANSLATOR" = "x"; then
325 echo " SH4 translator: None (emulation core only)"
327 echo " SH4 translator: $SH4_TRANSLATOR"
330 if test "x$VIDEO_DRIVERS" = "x"; then
331 echo " Video drivers: none (no supported GL found)"
333 echo " Video drivers: $VIDEO_DRIVERS"
336 if test "x$AUDIO_DRIVERS" = "x"; then
337 echo " Audio drivers: none (no supported output devices found)"
339 echo " Audio drivers: $AUDIO_DRIVERS"
342 if test "x$CDROM_DRIVER" = "x"; then
343 echo " CD-ROM driver: none (no supported cd-rom devices found)"
345 echo " CD-ROM driver: $CDROM_DRIVER"
.