Revert Marcus's changes; will re-apply when we get papers.
[bpt/guile.git] / configure.in
1 dnl Process this file with autoconf to produce configure.
2 AC_INIT(Makefile.in)
3 . $srcdir/GUILE-VERSION
4 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
5 AM_MAINTAINER_MODE
6 AM_CONFIG_HEADER(libguile/scmconfig.h)
7
8 #--------------------------------------------------------------------
9 #
10 # User options
11 #
12 #--------------------------------------------------------------------
13
14 AC_ARG_ENABLE(debug,
15 [ --disable-debug Don't include debugging support])
16 if test "$enableval" != n && test "$enableval" != no; then
17 AC_DEFINE(DEBUG_EXTENSIONS)
18 AC_DEFINE(READER_EXTENSIONS)
19 LIBOBJS="backtrace.o stacks.o debug.o srcprop.o $LIBOBJS"
20 fi
21
22 AC_ARG_ENABLE(dynamic-linking,
23 [ --enable-dynamic-linking Include support for dynamic linking],,
24 enable_dynamic_linking=yes)
25
26 AC_ARG_ENABLE(guile-debug,
27 [ --enable-guile-debug Include internal debugging functions])
28 if test "$enableval" = y || test "$enableval" = yes; then
29 AC_DEFINE(GUILE_DEBUG)
30 fi
31
32 #--------------------------------------------------------------------
33
34 AC_PROG_CC
35 AC_PROG_CPP
36 AM_PROG_LIBTOOL
37
38 AC_AIX
39 AC_ISC_POSIX
40 AC_MINIX
41
42 AC_C_CONST
43
44 AC_HEADER_STDC
45 AC_HEADER_DIRENT
46 AC_HEADER_TIME
47 AC_HEADER_SYS_WAIT
48 AC_CHECK_HEADERS(libc.h limits.h malloc.h memory.h string.h sys/ioctl.h sys/select.h sys/time.h sys/timeb.h sys/times.h sys/types.h sys/utime.h time.h unistd.h utime.h)
49 GUILE_HEADER_LIBC_WITH_UNISTD
50
51 AC_TYPE_GETGROUPS
52 AC_TYPE_SIGNAL
53 AC_TYPE_MODE_T
54
55 AC_CHECK_LIB(rx, main)
56
57 # Checks for dynamic linking
58
59 AC_CHECK_LIB(m, main)
60 AC_CHECK_FUNC(gethostbyname)
61 if test $ac_cv_func_gethostbyname = no; then
62 AC_CHECK_LIB(nsl, gethostbyname)
63 fi
64 AC_CHECK_FUNC(connect)
65 if test $ac_cv_func_connect = no; then
66 AC_CHECK_LIB(socket, connect)
67 fi
68
69 if test "$enable_dynamic_linking" = "yes"; then
70
71 AC_CHECK_LIB(dl,dlopen)
72 if test "$ac_cv_lib_dl_dlopen" = "yes"; then
73 AC_DEFINE(DYNAMIC_LINKING)
74 else
75 AC_CHECK_LIB(dld,dld_link)
76 if test "$ac_cv_lib_dld_dld_link" = "yes"; then
77 AC_DEFINE(DYNAMIC_LINKING)
78 else
79 AC_CHECK_FUNCS(shl_load)
80 if test "$ac_cv_func_shl_load" = "yes"; then
81 AC_DEFINE(DYNAMIC_LINKING)
82 fi
83 fi
84 fi
85
86 fi
87
88
89 AC_CHECK_FUNCS(ctermid ftime getcwd geteuid gethostent gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid)
90
91 AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts,
92 if test $ac_cv_func_sigaction = yes; then
93 [AC_TRY_COMPILE([#include <signal.h>],
94 [int a = SA_RESTART],
95 scm_cv_restarts=yes,
96 scm_cv_restarts=no)]
97 else
98 scm_cv_restarts=no
99 fi)
100 if test $scm_cv_restarts = yes; then
101 AC_DEFINE(HAVE_RESTARTS)
102 fi
103
104 AC_CHECK_FUNCS(regcomp, [LIBOBJS="regex-posix.o $LIBOBJS"])
105
106 AC_REPLACE_FUNCS(inet_aton putenv strerror)
107
108 AC_FUNC_ALLOCA
109
110 AC_STRUCT_ST_RDEV
111 AC_STRUCT_ST_BLKSIZE
112
113 # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to
114 # LIBOBJS, which we don't need. This seems more direct.
115 AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
116 [AC_TRY_COMPILE([#include <sys/types.h>
117 #include <sys/stat.h>], [struct stat s; s.st_blocks;],
118 ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
119 if test $ac_cv_struct_st_blocks = yes; then
120 AC_DEFINE(HAVE_ST_BLOCKS)
121 fi
122
123 AC_STRUCT_TIMEZONE
124 GUILE_STRUCT_UTIMBUF
125
126 #--------------------------------------------------------------------
127 #
128 # Which way does the stack grow?
129 #
130 #--------------------------------------------------------------------
131
132 AC_TRY_RUN(aux (l) unsigned long l;
133 { int x; exit (l >= ((unsigned long)&x)); }
134 main () { int q; aux((unsigned long)&q); },
135 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
136
137
138 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
139 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
140 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
141
142 AC_MSG_CHECKING(for struct linger)
143 AC_CACHE_VAL(scm_cv_struct_linger,
144 AC_TRY_COMPILE([
145 #include <sys/types.h>
146 #include <sys/socket.h>],
147 [struct linger lgr; lgr.l_linger = 100],
148 scm_cv_struct_linger="yes",
149 scm_cv_struct_linger="no"))
150 AC_MSG_RESULT($scm_cv_struct_linger)
151 if test $scm_cv_struct_linger = yes; then
152 AC_DEFINE(HAVE_STRUCT_LINGER)
153 fi
154
155 #--------------------------------------------------------------------
156 #
157 # How can you violate a stdio abstraction by setting a stream's fd?
158 #
159 #--------------------------------------------------------------------
160
161 AC_MSG_CHECKING(how to set a stream file descriptor)
162 AC_CACHE_VAL(scm_cv_fd_setter,
163 AC_TRY_COMPILE([#include <stdio.h>],
164 [stdout->_file = 1],
165 scm_cv_fd_setter="_file",
166 AC_TRY_COMPILE([#include <stdio.h>],
167 [stdout->_fileno = 1],
168 scm_cv_fd_setter="_fileno",
169 scm_cv_fd_setter="")))
170
171 if test "$scm_cv_fd_setter"; then
172 AC_MSG_RESULT($scm_cv_fd_setter)
173 AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter)
174 else
175 AC_MSG_RESULT(we couldn't do it!)
176 fi
177
178 #--------------------------------------------------------------------
179 # How to find out whether a FILE structure contains buffered data.
180 # From Tk we have the following list:
181 # _cnt: Most UNIX systems
182 # __cnt: HPUX
183 # _r: BSD
184 # readCount: Sprite
185 # Or, in GNU libc there are two fields, _gptr and _egptr, which
186 # have to be compared.
187 # These can also be known as _IO_read_ptr and _IO_read_end.
188 #--------------------------------------------------------------------
189
190 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
191 AC_CACHE_VAL(scm_cv_struct_file_count,
192 AC_TRY_COMPILE([#include <stdio.h>],
193 [FILE *f = stdin; f->_cnt = 0],
194 scm_cv_struct_file_count="_cnt",
195 AC_TRY_COMPILE([#include <stdio.h>],
196 [FILE *f = stdin; f->_r = 0],
197 scm_cv_struct_file_count="_r",
198 AC_TRY_COMPILE([#include <stdio.h>],
199 [FILE *f = stdin; f->readCount = 0],
200 scm_cv_struct_file_count="readCount",
201 scm_cv_struct_file_count=""))))
202 if test "$scm_cv_struct_file_count"; then
203 AC_MSG_RESULT($scm_cv_struct_file_count)
204 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
205 else
206 AC_CACHE_VAL(scm_cv_struct_file_gptr,
207 AC_TRY_COMPILE([#include <stdio.h>],
208 [FILE *f = stdin; f->_gptr = f->egptr;],
209 scm_cv_struct_file_gptr=1,
210 scm_cv_struct_file_gptr=""))
211 if test "$scm_cv_struct_gptr"; then
212 AC_MSG_RESULT(gptr)
213 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
214 else
215 AC_CACHE_VAL(scm_cv_struct_file_readptr,
216 AC_TRY_COMPILE([#include <stdio.h>],
217 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
218 scm_cv_struct_file_readptr=1))
219 if test "$scm_cv_struct_file_readptr"; then
220 AC_MSG_RESULT(read_ptr)
221 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
222 else
223 AC_MSG_RESULT(we couldn't do it!)
224 fi
225 fi
226 fi
227
228 #--------------------------------------------------------------------
229 #
230 # Flags for thread support
231 #
232 #--------------------------------------------------------------------
233
234 CY_AC_WITH_THREADS
235 CFLAGS="$CFLAGS $cy_cv_threads_cflags"
236 THREAD_LIBS="$cy_cv_threads_libs"
237 AC_SUBST(THREAD_LIBS)
238
239 dnl
240 dnl Set the appropriate flags!
241 dnl
242 if test "$cy_cv_threads_package" = FSU; then
243 AC_DEFINE(USE_FSU_PTHREADS, 1)
244 else if test "$cy_cv_threads_package" = COOP; then
245 AC_DEFINE(USE_COOP_THREADS, 1)
246 else if test "$cy_cv_threads_package" = MIT; then
247 AC_DEFINE(USE_MIT_PTHREADS, 1)
248 else if test "$cy_cv_threads_package" = PCthreads; then
249 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
250 else if test "$cy_cv_threads_package" = unknown; then
251 AC_MSG_ERROR("cannot find threads installation")
252 fi
253 fi
254 fi
255 fi
256 fi
257
258 if test "$cy_cv_threads_package" != ""; then
259 AC_DEFINE(USE_THREADS)
260 LIBOBJS="$LIBOBJS threads.o"
261 fi
262
263 ## If we're using GCC, ask for aggressive warnings.
264 case "$GCC" in
265 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
266 esac
267
268 AC_PROG_AWK
269
270 ## If we're creating a shared library (using libtool!), then we'll
271 ## need to generate a list of .lo files corresponding to the .o files
272 ## given in LIBOBJS. We'll call it LIBLOBJS.
273 LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
274
275 AC_SUBST(GUILE_MAJOR_VERSION)
276 AC_SUBST(GUILE_MINOR_VERSION)
277 AC_SUBST(GUILE_VERSION)
278
279 dnl timestamping the interpreter and scheme libraries:
280 dnl
281 dnl Help us notice when we're running one version of the Guile
282 dnl interpreter against a different version of the ice-9 Scheme code.
283 dnl This will definitely detect version skew due to differing
284 dnl snapshots and releases, but may not catch skew for the developers.
285 dnl Hopefully it will not detect skew when there is none; if that
286 dnl happens, the warnings will be useless, and we should remove this.
287 GUILE_STAMP="`date`"
288 AC_SUBST(GUILE_STAMP)
289
290 AC_SUBST(AWK)
291 AC_SUBST(LIBLOBJS)
292
293
294 dnl ======================================================================
295 dnl configuration for the Qt package
296 dnl ======================================================================
297
298 threads_enabled=false
299 if test "$cy_cv_threads_package" = COOP; then
300 threads_enabled=true
301 fi
302
303 # Determine the host we are working on
304 AC_CANONICAL_HOST
305
306 # How can we refer to the qt source directory from within the qt build
307 # directory? For headers, we can rely on the fact that the qt src
308 # directory appears in the #include path.
309
310 qtsrcdir="`(cd $srcdir; pwd)`/qt"
311
312 changequote(,)dnl We use [ and ] in a regexp in the case
313 case "$host" in
314 i[3456]86-*-*)
315 qtmds_s=$qtsrcdir/md/i386.s
316 qtmd_h=md/i386.h
317 qtmdc_c=$qtsrcdir/md/null.c
318 ;;
319 mips-sgi-irix5*)
320 qtmds_s=$qtsrcdir/md/mips-irix5.s
321 qtmd_h=md/mips.h
322 qtmdc_c=$qtsrcdir/md/null.c
323 qtdmdb_s=$qtsrcdir/md/mips_b.s
324 ;;
325 mips-*-*)
326 qtmds_s=$qtsrcdir/md/mips.s
327 qtmd_h=md/mips.h
328 qtmdc_c=$qtsrcdir/md/null.c
329 qtdmdb_s=$qtsrcdir/md/mips_b.s
330 ;;
331 sparc-*-sunos*)
332 qtmd_h=md/sparc.h
333 qtmdc_c=$qtsrcdir/md/null.c
334 qtmds_s=$qtsrcdir/md/_sparc.s
335 qtdmdb_s=$qtsrcdir/md/_sparc_b.s
336 ;;
337 sparc-*-*)
338 qtmd_h=md/sparc.h
339 qtmdc_c=$qtsrcdir/md/null.c
340 qtmds_s=$qtsrcdir/md/sparc.s
341 qtdmdb_s=$qtsrcdir/md/sparc_b.s
342 ;;
343 *)
344 echo "Unknown configuration; threads package disabled"
345 threads_enabled=false
346 ;;
347 esac
348 changequote([, ])
349
350
351 if $threads_enabled; then
352 target_libs=libqt.a
353 else
354 target_libs=
355 fi
356
357 # Give the Makefile the names of the object files that will be
358 # generated by compiling $qtmdc_c and $qtmds_s.
359 qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`"
360 qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`"
361
362 AC_SUBST(target_libs)
363 AC_SUBST(qtmd_h)
364 AC_SUBST(qtmdc_c)
365 AC_SUBST(qtmdc_o)
366 AC_SUBST(qtmds_s)
367 AC_SUBST(qtmds_o)
368 AC_SUBST(qtmdb_s)
369
370 AC_OUTPUT([Makefile libguile/Makefile libguile/guile-snarf ice-9/Makefile ice-9/version.scm qt/Makefile qt/qt.h qt/md/Makefile qt/time/Makefile], [chmod +x libguile/guile-snarf])
371
372 dnl Local Variables:
373 dnl comment-start: "dnl "
374 dnl comment-end: ""
375 dnl comment-start-skip: "\\bdnl\\b\\s *"
376 dnl End: