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