+###############################################################################################
+#
+# EDITABLE VARIABLES
+#
+###############################################################################################
+
+# If you wish to ignore a dependency throughout the entire core, add it here.
+
+our @ignoredeps = (
+ "inspircd_win32wrapper.h", # windows has its own configure program
+);
+
+# If you wish for all files in the entire core to have a given dependency, insert it here.
+# You should keep this to an absolute minimum to avoid rebuilds that are not neccessary.
+
+our @immutabledeps = (
+ "inspircd_config.h", # auto re-generated by configure
+ "inspircd.h",
+);
+
+###############################################################################################
+#
+# NON-EDITABLE VARIABLES
+#
+###############################################################################################
+
+# List of commands that make up 'make install' and 'make deinstall'
+
+our $install_list = "";
+our $uninstall_list = "";
+
+# This is a list of all files in the core. Each cpp file is mapped to a shared object file,
+# whos file extension is omitted (these can vary from system to system). Auto detected by
+# scanning the src/*.cpp files for files containing /* $Core: */ identifiers.
+
+our %filelist = ();
+
+# If you wish for a file to have special dependencies in the makefile, add an entry here.
+# Auto populated by /* $ExtraDeps: */ instruction
+
+our %specialdeps = ();
+
+# If you wish for a file to have extra make lines (in between the compile and link steps)
+# then insert them here.
+# Auto populated by /* $ExtraBuild: */ instruction
+
+our %extrabuildlines = ();
+
+# If you wish for a file to be linked against extra objects or arctives, insert them here.
+# Auto populated by /* $ExtraObjects: */ instruction
+
+our %extraobjects = ();
+
+# If you wish to compile extra cpp sources into an object, define them here.
+# NOTE: Certain cpp files such as the socket engines have a value auto calculated
+# for this table so that their derived class is built.
+# Auto populated by /* $ExtraSources: */ instruction
+
+our %extrasources = ();
+
+our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_nick_length,
+ $opt_chan_length, $opt_maxclients, $opt_ports, $opt_epoll, $opt_kqueue, $opt_noports,
+ $opt_noepoll, $opt_nokqueue, $opt_disablerpath, $opt_ipv6, $opt_ipv6links,
+ $opt_noipv6links, $opt_ident, $opt_quit, $opt_topic, $opt_maxbuf, $opt_kick,
+ $opt_gecos, $opt_away, $opt_modes, $opt_disable_debug, $opt_maxchans,
+ $opt_opermaxchans);
+
+our ($opt_cc, $opt_base_dir, $opt_config_dir, $opt_module_dir, $opt_binary_dir,
+ $opt_library_dir);
+
+sub list_extras ();
+
+sub enable_extras (@);
+
+sub disable_extras (@);
+
+my @opt_enableextras;
+my @opt_disableextras;
+
+GetOptions (
+ 'enable-gnutls' => \$opt_use_gnutls,
+ 'rebuild' => \$opt_rebuild,
+ 'enable-openssl' => \$opt_use_openssl,
+ 'disable-interactive' => \$opt_nointeractive,
+ 'with-nick-length=i' => \$opt_nick_length,
+ 'with-channel-length=i' => \$opt_chan_length,
+ 'with-max-clients=i' => \$opt_maxclients,
+ 'enable-ports' => \$opt_ports,
+ 'enable-epoll' => \$opt_epoll,
+ 'enable-kqueue' => \$opt_kqueue,
+ 'disable-ports' => \$opt_noports,
+ 'disable-epoll' => \$opt_noepoll,
+ 'disable-kqueue' => \$opt_nokqueue,
+ 'disable-rpath' => \$opt_disablerpath,
+ 'enable-ipv6' => \$opt_ipv6,
+ 'enable-remote-ipv6' => \$opt_ipv6links,
+ 'disable-remote-ipv6' => \$opt_noipv6links,
+ 'with-cc=s' => \$opt_cc,
+ 'with-ident-length=i' => \$opt_ident,
+ 'with-quit-length=i' => \$opt_quit,
+ 'with-topic-length=i' => \$opt_topic,
+ 'with-maxbuf=i' => \$opt_maxbuf,
+ 'with-kick-length=i' => \$opt_kick,
+ 'with-gecos-length=i' => \$opt_gecos,
+ 'with-away-length=i' => \$opt_away,
+ 'with-max-modes=i' => \$opt_modes,
+ 'prefix=s' => \$opt_base_dir,
+ 'config-dir=s' => \$opt_config_dir,
+ 'module-dir=s' => \$opt_module_dir,
+ 'binary-dir=s' => \$opt_binary_dir,
+ 'library-dir=s' => \$opt_library_dir,
+ 'disable-debuginfo' => sub { $opt_disable_debug = 1 },
+ 'help' => sub { showhelp(); },
+ 'modupdate' => sub { modupdate(); },
+ 'update' => sub { update(); },
+ 'svnupdate' => sub { svnupdate(); },
+ 'clean' => sub { clean(); },
+ 'list-extras' => sub { list_extras; exit 0; }, # This, --enable-extras, and --disable-extras are for non-interactive managing.
+ 'enable-extras=s@' => \@opt_enableextras, # ^
+ 'disable-extras=s@' => \@opt_disableextras, # ^
+);
+
+if (scalar(@opt_enableextras) + scalar(@opt_disableextras) > 0) {
+ @opt_enableextras = split /,/, join(',', @opt_enableextras);
+ @opt_disableextras = split /,/, join(',', @opt_disableextras);
+ enable_extras(@opt_enableextras);
+ disable_extras(@opt_disableextras);
+ list_extras;
+ print "Remember: YOU are responsible for making sure any libraries needed have been installed!\n";
+ print "Run $0 -modupdate after you've done this to update the makefiles.\n";
+ exit 0;
+}
+
+our $non_interactive = (
+ (defined $opt_library_dir) ||
+ (defined $opt_base_dir) ||
+ (defined $opt_config_dir) ||
+ (defined $opt_module_dir) ||
+ (defined $opt_base_dir) ||
+ (defined $opt_binary_dir) ||
+ (defined $opt_nointeractive) ||
+ (defined $opt_away) ||
+ (defined $opt_gecos) ||
+ (defined $opt_kick) ||
+ (defined $opt_maxclients) ||
+ (defined $opt_modes) ||
+ (defined $opt_topic) ||
+ (defined $opt_quit) ||
+ (defined $opt_ident) ||
+ (defined $opt_cc) ||
+ (defined $opt_ipv6) ||
+ (defined $opt_ipv6links) ||
+ (defined $opt_noipv6links) ||
+ (defined $opt_kqueue) ||
+ (defined $opt_epoll) ||
+ (defined $opt_ports) ||
+ (defined $opt_maxchans) ||
+ (defined $opt_opermaxchans) ||
+ (defined $opt_chan_length) ||
+ (defined $opt_nick_length) ||
+ (defined $opt_use_openssl) ||
+ (defined $opt_nokqueue) ||
+ (defined $opt_noepoll) ||
+ (defined $opt_noports) ||
+ (defined $opt_maxbuf) ||
+ (defined $opt_use_gnutls)
+);
+our $interactive = !$non_interactive;
+
+chomp(our $topdir = getcwd());
+our $this = resolve_directory($topdir); # PWD, Regardless.
+our @modlist = (); # Declare for Module List..
+our %config = (); # Initiate Configuration Hash..
+$config{ME} = resolve_directory($topdir); # Present Working Directory
+
+$config{BASE_DIR} = $config{ME};
+
+if (defined $opt_base_dir)
+{
+ $config{BASE_DIR} = $opt_base_dir;
+}
+
+$config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
+$config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
+$config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
+$config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
+
+if (defined $opt_config_dir)
+{
+ $config{CONFIG_DIR} = $opt_config_dir;
+}
+if (defined $opt_module_dir)
+{
+ $config{MODULE_DIR} = $opt_module_dir;
+}
+if (defined $opt_binary_dir)
+{
+ $config{BINARY_DIR} = $opt_binary_dir;
+}
+if (defined $opt_library_dir)
+{
+ $config{LIBRARY_DIR} = $opt_library_dir;
+}
+chomp($config{HAS_GNUTLS} = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
+chomp($config{HAS_OPENSSL} = `pkg-config --modversion openssl 2>/dev/null`); # Openssl version
+chomp(our $gnutls_ver = $config{HAS_GNUTLS});
+chomp(our $openssl_ver = $config{HAS_OPENSSL});
+$config{USE_GNUTLS} = "n";
+if (defined $opt_use_gnutls)
+{
+ $config{USE_GNUTLS} = "y"; # Use gnutls.
+}
+$config{USE_OPENSSL} = "n"; # Use openssl.
+if (defined $opt_use_openssl)
+{
+ $config{USE_OPENSSL} = "y";
+}
+
+# no, let's not change these.
+$config{OPTIMITEMP} = "0"; # Default Optimisation Value
+if (!defined $opt_disable_debug)
+{
+ $config{OPTIMISATI} = "-g1"; # Optimisation Flag
+}
+else
+{
+ $config{OPTIMISATI} = "-O2"; # DEBUGGING OFF!
+}
+
+$config{NICK_LENGT} = "31"; # Default Nick Length
+if (defined $opt_nick_length)
+{
+ $config{NICK_LENGT} = $opt_nick_length;
+}
+$config{CHAN_LENGT} = "64"; # Default Channel Name Length
+if (defined $opt_chan_length)
+{
+ $config{CHAN_LENGT} = $opt_chan_length;
+}
+$config{MAXI_MODES} = "20"; # Default Max. Number of Modes set at once.
+if (defined $opt_modes)
+{
+ $config{MAXI_MODES} = $opt_modes;
+}
+$config{HAS_STRLCPY} = "false"; # strlcpy Check.
+$config{HAS_STDINT} = "false"; # stdint.h check
+$config{USE_KQUEUE} = "y"; # kqueue enabled
+if (defined $opt_kqueue)
+{
+ $config{USE_KQUEUE} = "y";
+}
+if (defined $opt_nokqueue)
+{
+ $config{USE_KQUEUE} = "n";
+}
+$config{USE_EPOLL} = "y"; # epoll enabled
+if (defined $opt_epoll)
+{
+ $config{USE_EPOLL} = "y";
+}
+if (defined $opt_noepoll)
+{
+ $config{USE_EPOLL} = "n";
+}
+$config{USE_PORTS} = "y"; # epoll enabled
+if (defined $opt_ports)
+{
+ $config{USE_PORTS} = "y";
+}
+if (defined $opt_noports)
+{
+ $config{USE_PORTS} = "n";
+}
+$config{IPV6} = "n"; # IPv6 support (experimental)
+if (defined $opt_ipv6)
+{
+ $config{IPV6} = "y";
+}
+$config{SUPPORT_IP6LINKS} = "y"; # IPv4 supporting IPv6 links (experimental)
+if (defined $opt_ipv6links)
+{
+ $config{SUPPORT_IP6LINKS} = "y";
+}
+if (defined $opt_noipv6links)
+{
+ $config{SUPPORT_IP6LINKS} = "n";
+}
+chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
+chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
+chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
+$config{_SOMAXCONN} = SOMAXCONN; # Max connections in accept queue
+$config{OSNAME} = $^O; # Operating System Name
+$config{IS_DARWIN} = "NO"; # Is OSX?
+$config{STARTSCRIPT} = "inspircd"; # start script?
+$config{DESTINATION} = "BASE"; # Is target path.
+$config{EXTRA_DIR} = ""; # Is empty.
+if ($config{OSNAME} =~ /darwin/i)
+{
+ $config{IS_DARWIN} = "YES";
+ $config{STARTSCRIPT} = "org.inspircd.plist"; # start script for OSX.
+ $config{DESTINATION} = "LAUNCHDPATH"; # Is OSX target.
+ $config{EXTRA_DIR} = " launchd_dir"; # Is OSX specific path.
+}
+$config{CC} = "g++"; # C++ compiler
+if (defined $opt_cc)
+{
+ $config{CC} = $opt_cc;
+}
+our $exec = $config{CC} . " -dumpversion | cut -c 1";
+chomp($config{GCCVER} = `$exec`); # Major GCC Version
+$config{MAKEORDER} = "ircd mods"; # build order
+$config{MAX_IDENT} = "12"; # max ident size
+$config{MAX_QUIT} = "255"; # max quit message size
+$config{MAX_TOPIC} = "307"; # max topic size
+$config{MAX_KICK} = "255"; # max kick message size
+$config{MAX_GECOS} = "128"; # max GECOS size
+$config{MAX_AWAY} = "200"; # max AWAY size
+$config{MAXBUF} = "512"; # Max buffer size
+if (defined $opt_ident)
+{
+ $config{MAX_IDENT} = $opt_ident;
+}
+if (defined $opt_quit)
+{
+ $config{MAX_QUIT} = $opt_quit;
+}
+if (defined $opt_topic)
+{
+ $config{MAX_TOPIC} = $opt_topic;
+}
+if (defined $opt_kick)
+{
+ $config{MAX_KICK} = $opt_kick;
+}
+if (defined $opt_gecos)
+{
+ $config{MAX_GECOS} = $opt_gecos;
+}
+if (defined $opt_away)
+{
+ $config{MAX_AWAY} = $opt_away;
+}
+
+if ($config{HAS_OPENSSL} =~ /^([-[:digit:].]+)([a-z])?(\-[a-z][0-9])?$/) {
+ $config{HAS_OPENSSL} = $1;
+} else {
+ $config{HAS_OPENSSL} = "";