* feature.c, feature.h (scm_reset_hook_x): New procedure.
[bpt/guile.git] / configure.in
index d9863dc..00d8dae 100644 (file)
@@ -1,4 +1,25 @@
-dnl Process this file with autoconf to produce configure.
+dnl   configuration script for Guile
+dnl   Process this file with autoconf to produce configure.
+dnl
+dnl  Copyright (C) 1998 Free Software Foundation, Inc.
+dnl
+dnl  This file is part of GUILE
+dnl
+dnl  GUILE is free software; you can redistribute it and/or modify it
+dnl  under the terms of the GNU General Public License as published by
+dnl  the Free Software Foundation; either version 2, or (at your
+dnl  option) any later version.
+dnl
+dnl  GUILE is distributed in the hope that it will be useful, but
+dnl  WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl  General Public License for more details.
+dnl
+dnl  You should have received a copy of the GNU General Public License
+dnl  along with GUILE; see the file COPYING.  If not, write to the
+dnl  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+dnl  Boston, MA 02111-1307, USA.
+
 AC_INIT(Makefile.in)
 . $srcdir/GUILE-VERSION
 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
@@ -36,7 +57,10 @@ AC_AIX
 AC_ISC_POSIX
 AC_MINIX
 
+AM_PROG_CC_STDC
+
 AC_C_CONST
+AC_C_INLINE
 
 AC_HEADER_STDC
 AC_HEADER_DIRENT
@@ -60,8 +84,21 @@ if test $ac_cv_func_connect = no; then
 fi
 AC_CHECK_LIB(termcap, tgoto)
 AC_CHECK_LIB(readline, readline)
-AC_CHECK_FUNCS(rl_getc_function rl_clear_signals rl_cleanup_after_signal)
-if test $ac_cv_lib_readline_readline = yes -a $ac_cv_func_rl_getc_function = no; then
+AC_CHECK_FUNCS(rl_clear_signals rl_cleanup_after_signal)
+
+AC_CACHE_CHECK([for rl_getc_function pointer in readline],
+               ac_cv_var_rl_getc_function,
+               [AC_TRY_LINK([
+#include <stdio.h>
+#include <readline/readline.h>],
+                            [rl_getc_function;],
+                            [ac_cv_var_rl_getc_function=yes],
+                            [ac_cv_var_rl_getc_function=no])])
+if test "$ac_cv_var_rl_getc_function" = "yes"; then
+  AC_DEFINE(HAVE_RL_GETC_FUNCTION)
+fi
+
+if test $ac_cv_lib_readline_readline = yes -a $ac_cv_var_rl_getc_function = no; then
   echo 'Warning: libreadline is too old on your system.  Need >= 2.1.'
 fi
 
@@ -96,24 +133,41 @@ GUILE_DLSYM_USCORE
 
 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 bzero strdup system usleep)
 
-# Determine the host we are working on
-AC_CANONICAL_HOST
+### Some systems don't declare some functions.  On such systems, we
+### need to at least provide our own K&R-style declarations.
 
-# Some operating systems don't declare all functions
-case "$host_os" in
-  solaris2.5*)
-    AC_DEFINE(DECLARE_BZERO)
-    AC_DEFINE(DECLARE_USLEEP)
+### GUILE_FUNC_DECLARED(function, headerfile)
+
+### Check for a declaration of FUNCTION in HEADERFILE; if it is
+### not there, #define MISSING_FUNCTION_DECL.
+AC_DEFUN(GUILE_FUNC_DECLARED, [
+  AC_CACHE_CHECK(for $1 declaration, guile_cv_func_$1_declared,
+    AC_EGREP_HEADER($1, $2,
+                   guile_cv_func_$1_declared=yes, 
+                   guile_cv_func_$1_declared=no))
+  if test [x$guile_cv_func_]$1[_declared] = xno; then
+    AC_DEFINE([MISSING_]translit($1, [a-z], [A-Z])[_DECL])
+  fi
+])
+
+GUILE_FUNC_DECLARED(strptime, time.h)
+GUILE_FUNC_DECLARED(bzero, string.h)
+GUILE_FUNC_DECLARED(sleep, unistd.h)
+GUILE_FUNC_DECLARED(usleep, unistd.h)
+
+### On some systems usleep has no return value.  If it does have one,
+### we'd like to return it; otherwise, we'll fake it.
+AC_CACHE_CHECK([return type of usleep], guile_cv_func_usleep_return_type,
+  [AC_EGREP_HEADER(changequote(<, >)<void[     ]+usleep>changequote([, ]),
+                   /usr/include/unistd.h,
+                  [guile_cv_func_usleep_return_type=void],
+                  [guile_cv_func_usleep_return_type=int])])
+case "$guile_cv_func_usleep_return_type" in
+  "void" )
+    AC_DEFINE(USLEEP_RETURNS_VOID)
   ;;
 esac
 
