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