Commit | Line | Data |
---|---|---|
733943b9 | 1 | dnl Process this file with autoconf to produce configure. |
0f2d19dd | 2 | AC_INIT(Makefile.in) |
2d26def0 | 3 | . $srcdir/GUILE-VERSION |
3a629497 | 4 | AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define) |
15ae1bee | 5 | AM_MAINTAINER_MODE |
3a629497 | 6 | AM_CONFIG_HEADER(libguile/scmconfig.h) |
2d26def0 | 7 | |
3a629497 JB |
8 | #-------------------------------------------------------------------- |
9 | # | |
10 | # User options | |
11 | # | |
12 | #-------------------------------------------------------------------- | |
86789f9b | 13 | |
3a629497 JB |
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, | |
af8865f7 JB |
23 | [ --enable-dynamic-linking Include support for dynamic linking],, |
24 | enable_dynamic_linking=yes) | |
3a629497 JB |
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 | |
da88f0cb | 48 | AC_CHECK_HEADERS(libc.h limits.h malloc.h memory.h string.h regex.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) |
3a629497 JB |
49 | GUILE_HEADER_LIBC_WITH_UNISTD |
50 | ||
51 | AC_TYPE_GETGROUPS | |
52 | AC_TYPE_SIGNAL | |
53 | AC_TYPE_MODE_T | |
54 | ||
5852c051 | 55 | AC_CHECK_LIB(m, main) |
90fcac06 | 56 | AC_CHECK_LIB(rx, main) |
5852c051 JB |
57 | AC_CHECK_FUNC(gethostbyname) |
58 | if test $ac_cv_func_gethostbyname = no; then | |
59 | AC_CHECK_LIB(nsl, gethostbyname) | |
60 | fi | |
61 | AC_CHECK_FUNC(connect) | |
62 | if test $ac_cv_func_connect = no; then | |
63 | AC_CHECK_LIB(socket, connect) | |
64 | fi | |
65 | ||
90fcac06 JB |
66 | # Checks for dynamic linking |
67 | ||
5852c051 JB |
68 | if test "$enable_dynamic_linking" = "yes"; then |
69 | ||
70 | AC_CHECK_LIB(dl,dlopen) | |
71 | if test "$ac_cv_lib_dl_dlopen" = "yes"; then | |
5852c051 JB |
72 | AC_DEFINE(DYNAMIC_LINKING) |
73 | else | |
74 | AC_CHECK_LIB(dld,dld_link) | |
75 | if test "$ac_cv_lib_dld_dld_link" = "yes"; then | |
5852c051 JB |
76 | AC_DEFINE(DYNAMIC_LINKING) |
77 | else | |
78 | AC_CHECK_FUNCS(shl_load) | |
79 | if test "$ac_cv_func_shl_load" = "yes"; then | |
80 | AC_DEFINE(DYNAMIC_LINKING) | |
81 | fi | |
82 | fi | |
83 | fi | |
84 | ||
85 | fi | |
86 | ||
87 | ||
e1a191a8 GH |
88 | 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) |
89 | ||
da88f0cb JB |
90 | dnl <GNU-WIN32 hacks> |
91 | ||
92 | AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1) | |
93 | if test -n "$have_sys_un_h" ; then | |
94 | AC_DEFINE(HAVE_UNIX_DOMAIN_SOCKETS) | |
95 | fi | |
96 | ||
97 | AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset) | |
98 | ||
99 | cp confdefs.h confdefs.h.bak | |
100 | for func in sethostent endhostent getnetent setnetent endnetent getprotoent endprotoent getservent endservent getnetbyaddr getnetbyname inet_lnaof inet_makeaddr inet_netof ; do | |
101 | cp confdefs.h.bak confdefs.h | |
102 | cat >> confdefs.h << EOF | |
103 | #ifdef __CYGWIN32__ | |
104 | #define $func cygwin32_$func | |
105 | #endif | |
106 | EOF | |
107 | AC_CHECK_FUNC($func) | |
108 | done | |
109 | cp confdefs.h.bak confdefs.h | |
110 | ||
111 | dnl </GNU-WIN32 hacks> | |
112 | ||
e1a191a8 GH |
113 | AC_CACHE_CHECK([for restartable system calls], scm_cv_restarts, |
114 | if test $ac_cv_func_sigaction = yes; then | |
115 | [AC_TRY_COMPILE([#include <signal.h>], | |
116 | [int a = SA_RESTART], | |
117 | scm_cv_restarts=yes, | |
118 | scm_cv_restarts=no)] | |
119 | else | |
120 | scm_cv_restarts=no | |
121 | fi) | |
122 | if test $scm_cv_restarts = yes; then | |
123 | AC_DEFINE(HAVE_RESTARTS) | |
124 | fi | |
125 | ||
da88f0cb JB |
126 | if test "$ac_cv_header_regex_h" = yes; then |
127 | AC_CHECK_FUNCS(regcomp, [LIBOBJS="regex-posix.o $LIBOBJS"]) | |
128 | fi | |
8e1bfcd0 | 129 | |
3a629497 JB |
130 | AC_REPLACE_FUNCS(inet_aton putenv strerror) |
131 | ||
4a5fa91c TP |
132 | # When testing for the presence of alloca, we need to add alloca.o |
133 | # explicitly to LIBOBJS to make sure that it is translated to | |
134 | # `alloca.lo' for libtool later on. This can and should be done more cleanly. | |
3a629497 | 135 | AC_FUNC_ALLOCA |
4a5fa91c | 136 | if test "$ALLOCA" = "alloca.o"; then LIBOBJS="alloca.o $LIBOBJS"; fi |
3a629497 JB |
137 | |
138 | AC_STRUCT_ST_RDEV | |
139 | AC_STRUCT_ST_BLKSIZE | |
075edbde JB |
140 | |
141 | # We could use AC_STRUCT_ST_BLOCKS here, but that adds fileblocks.o to | |
142 | # LIBOBJS, which we don't need. This seems more direct. | |
143 | AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks, | |
144 | [AC_TRY_COMPILE([#include <sys/types.h> | |
145 | #include <sys/stat.h>], [struct stat s; s.st_blocks;], | |
146 | ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)]) | |
147 | if test $ac_cv_struct_st_blocks = yes; then | |
148 | AC_DEFINE(HAVE_ST_BLOCKS) | |
149 | fi | |
150 | ||
3a629497 JB |
151 | AC_STRUCT_TIMEZONE |
152 | GUILE_STRUCT_UTIMBUF | |
153 | ||
3a629497 JB |
154 | #-------------------------------------------------------------------- |
155 | # | |
156 | # Which way does the stack grow? | |
157 | # | |
158 | #-------------------------------------------------------------------- | |
159 | ||
160 | AC_TRY_RUN(aux (l) unsigned long l; | |
161 | { int x; exit (l >= ((unsigned long)&x)); } | |
162 | main () { int q; aux((unsigned long)&q); }, | |
163 | AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in)) | |
164 | ||
165 | ||
166 | AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); }, | |
167 | AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES) | |
168 | AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in)) | |
169 | ||
170 | AC_MSG_CHECKING(for struct linger) | |
171 | AC_CACHE_VAL(scm_cv_struct_linger, | |
172 | AC_TRY_COMPILE([ | |
173 | #include <sys/types.h> | |
174 | #include <sys/socket.h>], | |
175 | [struct linger lgr; lgr.l_linger = 100], | |
176 | scm_cv_struct_linger="yes", | |
177 | scm_cv_struct_linger="no")) | |
178 | AC_MSG_RESULT($scm_cv_struct_linger) | |
179 | if test $scm_cv_struct_linger = yes; then | |
180 | AC_DEFINE(HAVE_STRUCT_LINGER) | |
181 | fi | |
182 | ||
183 | #-------------------------------------------------------------------- | |
184 | # | |
185 | # How can you violate a stdio abstraction by setting a stream's fd? | |
186 | # | |
187 | #-------------------------------------------------------------------- | |
188 | ||
189 | AC_MSG_CHECKING(how to set a stream file descriptor) | |
190 | AC_CACHE_VAL(scm_cv_fd_setter, | |
191 | AC_TRY_COMPILE([#include <stdio.h>], | |
192 | [stdout->_file = 1], | |
193 | scm_cv_fd_setter="_file", | |
194 | AC_TRY_COMPILE([#include <stdio.h>], | |
195 | [stdout->_fileno = 1], | |
196 | scm_cv_fd_setter="_fileno", | |
197 | scm_cv_fd_setter=""))) | |
198 | ||
199 | if test "$scm_cv_fd_setter"; then | |
200 | AC_MSG_RESULT($scm_cv_fd_setter) | |
201 | AC_DEFINE_UNQUOTED(FD_SETTER, $scm_cv_fd_setter) | |
202 | else | |
203 | AC_MSG_RESULT(we couldn't do it!) | |
204 | fi | |
205 | ||
206 | #-------------------------------------------------------------------- | |
207 | # How to find out whether a FILE structure contains buffered data. | |
208 | # From Tk we have the following list: | |
209 | # _cnt: Most UNIX systems | |
210 | # __cnt: HPUX | |
211 | # _r: BSD | |
212 | # readCount: Sprite | |
213 | # Or, in GNU libc there are two fields, _gptr and _egptr, which | |
214 | # have to be compared. | |
215 | # These can also be known as _IO_read_ptr and _IO_read_end. | |
216 | #-------------------------------------------------------------------- | |
217 | ||
218 | AC_MSG_CHECKING(how to get buffer char count from FILE structure) | |
219 | AC_CACHE_VAL(scm_cv_struct_file_count, | |
220 | AC_TRY_COMPILE([#include <stdio.h>], | |
221 | [FILE *f = stdin; f->_cnt = 0], | |
222 | scm_cv_struct_file_count="_cnt", | |
223 | AC_TRY_COMPILE([#include <stdio.h>], | |
224 | [FILE *f = stdin; f->_r = 0], | |
225 | scm_cv_struct_file_count="_r", | |
226 | AC_TRY_COMPILE([#include <stdio.h>], | |
227 | [FILE *f = stdin; f->readCount = 0], | |
228 | scm_cv_struct_file_count="readCount", | |
229 | scm_cv_struct_file_count="")))) | |
230 | if test "$scm_cv_struct_file_count"; then | |
231 | AC_MSG_RESULT($scm_cv_struct_file_count) | |
232 | AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count) | |
233 | else | |
234 | AC_CACHE_VAL(scm_cv_struct_file_gptr, | |
235 | AC_TRY_COMPILE([#include <stdio.h>], | |
236 | [FILE *f = stdin; f->_gptr = f->egptr;], | |
237 | scm_cv_struct_file_gptr=1, | |
238 | scm_cv_struct_file_gptr="")) | |
239 | if test "$scm_cv_struct_gptr"; then | |
240 | AC_MSG_RESULT(gptr) | |
241 | AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr) | |
242 | else | |
243 | AC_CACHE_VAL(scm_cv_struct_file_readptr, | |
244 | AC_TRY_COMPILE([#include <stdio.h>], | |
245 | [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;], | |
246 | scm_cv_struct_file_readptr=1)) | |
247 | if test "$scm_cv_struct_file_readptr"; then | |
248 | AC_MSG_RESULT(read_ptr) | |
249 | AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr) | |
250 | else | |
251 | AC_MSG_RESULT(we couldn't do it!) | |
252 | fi | |
253 | fi | |
254 | fi | |
255 | ||
256 | #-------------------------------------------------------------------- | |
257 | # | |
258 | # Flags for thread support | |
259 | # | |
260 | #-------------------------------------------------------------------- | |
261 | ||
262 | CY_AC_WITH_THREADS | |
263 | CFLAGS="$CFLAGS $cy_cv_threads_cflags" | |
264 | THREAD_LIBS="$cy_cv_threads_libs" | |
265 | AC_SUBST(THREAD_LIBS) | |
266 | ||
267 | dnl | |
268 | dnl Set the appropriate flags! | |
269 | dnl | |
270 | if test "$cy_cv_threads_package" = FSU; then | |
271 | AC_DEFINE(USE_FSU_PTHREADS, 1) | |
272 | else if test "$cy_cv_threads_package" = COOP; then | |
273 | AC_DEFINE(USE_COOP_THREADS, 1) | |
274 | else if test "$cy_cv_threads_package" = MIT; then | |
275 | AC_DEFINE(USE_MIT_PTHREADS, 1) | |
276 | else if test "$cy_cv_threads_package" = PCthreads; then | |
277 | AC_DEFINE(USE_PCTHREADS_PTHREADS, 1) | |
278 | else if test "$cy_cv_threads_package" = unknown; then | |
279 | AC_MSG_ERROR("cannot find threads installation") | |
280 | fi | |
281 | fi | |
282 | fi | |
0f2d19dd | 283 | fi |
3a629497 JB |
284 | fi |
285 | ||
286 | if test "$cy_cv_threads_package" != ""; then | |
287 | AC_DEFINE(USE_THREADS) | |
288 | LIBOBJS="$LIBOBJS threads.o" | |
289 | fi | |
290 | ||
291 | ## If we're using GCC, ask for aggressive warnings. | |
292 | case "$GCC" in | |
293 | yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;; | |
294 | esac | |
295 | ||
296 | AC_PROG_AWK | |
297 | ||
298 | ## If we're creating a shared library (using libtool!), then we'll | |
299 | ## need to generate a list of .lo files corresponding to the .o files | |
300 | ## given in LIBOBJS. We'll call it LIBLOBJS. | |
301 | LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`" | |
302 | ||
7c86ae05 JB |
303 | AC_SUBST(GUILE_MAJOR_VERSION) |
304 | AC_SUBST(GUILE_MINOR_VERSION) | |
305 | AC_SUBST(GUILE_VERSION) | |
306 | ||
307 | dnl timestamping the interpreter and scheme libraries: | |
308 | dnl | |
309 | dnl Help us notice when we're running one version of the Guile | |
310 | dnl interpreter against a different version of the ice-9 Scheme code. | |
311 | dnl This will definitely detect version skew due to differing | |
312 | dnl snapshots and releases, but may not catch skew for the developers. | |
313 | dnl Hopefully it will not detect skew when there is none; if that | |
314 | dnl happens, the warnings will be useless, and we should remove this. | |
315 | GUILE_STAMP="`date`" | |
316 | AC_SUBST(GUILE_STAMP) | |
3a629497 JB |
317 | |
318 | AC_SUBST(AWK) | |
319 | AC_SUBST(LIBLOBJS) | |
320 | ||
321 | ||
322 | dnl ====================================================================== | |
323 | dnl configuration for the Qt package | |
324 | dnl ====================================================================== | |
325 | ||
326 | threads_enabled=false | |
327 | if test "$cy_cv_threads_package" = COOP; then | |
328 | threads_enabled=true | |
329 | fi | |
330 | ||
331 | # Determine the host we are working on | |
332 | AC_CANONICAL_HOST | |
333 | ||
77c7a433 JB |
334 | # How can we refer to the qt source directory from within the qt build |
335 | # directory? For headers, we can rely on the fact that the qt src | |
336 | # directory appears in the #include path. | |
337 | ||
338 | qtsrcdir="`(cd $srcdir; pwd)`/qt" | |
339 | ||
3a629497 JB |
340 | changequote(,)dnl We use [ and ] in a regexp in the case |
341 | case "$host" in | |
342 | i[3456]86-*-*) | |
77c7a433 JB |
343 | qtmds_s=$qtsrcdir/md/i386.s |
344 | qtmd_h=md/i386.h | |
345 | qtmdc_c=$qtsrcdir/md/null.c | |
3a629497 JB |
346 | ;; |
347 | mips-sgi-irix5*) | |
77c7a433 JB |
348 | qtmds_s=$qtsrcdir/md/mips-irix5.s |
349 | qtmd_h=md/mips.h | |
350 | qtmdc_c=$qtsrcdir/md/null.c | |
351 | qtdmdb_s=$qtsrcdir/md/mips_b.s | |
3a629497 JB |
352 | ;; |
353 | mips-*-*) | |
77c7a433 JB |
354 | qtmds_s=$qtsrcdir/md/mips.s |
355 | qtmd_h=md/mips.h | |
356 | qtmdc_c=$qtsrcdir/md/null.c | |
357 | qtdmdb_s=$qtsrcdir/md/mips_b.s | |
3a629497 | 358 | ;; |
2a18e748 | 359 | sparc-*-sunos*) |
77c7a433 JB |
360 | qtmd_h=md/sparc.h |
361 | qtmdc_c=$qtsrcdir/md/null.c | |
2a18e748 JB |
362 | qtmds_s=$qtsrcdir/md/_sparc.s |
363 | qtdmdb_s=$qtsrcdir/md/_sparc_b.s | |
3a629497 JB |
364 | ;; |
365 | sparc-*-*) | |
77c7a433 JB |
366 | qtmd_h=md/sparc.h |
367 | qtmdc_c=$qtsrcdir/md/null.c | |
2a18e748 JB |
368 | qtmds_s=$qtsrcdir/md/sparc.s |
369 | qtdmdb_s=$qtsrcdir/md/sparc_b.s | |
3a629497 JB |
370 | ;; |
371 | *) | |
372 | echo "Unknown configuration; threads package disabled" | |
373 | threads_enabled=false | |
374 | ;; | |
375 | esac | |
376 | changequote([, ]) | |
377 | ||
378 | ||
379 | if $threads_enabled; then | |
380 | target_libs=libqt.a | |
381 | else | |
382 | target_libs= | |
383 | fi | |
384 | ||
385 | # Give the Makefile the names of the object files that will be | |
386 | # generated by compiling $qtmdc_c and $qtmds_s. | |
387 | qtmdc_o="`echo ${qtmdc_c} | sed -e 's:^.*/::' | sed -e 's:\.c$:\.o:'`" | |
388 | qtmds_o="`echo ${qtmds_s} | sed -e 's:^.*/::' | sed -e 's:\.s$:\.o:'`" | |
389 | ||
390 | AC_SUBST(target_libs) | |
391 | AC_SUBST(qtmd_h) | |
392 | AC_SUBST(qtmdc_c) | |
393 | AC_SUBST(qtmdc_o) | |
394 | AC_SUBST(qtmds_s) | |
395 | AC_SUBST(qtmds_o) | |
396 | AC_SUBST(qtmdb_s) | |
0f2d19dd | 397 | |
7c86ae05 | 398 | 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]) |
0f2d19dd | 399 | |
3a629497 JB |
400 | dnl Local Variables: |
401 | dnl comment-start: "dnl " | |
402 | dnl comment-end: "" | |
403 | dnl comment-start-skip: "\\bdnl\\b\\s *" | |
404 | dnl End: |