dnl Process this file with autoconf to produce a configure script. dnl $Id$ AC_PREREQ(2.13) AC_INIT(citserver.c) AC_PREFIX_DEFAULT(/usr/local/citadel) if test "$prefix" = NONE; then AC_DEFINE_UNQUOTED(BBSDIR, "$ac_default_prefix") else AC_DEFINE_UNQUOTED(BBSDIR, "$prefix") fi AC_ARG_ENABLE(autologin, [ --disable-autologin disable autologin (default is enabled if possible)]) AC_ARG_ENABLE(chkpwd, [ --enable-chkpwd build 'chkpwd' (use this if you have shadow passwords)]) AC_ARG_WITH(pam, [ --with-pam use PAM if present]) dnl By default, we only build the client (citadel and whobbs) unless we can dnl figure out how to build with POSIX threads. TARGETS=client AC_CANONICAL_HOST SO=.so 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. dnl Also has stupid non-reentrant gethostbyaddr() and friends. i?86-*-bsdi*) test -z "$CC" -a -x /usr/bin/shlicc2 && CC=shlicc2 SO=.mo AC_DEFINE(HAVE_NONREENTRANT_NETDB) ;; dnl Digital Unix has an odd way to build for pthreads, and we can't dnl build pthreads programs with gcc due to header problems. alpha*-dec-osf*) test -z "$CC" && CC=cc SERVER_LDFLAGS=-pthread ;; *-*-cygwin32) SUFFIX=.exe ;; esac dnl Checks for programs. AC_PROG_CC dnl Set up system-dependent compiler flags. if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" case "$host" in i?86-*-bsdi*) ;; mips*-sgi-irix*) PICFLAGS=-fPIC ;; *) SERVER_LDFLAGS=-rdynamic PICFLAGS=-fPIC ;; esac fi AC_PROG_RANLIB AC_PROG_INSTALL missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) dnl Checks for libraries. dnl libdl, libgdbm, and libcrypt are only used in the server, so the dnl Makefile only passes $(LIBS) to that target. If other programs start dnl requiring additional libraries, we'll have to use other variables, as is dnl done with curses. dnl We want to test for crypt() and dlopen() in libc before checking for dnl -lcrypt and -ldl, because some systems (like Irix) have both. AC_CHECK_FUNCS(crypt dlopen) if test "$ac_cv_func_dlopen" = no; then AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS" chkpwd_LIBS=-ldl]) fi dnl Determine the system's authentication capabilities, if autologin is dnl requested. We currently support PAM, standard getpwnam(), and getspnam() dnl (Linux shadow passwords) if test "$enable_autologin" != no; then if test "$with_pam" = yes; then save_LIBS=$LIBS AC_CHECK_LIB(pam, pam_start, [chkpwd_LIBS="-lpam $chkpwd_LIBS" LIBS="-lpam $LIBS"]) AC_CHECK_FUNCS(pam_start) test "$enable_chkpwd" = yes && LIBS=$save_LIBS fi if test "$ac_cv_func_pam_start" = no -o "$with_pam" != yes; then AC_CHECK_LIB(shadow, getspnam) if test "$ac_cv_func_crypt" = no; then AC_CHECK_LIB(crypt, crypt, [chkpwd_LIBS=-lcrypt test "$enable_chkpwd" != yes && \ LIBS="-lcrypt $LIBS"]) fi fi if test "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes -o "$ac_cv_func_pam_start" = yes; then AC_DEFINE(ENABLE_AUTOLOGIN) if test "$enable_chkpwd" = yes; then AC_DEFINE(ENABLE_CHKPWD) CHKPWD=chkpwd else AUTH=auth.ro fi fi fi AC_CHECK_LIB(gdbm, gdbm_open) save_LIBS=$LIBS AC_CHECK_LIB(termcap, tgetent, [LIBS="$LIBS -ltermcap" CURSES=-ltermcap]) AC_CHECK_LIB(curses, initscr, CURSES="-lcurses $CURSES") 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 AC_CHECK_LIB(pthread, pthread_create) AC_CHECK_LIB(pthreads, pthread_create) fi dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT 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_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_CACHE_CHECK([for ut_type in struct utmp], ac_cv_struct_ut_type, [AC_TRY_COMPILE([#include ], [struct utmp ut; ut.ut_type;], ac_cv_struct_ut_type=yes, ac_cv_struct_ut_type=no)]) if test $ac_cv_struct_ut_type = yes; then AC_DEFINE(HAVE_UT_TYPE) fi dnl Checks for library functions. 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_FUNC(pthread_create, TARGETS="client server utils serv_modules") AC_REPLACE_FUNCS(snprintf getutline) dnl Done! Now write the Makefile and sysdep.h AC_SUBST(AUTH) AC_SUBST(SO) AC_SUBST(CHKPWD) AC_SUBST(CURSES) AC_SUBST(chkpwd_LIBS) AC_SUBST(TARGETS) AC_SUBST(SERVER_LDFLAGS) AC_SUBST(PICFLAGS) AC_SUBST(SUFFIX) AC_CONFIG_HEADER(sysdep.h) AC_OUTPUT(Makefile weekly)