Search
lxdream.org :: lxdream/configure.in
lxdream 0.9.1
released Jun 29
Download Now
filename configure.in
changeset 909:b4a21af8ce8c
prev906:268ea359f884
next913:edc494bde24b
author nkeynes
date Thu Oct 30 23:56:59 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Add --enable-profiled configure option for convenience (and enable fastcall only on fully optimized builds)
view annotate diff log raw
     1 dnl Process this file with autoconf to produce a configure script.
     3 AC_INIT(configure.in)
     4 AM_INIT_AUTOMAKE(lxdream, 0.9)
     5 AM_MAINTAINER_MODE
     6 AM_CONFIG_HEADER(config.h)
     8 AC_ISC_POSIX
     9 AC_PROG_CC
    10 AM_PROG_CC_STDC
    11 AM_PROG_AS
    12 AC_CHECK_SIZEOF([void *])
    13 AC_HEADER_STDC
    14 AC_CANONICAL_BUILD
    15 AC_CANONICAL_HOST
    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
    34       enable_profiled=yes;
    35     fi] )
    36 AC_ARG_ENABLE( trace, 
    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])
    40     fi] )
    41 AC_ARG_ENABLE( watch,
    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])
    45    fi] )
    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])
    50     fi] )
    51 AC_ARG_WITH( osmesa,
    52    AS_HELP_STRING( [--with-osmesa], [Build with the osmesa GL library (software rendering)]),
    53    [], [with_osmesa=no])
    54 AC_ARG_WITH( gtk,
    55    AS_HELP_STRING( [--with-gtk], [Build with the GTK UI. Default on X11 systems]), [with_gtk=yes], [with_gtk=x11] )
    56 AC_ARG_WITH( esd,
    57    AS_HELP_STRING( [--with-esd], [Build with support for the ESounD audio system]) )
    58 AC_ARG_WITH( pulse,
    59    AS_HELP_STRING( [--with-pulse], [Build with support for the PulseAudio audio system]) )
    61 dnl ------------ 
    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])
    70 else 
    71    CFLAGS="-g3"
    72 fi
    74 if test "x$GCC" = "xyes"; then
    75    CFLAGS="$CFLAGS -fno-strict-aliasing"
    76 fi
    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], [
    87       HAVE_COCOA='yes'
    88       APPLE_BUILD='yes'
    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
    96         with_gtk=no
    97       fi
    98    ])
   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])
   104 fi
   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."
   113     exit 1])
   115 if test "x$with_gtk" = "xno"; then
   116    dnl Check for GLIB only
   117    PKG_CHECK_MODULES(GLIB, glib-2.0)
   118 else
   119    dnl Check for GTK
   120    PKG_CHECK_MODULES(GTK, gtk+-2.0, [
   121        HAVE_GTK='yes'
   122        AC_DEFINE([HAVE_GTK],1,[Have GTK libraries])
   123    ])
   125    dnl Which GTK port do we have?
   126    LIBS="$LIBS $GTK_LIBS"
   127    AC_CHECK_FUNC(gdk_x11_display_get_xdisplay, [ 
   128       HAVE_GTK_X11='yes'
   129       AC_DEFINE([HAVE_GTK_X11],1,[Building with GTK+X11]) ], [])
   130    AC_CHECK_FUNC(gdk_quartz_window_get_nsview, [ 
   131       HAVE_GTK_OSX='yes'
   132       AC_DEFINE([HAVE_GTK_OSX],1,[Building with GTK+Cocoa]) ], [])
   133 fi
   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])])
   145   HAVE_OSMESA='yes'
   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."])])
   156    else
   157       AC_CHECK_FUNC(NSOpenGLGetVersion, [
   158          HAVE_NSGL='yes'
   159          VIDEO_DRIVERS="$VIDEO_DRIVERS nsgl"
   160          AC_DEFINE([HAVE_NSGL],1, [Have NSOpenGL support]) ] )
   161    fi
   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"
   167       fi
   168       AC_CHECK_FUNC(glXQueryVersion, [
   169          HAVE_GLX='yes'
   170          VIDEO_DRIVERS="$VIDEO_DRIVERS glx"
   171          AC_DEFINE([HAVE_GLX], 1, [Have GLX support]) ] )
   172    fi
   174 ])
   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
   192     case $host_cpu in
   193         i386|i486|i586|i686|x86_64)
   194 	    SH4_TRANSLATOR="x86"
   195             AC_DEFINE_UNQUOTED(SH4_TRANSLATOR,[TARGET_X86], [SH4 Translator to use (if any)] );;
   196     esac
   197 fi
   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], [
   203      HAVE_CORE_AUDIO=yes
   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], [
   212        HAVE_PULSE='yes'
   213        AUDIO_DRIVERS="$AUDIO_DRIVERS pulse"
   214        AC_DEFINE([HAVE_PULSE],1,[Have pulseaudio support]) 
   215    ], [
   216        if test "x$with_pulse" = "xyes"; then
   217           AC_MSG_FAILURE( [PulseAudio audio package could not be found (but was required)] )
   218        fi
   219    ])
   220 fi
   221 AM_CONDITIONAL( AUDIO_PULSE, [test "$HAVE_PULSE" = 'yes'] )
   223 dnl Check for esound
   224 if test "x$with_esd" != "xno"; then
   225    PKG_CHECK_MODULES(ESOUND, [esound], [ 
   226        HAVE_ESOUND='yes'
   227        AUDIO_DRIVERS="$AUDIO_DRIVERS esd"
   228        AC_DEFINE([HAVE_ESOUND],1,[Have esound support]) 
   229    ], [
   230        if test "x$with_esd" = "xyes"; then
   231           AC_MSG_FAILURE( [ESounD audio package could not be found (but was required)] )
   232        fi
   233    ])
   234 fi
   235 AM_CONDITIONAL( AUDIO_ESOUND, [test "$HAVE_ESOUND" = 'yes'] )
   237 dnl Check for alsa support
   238 PKG_CHECK_MODULES(ALSA, [alsa], [ 
   239      HAVE_ALSA='yes'
   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], [
   248      CDROM_DRIVER=osx
   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
   269   BUILD_SH="no"
   270   echo "Warning: SH4 cross-compiler not found, system tests will be disabled."
   271 else
   272   BUILD_SH="yes"
   273 fi
   274 if test "x$ARMCC" = "x" -o "x$ARMLD" = "x" -o "x$ARMOBJCOPY" = "x"; then
   275   BUILD_ARM="no"
   276   echo "Warning: ARM cross-compiler not found, AICA tests will be disabled."
   277 else
   278   BUILD_ARM="yes"
   279 fi
   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"
   291 AM_GLIB_GNU_GETTEXT
   293 AC_OUTPUT([
   294 Makefile
   295 src/Makefile
   296 po/Makefile.in
   297 test/Makefile
   298 Info.plist
   299 ])
   300 AS_MKDIR_P(test/sh4)
   302 dnl ------------------------- Print out a summary ----------------------
   304 echo
   305 echo "Configuration complete"
   306 echo
   308 if test "x$HAVE_GTK" = x; then
   309   if test "x$HAVE_COCOA" = x; then
   310      echo "  User interface: none"
   311   else
   312      echo "  User interface: Cocoa"
   313   fi
   314 else
   315   echo "  User interface: GTK"
   316 fi
   318 if test "x$SH4_TRANSLATOR" = "x"; then
   319   echo "  SH4 translator: None (emulation core only)"
   320 else
   321   echo "  SH4 translator: $SH4_TRANSLATOR"
   322 fi
   324 if test "x$VIDEO_DRIVERS" = "x"; then
   325    echo "  Video drivers: none (no supported GL found)"
   326 else
   327    echo "  Video drivers: $VIDEO_DRIVERS"
   328 fi
   330 if test "x$AUDIO_DRIVERS" = "x"; then
   331    echo "  Audio drivers: none (no supported output devices found)"
   332 else
   333    echo "  Audio drivers: $AUDIO_DRIVERS"
   334 fi
   336 if test "x$CDROM_DRIVER" = "x"; then
   337    echo "  CD-ROM driver: none (no supported cd-rom devices found)"
   338 else
   339    echo "  CD-ROM driver: $CDROM_DRIVER"
   340 fi
.