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