-print "*** \e[1;32mRemember to edit your configuration files!!!\e[0m ***\n\n\n";
-if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
- print "\e[1;32mWARNING!\e[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";
-}
-
-if ($config{GCCVER} < "3") {
- print <<FOO2;
-\e[1;32mWARNING!\e[0m You are attempting to compile InspIRCd on GCC 2.x!
-GCC 2.x series compilers only had partial (read as broken) C++ support, and
-your compile will most likely fail horribly! If you have any problems, do NOT
-report them to the bugtracker or forums without first upgrading your compiler
-to a newer 3.x or 4.x (or whatever is available currently) version.
-FOO2
-}
-
-################################################################################
-# HELPER FUNCTIONS #
-################################################################################
-sub getcache {
- # Retrieves the .config.cache file, and loads values into the main config hash.
- open(CACHE, ".config.cache") or return 0;
- while (<CACHE>) {
- chomp;
- # Ignore Blank lines, and comments..
- next if /^\s*$/;
- next if /^\s*#/;
- my ($key, $value) = split("=", $_, 2);
- $value =~ /^\"(.*)\"$/;
- # Do something with data here!
- $config{$key} = $1;
- }
- close(CACHE);
- return 1;
-}
-
-sub makecache {
- # Dump the contents of %config
- print "Writing \e[1;32mcache file\e[0m for future ./configures ...\n";
- open(FILEHANDLE, ">.config.cache");
- foreach my $key (keys %config) {
- print FILEHANDLE "$key=\"$config{$key}\"\n";
- }
- close(FILEHANDLE);
-}
-
-sub dir_check {
- my ($desc, $hash_key) = @_;
- my $complete = 0;
- while (!$complete) {
- print "In what directory $desc?\n";
- print "[\e[1;32m$config{$hash_key}\e[0m] -> ";
- chomp(my $var = <STDIN>);
- if ($var eq "") {
- $var = $config{$hash_key};
- }
- if ($var =~ /^\~\/(.+)$/) {
- # Convert it to a full path..
- $var = resolve_directory($ENV{HOME} . "/" . $1);
- }
- elsif ((($config{OSNAME} =~ /MINGW32/i) and ($var !~ /^[A-Z]{1}:\\.*/)) and (substr($var,0,1) ne "/"))
- {
- # Assume relative Path was given.. fill in the rest.
- $var = $this . "/$var";
- }
-
- $var = resolve_directory($var);
- if (! -e $var) {
- print "$var does not exist. Create it?\n[\e[1;32my\e[0m] ";
- chomp(my $tmp = <STDIN>);
- if (($tmp eq "") || ($tmp =~ /^y/i)) {
- # Attempt to Create the Dir..
- my $chk = eval {
- use File::Path ();
- File::Path::mkpath($var, 0, 0777);
- 1;
- };
- unless (defined($chk) && -d $var) {
- print "Unable to create directory. ($var)\n\n";
- # Restart Loop..
- next;
- }
- } else {
- # They said they don't want to create, and we can't install there.
- print "\n\n";
- next;
- }
- } else {
- if (!is_dir($var)) {
- # Target exists, but is not a directory.
- print "File $var exists, but is not a directory.\n\n";
- next;
- }
- }
- # Either Dir Exists, or was created fine.
- $config{$hash_key} = $var;
- $complete = 1;
- print "\n";
- }
-}
-
-our $SHARED = "";
-
-sub getosflags {
-
- # Beware: Linux sets it's own cflags below for some retarded reason
- $config{LDLIBS} = "-pthread -lstdc++";
- $config{FLAGS} = "-pipe -fPIC -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall $config{OPTIMISATI}";
- $config{DEVELOPER} = "-pipe -fPIC -Woverloaded-virtual -Wshadow -Wall -Wformat=2 -Wmissing-format-attribute -g";
- $SHARED = "-shared -export-dynamic";
- $config{MAKEPROG} = "make";
-
- if ($config{OSNAME} =~ /darwin/i) {
- $config{FLAGS} = "-pipe -DDARWIN -frtti -fPIC -Wall $config{OPTIMISATI}";
- $SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup";
- $config{LDLIBS} = "-ldl -pthread -lstdc++";
- }
-
- if ($config{OSNAME} =~ /OpenBSD/i) {
- $config{MAKEPROG} = "gmake";
-# apparantly (Dagonet says) that this causes problems, so let's try without it.
-# $config{LDLIBS} = $config{LDLIBS} . " -lunwind";
- chomp(my $foo = `eg++ -dumpversion | cut -c 1`);
- # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
- # if theyre not running this, configure lets the build continue but they probably wont manage to
- # compile as this standard version is 2.95.3!
- if ($foo ne "") {
- $config{CC} = "eg++";
- chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
- chomp($config{GCCMINOR} = `eg++ -dumpversion | cut -c 3`);
- }
- return "OpenBSD";
- }
-
- if ($config{OSNAME} =~ /Linux/i) {
- $config{LDLIBS} = "-ldl -lstdc++ -pthread";
-# $config{FLAGS} = "-fPIC -Woverloaded-virtual -Wshadow -Wall $config{OPTIMISATI}";
- $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
- $config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS});
- $config{LDLIBS} .= " " . $ENV{LDFLAGS} if exists($ENV{LDFLAGS});
- $config{MAKEPROG} = "make";
- }
-
- if ($config{OSNAME} =~ /FreeBSD/i) {
- $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
- $config{LDLIBS} .= " " . $ENV{LDLIBS} if exists($ENV{LDLIBS});
- $config{LDLIBS} .= " " . $ENV{LDFLAGS} if exists($ENV{LDFLAGS});
- }
-
- if ($config{OSNAME} =~ /SunOS/i or $config{OSNAME} =~ /solaris/i)
- {
- # solaris/sunos needs these
- # socket = bsd sockets api
- # nsl = dns stuff
- # rt = POSIX realtime extensions
- # resolv = inet_aton only (why isnt this in nsl?!)
- $config{MAKEPROG} = "gmake";
- $config{LDLIBS} .= " -lsocket -lnsl -lrt -lresolv -pthread";
- return "Solaris";
- }
-
- if($config{OSNAME} =~ /MINGW32/i)
- {
- # All code is position-independent on windows
- $config{FLAGS} =~ s/-fPIC //;
- return "MinGW";
- }
-
- return $config{OSNAME};
-}
-
-my ($mliflags, $mfrules, $mobjs, $mfcount) = ("", "", "", 0);