|
|
1.1 root 1: dnl Process this file with autoconf to produce a configure script.
1.1.1.4 root 2: dnl Written 1996, 1997, 1998 Bernd Schmidt
3:
4: dnl If you can use anything from this file, feel free to steal it. I put
5: dnl this into the public domain.
6:
7: dnl There are still many uncaught errors (e.g. --enable-dga on an Amiga)
8: dnl I didn't have the nerve to track them all down.
1.1 root 9:
1.1.1.2 root 10: AC_INIT(amiga/source/transdisk.c)
1.1.1.4 root 11: AC_PREREQ(2.12)
12:
1.1 root 13: dnl Checks for programs.
14: AC_PROG_CC
15:
16: AC_PROG_CPP
17: AC_PROG_MAKE_SET
1.1.1.4 root 18: AC_PATH_PROG(FILEPRG, file, not-found)
1.1 root 19:
20: AC_AIX
21: AC_ISC_POSIX
22:
1.1.1.4 root 23: NR_WARNINGS=0
24: NR_ERRORS=0
25:
26: NEED_THREAD_SUPPORT=no
27:
28: ADDITIONAL_CFLAGS=
29: OPTIMIZE_CFLAGS=
30: WARNING_CFLAGS=
31: DEBUG_CFLAGS=
32: NO_SCHED_CFLAGS=
33:
1.1 root 34: dnl Checks for libraries.
1.1.1.4 root 35: HAVE_BEOS=no
36: HAVE_POS=no
1.1 root 37: dnl Replace `main' with a function in -lMedia_s: (Ian!)
1.1.1.4 root 38: AC_CHECK_LIB(Media_s, main, HAVE_MEDIA_LIB=yes, HAVE_MEDIA_LIB=no)
1.1 root 39: dnl Replace `main' with a function in -lNeXT_s:
1.1.1.4 root 40: AC_CHECK_LIB(NeXT_s, main, HAVE_NEXT_LIB=yes, HAVE_NEXT_LIB=no)
41: AC_CHECK_LIB(amiga, OpenLibrary, HAVE_AMIGA_LIB=yes, HAVE_AMIGA_LIB=n)
42: AC_CHECK_LIB(vga, vga_setmode, HAVE_SVGA_LIB=yes, HAVE_SVGA_LIB=no)
43: AC_CHECK_LIB(AF, AFOpenAudioConn, HAVE_AF_LIB=yes, HAVE_AF_LIB=no)
44: AC_CHECK_LIB(ncurses, waddch, HAVE_NCURSES_LIB=yes, HAVE_NCURSES_LIB=no)
45: AC_CHECK_LIB(pthread, pthread_create, HAVE_PTHREAD_LIB=yes, HAVE_PTHREAD_LIB=no)
46: AC_CHECK_LIB(posix4, sem_init, HAVE_POSIX4_LIB=yes, HAVE_POSIX4_LIB=no)
47: AC_CHECK_LIB(ggi, ggiInit, HAVE_GGI_LIB=yes, HAVE_GGI_LIB=no)
48:
49: dnl Check for pOS or -target=p.os
50: if [[ $target = "p.os" ]]; then
51: HAVE_POS=yes
52: else
53: dnl Check for pOS
1.1 root 54:
1.1.1.4 root 55: cat >conftest.c << EOF
56: int main()
57: {
58: #ifdef __POS__
59: printf("POS\n");
60: #endif
61: return 0;
62: }
63: EOF
64: $CC $CFLAGS conftest.c -c -o conftest.o
65: $CC conftest.o -o conftest
66: ./conftest >conftest.file
67: if grep POS conftest.file >/dev/null; then
68: HAVE_POS=yes
69: else
70: HAVE_POS=no
71: fi
72: rm -f conftest*
73: fi
1.1 root 74:
1.1.1.4 root 75: AC_PATH_XTRA
76: AC_CONFIG_HEADER(src/sysconfig.h)
1.1.1.3 root 77:
1.1 root 78: AC_HEADER_DIRENT
79: AC_HEADER_STDC
80:
1.1.1.4 root 81: dnl @@@ Is <sys/termios.h> the right way or is it <termios.h>?
82: AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/types.h utime.h string.h strings.h values.h ncurses.h curses.h)
83: AC_CHECK_HEADERS(sys/vfs.h sys/mount.h sys/select.h sys/param.h sys/statfs.h sys/statvfs.h sys/stat.h)
84: AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h sun/audioio.h sys/audioio.h getopt.h features.h sys/termios.h)
85: AC_CHECK_HEADERS(posix_opt.h sys/ioctl.h sys/ipc.h sys/shm.h)
86: AC_CHECK_HEADERS(ggi/libggi.h)
87: AC_CHECK_HEADER(be_math.h, HAVE_BEOS=yes, HAVE_BEOS=no)
88:
89: AC_CHECK_SIZEOF(char, 1)
90: AC_CHECK_SIZEOF(short, 2)
91: AC_CHECK_SIZEOF(int, 4)
92: AC_CHECK_SIZEOF(long, 4)
93: AC_CHECK_SIZEOF(long long, 8)
1.1 root 94:
95: dnl Checks for typedefs, structures, and compiler characteristics.
96: AC_C_CONST
97: AC_C_INLINE
1.1.1.4 root 98: if [[ "x$ac_cv_c_inline" = "xno" ]]; then
99: ac_cv_c_inline=
100: fi
1.1 root 101: AC_TYPE_MODE_T
102: AC_TYPE_OFF_T
103: AC_TYPE_PID_T
104: AC_STRUCT_ST_BLOCKS
105: AC_HEADER_TIME
106: AC_STRUCT_TM
107:
108: dnl Checks for library functions.
109: AC_PROG_GCC_TRADITIONAL
110: AC_FUNC_MEMCMP
111: AC_TYPE_SIGNAL
112: AC_FUNC_UTIME_NULL
1.1.1.4 root 113: AC_CHECK_FUNCS(getcwd getopt strdup gettimeofday sigaction mkdir rmdir select strerror strstr statfs)
114: AC_CHECK_FUNCS(tcgetattr cfmakeraw readdir_r)
1.1 root 115:
116: AC_MSG_CHECKING(how many args statfs takes)
1.1.1.4 root 117: if [[ "x$ac_cv_func_statfs" = "xyes" ]]; then
1.1 root 118: AC_TRY_COMPILE([
119: #include "confdefs.h"
1.1.1.2 root 120: #ifdef HAVE_SYS_TYPES_H
121: #include <sys/types.h>
122: #endif
123: #ifdef HAVE_SYS_PARAM_H
124: #include <sys/param.h>
125: #endif
1.1 root 126: #ifdef HAVE_SYS_MOUNT_H
127: #include <sys/mount.h>
128: #endif
1.1.1.2 root 129: #ifdef HAVE_SYS_SELECT_H
130: #include <sys/select.h>
131: #endif
1.1 root 132: #ifdef HAVE_SYS_VFS_H
133: #include <sys/vfs.h>
134: #endif
135: #ifdef HAVE_SYS_STATFS_H
136: #include <sys/statfs.h>
137: #endif
138: #ifdef HAVE_SYS_STATVFS_H
139: #include <sys/statvfs.h>
140: #endif],[struct statfs statbuf;statfs("/",&statbuf);],
141: AC_MSG_RESULT(2)
142: STATFS_NO_ARGS=2,
143: AC_MSG_RESULT(4)
144: STATFS_NO_ARGS=4)
145: fi
146:
147: AC_MSG_CHECKING(whether to use f_bavail or f_bfree)
1.1.1.4 root 148: if [[ "x$ac_cv_func_statfs" = "xyes" ]]; then
1.1 root 149: AC_TRY_COMPILE([
150: #include "confdefs.h"
1.1.1.2 root 151: #ifdef HAVE_SYS_TYPES_H
152: #include <sys/types.h>
153: #endif
154: #ifdef HAVE_SYS_PARAM_H
155: #include <sys/param.h>
156: #endif
1.1 root 157: #ifdef HAVE_SYS_MOUNT_H
158: #include <sys/mount.h>
159: #endif
1.1.1.2 root 160: #ifdef HAVE_SYS_SELECT_H
161: #include <sys/select.h>
162: #endif
1.1 root 163: #ifdef HAVE_SYS_VFS_H
164: #include <sys/vfs.h>
165: #endif
166: #ifdef HAVE_SYS_STATFS_H
167: #include <sys/statfs.h>
168: #endif
169: #ifdef HAVE_SYS_STATVFS_H
170: #include <sys/statvfs.h>
171: #endif],[struct statfs statbuf;statbuf.f_bavail;],
172: AC_MSG_RESULT(f_bavail)
173: STATBUF_BAVAIL=f_bavail,
174: AC_MSG_RESULT(f_bfree)
175: STATBUF_BAVAIL=f_bfree)
176: fi
177:
1.1.1.4 root 178: dnl Verify that the ncurses installation makes some sense.
179:
180: if [[ "x$HAVE_NCURSES_LIB" = "xyes" ]]; then
181: if [[ "x$ac_cv_header_ncurses_h" = "xno" -a "x$ac_cv_header_curses_h" = "xno" ]]; then
182: echo "Installation problem, found libncurses but neither curses.h nor ncurses.h!"
183: HAVE_NCURSES_LIB=no
184: NR_ERRORS=`expr $NR_ERRORS + 1`
185: else
186: if [[ "x$ac_cv_header_ncurses_h" = "xno" ]]; then
187: AC_MSG_CHECKING(for attr_t in curses.h)
188: AC_TRY_COMPILE([#include <curses.h>],[{ attr_t a; a = A_NORMAL; }], AC_MSG_RESULT(yes),
189: [
190: ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DDONT_HAVE_ATTR_T"
191: AC_MSG_RESULT(no)
192: NR_WARNINGS=`expr $NR_WARNINGS + 1`
193: echo "Please install a newer version of libncurses if you can."
194: ])
195: else
196: AC_MSG_CHECKING(for attr_t in ncurses.h)
197: AC_TRY_COMPILE([#include <ncurses.h>],[{ attr_t a; a = A_NORMAL; }], AC_MSG_RESULT(yes),
198: [
199: ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DDONT_HAVE_ATTR_T"
200: AC_MSG_RESULT(no)
201: NR_WARNINGS=`expr $NR_WARNINGS + 1`
202: echo "Please install a newer version of libncurses if you can."
203: ])
204: fi
205: fi
206: fi
207:
208: DO_PROFILING=no
209: WANT_GGI=dunno
210: WANT_SVGALIB=dunno
211: WANT_ASCIIART=dunno
212: WANT_UI=dunno
213: WANT_NCURSES_UI=no
214: WANT_DGA=no
215: WANT_VIDMODE=no
216: SYSTEM_IS_ELF=dunno
217:
218: AC_ARG_ENABLE(profiling,[ --enable-profiling Build a profiling (SLOW!) version],[DO_PROFILING=$enableval],[])
219: AC_ARG_WITH(svgalib,[ --with-svgalib Use SVGAlib for graphics output],[WANT_SVGALIB=$withval],[])
220: AC_ARG_WITH(ggi,[ --with-ggi Use GGI for graphics output],[WANT_GGI=$withval],[])
221: AC_ARG_WITH(asciiart,[ --with-asciiart Use ncurses ascii art for graphics output],[WANT_ASCIIART=$withval],[])
222: AC_ARG_ENABLE(dga,[ --enable-dga X11 version: Use the DGA extension],[WANT_DGA=$enableval],[])
223: AC_ARG_ENABLE(vidmode,[ --enable-vidmode X11 version: Use the XF86VidMode extension],[WANT_VIDMODE=$enableval],[])
224: AC_ARG_ENABLE(ui,[ --enable-ui Use a user interface if possible (default on)],[WANT_UI=$enableval],[])
225: AC_ARG_WITH(elf,[ --with-elf Explicitly state that this system is ELF],[SYSTEM_IS_ELF=$withval],[])
226:
227: dnl Some simple plausibility tests...
228:
229: if [[ "x$WANT_DGA" = "xyes" ]]; then
230: if [[ "x$WANT_SVGALIB" = "xyes" -o "x$WANT_GGI" = "xyes" -o "x$WANT_ASCIIART" = "xyes" ]]; then
231: echo "You can't enable DGA for SVGAlib, GGI and ncurses targets!"
232: NR_ERRORS=`expr $NR_ERRORS + 1`
233: WANT_DGA=no
234: fi
235: fi
236:
237: if [[ "x$WANT_DGA" = "xyes" -a "x$no_x" = "xyes" ]]; then
238: echo "Ignoring --enable-dga, since X was disabled or not found."
239: NR_ERRORS=`expr $NR_ERRORS + 1`
240: WANT_DGA=no
241: fi
242:
243: if [[ "x$WANT_DGA" = "xno" -a "x$WANT_VIDMODE" = "xyes" ]]; then
244: echo "The XF86VidMode extension can only be used in DGA mode. Disabling it."
245: NR_ERRORS=`expr $NR_ERRORS + 1`
246: WANT_VIDMODE=no
247: fi
248:
249: dnl Check if we have the libraries needed for the user's selection.
250:
251: if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
252: if [[ "x$HAVE_SVGA_LIB" = "xno" ]]; then
253: echo "Could not find libsvga, disabling svgalib support."
254: NR_ERRORS=`expr $NR_ERRORS + 1`
255: WANT_SVGALIB=no
256: else
257: no_x=yes
258: fi
259: fi
260:
261: if [[ "x$WANT_GGI" = "xyes" ]]; then
262: if [[ "x$HAVE_GGI_LIB" = "xno" ]]; then
263: echo "Could not find libggi, disabling GGI support."
264: NR_ERRORS=`expr $NR_ERRORS + 1`
265: WANT_GGI=no
266: else if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
267: echo "You can't configure for both SVGAlib and GGI. Disabling GGI."
268: NR_ERRORS=`expr $NR_ERRORS + 1`
269: WANT_GGI=no
270: else
271: no_x=yes
272: fi
273: fi
274: fi
275:
276: if [[ "x$WANT_ASCIIART" = "xyes" ]]; then
277: if [[ "x$HAVE_NCURSES_LIB" = "xno" ]]; then
278: echo "Could not find libncurses, disabling ascii art support."
279: NR_ERRORS=`expr $NR_ERRORS + 1`
280: WANT_ASCIIART=no
281: else if [[ "x$WANT_SVGALIB" = "xyes" -o "x$WANT_GGI" = "xyes" ]]; then
282: echo "You can't configure for both ncurses and another target. Disabling ncurses."
283: NR_ERRORS=`expr $NR_ERRORS + 1`
284: WANT_ASCIIART=no
285: else
286: no_x=yes
287: fi
288: fi
289: fi
290:
291: dnl If the user wants DGA, see if we have it.
292: dnl This must come after we checked for X11.
293:
294: if [[ "x$WANT_DGA" = "xyes" ]]; then
295: TMP_SAVE_LIBS=$LIBS
296: LIBS="$X_LIBS $LIBS"
297: AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no, [ $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS ])
298: LIBS=$TMP_SAVE_LIBS
299: if [[ "x$HAVE_DGA" = "xno" ]]; then
300: echo "Could not find DGA extension, ignoring --enable-dga."
301: NR_ERRORS=`expr $NR_ERRORS + 1`
302: WANT_DGA=no
303: fi
304: fi
305:
306: if [[ "x$WANT_VIDMODE" = "xyes" ]]; then
307: TMP_SAVE_LIBS=$LIBS
308: LIBS="$X_LIBS $LIBS"
309: AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, HAVE_VIDMODE=yes, HAVE_VIDMODE=no, [ $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS ])
310: LIBS=$TMP_SAVE_LIBS
311: if [[ "x$HAVE_VIDMODE" = "xno" ]]; then
312: echo "Could not find VidMode extension, ignoring --enable-vidmode."
313: NR_ERRORS=`expr $NR_ERRORS + 1`
314: WANT_VIDMODE=no
315: fi
316: fi
317:
318: AM_PATH_GTK
319:
320: dnl If --enable-ui --enable-dga is given, give UI priority.
321: if [[ "x$WANT_UI" = "xyes" -a "x$WANT_DGA" = "xyes" ]]; then
322: echo "Can't use a GUI with DGA - disabling DGA."
323: NR_ERRORS=`expr $NR_ERRORS + 1`
324: WAMT_DGA=no
325: WANT_VIDMODE=no
326: fi
327:
328: dnl Without explicit --enable-ui, silently turn off the UI if DGA is wanted.
329: if [[ "x$WANT_DGA" = "xyes" ]]; then
330: WANT_UI=no
331: fi
332:
333: dnl See if we can at least compile SHM support
334:
335: SHM_SUPPORT_LINKS=0
336: if [[ "x$no_x" != "xyes" -a "x$WANT_DGA" != "xyes" -a "x$ac_cv_header_sys_ipc_h" = "xyes" -a "x$ac_cv_header_sys_shm_h" = "xyes" ]]; then
337: AC_MSG_CHECKING(whether the X11 MIT-SHM extension can be compiled in)
338: TMP_SAVE_CFLAGS=$CFLAGS
339: TMP_SAVE_LIBS=$LIBS
340: CFLAGS="$CFLAGS $X_CFLAGS"
341: LIBS="$X_LIBS $LIBS $X_PRE_LIBS -lX11 -lXext $X_EXTRA_LIBS"
342: AC_TRY_LINK([
343: #include "confdefs.h"
344: #ifdef HAVE_SYS_TYPES_H
345: #include <sys/types.h>
346: #endif
347: #include <X11/Xlib.h>
348: #include <X11/Xutil.h>
349: #include <X11/keysym.h>
350: #include <X11/cursorfont.h>
351: #include <sys/ipc.h>
352: #include <sys/shm.h>
353: #include <X11/extensions/XShm.h>],[
354: static XShmSegmentInfo shminfo;
355: static Display *display;
356: void foo(void)
357: {
358: XShmAttach(display, &shminfo);
359: XSync(display,0);
360: shmctl(shminfo.shmid, IPC_RMID, 0);
361: }],
362: SHM_SUPPORT_LINKS=1
363: AC_MSG_RESULT(yes),
364: SHM_SUPPORT_LINKS=0
365: AC_MSG_RESULT(no))
366: CFLAGS=$TMP_SAVE_CFLAGS
367: LIBS=$TMP_SAVE_LIBS
1.1.1.2 root 368: fi
369:
1.1.1.3 root 370: MATHLIB=-lm
1.1.1.4 root 371: DEBUGOBJS="debug.o"
1.1.1.3 root 372:
1.1 root 373: AC_MSG_CHECKING(which target to use)
1.1.1.4 root 374:
375: if [[ "x$HAVE_BEOS" = "xyes" ]]; then
376: AC_MSG_RESULT(BeOS)
377: MATHLIB=
378: TARGET=beos
379: TARGETDEP=t-beos.h
380: GFXOBJS=osdep/beos.o
381: GUIOBJS=
382: OPTIMIZE_CFLAGS=-O7
383: else if [[ "x$HAVE_POS" = "xyes" ]]; then
384: AC_MSG_RESULT(p.OS)
385: TARGET=p_os
386: TARGETDEP=t-pos.h
387: GFXOBJS="osdep/pos-win.o osdep/pos-disk.o osdep/pos-rexx.o"
388: GUIOBJS="osdep/pos-gui.o"
389: else if [[ "x$HAVE_AMIGA_LIB" = "xyes" ]]; then
1.1.1.3 root 390: AC_MSG_RESULT(AmigaOS)
391: TARGET=amigaos
1.1.1.4 root 392: TARGETDEP=t-amiga.h
393: GFXOBJS="osdep/ami-win.o osdep/ami-disk.o osdep/ami-rexx.o osdep/ami-appw.o"
394: GUIOBJS="osdep/ami-gui.o"
395: else if [[ "x$HAVE_NEXT_LIB" = "xyes" ]]; then
1.1.1.3 root 396: AC_MSG_RESULT(NeXTStep)
397: MATHLIB=
398: TARGET=next
399: GFXOBJS="NeXTwin.o"
1.1.1.4 root 400: GUIOBJS=
401: TARGETDEP=t-next.h
1.1.1.3 root 402: LIBRARIES="-sectcreate __ICON __header ../Uae.app/Uae.iconheader -segprot __ICON r r -sectcreate __ICON app ../Uae.app/Uae.tiff -lMedia_s -lNeXT_s"
403: else
1.1.1.4 root 404: dnl Unix system
405: dnl If we don't have X, see what else we have and/or want.
1.1.1.3 root 406:
1.1.1.4 root 407: if [[ "x$no_x" = "xyes" ]]; then
408: if [[ "x$WANT_SVGALIB" != "xyes" -a "x$WANT_GGI" != "xyes" -a "x$WANT_ASCIIART" != "xyes" ]]; then
409: if [[ "x$WANT_SVGALIB" != "xno" -a "x$HAVE_SVGA_LIB" = "xyes" ]]; then
410: WANT_SVGALIB=yes
411: else if [[ "x$WANT_GGI" != "xno" -a "x$HAVE_GGI_LIB" = "xyes" ]]; then
412: WANT_GGI=yes
413: else if [[ "x$WANT_ASCIIART" != "xno" -a "x$HAVE_NCURSES_LIB" = "xyes" ]]; then
414: WANT_ASCIIART=yes
415: fi
416: fi
417: fi
1.1.1.3 root 418: fi
419: fi
420:
1.1.1.4 root 421: if [[ "x$WANT_GGI" = "xyes" ]]; then
422: AC_MSG_RESULT(GGI)
423: TARGET=ggilib
424: TARGETDEP=t-ggi.h
425: WANT_NCURSES_UI=yes
426: GFXOBJS=ggi.o
427: LIBRARIES="-ldl -lggi"
428: LDFLAGS="-rdynamic $LDFLAGS"
429: else if [[ "x$WANT_SVGALIB" = "xyes" ]]; then
430: AC_MSG_RESULT(SVGAlib)
431: TARGET=svgalib
432: TARGETDEP=t-svgalib.h
433: GFXOBJS=svga.o
434: LIBRARIES="-lvga"
435: WANT_NCURSES_UI=yes
436: else if [[ "x$WANT_ASCIIART" = "xyes" ]]; then
437: AC_MSG_RESULT(ncurses ASCII art)
438: TARGET=asciiart
439: TARGETDEP=t-ascii.h
440: GFXOBJS="ncurses.o"
441: GUIOBJS="tui.o svgancui.o"
442: LIBRARIES="-lncurses"
443: else if [[ "x$no_x" = "xyes" ]]; then
444: AC_MSG_RESULT(Ummm....)
445: echo "Fatal error: No graphics system found, don't know what target to use."
446: exit 1
1.1.1.3 root 447: else
1.1.1.4 root 448: AC_MSG_RESULT(X11)
449: TARGET=x11
450: TARGETDEP=t-x11.h
451: GFXOBJS=xwin.o
452: GUIOBJS=nogui.o
453:
454: LIBRARIES="$X_LIBS $X_PRE_LIBS"
455: dnl If we still think we want DGA, set it up.
456: if [[ "x$WANT_DGA" = "xyes" ]]; then
457: LIBRARIES="$LIBRARIES -lXxf86dga"
458: X_CFLAGS="$X_CFLAGS -DUSE_DGA_EXTENSION"
459: if [[ "x$WANT_VIDMODE" = "xyes" ]]; then
460: LIBRARIES="$LIBRARIES -lXxf86vm"
461: X_CFLAGS="$X_CFLAGS -DUSE_VIDMODE_EXTENSION"
462: fi
463: fi
464: LIBRARIES="$LIBRARIES -lXext -lX11 $X_EXTRA_LIBS"
1.1.1.3 root 465:
1.1.1.4 root 466: if [[ "x$WANT_UI" != "xno" ]]; then
467: if [[ "x$no_gtk" = "xyes" ]]; then
468: echo "Did not find gtk+, disabling user interface"
469: GTK_CFLAGS=
470: GTK_LIBS=
471: if [[ "x$WANT_UI" = "xyes" ]]; then
472: NR_ERRORS=`expr $NR_ERRORS + 1`
473: fi
1.1 root 474: else
1.1.1.4 root 475: echo "Using gtk+ GUI."
476: LIBRARIES="-lgtk -lgdk -lglib $LIBRARIES"
477: NEED_THREAD_SUPPORT=yes
478: ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DUSING_GTK_GUI"
479: GUIOBJS=gtkui.o
1.1 root 480: fi
481: fi
1.1.1.4 root 482: fi
483: fi
484: fi
1.1 root 485: fi
486: fi
1.1.1.3 root 487: fi
488: fi
489: fi
1.1 root 490:
1.1.1.4 root 491: if [[ "x$WANT_NCURSES_UI" = "xyes" ]]; then
492: if [[ "x$HAVE_NCURSES_LIB" = "xno" ]]; then
493: if [[ "x$WANT_UI" = "xyes" ]]; then
494: echo "ncurses is unavailable, can't provide a user interface"
495: NR_ERRORS=`expr $NR_ERRORS + 1`
496: fi
497: WANT_UI=no
498: fi
499: if [[ "x$WANT_UI" != "xno" ]]; then
500: GUIOBJS="tui.o svgancui.o"
501: LIBRARIES="$LIBRARIES -lncurses"
502: ADDITIONAL_CFLAGS="$ADDITIONAL_CFLAGS -DUSING_CURSES_UI"
503: if [[ "x$ac_cv_header_ncurses_h" = "xno" ]]; then
504: echo "Found libncurses, but no ncurses.h. This is normal with recent versions"
505: echo "of ncurses, but it might indicate a problem with older versions."
506: NR_WARNINGS=`expr $NR_WARNINGS + 1`
507: fi
508: else
509: GUIOBJS=nogui.o
510: fi
1.1.1.3 root 511: fi
512:
1.1.1.4 root 513: GFXOBJS="$GFXOBJS $GUIOBJS"
514:
1.1.1.3 root 515: dnl Find out some things about the system
516: dnl - whether we have GCC 2.7 or better.
517: dnl - what CPU we have (to use some assembly hacks on the x86)
518: dnl - whether we are on a Linux system
1.1.1.4 root 519: dnl - whether that is an ELF system
520: dnl - whether it's running glibc-2.0
521:
522: MACHDEP=md-generic
523: OSDEP=od-generic
524: THREADDEP=td-none
525: SOUNDDEP=od-generic
526:
527: USE_PENGUINS=no
528: USE_THREADS=no
529: USE_SOUND=no
530: USE_FILE_SOUND=no
531:
532: HAVEELF=no
533: HAVELINUX=no
534: HAVEGCC27=no
535: HAVEI386=no
536: HAVE68K=no
537: HAVEGLIBC2=no
1.1.1.3 root 538:
1.1 root 539: ASMOBJS=
1.1.1.4 root 540: CPUOBJS=cpuemu.o
1.1.1.3 root 541:
1.1.1.4 root 542: AC_MSG_CHECKING(for GCC 2.7 or higher)
1.1.1.3 root 543: cat >conftest.c << EOF
544: int main()
545: {
546: #if defined(__GNUC__) && defined(__GNUC_MINOR__)
547: #if __GNUC__ > 2 || __GNUC_MINOR__ > 6
548: printf("GNU\n");
549: #endif
550: #endif
551: return 0;
552: }
553: EOF
554:
555: $CC conftest.c -c -o conftest.o
556: $CC conftest.o -o conftest
557: ./conftest >conftest.file
558: if grep GNU conftest.file >/dev/null; then
1.1.1.4 root 559: AC_MSG_RESULT(yes)
560: HAVEGCC27=yes
1.1.1.3 root 561: else
1.1.1.4 root 562: AC_MSG_RESULT(no)
563: if [[ "x$CC" = "xgcc" ]]; then
1.1.1.3 root 564: echo "I suggest you upgrade to at least version 2.7 of GCC"
565: else
566: echo "Couldn't find GCC. UAE may or may not compile and run correctly."
1.1.1.4 root 567: NR_WARNINGS=`expr $NR_WARNINGS + 1`
1.1.1.3 root 568: fi
569: fi
570:
1.1.1.4 root 571: AC_MSG_CHECKING(for glibc-2.0 or higher)
572: if [[ "x$ac_cv_header_features_h" = "xyes" ]]; then
573: cat >conftest.c << EOF
574: #include <features.h>
575: int main()
576: {
577: #if defined(__GLIBC__)
578: #if __GLIBC__ >= 2
579: printf("GNU\n");
580: #endif
581: #endif
582: return 0;
583: }
584: EOF
585:
586: $CC conftest.c -c -o conftest.o
587: $CC conftest.o -o conftest
588: ./conftest >conftest.file
589: if grep GNU conftest.file >/dev/null; then
590: HAVEGLIBC2=yes
591: AC_MSG_RESULT(yes)
592: else
593: AC_MSG_RESULT(no)
1.1.1.3 root 594: fi
595: else
1.1.1.4 root 596: AC_MSG_RESULT(no)
597: fi
598:
599: if [[ "x$CC" = "xgcc" ]]; then
600: WARNING_CFLAGS="-Wall -Wno-unused -Wno-format -W -Wmissing-prototypes -Wstrict-prototypes"
601: OPTIMIZE_CFLAGS="-O2 -fomit-frame-pointer"
602: dnl Not nice, but needed to turn off -g
603: CFLAGS=
604: fi
605:
606: if [[ "x$DO_PROFILING" = "xyes" ]]; then
607: if [[ "x$CC" = "xgcc" ]]; then
608: OPTIMIZE_CFLAGS="-O"
609: DEBUG_CFLAGS="-g -fno-inline -fno-omit-frame-pointer -pg -DUSE_PROFILING"
610: LDFLAGS="-pg"
611: else
612: DO_PROFILING=no
613: echo "Don't know how to set up profiling for your compiler."
614: NR_ERRORS=`expr $NR_ERRORS + 1`
1.1.1.3 root 615: fi
616: fi
617:
1.1.1.4 root 618: CFLAGS="$OPTIMIZE_CFLAGS $DEBUG_CFLAGS $WARNING_CFLAGS $CFLAGS $ADDITIONAL_CFLAGS"
619:
620: if [[ "x$HAVEGCC27" = "xyes" ]]; then
1.1.1.3 root 621: CFLAGS="$CFLAGS -DGCCCONSTFUNC=\"__attribute__((const))\""
622: else
623: CFLAGS="$CFLAGS -DGCCCONSTFUNC="
624: fi
625:
626: cat >conftest.c << EOF
627: int main()
628: {
629: #ifdef __i386__
630: printf("386\n");
1.1.1.4 root 631: #elif defined(__mc68000__)
632: printf("68k\n");
1.1.1.3 root 633: #endif
634: return 0;
635: }
636: EOF
637:
638: $CC conftest.c -c -o conftest.o
639: $CC conftest.o -o conftest
640: ./conftest >conftest.file
641: if grep 386 conftest.file >/dev/null; then
1.1.1.4 root 642: HAVEI386=yes
1.1.1.3 root 643: echo "You seem to be using a x86 CPU (UAE will require a 486 to run)"
1.1.1.4 root 644: else if grep 68k conftest.file >/dev/null; then
645: HAVE68K=yes
646: echo "You seem to be using a 68k CPU."
1.1.1.3 root 647: else
648: echo "No special hacks for your CPU, sorry."
1.1.1.4 root 649: fi; fi
1.1.1.3 root 650:
651: rm -f conftest*
1.1 root 652:
1.1.1.4 root 653: if MACHINE=`uname -a 2>/dev/null`; then
654: case "$MACHINE" in
655: Linux*)
656: HAVELINUX=yes
657: ;;
658: esac
659: fi
660:
661: dnl X86.S needs to know whether it needs to add underscores to symbols.
662: dnl This might break some obscure systems which don't have ELF but don't
663: dnl add underscores either.
1.1 root 664:
1.1.1.4 root 665: AC_MSG_CHECKING(whether we are on an ELF system)
666:
667: if [[ "x$SYSTEM_IS_ELF" = "xdunno" ]]; then
668: cat >conftest.c << EOF
1.1 root 669: int main() { return 0; }
670: EOF
1.1.1.4 root 671:
672: gcc conftest.c -o conftest
673: if [[ "x$FILEPRG" = "xnot-found" ]]; then
674: cp conftest conftest.file
675: else
676: $FILEPRG conftest >conftest.file
1.1 root 677: fi
1.1.1.4 root 678: if grep ELF conftest.file >/dev/null; then
679: HAVEELF=yes
680: AC_MSG_RESULT(yes)
681: else
1.1 root 682: AC_MSG_RESULT(no)
1.1.1.4 root 683: fi
684: else
685: AC_MSG_RESULT(overriden: $SYSTEM_IS_ELF)
686: HAVEELF=$SYSTEM_IS_ELF
687: fi
688:
689: rm -f conftest*
690:
691: AC_ARG_ENABLE(threads,[ --enable-threads Enable filesystem thread support],[USE_THREADS=$enableval],[])
692: AC_ARG_ENABLE(penguins,[ --enable-penguins Enable threads that only make sense on SMP machines],[USE_PENGUINS=$enableval],[])
693:
694: if [[ "x$NEED_THREAD_SUPPORT" = "xyes" ]]; then
695: if [[ "x$USE_THREADS" != "xyes" -a "x$USE_PENGUINS" != "xyes" ]]; then
696: echo "The gtk+ GUI needs threads; enabling thread support."
697: fi
698: fi
699:
700: if [[ "x$USE_THREADS" = "xyes" -o "x$USE_PENGUINS" = "xyes" -o "x$NEED_THREAD_SUPPORT" = "xyes" ]]; then
701: if [[ "x$HAVE_PTHREAD_LIB" = "xyes" ]]; then
702: THREADDEP=td-posix
703: CFLAGS="$CFLAGS -DSUPPORT_THREADS -D_REENTRANT"
704: LIBS="$LIBS -lpthread"
705: if [[ "x$HAVE_POSIX4_LIB" = "xyes" ]]; then
706: LIBS="$LIBS -lposix4"
707: fi
708:
709: if [[ "x$USE_THREADS" = "xyes" ]]; then
710: CFLAGS="$CFLAGS -DUAE_FILESYS_THREADS"
711: fi
712: if [[ "x$USE_PENGUINS" = "xyes" ]]; then
713: CFLAGS="$CFLAGS -DSUPPORT_PENGUINS"
714: fi
715:
716: if [[ "x$HAVELINUX" = "xno" -o "x$HAVEGLIBC2" = "xno" ]]; then
717: echo "*** Thread support has only been tested on Linux systems with glibc-2.0"
718: echo "*** There are known problems with libc5-based Linux systems and threads!"
719: if [[ "x$NEED_THREAD_SUPPORT" = "xyes" ]]; then
720: echo "*** Use 'configure --disable-ui' if you have problems."
721: fi
722: NR_WARNINGS=`expr $NR_WARNINGS + 1`
723: fi
724: if [[ "x$TARGET" = "xsvgalib" ]]; then
725: echo "If you didn't compile a fixed version of SVGAlib then thread support"
726: echo "in UAE will lock your machine real hard."
727: NR_WARNINGS=`expr $NR_WARNINGS + 1`
728: fi
1.1 root 729: else
1.1.1.4 root 730: echo "You tried to enable threads, but I couldn't find a thread library!"
731: NR_ERRORS=`expr $NR_ERRORS + 1`
1.1 root 732: fi
1.1.1.3 root 733: fi
734:
1.1.1.4 root 735: dnl See if we have something better than GCC 2.7.
736:
737: if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
738: SAVECFLAGS=$CFLAGS
739: CFLAGS="$CFLAGS -mno-schedule-prologue"
740: AC_TRY_COMPILE(,int main(){return 0;}, NO_SCHED_CFLAGS="-mno-schedule-prologue")
741: CFLAGS=$SAVECFLAGS
742: fi
743:
744: dnl If GCC supports exceptions, we don't want them.
745:
746: if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
747: SAVECFLAGS=$CFLAGS
748: CFLAGS="$CFLAGS -fno-exceptions"
749: NOEXCEPTIONS=no
750: AC_TRY_COMPILE(,int main(){return 0;}, NOEXCEPTIONS=yes)
751: if [[ "x$NOEXCEPTIONS" = "xno" ]]; then
752: CFLAGS=$SAVECFLAGS
753: fi
754: fi
755:
756:
1.1.1.3 root 757: dnl Set up the link to the appropriate machdep directory and select something
758: dnl for the REGPARAM define.
759:
1.1.1.4 root 760: if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVEI386" = "xyes" -a "x$DO_PROFILING" = "xno" ]]; then
761: MACHDEP=md-i386-gcc
762: dnl strength-reduce is turned off not because of paranoia, but because it
763: dnl actually makes the code worse in some cases on the i386 (generates too
764: dnl many registers, which all end up on the stack).
765: CFLAGS="$CFLAGS -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -fno-strength-reduce -DREGPARAM=\"__attribute__((regparm(3)))\""
766: ASMOBJS=machdep/X86.o
767: CPUOBJS="cpufast.o"
768: if [[ "x$HAVEELF" != "xyes" ]]; then
769: CFLAGS="$CFLAGS -DUSE_UNDERSCORE"
770: fi
771: else if [[ "x$TARGET" = "xp_os" ]]; then
772: CPU=`uname -m`
773: if [[ "x$CPU" = "xm68k" ]]; then
774: MACHDEP=md-68k
775: CFLAGS="$CFLAGS -DREGPARAM=\"__attribute__((regparm(4)))\" -DM68K_FLAG_OPT=1"
776: else if [[ "x$CPU" = "xppc" ]]; then
777: MACHDEP=md-ppc
778: CFLAGS="$CFLAGS -DREGPARAM="
779: else if [[ "x$CPU" = "xi386" ]]; then
780: dnl Sam, I don't think we can get here.
781: MACHDEP=md-i386-gcc
782: CFLAGS="$CFLAGS -DX86_ASSEMBLY -fno-strength-reduce -DREGPARAM=\"__attribute__((regparm(3)))\""
783: else
784: echo "Unsupported CPU: $CPU!"
785: exit 5
786: fi
787: fi
788: fi
789: CFLAGS="$CFLAGS -nostdinc -I/gg/include -I/p/../inc -D__POS__"
790: OSDEP=od-pos
791: CPUOBJS="cpufast.o"
792: else if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVE68K" = "xyes" -a "x$TARGET" = "xamigaos" ]]; then
793: MACHDEP=md-68k
794: OSDEP=od-amiga
1.1.1.3 root 795: CFLAGS="$CFLAGS -DREGPARAM=\"__attribute__((regparm(4)))\" -DM68K_FLAG_OPT=1"
1.1.1.4 root 796: CPUOBJS="cpufast.o"
797: else if [[ "x$TARGET" = "xamigaos" ]]; then
798: dnl: sam: amigaos without gcc
799: MACHDEP=md-generic
800: OSDEP=od-amiga
801: CFLAGS="$CFLAGS -DREGPARAM="
802: else if [[ "x$HAVEGCC27" = "xyes" -a "x$HAVE68K" = "xyes" -a "x$DO_PROFILING" = "xno" ]]; then
803: dnl sam: This is for linux 68k (REGPARAM is not used under linux)
804: MACHDEP=md-68k
805: CFLAGS="$CFLAGS -DM68K_FLAG_OPT=1 -DREGPARAM="
806: CPUOBJS="cpufast.o"
807: else if [[ "x$TARGET" = "xbeos" ]]; then
808: MACHDEP=md-ppc
809: CFLAGS="$CFLAGS -DREGPARAM="
810: OSDEP=od-beos
1.1 root 811: else
1.1.1.3 root 812: CFLAGS="$CFLAGS -DREGPARAM="
813: fi
814: fi
1.1 root 815: fi
1.1.1.4 root 816: fi
817: fi
818: fi
1.1 root 819:
1.1.1.4 root 820: if [[ "x$HAVELINUX" = "xyes" ]]; then
821: OSDEP=od-linux
822: if [[ "x$HAVEGLIBC2" = "xyes" -a "x$HAVEI386" = "xyes" ]]; then
823: CFLAGS="$CFLAGS -DHAVE_GLIBC_2_LINUX"
824: fi
1.1.1.2 root 825: fi
826:
1.1.1.4 root 827: if [[ "x$TARGET" = "xx11" -o "x$TARGET" = "xsvgalib" -o "x$TARGET" = "xamigaos" \
828: -o "x$TARGET" = "xbeos" -o "x$TARGET" = "xasciiart" -o "x$TARGET" = "xggilib" -o "x$TARGET" = "xp_os" ]]; then
829: dnl On Unix, BeOS and AmigaOS system, zfile is supposed to work. Dunno about others.
1.1.1.3 root 830: CFLAGS="$CFLAGS -DUSE_ZFILE"
1.1.1.4 root 831: fi
832:
833: HAVE_USS_SOUND=no
834: if [[ "x$ac_cv_header_sys_soundcard_h" = "xyes" -o "x$ac_cv_header_machine_soundcard_h" = "xyes" ]]; then
835: dnl Avoid surprises
836: AC_MSG_CHECKING(whether sys/soundcard.h or machine/soundcard.h works)
837: AC_TRY_COMPILE([
838: #include "confdefs.h"
839: #ifdef HAVE_SYS_SOUNDCARD_H
840: #include <sys/soundcard.h>
841: #else
842: #include <machine/soundcard.h>
843: #endif
844: #include <sys/ioctl.h>
845: ],
846: [int soundfd; ioctl (soundfd, SNDCTL_DSP_GETFMTS, 0);],
847: AC_MSG_RESULT(yes)
848: HAVE_USS_SOUND=yes,
849: AC_MSG_RESULT(no))
850: fi
851:
852: AC_MSG_CHECKING(which sound system to use)
853: AC_ARG_ENABLE(sound,[ --enable-sound Enable sound support],[USE_SOUND=$enableval],[])
854: AC_ARG_ENABLE(file-sound,[ --enable-file-sound Enable sound output to file],[USE_FILE_SOUND=$enableval],[])
855:
856: if [[ "x$USE_FILE_SOUND" = "xyes" ]]; then
857: USE_SOUND=yes
858: fi
859:
860: if [[ "x$USE_SOUND" = "xno" ]]; then
861: AC_MSG_RESULT(sound not enabled)
862: else
863: if [[ "x$USE_FILE_SOUND" = "xyes" ]]; then
864: AC_MSG_RESULT(file output)
865: SOUNDDEP=sd-file
866: USE_SOUND=yes
867: else if [[ "x$HAVE_USS_SOUND" = "xyes" ]]; then
868: AC_MSG_RESULT(USS)
869: SOUNDDEP=sd-uss
870: USE_SOUND=yes
871: else if [[ "x$ac_cv_header_sys_audioio_h" = "xyes" -o "x$ac_cv_header_sun_audioio_h" = "xyes" ]]; then
872: AC_MSG_RESULT(Solaris/NetBSD)
873: SOUNDDEP=sd-solaris
874: USE_SOUND=yes
875: else if [[ "x$HAVE_AF_LIB" = "xyes" ]]; then
876: AC_MSG_RESULT(AF sound)
877: SOUNDDEP=sd-af
878: USE_SOUND=yes
879: else if [[ "x$TARGET" = "xp_os" ]]; then
880: AC_MSG_RESULT(pAudio.device)
881: SOUNDDEP=od-pos
882: USE_SOUND=yes
883: else if [[ "x$TARGET" = "xamigaos" ]]; then
884: AC_MSG_RESULT(Amiga audio.device)
885: SOUNDDEP=od-amiga
886: USE_SOUND=yes
887: else if [[ "x$TARGET" = "xbeos" ]]; then
888: AC_MSG_RESULT(BeOS sound)
889: SOUNDDEP=od-beos
890: USE_SOUND=yes
891: else
892: echo "no known sound system found"
893: NR_ERRORS=`expr $NR_ERRORS + 1`
894: fi
895: fi
896: fi
897: fi
898: fi
899: fi
900: fi
901: fi
902:
903: rm -f src/machdep
904: rm -f src/osdep
905: rm -f src/threaddep
906: rm -f src/sounddep
907: rm -f src/target.h
1.1.1.5 ! root 908: rm -f src/config.h
1.1.1.3 root 909:
1.1.1.4 root 910: if [[ "x$TARGET" = "xamigaos" -o "x$TARGET" = "xp_os" ]]; then
1.1.1.3 root 911: dnl Determine the cpu-type
912: AC_MSG_CHECKING(which CPU to use)
913: cpu=`cpu | cut -d' ' -f2`
914: AC_MSG_RESULT($cpu)
915: CFLAGS="$CFLAGS -m$cpu"
916:
917: dnl Is that correct for the fpu ?
918: AC_MSG_CHECKING(which FPU to use)
1.1.1.4 root 919: fpu=`cpu | cut -d' ' -f3 | grep '^6888[12]$'`
920: if [[ "x$fpu" != "x" ]]; then
921: dnl gcc only knows about 68881
922: AC_MSG_RESULT(68881)
923: CFLAGS="$CFLAGS -m68881"
1.1.1.3 root 924: else
925: AC_MSG_RESULT(none)
926: fi
927: fi
1.1.1.4 root 928:
1.1 root 929: AC_SUBST(ac_cv_c_inline)
1.1.1.4 root 930: AC_SUBST(NO_SCHED_CFLAGS)
1.1 root 931: AC_SUBST(STATFS_NO_ARGS)
932: AC_SUBST(STATBUF_BAVAIL)
933: AC_SUBST(LIBRARIES)
934: AC_SUBST(TARGET)
935: AC_SUBST(GFXOBJS)
936: AC_SUBST(ASMOBJS)
1.1.1.2 root 937: AC_SUBST(CPUOBJS)
1.1.1.3 root 938: AC_SUBST(DEBUGOBJS)
1.1.1.2 root 939: AC_SUBST(SET_MAKE)
1.1.1.3 root 940: AC_SUBST(MATHLIB)
1.1.1.4 root 941: AC_SUBST(SHM_SUPPORT_LINKS)
942:
1.1.1.3 root 943: AC_SUBST(top_srcdir)
1.1 root 944:
1.1.1.2 root 945: AC_OUTPUT(src/Makefile Makefile)
1.1.1.4 root 946: if [[ "x$DO_PROFILING" = "xyes" ]]; then
1.1.1.3 root 947: echo "Building a profiling version of UAE (select this option only if you know"
948: echo "what you are doing)"
949: fi
1.1.1.4 root 950:
951: dnl Create some more links and files.
952:
953: tmp_save_dir=`pwd`
954: cd $srcdir
955: abssrcdir=`pwd`
956: cd $tmp_save_dir
957:
958: dnl We removed those from the build directory above, so if the source
959: dnl directory still has them, something is fairly wrong.
960:
961: dnl This doesn't work with Solaris /bin/sh, neither do all the alternatives I
962: dnl tried. So disable this for 0.7.0.
963:
964: dnl if (test -e $abssrcdir/src/sounddep) || (test -e $abssrcdir/src/machdep) \
965: dnl || (test -e $abssrcdir/src/osdep) || (test -e $abssrcdir/src/threaddep) \
966: dnl || (test -e $abssrcdir/src/target.h)
967: dnl then
968: dnl echo
969: dnl echo "Fatal error: Can't configure in the current directory, because"
970: dnl echo "configure was run in the source directory. Go to the source"
971: dnl echo "directory, type"
972: dnl echo " make streifenfrei"
973: dnl echo "and try again."
974: dnl exit 1
975: dnl fi
976:
977:
978: ln -s $abssrcdir/src/$MACHDEP src/machdep
979: ln -s $abssrcdir/src/$OSDEP src/osdep
980: ln -s $abssrcdir/src/$THREADDEP src/threaddep
981: ln -s $abssrcdir/src/$SOUNDDEP src/sounddep
982: ln -s $abssrcdir/src/targets/$TARGETDEP src/target.h
1.1.1.5 ! root 983: ln -s $abssrcdir/config.h src/config.h
1.1.1.4 root 984:
985: echo
986: echo
987: if [[ "x$NR_ERRORS" = "x0" ]]; then
988: if [[ "x$NR_WARNINGS" = "x0" ]]; then
989: echo "Configuration was successful!"
990: else
991: echo "There were $NR_WARNINGS warnings. That is usually harmless, but read the output"
992: echo "from configure carefully if you run into problems."
993: fi
994: else
995: echo "There were $NR_ERRORS errors. UAE may still build and run cleanly, but you may"
996: echo "not get all the features you asked for."
997: fi
998: echo
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.