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 (implies disable-optimized)]),
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_profiled" = "xyes"; then
64 CFLAGS="-g -pg -fprofile-arcs"
65 LDFLAGS="$LDFLAGS -pg";
66 elif test "x$enable_optimized" = "xyes"; then
67 CFLAGS="-g -O2 -fexceptions -fomit-frame-pointer"
68 AC_DEFINE(HAVE_EXCEPTIONS, [1], [Have exception stack-frame information])
69 AC_DEFINE(HAVE_FASTCALL, [1], [Use fast register-passing calling conventions])
74 if test "x$GCC" = "xyes"; then
75 CFLAGS="$CFLAGS -fno-strict-aliasing"
79 dnl ------------ Check if we're building on Darwin --------------
81 dnl For starters, do we have a working objective-c compiler?
82 lxdream_save_cppflags="$CPPFLAGS"
83 CPPFLAGS="$CPPFLAGS -x objective-c"
84 AC_TRY_COMPILE([@interface Foo @end],, [
86 AC_CHECK_HEADER([Cocoa/Cocoa.h], [
89 LIBS="$LIBS -framework AppKit"
90 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"
91 CPPFLAGS="$CPPFLAGS -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_4 -mdynamic-no-pic"
92 LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"
93 AC_DEFINE(HAVE_COCOA,[1],[Have Cocoa framework])
94 AC_DEFINE(APPLE_BUILD,[1],[Building on an apple platform. Things are different...])
95 if test "x$with_gtk" = "xx11"; then
100 ], [CPPFLAGS="$lxdream_save_cppflags"] )
101 AM_CONDITIONAL(GUI_COCOA, [test "$HAVE_COCOA" = 'yes' -a "$with_gtk" = "no"])
102 if test "x$HAVE_COCOA" = 'xyes' -a "x$with_gtk" = "xno"; then
103 AC_DEFINE(OSX_BUNDLE, [1], [Generating a bundled application])
106 dnl ----------- Check for mandatory dependencies --------------
107 dnl Check for libpng (required)
108 PKG_CHECK_MODULES(LIBPNG, [libpng] )
110 dnl Implied by libpng, but check explicitly just in case
111 AC_CHECK_LIB(z, uncompress, [], [
112 echo "Zlib (libz.so) could not be found, but is required."
115 if test "x$with_gtk" = "xno"; then
116 dnl Check for GLIB only
117 PKG_CHECK_MODULES(GLIB, glib-2.0)
120 PKG_CHECK_MODULES(GTK, gtk+-2.0, [
122 AC_DEFINE([HAVE_GTK],1,[Have GTK libraries])
125 dnl Which GTK port do we have?
126 LIBS="$LIBS $GTK_LIBS"
127 AC_CHECK_FUNC(gdk_x11_display_get_xdisplay, [
129 AC_DEFINE([HAVE_GTK_X11],1,[Building with GTK+X11]) ], [])
130 AC_CHECK_FUNC(gdk_quartz_window_get_nsview, [
132 AC_DEFINE([HAVE_GTK_OSX],1,[Building with GTK+Cocoa]) ], [])
135 AM_CONDITIONAL(GUI_GTK, [test "$HAVE_GTK" = 'yes'])
137 dnl ------------------ Video driver support -------------------
138 AS_IF([test "x$with_osmesa" != xno], [
140 dnl User requested OSMesa (ie pure software rendering)
141 AC_CHECK_LIB([OSMesa], [OSMesaCreateContext], [],
142 [AC_MSG_FAILURE( [--with-osmesa was given, but OSMesa library could not be found])])
143 AC_CHECK_HEADER([GL/osmesa.h], [],
144 [AC_MSG_FAILURE( [--with-osmesa was given, but osmesa.h could not be found])])
146 VIDEO_DRIVERS="$VIDEO_DRIVERS osmesa"
147 AC_DEFINE([HAVE_OSMESA],1,[Building with the OSMesa video driver]) ], [
149 dnl Otherwise we want a real GL library (unless we're on darwin, in which case it's already
150 dnl taken care of above).
151 if test "x$APPLE_BUILD" != 'xyes'; then
152 AC_CHECK_LIB(GL, glVertex3f, [], [
153 AC_MSG_FAILURE( ["The OpenGL library (libGL.so) could not be found, but is required."])])
154 AC_CHECK_HEADER([GL/gl.h], [], [
155 AC_MSG_FAILURE( ["The OpenGL header files (eg GL/gl.h) could not be found, but are required."])])
157 AC_CHECK_FUNC(NSOpenGLGetVersion, [
159 VIDEO_DRIVERS="$VIDEO_DRIVERS nsgl"
160 AC_DEFINE([HAVE_NSGL],1, [Have NSOpenGL support]) ] )
163 dnl Now work out how to get from the UI to GL - this is usually the painful part.
164 if test "x$HAVE_GTK_X11" = "xyes"; then
165 if test "x$APPLE_BUILD" = "xyes"; then
166 LIBS="$LIBS -L/usr/X11/lib -lGL"
168 AC_CHECK_FUNC(glXQueryVersion, [
170 VIDEO_DRIVERS="$VIDEO_DRIVERS glx"
171 AC_DEFINE([HAVE_GLX], 1, [Have GLX support]) ] )
178 AM_CONDITIONAL(VIDEO_OSMESA, [test "x$HAVE_OSMESA" = "xyes"])
179 AM_CONDITIONAL(VIDEO_GLX, [test "x$HAVE_GLX" = "xyes"])
180 AM_CONDITIONAL(VIDEO_NSGL, [test "x$HAVE_NSGL" = "xyes"])
182 dnl Check for optional (but highly desireable) OpenGL features
183 AC_CHECK_FUNC(glGenFramebuffersEXT, [ AC_DEFINE([HAVE_OPENGL_FBO],1,[Have EXT_framebuffer_object support]) ], [])
184 AC_CHECK_FUNC(glCreateShader, [ AC_DEFINE([HAVE_OPENGL_SHADER],1,[Have 2.0 shader support]) ], [])
185 AC_CHECK_FUNC(glCreateShaderObjectARB, [ AC_DEFINE([HAVE_OPENGL_SHADER_ARB],1,[Have ARB shader support]) ], [])
186 AC_CHECK_FUNC(glClampColorARB, [ AC_DEFINE([HAVE_OPENGL_CLAMP_COLOR],1,[Have Color Clamp]) ], [])
189 dnl ------------------- SH4 translator target -------------------
191 if test "x$enable_translator" != "xno"; then
193 i386|i486|i586|i686|x86_64)
195 AC_DEFINE_UNQUOTED(SH4_TRANSLATOR,[TARGET_X86], [SH4 Translator to use (if any)] );;
198 AM_CONDITIONAL(BUILD_SH4X86, [test "$SH4_TRANSLATOR" = "x86"])
200 dnl ------------------ Optional driver support -------------------
201 dnl Check for Apple CoreAudio
202 AC_CHECK_HEADER([CoreAudio/CoreAudio.h], [
204 LIBS="$LIBS -framework CoreAudio"
205 AUDIO_DRIVERS="$AUDIO_DRIVERS osx"
206 AC_DEFINE([HAVE_CORE_AUDIO], 1, [Have Apple CoreAudio support]) ],[true ])
207 AM_CONDITIONAL( AUDIO_OSX, [test "$HAVE_CORE_AUDIO" = 'yes'] )
209 dnl Check for pulseaudio
210 if test "x$with_pulse" != "xno"; then
211 PKG_CHECK_MODULES(PULSE, [libpulse-simple], [
213 AUDIO_DRIVERS="$AUDIO_DRIVERS pulse"
214 AC_DEFINE([HAVE_PULSE],1,[Have pulseaudio support])
216 if test "x$with_pulse" = "xyes"; then
217 AC_MSG_FAILURE( [PulseAudio audio package could not be found (but was required)] )
221 AM_CONDITIONAL( AUDIO_PULSE, [test "$HAVE_PULSE" = 'yes'] )
224 if test "x$with_esd" != "xno"; then
225 PKG_CHECK_MODULES(ESOUND, [esound], [
227 AUDIO_DRIVERS="$AUDIO_DRIVERS esd"
228 AC_DEFINE([HAVE_ESOUND],1,[Have esound support])
230 if test "x$with_esd" = "xyes"; then
231 AC_MSG_FAILURE( [ESounD audio package could not be found (but was required)] )
235 AM_CONDITIONAL( AUDIO_ESOUND, [test "$HAVE_ESOUND" = 'yes'] )
237 dnl Check for alsa support
238 PKG_CHECK_MODULES(ALSA, [alsa], [
240 AUDIO_DRIVERS="$AUDIO_DRIVERS alsa"
241 AC_DEFINE([HAVE_ALSA],1,[Have alsa support]) ], [true])
242 AM_CONDITIONAL( AUDIO_ALSA, [test "$HAVE_ALSA" = 'yes'] )
245 dnl Check for native cdrom support. There can be only one.
246 AC_CHECK_HEADER([linux/cdrom.h], [CDROM_DRIVER=linux], [true])
247 AC_CHECK_HEADER([IOKit/IOKitLib.h], [
249 LIBS="$LIBS -framework IOKit"],[true])
250 AM_CONDITIONAL(CDROM_LINUX, [test "x$CDROM_DRIVER" = "xlinux"])
251 AM_CONDITIONAL(CDROM_OSX, [test "x$CDROM_DRIVER" = "xosx"])
252 AM_CONDITIONAL(CDROM_NONE, [test "x$CDROM_DRIVER" = "x"])
254 AC_CHECK_HEADER([linux/joystick.h], [
255 HAVE_LINUX_JOYSTICK_H=yes
256 AC_DEFINE([HAVE_LINUX_JOYSTICK], 1, [Have linux joystick support]) ],
257 [ echo "Linux Joystick support not found, building without it."] )
258 AM_CONDITIONAL(JOY_LINUX, [test "$HAVE_LINUX_JOYSTICK_H" = "yes"])
260 dnl Check for cross-compiler availability - needed for system tests
261 AC_PATH_PROG(SHCC, [sh-elf-gcc])
262 AC_PATH_PROG(SHLD, [sh-elf-ld])
263 AC_PATH_PROG(SHOBJCOPY, [sh-elf-objcopy])
264 AC_PATH_PROG(ARMCC, [arm-elf-gcc])
265 AC_PATH_PROG(ARMLD, [arm-elf-ld])
266 AC_PATH_PROG(ARMOBJCOPY, [arm-elf-objcopy])
268 if test "x$SHCC" = "x" -o "x$SHLD" = "x" -o "x$SHOBJCOPY" = "x"; then
270 echo "Warning: SH4 cross-compiler not found, system tests will be disabled."
274 if test "x$ARMCC" = "x" -o "x$ARMLD" = "x" -o "x$ARMOBJCOPY" = "x"; then
276 echo "Warning: ARM cross-compiler not found, AICA tests will be disabled."
280 AM_CONDITIONAL(BUILD_SYSTEST, [test "$BUILD_SH" = "yes"])
281 AM_CONDITIONAL(BUILD_ARMTEST, [test "$BUILD_ARM" = "yes"])
284 dnl ----------------------- All done, finish up -----------------------
285 GETTEXT_PACKAGE=lxdream
286 AC_SUBST(GETTEXT_PACKAGE)
287 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[translation domain])
289 dnl Add the languages which your application supports here.
290 ALL_LINGUAS="de es it pt_BR"
302 dnl ------------------------- Print out a summary ----------------------
305 echo "Configuration complete"
308 if test "x$HAVE_GTK" = x; then
309 if test "x$HAVE_COCOA" = x; then
310 echo " User interface: none"
312 echo " User interface: Cocoa"
315 echo " User interface: GTK"
318 if test "x$SH4_TRANSLATOR" = "x"; then
319 echo " SH4 translator: None (emulation core only)"
321 echo " SH4 translator: $SH4_TRANSLATOR"
324 if test "x$VIDEO_DRIVERS" = "x"; then
325 echo " Video drivers: none (no supported GL found)"
327 echo " Video drivers: $VIDEO_DRIVERS"
330 if test "x$AUDIO_DRIVERS" = "x"; then
331 echo " Audio drivers: none (no supported output devices found)"
333 echo " Audio drivers: $AUDIO_DRIVERS"
336 if test "x$CDROM_DRIVER" = "x"; then
337 echo " CD-ROM driver: none (no supported cd-rom devices found)"
339 echo " CD-ROM driver: $CDROM_DRIVER"
.