]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - configure.ac
ShadowIRCd 6.3.2.1
[irc/rqf/shadowircd.git] / configure.ac
index d68f1470c96a66d5213c6bc24a4f6de75dc810f7..a7df4cf03e1e9302dee036f269dbcef17b0fdd94 100644 (file)
@@ -10,7 +10,7 @@ AC_PREREQ(2.57)
 dnl Sneaky way to get an Id tag into the configure script
 AC_COPYRIGHT([$Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $])
 
-AC_INIT([charybdis],[3.0.0-alpha1])
+AC_INIT([shadowircd],[6.3.2.1])
 
 AC_CONFIG_HEADER(include/setup.h)
 
@@ -81,7 +81,7 @@ esac
 
 fi
 
-AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
+AC_MSG_CHECKING([uname -s for Solaris, AIX or HPUX])
 OSNAME=`uname -s`
 case "$OSNAME" in
         HP-UX*)
@@ -96,10 +96,6 @@ case "$OSNAME" in
                        AC_MSG_RESULT(already using newer HPUX)
                fi
        ;;
-       CYGWIN*)
-               AC_MSG_RESULT(Cygwin)
-               CYGWIN=yes
-       ;;
        SunOS*)
                AC_MSG_RESULT(SunOS or Solaris)
                AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
@@ -128,7 +124,7 @@ if test "$ac_cv_c_compiler_gnu" = yes; then
        ;;
        esac
 
-       IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall"
+       IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -std=gnu99"
 fi
 
 dnl If we support -g, use it!
@@ -229,12 +225,37 @@ if test "$LEX" = ":"; then
        AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
 fi
 
+AC_ARG_ENABLE([fhs-paths],
+       [AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])],
+       [],
+       [dnl detect if the user appears to want --enable-fhs-paths
+       AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \
+               test "$localstatedir" = '${prefix}/var' && \
+               test "$libdir" = '${exec_prefix}/lib'],
+               [enable_fhs_paths=no],
+               [enable_fhs_paths=yes])
+       ])
 dnl use directory structure of cached as default (hack)
-if test "$libexecdir" = '${exec_prefix}/libexec' &&
-   test "$localstatedir" = '${prefix}/var'; then
-       libexecdir='${bindir}'
+AS_IF([test "x$enable_fhs_paths" = "xyes"],
+       [dnl Avoid name collisions.
+       pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
+       rundir=${rundir-'${prefix}/run'}
+       pkgrundir='${rundir}/${PACKAGE_TARNAME}'
+       pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'],
+       [libexecdir='${bindir}'
+       pkglibexecdir='${libexecdir}'
+       rundir='${sysconfdir}'
+       pkgrundir='${rundir}'
        localstatedir='${prefix}'
-fi
+       pkglocalstatedir='${sysconfdir}'])
+pkglibdir='${libdir}/${PACKAGE_TARNAME}'
+AC_SUBST([pkglibdir])
+AC_SUBST([rundir])
+AC_SUBST([pkgrundir])
+AC_SUBST([pkglocalstatedir])
+AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as band database]])
+AC_SUBST([pkglibexecdir])
+AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live])
 
 dnl Checks for header files.
 AC_HEADER_STDC
@@ -255,44 +276,6 @@ AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
 
-dnl Memory manager
-dnl ==============
-
-AC_MSG_CHECKING([the system's memory page size])
-pagesize="no"
-AC_TRY_RUN([
-#include <stdio.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-int main(void) {
-    FILE *fp = fopen("conftest.malloc", "w");
-
-    if (fp != NULL) {
-        fprintf(fp, "%d\n", getpagesize());
-        fclose(fp);
-    } else
-        exit(1);
-    exit(0);
-}],[
-if test -f "conftest.malloc" ; then
-    pagesize=`cat conftest.malloc`
-fi
-])
-if test "$pagesize" != "no" ; then
-    AC_MSG_RESULT($pagesize)
-else
-    if test "$ac_cv_sizeof_int" = "4" ; then
-        pagesize=4096
-    else
-        pagesize=8192
-    fi
-    AC_MSG_RESULT([$pagesize (guessing)])
-fi
-AC_DEFINE_UNQUOTED(MALLOC_PAGESIZE, $pagesize,
-    [the system's memory page size])
-
 dnl Networking Functions
 dnl ====================
 
@@ -303,11 +286,6 @@ if test x"$SUN" = xyes; then
        AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
 fi
 
-AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len'
-member.])],,[[#include <sys/types.h>
-#include <sys/socket.h>
-]])
-
 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.])],
