#
########################################
-
-$this = resolve_directory($ENV{PWD}); # PWD, Regardless.
+chomp($topdir = `pwd`);
+$this = resolve_directory($topdir); # PWD, Regardless.
@modlist = (); # Declare for Module List..
%config = (); # Initiate Configuration Hash..
-$config{ME} = resolve_directory($ENV{PWD}); # Present Working Directory
+$config{ME} = resolve_directory($topdir); # Present Working Directory
$config{CONFIG_DIR} = resolve_directory($config{ME}."/conf"); # Configuration Directory
$config{MODULE_DIR} = resolve_directory($config{ME}."/modules"); # Modules Directory
$config{BINARY_DIR} = resolve_directory($config{ME}."/bin"); # Binary Directory
chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
chomp($config{GCCVER} = `gcc -dumpversion | cut -c 1`); # Major GCC Version
chomp($config{GCC34} = `gcc -dumpversion | cut -c 3`); # Minor GCC Version
-chomp($config{OSNAME} = `uname -s`); # Operating System Name
+chomp($config{OSNAME} = `/bin/uname`); # Operating System Name
+$config{CC} = "g++"; # C++ compiler
-if (!$config{OSNAME}) {
- $config{OSNAME} = "Unknown"; # For use when uname fails.
+if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
+ chomp($config{OSNAME} = `/usr/bin/uname`);
+ if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
+ $config{OSNAME} = "Unknown";
+ }
}
if (!$config{MAX_CLIENT_T}) {
{
# try and find the delcaration of:
# size_t strlcpy(...)
- if (($line =~ /size_t(\0x9|\s)+strlcpy(\0x9|\s)+\(/) || ($line =~ /size_t(\0x9|\s)+strlcpy\(/))
+ if ($line =~ /size_t(\0x9|\s)+strlcpy/)
{
$config{HAS_STRLCPY} = "true";
}
{
# try and find the delcaration of:
# int kqueue(void);
- if (($line =~ /int(\0x9|\s)+kqueue(\0x9|\s)+\(/) || ($line =~ /int(\0x9|\s)+kqueue\(/))
+ if ($line =~ /int(\0x9|\s)+kqueue/)
{
$has_kqueue = 1;
}
print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
-print "\033[0mOptimatizaton Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n\n";
+print "\033[0mOptimatizaton Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
+print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n\n";
makecache();
writefiles();
print "\n\n";
print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
+if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
+ 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";
+}
################################################################################
# HELPER FUNCTIONS #
}
sub getosflags {
- if ($config{OSNAME} eq "FreeBSD") {
+ if ($config{OSNAME} =~ /BSD$/) {
$config{LDLIBS} = "-Ldl";
$config{FLAGS} = "-fPIC -frtti $OPTIMISATI -Woverloaded-virtual $config{OPTIMISATI}";
$config{MAKEPROG} = "gmake";
+ if ($config{OSNAME} eq "OpenBSD") {
+ chomp($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
+ chomp($config{GCC34} = `eg++ -dumpversion | cut -c 3`); # the compiler path
+ }
+ }
} else {
$config{LDLIBS} = "-ldl";
$config{FLAGS} = "-fPIC -frtti $OPTIMISATI -Woverloaded-virtual $config{OPTIMISATI}";
$config{MAKEPROG} = "make";
}
+ if ($config{OSNAME} =~ /SunOS/) {
+ # 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{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
+ }
}
sub is_dir {
#define MAXBUF 514
EOF
+ if ($config{OSNAME} =~ /SunOS/) {
+ print FILEHANDLE "#define IS_SOLARIS\n";
+ }
if ($config{GCCVER} > 3) {
print FILEHANDLE "#define GCC3\n";
print FILEHANDLE "#define GCC34\n";
}
close(FILEHANDLE);
+ $tmp =~ s/\@CC\@/$config{CC}/;
$tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
$tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
$tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;