On some systems <libc.h> conflicts with <unistd.h>, and should not
[bpt/guile.git] / libguile / configure.in
1 AC_INIT(eval.c)
2 AC_CONFIG_HEADER(scmconfig.h)
3
4 . $srcdir/../GUILE-VERSION
5
6 #--------------------------------------------------------------------
7 #
8 # User options
9 #
10 #--------------------------------------------------------------------
11
12 AC_ARG_ENABLE(debug,
13 [ --disable-debug Don't include debugging support])
14 if test "$enableval" != n && test "$enableval" != no; then
15 AC_DEFINE(DEBUG_EXTENSIONS)
16 AC_DEFINE(READER_EXTENSIONS)
17 LIBOBJS="backtrace.o stacks.o debug.o srcprop.o $LIBOBJS"
18 fi
19
20 #--------------------------------------------------------------------
21
22 test -z "$CFLAGS" && CFLAGS=-g
23 test -z "$LDFLAGS" && LDFLAGS=-g
24
25 AC_PROG_CC
26 AC_PROG_CPP
27 AC_PROG_RANLIB
28
29 AC_AIX
30 AC_ISC_POSIX
31 AC_MINIX
32
33 builtin(sinclude, ../aclocal.m4)
34 CY_AC_WITH_THREADS
35 CFLAGS="$CPPFLAGS $CFLAGS"
36
37 AC_C_CONST
38
39 AC_HEADER_STDC
40 AC_HEADER_DIRENT
41 AC_HEADER_TIME
42 AC_HEADER_SYS_WAIT
43 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)
44 GUILE_HEADER_LIBC_WITH_UNISTD
45
46 AC_TYPE_GETGROUPS
47 AC_TYPE_SIGNAL
48 AC_TYPE_MODE_T
49
50 AC_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)
51
52 AC_REPLACE_FUNCS(inet_aton strerror)
53
54 AC_STRUCT_ST_RDEV
55 AC_STRUCT_ST_BLKSIZE
56 AC_STRUCT_ST_BLOCKS
57 GUILE_STRUCT_UTIMBUF
58
59 #--------------------------------------------------------------------
60 #
61 # Which way does the stack grow?
62 #
63 #--------------------------------------------------------------------
64
65 AC_TRY_RUN(aux (l) unsigned long l;
66 { int x; exit (l >= ((unsigned long)&x)); }
67 main () { int q; aux((unsigned long)&q); },
68 AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
69
70
71 AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
72 AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
73 AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
74
75 AC_MSG_CHECKING(for struct linger)
76 AC_CACHE_VAL(scm_cv_struct_linger,
77 AC_TRY_COMPILE([#include <sys/socket.h>],
78 [struct linger lgr; lgr.l_linger = 100],
79 scm_cv_struct_linger="yes",
80 scm_cv_struct_linger="no"))
81 AC_MSG_RESULT($scm_cv_struct_linger)
82 if test $scm_cv_struct_linger = yes; then
83 AC_DEFINE(HAVE_STRUCT_LINGER)
84 fi
85
86 #--------------------------------------------------------------------
87 #
88 # How can you violate a stdio abstraction by setting a stream's fd?
89 #
90 #--------------------------------------------------------------------
91
92 FD_SETTER=""
93
94 if test "x$FD_SETTER" = x; then
95 AC_TRY_COMPILE(#include <stdio.h>
96 , stdout->_file = 1,
97 FD_SETTER="((F)->_file = (D))")
98 fi
99
100 if test "x$FD_SETTER" = x; then
101 AC_TRY_COMPILE(#include <stdio.h>
102 , stdout->_fileno,
103 FD_SETTER="((F)->_fileno = (D))")
104 fi
105
106 dnl
107 dnl Add FD_SETTER tests for other systems here. Your test should
108 dnl try a particular style of assigning to the descriptor
109 dnl field(s) of a FILE* and define FD_SETTER accordingly.
110 dnl
111 dnl The value of FD_SETTER is used as a macro body, as in:
112 dnl
113 dnl #define SET_FILE_FD_FIELD(F,D) @FD_SETTER@
114 dnl
115 dnl F is a FILE* and D a descriptor (int).
116 dnl
117
118 test "x$FD_SETTER" != x && AC_DEFINE(HAVE_FD_SETTER)
119
120 #--------------------------------------------------------------------
121 # How to find out whether a FILE structure contains buffered data.
122 # From Tk we have the following list:
123 # _cnt: Most UNIX systems
124 # __cnt: HPUX
125 # _r: BSD
126 # readCount: Sprite
127 # Or, in GNU libc there are two fields, _gptr and _egptr, which
128 # have to be compared.
129 # These can also be known as _IO_read_ptr and _IO_read_end.
130 #--------------------------------------------------------------------
131
132 AC_MSG_CHECKING(how to get buffer char count from FILE structure)
133 AC_CACHE_VAL(scm_cv_struct_file_count,
134 AC_TRY_COMPILE([#include <stdio.h>],
135 [FILE *f = stdin; f->_cnt = 0],
136 scm_cv_struct_file_count="_cnt",
137 AC_TRY_COMPILE([#include <stdio.h>],
138 [FILE *f = stdin; f->_r = 0],
139 scm_cv_struct_file_count="_r",
140 AC_TRY_COMPILE([#include <stdio.h>],
141 [FILE *f = stdin; f->readCount = 0],
142 scm_cv_struct_file_count="readCount",
143 scm_cv_struct_file_count=""))))
144 if test "$scm_cv_struct_file_count"; then
145 AC_MSG_RESULT($scm_cv_struct_file_count)
146 AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
147 else
148 AC_CACHE_VAL(scm_cv_struct_file_gptr,
149 AC_TRY_COMPILE([#include <stdio.h>],
150 [FILE *f = stdin; f->_gptr = f->egptr;],
151 scm_cv_struct_file_gptr=1,
152 scm_cv_struct_file_gptr=""))
153 if test "$scm_cv_struct_gptr"; then
154 AC_MSG_RESULT(gptr)
155 AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr)
156 else
157 AC_CACHE_VAL(scm_cv_struct_file_readptr,
158 AC_TRY_COMPILE([#include <stdio.h>],
159 [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
160 scm_cv_struct_file_readptr=1))
161 if test "$scm_cv_struct_file_readptr"; then
162 AC_MSG_RESULT(read_ptr)
163 AC_DEFINE_UNQUOTED(FILE_CNT_READPTR, $scm_cv_struct_file_readptr)
164 fi
165 fi
166 fi
167
168 #--------------------------------------------------------------------
169 #
170 # Flags for thread support
171 #
172 #--------------------------------------------------------------------
173
174 dnl
175 dnl Set the appropriate flags!
176 dnl
177 if test "$cy_cv_threads_package" = FSU; then
178 AC_DEFINE(USE_FSU_PTHREADS, 1)
179 else if test "$cy_cv_threads_package" = COOP; then
180 AC_DEFINE(USE_COOP_THREADS, 1)
181 else if test "$cy_cv_threads_package" = MIT; then
182 AC_DEFINE(USE_MIT_PTHREADS, 1)
183 else if test "$cy_cv_threads_package" = PCthreads; then
184 AC_DEFINE(USE_PCTHREADS_PTHREADS, 1)
185 else if test "$cy_cv_threads_package" = unknown; then
186 AC_MSG_ERROR("cannot find threads installation")
187 fi
188 fi
189 fi
190 fi
191 fi
192
193 if test "$cy_cv_threads_package" != ""; then
194 AC_DEFINE(USE_THREADS)
195 fi
196
197 ## If we're using GCC, ask for aggressive warnings.
198 case "$GCC" in
199 yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
200 esac
201
202 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, "$GUILE_MAJOR_VERSION")
203 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, "$GUILE_MINOR_VERSION")
204 AC_DEFINE_UNQUOTED(GUILE_VERSION, "$GUILE_VERSION")
205
206 AC_SUBST(CFLAGS)
207 AC_SUBST(LDFLAGS)
208 AC_SUBST(LIBOBJS)
209 AC_SUBST(FD_SETTER)
210 AC_SUBST(XINCLUDES)
211 AC_SUBST(GUILE_MAJOR_VERSION)
212 AC_SUBST(GUILE_MINOR_VERSION)
213 AC_SUBST(GUILE_VERSION)
214 AC_OUTPUT(Makefile fd.h)
215
216 dnl Local Variables:
217 dnl comment-start: "dnl "
218 dnl comment-end: ""
219 dnl comment-start-skip: "\\bdnl\\b\\s *"
220 dnl End: