]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - configure
Make the lines wide enough to hold the new data
[user/henk/code/inspircd.git] / configure
1 #!/usr/bin/perl
2
3 # InspIRCd Configuration Script
4 #
5 # Copyright 2002-2007 The ChatSpike Development Team
6 # <brain@chatspike.net>
7 # <Craig@chatspike.net>
8 #
9 # Licensed under GPL, please see the COPYING file
10 # for more information
11 #
12 # [14:21] Brain: <matrix impression> i know perl-fu!
13 #
14 # $Id$
15 #
16 ########################################
17
18
19 require 5.6.0;
20 use Socket;
21 use Cwd;
22 use Getopt::Long;
23
24 # Utility functions for our buildsystem
25 use make::utilities;
26 use make::configure;
27
28 GetOptions (
29         'enable-gnutls' => \$opt_use_gnutls,
30         'rebuild' => \$opt_rebuild,
31         'enable-openssl' => \$opt_use_openssl,
32         'disable-interactive' => \$opt_nointeractive,
33         'with-nick-length=i' => \$opt_nick_length,
34         'with-channel-length=i' => \$opt_chan_length,
35         'with-max-clients=i' => \$opt_maxclients,
36         'enable-epoll' => \$opt_epoll,
37         'enable-kqueue' => \$opt_kqueue,
38         'disable-epoll' => \$opt_noepoll,
39         'disable-kqueue' => \$opt_nokqueue,
40         'enable-ipv6' => \$opt_ipv6,
41         'enable-remote-ipv6' => \$opt_ipv6links,
42         'disable-remote-ipv6' => \$opt_noipv6links,
43         'with-cc=s' => \$opt_cc,
44         'with-ident-length=i' => \$opt_ident,
45         'with-quit-length=i' => \$opt_quit,
46         'with-topic-length=i' => \$opt_topic,
47         'with-kick-length=i' => \$opt_kick,
48         'with-gecos-length=i' => \$opt_gecos,
49         'with-away-length=i' => \$opt_away,
50         'with-max-modes=i' => \$opt_modes,
51         'prefix=s' => \$opt_base_dir,
52         'config-dir=s' => \$opt_config_dir,
53         'module-dir=s' => \$opt_module_dir,
54         'binary-dir=s' => \$opt_binary_dir,
55         'library-dir=s' => \$opt_library_dir,
56         'disable-debuginfo' => sub { $opt_disable_debug = 1 },
57         'help'  => sub { showhelp(); },
58         'modupdate' => sub { modupdate(); },
59         'update' => sub { update(); },
60         'svnupdate' => sub { svnupdate(); },
61         'clean' => sub { clean(); },
62 );
63
64 my $non_interactive = (
65         (defined $opt_library_dir) ||
66         (defined $opt_base_dir) ||
67         (defined $opt_config_dir) ||
68         (defined $opt_module_dir) ||
69         (defined $opt_base_dir) ||
70         (defined $opt_binary_dir) ||
71         (defined $opt_nointeractive) ||
72         (defined $opt_away) ||
73         (defined $opt_gecos) ||
74         (defined $opt_kick) ||
75         (defined $opt_maxclients) ||
76         (defined $opt_modes) ||
77         (defined $opt_topic) ||
78         (defined $opt_quit) ||
79         (defined $opt_ident) ||
80         (defined $opt_cc) ||
81         (defined $opt_ipv6) ||
82         (defined $opt_ipv6links) ||
83         (defined $opt_noipv6links) ||
84         (defined $opt_kqueue) ||
85         (defined $opt_epoll) ||
86         (defined $opt_maxchans) ||
87         (defined $opt_opermaxchans) ||
88         (defined $opt_chan_length) ||
89         (defined $opt_nick_length) ||
90         (defined $opt_use_openssl) ||
91         (defined $opt_nokqueue) ||
92         (defined $opt_noepoll) ||
93         (defined $opt_use_gnutls)
94 );
95 my $interactive = !$non_interactive;
96
97
98 chomp($topdir = getcwd());
99 $this = resolve_directory($topdir);                                             # PWD, Regardless.
100 @modlist = ();                                                          # Declare for Module List..
101 %config = ();                                                           # Initiate Configuration Hash..
102 $config{ME}              = resolve_directory($topdir);                  # Present Working Directory
103
104 $config{BASE_DIR}          = $config{ME};
105
106 if (defined $opt_base_dir)
107 {
108         $config{BASE_DIR} = $opt_base_dir;
109 }
110
111 $config{CONFIG_DIR}      = resolve_directory($config{BASE_DIR}."/conf");                # Configuration Directory
112 $config{MODULE_DIR}      = resolve_directory($config{BASE_DIR}."/modules");             # Modules Directory
113 $config{BINARY_DIR}      = resolve_directory($config{BASE_DIR}."/bin");         # Binary Directory
114 $config{LIBRARY_DIR}    = resolve_directory($config{BASE_DIR}."/lib");          # Library Directory
115
116 if (defined $opt_config_dir)
117 {
118         $config{CONFIG_DIR} = $opt_config_dir;
119 }
120 if (defined $opt_module_dir)
121 {
122         $config{MODULE_DIR} = $opt_module_dir;
123 }
124 if (defined $opt_binary_dir)
125 {
126         $config{BINARY_DIR} = $opt_binary_dir;
127 }
128 if (defined $opt_library_dir)
129 {
130         $config{LIBRARY_DIR} = $opt_library_dir;
131 }
132 chomp($config{HAS_GNUTLS}   = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
133 chomp($config{HAS_OPENSSL}  = `pkg-config --modversion openssl 2>/dev/null`);                   # Openssl version
134 chomp($gnutls_ver = $config{HAS_GNUTLS});
135 chomp($openssl_ver = $config{HAS_OPENSSL});
136 $config{USE_GNUTLS}         = "n";
137 if (defined $opt_use_gnutls)
138 {
139         $config{USE_GNUTLS} = "y";                                              # Use gnutls.
140 }
141 $config{USE_OPENSSL}    = "n";                                          # Use openssl.
142 if (defined $opt_use_openssl)
143 {
144         $config{USE_OPENSSL} = "y";
145 }
146
147 # no, let's not change these.
148 $config{OPTIMITEMP}      = "0";                                 # Default Optimisation Value
149 if (!defined $opt_disable_debug)
150 {
151         $config{OPTIMISATI}      = "-g1";                               # Optimisation Flag
152 }
153 else
154 {
155         $config{OPTIMISATI}      = "-O2";                                       # DEBUGGING OFF!
156 }
157
158 $config{NICK_LENGT}      = "31";                                        # Default Nick Length
159 if (defined $opt_nick_length)
160 {
161         $config{NICK_LENGT} = $opt_nick_length;
162 }
163 $config{CHAN_LENGT}      = "64";                                        # Default Channel Name Length
164 if (defined $opt_chan_length)
165 {
166         $config{CHAN_LENGT} = $opt_chan_length;
167 }
168 $config{MAXI_MODES}      = "20";                                        # Default Max. Number of Modes set at once.
169 if (defined $opt_modes)
170 {
171         $config{MAXI_MODES} = $opt_modes;
172 }
173 $config{HAS_STRLCPY}    = "false";                                      # strlcpy Check.
174 $config{HAS_STDINT}      = "false";                                             # stdint.h check
175 $config{USE_KQUEUE}      = "y";                                         # kqueue enabled
176 if (defined $opt_kqueue)
177 {
178         $config{USE_KQUEUE} = "y";
179 }
180 if (defined $opt_nokqueue)
181 {
182         $config{USE_KQUEUE} = "n";
183 }
184 $config{USE_EPOLL}        = "y";                                                # epoll enabled
185 if (defined $opt_epoll)
186 {
187         $config{USE_EPOLL} = "y";
188 }
189 if (defined $opt_noepoll)
190 {
191         $config{USE_EPOLL} = "n";
192 }
193 $config{IPV6}          = "n";                                           # IPv6 support (experimental)
194 if (defined $opt_ipv6)
195 {
196         $config{IPV6} = "y";
197 }
198 $config{SUPPORT_IP6LINKS}   = "y";                                              # IPv4 supporting IPv6 links (experimental)
199 if (defined $opt_ipv6links)
200 {
201         $config{SUPPORT_IP6LINKS} = "y";
202 }
203 if (defined $opt_noipv6links)
204 {
205         $config{SUPPORT_IP6LINKS} = "n";
206 }
207 $config{STATIC_LINK}        = "no";                                             # are doing static modules?
208 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`);                   # FD Limit
209 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`);                        # Hard FD Limit
210 chomp($config{GCCVER}       = `g++ -dumpversion | cut -c 1`);                   # Major GCC Version
211 $config{_SOMAXCONN} = SOMAXCONN;                                                # Max connections in accept queue
212 $config{OSNAME}             = $^O;                                      # Operating System Name
213 $config{IS_DARWIN}          = "NO";                                             # Is OSX?
214 if ($config{OSNAME} =~ /darwin/i)
215 {
216         $config{IS_DARWIN} = "YES";
217 }
218 $config{CC}                 = "g++";                                            # C++ compiler
219 if (defined $opt_cc)
220 {
221         $config{CC} = $opt_cc;
222 }
223 $exec = $config{CC} . " -dumpversion | cut -c 1";
224 chomp($config{GCCVER}       = `$exec`);                                         # Major GCC Version
225 $config{MAKEORDER}          = "ircd mods";                                      # build order
226 $config{STATICLIBS}      = "";                                          # library archive path
227 $config{MAX_IDENT}        = "12";                                               # max ident size
228 $config{MAX_QUIT}          = "255";                                             # max quit message size
229 $config{MAX_TOPIC}        = "307";                                              # max topic size
230 $config{MAX_KICK}          = "255";                                             # max kick message size
231 $config{MAX_GECOS}        = "128";                                              # max GECOS size
232 $config{MAX_AWAY}          = "200";                                             # max AWAY size
233 if (defined $opt_ident)
234 {
235         $config{MAX_IDENT} = $opt_ident;
236 }
237 if (defined $opt_quit)
238 {
239         $config{MAX_QUIT} = $opt_quit;
240 }
241 if (defined $opt_topic)
242 {
243         $config{MAX_TOPIC} = $opt_topic;
244 }
245 if (defined $opt_kick)
246 {
247         $config{MAX_KICK} = $opt_kick;
248 }
249 if (defined $opt_gecos)
250 {
251         $config{MAX_GECOS} = $opt_gecos;
252 }
253 if (defined $opt_away)
254 {
255         $config{MAX_AWAY} = $opt_away;
256 }
257
258 $config{HAS_OPENSSL} =~ /^([-[:digit:].]+)([a-z])?(\-[a-z][0-9])?$/;
259 $config{HAS_OPENSSL} = $1;
260
261 if ($config{GCCVER} eq "") {
262         print $config{CC} . " was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n";
263         exit;
264 }
265
266 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
267 # Keep my dynamic module experiments here for later
268 # consideration!
269
270 if ($config{OSNAME} =~ /CYGWIN/i)
271 {
272         $config{OSNAME} = "CYG-STATIC";
273 }
274
275 if (!$config{MAX_CLIENT_T}) { 
276         $config{MAX_CLIENT_T} = 1024;                            # Set a reasonable 'Default'
277         $fd_scan_fail = "true";                                # Used Later
278 }
279
280 # Get and Set some important vars..
281 getmodules();
282
283 sub clean
284 {
285         system("rm -rf .config.cache");
286 }
287
288 sub update
289 {
290         eval {
291                 chomp($topdir = getcwd());
292                 $this = resolve_directory($topdir);                                          # PWD, Regardless.
293                 getmodules();
294                 # Does the cache file exist?
295                 if (!getcache()) {
296                         # No, No it doesn't.. *BASH*
297                         print "You have not run ./configure before. Please do this before trying to run the update script.\n";
298                         exit 0;
299                 } else {
300                         # We've Loaded the cache file and all our variables..
301                         print "Updating Files..\n";
302                         getosflags();
303                         if ($opt_disable_debug == 1)
304                         {
305                                 print "Disabling debug information (-g).\n";
306                                 $config{OPTIMISATI} = "";
307                                 getosflags();
308                         }
309                         $has_epoll = $config{HAS_EPOLL};
310                         $has_kqueue = $config{HAS_KQUEUE};
311                         writefiles(1);
312                         makecache();
313                         print "Complete.\n";
314                         exit;
315                 }
316         };
317         if ($@)
318         {
319                 print "Configure update failed: $@\n";
320         }
321         exit;
322 }
323
324 sub modupdate
325 {
326         eval {
327                 chomp($topdir = getcwd());
328                 $this = resolve_directory($topdir);                                          # PWD, Regardless.
329                 getmodules();
330                 # Does the cache file exist?
331                 if (!getcache()) {
332                         # No, No it doesn't.. *BASH*
333                         print "You have not run ./configure before. Please do this before trying to run the update script.\n";
334                         exit 0;
335                 } else {
336                         # We've Loaded the cache file and all our variables..
337                         print "Updating Files..\n";
338                         getosflags();
339                         $has_epoll = $config{HAS_EPOLL};
340                         $has_kqueue = $config{HAS_KQUEUE};
341                         writefiles(0);
342                         makecache();
343                         print "Complete.\n";
344                         exit;
345                 }
346         };
347         if ($@)
348         {
349                 print "Module update failed: $@\n";
350         }
351         exit;
352 }
353
354
355
356 sub svnupdate
357 {
358         my $fail = 0;
359         open(FH,"<.svn/entries") or $fail = 1;
360         if ($fail) {
361                 print "This is not an SVN copy of InspIRCd.\n";
362                 exit;
363         }
364         else
365         {
366                 close(FH);
367         }
368         system("svn update");
369         system("perl configure -update");
370         if (defined $opt_rebuild) {
371                 system("make install");
372         }
373         exit;
374 }
375
376 print "Running non-interactive configure...\n" unless $interactive;
377 print "Checking for cache from previous configure... ";
378 print ((getcache() eq "true") ? "found\n" : "not found\n");
379 print "Checking operating system version... ";
380 print getosflags() . "\n";
381
382 if (defined $opt_maxclients)
383 {
384         $config{MAX_CLIENT} = $opt_maxclients;
385 }
386
387 if (!$config{MAX_CLIENT}) { 
388         # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
389         # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
390         # higher than the found value" :))
391         $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
392 }
393
394 printf "Checking if stdint.h exists... ";
395 $config{HAS_STDINT} = "true";
396 my $fail = 0;
397 open(STDINT, "</usr/include/stdint.h") or $config{HAS_STDINT} = "false";
398 if ($config{HAS_STDINT} eq "true") {
399         close(STDINT);
400 }
401 print "yes\n" if $config{HAS_STDINT} eq "true";
402 print "no\n" if $config{HAS_STDINT} eq "false";
403
404
405 printf "Checking if strlcpy exists... ";
406 # Perform the strlcpy() test..
407 $config{HAS_STRLCPY} = "false";
408 my $fail = 0;
409 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
410 if (!$fail) {
411         while (chomp($line = <STRLCPY>)) {
412                 # try and find the delcaration of:
413                 # size_t strlcpy(...)
414                 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
415                         $config{HAS_STRLCPY} = "true";
416                 }
417         }
418         close(STRLCPY);
419 }
420 print "yes\n" if $config{HAS_STRLCPY} eq "true";
421 print "no\n" if $config{HAS_STRLCPY} eq "false";
422
423
424 printf "Checking if kqueue exists... ";
425 $has_kqueue = 0;
426 $fail = 0;
427 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
428 if (!$fail) {
429         while (chomp($line = <KQUEUE>)) {
430                 # try and find the delcaration of:
431                 # int kqueue(void);
432                 if ($line =~ /int(\0x9|\s)+kqueue/) {
433                         $has_kqueue = 1;
434                 }
435         }
436         close(KQUEUE);
437 }
438 print "yes\n" if $has_kqueue == 1;
439 print "no\n" if $has_kqueue == 0;
440
441 printf "Checking if epoll exists... ";
442 $has_epoll = 0;
443 $fail = 0;
444 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
445 if (!$fail) {
446         $has_epoll = 1;
447         close(EPOLL);
448 }
449 if ($has_epoll) {
450         my $kernel = `uname -r`;
451         chomp($kernel);
452         if (($kernel =~ /^2\.0\./) || ($kernel =~ /^2\.2\./) || ($kernel =~ /^2\.4\./)) {
453                 $has_epoll = 0;
454         }
455 }
456 print "yes\n" if $has_epoll == 1;
457 print "no\n" if $has_epoll == 0;
458
459 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
460         $config{HAS_STRLCPY} = "true";
461 }
462
463 $config{HAS_EPOLL} = $has_epoll;
464 $config{HAS_KQUEUE} = $has_kqueue; 
465
466 printf "Checking for libgnutls... ";
467 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
468         print "yes\n";
469         $config{HAS_GNUTLS} = "y";
470 } else {
471         print "no\n";
472         $config{HAS_GNUTLS} = "n";
473 }
474
475 printf "Checking for openssl... ";
476 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
477         print "yes\n";
478         $config{HAS_OPENSSL} = "y";
479 } else {
480         print "no\n";
481         $config{HAS_OPENSSL} = "n";
482 }
483
484 ################################################################################
485 #                         BEGIN INTERACTIVE PART                              #
486 ################################################################################
487
488 # Clear the Screen..
489 if ($interactive)
490 {
491         system("clear");
492         $wholeos = $^O;
493
494         my $rev = getrevision();
495         # Display Introduction Message..
496         print "
497 Welcome to the \033[1mInspIRCd\033[0m Configuration program! (\033[1minteractive mode\033[0m)
498 \033[1mPackage maintainers: Type ./configure --help for non-interactive help\033[0m
499
500 *** If you are unsure of any of these values, leave it blank for    ***
501 *** standard settings that will work, and your server will run      ***
502 *** using them. Please consult your IRC network admin if in doubt.  ***
503
504 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
505 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
506 dir, otherwise you won't have a config file!
507
508 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos)
509 Maximum file descriptors: \033[1;32m$config{MAX_CLIENT_T}\033[0m
510 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
511         if ($rev eq "r0") {
512                 print " (Non-SVN build)";
513         }
514         print ".\n\n";
515
516         $config{CHANGE_COMPILER} = "n";
517         print "I have detected the following compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
518
519         while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
520                 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
521 should NOT be used. You should probably specify a newer compiler.\n\n";
522                 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
523                 if ($config{CHANGE_COMPILER} =~ /y/i) {
524                         print "What command do you want to use to invoke your compiler?\n";
525                         print "[\033[1;32m$config{CC}\033[0m] -> ";
526                         chomp($config{CC} = <STDIN>);
527                         if ($config{CC} eq "") {
528                                 $config{CC} = "g++";
529                         }
530                         chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
531                         if ($foo ne "") {
532                                 chomp($config{GCCVER}       = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
533                                 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
534                                 if ($config{GCCVER} < 3) {
535                                         print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
536                                 }
537                         }
538                         else {
539                                 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
540                         }
541                 }
542         }
543
544         print "\n";
545
546         # Directory Settings..
547         my $tmpbase = $config{BASE_DIR};
548         dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
549         if ($tmpbase ne $config{BASE_DIR}) {
550                 $config{CONFIG_DIR}      = resolve_directory($config{BASE_DIR}."/conf");           # Configuration Dir
551                 $config{MODULE_DIR}      = resolve_directory($config{BASE_DIR}."/modules");     # Modules Directory
552                 $config{BINARY_DIR}      = resolve_directory($config{BASE_DIR}."/bin");     # Binary Directory
553                 $config{LIBRARY_DIR}    = resolve_directory($config{BASE_DIR}."/lib");      # Library Directory
554         }
555
556         dir_check("are the configuration files", "CONFIG_DIR");
557         dir_check("are the modules to be compiled to", "MODULE_DIR");
558         dir_check("is the IRCd binary to be placed", "BINARY_DIR");
559         dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
560
561         if ($has_kqueue) {
562                 yesno(USE_KQUEUE,"You are running a BSD operating system, and kqueue\nwas detected. Would you like to enable kqueue support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable kqueue?");
563                 print "\n";
564         }
565         if ($has_epoll) {
566                 yesno(USE_EPOLL,"You are running a Linux 2.6+ operating system, and epoll\nwas detected. Would you like to enable epoll support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable epoll?");
567                 print "\n";
568         }
569         $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
570         if (!$chose_hiperf) {
571                 print "No high-performance socket engines are available, or you chose\n";
572                 print "not to enable one. Defaulting to select() engine.\n\n";
573         }
574
575         yesno(IPV6,"Would you like to build InspIRCd with IPv6 support?");
576         print "\n";
577
578         if ($config{IPV6} eq "y") {
579                 print "You have chosen to build an \033[1;32mIPV6-enabled\033[0m server.\nTo accept IPV4 users, you can still use IPV4 addresses\nin your port bindings..\n\n";
580                 $config{SUPPORT_IP6LINKS} = "y";
581         } else {
582                 yesno(SUPPORT_IP6LINKS,"You have chosen to build an \033[1;32mIPV4-only\033[0m server.\nWould you like to enable support for linking to IPV6-enabled\nInspIRCd servers?\nIf you are using a recent operating\nsystem and are unsure, answer yes.\nIf you answer 'no' here, your InspIRCd server will be unable\nto parse IPV6 addresses (e.g. for CIDR bans)");
583                 print "\n";
584         }
585
586         if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
587                 print "I have detected both \033[1;32mGnuTLS\033[0m and \033[1;32mOpenSSL\033[0m on your system.\n";
588                 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
589                 print "instead, you should enable the OpenSSL module yourself\n";
590                 print "by copying it from src/modules/extra to src/modules.\n\n";
591                 print "Detected GnuTLS version: \033[1;32m" . $gnutls_ver . "\033[0m\n";
592                 print "Detected OpenSSL version: \033[1;32m" . $openssl_ver . "\033[0m\n\n";
593         }
594
595         if ($config{HAS_GNUTLS} eq "y") {
596                 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
597                 if ($config{USE_GNUTLS} eq "y") {
598                         print "\nUsing GnuTLS SSL module.\n";
599                 }
600         } elsif ($config{HAS_OPENSSL} eq "y") {
601                         yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
602         if ($config{USE_OPENSSL} eq "y") {
603                         print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
604                 }
605         }
606         else {
607                 print "\nCould not detect OpenSSL or GnuTLS. Make sure pkg-config is installed if\nyou intend to use OpenSSL, or that GnuTLS is in your path if you intend\nto use GnuTLS.\n\n";
608         }
609
610         print "\nThe following questions will ask you for various figures relating\n";
611         print "To your IRCd install. Please note that these should usually be left\n";
612         print "as defaults unless you have a real reason to change them. If they\n";
613         print "changed, then the values must be identical on all servers on your\n";
614         print "network, or malfunctions and/or crashes may occur, with the exception\n";
615         print "of the 'maximum number of clients' setting which may be different on\n";
616         print "different servers on the network.\n\n";
617
618         # File Descriptor Settings..
619         promptnumeric("number of clients at any one time", "MAX_CLIENT_T");
620         $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
621         $config{MAX_DESCRIPTORS} = $config{MAX_CLIENT_T};
622
623         promptnumeric("length of nicknames", "NICK_LENGT");
624         promptnumeric("length of channel names", "CHAN_LENGT");
625         promptnumeric("number of mode changes in one line", "MAXI_MODES");
626         promptnumeric("length of an ident (username)", "MAX_IDENT");
627         promptnumeric("length of a quit message", "MAX_QUIT");
628         promptnumeric("length of a channel topic", "MAX_TOPIC");
629         promptnumeric("length of a kick message", "MAX_KICK");
630         promptnumeric("length of a GECOS (real name)", "MAX_GECOS");
631         promptnumeric("length of an away message", "MAX_AWAY");
632 }
633
634 dumphash();
635
636 if (($config{USE_GNUTLS} eq "y") && ($config{HAS_GNUTLS} ne "y"))
637 {
638         print "Sorry, but i couldn't detect gnutls. Make sure gnutls-config is in your path.\n";
639         exit(0);
640 }
641 if (($config{USE_OPENSSL} eq "y") && ($config{HAS_OPENSSL} ne "y"))
642 {
643         print "Sorry, but i couldn't detect openssl. Make sure openssl is in your path.\n";
644         exit(0);
645 }
646
647 if ($config{USE_GNUTLS} eq "y") {
648         $failed = 0;
649         open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
650         close(TMP);
651         if ($failed) {
652                 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
653                 chdir("src/modules");
654                 system("ln -s extra/m_ssl_gnutls.cpp");
655                 chdir("../..");
656         }
657         getmodules();
658         if ($interactive)
659         {
660                 $failed = 0;
661                 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
662                 close(TMP);
663                 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
664                 close(TMP);
665                 if ($failed) {
666                         print "SSL Certificates Not found, Generating.. \n\n
667 *************************************************************
668 * Generating the Private Key may take some time, go grab a  *
669 * Coffee. Even better, to generate some more entropy if it  *
670 * is taking a while, open another console and type du / a   *
671 * few times and get that HD going :) Then answer the    *
672 * Questions which follow. If you are unsure, just hit enter *
673 *************************************************************\n\n";
674                         system("certtool --generate-privkey --outfile key.pem");
675                         system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
676                         print "\nCertificate generation complete, copying to config directory... ";
677                         system("mv key.pem $config{CONFIG_DIR}/key.pem");
678                         system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
679                         print "Done.\n\n";
680                 } else {
681                         print "SSL Certificates found, skipping.\n\n"
682                 }
683         }
684         else
685         {
686                 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
687         }
688 } elsif ($config{USE_OPENSSL} eq "y") {
689         $failed = 0;
690         open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
691         close(TMP);
692         if ($failed) {
693                 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
694                 chdir("src/modules");
695                 system("ln -s extra/m_ssl_openssl.cpp");
696                 chdir("../..");
697         }
698         getmodules();
699         $failed = 0;
700         if ($interactive)
701         {
702                 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
703                 close(TMP);
704                 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
705                 close(TMP);
706                 if ($failed) {
707                         print "SSL Certificates Not found, Generating.. \n\n
708 *************************************************************
709 * Generating the certificates may take some time, go grab a *
710 * coffee, or something.                              *
711 *************************************************************\n\n";
712                         system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
713                         system("openssl dhparam -out dhparams.pem 1024");
714                         print "\nCertificate generation complete, copying to config directory... ";
715                         system("mv key.pem $config{CONFIG_DIR}/key.pem");
716                         system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
717                         system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
718                         print "Done.\n\n";
719                 } else {
720                         print "SSL Certificates found, skipping.\n\n"
721                 }
722         }
723         else
724         {
725                 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
726         }
727 }
728 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
729         print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
730 }
731
732 getosflags();
733 writefiles(1);
734 makecache();
735
736 print "\n\n";
737 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
738 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
739         print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
740         print "load the required modules in your config. This configure process\n";
741         print "has just prepared these modules to be compiled for you, and has not\n";
742         print "configured them to be compiled into the core of the ircd.\n";
743 }
744 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
745 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
746         print "\033[1;32mWARNING!\033[0m You are running OpenBSD but you are using the base gcc package\nrather than eg++. This compile will most likely fail, but i'm letting you\ngo ahead with it anyway, just in case i'm wrong :-)\n";
747 }
748
749 if ($config{GCCVER} < "3") {
750         print <<FOO2;
751 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
752 GCC 2.x series compilers only had partial (read as broken) C++ support, and
753 your compile will most likely fail horribly! If you have any problems, do NOT
754 report them to the bugtracker or forums without first upgrading your compiler
755 to a newer 3.x or 4.x (or whatever is available currently) version.
756 FOO2
757 }
758
759 ################################################################################
760 #                             HELPER FUNCTIONS                          #
761 ################################################################################
762 sub getcache {
763         # Retrieves the .config.cache file, and loads values into the main config hash.
764         open(CACHE, ".config.cache") or return undef;
765         while (<CACHE>) {
766                 chomp;
767                 # Ignore Blank lines, and comments..
768                 next if /^\s*$/;
769                 next if /^\s*#/;
770                 my ($key, $value) = split("=", $_, 2);
771                 $value =~ /^\"(.*)\"$/;
772                 # Do something with data here!
773                 $config{$key} = $1;
774         }
775         close(CONFIG);
776         return "true";
777 }
778
779 sub makecache {
780         # Dump the contents of %config
781         print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
782         open(FILEHANDLE, ">.config.cache");
783         foreach $key (keys %config) {
784                 print FILEHANDLE "$key=\"$config{$key}\"\n";
785         }
786         close(FILEHANDLE);
787 }
788
789 sub dir_check {
790         my ($desc, $hash_key) = @_;
791         my $complete = 0;
792         while (!$complete) {
793                 print "In what directory $desc?\n";
794                 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
795                 chomp($var = <STDIN>);
796                 if ($var eq "") {
797                         $var = $config{$hash_key};
798                 }
799                 if ($var =~ /^\~\/(.+)$/) {
800                         # Convert it to a full path..
801                         $var = resolve_directory($ENV{HOME} . "/" . $1);
802                 }
803                 elsif ((($config{OSNAME} =~ /MINGW32/i) and ($var !~ /^[A-Z]{1}:\\.*/)) and (substr($var,0,1) ne "/"))
804                 {
805                         # Assume relative Path was given.. fill in the rest.
806                         $var = $this . "/$var";
807                 }
808                 
809                 $var = resolve_directory($var); 
810                 if (! -e $var) {
811                         print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
812                         chomp($tmp = <STDIN>);
813                         if (($tmp eq "") || ($tmp =~ /^y/i)) {
814                                 # Attempt to Create the Dir..
815                                 
816                                 system("mkdir -p \"$var\" >> /dev/null 2>&1");
817                                 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
818                                 if ($chk != 0) {
819                                         print "Unable to create directory. ($var)\n\n";
820                                         # Restart Loop..
821                                         next;
822                                 }
823                         } else {
824                                 # They said they don't want to create, and we can't install there.
825                                 print "\n\n";
826                                 next;
827                         }
828                 } else {
829                         if (!is_dir($var)) {
830                                 # Target exists, but is not a directory.
831                                 print "File $var exists, but is not a directory.\n\n";
832                                 next;
833                         }
834                 }
835                 # Either Dir Exists, or was created fine.
836                 $config{$hash_key} = $var;
837                 $complete = 1;
838                 print "\n";
839         }
840 }
841
842 sub getosflags {
843
844         $config{LDLIBS} = "-lstdc++";
845         $config{FLAGS}  = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
846         $config{DEVELOPER} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -g";
847         $SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared";
848         $config{MAKEPROG} = "make";
849
850         if ($config{OSNAME} =~ /darwin/i) {
851                 $config{FLAGS}  = "-DDARWIN -frtti -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
852                 $SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup";
853                 $config{LDLIBS} = "-ldl -lstdc++";
854         }
855
856         if ($config{OSNAME} =~ /OpenBSD/i) {
857                 $config{MAKEPROG} = "gmake";
858                 chomp($foo = `eg++ -dumpversion | cut -c 1`);
859                 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
860                 # if theyre not running this, configure lets the build continue but they probably wont manage to
861                 # compile as this standard version is 2.95.3!
862                 if ($foo ne "") {
863                         $config{CC} = "eg++";
864                         chomp($config{GCCVER}       = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
865                 }
866                 return "OpenBSD";
867         }
868
869         if ($config{OSNAME} =~ /Linux/i) {
870                 $config{LDLIBS} = "-ldl -lstdc++";
871                 $config{FLAGS}  = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
872                 $config{FLAGS}  .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
873                 $config{MAKEPROG} = "make";
874                 if ($config{OSNAME} =~ /CYGWIN/) {
875                         $config{FLAGS}  = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
876                         $config{LDLIBS} = "";
877                         $config{MAKEPROG} = "/usr/bin/make";
878                         $config{MAKEORDER} = "ircd mods";
879                         return "Cygwin";
880                 } elsif ($config{OSNAME} eq "CYG-STATIC") {
881                         $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
882                         $config{LDLIBS} = "";
883                         $config{MAKEPROG} = "/usr/bin/make";
884                         $config{MAKEORDER} = "mods ircd";
885                         $config{STATICLIBS} = "modules/mods.a";
886                         $config{STATIC_LINK} = "yes";
887                         return "Cygwin-Static";
888                 }
889                 $config{FLAGS}  .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
890         }
891         
892         if ($config{OSNAME} =~ /SunOS/i)
893         {
894                 # solaris/sunos needs these
895                 # socket = bsd sockets api
896                 # nsl = dns stuff
897                 # rt = POSIX realtime extensions
898                 # resolv = inet_aton only (why isnt this in nsl?!)
899                 $config{MAKEPROG} = "gmake";
900                 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
901                 return "Solaris";
902         }
903         
904         if($config{OSNAME} =~ /MINGW32/i)
905         {
906                 # All code is position-independent on windows
907                 $config{FLAGS} =~ s/-fPIC //;
908                 return "MinGW";
909         }
910
911         return $config{OSNAME};
912 }
913
914 sub writefiles {
915         my($writeheader) = @_;
916         # First File.. inspircd_config.h
917         chomp(my $incos = `uname -n -s -r`);
918         chomp($version = `sh src/version.sh`);
919         chomp(my $revision2 = getrevision());
920         if ($writeheader == 1)
921         {
922                 print "Writing \033[1;32minspircd_config.h\033[0m\n";
923                 open(FILEHANDLE, ">include/inspircd_config.h");
924                 my $NL = $config{NICK_LENGT}+1;
925                 my $CL = $config{CHAN_LENGT}+1;
926                 print FILEHANDLE <<EOF;
927 /* Auto generated by configure, do not modify! */
928 #ifndef __CONFIGURATION_AUTO__
929 #define __CONFIGURATION_AUTO__
930
931 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
932 #define MOD_PATH "$config{MODULE_DIR}"
933 #define VERSION "$version"
934 #define REVISION "$revision2"
935 #define MAXCLIENTS $config{MAX_CLIENT}
936 #define MAXCLIENTS_S "$config{MAX_CLIENT}"
937 #define SOMAXCONN_S "$config{_SOMAXCONN}"
938 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
939 #define NICKMAX $NL
940 #define CHANMAX $CL
941 #define MAXMODES $config{MAXI_MODES}
942 #define IDENTMAX $config{MAX_IDENT}
943 #define MAXQUIT $config{MAX_QUIT}
944 #define MAXTOPIC $config{MAX_TOPIC}
945 #define MAXKICK $config{MAX_KICK}
946 #define MAXGECOS $config{MAX_GECOS}
947 #define MAXAWAY $config{MAX_AWAY}
948 #define OPTIMISATION $config{OPTIMITEMP}
949 #define LIBRARYDIR "$config{LIBRARY_DIR}"
950 #define SYSTEM "$incos"
951 #define MAXBUF 514
952 EOF
953                 if ($config{OSNAME} =~ /SunOS/i) {
954                         print FILEHANDLE "#define IS_SOLARIS\n";
955                 }
956                 if ($config{OSNAME} =~ /CYGWIN/i) {
957                         print FILEHANDLE "#define IS_CYGWIN\n";
958                         print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE        1024\n#endif\n";
959                 }
960                 if ($config{OSNAME} =~ /MINGW32/i) {
961                         print FILEHANDLE "#define IS_MINGW\n";
962                 }
963                 if ($config{OSNAME} =~ /CYG-STATIC/i) {
964                         print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE    1024\n#endif\n";
965                 }
966                 if ($config{STATIC_LINK} eq "yes") {
967                         print FILEHANDLE "#define STATIC_LINK\n";
968                 }
969                 if ($config{GCCVER} >= 3) {
970                         print FILEHANDLE "#define GCC3\n";
971                 }
972                 if ($config{HAS_STRLCPY} eq "true") {
973                         print FILEHANDLE "#define HAS_STRLCPY\n";
974                 }
975                 if ($config{HAS_STDINT} eq "true") {
976                         print FILEHANDLE "#define HAS_STDINT\n";
977                 }
978                 if ($config{IPV6} =~ /y/i) {
979                         print FILEHANDLE "#define IPV6\n";
980                 }
981                 if ($config{SUPPORT_IP6LINKS} =~ /y/i) {
982                         print FILEHANDLE "#define SUPPORT_IP6LINKS\n";
983                 }
984                 my $use_hiperf = 0;
985                 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
986                         print FILEHANDLE "#define USE_KQUEUE\n";
987                         $se = "socketengine_kqueue";
988                         $use_hiperf = 1;
989                 }
990                 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
991                         print FILEHANDLE "#define USE_EPOLL\n";
992                         $se = "socketengine_epoll";
993                         $use_hiperf = 1;
994                 }
995                 # user didn't choose either epoll or select for their OS.
996                 # default them to USE_SELECT (ewwy puke puke)
997                 if (!$use_hiperf) {
998                         print FILEHANDLE "#define USE_SELECT\n";
999                         $se = "socketengine_select";
1000                 }
1001                 print FILEHANDLE "\n#endif\n";
1002                 close(FILEHANDLE);
1003         }
1004
1005         if ($writeheader)
1006         {
1007                 open(FILEHANDLE, ">include/inspircd_se_config.h");
1008                 print FILEHANDLE <<EOF;
1009 /* Auto generated by configure, do not modify or commit to svn! */
1010 #ifndef __CONFIGURATION_SOCKETENGINE__
1011 #define __CONFIGURATION_SOCKETENGINE__
1012
1013 #include "$se.h"
1014
1015 #endif
1016 EOF
1017                 close(FILEHANDLE);
1018         }
1019
1020
1021         # Create a Modules List..
1022         my $modules = "";
1023         foreach $i (@modlist)
1024         {
1025                 if ($config{STATIC_LINK} eq "yes") {
1026                         $modules .= "m_".$i.".o ";
1027                 }
1028                 else {
1029                         $modules .= "m_".$i.".so ";
1030                 }
1031         }
1032         chomp($modules);   # Remove Redundant whitespace..
1033
1034         opendir(DIRHANDLE, "src/modules");
1035         foreach $name (sort readdir(DIRHANDLE)) {
1036                 if ($name =~ /^m_(.+?)$/) {
1037                         if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1038                                 closedir(MDIRHANDLE);
1039                                 $modules .= "$name.so ";
1040                         }
1041                 }
1042         }
1043         closedir(DIRHANDLE);
1044
1045
1046         # Write all .in files.
1047         my $tmp = "";
1048         my $file = "";
1049         my $exe = "inspircd";
1050
1051         if ($config{OSNAME} =~ /CYGWIN/i) {
1052                 $exe = "inspircd.exe";
1053         }
1054
1055         opendir(DIRHANDLE, $this);
1056
1057         # Do this once here, and cache it in the .*.inc files,
1058         # rather than attempting to read src/version.sh from
1059         # compiled code -- we might not have the source to hand.
1060         # Fix for bug#177 by Brain.
1061
1062         chomp(my $version = `sh ./src/version.sh`);
1063         chomp(my $revision = getrevision());
1064         $version = "$version(r$revision)";
1065
1066         my $LIBEXT = "so";
1067         if ($config{IS_DARWIN} eq "YES")
1068         {
1069                 $LIBEXT = "dylib";
1070         }
1071         # We can actually parse any file starting with . and ending with .inc,
1072         # but right now we only parse .inspircd.inc to form './inspircd'
1073
1074         foreach $name (sort readdir(DIRHANDLE)) {
1075                 if ($name =~ /^\.(.+)\.inc$/) {
1076                         $file = $1;
1077                         # All .name.inc files need parsing!
1078                         $tmp = "";
1079                         open(FILEHANDLE, ".$file.inc");
1080                         while (<FILEHANDLE>) {
1081                                 $tmp .= $_;
1082                         }
1083                         close(FILEHANDLE);
1084
1085                         $tmp =~ s/\@CC\@/$config{CC}/;
1086                         $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1087                         $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1088                         $tmp =~ s/\@DEVELOPER\@/$config{DEVELOPER}/;
1089                         $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1090                         $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1091                         $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1092                         $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1093                         $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1094                         $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1095                         $tmp =~ s/\@LIBRARY_EXT\@/$LIBEXT/;
1096                         $tmp =~ s/\@MODULES\@/$modules/;
1097                         $tmp =~ s/\@EXECUTABLE\@/$exe/;
1098                         $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1099                         $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1100                         $tmp =~ s/\@VERSION\@/$version/;
1101
1102                         print "Writing \033[1;32m$file\033[0m\n";
1103                         open(FILEHANDLE, ">$file");
1104                         print FILEHANDLE $tmp;
1105                 }
1106         }
1107         closedir(DIRHANDLE);
1108
1109         # Make inspircd executable!
1110         chmod 0744, 'inspircd';
1111
1112         if ($config{STATIC_LINK} eq "yes") {
1113                 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1114                 write_static_makefile();
1115                 write_static_modules_makefile();
1116         } elsif ($config{OSNAME} =~ /CYGWIN/i) {
1117                 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1118                 write_static_makefile();
1119                 write_dynamic_modules_makefile();
1120         } else {
1121                 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1122                 write_dynamic_makefile();
1123                 write_dynamic_modules_makefile();
1124         }
1125 }
1126
1127 sub write_static_modules_makefile {
1128         # Modules Makefile..
1129         print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1130         open(FILEHANDLE, ">src/modules/Makefile");
1131
1132         ###
1133         # Module Makefile Header
1134         ###
1135         print FILEHANDLE <<EOF;
1136 # (C) ChatSpike development team
1137 # Makefile by <Craig\@ChatSpike.net>
1138 # Many Thanks to Andrew Church <achurch\@achurch.org>
1139 #    for assisting with making this work right.
1140 #
1141 # Automatically Generated by ./configure to add a modules
1142 # please run ./configure --update
1143
1144 all: \$(MODULES)
1145
1146 EOF
1147         ###
1148         # End Module Makefile Header
1149         ###
1150
1151         # Create a Modules List..
1152         my $modules = "";
1153         my $cmflags = "";
1154         my $liflags = "";
1155
1156         open(MODLIST,">include/modlist.h");
1157
1158         ###
1159         # Include File Header
1160         ###
1161         print MODLIST <<HEADER;
1162 // Generated automatically by configure. DO NOT EDIT!
1163
1164 #ifndef __SYMBOLS__H_CONFIGURED__
1165 #define __SYMBOLS__H_CONFIGURED__
1166
1167 HEADER
1168         ###
1169         # End Include File Header
1170         ###
1171
1172         # Place Module List into Include
1173         foreach $i (@modlist) {
1174                 if ($i !~ /_static$/) {
1175                         print MODLIST "extern \"C\" void * $i\_init (void);\n";
1176                 }
1177         }
1178         print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1179
1180         ###
1181         # Build Module Crap
1182         ###
1183         foreach $i (@modlist)
1184         {
1185                 if ($i !~ /_static$/) {
1186                         $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1187                         $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1188                         $deps = getdependencies("src/modules/m_".$i.".cpp");
1189
1190                         #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1191
1192                         ###
1193                         # Write Entry to the Makefile
1194                         ###
1195                         print FILEHANDLE <<EOCHEESE;
1196 m_$i.o: .m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h $deps
1197         \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c .m_$i\_static.cpp
1198         mv .m_$i\_static.o ../m_$i.o
1199
1200 EOCHEESE
1201                         ###
1202                         # End Write Entry to the MakeFile
1203                         ###
1204                         print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1205                         open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1206                         open(MUNGED,">src/modules/.m_".$i."_static.cpp") or die("Could not create .m_".$i."_static.cpp");
1207                         while (chomp($a = <MODULE>)) { 
1208                                 $a =~ s/init_module/$i\_init/g;
1209                                 print MUNGED "$a\n";
1210                         }
1211                         close(MODULE);
1212                         close(MUNGED);
1213                         print MODLIST <<EOENT;
1214 {"m_$i.so",\&$i\_init},
1215 EOENT
1216                         print "done\n";
1217                 }
1218         }
1219
1220         print MODLIST "{0}};\n\n#endif\n";
1221         close(MODLIST);
1222 }
1223
1224 sub write_dynamic_modules_makefile {
1225         # Modules Makefile..
1226         print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1227         open(FILEHANDLE, ">src/modules/Makefile");
1228         my $extra = "";
1229
1230         if ($config{OSNAME} =~ /CYGWIN/i) {
1231                 $extra = "../inspircd.dll.a";
1232         }
1233
1234 ###
1235 # Module Makefile Header
1236 ###
1237         print FILEHANDLE <<EOF;
1238 # (C) ChatSpike development team
1239 # Makefile by <Craig\@ChatSpike.net>
1240 # Many Thanks to Andrew Church <achurch\@achurch.org>
1241 #    for assisting with making this work right.
1242 #
1243 # Automatically Generated by ./configure to add a modules
1244 # please run ./configure -update or ./configure -modupdate
1245
1246 all: \$(MODULES)
1247
1248 EOF
1249         ###
1250         # End Module Makefile Header
1251         ###
1252
1253         # Create a Modules List..
1254         my $modules = "";
1255         my $cmflags = "";
1256         my $liflags = "";
1257         my $crud = "";
1258
1259         foreach $i (@modlist) {
1260                 ###
1261                 # Write Entry to the MakeFile
1262                 ###
1263                 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1264                 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1265                 $deps = getdependencies("src/modules/m_".$i.".cpp");
1266         
1267                 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1268         
1269                 print FILEHANDLE <<EOCHEESE;
1270 m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps
1271         \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1272 EOCHEESE
1273
1274 if ($config{OSNAME} =~ /darwin/) {
1275                 print FILEHANDLE <<EOCHEESE;
1276         \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle $liflags -o m_$i.so m_$i.o $extra
1277
1278 EOCHEESE
1279 } else {
1280                 print FILEHANDLE <<EOCHEESE;
1281         \$(CC) -pipe \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1282
1283 EOCHEESE
1284 }
1285                 $crud = $crud . "       install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
1286 ###
1287                 # End Write Entry to the MakeFile
1288                 ###
1289         }
1290
1291         opendir(DIRHANDLE, "src/modules");
1292         foreach $name (sort readdir(DIRHANDLE)) {
1293                 if ($name =~ /^m_(.+?)$/) {
1294                         $crapola = "";
1295                         $crap3 = "";
1296                         # A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
1297                         if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1298                                 print "Composing Makefile rules for directory \033[1;32m$name\033[0m... ";
1299                                 my $i = 0;
1300                                 print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h"; 
1301                                 foreach $fname (sort readdir(MDIRHANDLE)) {
1302                                         if ($fname =~ /\.cpp$/) {
1303                                                 $cmflags = getcompilerflags("src/modules/$name/$fname");
1304                                                 $liflags = getlinkerflags("src/modules/$name/$fname");
1305                                                 $deps = getdependencies("src/modules/$name/$fname");
1306                                                 $oname = $fname;
1307                                                 $oname =~ s/\.cpp$/.o/g;
1308                                                 print FILEHANDLE " $name/$oname";
1309                                                 $crapola = $crapola .  "$name/$oname: $name/$fname ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps\n";
1310                                                 $crapola = $crapola .  "        \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $name/$oname -c $name/$fname\n\n";
1311                                                 $crap3 = $crap3 . " $name/$oname";
1312                                                 $i++;
1313                                         }
1314                                 }
1315                                 print "(\033[1;32m$i files found\033[0m)\n";
1316                                 if ($config{IS_DARWIN} eq "YES") {
1317                                         print FILEHANDLE "\n    \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle -o $name.so $crap3\n"; 
1318                                 } else {
1319                                         print FILEHANDLE "\n    \$(CC) -pipe \$(FLAGS) -shared $liflags -o $name.so $crap3\n";
1320                                 }
1321                                 print FILEHANDLE "\n$crapola\n";
1322                                 closedir(MDIRHANDLE);
1323                                 $crud = $crud . "       install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
1324                         }
1325                 }
1326         }
1327         closedir(DIRHANDLE);
1328
1329         print FILEHANDLE "modinst:\n    \@echo \"Installing modules...\"\n" . $crud;
1330 }
1331
1332
1333 sub write_static_makefile {
1334         open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1335         my $i = 0;
1336         my @cmdlist = ();
1337         opendir(DIRHANDLE, "src");
1338         foreach $name (sort readdir(DIRHANDLE)) {
1339                 if ($name =~ /^cmd_(.+)\.cpp$/) {
1340                         $cmdlist[$i++] = $1;
1341                 }
1342         }
1343         closedir(DIRHANDLE);
1344         my $cmdobjs = "";
1345         my $srcobjs = "";
1346         foreach my $cmd (@cmdlist) {
1347                 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1348                 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1349         }
1350         print FH <<EOM;
1351 # Insp Makefile :p
1352 #
1353 # (C) ChatSpike development team
1354 # Makefile by <Craig\@ChatSpike.net>
1355 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1356 #
1357
1358 CC = im a cheezeball
1359
1360 CXXFLAGS = -I../include \${FLAGS}
1361 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1362 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1363
1364 EOM
1365
1366 $se = "socketengine_select";
1367 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1368         $se = "socketengine_kqueue";
1369 }       
1370 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1371         $se = "socketengine_epoll";
1372 }
1373
1374         ###
1375         # This next section is for cygwin dynamic module builds.
1376         # Basically, what we do, is build the inspircd core as a library
1377         # then the main executable uses that. the library is capable of
1378         # loading / unloading the modules dynamically :)
1379         # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1380         # make this work :)
1381         ###
1382
1383         if ($config{OSNAME} =~ /CYGWIN/i) {
1384                 print FH <<EOM;
1385 all: timer.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.o $cmdobjs commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o snomasks.o inspircd.exe
1386
1387 inspircd.exe: inspircd.dll.a
1388         \$(CC) -o \$@ \$^
1389
1390 inspircd.dll inspircd.dll.a: inspircd.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.o $cmdobjs  commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o hashcomp.o socket.o socketengine.o userprocess.o cull_list.o command_parse.o timer.o snomasks.o
1391         \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1392 EOM
1393         } else {
1394                 print FH <<EOM;
1395 all: timer.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.o $cmdobjs commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o snomasks.o \$(MODULES) inspircd.exe
1396
1397 inspircd.exe: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h ../include/base.h
1398         \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspsocket.o configreader.o $cmdobjs commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o hashcomp.o socket.o socketengine.o userprocess.o cull_list.o command_parse.o timer.o snomasks.o modes/modeclasses.a \$(MODULES)
1399 EOM
1400         }
1401
1402         print FH <<EOM;
1403
1404 cull_list.o: cull_list.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/users.h ../include/channels.h
1405         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1406
1407 snomasks.o: snomasks.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/channels.h
1408         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1409
1410 command_parse.o: command_parse.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1411         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1412
1413 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1414         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1415
1416 socketengine.o: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1417         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1418
1419 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1420         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1421
1422 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1423         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1424
1425 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1426         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1427
1428 mode.o: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES) modes/modeclasses.a
1429         \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS)
1430         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1431
1432 xline.o: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1433         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1434
1435 inspstring.o: inspstring.cpp ../include/base.h ../include/inspstring.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1436         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1437
1438 dns.o: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1439         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1440
1441 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1442         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1443
1444 configreader.o: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1445         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1446
1447 commands.o: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h $srcobjs
1448         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1449
1450 dynamic.o: dynamic.cpp ../include/base.h ../include/dynamic.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1451         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1452
1453 users.o: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1454         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1455
1456 modules.o: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1457         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1458
1459 wildcard.o: wildcard.cpp ../include/base.h ../include/wildcard.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1460         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1461
1462 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1463         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1464         
1465 inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1466         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1467
1468 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1469         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1470
1471 EOM
1472         foreach my $cmd (@cmdlist) {
1473                 print FH <<ITEM;
1474 cmd_$cmd.o: cmd_$cmd.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/commands/cmd_$cmd.h
1475         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1476 ITEM
1477         }
1478         close(FH);
1479 }
1480
1481 sub write_dynamic_makefile {
1482
1483         my $i = 0;
1484         my @cmdlist = ();
1485         opendir(DIRHANDLE, "src");
1486         foreach $name (sort readdir(DIRHANDLE)) {
1487                 if ($name =~ /^cmd_(.+)\.cpp$/) {
1488                         $cmdlist[$i++] = $1;
1489                 }
1490         }
1491         closedir(DIRHANDLE);
1492
1493         my $cmdobjs = "";
1494         my $srcobjs = "";
1495         foreach my $cmd (@cmdlist) {
1496                 $cmdobjs = $cmdobjs . "cmd_$cmd.so ";
1497                 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1498         }
1499
1500         $se = "socketengine_select";
1501         if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1502                 $se = "socketengine_kqueue";
1503         }
1504         elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1505                 $se = "socketengine_epoll";
1506         }
1507
1508         open(FH,">src/Makefile") or die("Could not write src/Makefile");
1509         print FH <<EOM;
1510 # Insp Makefile :p
1511 #
1512 # (C) ChatSpike development team
1513 # Makefile by <Craig\@ChatSpike.net>
1514 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1515 #
1516
1517 CC = im a cheezeball
1518
1519 CXXFLAGS = -I../include \${FLAGS}
1520 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1521 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1522
1523 EOM
1524
1525 if ($config{IS_DARWIN} eq "YES") {
1526         print FH <<EOM;
1527 all: libIRCDtimer.dylib libIRCDcull_list.dylib libIRCDuserprocess.dylib libIRCDsocketengine.dylib libIRCDsocket.dylib libIRCDhash.dylib libIRCDchannels.dylib libIRCDmode.dylib libIRCDxline.dylib libIRCDstring.dylib libIRCDasyncdns.dylib libIRCDbase.dylib libIRCDconfigreader.dylib libIRCDinspsocket.dylib libIRCDcommands.dylib libIRCDdynamic.dylib libIRCDusers.dylib libIRCDmodules.dylib libIRCDwildcard.dylib libIRCDhelper.dylib libIRCDcommand_parse.dylib libIRCDsnomasks.dylib inspircd
1528
1529 inspircd: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h ../include/socket.h $cmdobjs libIRCDtimer.dylib libIRCDcull_list.dylib libIRCDuserprocess.dylib libIRCDsocketengine.dylib libIRCDsocket.dylib libIRCDhash.dylib libIRCDchannels.dylib libIRCDmode.dylib libIRCDxline.dylib libIRCDstring.dylib libIRCDasyncdns.dylib libIRCDbase.dylib libIRCDconfigreader.dylib libIRCDinspsocket.dylib libIRCDsnomasks.dylib libIRCDcommands.dylib libIRCDdynamic.dylib libIRCDusers.dylib libIRCDmodules.dylib libIRCDwildcard.dylib libIRCDhelper.dylib libIRCDcommand_parse.dylib
1530         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd.cpp
1531         \$(CC) -pipe -dynamic -bind_at_load -L. -o inspircd \$(LDLIBS) inspircd.o libIRCDchannels.dylib libIRCDmode.dylib libIRCDxline.dylib libIRCDstring.dylib libIRCDasyncdns.dylib libIRCDbase.dylib libIRCDconfigreader.dylib libIRCDinspsocket.dylib libIRCDcommands.dylib libIRCDdynamic.dylib libIRCDusers.dylib libIRCDmodules.dylib libIRCDwildcard.dylib libIRCDhelper.dylib libIRCDhash.dylib libIRCDsocket.dylib libIRCDsocketengine.dylib libIRCDuserprocess.dylib libIRCDcull_list.dylib libIRCDcommand_parse.dylib libIRCDtimer.dylib libIRCDsnomasks.dylib
1532
1533 libIRCDsocketengine.dylib: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1534         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1535         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c $se.cpp
1536         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDsocketengine.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDsocketengine.dylib socketengine.o $se.o
1537
1538 libIRCDsnomasks.dylib: snomasks.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/channels.h
1539         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1540         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDsnomasks.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDsnomasks.dylib snomasks.o
1541
1542 libIRCDcommand_parse.dylib: command_parse.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1543         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1544         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDcommand_parse.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDcommand_parse.dylib command_parse.o
1545
1546 libIRCDcull_list.dylib: cull_list.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/users.h ../include/channels.h
1547         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1548         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDcull_list.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDcull_list.dylib cull_list.o
1549
1550 libIRCDuserprocess.dylib: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1551         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1552         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDuserprocess.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDuserprocess.dylib userprocess.o
1553
1554 libIRCDhash.dylib: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1555         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1556         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDhash.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDhash.dylib hashcomp.o
1557
1558 libIRCDhelper.dylib: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1559         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1560         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDhelper.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDhelper.dylib helperfuncs.o
1561
1562 libIRCDchannels.dylib: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1563         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1564         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDchannels.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDchannels.dylib channels.o
1565
1566 libIRCDmode.dylib: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES)
1567         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1568         \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1569         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDmode.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDmode.dylib mode.o modes/modeclasses.a
1570
1571 libIRCDxline.dylib: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1572         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1573         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDxline.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDxline.dylib xline.o
1574
1575 libIRCDstring.dylib: inspstring.cpp ../include/base.h ../include/inspstring.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1576         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1577         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDstring.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDstring.dylib inspstring.o
1578
1579 libIRCDasyncdns.dylib: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1580         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1581         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDasyncdns.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDasyncdns.dylib dns.o
1582
1583 libIRCDbase.dylib: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1584         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1585         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDbase.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDbase.dylib base.o
1586
1587 libIRCDconfigreader.dylib: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1588         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1589         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDconfigreader.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDconfigreader.dylib configreader.o
1590
1591 libIRCDcommands.dylib: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1592         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1593         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDcommands.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDcommands.dylib commands.o
1594
1595 libIRCDdynamic.dylib: dynamic.cpp ../include/base.h ../include/dynamic.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1596         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1597         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDdynamic.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDdynamic.dylib dynamic.o
1598
1599 libIRCDusers.dylib: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1600         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1601         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDusers.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDusers.dylib users.o
1602
1603 libIRCDmodules.dylib: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1604         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1605         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDmodules.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDmodules.dylib modules.o
1606
1607 libIRCDwildcard.dylib: wildcard.cpp ../include/base.h ../include/wildcard.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1608         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1609         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDwildcard.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDwildcard.dylib wildcard.o
1610
1611 libIRCDsocket.dylib: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1612         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1613         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDsocket.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDsocket.dylib socket.o
1614
1615 libIRCDinspsocket.dylib: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1616         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1617         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDinspsocket.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDinspsocket.dylib inspsocket.o
1618
1619 libIRCDtimer.dylib: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1620         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1621         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDtimer.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDtimer.dylib timer.o
1622
1623 EOM
1624
1625 } else {
1626
1627         print FH <<EOM;
1628 all: libIRCDtimer.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so $cmdobjs libIRCDcommands.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so libIRCDsnomasks.so inspircd
1629
1630 inspircd: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h ../include/socket.h libIRCDtimer.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so $cmdobjs libIRCDsnomasks.so libIRCDcommands.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so
1631         \$(CC) -pipe -I../include $extra -Wl,--rpath -Wl,$config{LIBRARY_DIR} \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so libIRCDcommands.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDhash.so libIRCDsocket.so libIRCDsocketengine.so libIRCDuserprocess.so libIRCDcull_list.so libIRCDcommand_parse.so libIRCDtimer.so libIRCDsnomasks.so
1632
1633 libIRCDsocketengine.so: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1634         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1635         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o $se.o
1636
1637 libIRCDsnomasks.so: snomasks.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/channels.h
1638         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1639         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsnomasks.so snomasks.o
1640
1641 libIRCDcommand_parse.so: command_parse.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1642         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1643         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1644
1645 libIRCDcull_list.so: cull_list.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/users.h ../include/channels.h
1646         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1647         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1648
1649 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1650         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1651         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1652
1653 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1654         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1655         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1656
1657 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1658         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1659         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1660
1661 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1662         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1663         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1664
1665 libIRCDmode.so: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES)
1666         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1667         \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1668         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o modes/modeclasses.a
1669
1670 libIRCDxline.so: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1671         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1672         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1673
1674 libIRCDstring.so: inspstring.cpp ../include/base.h ../include/inspstring.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1675         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1676         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1677
1678 libIRCDasyncdns.so: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1679         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1680         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1681
1682 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1683         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1684         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1685
1686 libIRCDconfigreader.so: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1687         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1688         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
1689
1690 libIRCDcommands.so: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1691         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1692         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o
1693
1694 libIRCDdynamic.so: dynamic.cpp ../include/base.h ../include/dynamic.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1695         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1696         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1697
1698 libIRCDusers.so: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1699         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1700         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1701
1702 libIRCDmodules.so: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1703         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1704         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1705
1706 libIRCDwildcard.so: wildcard.cpp ../include/base.h ../include/wildcard.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1707         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1708         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1709
1710 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1711         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1712         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1713
1714 libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1715         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1716         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
1717
1718 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1719         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1720         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1721
1722 EOM
1723 }
1724         foreach my $cmd (@cmdlist) {
1725                 print FH <<ITEM;
1726 cmd_$cmd.so: cmd_$cmd.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/commands/cmd_$cmd.h
1727         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1728         \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
1729
1730 ITEM
1731         }
1732         close(FH);
1733 }
1734