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