dotd-2.3.7/area/
dotd-2.3.7/clans/
dotd-2.3.7/classes/
dotd-2.3.7/councils/
dotd-2.3.7/deity/
dotd-2.3.7/dict/
dotd-2.3.7/doc/mudprogs/
dotd-2.3.7/player/a/
dotd-2.3.7/player/g/
# Process this file with autoconf to produce a configure script.
AC_INIT(DOTD, 2.3.7, dotd@dotd.com)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-installinfo no-installman])
AC_CONFIG_SRCDIR([src/db.c])
AM_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CC_C_O

if test "x$GCC" = xyes; then
    OPT_CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS="$OPT_CFLAGS"])

    if test "x$host_cpu-$host_vendor" = "xsparc-sun"; then
        W_FLAGS="-Wno-char-subscripts"
    else
        W_FLAGS="-Wchar-subscripts"
    fi
    W_FLAGS="-Wall -Wformat -Wformat-security -Winline -Wstrict-prototypes -Wpointer-arith -Wcast-align $W_FLAGS"
    for OPT_CFLAGS in $W_FLAGS
    do
        AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS="$CFLAGS $OPT_CFLAGS"])
    done

    if test "x$host_cpu" = "xsparc"; then
	if test `isainfo -n` = "sparcv9"; then
	    CPU_CFLAGS="-mcpu=v9 -mtune=ultrasparc"
	else
	    CPU_CFLAGS="-mcpu=v8"
	fi
    elif test "x$host_os" != "xcygwin"; then
	CPU_CFLAGS="-march=$host_cpu"
    fi

    if test "$CPU_CFLAGS"; then
        AC_TRY_CFLAGS([$CPU_CFLAGS],[CFLAGS="$CFLAGS $CPU_CFLAGS"])
    fi
fi

AC_PROG_YACC
AM_PROG_LEX
AC_PROG_MAKE_SET

# Checks for libraries.
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(m, pow)
AC_CHECK_LIB(z, deflate)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(resolv, inet_aton)
#AC_CHECK_LIB(aspell, new_aspell_config)

# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/socket.h sys/time.h unistd.h crypt.h execinfo.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_SETVBUF_REVERSED
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_FUNC_CLOSEDIR_VOID
AC_REPLACE_FNMATCH
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([alarm bzero dup2 getcwd gethostbyaddr gethostbyname gethostname getpagesize gettimeofday inet_ntoa isascii memchr memmove memset mkdir munmap pow select socket sqrt strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtoul uname backtrace_symbols])

AC_CHECK_FUNC([backtrace_symbols],[AC_TRY_CFLAGS(["-rdynamic"],[CFLAGS="-rdynamic $CFLAGS $CPU_CFLAGS"])])

AC_caolan_CHECK_PACKAGE(aspell, new_aspell_config, aspell, aspell.h, [AC_DEFINE(USE_ASPELL)])
AH_TEMPLATE([HAVE_PKG_aspell], [ASpell package existance])
AH_TEMPLATE([USE_ASPELL], [ASpell spell checking support])

# Custom stuff
AH_TEMPLATE([USE_IRC], [Enable or disable the internal irc server])
AC_ARG_ENABLE(irc,
    [  --disable-irc          Disable the internal IRC server],
    [irc=no],[AC_DEFINE(USE_IRC) irc=yes])
AM_CONDITIONAL(USE_IRC, test x$irc = xyes)

AH_TEMPLATE([USE_MUDMSG], [Enable or disable the Mudmsg code])
AC_ARG_ENABLE(mudmsg,
    [  --enable-mudmsg        Disable the internal IRC server],
    [AC_DEFINE(USE_MUDMSG) mudmsg=yes],[mudmsg=no])
AM_CONDITIONAL(USE_MUDMSG, test x$mudmsg = xyes)

AH_TEMPLATE([USE_BOA], [Integrated BOA web server])
AC_ARG_ENABLE(boa,
    [  --enable-boa           Enable the internal BOA web server],
    [AC_DEFINE(USE_BOA) boa=yes],[boa=no])
AM_CONDITIONAL(USE_BOA, test x$boa = xyes)

AH_TEMPLATE([I3], [Intermud3 code])
AH_TEMPLATE([I3SMAUG], [Intermud3 code for SMAUG])
AC_ARG_ENABLE(i3,
    [  --disable-i3           Disable the Intermud3 code],
    [i3=no],[AC_DEFINE(I3) AC_DEFINE(I3SMAUG) i3=yes])
AM_CONDITIONAL(USE_I3, test x$i3 = xyes)

AH_TEMPLATE([IMC], [IMC code])
AH_TEMPLATE([IMCSMAUG], [IMC code for SMAUG])
AC_ARG_ENABLE(imc,
    [  --enable-imc           Enable the IMC code],
    [AC_DEFINE(IMC) AC_DEFINE(IMCSMAUG) imc=yes],[imc=no])
AM_CONDITIONAL(USE_IMC, test x$imc = xyes)

AH_TEMPLATE([MUD_DEBUG], [Extra debugging in the code])
AC_ARG_ENABLE(debug,
    [  --enable-debug         Enable extra debugging],
    [AC_DEFINE(MUD_DEBUG) debug=yes],[debug=no])

AH_TEMPLATE([MXP], [Mud eXtension Protocol])
AC_ARG_ENABLE(mxp,
    [  --disable-mxp          Disable the Mud eXtension Protocol],
    [mxp=no],[AC_DEFINE(MXP) mxp=yes])

AH_TEMPLATE([COMPRESS], [MCCP Compression])
AC_ARG_ENABLE(mccp,
    [  --disable-mccp         Disable the MCCP compression protocol],
    [mccp=no],[AC_DEFINE(COMPRESS) mccp=yes])

AH_TEMPLATE([USE_DICT], [Online Dictionary Code])
AC_ARG_ENABLE(dictionary,
    [  --enable-dictionary    Enable the Online Dictionary],
    [AC_DEFINE(USE_DICT) dict=yes], [dict=no])

AH_TEMPLATE([NOCRYPT], [Disable the use of crypt for passwords])
AC_ARG_ENABLE(crypt,
    [  --disable-crypt        Disable the use of crypt for passwords],
    [AC_DEFINE(NOCRYPT) crypt=no],[crypt=no])

AH_TEMPLATE([MUD_LISTENER], [Experimental socket code])
AC_ARG_ENABLE(listener,
    [  --enable-listener      Enable the experimental listener code],
    [AC_DEFINE(MUD_LISTENER) listener=yes],[listener=no])

AH_TEMPLATE([STRING_HASH_SEMAPHORE], [Use semaphores to lock the string hashes])
AH_TEMPLATE([THREADED_AREA_LOAD], [Use pthreads to load areas in parallel])
AC_ARG_ENABLE(threads,
    [  --enable-threads       Enable usage of threads],
    [AC_DEFINE(STRING_HASH_SEMAPHORE) AC_DEFINE(THREADED_AREA_LOAD) threads=yes],[threads=no])

#AH_TEMPLATE([USE_ASPELL], [ASpell spell checking support])
#AC_ARG_ENABLE(aspell,
#    [  --disable-aspell       Disable ASpell spell checking support],
#    [aspell=no],[AC_DEFINE(USE_ASPELL) aspell=yes])
#AM_CONDITIONAL(USE_ASPELL, test x$aspell = xyes)

if test "x$threads" = "xyes"; then
    AC_CHECK_LIB(pthread, pthread_create)
    AC_CHECK_LIB(rt, sem_init)
fi

AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT