Search
lxdream.org :: lxdream/configure.in
lxdream 0.9.1
released Jun 29
Download Now
filename configure.in
changeset 964:f2f3c7612d06
prev927:17b6b9e245d8
next966:0f0320cb3650
author nkeynes
date Thu Jan 15 04:15:11 2009 +0000 (15 years ago)
permissions -rw-r--r--
last change Add support for the Intel ICC compiler (C only, icc doesn't support Obj-C)
- Rename Obj-C source to .m
- Separate paths.c into paths_unix.c and paths_osx.m
- Add configuration detection of ICC, along with specific opt flags
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 AC_PROG_OBJC
    12 AC_PROG_SED
    13 AM_PROG_AS
    14 AC_CHECK_SIZEOF([void *])
    15 AC_HEADER_STDC
    16 AC_CANONICAL_BUILD
    17 AC_CANONICAL_HOST
    19 _AM_DEPENDENCIES([OBJC])
    21 AC_PATH_PROG(POD2MAN, [pod2man])
    22 AC_PATH_PROG(POD2HTML, [pod2html])
    24 dnl ---------------- enable/with flags ------------------
    26 AC_ARG_ENABLE( strict-warn,
    27    AS_HELP_STRING( [--enable-strict-warn], [Enable strict compilation warnings]),
    28    [CFLAGS="$CFLAGS -Werror -Wall -Wno-unused"], [])
    29 AC_ARG_ENABLE( translator, 
    30    AS_HELP_STRING( [--disable-translator], [Disable the SH4 translator (Enabled by default)]),
    31    [true], [enable_translator=yes] )
    32 AC_ARG_ENABLE( optimized,
    33    AS_HELP_STRING( [--disable-optimized], [Disable compile-time optimizations (Enabled by default)]),
    34    [true], [enable_optimized=yes] )
    35 AC_ARG_ENABLE( profiled,
    36    AS_HELP_STRING( [--enable-profiled], [Enable profiling build]),
    37    [if test "$enableval" == "yes"; then
    38       enable_profiled=yes;
    39     fi] )
    40 AC_ARG_ENABLE( trace, 
    41    AS_HELP_STRING( [--enable-trace], [Enable generation of IO traces (warning: hurts performance)]),
    42    [if test "$enableval" == "yes"; then
    43      AC_DEFINE(ENABLE_TRACE_IO, 1, [Enable IO tracing])
    44     fi] )
    45 AC_ARG_ENABLE( watch,
    46    AS_HELP_STRING( [--enable-watch], [Enable watchpoints in the debugger (warning: hurts performance)]),
    47    [if test "$enableval" == "yes"; then
    48      AC_DEFINE(ENABLE_WATCH, 1, [Enable watchpoints])
    49    fi] )
    50 AC_ARG_ENABLE( sh4stats,
    51    AS_HELP_STRING( [--enable-sh4stats], [Enable statistics on executed sh4 instructions]),
    52    [if test "$enableval" == "yes"; then
    53      AC_DEFINE(ENABLE_SH4STATS, 1, [Enable SH4 statistics])
    54     fi] )
    55 AC_ARG_WITH( osmesa,
    56    AS_HELP_STRING( [--with-osmesa], [Build with the osmesa GL library (software rendering)]),
    57    [], [with_osmesa=no])
    58 AC_ARG_WITH( gtk,
    59    AS_HELP_STRING( [--with-gtk], [Build with the GTK UI. Default on X11 systems]), [with_gtk=yes], [with_gtk=x11] )
    60 AC_ARG_WITH( esd,
    61    AS_HELP_STRING( [--with-esd], [Build with support for the ESounD audio system]) )
    62 AC_ARG_WITH( pulse,
    63    AS_HELP_STRING( [--with-pulse], [Build with support for the PulseAudio audio system]) )
    65 dnl ------------------ Compiler flags -----------------------
    66 CFLAGS="-g -fexceptions"
    67 OBJCFLAGS="-g -fexceptions"
    68 AC_DEFINE(HAVE_EXCEPTIONS, [1], [Have exception stack-frame information])
    70 AC_CC_VERSION([ CCOPT="-O2 -msse2 -mfpmath=sse" 
    71                 CFLAGS="$CFLAGS -fno-strict-aliasing" ],
    72               [ CCOPT="$CFLAGS -fast" ],
    73               [ CCOPT="$CFLAGS -O2" ])
    74 AC_OBJC_VERSION([ OBJCOPT="-O2 -msse2 -mfpmath=sse"
    75                   OBJCFLAGS="$OBJCFLAGS -fno-strict-aliasing" ],
    76                 [ OBJCOPT="-O2" ], [] )
    78 if test "x$enable_optimized" = "xyes"; then
    79    CFLAGS="$CFLAGS $CCOPT"
    80    OBJCFLAGS="$OBJCFLAGS $CCOPT"
    81    if test "x$enable_profiled" != "xyes"; then
    82        dnl -fomit-frame-pointer can't be used with -pg
    83        CFLAGS="$CFLAGS -fomit-frame-pointer"
    84    fi
    85 else
    86    CFLAGS="$CFLAGS -g3"
    87    OBJCFLAGS="$OBJCFLAGS -g3"
    88 fi
    90 if test "x$enable_profiled" = "xyes"; then
    91    CFLAGS="$CFLAGS -pg"
    92    LDFLAGS="$LDFLAGS -pg";
    93    OBJCFLAGS="$OBJCFLAGS -pg";
    94 fi
    96 AC_CHECK_FASTCALL([
    97    AC_DEFINE(HAVE_FASTCALL, [1], [Use fast register-passing calling conventions])
    98 ])
    99 AC_CHECK_FRAME_ADDRESS( [
   100    AC_DEFINE(HAVE_FRAME_ADDRESS, [1], [Define if we have a working builtin frame_address])
   101 ], [ AC_MSG_WARN([Memory exceptions will be slow]) ])
   104 dnl ------------ Check if we're building on Darwin --------------
   106 dnl For starters, do we have a working objective-c compiler?
   107 AC_LANG_OBJC
   109 AC_CHECK_HEADER([Cocoa/Cocoa.h], [
   110       HAVE_COCOA='yes'
   111       APPLE_BUILD='yes'
   112       LIBS="$LIBS -framework AppKit"
   113       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"
   114       CPPFLAGS="$CPPFLAGS -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_4 -mdynamic-no-pic"
   115       LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"
   116       AC_DEFINE(HAVE_COCOA,[1],[Have Cocoa framework])
   117       AC_DEFINE(APPLE_BUILD,[1],[Building on an apple platform. Things are different...])
   118       if test "x$with_gtk" = "xx11"; then
   119         with_gtk=no
   120       fi
   121 ])
   123 AM_CONDITIONAL(GUI_COCOA, [test "$HAVE_COCOA" = 'yes' -a "$with_gtk" = "no"])
   124 if test "x$HAVE_COCOA" = 'xyes' -a "x$with_gtk" = "xno"; then
   125   AC_DEFINE(OSX_BUNDLE, [1], [Generating a bundled application])
   126 fi
   128 AC_LANG_C
   130 dnl ----------- Check for mandatory dependencies --------------
   131 dnl Check for libpng (required)
   132 PKG_CHECK_MODULES(LIBPNG, [libpng] )
   134 dnl Implied by libpng, but check explicitly just in case
   135 AC_CHECK_LIB(z, uncompress, [], [
   136     echo "Zlib (libz.so) could not be found, but is required."
   137     exit 1])
   139 if test "x$with_gtk" = "xno"; then
   140    dnl Check for GLIB only
   141    PKG_CHECK_MODULES(GLIB, glib-2.0)
   142 else
   143    dnl Check for GTK
   144    PKG_CHECK_MODULES(GTK, gtk+-2.0, [
   145        HAVE_GTK='yes'
   146        AC_DEFINE([HAVE_GTK],1,[Have GTK libraries])
   147    ])
   149    dnl Which GTK port do we have?
   150    LIBS="$LIBS $GTK_LIBS"
   151    AC_CHECK_FUNC(gdk_x11_display_get_xdisplay, [ 
   152       HAVE_GTK_X11='yes'
   153       AC_DEFINE([HAVE_GTK_X11],1,[Building with GTK+X11]) ], [])
   154    AC_CHECK_FUNC(gdk_quartz_window_get_nsview, [ 
   155       HAVE_GTK_OSX='yes'
   156       AC_DEFINE([HAVE_GTK_OSX],1,[Building with GTK+Cocoa]) ], [])
   157 fi
   159 AM_CONDITIONAL(GUI_GTK, [test "$HAVE_GTK" = 'yes'])
   161 dnl ------------------ Video driver support -------------------
   162 AS_IF([test "x$with_osmesa" != xno], [ 
   164 dnl User requested OSMesa (ie pure software rendering)
   165   AC_CHECK_LIB([OSMesa], [OSMesaCreateContext], [],
   166     [AC_MSG_FAILURE( [--with-osmesa was given, but OSMesa library could not be found])])
   167   AC_CHECK_HEADER([GL/osmesa.h], [],
   168     [AC_MSG_FAILURE( [--with-osmesa was given, but osmesa.h could not be found])])
   169   HAVE_OSMESA='yes'
   170   VIDEO_DRIVERS="$VIDEO_DRIVERS osmesa"
   171   AC_DEFINE([HAVE_OSMESA],1,[Building with the OSMesa video driver]) ], [
   173 dnl Otherwise we want a real GL library (unless we're on darwin, in which case it's already
   174 dnl taken care of above).
   175    if test "x$APPLE_BUILD" != 'xyes'; then
   176       AC_CHECK_LIB(GL, glVertex3f, [], [
   177           AC_MSG_FAILURE( ["The OpenGL library (libGL.so) could not be found, but is required."])])
   178       AC_CHECK_HEADER([GL/gl.h], [], [
   179           AC_MSG_FAILURE( ["The OpenGL header files (eg GL/gl.h) could not be found, but are required."])])
   180    else
   181       AC_CHECK_FUNC(NSOpenGLGetVersion, [
   182          HAVE_NSGL='yes'
   183          VIDEO_DRIVERS="$VIDEO_DRIVERS nsgl"
   184          AC_DEFINE([HAVE_NSGL],1, [Have NSOpenGL support]) ] )
   185    fi
   187 dnl Now work out how to get from the UI to GL - this is usually the painful part.
   188    if test "x$HAVE_GTK_X11" = "xyes"; then
   189       if test "x$APPLE_BUILD" = "xyes"; then
   190          LIBS="$LIBS -L/usr/X11/lib -lGL"
   191       fi
   192       AC_CHECK_FUNC(glXQueryVersion, [
   193          HAVE_GLX='yes'
   194          VIDEO_DRIVERS="$VIDEO_DRIVERS glx"
   195          AC_DEFINE([HAVE_GLX], 1, [Have GLX support]) ] )
   196    fi
   198 ])
   202 AM_CONDITIONAL(VIDEO_OSMESA, [test "x$HAVE_OSMESA" = "xyes"])
   203 AM_CONDITIONAL(VIDEO_GLX, [test "x$HAVE_GLX" = "xyes"])
   204 AM_CONDITIONAL(VIDEO_NSGL, [test "x$HAVE_NSGL" = "xyes"])
   206 dnl Check for optional (but highly desireable) OpenGL features
   207 AC_CHECK_FUNC(glGenFramebuffersEXT, [ AC_DEFINE([HAVE_OPENGL_FBO],1,[Have EXT_framebuffer_object support]) ], [])
   208 AC_CHECK_FUNC(glCreateShader, [ AC_DEFINE([HAVE_OPENGL_SHADER],1,[Have 2.0 shader support]) ], [])
   209 AC_CHECK_FUNC(glCreateShaderObjectARB, [ AC_DEFINE([HAVE_OPENGL_SHADER_ARB],1,[Have ARB shader support]) ], [])
   210 AC_CHECK_FUNC(glClampColorARB, [ AC_DEFINE([HAVE_OPENGL_CLAMP_COLOR],1,[Have Color Clamp]) ], [])
   213 dnl ------------------- SH4 translator target -------------------
   215 if test "x$enable_translator" != "xno"; then
   216     case $host_cpu in
   217         i386|i486|i586|i686|x86_64)
   218 	    SH4_TRANSLATOR="x86"
   219             AC_DEFINE_UNQUOTED(SH4_TRANSLATOR,[TARGET_X86], [SH4 Translator to use (if any)] );;
   220     esac
   221 fi
   222 AM_CONDITIONAL(BUILD_SH4X86, [test "$SH4_TRANSLATOR" = "x86"])
   224 dnl ------------------ Optional driver support -------------------
   225 dnl Check for Apple CoreAudio
   226 AC_CHECK_HEADER([CoreAudio/CoreAudio.h], [
   227      HAVE_CORE_AUDIO=yes
   228      LIBS="$LIBS -framework CoreAudio"
   229      AUDIO_DRIVERS="$AUDIO_DRIVERS osx"
   230      AC_DEFINE([HAVE_CORE_AUDIO], 1, [Have Apple CoreAudio support]) ],[true ])
   231 AM_CONDITIONAL( AUDIO_OSX, [test "$HAVE_CORE_AUDIO" = 'yes'] )
   233 dnl Check for pulseaudio
   234 if test "x$with_pulse" != "xno"; then
   235    PKG_CHECK_MODULES(PULSE, [libpulse-simple], [
   236        HAVE_PULSE='yes'
   237        AUDIO_DRIVERS="$AUDIO_DRIVERS pulse"
   238        AC_DEFINE([HAVE_PULSE],1,[Have pulseaudio support]) 
   239    ], [
   240        if test "x$with_pulse" = "xyes"; then
   241           AC_MSG_FAILURE( [PulseAudio audio package could not be found (but was required)] )
   242        fi
   243    ])
   244 fi
   245 AM_CONDITIONAL( AUDIO_PULSE, [test "$HAVE_PULSE" = 'yes'] )
   247 dnl Check for esound
   248 if test "x$with_esd" != "xno"; then
   249    PKG_CHECK_MODULES(ESOUND, [esound], [ 
   250        HAVE_ESOUND='yes'
   251        AUDIO_DRIVERS="$AUDIO_DRIVERS esd"
   252        AC_DEFINE([HAVE_ESOUND],1,[Have esound support]) 
   253    ], [
   254        if test "x$with_esd" = "xyes"; then
   255           AC_MSG_FAILURE( [ESounD audio package could not be found (but was required)] )
   256        fi
   257    ])
   258 fi
   259 AM_CONDITIONAL( AUDIO_ESOUND, [test "$HAVE_ESOUND" = 'yes'] )
   261 dnl Check for alsa support
   262 PKG_CHECK_MODULES(ALSA, [alsa], [ 
   263      HAVE_ALSA='yes'
   264      AUDIO_DRIVERS="$AUDIO_DRIVERS alsa"
   265      AC_DEFINE([HAVE_ALSA],1,[Have alsa support]) ], [true])
   266 AM_CONDITIONAL( AUDIO_ALSA, [test "$HAVE_ALSA" = 'yes'] )
   269 dnl Check for native cdrom support. There can be only one.
   270 AC_CHECK_HEADER([linux/cdrom.h], [CDROM_DRIVER=linux], [true])
   271 AC_CHECK_HEADER([IOKit/IOKitLib.h], [
   272      CDROM_DRIVER=osx
   273      LIBS="$LIBS -framework IOKit"],[true])
   274 AM_CONDITIONAL(CDROM_LINUX, [test "x$CDROM_DRIVER" = "xlinux"])
   275 AM_CONDITIONAL(CDROM_OSX, [test "x$CDROM_DRIVER" = "xosx"])
   276 AM_CONDITIONAL(CDROM_NONE, [test "x$CDROM_DRIVER" = "x"])
   278 AC_CHECK_HEADER([linux/joystick.h], [
   279     HAVE_LINUX_JOYSTICK_H=yes
   280     AC_DEFINE([HAVE_LINUX_JOYSTICK], 1, [Have linux joystick support]) ], 
   281   [ echo "Linux Joystick support not found, building without it."] )
   282 AM_CONDITIONAL(JOY_LINUX, [test "$HAVE_LINUX_JOYSTICK_H" = "yes"])
   284 dnl Check for cross-compiler availability - needed for system tests
   285 AC_PATH_PROG(SHCC, [sh-elf-gcc])
   286 AC_PATH_PROG(SHLD, [sh-elf-ld])
   287 AC_PATH_PROG(SHOBJCOPY, [sh-elf-objcopy])
   288 AC_PATH_PROG(ARMCC, [arm-elf-gcc])
   289 AC_PATH_PROG(ARMLD, [arm-elf-ld])
   290 AC_PATH_PROG(ARMOBJCOPY, [arm-elf-objcopy])
   292 if test "x$SHCC" = "x" -o "x$SHLD" = "x" -o "x$SHOBJCOPY" = "x"; then
   293   BUILD_SH="no"
   294   echo "Warning: SH4 cross-compiler not found, system tests will be disabled."
   295 else
   296   BUILD_SH="yes"
   297 fi
   298 if test "x$ARMCC" = "x" -o "x$ARMLD" = "x" -o "x$ARMOBJCOPY" = "x"; then
   299   BUILD_ARM="no"
   300   echo "Warning: ARM cross-compiler not found, AICA tests will be disabled."
   301 else
   302   BUILD_ARM="yes"
   303 fi
   304 AM_CONDITIONAL(BUILD_SYSTEST, [test "$BUILD_SH" = "yes"])
   305 AM_CONDITIONAL(BUILD_ARMTEST, [test "$BUILD_ARM" = "yes"])
   308 dnl ----------------------- All done, finish up -----------------------
   309 GETTEXT_PACKAGE=lxdream
   310 AC_SUBST(GETTEXT_PACKAGE)
   311 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[translation domain])
   313 dnl Add the languages which your application supports here.
   314 ALL_LINGUAS="de es it pt_BR"
   315 AM_GLIB_GNU_GETTEXT
   317 AC_OUTPUT([
   318 Makefile
   319 src/Makefile
   320 po/Makefile.in
   321 test/Makefile
   322 Info.plist
   323 ])
   324 AS_MKDIR_P(test/sh4)
   326 dnl ------------------------- Print out a summary ----------------------
   328 echo
   329 echo "Configuration complete"
   330 echo
   332 if test "x$HAVE_GTK" = x; then
   333   if test "x$HAVE_COCOA" = x; then
   334      echo "  User interface: none"
   335   else
   336      echo "  User interface: Cocoa"
   337   fi
   338 else
   339   echo "  User interface: GTK"
   340 fi
   342 if test "x$SH4_TRANSLATOR" = "x"; then
   343   echo "  SH4 translator: None (emulation core only)"
   344 else
   345   echo "  SH4 translator: $SH4_TRANSLATOR"
   346 fi
   348 if test "x$VIDEO_DRIVERS" = "x"; then
   349    echo "  Video drivers: none (no supported GL found)"
   350 else
   351    echo "  Video drivers: $VIDEO_DRIVERS"
   352 fi
   354 if test "x$AUDIO_DRIVERS" = "x"; then
   355    echo "  Audio drivers: none (no supported output devices found)"
   356 else
   357    echo "  Audio drivers: $AUDIO_DRIVERS"
   358 fi
   360 if test "x$CDROM_DRIVER" = "x"; then
   361    echo "  CD-ROM driver: none (no supported cd-rom devices found)"
   362 else
   363    echo "  CD-ROM driver: $CDROM_DRIVER"
   364 fi
.