]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - configure
4c80500fced22c6dd9e5cc6b312fd3520705e794
[user/henk/code/inspircd.git] / configure
1 #!/usr/bin/env perl
2
3 #
4 # InspIRCd -- Internet Relay Chat Daemon
5 #
6 #   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
7 #   Copyright (C) 2007, 2009 Dennis Friis <peavey@inspircd.org>
8 #   Copyright (C) 2003, 2006-2008 Craig Edwards <craigedwards@brainbox.cc>
9 #   Copyright (C) 2006-2008 Robin Burchell <robin+git@viroteck.net>
10 #   Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
11 #   Copyright (C) 2007 John Brooks <john.brooks@dereferenced.net>
12 #   Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com>
13 #   Copyright (C) 2003-2006 Craig McLure <craig@chatspike.net>
14 #
15 # This file is part of InspIRCd.  InspIRCd is free software: you can
16 # redistribute it and/or modify it under the terms of the GNU General Public
17 # License as published by the Free Software Foundation, version 2.
18 #
19 # This program is distributed in the hope that it will be useful, but WITHOUT
20 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
22 # details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
26 #
27
28
29 BEGIN {
30         require 5.10.0;
31 }
32
33 use feature ':5.10';
34 use strict;
35 use warnings FATAL => qw(all);
36
37 use File::Basename        qw(basename);
38 use File::Copy            ();
39 use File::Spec::Functions qw(rel2abs);
40 use FindBin               qw($RealDir);
41 use Getopt::Long          qw(GetOptions);
42 use POSIX                 qw(getgid getuid);
43
44 use lib $RealDir;
45 use make::common;
46 use make::configure;
47 use make::console;
48 use make::directive;
49
50 my ($opt_binary_dir,
51     $opt_config_dir,
52     $opt_data_dir,
53     $opt_development,
54     $opt_disable_interactive,
55     $opt_distribution_label,
56     $opt_gid,
57     $opt_log_dir,
58     $opt_manual_dir,
59     $opt_module_dir,
60     $opt_prefix,
61     $opt_socketengine,
62     $opt_system,
63     $opt_uid);
64
65 sub list_extras ();
66
67 sub enable_extras (@);
68
69 sub disable_extras (@);
70
71 my @opt_enableextras;
72 my @opt_disableextras;
73
74 GetOptions(
75         'clean'  => \&cmd_clean,
76         'help'   => \&cmd_help,
77         'update' => \&cmd_update,
78
79         'development'          => \$opt_development,
80         'disable-interactive'  => \$opt_disable_interactive,
81         'distribution-label=s' => \$opt_distribution_label,
82         'binary-dir=s'         => \$opt_binary_dir,
83         'config-dir=s'         => \$opt_config_dir,
84         'data-dir=s'           => \$opt_data_dir,
85         'gid=s'                => \$opt_gid,
86         'log-dir=s'            => \$opt_log_dir,
87         'manual-dir=s'         => \$opt_manual_dir,
88         'module-dir=s'         => \$opt_module_dir,
89         'prefix=s'             => \$opt_prefix,
90         'socketengine=s'       => \$opt_socketengine,
91         'system'               => \$opt_system,
92         'uid=s'                => \$opt_uid,
93
94         # TODO: when the modulemanager rewrite is done these should be removed.
95         'disable-extras=s@' => \@opt_disableextras,
96         'enable-extras=s@'  => \@opt_enableextras,
97         'list-extras'       => sub { list_extras; exit 0; },
98 );
99
100 if (scalar(@opt_enableextras) + scalar(@opt_disableextras) > 0) {
101         @opt_enableextras = split /,/, join(',', @opt_enableextras);
102         @opt_disableextras = split /,/, join(',', @opt_disableextras);
103         enable_extras(@opt_enableextras);
104         disable_extras(@opt_disableextras);
105         list_extras;
106         print "Remember: YOU are responsible for making sure any libraries needed have been installed!\n";
107         exit 0;
108 }
109
110 our $interactive = !(
111         !-t STDIN ||
112         !-t STDOUT ||
113         defined $opt_binary_dir ||
114         defined $opt_config_dir ||
115         defined $opt_data_dir ||
116         defined $opt_development ||
117         defined $opt_disable_interactive ||
118         defined $opt_distribution_label ||
119         defined $opt_gid ||
120         defined $opt_log_dir ||
121         defined $opt_manual_dir ||
122         defined $opt_module_dir ||
123         defined $opt_prefix ||
124         defined $opt_socketengine ||
125         defined $opt_system ||
126         defined $opt_uid
127 );
128
129 my %version = get_version $opt_distribution_label;
130 print_format "<|BOLD Configuring InspIRCd $version{FULL} on $^O.|>\n";
131
132 our %config;
133 if ($interactive) {
134         %config = read_configure_cache();
135         run_test CONFIGURE_CACHE_FILE, %config;
136         if (!defined $config{VERSION}) {
137                 $config{VERSION} = CONFIGURE_CACHE_VERSION;
138         } elsif ($config{VERSION} != CONFIGURE_CACHE_VERSION) {
139                 print_warning "ignoring contents of ${\CONFIGURE_CACHE_FILE} as it was generated by an incompatible version of $0!";
140                 %config = ('VERSION', CONFIGURE_CACHE_VERSION);
141         }
142 }
143
144 $config{CXX} = find_compiler($config{CXX} // $ENV{CXX});
145 unless ($config{CXX}) {
146         print "A suitable C++ compiler could not be detected on your system!\n";
147         print "Set the CXX environment variable to the compiler binary path if this is incorrect.\n";
148         exit 1; 
149 }
150 my %compiler = get_compiler_info($config{CXX});
151
152 $config{HAS_CLOCK_GETTIME} = run_test 'clock_gettime()', test_file($config{CXX}, 'clock_gettime.cpp', $^O eq 'darwin' ? undef : '-lrt');
153 $config{HAS_EVENTFD} = run_test 'eventfd()', test_file($config{CXX}, 'eventfd.cpp');
154
155 if ($config{HAS_EPOLL} = run_test 'epoll', test_header($config{CXX}, 'sys/epoll.h')) {
156         $config{SOCKETENGINE} //= 'epoll';
157 }
158
159 if ($config{HAS_KQUEUE} = run_test 'kqueue', test_file($config{CXX}, 'kqueue.cpp')) {
160         $config{SOCKETENGINE} //= 'kqueue';
161 }
162
163 if ($config{HAS_PORTS} = run_test 'Solaris IOCP', test_header($config{CXX}, 'port.h')) {
164         $config{SOCKETENGINE} //= 'ports';
165 }
166
167 if ($config{HAS_POLL} = run_test 'poll', test_header($config{CXX}, 'poll.h')) {
168         $config{SOCKETENGINE} //= 'poll';
169 }
170
171 # Select is available on all platforms
172 $config{HAS_SELECT} = 1;
173 $config{SOCKETENGINE} //= 'select';
174
175 if (defined $opt_socketengine) {
176         my $cfgkey = 'HAS_' . uc $opt_socketengine;
177         if ($config{$cfgkey} && -f "src/socketengines/socketengine_$opt_socketengine.cpp") {
178                 $config{SOCKETENGINE} = $opt_socketengine;
179         } else {
180                 print "Unable to use a socket engine which is not supported on this platform ($opt_socketengine)!\n";
181                 print "Available socket engines are:";
182                 foreach (<src/socketengines/socketengine_*.cpp>) {
183                         s/src\/socketengines\/socketengine_(\w+)\.cpp/$1/;
184                         print " $1" if $config{'HAS_' . uc $1};
185                 }
186                 print "\n";     
187                 exit 1;
188         }
189 }
190
191 if (defined $opt_system) {
192         $config{BASE_DIR}   = $opt_prefix     // '/var/lib/inspircd';
193         $config{BINARY_DIR} = $opt_binary_dir // '/usr/sbin';
194         $config{CONFIG_DIR} = $opt_config_dir // '/etc/inspircd';
195         $config{DATA_DIR}   = $opt_data_dir   // '/var/inspircd';
196         $config{LOG_DIR}    = $opt_module_dir // '/var/log/inspircd';
197         $config{MANUAL_DIR} = $opt_manual_dir // '/usr/share/man/man1';
198         $config{MODULE_DIR} = $opt_module_dir // '/usr/lib/inspircd';
199 } else {
200         $config{BASE_DIR}   = $opt_prefix     // $config{BASE_DIR}   // rel2abs 'run';
201         $config{BINARY_DIR} = $opt_binary_dir // $config{BINARY_DIR} // rel2abs $config{BASE_DIR} . '/bin';
202         $config{CONFIG_DIR} = $opt_config_dir // $config{CONFIG_DIR} // rel2abs $config{BASE_DIR} . '/conf';
203         $config{DATA_DIR}   = $opt_data_dir   // $config{DATA_DIR}   // rel2abs $config{BASE_DIR} . '/data';
204         $config{LOG_DIR}    = $opt_log_dir    // $config{LOG_DIR}    // rel2abs $config{BASE_DIR} . '/logs';
205         $config{MANUAL_DIR} = $opt_manual_dir // $config{MANUAL_DIR} // rel2abs $config{BASE_DIR} . '/manuals';
206         $config{MODULE_DIR} = $opt_module_dir // $config{MODULE_DIR} // rel2abs $config{BASE_DIR} . '/modules';
207 }
208
209 # Parse --gid=123 or --gid=foo and extract the group id.
210 my @group;
211 if (defined $opt_gid) {
212         @group = $opt_gid =~ /^\d+$/ ? getgrgid($opt_gid) : getgrnam($opt_gid);
213         print_error "there is no '$opt_gid' group on this system!" unless @group;
214 } else {
215         @group = $opt_system ? getgrnam('irc') : getgrgid($config{GID} // getgid());
216         print_error "you need to specify a group to run as using '--gid [id|name]'!" unless @group;
217 }
218 $config{GROUP} = $group[0];
219 $config{GID}   = $group[2];
220
221 # Parse --uid=123 or --uid=foo and extract the user id.
222 my @user;
223 if (defined $opt_uid) {
224         @user = $opt_uid =~ /^\d+$/ ? getpwuid($opt_uid) : getpwnam($opt_uid);
225         print_error "there is no '$opt_uid' user on this system!" unless @user;
226 } else {
227         @user = $opt_system ? getpwnam('irc') : getpwuid($config{UID} // getuid());
228         print_error "you need to specify a user to run as using '--uid [id|name]'!" unless @user;
229 }
230 $config{USER} = $user[0];
231 $config{UID}  = $user[2];
232
233 # Clear the screen.
234 system 'tput', 'clear' if $interactive;
235
236 # Check that the user actually wants this version.
237 if ($version{LABEL} ne 'release') {
238         print_warning <<'EOW';
239 You are building a development version. This contains code which has
240 not been tested as heavily and may contain various faults which could seriously
241 affect the running of your server. It is recommended that you use a stable
242 version instead.
243
244 You can obtain the latest stable version from http://www.inspircd.org/ or by
245 running `git checkout insp20` if you are installing from Git.
246 EOW
247         if (!prompt_bool $interactive, 'I understand this warning and want to continue anyway.', $opt_development // 0) {
248                 say STDERR 'If you understand this warning and still want to continue pass the --development flag.' unless $interactive;
249                 exit 1;
250         }
251 }
252
253 # Configure directory settings.
254 my $question = <<"EOQ";
255 Currently, InspIRCd is configured with the following paths:
256
257 <|BOLD Base:|>   $config{BASE_DIR}
258 <|BOLD Binary:|> $config{BINARY_DIR}
259 <|BOLD Config:|> $config{CONFIG_DIR}
260 <|BOLD Data:|>   $config{DATA_DIR}
261 <|BOLD Log:|>    $config{LOG_DIR}
262 <|BOLD Manual:|> $config{MANUAL_DIR}
263 <|BOLD Module:|> $config{MODULE_DIR}
264
265 Do you want to change these settings?
266 EOQ
267 if (prompt_bool $interactive, $question, 0) {
268         my $original_base_dir = $config{BASE_DIR};
269         $config{BASE_DIR} = prompt_dir $interactive, 'In what directory do you wish to install the InspIRCd base?', $config{BASE_DIR};
270         foreach my $key (qw(BINARY_DIR CONFIG_DIR DATA_DIR LOG_DIR MANUAL_DIR MODULE_DIR)) {
271                 $config{$key} =~ s/^\Q$original_base_dir\E/$config{BASE_DIR}/;
272         }
273         $config{BINARY_DIR} = prompt_dir $interactive, 'In what directory should the InspIRCd binary be placed?', $config{BINARY_DIR};
274         $config{CONFIG_DIR} = prompt_dir $interactive, 'In what directory are configuration files to be stored?', $config{CONFIG_DIR};
275         $config{DATA_DIR}   = prompt_dir $interactive, 'In what directory are variable data files to be stored?', $config{DATA_DIR};
276         $config{LOG_DIR}    = prompt_dir $interactive, 'In what directory are log files to be stored?',           $config{LOG_DIR};
277         $config{MANUAL_DIR} = prompt_dir $interactive, 'In what directory are manual pages to be placed?',        $config{MANUAL_DIR};
278         $config{MODULE_DIR} = prompt_dir $interactive, 'In what directory are modules to be placed?',             $config{MODULE_DIR};
279 }
280
281 # Configure module settings.
282 $question = <<'EOQ';
283 Currently, InspIRCd is configured to automatically enable all available extra modules.
284
285 Would you like to enable extra modules manually?
286 EOQ
287 if (prompt_bool $interactive, $question, 0) {
288         foreach my $extra (<src/modules/extra/m_*.cpp>) {
289                 my $module_name = basename $extra, '.cpp';
290                 if (prompt_bool $interactive, "Would you like to enable $module_name?", 0) {
291                         enable_extras "$module_name.cpp";
292                 }
293         }
294 } else {
295         # TODO: finish modulemanager rewrite and replace this code with:
296         # system './modulemanager', 'enable', '--auto';
297         enable_extras 'm_ssl_gnutls.cpp' unless system 'pkg-config --exists gnutls >/dev/null 2>&1';
298         enable_extras 'm_ssl_mbedtls.cpp' if -e '/usr/include/mbedtls/ssl.h';
299         enable_extras 'm_ssl_openssl.cpp' unless system 'pkg-config --exists openssl >/dev/null 2>&1';
300 }
301
302 # Generate SSL certificates.
303 if (<src/modules/m_ssl_*.cpp> && prompt_bool $interactive, 'Would you like to generate SSL certificates now?', $interactive) {
304         system './tools/genssl', 'auto';
305 }
306
307 # Cache the distribution label so that its not lost when --update is run.
308 $config{DISTRIBUTION} = $opt_distribution_label if $opt_distribution_label;
309
310 write_configure_cache %config;
311 parse_templates \%config, \%compiler, \%version;
312
313 print_format <<"EOM";
314
315 Configuration is complete! You have chosen to build with the following settings:
316
317 <|GREEN Compiler:|>
318   <|GREEN Binary:|>  $config{CXX}
319   <|GREEN Name:|>    $compiler{NAME}
320   <|GREEN Version:|> $compiler{VERSION}
321
322 <|GREEN Extra Modules:|>
323 EOM
324
325 for my $file (<src/modules/m_*>) {
326         my $module = basename $file, '.cpp';
327         say "  * $module" if -l $file;
328 }
329
330 print_format <<"EOM";
331
332 <|GREEN Paths:|>
333   <|GREEN Base:|>   $config{BASE_DIR}
334   <|GREEN Binary:|> $config{BINARY_DIR}
335   <|GREEN Config:|> $config{CONFIG_DIR}
336   <|GREEN Data:|>   $config{DATA_DIR}
337   <|GREEN Log:|>    $config{LOG_DIR}
338   <|GREEN Manual:|> $config{MANUAL_DIR}
339   <|GREEN Module:|> $config{MODULE_DIR}
340
341 <|GREEN Execution Group:|> $config{GROUP} ($config{GID})
342 <|GREEN Execution User:|>  $config{USER} ($config{UID})
343 <|GREEN Socket Engine:|>   $config{SOCKETENGINE}
344
345 To build with these settings run '<|GREEN make -j${\get_cpu_count}|>' now.
346
347 EOM
348
349 # Routine to list out the extra/ modules that have been enabled.
350 # Note: when getting any filenames out and comparing, it's important to lc it if the
351 # file system is not case-sensitive (== Epoc, MacOS, OS/2 (incl DOS/DJGPP), VMS, Win32
352 # (incl NetWare, Symbian)). Cygwin may or may not be case-sensitive, depending on
353 # configuration, however, File::Spec does not currently tell us (it assumes Unix behavior).
354 sub list_extras () {
355         use File::Spec;
356         # @_ not used
357         my $srcdir = File::Spec->catdir("src", "modules");
358         my $abs_srcdir = File::Spec->rel2abs($srcdir);
359         local $_;
360         my $dd;
361         opendir $dd, File::Spec->catdir($abs_srcdir, "extra") or die (File::Spec->catdir($abs_srcdir, "extra") . ": $!\n");
362         my @extras = map { File::Spec->case_tolerant() ? lc($_) : $_ } (readdir($dd));
363         closedir $dd;
364         undef $dd;
365         opendir $dd, $abs_srcdir or die "$abs_srcdir: $!\n";
366         my @sources = map { File::Spec->case_tolerant() ? lc($_) : $_ } (readdir($dd));
367         closedir $dd;
368         undef $dd;
369         my $maxlen = (sort { $b <=> $a } (map {length($_)} (@extras)))[0];
370         my %extras = ();
371 EXTRA:  for my $extra (@extras) {
372                 next if (File::Spec->curdir() eq $extra || File::Spec->updir() eq $extra);
373                 my $abs_extra = File::Spec->catfile($abs_srcdir, "extra", $extra);
374                 my $abs_source = File::Spec->catfile($abs_srcdir, $extra);
375                 next unless ($extra =~ m/\.(cpp|h)$/ || (-d $abs_extra)); # C++ Source/Header, or directory
376                 if (-l $abs_source) {
377                         # Symlink, is it in the right place?
378                         my $targ = readlink($abs_source);
379                         my $abs_targ = File::Spec->rel2abs($targ, $abs_srcdir);
380                         if ($abs_targ eq $abs_extra) {
381                                 $extras{$extra} = "\e[32;1menabled\e[0m";
382                         } else {
383                                 $extras{$extra} = sprintf("\e[31;1mwrong symlink target (%s)\e[0m", $abs_targ);
384                         }
385                 } elsif (-e $abs_source) {
386                         my ($devext, $inoext) = stat($abs_extra);
387                         my ($devsrc, $inosrc, undef, $lnksrc) = stat($abs_source);
388                         if ($lnksrc > 1) {
389                                 if ($devsrc == $devext && $inosrc == $inoext) {
390                                         $extras{$extra} = "\e[32;1menabled\e[0m";
391                                 } else {
392                                         $extras{$extra} = sprintf("\e[31;1mwrong hardlink target (%d:%d)\e[0m", $devsrc, $inosrc);
393                                 }
394                         } else {
395                                 open my $extfd, "<", $abs_extra;
396                                 open my $srcfd, "<", $abs_source;
397                                 local $/ = undef;
398                                 if (scalar(<$extfd>) eq scalar(<$srcfd>)) {
399                                         $extras{$extra} = "\e[32;1menabled\e[0m";
400                                 } else {
401                                         $extras{$extra} = sprintf("\e[31;1mout of synch (re-copy)\e[0m");
402                                 }
403                         }
404                 } else {
405                         $extras{$extra} = "\e[33;1mdisabled\e[0m";
406                 }
407         }
408         # Now let's add dependency info
409         for my $extra (keys(%extras)) {
410                 next unless $extras{$extra} =~ m/enabled/; # only process enabled extras.
411                 my $abs_extra = File::Spec->catfile($abs_srcdir, "extra", $extra);
412                 my @deps = split /\s+/, get_directive($abs_extra, 'ModDep', '');
413                 for my $dep (@deps) {
414                         if (exists($extras{$dep})) {
415                                 my $ref = \$extras{$dep}; # Take reference.
416                                 if ($$ref !~ m/needed by/) {
417                                         # First dependency found.
418                                         if ($$ref =~ m/enabled/) {
419                                                 $$ref .= " (needed by \e[32;1m$extra\e[0m";
420                                         } else {
421                                                 $$ref =~ s/\e\[.*?m//g; # Strip out previous coloring. Will be set in bold+red+blink later.
422                                                 $$ref .= " (needed by \e[0;32;1;5m$extra\e[0;31;1;5m";
423                                         }
424                                 } else {
425                                         if ($$ref =~ m/enabled/) {
426                                                 $$ref .= ", \e[32;1m$extra\e[0m";
427                                         } else {
428                                                 $$ref .= ", \e[0;32;1;5m$extra\e[0;31;1;5m";
429                                         }
430                                 }
431                         }
432                 }
433         }
434         for my $extra (sort {$a cmp $b} keys(%extras)) {
435                 my $text = $extras{$extra};
436                 if ($text =~ m/needed by/ && $text !~ m/enabled/) {
437                         printf "\e[31;1;5m%-*s = %s%s\e[0m\n", $maxlen, $extra, $text, ($text =~ m/needed by/ ? ")" : "");
438                 } else {
439                         printf "%-*s = %s%s\n", $maxlen, $extra, $text, ($text =~ m/needed by/ ? "\e[0m)" : "");
440                 }
441         }
442         return keys(%extras) if wantarray; # Can be used by manage_extras.
443 }
444
445 sub enable_extras (@) {
446         my (@extras) = @_;
447         for my $extra (@extras) {
448                 my $extrapath = "src/modules/extra/$extra";
449                 if (!-e $extrapath) {
450                         print STDERR "Cannot enable \e[32;1m$extra\e[0m : No such file or directory in src/modules/extra\n";
451                         next;
452                 }
453                 my $source = "src/modules/$extra";
454                 if (-e $source) {
455                         print STDERR "Cannot enable \e[32;1m$extra\e[0m : destination in src/modules exists (might already be enabled?)\n";
456                         next;
457                 }
458                 # Get dependencies, and add them to be processed.
459                 my @deps = split /\s+/, get_directive($extrapath, 'ModDep', '');
460                 for my $dep (@deps) {
461                         next if scalar(grep { $_ eq $dep } (@extras)) > 0; # Skip if we're going to be enabling it anyway.
462                         if (!-e "src/modules/$dep" && !-e "include/$dep") {
463                                 if (-e "src/modules/extra/$dep") {
464                                         print STDERR "Will also enable extra \e[32;1m$dep\e[0m (needed by \e[32;1m$extra\e[0m)\n";
465                                         push @extras, $dep;
466                                 } else {
467                                         print STDERR "\e[33;1mWARNING:\e[0m module \e[32;1m$extra\e[0m might be missing dependency \e[32;1m$dep\e[0m - YOU are responsible for satisfying it!\n";
468                                 }
469                         }
470                 }
471                 print "Enabling $extra ... \n";
472                 symlink "extra/$extra", $source or print STDERR "$source: Cannot link to 'extra/$extra': $!\n";
473         }
474 }
475
476 sub disable_extras (@)
477 {
478         opendir my $dd, "src/modules/extra/";
479         my @files = readdir($dd);
480         closedir $dd;
481         my (@extras) = @_;
482 EXTRA:  for my $extra (@extras) {
483                 my $extrapath = "src/modules/extra/$extra";
484                 my $source = "src/modules/$extra";
485                 if (!-e $extrapath) {
486                         print STDERR "Cannot disable \e[32;1m$extra\e[0m : Is not an extra\n";
487                         next;
488                 }
489                 if ((! -l $source) || readlink($source) ne "extra/$extra") {
490                         print STDERR "Cannot disable \e[32;1m$extra\e[0m : Source is not a link or doesn't refer to the right file. Remove manually if this is in error.\n";
491                         next;
492                 }
493                 # Check if anything needs this.
494                 for my $file (@files) {
495                         my @deps = split /\s+/, get_directive("src/modules/extra/$file", 'ModDep', '');
496                         # File depends on this extra...
497                         if (scalar(grep { $_ eq $extra } @deps) > 0) {
498                                 # And is both enabled and not about to be disabled.
499                                 if (-e "src/modules/$file" && scalar(grep { $_ eq $file } @extras) < 1) {
500                                         print STDERR "Cannot disable \e[32;1m$extra\e[0m : is needed by \e[32;1m$file\e[0m\n";
501                                         next EXTRA;
502                                 }
503                         }
504                 }
505                 # Now remove.
506                 print "Disabling $extra ... \n";
507                 unlink "src/modules/$extra" or print STDERR "Cannot disable \e[32;1m$extra\e[0m : $!\n";
508         }
509 }