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