diff options
-rw-r--r-- | .Makefile.inc | 55 | ||||
-rwxr-xr-x | configure | 105 | ||||
-rw-r--r-- | make/bsd-real.mk | 9 | ||||
-rw-r--r-- | make/gnu-real.mk | 10 |
4 files changed, 55 insertions, 124 deletions
diff --git a/.Makefile.inc b/.Makefile.inc index 03fdc5f03..00cb9c2ec 100644 --- a/.Makefile.inc +++ b/.Makefile.inc @@ -11,21 +11,14 @@ @BSD_ONLY MAKESTYLE = bsd @BSD_ONLY COMPILE_ROOT != pwd -@IFDEF D - NICEFLAGS = @DEVELOPER@ - HEADER = debug-header -@ENDIF - -NICEFLAGS ?= @FLAGS@ -HEADER ?= std-header - -NICEFLAGS += -I$(COMPILE_ROOT)/include - CC = @CC@ -FLAGS = $(NICEFLAGS) -pedantic -PICLDFLAGS = -fPIC -DPIC -shared -export-dynamic -CORE_FLAGS = @CORE_FLAGS@ -LDLIBS = @LDLIBS@ +SYSTEM = @SYSTEM@ +SOCKETENGINE = @SOCKETENGINE@ +NICEFLAGS = -pipe -fPIC +LDLIBS = -pthread -lstdc++ +SHARED = -shared -rdynamic +CORE_FLAGS = -rdynamic -L. +PICLDFLAGS = -fPIC -DPIC -shared -rdynamic BASE = "@BASE_DIR@" CONPATH = "@CONFIG_DIR@" MODPATH = "@MODULE_DIR@" @@ -33,7 +26,39 @@ BINPATH = "@BINARY_DIR@" LAUNCHDPATH = "/System/Library/LaunchDaemons" LIBPATH = "@LIBRARY_DIR@" INSTMODE = 0755 -SOCKETENGINE = @SOCKETENGINE@ + +@IFEQ $(CC) icc + NICEFLAGS += -Wshadow + FLAGS = $(NICEFLAGS) +@ELSE + NICEFLAGS += -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall + FLAGS = $(NICEFLAGS) -pedantic +@ENDIF + + +@IFEQ $(SYSTEM) linux + LDLIBS += -ldl +@ELSIFEQ $(SYSTEM) solaris + LDLIBS += -lsocket -lnsl -lrt -lresolv +@ELSIFEQ $(SYSTEM) sunos + LDLIBS += -lsocket -lnsl -lrt -lresolv +@ELSIFEQ $(SYSTEM) darwin + NICEFLAGS += -DDARWIN -frtti + LDLIBS += -ldl + SHARED = -bundle -twolevel_namespace -undefined dynamic_lookup + CORE_FLAGS = -dynamic -bind_at_load -L. +@ENDIF + +@IFDEF D + NICEFLAGS += -g3 + HEADER = debug-header +@ELSE + NICEFLAGS += -g1 + HEADER = std-header +@ENDIF + +NICEFLAGS += -I$(COMPILE_ROOT)/include + @GNU_ONLY MAKEFLAGS += --no-print-directory @IFDEF V @@ -313,12 +313,10 @@ sub update } else { # We've Loaded the cache file and all our variables.. print "Updating files...\n"; - getosflags(); if (defined($opt_disable_debug) && $opt_disable_debug == 1) { print "Disabling debug information (-g).\n"; $config{OPTIMISATI} = ""; - getosflags(); } $has_epoll = $config{HAS_EPOLL}; $has_ports = $config{HAS_PORTS}; @@ -427,8 +425,8 @@ sub test_compile { print "Running non-interactive configure...\n" unless $interactive; print "Checking for cache from previous configure... "; print ((!getcache()) ? "not found\n" : "found\n"); -print "Checking operating system version... "; -print getosflags() . "\n"; +$config{SYSTEM} = lc $^O; +print "Checking operating system version... $config{SYSTEM}\n"; printf "Checking if stdint.h exists... "; $config{HAS_STDINT} = "true"; @@ -538,27 +536,16 @@ if ($config{OSNAME} =~ /FreeBSD/i) my $version = `uname -r`; if ($version =~ /^4\./) { - my $foundit = `ls -l /usr/local/lib/libgnugetopt* | wc -l`; - if ($foundit > 0) - { - # ICKY ICKY ICK, FREEBSD 4.x! GET AN UPGRADE! - $config{CRAQ} = "-L/usr/local/lib -lgnugetopt -DHAVE_DECL_GETOPT=1"; - print "yes (upgrade ffs, freebsd 4 is *way* out of date)\n"; - } - else - { - print "\n\nERROR: You require libgnugetopt (from ports or packages) to build InspIRCd on FreeBSD 4.11.\n"; - } + print "yes\n"; + exit 1; } else { - $config{CRAQ} = " "; print "no ($version)\n"; } } else { - $config{CRAQ} = " "; print "no ($config{OSNAME})\n"; } @@ -830,7 +817,6 @@ if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) { print "Skipping SSL Certificate generation, SSL support is not available.\n\n"; } -getosflags(); writefiles(1); makecache(); @@ -944,74 +930,6 @@ sub dir_check { 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); sub writefiles { @@ -1188,7 +1106,7 @@ EOF print "Writing \e[1;32m$file\e[0m ...\n"; for my $var (qw( - CC FLAGS DEVELOPER LDLIBS BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR LIBRARY_DIR + CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR LIBRARY_DIR STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE CORE_FLAGS )) { s/\@$var\@/$config{$var}/g; @@ -1200,6 +1118,8 @@ EOF my $mk_tmp = $_; s/\@IFDEF (\S+)/ifdef $1/g; s/\@IFNDEF (\S+)/ifndef $1/g; + s/\@IFEQ (\S+) (\S+)/ifeq ($1,$2)/g; + s/\@ELSIFEQ (\S+) (\S+)/else ifeq ($1,$2)/g; s/\@ELSE/else/g; s/\@ENDIF/endif/g; s/ *\@BSD_ONLY .*\n//g; @@ -1211,6 +1131,8 @@ EOF $_ = $mk_tmp; s/\@IFDEF (\S+)/.if defined($1)/g; s/\@IFNDEF (\S+)/.if !defined($1)/g; + s/\@IFEQ (\S+) (\S+)/.if $1 == $2/g; + s/\@ELSIFEQ (\S+) (\S+)/.elif $1 == $2/g; s/\@ELSE/.else/g; s/\@ENDIF/.endif/g; s/\@BSD_ONLY //g; @@ -1249,15 +1171,6 @@ sub prepare_dynamic_makefile { $config{USE_PORTS} = 0; } - - if ($config{IS_DARWIN} eq "YES") - { - $config{CORE_FLAGS} = '-dynamic -bind_at_load -L.'; - } - else - { - $config{CORE_FLAGS} = (defined $config{CRAQ} ? $config{CRAQ}. ' ' : "").'-rdynamic -L.' - } } # Routine to list out the extra/ modules that have been enabled. diff --git a/make/bsd-real.mk b/make/bsd-real.mk index 8ae9bfe99..12211e7cb 100644 --- a/make/bsd-real.mk +++ b/make/bsd-real.mk @@ -1,11 +1,9 @@ -CORE_TARGS != perl -e 'print join " ", grep s/\.cpp/.o/, <*.cpp>' -MODE_TARGS != perl -e 'print join " ", grep s/\.cpp/.o/, <modes/*.cpp>' +CORE_TARGS != perl -e 'print join " ", grep s/\.cpp/.o/, <*.cpp>, <modes/*.cpp>' CMD_TARGS != perl -e 'print join " ", grep s/\.cpp/.so/, <commands/*.cpp>' MOD_TARGS != perl -e 'print join " ", grep s/\.cpp/.so/, <modules/*.cpp>' SPANNINGTREE_TARGS != perl -e 'print join " ", grep s/\.cpp/.o/, <modules/m_spanningtree/*.cpp>' -CORE_TARGS += modeclasses.a threadengines/threadengine_pthread.o -CORE_TARGS += socketengines/$(SOCKETENGINE).o +CORE_TARGS += socketengines/$(SOCKETENGINE).o threadengines/threadengine_pthread.o MOD_TARGS += modules/m_spanningtree.so DFILES != perl -e 'print join " ", grep s!([^/]+)\.cpp!.$$1.d!, <*.cpp>, <commands/*.cpp>, <modes/*.cpp>, <modules/*.cpp>, <modules/m_spanningtree/*.cpp>' @@ -17,9 +15,6 @@ commands: $(CMD_TARGS) modules: $(MOD_TARGS) -modeclasses.a: $(MODE_TARGS) - @../make/run-cc.pl ar crs modeclasses.a $(MODE_TARGS) - modules/m_spanningtree.so: $(SPANNINGTREE_TARGS) $(RUNCC) $(FLAGS) -shared -export-dynamic -o $@ $(SPANNINGTREE_TARGS) diff --git a/make/gnu-real.mk b/make/gnu-real.mk index 489e1bbdf..f6d86eb00 100644 --- a/make/gnu-real.mk +++ b/make/gnu-real.mk @@ -4,8 +4,9 @@ CMD_TARGS = $(patsubst %.cpp,%.so,$(wildcard commands/*.cpp)) MOD_TARGS = $(patsubst %.cpp,%.so,$(wildcard modules/*.cpp)) SPANNINGTREE_TARGS = $(patsubst %.cpp,%.o,$(wildcard modules/m_spanningtree/*.cpp)) -CORE_TARGS += modeclasses.a threadengines/threadengine_pthread.o +CORE_TARGS += threadengines/threadengine_pthread.o CORE_TARGS += socketengines/$(SOCKETENGINE).o +CORE_TARGS += $(MODE_TARGS) MOD_TARGS += modules/m_spanningtree.so DFILES = $(shell perl -e 'print join " ", grep s!([^/]+)\.cpp!.$$1.d!, <*.cpp>, <commands/*.cpp>, <modes/*.cpp>, <modules/*.cpp>, <modules/m_spanningtree/*.cpp>') @@ -17,14 +18,11 @@ commands: $(CMD_TARGS) modules: $(MOD_TARGS) -modeclasses.a: $(MODE_TARGS) - @../make/run-cc.pl ar crs modeclasses.a $(MODE_TARGS) - modules/m_spanningtree.so: $(SPANNINGTREE_TARGS) - $(RUNCC) $(FLAGS) -shared -export-dynamic -o $@ $(SPANNINGTREE_TARGS) + $(RUNCC) $(FLAGS) $(PICLDFLAGS) -o $@ $(SPANNINGTREE_TARGS) inspircd: $(CORE_TARGS) - $(RUNCC) $(FLAGS) $(CORE_FLAGS) -o inspircd $(LDLIBS) $(CORE_TARGS) + $(RUNCC) $(FLAGS) $(CORE_FLAGS) -o $@ $(LDLIBS) $(CORE_TARGS) .%.d: %.cpp @../make/calcdep.pl $< |