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