-# On some systems usleep has no return value
-AC_EGREP_HEADER(changequote(<, >)<void[        ][      ]*usleep>changequote([, ]),
-  /usr/include/unistd.h,
-  AC_DEFINE(USLEEP_RETURNS_VOID)
-)
-
-
 dnl <GNU-WIN32 hacks>
 
 AC_CHECK_HEADER(sys/un.h, have_sys_un_h=1)
@@ -214,10 +268,22 @@ AC_TRY_RUN(aux (l) unsigned long l;
           main () { int q; aux((unsigned long)&q); }, 
           AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
 
+AC_CACHE_CHECK([whether floats fit in longs], guile_cv_type_float_fits_long,
+    [AC_TRY_RUN([main () { exit (sizeof(float) > sizeof(long)); }],
+               [guile_cv_type_float_fits_long=yes],
+               [guile_cv_type_float_fits_long=no],
+               [guile_cv_type_float_fits_long=guess-yes])])
+case $guile_cv_type_float_fits_long in
+  "yes" )
+    AC_DEFINE(SCM_SINGLES)
+  ;;
+  "guess-yes" )
+    AC_DEFINE(SCM_SINGLES)
+    AC_MSG_WARN([guessing that sizeof(long) == sizeof(float)])
+    AC_MSG_WARN([see SCM_SINGLES in scmconfig.h.in])
+  ;;
+esac
 
-AC_TRY_RUN(main () { exit (sizeof(float) != sizeof(long)); },
-          AC_DEFINE(SCM_SINGLES),,AC_DEFINE(SCM_SINGLES)
-          AC_MSG_WARN(Guessing that sizeof(long) == sizeof(float) -- see scmconfig.h.in))
 
 AC_MSG_CHECKING(for struct linger)
 AC_CACHE_VAL(scm_cv_struct_linger,
@@ -243,10 +309,13 @@ AC_CACHE_VAL(scm_cv_fd_setter,
        AC_TRY_COMPILE([#include <stdio.h>],
                        [stdout->_file = 1],
                        scm_cv_fd_setter="_file",
+       AC_TRY_COMPILE([#include <stdio.h>],
+                       [stdout->__file = 1],
+                       scm_cv_fd_setter="__file",
        AC_TRY_COMPILE([#include <stdio.h>],
                        [stdout->_fileno = 1],
                        scm_cv_fd_setter="_fileno",
-                       scm_cv_fd_setter="")))
+                       scm_cv_fd_setter=""))))
 
 if test "$scm_cv_fd_setter"; then
        AC_MSG_RESULT($scm_cv_fd_setter)
@@ -259,7 +328,7 @@ fi
 # How to find out whether a FILE structure contains buffered data.
 # From Tk we have the following list:
 #              _cnt:           Most UNIX systems
-#              __cnt:          HPUX
+#              __cnt:          HPUX and SCO
 #              _r:             BSD
 #              readCount:      Sprite
 #      Or, in GNU libc there are two fields, _gptr and _egptr, which
@@ -272,13 +341,16 @@ AC_CACHE_VAL(scm_cv_struct_file_count,
        AC_TRY_COMPILE([#include <stdio.h>],
                        [FILE *f = stdin; f->_cnt = 0],
                        scm_cv_struct_file_count="_cnt",
+       AC_TRY_COMPILE([#include <stdio.h>],
+                       [FILE *f = stdin; f->__cnt = 0],
+                       scm_cv_struct_file_count="__cnt",
        AC_TRY_COMPILE([#include <stdio.h>],
                        [FILE *f = stdin; f->_r = 0],
                        scm_cv_struct_file_count="_r",
        AC_TRY_COMPILE([#include <stdio.h>],
                        [FILE *f = stdin; f->readCount = 0],
                        scm_cv_struct_file_count="readCount",
-       scm_cv_struct_file_count=""))))
+       scm_cv_struct_file_count="")))))
 if test "$scm_cv_struct_file_count"; then
        AC_MSG_RESULT($scm_cv_struct_file_count)
        AC_DEFINE_UNQUOTED(FILE_CNT_FIELD, $scm_cv_struct_file_count)
@@ -387,7 +459,7 @@ AC_SUBST(GUILE_MAJOR_VERSION)
 AC_SUBST(GUILE_MINOR_VERSION)
 AC_SUBST(GUILE_VERSION)
 
-dnl Tell build-guile what flags guile users should link against.
+dnl Tell guile-config what flags guile users should link against.
 GUILE_LIBS="$LDFLAGS $THREAD_LIBS_INSTALLED $LIBS"
 AC_SUBST(GUILE_LIBS)
 
@@ -405,7 +477,7 @@ AC_SUBST(GUILE_STAMP)
 AC_SUBST(AWK)
 AC_SUBST(LIBLOBJS)
 
-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 build/Makefile], [chmod +x libguile/guile-snarf])
+AC_OUTPUT([Makefile libguile/Makefile libguile/guile-snarf libguile/versiondat.h ice-9/Makefile ice-9/version.scm qt/Makefile qt/qt.h qt/md/Makefile qt/time/Makefile guile-config/Makefile doc/Makefile], [chmod +x libguile/guile-snarf])
 
 dnl Local Variables:
 dnl comment-start: "dnl "