@@ -317,50 +295,6 @@ AC_CHECK_TYPE(socklen_t, ,
 AC_ARG_ENABLE(ipv6,
 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
 
-if test $ipv6 != yes; then
-       have_v6="no"
-else
-AC_MSG_CHECKING([for core IPv6 support])
-
-AC_COMPILE_IFELSE(
-[AC_LANG_PROGRAM(
-       [[#define IN_AUTOCONF
-       #include <sys/types.h>
-       #include <sys/socket.h>
-       #include <netinet/in.h>]],
-       [[struct sockaddr_in6 s; 
-         s.sin6_family = 0;]]
-       )],
-[
-       if test "$CYGWIN" = "yes"; then
-               AC_MSG_RESULT([no, Cygwin's IPv6 is incomplete])
-               have_v6=no
-       else
-               have_v6=yes
-               AC_DEFINE(IPV6, 1, [Define if IPv6 support is present and available.])
-               AC_MSG_RESULT(yes)
-               AC_MSG_CHECKING([for struct in6addr_any])
-               AC_COMPILE_IFELSE(
-                       [AC_LANG_PROGRAM(
-                               [[#define IN_AUTOCONF
-                               #include <sys/types.h>
-                               #include <sys/socket.h>
-                               #include <netinet/in.h>]],
-                               [[struct in6_addr a = in6addr_any;]]
-                       )],
-                       [AC_MSG_RESULT(yes)],
-                       [
-                               AC_MSG_RESULT(no)
-                               AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.])
-                               inet_misc=1
-                       ]
-               )
-       fi
-],
-[AC_MSG_RESULT(no)
-have_v6="no"])
-fi
-
 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
 
 CRYPT_LIB=$ac_cv_search_crypt
@@ -402,7 +336,7 @@ fi
 AC_C_BIGENDIAN
 
 dnl Check for stdarg.h - if we can't find it, halt configure
-AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])])
+AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])])
 
 dnl Checks for the existence of strlcat, strlcpy, basename...
 dnl This more reliable test only works with gcc though.
@@ -675,22 +609,15 @@ AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Lin
 ],)
 
 dnl **********************************************************************
-dnl Check for --with-confdir
+dnl Check for --with-confdir [deprecated, use --sysconfdir instead]
 dnl **********************************************************************
 
-AC_MSG_CHECKING([whether to modify confdir])
-AC_ARG_WITH(confdir, 
-AC_HELP_STRING([--with-confdir=DIR],
-              [Directory to install config files.]),
-              [ confdir=`echo $withval | sed 's/\/$//'`
-                AC_MSG_RESULT(yes)
-                AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
-                AC_SUBST_DIR([confdir]) ],
-              [ confdir='${prefix}/etc'
-                AC_MSG_RESULT(no)
-                AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
-                AC_SUBST_DIR([confdir])]
-)
+AC_ARG_WITH([confdir],
+       [AC_HELP_STRING([--with-confdir=DIR],
+              [Directory to install config files [deprecated, use --sysconfdir instead].])],
+       [ sysconfdir=`echo $withval | sed 's/\/$//'` ],
+       [ confdir='${sysconfdir}' ])
+AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.])
 
 dnl **********************************************************************
 dnl Check for --with-logdir
