summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-19 12:51:21 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-19 12:51:21 +0000
commit3a6885d6a1d30f6e2eb9b1fcd20e949768267318 (patch)
treefefc6fb26bf91713479e47261775651c927b1441 /configure
parente8c920ce01a47e7b05ca3d445c3d8d88f9c70e37 (diff)
* Seperate out socket engines into derived classes of SocketEngine.
* Add a classfactory SocketEngineFactory to create a new socketengine of the configured type * Implement configure hax to compile only the required socketengine and the base class * Eliminates ugly defines, and is more in line with C++ ways git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4439 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure43
1 files changed, 38 insertions, 5 deletions
diff --git a/configure b/configure
index d13a07852..22855727f 100755
--- a/configure
+++ b/configure
@@ -1022,21 +1022,37 @@ EOF
my $use_hiperf = 0;
if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
print FILEHANDLE "#define USE_KQUEUE\n";
+ $se = "socketengine_kqueue";
$use_hiperf = 1;
}
if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
print FILEHANDLE "#define USE_EPOLL\n";
+ $se = "socketengine_epoll";
$use_hiperf = 1;
}
# user didn't choose either epoll or select for their OS.
# default them to USE_SELECT (ewwy puke puke)
if (!$use_hiperf) {
print FILEHANDLE "#define USE_SELECT\n";
+ $se = "socketengine_select";
}
print FILEHANDLE "\n#endif\n";
close(FILEHANDLE);
}
+open(FILEHANDLE, ">include/inspircd_se_config.h");
+ print FILEHANDLE <<EOF;
+/* Auto generated by configure, do not modify or commit to svn! */
+#ifndef __CONFIGURATION_SOCKETENGINE__
+#define __CONFIGURATION_SOCKETENGINE__
+
+#include "$se.h"
+
+#endif
+EOF
+close(FILEHANDLE);
+
+
# Create a Modules List..
my $modules = "";
foreach $i (@modlist)
@@ -1351,6 +1367,15 @@ CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v
RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
EOM
+
+$se = "socketengine_select";
+if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
+ $se = "socketengine_kqueue";
+}
+elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
+ $se = "socketengine_epoll";
+}
+
###
# This next section is for cygwin dynamic module builds.
# Basically, what we do, is build the inspircd core as a library
@@ -1393,8 +1418,8 @@ command_parse.o: command_parse.cpp ../include/base.h ../include/hashcomp.h ../in
userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
-socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
- \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
+socketengine.o: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
+ \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
@@ -1492,6 +1517,14 @@ if (($config{OSNAME} !~ /Linux/i) && ($config{HAS_EXECINFO} eq "1")) {
$extra = "";
}
+$se = "socketengine_select";
+if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
+ $se = "socketengine_kqueue";
+}
+elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
+ $se = "socketengine_epoll";
+}
+
open(FH,">src/Makefile") or die("Could not write src/Makefile");
print FH <<EOM;
# Insp Makefile :p
@@ -1512,9 +1545,9 @@ all: libIRCDtimer.so libIRCDaes.so libIRCDcull_list.so libIRCDuserprocess.so lib
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 libIRCDaes.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 libIRCDmessage.so $cmdobjs libIRCDsnomasks.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so
\$(CC) -I../include $extra -Wl,--rpath -Wl,/usr/local/lib -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 libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.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 libIRCDaes.so libIRCDtimer.so libIRCDsnomasks.so
-libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
- \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
- \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
+libIRCDsocketengine.so: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
+ \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
+ \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o $se.o
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
\$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp