1dnl Process this file with autoconf to produce a configure script.
2dnl Written 1996, 1997, 1998 Bernd Schmidt
3
4dnl If you can use anything from this file, feel free to steal it. I put
5dnl this into the public domain.
6
7dnl There are still many uncaught errors (e.g. --enable-dga on an Amiga)
8dnl I didn't have the nerve to track them all down.
9
10AC_INIT(UAE, 0.8.29, , uae)
11AC_CONFIG_SRCDIR([amiga/source/transdisk.c])
12AC_PREREQ(2.59)
13
14dnl Checks for programs.
15AC_PROG_CC
16
17AC_PROG_CPP
18AC_PROG_INSTALL
19AC_PROG_MAKE_SET
20AC_PATH_PROG(MAKEDEPPRG, makedepend, not-found)
21AC_PATH_PROG(FILEPRG, file, not-found)
22AC_PATH_PROG(WRCPRG, wrc, not-found)
23AC_PATH_PROG(RCLPRG, rcl, not-found)
24AC_PATH_PROG(SDL_CONFIG, sdl-config, not-found)
25
26AC_AIX
27AC_ISC_POSIX
28
29AC_MSG_CHECKING(for Watcom C)
30AC_EGREP_CPP(yes,
31[#ifdef __WATCOMC__
32  yes
33#endif
34], [uae_cv_prog_cc_watcom=yes], [uae_cv_prog_cc_watcom=no])
35AC_MSG_RESULT($uae_cv_prog_cc_watcom)
36
37AC_CANONICAL_HOST()
38AC_DIAGNOSE([obsolete],[AC_CYGWIN is obsolete: use AC_CANONICAL_HOST and $host_os])case $host_os in
39  *cygwin* ) CYGWIN=yes;;
40	 * ) CYGWIN=no;;
41esac
42
43AC_DIAGNOSE([obsolete],[AC_MINGW32 is obsolete: use AC_CANONICAL_HOST and $host_os])case $host_os in
44  *mingw32* ) MINGW32=yes;;
45	  * ) MINGW32=no;;
46esac
47
48AC_EXEEXT()
49
50NR_WARNINGS=0
51NR_ERRORS=0
52
53tmp_save_dir=`pwd`
54cd $srcdir
55abssrcdir=`pwd`
56cd $tmp_save_dir
57
58NEED_THREAD_SUPPORT=no
59
60ADDITIONAL_CFLAGS=
61OPTIMIZE_CFLAGS=
62WARNING_CFLAGS=
63DEBUG_CFLAGS=
64NO_SCHED_CFLAGS=
65NO_REORDER_CFLAGS=
66LDFLAGS="$LDFLAGS -L."
67
68dnl Checks for libraries.
69HAVE_BEOS=no
70dnl Replace `main' with a function in -lMedia_s: (Ian!)
71AC_CHECK_LIB(Media_s, main, HAVE_MEDIA_LIB=yes, HAVE_MEDIA_LIB=no)
72dnl Replace `main' with a function in -lNeXT_s:
73AC_CHECK_LIB(NeXT_s, main, HAVE_NEXT_LIB=yes, HAVE_NEXT_LIB=no)
74AC_CHECK_LIB(moto, cos, HAVE_MOTO_LIB=yes, HAVE_MOTO_LIB=no)
75AC_CHECK_LIB(amiga, OpenLibrary, HAVE_AMIGA_LIB=yes, HAVE_AMIGA_LIB=n)
76AC_CHECK_LIB(vga, vga_setmode, HAVE_SVGA_LIB=yes, HAVE_SVGA_LIB=no)
77AC_CHECK_LIB(mme, waveOutGetNumDevs, HAVE_MME_LIB=yes, HAVE_MME_LIB=no)
78AC_CHECK_LIB(ncurses, waddch, HAVE_NCURSES_LIB=yes, HAVE_NCURSES_LIB=no)
79AC_CHECK_LIB(posix4, sem_init, HAVE_POSIX4_LIB=yes, HAVE_POSIX4_LIB=no)
80AC_CHECK_LIB(rt, sem_init, HAVE_RT_LIB=yes, HAVE_RT_LIB=no)
81AC_CHECK_LIB(audio, alOpenPort, HAVE_SGIAUDIO_LIB=yes, HAVE_SGIAUDIO_LIB=no)
82AC_CHECK_LIB(asound, snd_pcm_open, HAVE_ALSA=yes, HAVE_ALSA=no)
83
84AC_PATH_XTRA
85AC_CONFIG_HEADER(src/sysconfig.h)
86
87AC_HEADER_DIRENT
88AC_HEADER_STDC
89
90dnl @@@ Is <sys/termios.h> the right way or is it <termios.h>?
91AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/types.h utime.h string.h strings.h values.h ncurses.h curses.h)
92AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h sun/audioio.h sys/audioio.h getopt.h features.h sys/termios.h)
93AC_CHECK_HEADERS(posix_opt.h sys/ioctl.h sys/ipc.h sys/shm.h sys/stat.h sys/utime.h)
94AC_CHECK_HEADERS(windows.h ddraw.h)
95AC_CHECK_HEADER(be_math.h, HAVE_BEOS=yes, HAVE_BEOS=no)
96AC_CHECK_HEADERS(machine/joystick.h)
97AC_CHECK_HEADERS(devices/ahi.h)
98AC_CHECK_HEADERS(libraries/cybergraphics.h cybergraphx/cybergraphics.h)
99
100AC_CHECK_SIZEOF(char, 1)
101AC_CHECK_SIZEOF(short, 2)
102AC_CHECK_SIZEOF(int, 4)
103AC_CHECK_SIZEOF(long, 4)
104AC_CHECK_SIZEOF(void *, 4)
105AC_CHECK_SIZEOF(long long, 8)
106AC_CHECK_SIZEOF(__int64, 8)
107
108dnl Checks for typedefs, structures, and compiler characteristics.
109AC_C_CONST
110AC_C_INLINE
111if [[ "x$ac_cv_c_inline" = "xno" ]]; then
112  ac_cv_c_inline=
113fi
114AC_TYPE_MODE_T
115AC_TYPE_OFF_T
116AC_TYPE_PID_T
117AC_STRUCT_ST_BLOCKS
118AC_HEADER_TIME
119AC_STRUCT_TM
120
121dnl Checks for library functions.
122AC_PROG_GCC_TRADITIONAL
123AC_FUNC_MEMCMP
124AC_TYPE_SIGNAL
125AC_FUNC_UTIME_NULL
126AC_CHECK_FUNCS(getcwd getopt strdup gettimeofday sigaction mkdir rmdir)
127AC_CHECK_FUNCS(select strerror strstr isnan isinf setitimer)
128AC_CHECK_FUNCS(tcgetattr cfmakeraw readdir_r vprintf vsprintf vfprintf)
129
130dnl GNOME_FILEUTILS_CHECKS will fail for native Win32 compilers like Watcom C
131dnl So don't use that macro if we know it will fail
132DO_FILEUTILS_CHECK=yes
133if test $uae_cv_prog_cc_watcom = yes -o $MINGW32 = yes; then
134  DO_FILEUTILS_CHECK=no
135fi
136if test $DO_FILEUTILS_CHECK = yes; then
137  GNOME_FILEUTILS_CHECKS
138fi
139
140if test "$SDL_CONFIG" = "not-found" ; then
141  HAVE_SDL_LIB=no
142else
143  HAVE_SDL_LIB=yes
144  SDL_CFLAGS=`$SDL_CONFIG --cflags`
145  SDL_LIBS=`$SDL_CONFIG --libs`
146fi
147
148
149dnl Verify that the ncurses installation makes some sense.
150
151if [[ "x$HAVE_NCURSES_LIB" = "xyes" ]]; then
152  if [[ "x$ac_cv_header_ncurses_h" = "xno" -a "x$ac_cv_header_curses_h" = "xno" ]]; then
153    echo "Installation problem, found libncurses but neither curses.h nor ncurses.h!"
154    HAVE_NCURSES_LIB=no
155    NR_ERRORS=`expr $NR_ERRORS + 1`
156  else
157    if [[ "x$ac_cv_header_ncurses_h" = "xno" ]]; then
158      AC_MSG_CHECKING(for attr_t in curses.h)
159      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[{ attr_t a; a = A_NORMAL; }]])],[AC_MSG_RESULT(yes)],[
160        ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DDONT_HAVE_ATTR_T"
161        AC_MSG_RESULT(no)
162	NR_WARNINGS=`expr $NR_WARNINGS + 1`
163	echo "Please install a newer version of libncurses if you can."
164      ])
165    else
166      AC_MSG_CHECKING(for attr_t in ncurses.h)
167      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ncurses.h>]], [[{ attr_t a; a = A_NORMAL; }]])],[AC_MSG_RESULT(yes)],[
168        ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DDONT_HAVE_ATTR_T"
169        AC_MSG_RESULT(no)
170	NR_WARNINGS=`expr $NR_WARNINGS + 1`
171	echo "Please install a newer version of libncurses if you can."
172      ])
173    fi
174  fi
175fi
176
177AC_MSG_CHECKING(for pthread library)
178TMP_SAVE_CFLAGS=$CFLAGS
179TMP_SAVE_LIBS=$LIBS
180LIBS="$LIBS -lpthread"
181AC_LINK_IFELSE([AC_LANG_PROGRAM([[
182#include "confdefs.h"
183#ifdef HAVE_SYS_TYPES_H
184#include <sys/types.h>
185#endif
186#include <pthread.h>]], [[
187pthread_exit (0);
188]])],[HAVE_PTHREAD_LIB=yes
189AC_MSG_RESULT(yes)],[HAVE_PTHREAD_LIB=no
190AC_MSG_RESULT(no)])
191CFLAGS=$TMP_SAVE_CFLAGS
192LIBS=$TMP_SAVE_LIBS
193
194AC_MSG_CHECKING(for DirectX)
195TMP_SAVE_CFLAGS=$CFLAGS
196TMP_SAVE_LIBS=$LIBS
197CFLAGS="$CFLAGS $X_CFLAGS"
198LIBS="$LIBS -lddraw"
199AC_LINK_IFELSE([AC_LANG_PROGRAM([[
200#include "confdefs.h"
201#ifdef HAVE_SYS_TYPES_H
202#include <sys/types.h>
203#endif
204#include <windows.h>
205#include <ddraw.h>]], [[
206LPDIRECTDRAW lpDD;
207IDirectDraw_CreateSurface(lpDD, 0, 0, 0);
208]])],[HAVE_DIRECTX=yes
209AC_MSG_RESULT(yes)],[HAVE_DIRECTX=no
210AC_MSG_RESULT(no)])
211CFLAGS=$TMP_SAVE_CFLAGS
212LIBS=$TMP_SAVE_LIBS
213
214HAVE_OSS_SOUND=no
215if [[ "x$ac_cv_header_sys_soundcard_h" = "xyes" -o "x$ac_cv_header_machine_soundcard_h" = "xyes" ]]; then
216  dnl Avoid surprises
217  AC_MSG_CHECKING(whether sys/soundcard.h or machine/soundcard.h works)
218  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
219#include "confdefs.h"
220#ifdef HAVE_SYS_SOUNDCARD_H
221#include <sys/soundcard.h>
222#else
223#include <machine/soundcard.h>
224#endif
225#include <sys/ioctl.h>
226]], [[int soundfd; ioctl (soundfd, SNDCTL_DSP_GETFMTS, 0);]])],[AC_MSG_RESULT(yes)
227HAVE_OSS_SOUND=yes],[AC_MSG_RESULT(no)])
228fi
229
230DO_PROFILING=no
231WANT_SVGALIB=dunno
232WANT_ASCIIART=dunno
233WANT_UI=dunno
234WANT_NCURSES_UI=no
235WANT_DGA=no
236WANT_VIDMODE=no
237
238AC_ARG_ENABLE(profiling,[  --enable-profiling      Build a profiling (SLOW!) version],[DO_PROFILING=$enableval],[])
239AC_ARG_WITH(svgalib,[  --with-svgalib          Use SVGAlib for graphics output],[WANT_SVGALIB=$withval],[])
240AC_ARG_WITH(sdl,[  --with-sdl              Use SDL library for low-level functions],[WANT_SDL=$withval],[])
241AC_ARG_WITH(sdl-sound,[  --with-sdl-sound        Use SDL library for sound],[WANT_SDLSND=$withval],[])
242AC_ARG_WITH(sdl-gfx,[  --with-sdl-gfx          Use SDL library for graphics],[WANT_SDLGFX=$withval],[])
243AC_ARG_WITH(oss-sound,[  --with-oss-sound        Use OSS interface sound (default)],[WANT_OSS=$withval],[])
244AC_ARG_WITH(alsa,[  --with-alsa             Use ALSA library for sound],[WANT_ALSA=$withval],[])
245AC_ARG_WITH(asciiart,[  --with-asciiart         Use ncurses ascii art for graphics output],[WANT_ASCIIART=$withval],[])
246AC_ARG_ENABLE(dga,[  --enable-dga            X11 version: Use the DGA extension],[WANT_DGA=$enableval],[])
247AC_ARG_ENABLE(vidmode,[  --enable-vidmode        X11 version: Use the XF86VidMode extension],[WANT_VIDMODE=$enableval],[])
248AC_ARG_ENABLE(ui,[  --enable-ui             Use a user interface if possible (default on)],[WANT_UI=$enableval],[])
249AC_ARG_WITH(hostcc,[  --with-hostcc=x         Use a x as compiler for the host system],[HOSTCC=$withval],[HOSTCC=$CC])
250
251dnl Configure tools directory first, so that warning messages appear near the
252dnl end of the output.
253
254mkdir -p src/tools
255progname=$0
256changequote(,)dnl
257srcd=`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
258changequote([,])dnl
259topsrcdir=`cd $srcd; pwd`
260tcc=$CC
261CC=$HOSTCC
262(cd src/tools && $topsrcdir/src/tools/configure)
263CC=$tcc
264
265dnl Some simple plausibility tests...
266
267if [[ "x$WANT_ALSA" = "xyes" ]]; then
268  if [[ "x$HAVE_ALSA" = "xno" ]]; then
269    echo "Could not find libasound, disabling ALSA support."
270    NR_ERRORS=`expr $NR_ERRORS + 1`
271    WANT_ALSA=no
272  else
273    LIBS="$LIBS -lasound"
274  fi
275fi
276
277if [[ "x$WANT_OSS" = "xyes" ]]; then
278  if [[ "x$HAVE_OSS_SOUND" = "xno" ]]; then
279    echo "Could not find OSS interface, disabling OSS support."
280    NR_ERRORS=`expr $NR_ERRORS + 1`
281    WANT_ALSA=no
282  else
283    LIBS="$LIBS -lasound"
284  fi
285fi
286
287if [[ "x$WANT_SDLSND" = "xyes" ]]; then
288  if [[ "x$WANT_ALSA" = "xyes" -o "x$WANT_OSS" = "xyes" ]]; then
289    echo "Multiple sound backends selected; disabling SDL sound."
290    WANT_SDLSND=no
291  fi
292fi
293
294if [[ "x$WANT_ALSA" = "xyes" ]]; then
295  if [[ "x$WANT_OSS" = "xyes" ]]; then
296    echo "Multiple sound backends selected; disabling ALSA."
297    WANT_ALSA=no
298  fi
299fi
300
301if [[ "x$WANT_SDLSND" = "xyes" -o "x$WANT_SDLGFX" = "xyes" ]]; then
302  WANT_SDL=yes
303fi
304
305if [[ "x$WANT_SDL" = "xyes" ]]; then
306  if [[ "x$HAVE_SDL_LIB" = "xno" ]]; then
307    echo "Could not find libSDL, disabling SDL support."
308    NR_ERRORS=`expr $NR_ERRORS + 1`
309    WANT_SDL=no
310    WANT_SDLSND=no
311    WANT_SDLGFX=no
312  else
313    LIBS="$LIBS $SDL_LIBS"
314    ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS $SDL_CFLAGS -DUSE_SDL"
315  fi
316fi
317
318if [[ "x$WANT_DGA" = "xyes" ]]; then
319  if [[ "x$WANT_SVGALIB" = "xyes" -o "x$WANT_ASCIIART" = "xyes" -o "x$WANT_SDLGFX" = "xyes" ]]; then
320    echo "You can't enable DGA for SVGAlib, SDL and ncurses targets!"
321    NR_ERRORS=`expr $NR_ERRORS + 1`
322    WANT_DGA=no
323  fi
324fi
325
326if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
327  if [[ "x$WANT_ASCIIART" = "xyes" -o "x$WANT_SDLGFX" = "xyes" ]]; then
328    echo "You can't enable both SVGAlib and other targets!"
329    NR_ERRORS=`expr $NR_ERRORS + 1`
330    WANT_DGA=no
331  fi
332fi
333
334if [[ "x$WANT_DGA" = "xyes" -a "x$no_x" = "xyes" ]]; then
335  echo "Ignoring --enable-dga, since X was disabled or not found."
336  NR_ERRORS=`expr $NR_ERRORS + 1`
337  WANT_DGA=no
338fi
339
340if [[ "x$WANT_DGA" = "xno" -a "x$WANT_VIDMODE" = "xyes" ]]; then
341  echo "The XF86VidMode extension can only be used in DGA mode. Disabling it."
342  NR_ERRORS=`expr $NR_ERRORS + 1`
343  WANT_VIDMODE=no
344fi
345
346dnl Check if we have the libraries needed for the user's selection.
347
348if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
349  if [[ "x$HAVE_SVGA_LIB" = "xno" ]]; then
350    echo "Could not find libsvga, disabling svgalib support."
351    NR_ERRORS=`expr $NR_ERRORS + 1`
352    WANT_SVGALIB=no
353  else
354    no_x=yes
355  fi
356fi
357
358if [[ "x$WANT_ASCIIART" = "xyes" ]]; then
359  if [[ "x$HAVE_NCURSES_LIB" = "xno" ]]; then
360    echo "Could not find libncurses, disabling ascii art support."
361    NR_ERRORS=`expr $NR_ERRORS + 1`
362    WANT_ASCIIART=no
363  else if [[ "x$WANT_SVGALIB" = "xyes" -o "x$WANT_SDLGFX" = "xyes" ]]; then
364    echo "You can't configure for both ncurses and another target. Disabling ncurses."
365    NR_ERRORS=`expr $NR_ERRORS + 1`
366    WANT_ASCIIART=no
367  else
368    no_x=yes
369  fi
370  fi
371fi
372
373dnl If the user wants DGA, see if we have it.
374dnl This must come after we checked for X11.
375
376if [[ "x$WANT_DGA" = "xyes" ]]; then
377  TMP_SAVE_LIBS=$LIBS
378  LIBS="$X_LIBS $LIBS"
379  AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no, [ $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS ])
380  LIBS=$TMP_SAVE_LIBS
381  if [[ "x$HAVE_DGA" = "xno" ]]; then
382    echo "Could not find DGA extension, ignoring --enable-dga."
383    NR_ERRORS=`expr $NR_ERRORS + 1`
384    WANT_DGA=no
385  fi
386fi
387
388if [[ "x$WANT_VIDMODE" = "xyes" ]]; then
389  TMP_SAVE_LIBS=$LIBS
390  LIBS="$X_LIBS $LIBS"
391  AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, HAVE_VIDMODE=yes, HAVE_VIDMODE=no, [ $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS ])
392  LIBS=$TMP_SAVE_LIBS
393  if [[ "x$HAVE_VIDMODE" = "xno" ]]; then
394    echo "Could not find VidMode extension, ignoring --enable-vidmode."
395    NR_ERRORS=`expr $NR_ERRORS + 1`
396    WANT_VIDMODE=no
397  fi
398fi
399
400#GTK_PACKAGES="gtk+-2.0"
401#GTK_REQUIRED_VERSION=2.4.0
402#PKG_CHECK_MODULES(DEPS, $GTK_PACKAGES >= $GTK_REQUIRED_VERSION)
403#GTK_CFLAGS=`$PKG_CONFIG --cflags $ATK_PACKAGES $GTK_PACKAGES $LIBGNOMECANVAS_PACKAGES`
404#GTK_LIBS=`$PKG_CONFIG --libs $ATK_PACKAGES $GTK_PACKAGES $LIBGNOMECANVAS_PACKAGES`
405
406AM_PATH_GTK_2_0(2.4.0)
407
408dnl See if we can at least compile SHM support
409
410SHM_SUPPORT_LINKS=0
411if [[ "x$no_x" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
412  AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
413  TMP_SAVE_CFLAGS=$CFLAGS
414  TMP_SAVE_LIBS=$LIBS
415  CFLAGS="$CFLAGS $X_CFLAGS"
416  LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS"
417  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
418#include "confdefs.h"
419#ifdef HAVE_SYS_TYPES_H
420#include <sys/types.h>
421#endif
422#include <X11/Xlib.h>
423#include <X11/Xutil.h>
424#include <X11/keysym.h>
425#include <X11/cursorfont.h>
426#include <sys/ipc.h>
427#include <sys/shm.h>
428#include <X11/extensions/XShm.h>]], [[
429static XShmSegmentInfo shminfo;
430static Display *display;
431XShmAttach(display, &shminfo);
432XSync(display,0);
433shmctl(shminfo.shmid, IPC_RMID, 0);
434]])],[SHM_SUPPORT_LINKS=1
435AC_MSG_RESULT(yes)],[SHM_SUPPORT_LINKS=0
436AC_MSG_RESULT(no)])
437  CFLAGS=$TMP_SAVE_CFLAGS
438  LIBS=$TMP_SAVE_LIBS
439fi
440
441MATHLIB=-lm
442DEBUGOBJS="debug.o"
443
444GUIDEP=gui-none
445GUIOBJS_IN=nogui.o
446
447AC_MSG_CHECKING(which target to use)
448
449if [[ "x$WANT_SDLGFX" = "xyes" ]]; then
450  AC_MSG_RESULT(SDL)
451  MATHLIB=
452  TARGET=x11
453  GFXOBJS="sdlgfx.o sdlkeys.o rawkeys.o"
454  # @@@ Kludge.  This may get changed later.
455  TARGETDEP=t-x11.h
456else if [[ "x$HAVE_DIRECTX" = "xyes" ]]; then
457  AC_MSG_RESULT(Win32/DirectX)
458  MATHLIB=
459  TARGET=win32
460  TARGETDEP=t-win32.h
461  GFXOBJS="osdep/win32.o osdep/parser.o osdep/keyboard.o osdep/posixemu.o"
462  RESOBJS="osdep/winuae.res"
463else if [[ "x$HAVE_BEOS" = "xyes" ]]; then
464  AC_MSG_RESULT(BeOS)
465  MATHLIB=
466  TARGET=beos
467  TARGETDEP=t-beos.h
468  GFXOBJS=osdep/beos.o
469  OPTIMIZE_CFLAGS=-O7
470else if [[ "x$HAVE_AMIGA_LIB" = "xyes" ]]; then
471  AC_MSG_RESULT(AmigaOS)
472  TARGET=amigaos
473  TARGETDEP=t-amiga.h
474  GFXOBJS="osdep/ami-win.o osdep/ami-disk.o osdep/ami-rexx.o osdep/ami-appw.o"
475else if [[ "x$HAVE_NEXT_LIB" = "xyes" ]]; then
476  AC_MSG_RESULT(NeXTStep)
477  MATHLIB=
478  TARGET=next
479  GFXOBJS="NeXTwin.o"
480  TARGETDEP=t-next.h
481  LIBRARIES="-sectcreate __ICON __header ../Uae.app/Uae.iconheader -segprot __ICON r r -sectcreate __ICON app ../Uae.app/Uae.tiff -lMedia_s -lNeXT_s"
482else
483  dnl Unix system
484  dnl If we don't have X, see what else we have and/or want.
485
486  if [[ "x$no_x" = "xyes" ]]; then
487    if [[ "x$WANT_SVGALIB" != "xyes" -a "x$WANT_ASCIIART" != "xyes" ]]; then
488      if [[ "x$WANT_SVGALIB" != "xno" -a "x$HAVE_SVGA_LIB" = "xyes" ]]; then
489        WANT_SVGALIB=yes
490      else if [[ "x$WANT_ASCIIART" != "xno" -a "x$HAVE_NCURSES_LIB" = "xyes" ]]; then
491        WANT_ASCIIART=yes
492      fi
493      fi
494    fi
495  fi
496
497  if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
498    AC_MSG_RESULT(SVGAlib)
499    TARGET=svgalib
500    TARGETDEP=t-svgalib.h
501    GFXOBJS=svga.o
502    LIBRARIES="-lvga"
503    WANT_NCURSES_UI=yes
504  else if [[ "x$WANT_ASCIIART" = "xyes" ]]; then
505    AC_MSG_RESULT(ncurses ASCII art)
506    TARGET=asciiart
507    TARGETDEP=t-ascii.h
508    GFXOBJS="ncurses.o"
509    WANT_NCURSES_UI=yes
510    LIBRARIES="-lncurses"
511  else if [[ "x$no_x" = "xyes" ]]; then
512    AC_MSG_RESULT(Ummm....)
513    echo "Fatal error: No graphics system found, don't know what target to use."
514    exit 1
515  else
516    AC_MSG_RESULT(X11)
517    TARGET=x11
518    TARGETDEP=t-x11.h
519    GFXOBJS="xwin.o x11keys.o"
520
521    LIBRARIES="$X_LIBS $X_PRE_LIBS"
522    dnl If we still think we want DGA, set it up.
523    if [[ "x$WANT_DGA" = "xyes" ]]; then
524      LIBRARIES="$LIBRARIES -lXxf86dga"
525      X_CFLAGS="$X_CFLAGS -DUSE_DGA_EXTENSION"
526      if [[ "x$WANT_VIDMODE" = "xyes" ]]; then
527        LIBRARIES="$LIBRARIES -lXxf86vm"
528	X_CFLAGS="$X_CFLAGS -DUSE_VIDMODE_EXTENSION"
529      fi
530    fi
531    LIBRARIES="$LIBRARIES -lXext -lX11 $X_EXTRA_LIBS"
532  fi
533  fi
534  fi
535fi
536fi
537fi
538fi
539fi
540
541if [[ "x$HAVE_DIRECTX" = "xyes" ]]; then
542  TARGETDEP=t-win32.h
543  TARGET=win32
544fi
545
546if [[ "x$WANT_UI" != "xno" ]]; then
547  if [[ "x$HAVE_DIRECTX" = "xyes" ]]; then
548    GUIOBJS=osdep/win32gui.o
549  else if [[ "x$HAVE_AMIGA_LIB" = "xyes" ]]; then
550    GUIOBJS="osdep/ami-gui.o"
551  else if [[ "x$WANT_NCURSES_UI" = "xyes" ]]; then
552    if [[ "x$HAVE_NCURSES_LIB" = "xno" ]]; then
553      echo "ncurses is unavailable, can't provide a user interface"
554      if [[ "x$WANT_UI" = "xyes" ]]; then
555        NR_ERRORS=`expr $NR_ERRORS + 1`
556      fi
557      WANT_UI=no
558    else
559      GUIOBJS="tui.o svgancui.o"
560      LIBRARIES="$LIBRARIES -lncurses"
561      ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DUSING_CURSES_UI"
562      if [[ "x$ac_cv_header_ncurses_h" = "xno" ]]; then
563        echo "Found libncurses, but no ncurses.h. This is normal with recent versions"
564        echo "of ncurses, but it might indicate a problem with older versions."
565        NR_WARNINGS=`expr $NR_WARNINGS + 1`
566      fi
567    fi
568  else if [[ "x$no_x" != "xno" ]]; then
569    if [[ "x$no_gtk" = "xyes" ]]; then
570      echo "Did not find gtk+, disabling user interface"
571      GTK_CFLAGS=
572      if [[ "x$WANT_UI" = "xyes" ]]; then
573        NR_ERRORS=`expr $NR_ERRORS + 1`
574      fi
575    else
576      echo "Using gtk+ GUI."
577      NEED_THREAD_SUPPORT=yes
578      ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DUSING_GTK_GUI -I$abssrcdir/src/gui-gtk"
579dnl      GUIOBJS="gtkui.o chipsetspeedpanel.o chipsettypepanel.o chooserwidget.o"
580dnl      GUIOBJS="$GUIOBJS cpuspeedpanel.o cputypepanel.o floppyfileentry.o led.o util.o"
581      GUIDEP=gui-gtk
582      GUIOBJS_IN="gtkui.o util.o"
583    fi
584  else
585    if [[ "x$WANT_UI" = "xyes" ]]; then
586      echo "GUI requested, but no suitable libraries found."
587      NR_ERRORS=`expr $NR_ERRORS + 1`
588    fi
589  fi
590  fi
591  fi
592  fi
593fi
594
595dnl
596dnl  MULTIPLICATION_PROFITABLE?
597dnl
598dnl  We always set this for now. It's only used in the audio emulation,
599dnl  where the option is to do multiplication or table look-up. On just
600dnl  about any CPU it's worthwhile running E-UAE on, multiplication will be
601dnl  better.
602
603AC_DEFINE(MULTIPLICATION_PROFITABLE, 1, [Define to 1 if your CPU has a fast multiply instruction.])
604
605dnl Find out some things about the system
606dnl  - whether we have GCC 2.7 or better.
607dnl  - what CPU we have (to use some assembly hacks on the x86)
608dnl  - whether we are on a Linux system
609
610MACHDEP=md-generic
611OSDEP=od-generic
612THREADDEP=td-none
613SOUNDDEP=od-generic
614
615FPP_H=fpp-unknown.h
616USE_THREADS=no
617USE_FILE_SOUND=no
618USE_SCSI_DEVICE=no
619
620USE_UNDERSCORE=dunno
621
622HAVELINUX=no
623HAVEBSD=no
624HAVEGCC27=no
625HAVEI386=no
626HAVE68K=no
627HAVEPPC=no
628
629ASMOBJS=
630CPUOBJS=cpuemu.o
631
632dnl
633dnl  Find out what CPU arch to build for
634dnl
635AC_MSG_CHECKING([host cpu support])
636
637dnl default is to use no CPU-specific features
638HOST_CPU=generic
639MDFPP_H=fpp-unknown.h
640
641case $host_cpu in
642     i[[3-6]]86)
643       HOST_CPU=i386
644       MDFPP_H=fpp-ieee.h
645       ;;
646     amd64 | x86_64)
647       HOST_CPU=amd64
648       MDFPP_H=fpp-ieee.h
649       ;;
650     powerpc)
651       HOST_CPU=ppc
652       MDFPP_H=fpp-ieee.h
653       ;;
654     m68k)
655       HOST_CPU=68k
656       MDFPP_H=fpp-ieee.h
657       ;;
658esac
659
660AC_MSG_RESULT([$HOST_CPU])
661MACHDEP="md-$HOST_CPU"
662
663AC_MSG_CHECKING(for GCC 2.7 or higher)
664AC_EGREP_CPP(yes,
665[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
666  yes
667#endif
668], [AC_MSG_RESULT(yes); HAVEGCC27=yes], AC_MSG_RESULT(no))
669
670if test $ac_cv_c_compiler_gnu = yes; then
671  WARNING_CFLAGS="-Wall -Wno-unused -Wno-format -W -Wmissing-prototypes -Wstrict-prototypes"
672  OPTIMIZE_CFLAGS="-O2 -fomit-frame-pointer"
673  dnl Not nice, but needed to turn off -g
674  CFLAGS=
675fi
676
677if [[ "x$DO_PROFILING" = "xyes" ]]; then
678  if test $ac_cv_prog_gcc = yes; then
679    OPTIMIZE_CFLAGS="-O"
680    DEBUG_CFLAGS="-g -fno-inline -fno-omit-frame-pointer -pg -DUSE_PROFILING"
681    LDFLAGS="-pg"
682  else
683    DO_PROFILING=no
684    echo "Don't know how to set up profiling for your compiler."
685    NR_ERRORS=`expr $NR_ERRORS + 1`
686  fi
687fi
688
689CFLAGS="$OPTIMIZE_CFLAGS $DEBUG_CFLAGS $WARNING_CFLAGS $CFLAGS $ADDITIONAL_CFLAGS"
690
691if test $ac_cv_prog_gcc = yes; then
692  if test $HAVEGCC27 != yes; then
693    AC_MSG_WARN([Version 2.7 or better of GCC is recommended])
694    NR_WARNINGS=`expr $NR_WARNINGS + 1`
695  fi
696else
697  if test $uae_cv_prog_cc_watcom != yes; then
698    AC_MSG_WARN([UAE may not compile and run correctly with your compiler])
699    NR_WARNINGS=`expr $NR_WARNINGS + 1`
700  fi
701fi
702
703if test $ac_cv_prog_gcc = yes; then
704  if [[ "$HOST_CPU" = i386 -o "$HOST_CPU" = ppc -o "$HOST_CPU" = amd64 ]]; then
705    MACHDEP="$MACHDEP-gcc"
706  fi
707fi
708
709dnl X86.S needs to know whether it needs to add underscores to symbols.
710dnl This might break some obscure systems which don't have ELF but don't
711dnl add underscores either.
712
713AC_MSG_CHECKING(whether assembler symbols need an underscore)
714cat >conftest1.S << EOF
715	.text
716	.globl _symbol
717_symbol:
718EOF
719cat >conftest2.c << EOF
720extern void symbol ();
721int main ()
722{
723symbol ();
724}
725EOF
726$CC conftest1.S -c -o conftest1.o >/dev/null 2>&1
727$CC conftest2.c -c -o conftest2.o >/dev/null 2>&1
728if $CC conftest1.o conftest2.o -o conftest >/dev/null 2>&1; then
729  USE_UNDERSCORE=yes
730  CFLAGS="$CFLAGS -DUSE_UNDERSCORE"
731else
732  USE_UNDERSCORE=no
733fi
734AC_MSG_RESULT($USE_UNDERSCORE)
735
736rm -f conftest*
737
738AC_ARG_ENABLE(threads,[  --enable-threads        Enable some generally useful thread support],[USE_THREADS=$enableval],[])
739
740dnl See if we have something better than GCC 2.7.
741
742if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
743  SAVECFLAGS=$CFLAGS
744  CFLAGS="$CFLAGS -mno-schedule-prologue"
745  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int main(){return 0;}]])],[NO_SCHED_CFLAGS="-mno-schedule-prologue"],[])
746  CFLAGS=$SAVECFLAGS
747fi
748
749if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
750  SAVECFLAGS=$CFLAGS
751  CFLAGS="$CFLAGS -mpreferred-stack-boundary=2"
752  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int main(){return 0;}]])],[SAVECFLAGS=$CFLAGS],[])
753  CFLAGS=$SAVECFLAGS
754fi
755
756if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
757  SAVECFLAGS=$CFLAGS
758  CFLAGS="$CFLAGS -fno-reorder-blocks"
759  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int main(){return 0;}]])],[NO_REORDER_CFLAGS="-fno-reorder-blocks"],[])
760  CFLAGS=$SAVECFLAGS
761fi
762
763dnl If GCC supports exceptions, we don't want them.
764
765if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
766  SAVECFLAGS=$CFLAGS
767  CFLAGS="$CFLAGS -fno-exceptions"
768  NOEXCEPTIONS=no
769  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int main(){return 0;}]])],[NOEXCEPTIONS=yes],[])
770  if [[ "x$NOEXCEPTIONS" = "xno" ]]; then
771    CFLAGS=$SAVECFLAGS
772  fi
773fi
774
775
776dnl Set up the link to the appropriate machdep directory and select something
777dnl for the REGPARAM define.
778
779if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" -a "x$DO_PROFILING" = "xno" ]]; then
780  MACHDEP=md-i386-gcc
781  dnl strength-reduce is turned off not because of paranoia, but because it
782  dnl actually makes the code worse in some cases on the i386 (generates too
783  dnl many registers, which all end up on the stack).
784  CFLAGS="$CFLAGS -DUNALIGNED_PROFITABLE -fno-strength-reduce -DREGPARAM=\"__attribute__((regparm(3)))\""
785
786  CFLAGS="$CFLAGS -DX86_ASSEMBLY -DOPTIMIZED_FLAGS"
787  ASMOBJS=md-X86.o
788else if test $uae_cv_prog_cc_watcom = yes; then
789  MACHDEP=md-i386-watcom
790  echo CFLAGS before: $CFLAGS
791  CFLAGS=`echo $CFLAGS | sed 's, -g , ,' |sed 's,^-g ,,'`
792  CFLAGS="$CFLAGS --/--bm --/--mf --/--w4 --/--s --/--ei --/--zp4 --/--5r"
793  CFLAGS="$CFLAGS --/--oe=50 --/--oi --/--ok --/--ol --/--ot --/--oh --/--or --/--zq"
794  CFLAGS="$CFLAGS -DREGPARAM= -DUNALIGNED_PROFITABLE"
795  echo CFLAGS after:  $CFLAGS
796else if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEPPC" = "xyes" ]]; then
797  MACHDEP=md-ppc-gcc
798  CFLAGS="$CFLAGS -DREGPARAM="
799  if [[ "x$HAVE_MOTO_LIB" = "xyes" ]]; then
800    MATHLIB="-lmoto $MATHLIB"
801  fi
802else if [[ "x$TARGET" = "xamigaos" ]]; then
803  OSDEP=od-amiga
804  CPU=`uname -m`
805  if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVE68K" = "xyes" ]]; then
806    MACHDEP=md-68k
807    CFLAGS="$CFLAGS -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(4)))\" -DM68K_FLAG_OPT=1"
808  else if [[ "x$HAVEGCC27" = "xyes" -a "x$CPU" = "xppc" ]]; then
809    MACHDEP=md-ppc-gcc
810  else
811    dnl sam: amigaos without gcc
812    CFLAGS="$CFLAGS -O -DREGPARAM="
813  fi
814  CPUOBJS="cpuemu1.o cpuemu2.o cpuemu3.o cpuemu4.o cpuemu5.o cpuemu6.o cpuemu7.o cpuemu8.o"
815  fi
816else if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVE68K" = "xyes" -a "x$DO_PROFILING" = "xno" ]]; then
817  dnl sam: This is for linux 68k (REGPARAM is not used under linux)
818  MACHDEP=md-68k
819  CFLAGS="$CFLAGS -DM68K_FLAG_OPT=1 -DREGPARAM="
820else if [[ "x$TARGET" = "xbeos" ]]; then
821  MACHDEP=md-ppc
822  CFLAGS="$CFLAGS -DREGPARAM="
823  OSDEP=od-beos
824else
825  CFLAGS="$CFLAGS -DREGPARAM="
826fi
827fi
828fi
829fi
830fi
831fi
832
833FSDBOBJS=fsdb_unix.o
834if [[ "x$TARGET" = "xwin32" ]]; then
835  OSDEP=od-win32
836  FSDBOBJS=osdep/fsdb_win32.o
837  if test $ac_cv_c_compiler_gnu = yes; then
838    LIBS="$LIBS -lddraw -lwinmm -lcomctl32 -lcomdlg32 -luser32 -lgdi32 -lkernel32 -ladvapi32 -lshell32"
839  else if test $uae_cv_prog_cc_watcom = yes; then
840    LIBS="$LIBS -lddraw -lwinmm -lcomctl32"
841  fi
842  fi
843else if [[ "x$HAVELINUX" = "xyes" ]]; then
844  OSDEP=od-linux
845fi
846fi
847
848if [[ "x$TARGET" = "xx11" -o "x$TARGET" = "xsvgalib" -o "x$TARGET" = "xamigaos" \
849     -o "x$TARGET" = "xbeos" -o "x$TARGET" = "xasciiart" ]]; then
850  dnl On Unix, BeOS and AmigaOS system, zfile is supposed to work. Dunno about others.
851  CFLAGS="$CFLAGS -DUSE_ZFILE"
852fi
853
854AC_MSG_CHECKING(which sound system to use)
855AC_ARG_ENABLE(file-sound,[  --enable-file-sound     Enable sound output to file],[USE_FILE_SOUND=$enableval],[])
856
857if [[ "x$USE_FILE_SOUND" = "xyes" ]]; then
858  AC_MSG_RESULT(file output)
859  SOUNDDEP=sd-file
860  USE_SOUND=yes
861else if [[ "x$WANT_SDLSND" = "xyes" ]]; then
862  AC_MSG_RESULT(SDL)
863  SOUNDDEP=sd-sdl
864  USE_SOUND=yes
865  NEED_THREAD_SUPPORT=yes
866  if [[ "x$HAVE_ALSA" = "xyes" -o "x$HAVE_OSS_SOUND" = "xyes" ]]; then
867    NR_WARNINGS=`expr $NR_WARNINGS + 1`
868    echo "SDL sound support was selected, but OSS or ALSA are more reliable."
869  fi
870else if [[ "x$WANT_ALSA" = "xyes" ]]; then
871  AC_MSG_RESULT(ALSA)
872  SOUNDDEP=sd-alsa
873  USE_SOUND=yes
874else if [[ "x$HAVE_OSS_SOUND" = "xyes" ]]; then
875  AC_MSG_RESULT(OSS)
876  SOUNDDEP=sd-uss
877  USE_SOUND=yes
878else if [[ "x$ac_cv_header_sys_audioio_h" = "xyes" -o "x$ac_cv_header_sun_audioio_h" = "xyes" ]]; then
879  AC_MSG_RESULT(Solaris/NetBSD)
880  SOUNDDEP=sd-solaris
881  USE_SOUND=yes
882else if [[ "x$HAVE_MME_LIB" = "xyes" ]]; then
883  AC_MSG_RESULT(MME sound)
884  SOUNDDEP=sd-mme
885  LIBS="$LIBS -lmme"
886  USE_SOUND=yes
887else if [[ "x$TARGET" = "xamigaos" ]]; then
888  if [[ "x$ac_cv_header_devices_ahi_h" = "xyes" ]]; then
889    AC_MSG_RESULT(Amiga AHI.device)
890  else
891    AC_MSG_RESULT(Amiga audio.device)
892  fi
893  SOUNDDEP=od-amiga
894  USE_SOUND=yes
895else if [[ "x$TARGET" = "xbeos" ]]; then
896  AC_MSG_RESULT(BeOS sound)
897  SOUNDDEP=od-beos
898  USE_SOUND=yes
899else if [[ "x$TARGET" = "xwin32" ]]; then
900  AC_MSG_RESULT(Win32 sound)
901  SOUNDDEP=od-win32
902  USE_SOUND=yes
903else
904  echo "no known sound system found"
905  NR_ERRORS=`expr $NR_ERRORS + 1`
906fi
907fi
908fi
909fi
910fi
911fi
912fi
913fi
914fi
915
916if [[ "x$NEED_THREAD_SUPPORT" = "xyes" ]]; then
917  if [[ "x$USE_THREADS" != "xyes" ]]; then
918    echo "Threads are needed for this configuration; enabling thread support."
919  fi
920fi
921
922if [[ "x$USE_THREADS" = "xyes" -o "x$NEED_THREAD_SUPPORT" = "xyes" ]]; then
923  if [[ "x$WANT_SDL" = "xyes" ]]; then
924    THREADDEP=td-sdl
925    CFLAGS="$CFLAGS -DSUPPORT_THREADS -D_REENTRANT"
926  else if [[ "x$HAVE_PTHREAD_LIB" = "xyes" ]]; then
927    THREADDEP=td-posix
928    CFLAGS="$CFLAGS -DSUPPORT_THREADS -D_REENTRANT"
929    LIBS="$LIBS -lpthread"
930    if [[ "x$HAVE_POSIX4_LIB" = "xyes" ]]; then
931      LIBS="$LIBS -lposix4"
932    fi
933
934    if [[ "x$USE_THREADS" = "xyes" ]]; then
935      CFLAGS="$CFLAGS -DUAE_FILESYS_THREADS"
936    fi
937
938    if [[ "x$TARGET" = "xsvgalib" ]]; then
939      echo "If you didn't compile a fixed version of SVGAlib then thread support"
940      echo "in UAE will lock your machine real hard."
941      NR_WARNINGS=`expr $NR_WARNINGS + 1`
942    fi
943  else
944    echo "You tried to enable threads, but I couldn't find a thread library!"
945    NR_ERRORS=`expr $NR_ERRORS + 1`
946  fi
947  fi
948fi
949
950SCSIOBJS=scsi-none.o
951AC_ARG_ENABLE(scsi-device,[  --enable-scsi-device    Enable the uaescsi.device],[USE_SCSI_DEVICE=$enableval],[])
952if [[ "x$USE_SCSI_DEVICE" = "xyes" ]]; then
953  AC_MSG_CHECKING("availability of libscg headers and lib")
954  OLDLIBS="$LIBS"
955  OLDCFLAGS="$CFLAGS"
956  CFLAGS="$CFLAGS -Isrc/include"
957  LIBS="-Lsrc $LIBS -lscg -lschily"
958  AC_LINK_IFELSE([AC_LANG_PROGRAM([[typedef int BOOL;
959#include "scg/scgcmd.h"
960#include "scg/scsitransp.h"
961#include "scg/scsireg.h"]], [[{SCSI *scgp = open_scsi ((void *)0, (void *)0, 0, 1, 1);}]])],[
962    AC_MSG_RESULT(available)
963    SCSIOBJS=scsidev.o
964  ],[
965     AC_MSG_RESULT(not available)
966     NR_WARNINGS=`expr $NR_WARNINGS + 1`
967     echo "Please refer to the UAE SCSI device section in docs/README for installation instructions."
968     LIBS="$OLDLIBS"
969  ])
970  CFLAGS="$OLDCFLAGS"
971fi
972
973dnl Special case hack for BSD: try to use the Linux joystick.c.
974
975if [[ "x$WANT_SDL" = "xyes" ]]; then
976    OD_JOYSTICK=sdl-joystick.c
977else if [[ "x$ac_cv_header_machine_joystick_h" = "xyes" ]]; then
978    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <machine/joystick.h>]], [[{ struct joystick a; }]])],[OD_JOYSTICK=od-linux/joystick.c],[])
979else
980    OD_JOYSTICK=$OSDEP/joystick.c
981fi
982fi
983
984rm -f src/machdep
985rm -f src/osdep
986rm -rf src/guidep
987rm -f src/threaddep
988rm -f src/sounddep
989rm -f src/scsidep
990rm -f src/target.h
991rm -f src/sd-sound.c
992rm -f src/od-joy.c
993rm -f src/md-support.c
994rm -f src/md-X86.S
995rm -f src/scsi-support.c
996
997if [[ "x$TARGET" = "xamigaos" ]]; then
998  dnl Determine the cpu-type
999  AC_MSG_CHECKING(which CPU to use)
1000  cpu=`cpu | cut -d' ' -f2`
1001  AC_MSG_RESULT($cpu)
1002  CFLAGS="$CFLAGS -m$cpu"
1003
1004  dnl Is that correct for the fpu ?
1005  AC_MSG_CHECKING(which FPU to use)
1006  fpu=`cpu | cut -d' ' -f3 | grep '^6888[12]$'`
1007  if [[ "x$fpu" != "x" ]]; then
1008    dnl gcc only knows about 68881
1009    AC_MSG_RESULT(68881)
1010    CFLAGS="$CFLAGS -m68881"
1011  else
1012    AC_MSG_RESULT(none)
1013  fi
1014fi
1015
1016if [[ "x$DO_PROFILING" = "xyes" ]]; then
1017  echo "Building a profiling version of UAE (select this option only if you know"
1018  echo "what you are doing)"
1019fi
1020
1021dnl Create some more links and files.
1022
1023dnl We removed those from the build directory above, so if the source
1024dnl directory still has them, something is fairly wrong.
1025
1026dnl This doesn't work with Solaris /bin/sh, neither do all the alternatives I
1027dnl tried. It doesn't seem to cause a failure either, though.
1028
1029if test -f $abssrcdir/src/target.h
1030then
1031  echo
1032  echo "Fatal error: Can't configure in the current directory, because"
1033  echo "configure was run in the source directory. Go to the source"
1034  echo "directory, type"
1035  echo "  make streifenfrei"
1036  echo "and try again."
1037  exit 1
1038fi
1039
1040AC_CONFIG_LINKS(src/osdep:src/$OSDEP)
1041AC_CONFIG_LINKS(src/sounddep:src/$SOUNDDEP)
1042AC_CONFIG_LINKS(src/threaddep:src/$THREADDEP)
1043AC_CONFIG_LINKS(src/machdep:src/$MACHDEP)
1044dnl AC_CONFIG_LINKS(src/gfxdep:src/$GFX_DEP)
1045
1046mkdir src/guidep
1047for x in $GUIOBJS_IN; do
1048  src=`echo $x |sed s,'\.o$,.c,'`
1049  AC_CONFIG_LINKS(src/guidep/$src:src/$GUIDEP/$src)
1050  GUIOBJS="$GUIOBJS guidep/$x"
1051done
1052
1053
1054echo "#include \"$abssrcdir/src/targets/$TARGETDEP\"" > src/target.h
1055
1056echo "#include \"$abssrcdir/src/$SOUNDDEP/sound.c\"" >src/sd-sound.c
1057echo "#include \"$abssrcdir/src/$OD_JOYSTICK\"" >src/od-joy.c
1058echo "#include \"$abssrcdir/src/$MACHDEP/support.c\"" >src/md-support.c
1059
1060if [[ "x$MACHDEP" = "xmd-i386-gcc" ]]; then
1061  echo "#include \"machdep/X86.S\"" >src/md-X86.S
1062fi
1063echo "#include \"$abssrcdir/src/include/$FPP_H\"" >src/md-fpp.h
1064
1065mkdir -p src/keymap
1066
1067AC_SUBST(ac_cv_c_inline)
1068AC_SUBST(WRCPRG)
1069AC_SUBST(NO_SCHED_CFLAGS)
1070AC_SUBST(NO_REORDER_CFLAGS)
1071AC_SUBST(LIBRARIES)
1072AC_SUBST(TARGET)
1073AC_SUBST(GFXOBJS)
1074AC_SUBST(GUIOBJS)
1075AC_SUBST(RESOBJS)
1076AC_SUBST(ASMOBJS)
1077AC_SUBST(SCSIOBJS)
1078AC_SUBST(CPUOBJS)
1079AC_SUBST(DEBUGOBJS)
1080AC_SUBST(FSDBOBJS)
1081AC_SUBST(SET_MAKE)
1082AC_SUBST(MATHLIB)
1083AC_SUBST(SHM_SUPPORT_LINKS)
1084
1085AC_SUBST(top_srcdir)
1086
1087AC_CONFIG_FILES([src/Makefile Makefile])
1088
1089AC_OUTPUT
1090
1091echo
1092echo
1093if [[ "x$NR_ERRORS" = "x0" ]]; then
1094  if [[ "x$NR_WARNINGS" = "x0" ]]; then
1095    echo "Configuration was successful!"
1096  else
1097    echo "There were $NR_WARNINGS warnings. That is usually harmless, but read the output"
1098    echo "from configure carefully if you run into problems."
1099  fi
1100else
1101  echo "There were $NR_ERRORS errors. UAE may still build and run cleanly, but you may"
1102  echo "not get all the features you asked for."
1103fi
1104echo
1105
1106