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