ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.in
Revision: 1.5
Committed: 1999-10-15T12:27:24Z (25 years, 1 month ago) by cebix
Branch: MAIN
Changes since 1.4: +2 -7 lines
Log Message:
- removed unnecessary test for semget()

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     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 cebix 1.5 dnl Emulate semaphores with pthread mutexes
81     SEMSRCS="posix_sem.cpp"
82 cebix 1.1 else
83     LIBS="$LIBS -lposix4"
84     fi
85     fi
86    
87     dnl Checks for header files.
88     AC_HEADER_STDC
89     AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h)
90    
91     dnl Checks for typedefs, structures, and compiler characteristics.
92     AC_C_BIGENDIAN
93     AC_C_CONST
94     AC_C_INLINE
95     AC_CHECK_SIZEOF(short, 2)
96     AC_CHECK_SIZEOF(int, 4)
97     AC_CHECK_SIZEOF(long, 4)
98     AC_CHECK_SIZEOF(long long, 8)
99     AC_TYPE_OFF_T
100     AC_CHECK_TYPE(loff_t, off_t)
101     AC_TYPE_SIZE_T
102     AC_HEADER_TIME
103     AC_STRUCT_TM
104    
105     dnl Checks for library functions.
106     AC_CHECK_FUNCS(strdup cfmakeraw)
107     AC_CHECK_FUNCS(nanosleep clock_gettime timer_create)
108    
109     dnl Select system-dependant source files.
110     SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp"
111     if MACHINE=`uname -a 2>/dev/null`; then
112     case "$MACHINE" in
113     Linux*)
114     SYSSRCS="Linux/ether_linux.cpp Linux/scsi_linux.cpp Linux/audio_linux.cpp"
115     ;;
116     FreeBSD*3.*)
117     dnl Check for the CAM library
118     AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
119     if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
120     AC_MSG_ERROR([Cannot find libcam for SCSI management.])
121     else
122     dnl Check for the sys kernel includes
123     AC_CHECK_HEADER(/sys/cam/cam.h)
124     if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
125     dnl In this case I should fix this thing including a "patch"
126     dnl to access directly to the functions in the kernel :) --Orlando
127     AC_MSG_ERROR([Cannot find kernel includes for CAM library.])
128     fi
129     SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.cpp"
130     CXXFLAGS="$CXXFLAGS -I/sys"
131     CFLAGS="$CFLAGS -I/sys"
132     LIBS="$LIBS -lcam"
133     DEFINES="$DEFINES -DBSD_COMP -DCAM"
134     fi
135     ;;
136     FreeBSD*)
137     dnl Check for the SCSI library
138     AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no)
139     if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then
140     AC_MSG_ERROR([Cannot find libscsi for SCSI management.])
141     else
142     dnl Check for the sys kernel includes
143     AC_CHECK_HEADER(scsi.h sys/scsiio.h)
144     if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
145     AC_MSG_ERROR([Cannot find includes for the SCSI library.])
146     fi
147     SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.cpp"
148     LIBS="$LIBS -lscsi"
149     DEFINES="$DEFINES -DBSD_COMP"
150     fi
151     ;;
152     SunOS*)
153     SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp Solaris/audio_solaris.cpp"
154     DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
155     ;;
156     IRIX*)
157     SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp Irix/unaligned.c"
158     DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200"
159     LIBS="$LIBS -lm"
160     ;;
161     esac
162     if [[ "x$WANT_UI" = "xyes" ]]; then
163     SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp"
164     else
165     SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp"
166     fi
167     fi
168     if [[ "x$SEMSRCS" != "x" ]]; then
169     SYSSRCS="$SYSSRCS $SEMSRCS"
170     fi
171    
172     dnl Defaults for UAE CPU.
173     CPUINCLUDES="-I../uae_cpu"
174     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"
175    
176     dnl Check for i386.
177     HAVE_I386=no
178     AC_MSG_CHECKING(for x86 target CPU)
179     AC_EGREP_CPP(yes,
180     [
181     #ifdef __i386__
182     yes
183     #endif
184     ], [AC_MSG_RESULT(yes); HAVE_I386=yes], AC_MSG_RESULT(no))
185    
186 cebix 1.3 dnl Check for GAS.
187 cebix 1.1 HAVE_GAS=no
188     AC_MSG_CHECKING(for GAS .p2align feature)
189     cat >conftest.S << EOF
190     .text
191     .p2align 5
192     EOF
193     if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
194     AC_MSG_RESULT($HAVE_GAS)
195    
196 cebix 1.3 dnl Check for GCC 2.7 or higher.
197 cebix 1.1 HAVE_GCC27=no
198     AC_MSG_CHECKING(for GCC 2.7 or higher)
199     AC_EGREP_CPP(yes,
200     [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
201     yes
202     #endif
203     ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
204    
205 cebix 1.3 dnl Set "-fomit-frame-pointer" on GCC.
206 cebix 1.1 if [[ "x$HAVE_GCC27" = "xyes" ]]; then
207     CFLAGS="$CFLAGS -fomit-frame-pointer"
208     CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
209     fi
210    
211 cebix 1.3 dnl Select appropriate CPU source and REGPARAM define.
212 cebix 1.1 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
213     DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
214     if [[ "x$HAVE_GAS" = "xyes" ]]; then
215     DEFINES="$DEFINES -DX86_ASSEMBLY"
216     CPUSRCS="$CPUSRCS cpufast.s"
217     else
218     CPUSRCS="$CPUSRCS cpuemu.cpp"
219     fi
220     else
221     CPUSRCS="$CPUSRCS cpuemu.cpp"
222     fi
223    
224 cebix 1.3 dnl Generate Makefile.
225 cebix 1.1 AC_SUBST(DEFINES)
226     AC_SUBST(STATICLIBS)
227     AC_SUBST(SYSSRCS)
228     AC_SUBST(CPUINCLUDES)
229     AC_SUBST(CPUSRCS)
230     AC_OUTPUT(Makefile)
231     echo "Configuration done. Now type \"make\"."