Search
lxdream.org :: lxdream/configure.in
lxdream 0.9.1
released Jun 29
Download Now
filename configure.in
changeset 913:edc494bde24b
prev909:b4a21af8ce8c
next923:13ac59a786f4
author nkeynes
date Fri Nov 07 07:53:31 2008 +0000 (15 years ago)
permissions -rw-r--r--
last change Fix "0" being confused with "not defined"
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]),
    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_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])
    69    fi
    70    AC_DEFINE(HAVE_FASTCALL, [1], [Use fast register-passing calling conventions])
    71 else 
    72    CFLAGS="-g3"
    73 fi
    75 if test "x$enable_profiled" = "xyes"; then
    76    CFLAGS="$CFLAGS -pg"
    77    LDFLAGS="$LDFLAGS -pg";
    78 fi
    80 if test "x$GCC" = "xyes"; then
    81    CFLAGS="$CFLAGS -fno-strict-aliasing"
    82 fi
    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], [
    93       HAVE_COCOA='yes'
    94       APPLE_BUILD='yes'
    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
   102         with_gtk=no
   103       fi
   104    ])
   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])
   110 fi
   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."
   119     exit 1])
   121 if test "x$with_gtk" = "xno"; then
   122    dnl Check for GLIB only
   123    PKG_CHECK_MODULES(GLIB, glib-2.0)
   124 else
   125    dnl Check for GTK
   126    PKG_CHECK_MODULES(GTK, gtk+-2.0, [
   127        HAVE_GTK='yes'
   128        AC_DEFINE([HAVE_GTK],1,[Have GTK libraries])
   129    ])
   131    dnl Which GTK port do we have?
   132    LIBS="$LIBS $GTK_LIBS"
   133    AC_CHECK_FUNC(gdk_x11_display_get_xdisplay, [ 
   134       HAVE_GTK_X11='yes'
   135       AC_DEFINE([HAVE_GTK_X11],1,[Building with GTK+X11]) ], [])
   136    AC_CHECK_FUNC(gdk_quartz_window_get_nsview, [ 
   137       HAVE_GTK_OSX='yes'
   138       AC_DEFINE([HAVE_GTK_OSX],1,[Building with GTK+Cocoa]) ], [])
   139 fi
   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])])
   151   HAVE_OSMESA='yes'
   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."])])
   162    else
   163       AC_CHECK_FUNC(NSOpenGLGetVersion, [
   164          HAVE_NSGL='yes'
   165          VIDEO_DRIVERS="$VIDEO_DRIVERS nsgl"
   166          AC_DEFINE([HAVE_NSGL],1, [Have NSOpenGL support]) ] )
   167    fi
   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"
   173       fi
   174       AC_CHECK_FUNC(glXQueryVersion, [
   175          HAVE_GLX='yes'
   176          VIDEO_DRIVERS="$VIDEO_DRIVERS glx"
   177          AC_DEFINE([HAVE_GLX], 1, [Have GLX support]) ] )
   178    fi
   180 ])
   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
   198     case $host_cpu in
   199         i386|i486|i586|i686|x86_64)
   200 	    SH4_TRANSLATOR="x86"
   201             AC_DEFINE_UNQUOTED(SH4_TRANSLATOR,[TARGET_X86], [SH4 Translator to use (if any)] );;
   202     esac
   203 fi
   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], [
   209      HAVE_CORE_AUDIO=yes
   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], [
   218        HAVE_PULSE='yes'
   219        AUDIO_DRIVERS="$AUDIO_DRIVERS pulse"
   220        AC_DEFINE([HAVE_PULSE],1,[Have pulseaudio support]) 
   221    ], [
   222        if test "x$with_pulse" = "xyes"; then
   223           AC_MSG_FAILURE( [PulseAudio audio package could not be found (but was required)] )
   224        fi
   225    ])
   226 fi
   227 AM_CONDITIONAL( AUDIO_PULSE, [test "$HAVE_PULSE" = 'yes'] )
   229 dnl Check for esound
   230 if test "x$with_esd" != "xno"; then
   231    PKG_CHECK_MODULES(ESOUND, [esound], [ 
   232        HAVE_ESOUND='yes'
   233        AUDIO_DRIVERS="$AUDIO_DRIVERS esd"
   234        AC_DEFINE([HAVE_ESOUND],1,[Have esound support]) 
   235    ], [
   236        if test "x$with_esd" = "xyes"; then
   237           AC_MSG_FAILURE( [ESounD audio package could not be found (but was required)] )
   238        fi
   239    ])
   240 fi
   241 AM_CONDITIONAL( AUDIO_ESOUND, [test "$HAVE_ESOUND" = 'yes'] )
   243 dnl Check for alsa support
   244 PKG_CHECK_MODULES(ALSA, [alsa], [ 
   245      HAVE_ALSA='yes'
   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], [
   254      CDROM_DRIVER=osx
   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
   275   BUILD_SH="no"
   276   echo "Warning: SH4 cross-compiler not found, system tests will be disabled."
   277 else
   278   BUILD_SH="yes"
   279 fi
   280 if test "x$ARMCC" = "x" -o "x$ARMLD" = "x" -o "x$ARMOBJCOPY" = "x"; then
   281   BUILD_ARM="no"
   282   echo "Warning: ARM cross-compiler not found, AICA tests will be disabled."
   283 else
   284   BUILD_ARM="yes"
   285 fi
   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"
   297 AM_GLIB_GNU_GETTEXT
   299 AC_OUTPUT([
   300 Makefile
   301 src/Makefile
   302 po/Makefile.in
   303 test/Makefile
   304 Info.plist
   305 ])
   306 AS_MKDIR_P(test/sh4)
   308 dnl ------------------------- Print out a summary ----------------------
   310 echo
   311 echo "Configuration complete"
   312 echo
   314 if test "x$HAVE_GTK" = x; then
   315   if test "x$HAVE_COCOA" = x; then
   316      echo "  User interface: none"
   317   else
   318      echo "  User interface: Cocoa"
   319   fi
   320 else
   321   echo "  User interface: GTK"
   322 fi
   324 if test "x$SH4_TRANSLATOR" = "x"; then
   325   echo "  SH4 translator: None (emulation core only)"
   326 else
   327   echo "  SH4 translator: $SH4_TRANSLATOR"
   328 fi
   330 if test "x$VIDEO_DRIVERS" = "x"; then
   331    echo "  Video drivers: none (no supported GL found)"
   332 else
   333    echo "  Video drivers: $VIDEO_DRIVERS"
   334 fi
   336 if test "x$AUDIO_DRIVERS" = "x"; then
   337    echo "  Audio drivers: none (no supported output devices found)"
   338 else
   339    echo "  Audio drivers: $AUDIO_DRIVERS"
   340 fi
   342 if test "x$CDROM_DRIVER" = "x"; then
   343    echo "  CD-ROM driver: none (no supported cd-rom devices found)"
   344 else
   345    echo "  CD-ROM driver: $CDROM_DRIVER"
   346 fi
.