dnl Process this file with autoconf to produce a configure script. dnl $Id: configure.in,v 1.155.2.3 2007/05/10 07:32:38 pak21 Exp $ dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl dnl Author contact information: dnl dnl E-mail: philip-fuse@shadowmagic.org.uk AC_INIT(fuse.c) AM_CONFIG_HEADER(config.h) AC_CANONICAL_SYSTEM dnl Use automake to produce `Makefile.in' AM_INIT_AUTOMAKE(fuse, 0.8.0.1) dnl Checks for programs. AC_PROG_CC AC_PROG_RANLIB AC_PATH_PROG(PERL, perl) AC_SUBST(PERL) AM_PROG_LEX AC_PROG_YACC AC_PROG_LIBTOOL dnl Generate commandy.h YFLAGS="$YFLAGS -d" AC_SUBST(YFLAGS) dnl Check for big endianness AC_C_BIGENDIAN dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS( dsound.h \ libgen.h \ siginfo.h \ strings.h \ sys/soundcard.h \ sys/audio.h \ sys/audioio.h ) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_INLINE dnl Checks for library functions. AC_FUNC_MMAP AC_CHECK_FUNCS(dirname geteuid getopt_long mkstemp) dnl Allow the user to say that various libraries are in one place AC_ARG_WITH(local-prefix, [ --with-local-prefix=PFX local libraries installed in PFX (optional)], CPPFLAGS="$CPPFLAGS -I$withval/include"; LDFLAGS="$LDFLAGS -L$withval/lib", if test "$prefix" != "NONE"; then CPPFLAGS="$CPPFLAGS -I$prefix/include"; LDFLAGS="$LDFLAGS -L$prefix/lib" fi) dnl Select a user interface dnl Try various UI options; set the `ui' variable when we've got one dnl we like, and then don't look at the other options dnl Look for svgalib (default=no) AC_MSG_CHECKING(whether svgalib UI requested) AC_ARG_WITH(svgalib, [ --with-svgalib use svgalib for user interface], if test "$withval" = no; then svgalib=no; else svgalib=yes; fi, svgalib=no) AC_MSG_RESULT($svgalib) if test "$svgalib" = yes; then AC_CHECK_HEADER(vga.h, LIBS="$LIBS -lvga"; AC_DEFINE([UI_SVGA], 1, [Defined if svgalib UI in use]) AC_DEFINE([USE_WIDGET], 1, [Defined if we're using a widget-based UI]) UI=svga; WIDGET=widget; UI_LIBS="ui/svga/libuisvga.a widget/libwidget.a", AC_MSG_ERROR([svgalib not found])) fi dnl Look for aalib (default=no) dnl Remove until this works PAK 20030419 dnl AC_MSG_CHECKING(whether aalib UI requested) dnl AC_ARG_WITH(aalib, dnl [ --with-aalib use aalib for user interface], dnl if test "$withval" = no; then aalib=no; else aalib=yes; fi, dnl aalib=no) dnl AC_MSG_RESULT($aalib) dnl if test "$aalib" = yes; then dnl AC_CHECK_HEADER(aalib.h, dnl LIBS="$LIBS -laa"; AC_DEFINE([UI_AALIB], 1, [Defined if aalib UI in use]) AC_DEFINE(USE_WIDGET) dnl ui=aalib; UI_LIBS="ui/aalib/libuiaalib.a widget/libwidget.a", dnl AC_MSG_ERROR([aalib not found])) dnl fi dnl Look for framebuffer interface for SA1110 (default=no) if test -z "$UI"; then AC_MSG_CHECKING(whether framebuffer UI requested) AC_ARG_WITH(fb, [ --with-fb use framebuffer for user interface], if test "$withval" = no; then fb=no; else fb=yes; fi, fb=no) AC_MSG_RESULT($fb) if test "$fb" = yes; then AC_DEFINE([UI_FB], 1, [Defined if framebuffer UI in use]) AC_DEFINE([USE_WIDGET], 1, [Defined if we're using a widget-based UI]) UI=fb; WIDGET=widget; UI_LIBS="ui/fb/libuifb.a widget/libwidget.a" dnl Look for libgpm (default=yes) AC_MSG_CHECKING(whether gpm requested) AC_ARG_WITH(gpm, [ --without-gpm don't use libgpm for e.g. Kempston mouse], if test "$withval" = no; then gpm=no; else gpm=yes; fi, gpm=yes) AC_MSG_RESULT($gpm) dnl Note: we use libdl to get libgpm at runtime if test "$gpm" = yes; then AC_CHECK_HEADER(gpm.h, UI_LIBS="$UI_LIBS -ldl"; AC_DEFINE([HAVE_GPM_H], 1, [Defined if gpm in use]), AC_MSG_ERROR([libgpm not found])) fi fi fi dnl Look for SDL (default=no) if test -z "$UI"; then AC_MSG_CHECKING(whether SDL UI requested) AC_ARG_WITH(sdl, [ --with-sdl use SDL for user interface], if test "$withval" = no; then sdl=no; else sdl=yes; fi, sdl=no) AC_MSG_RESULT($sdl) if test "$sdl" = yes; then SDL_VERSION=1.2.4 AM_PATH_SDL($SDL_VERSION, AC_DEFINE([UI_SDL], 1, [Defined if the SDL UI in use]) AC_DEFINE([USE_WIDGET], 1, [Defined if we're using a widget-based UI]) UI=sdl; WIDGET=widget; UI_LIBS="ui/sdl/libuisdl.a widget/libwidget.a", AC_MSG_ERROR([SDL version $SDL_VERSION not found])) CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" fi fi dnl Look for GGI (default=no) dnl Disabled -- doesn't work and unmaintained -- PAK 20040702 dnl if test -z "$UI"; then dnl AC_MSG_CHECKING(whether GGI UI requested) dnl AC_ARG_WITH(ggi, dnl [ --with-ggi use GGI for user interface], dnl if test "$withval" = no; then sdl=no; else ggi=yes; fi, dnl ggi=no) dnl AC_MSG_RESULT($ggi) dnl if test "$ggi" = yes; then dnl AC_CHECK_HEADER(ggi/ggi.h, dnl AC_DEFINE([UI_GGI], 1, [Defined if GGI UI in use]) dnl AC_DEFINE([USE_WIDGET], 1, dnl [Defined if we're using a widget-based UI]) dnl UI=ggi; WIDGET=widget; dnl UI_LIBS="ui/ggi/libuiggi.a widget/libwidget.a" dnl LIBS="$LIBS -lggi", dnl AC_MSG_ERROR([ggi/ggi.h not found])) dnl fi dnl fi dnl Look for GTK+ 2.0 (default=yes unless --without-gtk); fall back to GTK+ dnl 1.2 if not found if test "$with_gtk" = no; then gtk=no; else gtk=yes; fi if test -z "$UI"; then AC_MSG_CHECKING(whether GTK+ 2.x UI requested) AC_ARG_WITH(gtk2, [ --without-gtk2 don't use GTK+ 2.x library for user interface], if test "$withval" = no; then gtk2=no; else gtk2=yes; fi, gtk2="$gtk") AC_MSG_RESULT($gtk2) if test "$gtk2" = yes; then AM_PATH_GTK_2_0(2.0.0, AC_DEFINE([UI_GTK], 1, [Defined if GTK+ UI (either 1.2 or 2.x) is in use]) AC_DEFINE([UI_GTK2], 1, [Defined if GTK+ 2.0 is in use]) AC_DEFINE([HAVE_LIB_GLIB], 1, [Defined if we've got glib]) UI=gtk; UI_LIBS="ui/gtk/libuigtk.la", AC_MSG_WARN([GTK+ 2.x not found. Reverting to GTK+ 1.2])) fi fi dnl Look for GTK+ 1.2 (default=yes); fall back to Xlib if not found if test -z "$UI"; then AC_MSG_CHECKING(whether GTK+ 1.2 UI requested) AC_ARG_WITH(gtk, [ --without-gtk don't use GTK+ 1.2 library for user interface], if test "$withval" = no; then gtk=no; else gtk=yes; fi, gtk=yes) AC_MSG_RESULT($gtk) if test "$gtk" = yes; then AM_PATH_GTK(1.2.0, AC_DEFINE([UI_GTK], 1, [Defined if GTK+ UI (either 1.2 or 2.x) is in use]) AC_DEFINE([HAVE_LIB_GLIB], 1, [Defined if we've got glib]) UI=gtk; UI_LIBS="ui/gtk/libuigtk.la", AC_MSG_WARN([GTK+ 1.2 not found. Reverting to Xlib UI])) fi fi if test "$UI" = gtk; then AC_PATH_XTRA fi dnl Look for Xlib UI (default=yes) if test -z "$UI"; then if test "$with_x" = no; then AC_MSG_ERROR([Please specify --with-svgalib or --with-fb, not --without-x.]) fi AC_PATH_XTRA CFLAGS="$CFLAGS $X_CFLAGS"; LDFLAGS="$LDFLAGS $X_LIBS"; LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"; dnl This apparently needed for SVR4 systems to link correctly dnl Basically the same as a part of AC_PATH_XTRA, but using `gethostname' dnl instead of `gethostbyname'. dnl Thanks to Erik Kunze for pointing out this problem AC_CHECK_FUNC(gethostname) if test $ac_cv_func_gethostname = no; then AC_CHECK_LIB(nsl, gethostname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") fi AC_CHECK_FUNC(connect) if test $ac_cv_func_connect = no; then AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , $X_EXTRA_LIBS) fi dnl Check for the MIT-SHM extension AC_CHECK_HEADERS( X11/extensions/XShm.h ) AC_CHECK_LIB( Xext, XShmAttach, LIBS="$LIBS -lXext" ) AC_DEFINE([UI_X], 1, [Defined if Xlib UI in use]) UI=xlib; WIDGET=widget; AC_DEFINE([USE_WIDGET], 1, [Defined if we're using a widget-based UI]) UI_LIBS="ui/xlib/libuixlib.a widget/libwidget.a" fi AC_SUBST(UI) AC_SUBST(UI_LIBS) AC_SUBST(WIDGET) # If we're not using GTK+, must either find glib or use the replacement # (as supplied by libspectrum) if test "$UI" != gtk; then AC_MSG_CHECKING(whether to use glib) AC_ARG_WITH(glib, [ --without-glib don't use glib], if test "$withval" = no; then glib=no; else glib=yes; fi, glib=yes) AC_MSG_RESULT($glib) if test "$glib" = yes; then glib2=no AM_PATH_GLIB_2_0( 2.0.0, glib2=yes AC_DEFINE([HAVE_LIB_GLIB], 1, [Defined if we've got glib]) LIBS="$LIBS `pkg-config --libs glib-2.0`", ) if test "$glib2" = no; then AM_PATH_GLIB( 1.2.0, AC_DEFINE([HAVE_LIB_GLIB], 1, [Defined if we've got glib]) LIBS="$LIBS `glib-config --libs`", AC_MSG_WARN(glib not found - using libspectrum's replacement) ) fi fi fi dnl Check that libspectrum is available AC_ARG_WITH(libspectrum-prefix, [ --with-libspectrum-prefix=PFX where libspectrum is installed (optional)], LIBSPEC_CFLAGS=-I$withval/include; LIBSPEC_LIBS=-L$withval/lib, LIBSPEC_CFLAGS=""; LIBSPEC_LIBS="") ac_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $LIBSPEC_CFLAGS $GTK_CFLAGS $GLIB_CFLAGS" AC_CHECK_HEADERS(libspectrum.h,LIBSPEC_LIBS="$LIBSPEC_LIBS -lspectrum", AC_MSG_ERROR(Sorry - I need libspectrum to be available)) CPPFLAGS="$ac_save_CPPFLAGS" AC_SUBST(LIBSPEC_CFLAGS) AC_SUBST(LIBSPEC_LIBS) dnl Check if supplied libspectrum has support for compressed szx files AC_MSG_CHECKING(whether libspectrum supports compressed szx snaps) ac_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $LIBSPEC_CFLAGS" AC_TRY_COMPILE([#include ],[ void test() { int test = LIBSPECTRUM_SUPPORTS_ZLIB_COMPRESSION; } ], AUTOLOAD_SNAPS=compressed; AC_MSG_RESULT(yes), AUTOLOAD_SNAPS=uncompressed; AC_MSG_RESULT(no)) CPPFLAGS="$ac_save_CPPFLAGS" AC_SUBST(AUTOLOAD_SNAPS) AC_LINK_FILES([ lib/"$AUTOLOAD_SNAPS"/disk_plus3.szx lib/"$AUTOLOAD_SNAPS"/tape_128.szx lib/"$AUTOLOAD_SNAPS"/tape_16.szx lib/"$AUTOLOAD_SNAPS"/tape_2048.szx lib/"$AUTOLOAD_SNAPS"/tape_2068.szx lib/"$AUTOLOAD_SNAPS"/tape_48.szx lib/"$AUTOLOAD_SNAPS"/tape_plus2.szx lib/"$AUTOLOAD_SNAPS"/tape_plus2a.szx lib/"$AUTOLOAD_SNAPS"/tape_plus3.szx lib/"$AUTOLOAD_SNAPS"/tape_plus3e.szx lib/"$AUTOLOAD_SNAPS"/tape_pentagon.szx lib/"$AUTOLOAD_SNAPS"/tape_scorpion.szx lib/"$AUTOLOAD_SNAPS"/tape_se.szx lib/"$AUTOLOAD_SNAPS"/tape_ts2068.szx], [lib/disk_plus3.szx lib/tape_128.szx lib/tape_16.szx lib/tape_2048.szx lib/tape_2068.szx lib/tape_48.szx lib/tape_plus2.szx lib/tape_plus2a.szx lib/tape_plus3.szx lib/tape_plus3e.szx lib/tape_pentagon.szx lib/tape_scorpion.szx lib/tape_se.szx lib/tape_ts2068.szx]) dnl Do we want +3 disk support? AC_MSG_CHECKING(whether +3 disk support requested) AC_ARG_WITH(plus3-disk, [ --without-plus3-disk disable +3 disk support], if test "$withval" = no; then plus3disk = no; else plus3disk=yes; fi, plus3disk=yes) AC_MSG_RESULT($plus3disk) if test "$plus3disk" = yes; then AC_ARG_WITH(plus3-disk-prefix, [ --with-plus3-disk-prefix=PFX where the +3 libraries are installed (optional)], DSK_CFLAGS=-I$withval/include; DSKLIBS=-L$withval/lib, DSK_CFLAGS=""; DSK_LIBS="") ac_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $DSK_CFLAGS" AC_CHECK_HEADERS(765.h, DSKLIBS="$DSKLIBS -l765"; lib765=yes, AC_MSG_WARN(765.h not found - disk support disabled)) if test "$lib765" = yes; then AC_CHECK_HEADERS(libdsk.h, DSKLIBS="$DSKLIBS -ldsk") fi CPPFLAGS="$ac_save_CPPFLAGS" fi AC_SUBST(DSK_CFLAGS) AC_SUBST(DSKLIBS) dnl Check if a version of libpng which supplies png_write_png is available AC_CHECK_LIB( png, png_write_png, [AC_CHECK_HEADER( png.h, [AC_DEFINE([USE_LIBPNG], 1, [Defined if we're going to be using the installed libpng]) PNG_LIBS='-lpng -lm -lz'], [AC_MSG_WARN(png.h not found - saving screenshots disabled)] )], [AC_MSG_WARN(png_write_png not found - saving screenshots disabled)], [-lm -lz] ) AC_SUBST(PNG_LIBS) dnl Check if a version of libao which supplies ao_open_live is available AC_MSG_CHECKING(whether libao requested) AC_ARG_WITH(libao, [ --with-libao use libao for sound output], if test "$withval" = no; then libao=no; else libao=yes; fi, libao=no) AC_MSG_RESULT($libao) if test "$libao" = yes; then AC_CHECK_LIB( ao, ao_open_live, [AC_CHECK_HEADER( ao/ao.h, [AC_DEFINE([USE_LIBAO], 1, [Defined if we're going to be using the installed libao]) AO_LIBS='-lao'], [AC_MSG_WARN(ao/ao.h not found - no libao sound output)] )], [AC_MSG_WARN(ao_open_live not found - no libao sound output)] ) AC_SUBST(AO_LIBS) fi dnl Check if CoreAudio is available AC_CHECK_HEADER( CoreAudio/AudioHardware.h, [AC_DEFINE([USE_COREAUDIO], 1, [Defined if we're going to be using CoreAudio]) COREAUDIO_LIBS='-framework CoreAudio -framework AudioUnit -framework CoreServices'], [AC_MSG_WARN(CoreAudio/AudioHardware.h not found - no CoreAudio sound output)] ) AC_SUBST(COREAUDIO_LIBS) dnl Are we supplying the ROMs or relying on another package? AC_MSG_CHECKING(where to find the Spectrum ROM images) AC_ARG_WITH(roms-dir, [ --with-roms-dir=DIR location of the Spectrum ROM images], , unset withval ) if test "$withval" = ""; then echo 'we supply them' else echo "$withval" AC_DEFINE_UNQUOTED(ROMSDIR, "$withval", [Location of the ROM images]) fi AC_MSG_CHECKING(whether hardware joystick support requested) AC_ARG_WITH(joystick, [ --with-joystick use a real joystick for Kempston emulation etc.], if test "$withval" = no; then stick=no; else stick=yes; fi, stick=yes) AC_MSG_RESULT($stick) if test "$stick" = yes; then dnl We prefer to use UI-specific joystick code. (Default.) dnl If there is none, or you override this here, we use libjsw. dnl (svgalib appears to dislike switched joysticks on the parallel port...) case "$UI" in svga|sdl) dnl Libraries such as svgalib provide their own joystick code. AC_MSG_CHECKING([whether to use $UI's joystick support]) AC_ARG_ENABLE(ui-joystick, [ --enable-ui-joystick use UI-specific joystick code (where supported)], if test "$enableval" = no; then libjsw=yes; else libjsw=no; fi, libjsw=no) if test "$libjsw" = yes; then AC_MSG_RESULT([no, use libjsw]) else AC_MSG_RESULT(yes) AC_DEFINE([USE_JOYSTICK], 1, [Defined if we're using hardware joysticks]) fi ;; *) dnl Our only option is libjsw. libjsw=yes ;; esac if test "$libjsw" = yes; then dnl Look for libjsw. If missing, use QAOP. AC_CHECK_HEADERS(jsw.h, LIBS="$LIBS -ljsw"; AC_DEFINE([USE_JOYSTICK], 1, [Defined if we're using hardware joysticks]), AC_MSG_WARN(jsw.h not found - joystick support disabled)) fi fi dnl See if libxml2 is available (for the config file handling) AM_PATH_XML2(2.0.0,AC_DEFINE([HAVE_LIB_XML2], 1, [Defined if we've got libxml2]), AC_WARN(libxml2 not found - config file use disabled)) dnl Do we want the low memory compile? AC_MSG_CHECKING(whether low memory compile requested) AC_ARG_ENABLE(smallmem, [ --enable-smallmem low memory compile needed], if test "$enableval" = yes; then smallmem=yes; else smallmem=no; fi, smallmem=no) if test "$smallmem" = no; then AC_DEFINE([HAVE_ENOUGH_MEMORY], 1, [Defined if we've got enough memory to compile z80_ops.c]) fi AC_MSG_RESULT($smallmem) dnl Do we want lots of warning messages? AC_MSG_CHECKING(whether lots of warnings requested) AC_ARG_ENABLE(warnings, [ --enable-warnings give lots of warnings if using gcc], if test "$enableval" = yes; then warnings=yes; else warnings=no; fi, warnings=no) AC_MSG_RESULT($warnings) dnl If it appears we're using gcc as our compiler, turn on warnings if test "$ac_cv_prog_gcc" = yes; then CFLAGS="$CFLAGS -Wall" dnl And possibly lots of warnings if test "$warnings" = yes; then CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Winline -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Waggregate-return -W -Wsign-compare" fi fi dnl Debugging mode: turns off any use of signals to make running under gdb dnl useful. AC_MSG_CHECKING(whether debugging mode requested) AC_ARG_ENABLE(debug-mode, [ --enable-debug-mode enable debugging mode (developers only)], if test "$enableval" = yes; then debugging=yes; else debugging=no; fi, debugging=no) AC_MSG_RESULT($debugging) if test "$debugging" = yes; then AC_DEFINE([DEBUG_MODE], 1, [Defined if we're in debugging mode]) fi AC_OUTPUT(Makefile \ compat/Makefile \ debugger/Makefile \ hacking/Makefile \ lib/Makefile \ machines/Makefile \ man/Makefile \ perl/Makefile \ perl/Fuse/Makefile \ pokefinder/Makefile \ roms/Makefile \ sound/Makefile \ ui/Makefile \ ui/fb/Makefile \ ui/gtk/Makefile \ ui/svga/Makefile \ ui/sdl/Makefile \ ui/scaler/Makefile \ ui/win32/Makefile \ ui/xlib/Makefile \ widget/Makefile \ z80/Makefile \ z80/tests/Makefile)