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