1dnl
2dnl This file is part of VICE, the Versatile Commodore Emulator.
3dnl See README for copyright notice.
4dnl
5dnl Process this file with GNU autoconf to produce a configure script.
6dnl
7
8AC_INIT(src/maincpu.c)
9
10dnl Command-line options
11VICE_ARG_INIT()
12
13VICE_VERSION_MAJOR=3
14VICE_VERSION_MINOR=3
15VICE_VERSION_BUILD=0
16
17dnl Miminum required version of yasm to build static/shared ffmpeg
18YASM_VERSION_MAJOR=1
19YASM_VERSION_MINOR=2
20YASM_VERSION_BUILD=0
21
22
23VICE_ARG_WITH_LIST(readline,      [  --without-readline      do not try to use the system's readline library])
24VICE_ARG_WITH_LIST(arts,          [  --with-arts             use aRts sound system])
25VICE_ARG_WITH_LIST(pulse,         [  --without-pulse         do not use PulseAudio sound system])
26VICE_ARG_WITH_LIST(alsa,          [  --without-alsa          do not use the ALSA sound system])
27VICE_ARG_WITH_LIST(oss,           [  --without-oss           do not use the OSS sound system])
28VICE_ARG_WITH_LIST(sdlsound,      [  --with-sdlsound         use SDL sound system])
29VICE_ARG_WITH_LIST(resid,         [  --without-resid         do not use the reSID engine])
30VICE_ARG_WITH_LIST(jpeg,          [  --without-jpeg          do not use the JPEG screenshot system])
31VICE_ARG_WITH_LIST(png,           [  --without-png           do not use the PNG screenshot system])
32VICE_ARG_WITH_LIST(gif,           [  --without-gif           do not use the GIF screenshot sustem])
33VICE_ARG_WITH_LIST(zlib,          [  --without-zlib          do not use the zlib support])
34VICE_ARG_ENABLE_LIST(sdlui,       [  --enable-sdlui          enables SDL UI support])
35VICE_ARG_ENABLE_LIST(sdlui2,      [  --enable-sdlui2         enables SDL2 UI support])
36VICE_ARG_ENABLE_LIST(native-gtk3ui,[  --enable-native-gtk3ui  enables native GTK3 UI support])
37VICE_ARG_ENABLE_LIST(debug-gtk3ui, [ --enable-debug-gtk3ui    enables debugging for the GTK3 port])
38VICE_ARG_ENABLE_LIST(realdevice,  [  --disable-realdevice    disables access to real peripheral devices (CBM4Linux/OpenCBM)])
39VICE_ARG_ENABLE_LIST(shared-ffmpeg, [  --enable-shared-ffmpeg  enable included shared FFmpeg support])
40VICE_ARG_ENABLE_LIST(static-ffmpeg, [  --enable-static-ffmpeg  enable included static FFmpeg support])
41VICE_ARG_ENABLE_LIST(external-ffmpeg, [ --enable-external-ffmpeg  enable external FFmpeg support])
42VICE_ARG_ENABLE_LIST(quicktime,   [  --enable-quicktime      enables Apple QuickTime support])
43VICE_ARG_ENABLE_LIST(ethernet,    [  --enable-ethernet       enables The Final Ethernet emulation])
44VICE_ARG_ENABLE_LIST(ipv6,        [  --disable-ipv6          disables the checking for IPv6 compatibility])
45VICE_ARG_ENABLE_LIST(ssi2001,     [  --disable-ssi2001       disables SSI2001 (ISA SID card) support])
46VICE_ARG_ENABLE_LIST(catweasel,   [  --disable-catweasel     disables CatWeasel (PCI/Zorro/Clockport SID card) support])
47VICE_ARG_ENABLE_LIST(hardsid,     [  --disable-hardsid       disables HardSID support])
48VICE_ARG_ENABLE_LIST(parsid,      [  --disable-parsid        disables ParSID support])
49VICE_ARG_ENABLE_LIST(libieee1284, [  --enable-libieee1284    enables libieee1284 support])
50VICE_ARG_ENABLE_LIST(portaudio,   [  --disable-portaudio     disables PortAudio support])
51VICE_ARG_ENABLE_LIST(ahi,         [  --disable-ahi           disables AHI support])
52VICE_ARG_ENABLE_LIST(bundle,      [  --disable-bundle        do not use application bundles on Macs])
53VICE_ARG_ENABLE_LIST(cpuhistory,  [  --enable-cpuhistory     enable the 65xx cpu history feature])
54VICE_ARG_ENABLE_LIST(lame,        [  --disable-lame          disable MP3 export with LAME])
55VICE_ARG_ENABLE_LIST(static-lame, [  --enable-static-lame    enable static LAME linking])
56VICE_ARG_ENABLE_LIST(rs232,       [  --disable-rs232         disable RS232 support])
57VICE_ARG_ENABLE_LIST(midi,        [  --disable-midi          disable MIDI support])
58VICE_ARG_ENABLE_LIST(platformdox, [  --enable-platformdox    enable generating of documentation specific to the current host])
59VICE_ARG_ENABLE_LIST(embedded,    [  --enable-embedded       enable embedding of emulation data files])
60VICE_ARG_ENABLE_LIST(hidmgr,      [  --disable-hidmgr        disable IOHIDManager joystick support on Mac])
61VICE_ARG_ENABLE_LIST(hidutils,    [  --disable-hidutils      disable HID Uitlities joystick support on Mac])
62VICE_ARG_ENABLE_LIST(debug,       [  --enable-debug          enable debug source options])
63VICE_ARG_ENABLE_LIST(native-tools,[  --enable-native-tools[[=compiler]]    enable native tools instead of scripts])
64
65dnl register ReSID options here to pass arg checks
66VICE_ARG_ENABLE_LIST(inline,      [  --enable-inline         enable inlining of functions [default=yes]])
67VICE_ARG_ENABLE_LIST(arch,        [  --enable-arch[[=arch]]    enable architecture specific compilation [[default=yes]]], [], [enable_arch=yes])
68VICE_ARG_ENABLE_LIST(no-pic,      [  --enable-no-pic         enable the use of the no-pic switch [[default=yes]]])
69
70AC_ARG_VAR(FW_DIR, [Location of support frameworks (macOS only)])
71
72dnl this hack is needed because the default for the auto-tools
73dnl is 'no', and we want the default to be 'yes' unless
74dnl '--disable-option-checking' is used.
75enable_option_checking=yes
76for command_option in $@
77do
78  if test x"$command_option" = "x--disable-option-checking"; then
79    enable_option_checking=no
80  fi
81done
82
83dnl check for invalid options
84echo "option checking is $enable_option_checking"
85if test x"$enable_option_checking" = "xyes"; then
86  VICE_ARG_LIST_CHECK()
87fi
88
89dnl check for conflicting ui options
90vice_ui_list="--enable-sdlui --enable-sdlui2 --enable-native-gtk3ui"
91vice_ui_1=none
92vice_ui_2=none
93
94for command_option in $@
95do
96  for vice_ui in $vice_ui_list
97  do
98    if test x"$command_option" = x"$vice_ui"; then
99      if test x"$vice_ui_1" = "xnone"; then
100        vice_ui_1=$vice_ui
101      else
102        vice_ui_2=$vice_ui
103      fi
104    fi
105  done
106done
107
108if test x"$vice_ui_1" != "xnone" -a x"$vice_ui_2" != "xnone"; then
109  AC_MSG_ERROR([conflicting UI options: $vice_ui_1 $vice_ui_2])
110fi
111
112
113dnl Test for bash for building static/shared ffmpeg
114if test x"$enable_shared_ffmpeg" = "xyes" -o x"$enable_static_ffmpeg" = "xyes"; then
115  AC_CHECK_PROG(ffmpeg_have_bash, bash, "yes", "no")
116  if test x"$ffmpeg_have_bash" != "xyes"; then
117    AC_MSG_ERROR([bash is required for ffmpeg compiling])
118  fi
119fi
120
121dnl check for conflicting ffmpeg options
122vice_ffmpeg_list="--enable-static-ffmpeg --enable-shared-ffmpeg --enable-external-ffmpeg"
123vice_ffmpeg_1=none
124vice_ffmpeg_2=none
125
126for command_option in $@
127do
128  for vice_ffmpeg in $vice_ffmpeg_list
129  do
130    if test x"$command_option" = x"$vice_ffmpeg"; then
131      if test x"$vice_ffmpeg_1" = "xnone"; then
132        vice_ffmpeg_1=$vice_ffmpeg
133      else
134        vice_ffmpeg_2=$vice_ffmpeg
135      fi
136    fi
137  done
138done
139
140if test x"$vice_ffmpeg_1" != "xnone" -a x"$vice_ffmpeg_2" != "xnone"; then
141  AC_MSG_ERROR([conflicting FFMPEG options: $vice_ffmpeg_1 $vice_ffmpeg_2])
142fi
143
144AC_SUBST(VICE_VERSION_MAJOR)
145AC_SUBST(VICE_VERSION_MINOR)
146AC_SUBST(VICE_VERSION_BUILD)
147
148if test x"$VICE_VERSION_BUILD" = "x" -o x"$VICE_VERSION_BUILD" = "x0" ; then
149  VICE_VERSION=$VICE_VERSION_MAJOR"."$VICE_VERSION_MINOR
150else
151  VICE_VERSION=$VICE_VERSION_MAJOR"."$VICE_VERSION_MINOR"."$VICE_VERSION_BUILD
152  AC_DEFINE(UNSTABLE,,[Define if this version is unstable.])
153fi
154AC_SUBST(VICE_VERSION)
155
156AM_INIT_AUTOMAKE(vice, $VICE_VERSION)
157AC_CONFIG_HEADERS(src/config.h)
158
159if test x"$VICE_VERSION_BUILD" = "x" -o x"$VICE_VERSION_BUILD" = "x0" ; then
160  VERSION_RC=$VICE_VERSION_MAJOR","$VICE_VERSION_MINOR",0,0"
161else
162  VERSION_RC=$VICE_VERSION_MAJOR","$VICE_VERSION_MINOR","$VICE_VERSION_BUILD",0"
163fi
164AC_SUBST(VERSION_RC)
165
166VERSION_COMBINED=`expr $VICE_VERSION_MAJOR \* 65536 + $VICE_VERSION_MINOR \* 256 + $VICE_VERSION_BUILD`
167AC_SUBST(VERSION_COMBINED)
168
169is_unix=no
170is_unix_x11=no
171is_unix_macosx=no
172is_win32=no
173is_win32_x11=no
174is_win32_gtk3=no
175is_os2=no
176is_beos=no
177is_amiga=no
178
179HAVE_CAIRO_SUPPORT="no "
180HAVE_PANGO_SUPPORT="no "
181HAVE_HWSCALE_SUPPORT="no "
182HAVE_LIBXPM_SUPPORT="no "
183
184HAVE_CATWEASELMKIII_SUPPORT="no "
185HAVE_HARDSID_SUPPORT="no "
186HAVE_MIDI_SUPPORT="no "
187HAVE_PARSID_SUPPORT="no "
188HAVE_SSI2001_SUPPORT="no "
189HAVE_IOSID_SUPPORT="no "
190HAVE_PORTSID_SUPPORT="no "
191HAVE_PCIUTILS_SUPPORT="no "
192HAVE_SYS_AUDIO_H_SUPPORT="no "
193HAVE_SYS_AUDIOIO_H_SUPPORT="no "
194USE_AIX_AUDIO_SUPPORT="no "
195USE_ALSA_SUPPORT="no "
196USE_ARTS_SUPPORT="no "
197USE_DMEDIA_SUPPORT="no "
198USE_OSS_SUPPORT="no "
199USE_PORTAUDIO_SUPPORT="no "
200USE_PULSE_SUPPORT="no "
201USE_SDL_AUDIO_SUPPORT="no "
202USE_LAMEMP3_SUPPORT="no "
203USE_MPG123_SUPPORT="no "
204USE_FLAC_SUPPORT="no "
205USE_VORBIS_SUPPORT="no "
206USE_COREAUDIO_SUPPORT="no "
207HAVE_AUDIO_UNIT_SUPPORT="no "
208HAVE_DEVICES_AHI_H_SUPPORT="no "
209USE_DXSOUND_SUPPORT="no "
210
211HAVE_GIF_SUPPORT="no "
212HAVE_JPEG_SUPPORT="no "
213HAVE_PNG_SUPPORT="no "
214
215HAVE_FFMPEG_SUPPORT="no "
216HAVE_FFMPEG_SWSCALE_SUPPORT="no "
217HAVE_FFMPEG_SWRESAMPLE_SUPPORT="no "
218HAVE_FFMPEG_AVRESAMPLE_SUPPORT="no "
219SHARED_FFMPEG_SUPPORT="no "
220STATIC_FFMPEG_SUPPORT="no "
221HAVE_QUICKTIME_SUPPORT="no "
222
223HAS_JOYSTICK_SUPPORT="no "
224HAVE_MOUSE_SUPPORT="no "
225HAVE_LIGHTPEN_SUPPORT="no "
226LINUX_JOYSTICK_SUPPORT="no "
227BSD_JOYSTICK_SUPPORT="no "
228HAS_DIGITAL_JOYSTICK_SUPPORT="no "
229HAS_USB_JOYSTICK_SUPPORT="no "
230MAC_JOYSTICK_SUPPORT="no "
231HAS_HIDMGR_SUPPORT="no "
232HAVE_DINPUT_SUPPORT="no "
233HAVE_SDL_NUMJOYSTICKS_SUPPORT="no "
234
235HAVE_RS232DEV_SUPPORT="no "
236HAVE_NETWORK_SUPPORT="no "
237HAVE_RS232NET_SUPPORT="no "
238HAVE_IPV6_SUPPORT="no "
239HAVE_RAWNET_SUPPORT="no "
240
241HAVE_RAWDRIVE_SUPPORT="no "
242HAVE_OPENCBM_SUPPORT="no "
243
244HAVE_DYNLIB_SUPPORT_TOO="no "
245
246HAVE_ZLIB_SUPPORT="no "
247HAVE_LIBIEEE1284_SUPPORT="no "
248HAVE_PROTO_OPENPCI_H_SUPPORT="no "
249
250HAVE_RESID_SUPPORT="no "
251FEATURE_CPUMEMHISTORY_SUPPORT="no "
252DEBUG_SUPPORT="no "
253USE_EMBEDDED_SUPPORT="no "
254
255HAVE_FONTCONFIG_SUPPORT="no"
256
257AM_CONDITIONAL(DUMMY_COMPILE, false)
258
259dnl Try to find out which system we are on...
260AC_CANONICAL_HOST
261
262if test x"$enable_cpuhistory" = "xyes"; then
263  AC_DEFINE(FEATURE_CPUMEMHISTORY,,[Use the 65xx cpu history feature.])
264  FEATURE_CPUMEMHISTORY_SUPPORT="yes"
265fi
266
267AM_CONDITIONAL(VICE_QUIET, test x"$verbose" != "xyes")
268
269user_cflags=$CFLAGS
270AC_PROG_CC([gcc clang cc])
271AC_LIB_PROG_LD
272
273AC_CHECK_TOOL(objdump, objdump, no)
274
275PKG_PROG_PKG_CONFIG
276
277SOUND_DRIVERS=""
278
279dnl Check if the user has disabled all GUIs
280if test x"$enable_native_gtk3ui" = "xno" -a x"$enable_sdlui" = "xno" -a x"$enable_sdlui2" = "xno"; then
281  AC_MSG_ERROR([You cannot disable all GUIs])
282fi
283
284dnl Check if a GUI order check needs to be done
285if test x"$enable_native_gtk3ui" != "xyes" -a x"$enable_sdlui" != "xyes" -a x"$enable_sdlui2" != "xyes"; then
286  check_guis=yes
287fi
288
289dnl Check if gtk3 ui should be checked
290if test x"$check_guis" = "xyes"; then
291  if test x"$enable_native_gtk3ui" != "xno"; then
292    check_gtk3=yes
293  fi
294else
295  if test x"$enable_native_gtk3ui" = "xyes"; then
296    check_gtk3=yes
297  fi
298fi
299
300
301dnl Do these checks before any Gtk3 flags are added
302AC_MSG_CHECKING(for time_t in time.h)
303AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
304[AC_TRY_COMPILE([#include <time.h>], [time_t i;],
305bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
306AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
307if test $bu_cv_decl_time_t_time_h = yes; then
308  AC_DEFINE([HAVE_TIME_T_IN_TIME_H],,
309	    [Is the type time_t defined in <time.h>?])
310fi
311
312AC_MSG_CHECKING(for time_t in sys/types.h)
313AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
314[AC_TRY_COMPILE([#include <sys/types.h>], [time_t i;],
315bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
316AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
317if test $bu_cv_decl_time_t_types_h = yes; then
318  AC_DEFINE([HAVE_TIME_T_IN_TYPES_H],,
319	    [Is the type time_t defined in <sys/types.h>?])
320fi
321
322if test $bu_cv_decl_time_t_time_h = yes; then
323  AC_CHECK_SIZEOF([time_t],[],[#include <time.h>])
324else
325  AC_CHECK_SIZEOF([time_t],[],[#include <sys/types.h>])
326fi
327
328if test "x$ac_cv_sizeof_time_t" = "x4"; then
329  AC_DEFINE([TIME_T_IS_32BIT],,[time_t is 32 bit])
330elif test "x$ac_cv_sizeof_time_t" = "x8"; then
331  AC_DEFINE([TIME_T_IS_64BIT],,[time_t is 64 bit])
332else
333  AC_MSG_ERROR([can not figure type of time_t])
334fi
335
336
337dnl Check and setup native GTK3 compilation, only fail if the gtk3 ui was requested
338if test x"$check_gtk3" = "xyes"; then
339
340  PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.22], [have_gtk3_module=yes], [have_gtk3_module=no; AC_MSG_RESULT([no])])
341  AC_DEFINE(HAVE_CAIRO,,[Enable Cairo rendering support])
342  HAVE_CAIRO_SUPPORT="yes"
343  PKG_CHECK_MODULES(GLIB, [glib-2.0], [have_glib2_module=yes], [have_glib2_module=no; AC_MSG_RESULT([no])])
344
345  dnl error out if gtk3 support is missing and gtk3 ui was requested
346  if test x"$have_gtk3_module" = "xno" -o x"$have_glib2_module" = "xno"; then
347    if test x"$enable_native_gtk3ui" = "xyes"; then
348      AC_MSG_ERROR([GTK3 UI requested, but GTK3 support packages are missing])
349    fi
350  fi
351
352  dnl only continue to test if gtk3 support was present
353  if test x"$have_gtk3_module" = "xyes" -a x"$have_glib2_module" = "xyes"; then
354
355    CFLAGS="$CFLAGS $GLIB_CFLAGS $GTK_CFLAGS"
356    LIBS="$LIBS $GTK_LIBS $GLIB_LIBS"
357
358    if test x"$is_unix_macosx" = "xyes"; then
359      dnl GTK3-FIXME: put OSX specific checks here
360      :
361    elif test x"$is_win32" = "xyes"; then
362      dnl GTK3-FIXME: put windows specific checks here
363      :
364    else
365      dnl GTK3-FIXME: put *nix specific checks here
366      :
367    fi
368
369    dnl Check for OpenGL 3.x and (on platforms that need it) GLEW.
370
371    AC_MSG_CHECKING(whether we can use the GL library)
372    old_LIBS="$LIBS"
373    LIBS="$LIBS -lGL -lGLEW"
374    AC_TRY_LINK([#include <GL/glew.h>],
375                [glewInit()],
376                [AC_MSG_RESULT(yes);
377                 have_opengl_lib=yes;
378                 have_glew=yes],
379                [AC_MSG_RESULT(no);
380                 LIBS="$old_LIBS"])
381    if test x"$have_opengl_lib" != "xyes"; then
382      AC_MSG_CHECKING(whether we can use the opengl32 library...)
383      old_LIBS="$LIBS"
384      LIBS="$LIBS -lopengl32 -lglew32"
385      AC_TRY_LINK([#include <GL/glew.h>],
386                  [glewInit()],
387                  [AC_MSG_RESULT(yes);
388                   have_opengl_lib=yes;
389                   have_glew=yes],
390                  [AC_MSG_RESULT(no);
391                   LIBS="$old_LIBS"])
392    fi
393
394    if test x"$have_opengl_lib" != "xyes" -a x"$is_unix_macosx" = "xyes"; then
395      AC_MSG_CHECKING(whether we can use the OpenGL Framework)
396      old_LIBS="$LIBS"
397      LIBS="$LIBS -framework OpenGL"
398      AC_TRY_LINK([#define GL_GLEXT_PROTOTYPES
399                   #include <OpenGL/gl.h>],
400                   [glUniform4f(0,1,2,3,4);],
401                   [AC_MSG_RESULT(yes);
402                    have_opengl_lib=yes],
403                   [AC_MSG_RESULT(no);
404                    LIBS="$old_LIBS"])
405    fi
406
407    dnl Note that even if HAVE_HWSCALE is "no", GTK3's base "Cairo"
408    dnl renderer can still do scaling, and even claims to do it in
409    dnl hardware. Our experimentation suggests that this is more
410    dnl aspirational than genuine, though...
411    AC_DEFINE(HAVE_HWSCALE,,[Enable arbitrary window scaling])
412    HAVE_HWSCALE_SUPPORT="yes"
413    if test x"$have_opengl_lib" = "xyes"; then
414      AC_DEFINE(HAVE_GTK3_OPENGL,,[Enable OpenGL support in GTK3 UI])
415    fi
416    if test x"$have_glew" = "xyes"; then
417      AC_DEFINE(HAVE_GTK3_GLEW,,[GTK3 OpenGL support uses GLEW])
418    fi
419    AC_DEFINE(USE_NATIVE_GTK3,,[Use native GTK3 UI.])
420    if test x"$enable_debug_gtk3ui" = "xyes"; then
421      AC_DEFINE(HAVE_DEBUG_GTK3UI,,[Add native GTK3 UI debugging code.])
422    fi
423
424    dnl Check for C++11 support (for novte) and update CXXFLAGS
425    AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
426    CXXFLAGS="$CXXFLAGS -std=c++11"
427
428    dnl Platform canonical names for Win32-GTK3 have names like "i686-w64-mingw32"
429    case "$host_os" in
430      *mingw32)
431          host_os=mingw32-gtk3
432          is_win32_gtk3=yes
433          dnl Required for GetUserProfileDirectoryA
434          LIBS="$LIBS -luserenv"
435          dnl Needed for cross-building win32, -static makes some CoInitialize
436          dnl check fail, so I had to leave that out. This also works on msys2.
437          dnl Still need libstdc++-6.dll in the bindist, even with that
438          dnl -static-libstdc++.
439          LIBS="$LIBS -static-libgcc -static-libstdc++"
440
441    esac
442
443    dnl check for fontconfig
444    PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.0.0],
445        [HAVE_FONTCONFIG_SUPPORT=yes; LIBS="$LIBS -lfontconfig"],
446        AC_MSG_ERROR([failed to find fontconfig]))
447    AC_DEFINE(HAVE_FONTCONFIG,,[Use fontconfig for custom fonts.])
448
449    dnl now that the GTK3 UI support has been detected, define enable_native_gtk3ui and undefine the others to prevent checks
450    enable_native_gtk3ui=yes
451    enable_sdlui=no
452    enable_sdlui2=no
453    found_gui=gtk3
454
455
456  fi
457fi
458
459dnl Check if sdl2 ui should be checked
460if test x"$check_guis" = "xyes"; then
461  if test x"$enable_sdlui2" != "xno"; then
462    check_sdl2=yes
463  fi
464else
465  if test x"$enable_sdlui2" = "xyes"; then
466    check_sdl2=yes
467  fi
468fi
469if test x"$with_sdlsound" = "xyes"; then
470  check_sdl2=yes
471fi
472
473dnl Check and setup SDL2 compilation, only fail if the sdl2 ui was requested
474if test x"$check_sdl2" = "xyes"; then
475  old_cflags=$CFLAGS
476  old_cxxflags=$CXXFLAGS
477  old_libs=$LIBS
478
479  found_sdl2=no
480
481  dnl Check for SDL2.framework
482  if test x"$FW_DIR" != "x"; then
483    CFLAGS="$CFLAGS -F$FW_DIR"
484    CXXFLAGS="$CXXFLAGS -F$FW_DIR"
485    LIBS="$LIBS -F$FW_DIR -framework SDL2"
486
487    AC_MSG_CHECKING(for SDL2.framework)
488    AC_TRY_LINK([#include <SDL2/SDL.h>],
489                [SDL_GetNumRenderDrivers()],
490                [AC_MSG_RESULT(yes);
491                 use_sdl_prefix=no;
492                 use_sdl2_prefix=yes;
493                 found_sdl2=yes],
494                [AC_MSG_RESULT(no);
495                 CFLAGS=$old_cflags;
496                 CXXFLAGS=$old_cxxflags;
497                 LIBS=$old_libs])
498    AC_SUBST(FW_DIR)
499  fi
500
501  if test x"$found_sdl2" != "xyes"; then
502    dnl Check for sdl2-config
503    AC_CHECK_TOOL(sdl2_config, sdl2-config, no)
504    if test x"$sdl2_config" != "xno"; then
505      CFLAGS="$CFLAGS `$sdl2_config --cflags`"
506      CXXFLAGS="$CXXFLAGS `$sdl2_config --cflags`"
507      LIBS="$LIBS `$sdl2_config --libs`"
508
509      dnl Determine whether we need to add SDL2/ as a prefix.
510      AC_MSG_CHECKING(whether SDL2 requires a prefix on includes)
511      AC_TRY_LINK([#include <SDL2/SDL_render.h>],
512                  [SDL_GetNumRenderDrivers()],
513                  [AC_MSG_RESULT(yes);
514                   use_sdl_prefix=no;
515                   use_sdl2_prefix=yes;
516                   found_sdl2=yes],
517                  [AC_MSG_RESULT(no)])
518
519      if test x"$found_sdl2" != "xyes"; then
520        AC_MSG_CHECKING(whether SDL2 works without a prefix)
521        AC_TRY_LINK([#include <SDL_render.h>],
522                    [SDL_GetNumRenderDrivers()],
523                    [AC_MSG_RESULT(yes);
524                     use_sdl_prefix=no;
525                     use_sdl2_prefix=no;
526                     found_sdl2=yes],
527                    [AC_MSG_RESULT(no)])
528      fi
529    fi
530  fi
531
532  dnl fail if SDL2 ui was requested, otherwise restore flags and continue
533  if test x"$found_sdl2" = "xno"; then
534    CFLAGS=$old_cflags
535    CXXFLAGS=$old_cxxflags
536    LIBS=$old_libs
537
538    if test x"$enable_sdlui2" = "xyes"; then
539      AC_MSG_ERROR([SDL2 UI requested, but SDL2 is missing])
540    fi
541  fi
542
543  dnl only continue if sdl2-config was found
544  if test x"$found_sdl" != "xno"; then
545    if test x"$use_sdl2_prefix" != "xno"; then
546      AC_DEFINE(USE_SDL2_PREFIX,,[Enable SDL2 prefix for header inclusion.])
547    fi
548
549    dnl check for the 2 cases where audio needs to be checked
550    check_sdl2audio=no
551    if test x"$enable_sdlui2" = "xno"; then
552      if test x"$with_sdlsound" = "xyes"; then
553        check_sdl2audio=yes
554      fi
555    else
556        check_sdl2audio=yes
557    fi
558
559    dnl only do if audio needs to be checked
560    if test x"$check_sdl2audio" = "xyes"; then
561      AC_MSG_CHECKING(for SDL audio support)
562      if test x"$use_sdl2_prefix" = "xyes"; then
563        AC_TRY_LINK([#include <SDL2/SDL_audio.h>],
564                    [SDL_OpenAudio(NULL, NULL)],
565                    [AC_MSG_RESULT(yes);
566                     USE_SDL_AUDIO_SUPPORT="yes";
567                     AC_DEFINE(USE_SDL_AUDIO,,[Enable SDL sound support.])],
568                    [AC_MSG_RESULT(no);])
569      else
570        AC_TRY_LINK([#include <SDL_audio.h>],
571                    [SDL_OpenAudio(NULL, NULL)],
572                    [AC_MSG_RESULT(yes);
573                     USE_SDL_AUDIO_SUPPORT="yes";
574                     AC_DEFINE(USE_SDL_AUDIO,,[Enable SDL sound support.])],
575                    [AC_MSG_RESULT(no);])
576      fi
577
578      dnl fail if --with-sdlsound was given
579      if test x"$USE_SDL_AUDIO_SUPPORT" != "xyes"; then
580        if test x"$with_sdlsound" = "xyes"; then
581          AC_MSG_ERROR([SDL sound support missing])
582        fi
583      else
584        SOUND_DRIVERS="$SOUND_DRIVERS soundsdl.o"
585      fi
586    fi
587
588    dnl SDL2 now definitely works, so set the last few settings.
589    dnl SDL2 is much more consistent than SDL1 so none of these
590    dnl actually require tests.
591    if test x"$enable_sdlui2" != "xno"; then
592      AC_DEFINE(USE_SDLUI2,,[Enable SDL2 UI support.])
593      AC_DEFINE(HAVE_FULLSCREEN,,[Enable Fullscreen support.])
594      HAVE_FULLSCREEN_SUPPORT="yes"
595      AC_DEFINE(HAVE_HWSCALE,,[Enable arbitrary window scaling])
596      HAVE_HWSCALE_SUPPORT="yes"
597      dnl SDL2 never requires SDLmain replacement. Including SDL.h
598      dnl itself and relying on sdl2-config's replies do all the
599      dnl work we require.
600
601      AC_CHECK_FUNCS(SDL_NumJoysticks)
602
603      dnl now that the SDL2 UI support has been detected, define
604      dnl enable_sdlui2 and undefine the others to prevent checks
605
606      enable_native_gtk3ui=no
607      enable_sdlui=no
608      enable_sdlui2=yes
609      found_gui=sdl2
610
611      case "$host_os" in
612        *mingw32)
613          dnl Required for GetUserProfileDirectoryA
614          LIBS="$LIBS -luserenv"
615          ;;
616      esac
617    fi
618  fi
619fi
620
621dnl Check if sdl ui should be checked
622if test x"$check_guis" = "xyes"; then
623  if test x"$enable_sdlui" != "xno"; then
624    check_sdl1=yes
625  fi
626else
627  if test x"$enable_sdlui" = "xyes"; then
628    check_sdl1=yes
629  fi
630fi
631if test x"$with_sdlsound" = "xyes"; then
632  check_sdl1=yes
633fi
634
635dnl Check and setup SDL compilation.
636if test x"$check_sdl1" = "xyes"; then
637
638  dnl check for the 2 cases where audio needs to be checked
639  check_sdlaudio=no
640  if test x"$ac_cv_lib_SDL2_SDL_OpenAudio" != "xyes"; then
641    if test x"$enable_sdlui" = "xno"; then
642      if test x"$with_sdlsound" = "xyes"; then
643        check_sdlaudio=yes
644      fi
645    else
646      check_sdlaudio=yes
647    fi
648  fi
649
650  if test x"$host_os" = "xmingw32ce" -o x"$host_os" = "xcegcc"; then
651    LIBS="$LIBS -lSDL -lwinsock"
652    SOUND_DRIVERS="$SOUND_DRIVERS soundsdl.o"
653    USE_SDL_AUDIO_SUPPORT="yes"
654    AC_DEFINE(USE_SDL_AUDIO,,[Enable SDL sound support.])
655    if test x"$enable_sdlui" != "xno"; then
656      AC_DEFINE(USE_SDLUI,,[Enable SDL UI support.])
657    fi
658    AC_DEFINE(CEGCC_COMPILE,,[Enable cegcc support.])
659  elif test x"$is_amiga" = "xyes" -a x"$is_amiga_aros" != "xyes" -a x"$enable_sdlui2" != "xyes"; then
660    if test x"$enable_sdlui" != "xno"; then
661      AC_DEFINE(USE_SDLUI,,[Enable SDL UI support.])
662    fi
663    AC_CHECK_HEADER(inline/SDL.h,[SDL_AMIGA_INLINE=yes], [SDL_AMIGA_INLINE=no],)
664    AC_CHECK_HEADER(ppcinline/powersdl.h,[POWERSDL_AMIGA_INLINE=yes], [POWERSDL_AMIGA_INLINE=no],)
665    AC_CHECK_LIB(debug, kprintf, [LIBS="$LIBS -ldebug"])
666    if test x"$enable_sdlui" != "xno"; then
667      AC_CHECK_LIB(GL, AROSMesaCreateContext, [LIBS="$LIBS -lGL"])
668    fi
669    if test x"$SDL_AMIGA_INLINE" = "xyes"; then
670      AC_DEFINE(SDL_AMIGA_INLINE,,[Enable amiga shared SDL library support.])
671      if test x"$enable_sdlui" != "xno"; then
672        AC_DEFINE(HAVE_SDL_NUMJOYSTICKS,, [Define to 1 if you have the `SDL_NumJoysticks' function.])
673        HAVE_SDL_NUMJOYSTICKS_SUPPORT="yes";
674      fi
675    elif test x"$POWERSDL_AMIGA_INLINE" = "xyes"; then
676      AC_DEFINE(POWERSDL_AMIGA_INLINE,,[Enable morphos shared SDL library support.])
677      if test x"$enable_sdlui" != "xno"; then
678        AC_DEFINE(HAVE_SDL_NUMJOYSTICKS,, [Define to 1 if you have the `SDL_NumJoysticks' function.])
679        HAVE_SDL_NUMJOYSTICKS_SUPPORT="yes";
680      fi
681    else
682      if test x"$check_sdlaudio" = "xyes"; then
683        AC_CHECK_LIB(SDL, SDL_OpenAudio, [found_sdl_sound=yes], [found_sdl_sound=no])
684        if test x"$found_sdl_sound" = "xyes"; then
685           SOUND_DRIVERS="$SOUND_DRIVERS soundsdl.o";
686           USE_SDL_AUDIO_SUPPORT="yes";
687           AC_DEFINE(USE_SDL_AUDIO,,[Enable SDL sound support.])
688        fi
689      fi
690
691      if test x"$enable_sdlui" != "xno"; then
692        AC_CHECK_LIB(SDL, SDL_SetVideoMode, [found_sdl_lib=yes], [found_sdl_lib=no])
693        if test x"$found_sdl_lib" = "xno"; then
694          AC_MSG_ERROR([static SDL lib missing])
695        fi
696      fi
697
698      if test x"$found_sdl_lib" = "xyes" -o x"$found_sdl_sound" = "xyes"; then
699        LIBS="-lSDL $LIBS"
700      fi
701
702      if test x"$enable_sdlui" != "xno"; then
703        AC_CHECK_FUNCS(SDL_NumJoysticks)
704      fi
705    fi
706    AC_CHECK_HEADER(SDL/SDL.h, [found_sdl_h=yes], [found_sdl_h=no],)
707    if test x"$found_sdl_h" = "xyes"; then
708      AC_DEFINE(USE_SDL_PREFIX,,[Enable SDL prefix for header inclusion.])
709      if test x"$found_sdl_sound" = "xyes"; then
710        AC_CHECK_HEADERS(SDL/SDL_audio.h, [], [AC_MSG_ERROR([SDL headers missing])],)
711      fi
712    else
713      AC_CHECK_HEADERS(SDL.h, [found_sdl_h=yes], [found_sdl_h=no],)
714      if test x"$found_sdl_h" = "xno"; then
715        AC_MSG_ERROR([SDL headers missing])
716      fi
717      if test x"$found_sdl_sound" = "xyes"; then
718        AC_CHECK_HEADERS(SDL_audio.h, [], [AC_MSG_ERROR([SDL headers missing])],)
719      fi
720    fi
721  else
722
723    dnl check for sdl-config
724    AC_CHECK_TOOL(sdl_config, sdl-config, no)
725
726    if test x"$sdl_config" = "x"; then
727      sdl_config=no
728    fi
729
730    dnl fail if SDL ui was requested
731    if test x"$sdl_config" = "xno" -a x"$enable_sdlui" = "xyes"; then
732      AC_MSG_ERROR([SDL UI requested, but sdl-config is missing])
733    fi
734
735    dnl only continue if sdl-config was found
736    if test x"$sdl_config" != "xno"; then
737      old_cflags=$CFLAGS
738      old_cxxflags=$CXXFLAGS
739      old_libs=$LIBS
740
741      CFLAGS="$CFLAGS `$sdl_config --cflags`"
742      CXXFLAGS="$CXXFLAGS `$sdl_config --cflags`"
743      LIBS="$LIBS `$sdl_config --libs`"
744
745      dnl only do if audio needs to be checked
746      if test x"$check_sdlaudio" = "xyes"; then
747        AC_CHECK_HEADERS(SDL/SDL_audio.h,[AC_CHECK_LIB(SDL, SDL_OpenAudio,
748                         [use_sdl_prefix=yes;
749                          use_sdl2_prefix=no;
750                          USE_SDL_AUDIO_SUPPORT="yes";
751                          AC_DEFINE(USE_SDL_PREFIX,,[Enable SDL prefix for header inclusion.])
752                          AC_DEFINE(USE_SDL_AUDIO,,[Enable SDL sound support.])],
753                         [CFLAGS=$old_cflags; CXXFLAGS=$old_cxxflags; LIBS=$old_libs; break],$EXTRA_SDL_LIBS)],
754                         [CFLAGS=$old_cflags; CXXFLAGS=$old_cxxflags; LIBS=$old_libs; break])
755
756        if test x"$ac_cv_lib_SDL_SDL_OpenAudio" != "xyes"; then
757          unset ac_cv_lib_SDL_SDL_OpenAudio
758          AC_CHECK_HEADERS(SDL_audio.h,[AC_CHECK_LIB(SDL, SDL_OpenAudio,
759                           [use_sdl_prefix=no;
760                            use_sdl2_prefix=no;
761                            USE_SDL_AUDIO_SUPPORT="yes";
762                            AC_DEFINE(USE_SDL_AUDIO,,[Enable SDL sound support.])],
763                           [CFLAGS=$old_cflags; CXXFLAGS=$old_cxxflags; LIBS=$old_libs; break],$EXTRA_SDL_LIBS)],
764                           [CFLAGS=$old_cflags; CXXFLAGS=$old_cxxflags; LIBS=$old_libs; break])
765        fi
766
767        dnl fail if --with-sdlsound was given
768        if test x"$ac_cv_lib_SDL_SDL_OpenAudio" != "xyes"; then
769          if test x"$with_sdlsound" = "xyes"; then
770            AC_MSG_ERROR([SDL sound support missing])
771          fi
772        else
773          SOUND_DRIVERS="$SOUND_DRIVERS soundsdl.o"
774        fi
775      fi
776
777      dnl only check if sdl ui is needed
778      if test x"$enable_sdlui" != "xno"; then
779        AC_CHECK_HEADERS(SDL/SDL.h,[AC_CHECK_LIB(SDL, SDL_SetVideoMode,
780                           [use_sdl_prefix=yes;
781                            use_sdl2_prefix=no;
782                            AC_DEFINE(USE_SDL_PREFIX,,[Enable SDL prefix for header inclusion.])
783                            AC_DEFINE(USE_SDLUI,,[Enable SDL UI support.])],
784                           [CFLAGS=$old_cflags; CXXFLAGS=$old_cxxflags; LIBS=$old_libs; break],$EXTRA_SDL_LIBS)],
785                           [CFLAGS=$old_cflags; CXXFLAGS=$old_cxxflags; LIBS=$old_libs; break])
786
787          if test x"$ac_cv_lib_SDL_SDL_SetVideoMode" != "xyes"; then
788            unset ac_cv_lib_SDL_SDL_SetVideoMode
789            AC_CHECK_HEADERS(SDL.h,[AC_CHECK_LIB(SDL, SDL_SetVideoMode,
790                             [use_sdl_prefix=no;
791                              use_sdl2_prefix=no;
792                              AC_DEFINE(USE_SDLUI,,[Enable SDL UI support.])],
793                             [CFLAGS=$old_cflags; CXXFLAGS=$old_cxxflags; LIBS=$old_libs; break],$EXTRA_SDL_LIBS)],
794                             [CFLAGS=$old_cflags; CXXFLAGS=$old_cxxflags; LIBS=$old_libs; break])
795          fi
796
797          dnl fail if SDL ui was requested
798          if test x"$ac_cv_lib_SDL_SDL_SetVideoMode" != "xyes" -a x"$enable_sdlui" = "xyes"; then
799            AC_MSG_ERROR([SDL headers and/or libraries missing])
800          fi
801
802        dnl only continue if SDL headers/libs are present
803        if test x"$ac_cv_lib_SDL_SDL_SetVideoMode" = "xyes"; then
804          AC_DEFINE(HAVE_FULLSCREEN,,[Enable Fullscreen support.])
805          HAVE_FULLSCREEN_SUPPORT="yes"
806
807          AC_CHECK_FUNCS(SDL_NumJoysticks)
808
809          dnl check for opengl libs.
810          AC_MSG_CHECKING(whether we can use the GL library)
811
812          old_LIBS="$LIBS"
813          LIBS="$LIBS -lGL"
814          if test x"$use_sdl_prefix" = "xyes"; then
815            AC_TRY_LINK([#include <SDL/SDL_opengl.h>],
816                        [glViewport(1,2,3,4)],
817                        [AC_MSG_RESULT(yes);
818                         have_opengl_lib=yes],
819                        [AC_MSG_RESULT(no);
820                         LIBS="$old_LIBS"])
821          else
822            AC_TRY_LINK([#include <SDL_opengl.h>],
823                        [glViewport(1,2,3,4)],
824                        [AC_MSG_RESULT(yes);
825                         have_opengl_lib=yes],
826                        [AC_MSG_RESULT(no);
827                         LIBS="$old_LIBS"])
828          fi
829
830          if test x"$have_opengl_lib" != "xyes"; then
831            AC_MSG_CHECKING(whether we can use the opengl32 library)
832            old_LIBS="$LIBS"
833            LIBS="$LIBS -lopengl32"
834            if test x"$use_sdl_prefix" = "xyes"; then
835              AC_TRY_LINK([#include <SDL/SDL_opengl.h>],
836                          [glViewport(1,2,3,4)],
837                          [AC_MSG_RESULT(yes);
838                           have_opengl_lib=yes],
839                          [AC_MSG_RESULT(no);
840                           LIBS="$old_LIBS"])
841            else
842              AC_TRY_LINK([#include <SDL_opengl.h>],
843                          [glViewport(1,2,3,4)],
844                          [AC_MSG_RESULT(yes);
845                           have_opengl_lib=yes],
846                          [AC_MSG_RESULT(no);
847                           LIBS="$old_LIBS"])
848            fi
849          fi
850
851          if test x"$have_opengl_lib" != "xyes" -a x"$is_unix_macosx" = "xyes"; then
852            AC_MSG_CHECKING(whether we can use the OpenGL Framework)
853            old_LIBS="$LIBS"
854            LIBS="$LIBS -framework OpenGL"
855
856            if test x"$use_sdl_prefix" = "xyes"; then
857              AC_TRY_LINK([#include <SDL/SDL_opengl.h>],
858                          [glViewport(1,2,3,4)],
859                          [AC_MSG_RESULT(yes);
860                           have_opengl_lib=yes],
861                          [AC_MSG_RESULT(no);
862                           LIBS="$old_LIBS"])
863            else
864              AC_TRY_LINK([#include <SDL_opengl.h>],
865                          [glViewport(1,2,3,4)],
866                          [AC_MSG_RESULT(yes);
867                           have_opengl_lib=yes],
868                          [AC_MSG_RESULT(no);
869                           LIBS="$old_LIBS"])
870            fi
871          fi
872
873          if test x"$have_opengl_lib" = "xyes"; then
874            AC_DEFINE(HAVE_HWSCALE,,[Enable arbitrary window scaling])
875            HAVE_HWSCALE_SUPPORT="yes"
876          fi
877
878          dnl check for the SDL_main.h header
879          if test x"$use_sdl_prefix" = "xyes"; then
880            AC_CHECK_HEADERS(SDL/SDL_main.h)
881          else
882            AC_CHECK_HEADERS(SDL_main.h)
883          fi
884
885          AC_MSG_CHECKING(whether we can use the SDLmain library)
886          old_LIBS="$LIBS"
887          LIBS="$LIBS -lSDLmain -lSDL $EXTRA_SDL_LIBS"
888          if test x"$use_sdl_prefix" = "xyes"; then
889            AC_TRY_LINK([#include <SDL/SDL_main.h>
890                         int main(int argc, char *argv[])
891                         { return 0; }
892                         #undef main
893                         #define main something_else],
894                        [return 0;],
895                        [AC_MSG_RESULT(yes);
896                         have_sdlmain=yes],
897                        [AC_MSG_RESULT(no);
898                         LIBS="$old_LIBS"])
899          else
900            AC_TRY_LINK([#include <SDL_main.h>
901                         int main(int argc, char *argv[])
902                         { return 0; }
903                         #undef main
904                         #define main something_else],
905                        [return 0;],
906                        [AC_MSG_RESULT(yes);
907                         have_sdlmain=yes],
908                        [AC_MSG_RESULT(no);
909                         LIBS="$old_LIBS"])
910          fi
911
912          if test x"$have_sdlmain" != "xyes"; then
913            AC_MSG_CHECKING(whether we can use the SDLmain library when adding -lmingw32)
914            old_LIBS="$LIBS"
915            LIBS="$LIBS -lmingw32 -lSDLmain -lSDL"
916            if test x"$use_sdl_prefix" = "xyes"; then
917              AC_TRY_LINK([#include <SDL/SDL_main.h>
918                           int main(int argc, char *argv[])
919                           { return 0; }
920                           #undef main
921                           #define main something_else],
922                          [return 0;],
923                          [AC_MSG_RESULT(yes);
924                           have_sdlmain=yes],
925                          [AC_MSG_RESULT(no);
926                           LIBS="$old_LIBS"])
927            else
928              AC_TRY_LINK([#include <SDL_main.h>
929                           int main(int argc, char *argv[])
930                           { return 0; }
931                           #undef main
932                           #define main something_else],
933                          [return 0;],
934                          [AC_MSG_RESULT(yes);
935                           have_sdlmain=yes],
936                          [AC_MSG_RESULT(no);
937                           LIBS="$old_LIBS"])
938            fi
939          fi
940
941          if test x"$have_sdlmain" = "xyes"; then
942            AC_DEFINE(HAVE_SDLMAIN,,[Enable SDLmain replacement])
943          fi
944
945          case "$host_os" in
946            *mingw32)
947              dnl Required for GetUserProfileDirectoryA
948              LIBS="$LIBS -luserenv"
949              ;;
950          esac
951
952          dnl now that the SDL1 UI support has been detected, define enable_sdlui and undefine the others to prevent checks
953          enable_native_gtk3ui=no
954          enable_sdlui=yes
955          enable_sdlui2=no
956          found_gui=sdl1
957        fi
958      fi
959    fi
960  fi
961fi
962
963dnl check if any gui support was found
964if test x"$found_gui" = "x"; then
965  AC_MSG_ERROR([No GUI support found])
966fi
967
968dnl check if sdl sound was requested but not found
969if test x"$with_sdlsound" = "xyes"; then
970  if test x"$USE_SDL_AUDIO_SUPPORT" != "xyes"; then
971    AC_MSG_ERROR([No SDL sound support found])
972  fi
973fi
974
975# We require C99
976AC_PROG_CC_C99
977if test x"$ac_cv_prog_cc_c99" = "xno"; then
978  AC_MSG_ERROR([A C99-compliant compiler is required.])
979fi
980
981dnl Set proper mkfontdir path for QNX6
982case "$host_os" in
983  nto*)
984    if test -d "/opt/X11R6"; then
985      AC_SUBST(MKFONTDIR_BIN, "/opt/X11R6/bin/mkfontdir")
986    else
987      if test -d "/opt/X11R7"; then
988        AC_SUBST(MKFONTDIR_BIN, "/opt/X11R7/bin/mkfontdir")
989      fi
990    fi
991    ;;
992  *)
993    AC_SUBST(MKFONTDIR_BIN, "mkfontdir")
994    ;;
995esac
996
997dnl Add runtime/linker paths for OpenIndiana
998case "$host_os" in
999  solaris*)
1000    CPPFLAGS="$CPPFLAGS -I/usr/gnu/include"
1001    solrtp=`${CONFIG_SHELL-/bin/sh} "$srcdir/config.rpath" "$CC" "$GCC" "$LDFLAGS" /usr/gnu/bin/ld yes "$host" "/usr/gnu/lib"`
1002    LDFLAGS="$LDFLAGS $solrtp -L/usr/gnu/lib"
1003    if test -d "/opt/csw"; then
1004      CPPFLAGS="$CPPFLAGS -I/opt/csw/include"
1005      solrtp_csw=`${CONFIG_SHELL-/bin/sh} "$srcdir/config.rpath" "$CC" "$GCC" "$LDFLAGS" /usr/gnu/bin/ld yes "$host" "/opt/csw/lib"`
1006      LDFLAGS="$LDFLAGS $solrtp_csw -L/opt/csw/lib"
1007    fi
1008    ;;
1009esac
1010
1011
1012dnl Add runtime/linker paths for *BSD
1013case "$host_os" in
1014  freebsd*)
1015    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1016    fbsdrtp=`${CONFIG_SHELL-/bin/sh} "$srcdir/config.rpath" "$CC" "$GCC" "$LDFLAGS" "$LD" "$with_gnu_ld" "$host" "/usr/local/lib"`
1017    LDFLAGS="$LDFLAGS $fbsdrtp -L/usr/local/lib"
1018    ;;
1019  netbsd*)
1020    CPPFLAGS="$CPPFLAGS -I/usr/pkg/include -I/usr/include"
1021    nbsdrtp=`${CONFIG_SHELL-/bin/sh} "$srcdir/config.rpath" "$CC" "$GCC" "$LDFLAGS" "$LD" "$with_gnu_ld" "$host" "/usr/pkg/lib"`
1022    LDFLAGS="$LDFLAGS $nbsdrtp -L/usr/pkg/lib"
1023    if test -d "/usr/X11R7/lib"; then
1024      rtp=`${CONFIG_SHELL-/bin/sh} "$srcdir/config.rpath" "$CC" "$GCC" "$LDFLAGS" "$LD" "$with_gnu_ld" "$host" "/usr/X11R7/lib"`
1025      LDFLAGS="$LDFLAGS $rtp"
1026    else
1027      if test -d "/usr/X11R6/lib"; then
1028        rtp=`${CONFIG_SHELL-/bin/sh} "$srcdir/config.rpath" "$CC" "$GCC" "$LDFLAGS" "$LD" "$with_gnu_ld" "$host" "/usr/X11R6/lib"`
1029        LDFLAGS="$LDFLAGS $rtp"
1030      fi
1031    fi
1032    ;;
1033  dragonfly*)
1034    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1035    dfbsdrtp=`${CONFIG_SHELL-/bin/sh} "$srcdir/config.rpath" "$CC" "$GCC" "$LDFLAGS" "$LD" "$with_gnu_ld" "$host" "/usr/local/lib"`
1036    LDFLAGS="$LDFLAGS $dfbsdrtp -L/usr/local/lib"
1037    ;;
1038  *)
1039    ;;
1040esac
1041
1042dnl AC_HEADER_TIOCGWINSZ
1043
1044dnl check for GNU make for static/shared ffmpeg
1045if test x"$enable_shared_ffmpeg" = "xyes" -o x"$enable_static_ffmpeg" = "xyes"; then
1046  make_cmd=""
1047  for i in "$MAKE" make gmake gnumake
1048  do
1049    test -x "$i" && continue
1050      if ( sh -c "$i --version" 2>/dev/null | grep GNU >/dev/null )
1051      then
1052        make_cmd=$i;
1053        break;
1054      fi
1055  done
1056  if test x"$make_cmd" = "x"; then
1057    AC_MSG_ERROR([When using internal FFMPEG a GNU make command is needed])
1058  else
1059    MAKE="$make_cmd"
1060  fi
1061fi
1062
1063
1064if test x"$host_os" = "xcygwin32" -o x"$host_os" = "xcygwin"; then
1065  if test x"$with_x" = "xyes"; then
1066    host_os=cygwin-x11
1067    is_win32_x11=yes
1068  fi
1069fi
1070
1071dnl disable toolchain and ar checking for ppc-beos
1072if test x"$host_os" = "xbeos" -a x"$host_cpu" = "xpowerpc"; then
1073  toolchain_check=no
1074  ar_check=no
1075fi
1076
1077dnl disable ar checking for nextstep, openstep and rhapsody
1078case "$host_os" in
1079  nextstep*|openstep*|rhapsody*)
1080    ar_check=no
1081    posix_check=yes
1082    ;;
1083esac
1084
1085if test "x$CC" = "xgcc"; then
1086  GCC=yes
1087fi
1088
1089dnl test for openwatcom CC for library conversion
1090if test x"$CC" = "xowcc"; then
1091  CFLAGS="$CFLAGS -O3"
1092  AM_CONDITIONAL(OWCC, true)
1093  AC_DEFINE(WATCOM_COMPILE,,[owcc is being used.])
1094  toolchain_check=no
1095  ar_check=no
1096  nowarnings=yes
1097else
1098  AM_CONDITIONAL(OWCC, false)
1099fi
1100
1101if test x"$enable_arch" = "xno"; then
1102  march=""
1103  ENABLE_ARCH=no
1104else
1105  if test x"$enable_arch" = "xyes"; then
1106    AC_MSG_CHECKING([if the compiler supports -march=native])
1107    ORIG_CFLAGS="$CFLAGS"
1108    CFLAGS="$CFLAGS -march=native"
1109    AC_TRY_COMPILE([],
1110                   [int test;],
1111                   [ AC_MSG_RESULT(yes)
1112                     ENABLE_ARCH=yes
1113                     march="-march=native" ],
1114                   [ AC_MSG_RESULT(no)
1115                     ENABLE_ARCH=no
1116                     march="" ])
1117    CFLAGS="$ORIG_CFLAGS"
1118  else
1119    AC_MSG_CHECKING([if the compiler supports -march=$enable_arch])
1120    ORIG_CFLAGS="$CFLAGS"
1121    CFLAGS="$CFLAGS -march=$enable_arch"
1122    AC_TRY_COMPILE([],
1123                   [int test;],
1124                   [ AC_MSG_RESULT(yes)
1125                     ENABLE_ARCH=yes
1126                     march="-march=$enable_arch" ],
1127                   [ AC_MSG_RESULT(no)
1128                     ENABLE_ARCH=no
1129                     march="" ])
1130    CFLAGS="$ORIG_CFLAGS"
1131  fi
1132fi
1133
1134AC_SUBST(ENABLE_ARCH)
1135
1136dnl check if the compiler supports -posix
1137if test x"$posix_check" = "xyes"; then
1138  AC_MSG_CHECKING([if the compiler supports -posix])
1139  ORIG_CFLAGS=$CFLAGS
1140  CFLAGS="$CFLAGS -posix"
1141  AC_TRY_COMPILE([],
1142                 [int test;],
1143                 [ AC_MSG_RESULT(yes)],
1144                 [ AC_MSG_RESULT(no)
1145                   CFLAGS=$ORIG_CFLAGS ])
1146fi
1147
1148
1149
1150dnl Check for needed external programs.
1151AC_PROG_CPP
1152AC_CHECK_PROG(AR, ar, ar, ar)
1153AC_CHECK_TOOL(RANLIB, ranlib, :)
1154AC_CHECK_TOOL(STRIP, strip, :)
1155AC_CHECK_PROG(SVN, svn, svn, :)
1156AC_CHECK_PROG(TAR, tar, tar, :)
1157AC_CHECK_PROG(SVNVERSION, svnversion, svnversion, :)
1158AC_PROG_INSTALL
1159AC_PROG_LN_S
1160
1161dnl Check for large file support
1162AC_SYS_LARGEFILE
1163
1164if test x"$enable_static_ffmpeg" = "xyes" -o x"$enable_shared_ffmpeg" = "xyes"; then
1165  case "$host_cpu" in
1166  i*86 | x86_64* | amd64*)
1167    AC_CHECK_PROG(YASM, yasm, yasm, no)
1168    if test x"$YASM" = "xno"; then
1169      AC_MSG_ERROR([yasm needed for ffmpeg compile])
1170    fi
1171    dnl Check minimum yasm version required
1172    yasm_ver=`$YASM --version | head -n 1 | cut -d ' ' -f 2`
1173    yasm_maj=`echo "$yasm_ver" | cut -d '.' -f 1`
1174    yasm_min=`echo "$yasm_ver" | cut -d '.' -f 2`
1175    yasm_rev=`echo "$yasm_ver" | cut -d '.' -f 3`
1176    yasm_ok=false
1177
1178    if test $yasm_maj -gt $YASM_VERSION_MAJOR; then
1179      yasm_ok=true
1180    elif test $yasm_maj -eq $YASM_VERSION_MAJOR; then
1181      if test $yasm_min -gt $YASM_VERSION_MINOR; then
1182        yasm_ok=true
1183      elif test $yasm_min -eq $YASM_VERSION_MINOR; then
1184        if test $yasm_rev -ge $YASM_VERSION_BUILD; then
1185          yasm_ok=true
1186        fi
1187      fi
1188    fi
1189
1190    if test x"$yasm_ok" != x"true"; then
1191      AC_MSG_ERROR([yasm 1.2.0 or higher required])
1192    fi
1193    ;;
1194  *)
1195    ;;
1196  esac
1197fi
1198
1199AC_CHECK_PROGS(YACC, byacc yacc 'bison -y', [no])
1200if test x"$YACC" = "xno"; then
1201  AC_MSG_ERROR([Could not find byacc, yacc or bison!])
1202fi
1203
1204dnl do not use --noyywrap option with flex as older versions do not support
1205dnl it. FIXME: We should really have a compatibility test here.
1206dnl AC_CHECK_PROGS(LEX, 'flex --noyywrap', [no])
1207
1208dnl if test x"$LEX" = "xno"; then
1209dnl   unset LEX
1210dnl fi
1211
1212AC_PROG_LEX
1213
1214if test x"$LEX" = "x:"; then
1215  AC_MSG_ERROR([Could not find either flex or lex!])
1216fi
1217
1218AM_PROG_AS
1219
1220dnl check if ar truncates object names
1221if test x"$ar_check" != "xno"; then
1222  AC_MSG_CHECKING(if ar truncates object names)
1223  rm -f vicetest.c
1224  touch vicetest.c
1225  $CC -c vicetest.c -o some_long_object_name.o
1226  rm -f vicetest.c
1227  rm -f libvicetest.a
1228  $AR cru libvicetest.a some_long_object_name.o
1229  rm -f some_long_object_name.o
1230  $AR x libvicetest.a
1231  if test -f some_long_object_name.o; then
1232    AC_MSG_RESULT(no)
1233    rm -f some_long_object_name.o libvicetest.a
1234  else
1235    AC_MSG_RESULT(yes)
1236    rm -f some*.o libvicetest.a
1237    AC_MSG_ERROR([ar is too old, upgrade your ar])
1238  fi
1239fi
1240
1241dnl check if ar needs a wrapper to get rid of the 'u' option
1242if test x"$ar_check" != "xno"; then
1243  AC_MSG_CHECKING(if ar complains about the 'u' option)
1244  rm -f vicetest.c
1245  touch vicetest.c
1246  $CC -c vicetest.c -o vicetest.o
1247  rm -f vicetest.c
1248  rm -f libvicetest.a
1249  complains=`$AR cru libvicetest.a vicetest.o 2>&1`
1250  if test x"$complains" != "x"; then
1251    AC_MSG_RESULT(yes)
1252    echo "using ar wrapper instead of ar directly"
1253    AR_WRAP="$AR"
1254    AR="\$(top_srcdir)/src/wrap-u-ar.sh \"$AR_WRAP\""
1255  else
1256    AC_MSG_RESULT(no)
1257  fi
1258fi
1259
1260AC_CHECK_PROGS(MAKEINFO, makeinfo, no)
1261
1262AC_CHECK_PROGS(TEXI2DVI, texi2dvi, no)
1263AC_CHECK_PROGS(PDFTEX, pdftex, no)
1264if test x"$TEXI2DVI" = "xno" -o x"$PDFTEX" = "xno"; then
1265  AM_CONDITIONAL(BUILD_PDF, false)
1266else
1267  AM_CONDITIONAL(BUILD_PDF, true)
1268fi
1269
1270AC_CHECK_PROGS(DOS2UNIX, dos2unix, dos2unix)
1271
1272AC_CHECK_PROGS(XA, [xa xa65], no)
1273
1274if test x"$XA" = "xno"; then
1275  AC_MSG_ERROR([xa is missing])
1276fi
1277
1278if test x"$SVN" != "x"; then
1279  svnrevision=`$SVN 2>dummy.tmp info $srcdir | grep Revision | cut -d " " -f 2`
1280  rm dummy.tmp
1281  if test x"$svnrevision" != "x"; then
1282    AM_CONDITIONAL(USE_SVN_REVISION, true)
1283    AC_DEFINE(USE_SVN_REVISION,,[define when using the svn revision in addition to the version])
1284  else
1285    AM_CONDITIONAL(USE_SVN_REVISION, false)
1286  fi
1287else
1288  AM_CONDITIONAL(USE_SVN_REVISION, false)
1289fi
1290
1291dnl Setup crosscompiling.
1292
1293if test x"$host_os" = "xamigaos" -o x"$host_os" = "xamigaos4" -o x"$host_os" = "xamithlon" -o x"$host_os" = "xaros" -o x"$host_os" = "xmorphos" -o x"$host_os" = "xwarpos" -o x"$host_os" = "xpowerup"; then
1294  AM_CONDITIONAL(HAVE_RAWDRIVE, true)
1295
1296  AC_DEFINE(AMIGA_SUPPORT,,[Should we enable Amigaos support.])
1297
1298  is_amigaos4=yes
1299  is_amigaos3=no
1300  is_amiga_aros=no
1301  is_amiga_morphos=no
1302  openpci_present=no
1303
1304  if test x"$host_os" = "xmorphos"; then
1305    AC_DEFINE(AMIGA_MORPHOS,,[Should we enable Amiga Morphos support.])
1306    CFLAGS="$CFLAGS -noixemul"
1307    AC_DEFINE(HAVE_HTONL,,[Define to 1 if you have the htonl function.])
1308    AC_DEFINE(HAVE_HTONS,,[Define to 1 if you have the htons function.])
1309    AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])
1310    HAVE_NETWORK_SUPPORT="yes"
1311    AC_DEFINE(HAVE_RS232NET,,[Enable RS232 network support])
1312    HAVE_RS232NET_SUPPORT="yes"
1313    AC_CHECK_HEADERS(proto/openpci.h, openpci_present=yes,,)
1314    if test x"$openpci_present" = "xyes"; then
1315      if test x"$enable_catweasel" != "xno"; then
1316        AC_DEFINE(HAVE_CATWEASELMKIII,,[Support for Catweasel MKIII.])
1317        HAVE_CATWEASELMKIII_SUPPORT="yes"
1318      fi
1319      if test x"$enable_hardsid" != "xno"; then
1320        AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.])
1321        HAVE_HARDSID_SUPPORT="yes"
1322      fi
1323    else
1324      if test x"$enable_catweasel" = "xyes" -a x"$HAVE_CATWEASELMKIII_SUPPORT" != "xyes"; then
1325        AC_MSG_ERROR([CatWeaselMKIII support is missing])
1326      fi
1327      if test x"$enable_hardsid" = "xyes" -a x"$HAVE_HARDSID_SUPPORT" != "xyes"; then
1328        AC_MSG_ERROR([HardSID support is missing])
1329      fi
1330    fi
1331    is_amiga_morphos=yes
1332    is_amigaos4=no
1333  fi
1334
1335  if test x"$host_os" = "xaros"; then
1336    AC_DEFINE(AMIGA_AROS,,[Should we enable AROS support.])
1337    AC_DEFINE(HAVE_HTONL,,[Define to 1 if you have the htonl function.])
1338    AC_DEFINE(HAVE_HTONS,,[Define to 1 if you have the htons function.])
1339    AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])
1340    HAVE_NETWORK_SUPPORT="yes"
1341    AC_DEFINE(HAVE_RS232NET,,[Enable RS232 network support])
1342    HAVE_RS232NET_SUPPORT="yes"
1343    AC_CHECK_HEADERS(aros/_timeval.h)
1344    AC_MSG_CHECKING(if common library bases are auto resolved)
1345    aros_common_resolve=no
1346    AC_TRY_LINK([#include <proto/asl.h>],
1347                [AbortAslRequest(0)],
1348                aros_common_resolve=yes)
1349    if test x"$aros_common_resolve" = "xyes"; then
1350       AC_MSG_RESULT(yes)
1351       AC_DEFINE(WORKING_AROS_AUTO,,[Define to 1 if aros can handle auto resolving of library bases.])
1352    else
1353       AC_MSG_RESULT(no)
1354    fi
1355    is_amigaos4=no
1356    is_amiga_aros=yes
1357  fi
1358
1359  if test x"$host_os" = "xamigaos" -a x"$host_cpu" = "xm68k"; then
1360    CFLAGS="$CFLAGS -mc68020 -noixemul"
1361    AC_DEFINE(AMIGA_M68K,,[Should we enable M68K AmigaOS support.])
1362    AC_DEFINE(HAVE_HTONL,,[Define to 1 if you have the htonl function.])
1363    AC_DEFINE(HAVE_HTONS,,[Define to 1 if you have the htons function.])
1364    AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])
1365    HAVE_NETWORK_SUPPORT="yes"
1366    AC_DEFINE(HAVE_RS232NET,,[Enable RS232 network support])
1367    HAVE_RS232NET_SUPPORT="yes"
1368    AC_CHECK_HEADERS(proto/openpci.h, openpci_present=yes,,)
1369    if test x"$openpci_present" = "xyes"; then
1370      if test x"$enable_catweasel" != "xno"; then
1371        AC_DEFINE(HAVE_CATWEASELMKIII,,[Support for Catweasel MKIII.])
1372        HAVE_CATWEASELMKIII_SUPPORT="yes"
1373      fi
1374      if test x"$enable_hardsid" != "xno"; then
1375        AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.])
1376        HAVE_HARDSID_SUPPORT="yes"
1377      fi
1378      if test x"$enable_ssi2001" != "xno"; then
1379        AC_DEFINE(HAVE_SSI2001,,[Support for SSI2001.])
1380        HAVE_SSI2001_SUPPORT="yes"
1381      fi
1382    else
1383      if test x"$enable_catweasel" = "xyes" -a x"$HAVE_CATWEASELMKIII" != "xyes"; then
1384        AC_MSG_ERROR([CatWeaselMKIII support is missing])
1385      fi
1386      if test x"$enable_hardsid" = "xyes" -a x"$HAVE_HARDSID_SUPPORT" != "xyes"; then
1387        AC_MSG_ERROR([HardSID support is missing])
1388      fi
1389    fi
1390    is_amigaos4=no
1391    is_amigaos3=yes
1392  fi
1393
1394  if test x"$is_amigaos4" = "xyes"; then
1395    AC_DEFINE(AMIGA_OS4,,[Should we enable AmigaOS4 support.])
1396    if test x"$enable_catweasel" != "xno"; then
1397      AC_DEFINE(HAVE_CATWEASELMKIII,,[Support for Catweasel MKIII.])
1398      HAVE_CATWEASELMKIII_SUPPORT="yes"
1399    fi
1400    if test x"$enable_hardsid" != "xno"; then
1401      AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.])
1402      HAVE_HARDSID_SUPPORT="yes"
1403    fi
1404    LIBS="$LIBS -lsupc++ -lgcc_eh"
1405  fi
1406
1407  is_amiga=yes
1408
1409  CFLAGS="$CFLAGS -finline-functions"
1410
1411  if test x"$enable_sdlui" = "xyes" -o x"$enable_sdlui2" = "xyes"; then
1412    if test x"is_amigaos4" = "xyes"; then
1413      LIBS="$LIBS -lunix"
1414    fi
1415  fi
1416
1417elif test x"$host_os" = "xcygwin32" -o x"$host_os" = "xcygwin" -o x"$host_os" = "xmingw32" -o x"$host_os" = "xmingw32msvc" -o x"$is_win32_gtk3" = "xyes"; then
1418
1419  dnl This is used by subsequent tests.
1420  ac_cv_prog_gcc=yes
1421  GCC=yes
1422
1423  is_win32=yes
1424
1425  AC_CHECK_HEADERS([commctrl.h shlobj.h winioctl.h], [], [], [#include <windows.h>])
1426
1427  AC_DEFINE(HAVE_HTONL,,[Define to 1 if you have the htonl function.])
1428  AC_DEFINE(HAVE_HTONS,,[Define to 1 if you have the htons function.])
1429  AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])
1430  HAVE_NETWORK_SUPPORT="yes"
1431  AC_DEFINE(HAVE_RS232NET,,[Enable RS232 network support])
1432  HAVE_RS232NET_SUPPORT="yes"
1433  if test x"$host_cpu" = "xx86_64" -o x"$host_cpu" = "xamd64"; then
1434    LIBS="$LIBS -lwinmm -lws2_32 -lntdll"
1435  else
1436    LIBS="$LIBS -lwinmm -lwsock32 -lmingwex -lmsvcrt -lntdll"
1437  fi
1438  if test x"$enable_catweasel" != "xno"; then
1439    AC_DEFINE(HAVE_CATWEASELMKIII,,[Support for Catweasel MKIII.])
1440    HAVE_CATWEASELMKIII_SUPPORT="yes"
1441  fi
1442  if test x"$enable_hardsid" != "xno"; then
1443    AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.])
1444    HAVE_HARDSID_SUPPORT="yes"
1445  fi
1446  if test x"$enable_parsid" != "xno"; then
1447    AC_DEFINE(HAVE_PARSID,,[Support for ParSID.])
1448    HAVE_PARSID_SUPPORT="yes"
1449
1450    if test x"$enable_libieee1284" = "xyes"; then
1451      LIBIEEE1284_HEADERS_PRESENT=yes
1452
1453      dnl Check for needed io headers
1454      AC_CHECK_HEADERS(ieee1284.h,,[LIBIEEE1284_HEADERS_PRESENT=no],)
1455
1456      if test x"$LIBIEEE1284_HEADERS_PRESENT" = "xyes"; then
1457        AC_CHECK_LIB(ieee1284, ieee1284_find_ports,[LIBS="-lieee1284 $LIBS"; PARSID_SUPPORT=yes],,)
1458        if test x"$PARSID_SUPPORT" = "xyes"; then
1459          AC_DEFINE(HAVE_LIBIEEE1284,,[Define to 1 if you have the `ieee1284' library (-lieee1284).])
1460        else
1461          AC_MSG_ERROR([libieee1284 is missing])
1462        fi
1463      else
1464        AC_MSG_ERROR([libieee1284 header is missing])
1465      fi
1466    fi
1467  fi
1468  if test x"$enable_ssi2001" != "xno"; then
1469    AC_DEFINE(HAVE_SSI2001,,[Support for SSI2001 (ISA SID card).])
1470    HAVE_SSI2001_SUPPORT="yes"
1471  fi
1472  if test x"$enable_midi" != "xno"; then
1473    AC_DEFINE(HAVE_MIDI,,[Enable support for MIDI.])
1474    HAVE_MIDI_SUPPORT="yes"
1475  fi
1476  if test x"$enable_ethernet" = "xyes"; then
1477    AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
1478    AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
1479    HAVE_RAWNET_SUPPORT="yes"
1480  fi
1481  if test x"$enable_rs232" != "xno"; then
1482    AC_DEFINE(HAVE_RS232DEV,,[Enable RS232 device emulation.])
1483    HAVE_RS232DEV_SUPPORT="yes"
1484  fi
1485
1486  AM_CONDITIONAL(HAVE_RAWDRIVE, false)
1487
1488  dinput_header_no_lib="no"
1489
1490  dnl don't use dinput for owcc
1491  if test x"$CC" != "xowcc"; then
1492    AC_CHECK_HEADER(dinput.h,
1493                [ HAVE_DINPUT_SUPPORT="yes";
1494                  AC_DEFINE(HAVE_DINPUT,,[Use DirectInput joystick driver]) ]
1495                [ AC_MSG_CHECKING(for -ldinput) ]
1496                [SAVELIBS="$LIBS"] [ LIBS="-ldinput $LIBS" ]
1497                [ AC_LINK_IFELSE([
1498                                 AC_LANG_PROGRAM([#include <dinput.h>],[return DirectInputCreateA(0,0,0,0);])
1499                                 ],
1500                              [ AC_DEFINE(HAVE_DINPUT_LIB, [], [dinput.lib or libdinput.a are present]) ]
1501     	                        [ AC_MSG_RESULT(yes) ],
1502                              [ dinput_header_no_lib="yes" ]
1503                              [ LIBS="$SAVELIBS" ]
1504                              [ AC_MSG_RESULT(no) ]
1505                )]
1506	  	 )
1507  fi
1508
1509  dnl warnings_cxx="-Wall -W -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare"
1510  if test x"$nowarnings" != "xyes"; then
1511      warnings_cxx="-Wall -Wno-unused-parameter -Wno-sign-compare"
1512      CFLAGS="$CFLAGS $warnings_cxx"
1513      CXXFLAGS="$CXXFLAGS $warnings_cxx"
1514  fi
1515
1516elif test x"$host_os" = "xbeos" -o x"$host_os" = "xhaiku"; then
1517
1518  dnl This is used by subsequent tests.
1519  ac_cv_prog_gcc=yes
1520  GCC=yes
1521
1522  is_beos=yes
1523  AC_DEFINE(BEOS_COMPILE,,[Are we compiling for either BeOS or Haiku?])
1524
1525  AM_CONDITIONAL(HAVE_RAWDRIVE, false)
1526
1527  if test x"$enable_catweasel" != "xno"; then
1528    AC_DEFINE(HAVE_CATWEASELMKIII,,[Support for Catweasel MKIII.])
1529    HAVE_CATWEASELMKIII_SUPPORT="yes"
1530  fi
1531
1532  if test x"$enable_hardsid" != "xno"; then
1533    AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.])
1534    HAVE_HARDSID_SUPPORT="yes"
1535  fi
1536
1537  if test x"$enable_parsid" != "xno"; then
1538    AC_DEFINE(HAVE_PARSID,,[Support for ParSID.])
1539    HAVE_PARSID_SUPPORT="yes"
1540
1541    if test x"$enable_libieee1284" = "xyes"; then
1542      LIBIEEE1284_HEADERS_PRESENT=yes
1543
1544      dnl Check for needed io headers
1545      AC_CHECK_HEADERS(ieee1284.h,,[LIBIEEE1284_HEADERS_PRESENT=no],)
1546
1547      if test x"$LIBIEEE1284_HEADERS_PRESENT" = "xyes"; then
1548        AC_CHECK_LIB(ieee1284, ieee1284_find_ports,[LIBS="-lieee1284 $LIBS"; PARSID_SUPPORT=yes],,)
1549        if test x"$PARSID_SUPPORT" = "xyes"; then
1550          AC_DEFINE(HAVE_LIBIEEE1284,,[Define to 1 if you have the `ieee1284' library (-lieee1284).])
1551        else
1552          AC_MSG_ERROR([libieee1284 is missing])
1553        fi
1554      else
1555        AC_MSG_ERROR([libieee1284 header is missing])
1556      fi
1557    fi
1558  fi
1559
1560  if test x"$enable_ssi2001" != "xno"; then
1561    AC_DEFINE(HAVE_SSI2001,,[Support for SSI2001 (ISA SID card).])
1562    HAVE_SSI2001_SUPPORT="yes"
1563  fi
1564
1565else
1566
1567dnl check for darwin first.
1568case "$host_os" in
1569darwin*)
1570  dnl check for needed CoreVideo header
1571  AC_CHECK_HEADERS(CoreVideo/CVHostTime.h)
1572
1573  dnl check for needed CoreServices header
1574  AC_CHECK_HEADERS(CoreServices/CoreServices.h)
1575
1576  dnl change the host_os to puredarwin to make the configure think it is
1577  dnl just another unix.
1578  if test x"$ac_cv_header_CoreServices_CoreServices_h" != "xyes"; then
1579    host_os=puredarwin;
1580    AC_DEFINE(DARWIN_COMPILE,,[Enable plain darwin compilation])
1581  fi
1582  ;;
1583*)
1584  ;;
1585esac
1586
1587dnl Check for host os with version attached. Typically on UN*X like systems.
1588case "$host_os" in
1589
1590dnl Mac OS X Host
1591darwin*)
1592
1593  is_unix=yes
1594  is_unix_macosx=yes
1595
1596  dnl disable toolchain checking for macosx
1597  toolchain_check=no
1598
1599  is_unix_x11=yes
1600
1601  if test -z "$user_cflags" ; then
1602    if test x"$GCC" = "xyes" ; then
1603      warnings_cxx="-Wall -Winline"
1604      warnings_c="-Wstrict-prototypes $warnings_cxx"
1605      optimization_c="-O3 -mmacosx-version-min=10.9 $march"
1606      optimization_cxx="-fno-exceptions $optimization_c"
1607      if test x"$ac_cv_prog_cc_g" = "xyes" ; then
1608        CFLAGS="$CFLAGS -g $optimization_c $warnings_c"
1609        CXXFLAGS="$CXXFLAGS -g $optimization_cxx $warnings_cxx"
1610      else
1611        CFLAGS="$CFLAGS $optimization_c $warnings_c"
1612        CXXFLAGS="$CXXFLAGS $optimization_cxx $warnings_cxx"
1613      fi
1614    fi
1615  fi
1616
1617  if test "$GCC" = yes -a "$enable_no_pic" != "no" ; then
1618    CFLAGS="$CFLAGS -mdynamic-no-pic"
1619    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1620  fi
1621
1622  AM_CONDITIONAL(HAVE_RAWDRIVE, true)
1623  if test x"$enable_rs232" != "xno"; then
1624    AC_DEFINE(HAVE_RS232DEV,,[Enable RS232 device emulation.])
1625    HAVE_RS232DEV_SUPPORT="yes"
1626  fi
1627
1628  AC_DEFINE(HAVE_RAWDRIVE,,[Support for block device disk image access.])
1629  HAVE_RAWDRIVE_SUPPORT="yes"
1630  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])
1631  HAVE_MOUSE_SUPPORT="yes"
1632  AC_DEFINE(HAVE_LIGHTPEN,,[Enable lightpen support])
1633  HAVE_LIGHTPEN_SUPPORT="yes"
1634
1635  AC_DEFINE(MACOSX_SUPPORT,,[Enable Mac OS X specific code.])
1636  if test x"$enable_bundle" != "xno"; then
1637    echo "enabled Mac application bundles"
1638    AC_DEFINE(MACOSX_BUNDLE,,[Enable Mac OS X application bundles.])
1639  else
1640    echo "disabled Mac application bundles"
1641  fi
1642  CFLAGS="$CFLAGS -I/usr/local/include -I/System/Library/Frameworks/OpenGL.framework/Headers"
1643  CXXFLAGS="$CXXFLAGS -I/usr/local/include -I/System/Library/Frameworks/OpenGL.framework/Headers"
1644  LDFLAGS="$LDFLAGS -L/usr/local/lib"
1645  LIBS="$LIBS -framework CoreServices"
1646
1647  ;;
1648
1649dnl All other UN*X systems
1650*)
1651
1652  dnl special handling of sco unixware 7.x
1653  case "$host_os" in
1654    sco3.2v7*)
1655      LIBS="-lxti -lsocket -lnsl $LIBS"
1656      ;;
1657  esac
1658
1659  case "$host" in
1660    alpha*-*-linux*)
1661      if test x"$CC" = "xccc"; then
1662        echo "Using Compaq C Compiler cflags."
1663        CFLAGS="$CFLAGS -w0 -g3 -migrate -fast -inline speed -unroll 0 -arch host -tune host"
1664        AC_DEFINE(__DECALPHA__,1,[define when using the alpha compaq compiler])
1665      fi
1666      ;;
1667
1668    sparc-*-sunos4*)
1669      if test x"$CC" = "xcc"; then
1670        echo "Using Sun C Compiler cflags."
1671        CFLAGS="$CFLAGS -O -xCC"
1672      fi
1673      ;;
1674
1675    *-sgi-irix*)
1676      if test x"$CC" = "xcc"; then
1677        echo "Using SGI C Compiler cflags."
1678        CFLAGS="$CFLAGS -O3 -woff all"
1679      fi
1680      ;;
1681
1682    alpha*-dec-osf*)
1683      if test x"$CC" = "xcc"; then
1684        echo "Using Tru64 C Compiler cflags."
1685        CFLAGS="$CFLAGS -fast -O3 -std -g3 -non_shared"
1686      fi
1687      ;;
1688  esac
1689
1690  is_unix=yes
1691  is_unix_x11=yes
1692
1693  if test -z "$user_cflags" ; then
1694
1695    ORIG_CFLAGS="$CFLAGS"
1696    dnl Check for the type of compiler first.
1697    if test x"$GCC" = "xyes" ; then
1698
1699      AC_MSG_CHECKING([if the compiler supports -Wno-unused-parameter])
1700      CFLAGS="$ORIG_CFLAGS -Wno-unused-parameter"
1701      AC_TRY_COMPILE([],
1702                     [int test;],
1703                     [ AC_MSG_RESULT(yes)
1704                       warn_no_up="-Wno-unused-parameter" ],
1705                     [ AC_MSG_RESULT(no)
1706                       warn_no_up="" ])
1707      AC_MSG_CHECKING([if the compiler supports -Wno-sign-compare])
1708      CFLAGS="$ORIG_CFLAGS -Wno-sign-compare"
1709      AC_TRY_COMPILE([],
1710                     [int test;],
1711                     [ AC_MSG_RESULT(yes)
1712                       warn_no_sc="-Wno-sign-compare" ],
1713                     [ AC_MSG_RESULT(no)
1714                       warn_no_sc="" ])
1715      CFLAGS=$ORIG_CFLAGS
1716
1717      warnings_cxx="-Wall -W $warn_no_up $warn_no_mfi $warn_no_sc"
1718      if test x"$enable_gnomeui" != "xyes" ; then
1719          warnings_c="-Wstrict-prototypes $warnings_cxx"
1720      else
1721	  dnl "-Wstrict-prototypes" gives zillions of warnings in gtk headers
1722	  dnl warnings_gnome="-DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
1723	  warnings_c="$warnings_gnome $warnings_cxx"
1724      fi
1725
1726      dnl Set appropriate optimization options (better than the default -g -O)
1727      dnl if using GCC.
1728      dnl If the user has specified her own `CFLAGS', we do not override them.
1729
1730      optimization_c="-O3 $march"
1731      optimization_cxx="-fno-exceptions $optimization_c"
1732      dnl Use -g if available.
1733      if test x"$ac_cv_prog_cc_g" = "xyes" ; then
1734         CFLAGS="$CFLAGS -g $optimization_c $warnings_c"
1735         CXXFLAGS="$CXXFLAGS -g $optimization_cxx $warnings_cxx"
1736      else
1737         CFLAGS="$CFLAGS $optimization_c $warnings_c"
1738         CXXFLAGS="$CXXFLAGS $optimization_cxx $warnings_cxx"
1739      fi
1740
1741      dnl Check whether the options are OK.
1742      AC_PROG_CC
1743
1744    fi
1745
1746    dnl (If not on GCC, just keep the defaults, which are very conservative).
1747
1748  fi
1749
1750  AM_CONDITIONAL(HAVE_RAWDRIVE, true)
1751
1752  AC_DEFINE(HAVE_RAWDRIVE,,[Support for block device disk image access.])
1753  HAVE_RAWDRIVE_SUPPORT="yes"
1754  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])
1755  HAVE_MOUSE_SUPPORT="yes"
1756  AC_DEFINE(HAVE_LIGHTPEN,,[Enable lightpen support])
1757  HAVE_LIGHTPEN_SUPPORT="yes"
1758  if test x"$enable_midi" != "xno"; then
1759    AC_DEFINE(HAVE_MIDI,,[Enable support for MIDI.])
1760    HAVE_MIDI_SUPPORT="yes"
1761  fi
1762  if test x"$enable_rs232" != "xno"; then
1763    AC_DEFINE(HAVE_RS232DEV,,[Enable RS232 device emulation.])
1764    HAVE_RS232DEV_SUPPORT="yes"
1765  fi
1766  ;;
1767esac
1768fi
1769
1770
1771dnl check if the compiler supports -Werror=missing-prototypes
1772AC_MSG_CHECKING([if the compiler supports -Wmissing-prototypes])
1773ORIG_CFLAGS="$CFLAGS"
1774CFLAGS="$CFLAGS -Wmissing-prototypes"
1775AC_TRY_COMPILE([],
1776               [int test;],
1777               [ AC_MSG_RESULT(yes)],
1778               [ AC_MSG_RESULT(no)
1779                 CFLAGS="$ORIG_CFLAGS" ])
1780
1781
1782dnl check if the compiler supports -Werror=implicit-function-declaration
1783AC_MSG_CHECKING([if the compiler supports -Werror=implicit-function-declaration])
1784ORIG_CFLAGS="$CFLAGS"
1785CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
1786AC_TRY_COMPILE([],
1787               [int test;],
1788               [ AC_MSG_RESULT(yes)],
1789               [ AC_MSG_RESULT(no)
1790                 CFLAGS="$ORIG_CFLAGS" ])
1791
1792
1793dnl check if the compiler supports -Wfatal-errors
1794AC_MSG_CHECKING([if the compiler supports -Wfatal-errors])
1795ORIG_CFLAGS="$CFLAGS"
1796CFLAGS="$CFLAGS -Wfatal-errors"
1797AC_TRY_COMPILE([],
1798               [int test;],
1799               [ AC_MSG_RESULT(yes)],
1800               [ AC_MSG_RESULT(no)
1801                 CFLAGS="$ORIG_CFLAGS" ])
1802
1803dnl check if the compiler supports -Wshadow
1804AC_MSG_CHECKING([if the compiler supports -Wshadow])
1805ORIGI_CFLAGS="$CFLAGS"
1806CFLAGS="$CFLAGS -Wshadow"
1807AC_TRY_COMPILE([],
1808               [int test;],
1809               [ AC_MSG_RESULT(yes)],
1810               [ AC_MSG_RESULT(no)
1811                 CFLAGS="$ORIG_CFLAGS" ])
1812
1813
1814dnl check for debug build
1815if test x"$enable_debug" = "xyes"; then
1816  have_backtrace_symbols="no"
1817  DEBUGBUILD=1
1818  DEBUG_SUPPORT="yes"
1819  AC_CHECK_HEADERS(execinfo.h,,)
1820
1821  dnl PCBSD/FreeBSD/Haiku needs -lexecinfo for debug builds
1822  AC_CHECK_FUNC(backtrace_symbols,
1823                have_backtrace_symbols="yes",
1824                have_backtrace_symbols="no")
1825
1826  if test x"$have_backtrace_symbols" != "xyes"; then
1827    AC_CHECK_LIB(execinfo,
1828                 backtrace_symbols,
1829                 [ LIBS="$LIBS -lexecinfo"
1830                   have_backtrace_symbols="yes" ],
1831                 AC_MSG_WARN("Could not find backtrace_symbols in either libc or libexecinfo. Either install libexecinfo, or disable debugging. Please note that --enable-debug is only available for Linux, *BSD, Solaris and OSX."))
1832
1833  fi
1834
1835  if test x"$have_backtrace_symbols" = "xyes"; then
1836    AC_DEFINE(HAVE_BT_SYMBOLS,,[Use backtrace facility of libC or libexecinfo])
1837  fi
1838
1839else
1840  DEBUGBUILD=0
1841fi
1842
1843AC_SUBST(DEBUGBUILD)
1844
1845
1846dnl This enables the embedded data files feature, which should
1847dnl only be used for developing new ports or for ports for which
1848dnl the loading of the datafiles is hard/impossible.
1849if test x"$enable_embedded" = "xyes"; then
1850  AC_DEFINE(USE_EMBEDDED,,[Use embedded data files.])
1851  USE_EMBEDDED_SUPPORT="yes"
1852  AM_CONDITIONAL(EMBEDDED, true)
1853else
1854  AM_CONDITIONAL(EMBEDDED, false)
1855fi
1856
1857dnl check for texi to amigaguide program
1858AC_CHECK_PROGS(MAKEGUIDE, makeguide, no)
1859if test x"$MAKEGUIDE" != "xno"; then
1860  AM_CONDITIONAL(BUILD_AMIGAGUIDE, true)
1861else
1862  if test x"$MAKEINFO" != "xno"; then
1863    AC_MSG_CHECKING([if the makeinfo supports amigaguide])
1864    agresult=`$MAKEINFO --help 2>&1 | grep amiga`
1865    if test x"$agresult" != "x"; then
1866      AC_MSG_RESULT([yes])
1867      MAKEGUIDE=$MAKEINFO
1868      AM_CONDITIONAL(BUILD_AMIGAGUIDE, true)
1869    else
1870      AC_MSG_RESULT([no])
1871      AM_CONDITIONAL(BUILD_AMIGAGUIDE, false)
1872    fi
1873  else
1874    AM_CONDITIONAL(BUILD_AMIGAGUIDE, false)
1875  fi
1876fi
1877AC_SUBST(MAKEGUIDE)
1878
1879dnl check for windows chm compiler
1880AC_CHECK_PROGS(HHC, hhc, no)
1881if test x"$HHC" = "xno"; then
1882  AM_CONDITIONAL(BUILD_CHM, false)
1883else
1884  AM_CONDITIONAL(BUILD_CHM, true)
1885fi
1886
1887dnl check for windows hlp compiler programs
1888AC_CHECK_PROGS(MAKERTF, makertf, no)
1889AC_CHECK_PROGS(HCRTF, hcrtf, no)
1890if test x"$MAKERTF" = "xno" -o x"$HCRTF" = "xno"; then
1891  AM_CONDITIONAL(BUILD_HLP, false)
1892else
1893  AM_CONDITIONAL(BUILD_HLP, true)
1894fi
1895
1896dnl check for os/2 ipf compiler programs
1897AC_CHECK_PROGS(TEXI2IPF, texi2ipf, no)
1898AC_CHECK_PROGS(IPFC, wipfc, no)
1899if test x"$TEXI2IPF" != "xno"; then
1900  if test x"$IPFC" = "xno"; then
1901    AC_CHECK_PROGS(IPFC, ipfc, no)
1902  fi
1903  if test x"$IPFC" != "xno"; then
1904    AM_CONDITIONAL(BUILD_IPF, true)
1905  else
1906    AM_CONDITIONAL(BUILD_IPF, false)
1907  fi
1908else
1909  AM_CONDITIONAL(BUILD_IPF, false)
1910fi
1911
1912dnl Extension for executable files in this system
1913AC_EXEEXT
1914
1915AC_CHECK_LIB(iconv, libiconv_open,,)
1916
1917dnl Check for a perl interpreter.
1918AC_PATH_PROG(PERL, perl)
1919AC_SUBST(PERL)
1920
1921dnl Check if --param inline-unit-growth=60 can be used.
1922old_CFLAGS=$CFLAGS
1923CFLAGS="$CFLAGS -Werror --param inline-unit-growth=60"
1924AC_MSG_CHECKING([if the compiler accepts --param inline-unit-growth=60])
1925AC_TRY_COMPILE([],
1926               [int test;],
1927               [ AC_MSG_RESULT(yes)
1928                 INLINE_UNIT_GROWTH="--param inline-unit-growth=60"
1929                ],
1930               [ AC_MSG_RESULT(no)
1931                INLINE_UNIT_GROWTH=""
1932                ])
1933CFLAGS=$old_CFLAGS
1934AC_SUBST(INLINE_UNIT_GROWTH)
1935
1936dnl Check if --param max-inline-insns-single=600 can be used.
1937old_CFLAGS=$CFLAGS
1938CFLAGS="$CFLAGS -Werror --param max-inline-insns-single=600"
1939AC_MSG_CHECKING([if the compiler accepts --param max-inline-insns-single=600])
1940AC_TRY_COMPILE([],
1941               [int test;],
1942               [ AC_MSG_RESULT(yes)
1943                 MAX_INLINE_INSN_SINGLE="--param max-inline-insns-single=600"
1944                ],
1945               [ AC_MSG_RESULT(no)
1946                MAX_INLINE_INSN_SINGLE=""
1947                ])
1948CFLAGS=$old_CFLAGS
1949AC_SUBST(MAX_INLINE_INSN_SINGLE)
1950
1951dnl Check and setup aRts compilation.
1952if test x"$with_arts" = "xyes"; then
1953  AC_CHECK_PROGS(artsc_config, artsc-config, no)
1954  if test x"$artsc_config" = "xno"; then
1955    AC_MSG_WARN([artsc-config not found. aRts will not be configured])
1956                with_arts=no
1957        fi
1958else
1959  with_arts=no
1960fi
1961
1962dnl Set output drivers to none
1963GFXOUTPUT_DRIVERS=""
1964
1965RESID_DIR=
1966RESID_LIBS=
1967RESID_INCLUDES=
1968RESID_DEP=
1969
1970RESID_DTV_DIR=
1971RESID_DTV_LIBS=
1972RESID_DTV_INCLUDES=
1973RESID_DTV_DEP=
1974
1975
1976LINKCC='$(CC)'
1977
1978dnl disable reSID for certain platforms
1979
1980RESIDSUB=""
1981RESIDDTVSUB=""
1982
1983if test x"$with_resid" = "xno"; then
1984  dnl Do not attempt to configure reSID.
1985  dnl NOTE: no_recursion is set because directories specified with
1986  dnl AC_CONFIG_SUBDIRS are always recursed into regardless of where the
1987  dnl macro is used.
1988  dnl Another workaround must be found if other self-contained packages go
1989  dnl into VICE.
1990  if test x"$enable_shared_ffmpeg" != "xyes" -a x"$enable_static_ffmpeg" != "xyes"; then
1991    no_recursion=yes
1992  fi
1993  dnl A workaround for an autoconf bug when not using/checking the C++
1994  dnl compiler, we'll define am__fastdepCXX_TRUE as #
1995  am__fastdepCXX_TRUE=#
1996  am__fastdepCXX_FALSE=
1997else
1998  AC_LANG_SAVE
1999  AC_LANG_CPLUSPLUS
2000  AC_PROG_CXX([g++ clang++ cc])
2001
2002  dnl disable resid when no C++ compiler is found
2003  if test x"$CXX" != "x" ; then
2004    LINKCC='$(CXX)'
2005
2006    dnl Set CXXFLAGS. Use -fno-exceptions for G++ if supported.
2007    if test "$ac_test_CXXFLAGS" != set; then
2008      if test "$GXX" = yes; then
2009        old_CXXFLAGS=$CXXFLAGS
2010        CXXFLAGS="$CXXFLAGS -fno-exceptions"
2011        AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
2012        AC_TRY_COMPILE([],
2013                       [ int test; ],
2014                       [ AC_MSG_RESULT(yes) ],
2015                       [ AC_MSG_RESULT(no)
2016                         CXXFLAGS=$old_CXXFLAGS
2017                         ])
2018      fi
2019    fi
2020    AC_PROG_CXXCPP
2021  fi
2022
2023  if test x"$with_resid" = "xyes" -o x"$with_resid" = "x"; then
2024    AC_DEFINE(HAVE_RESID,,[This version provides ReSID support.])
2025    HAVE_RESID_SUPPORT="yes"
2026    AC_CONFIG_SUBDIRS(src/resid)
2027    RESID_DIR=resid
2028    RESID_LIBS="\$(top_builddir)/src/resid/libresid.a"
2029    RESID_INCLUDES="-I\$(top_builddir)/src/resid"
2030    RESID_DEP=libresid
2031    RESIDSUB=resid
2032
2033    AC_DEFINE(HAVE_RESID_DTV,,[This version provides ReSID-DTV support.])
2034    AC_CONFIG_SUBDIRS(src/resid-dtv)
2035    RESID_DTV_DIR=resid-dtv
2036    RESID_DTV_LIBS="\$(top_builddir)/src/resid-dtv/libresiddtv.a"
2037    RESID_DTV_INCLUDES="-I\$(top_builddir)/src/resid-dtv"
2038    RESID_DTV_DEP=libresiddtv
2039    RESIDDTVSUB=resid-dtv
2040  fi
2041  AC_LANG_RESTORE
2042fi
2043
2044AC_SUBST(RESIDSUB)
2045AC_SUBST(RESIDDTVSUB)
2046
2047if test x"$RESIDSUB" = "xresid"; then
2048  AM_CONDITIONAL(RESID_DIR_USED, true)
2049else
2050  AM_CONDITIONAL(RESID_DIR_USED, false)
2051fi
2052
2053AC_SUBST(LINKCC)
2054
2055AM_CONDITIONAL(HAVE_RESID, test x"$with_resid" != "xno")
2056
2057AC_SUBST(RESID_DIR)
2058AC_SUBST(RESID_LIBS)
2059AC_SUBST(RESID_INCLUDES)
2060AC_SUBST(RESID_DEP)
2061
2062AM_CONDITIONAL(HAVE_RESID_DTV, test x"$with_resid" != "xno")
2063AC_SUBST(RESID_DTV_DIR)
2064AC_SUBST(RESID_DTV_LIBS)
2065AC_SUBST(RESID_DTV_INCLUDES)
2066AC_SUBST(RESID_DTV_DEP)
2067
2068dnl Check for typedefs, structures, and compiler characteristics.
2069AC_CHECK_HEADERS(sys/types.h)
2070
2071AC_TYPE_OFF_T
2072AC_TYPE_PID_T
2073AC_TYPE_SIZE_T
2074AC_TYPE_SSIZE_T
2075
2076dnl Check whether inline functions are available.
2077AC_C_INLINE
2078if test x"$ac_cv_c_inline" = "xno" ; then
2079  CFLAGS="$CFLAGS -DNO_INLINE"
2080fi
2081
2082dnl fix endian for interix
2083case "$host_os" in
2084  interix*)
2085      ac_cv_c_bigendian=no
2086    ;;
2087esac
2088
2089dnl Define the type sizes.
2090if [[ x"$ac_cv_prog_cc_cross" != "xyes" ]]; then
2091  AC_C_BIGENDIAN
2092else
2093  dnl if cross-compiling, we have to do this by hand
2094  echo "warning: assuming sizeof(unsigned short) == 2,"
2095  echo "                  sizeof(unsigned int) == 4,"
2096  echo "                  sizeof(unsigned long) == 4"
2097fi
2098
2099if test x"$cross_compiling" = "xyes"; then
2100  AM_CONDITIONAL(CROSS, true)
2101  CROSS=true
2102  if test x"$enable_native_tools" = "xno" -o x"$enable_native_tools" = "x"; then
2103    AC_MSG_WARN([Cross compiling and no 'enable-native-tools' specified, using slow scripts for generation tasks])
2104    NATIVE_TOOLS_COMPILER=""
2105    AM_CONDITIONAL(NATIVE_TOOLS, false)
2106  else
2107    if test x"$enable_native_tools" = "xyes"; then
2108      NATIVE_TOOLS_COMPILER="gcc"
2109      AC_MSG_WARN([No native tools compiler given, using 'gcc'])
2110      AM_CONDITIONAL(NATIVE_TOOLS, true)
2111    else
2112      NATIVE_TOOLS_COMPILER="$enable_native_tools"
2113      AM_CONDITIONAL(NATIVE_TOOLS, true)
2114    fi
2115  fi
2116else
2117  AM_CONDITIONAL(CROSS, false)
2118  CROSS=false
2119  NATIVE_TOOLS_COMPILER="$CC"
2120  AM_CONDITIONAL(NATIVE_TOOLS, true)
2121fi
2122AC_SUBST(CROSS)
2123AC_SUBST(NATIVE_TOOLS_COMPILER)
2124
2125AC_CHECK_SIZEOF(unsigned short, 2)
2126AC_CHECK_SIZEOF(unsigned int, 4)
2127AC_CHECK_SIZEOF(unsigned long, 4)
2128
2129
2130dnl Check whether gcc needs -traditional.
2131AC_PROG_GCC_TRADITIONAL
2132
2133
2134dnl Check for header files.
2135AC_HEADER_DIRENT
2136AC_CHECK_HEADERS(direct.h errno.h fcntl.h limits.h regex.h unistd.h strings.h \
2137sys/dirent.h sys/stat.h inttypes.h libgen.h sys/ioctl.h \
2138dir.h io.h process.h signal.h alloca.h wchar.h stdint.h sys/time.h)
2139
2140
2141AC_CHECK_HEADER(regexp.h,,,[#define	INIT		register char *sp = instring;
2142#define	GETC()		(*sp++)
2143#define	PEEKC()		(*sp)
2144#define	UNGETC(c)	-- sp
2145#define	RETURN(ptr)	return NULL;
2146#define	ERROR(val)	_RegExpError(val)
2147])
2148AC_DECL_SYS_SIGLIST
2149
2150dnl ----- Dynamic Lib Loading Support -----
2151dynlib_support=no
2152DYNLIB_LIBS=
2153dnl check for dlopen support on unix and beos/haiku systems
2154if test x"$is_unix" = "xyes" -o x"$is_beos" = "xyes"; then
2155  AC_CHECK_HEADER(dlfcn.h,,)
2156  if test x"$ac_cv_header_dlfcn_h" = "xyes" ; then
2157    AC_CHECK_FUNC(dlopen,
2158                 [ DYNLIB_LIBS="";
2159                   AC_DEFINE(HAVE_DYNLIB_SUPPORT,,
2160                             [Support for dynamic library loading.])
2161                   dynlib_support=yes;
2162                   HAVE_DYNLIB_SUPPORT_TOO="yes"
2163                 ])
2164    if test x"$dynlib_support" != "xyes" ; then
2165      AC_CHECK_LIB(dl, dlopen,
2166                 [ DYNLIB_LIBS="-ldl";
2167                   AC_DEFINE(HAVE_DYNLIB_SUPPORT,,
2168                             [Support for dynamic library loading.])
2169                   dynlib_support=yes;
2170                   HAVE_DYNLIB_SUPPORT_TOO="yes";
2171                   LIBS="-ldl $LIBS"
2172                 ],,)
2173    fi
2174  fi
2175elif test x"$is_win32" = "xyes" ; then
2176  AC_DEFINE(HAVE_DYNLIB_SUPPORT,,[Support for dynamic library loading.])
2177  HAVE_DYNLIB_SUPPORT_TOO="yes"
2178fi
2179AC_SUBST(DYNLIB_LIBS)
2180
2181dnl ----- Joystick support -----
2182JOY_LIBS=
2183if test x"$is_unix_x11" = "xyes" -a x"$enable_sdlui" != "xyes" -a x"$enable_sdlui2" != "xyes"; then
2184  AC_CHECK_HEADER(linux/joystick.h,
2185                  [ AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
2186                    HAS_JOYSTICK_SUPPORT="yes";
2187                    LINUX_JOYSTICK_SUPPORT="yes";
2188                    AC_DEFINE(LINUX_JOYSTICK,,
2189                              [Enable support for Linux style joysticks.])],)
2190  if test x"$ac_cv_header_linux_joystick_h" = "xyes" ; then
2191    AC_MSG_CHECKING(whether linux/joystick.h supports digital joysticks)
2192    AC_TRY_COMPILE([ #include <linux/joystick.h> ],
2193                   [ struct DJS_DATA_TYPE djs; ],
2194                   [ HAS_DIGITAL_JOYSTICK_SUPPORT="yes";
2195                     AC_DEFINE(HAS_DIGITAL_JOYSTICK,,
2196                               [Enable emulation for digital joysticks.])
2197                     AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no))
2198  fi
2199
2200  AC_CHECK_HEADER(machine/joystick.h,
2201                  [ AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
2202                    HAS_JOYSTICK_SUPPORT="yes";
2203                    BSD_JOYSTICK_SUPPORT="yes";
2204                    AC_DEFINE(HAVE_MACHINE_JOYSTICK_H,,
2205                              [Define to 1 if you have the <machine/joystick.h> header file.])
2206                    AC_DEFINE(BSD_JOYSTICK,,
2207                              [Enable support for BSD style joysticks.])],)
2208
2209  if test x"$ac_cv_header_machine_joystick_h" != "xyes"; then
2210    AC_CHECK_HEADER(sys/joystick.h,
2211                    [ AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
2212                      HAS_JOYSTICK_SUPPORT="yes";
2213                      BSD_JOYSTICK_SUPPORT="yes";
2214                      AC_DEFINE(HAVE_SYS_JOYSTICK_H,,
2215                                [Define to 1 if you have the <sys/joystick.h> header file.])
2216                      AC_DEFINE(BSD_JOYSTICK,,
2217                                [Enable support for BSD style joysticks.])],)
2218  fi
2219
2220  dnl NetBSD/FreeBSD USB joystick support
2221  usbhid_header=no
2222  usbhid_lib=no
2223  usb_lib=no
2224  AC_CHECK_LIB(usbhid, hid_get_report_desc, usbhid_lib=yes)
2225  if test x"$usbhid_lib" = "xyes" ; then
2226    AC_CHECK_HEADER(usbhid.h,
2227                    [AC_DEFINE(HAVE_USBHID_H,1,
2228                      [Define to 1 if you have the <usbhid.h> header file.])
2229                    usb_header=yes])
2230    AC_CHECK_HEADER(libusbhid.h,
2231                    [AC_DEFINE(HAVE_LIBUSBHID_H,1,
2232                      [Define to 1 if you have the <libusbhid.h> header file.])
2233                    usb_header=yes])
2234
2235    if test x"$usb_header" = "xyes" ; then
2236      AC_DEFINE(HAS_USB_JOYSTICK,,[Enable emulation for USB joysticks.])
2237      JOY_LIBS="-lusbhid"
2238      HAS_USB_JOYSTICK_SUPPORT="yes"
2239    fi
2240  else
2241    AC_CHECK_LIB(usb, hid_get_report_desc, usb_lib=yes)
2242    if test x"$usb_lib" = "xyes"; then
2243      AC_CHECK_HEADER(usb.h,
2244                      [AC_DEFINE(HAVE_USB_H,1,
2245                        [Define to 1 if you have the <usb.h> header file.])
2246                      usb_header=yes])
2247      AC_CHECK_HEADER(libusb.h,
2248                      [AC_DEFINE(HAVE_LIBUSB_H,1,
2249                        [Define to 1 if you have the <libusb.h> header file.])
2250                      usb_header=yes])
2251      if test x"$usb_header" = "xyes" ; then
2252        AC_DEFINE(HAS_USB_JOYSTICK,,[Enable emulation for USB joysticks.])
2253        JOY_LIBS="-lusb"
2254        HAS_USB_JOYSTICK_SUPPORT="yes"
2255      fi
2256    fi
2257  fi
2258fi
2259
2260if test x"$is_unix_macosx" = "xyes" -a x"$enable_sdlui" != "xyes" -a x"$enable_sdlui2" != "xyes"; then
2261  dnl --- Mac joystick support ---
2262
2263  dnl check for HID Manager
2264  if test x"$enable_hidmgr" != "xno" ; then
2265    AC_CHECK_HEADER(IOKit/hid/IOHIDManager.h,,)
2266    if test x"$ac_cv_header_IOKit_hid_IOHIDManager_h" = "xyes" ; then
2267      AC_MSG_CHECKING(whether we can link the (mac) IOHIDManager)
2268      old_LIBS="${LIBS}"
2269      LIBS="$LIBS -framework IOKit -framework CoreServices"
2270      AC_TRY_LINK([#include <IOKit/hid/IOHIDManager.h>],
2271                  [IOHIDManagerCreate(NULL,0)],
2272                  [AC_MSG_RESULT(yes);
2273                   JOY_LIBS="-framework IOKit -framework CoreServices";
2274                   AC_DEFINE(HAS_JOYSTICK,,[Enable Joystick emulation.])
2275                   HAS_JOYSTICK_SUPPORT="yes";
2276                   MAC_JOYSTICK_SUPPORT="yes";
2277                   HAS_HIDMGR_SUPPORT="yes";
2278                   AC_DEFINE(MAC_JOYSTICK,,[Enable Mac Joystick support.])
2279                   AC_DEFINE(HAS_HIDMGR,,[Enable Mac IOHIDManager Joystick driver.])
2280                   enable_hidutils=no
2281                   ],
2282                  [AC_MSG_RESULT(no);
2283                   LIBS=${old_LIBS}])
2284      LIBS="${old_LIBS}"
2285    fi
2286  fi
2287
2288  dnl check for HID utility library
2289  if test x"$enable_hidutils" != "xno" ; then
2290    AC_CHECK_HEADER(HID_Utilities_External.h,,)
2291    if test x"$ac_cv_header_HID_Utilities_External_h" = "xyes" ; then
2292      AC_MSG_CHECKING(whether we can link the (mac) HIDUtilities library)
2293      old_LIBS="${LIBS}"
2294      LIBS="$LIBS -lHIDUtilities -framework IOKit -framework CoreServices"
2295      AC_TRY_LINK([#include <HID_Utilities_External.h>],
2296                  [HIDCountDevices()],
2297                  [AC_MSG_RESULT(yes);
2298                   JOY_LIBS="-lHIDUtilities -framework IOKit -framework CoreServices";
2299                   AC_DEFINE(HAS_JOYSTICK,,[Enable Joystick emulation.])
2300                   HAS_JOYSTICK_SUPPORT="yes";
2301                   MAC_JOYSTICK_SUPPORT="yes";
2302                   AC_DEFINE(MAC_JOYSTICK,,[Enable Mac Joystick support.])],
2303                  [AC_MSG_RESULT(no);
2304                   LIBS=${old_LIBS}])
2305      LIBS="${old_LIBS}"
2306    fi
2307  fi
2308fi
2309AC_SUBST(JOY_LIBS)
2310
2311dnl Check for math library
2312AC_CHECK_HEADERS(math.h)
2313AC_CHECK_LIB(m, sqrt,,,$LIBS)
2314
2315
2316dnl ----- ZLib -----
2317ZLIB_LIBS=
2318
2319if test x"$with_zlib" != "xno" ; then
2320  AC_CHECK_HEADER(zlib.h,,)
2321  if test x"$ac_cv_header_zlib_h" = "xyes" ; then
2322    ac_cv_lib_z_zlibVersion=yes
2323    AC_CHECK_LIB(z, zlibVersion,
2324               [ ZLIB_LIBS="-lz";
2325                 HAVE_ZLIB_SUPPORT="yes";
2326                 AC_DEFINE(HAVE_ZLIB,,
2327                 [Can we use the ZLIB compression library?]) ],,)
2328  fi
2329fi
2330
2331AC_SUBST(ZLIB_LIBS)
2332
2333
2334dnl ----- Netplay Support -----
2335NETPLAY_LIBS=
2336old_LIBS="$LIBS"
2337if test x"$is_unix_x11" = "xyes" -o x"$is_unix_macosx" = "xyes"; then
2338
2339  if test x"$host_os" != "xqnx"; then
2340    dnl Check for needed network headers
2341    UNIX_NETWORK_HEADERS_PRESENT=yes
2342    case "$host_os" in
2343      nextstep*|openstep*|rhapsody*)
2344        AC_CHECK_HEADERS(sys/types.h unistd.h sys/socket.h sys/time.h netinet/in.h arpa/inet.h netdb.h,,
2345                         [UNIX_NETWORK_HEADERS_PRESENT=no],)
2346        if test x"$UNIX_NETWORK_HEADERS_PRESENT" = "xyes"; then
2347          AC_CHECK_HEADERS(sys/select.h,,[sys_select_present=no],)
2348          if test x"$sys_select_present" = "xno"; then
2349            AC_CHECK_HEADERS(libc.h,,[UNIX_NETWORK_HEADERS_PRESENT=no],)
2350          fi
2351        fi
2352        ;;
2353      *)
2354        AC_CHECK_HEADERS(sys/types.h unistd.h sys/socket.h sys/time.h sys/select.h netinet/in.h arpa/inet.h netdb.h,,
2355                         [UNIX_NETWORK_HEADERS_PRESENT=no],)
2356        ;;
2357    esac
2358  else
2359    LIBS="-lsocket -lunix $LIBS"
2360  fi
2361
2362  if test x"$UNIX_NETWORK_HEADERS_PRESENT" = "xyes"; then
2363
2364    dnl Check for possible extra needed network libraries
2365    AC_CHECK_LIB(intl, dgettext,[ NETPLAY_LIBS="-lintl $NETPLAY_LIBS";
2366                                  LIBS="-lintl $LIBS"],,)
2367    AC_CHECK_LIB(nsl, gethostbyname,[ NETPLAY_LIBS="-lnsl $NETPLAY_LIBS";
2368                                      LIBS="-lnsl $LIBS"],,)
2369    AC_CHECK_LIB(socket, gethostbyname,[ NETPLAY_LIBS="-lsocket $NETPLAY_LIBS";
2370                                         LIBS="-lsocket $LIBS"],,)
2371    AC_CHECK_LIB(bsd, gethostbyname,[ NETPLAY_LIBS="-lbsd $NETPLAY_LIBS";
2372                                      LIBS="-lbsd $LIBS"],,)
2373    AC_CHECK_LIB(net, gethostbyname,[ NETPLAY_LIBS="-lnet $NETPLAY_LIBS";
2374                                      LIBS="-lnet $LIBS"],,)
2375    AC_CHECK_LIB(inet, gethostbyname,[ NETPLAY_LIBS="-linet $NETPLAY_LIBS";
2376                                       LIBS="-linet $LIBS"],,)
2377
2378    dnl Check for needed functions
2379    UNIX_NETWORK_FUNCS_PRESENT=yes
2380
2381    dnl Check for netinet/tcp.h
2382    AC_CHECK_HEADERS([netinet/tcp.h])
2383
2384    AC_CHECK_FUNCS(socket send bind listen gethostbyname connect recv accept,,
2385                   [UNIX_NETWORK_FUNCS_PRESENT=no],)
2386
2387    if test x"$UNIX_NETWORK_FUNCS_PRESENT" = "xyes"; then
2388      AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])
2389      HAVE_NETWORK_SUPPORT="yes"
2390      AC_DEFINE(HAVE_RS232NET,,[Enable RS232 network support])
2391      HAVE_RS232NET_SUPPORT="yes"
2392      AC_CHECK_FUNCS(htons htonl)
2393      AC_CHECK_FUNCS(getdtablesize getrlimit)
2394      AC_MSG_CHECKING([For socklen_t])
2395      AC_TRY_COMPILE([#include <sys/types.h>
2396                      #include <sys/socket.h>],
2397                     [socklen_t foo; foo = 1235;],
2398                     [AC_DEFINE(HAVE_SOCKLEN_T,,[Define if the socklen_t type is present.])
2399                      AC_MSG_RESULT(yes)],
2400                     [AC_MSG_RESULT(no)])
2401
2402      AC_MSG_CHECKING([for in_addr_t])
2403      AC_TRY_COMPILE([#include <sys/types.h>
2404                      #include <stdlib.h>
2405                      #include <stddef.h>
2406                      #include <netinet/in.h>], [in_addr_t foo;],
2407                      [AC_DEFINE(HAVE_IN_ADDR_T,,[Define if the in_addr_t type is present.])
2408                       AC_MSG_RESULT(yes)],
2409                      [AC_MSG_RESULT(no)])
2410    fi
2411  fi
2412elif test x"$is_beos" = "xyes"; then
2413
2414  dnl Check for needed network headers
2415  BEOS_NETWORK_HEADERS_PRESENT=yes
2416  AC_CHECK_HEADERS(sys/socket.h netdb.h ByteOrder.h,,
2417                   [BEOS_NETWORK_HEADERS_PRESENT=no],)
2418
2419  if test x"$BEOS_NETWORK_HEADERS_PRESENT" = "xyes"; then
2420
2421    dnl Check for possible extra needed network libraries
2422
2423    AC_CHECK_LIB(network, gethostbyname,[ NETPLAY_LIBS="-lnetwork $NETPLAY_LIBS";
2424                                      LIBS="-lnetwork $LIBS"],,)
2425
2426    AC_CHECK_LIB(net, gethostbyname,[ NETPLAY_LIBS="-lnet -lnetapi $NETPLAY_LIBS";
2427                                      LIBS="-lnet -lnetapi $LIBS"],,)
2428
2429    dnl Check for needed functions
2430
2431    BEOS_NETWORK_FUNCS_PRESENT=yes
2432
2433    AC_CHECK_FUNCS(socket send bind listen gethostbyname connect recv accept,,
2434                   [BEOS_NETWORK_FUNCS_PRESENT=no],)
2435
2436    if test x"$BEOS_NETWORK_FUNCS_PRESENT" = "xyes"; then
2437      AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])
2438      HAVE_NETWORK_SUPPORT="yes"
2439      AC_DEFINE(HAVE_RS232NET,,[Enable RS232 network support])
2440      HAVE_RS232NET_SUPPORT="yes"
2441      AC_CHECK_FUNCS(getdtablesize getrlimit)
2442    fi
2443  fi
2444fi
2445
2446dnl Check for availability of IPV6
2447if test x"$is_unix_x11" = "xyes" -o x"$is_unix_macosx" = "xyes" ; then
2448  if test x"$UNIX_NETWORK_FUNCS_PRESENT" = "xyes"; then
2449    AC_MSG_CHECKING([if IPV6 should be enabled])
2450    if test x"$enable_ipv6" != "xno"; then
2451      have_ipv6=no
2452      AC_TRY_COMPILE([
2453        #include <sys/socket.h>
2454        #include <sys/types.h>
2455        #include <netinet/in.h>], [
2456        struct sockaddr_storage ss;
2457        struct in6_addr in6;
2458        socket(AF_INET6, SOCK_STREAM, 0);
2459        in6 = in6addr_any;
2460        ],
2461        have_ipv6=yes,
2462        have_ipv6=no
2463      )
2464      AC_MSG_RESULT($have_ipv6)
2465
2466      if test $have_ipv6 = yes; then
2467        have_broken_ss_family=no
2468
2469        dnl on some platforms, the structure sockaddr doesn't have a
2470        dnl ss_family, but __ss_family. If we find no ss_family then we
2471        dnl check for __ss_family, and if found define NEED_PREFIXED_SS_FAMILY.
2472        AC_MSG_CHECKING([struct sockaddr::ss_family])
2473        AC_TRY_COMPILE([
2474          #include <sys/socket.h>
2475          #include <sys/types.h>], [
2476          struct sockaddr_storage ss ;
2477          ss.ss_family = 0 ;
2478          ],
2479          have_ss_family=yes,
2480          have_ss_family=no
2481        )
2482        AC_MSG_RESULT($have_ss_family)
2483        if test x"$have_ss_family" = "xno" ; then
2484          AC_MSG_CHECKING([broken struct sockaddr::ss_family])
2485          AC_TRY_COMPILE([
2486            #include <sys/socket.h>
2487            #include <sys/types.h>], [
2488            struct sockaddr_storage ss ;
2489            ss.__ss_family = 0 ;
2490            ],
2491            have_broken_ss_family=yes,
2492            have_broken_ss_family=no
2493          )
2494          AC_MSG_RESULT($have_broken_ss_family)
2495          if test x$have_broken_ss_family = xyes ; then
2496            AC_DEFINE(NEED_PREFIXED_SS_FAMILY, [],
2497            [Whether struct sockaddr::__ss_family exists])
2498            AC_DEFINE(ss_family, __ss_family,
2499            [ss_family is not defined here, use __ss_family instead])
2500          else
2501            AC_MSG_WARN(ss_family and __ss_family not found)
2502          fi
2503        fi
2504
2505        have_gethostbyname2=no
2506        AC_CHECK_FUNC(gethostbyname2, have_gethostbyname2=yes)
2507        if test $have_gethostbyname2 = yes; then
2508          AC_DEFINE([HAVE_GETHOSTBYNAME2], [], [Define if gethostbyname2 can be used])
2509          AC_DEFINE([HAVE_IPV6], [], [Define if ipv6 can be used])
2510          HAVE_IPV6_SUPPORT="yes"
2511        else
2512          have_getipnodebyname=no
2513          AC_CHECK_FUNC(getipnodebyname, have_getipnodebyname=yes)
2514          if test $have_getipnodebyname = yes; then
2515            AC_DEFINE([HAVE_GETIPNODEBYNAME], [], [Define if getipnodebyname can be used])
2516            AC_DEFINE([HAVE_IPV6], [], [Define if ipv6 can be used])
2517            HAVE_IPV6_SUPPORT="yes"
2518          fi
2519        fi
2520      fi
2521    else
2522      AC_MSG_RESULT("no")
2523    fi
2524  fi
2525fi
2526LIBS="$old_LIBS"
2527AC_SUBST(NETPLAY_LIBS)
2528
2529dnl ----- FFMPEG -----
2530FFMPEG_DIR=
2531FFMPEG_LIBS=
2532FFMPEG_INCLUDES=
2533FFMPEG_DEP=
2534
2535HAVE_SHARED_FFMPEG=no
2536HAVE_STATIC_FFMPEG=no
2537HAVE_EXTERNAL_FFMPEG=no
2538
2539AC_MSG_CHECKING([for FFMPEG support])
2540
2541dnl shared vice included ffmpeg
2542if test x"$enable_shared_ffmpeg" = "xyes"; then
2543  if test x"$is_win32" = "xyes" -o x"$is_unix" = "xyes" -a x"$dynlib_support" = "xyes" ; then
2544    FFMPEG_DEP=libffmpeg
2545    FFMPEG_LIBS="\$(top_builddir)/src/libffmpeg.a"
2546    FFMPEG_DIR="$FFMPEG_DIR liblame libx264 libffmpeg"
2547    AC_DEFINE([HAVE_FFMPEG],,[Have FFMPEG av* libs available])
2548    HAVE_FFMPEG_SUPPORT="yes"
2549    AC_DEFINE([SHARED_FFMPEG],,[FFMPEG libraries are shared])
2550    SHARED_FFMPEG_SUPPORT="yes"
2551    FFMPEG_INCLUDES="-I\$(top_srcdir)/src/lib/libffmpeg"
2552
2553    FFMPEG_DO_SUBDIRS=yes
2554    HAVE_SHARED_FFMPEG=yes
2555
2556    dnl --- define obsolete variables as long as they are not removed from driver code ---
2557    AC_DEFINE([HAVE_FFMPEG_SWSCALE],,[Have FFMPEG swscale lib available])
2558    HAVE_FFMPEG_SWSCALE_SUPPORT="yes"
2559    AC_DEFINE([HAVE_FFMPEG_HEADER_SUBDIRS],,[FFMPEG uses subdirs for headers])
2560    AC_MSG_RESULT([yes (shared internal)])
2561    GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS ffmpegdrv.o ffmpeglib.o"
2562  else
2563    AC_MSG_RESULT([shared not available])
2564  fi
2565fi
2566
2567dnl static vice included ffmpeg
2568if test x"$enable_static_ffmpeg" = "xyes"; then
2569  FFMPEG_DEP=libffmpeg
2570  FFMPEG_LIBS="\$(top_builddir)/src/lib/libffmpeg/libavformat/libavformat.a \$(top_builddir)/src/lib/libffmpeg/libavcodec/libavcodec.a \$(top_builddir)/src/lib/libffmpeg/libavutil/libavutil.a \$(top_builddir)/src/lib/libffmpeg/libswscale/libswscale.a \$(top_builddir)/src/lib/libffmpeg/libswresample/libswresample.a \$(top_builddir)/src/lib/libffmpeg/lib/libmp3lame.a \$(top_builddir)/src/lib/libffmpeg/lib/libx264.a"
2571  FFMPEG_DIR="$FFMPEG_DIR liblame libx264 libffmpeg"
2572  AC_DEFINE([HAVE_FFMPEG],,[Have FFMPEG av* libs available])
2573  HAVE_FFMPEG_SUPPORT="yes"
2574  AC_DEFINE([STATIC_FFMPEG],,[FFMPEG libraries are static])
2575  STATIC_FFMPEG_SUPPORT="yes"
2576  FFMPEG_INCLUDES="-I\$(top_srcdir)/src/lib/libffmpeg"
2577
2578  AC_MSG_RESULT([yes (static internal)])
2579
2580  AC_CHECK_LIB(rt, clock_gettime,,)
2581  AC_CHECK_LIB(bz2, BZ2_bzDecompressInit,,)
2582  AC_CHECK_LIB(lzma, lzma_code,,)
2583  AC_CHECK_LIB(va, vaBeginPicture,,)
2584  AC_CHECK_LIB(m, sqrt,,)
2585
2586  if test x"$is_win32" = "xyes"; then
2587    win32_pthreads=no
2588    AC_CHECK_LIB(pthreadGC2, _imp__pthread_self, [ win32_pthreads=yes ])
2589    if test x"$win32_pthreads" = "xno"; then
2590      AC_CHECK_LIB(pthreadGC2, pthread_self, [ win32_pthreads=yes ])
2591    fi
2592    if test x"$win32_pthreads" = "xno"; then
2593      AC_CHECK_LIB(pthread, _imp__pthread_self, [ win32_pthreads=yes ])
2594    else
2595      LIBS="$LIBS -lpthreadGC2"
2596    fi
2597    if test x"$win32_pthreads" = "xno"; then
2598      AC_CHECK_LIB(pthread, pthread_self, [ win32_pthreads=yes ])
2599    else
2600      LIBS="$LIBS -lpthread"
2601    fi
2602    if test x"$win32_pthreads" = "xno"; then
2603      AC_MSG_ERROR([Needed pthread lib missing])
2604    else
2605      LIBS="$LIBS -lpthread"
2606    fi
2607    dnl Add -lws2_32
2608    LIBS="$LIBS -lws2_32"
2609  else
2610    AC_CHECK_LIB(pthread, pthread_create,,)
2611  fi
2612
2613  FFMPEG_DO_SUBDIRS=yes
2614  HAVE_STATIC_FFMPEG=yes
2615
2616  dnl --- define obsolete variables as long as they are not removed from driver code ---
2617  AC_DEFINE([HAVE_FFMPEG_SWSCALE],,[Have FFMPEG swscale lib available])
2618  HAVE_FFMPEG_SWSCALE_SUPPORT="yes"
2619  AC_DEFINE([HAVE_FFMPEG_HEADER_SUBDIRS],,[FFMPEG uses subdirs for headers])
2620
2621  GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS ffmpegdrv.o ffmpeglib.o"
2622fi
2623
2624dnl external ffmpeg
2625if test x"$enable_external_ffmpeg" = "xyes"; then
2626  PKG_PROG_PKG_CONFIG
2627
2628  valid_ffmpeg_platform="no"
2629
2630  if test x"$is_unix" = "xyes"; then
2631    dnl --- unix (requires dynlib support) ---
2632    if test x"$dynlib_support" = "xyes"; then
2633      valid_ffmpeg_platform="yes"
2634    fi
2635  else
2636    valid_ffmpeg_platform="yes"
2637  fi
2638
2639  if test x"$valid_ffmpeg_platform" = "xyes"; then
2640    AC_MSG_RESULT([via pkg-config])
2641    PKG_CHECK_MODULES(FFMPEG_AV,  [libavcodec libavformat libavutil],
2642      [old_CFLAGS=$CFLAGS
2643       old_CPPFLAGS=$CPPFLAGS
2644       CFLAGS="$CFLAGS $FFMPEG_AV_CFLAGS"
2645       CPPFLAGS="$CPPFLAGS $FFMPEG_AV_CFLAGS"
2646
2647       AC_CHECK_HEADER(libavformat/avformat.h,
2648        [AC_DEFINE([HAVE_FFMPEG_HEADER_SUBDIRS],,[FFMPEG uses subdirs for headers])],
2649        [AC_CHECK_HEADER(avformat.h,,
2650          [AC_MSG_ERROR([No suitable FFMPEG header found!])])])
2651
2652       CFLAGS=$old_CFLAGS
2653       CPPFLAGS=$old_CPPFLAGS
2654
2655      PKG_CHECK_MODULES(FFMPEG_SWSCALE, [libswscale],
2656        [have_swscale=yes],
2657        [echo "no. trying img_convert"]
2658        [old_LIBS=$LIBS]
2659        [AC_CHECK_LIB(avcodec, img_convert,[have_imgconvert=yes])]
2660        [LIBS=$old_LIBS]
2661      )
2662      if (test x"${have_swscale}" = x"yes") || (test x"${have_imgconvert}" = x"yes") ; then
2663        AC_DEFINE([HAVE_FFMPEG],,[Have FFMPEG av* libs available])
2664        HAVE_FFMPEG_SUPPORT="yes"
2665        FFMPEG_INCLUDES="$FFMPEG_AV_CFLAGS"
2666        GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS ffmpegdrv.o ffmpeglib.o"
2667	dlopen_pthread=yes
2668      fi
2669      if (test x"${have_swscale}" = x"yes") ; then
2670        AC_DEFINE([HAVE_FFMPEG_SWSCALE],,[Have FFMPEG swscale lib available])
2671        HAVE_FFMPEG_SWSCALE_SUPPORT="yes"
2672        FFMPEG_INCLUDES="$FFMPEG_INCLUDES $FFMPEG_SWSCALE_CFLAGS"
2673	dlopen_pthread=yes
2674      fi
2675       ],
2676      [echo "no. disabled."]
2677    )
2678    HAVE_EXTERNAL_FFMPEG=yes
2679    PKG_CHECK_MODULES(FFMPEG_SWRESAMPLE, [libswresample], [have_swresample=yes], [have_swresample=no])
2680    if test x"$have_swresample" = "xyes"; then
2681      AC_DEFINE([HAVE_FFMPEG_SWRESAMPLE],,[Have FFMPEG swresample lib available])
2682      HAVE_FFMPEG_SWRESAMPLE_SUPPORT="yes"
2683    else
2684      PKG_CHECK_MODULES(FFMPEG_AVRESAMPLE, [libavresample], [have_avresample=yes], [have_avresample=no])
2685      if test x"$have_avresample" = "xyes"; then
2686        AC_DEFINE([HAVE_FFMPEG_AVRESAMPLE],,[Have FFMPEG avresample lib available])
2687        HAVE_FFMPEG_AVRESAMPLE_SUPPORT="yes"
2688      else
2689        AC_MSG_ERROR([No swresample or avresample library available!])
2690      fi
2691    fi
2692  else
2693    AC_MSG_RESULT([not available])
2694  fi
2695fi
2696
2697AC_SUBST(FFMPEG_INCLUDES)
2698AC_SUBST(FFMPEG_LIBS)
2699AC_SUBST(FFMPEG_DIR)
2700AC_SUBST(FFMPEG_DEP)
2701
2702if test x"$HAVE_SHARED_FFMPEG" != "xyes" -a x"$HAVE_STATIC_FFMPEG" != "xyes" -a x"$HAVE_EXTERNAL_FFMPEG" != "xyes"; then
2703  AC_MSG_RESULT([disabled])
2704fi
2705
2706if test x"$FFMPEG_DO_SUBDIRS" = "xyes"; then
2707  if test x"$is_win32" = "xyes"; then
2708      ac_configure_args="$ac_configure_args --enable-yasm-command=${YASM} --enable-make-command=${MAKE-make} --enable-w32threads --enable-full-host=${ac_cv_host} --enable-compiler=${CC} --prefix=${prefix}"
2709  else
2710      ac_configure_args="$ac_configure_args --enable-yasm-command=${YASM} --enable-make-command=${MAKE-make} --enable-full-host=${ac_cv_host} --enable-compiler=${CC} --prefix=${prefix}"
2711  fi
2712  AC_CONFIG_SUBDIRS(src/lib/ffmpeg)
2713fi
2714
2715if test x"$HAVE_SHARED_FFMPEG" = "xyes"; then
2716  AM_CONDITIONAL(HAVE_SHARED_FFMPEG, true)
2717else
2718  AM_CONDITIONAL(HAVE_SHARED_FFMPEG, false)
2719fi
2720
2721if test x"$HAVE_STATIC_FFMPEG" = "xyes"; then
2722  AM_CONDITIONAL(HAVE_STATIC_FFMPEG, true)
2723else
2724  AM_CONDITIONAL(HAVE_STATIC_FFMPEG, false)
2725fi
2726
2727if test x"$enable_shared_ffmpeg" = "xyes" -o x"$enable_static_ffmpeg" = "xyes"; then
2728  LAMEMP3SUB=liblame
2729  LIBX264SUB=libx264
2730  LIBFFMPEGSUB=libffmpeg
2731  FFMPEGSUB=ffmpeg
2732else
2733  LAMEMP3SUB=""
2734  LIBX264SUB=""
2735  LIBFFMPEGSUB=""
2736  FFMPEGSUB=""
2737fi
2738
2739AC_SUBST(LAMEMP3SUB)
2740AC_SUBST(LIBX264SUB)
2741AC_SUBST(LIBFFMPEGSUB)
2742AC_SUBST(FFMPEGSUB)
2743
2744if test x"$LAMEMP3SUB" = "xliblame"; then
2745  AM_CONDITIONAL(LAMEMP3_DIR_USED, true)
2746else
2747  AM_CONDITIONAL(LAMEMP3_DIR_USED, false)
2748fi
2749
2750dnl ----- Apple QuickTime -----
2751QUICKTIME_INCLUDES=
2752QUICKTIME_LIBS=
2753if test x"$enable_quicktime" = "xyes" -o x"$is_unix_macosx" = "xyes"; then
2754
2755  dnl ---- Mac OS X -----
2756  if test x"$is_unix_macosx" = x"yes" ; then
2757    AC_CHECK_HEADER(QuickTime/QuickTime.h,,)
2758    if test x"$ac_cv_header_QuickTime_QuickTime_h" = "xyes" ; then
2759      AC_CHECK_HEADER(CoreVideo/CVPixelBuffer.h,,)
2760      if test x"$ac_cv_header_CoreVideo_CVPixelBuffer_h" = "xyes" ; then
2761        AC_MSG_CHECKING(whether we can link the QuickTime framework)
2762        old_LIBS="${LIBS}"
2763        LIBS="${LIBS} -framework QuickTime -framework CoreVideo"
2764        AC_TRY_LINK([#include <QuickTime/Movies.h>
2765                     #include <CoreVideo/CVPixelBuffer.h>],
2766                    [EnterMovies(); CVPixelBufferGetTypeID();],
2767                    [AC_MSG_RESULT(yes);
2768                     GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS quicktimedrv.o"
2769                     QUICKTIME_LIBS="-framework QuickTime -framework CoreVideo"
2770                     HAVE_QUICKTIME_SUPPORT="yes"
2771                     AC_DEFINE(HAVE_QUICKTIME,,[Enable QuickTime support.])],
2772                    [AC_MSG_RESULT(no)])
2773        LIBS=${old_LIBS}
2774      fi
2775    fi
2776  fi
2777fi
2778AC_SUBST(QUICKTIME_INCLUDES)
2779AC_SUBST(QUICKTIME_LIBS)
2780
2781dnl check for glibc 2.20+
2782linux_glibc_220_and_up=yes
2783AC_MSG_CHECKING(if we are using glibc-2.20 and up)
2784AC_TRY_LINK([#ifdef __linux
2785             #  include <ctype.h>
2786             #  ifdef __GLIBC__
2787             #    if (__GLIBC__>=2)
2788             #      if ((__GLIBC__==2 && __GLIBC_MINOR__>=20) || __GLIBC__>=3)
2789             #        error GLIBC2.20+
2790             #      endif
2791             #    endif
2792             #  endif
2793             #endif],
2794             [int a=0],
2795             linux_glibc_220_and_up=no)
2796AC_MSG_RESULT($linux_glibc_220_and_up)
2797
2798dnl ----- Ethernet -----
2799TFE_LIBS=""
2800if test x"$enable_ethernet" = "xyes"; then
2801  have_tuntap="no"
2802  if test x"$is_win32_gtk3" = "xyes"; then
2803    AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
2804    AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
2805    HAVE_RAWNET_SUPPORT="yes"
2806  else
2807    if test x"$is_win32" = "xno"; then
2808    dnl libpcap.a
2809      AC_CHECK_LIB(nsl, gethostbyname,[ LIBS="-lnsl $LIBS" ],,)
2810      AC_CHECK_LIB(socket, gethostbyname,[ LIBS="-lsocket $LIBS" ],,)
2811      AC_CHECK_LIB(pcap, pcap_inject,[
2812        AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
2813        AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
2814        HAVE_RAWNET_SUPPORT="yes";
2815        AC_DEFINE(HAVE_PCAP_INJECT,,[A libpcap version with pcap_inject is available])
2816        TFE_LIBS="-lpcap"
2817      ],,$LIBS)
2818      AC_CHECK_LIB(pcap, pcap_sendpacket,[
2819        AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
2820        AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
2821        HAVE_RAWNET_SUPPORT="yes";
2822        AC_DEFINE(HAVE_PCAP_SENDPACKET,,[A libpcap version with pcap_sendpacket is available])
2823        TFE_LIBS="-lpcap"
2824      ],,$LIBS)
2825    dnl libpcap.a
2826    dnl libnet.a
2827      AC_CHECK_LIB(pcap, pcap_open_live,[
2828        AC_CHECK_LIB(net, libnet_init,[
2829          AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
2830          AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
2831          HAVE_RAWNET_SUPPORT="yes";
2832          AC_DEFINE(VICE_USE_LIBNET_1_1,,[Support for The Final Ethernet])
2833          TFE_LIBS="-lpcap `libnet-config --libs`"
2834          libnet_cflags="`libnet-config --defines`"
2835      ],,$LIBS)],,$LIBS)
2836    dnl libpcap.a
2837    dnl libnet.a
2838      AC_CHECK_LIB(pcap, pcap_open_live,[
2839        AC_CHECK_LIB(net, libnet_write_link_layer,[
2840          AC_DEFINE(HAVE_PCAP,,[Support for PCAP library.])
2841          AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
2842          HAVE_RAWNET_SUPPORT="yes";
2843          TFE_LIBS="-lpcap `libnet-config --libs`"
2844          libnet_cflags="`libnet-config --defines`"
2845      ],,$LIBS)],,$LIBS)
2846      if test x"$libnet_cflags" != "x"; then
2847        if test x"$linux_glibc_220_and_up" = "xyes"; then
2848          new_libnet_cflags=""
2849          for i in $libnet_cflags
2850          do
2851            if test x"$i" = "x-D_BSD_SOURCE"; then
2852              new_libnet_cflags="$new_libnet_cflags -D_DEFAULT_SOURCE"
2853            else
2854              new_libnet_cflags="$new_libnet_cflags $i"
2855            fi
2856          done
2857          CFLAGS="$CFLAGS $new_libnet_cflags"
2858        else
2859          CFLAGS="$CFLAGS $libnet_cflags"
2860        fi
2861      fi
2862    dnl check for tuntap
2863      AC_CHECK_HEADER(linux/if_tun.h,[AC_DEFINE(HAVE_TUNTAP,, [TUN/TAP support using <linux/if_tun.h>])
2864                      AC_DEFINE(HAVE_RAWNET,,[Support for CS8900A ethernet controller.])
2865                      have_tuntap=yes
2866                      HAVE_RAWNET_SUPPORT="yes"])
2867    fi
2868  fi
2869  if test x"$TFE_LIBS" = "x" -a x"$is_win32" = "xno" -a x"$is_win32_gtk3" = "xno" -a x"$have_tuntap" = "xno"; then
2870    AC_MSG_ERROR([Needed pcap library not found, please install libpcap-dev or equivalent])
2871  fi
2872fi
2873AC_SUBST(TFE_LIBS)
2874
2875dnl ----- Sound Drivers -----
2876if test x"$is_unix" = "xyes"; then
2877  if test x"$with_pulse" != "xno"; then
2878    AC_CHECK_HEADERS(pulse/simple.h,[AC_CHECK_LIB(pulse-simple, pa_simple_new,
2879                     [SOUND_DRIVERS="$SOUND_DRIVERS soundpulse.o";
2880                      SOUND_LIBS="$SOUND_LIBS -lpulse-simple -lpulse";
2881                      USE_PULSE_SUPPORT="yes";
2882                      AC_DEFINE(USE_PULSE,,[Enable pulseaudio support.])],,$SOUND_LIBS)])
2883    if test x"$with_pulse" = "xyes" -a x"$USE_PULSE_SUPPORT" != "xyes"; then
2884      AC_MSG_ERROR([pulse audio support missing])
2885    fi
2886  fi
2887
2888
2889  dnl aRts support checking
2890  if test x"$with_arts" = "xyes"; then
2891    old_cflags=$CFLAGS
2892    old_libs=$LIBS
2893    CFLAGS="$CFLAGS `artsc-config --cflags`"
2894    LIBS="$LIBS `artsc-config --libs`"
2895    AC_CHECK_HEADERS(artsc.h,[AC_CHECK_LIB(artsc, arts_init,
2896                     [SOUND_DRIVERS="$SOUND_DRIVERS soundarts.o"; break],
2897                     [CFLAGS=$old_cflags; LIBS=$old_libs; with_arts=no; break],$SOUND_LIBS)],
2898                     [CFLAGS=$old_cflags; LIBS=$old_libs; with_arts=no; break])
2899    if test x"$with_arts" = "xyes"; then
2900      AC_DEFINE(USE_ARTS,,[Enable aRts support.])
2901      USE_ARTS_SUPPORT="yes"
2902    else
2903      AC_MSG_ERROR([aRts support is missing])
2904    fi
2905  fi
2906
2907
2908  dnl ALSA support checks
2909  if test x"$with_alsa" != "xno"; then
2910    AC_CHECK_HEADERS(alsa/asoundlib.h,[AC_CHECK_LIB(asound, snd_pcm_open,
2911                     [SOUND_DRIVERS="$SOUND_DRIVERS soundalsa.o";
2912                      SOUND_LIBS="$SOUND_LIBS -lasound";
2913                      USE_ALSA_SUPPORT="yes";
2914                      AC_DEFINE(USE_ALSA,,[Enable alsa support.])],,$SOUND_LIBS)])
2915    AC_CHECK_LIB(asound, snd_pcm_avail,
2916                 [AC_DEFINE(HAVE_SND_PCM_AVAIL,,[Use more accurate buffer fill reporting])])
2917    if test x"$with_alsa" = "xyes" -a x"$USE_ALSA_SUPPORT" != "xyes"; then
2918      AC_MSG_ERROR([alsa support is missing])
2919    fi
2920  fi
2921
2922
2923  dnl OSS support checks
2924  if test x"$with_oss" != "xno" -a x"$host_os" != "uwin"; then
2925    AC_CHECK_HEADERS(linux/soundcard.h machine/soundcard.h sys/soundcard.h soundcard.h,
2926                     [SOUND_DRIVERS="$SOUND_DRIVERS sounduss.o";
2927                      USE_OSS_SUPPORT="yes";
2928                      AC_DEFINE(USE_OSS,,[Enable oss support.])])
2929    AC_CHECK_LIB(ossaudio, _oss_ioctl,,,$SOUND_LIBS)
2930    if test x"$with_oss" = "xyes" -a x"$USE_OSS_SUPPORT" != "xyes"; then
2931      AC_MSG_ERROR([OSS support missing])
2932    fi
2933  fi
2934
2935  AC_CHECK_HEADERS(dmedia/audio.h, [AC_CHECK_LIB(audio, ALseterrorhandler,
2936                   [SOUND_DRIVERS="$SOUND_DRIVERS soundsgi.o";
2937                    SOUND_LIBS="$SOUND_LIBS -laudio";
2938                    USE_DMEDIA_SUPPORT="yes";
2939                    AC_DEFINE(USE_DMEDIA,,[Enable sgi sound support.])],,$SOUND_LIBS)])
2940
2941  AC_CHECK_HEADERS(sys/audioio.h,
2942                   [SOUND_DRIVERS="$SOUND_DRIVERS soundsun.o"; break])
2943
2944  case "$host_os" in
2945    hpux*)
2946      AC_CHECK_HEADERS(sys/audio.h,
2947                       [SOUND_DRIVERS="$SOUND_DRIVERS soundhpux.o"; break])
2948      ;;
2949    *)
2950      ;;
2951  esac
2952
2953  AC_CHECK_HEADERS(UMS/UMSAudioDevice.h,[AC_CHECK_HEADERS(UMS/UMSBAUDDevice.h,
2954                   [AC_CHECK_LIB(UMSobj, UMSAudioDevice_initialize,
2955                    [SOUND_DRIVERS="$SOUND_DRIVERS soundaix.o";
2956                     SOUND_LIBS="$SOUND_LIBS -lUMSobj";
2957                     USE_AIX_AUDIO_SUPPORT="yes";
2958                     AC_DEFINE(USE_AIX_AUDIO,,[Enable aix sound support.])],,$SOUND_LIBS)])])
2959fi
2960
2961if test x"$is_amiga" = "xyes"; then
2962  if test x"$enable_ahi" != "xno"; then
2963    AC_CHECK_HEADERS(devices/ahi.h,
2964                     [SOUND_DRIVERS="$SOUND_DRIVERS soundahi.o"; break])
2965
2966    if test "x$ac_cv_header_devices_ahi_h" = xyes; then
2967      HAVE_DEVICES_AHI_H_SUPPORT="yes"
2968    else
2969      if test x"$enable_ahi" = "xyes"; then
2970        AC_MSG_ERROR([AHI support is missing])
2971      fi
2972    fi
2973  fi
2974fi
2975
2976dnl --- Lame ---
2977if test x"$enable_lame" != "xno" ; then
2978
2979  AC_CHECK_HEADER(lame/lame.h,,)
2980
2981  dnl the header is available!
2982  if test "$ac_cv_header_lame_lame_h" != "no" ; then
2983    AC_MSG_CHECKING([for lame lib linking])
2984    if test x"$dynlib_support" = "xyes" -a x"$enable_static_lame" != "xyes" ; then
2985      dnl dynlib linking
2986      SOUND_DRIVERS="$SOUND_DRIVERS soundmp3.o lamelib.o"
2987      AC_DEFINE(USE_LAMEMP3,,[Enable lamemp3 support.])
2988      USE_LAMEMP3_SUPPORT="yes"
2989      AC_MSG_RESULT([dynlib])
2990    else
2991      dnl try static linking
2992      AC_MSG_RESULT([trying static])
2993      AC_CHECK_LIB(mp3lame, lame_encode_buffer,[ADD_MPGDECODER=0],,)
2994      if test "$ac_cv_lib_mp3lame_lame_encode_buffer" = "no"; then
2995        unset ac_cv_lib_mp3lame_lame_encode_buffer
2996        AC_CHECK_LIB(mp3lame, lame_encode_buffer,[ADD_MPGDECODER=1],,[-lmpgdecoder])
2997      fi
2998      if test "$ac_cv_lib_mp3lame_lame_encode_buffer" != "no"; then
2999        SOUND_DRIVERS="$SOUND_DRIVERS soundmp3.o";
3000        SOUND_LIBS="$SOUND_LIBS -lmp3lame";
3001        if test "$ADD_MPGDECODER" = "1" ; then
3002          SOUND_LIBS="$SOUND_LIBS -lmpgdecoder";
3003        fi
3004        AC_DEFINE(USE_LAMEMP3,,[Enable lamemp3 support.])
3005        USE_LAMEMP3_SUPPORT="yes"
3006        AC_DEFINE(HAVE_STATIC_LAME,,[Static linking for lame libs])
3007      fi
3008      if test x"$USE_LAMEMP3_SUPPORT" != "xyes" -a x"$enable_lame" = "xyes"; then
3009        AC_MSG_ERROR([lame mp3 support is missing])
3010      fi
3011    fi
3012  fi
3013fi
3014
3015AC_PATH_PROGS(FCCACHE, fc-cache, false)
3016if test x"$FCCACHE" = "xfalse"; then
3017  AM_CONDITIONAL(HAVE_FC_CACHE, false)
3018else
3019  AM_CONDITIONAL(HAVE_FC_CACHE, true)
3020fi
3021
3022if test x"$is_amigaos4" = "xyes"; then
3023  dnl for AmigaOS4 native resid needs to be configured without dependency tracking
3024    if test x"$cross_compiling" != "xyes"; then
3025    ac_configure_args="$ac_configure_args --disable-dependency-tracking"
3026  fi
3027fi
3028
3029dsound_header_no_lib="no"
3030
3031if test x"$is_win32" = "xyes" -o x"$is_win32_gtk3" = "xyes"; then
3032    if test x"$enable_sdlui" != "xyes" -a x"$enable_sdlui2" != "xyes"; then
3033        SOUND_DRIVERS="$SOUND_DRIVERS soundwmm.o"
3034        AC_MSG_CHECKING(whether we can use directx sound)
3035        AC_CHECK_HEADER(dsound.h,
3036              [ AC_DEFINE(USE_DXSOUND,,[Enable directx sound support.])
3037                USE_DXSOUND_SUPPORT="yes" ]
3038              [ SOUND_DRIVERS="$SOUND_DRIVERS sounddx.o" ]
3039              [ AC_MSG_CHECKING(for -ldsound) ]
3040              [ old_LIBS="$LIBS" ]
3041              [ LIBS="$LIBS -ldsound" ]
3042              [ AC_LINK_IFELSE([
3043                               AC_LANG_PROGRAM(
3044                                               [#define DIRECTSOUND_VERSION 0x500
3045                                                #include <dsound.h>],
3046                                               [LPDIRECTSOUNDBUFFER buffer=NULL;
3047                                                IDirectSoundBuffer_Restore(buffer);]
3048                                              )
3049                               ],
3050                            [ AC_DEFINE(HAVE_DSOUND_LIB, [], [dsound.lib or libdsound.a are present]) ]
3051                            [ AC_MSG_RESULT(yes) ]
3052                            [ SOUND_LIBS="$SOUND_LIBS -ldsound" ],
3053                            [ AC_MSG_RESULT(no) ]
3054                            [ dsound_header_no_lib="yes" ]
3055              )]
3056              [ LIBS="$old_LIBS" ]
3057        )
3058
3059        if test x"$dsound_header_no_lib" = "xyes" -o x"$dinput_header_no_lib" = "xyes"; then
3060              AC_MSG_CHECKING(if CoInitialize can be linked)
3061              LIBS="$LIBS -lole32"
3062              AC_LINK_IFELSE([
3063                               AC_LANG_PROGRAM(
3064                                               [#include <objbase.h>],
3065                                               [CoInitialize(NULL);]
3066                                              )
3067                               ],
3068                               [ AC_MSG_RESULT(yes) ],
3069                               [ AC_MSG_ERROR(no) ]
3070                              )
3071        fi
3072    else
3073        SOUND_DRIVERS="$SOUND_DRIVERS soundwmm.o"
3074    fi
3075fi
3076
3077if test x"$is_beos" = "xyes"; then
3078    SOUND_DRIVERS="$SOUND_DRIVERS soundbeos.o soundbsp.o"
3079fi
3080
3081VORBIS_PRESENT=yes
3082AC_CHECK_HEADERS(vorbis/vorbisfile.h,,[VORBIS_PRESENT=no],)
3083
3084if test x"$VORBIS_PRESENT" = "xyes"; then
3085  AC_CHECK_LIB(ogg, ogg_stream_flush,, [VORBIS_PRESENT=no])
3086fi
3087
3088if test x"$VORBIS_PRESENT" = "xyes"; then
3089  AC_CHECK_LIB(vorbis, vorbis_info_clear,, [VORBIS_PRESENT=no])
3090fi
3091
3092if test x"$VORBIS_PRESENT" = "xyes"; then
3093  AC_CHECK_LIB(vorbisfile, ov_open_callbacks,, [VORBIS_PRESENT=no])
3094fi
3095
3096if test x"$VORBIS_PRESENT" = "xyes"; then
3097  AC_CHECK_LIB(vorbisenc, vorbis_encode_init_vbr,, [VORBIS_PRESENT=no])
3098fi
3099
3100if test x"$VORBIS_PRESENT" = "xyes"; then
3101  SOUND_DRIVERS="$SOUND_DRIVERS soundvorbis.o";
3102  LIBS="$LIBS -lvorbisfile -logg -lvorbis -lvorbisenc"
3103  USE_VORBIS_SUPPORT="yes"
3104  AC_DEFINE(USE_VORBIS,,[Enable ogg/vorbis support.])
3105fi
3106
3107FLAC_PRESENT=yes
3108
3109AC_CHECK_HEADERS(FLAC/stream_decoder.h,,[FLAC_PRESENT=no],)
3110
3111if test x"$FLAC_PRESENT" = "xyes"; then
3112  AC_CHECK_LIB(FLAC, FLAC__stream_decoder_get_channels,, [FLAC_PRESENT=no])
3113fi
3114
3115if test x"$FLAC_PRESENT" = "xno"; then
3116  unset ac_cv_lib_FLAC_FLAC__stream_decoder_get_channels
3117  AC_CHECK_LIB(FLAC, FLAC__stream_decoder_get_channels,, [FLAC_PRESENT=no], [-lwinmm])
3118  if test x"$FLAC_PRESENT" = "xyes"; then
3119    LIBS="$LIBS -lwinmm"
3120  fi
3121fi
3122
3123if test x"$FLAC_PRESENT" = "xyes"; then
3124    LIBS="$LIBS -lFLAC"
3125    SOUND_DRIVERS="$SOUND_DRIVERS soundflac.o"
3126    USE_FLAC_SUPPORT="yes"
3127    AC_DEFINE(USE_FLAC,,[Enable FLAC support.])
3128fi
3129
3130if test x"$is_unix_macosx" = "xyes"; then
3131
3132  dnl --- check for CoreAudio ---
3133  AC_CHECK_HEADER(CoreAudio/CoreAudio.h,,)
3134  if test x"$ac_cv_header_CoreAudio_CoreAudio_h" = "xyes" ; then
3135    AC_CHECK_HEADER(AudioToolbox/AudioToolbox.h,,)
3136    if test x"$ac_cv_header_AudioToolbox_AudioToolbox_h" = "xyes" ; then
3137      AC_MSG_CHECKING(whether we can link the CoreAudio framework)
3138      old_LIBS="${LIBS}"
3139      LIBS="${LIBS} -framework CoreAudio -framework AudioToolbox"
3140      AC_TRY_LINK([#include <CoreAudio/CoreAudio.h>],
3141                  [AudioDeviceStart(0,0);],
3142                  [AC_MSG_RESULT(yes);
3143                   SOUND_DRIVERS="$SOUND_DRIVERS soundcoreaudio.o";
3144                   SOUND_LIBS="$SOUND_LIBS -framework CoreAudio -framework AudioToolbox";
3145                   USE_COREAUDIO_SUPPORT="yes";
3146                   AC_DEFINE(USE_COREAUDIO,,[Enable CoreAudio support.])],
3147                  [AC_MSG_RESULT(no)])
3148      LIBS=${old_LIBS}
3149
3150      AC_CHECK_HEADER(AudioUnit/AudioUnit.h,,)
3151      if test x"$ac_cv_header_AudioUnit_AudioUnit_h" = "xyes" ; then
3152        AC_MSG_CHECKING(whether we can link the AudioUnit framework)
3153        old_LIBS="${LIBS}"
3154        LIBS="${LIBS} -framework AudioUnit"
3155        AC_TRY_LINK([#include <AudioUnit/AudioUnit.h>],
3156                    [AudioOutputUnitStart(NULL);],
3157                    [AC_MSG_RESULT(yes);
3158                     SOUND_LIBS="$SOUND_LIBS -framework AudioUnit";
3159                     HAVE_AUDIO_UNIT_SUPPORT="yes";
3160                     AC_DEFINE(HAVE_AUDIO_UNIT,,[Enable AudioUnit support.])],
3161                    [AC_MSG_RESULT(no)])
3162        LIBS=${old_LIBS}
3163      fi
3164    fi
3165  fi
3166
3167  dnl --- check for CoreMIDI ---
3168  if test x"$enable_midi" != "xno"; then
3169    AC_MSG_CHECKING(whether we can link the CoreMIDI framework)
3170    old_LIBS="${LIBS}"
3171    LIBS="$LIBS -framework CoreMidi -framework CoreServices"
3172    AC_TRY_LINK([#include <CoreMIDI/MIDIServices.h>],
3173                [MIDIGetNumberOfDevices()],
3174                [AC_MSG_RESULT(yes);
3175                 AC_DEFINE(HAVE_MIDI,,[Enable MIDI emulation.])
3176                 HAVE_MIDI_SUPPORT="yes"],
3177               [AC_MSG_RESULT(no);
3178                 LIBS=${old_LIBS}])
3179  fi
3180  if test x"$enable_midi" = "xyes" -a x"$HAVE_MIDI_SUPPORT" != "xyes"; then
3181    AC_MSG_ERROR([MIDI support missing])
3182  fi
3183fi
3184
3185if test x"$is_win32_gtk3" = "xyes" -a x"$enable_native_gtk3ui" = "xyes"; then
3186  SOUND_DRIVERS="$SOUND_DRIVERS soundwmm.o"
3187fi
3188
3189AC_SUBST(SOUND_DRIVERS)
3190AC_SUBST(SOUND_LIBS)
3191
3192dnl Check for ParSID/SSI2001/HardSID/CW support
3193if test x"$is_unix" = "xyes"; then
3194
3195  dnl Check cpu first
3196  case "$host_cpu" in
3197  i*86 | x86_64* | amd64*)
3198      ;;
3199  *)
3200      enable_parsid=no
3201      enable_ssi2001=no
3202      enable_hardsid=no
3203      enable_catweasel=no
3204      ;;
3205  esac
3206
3207  if test x"$enable_parsid" != "xno" -o x"$enable_ssi2001" != "xno" -o x"$enable_hardsid" != "xno" -o x"$enable_catweasel" != "xno"; then
3208
3209    if test x"$enable_libieee1284" = "xyes"; then
3210      LIBIEEE1284_HEADERS_PRESENT=yes
3211    else
3212      LIBIEEE1284_HEADERS_PRESENT=no
3213    fi
3214    LINUX_HARDSID_HEADER_PRESENT=yes
3215    LINUX_PARPORT_HEADERS_PRESENT=yes
3216    CATWEASEL_HEADER_PRESENT=yes
3217    QNX_MMAN_HEADERS_PRESENT=yes
3218    BSD_SET_IOPERM_HEADERS_PRESENT=yes
3219    PARSID_SUPPORT=no
3220    IOSID_SUPPORT=no
3221    PORTSID_SUPPORT=no
3222    PCIUTILS_HEADER_PRESENT=yes
3223    PCIUTILS_LIB_PRESENT=no
3224
3225    dnl Check for needed io headers
3226    if test x"$enable_libieee1284" = "xyes"; then
3227      AC_CHECK_HEADERS(ieee1284.h,,[LIBIEEE1284_HEADERS_PRESENT=no],)
3228    fi
3229    AC_CHECK_HEADERS(linux/hardsid.h,,[LINUX_HARDSID_HEADER_PRESENT=no],)
3230    AC_CHECK_HEADERS(linux/ppdev.h linux/parport.h,,[LINUX_PARPORT_HEADERS_PRESENT=no],)
3231    AC_CHECK_HEADERS(dev/ppbus/ppi.h dev/ppbus/ppbconf.h,,[FREEBSD_PARPORT_HEADERS_PRESENT=no],)
3232    AC_CHECK_HEADERS(cwsid.h,,[CATWEASEL_HEADER_PRESENT=no],)
3233    AC_CHECK_HEADERS(sys/mman.h hw/inout.h,,[QNX_MMAN_HEADERS_PRESENT=no],)
3234    AC_CHECK_HEADERS(machine/sysarch.h,,[BSD_SET_IOPERM_HEADERS_PRESENT=no],)
3235    AC_CHECK_HEADERS(unistd.h sys/io.h machine/pio.h machine/cpufunc.h)
3236    AC_CHECK_HEADERS(pci/pci.h,,[PCIUTILS_HEADER_PRESENT=no],)
3237
3238    case "$host_os" in
3239    solaris*)
3240      PORTSID_SUPPORT=yes
3241      ;;
3242    esac
3243
3244    if test x"$PCIUTILS_HEADER_PRESENT" = "xyes"; then
3245      AC_CHECK_LIB(pciutils, pci_fill_info,[LIBS="-lpciutils $LIBS"; PCIUTILS_LIB_PRESENT=yes],,)
3246      if test x"$PCIUTILS_LIB_PRESENT" = "xno"; then
3247        AC_CHECK_LIB(pci, pci_fill_info,[LIBS="-lpci $LIBS"; PCIUTILS_LIB_PRESENT=yes],,)
3248      fi
3249      if test x"$PCIUTILS_LIB_PRESENT" != "xno"; then
3250        AC_DEFINE(HAVE_LIBPCI,,[Define to 1 if you have the 'pciutils' library.])
3251        HAVE_PCIUTILS_SUPPORT=yes
3252      fi
3253    fi
3254
3255    if test x"$LIBIEEE1284_HEADERS_PRESENT" = "xyes"; then
3256      AC_CHECK_LIB(ieee1284, ieee1284_find_ports,[LIBS="-lieee1284 $LIBS"; PARSID_SUPPORT=yes],,)
3257      if test x"$PARSID_SUPPORT" = "xyes"; then
3258        AC_DEFINE(HAVE_LIBIEEE1284,,[Define to 1 if you have the `ieee1284' library (-lieee1284).])
3259        HAVE_LIBIEEE1284_SUPPORT="yes"
3260      else
3261        AC_MSG_ERROR([libieee1284 is missing])
3262      fi
3263    else
3264      if test x"$enable_libieee1284" = "xyes"; then
3265        AC_MSG_ERROR([libieee1284 header is missing])
3266      fi
3267    fi
3268
3269    if test x"$PARSID_SUPPORT" != "xno" -a x"$enable_ssi2001" = "xno" -a x"$enable_hardsid" = "xno"; then
3270      IOSID_SUPPORT=yes
3271      HAVE_IOSID_SUPPORT=yes
3272    fi
3273
3274    if test x"$LINUX_PARPORT_HEADERS_PRESENT" = "xyes"; then
3275      AC_DEFINE(HAVE_LINUX_PARPORT_HEADERS,,[Support for Linux par port device file.])
3276      PORTSID_SUPPORT=yes
3277      HAVE_PORTSID_SUPPORT=yes
3278    fi
3279
3280    if test x"$FREEBSD_PARPORT_HEADERS_PRESENT" = "xyes"; then
3281      AC_DEFINE(HAVE_FREEBSD_PARPORT_HEADERS,,[Support for FreeBSD par port device file.])
3282      PORTSID_SUPPORT=yes
3283      HAVE_PORTSID_SUPPORT=yes
3284    fi
3285
3286    if test x"$IOSID_SUPPORT" = "xno"; then
3287      if test x"$QNX_MMAN_HEADERS_PRESENT" = "xyes"; then
3288        QNX_MMAN_FUNCS_PRESENT=yes
3289        AC_CHECK_FUNCS(mmap_device_io in8 out8,,[QNX_MMAN_FUNCS_PRESENT=no])
3290        if test x"$QNX_MMAN_FUNCS_PRESENT" = "xyes"; then
3291          IOSID_SUPPORT=yes
3292          HAVE_IOSID_SUPPORT=yes
3293        fi
3294      fi
3295    fi
3296
3297    if test x"$IOSID_SUPPORT" = "xno"; then
3298      if test x"$BSD_SET_IOPERM_HEADERS_PRESENT" = "xyes"; then
3299        AC_CHECK_LIB(amd64, amd64_set_ioperm,[LIBS="-lamd64 $LIBS"; IOSID_SUPPORT=yes],,)
3300        if test x"$IOSID_SUPPORT" = "xyes"; then
3301          AC_DEFINE(HAVE_LIBAMD64,,[Define to 1 if you have the `amd64' library (-lamd64).])
3302        fi
3303      fi
3304    fi
3305
3306    if test x"$IOSID_SUPPORT" = "xno"; then
3307      if test x"$BSD_SET_IOPERM_HEADERS_PRESENT" = "xyes"; then
3308        AC_CHECK_LIB(i386, i386_get_ioperm,[LIBS="-li386 $LIBS"],,)
3309        AC_CHECK_FUNCS(i386_set_ioperm,[IOSID_SUPPORT=yes],)
3310      fi
3311    fi
3312
3313    if test x"$IOSID_SUPPORT" = "xno"; then
3314      AC_CHECK_FUNCS(ioperm,[IOSID_SUPPORT=yes],)
3315      AC_CHECK_FUNCS(inb outb outb_p inb_p inbv outbv)
3316    fi
3317
3318    if test x"$IOSID_SUPPORT" = "xyes"; then
3319      if test x"$enable_parsid" != "xno"; then
3320        AC_DEFINE(HAVE_PARSID,,[Support for ParSID.])
3321        HAVE_PARSID_SUPPORT="yes"
3322      fi
3323      if test x"$enable_ssi2001" != "xno"; then
3324        AC_DEFINE(HAVE_SSI2001,,[Support for SSI2001 (ISA SID card).])
3325        HAVE_SSI2001_SUPPORT="yes"
3326      fi
3327      if test x"$enable_catweasel" != "xno"; then
3328        AC_DEFINE(HAVE_CATWEASELMKIII,,[Support for Catweasel MKIII.])
3329        AC_DEFINE(HAVE_CATWEASELMKIII_IO,,[Support for direct PCI I/O access Catweasel MKIII.])
3330        HAVE_CATWEASELMKIII_SUPPORT="yes"
3331      fi
3332      if test x"$enable_hardsid" != "xno"; then
3333        AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.])
3334        AC_DEFINE(HAVE_HARDSID_IO,,[Support for PCI/ISA HardSID.])
3335        HAVE_HARDSID_SUPPORT="yes"
3336      fi
3337    else
3338      if test x"$enable_hardsid" != "xno" -a x"$LINUX_HARDSID_HEADER_PRESENT" = "xyes"; then
3339        AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.])
3340        HAVE_HARDSID_SUPPORT="yes"
3341      fi
3342      if test x"$enable_catweasel" != "xno" -a x"$CATWEASEL_HEADER_PRESENT" = "xyes"; then
3343        AC_DEFINE(HAVE_CATWEASELMKIII,,[Support for Catweasel MKIII.])
3344        HAVE_CATWEASELMKIII_SUPPORT="yes"
3345      fi
3346    fi
3347
3348    if test x"$PORTSID_SUPPORT" = "xyes"; then
3349      if test x"$enable_parsid" != "xno" -a x"HAVE_PARSID_SUPPORT" != "xyes"; then
3350        AC_DEFINE(HAVE_PARSID,,[Support for ParSID.])
3351        AC_DEFINE(HAVE_PORTSID,,[Support for file device based access to ParSID.])
3352        HAVE_PARSID_SUPPORT="yes"
3353      fi
3354    fi
3355
3356    if test x"$enable_catweasel" = "xyes" -a x"$HAVE_CATWEASELMKIII_SUPPORT" != "xyes"; then
3357      AC_MSG_ERROR([CatWeaselMKIII support is missing])
3358    fi
3359
3360    if test x"$enable_hardsid" = "xyes" -a x"$HAVE_HARDSID_SUPPORT" != "xyes"; then
3361      AC_MSG_ERROR([HardSID support is missing])
3362    fi
3363
3364  fi
3365fi
3366
3367AC_TYPE_SIGNAL
3368AC_FUNC_VFORK
3369AC_CHECK_TYPES(u_short)
3370AC_CHECK_TYPES(socklen_t, [], [], [[#include <sys/socket.h>]])
3371
3372dnl some platforms have some of the functions in libbsd,
3373dnl so we check it out first.
3374AC_CHECK_LIB(bsd,gettimeofday,,,$LIBS)
3375
3376dnl some platforms have some of the functions in libposix,
3377dnl so we check it out second.
3378AC_CHECK_LIB(posix,gettimeofday,,,$LIBS)
3379
3380AC_CHECK_FUNCS(gettimeofday memmove atexit strerror strcasecmp strncasecmp dirname mkstemp swab getcwd getpwuid random rewinddir strtok strtok_r strtoul snprintf vsnprintf ltoa ultoa stpcpy strlcpy strlwr strrev fseeko)
3381AC_CHECK_FUNCS(strdup, [have_strdup_func=yes], [have_strdup_func=no])
3382
3383if test x"$have_strdup_func" = "xno"; then
3384  AC_MSG_CHECKING(whether strdup is defined as a macro)
3385  AC_TRY_LINK([#include <string.h>],
3386               [char *something = strdup("something")],
3387               [AC_MSG_RESULT(yes); have_strdup_func=yes],
3388               [AC_MSG_RESULT(no); have_strdup_func=no])
3389
3390  if test x"$have_strdup_func" = "xyes"; then
3391    AC_DEFINE(HAVE_STRDUP,,[Define to 1 if you have the `strdup' function.])
3392  fi
3393fi
3394
3395AC_SUBST(LIBS)
3396
3397dnl check for usleep
3398if test x"$is_win32" != "xyes" -a x"$is_amiga_aros" != "xyes"; then
3399  AC_REPLACE_FUNCS(usleep)
3400fi
3401
3402AC_CHECK_FUNC(nanosleep,
3403              [ AC_DEFINE(HAVE_NANOSLEEP,,[Use nanosleep instead of usleep]) ])
3404
3405dnl Check time.h.
3406
3407dnl AC_HEADER_TIME
3408dnl AC_STRUCT_TM
3409
3410dnl GTK3-FIXME: check if readline is even needed for native GTK3 UI and disable the check if needed
3411
3412dnl ----- Readline -----
3413dnl Check whether we have GNU readline.  If not, use our replacement.
3414dnl The user can force us to use the replacement with `--without-readline'.
3415READLINE_LIBS=
3416EDITLINE_LIBS=
3417if test x"$is_unix_x11" = "xyes"; then
3418  if test x"$with_readline" != "xno" ; then
3419    READLINE_HEADER_PRESENT=yes
3420    AC_CHECK_HEADERS(readline/readline.h,,[READLINE_HEADER_PRESENT=no],)
3421    READLINE=""
3422    unset ac_cv_lib_readline_readline
3423    old_LIBS="$LIBS"
3424    AC_CHECK_LIB(readline, readline,
3425               [ READLINE="" READLINE_LIBS="-lreadline"],
3426               [],,)
3427
3428    if test "$ac_cv_lib_readline_readline" = "no"; then
3429      unset ac_cv_lib_readline_readline
3430      AC_CHECK_LIB(readline, readline,
3431               [ READLINE="" READLINE_LIBS="-lreadline -ltermcap"],
3432               [], [-ltermcap],)
3433    fi
3434
3435    if test "$ac_cv_lib_readline_readline" = "no"; then
3436      unset ac_cv_lib_readline_readline
3437      AC_CHECK_LIB(readline, readline,
3438               [ READLINE="" READLINE_LIBS="-lreadline -lncurses"],
3439               [], [-lncurses],)
3440    fi
3441
3442    if test "$ac_cv_lib_readline_readline" = "no"; then
3443      unset ac_cv_lib_readline_readline
3444      AC_CHECK_LIB(readline, readline,
3445             [ READLINE="" READLINE_LIBS="-lreadline -lcurses"],
3446             [ ],
3447              [-lcurses],)
3448    fi
3449
3450    if test x"$enable_sdlui" != "xno" -o x"$enable_sdlui2" != "xno"; then
3451      READLINE=""
3452    fi
3453
3454    if test "$ac_cv_lib_readline_readline" = "yes"; then
3455      AC_CHECK_LIB(readline, rl_readline_name,
3456             [ AC_DEFINE(HAVE_RLNAME,,
3457             [Does the `readline' library support `rl_readline_name'?]) ],,)
3458    fi
3459    LIBS="${old_LIBS}"
3460  else
3461    if test x"$enable_sdlui" != "xyes" -a x"$enable_sdlui2" != "xyes"; then
3462      READLINE="\$(top_builddir)/src/arch/unix/readline/libreadline.a"
3463    fi
3464  fi
3465else
3466  READLINE=""
3467fi
3468AM_CONDITIONAL(NEED_READLINE, test x"$READLINE" != "x")
3469AC_SUBST(READLINE)
3470AC_SUBST(READLINE_LIBS)
3471
3472dnl Configure graphics output drivers
3473old_LIBS="$LIBS"
3474GFXOUTPUT_LIBS=
3475
3476dnl check for png support
3477if test x"$with_png" != "xno" ; then
3478  dnl Check for the PNG library.
3479  AC_CHECK_HEADER(png.h,,)
3480  if test x"$ac_cv_header_png_h" = "xyes" ; then
3481    unset ac_cv_lib_png_png_sig_cmp
3482    AC_CHECK_LIB(png, png_sig_cmp,
3483                 [ GFXOUTPUT_LIBS="-lpng $GFXOUTPUT_LIBS";
3484                   GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS pngdrv.o";
3485                   HAVE_PNG_SUPPORT="yes";
3486                   AC_DEFINE(HAVE_PNG,,[Can we use the PNG library?]) ],,)
3487    if test "$ac_cv_lib_png_png_sig_cmp" = "no"; then
3488      unset ac_cv_lib_png_png_sig_cmp
3489      AC_CHECK_LIB(png, png_sig_cmp,
3490                   [ GFXOUTPUT_LIBS="-lpng -lz $GFXOUTPUT_LIBS";
3491                     GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS pngdrv.o";
3492                     HAVE_PNG_SUPPORT="yes";
3493                     AC_DEFINE(HAVE_PNG,,
3494                               [Can we use the PNG library?]) ],,"-lz")
3495    fi
3496  fi
3497
3498  if test x"$HAVE_PNG_SUPPORT" != "xyes" -a x"$cross_compiling" != "xyes"; then
3499    PKG_PROG_PKG_CONFIG
3500    if test x"$PKG_CONFIG" != "x"; then
3501      AC_MSG_CHECKING([if pkgconfig libpng is present])
3502      PKG_CHECK_MODULES(PNG, [libpng], HAVE_PNG_SUPPORT="yes")
3503      if test x"$HAVE_PNG_SUPPORT" = "xyes"; then
3504          GFXOUTPUT_LIBS="$PNG_LIBS $GFXOUTPUT_LIBS"
3505          GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS pngdrv.o";
3506          CFLAGS="$PNG_CFLAGS $CFLAGS";
3507          AC_DEFINE(HAVE_PNG,,[Can we use the PNG library?])
3508          AC_MSG_RESULT([yes])
3509      else
3510          AC_MSG_RESULT([no])
3511      fi
3512    fi
3513  fi
3514
3515  if test x"$with_png" = "xyes" -a x"$HAVE_PNG_SUPPORT" != "xyes"; then
3516    AC_MSG_ERROR([PNG support is missing])
3517  fi
3518fi
3519
3520dnl Check for the GIF or UNGIF library.
3521if test x"$with_gif" != "xno"; then
3522  AC_CHECK_HEADER(gif_lib.h,,)
3523  if test x"$ac_cv_header_gif_lib_h" = "xyes" ; then
3524    AC_CHECK_LIB(ungif, EGifPutLine, [
3525                 GFXOUTPUT_LIBS="-lungif $GFXOUTPUT_LIBS";
3526                 GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS gifdrv.o";
3527                 HAVE_GIF_SUPPORT="yes";
3528                 AC_DEFINE(HAVE_GIF,,[Can we use the GIF or UNGIF library?]) ],,)
3529    if test "$ac_cv_lib_ungif_EGifPutLine" = "no"; then
3530      AC_CHECK_LIB(gif, EGifPutLine, [
3531                   GFXOUTPUT_LIBS="-lgif $GFXOUTPUT_LIBS";
3532                   GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS gifdrv.o";
3533                   HAVE_GIF_SUPPORT="yes";
3534                   AC_DEFINE(HAVE_GIF,,[Can we use the GIF or UNGIF library?]) ],,)
3535    fi
3536 fi
3537 if test x"$with_gif" = "xyes" -a x"$HAVE_GIF_SUPPORT" != "xyes"; then
3538   AC_MSG_ERROR([GIF support not present])
3539 fi
3540fi
3541
3542dnl check for jpeg support
3543if test x"$with_jpeg" != "xno" ; then
3544  dnl Check for the JPEG library.
3545  AC_CHECK_HEADER(jpeglib.h,,)
3546  if test x"$ac_cv_header_jpeglib_h" = "xyes" ; then
3547    AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [
3548                 GFXOUTPUT_LIBS="-ljpeg $GFXOUTPUT_LIBS";
3549                 GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS jpegdrv.o";
3550                 HAVE_JPEG_SUPPORT="yes";
3551                 AC_DEFINE(HAVE_JPEG,,[Can we use the JPEG library?]) ],,)
3552  fi
3553  if test x"$with_jpeg" = "xyes" -a x"$HAVE_JPEG_SUPPORT" != "xyes"; then
3554    AC_MSG_ERROR([JPEG support is missing])
3555  fi
3556fi
3557
3558LIBS="$old_LIBS"
3559AC_SUBST(GFXOUTPUT_DRIVERS)
3560AC_SUBST(GFXOUTPUT_LIBS)
3561
3562
3563dnl PortAudio support checks
3564
3565if test x"$enable_portaudio" != "xno"; then
3566  AC_CHECK_HEADERS(portaudio.h, PA_HEADERS="yes", PA_HEADERS="no")
3567
3568  if test x"$PA_HEADERS" = "xyes"; then
3569    if test x"$is_win32" = "xyes" -o x"$is_win32_gtk3" = "xyes"; then
3570      AC_CHECK_LIB(portaudio, Pa_Initialize,
3571                   [LIBS="$LIBS -lportaudio -lwinmm";
3572                    USE_PORTAUDIO_SUPPORT="yes";
3573                    AC_DEFINE(USE_PORTAUDIO,,[Enable portaudio sampling support.])],,-lwinmm)
3574    else
3575      AC_CHECK_LIB(portaudio, Pa_Initialize,
3576                 [LIBS="$LIBS -lportaudio";
3577                  USE_PORTAUDIO_SUPPORT="yes";
3578                  AC_DEFINE(USE_PORTAUDIO,,[Enable portaudio sampling support.])],,)
3579    fi
3580  fi
3581
3582  if test x"$enable_portaudio" = "xyes" -a x"$USE_PORTAUDIO_SUPPORT" != "xyes"; then
3583    AC_MSG_ERROR([PortAudio support is missing])
3584  fi
3585fi
3586
3587AC_CHECK_HEADERS(mpg123.h,[AC_CHECK_LIB(mpg123, mpg123_init,
3588                     [LIBS="$LIBS -lmpg123";
3589                      USE_MPG123_SUPPORT="yes";
3590                      AC_DEFINE(USE_MPG123,,[Enable mpg123 mp3 decoding support.])],,)])
3591
3592dnl Check for libraries and header files
3593if test x"$is_amiga" = "xyes"; then
3594
3595  dnl On Amiga, we already know what we want.
3596  if test x"$is_amiga_aros" != "xyes"; then
3597    if test x"$host_os" != "xmorphos" -a x"$host_os" != "xwarpos" -a x"$host_os" != "xpowerup"; then
3598      LIBS="$LIBS -lauto"
3599    fi
3600  fi
3601  AC_SUBST(LDFLAGS)
3602
3603elif test x"$is_beos" = "xyes"; then
3604
3605  dnl On BEOS, we already know what we want.
3606
3607  LIBS="$LIBS -lbe -ltracker -ldevice -lmedia -lgame"
3608  AC_SUBST(LDFLAGS)
3609fi
3610
3611dnl CBM4Linux/OpenCBM
3612AC_MSG_CHECKING([for OpenCBM support])
3613if test x"$enable_realdevice" != "xno"; then
3614  if test x"$host_os" = "xcygwin32" -o x"$host_os" = "xcygwin" -o x"$host_os" = "xmingw32" -o x"$host_os" = "xmingw32msvc"; then
3615    AC_DEFINE(HAVE_OPENCBM,,[Support for OpenCBM (former CBM4Linux).])
3616    HAVE_OPENCBM_SUPPORT="yes"
3617    AM_CONDITIONAL(HAVE_REALDEVICE, true)
3618    AC_MSG_RESULT([yes])
3619  else
3620    if test x"$dynlib_support" = "xyes"; then
3621      if test x"$is_beos" != "xyes"; then
3622        AC_DEFINE(HAVE_OPENCBM,,[Support for OpenCBM (former CBM4Linux).])
3623        HAVE_OPENCBM_SUPPORT="yes"
3624        AM_CONDITIONAL(HAVE_REALDEVICE, true)
3625        AC_MSG_RESULT([yes])
3626      else
3627        AM_CONDITIONAL(HAVE_REALDEVICE, false)
3628        AC_MSG_RESULT([no (not supported on current host)])
3629      fi
3630    else
3631      AM_CONDITIONAL(HAVE_REALDEVICE, false)
3632      AC_MSG_RESULT([no (dynamic lib support missing)])
3633    fi
3634  fi
3635else
3636  AM_CONDITIONAL(HAVE_REALDEVICE, false)
3637  AC_MSG_RESULT([no (realdevice disabled)])
3638fi
3639
3640AC_SUBST(vsid_LDFLAGS)
3641AC_SUBST(x64_LDFLAGS)
3642AC_SUBST(x128_LDFLAGS)
3643AC_SUBST(xscpu64_LDFLAGS)
3644AC_SUBST(xvic_LDFLAGS)
3645AC_SUBST(xpet_LDFLAGS)
3646AC_SUBST(xplus4_LDFLAGS)
3647AC_SUBST(xcbm2_LDFLAGS)
3648
3649AM_CONDITIONAL(SUPPORT_X64DTV, true)
3650AM_CONDITIONAL(SUPPORT_X64SC, true)
3651
3652dnl xscpu64 should be supported on all platforms
3653AM_CONDITIONAL(SUPPORT_XSCPU64, true)
3654
3655dnl Setup the system-specific object files.
3656if test x"$enable_sdlui" = "xyes" -o x"$enable_sdlui2" = "xyes"; then
3657  ARCH_DIR="\$(top_builddir)/src/arch/sdl"
3658  ARCH_SRC_DIR="\$(top_srcdir)/src/arch/sdl"
3659  ARCH_LIBS="$ARCH_DIR/libarch.a"
3660  if test x"$is_win32" = "xyes"; then
3661    ARCH_INCLUDES="-I$ARCH_SRC_DIR -I\$(top_srcdir)/src/arch/mingw32-pcap/wpcap"
3662  else
3663    ARCH_INCLUDES="-I$ARCH_SRC_DIR -I\$(top_srcdir)/src/arch"
3664  fi
3665  if test x"$ac_cv_lib_readline_readline" = "xyes"; then
3666    AC_DEFINE(HAVE_READLINE,,[Enable the readline library])
3667  fi
3668  AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
3669  HAS_JOYSTICK_SUPPORT="yes"
3670  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])
3671  HAVE_MOUSE_SUPPORT="yes"
3672  AC_DEFINE(HAVE_LIGHTPEN,,[Enable lightpen support])
3673  HAVE_LIGHTPEN_SUPPORT="yes"
3674  AM_CONDITIONAL(SDL_COMPILE, true)
3675  if test x"$enable_sdlui2" = "xyes"; then
3676    AM_CONDITIONAL(SDL2_COMPILE, true)
3677    SDL_VERSION=2
3678  else
3679    AM_CONDITIONAL(SDL2_COMPILE, false)
3680    SDL_VERSION=1
3681  fi
3682  AC_SUBST(SDL_VERSION)
3683else
3684  AM_CONDITIONAL(SDL_COMPILE, false)
3685  AM_CONDITIONAL(SDL2_COMPILE, false)
3686fi
3687
3688SDL_EXTRA_LIBS=""
3689
3690AM_CONDITIONAL(MAKE_BINDIST, false)
3691
3692if test x"$enable_native_gtk3ui" = "xyes"; then
3693  dnl Use C++ compiler/linker since novte uses C++
3694  LINKCC='$(CXX)'
3695  ARCH_DIR="\$(top_builddir)/src/arch/gtk3"
3696  ARCH_SRC_DIR="\$(top_srcdir)/src/arch/gtk3"
3697  ARCH_LIBS="$ARCH_DIR/libarch.a $ARCH_DIR/widgets/libwidgets.a $ARCH_DIR/widgets/base/libbasewidgets.a $ARCH_DIR/novte/libnovte.a"
3698  if test x"$is_win32" = "xyes" -o x"$is_win32_gtk3" = "xyes"; then
3699    ARCH_INCLUDES="-I$ARCH_SRC_DIR -I\$(top_srcdir)/src/arch/mingw32-pcap/wpcap"
3700    AM_CONDITIONAL(MAKE_BINDIST, true)
3701  else
3702    ARCH_INCLUDES="-I$ARCH_SRC_DIR -I\$(top_srcdir)/src/arch"
3703  fi
3704  if test x"$ac_cv_lib_readline_readline" = "xyes"; then
3705    AC_DEFINE(HAVE_READLINE,,[Enable the readline library])
3706  fi
3707  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])
3708  HAVE_MOUSE_SUPPORT="yes"
3709  AC_DEFINE(HAVE_LIGHTPEN,,[Enable lightpen support])
3710  HAVE_LIGHTPEN_SUPPORT="yes"
3711
3712  AM_CONDITIONAL(NATIVE_GTK3_COMPILE, true)
3713
3714else
3715  AM_CONDITIONAL(NATIVE_GTK3_COMPILE, false)
3716fi
3717
3718if test x"$is_unix" = "xyes"; then
3719
3720  if test x"$is_win32_gtk3" = "xyes"; then
3721    AC_DEFINE(WIN32_COMPILE,,[Are we compiling for windows?])
3722    LIBS="$LIBS -lntdll"
3723  else
3724    AC_DEFINE(UNIX_COMPILE,,[Are we compiling for unix?])
3725  fi
3726
3727  AM_CONDITIONAL(SUPPORT_CMDLINE_TOOLS, true)
3728  AM_CONDITIONAL(UNIX_COMPILE, true)
3729  if test x"$is_win32_gtk3" = "xyes"; then
3730     AM_CONDITIONAL(WIN32_COMPILE, true)
3731  else
3732     AM_CONDITIONAL(WIN32_COMPILE, false)
3733  fi
3734  AM_CONDITIONAL(OS2_COMPILE, false)
3735  AM_CONDITIONAL(BEOS_COMPILE, false)
3736  AM_CONDITIONAL(AMIGA_COMPILE, false)
3737  scounixcompile=no
3738  openserver5compile=no
3739  openserver6compile=no
3740  unixwarecompile=no
3741  qnx4compile=no
3742  qnx6compile=no
3743  solariscompile=no
3744  hpuxcompile=no
3745  skyoscompile=no
3746  syllablecompile=no
3747  nextstepcompile=no
3748  openstepcompile=no
3749  rhapsodycompile=no
3750  case "$host_os" in
3751    rhapsody*)
3752      rhapsodycompile=yes
3753      AM_CONDITIONAL(UNIX_RHAPSODY_COMPILE, true)
3754      AC_DEFINE(RHAPSODY_COMPILE,,[Enable Rhapsody 5.x support])
3755      ;;
3756    openstep*)
3757      openstepcompile=yes
3758      AM_CONDITIONAL(UNIX_OPENSTEP_COMPILE, true)
3759      AC_DEFINE(OPENSTEP_COMPILE,,[Enable OpenStep 4.x support])
3760      ;;
3761    nextstep*)
3762      nextstepcompile=yes
3763      AM_CONDITIONAL(UNIX_NEXTSTEP_COMPILE, true)
3764      AC_DEFINE(NEXTSTEP_COMPILE,,[Enable NextStep 3.x support])
3765      ;;
3766    skyos*)
3767      skyoscompile=yes
3768      AM_CONDITIONAL(UNIX_SKYOS_COMPILE, true)
3769      ;;
3770    qnx*)
3771      qnx4compile=yes
3772      AM_CONDITIONAL(UNIX_QNX4_COMPILE, true)
3773      ;;
3774    nto*)
3775      qnx6compile=yes
3776      AM_CONDITIONAL(UNIX_QNX6_COMPILE, true)
3777      ;;
3778    solaris*)
3779      solariscompile=yes
3780      AM_CONDITIONAL(UNIX_SOLARIS_COMPILE, true)
3781      sol_version=`uname -r`
3782      if test x"$sol_version" = "x5.7"; then
3783        ac_configure_args="$ac_configure_args"
3784      fi
3785      ;;
3786    sco3.2v4*)
3787      scounixcompile=yes
3788      AM_CONDITIONAL(UNIX_SCO4_COMPILE, true)
3789      AC_DEFINE(SCO4UNIX_COMPILE,,[Enable SCO Unix 4.x support])
3790      ;;
3791    sco3.2v5*)
3792      openserver5compile=yes
3793      AM_CONDITIONAL(UNIX_OPENSERVER5_COMPILE, true)
3794      AC_DEFINE(OPENSERVER5_COMPILE,,[Enable SCO Openserver 5.x support])
3795      ;;
3796    sco3.2v6*)
3797      openserver6compile=yes
3798      AM_CONDITIONAL(UNIX_OPENSERVER6_COMPILE, true)
3799      AC_DEFINE(OPENSERVER6_COMPILE,,[Enable SCO Openserver 6.x support])
3800      ;;
3801    sco3.2v7*)
3802      unixwarecompile=yes
3803      AM_CONDITIONAL(UNIX_UNIXWARE_COMPILE, true)
3804      AC_DEFINE(UNIXWARE_COMPILE,,[Enable SCO Unixware 7.x support])
3805      ;;
3806    hpux*)
3807      hpuxcompile=yes
3808      AM_CONDITIONAL(UNIX_HPUX_COMPILE, true)
3809      ;;
3810    syllable*)
3811      syllablecompile=yes
3812      AM_CONDITIONAL(SYLLABLE_COMPILE, true)
3813      ;;
3814    *)
3815      ;;
3816  esac
3817
3818  if test x"$skyoscompile" = "xno"; then
3819    AM_CONDITIONAL(UNIX_SKYOS_COMPILE, false)
3820  fi
3821
3822  if test x"$qnx4compile" = "xno"; then
3823    AM_CONDITIONAL(UNIX_QNX4_COMPILE, false)
3824  fi
3825
3826  if test x"$qnx6compile" = "xno"; then
3827    AM_CONDITIONAL(UNIX_QNX6_COMPILE, false)
3828  fi
3829
3830  if test x"$nextstepcompile" = "xno"; then
3831    AM_CONDITIONAL(UNIX_NEXTSTEP_COMPILE, false)
3832  fi
3833
3834  if test x"$openstepcompile" = "xno"; then
3835    AM_CONDITIONAL(UNIX_OPENSTEP_COMPILE, false)
3836  fi
3837
3838  if test x"$rhapsodycompile" = "xno"; then
3839    AM_CONDITIONAL(UNIX_RHAPSODY_COMPILE, false)
3840  fi
3841
3842  if test x"$solariscompile" = "xno"; then
3843    AM_CONDITIONAL(UNIX_SOLARIS_COMPILE, false)
3844  fi
3845
3846  if test x"$scounixcompile" = "xno"; then
3847    AM_CONDITIONAL(UNIX_SCO4_COMPILE, false)
3848  fi
3849
3850  if test x"$openserver5compile" = "xno"; then
3851    AM_CONDITIONAL(UNIX_OPENSERVER5_COMPILE, false)
3852  fi
3853
3854  if test x"$openserver6compile" = "xno"; then
3855    AM_CONDITIONAL(UNIX_OPENSERVER6_COMPILE, false)
3856  fi
3857
3858  if test x"$unixwarecompile" = "xno"; then
3859    AM_CONDITIONAL(UNIX_UNIXWARE_COMPILE, false)
3860  fi
3861
3862  if test x"$hpuxcompile" = "xno"; then
3863    AM_CONDITIONAL(UNIX_HPUX_COMPILE, false)
3864  fi
3865
3866  if test x"$syllablecompile" = "xno"; then
3867    AM_CONDITIONAL(SYLLABLE_COMPILE, false)
3868  fi
3869
3870  if test x"$is_unix_macosx" = "xyes" ; then
3871    AM_CONDITIONAL(UNIX_MACOSX_COMPILE, true)
3872    if test x"$enable_bundle" != "xno" ; then
3873      AM_CONDITIONAL(MAKE_BINDIST, true)
3874    else
3875      AM_CONDITIONAL(MAKE_BINDIST, false)
3876    fi
3877  else
3878    AM_CONDITIONAL(UNIX_MACOSX_COMPILE, false)
3879  fi
3880
3881
3882elif test x"$is_win32" = "xyes"; then
3883  AC_DEFINE(WIN32_COMPILE,,[Are we compiling for win32?])
3884
3885  if test x"$enable_sdlui" = "xyes" -o x"$enable_sdlui2" = "xyes"; then
3886    if test x"$host_cpu" = "xx86_64" -o x"$host_cpu" = "xamd64"; then
3887      SDL_EXTRA_LIBS="$UI_LIBS -lwinmm -lws2_32"
3888    else
3889      SDL_EXTRA_LIBS="$UI_LIBS -lwinmm -lwsock32"
3890    fi
3891  fi
3892
3893  AM_CONDITIONAL(WIN32_COMPILE, true)
3894  AM_CONDITIONAL(UNIX_COMPILE, false)
3895  AM_CONDITIONAL(UNIX_SKYOS_COMPILE, false)
3896  AM_CONDITIONAL(UNIX_QNX4_COMPILE, false)
3897  AM_CONDITIONAL(UNIX_QNX6_COMPILE, false)
3898  AM_CONDITIONAL(UNIX_SOLARIS_COMPILE, false)
3899  AM_CONDITIONAL(UNIX_RHAPSODY_COMPILE, false)
3900  AM_CONDITIONAL(UNIX_OPENSTEP_COMPILE, false)
3901  AM_CONDITIONAL(UNIX_NEXTSTEP_COMPILE, false)
3902  AM_CONDITIONAL(UNIX_SCO4_COMPILE, false)
3903  AM_CONDITIONAL(UNIX_OPENSERVER5_COMPILE, false)
3904  AM_CONDITIONAL(UNIX_OPENSERVER6_COMPILE, false)
3905  AM_CONDITIONAL(UNIX_UNIXWARE_COMPILE, false)
3906  AM_CONDITIONAL(UNIX_HPUX_COMPILE, false)
3907  AM_CONDITIONAL(SYLLABLE_COMPILE, false)
3908  AM_CONDITIONAL(OS2_COMPILE, false)
3909  AM_CONDITIONAL(BEOS_COMPILE, false)
3910  AM_CONDITIONAL(AMIGA_COMPILE, false)
3911  AM_CONDITIONAL(UNIX_MACOSX_COMPILE, false)
3912  AM_CONDITIONAL(SUPPORT_CMDLINE_TOOLS, true)
3913  AM_CONDITIONAL(MAKE_BINDIST, true)
3914elif test x"$is_amiga" = "xyes"; then
3915  AM_CONDITIONAL(UNIX_COMPILE, false)
3916  AM_CONDITIONAL(UNIX_SKYOS_COMPILE, false)
3917  AM_CONDITIONAL(UNIX_QNX4_COMPILE, false)
3918  AM_CONDITIONAL(UNIX_QNX6_COMPILE, false)
3919  AM_CONDITIONAL(UNIX_SOLARIS_COMPILE, false)
3920  AM_CONDITIONAL(UNIX_RHAPSODY_COMPILE, false)
3921  AM_CONDITIONAL(UNIX_OPENSTEP_COMPILE, false)
3922  AM_CONDITIONAL(UNIX_NEXTSTEP_COMPILE, false)
3923  AM_CONDITIONAL(UNIX_SCO4_COMPILE, false)
3924  AM_CONDITIONAL(UNIX_OPENSERVER5_COMPILE, false)
3925  AM_CONDITIONAL(UNIX_OPENSERVER6_COMPILE, false)
3926  AM_CONDITIONAL(UNIX_UNIXWARE_COMPILE, false)
3927  AM_CONDITIONAL(UNIX_HPUX_COMPILE, false)
3928  AM_CONDITIONAL(SYLLABLE_COMPILE, false)
3929  AM_CONDITIONAL(WIN32_COMPILE, false)
3930  AM_CONDITIONAL(OS2_COMPILE, false)
3931  AM_CONDITIONAL(BEOS_COMPILE, false)
3932  AM_CONDITIONAL(AMIGA_COMPILE, true)
3933  AM_CONDITIONAL(UNIX_MACOSX_COMPILE, false)
3934  AM_CONDITIONAL(SUPPORT_CMDLINE_TOOLS, true)
3935  AM_CONDITIONAL(MAKE_BINDIST, true)
3936elif test x"$is_os2" = "xyes"; then
3937  ARCH_INCLUDES="-I\$(top_srcdir)/src/arch/os2"
3938  ARCH_DIR="\$(top_builddir)/src/arch/os2"
3939  ARCH_SRC_DIR="\$(top_srcdir)/src/arch/os2"
3940  ARCH_LIBS="$ARCH_DIR/libarch.a"
3941  AM_CONDITIONAL(UNIX_COMPILE, false)
3942  AM_CONDITIONAL(UNIX_SKYOS_COMPILE, false)
3943  AM_CONDITIONAL(UNIX_QNX4_COMPILE, false)
3944  AM_CONDITIONAL(UNIX_QNX6_COMPILE, false)
3945  AM_CONDITIONAL(UNIX_SOLARIS_COMPILE, false)
3946  AM_CONDITIONAL(UNIX_RHAPSODY_COMPILE, false)
3947  AM_CONDITIONAL(UNIX_OPENSTEP_COMPILE, false)
3948  AM_CONDITIONAL(UNIX_NEXTSTEP_COMPILE, false)
3949  AM_CONDITIONAL(UNIX_SCO4_COMPILE, false)
3950  AM_CONDITIONAL(UNIX_OPENSERVER5_COMPILE, false)
3951  AM_CONDITIONAL(UNIX_OPENSERVER6_COMPILE, false)
3952  AM_CONDITIONAL(UNIX_UNIXWARE_COMPILE, false)
3953  AM_CONDITIONAL(UNIX_HPUX_COMPILE, false)
3954  AM_CONDITIONAL(SYLLABLE_COMPILE, false)
3955  AM_CONDITIONAL(WIN32_COMPILE, false)
3956  AM_CONDITIONAL(OS2_COMPILE, true)
3957  AM_CONDITIONAL(BEOS_COMPILE, false)
3958  AM_CONDITIONAL(AMIGA_COMPILE, false)
3959  AM_CONDITIONAL(UNIX_MACOSX_COMPILE, false)
3960  AM_CONDITIONAL(SUPPORT_CMDLINE_TOOLS, true)
3961  AM_CONDITIONAL(MAKE_BINDIST, true)
3962elif test x"$is_beos" = "xyes"; then
3963  AM_CONDITIONAL(UNIX_COMPILE, false)
3964  AM_CONDITIONAL(UNIX_SKYOS_COMPILE, false)
3965  AM_CONDITIONAL(UNIX_QNX4_COMPILE, false)
3966  AM_CONDITIONAL(UNIX_QNX6_COMPILE, false)
3967  AM_CONDITIONAL(UNIX_SOLARIS_COMPILE, false)
3968  AM_CONDITIONAL(UNIX_RHAPSODY_COMPILE, false)
3969  AM_CONDITIONAL(UNIX_OPENSTEP_COMPILE, false)
3970  AM_CONDITIONAL(UNIX_NEXTSTEP_COMPILE, false)
3971  AM_CONDITIONAL(UNIX_SCO4_COMPILE, false)
3972  AM_CONDITIONAL(UNIX_OPENSERVER5_COMPILE, false)
3973  AM_CONDITIONAL(UNIX_OPENSERVER6_COMPILE, false)
3974  AM_CONDITIONAL(UNIX_UNIXWARE_COMPILE, false)
3975  AM_CONDITIONAL(UNIX_HPUX_COMPILE, false)
3976  AM_CONDITIONAL(SYLLABLE_COMPILE, false)
3977  AM_CONDITIONAL(WIN32_COMPILE, false)
3978  AM_CONDITIONAL(OS2_COMPILE, false)
3979  AM_CONDITIONAL(BEOS_COMPILE, true)
3980  AM_CONDITIONAL(AMIGA_COMPILE, false)
3981  AM_CONDITIONAL(UNIX_MACOSX_COMPILE, false)
3982  AM_CONDITIONAL(SUPPORT_CMDLINE_TOOLS, true)
3983  AM_CONDITIONAL(MAKE_BINDIST, true)
3984else
3985  AC_MSG_WARN([No architecture defined!])
3986fi
3987
3988dnl Check wether we have gcc
3989if test x"$GCC" = "xyes" ; then
3990  AC_DEFINE(USE_GCC,, [Define when using gcc] )
3991fi
3992
3993dnl Check wether we have gcc and solaris /usr/openwin stuff.
3994dnl The headers there give zillions of warnings because of implicit int
3995dnl declarations. gcc's >= 2.6.3 know the `-Wno-implicit-int' option so I
3996dnl don't care about checking it out. MP
3997
3998if test x"$GCC" = "xyes" ; then
3999  case "$host_os" in
4000    solaris2.3*)
4001      LIBS="$LIBS -lthread"
4002      ;;
4003    solaris*)
4004      if echo ${CFLAGS} ${ARCH_INCLUDES} | grep "I/usr/openwin/include" > /dev/null 2>&1 ; then
4005          CFLAGS="${CFLAGS} -Wno-implicit-int"
4006      fi
4007      ;;
4008    *)
4009      ;;
4010  esac
4011fi
4012
4013AC_SUBST(HAVE_READLINE)
4014AC_SUBST(ARCH_INCLUDES)
4015AC_SUBST(ARCH_LIBS)
4016AC_SUBST(ARCH_DIR)
4017AC_SUBST(ARCH_SRC_DIR)
4018AC_SUBST(ARCH_MAKE_BINDIST_DIR)
4019AC_SUBST(ARCH_EXTRA_SUBDIR)
4020AC_SUBST(UI_LIBS)
4021AC_SUBST(SDL_EXTRA_LIBS)
4022AC_SUBST(SOUND_USS_OBJ)
4023AC_SUBST(SOUND_SGI_OBJ)
4024AC_SUBST(SOUND_HPUX_OBJ)
4025AC_SUBST(SOUND_AIX_OBJ)
4026AC_SUBST(SOUND_MIDAS_OBJ)
4027AC_SUBST(SOUND_SDL_OBJ)
4028
4029PLATFORM_DOX_FLAGS=""
4030if test x"$enable_platformdox" = "xyes"; then
4031  if test x"$enable_sdlui" = "xyes" -o x"$enable_sdlui2" = "xyes"; then
4032    PLATFORM_DOX_FLAGS="platformsdl"
4033  fi
4034fi
4035if test x"$PLATFORM_DOX_FLAGS" = "x"; then
4036  PLATFORM_DOX_FLAGS="platformall"
4037fi
4038AC_SUBST(PLATFORM_DOX_FLAGS)
4039
4040if test "$prefix" = NONE && test "$exec_prefix" = NONE; then
4041  PREFIX="$ac_default_prefix"
4042elif test "$prefix" = NONE; then
4043  PREFIX="$exec_prefix"
4044else
4045  PREFIX="$prefix"
4046fi
4047
4048AC_DEFINE_UNQUOTED(PREFIX, "$PREFIX",
4049		   [Where do we want to install the executable?])
4050
4051dnl Path for keymaps, ROMs etc.
4052case "$host_os" in
4053  netbsd*)
4054    VICEDIR="$PREFIX/share/vice"
4055    AM_CONDITIONAL(ALTERNATE_DOCDIR, true)
4056    ;;
4057  freebsd*)
4058    VICEDIR="$PREFIX/lib/vice"
4059    AM_CONDITIONAL(ALTERNATE_DOCDIR, true)
4060    ;;
4061  linux*)
4062    if test x"$host_cpu" = "xx86_64"; then
4063      VICEDIR="$PREFIX/lib64/vice"
4064      AM_CONDITIONAL(ALTERNATE_DOCDIR, false)
4065    else
4066      VICEDIR="$PREFIX/lib/vice"
4067      AM_CONDITIONAL(ALTERNATE_DOCDIR, false)
4068    fi
4069    ;;
4070  *)
4071    VICEDIR="$PREFIX/lib/vice"
4072    AM_CONDITIONAL(ALTERNATE_DOCDIR, false)
4073    ;;
4074esac
4075AC_SUBST(VICEDIR)
4076AC_DEFINE_UNQUOTED(VICEDIR, "$VICEDIR",
4077		   [Where should we lookup for data files?])
4078
4079
4080# Add path with private dynamic ffmpeg libs to the search path
4081rpath_line=`${CONFIG_SHELL-/bin/sh} "$srcdir/config.rpath" "$CC" "$GCC" "$LDFLAGS" "$LD" "$with_gnu_ld" "$host" "$VICEDIR/lib"`
4082LDFLAGS="$LDFLAGS $rpath_line"
4083
4084AC_OUTPUT([Makefile
4085           vice-mint-sdl.spec
4086           build/Makefile
4087           build/android/Makefile
4088           build/beos/Makefile
4089           build/macosx/Makefile
4090           build/nextstep/Makefile
4091           build/openstep/Makefile
4092           build/openwatcom/Makefile
4093           build/qnx4/Makefile
4094           build/rhapsody/Makefile
4095           data/Makefile
4096           data/C128/Makefile
4097           data/C64/Makefile
4098           data/C64DTV/Makefile
4099           data/CBM-II/Makefile
4100           data/DRIVES/Makefile
4101           data/PET/Makefile
4102           data/PLUS4/Makefile
4103           data/SCPU64/Makefile
4104           data/PRINTER/Makefile
4105           data/VIC20/Makefile
4106           data/fonts/Makefile
4107           doc/Makefile
4108           doc/building/Makefile
4109           doc/html/Makefile
4110           doc/readmes/Makefile
4111           man/Makefile
4112           src/Makefile
4113           src/debug.h
4114           src/arch/Makefile
4115           src/arch/android/Makefile
4116           src/arch/android/AnVICE/AndroidManifest.xml
4117           src/arch/android/AnVICE/Makefile
4118           src/arch/android/AnVICE/.settings/Makefile
4119           src/arch/android/AnVICE/assets-proto/Makefile
4120           src/arch/android/AnVICE/jni/Makefile
4121           src/arch/android/AnVICE/jni/locnet/Makefile
4122           src/arch/android/AnVICE/jni/locnet_x64/Makefile
4123           src/arch/android/AnVICE/jni/locnet_x64dtv/Makefile
4124           src/arch/android/AnVICE/jni/locnet_x64sc/Makefile
4125           src/arch/android/AnVICE/jni/locnet_x128/Makefile
4126           src/arch/android/AnVICE/jni/locnet_xcbm2/Makefile
4127           src/arch/android/AnVICE/jni/locnet_xcbm5x0/Makefile
4128           src/arch/android/AnVICE/jni/locnet_xpet/Makefile
4129           src/arch/android/AnVICE/jni/locnet_xplus4/Makefile
4130           src/arch/android/AnVICE/jni/locnet_xscpu64/Makefile
4131           src/arch/android/AnVICE/jni/locnet_xvic/Makefile
4132           src/arch/android/AnVICE/jni/locnet_al/Makefile
4133           src/arch/android/AnVICE/jni/sdl/Makefile
4134           src/arch/android/AnVICE/jni/vice_x64/Makefile
4135           src/arch/android/AnVICE/jni/vice_x64_128_5x0/Makefile
4136           src/arch/android/AnVICE/jni/vice_x64_dtv_128_5x0/Makefile
4137           src/arch/android/AnVICE/jni/vice_x64_sc/Makefile
4138           src/arch/android/AnVICE/jni/vice_x64_sc_128/Makefile
4139           src/arch/android/AnVICE/jni/vice_x64_sc_128_2_5x0_pet_4_20/Makefile
4140           src/arch/android/AnVICE/jni/vice_x64_sc_dtv/Makefile
4141           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_128_2_5x0_pet_4_20/Makefile
4142           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu/Makefile
4143           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu_128/Makefile
4144           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu_128_2_5x0_20/Makefile
4145           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu_128_2_5x0_4_20/Makefile
4146           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu_128_2_5x0_pet_4/Makefile
4147           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu_128_2_5x0_pet_4_20/Makefile
4148           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu_128_2_pet_4_20/Makefile
4149           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu_128_4_20/Makefile
4150           src/arch/android/AnVICE/jni/vice_x64_sc_dtv_scpu_128_20/Makefile
4151           src/arch/android/AnVICE/jni/vice_x64_sc_scpu/Makefile
4152           src/arch/android/AnVICE/jni/vice_x64_sc_scpu_128/Makefile
4153           src/arch/android/AnVICE/jni/vice_x64_sc_scpu_128_2/Makefile
4154           src/arch/android/AnVICE/jni/vice_x64_sc_scpu_128_2_5x0_pet_4_20/Makefile
4155           src/arch/android/AnVICE/jni/vice_x64_sc_scpu_128_2_pet_4_20/Makefile
4156           src/arch/android/AnVICE/jni/vice_x64_sc_scpu_128_2_pet_20/Makefile
4157           src/arch/android/AnVICE/jni/vice_x64_sc_scpu_128_4/Makefile
4158           src/arch/android/AnVICE/jni/vice_x64_sc_scpu_128_20/Makefile
4159           src/arch/android/AnVICE/jni/vice_x64_sc_scpu_128_5x0_4_20/Makefile
4160           src/arch/android/AnVICE/jni/vice_x64dtv/Makefile
4161           src/arch/android/AnVICE/jni/vice_x64sc/Makefile
4162           src/arch/android/AnVICE/jni/vice_x64sc_scpu/Makefile
4163           src/arch/android/AnVICE/jni/vice_x64sc_scpu_128_2_pet_4_20/Makefile
4164           src/arch/android/AnVICE/jni/vice_x128/Makefile
4165           src/arch/android/AnVICE/jni/vice_x128_2_5x0_pet/Makefile
4166           src/arch/android/AnVICE/jni/vice_xcbm2/Makefile
4167           src/arch/android/AnVICE/jni/vice_xcbm2_5x0/Makefile
4168           src/arch/android/AnVICE/jni/vice_xcbm2_pet/Makefile
4169           src/arch/android/AnVICE/jni/vice_xcbm5x0/Makefile
4170           src/arch/android/AnVICE/jni/vice_xpet/Makefile
4171           src/arch/android/AnVICE/jni/vice_xplus4/Makefile
4172           src/arch/android/AnVICE/jni/vice_xscpu64/Makefile
4173           src/arch/android/AnVICE/jni/vice_xvic/Makefile
4174           src/arch/android/AnVICE/res-proto/Makefile
4175           src/arch/android/AnVICE/res-proto/layout/Makefile
4176           src/arch/android/AnVICE/res-proto/values/Makefile
4177           src/arch/android/AnVICE/src-proto/Makefile
4178           src/arch/android/AnVICE/src-proto/com/Makefile
4179           src/arch/android/AnVICE/src-proto/com/locnet/Makefile
4180           src/arch/android/AnVICE/src-proto/com/locnet/vice/Makefile
4181           src/arch/gtk3/Makefile
4182           src/arch/gtk3/data/Makefile
4183           src/arch/gtk3/novte/Makefile
4184           src/arch/gtk3/widgets/Makefile
4185           src/arch/gtk3/widgets/base/Makefile
4186           src/arch/mingw32-pcap/Makefile
4187           src/arch/mingw32-pcap/wpcap/Makefile
4188           src/arch/mingw32-pcap/wpcap/net/Makefile
4189           src/arch/sdl/Makefile
4190           src/arch/sdl/qnx4/Makefile
4191           src/arch/sdl/sortix-files/Makefile
4192           src/arch/sdl/syllable-files/Makefile
4193           src/arch/shared/Makefile
4194           src/buildtools/Makefile
4195           src/c128/Makefile
4196           src/c64/Makefile
4197           src/c64/cart/Makefile
4198           src/c64dtv/Makefile
4199           src/scpu64/Makefile
4200           src/cbm2/Makefile
4201           src/core/Makefile
4202           src/crtc/Makefile
4203           src/diag/Makefile
4204           src/diskimage/Makefile
4205           src/drive/Makefile
4206           src/drive/iec/Makefile
4207           src/drive/iec/c64exp/Makefile
4208           src/drive/iec/plus4exp/Makefile
4209           src/drive/iec128dcr/Makefile
4210           src/drive/iecieee/Makefile
4211           src/drive/ieee/Makefile
4212           src/drive/tcbm/Makefile
4213           src/fileio/Makefile
4214           src/fsdevice/Makefile
4215           src/gfxoutputdrv/Makefile
4216           src/hwsiddrv/Makefile
4217           src/hvsc/Makefile
4218           src/iecbus/Makefile
4219           src/imagecontents/Makefile
4220           src/iodrv/Makefile
4221           src/joyport/Makefile
4222           src/lib/Makefile
4223           src/lib/ffmpeg/Makefile
4224           src/lib/p64/Makefile
4225           src/mididrv/Makefile
4226           src/monitor/Makefile
4227           src/parallel/Makefile
4228           src/pet/Makefile
4229           src/plus4/Makefile
4230           src/printerdrv/Makefile
4231           src/raster/Makefile
4232           src/rs232drv/Makefile
4233           src/rtc/Makefile
4234           src/samplerdrv/Makefile
4235           src/serial/Makefile
4236           src/sid/Makefile
4237           src/socketdrv/Makefile
4238           src/sounddrv/Makefile
4239           src/tape/Makefile
4240           src/tapeport/Makefile
4241           src/userport/Makefile
4242           src/vdc/Makefile
4243           src/vdrive/Makefile
4244           src/vic20/Makefile
4245           src/vic20/cart/Makefile
4246           src/vicii/Makefile
4247           src/viciisc/Makefile
4248           src/viciivsid/Makefile
4249           src/video/Makefile
4250           src/version.h
4251           src/vice-version.sh
4252           ])
4253
4254dnl Local Variables:
4255dnl mode: autoconf
4256dnl compile-command: "autoconf"
4257dnl End:
4258
4259dnl construct show_arch
4260if test x"$is_amiga" != "xyes" -a x"$is_beos" != "xyes" -a x"$is_os2" != "xyes" -a x"$is_unix_macosx" != "xyes" -a x"$is_win32" != "xyes" -a x"$is_win32_gtk3" != "xyes"; then
4261    show_arch="Unix"
4262    real_arch="Unix"
4263else
4264    if test x"$is_amiga" = "xyes"; then
4265        show_arch="Amiga"
4266        real_arch="Amiga"
4267    fi
4268    if test x"$is_beos" = "xyes"; then
4269        show_arch="BeOS"
4270        real_arch="BeOS"
4271    fi
4272    if test x"$is_os2" = "xyes"; then
4273        show_arch="OS/2"
4274        real_arch="OS/2"
4275    fi
4276    if test x"$is_unix_macosx" = "xyes"; then
4277        show_arch="Mac OS X"
4278        real_arch="OSX"
4279    fi
4280    if test x"$is_win32" = "xyes" -o x"$is_win32_gtk3" = "xyes"; then
4281        if test x"$enable_native_gtk3ui" = "xyes"; then
4282            show_arch="Win32-GTK3 (treated as Unix)"
4283            real_arch="Unix"
4284        fi
4285    fi
4286fi
4287
4288dnl construct show_gui
4289show_gui="Unknown"
4290if test x"$enable_sdlui" = "xyes"; then
4291    show_gui="SDL1"
4292fi
4293
4294if test x"$enable_sdlui2" = "xyes"; then
4295    show_gui="SDL2"
4296fi
4297
4298if test x"$enable_native_gtk3ui" = "xyes"; then
4299    show_gui="NATIVE GTK3"
4300fi
4301
4302if test "x$ac_cv_header_sys_audio_h" = xyes; then
4303    HAVE_SYS_AUDIO_H_SUPPORT="yes"
4304fi
4305
4306if test "x$ac_cv_header_sys_audioio_h" = xyes; then
4307    HAVE_SYS_AUDIOIO_H_SUPPORT="yes"
4308fi
4309
4310if test "x$ac_cv_func_SDL_NumJoysticks" = xyes; then
4311    HAVE_SDL_NUMJOYSTICKS_SUPPORT="yes"
4312fi
4313
4314if test "x$ac_cv_header_proto_openpci_h" = xyes; then
4315    HAVE_PROTO_OPENPCI_H_SUPPORT="yes"
4316fi
4317
4318echo "----------------------------------------------------------------------"
4319echo ""
4320echo "configure summary:"
4321echo ""
4322
4323echo "Platform canonical: $ac_cv_host"
4324echo "Architecture      : $show_arch"
4325echo "GUI               : $show_gui"
4326echo ""
4327
4328echo "SCREEN/UI"
4329echo "---------"
4330
4331if test x"$real_arch" != "xWin32" -a x"$real_arch" != "xBeOS"; then
4332    echo "Hardware scaling support       : $HAVE_HWSCALE_SUPPORT"
4333fi
4334
4335if test x"$real_arch" = "xUnix"; then
4336    echo "Cairo rendering support        : $HAVE_CAIRO_SUPPORT"
4337    echo "Pango support                  : $HAVE_PANGO_SUPPORT"
4338fi
4339
4340echo ""
4341echo "SOUND"
4342echo "-----"
4343
4344if test x"$real_arch" != "xAmiga"; then
4345    echo "PortAudio sound input support: $USE_PORTAUDIO_SUPPORT (--enable/disable-portaudio)"
4346fi
4347
4348if test x"$real_arch" = "xUnix"; then
4349    echo "OSS sound support            : $USE_OSS_SUPPORT (--with/without-oss)"
4350    echo "ALSA sound support           : $USE_ALSA_SUPPORT (--with/without-alsa)"
4351    echo "ARTS sound support           : $USE_ARTS_SUPPORT (--with/without-arts)"
4352    echo "Pulseaudio sound support     : $USE_PULSE_SUPPORT (--with/without-pulse)"
4353fi
4354
4355if test x"$real_arch" = "xOSX"; then
4356    echo "CoreAudio sound support      : $USE_COREAUDIO_SUPPORT"
4357    echo "AudioUnit sound support      : $HAVE_AUDIO_UNIT_SUPPORT"
4358fi
4359
4360if test x"$real_arch" = "xAmiga"; then
4361    echo "AHI sound support            : $HAVE_DEVICES_AHI_H_SUPPORT (--enable/disable-ahi)"
4362fi
4363
4364if test x"$real_arch" = "xWin32" -o x"$is_win32_gtk3" = "xyes"; then
4365    echo "DirectX sound support        : $USE_DXSOUND_SUPPORT"
4366fi
4367
4368if test x"$real_arch" != "xDOS"; then
4369    echo "SDL sound support            : $USE_SDL_AUDIO_SUPPORT (--with/without-sdlsound)"
4370fi
4371
4372if test x"$real_arch" = "xUnix"; then
4373    echo "NetBSD/Solaris sound support : $HAVE_SYS_AUDIOIO_H_SUPPORT"
4374    echo "AIX sound support            : $USE_AIX_AUDIO_SUPPORT"
4375    echo "HPUX sound support           : $HAVE_SYS_AUDIO_H_SUPPORT"
4376    echo "SGI sound support            : $USE_DMEDIA_SUPPORT"
4377fi
4378
4379if test x"$real_arch" = "xUnix" -o x"$real_arch" = "xOSX" -o x"$real_arch" = "xWin32"; then
4380    echo "MIDI support                 : $HAVE_MIDI_SUPPORT (--enable/disable-midi)"
4381fi
4382
4383if test x"$real_arch" != "xOSX" -a x"$real_arch" != "xBeOS"; then
4384    echo "Catweasel MK3 support        : $HAVE_CATWEASELMKIII_SUPPORT (--enable/disable-catweasel)"
4385    echo "HardSID support              : $HAVE_HARDSID_SUPPORT (--enable/disable-hardsid)"
4386fi
4387
4388if test x"$real_arch" = "xUnix" -o x"$real_arch" = "xDOS" -o x"$real_arch" = "xWin32"; then
4389    echo "ParSID support               : $HAVE_PARSID_SUPPORT (--enable/disable-parsid)"
4390    echo "SSI2001 support              : $HAVE_SSI2001_SUPPORT (--enable/disable-ssi2001)"
4391    echo "direct I/O access support    : $HAVE_IOSID_SUPPORT"
4392    echo "lpt port access              : $HAVE_PORTSID_SUPPORT"
4393fi
4394
4395echo "PCI utils support            : $HAVE_PCIUTILS_SUPPORT"
4396
4397echo "MP3 encoding support         : $USE_LAMEMP3_SUPPORT (--enable/disable-lame)"
4398echo "MP3 decoding support         : $USE_MPG123_SUPPORT"
4399echo "FLAC en/de-coding support    : $USE_FLAC_SUPPORT"
4400echo "OGG en/de-coding support     : $USE_VORBIS_SUPPORT"
4401
4402echo ""
4403echo "SCREENSHOTS"
4404echo "-----------"
4405
4406echo "GIF encoding support : $HAVE_GIF_SUPPORT (--with/without-gif)"
4407echo "JPEG encoding support: $HAVE_JPEG_SUPPORT (--with/without-jpeg)"
4408echo "PNG encoding support : $HAVE_PNG_SUPPORT (--with/without-png)"
4409
4410echo ""
4411echo "VIDEO RECORDING"
4412echo "---------------"
4413
4414echo "FFMPEG support                : $HAVE_FFMPEG_SUPPORT (--enable-shared-ffmpeg/--enable-static-ffmpeg/--enable-external-ffmpeg)"
4415echo "FFMPEG swscale support        : $HAVE_FFMPEG_SWSCALE_SUPPORT"
4416echo "FFMPEG swresample support     : $HAVE_FFMPEG_SWRESAMPLE_SUPPORT"
4417echo "FFMPEG avresample support     : $HAVE_FFMPEG_AVRESAMPLE_SUPPORT"
4418echo "included shared FFMPEG support: $SHARED_FFMPEG_SUPPORT (--enable-shared-ffmpeg)"
4419echo "included static FFMPEG support: $STATIC_FFMPEG_SUPPORT (--enable-static-ffmpeg)"
4420
4421if test x"$real_arch" = "xOSX" -o x"$real_arch" = "xWin32"; then
4422    echo "QuickTime support             : $HAVE_QUICKTIME_SUPPORT (--enable/disable-quicktime)"
4423fi
4424
4425echo ""
4426echo "INPUT"
4427echo "-----"
4428
4429echo "Joystick support            : $HAS_JOYSTICK_SUPPORT"
4430echo "Mouse support               : $HAVE_MOUSE_SUPPORT"
4431
4432if test x"$real_arch" = "xAmiga" -o x"$real_arch" = "xBeOS"; then
4433    if test x"$show_gui" = "xSDL" -o x"$show_gui" = "xSDL2"; then
4434        echo "Lightpen support            : $HAVE_LIGHTPEN_SUPPORT"
4435    fi
4436else
4437    echo "Lightpen support            : $HAVE_LIGHTPEN_SUPPORT"
4438fi
4439
4440if test x"$real_arch" = "xUnix"; then
4441    if test x"$show_gui" != "xSDL" -a x"$show_gui" != "xSDL2"; then
4442        echo "Linux style joystick support: $LINUX_JOYSTICK_SUPPORT"
4443        echo "BSD style joystick support  : $BSD_JOYSTICK_SUPPORT"
4444        echo "Digital joystick support    : $HAS_DIGITAL_JOYSTICK_SUPPORT"
4445        echo "USB joystick support        : $HAS_USB_JOYSTICK_SUPPORT"
4446    fi
4447fi
4448
4449if test x"$real_arch" = "xOSX"; then
4450    if test x"$show_gui" != "xSDL" -a x"$show_gui" != "xSDL2"; then
4451        echo "Mac joystick support         : $MAC_JOYSTICK_SUPPORT"
4452        echo "IOHIDManager joystick support: $HAS_HIDMGR_SUPPORT (--enable/disable-hidmgr)"
4453    fi
4454fi
4455
4456if test x"$real_arch" = "xWin32" -o x"$is_win32_gtk3" = "xyes"; then
4457    if test x"$show_gui" != "xSDL" -a x"$show_gui" != "xSDL2"; then
4458        echo "DirectInput joystick support: $HAVE_DINPUT_SUPPORT"
4459    fi
4460fi
4461
4462if test x"$show_gui" = "xSDL" -o x"$show_gui" = "xSDL2"; then
4463    echo "SDL joystick support        : $HAVE_SDL_NUMJOYSTICKS_SUPPORT"
4464fi
4465
4466echo ""
4467echo "MODEM/NETWORK"
4468echo "-------------"
4469
4470if test x"$real_arch" = "xUnix" -o x"$real_arch" = "xWin32"; then
4471    echo "RS232 device support             : $HAVE_RS232DEV_SUPPORT (--enable/disable-rs232)"
4472fi
4473
4474echo "Network support                  : $HAVE_NETWORK_SUPPORT"
4475echo "RS232 network support            : $HAVE_RS232NET_SUPPORT"
4476echo "IPv6 network support             : $HAVE_IPV6_SUPPORT (--enable/disable-ipv6)"
4477echo "Network capture/injection support: $HAVE_RAWNET_SUPPORT (--enable/disable-ethernet)"
4478
4479echo ""
4480echo "DRIVE"
4481echo "-----"
4482
4483echo "Raw drive support: $HAVE_RAWDRIVE_SUPPORT"
4484
4485if test x"$real_arch" = "xUnix" -o x"$real_arch" = "xWin32"; then
4486    echo "OpenCBM support  : $HAVE_OPENCBM_SUPPORT (--enable/disable-realdevice)"
4487fi
4488
4489dnl echo ""
4490dnl echo "MONITOR"
4491dnl echo "-------"
4492dnl echo "Native Gtk3 monitor support: $HAVE_GTK3_MONITOR_SUPPORT"
4493
4494echo ""
4495echo "LIBS"
4496echo "----"
4497
4498if test x"$real_arch" = "xUnix" -o x"$real_arch" = "xOSX" -o x"$real_arch" = "xWin32"; then
4499    echo "Dynamic linking support: $HAVE_DYNLIB_SUPPORT_TOO"
4500fi
4501
4502echo "Zlib support           : $HAVE_ZLIB_SUPPORT (--with/without-zlib)"
4503
4504if test x"$real_arch" = "xUnix"; then
4505    echo "Libieee1284 support    : $HAVE_LIBIEEE1284_SUPPORT"
4506fi
4507
4508if test x"$real_arch" = "xAmiga"; then
4509    echo "OpenPCI support        : $HAVE_PROTO_OPENPCI_H_SUPPORT"
4510fi
4511
4512echo ""
4513echo "MISC"
4514echo "----"
4515
4516echo "ReSID support              : $HAVE_RESID_SUPPORT (--with/without-resid)"
4517echo "65xx CPU history support   : $FEATURE_CPUMEMHISTORY_SUPPORT (--enable/disable-cpuhistory)"
4518echo "Debug support              : $DEBUG_SUPPORT (--enable/disable-debug)"
4519echo "Embedded data files support: $USE_EMBEDDED_SUPPORT (--enable/disable-embedded)"
4520
4521echo ""
4522echo "CPPFLAGS: $CPPFLAGS"
4523echo "CFLAGS  : $CFLAGS"
4524echo "CXXFLAGS: $CXXFLAGS"
4525echo "LDFLAGS : $LDFLAGS"
4526echo "----------------------------------------------------------------------"
4527