* * backtrace.c (scm_display_application): New procedure:
[bpt/guile.git] / libguile / configure.in
CommitLineData
0f2d19dd 1AC_INIT(eval.c)
733943b9
TT
2AM_CONFIG_HEADER(scmconfig.h)
3AM_INIT_GUILE_MODULE(libguile)
15ae1bee 4AM_MAINTAINER_MODE
0f2d19dd 5
074657b0
MD
6#--------------------------------------------------------------------
7#
8# User options
9#
10#--------------------------------------------------------------------
11
12AC_ARG_ENABLE(debug,
13[ --disable-debug Don't include debugging support])
14if test "$enableval" != n && test "$enableval" != no; then
15 AC_DEFINE(DEBUG_EXTENSIONS)
16 AC_DEFINE(READER_EXTENSIONS)
9ab71a53 17 LIBOBJS="backtrace.o stacks.o debug.o srcprop.o $LIBOBJS"
074657b0
MD
18fi
19
abb2a7d0
MV
20AC_ARG_ENABLE(dynamic-linking,
21 [ --enable-dynamic-linking Include support for dynamic linking])
abb2a7d0 22
074657b0
MD
23#--------------------------------------------------------------------
24
0f2d19dd
JB
25AC_PROG_CC
26AC_PROG_CPP
1bb9f4db 27AM_PROG_LIBTOOL
0f2d19dd
JB
28
29AC_AIX
30AC_ISC_POSIX
31AC_MINIX
32
027fde39 33CY_AC_WITH_THREADS
027fde39 34
0f2d19dd
JB
35AC_C_CONST
36
37AC_HEADER_STDC
38AC_HEADER_DIRENT
39AC_HEADER_TIME
40AC_HEADER_SYS_WAIT
2170fce3 41AC_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)
3594582b 42GUILE_HEADER_LIBC_WITH_UNISTD
0f2d19dd
JB
43
44AC_TYPE_GETGROUPS
45AC_TYPE_SIGNAL
b09ca643 46AC_TYPE_MODE_T
0f2d19dd 47
1fd838af 48AC_CHECK_FUNCS(ctermid ftime getcwd geteuid lstat mkdir mknod nice putenv readlink rename rmdir select setegid seteuid setlocale setpgid setsid strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid)
0f2d19dd 49
14a7e04c 50AC_REPLACE_FUNCS(inet_aton strerror)
0f2d19dd 51
48b96f4b
JB
52AC_FUNC_ALLOCA
53
0f2d19dd
JB
54AC_STRUCT_ST_RDEV
55AC_STRUCT_ST_BLKSIZE
56AC_STRUCT_ST_BLOCKS
2170fce3 57GUILE_STRUCT_UTIMBUF
0f2d19dd 58
abb2a7d0 59# Checks for dynamic linking
5c988700
MV
60
61xtra_PLUGIN_guile_libs=""
62AC_SUBST(xtra_PLUGIN_guile_libs)
63
64if test "$enable_dynamic_linking" = "yes"; then
65
abb2a7d0 66AC_CHECK_LIB(dl,dlopen)
5c988700
MV
67if test "$ac_cv_lib_dl_dlopen" = "yes"; then
68 xtra_PLUGIN_guile_libs="-lguile -ldl"
d914fd5f 69 AC_DEFINE(DYNAMIC_LINKING)
5c988700 70else
d914fd5f 71AC_CHECK_LIB(dld,dld_link)
5c988700
MV
72if test "$ac_cv_lib_dld_dld_link" = "yes"; then
73 xtra_PLUGIN_guile_libs="-lguile -ldld"
d914fd5f
MV
74 AC_DEFINE(DYNAMIC_LINKING)
75else
76AC_CHECK_FUNCS(shl_load)
77if test "$ac_cv_func_shl_load" = "yes"; then
78 AC_DEFINE(DYNAMIC_LINKING)
79fi fi fi
5c988700
MV
80
81fi
82
0f2d19dd
JB
83#--------------------------------------------------------------------
84#
85# Which way does the stack grow?
86#
87#--------------------------------------------------------------------
88
89AC_TRY_RUN(aux (l) unsigned long l;
90 { int x; exit (l >= ((unsigned long)&x)); }
91 main () { int q; aux((unsigned long)&q); },
92 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
93
94
95AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
96 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
97 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
98
2e18892a
GH
99AC_MSG_CHECKING(for struct linger)
100AC_CACHE_VAL(scm_cv_struct_linger,
b3310939
JB
101 AC_TRY_COMPILE([
102#include <sys/types.h>
103#include <sys/socket.h>],
2e18892a
GH
104 [struct linger lgr; lgr.l_linger = 100],
105 scm_cv_struct_linger="yes",
106 scm_cv_struct_linger="no"))
107AC_MSG_RESULT($scm_cv_struct_linger)
108if test $scm_cv_struct_linger = yes; then
109 AC_DEFINE(HAVE_STRUCT_LINGER)
110fi
111
0f2d19dd
JB
112#--------------------------------------------------------------------
113#
114# How can you violate a stdio abstraction by setting a stream's fd?
115#
116#--------------------------------------------------------------------
117
118FD_SETTER=""
119
120if test "x$FD_SETTER" = x; then
121 AC_TRY_COMPILE(#include <stdio.h>
122, stdout->_file = 1,
123 FD_SETTER="((F)->_file = (D))")
124fi
125
126if test "x$FD_SETTER" = x; then
127 AC_TRY_COMPILE(#include <stdio.h>
128, stdout->_fileno,
129 FD_SETTER="((F)->_fileno = (D))")
130fi
131
132dnl
133dnl Add FD_SETTER tests for other systems here. Your test should
134dnl try a particular style of assigning to the descriptor
135dnl field(s) of a FILE* and define FD_SETTER accordingly.
136dnl
137dnl The value of FD_SETTER is used as a macro body, as in:
138dnl
139dnl #define SET_FILE_FD_FIELD(F,D) @FD_SETTER@
140dnl
141dnl F is a FILE* and D a descriptor (int).
142dnl
143
144test "x$FD_SETTER" != x && AC_DEFINE(HAVE_FD_SETTER)
145
f93ddd39
GH
146#--------------------------------------------------------------------
147# How to find out whether a FILE structure contains buffered data.
148# From Tk we have the following list:
149# _cnt: Most UNIX systems
150# __cnt: HPUX
151# _r: BSD
152# readCount: Sprite
153# Or, in GNU libc there are two fields, _gptr and _egptr, which
154# have to be compared.
155# These can also be known as _IO_read_ptr and _IO_read_end.
156#--------------------------------------------------------------------
157
158AC_MSG_CHECKING(how to get buffer char count from FILE structure)
159AC_CACHE_VAL(scm_cv_struct_file_count,
160 AC_TRY_COMPILE([#include <stdio.h>],
161 [FILE *f = stdin; f->_cnt = 0],
162 scm_cv_struct_file_count="_cnt",
163 AC_TRY_COMPILE([#include <stdio.h>],
164 [FILE *f = stdin; f->_r = 0],
165 scm_cv_struct_file_count="_r",
166 AC_TRY_COMPILE([#include <stdio.h>],
167 [FILE *f = stdin; f->readCount = 0],
168 scm_cv_struct_file_count="readCount",
169 scm_cv_struct_file_count=""))))
170if test "$scm_cv_struct_file_count"; then
171 AC_MSG_RESULT($scm_cv_struct_file_count)
172 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
173else
174AC_CACHE_VAL(scm_cv_struct_file_gptr,
175 AC_TRY_COMPILE([#include <stdio.h>],
176 [FILE *f = stdin; f->_gptr = f->egptr;],
177 scm_cv_struct_file_gptr=1,
178 scm_cv_struct_file_gptr=""))
179if test "$scm_cv_struct_gptr"; then
180 AC_MSG_RESULT(gptr)
181 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
182else
183AC_CACHE_VAL(scm_cv_struct_file_readptr,
184 AC_TRY_COMPILE([#include <stdio.h>],
185 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
186 scm_cv_struct_file_readptr=1))
187if test "$scm_cv_struct_file_readptr"; then
188 AC_MSG_RESULT(read_ptr)
189 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
190fi
191fi
192fi
193
027fde39
MD
194#--------------------------------------------------------------------
195#
196# Flags for thread support
197#
198#--------------------------------------------------------------------
199
200dnl
201dnl Set the appropriate flags!
202dnl
203if test "$cy_cv_threads_package" = FSU; then
204 AC_DEFINE(USE_FSU_PTHREADS, 1)
205 else if test "$cy_cv_threads_package" = COOP; then
206 AC_DEFINE(USE_COOP_THREADS, 1)
207 else if test "$cy_cv_threads_package" = MIT; then
208 AC_DEFINE(USE_MIT_PTHREADS, 1)
209 else if test "$cy_cv_threads_package" = PCthreads; then
210 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
211 else if test "$cy_cv_threads_package" = unknown; then
212 AC_MSG_ERROR("cannot find threads installation")
213 fi
214 fi
215 fi
216 fi
217fi
218
219if test "$cy_cv_threads_package" != ""; then
220 AC_DEFINE(USE_THREADS)
221fi
222
d9098516
JB
223## If we're using GCC, ask for aggressive warnings.
224case "$GCC" in
225 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
226esac
0f2d19dd 227
ee78fbb0
GH
228AC_PROG_AWK
229AC_MSG_CHECKING(whether errno codes can be extracted from errno.h)
ee78fbb0 230if test "$GCC" = yes ; then
ee78fbb0 231 AC_MSG_RESULT(yes)
1146b6cd 232 ERRNO_EXTRACT="${CC-cc} -undef -dM -E $srcdir/errnos_get.c | egrep ' E.+' | cut -f2 -d' ' > errnos.list"
ee78fbb0 233else
1146b6cd 234 ERRNO_EXTRACT="cp $srcdir/errnos.default errnos.list"
ee78fbb0
GH
235 AC_MSG_RESULT([no, using default])
236fi
237
9dcf6a02
JB
238## If we're creating a shared library (using libtool!), then we'll
239## need to generate a list of .lo files corresponding to the .o files
240## given in LIBOBJS. We'll call it LIBLOBJS.
241LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`"
242
9d7e1edf
JB
243AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, "$GUILE_MAJOR_VERSION")
244AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, "$GUILE_MINOR_VERSION")
245AC_DEFINE_UNQUOTED(GUILE_VERSION, "$GUILE_VERSION")
0f2d19dd 246
1146b6cd 247AC_SUBST(AWK)
0f2d19dd 248AC_SUBST(FD_SETTER)
1146b6cd 249AC_SUBST(ERRNO_EXTRACT)
9dcf6a02 250AC_SUBST(LIBLOBJS)
5c988700 251AC_OUTPUT([Makefile fd.h guile-snarf PLUGIN/guile.libs], [chmod +x guile-snarf])
0f2d19dd
JB
252
253dnl Local Variables:
254dnl comment-start: "dnl "
255dnl comment-end: ""
256dnl comment-start-skip: "\\bdnl\\b\\s *"
257dnl End: