1 |
cebix |
1.1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
|
|
dnl Written in 1999 by Christian Bauer et al. |
3 |
|
|
|
4 |
|
|
AC_INIT(main_unix.cpp) |
5 |
|
|
AC_PREREQ(2.12) |
6 |
|
|
AC_CONFIG_HEADER(config.h) |
7 |
|
|
|
8 |
|
|
dnl Options. |
9 |
cebix |
1.17 |
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_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes]) |
12 |
|
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
13 |
|
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
14 |
|
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
15 |
cebix |
1.1 |
|
16 |
|
|
dnl Checks for programs. |
17 |
|
|
AC_PROG_CC |
18 |
cebix |
1.4 |
AC_PROG_CPP |
19 |
cebix |
1.1 |
AC_PROG_CXX |
20 |
|
|
AC_PROG_MAKE_SET |
21 |
|
|
AC_PROG_INSTALL |
22 |
|
|
|
23 |
cebix |
1.11 |
dnl We use mon if possible. |
24 |
|
|
MONSRCS= |
25 |
|
|
AC_MSG_CHECKING(for mon) |
26 |
|
|
if grep mon_init ../../../mon/src/mon.h >/dev/null 2>/dev/null; then |
27 |
|
|
AC_MSG_RESULT(yes) |
28 |
cebix |
1.12 |
WANT_MON=yes |
29 |
cebix |
1.11 |
DEFINES="$DEFINES -DENABLE_MON=1" |
30 |
|
|
MONSRCS="../../../mon/src/mon.cpp ../../../mon/src/mon_6502.cpp ../../../mon/src/mon_68k.cpp ../../../mon/src/mon_8080.cpp ../../../mon/src/mon_cmd.cpp ../../../mon/src/mon_ppc.cpp ../../../mon/src/mon_x86.cpp" |
31 |
|
|
CXXFLAGS="$CXXFLAGS -I../../../mon/src" |
32 |
cebix |
1.14 |
AC_CHECK_LIB(readline, readline) |
33 |
|
|
AC_CHECK_HEADERS(readline/readline.h readline/history.h) |
34 |
cebix |
1.11 |
else |
35 |
|
|
AC_MSG_RESULT(no) |
36 |
cebix |
1.12 |
WANT_MON=no |
37 |
cebix |
1.11 |
DEFINES="$DEFINES -DENABLE_MON=0" |
38 |
|
|
fi |
39 |
|
|
|
40 |
cebix |
1.1 |
dnl Checks for libraries. |
41 |
cebix |
1.10 |
AC_CHECK_LIB(posix4, sem_init) |
42 |
|
|
|
43 |
|
|
dnl We need X11. |
44 |
cebix |
1.1 |
AC_PATH_XTRA |
45 |
|
|
if [[ "x$no_x" = "xyes" ]]; then |
46 |
|
|
AC_MSG_ERROR([You need X11 to run Basilisk II.]) |
47 |
|
|
fi |
48 |
|
|
CFLAGS="$CFLAGS $X_CFLAGS" |
49 |
|
|
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
50 |
|
|
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
51 |
|
|
|
52 |
cebix |
1.10 |
dnl We need pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL. |
53 |
|
|
AC_CHECK_LIB(pthread, pthread_create, , [ |
54 |
|
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
55 |
|
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
56 |
cebix |
1.6 |
AC_MSG_ERROR([You need pthreads to run Basilisk II.]) |
57 |
cebix |
1.10 |
]) |
58 |
|
|
]) |
59 |
|
|
]) |
60 |
|
|
|
61 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
62 |
|
|
SEMSRCS= |
63 |
|
|
AC_CHECK_FUNCS(sem_init, , [ |
64 |
|
|
SEMSRCS=posix_sem.cpp |
65 |
|
|
]) |
66 |
cebix |
1.1 |
|
67 |
cebix |
1.10 |
dnl We use DGA (XFree86 or fbdev) if possible. |
68 |
cebix |
1.8 |
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
69 |
cebix |
1.10 |
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
70 |
cebix |
1.8 |
DEFINES="$DEFINES -DENABLE_XF86_DGA=1" |
71 |
cebix |
1.1 |
LIBS="$LIBS -lXxf86dga" |
72 |
cebix |
1.8 |
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
73 |
|
|
AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.]) |
74 |
|
|
WANT_FBDEV_DGA=no |
75 |
|
|
fi |
76 |
cebix |
1.10 |
], [ |
77 |
|
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
78 |
cebix |
1.13 |
WANT_XF86_DGA=no |
79 |
cebix |
1.10 |
DEFINES="$DEFINES -DENABLE_XF86_DGA=0" |
80 |
|
|
]) |
81 |
cebix |
1.8 |
else |
82 |
|
|
DEFINES="$DEFINES -DENABLE_XF86_DGA=0" |
83 |
|
|
fi |
84 |
|
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
85 |
|
|
DEFINES="$DEFINES -DENABLE_FBDEV_DGA=1" |
86 |
|
|
else |
87 |
|
|
DEFINES="$DEFINES -DENABLE_FBDEV_DGA=0" |
88 |
cebix |
1.1 |
fi |
89 |
|
|
|
90 |
cebix |
1.17 |
dnl We use XFree86 VidMode if possible. |
91 |
|
|
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
92 |
|
|
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
93 |
|
|
DEFINES="$DEFINES -DENABLE_XF86_VIDMODE=1" |
94 |
|
|
LIBS="$LIBS -lXxf86vm" |
95 |
|
|
], [ |
96 |
|
|
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
97 |
|
|
WANT_XF86_VIDMODE=no |
98 |
|
|
DEFINES="$DEFINES -DENABLE_XF86_VIDMODE=0" |
99 |
|
|
]) |
100 |
|
|
fi |
101 |
|
|
|
102 |
cebix |
1.1 |
dnl We use GTK+ if possible. |
103 |
cebix |
1.10 |
UISRCS=../dummy/prefs_editor_dummy.cpp |
104 |
cebix |
1.14 |
if [[ "x$WANT_GTK" = "xyes" ]]; then |
105 |
cebix |
1.10 |
AM_PATH_GTK(1.2.0, [ |
106 |
|
|
DEFINES="$DEFINES -DENABLE_GTK=1" |
107 |
|
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
108 |
|
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
109 |
|
|
LIBS="$LIBS $GTK_LIBS" |
110 |
|
|
UISRCS=prefs_editor_gtk.cpp |
111 |
|
|
], [ |
112 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
113 |
cebix |
1.14 |
WANT_GTK=no |
114 |
cebix |
1.15 |
DEFINES="$DEFINES -DENABLE_GTK=0" |
115 |
cebix |
1.10 |
]) |
116 |
cebix |
1.1 |
fi |
117 |
|
|
|
118 |
cebix |
1.10 |
dnl We use ESD if possible. |
119 |
|
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
120 |
|
|
AM_PATH_ESD(0.2.8, [ |
121 |
|
|
DEFINES="$DEFINES -DENABLE_ESD=1" |
122 |
|
|
CFLAGS="$CFLAGS $ESD_CFLAGS" |
123 |
|
|
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
124 |
|
|
LIBS="$LIBS $ESD_LIBS" |
125 |
|
|
], [ |
126 |
|
|
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
127 |
|
|
WANT_ESD=no |
128 |
cebix |
1.15 |
DEFINES="$DEFINES -DENABLE_ESD=0" |
129 |
cebix |
1.10 |
]) |
130 |
cebix |
1.1 |
fi |
131 |
|
|
|
132 |
|
|
dnl Checks for header files. |
133 |
|
|
AC_HEADER_STDC |
134 |
|
|
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h) |
135 |
|
|
|
136 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
137 |
|
|
AC_C_BIGENDIAN |
138 |
|
|
AC_C_CONST |
139 |
|
|
AC_C_INLINE |
140 |
|
|
AC_CHECK_SIZEOF(short, 2) |
141 |
|
|
AC_CHECK_SIZEOF(int, 4) |
142 |
|
|
AC_CHECK_SIZEOF(long, 4) |
143 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
144 |
|
|
AC_TYPE_OFF_T |
145 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
146 |
|
|
AC_TYPE_SIZE_T |
147 |
|
|
AC_HEADER_TIME |
148 |
|
|
AC_STRUCT_TM |
149 |
|
|
|
150 |
|
|
dnl Checks for library functions. |
151 |
|
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
152 |
|
|
AC_CHECK_FUNCS(nanosleep clock_gettime timer_create) |
153 |
cebix |
1.10 |
AC_CHECK_FUNCS(pthread_cancel) |
154 |
cebix |
1.1 |
|
155 |
|
|
dnl Select system-dependant source files. |
156 |
|
|
SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp" |
157 |
|
|
if MACHINE=`uname -a 2>/dev/null`; then |
158 |
|
|
case "$MACHINE" in |
159 |
|
|
Linux*) |
160 |
cebix |
1.10 |
SYSSRCS="Linux/ether_linux.cpp Linux/scsi_linux.cpp audio_oss_esd.cpp" |
161 |
cebix |
1.1 |
;; |
162 |
|
|
FreeBSD*3.*) |
163 |
|
|
dnl Check for the CAM library |
164 |
|
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
165 |
|
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
166 |
|
|
AC_MSG_ERROR([Cannot find libcam for SCSI management.]) |
167 |
|
|
else |
168 |
|
|
dnl Check for the sys kernel includes |
169 |
|
|
AC_CHECK_HEADER(/sys/cam/cam.h) |
170 |
|
|
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
171 |
|
|
dnl In this case I should fix this thing including a "patch" |
172 |
|
|
dnl to access directly to the functions in the kernel :) --Orlando |
173 |
|
|
AC_MSG_ERROR([Cannot find kernel includes for CAM library.]) |
174 |
|
|
fi |
175 |
cebix |
1.10 |
SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp audio_oss_esd.cpp" |
176 |
cebix |
1.1 |
CXXFLAGS="$CXXFLAGS -I/sys" |
177 |
|
|
CFLAGS="$CFLAGS -I/sys" |
178 |
|
|
LIBS="$LIBS -lcam" |
179 |
|
|
DEFINES="$DEFINES -DBSD_COMP -DCAM" |
180 |
|
|
fi |
181 |
|
|
;; |
182 |
|
|
FreeBSD*) |
183 |
|
|
dnl Check for the SCSI library |
184 |
|
|
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no) |
185 |
|
|
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then |
186 |
|
|
AC_MSG_ERROR([Cannot find libscsi for SCSI management.]) |
187 |
|
|
else |
188 |
|
|
dnl Check for the sys kernel includes |
189 |
|
|
AC_CHECK_HEADER(scsi.h sys/scsiio.h) |
190 |
|
|
if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then |
191 |
|
|
AC_MSG_ERROR([Cannot find includes for the SCSI library.]) |
192 |
|
|
fi |
193 |
|
|
SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.cpp" |
194 |
|
|
LIBS="$LIBS -lscsi" |
195 |
|
|
DEFINES="$DEFINES -DBSD_COMP" |
196 |
|
|
fi |
197 |
|
|
;; |
198 |
|
|
SunOS*) |
199 |
|
|
SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp Solaris/audio_solaris.cpp" |
200 |
|
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
201 |
|
|
;; |
202 |
|
|
IRIX*) |
203 |
|
|
SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp Irix/unaligned.c" |
204 |
|
|
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200" |
205 |
|
|
LIBS="$LIBS -lm" |
206 |
|
|
;; |
207 |
|
|
esac |
208 |
cebix |
1.8 |
fi |
209 |
cebix |
1.11 |
SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS" |
210 |
cebix |
1.1 |
|
211 |
cebix |
1.9 |
dnl Check for i386 CPU. |
212 |
cebix |
1.1 |
HAVE_I386=no |
213 |
|
|
AC_MSG_CHECKING(for x86 target CPU) |
214 |
|
|
AC_EGREP_CPP(yes, |
215 |
|
|
[ |
216 |
|
|
#ifdef __i386__ |
217 |
|
|
yes |
218 |
|
|
#endif |
219 |
|
|
], [AC_MSG_RESULT(yes); HAVE_I386=yes], AC_MSG_RESULT(no)) |
220 |
|
|
|
221 |
cebix |
1.9 |
dnl Check for SPARC CPU. |
222 |
|
|
HAVE_SPARC=no |
223 |
|
|
AC_MSG_CHECKING(for SPARC target CPU) |
224 |
|
|
AC_EGREP_CPP(yes, |
225 |
|
|
[ |
226 |
|
|
#ifdef __sparc__ |
227 |
|
|
yes |
228 |
|
|
#endif |
229 |
|
|
], [AC_MSG_RESULT(yes); HAVE_SPARC=yes], AC_MSG_RESULT(no)) |
230 |
|
|
|
231 |
cebix |
1.3 |
dnl Check for GAS. |
232 |
cebix |
1.1 |
HAVE_GAS=no |
233 |
|
|
AC_MSG_CHECKING(for GAS .p2align feature) |
234 |
|
|
cat >conftest.S << EOF |
235 |
|
|
.text |
236 |
|
|
.p2align 5 |
237 |
|
|
EOF |
238 |
|
|
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi |
239 |
|
|
AC_MSG_RESULT($HAVE_GAS) |
240 |
|
|
|
241 |
cebix |
1.3 |
dnl Check for GCC 2.7 or higher. |
242 |
cebix |
1.1 |
HAVE_GCC27=no |
243 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
244 |
|
|
AC_EGREP_CPP(yes, |
245 |
|
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
246 |
|
|
yes |
247 |
|
|
#endif |
248 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
249 |
|
|
|
250 |
cebix |
1.9 |
dnl Set "-fomit-frame-pointer" on GCC 2.7 or higher. |
251 |
cebix |
1.1 |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
252 |
|
|
CFLAGS="$CFLAGS -fomit-frame-pointer" |
253 |
|
|
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer" |
254 |
|
|
fi |
255 |
|
|
|
256 |
cebix |
1.3 |
dnl Select appropriate CPU source and REGPARAM define. |
257 |
cebix |
1.12 |
WANT_X86_ASSEMBLY=no |
258 |
|
|
WANT_SPARC_V8_ASSEMBLY=no |
259 |
|
|
WANT_SPARC_V9_ASSEMBLY=no |
260 |
cebix |
1.9 |
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
261 |
cebix |
1.1 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
262 |
cebix |
1.9 |
dnl i386 CPU |
263 |
cebix |
1.1 |
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
264 |
|
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
265 |
cebix |
1.12 |
WANT_X86_ASSEMBLY=yes |
266 |
cebix |
1.1 |
DEFINES="$DEFINES -DX86_ASSEMBLY" |
267 |
cebix |
1.16 |
CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
268 |
cebix |
1.1 |
fi |
269 |
cebix |
1.9 |
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
270 |
|
|
dnl SPARC CPU |
271 |
|
|
case "$MACHINE" in |
272 |
|
|
SunOS*) |
273 |
|
|
AC_MSG_CHECKING(SPARC CPU architecture) |
274 |
|
|
SPARC_TYPE=`Solaris/which_sparc` |
275 |
|
|
AC_MSG_RESULT($SPARC_TYPE) |
276 |
|
|
case "$SPARC_TYPE" in |
277 |
|
|
SPARC_V8) |
278 |
cebix |
1.12 |
WANT_SPARC_V8_ASSEMBLY=yes |
279 |
cebix |
1.9 |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" |
280 |
|
|
CFLAGS="$CFLAGS -Wa,-Av8" |
281 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
282 |
|
|
;; |
283 |
|
|
SPARC_V9) |
284 |
cebix |
1.12 |
WANT_SPARC_V9_ASSEMBLY=yes |
285 |
cebix |
1.9 |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" |
286 |
|
|
CFLAGS="$CFLAGS -Wa,-Av9" |
287 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
288 |
|
|
;; |
289 |
|
|
esac |
290 |
|
|
;; |
291 |
|
|
esac |
292 |
cebix |
1.1 |
fi |
293 |
cebix |
1.9 |
|
294 |
|
|
dnl UAE CPU sources for all architectures. |
295 |
|
|
CPUINCLUDES="-I../uae_cpu" |
296 |
|
|
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp ../uae_cpu/fpp.cpp cpustbl.cpp cpudefs.cpp $CPUSRCS" |
297 |
cebix |
1.1 |
|
298 |
cebix |
1.3 |
dnl Generate Makefile. |
299 |
cebix |
1.1 |
AC_SUBST(DEFINES) |
300 |
|
|
AC_SUBST(SYSSRCS) |
301 |
|
|
AC_SUBST(CPUINCLUDES) |
302 |
|
|
AC_SUBST(CPUSRCS) |
303 |
|
|
AC_OUTPUT(Makefile) |
304 |
cebix |
1.12 |
|
305 |
|
|
dnl Print summary. |
306 |
|
|
echo |
307 |
|
|
echo Basilisk II configuration summary: |
308 |
|
|
echo |
309 |
|
|
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
310 |
cebix |
1.17 |
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
311 |
cebix |
1.12 |
echo fbdev DGA support ................ : $WANT_FBDEV_DGA |
312 |
|
|
echo ESD sound support ................ : $WANT_ESD |
313 |
cebix |
1.14 |
echo GTK user interface ............... : $WANT_GTK |
314 |
cebix |
1.12 |
echo mon debugger support ............. : $WANT_MON |
315 |
|
|
echo i386 assembly optimizations ...... : $WANT_X86_ASSEMBLY |
316 |
|
|
echo SPARC V8 assembly optimizations .. : $WANT_SPARC_V8_ASSEMBLY |
317 |
|
|
echo SPARC V9 assembly optimizations .. : $WANT_SPARC_V9_ASSEMBLY |
318 |
|
|
echo |
319 |
cebix |
1.1 |
echo "Configuration done. Now type \"make\"." |