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