Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
506 lines (473 sloc) 14.4 KB
dnl Process this file with autoconf to produce a configure script.
AC_INIT(Hybserv2, 1.9.5, dinko.korunic@gmail.com)
AC_PREREQ(2.60)
AC_COPYRIGHT([Copyright (c) 1999-2013 Hybserv2 team])
AC_CONFIG_HEADER(include/defs.h)
dnl We need to check for the compiler up here to avoid anything else
dnl starting with a different one.
AC_PROG_CC([clang llvm-gcc gcc cc])
AC_PROG_CPP
dnl Get version and revision number
if test -d "$srcdir/.git"; then
if git help >/dev/null 2>&1; then
ac_cv_revision="git-"`git rev-parse --short HEAD`
else
ac_cv_revision="git-unknown"
fi
else
ac_cv_revision="release"
fi
ac_cv_version="$PACKAGE_VERSION-$ac_cv_revision"
AC_SUBST(ac_cv_version)
AC_DEFINE_UNQUOTED(HYBSERV_VERSION, ["$ac_cv_version"],
[Hybserv release version])
AC_MSG_NOTICE([configuring Hybserv2 $ac_cv_version])
dnl Set language and save it
AC_LANG_C
dnl Get system type
AC_CANONICAL_HOST
MYHOST=$host_os
case "$host_os" in
*sunos*|*solaris*)
AC_DEFINE(HAVE_SOLARIS, 1, [Define to 1 if you have Solaris OS])
;;
*cygwin)
AC_DEFINE(HAVE_CYGWIN, 1, [Define to 1 if you have Cygwin environment])
esac
dnl Standard installation path
AC_PREFIX_DEFAULT(/usr/local)
dnl Compiler environment
AC_GNU_SOURCE
AC_ISC_POSIX
AC_C_INLINE
AC_C_CONST
AC_SYS_LARGEFILE
AC_C_BIGENDIAN
AC_USE_SYSTEM_EXTENSIONS
dnl Check for more detailed compiler info
if test "x$ac_cv_c_compiler_gnu" != "xyes"; then
AC_MSG_CHECKING([$CC -version for TenDRA or MIPSpro cc])
case `$CC -version 2>&1` in
*TenDRA*)
AC_MSG_RESULT([TenDRA cc])
CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -Ysystem"
ac_cv_c_compiler="TenDRA"
;;
*MIPSpro*)
AC_MSG_RESULT([MIPSpro cc])
ac_cv_c_compiler="MIPSpro"
;;
*)
AC_MSG_RESULT(no)
;;
esac
AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
case `$CC -V 2>&1` in
*Sun*WorkShop* | *Forte*Developer* | *Sun*C*)
AC_MSG_RESULT([Sun Workshop/Forte])
ac_cv_c_compiler="SunWorkShop"
;;
*Tru64*)
AC_MSG_RESULT([Tru64 cc])
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
ac_cv_c_compiler="Tru64"
;;
*HP*ANSI*)
AC_MSG_RESULT(HPUX cc)
CFLAGS="$CFLAGS +e"
ac_cv_c_compiler="HPUX"
;;
*)
AC_MSG_RESULT(no)
;;
esac
fi
dnl Checks for programs
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_CHECK_TOOL(RANLIB, ranlib, ':')
AC_CHECK_TOOL(AR, ar, ':')
AC_PATH_PROG(RM, rm)
AC_PATH_PROG(CP, cp)
AC_PATH_PROG(MV, mv)
AC_PATH_PROG(LN, ln)
AC_PATH_PROG(TOUCH, touch)
AC_PATH_PROG(MKDIR, mkdir)
dnl Find what to use as dependancy generator
AC_PATH_PROG(MKDEP, mkdep)
AC_PATH_PROG(MAKEDEPEND, makedepend)
AC_MSG_CHECKING([how to generate dependency info])
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
AC_MSG_RESULT($CC -MM)
MKDEP="$CC -MM"
elif test "x$ac_cv_c_compiler" = "xSunWorkShop"; then
AC_MSG_RESULT($CC -xM)
MKDEP="$CC -xM"
elif test "x$MKDEP" != "x"; then
AC_MSG_RESULT(mkdep)
elif test "x$MAKEDEPEND" != "x"; then
AC_MSG_RESULT(makedepend)
MKDEP="$MAKEDEPEND -f-"
else
AC_MSG_RESULT([nothing suitable])
MKDEP=":"
fi
AC_SUBST(MKDEP)
dnl Checks for header files
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_CHECK_HEADERS([errno.h assert.h netdb.h fcntl.h signal.h \
limits.h arpa/inet.h netinet/in.h netinet/tcp.h \
sys/socket.h sys/resource.h sys/signal.h])
dnl Checks for additional types and headers
AC_CHECK_TYPE(socklen_t, ,
[AC_DEFINE([socklen_t], [unsigned int],
[If we don't have a real socklen_t, unsigned int is good enough])],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_MEMBER([struct sockaddr.sa_len],
[AC_DEFINE(HAVE_SOCKADDR_LEN, 1,
[Define to 1 if you have sockaddr.sa_len])], ,
[#include <sys/types.h>
#include <sys/socket.h>])
AC_MSG_CHECKING([struct sockaddr_storage])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <sys/types.h>
#include <sys/socket.h>
struct sockaddr_storage x;
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1,
[Define to 1 if you have struct sockaddr_storage])],
[AC_MSG_RESULT(no)])
dnl And check if we have IPv6 libraries
AC_MSG_CHECKING([compile with ipv6 support])
ac_cv_ipv6type=unknown
AC_ARG_ENABLE(ipv6,
[ --disable-ipv6 Disable IPv6 support [[default=no]]],
[cf_enable_ipv6=$enableval],
[cf_enable_ipv6="yes"])
if test "x$cf_enable_ipv6" = "xyes"; then
AC_MSG_RESULT(yes)
AC_MSG_CHECKING([ipv6 stack type])
for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
case "$i" in
inria)
# http://www.kame.net/
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <netinet/in.h>
#if !defined IPV6_INRIA_VERSION
no
#endif
]])],
[ac_cv_ipv6type="$i"
AC_DEFINE(INET6, 1, [Define to 1 if you have IPv6])
])
;;
kame)
# http://www.kame.net/
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <netinet/in.h>
#if !defined __KAME__
no
#endif
]])],
[ac_cv_ipv6type="$i"
AC_DEFINE(INET6, 1, [Define to 1 if you have IPv6])
])
;;
linux-glibc)
# http://www.v6.linux.or.jp/
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <features.h>
#if !defined(__GLIBC__) || (__GLIBC__ < 2 && __GLIBC_MINOR__ < 1 )
no
#endif
]])],
[ac_cv_ipv6type="$i"
AC_DEFINE(INET6, 1, [Define to 1 if you have IPv6])
])
;;
linux-inet6)
# http://www.v6.linux.or.jp/
if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then
ac_cv_ipv6type="$i"
AC_DEFINE(INET6, 1, [Define to 1 if you have IPv6])
CFLAGS="$CFLAGS -I/usr/inet6/include"
LIBS="$LIBS -linet6"
LDFLAGS="$LDFLAGS -L/usr/inet6/lib"
fi
;;
toshiba)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <sys/param.h>
#if !defined _TOSHIBA_INET6
no
#endif
]])],
[ac_cv_ipv6type="$i"
AC_DEFINE(INET6, 1, [Define to 1 if you have IPv6])
CFLAGS="$CFLAGS -I/usr/local/v6/include"
LIBS="$LIBS -linet6"
LDFLAGS="$LDFLAGS -L/usr/local/v6/lib"
])
;;
v6d)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include </usr/local/v6/include/sys/v6config.h>
#if !defined __V6D__
no
#endif
]])],
[ac_cv_ipv6type="$i"
AC_DEFINE(INET6, 1, [Define to 1 if you have IPv6])
CFLAGS="$CFLAGS -I/usr/local/v6/include"
LIBS="$LIBS -lv6"
LDFLAGS="$LDFLAGS -L/usr/local/v6/lib"
])
;;
zeta)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <sys/param.h>
#if !defined _ZETA_MINAMI_INET6
no
#endif
]])],
[ac_cv_ipv6type="$i"
AC_DEFINE(INET6, 1, [Define to 1 if you have IPv6])
CFLAGS="$CFLAGS -I/usr/local/v6/include"
LIBS="$LIBS -lv6"
LDFLAGS="$LDFLAGS -L/usr/local/v6/lib"
])
;;
esac
if test "x$ac_cv_ipv6type" != "xunknown"; then
break
fi
done
AC_MSG_RESULT([$ac_cv_ipv6type])
AC_SEARCH_LIBS(getaddrinfo, inet6)
else
AC_MSG_RESULT(no)
fi
dnl Checks for library functions
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([select strchr memcpy gettimeofday])
AC_SEARCH_LIBS(socket, socket, ,
[AC_MSG_ERROR([You have no socket()! Aborting])])
AC_SEARCH_LIBS(crypt, [crypt descrypt])
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(inet_ntoa, resolv)
AC_SEARCH_LIBS(inet_ntop, resolv)
AC_SEARCH_LIBS(inet_pton, resolv)
AC_CHECK_FUNCS(getnameinfo, , [AC_LIBOBJ(getnameinfo)])
AC_CHECK_FUNCS(getaddrinfo, , [AC_LIBOBJ(getaddrinfo)])
AC_CHECK_FUNCS(inet_ntoa, , [AC_LIBOBJ(inet_ntoa)])
AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(inet_ntop)])
AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(inet_pton)])
AC_CHECK_FUNCS(strtoul, , [AC_LIBOBJ(strtoul)])
AC_CHECK_FUNCS(strlcat, , [AC_LIBOBJ(strlcat)])
AC_CHECK_FUNCS(strlcpy, , [AC_LIBOBJ(strlcpy)])
AC_CHECK_FUNCS(strerror, , [AC_LIBOBJ(strerror)])
AC_CHECK_FUNCS(strdup, , [AC_LIBOBJ(strdup)])
dnl Check if getaddr info is broken for 32bit IPv4 integer notation
AC_MSG_CHECKING([is getaddrinfo broken for integer notation])
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
]],
[[char name[] = "2130706433";
struct addrinfo *res = NULL;
return getaddrinfo(name, NULL, NULL, &res);
]])],
[AC_MSG_RESULT(no)],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BROKEN_INT_GETADDRINFO, 1,
[Define to 1 if you have broken getaddrinfo for integer notation])])
dnl Check if we have sys_errlist
AC_MSG_CHECKING([if libc defines sys_errlist])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <stdio.h>
]],
[[printf("%s", sys_errlist[0]);
return 0;
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SYS_ERRLIST, 1,
[Define to 1 if you have *sys_errlist])],
[AC_MSG_RESULT(no)])
dnl Check if we have sys_nerr
AC_MSG_CHECKING([if libc defines sys_nerr])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <stdio.h>
]],
[[printf("%d", sys_nerr);
]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SYS_NERR, 1,
[Define to 1 if you have sys_nerr])],
[AC_MSG_RESULT(no)])
dnl Try libefence support
AC_MSG_CHECKING([compile with electricfence library])
AC_ARG_ENABLE(efence,
[ --enable-efence Enable Electric Fence support [[default=no]]],
[cf_enable_efence=$enableval],
[cf_enable_efence="no"])
if test "x$cf_enable_efence" = "xyes"; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB(efence, malloc,
[LIBS="$LIBS -lefence"],
[cf_enable_efence="no"])
else
AC_MSG_RESULT(no)
fi
dnl Try dmalloc support
AC_MSG_CHECKING([compile with malloc debugging libs])
AC_ARG_ENABLE(dmalloc,
[ --enable-dmalloc Enable dmalloc support [[default=no]]],
[cf_enable_dmalloc=$enableval],
[cf_enable_dmalloc="no"])
if test "x$cf_enable_dmalloc" = "xyes"; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB(dmalloc, malloc,
[CFLAGS="$CFLAGS -U_GNU_SOURCE"
LIBS="$LIBS -ldmalloc"],
[cf_enable_dmalloc="no"])
else
AC_MSG_RESULT(no)
fi
dnl Try Boehm GC support
AC_MSG_CHECKING([compile with Boehm Garbage Collector])
AC_ARG_ENABLE(boehm-gc,
[ --enable-boehm-gc Enable Boehm GC support [[default=yes]]],
[cf_enable_boehm_gc=$enableval],
[cf_enable_boehm_gc="yes"])
if test "x$cf_enable_boehm_gc" = "xyes"; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB(gc, GC_malloc,
[AC_CHECK_HEADERS(gc/gc.h gc.h)
AC_DEFINE(HAVE_BOEHM_GC, 1, [Define this to enable Boehm GC])
LIBS="$LIBS -lgc"],
[cf_enable_boehm_gc="no"])
else
AC_MSG_RESULT(no)
fi
dnl Get nick/chan/topic length
AC_ARG_WITH(nicklen,
[ --with-nicklen=LENGTH Sets nick length to LENGTH [[default=18]]],
[ac_cv_nicklen=$withval], [ac_cv_nicklen="18"])
AC_MSG_RESULT([checking nick length... $ac_cv_nicklen])
AC_ARG_WITH(channellen,
[ --with-channellen=LENGTH Sets channel length to LENGTH [[default=200]]],
[ac_cv_channellen=$withval], [ac_cv_channellen="200"])
AC_MSG_RESULT([checking channel length... $ac_cv_channellen])
AC_ARG_WITH(topiclen,
[ --with-topiclen=LENGTH Sets topic length to LENGTH [[default=160]]],
[ac_cv_topiclen=$withval], [ac_cv_topiclen="160"])
AC_MSG_RESULT([checking topic length... $ac_cv_topiclen])
dnl Get the network identificator
AC_ARG_WITH(network,
[ --with-network=TYPE Sets network type TYPE],
[ac_cv_network=$withval], [ac_cv_network="no"])
if test "x$ac_cv_network" = "xyes"; then
ac_cv_network="hybrid7"
fi
AC_MSG_RESULT([checking network type... $ac_cv_network])
if test "x$ac_cv_network" = "xhybrid"; then
ac_cv_nicklen=9
ac_cv_channellen=200
ac_cv_topiclen=120
elif test "x$ac_cv_network" = "xhybrid7"; then
ac_cv_nicklen=18
ac_cv_channellen=200
ac_cv_topiclen=160
elif test "x$ac_cv_network" = "xidolnet"; then
ac_cv_nicklen=18
ac_cv_channellen=200
ac_cv_topiclen=240
elif test "x$ac_cv_network" = "xbalcannet"; then
ac_cv_nicklen=24
ac_cv_channellen=200
ac_cv_topiclen=400
elif test "x$ac_cv_network" = "xdancer"; then
ac_cv_nicklen=20
ac_cv_channellen=30
ac_cv_topiclen=450
elif test "x$ac_cv_network" = "xratbox"; then
ac_cv_nicklen=9
ac_cv_channellen=200
ac_cv_topiclen=160
fi
AC_DEFINE_UNQUOTED(NICKLEN, $ac_cv_nicklen, [Define to nick length])
AC_DEFINE_UNQUOTED(CHANNELLEN, $ac_cv_channellen, [Define to channel length])
AC_DEFINE_UNQUOTED(TOPICLEN, $ac_cv_topiclen, [Define to topic length])
dnl Check if asserts are to be enabled
AC_MSG_CHECKING([compile with asserts enabled])
AC_ARG_ENABLE(asserts,
[ --enable-asserts Enable asserts in code [[default=no]]],
[cf_enable_asserts=$enableval],
[cf_enable_asserts="no"])
if test "x$cf_enable_asserts" = "xno"; then
AC_MSG_RESULT(no)
AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support])
elif test "x$cf_enable_asserts" = "xsoft"; then
AC_MSG_RESULT(soft)
AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts])
AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support])
else
AC_MSG_RESULT(yes)
fi
dnl Check if coredumping is to be enabled
AC_MSG_CHECKING([compile with core dumping enabled])
AC_ARG_ENABLE(gimmecore,
[ --enable-gimmecore Enable core dumping [[default=yes]]],
[cf_enable_gimmecore=$enableval],
[cf_enable_gimmecore="yes"])
if test "x$cf_enable_gimmecore" = "xno"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_DEFINE(GIMMECORE, 1, [Define this to enable core dumping])
fi
dnl Check if program is to be monitored under daemontools
AC_MSG_CHECKING([compile for daemontools])
AC_ARG_ENABLE(daemontools,
[ --enable-daemontools Enable daemontools support [[default=no]]],
[cf_enable_daemontools=$enableval],
[cf_enable_daemontools="no"])
if test "x$cf_enable_daemontools" = "xyes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(DAEMONTOOLS, 1, [Define this to enable daemontools support])
else
AC_MSG_RESULT(no)
fi
AC_OUTPUT(Makefile compat/Makefile src/Makefile tools/Makefile \
bin/settings.conf bin/cleandb include/config.h)
echo "
Configuration:
C Compiler ........... ${CC}
C Compiler flags...... ${CFLAGS}
Linker flags ......... ${LIBS} ${LDFLAGS}
Source revision ...... ${ac_cv_revision}
Package revision ..... ${ac_cv_version}
Detected OS .......... ${host_os}
Install path ......... ${prefix}/hybserv
Compile configuration:
Configured network ... ${ac_cv_network}
Nick length .......... ${ac_cv_nicklen}
Channel length ....... ${ac_cv_channellen}
Topic length ......... ${ac_cv_topiclen}
Extra configuration:
LibEfence enabled .... ${cf_enable_efence}
Dmalloc enabled ...... ${cf_enable_dmalloc}
Boehm GC enabled ..... ${cf_enable_boehm_gc}
Asserts enabled ...... ${cf_enable_asserts}
Coredumps enabled .... ${cf_enable_gimmecore}
Daemontools enabled .. ${cf_enable_daemontools}
NOTE: Please edit include/config.h to change the settings
to match your network before running make!"
dnl vim: ts=4:et