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