+
+require 5.6.0;
+use Cwd;
+use Getopt::Long;
+
+GetOptions (
+ 'enable-gnutls' => \$opt_use_gnutls,
+ '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-channels=i' => \$opt_maxchans,
+ 'with-max-oper-channels=i' => \$opt_opermaxchans,
+ 'with-max-clients=i' => \$opt_maxclients,
+ 'enable-epoll' => \$opt_epoll,
+ 'enable-kqueue' => \$opt_kqueue,
+ 'disable-epoll' => \$opt_noepoll,
+ 'disable-kqueue' => \$opt_nokqueue,
+ '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-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(); },
+);
+
+my $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_maxchans) ||
+ (defined $opt_opermaxchans) ||
+ (defined $opt_chan_length) ||
+ (defined $opt_nick_length) ||
+ (defined $opt_use_openssl) ||
+ (defined $opt_nokqueue) ||
+ (defined $opt_noepoll) ||
+ (defined $opt_use_gnutls)
+);
+my $interactive = !$non_interactive;
+
+
+chomp($topdir = getcwd());