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