ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.in
Revision: 1.8
Committed: 1999-10-21T13:19:21Z (25 years, 1 month ago) by cebix
Branch: MAIN
Changes since 1.7: +24 -10 lines
Log Message:
- added fbdev video code and SPARC assembly optimizations

File Contents

# User Rev Content
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.1 WANT_UI=yes
12 cebix 1.8 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 cebix 1.1 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 cebix 1.4 AC_PROG_CPP
19 cebix 1.1 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 cebix 1.6 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 cebix 1.1 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 cebix 1.8 if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
57 cebix 1.1 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no)
58     if [[ "x$HAVE_DGA" = "xno" ]]; then
59 cebix 1.8 AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
60     DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
61 cebix 1.1 else
62 cebix 1.8 DEFINES="$DEFINES -DENABLE_XF86_DGA=1"
63 cebix 1.1 LIBS="$LIBS -lXxf86dga"
64 cebix 1.8 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 cebix 1.1 fi
69 cebix 1.8 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 cebix 1.1 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 cebix 1.5 dnl Emulate semaphores with pthread mutexes
101     SEMSRCS="posix_sem.cpp"
102 cebix 1.1 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 cebix 1.8 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 cebix 1.1 fi
188     if [[ "x$SEMSRCS" != "x" ]]; then
189     SYSSRCS="$SYSSRCS $SEMSRCS"
190     fi
191    
192     dnl Defaults for UAE CPU.
193     CPUINCLUDES="-I../uae_cpu"
194     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"
195    
196     dnl Check for i386.
197     HAVE_I386=no
198     AC_MSG_CHECKING(for x86 target CPU)
199     AC_EGREP_CPP(yes,
200     [
201     #ifdef __i386__
202     yes
203     #endif
204     ], [AC_MSG_RESULT(yes); HAVE_I386=yes], AC_MSG_RESULT(no))
205    
206 cebix 1.3 dnl Check for GAS.
207 cebix 1.1 HAVE_GAS=no
208     AC_MSG_CHECKING(for GAS .p2align feature)
209     cat >conftest.S << EOF
210     .text
211     .p2align 5
212     EOF
213     if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
214     AC_MSG_RESULT($HAVE_GAS)
215    
216 cebix 1.3 dnl Check for GCC 2.7 or higher.
217 cebix 1.1 HAVE_GCC27=no
218     AC_MSG_CHECKING(for GCC 2.7 or higher)
219     AC_EGREP_CPP(yes,
220     [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
221     yes
222     #endif
223     ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
224    
225 cebix 1.3 dnl Set "-fomit-frame-pointer" on GCC.
226 cebix 1.1 if [[ "x$HAVE_GCC27" = "xyes" ]]; then
227     CFLAGS="$CFLAGS -fomit-frame-pointer"
228     CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
229     fi
230    
231 cebix 1.3 dnl Select appropriate CPU source and REGPARAM define.
232 cebix 1.1 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
233     DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
234     if [[ "x$HAVE_GAS" = "xyes" ]]; then
235     DEFINES="$DEFINES -DX86_ASSEMBLY"
236 cebix 1.7 CPUSRCS="$CPUSRCS cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
237 cebix 1.1 else
238 cebix 1.7 CPUSRCS="$CPUSRCS cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
239 cebix 1.1 fi
240     else
241 cebix 1.7 CPUSRCS="$CPUSRCS cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
242 cebix 1.1 fi
243    
244 cebix 1.3 dnl Generate Makefile.
245 cebix 1.1 AC_SUBST(DEFINES)
246     AC_SUBST(STATICLIBS)
247     AC_SUBST(SYSSRCS)
248     AC_SUBST(CPUINCLUDES)
249     AC_SUBST(CPUSRCS)
250     AC_OUTPUT(Makefile)
251     echo "Configuration done. Now type \"make\"."