1dnl Process this file with autoconf to produce a configure script. 2 3dnl This program is free software; you can redistribute it and/or modify 4dnl it under the terms of the GNU General Public License as published by 5dnl the Free Software Foundation; either version 2 of the License, or 6dnl (at your option) any later version. 7dnl 8dnl This program is distributed in the hope that it will be useful, 9dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 10dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11dnl GNU General Public License for more details. 12dnl 13dnl You should have received a copy of the GNU General Public License along 14dnl with this program; if not, write to the Free Software Foundation, Inc., 15dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 16dnl 17dnl Author contact information: 18dnl 19dnl E-mail: philip-fuse@shadowmagic.org.uk 20 21dnl Package version 22m4_define([fuse_version], [1.6.0]) 23 24dnl Product full version 25m4_define([fuse_major_version], [1]) 26m4_define([fuse_minor_version], [6]) 27m4_define([fuse_micro_version], [0]) 28m4_define([fuse_nano_version], [0]) 29m4_define([fuse_full_version], [fuse_major_version.fuse_minor_version.fuse_micro_version.fuse_nano_version]) 30m4_define([fuse_rc_version], [fuse_major_version,fuse_minor_version,fuse_micro_version,fuse_nano_version]) 31 32dnl Package info 33m4_define([fuse_copyright], ["(c) 1999-2021 Philip Kendall and others"]) 34m4_define([fuse_url], [http://fuse-emulator.sourceforge.net/]) 35m4_define([fuse_bugreport], [http://sourceforge.net/p/fuse-emulator/bugs/]) 36 37AC_INIT([fuse],[fuse_version],[fuse_bugreport],[fuse],[fuse_url]) 38AC_CONFIG_SRCDIR(fuse.c) 39AC_CONFIG_MACRO_DIR([m4]) 40AC_CONFIG_HEADERS(config.h) 41AC_CANONICAL_HOST 42 43dnl Use automake to produce `Makefile.in' 44AM_INIT_AUTOMAKE([1.11 foreign subdir-objects -Wall]) 45AM_SILENT_RULES([yes]) 46 47dnl Substitutions for .in files 48FUSE_FULL_VERSION=fuse_full_version 49FUSE_COPYRIGHT=fuse_copyright 50FUSE_URL=fuse_url 51AC_SUBST(FUSE_FULL_VERSION) 52AC_SUBST(FUSE_COPYRIGHT) 53AC_SUBST(FUSE_URL) 54 55dnl Definitions for config.h 56AC_DEFINE([FUSE_RC_VERSION], [fuse_rc_version], 57 [Define version information for win32 executables]) 58AC_DEFINE([FUSE_COPYRIGHT], [fuse_copyright], [Define copyright of Fuse]) 59 60dnl Checks for programs. 61AC_PROG_CC 62AM_PROG_CC_C_O 63AC_PATH_PROG(PERL, perl) 64AC_SUBST(PERL) 65AM_PROG_LEX 66AC_PROG_YACC 67LT_INIT 68 69dnl Check for host specific programs 70case "$host_os" in 71 mingw32*) 72 AC_CHECK_TOOL([WINDRES], [windres]) 73 if test -z "$WINDRES" ; then 74 AC_MSG_ERROR([windres is required to compile Fuse for $host hosts]) 75 fi 76 AC_CHECK_PROGS([MAN2HTML], [man2html]) 77 AC_CHECK_PROGS([GROFF], [groff]) 78 AC_CHECK_PROGS([UNIX2DOS], [unix2dos]) 79 ;; 80esac 81 82dnl Generate commandy.h 83YFLAGS="$YFLAGS -d" 84AC_SUBST(YFLAGS) 85 86dnl Check for big endianness 87AC_C_BIGENDIAN 88 89dnl Checks for header files. 90AC_HEADER_STDC 91AC_CHECK_HEADERS( 92 libgen.h \ 93 siginfo.h \ 94 strings.h \ 95 sys/soundcard.h \ 96 sys/audio.h \ 97 sys/audioio.h 98) 99 100dnl Checks for typedefs, structures, and compiler characteristics. 101AC_C_CONST 102AC_C_INLINE 103 104dnl Checks for library functions. 105AC_CHECK_FUNCS(dirname geteuid getopt_long fsync) 106AC_CHECK_LIB([m],[cos]) 107 108AX_STRING_STRCASECMP 109if test x"$ac_cv_string_strcasecmp" = "xno" ; then 110 AX_STRINGS_STRCASECMP 111fi 112 113dnl Allow the user to say that various libraries are in one place 114AC_ARG_WITH(local-prefix, 115[ --with-local-prefix=PFX local libraries installed in PFX (optional)], 116CPPFLAGS="$CPPFLAGS -I$withval/include"; LDFLAGS="$LDFLAGS -L$withval/lib", 117if test "$prefix" != "NONE"; then 118 CPPFLAGS="$CPPFLAGS -I$prefix/include"; LDFLAGS="$LDFLAGS -L$prefix/lib" 119fi) 120 121dnl Check that libspectrum is available and that it is new enough 122PKG_CHECK_MODULES([LIBSPECTRUM], [libspectrum >= 1.5.0]) 123 124dnl Check if supplied libspectrum has its own internal GLib replacement 125AC_MSG_CHECKING(whether libspectrum has its own internal GLib replacement) 126ac_save_CPPFLAGS="$CPPFLAGS" 127CPPFLAGS="$CPPFLAGS $LIBSPECTRUM_CFLAGS" 128AC_PREPROC_IFELSE( 129 [AC_LANG_SOURCE([ 130#include <libspectrum.h> 131#if LIBSPECTRUM_HAS_GLIB_REPLACEMENT == 0 132#error "GLib replacement not found" 133#endif 134 ])], 135 [fakeglib=yes; AC_MSG_RESULT(yes)], 136 [fakeglib=no; AC_MSG_RESULT(no)] 137) 138CPPFLAGS="$ac_save_CPPFLAGS" 139 140# If we're not libspectrum's own internal GLib replacement, we must use the 141# real thing 142AS_IF([test "$fakeglib" = no], [ 143 PKG_CHECK_MODULES( 144 [GLIB], 145 [glib-2.0 >= 2.20.0], 146 [AC_DEFINE([HAVE_LIB_GLIB], 1, [Defined if we've got GLib])], 147 [AC_MSG_ERROR([GLib not found, and libspectrum has no internal replacement])] 148 ) 149]) 150 151dnl Check if supplied libspectrum has support for compressed szx files 152AC_MSG_CHECKING(whether libspectrum supports compressed szx snaps) 153ac_save_CPPFLAGS="$CPPFLAGS" 154CPPFLAGS="$CPPFLAGS $LIBSPECTRUM_CFLAGS" 155AC_COMPILE_IFELSE( 156 [AC_LANG_PROGRAM([[#include <libspectrum.h>]], 157 [[ 158 int test = LIBSPECTRUM_SUPPORTS_ZLIB_COMPRESSION; 159 ]]) 160 ], 161 [LIBSPEC_HAVE_ZLIB=yes; AC_MSG_RESULT(yes)], 162 [LIBSPEC_HAVE_ZLIB=""; AC_MSG_RESULT(no)] 163) 164CPPFLAGS="$ac_save_CPPFLAGS" 165AC_SUBST(LIBSPEC_HAVE_ZLIB) 166 167dnl Select a user interface 168 169dnl Try various UI options; set the `ui' variable when we've got one 170dnl we like, and then don't look at the other options 171 172AC_PATH_XTRA 173 174dnl Look for Win32 UI (default=no) 175AC_MSG_CHECKING(whether Win32 UI requested) 176AC_ARG_WITH(win32, 177[ --with-win32 use Win32 for user interface], 178if test "$withval" = no; then win32=no; else win32=yes; fi, 179win32=auto) 180 181if test "$win32" = auto; then 182case "$host_os" in 183 mingw32*) 184 win32=yes 185 ;; 186 *) 187 win32=no 188 ;; 189esac 190fi 191AC_MSG_RESULT($win32) 192 193if test "$win32" = yes; then 194 AC_CHECK_HEADER(windows.h, 195 LIBS="$LIBS -mwindows -lcomctl32 -lwinmm"; 196 AC_DEFINE([UI_WIN32], 1, [Defined if Win32 UI in use]) 197 UI=win32, 198 AC_MSG_ERROR([Win32 UI not found])) 199fi 200 201dnl Look for svgalib (default=no) 202if test -z "$UI"; then 203 AC_MSG_CHECKING(whether svgalib UI requested) 204 AC_ARG_WITH(svgalib, 205 [ --with-svgalib use svgalib for user interface], 206 if test "$withval" = no; then svgalib=no; else svgalib=yes; fi, 207 svgalib=no) 208 AC_MSG_RESULT($svgalib) 209 if test "$svgalib" = yes; then 210 AC_CHECK_HEADER(vga.h, 211 LIBS="$LIBS -lvga"; 212 AC_DEFINE([UI_SVGA], 1, [Defined if svgalib UI in use]) 213 AC_DEFINE([USE_WIDGET], 1, 214 [Defined if we're using a widget-based UI]) 215 UI=svga; WIDGET=widget, 216 AC_MSG_ERROR([svgalib not found])) 217 fi 218fi 219 220dnl Look for framebuffer interface for SA1110 (default=no) 221if test -z "$UI"; then 222 AC_MSG_CHECKING(whether framebuffer UI requested) 223 AC_ARG_WITH(fb, 224 [ --with-fb use framebuffer for user interface], 225 if test "$withval" = no; then fb=no; else fb=yes; fi, 226 fb=no) 227 AC_MSG_RESULT($fb) 228 if test "$fb" = yes; then 229 AC_DEFINE([UI_FB], 1, [Defined if framebuffer UI in use]) 230 AC_DEFINE([USE_WIDGET], 1, [Defined if we're using a widget-based UI]) 231 UI=fb; WIDGET=widget; 232 dnl Look for libgpm (default=yes) 233 AC_MSG_CHECKING(whether gpm requested) 234 AC_ARG_WITH(gpm, 235 [ --without-gpm don't use libgpm for e.g. Kempston mouse], 236 if test "$withval" = no; then gpm=no; else gpm=yes; fi, 237 gpm=yes) 238 AC_MSG_RESULT($gpm) 239 dnl Note: we use libdl to get libgpm at runtime 240 if test "$gpm" = yes; then 241 AC_CHECK_HEADER(gpm.h, 242 LIBS="$LIBS -ldl"; 243 AC_DEFINE([HAVE_GPM_H], 1, [Defined if gpm in use]), 244 AC_MSG_ERROR([libgpm not found])) 245 fi 246 fi 247fi 248 249dnl Look for Wii interface (default = 0) 250if test -z "$UI"; then 251 AC_MSG_CHECKING(whether Wii UI requested) 252 AC_ARG_WITH(wii, 253 [ --with-wii use Wii FB for user interface], 254 if test "$withval" = no; then wii=no; else wii=yes; fi, 255 wii=no) 256 AC_MSG_RESULT($wii) 257 if test "$wii" = yes; then 258 AC_DEFINE([UI_WII], 1, [Defined if Wii UI in use]) 259 AC_DEFINE([USE_WIDGET], 1, [Defined if we're using a widget-based UI]) 260 AC_DEFINE([USE_JOYSTICK], 1, [Defined if we're using hardware joysticks]) 261 UI=wii; WIDGET=widget; 262 host_os=wii 263 dnl Look for libgpm (default=yes) 264 AC_MSG_CHECKING(whether gpm requested) 265 AC_ARG_WITH(gpm, 266 [ --without-gpm don't use libgpm for e.g. Kempston mouse], 267 if test "$withval" = no; then gpm=no; else gpm=yes; fi, 268 gpm=yes) 269 AC_MSG_RESULT($gpm) 270 dnl Note: we use libdl to get libgpm at runtime 271 if test "$gpm" = yes; then 272 AC_CHECK_HEADER(gpm.h, 273 LIBS="$LIBS -ldl"; 274 AC_DEFINE([HAVE_GPM_H], 1, [Defined if gpm in use]), 275 AC_MSG_ERROR([libgpm not found])) 276 fi 277 fi 278fi 279 280dnl Check if the user wants the SDL UI 281if test -z "$UI"; then 282 AC_MSG_CHECKING(whether SDL UI requested) 283 AC_ARG_WITH(sdl, 284 [ --with-sdl use SDL for user interface], 285 if test "$withval" = no; then sdl_ui=no; else sdl_ui=yes; fi, 286 sdl_ui=no) 287 AC_MSG_RESULT($sdl_ui) 288fi 289 290dnl Check if the user prefers SDL 1 over SDL 2 291AC_ARG_ENABLE(sdl2, 292 AS_HELP_STRING([--disable-sdl2],[prefer SDL 1 to SDL 2]), 293 if test "$enableval" = yes; then sdl2=yes; else sdl2=no; fi, 294 sdl2=yes 295) 296 297dnl SDL 2 is not supported for the UI yet, so warn the user 298if test "$sdl_ui" = yes -a "$sdl2" = yes; then 299 AC_MSG_WARN([SDL 2 not supported for the UI, using SDL 1 instead]) 300 sdl2=no 301fi 302 303dnl Look for SDL 2 304sdl_available=no 305if test "$sdl2" = yes; then 306 PKG_CHECK_MODULES([SDL], [sdl2], [sdl_available=yes], [ 307 AC_MSG_WARN([SDL 2 not found, looking for SDL 1]) 308 sdl2=no]) 309fi 310 311dnl Look for SDL 1 if we don't have or want SDL 2 312SDL_VERSION=1.2.4 313if test "$sdl_available" = no; then 314 AM_PATH_SDL($SDL_VERSION, sdl_available=yes, sdl_available=no) 315fi 316 317dnl Enable the SDL UI if all conditions are met 318if test "$sdl_ui" = yes; then 319 if test "$sdl_available" = yes; then 320 AC_DEFINE([UI_SDL], 1, [Defined if the SDL UI in use]) 321 AC_DEFINE([USE_WIDGET], 1, [Defined if we're using a widget-based UI]) 322 UI=sdl 323 WIDGET=widget 324 use_sdl=yes 325 else 326 AC_MSG_ERROR([SDL version $SDL_VERSION not found]) 327 fi 328fi 329 330dnl Look for null UI (default=no) 331if test -z "$UI"; then 332 AC_MSG_CHECKING(whether null UI requested) 333 AC_ARG_WITH(null-ui, 334 [ --with-null-ui use null user interface], 335 if test "$withval" = no; then null_ui=no; else null_ui=yes; fi, 336 null_ui=no) 337 AC_MSG_RESULT($null_ui) 338 if test "$null_ui" = yes; then 339 AC_DEFINE([UI_NULL], 1, [Defined if null UI is in use]) 340 UI=null 341 fi 342fi 343 344dnl Look for GTK (default=yes) 345if test -z "$UI"; then 346 AC_MSG_CHECKING(whether GTK UI requested) 347 AC_ARG_WITH(gtk, 348 [ --without-gtk don't use GTK for user interface], 349 if test "$withval" = no; then gtk=no; else gtk=yes; fi, 350 if test "$fakeglib" = yes; then gtk=no; else gtk=yes; fi) 351 AC_MSG_RESULT($gtk) 352 353 if test "$gtk" = yes; then 354 355 if test "$fakeglib" = yes; then 356 AC_MSG_ERROR([libspectrum is using its own internal GLib replacement 357GTK requires the real GLib library, so the GTK UI cannot be used with 358the libspectrum that was found. Rebuild libspectrum to use the real GLib 359library (i.e. do not pass --with-fake-glib) instead of its own replacement.]) 360 fi 361 362 AC_ARG_ENABLE(gtk3, 363 AS_HELP_STRING([--disable-gtk3],[prefer GTK 2 to GTK 3]), 364 if test "$enableval" = yes; then gtk3=yes; else gtk3=no; fi, 365 gtk3=auto 366 ) 367 368 if test "$gtk3" = yes; then 369 PKG_CHECK_MODULES(GTK, [gtk+-3.0],, 370 AC_MSG_ERROR([GTK not found]) 371 ) 372 373 elif test "$gtk3" = no; then 374 AM_PATH_GTK_2_0(2.18.0,, 375 AC_MSG_ERROR([GTK not found]) 376 ) 377 378 elif test "$gtk3" = auto; then 379 PKG_CHECK_MODULES([GTK], [gtk+-3.0], [gtk3=yes], [true]) 380 381 if test "$gtk3" = auto; then 382 AM_PATH_GTK_2_0(2.18.0, 383 gtk3=no, 384 AC_MSG_WARN([GTK not found. Reverting to Xlib]) 385 gtk3=no 386 gtk=no 387 ) 388 fi 389 fi 390 391 fi 392 393 if test "$gtk" = yes; then 394 AC_DEFINE([UI_GTK], 1, [Defined if GTK UI is in use]) 395 UI=gtk; 396 AC_MSG_CHECKING(whether GTK supports x11 backend) 397 ac_save_CPPFLAGS="$CPPFLAGS" 398 CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" 399 AC_COMPILE_IFELSE( 400 [AC_LANG_PROGRAM( 401 [[ 402 #include <gdk/gdk.h> 403 #include <stdlib.h> 404 ]], 405 [[ 406 #ifndef GDK_WINDOWING_X11 407 #error "X11 backend not supported" 408 #endif 409 ]]) 410 ], 411 [LIBS="$LIBS -lX11"; AC_MSG_RESULT(yes)], 412 [AC_MSG_RESULT(no)] 413 ) 414 CPPFLAGS="$ac_save_CPPFLAGS" 415 fi 416fi 417 418AM_CONDITIONAL(HAVE_GTK2, test "$gtk3" != yes) 419 420if test "$UI" = gtk; then 421 AC_PATH_XTRA 422fi 423 424dnl Look for Xlib UI (default=yes) 425if test -z "$UI"; then 426 if test "$with_x" = no; then 427 AC_MSG_ERROR([Please specify --with-svgalib or --with-fb, not --without-x.]) 428 fi 429 AC_PATH_XTRA 430 CFLAGS="$CFLAGS $X_CFLAGS"; 431 LDFLAGS="$LDFLAGS $X_LIBS"; 432 LIBS="$LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"; 433 434 dnl This apparently needed for SVR4 systems to link correctly 435 dnl Basically the same as a part of AC_PATH_XTRA, but using `gethostname' 436 dnl instead of `gethostbyname'. 437 dnl Thanks to Erik Kunze for pointing out this problem 438 AC_CHECK_FUNC(gethostname) 439 if test $ac_cv_func_gethostname = no; then 440 AC_CHECK_LIB(nsl, gethostname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") 441 fi 442 AC_CHECK_FUNC(connect) 443 if test $ac_cv_func_connect = no; then 444 AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , 445 $X_EXTRA_LIBS) 446 fi 447 448 dnl Check for the MIT-SHM extension 449 AC_CHECK_HEADERS( X11/extensions/XShm.h,,,[[ 450 #include <sys/ipc.h> 451 #include <sys/shm.h> 452 #include <X11/Xlib.h> 453 ]]) 454 AC_CHECK_LIB( Xext, XShmAttach, LIBS="$LIBS -lXext" ) 455 456 AC_DEFINE([UI_X], 1, [Defined if Xlib UI in use]) 457 UI=xlib; WIDGET=widget; 458 AC_DEFINE([USE_WIDGET], 1, [Defined if we're using a widget-based UI]) 459fi 460 461AM_CONDITIONAL(UI_FB, test "$UI" = fb) 462AM_CONDITIONAL(UI_GTK, test "$UI" = gtk) 463AM_CONDITIONAL(UI_NULL, test "$UI" = null) 464AM_CONDITIONAL(UI_SDL, test "$UI" = sdl) 465AM_CONDITIONAL(UI_SVGA, test "$UI" = svga) 466AM_CONDITIONAL(UI_WII, test "$UI" = wii) 467AM_CONDITIONAL(UI_WIN32, test "$UI" = win32) 468AM_CONDITIONAL(UI_X, test "$UI" = xlib) 469AM_CONDITIONAL(USE_WIDGET, test x$WIDGET != x) 470AC_SUBST(UI) 471 472dnl Locate common options for widget UIs 473if test -n "$WIDGET"; then 474 OPTIONS_DIR="$WIDGET" 475else 476 OPTIONS_DIR="$UI" 477fi 478AC_SUBST(OPTIONS_DIR) 479 480dnl Check whether to use zlib (the UNIX version is called z, Win32 zdll) 481AC_MSG_CHECKING(whether to use zlib) 482AC_ARG_WITH(zlib, 483[ --without-zlib don't use zlib], 484if test "$withval" = no; then zlib=no; else zlib=yes; fi, 485zlib=yes) 486AC_MSG_RESULT($zlib) 487if test "$zlib" = yes; then 488 zlib=no 489 AC_CHECK_HEADERS( 490 zlib.h, 491 AC_SEARCH_LIBS(compress2, z zdll, zlib=yes) 492 ) 493fi 494 495dnl Check if supplied libspectrum has support for bz2 compressed files 496AC_MSG_CHECKING(whether libspectrum supports compressed bz2 files) 497ac_save_CPPFLAGS="$CPPFLAGS" 498CPPFLAGS="$CPPFLAGS $LIBSPECTRUM_CFLAGS" 499AC_COMPILE_IFELSE( 500 [AC_LANG_PROGRAM([[#include <libspectrum.h>]], 501 [[ 502 int test = LIBSPECTRUM_SUPPORTS_BZ2_COMPRESSION; 503 ]]) 504 ], 505 [LIBSPEC_HAVE_BZ2=yes; AC_MSG_RESULT(yes)], 506 [LIBSPEC_HAVE_BZ2=""; AC_MSG_RESULT(no)] 507) 508CPPFLAGS="$ac_save_CPPFLAGS" 509AC_SUBST(LIBSPEC_HAVE_BZ2) 510 511dnl Check if supplied libspectrum has support for wav files 512AC_MSG_CHECKING(whether libspectrum supports wav files) 513ac_save_CPPFLAGS="$CPPFLAGS" 514CPPFLAGS="$CPPFLAGS $LIBSPECTRUM_CFLAGS" 515AC_COMPILE_IFELSE( 516 [AC_LANG_PROGRAM([[#include <libspectrum.h>]], 517 [[ 518 int test = LIBSPECTRUM_SUPPORTS_AUDIOFILE; 519 ]]) 520 ], 521 [LIBSPEC_HAVE_AUDIOFILE=yes; AC_MSG_RESULT(yes)], 522 [LIBSPEC_HAVE_AUDIOFILE=""; AC_MSG_RESULT(no)] 523) 524CPPFLAGS="$ac_save_CPPFLAGS" 525AC_SUBST(LIBSPEC_HAVE_AUDIOFILE) 526 527dnl Check if a version of libpng which supplies png_write_png is available 528AC_MSG_CHECKING(whether PNG support requested) 529AC_ARG_WITH(png, 530[ --without-png don't use libpng], 531if test "$withval" = no; then libpng=no; else libpng=yes; fi, 532libpng=yes) 533AC_MSG_RESULT($libpng) 534if test "$libpng" = yes; then 535 PKG_CHECK_MODULES( 536 [PNG], 537 [libpng], 538 [AC_DEFINE([USE_LIBPNG], 1, [Defined if we're going to be using the installed libpng])], 539 [AC_MSG_WARN([libpng not found - saving screenshots disabled]) 540 libpng=no] 541 ) 542fi 543 544AC_SUBST(PNG_CFLAGS) 545AC_SUBST(PNG_LIBS) 546 547dnl Check if we can improve Blip Buffer accuracy on LP64 platforms 548AC_CHECK_SIZEOF(long) 549AC_MSG_CHECKING([Blip Buffer accuracy]) 550AS_IF([test "$ac_cv_sizeof_long" -ge 8], 551 [AC_DEFINE([BLIP_BUFFER_ACCURACY], [32], [Defined if we can increase Blip Buffer accuracy]) 552 AC_MSG_RESULT([32])], 553 [AC_MSG_RESULT([default])] 554) 555 556 557dnl Create the list of available audio drivers. 558dnl Drivers are added to this list in order of preference, so the 559dnl first one will be selected unless one is chosen explicitly. 560audio_driver_list="" 561 562dnl Check if a version of libasound which supplies pcm is available 563AC_CHECK_LIB( asound, snd_pcm_hw_params_set_period_size_near, 564 [AC_CHECK_HEADER( 565 alsa/asoundlib.h, 566 [audio_driver_list="$audio_driver_list alsa"], 567 [AC_MSG_WARN(alsa/asoundlib.h not found - no ALSA output)] 568 )], 569 [AC_MSG_WARN(snd_pcm_hw_params_set_period_size_near not found - no ALSA output)] 570) 571 572dnl Check if DirectSound is available 573AC_CHECK_HEADER( 574 dsound.h, 575 [audio_driver_list="$audio_driver_list directsound"],, 576 [#define DIRECTSOUND_VERSION 0x0700 577 #include <windows.h> 578 #include <mmsystem.h>] 579) 580 581dnl Check if MS Windows Multimedia API sound is available 582AC_CHECK_HEADER( 583 mmsystem.h, 584 [audio_driver_list="$audio_driver_list win32sound"],, 585 [#include <windows.h>] 586) 587 588dnl SDL audio 589if test "$sdl_available" = "yes"; then 590 dnl Default to SDL audio if we're using the SDL UI 591 if test "$UI" = sdl; then 592 audio_driver_list="sdl $audio_driver_list" 593 else 594 audio_driver_list="$audio_driver_list sdl" 595 fi 596fi 597 598dnl Check if a version of libao which supplies ao_open_live is available 599AC_CHECK_LIB( ao, ao_open_live, 600 [AC_CHECK_HEADER( 601 ao/ao.h, 602 [audio_driver_list="$audio_driver_list libao"], 603 [AC_MSG_WARN(ao/ao.h not found - no libao sound output)] 604 )], 605 [AC_MSG_WARN(ao_open_live not found - no libao sound output)] 606) 607 608dnl Solaris, HP/UX and OpenBSD 609if test "$ac_cv_header_sys_audio_h" = yes; then 610 611 AC_COMPILE_IFELSE( 612 [AC_LANG_PROGRAM([[#include <sys/audio.h>]], 613 [[return AUDIO_SETINFO;]])], 614 [audio_driver_list="$audio_driver_list solaris"]) 615 616 AC_COMPILE_IFELSE( 617 [AC_LANG_PROGRAM([[#include <sys/audio.h>]], 618 [[return AUDIO_FORMAT_LINEAR16BIT;]])], 619 [audio_driver_list="$audio_driver_list hpux"]) 620 621elif test "$ac_cv_header_sys_audioio_h" = yes; then 622 audio_driver_list="$audio_driver_list openbsd" 623fi 624 625dnl Open sound system 626if test "$ac_cv_header_sys_soundcard_h" = yes; then 627 audio_driver_list="$audio_driver_list oss" 628fi 629 630dnl Check if CoreAudio is available 631AC_CHECK_HEADER( 632 AudioToolbox/AudioToolbox.h, 633 [audio_driver_list="$audio_driver_list coreaudio"],, 634) 635 636dnl Nintendo Wii 637if test "$wii" = yes; then 638 audio_driver_list="$audio_driver_list wii" 639fi 640 641dnl Check if pulseaudio is available (experimental) 642AC_CHECK_LIB( pulse-simple, pa_simple_new, 643 [AC_CHECK_HEADER( 644 pulse/simple.h, 645 [audio_driver_list="$audio_driver_list pulseaudio"], 646 [AC_MSG_WARN(pulse/simple.h not found - no pulseaudio output)] 647 )], 648 [AC_MSG_WARN(pa_simple_new not found - no pulseaudio output)] 649) 650 651dnl No audio driver - this is the last one of the list 652audio_driver_list="$audio_driver_list null" 653 654dnl Configure option to select an audio driver 655AC_MSG_CHECKING(which audio driver to use) 656AC_ARG_WITH(audio-driver, 657[ --with-audio-driver=DRV select audio driver (default=auto)], 658audio_driver=$withval, audio_driver=auto) 659 660dnl See if the selected audio driver is available 661audio_driver_found=no 662for drv in $audio_driver_list; do 663 dnl If audio_driver is auto then select the first one from the list 664 if test "$audio_driver" = "auto"; then 665 audio_driver=$drv 666 fi 667 668 dnl If the selected driver is on the list then stop searching 669 if test "$audio_driver" = "$drv"; then 670 audio_driver_found=yes 671 break 672 fi 673done 674 675if test $audio_driver_found = "yes"; then 676 AC_MSG_RESULT($audio_driver) 677else 678 AC_MSG_ERROR([requested audio driver $audio_driver not found. 679Available drivers: $audio_driver_list]) 680fi 681 682dnl 683dnl Add the necessary options for the selected audio driver 684dnl 685case $audio_driver in 686 sdl) 687 SOUND_LIBADD='sound/sdlsound.$(OBJEXT)' SOUND_LIBS='' sound_fifo=yes 688 use_sdl=yes 689 ;; 690 directsound) 691 SOUND_LIBADD='sound/dxsound.$(OBJEXT)' SOUND_LIBS='-ldsound -lole32 -ldxguid' 692 AC_DEFINE([DIRECTSOUND_VERSION], 0x0700, [DirectX 7 or higher is required]) 693 ;; 694 win32sound) 695 SOUND_LIBADD='sound/win32sound.$(OBJEXT)' SOUND_LIBS='-lwinmm' 696 ;; 697 alsa) 698 SOUND_LIBADD='sound/alsasound.$(OBJEXT)' SOUND_LIBS='-lasound' 699 ;; 700 libao) 701 SOUND_LIBADD='sound/aosound.$(OBJEXT)' SOUND_LIBS='-lao' 702 ;; 703 solaris | openbsd) 704 SOUND_LIBADD='sound/sunsound.$(OBJEXT)' SOUND_LIBS='' 705 ;; 706 hpux) 707 SOUND_LIBADD='sound/hpsound.$(OBJEXT)' SOUND_LIBS='' 708 ;; 709 oss) 710 SOUND_LIBADD='sound/osssound.$(OBJEXT)' SOUND_LIBS='' 711 ;; 712 coreaudio) 713 SOUND_LIBADD='sound/coreaudiosound.$(OBJEXT)' SOUND_LIBS='-framework CoreAudio -framework AudioUnit' sound_fifo=yes 714 ;; 715 wii) 716 SOUND_LIBADD='sound/wiisound.$(OBJEXT)' SOUND_LIBS='' sound_fifo=yes 717 ;; 718 pulseaudio) 719 SOUND_LIBADD='sound/pulsesound.$(OBJEXT)' SOUND_LIBS='-lpulse-simple -lpulse' 720 ;; 721 null) 722 SOUND_LIBADD='sound/nullsound.$(OBJEXT)' SOUND_LIBS='' 723 AC_DEFINE([NO_SOUND], 1, [Defined if no sound code is present]) 724 ;; 725esac 726 727if test "$sound_fifo" = yes; then 728 dnl Strange construct used here as += doesn't seem to work on OS X 729 SOUND_LIBADD="$SOUND_LIBADD"' sound/sfifo.$(OBJEXT)' 730 AC_DEFINE([SOUND_FIFO], 1, [Defined if the sound code uses a fifo]) 731fi 732 733AC_SUBST(SOUND_LIBADD) 734AC_SUBST(SOUND_LIBS) 735 736dnl Are we supplying the ROMs or relying on another package? 737AC_MSG_CHECKING(where to find the Spectrum ROM images) 738AC_ARG_WITH(roms-dir, 739 [ --with-roms-dir=DIR location of the Spectrum ROM images], 740 , 741 unset withval 742) 743if test "$withval" = ""; then 744 echo 'we supply them' 745else 746 echo "$withval" 747 AC_DEFINE_UNQUOTED(ROMSDIR, "$withval", [Location of the ROM images]) 748fi 749 750AC_MSG_CHECKING(whether hardware joystick support requested) 751 AC_ARG_WITH(joystick, 752 [ --without-joystick use a real joystick for Kempston emulation etc.], 753 if test "$withval" = no; then stick=no; else stick=yes; fi, 754 stick=yes) 755AC_MSG_RESULT($stick) 756if test "$stick" = yes; then 757 dnl We prefer to use UI-specific joystick code. (Default.) 758 dnl If there is none, or you override this here, we use libjsw. 759 dnl (svgalib appears to dislike switched joysticks on the parallel port...) 760 case "$UI" in 761 svga|sdl|win32) 762 dnl Libraries such as svgalib provide their own joystick code. 763 AC_MSG_CHECKING([whether to use $UI's joystick support]) 764 AC_ARG_ENABLE(ui-joystick, 765 AS_HELP_STRING([--disable-ui-joystick], [use libjsw joystick code (where supported)]), 766 if test "$enableval" = no; then libjsw=yes; else libjsw=no; fi, 767 libjsw=no) 768 if test "$libjsw" = yes; then 769 AC_MSG_RESULT([no, use libjsw]) 770 else 771 AC_MSG_RESULT(yes) 772 AC_DEFINE([USE_JOYSTICK], 1, [Defined if we're using hardware joysticks]) 773 fi 774 ;; 775 gtk|xlib) 776 dnl These UIs could use SDL library for handling joysticks 777 AC_MSG_CHECKING([whether to use $UI's joystick support]) 778 AC_ARG_ENABLE(ui-joystick, 779 AS_HELP_STRING([--disable-ui-joystick], [use libjsw joystick code (where supported)]), 780 if test "$enableval" = no; then libjsw=yes; else libjsw=no; fi, 781 libjsw=no) 782 if test "$libjsw" = yes; then 783 AC_MSG_RESULT([no, use libjsw]) 784 else 785 if test "$sdl_available" = yes; then 786 AC_MSG_RESULT(yes) 787 AC_DEFINE([USE_JOYSTICK], 1, [Defined if we're using hardware joysticks]) 788 use_sdl=yes 789 else 790 AC_MSG_WARN([SDL version $SDL_VERSION not found - joystick support disabled]) 791 stick=no 792 fi 793 fi 794 ;; 795 wii) 796 dnl Wii UI check this elsewhere 797 AC_MSG_RESULT(yes) 798 libjsw=no 799 ;; 800 *) 801 dnl Our only option is libjsw. 802 libjsw=yes 803 ;; 804 esac 805 if test "$libjsw" = yes; then 806 dnl Look for libjsw. If missing, use QAOP<space>. 807 AC_CHECK_HEADERS(jsw.h, 808 LIBS="$LIBS -ljsw"; 809 AC_DEFINE([USE_JOYSTICK], 1, 810 [Defined if we're using hardware joysticks]), 811 AC_MSG_WARN(jsw.h not found - joystick support disabled) 812 stick=no) 813 fi 814fi 815 816dnl See if libxml2 is available (for the config file handling) 817AC_MSG_CHECKING(whether libxml2 support requested) 818 AC_ARG_WITH(libxml2, 819 [ --without-libxml2 use a libxml2 for settings], 820 if test "$withval" = no; then libxml2=no; else libxml2=yes; fi, 821 libxml2=yes) 822AC_MSG_RESULT($libxml2) 823if test "$libxml2" = yes; then 824 PKG_CHECK_MODULES( 825 [XML], 826 [libxml-2.0 >= 2.6.0], 827 [AC_DEFINE([HAVE_LIB_XML2], 1, [Defined if we've got libxml2])], 828 [AC_MSG_WARN([libxml2 not found - config file will use ini format]) 829 libxml2="no"] 830 ) 831fi 832 833AC_SUBST(XML_CFLAGS) 834AC_SUBST(XML_LIBS) 835 836dnl Work out which timer routines to use 837AC_MSG_CHECKING(which timer routines to use) 838if test "$UI" = sdl; then 839 TIMER_LIBADD='timer/sdl.$(OBJEXT)' 840 AC_MSG_RESULT(SDL) 841else 842 TIMER_LIBADD='timer/native.$(OBJEXT)' 843 AC_MSG_RESULT(native) 844fi 845AC_SUBST(TIMER_LIBADD) 846 847dnl See if sockets are supported 848AC_MSG_CHECKING([whether sockets support requested]) 849AC_ARG_ENABLE(sockets, 850AS_HELP_STRING([--disable-sockets], [do not use sockets]), 851if test "$enableval" = yes; then sockets=yes; else sockets=no; fi, 852sockets=yes) 853AC_MSG_RESULT($sockets) 854if test "$sockets" = yes; then 855case "$host_os" in 856 mingw32*) 857 AC_CHECK_HEADER([winsock2.h], [LIBS="$LIBS -lws2_32"], [sockets=no]) 858 ;; 859 *) 860 AC_CHECK_HEADER([sys/socket.h],, [sockets=no]) 861 ;; 862esac 863fi 864AM_CONDITIONAL(HAVE_SOCKETS, test "$sockets" = yes) 865if test "$sockets" = yes; then 866 build_ttx2000s=yes 867 AC_DEFINE([BUILD_TTX2000S], 1, [Defined if we support ttx2000s]) 868else 869 build_ttx2000s=no 870fi 871AM_CONDITIONAL(BUILD_TTX2000S, test "$build_ttx2000s" = yes) 872 873dnl See if POSIX threads are supported 874AC_MSG_CHECKING([whether pthread support requested]) 875AC_ARG_WITH(pthread, 876AS_HELP_STRING([--without-pthread],[do not use POSIX threads]), 877if test "$withval" = no; then pthread=no; else pthread=yes; fi, 878pthread=yes) 879AC_MSG_RESULT($pthread) 880if test "$pthread" = yes; then 881 AX_PTHREAD([], 882 [AC_MSG_WARN(POSIX threads not found - some peripherals disabled) 883 pthread=no]) 884fi 885if test "$pthread" = yes -a "$sockets" = yes; then 886 build_spectranet=yes 887 AC_DEFINE([BUILD_SPECTRANET], 1, [Defined if we support spectranet]) 888else 889 build_spectranet=no 890fi 891AM_CONDITIONAL(BUILD_SPECTRANET, test "$build_spectranet" = yes) 892 893dnl See if Linux TAP devices are supported 894AC_MSG_CHECKING(whether Linux TAP devices are supported) 895ac_save_CPPFLAGS="$CPPFLAGS" 896CPPFLAGS="$CPPFLAGS $LIBSPECTRUM_CFLAGS" 897AC_COMPILE_IFELSE( 898 [AC_LANG_PROGRAM([[ 899 #include <linux/if_tun.h> 900 #include <net/if.h> 901 #include <sys/ioctl.h> 902 ]],[[ 903 int test1 = IFF_TAP | IFF_NO_PI; 904 int test2 = TUNSETIFF; 905 ]]) 906 ], 907 [AC_DEFINE([BUILD_SPECCYBOOT], 1, [Define to 1 if SpeccyBoot is supported.]) 908 linux_tap=yes 909 AC_MSG_RESULT(yes)], 910 [AC_MSG_RESULT(no)] 911) 912CPPFLAGS="$ac_save_CPPFLAGS" 913AM_CONDITIONAL(HAVE_TUNTAP, test x$linux_tap != x) 914AM_CONDITIONAL(BUILD_SPECCYBOOT, test x$linux_tap != x) 915 916dnl Work out which standard routines we're missing 917AC_MSG_CHECKING(which standard routines we're missing) 918missing_routines='' 919if test "$ac_cv_func_dirname" = no; then 920 missing_routines="$missing_routines"'dirname ' 921fi 922AM_CONDITIONAL(COMPAT_DIRNAME, test "$ac_cv_func_dirname" = no) 923if test "$ac_cv_func_getopt_long" = no; then 924 case "$host_os" in 925 amigaos|morphos) 926 dnl Our getopt_long replacement doesn't work, so don't use it 927 ;; 928 *) 929 compat_getopt=yes 930 missing_routines="$missing_routines"'getopt_long ' 931 ;; 932 esac 933fi 934AM_CONDITIONAL(COMPAT_GETOPT, test "$compat_getopt" = yes) 935if test "x$missing_routines" = x; then 936 missing_routines='(none)' 937fi 938AC_MSG_RESULT($missing_routines) 939 940dnl Work out which compatibility routines to use 941AC_MSG_CHECKING(which compatibility routines to use) 942case "$host_os" in 943 amigaos) 944 COMPAT_OSNAME='amiga' 945 ;; 946 linux*) 947 COMPAT_OSNAME='linux' 948 ;; 949 morphos) 950 COMPAT_OSNAME='morphos' 951 ;; 952 mingw32*) 953 COMPAT_OSNAME='win32' 954 AC_DEFINE([WINVER], 0x0500, [Minimal supported version of Windows is 2000]) 955 AC_DEFINE([_WIN32_IE], 0x501, [Internet Explorer 5.01 or higher is required]) 956 AC_DEFINE([WIN32_LEAN_AND_MEAN],, [Exclude rarely used stuff from Windows headers <windows.h>]) 957 ;; 958 wii) 959 COMPAT_OSNAME='wii' 960 ;; 961 *) 962 COMPAT_OSNAME='unix' 963 ;; 964esac 965AC_MSG_RESULT($COMPAT_OSNAME) 966AM_CONDITIONAL(COMPAT_AMIGA, test "$COMPAT_OSNAME" = 'amiga') 967AM_CONDITIONAL(COMPAT_LINUX, test "$COMPAT_OSNAME" = 'linux') 968AM_CONDITIONAL(COMPAT_MORPHOS, test "$COMPAT_OSNAME" = 'morphos') 969AM_CONDITIONAL(COMPAT_UNIX, test "$COMPAT_OSNAME" = 'unix') 970AM_CONDITIONAL(COMPAT_WII, test "$COMPAT_OSNAME" = 'wii') 971AM_CONDITIONAL(COMPAT_WIN32, test "$COMPAT_OSNAME" = 'win32') 972 973dnl This tells the Makefile to use SDL_CFLAGS and SDL_LIBS during the build 974AM_CONDITIONAL(USE_SDL, test "$use_sdl" = "yes") 975 976dnl Decide whether to install desktop and mime files 977AC_ARG_ENABLE(desktop-integration, 978AS_HELP_STRING([--enable-desktop-integration], [add menu entry and file associations]), 979if test "$enableval" = yes; then desktopintegration=yes; else desktopintegration=no; fi, 980desktopintegration=no) 981AC_MSG_CHECKING(whether to install desktop file) 982AC_MSG_RESULT($desktopintegration) 983AM_CONDITIONAL(DESKTOP_INTEGRATION, test "$desktopintegration" = yes) 984AC_CHECK_PROGS(GTK_UPDATE_ICON_CACHE,gtk-update-icon-cache,true) 985if test "$desktopintegration" = "yes"; then 986 AC_DEFINE([FUSE_ICON_AVAILABLE], 1, [Defined if the Fuse icon is installed]) 987fi 988 989dnl Where to install the desktop and mime files 990AC_ARG_WITH(desktop-dir, 991AS_HELP_STRING([--with-desktop-dir=DIR], [location of desktop files (default=datadir)]), 992if test "$withval" = no; then desktopdir=no; else desktopdir=yes; fi, 993desktopdir=no) 994if test "$desktopdir" = yes; then 995 DESKTOP_DATADIR=$with_desktop_dir 996else 997 DESKTOP_DATADIR="$datadir" 998fi 999AM_CONDITIONAL(DESKTOP_DATADIR, test "$desktopdir" = yes) 1000AC_SUBST(DESKTOP_DATADIR) 1001 1002dnl Where to install the bash completion script 1003AC_ARG_WITH([bash-completion-dir], 1004 [AS_HELP_STRING([--with-bash-completion-dir=DIR], 1005 [install bash completion script in given directory])], 1006 if test "$withval" = no; then with_bash_completion_dir=""; fi 1007) 1008if test "$with_bash_completion_dir" = yes; then 1009 PKG_CHECK_VAR([BASH_COMPLETION_DIR], [bash-completion], [completionsdir], [], 1010 [BASH_COMPLETION_DIR="${sysconfdir}/bash_completion.d"]) 1011else 1012 BASH_COMPLETION_DIR="$with_bash_completion_dir" 1013fi 1014AM_CONDITIONAL([BASH_COMPLETION], [test -n "$BASH_COMPLETION_DIR"]) 1015AC_SUBST([BASH_COMPLETION_DIR]) 1016 1017dnl Do we want the low memory compile? 1018AC_MSG_CHECKING(whether low memory compile requested) 1019AC_ARG_ENABLE(smallmem, 1020[ --enable-smallmem low memory compile needed], 1021if test "$enableval" = yes; then 1022 smallmem=yes; 1023else 1024 smallmem=no; 1025fi, 1026smallmem=no) 1027if test "$smallmem" = no; then 1028 AC_DEFINE([HAVE_ENOUGH_MEMORY], 1, [Defined if we've got enough memory to compile z80_ops.c]) 1029fi 1030AC_MSG_RESULT($smallmem) 1031 1032dnl Do we want lots of warning messages? 1033AC_MSG_CHECKING(whether lots of warnings requested) 1034AC_ARG_ENABLE(warnings, 1035[ --enable-warnings give lots of warnings if using gcc], 1036if test "$enableval" = yes; then 1037 warnings=yes; 1038else 1039 warnings=no; 1040fi, 1041warnings=no) 1042AC_MSG_RESULT($warnings) 1043 1044dnl If it appears we're using gcc as our compiler, turn on warnings 1045if test "$ac_cv_c_compiler_gnu" = yes; then 1046 WARN_CFLAGS="-Wall -Wwrite-strings" 1047 dnl And possibly lots of warnings 1048 if test "$warnings" = yes; then 1049 WARN_CFLAGS="$WARN_CFLAGS -Wstrict-prototypes -Winline -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Waggregate-return -W -Wsign-compare" 1050 fi 1051fi 1052AC_SUBST(WARN_CFLAGS) 1053 1054AC_CONFIG_FILES([ 1055Makefile 1056data/win32/fuse.manifest 1057data/win32/installer.nsi 1058]) 1059 1060AC_OUTPUT 1061 1062dnl Status summary 1063echo "" 1064echo "****************************" 1065echo "*** Libspectrum features ***" 1066echo "****************************" 1067echo "" 1068echo "Internal GLib replacement: ${fakeglib}" 1069echo "zlib support: ${LIBSPEC_HAVE_ZLIB:-no}" 1070echo "bzip2 support: ${LIBSPEC_HAVE_BZ2:-no}" 1071echo "audiofile support: ${LIBSPEC_HAVE_AUDIOFILE:-no}" 1072echo "" 1073echo "********************" 1074echo "*** Fuse options ***" 1075echo "********************" 1076echo "" 1077echo "User interface: ${UI}" 1078if test "${UI}" = "gtk"; then 1079 echo "Using GTK 3: ${gtk3}" 1080fi 1081if test "${use_sdl}" = "yes"; then 1082 echo "Using SDL 2: ${sdl2}" 1083fi 1084if test x"${gpm}" != "x"; then 1085 echo "libgpm support: ${gpm}" 1086fi 1087echo "Joystick support: ${stick}" 1088if test "${stick}" = "yes"; then 1089 echo "Using libjsw for joystick support: ${libjsw}" 1090fi 1091echo "zlib support: ${zlib}" 1092echo "libxml2 support: ${libxml2}" 1093echo "libpng support: ${libpng}" 1094echo "Available audio drivers: ${audio_driver_list}" 1095echo "Selected audio driver: ${audio_driver}" 1096echo "Spectranet support: ${build_spectranet}" 1097echo "SpeccyBoot support: ${linux_tap:-no}" 1098echo "TTX2000 S support: ${build_ttx2000s}" 1099echo "Desktop integration: ${desktopintegration}" 1100echo "" 1101echo "Type 'make' to compile Fuse" 1102echo "" 1103