@@ -701,14 +628,13 @@ AC_ARG_WITH(logdir,
 AC_HELP_STRING([--with-logdir=DIR],
               [Directory where to write logfiles.]),
               [ logdir=`echo $withval | sed 's/\/$//'`
-                AC_MSG_RESULT(yes)
-                AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
-                AC_SUBST_DIR([logdir]) ],
-              [ logdir='${prefix}/logs'
-                AC_MSG_RESULT(no)
-                AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
-                AC_SUBST_DIR([logdir])]
-)
+                AC_MSG_RESULT(yes)],
+              [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
+                       [logdir='${localstatedir}/log/${PACKAGE_TARNAME}'],
+                       [logdir='${prefix}/logs'])
+                AC_MSG_RESULT(no)])
+AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.])
+AC_SUBST_DIR([logdir])
 
 dnl **********************************************************************
 dnl Check for --with-helpdir
@@ -719,14 +645,13 @@ AC_ARG_WITH(helpdir,
 AC_HELP_STRING([--with-helpdir=DIR],
               [Directory to install help files.]),
               [ helpdir=`echo $withval | sed 's/\/$//'`
-                AC_MSG_RESULT(yes)
-                AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
-                AC_SUBST_DIR([helpdir]) ],
-              [ helpdir='${prefix}/help'
-                AC_MSG_RESULT(no)
-                AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
-                AC_SUBST_DIR([helpdir])]
-)
+                AC_MSG_RESULT(yes) ],
+              [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
+                       [helpdir='${datadir}/${PACKAGE_TARNAME}/help'],
+                       [helpdir='${prefix}/help'])
+                AC_MSG_RESULT(no) ])
+AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.])
+AC_SUBST_DIR([helpdir])
 
 dnl **********************************************************************
 dnl Check for --with-moduledir
@@ -734,17 +659,44 @@ dnl **********************************************************************
 
 AC_MSG_CHECKING([whether to modify moduledir])
 AC_ARG_WITH(moduledir, 
-AC_HELP_STRING([--with-moduledir=DIR],
-              [Directory to install modules.]),
+       [AC_HELP_STRING([--with-moduledir=DIR],
+              [Directory to install modules.])],
               [ moduledir=`echo $withval | sed 's/\/$//'`
-                AC_MSG_RESULT(yes)
-                AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
-                AC_SUBST_DIR([moduledir]) ],
-              [ moduledir='${prefix}/modules'
+                AC_MSG_RESULT(yes)],
+              [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
+                       [moduledir='${pkglibdir}/modules'],
+                       [moduledir='${prefix}/modules'])
                 AC_MSG_RESULT(no)
-                AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
-                AC_SUBST_DIR([moduledir])]
-)
+               ])
+AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
+AC_SUBST_DIR([moduledir])
+
+dnl Check for --with-rundir
+
+AC_MSG_CHECKING([whether or modify rundir])
+AC_ARG_WITH([rundir],
+       [AC_HELP_STRING([--with-rundir=DIR],
+               [Directory in which to store pidfile.])],
+       [AC_MSG_RESULT([yes])
+       rundir=`echo $withval | sed 's/\/$//'`],
+       [AC_MSG_RESULT([no])
+       AS_IF([test "x$enable_fhs_paths" = "xyes"],
+               [rundir='${prefix}/run'],
+               [rundir='${sysconfdir}'])])
+AC_SUBST([rundir])
+AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.])
+
+dnl Installed utility program prefixes (does not affect binaries
+dnl installed into pkglibexecdir)
+AC_MSG_CHECKING([for program prefix])
+AC_ARG_WITH([program-prefix],
+       [AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])],
+       [test "x$with_program_prefix" = "xno" && with_program_prefix=],
+       [with_program_prefix=])
+AC_MSG_RESULT(["$with_program_prefix"])
+PROGRAM_PREFIX="$with_program_prefix"
+AC_SUBST([PROGRAM_PREFIX])
+AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.])
 
 if test ! -z "$SELECT_TYPE_EXPLICIT"; then
        SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
