dnl Process this file with autoconf to produce a configure script.
AC_INIT(mudconf.h)
AC_CONFIG_HEADER(autoconf.h)
dnl Option checks
if test "$#" -gt 0; then
CONFIGURE_CMD="$0 $*"
else
CONFIGURE_CMD="$0"
fi
AC_SUBST(CONFIGURE_CMD)
AC_MSG_CHECKING(whether to build with SQL support)
AC_ARG_WITH(sql,
[ --with-sql=TYPE build with support for SQL database connection
(TYPE can be mysql or msql) [default=no]],
[
case "$withval" in
msql) SQL_S="db_msql.c"
SQL_O="db_msql.o"
AC_MSG_RESULT(msql) ;;
mysql) SQL_S="db_mysql.c"
SQL_O="db_mysql.o"
AC_MSG_RESULT(mysql) ;;
*) SQL_S="db_empty.c"
SQL_O="db_empty.o"
AC_MSG_RESULT(no) ;;
esac
], SQL_S="db_empty.c"
SQL_O="db_empty.o"
AC_MSG_RESULT(no))
AC_SUBST(SQL_S)
AC_SUBST(SQL_O)
AC_MSG_CHECKING(for location of SQL header files)
AC_ARG_WITH(sql-inc,
[ --with-sql-inc=PATH set the include path for SQL header files
[default for msql=/usr/local/Hughes/include]
[default for mysql=/usr/local/include/mysql]],
[
case "$with_sql" in
msql | mysql) SQL_I="-I$withval"
AC_MSG_RESULT($withval) ;;
*) AC_MSG_RESULT(none) ;;
esac
], [
case "$with_sql" in
msql) SQL_I="-I/usr/local/Hughes/include"
AC_MSG_RESULT(/usr/local/Hughes/include) ;;
mysql) SQL_I="-I/usr/local/include/mysql"
AC_MSG_RESULT(/usr/local/include/mysql) ;;
*) AC_MSG_RESULT(none) ;;
esac
])
AC_SUBST(SQL_I)
AC_MSG_CHECKING(for location of SQL library files)
AC_ARG_WITH(sql-libs,
[ --with-sql-libs=PATH set the library path for SQL library files
[default for msql=/usr/local/Hughes/lib]
[default for mysql=/usr/local/lib/mysql]],
[
case "$with_sql" in
msql | mysql) SQL_LIB="-L$withval"
AC_MSG_RESULT($withval) ;;
*) AC_MSG_RESULT(none) ;;
esac
], [
case "$with_sql" in
msql) SQL_LIB="-L/usr/local/Hughes/lib"
AC_MSG_RESULT(/usr/local/Hughes/lib) ;;
mysql) SQL_LIB="-L/usr/local/lib/mysql"
AC_MSG_RESULT(/usr/local/lib/mysql) ;;
*) AC_MSG_RESULT(none) ;;
esac
])
AC_MSG_CHECKING(whether to enable disk-based database)
AC_ARG_ENABLE(disk-based,
[ --enable-disk-based store the database on disk using a DBM hashfile,
and cache some attributes in a limited amount of
memory. The alternative is memory-based, where the
database is kept in memory. Disk-based uses less
memory and more disk space. Disabling the disk-based
cache can improve performance if enough memory is
available. [default=yes]],
[
if test "x$enableval" = "xno"; then
AC_DEFINE(MEMORY_BASED)
UDB_S="udb_ocache.c udb_ochunk.c udb_obj.c udb_misc.c"
UDB_O="udb_ocache.o udb_ochunk.o udb_obj.o udb_misc.o"
UDB_I="udb.h udb_defs.h"
AC_MSG_RESULT(no)
else
UDB_S="udb_ocache.c udb_ochunk.c udb_obj.c udb_misc.c"
UDB_O="udb_ocache.o udb_ochunk.o udb_obj.o udb_misc.o"
UDB_I="udb.h udb_defs.h"
AC_MSG_RESULT(yes)
fi
], [
UDB_S="udb_ocache.c udb_ochunk.c udb_obj.c udb_misc.c"
UDB_O="udb_ocache.o udb_ochunk.o udb_obj.o udb_misc.o"
UDB_I="udb.h udb_defs.h"
AC_MSG_RESULT(yes)
])
AC_SUBST(UDB_S)
AC_SUBST(UDB_O)
AC_SUBST(UDB_I)
AC_MSG_CHECKING(whether to enable port concentrator)
AC_ARG_ENABLE(concentrator,
[ --enable-concentrator use the port concentrator (not included with
the main distribution) if you hit resource limits
when too many connections are open at once (talk
to David) [default=no]],
[
if test "x$enableval" = "xno"; then
AC_MSG_RESULT(no)
else
CONC_S="newconc.c"
CONC_O="newconc.o"
AC_DEFINE(CONCENTRATE)
AC_MSG_RESULT(yes)
fi
], AC_MSG_RESULT(no))
AC_SUBST(CONC_S)
AC_SUBST(CONC_O)
AC_MSG_CHECKING(for which version of malloc to use)
AC_ARG_WITH(malloc,
[ --with-malloc=TYPE build with a particular malloc package.
TYPE can be sys (use your system libraries),
gnu (use our copy of GNU malloc), or trace (use
our GNU malloc with mtrace turned on). If your
system malloc library is broken for some reason,
try gnu. Don't use trace unless you're debugging
a memory leak or corruption problem and you're
willing to put up with the performance hit. Try
using Purify (make netmush-pure) if you have it.
[default=sys]],
[
case "$withval" in
gnu)
MALLOC_S="malloc.c"
MALLOC_O="malloc.o"
AC_MSG_RESULT(gnu)
;;
trace)
MALLOC_S="malloc.c mcheck.c mstats.c mtrace.c"
MALLOC_O="malloc.o mcheck.o mstats.o mtrace.o"
AC_DEFINE(MCHECK)
AC_DEFINE(MTRACE_FILE,"mtrace.out")
AC_MSG_RESULT(trace)
;;
*)
AC_MSG_RESULT(sys)
;;
esac
], AC_MSG_RESULT(sys))
AC_SUBST(MALLOC_S)
AC_SUBST(MALLOC_O)
AC_MSG_CHECKING(whether to build with Pueblo support)
AC_ARG_ENABLE(pueblo,
[ --enable-pueblo build with support for Pueblo client
[default=yes]],
[
if test "x$enableval" = "xno"; then
AC_MSG_RESULT(no)
else
AC_DEFINE(PUEBLO_SUPPORT)
AC_MSG_RESULT(yes)
fi
], AC_DEFINE(PUEBLO_SUPPORT)
AC_MSG_RESULT(yes))
AC_MSG_CHECKING(whether to use floating-point math)
AC_ARG_ENABLE(fpmath,
[ --enable-fpmath build math functions (lt, gt, add, etc.) with
IEEE 754 floating-point support instead of allowing
only integer calculations [default=yes]],
[
if test "x$enableval" = "xno"; then
AC_MSG_RESULT(no)
else
AC_DEFINE(FLOATING_POINTS)
AC_MSG_RESULT(yes)
fi
], AC_DEFINE(FLOATING_POINTS)
AC_MSG_RESULT(yes))
AC_MSG_CHECKING(whether to enable command lag detection)
AC_ARG_ENABLE(lag-checking,
[ --enable-lag-checking enable warnings that a certain command has
exceeded a certain amount of wall-clock time to
execute. Disable this if you have severe problems
with computational resources on your host machine.
[default=yes]],
[
if test "x$enableval" = "xno"; then
AC_DEFINE(NO_LAG_CHECK)
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
], AC_MSG_RESULT(yes))
AC_MSG_CHECKING(whether to enable per-object time usage tracking)
AC_ARG_ENABLE(time-checking,
[ --enable-time-checking enable tracking of the amount of wall-clock time
that individual objects are using. Disable this
if you have severe problems with computational
resources on your host machine. (This is assumed to
be disabled if lag-checking is disabled)
[default=yes]],
[
if test "x$enableval" = "xno"; then
AC_DEFINE(NO_TIMECHECKING)
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
], AC_MSG_RESULT(yes))
AC_MSG_CHECKING(whether to enable cpu time checking)
AC_ARG_ENABLE(cpu-checking,
[ --enable-cpu-checking for lag-checking and time-checking features,
use CPU time reported with getrusage() instead
of tracking wall-clock time. This is more accurate
but also more computationally expensive
[default=no]],
[
if test "x$enableval" = "xno"; then
AC_MSG_RESULT(no)
else
AC_DEFINE(TRACK_USER_TIME)
AC_MSG_RESULT(yes)
fi
], AC_MSG_RESULT(no))
AC_MSG_CHECKING(whether to enable malloc-wrapper macros)
AC_ARG_ENABLE(malloc-wrapper,
[ --enable-malloc-wrapper=TYPE
use wrapper macros for malloc(), free(), and
related functions to do one of the following,
which can help identify memory leaks:
track - maintain a tagged list of memory
allocated for purposes other than the
buffer pool (see @list raw_memory)
log - print log messages when the functions
are called. This is spammy; try other
debugging tools first
[default=no]],
[
case "$enableval" in
trac*)
AC_DEFINE(RAW_MEMTRACKING)
AC_MSG_RESULT(tracking) ;;
log*)
AC_DEFINE(TEST_MALLOC)
AC_MSG_RESULT(logging) ;;
*)
AC_MSG_RESULT(no) ;;
esac
], AC_MSG_RESULT(no))
AC_MSG_CHECKING(how many global registers to use)
AC_ARG_WITH(global-regs,
[ --with-global-regs=N use N global registers (%q0-%q9,%qa-%qz)
N must be a number from 10 to 36. Set lower
to conserve memory if you don't need all the
possible registers [default=36]],
[
if test "$withval" -lt "10"; then
AC_DEFINE(MAX_GLOBAL_REGS,10)
AC_MSG_RESULT(10)
elif test "$withval" -gt "36"; then
AC_DEFINE(MAX_GLOBAL_REGS,36)
AC_MSG_RESULT(36)
else
AC_DEFINE_UNQUOTED(MAX_GLOBAL_REGS,$withval)
AC_MSG_RESULT($withval)
fi
], AC_DEFINE(MAX_GLOBAL_REGS,36)
AC_MSG_RESULT(36))
AC_MSG_CHECKING(for modules to enable)
AC_ARG_ENABLE(modules,
[ --enable-modules=module1,module2,...
build and link with the specified modules.
Included modules are comsys, mail, and hello
[default=comsys,mail]],
[
if test "x$enableval" = "xno"; then
modules=""
AC_MSG_RESULT(none)
else
modules=`echo "$enableval" | tr ',' ' '`
AC_MSG_RESULT($enableval)
fi
], [
modules="comsys mail"
enableval="comsys,mail"
AC_MSG_RESULT($enableval)
])
if test -z "$modules"; then
AC_DEFINE(NEED_EMPTY_LTPLSYM)
fi
for module in $modules; do
if test ! -d "modules/$module"; then
AC_MSG_ERROR(no such module: $module)
fi
INCMODULECODE="include modules/${module}/Makefile.inc\\
${INCMODULECODE}"
MODULEDIRS="modules/${module} ${MODULEDIRS}"
done
AC_SUBST(INCMODULECODE)
dnl Program checks
AC_PROG_CC
AC_PROG_CPP
AC_PROG_MAKE_SET
dnl Platform checks
AC_ISC_POSIX
AC_MINIX
AC_AIX
dnl Figure out preprocessor args to do 'make depend' stuff
MKDEP=""
AC_MSG_CHECKING(for preprocessor flag to list dependencies)
SAVECPPFLAGS="$CPPFLAGS"
CPPFLAGS="$SAVECPPFLAGS -xM1"
AC_TRY_CPP(,
AC_MSG_RESULT(-xM1)
MKDEP="$CPP -xM1",
CPPFLAGS="$SAVECPPFLAGS -MM"
AC_TRY_CPP(,
AC_MSG_RESULT(-MM)
MKDEP="$CPP -MM",
CPPFLAGS="$SAVECPPFLAGS -M"
AC_TRY_CPP(,
AC_MSG_RESULT(-M)
MKDEP="CPP -M",
AC_MSG_RESULT(unknown))))
if test -z "$MKDEP"; then
AC_MSG_CHECKING(for compiler flag to list dependencies)
CPPFLAGS="$SAVECPPFLAGS -MM"
AC_TRY_COMPILE(,,
AC_MSG_RESULT(-MM)
MKDEP="$CC -MM",
CPPFLAGS="$SAVECPPFLAGS -M"
AC_TRY_COMPILE(,,
AC_MSG_RESULT(-M)
MKDEP="$CC -M",
AC_MSG_RESULT(unknown)))
fi
CPPFLAGS="$SAVECPPFLAGS"
if test -z "$MKDEP"; then
AC_PATH_PROG(MKDEP, mkdep, :)
MKDEP="$MKDEP -f -"
fi
AC_SUBST(MKDEP)
dnl Make sure we're properly linked dynamically
AC_LIBLTDL_CONVENIENCE
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
# XXX section added for ltdl
if test -z "$enable_ltdl_install$enable_ltdl_convenience"; then
if test -f ${srcdir}/ltconfig && test -f ${srcdir}/ltmain.sh; then
# if libltdl is libtoolized, it is assumed to be stand-alone and
# installed unless the command line overrides it (tested above)
enable_ltdl_install=yes
else
AC_MSG_WARN([*** The top-level configure must select either])
AC_MSG_WARN([*** [A""C_LIBLTDL_INSTALLABLE] or [A""C_LIBLTDL_CONVENIENCE].])
AC_MSG_ERROR([*** Maybe you want to --enable-ltdl-install?])
fi
fi
AM_INIT_AUTOMAKE(libltdl,1.0,-)
AM_MAINTAINER_MODE
AC_SUBST(LIBTOOL_DEPS)
AC_ARG_ENABLE(ltdl-install,
[ --enable-ltdl-install install libltdl])
AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
dnl Read the libtool configuration
rm -f conftest
./libtool --config > conftest
. ./conftest
rm -f conftest
AC_CACHE_CHECK([which extension is used for shared libraries],
libltdl_cv_shlibext, [dnl
(
last=
for spec in $library_names_spec; do
last="$spec"
done
changequote(, )
echo "$last" | sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//' > conftest
changequote([, ])
)
libltdl_cv_shlibext=`cat conftest`
rm -f conftest
])
if test -n "$libltdl_cv_shlibext"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
[Define to the extension used for shared libraries, say, ".so". ])
fi
AC_CACHE_CHECK([which variable specifies run-time library path],
libltdl_cv_shlibpath_var, [libltdl_cv_shlibpath_var="$shlibpath_var"])
if test -n "$libltdl_cv_shlibpath_var"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
[Define to the name of the environment variable that determines the dynamic library search path. ])
fi
AC_CACHE_CHECK([for objdir],
libltdl_cv_objdir, [libltdl_cv_objdir="$objdir"])
test -z "$libltdl_cv_objdir" && libltdl_cv_objdir=".libs"
AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/",
[Define to the sub-directory in which libtool stores uninstalled libraries. ])
AC_HEADER_STDC
AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h dld.h)
AC_CHECK_HEADERS(string.h strings.h, break)
AC_CHECK_FUNCS(strchr index, break)
AC_CHECK_FUNCS(strrchr rindex, break)
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
libltdl_cv_preloaded_symbols, [dnl
if test -n "$global_symbol_pipe"; then
libltdl_cv_preloaded_symbols=yes
else
libltdl_cv_preloaded_symbols=no
fi
])
if test x"$libltdl_cv_preloaded_symbols" = x"yes"; then
AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1,
[Define if libtool can extract symbol lists from object files. ])
fi
LIBADD_DL=
AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1) LIBADD_DL="-ldl"],
[AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL, 1)])])
AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1)],
[AC_CHECK_LIB(dld, shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1) LIBADD_DL="$LIBADD_DL -ldld"])])
AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1)dnl
test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="$LIBADD_DL -ldld"])
AC_SUBST(LIBADD_DL)
if test "x$ac_cv_func_dlopen" = xyes || test "x$ac_cv_lib_dl_dlopen" = xyes; then
LIBS_SAVE="$LIBS"
LIBS="$LIBS $LIBADD_DL"
AC_CHECK_FUNCS(dlerror)
LIBS="$LIBS_SAVE"
fi
dnl Check for command to grab the raw symbol name followed
dnl by C symbol name from nm.
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_NM])dnl
# Check for command to grab the raw symbol name followed by C symbol from nm.
AC_MSG_CHECKING([command to parse $NM output])
AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
[# These are sane defaults that work on at least a few old systems.
# {They come from Ultrix. What could be older than Ultrix?!! ;)}
changequote(,)dnl
# Character class describing NM global symbol codes.
ac_symcode='[BCDEGRST]'
# Regexp to match symbols that can be accessed directly from C.
ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
# Transform the above into a raw symbol and a C symbol.
ac_symxfrm='\1 \2\3 \3'
# Transform an extracted symbol line into a proper C declaration
ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
# Define system-specific variables.
case "$host_os" in
aix*)
ac_symcode='[BCDT]'
;;
cygwin* | mingw*)
ac_symcode='[ABCDGISTW]'
;;
hpux*)
ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
;;
irix*)
ac_symcode='[BCDEGRST]'
;;
solaris*)
ac_symcode='[BDT]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
ac_symcode='[ABCDGISTW]'
fi
changequote([,])dnl
# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($ac_symcode\)[ ][ ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
# Check to see that the pipe works correctly.
ac_pipe_works=no
rm -f conftest.$ac_ext
cat > conftest.$ac_ext <<EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# Try sorting and uniquifying the output.
if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
mv -f "$ac_nlist"T "$ac_nlist"
else
rm -f "$ac_nlist"T
fi
# Make sure that we snagged all the symbols we need.
if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
cat <<EOF > conftest.c
#ifdef __cplusplus
extern "C" {
#endif
EOF
# Now generate the symbol file.
eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
cat <<EOF >> conftest.c
#if defined (__STDC__) && __STDC__
# define lt_ptr_t void *
#else
# define lt_ptr_t char *
# define const
#endif
/* The mapping between symbol names and symbols. */
const struct {
const char *name;
lt_ptr_t address;
}
changequote(,)dnl
lt_preloaded_symbols[] =
changequote([,])dnl
{
EOF
sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
cat <<\EOF >> conftest.c
{0, (lt_ptr_t) 0}
};
#ifdef __cplusplus
}
#endif
EOF
# Now try linking the two files.
mv conftest.$ac_objext conftstm.$ac_objext
ac_save_LIBS="$LIBS"
ac_save_CFLAGS="$CFLAGS"
LIBS="conftstm.$ac_objext"
CFLAGS="$CFLAGS$no_builtin_flag"
if AC_TRY_EVAL(ac_link) && test -s conftest; then
ac_pipe_works=yes
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
LIBS="$ac_save_LIBS"
CFLAGS="$ac_save_CFLAGS"
else
echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
fi
else
echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
fi
else
echo "$progname: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
rm -rf conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$ac_pipe_works" = yes; then
if test x"$ac_symprfx" = x"_"; then
ac_cv_sys_symbol_underscore=yes
else
ac_cv_sys_symbol_underscore=no
fi
break
else
ac_cv_sys_global_symbol_pipe=
fi
done
])
ac_result=yes
if test -z "$ac_cv_sys_global_symbol_pipe"; then
ac_result=no
fi
AC_MSG_RESULT($ac_result)
dnl does the compiler prefix global symbols with an underscore?
AC_MSG_CHECKING([for _ prefix in compiled symbols])
AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
[ac_cv_sys_symbol_underscore=no
cat > conftest.$ac_ext <<EOF
void nm_test_func(){}
int main(){nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# See whether the symbols have a leading underscore.
if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
ac_cv_sys_symbol_underscore=yes
else
if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
:
else
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
fi
fi
else
echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
fi
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
fi
rm -rf conftest*
])
AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
if test x"$ac_cv_sys_symbol_underscore" = xyes; then
if test x"$ac_cv_func_dlopen" = xyes ||
test x"$ac_cv_lib_dl_dlopen" = xyes ; then
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
libltdl_cv_need_uscore, [dnl
AC_TRY_RUN([
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <stdio.h>
#ifdef RTLD_GLOBAL
# define LTDL_GLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LTDL_GLOBAL DL_GLOBAL
# else
# define LTDL_GLOBAL 0
# endif
#endif
/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LTDL_LAZY_OR_NOW
# ifdef RTLD_LAZY
# define LTDL_LAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LTDL_LAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LTDL_LAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LTDL_LAZY_OR_NOW DL_NOW
# else
# define LTDL_LAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
if(ptr1 && !ptr2) { dlclose(self); exit(0); } } exit(1); }
], libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
libltdl_cv_need_uscore=cross
)])
fi
fi
if test x"$libltdl_cv_need_uscore" = xyes; then
AC_DEFINE(NEED_USCORE, 1,
[Define if dlsym() requires a leading underscode in symbol names. ])
fi
# XXX end of section added for ltdl
dnl Library checks
SAVELDFLAGS="$LDFLAGS"
LDFLAGS="-L./gdbm-1.8.0/.libs $SAVELDFLAGS"
AC_CHECK_LIB(tinygdbm, main,
LIBS="-L./gdbm-1.8.0/.libs -ltinygdbm $LIBS",
AC_MSG_ERROR(This program requires TinyMUSH GNU DBM (src/gdbm-1.8.0) to be built first), )
case "$with_sql" in
msql)
LDFLAGS="$SQL_LIB $SAVELDFLAGS"
AC_CHECK_LIB(msql, main,
LIBS="$SQL_LIB -lmsql $LIBS",
AC_MSG_ERROR(unable to build with msql), ) ;;
mysql)
LDFLAGS="$SQL_LIB $SAVELDFLAGS"
AC_CHECK_LIB(z, compress)
AC_CHECK_LIB(mysqlclient, mysql_real_connect,
LIBS="$SQL_LIB -lmysqlclient $LIBS",
AC_MSG_ERROR(unable to build with mysql), ) ;;
esac
AC_CHECK_LIB(crypt, main)
AC_CHECK_LIB(resolv, main)
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(inet, gethostbyaddr)
AC_CHECK_LIB(m, main)
AC_SUBST(LIBOBJS)
dnl Header checks
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(unistd.h memory.h string.h errno.h malloc.h sys/select.h)
AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h sys/stat.h)
dnl Structure, Typedef, Compiler checks
AC_C_CONST
AC_C_CHAR_UNSIGNED
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_ST_BLKSIZE
AC_MSG_CHECKING(for struct linger)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],
[struct linger ling; ling.l_onoff = 1;],
AC_DEFINE(HAVE_LINGER) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING(for union wait)
AC_TRY_COMPILE([#include <sys/wait.h>],[union wait stat;],
AC_DEFINE(HAVE_UNION_WAIT)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for struct rusage completeness)
AC_TRY_COMPILE([#include <sys/resource.h>],
[struct rusage usage; usage.ru_ixrss = 1],
AC_DEFINE(STRUCT_RUSAGE_COMPLETE)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for signal SIGCHLD braindamage)
AC_TRY_RUN([
#include <sys/types.h>
#include <signal.h>
#ifndef SIGCHLD
#define SIGCHLD SIGCLD
#endif
int rlev;
RETSIGTYPE sighand(sig)
int sig;
{
int stat;
if (rlev++ > 2)
exit(1);
signal(SIGCHLD, sighand);
wait(&stat);
return;
}
main(argc, argv)
int argc;
char **argv;
{
rlev = 0;
signal(SIGCHLD, sighand);
if (fork()) {
sleep(10);
} else {
sleep(2);
exit(1);
}
exit(0);
}
], AC_MSG_RESULT(no),
AC_DEFINE(SIGNAL_SIGCHLD_BRAINDAMAGE)
AC_MSG_RESULT(yes),
AC_DEFINE(SIGNAL_SIGCHLD_BRAINDAMAGE)
AC_MSG_RESULT(unable to test... assuming yes))
AC_MSG_CHECKING(for broken small struct padding)
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
main(argc, argv)
int argc;
char **argv;
{
struct in_addr addr;
char *dq;
addr.s_addr = htonl(0x01020304);
dq = inet_ntoa(addr);
if (dq[0] != '1' || dq[1] != '.' || dq[2] != '2' || dq[3] != '.' ||
dq[4] != '3' || dq[5] != '.' || dq[6] != '4' || dq[7] != '\0')
return 1;
return 0;
}],AC_MSG_RESULT(no),
AC_DEFINE(BROKEN_GCC_PADDING)
AC_MSG_RESULT(yes),
AC_DEFINE(BROKEN_GCC_PADDING)
AC_MSG_RESULT(unable to test... assuming yes))
dnl Function checks
AC_FUNC_VFORK
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(setrlimit getrusage timelocal mktime srandom)
AC_CHECK_FUNCS(getdtablesize socket gethostbyaddr)
AC_CHECK_FUNCS(gettimeofday select wait3 wait4 strtok_r strcspn)
AC_CHECK_FUNCS(getpagesize strchr memset vsnprintf)
dnl Declaration checks
AC_DECL_SYS_SIGLIST
AC_MSG_CHECKING(for sys_signame decl)
AC_EGREP_HEADER(sys_signame,signal.h,AC_DEFINE(HAVE_SYS_SIGNAME) AC_MSG_RESULT(yes),AC_MSG_RESULT(no))
AC_MSG_CHECKING(for getpagesize dcl)
AC_EGREP_HEADER(getpagesize,unistd.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_GETPAGESIZE_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for malloc dcl)
AC_EGREP_HEADER(realloc,stdlib.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_MALLOC_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for vsprintf dcl)
AC_EGREP_HEADER(vsprintf,stdio.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_VSPRINTF_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for sprintf dcl)
AC_EGREP_HEADER(\<sprintf|\<*sprintf,stdio.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_SPRINTF_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for extended stdio dcls)
AC_EGREP_HEADER(fread,stdio.h,AC_DEFINE(EXTENDED_STDIO_DCLS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING(for extended socket dcls)
AC_EGREP_HEADER(setsockopt,sys/socket.h,AC_DEFINE(EXTENDED_SOCKET_DCLS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING(for gettimeofday dcl)
if test $ac_cv_header_time = yes && test $ac_cv_header_sys_time_h = yes ; then
AC_EGREP_HEADER(gettimeofday,[time.h>
#include <sys/time.h],AC_MSG_RESULT(yes),AC_DEFINE(NEED_GETTIMEOFDAY_DCL) AC_MSG_RESULT(no))
elif test $ac_cv_header_sys_time_h = yes ; then
AC_EGREP_HEADER(gettimeofday,sys/time.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_GETTIMEOFDAY_DCL) AC_MSG_RESULT(no))
else
AC_EGREP_HEADER(gettimeofday,time.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_GETTIMEOFDAY_DCL) AC_MSG_RESULT(no))
fi
if test $ac_cv_header_sys_wait_h = yes ; then
AC_MSG_CHECKING(for wait3 dcl)
AC_EGREP_HEADER(wait3,sys/wait.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_WAIT3_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for wait4 dcl)
AC_EGREP_HEADER(wait4,sys/wait.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_WAIT4_DCL) AC_MSG_RESULT(no))
fi
AC_MSG_CHECKING(for srandom dcl)
AC_EGREP_HEADER(srandom,math.h,AC_MSG_RESULT(yes),AC_EGREP_HEADER(srandom,stdlib.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_SRANDOM_DCL) AC_MSG_RESULT(no)))
AC_MSG_CHECKING(for random dcl)
AC_EGREP_HEADER(extern * random,stdlib.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_RANDOM_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for perror dcl)
AC_EGREP_HEADER(perror,errno.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_PERROR_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for getrusage dcl)
AC_EGREP_HEADER(getrusage,sys/resource.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_GETRUSAGE_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for getrlimit dcl)
AC_EGREP_HEADER(getrlimit,sys/resource.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_GETRLIMIT_DCL) AC_MSG_RESULT(no))
AC_MSG_CHECKING(for strtok_r dcl)
AC_EGREP_HEADER(strtok_r,string.h,AC_MSG_RESULT(yes),AC_DEFINE(NEED_STRTOK_R_DCL) AC_MSG_RESULT(no))
dnl Configure for modules.
AC_CONFIG_SUBDIRS($MODULEDIRS)
AC_OUTPUT(Makefile)