+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
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.
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
PICFLAGS=-fPIC
;;
*)
- SERVER_LDFLAGS=-rdynamic
+ SERVER_LDFLAGS="$SERVER_LDFLAGS -rdynamic"
PICFLAGS=-fPIC
;;
esac
fi
fi
+test -f /usr/local/lib/libgdbm.a && LDFLAGS="$LDFLAGS -L/usr/local/lib"
AC_CHECK_LIB(gdbm, gdbm_open)
save_LIBS=$LIBS
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
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.
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
AC_SUBST(SERVER_LDFLAGS)
AC_SUBST(PICFLAGS)
AC_SUBST(SUFFIX)
+AC_SUBST(PTHREAD_DEFS)
AC_CONFIG_HEADER(sysdep.h)
AC_OUTPUT(Makefile weekly)
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
}
}