@@ -910,8 +862,8 @@ if test "$balloc" = no; then
 fi
 
 AC_ARG_ENABLE(small-net,
-AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
-[small_net=$enableval], [small_net=no])
+AC_HELP_STRING([--disable-small-net],[Disable small network support.]),
+[small_net=$enableval], [small_net=yes])
 
 if test "$small_net" = yes; then
 dnl    AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
@@ -953,15 +905,18 @@ dnl so enable small net unless you really need this much support
 fi
 
 AC_ARG_WITH(nicklen,
-AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
+AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 31, max 50)]),
 [
+  if ! expr "$withval" + 0 >/dev/null 2>&1; then 
+       AC_ERROR([NICKLEN must be a numeric value])
+  fi 
   if test $withval -ge 50; then
        NICKLEN=50
        AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
   else
        NICKLEN="$withval"
   fi
-], [NICKLEN=15])
+], [NICKLEN=31])
 
 AC_ARG_WITH(topiclen,           
 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
@@ -980,12 +935,6 @@ AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
 shared_modules="yes"
 dnl Some first-stage sanity checks.
 if test "$shared_modules" = yes; then
-       
-       if test "$CYGWIN" = yes; then
-               AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
-               shared_modules="no"
-       fi
-
        dnl TenDRA's cc is called tcc too.
        if test "$CC" = tcc -a "$TenDRA" = "no"; then
                AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
@@ -1107,9 +1056,21 @@ if test "$shared_modules" = yes; then
        fi
 fi
 
+# rpath, for finding libratbox.so at run time
+hold_ldflags=$LDFLAGS
+AC_MSG_CHECKING(for the ld -rpath flag)
+LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}"
+AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
+LDFLAGS=$hold_ldflags
+AC_MSG_RESULT($found)
+if test "$found" = yes; then
+       LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}"
+fi
+
 # This must be down here, or it will mess up checks like the ones
 # for -Wl,-export-dynamic
 # -- jilles
+CWARNS=""
 AC_ARG_ENABLE(warnings,
 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
 [
@@ -1121,6 +1082,8 @@ CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
+CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings)
+CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
 CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
@@ -1130,12 +1093,10 @@ CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_nor
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
-CHARYBDIS_C_GCC_TRY_FLAGS([-Wbad-function-cast], charybdis_cv_c_gcc_w_bad_function_cast)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
 CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
-CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat=2], charybdis_cv_c_gcc_w_format)
-CHARYBDIS_C_GCC_TRY_FLAGS([-pedantic], charybdis_cv_c_gcc_pedantic)
+CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format)
 
 IRC_CFLAGS="$CFLAGS"
 ],[])
@@ -1209,6 +1170,8 @@ EOF
        fi
 fi
 
+IRC_CFLAGS="$IRC_CFLAGS $CWARNS"
+
 AC_SUBST(MODULES_LIBS)
 AC_SUBST(MOD_TARGET)
 
@@ -1237,15 +1200,18 @@ fi
 
 AC_CONFIG_FILES(                       \
        Makefile                        \
-       servlink/Makefile               \
+       bandb/Makefile                  \
+       ssld/Makefile                   \
        extensions/Makefile             \
        unsupported/Makefile            \
        src/Makefile                    \
        modules/Makefile                \
        tools/Makefile                  \
+       tools/genssl.sh                 \
        doc/Makefile                    \
        help/Makefile                   \
 )
+AC_CONFIG_COMMANDS([tools/genssl.sh_chmod], [chmod 755 tools/genssl.sh])
 
 AC_OUTPUT
 
@@ -1267,7 +1233,6 @@ Configuration:
 
        Ziplinks           : $zlib
        OpenSSL            : $openssl
-       IPv6 support       : $have_v6
        Socket Engine      : $SELECT_TYPE
        Small network      : $small_net
        Block allocator    : $balloc
@@ -1275,5 +1240,5 @@ Configuration:
        Nickname length    : $NICKLEN
        Topic length       : $TOPICLEN
 
-Use make to compile Charybdis, then make install to install it.
+Use (g)make to compile ShadowIRCd, then (g)make install to install it.
 "