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