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