* Makefile.in, configure.in, getutline.c, sysdep.c:
authorNathan Bryant <loanshark@uncensored.citadel.org>
Wed, 7 Apr 1999 03:17:24 +0000 (03:17 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Wed, 7 Apr 1999 03:17:24 +0000 (03:17 +0000)
          fixes/bug workarounds for FreeBSD

citadel/ChangeLog
citadel/Makefile.in
citadel/configure.in
citadel/getutline.c
citadel/sysdep.c

index d58d6321f7a4bf89d6cb0dfde445dbc635c216cf..ceb48081771af7e0928d07fe1b05bfbc95b3a13d 100644 (file)
@@ -1,3 +1,7 @@
+1999-04-06 Nathan Bryant <bryant@cs.usm.maine.edu>
+       * Makefile.in, configure.in, getutline.c, sysdep.c:
+         fixes/bug workarounds for FreeBSD
+
 1999-04-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * Makefile.in, configure.in, chkpwd.c, acconfig.h: support for
          `chkpwd', a setuid helper program for machines which use shadow
index 4427303d133991e32424a1264e93ed2b9050c636..00dd4adb2e32f28620ad754c6c51f68086057e61 100644 (file)
@@ -46,7 +46,7 @@ PICFLAGS=@PICFLAGS@
 CURSES=@CURSES@
 chkpwd_LIBS=@chkpwd_LIBS@
 LIBOBJS=@LIBOBJS@
-PTHREAD_DEFS=-D_REENTRANT
+PTHREAD_DEFS=@PTHREAD_DEFS@
 INSTALL=@INSTALL@
 INSTALL_DATA=@INSTALL_DATA@
 SHELL=/bin/sh
index 19f0bc8611fc6dce72adbcb9c38ad845a58e97f7..8e5bf2b071c4761455b881cdfcade0f110d7bba5 100644 (file)
@@ -19,6 +19,7 @@ TARGETS=client
 
 AC_CANONICAL_HOST
 SO=.so
+PTHREAD_DEFS=-D_REENTRANT
 case "$host" in
        dnl BSDI 3.0 wants relocatable object modules instead of shared libs
        dnl for dlopen(), and has a wrapper script to link with shared libs.
@@ -33,6 +34,18 @@ case "$host" in
        alpha*-dec-osf*)
                test -z "$CC" && CC=cc
                SERVER_LDFLAGS=-pthread
+               check_pthread=no
+       ;;
+       dnl FreeBSD is similar to Digital UNIX:
+       *-*-freebsd*)
+               AC_ARG_WITH(kthread, [  --with-kthread          use kernel threads, not user])
+               if test "$with_kthread" = yes; then
+                       SERVER_LDFLAGS=-kthread
+               else
+                       SERVER_LDFLAGS=-pthread
+               fi
+               check_pthread=no
+               PTHREAD_DEFS=-D_THREAD_SAFE
        ;;
        *-*-cygwin32)
                SUFFIX=.exe
@@ -52,7 +65,7 @@ if test "$GCC" = yes; then
                        PICFLAGS=-fPIC
                ;;
                *)
-                       SERVER_LDFLAGS=-rdynamic
+                       SERVER_LDFLAGS="$SERVER_LDFLAGS -rdynamic"
                        PICFLAGS=-fPIC
                ;;
        esac
@@ -108,6 +121,7 @@ if test "$enable_autologin" != no; then
        fi
 fi
 
+test -f /usr/local/lib/libgdbm.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
 AC_CHECK_LIB(gdbm, gdbm_open)
 
 save_LIBS=$LIBS
@@ -117,9 +131,9 @@ AC_CHECK_LIB(curses, initscr, CURSES="-lcurses $CURSES", [
        AC_CHECK_LIB(ncurses, initscr, CURSES="-lncurses")])
 LIBS=$save_LIBS
 
-dnl Check for libpthread(s) if we're not using Digital UNIX. (On which the
-dnl -pthread flag takes care of this.)
-if test "$SERVER_LDFLAGS" != -pthread; then
+dnl Check for libpthread(s) if we're not using Digital UNIX or FreeBSD. (On
+dnl which the -pthread flag takes care of this.)
+if test "$check_pthread" != no; then
        AC_CHECK_LIB(pthread, pthread_create)
        AC_CHECK_LIB(pthreads, pthread_create)
 fi
@@ -128,6 +142,7 @@ dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
+test -f /usr/local/include/gdbm.h && CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 AC_CHECK_HEADERS(curses.h fcntl.h limits.h termios.h strings.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h pthread.h gdbm.h utmp.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -149,8 +164,14 @@ AC_FUNC_GETPGRP
 AC_PROG_GCC_TRADITIONAL
 AC_TYPE_SIGNAL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(getspnam mkdir mkfifo mktime pthread_cancel rmdir select socket strerror)
+AC_CHECK_FUNCS(getspnam mkdir mkfifo mktime rmdir select socket strerror)
+
+save_LDFLAGS=$LDFLAGS
+LDFLAGS="$LDFLAGS $SERVER_LDFLAGS"
+AC_CHECK_FUNCS(pthread_cancel)
 AC_CHECK_FUNC(pthread_create, TARGETS="client server utils serv_modules")
+LDFLAGS=$save_LDFLAGS
+
 AC_REPLACE_FUNCS(snprintf getutline)
 
 dnl Done! Now write the Makefile and sysdep.h
@@ -163,5 +184,6 @@ AC_SUBST(TARGETS)
 AC_SUBST(SERVER_LDFLAGS)
 AC_SUBST(PICFLAGS)
 AC_SUBST(SUFFIX)
+AC_SUBST(PTHREAD_DEFS)
 AC_CONFIG_HEADER(sysdep.h)
 AC_OUTPUT(Makefile weekly)
index a567b90132fc954b92d57213f89ebd3c6213e26d..ad067cbd7d2457f8ba0891654b2a3001bd2aeb47 100644 (file)
@@ -8,6 +8,7 @@
 #include "sysdep.h"
 #ifdef HAVE_UTMP_H
 #include <stdio.h>
+#include <sys/types.h>
 #include <utmp.h>
 #include <paths.h>
 #include <string.h>
index 114561ec4b4b496116b9e6c5d823fbda3f67462b..a4824bfbd9e833f5cbd0720b34330b68bdab2c6c 100644 (file)
@@ -637,6 +637,14 @@ void kill_session(int session_to_kill) {
                pthread_cancel(killme);
 #else
                pthread_kill(killme, SIGUSR1);
+#ifdef __FreeBSD__
+               /* there's a very stupid bug in the user threads package on
+                  FreeBSD 3.1 which prevents a signal from being properly
+                  dispatched to a thread that's in a blocking syscall. the
+                  first signal interrupts the syscall, the second one actually
+                  gets delivered. */
+               pthread_kill(killme, SIGUSR1);
+#endif
 #endif
                }
        }