| 1 | AC_INIT(eval.c) |
| 2 | AM_CONFIG_HEADER(scmconfig.h) |
| 3 | AM_INIT_GUILE_MODULE(libguile) |
| 4 | AM_MAINTAINER_MODE |
| 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 | AC_ARG_ENABLE(dynamic-linking, |
| 21 | [ --enable-dynamic-linking Include support for dynamic linking]) |
| 22 | |
| 23 | #-------------------------------------------------------------------- |
| 24 | |
| 25 | AC_PROG_CC |
| 26 | AC_PROG_CPP |
| 27 | AM_PROG_LIBTOOL |
| 28 | |
| 29 | AC_AIX |
| 30 | AC_ISC_POSIX |
| 31 | AC_MINIX |
| 32 | |
| 33 | CY_AC_WITH_THREADS |
| 34 | |
| 35 | AC_C_CONST |
| 36 | |
| 37 | AC_HEADER_STDC |
| 38 | AC_HEADER_DIRENT |
| 39 | AC_HEADER_TIME |
| 40 | AC_HEADER_SYS_WAIT |
| 41 | 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) |
| 42 | GUILE_HEADER_LIBC_WITH_UNISTD |
| 43 | |
| 44 | AC_TYPE_GETGROUPS |
| 45 | AC_TYPE_SIGNAL |
| 46 | AC_TYPE_MODE_T |
| 47 | |
| 48 | 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) |
| 49 | |
| 50 | AC_REPLACE_FUNCS(inet_aton strerror) |
| 51 | |
| 52 | AC_FUNC_ALLOCA |
| 53 | |
| 54 | AC_STRUCT_ST_RDEV |
| 55 | AC_STRUCT_ST_BLKSIZE |
| 56 | AC_STRUCT_ST_BLOCKS |
| 57 | GUILE_STRUCT_UTIMBUF |
| 58 | |
| 59 | # Checks for dynamic linking |
| 60 | |
| 61 | xtra_PLUGIN_guile_libs="" |
| 62 | AC_SUBST(xtra_PLUGIN_guile_libs) |
| 63 | |
| 64 | if test "$enable_dynamic_linking" = "yes"; then |
| 65 | |
| 66 | AC_CHECK_LIB(dl,dlopen) |
| 67 | if test "$ac_cv_lib_dl_dlopen" = "yes"; then |
| 68 | xtra_PLUGIN_guile_libs="-lguile -ldl" |
| 69 | AC_DEFINE(DYNAMIC_LINKING) |
| 70 | else |
| 71 | AC_CHECK_LIB(dld,dld_link) |
| 72 | if test "$ac_cv_lib_dld_dld_link" = "yes"; then |
| 73 | xtra_PLUGIN_guile_libs="-lguile -ldld" |
| 74 | AC_DEFINE(DYNAMIC_LINKING) |
| 75 | else |
| 76 | AC_CHECK_FUNCS(shl_load) |
| 77 | if test "$ac_cv_func_shl_load" = "yes"; then |
| 78 | AC_DEFINE(DYNAMIC_LINKING) |
| 79 | fi fi fi |
| 80 | |
| 81 | fi |
| 82 | |
| 83 | #-------------------------------------------------------------------- |
| 84 | # |
| 85 | # Which way does the stack grow? |
| 86 | # |
| 87 | #-------------------------------------------------------------------- |
| 88 | |
| 89 | AC_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 | |
| 95 | AC_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 | |
| 99 | AC_MSG_CHECKING(for struct linger) |
| 100 | AC_CACHE_VAL(scm_cv_struct_linger, |
| 101 | AC_TRY_COMPILE([ |
| 102 | #include <sys/types.h> |
| 103 | #include <sys/socket.h>], |
| 104 | [struct linger lgr; lgr.l_linger = 100], |
| 105 | scm_cv_struct_linger="yes", |
| 106 | scm_cv_struct_linger="no")) |
| 107 | AC_MSG_RESULT($scm_cv_struct_linger) |
| 108 | if test $scm_cv_struct_linger = yes; then |
| 109 | AC_DEFINE(HAVE_STRUCT_LINGER) |
| 110 | fi |
| 111 | |
| 112 | #-------------------------------------------------------------------- |
| 113 | # |
| 114 | # How can you violate a stdio abstraction by setting a stream's fd? |
| 115 | # |
| 116 | #-------------------------------------------------------------------- |
| 117 | |
| 118 | FD_SETTER="" |
| 119 | |
| 120 | if test "x$FD_SETTER" = x; then |
| 121 | AC_TRY_COMPILE(#include <stdio.h> |
| 122 | , stdout->_file = 1, |
| 123 | FD_SETTER="((F)->_file = (D))") |
| 124 | fi |
| 125 | |
| 126 | if test "x$FD_SETTER" = x; then |
| 127 | AC_TRY_COMPILE(#include <stdio.h> |
| 128 | , stdout->_fileno, |
| 129 | FD_SETTER="((F)->_fileno = (D))") |
| 130 | fi |
| 131 | |
| 132 | dnl |
| 133 | dnl Add FD_SETTER tests for other systems here. Your test should |
| 134 | dnl try a particular style of assigning to the descriptor |
| 135 | dnl field(s) of a FILE* and define FD_SETTER accordingly. |
| 136 | dnl |
| 137 | dnl The value of FD_SETTER is used as a macro body, as in: |
| 138 | dnl |
| 139 | dnl #define SET_FILE_FD_FIELD(F,D) @FD_SETTER@ |
| 140 | dnl |
| 141 | dnl F is a FILE* and D a descriptor (int). |
| 142 | dnl |
| 143 | |
| 144 | test "x$FD_SETTER" != x && AC_DEFINE(HAVE_FD_SETTER) |
| 145 | |
| 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 | |
| 158 | AC_MSG_CHECKING(how to get buffer char count from FILE structure) |
| 159 | AC_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="")))) |
| 170 | if 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) |
| 173 | else |
| 174 | AC_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="")) |
| 179 | if test "$scm_cv_struct_gptr"; then |
| 180 | AC_MSG_RESULT(gptr) |
| 181 | AC_DEFINE_UNQUOTED(FILE_CNT_GPTR, $scm_cv_struct_file_gptr) |
| 182 | else |
| 183 | AC_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)) |
| 187 | if 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) |
| 190 | fi |
| 191 | fi |
| 192 | fi |
| 193 | |
| 194 | #-------------------------------------------------------------------- |
| 195 | # |
| 196 | # Flags for thread support |
| 197 | # |
| 198 | #-------------------------------------------------------------------- |
| 199 | |
| 200 | dnl |
| 201 | dnl Set the appropriate flags! |
| 202 | dnl |
| 203 | if 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 |
| 217 | fi |
| 218 | |
| 219 | if test "$cy_cv_threads_package" != ""; then |
| 220 | AC_DEFINE(USE_THREADS) |
| 221 | fi |
| 222 | |
| 223 | ## If we're using GCC, ask for aggressive warnings. |
| 224 | case "$GCC" in |
| 225 | yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;; |
| 226 | esac |
| 227 | |
| 228 | AC_PROG_AWK |
| 229 | AC_MSG_CHECKING(whether errno codes can be extracted from errno.h) |
| 230 | if test "$GCC" = yes ; then |
| 231 | AC_MSG_RESULT(yes) |
| 232 | ERRNO_EXTRACT="${CC-cc} -undef -dM -E $srcdir/errnos_get.c | egrep ' E.+' | cut -f2 -d' ' > errnos.list" |
| 233 | else |
| 234 | ERRNO_EXTRACT="cp $srcdir/errnos.default errnos.list" |
| 235 | AC_MSG_RESULT([no, using default]) |
| 236 | fi |
| 237 | |
| 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. |
| 241 | LIBLOBJS="`echo ${LIBOBJS} | sed 's/\.o/.lo/g'`" |
| 242 | |
| 243 | AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, "$GUILE_MAJOR_VERSION") |
| 244 | AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, "$GUILE_MINOR_VERSION") |
| 245 | AC_DEFINE_UNQUOTED(GUILE_VERSION, "$GUILE_VERSION") |
| 246 | |
| 247 | AC_SUBST(AWK) |
| 248 | AC_SUBST(FD_SETTER) |
| 249 | AC_SUBST(ERRNO_EXTRACT) |
| 250 | AC_SUBST(LIBLOBJS) |
| 251 | AC_OUTPUT([Makefile fd.h guile-snarf PLUGIN/guile.libs], [chmod +x guile-snarf]) |
| 252 | |
| 253 | dnl Local Variables: |
| 254 | dnl comment-start: "dnl " |
| 255 | dnl comment-end: "" |
| 256 | dnl comment-start-skip: "\\bdnl\\b\\s *" |
| 257 | dnl End: |