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