1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
dnl Written in 2002 by Christian Bauer |
3 |
|
4 |
AC_INIT(main_unix.cpp) |
5 |
AC_PREREQ(2.12) |
6 |
AC_CONFIG_HEADER(config.h) |
7 |
|
8 |
dnl Options. |
9 |
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
10 |
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) |
11 |
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
12 |
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
13 |
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
14 |
|
15 |
dnl Checks for programs. |
16 |
AC_PROG_CC |
17 |
AC_PROG_CPP |
18 |
AC_PROG_CXX |
19 |
AC_PROG_MAKE_SET |
20 |
AC_PROG_INSTALL |
21 |
|
22 |
dnl Check for PowerPC target CPU. |
23 |
HAVE_PPC=no |
24 |
AC_MSG_CHECKING(for PowerPC target CPU) |
25 |
AC_EGREP_CPP(yes, |
26 |
[ |
27 |
#ifdef __powerpc__ |
28 |
yes |
29 |
#endif |
30 |
], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no)) |
31 |
|
32 |
dnl We use mon if possible. |
33 |
MONSRCS= |
34 |
if [[ "x$WANT_MON" = "xyes" ]]; then |
35 |
AC_MSG_CHECKING(for mon) |
36 |
mon_srcdir=../../../mon/src |
37 |
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
38 |
AC_MSG_RESULT(yes) |
39 |
AC_DEFINE(ENABLE_MON) |
40 |
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c" |
41 |
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
42 |
AC_CHECK_LIB(readline, readline) |
43 |
AC_CHECK_LIB(termcap, tputs) |
44 |
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
45 |
else |
46 |
AC_MSG_RESULT(no) |
47 |
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
48 |
WANT_MON=no |
49 |
fi |
50 |
fi |
51 |
|
52 |
dnl Checks for libraries. |
53 |
AC_CHECK_LIB(posix4, sem_init) |
54 |
|
55 |
dnl We need X11. |
56 |
AC_PATH_XTRA |
57 |
if [[ "x$no_x" = "xyes" ]]; then |
58 |
AC_MSG_ERROR([You need X11 to run SheepShaver.]) |
59 |
fi |
60 |
CFLAGS="$CFLAGS $X_CFLAGS" |
61 |
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
62 |
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
63 |
|
64 |
dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL. |
65 |
HAVE_PTHREADS=yes |
66 |
if [[ "x$HAVE_PPC" = "xno" ]]; then |
67 |
AC_CHECK_LIB(pthread, pthread_create, , [ |
68 |
AC_CHECK_LIB(c_r, pthread_create, , [ |
69 |
AC_CHECK_LIB(PTL, pthread_create, , [ |
70 |
AC_MSG_ERROR([You need pthreads to run Basilisk II.]) |
71 |
]) |
72 |
]) |
73 |
]) |
74 |
AC_CHECK_FUNCS(pthread_cancel) |
75 |
fi |
76 |
|
77 |
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
78 |
SEMSRC= |
79 |
AC_CHECK_FUNCS(sem_init, , [ |
80 |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
81 |
SEMSRC=posix_sem.cpp |
82 |
fi |
83 |
]) |
84 |
|
85 |
dnl We use XFree86 DGA if possible. |
86 |
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
87 |
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
88 |
AC_DEFINE(ENABLE_XF86_DGA) |
89 |
LIBS="$LIBS -lXxf86dga" |
90 |
], [ |
91 |
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
92 |
WANT_XF86_DGA=no |
93 |
]) |
94 |
fi |
95 |
|
96 |
dnl We use XFree86 VidMode if possible. |
97 |
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
98 |
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
99 |
AC_DEFINE(ENABLE_XF86_VIDMODE) |
100 |
LIBS="$LIBS -lXxf86vm" |
101 |
], [ |
102 |
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
103 |
WANT_XF86_VIDMODE=no |
104 |
]) |
105 |
fi |
106 |
|
107 |
dnl We use GTK+ if possible. |
108 |
UISRCS= |
109 |
if [[ "x$WANT_GTK" = "xyes" ]]; then |
110 |
AM_PATH_GTK(1.2.0, [ |
111 |
AC_DEFINE(ENABLE_GTK) |
112 |
CFLAGS="$CFLAGS $GTK_CFLAGS" |
113 |
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
114 |
LIBS="$LIBS $GTK_LIBS" |
115 |
UISRCS=prefs_editor_gtk.cpp |
116 |
], [ |
117 |
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
118 |
WANT_GTK=no |
119 |
]) |
120 |
fi |
121 |
|
122 |
dnl We use ESD if possible. |
123 |
if [[ "x$WANT_ESD" = "xyes" ]]; then |
124 |
AM_PATH_ESD(0.2.8, [ |
125 |
AC_DEFINE(ENABLE_ESD) |
126 |
CFLAGS="$CFLAGS $ESD_CFLAGS" |
127 |
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
128 |
LIBS="$LIBS $ESD_LIBS" |
129 |
], [ |
130 |
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
131 |
WANT_ESD=no |
132 |
]) |
133 |
fi |
134 |
|
135 |
dnl Checks for header files. |
136 |
AC_HEADER_STDC |
137 |
AC_HEADER_SYS_WAIT |
138 |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h) |
139 |
|
140 |
dnl Checks for typedefs, structures, and compiler characteristics. |
141 |
AC_C_BIGENDIAN |
142 |
AC_C_CONST |
143 |
AC_C_INLINE |
144 |
AC_CHECK_SIZEOF(short, 2) |
145 |
AC_CHECK_SIZEOF(int, 4) |
146 |
AC_CHECK_SIZEOF(long, 4) |
147 |
AC_CHECK_SIZEOF(long long, 8) |
148 |
AC_TYPE_OFF_T |
149 |
AC_CHECK_TYPE(loff_t, off_t) |
150 |
AC_TYPE_SIZE_T |
151 |
AC_HEADER_TIME |
152 |
AC_STRUCT_TM |
153 |
|
154 |
dnl Checks for library functions. |
155 |
AC_CHECK_FUNCS(strdup cfmakeraw) |
156 |
AC_CHECK_FUNCS(nanosleep clock_gettime timer_create) |
157 |
|
158 |
dnl Select system-dependant sources. |
159 |
if [[ "x$HAVE_PPC" = "xyes" ]]; then |
160 |
SYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S" |
161 |
else |
162 |
SYSSRCS="../emul_ppc/emul_ppc.cpp" |
163 |
fi |
164 |
SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS" |
165 |
|
166 |
dnl Generate Makefile. |
167 |
AC_SUBST(SYSSRCS) |
168 |
AC_OUTPUT(Makefile) |
169 |
|
170 |
dnl Print summary. |
171 |
echo |
172 |
echo SheepShaver configuration summary: |
173 |
echo |
174 |
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
175 |
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
176 |
echo ESD sound support ................ : $WANT_ESD |
177 |
echo GTK user interface ............... : $WANT_GTK |
178 |
echo mon debugger support ............. : $WANT_MON |
179 |
echo |
180 |
echo "Configuration done. Now type \"make\"." |