Răsfoiți Sursa

Merge branch 'maint'

* maint:
  Update bdlib for build cleanups
  Avoid ccache/clang warnings
  No longer need to hide unused arguments to clang now that CPPFLAGS is fixed
  Stop hiding errors when unable to generate symbols
  It's still required to pre-create each file
  Since 3fe27824a906c2, -no-integrated-cpp has not been needed
  Rename C++ files to .cc to quiet clang
  Build with -fstack-protector or -fstack-protector-strong by default
  Cleanup use of CXXFLAGS/CPPFLAGS a bit.
  Export C symbols properly
  Tell which symbols are being generated for
  Optimize the dependency generating slightly
  Cleanup this script more
  Don't depend on GCC

Conflicts:
	lib/bdlib
	src/Makefile.in
	src/generate_defs.sh
Bryan Drewery 11 ani în urmă
părinte
comite
1d5920fbb7
99 a modificat fișierele cu 267 adăugiri și 205 ștergeri
  1. 16 26
      Makefile.in
  2. 1 1
      build.sh
  3. 5 4
      build/autotools/configure.ac
  4. 1 1
      build/autotools/includes/acinclude.m4
  5. 7 8
      build/autotools/includes/depend.m4
  6. 9 9
      build/build.mk
  7. 84 50
      configure
  8. 1 0
      doc/UPDATES
  9. 1 0
      src/.gitignore
  10. 0 0
      src/EncryptedStream.cc
  11. 15 14
      src/Makefile.in
  12. 0 0
      src/adns.cc
  13. 0 0
      src/auth.cc
  14. 0 0
      src/base64.cc
  15. 0 0
      src/bg.cc
  16. 0 0
      src/binary.cc
  17. 0 0
      src/binds.cc
  18. 0 0
      src/botcmd.cc
  19. 0 0
      src/botmsg.cc
  20. 0 0
      src/botnet.cc
  21. 0 0
      src/chanprog.cc
  22. 0 0
      src/cmds.cc
  23. 3 2
      src/compat/Makefile.in
  24. 6 0
      src/compat/compat.h
  25. 7 1
      src/compat/dirname.h
  26. 6 0
      src/compat/dn_expand.h
  27. 6 0
      src/compat/inet_ntop.h
  28. 6 0
      src/compat/memcpy.h
  29. 6 0
      src/compat/memset.h
  30. 0 1
      src/compat/memutil.c
  31. 8 2
      src/compat/memutil.h
  32. 6 0
      src/compat/snprintf.h
  33. 6 0
      src/compat/strcasecmp.h
  34. 6 0
      src/compat/strftime.h
  35. 6 1
      src/compat/strlcpy.h
  36. 6 1
      src/compat/strsep.h
  37. 0 0
      src/conf.cc
  38. 0 0
      src/core_binds.cc
  39. 0 0
      src/crypt.cc
  40. 3 2
      src/crypto/Makefile.in
  41. 0 0
      src/crypto/aes_util.cc
  42. 0 0
      src/crypto/bf_util.cc
  43. 0 0
      src/crypto/dh_util.cc
  44. 0 0
      src/dcc.cc
  45. 0 0
      src/dccutil.cc
  46. 0 0
      src/debug.cc
  47. 0 0
      src/dhparam.cc
  48. 0 0
      src/dl.cc
  49. 0 0
      src/egg_timer.cc
  50. 0 0
      src/enclink.cc
  51. 0 0
      src/flags.cc
  52. 0 0
      src/garble.cc
  53. 27 64
      src/generate_defs.sh
  54. 1 1
      src/libcrypto.cc
  55. 1 1
      src/libssl.cc
  56. 1 1
      src/libtcl.cc
  57. 0 0
      src/log.cc
  58. 0 0
      src/main.cc
  59. 0 0
      src/makehelp.cc
  60. 0 0
      src/makeres.cc
  61. 0 0
      src/makeset.cc
  62. 0 0
      src/makesort.cc
  63. 0 0
      src/match.cc
  64. 0 0
      src/misc.cc
  65. 0 0
      src/misc_file.cc
  66. 6 5
      src/mod/Makefile.in
  67. 0 0
      src/mod/channels.mod/chanmisc.cc
  68. 3 3
      src/mod/channels.mod/channels.cc
  69. 0 0
      src/mod/channels.mod/cmdschan.cc
  70. 0 0
      src/mod/channels.mod/userchan.cc
  71. 0 0
      src/mod/compress.mod/compress.cc
  72. 0 0
      src/mod/console.mod/console.cc
  73. 0 0
      src/mod/ctcp.mod/ctcp.cc
  74. 0 0
      src/mod/irc.mod/chan.cc
  75. 0 0
      src/mod/irc.mod/cmdsirc.cc
  76. 4 4
      src/mod/irc.mod/irc.cc
  77. 0 0
      src/mod/irc.mod/mode.cc
  78. 0 0
      src/mod/irc.mod/msgcmds.cc
  79. 0 0
      src/mod/server.mod/cmdsserv.cc
  80. 2 2
      src/mod/server.mod/server.cc
  81. 0 0
      src/mod/server.mod/servmsg.cc
  82. 0 0
      src/mod/share.mod/share.cc
  83. 0 0
      src/mod/transfer.mod/transfer.cc
  84. 0 0
      src/mod/update.mod/update.cc
  85. 0 0
      src/net.cc
  86. 1 1
      src/openssl.cc
  87. 0 0
      src/response.cc
  88. 0 0
      src/rfc1459.cc
  89. 0 0
      src/set.cc
  90. 0 0
      src/shell.cc
  91. 0 0
      src/socket.cc
  92. 0 0
      src/sorthelp.cc
  93. 0 0
      src/sprintf.cc
  94. 0 0
      src/stringfix.cc
  95. 0 0
      src/thread.cc
  96. 0 0
      src/userent.cc
  97. 0 0
      src/userrec.cc
  98. 0 0
      src/users.cc
  99. 0 0
      src/utc-time.cc

+ 16 - 26
Makefile.in

@@ -30,10 +30,10 @@ SETTINGSFILE = doc/settings.txt
 RESPONSESFILE = doc/responses.txt
 
 # defaults
-CXX = @CCACHE@ @DISTCC@ @CXX@ @STATIC@ -no-integrated-cpp
+CXX = @CCACHE@ @DISTCC@ @CXX@ @STATIC@
 LD_DYNAMIC = @CXX@
 LD_STATIC = @CXX@ @STATIC@
-CCDEBUG = @CCACHE@ @DISTCC@ @CXX@
+CXX_DEBUG = @CCACHE@ @DISTCC@ @CXX@
 LD_DEBUG = @CXX@
 STRIP = @STRIP@
 DIFF = @DIFF@
@@ -43,18 +43,8 @@ LIBS = @LIBS@
 INCLUDES = @TCL_INCLUDES@
 
 DEBCXXFLAGS = -DDEBUG -fno-inline -g3 -ggdb3 -O0 -Wshadow -Wpointer-arith -Wcast-align @GCC3DEB@ @GCC4DEB@ @DEBCXXFLAGS@
-CFLGS = @GCC3@ -fno-rtti @SSL_INCLUDES@
-_CFLGS = -fno-strict-aliasing -W -Wformat \
-#-Wshadow -Wnested-externs -Wno-format-y2k \
-#-Wlarger-than-6608 -Wpointer-arith -Wcast-align \
-#-Waggrepate-return -Wbad-function-cast \
-#-Wlong-long @GCC3@
-
-#-Wmissing-noreturn
-#-Wunused-parameter
-#-Wwrite-strings
-#-Wconversion
-#-Wtraditional
+CFLGS = @GCC3_CFLAGS@ @SSL_INCLUDES@
+CXXFLAGS = @CXXFLAGS@ $(CFLGS) @GCC3_CXXFLAGS@ -fno-rtti
 
 MAKEFLAGS = -s
 
@@ -62,26 +52,26 @@ STRINGFIX = src/stringfix
 
 MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD_STATIC)' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=$(STRIP)' 'CFLGS=$(CFLGS) -DBIN_TYPE_STATIC' 'STRINGFIX=$(STRINGFIX)' \
+'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_STATIC' 'STRINGFIX=$(STRINGFIX)' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
 
 MAKE_DYNAMIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD_DYNAMIC)' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=$(STRIP)' 'CFLGS=$(CFLGS) -DBIN_TYPE_DYNAMIC' 'STRINGFIX=$(STRINGFIX)' \
+'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_DYNAMIC' 'STRINGFIX=$(STRINGFIX)' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
 
-MAKE_DEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CCDEBUG)' 'LD=$(LD_DEBUG) -g' 'INCLUDES=$(INCLUDES)' \
+MAKE_DEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX_DEBUG)' 'LD=$(LD_DEBUG) -g' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=touch' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS) -DBIN_TYPE_DYNAMIC' 'STRINGFIX=' \
+'STRIP=touch' 'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS) -DBIN_TYPE_DYNAMIC' 'STRINGFIX=' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(debug)'
 
-MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CCDEBUG)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
+MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX_DEBUG)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' \
-'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD_DEBUG) -g'
+'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD_DEBUG) -g'
 
 MAKE_UTILS_NR = $(MAKE) 'CXX=$(CXX)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' \
-'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD) -g'
+'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD) -g'
 
 MAKE_CONFIG = $(MAKE) 'MAKE=$(MAKE)'
 
@@ -190,19 +180,19 @@ res: makeres
 	cp -f src/responses.h~ src/responses.h; \
 	fi)
 
-stringfix: src/stringfix.c src/config.h
+stringfix: src/stringfix.cc src/config.h
 	+@cd src && ${MAKE_UTILS} stringfix
 
-makeres: src/makeres.c
+makeres: src/makeres.cc
 	+@cd src && ${MAKE_UTILS} makeres
 
-makeset: src/makeset.c
+makeset: src/makeset.cc
 	+@cd src && ${MAKE_UTILS} makeset
 
-makehelp: src/makehelp.c
+makehelp: src/makehelp.cc
 	+@cd src && ${MAKE_UTILS} makehelp
 
-sorthelp: src/sorthelp.c
+sorthelp: src/sorthelp.cc
 	+@cd src && ${MAKE_UTILS} sorthelp
 
 utils: stringfix makehelp

+ 1 - 1
build.sh

@@ -12,7 +12,7 @@ fi
 
 # Convert timestamp into readable format
 rm -f ts > /dev/null 2>&1
-gcc -o ts src/timestamp.c > /dev/null 2>&1
+cc -o ts src/timestamp.c > /dev/null 2>&1
 builddate=`./ts ${BUILDTS}`
 rm -f ts > /dev/null 2>&1
 

+ 5 - 4
build/autotools/configure.ac

@@ -29,8 +29,10 @@ AC_CACHE_SAVE
 EGG_CHECK_CCWALL
 EGG_CHECK_CCPIPE
 CXX_FLAG_CHECK([CXXFLAGS], [-fcolor-diagnostics], [colordiagnostics])
-CXX_FLAG_CHECK([CXXFLAGS], [-Qunused-arguments], [unusedarguments])
-CXX_FLAG_CHECK([DEBCXXFLAGS], [-fstack-protector-all], [stackprotector])
+#CXX_FLAG_CHECK([CXXFLAGS], [-Qunused-arguments], [unusedarguments])
+CXX_FLAG_CHECK([CXXFLAGS], [-fstack-protector], [stackprotector])
+CXX_FLAG_CHECK([CXXFLAGS], [-fstack-protector-strong], [stackprotectorstrong])
+CXX_FLAG_CHECK([DEBCXXFLAGS], [-fstack-protector-all], [stackprotectorall])
 
 EGG_CHECK_DEPMODE
 
@@ -47,7 +49,7 @@ AC_CHECK_PROG(OBJCOPY, objcopy, [objcopy --remove-section=.note --remove-section
 AC_CHECK_PROG(STRIP, strip, strip, touch)
 AC_CHECK_PROG(DIFF, gdiff, gdiff, diff)
 AC_CHECK_PROG(UNAME, uname, uname)
-AC_CHECK_PROG(CCACHE, ccache, ccache)
+AC_CHECK_PROG(CCACHE, ccache, env CCACHE_CPP2=1 ccache)
 AC_CHECK_PROG(DISTCC, distcc, distcc)
 
 # Test the os and set the module linking settings
@@ -63,7 +65,6 @@ EGG_CHECK_RANDOM_MAX
 
 # Create static binaries
 EGG_CHECK_CCSTATIC
-AC_SUBST(CCDEBUG)dnl
 AC_SUBST(DEBCXXFLAGS)
 
 #checkpoint

+ 1 - 1
build/autotools/includes/acinclude.m4

@@ -651,7 +651,7 @@ dnl  EGG_SUBST_VERSION()
 dnl
 AC_DEFUN([EGG_SUBST_VERSION], 
 [
-VERSION=`grep "char" $srcdir/src/main.c | $AWK '/egg_version/ {print [$]5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
+VERSION=`grep "char" $srcdir/src/main.cc | $AWK '/egg_version/ {print [$]5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
 version_num=`echo $VERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'`
 AC_DEFINE_UNQUOTED(EGG_VERSION, $version_num, [Defines the current pack version])dnl
 AC_SUBST(VERSION)dnl

+ 7 - 8
build/autotools/includes/depend.m4

@@ -11,11 +11,13 @@ num=`$CXX -dumpversion | sed "s/^\\\(.\\\).*/\\\1/"`
 if test $num -ge "3"; then
   CCDEPMODE=gcc3
 #  GCC3="-Wpadded -Wpacked -Wno-unused-parameter -Wmissing-format-attribute -Wdisabled-optimization"
-  GCC3="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -fno-strict-aliasing -Woverloaded-virtual -Wno-format-y2k"
+  GCC3_CFLAGS="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -fno-strict-aliasing -Wno-format-y2k"
+  GCC3_CXXFLAGS="-Woverloaded-virtual"
   GCC3DEB="-Wno-disabled-optimization -Wmissing-format-attribute"
 fi
 AC_SUBST(CCDEPMODE)dnl
-AC_SUBST(GCC3)dnl
+AC_SUBST(GCC3_CFLAGS)dnl
+AC_SUBST(GCC3_CXXFLAGS)dnl
 AC_SUBST(GCC3DEB)dnl
 AC_SUBST(GCC4DEB)dnl
 ])
@@ -25,11 +27,8 @@ AC_DEFUN([DO_DEPS],
 files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
 for mf in $files; do
   # Strip MF so we end up with the name of the file.
-#  echo "MF: $mf"
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  dirpart=`AS_DIRNAME("$mf")`
-#  echo "dirpart: $dirpart mf: $mf"
-#  rm -rf "$dirpart/.deps/"
+  mf=${mf%%:*}
+  dirpart=${mf%/*}
   rm -f "$dirpart/.deps/includes"
   test -d "$dirpart/.deps" || mkdir "$dirpart/.deps"
   for file in `sed -n -e '
@@ -46,7 +45,7 @@ for mf in $files; do
   do
     suffix=${file##*.}
     base=${file%%.*}
-    test -f "$dirpart/$base.c" || continue
+    test -f "$dirpart/$base.cc" || test -f "$dirpart/$base.c" || continue
     if ! test -f "$dirpart/.deps/$base.Po"; then
       echo '# dummy' > "$dirpart/.deps/$base.Po"
       #Remove the .o file, because it needs to be recompiled for its dependancies.

+ 9 - 9
build/build.mk

@@ -17,16 +17,16 @@ depcomp = /bin/sh $(top_srcdir)/build/autotools/depcomp
 	  fi; \
 	else \
 	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.ii; \
+	  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.ii; \
 	fi; \
-	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $*.ii -o $@; \
+	$(CXX) $(CXXFLAGS) -c $*.ii -o $@; \
 	rm -f $*.ii
 
 .c.So:
 	@echo -e "{C }	\033[1m$*\033[0m"
 	set -e; trap "rm -f '.deps/$*.TPo' $*.i $*.fail; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if { { $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -E $< || :> $*.fail; } | \
+	  if { { $(CC) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CPPFLAGS) $(CFLAGS) -E $< || :> $*.fail; } | \
 	    $(top_srcdir)/src/stringfix > $*.i; } && ! [ -f $*.fail ]; then \
 	    echo '$@: $(top_srcdir)/src/stringfix' >> '.deps/$*.TPo'; \
 	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
@@ -36,16 +36,16 @@ depcomp = /bin/sh $(top_srcdir)/build/autotools/depcomp
 	  fi; \
 	else \
 	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.i; \
+	  $(CC) $(CPPFLAGS) $(CFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.i; \
 	fi; \
-	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $*.i -o $@; \
+	$(CC) $(CFLAGS) -c $*.i -o $@; \
 	rm -f $*.i
 
 .cc.o:
 	@echo -e "[CC]	\033[1m$*\033[0m"
 	set -e; trap "rm -f '.deps/$*.TPo'; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; then \
+	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@; then \
 	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
 	   else \
 	     rm -f '.deps/$*.TPo'; \
@@ -53,14 +53,14 @@ depcomp = /bin/sh $(top_srcdir)/build/autotools/depcomp
 	  fi; \
 	else \
 	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; \
+	  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@; \
 	fi
 
 .c.o:
 	@echo -e "[C]	\033[1m$*\033[0m"
 	set -e; trap "rm -f '.deps/$*.TPo'; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; then \
+	  if $(CC) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CPPFLAGS) $(CFLAGS) -c $< -o $@; then \
 	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
 	   else \
 	     rm -f '.deps/$*.TPo'; \
@@ -68,5 +68,5 @@ depcomp = /bin/sh $(top_srcdir)/build/autotools/depcomp
 	  fi; \
 	else \
 	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@; \
+	  $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@; \
 	fi

+ 84 - 50
configure

@@ -646,7 +646,6 @@ LIBELF_BUNDLED
 EGREP
 GREP
 DEBCXXFLAGS
-CCDEBUG
 STATIC
 BUILDARCH
 BUILDOS
@@ -663,7 +662,8 @@ SED
 SET_MAKE
 GCC4DEB
 GCC3DEB
-GCC3
+GCC3_CXXFLAGS
+GCC3_CFLAGS
 CCDEPMODE
 HAVE_CXX11
 CXXCPP
@@ -3530,10 +3530,11 @@ EOF
     exit 1
   fi
 
+#CXX_FLAG_CHECK([CXXFLAGS], [-Qunused-arguments], [unusedarguments])
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -Qunused-arguments" >&5
-$as_echo_n "checking whether the compiler understands -Qunused-arguments... " >&6; }
-if ${egg_cv_prog_cc_unusedarguments+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -fstack-protector" >&5
+$as_echo_n "checking whether the compiler understands -fstack-protector... " >&6; }
+if ${egg_cv_prog_cc_stackprotector+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -3544,7 +3545,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
     ac_saved_flags="$CXXFLAGS"
-    CXXFLAGS="-Werror -Qunused-arguments"
+    CXXFLAGS="-Werror -fstack-protector"
     cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end build/confdefs.h.  */
 
@@ -3557,9 +3558,9 @@ main ()
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  egg_cv_prog_cc_unusedarguments="yes"
+  egg_cv_prog_cc_stackprotector="yes"
 else
-  egg_cv_prog_cc_unusedarguments="no"
+  egg_cv_prog_cc_stackprotector="no"
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     CXXFLAGS="$ac_saved_flags"
@@ -3571,16 +3572,73 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $egg_cv_prog_cc_unusedarguments" >&5
-$as_echo "$egg_cv_prog_cc_unusedarguments" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $egg_cv_prog_cc_stackprotector" >&5
+$as_echo "$egg_cv_prog_cc_stackprotector" >&6; }
 
-  if [ "$egg_cv_prog_cc_unusedarguments" = "yes" ]; then
-    CXXFLAGS="$CXXFLAGS -Qunused-arguments"
+  if [ "$egg_cv_prog_cc_stackprotector" = "yes" ]; then
+    CXXFLAGS="$CXXFLAGS -fstack-protector"
   elif [ -n "" ]; then
       cat << 'EOF' >&2
 configure: error:
 
-  Your OS or C++ compiler does not support -Qunused-arguments.
+  Your OS or C++ compiler does not support -fstack-protector.
+  This compile flag is required.
+
+EOF
+    exit 1
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -fstack-protector-strong" >&5
+$as_echo_n "checking whether the compiler understands -fstack-protector-strong... " >&6; }
+if ${egg_cv_prog_cc_stackprotectorstrong+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+    ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+    ac_saved_flags="$CXXFLAGS"
+    CXXFLAGS="-Werror -fstack-protector-strong"
+    cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end build/confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  egg_cv_prog_cc_stackprotectorstrong="yes"
+else
+  egg_cv_prog_cc_stackprotectorstrong="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    CXXFLAGS="$ac_saved_flags"
+    ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $egg_cv_prog_cc_stackprotectorstrong" >&5
+$as_echo "$egg_cv_prog_cc_stackprotectorstrong" >&6; }
+
+  if [ "$egg_cv_prog_cc_stackprotectorstrong" = "yes" ]; then
+    CXXFLAGS="$CXXFLAGS -fstack-protector-strong"
+  elif [ -n "" ]; then
+      cat << 'EOF' >&2
+configure: error:
+
+  Your OS or C++ compiler does not support -fstack-protector-strong.
   This compile flag is required.
 
 EOF
@@ -3590,7 +3648,7 @@ EOF
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -fstack-protector-all" >&5
 $as_echo_n "checking whether the compiler understands -fstack-protector-all... " >&6; }
-if ${egg_cv_prog_cc_stackprotector+:} false; then :
+if ${egg_cv_prog_cc_stackprotectorall+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -3614,9 +3672,9 @@ main ()
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  egg_cv_prog_cc_stackprotector="yes"
+  egg_cv_prog_cc_stackprotectorall="yes"
 else
-  egg_cv_prog_cc_stackprotector="no"
+  egg_cv_prog_cc_stackprotectorall="no"
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     CXXFLAGS="$ac_saved_flags"
@@ -3628,10 +3686,10 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $egg_cv_prog_cc_stackprotector" >&5
-$as_echo "$egg_cv_prog_cc_stackprotector" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $egg_cv_prog_cc_stackprotectorall" >&5
+$as_echo "$egg_cv_prog_cc_stackprotectorall" >&6; }
 
-  if [ "$egg_cv_prog_cc_stackprotector" = "yes" ]; then
+  if [ "$egg_cv_prog_cc_stackprotectorall" = "yes" ]; then
     DEBCXXFLAGS="$DEBCXXFLAGS -fstack-protector-all"
   elif [ -n "" ]; then
       cat << 'EOF' >&2
@@ -3651,7 +3709,8 @@ num=`$CXX -dumpversion | sed "s/^\\\(.\\\).*/\\\1/"`
 if test $num -ge "3"; then
   CCDEPMODE=gcc3
 #  GCC3="-Wpadded -Wpacked -Wno-unused-parameter -Wmissing-format-attribute -Wdisabled-optimization"
-  GCC3="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -fno-strict-aliasing -Woverloaded-virtual -Wno-format-y2k"
+  GCC3_CFLAGS="-W -Wno-unused-parameter -Wdisabled-optimization -Wno-write-strings -Wno-format-security -fno-strict-aliasing -Wno-format-y2k"
+  GCC3_CXXFLAGS="-Woverloaded-virtual"
   GCC3DEB="-Wno-disabled-optimization -Wmissing-format-attribute"
 fi
 
@@ -4166,7 +4225,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CCACHE="ccache"
+    ac_cv_prog_CCACHE="env CCACHE_CPP2=1 ccache"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -8869,7 +8928,7 @@ fi
 rm -f confcache
 
 
-VERSION=`grep "char" $srcdir/src/main.c | $AWK '/egg_version/ {print $5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
+VERSION=`grep "char" $srcdir/src/main.cc | $AWK '/egg_version/ {print $5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
 version_num=`echo $VERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", $1, $2, $3)}'`
 
 cat >>build/confdefs.h <<_ACEOF
@@ -8891,33 +8950,8 @@ esac
 files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
 for mf in $files; do
   # Strip MF so we end up with the name of the file.
-#  echo "MF: $mf"
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$mf" : 'X\(//\)[^/]' \| \
-	 X"$mf" : 'X\(//\)$' \| \
-	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$mf" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-#  echo "dirpart: $dirpart mf: $mf"
-#  rm -rf "$dirpart/.deps/"
+  mf=${mf%%:*}
+  dirpart=${mf%/*}
   rm -f "$dirpart/.deps/includes"
   test -d "$dirpart/.deps" || mkdir "$dirpart/.deps"
   for file in `sed -n -e '
@@ -8934,7 +8968,7 @@ $as_echo X"$mf" |
   do
     suffix=${file##*.}
     base=${file%%.*}
-    test -f "$dirpart/$base.c" || continue
+    test -f "$dirpart/$base.cc" || test -f "$dirpart/$base.c" || continue
     if ! test -f "$dirpart/.deps/$base.Po"; then
       echo '# dummy' > "$dirpart/.deps/$base.Po"
       #Remove the .o file, because it needs to be recompiled for its dependancies.

+ 1 - 0
doc/UPDATES

@@ -19,6 +19,7 @@ maint
     in doc/responses.txt
   * Remove channel limit when limitraise is disabled (#77)
   * 'fork-interval' removed.
+  * Build with -fstack-protector by default
 
 1.4.3
   * Default 'set promisc' to ignore since it's usually a false positive

+ 1 - 0
src/.gitignore

@@ -1,6 +1,7 @@
 /Makefile
 /buildinfo.h
 /_*.c
+/_*.cc
 /*~
 /help.h
 /response.h

+ 0 - 0
src/EncryptedStream.c → src/EncryptedStream.cc


+ 15 - 14
src/Makefile.in

@@ -7,8 +7,9 @@ VPATH = @srcdir@
 
 @SET_MAKE@
 
-CXXFLAGS = @CXXFLAGS@ -I. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/pack @DEFS@ $(INCLUDES) $(CFLGS) '-DCOMMIT="$(COMMIT)"' '-DBRANCH="$(BRANCH)"' -DBUILDTS=$(BUILDTS) '-DVERSION="$(VERSION)"'
-CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = $(CXXFLAGS)
+CFLAGS = $(CFLGS)
+CPPFLAGS = @CPPFLAGS@ -I. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/pack @DEFS@ $(INCLUDES) '-DCOMMIT="$(COMMIT)"' '-DBRANCH="$(BRANCH)"' -DBUILDTS=$(BUILDTS) '-DVERSION="$(VERSION)"'
 
 include $(top_srcdir)/build/build.mk
 
@@ -67,36 +68,36 @@ MODOBJS = mod/channels.mod/channels.So \
         mod/update.mod/update.So
 
 
-MAKE_GENERIC = $(MAKE) 'MAKE=$(MAKE)' 'MAKEFLAGS=$(MAKEFLAGS)' 'CXX=$(CXX)' 'LD=$(LD)' 'STRIP=$(STRIP)' 'CFLGS=$(CFLGS)' 'CCDEPMODE=$(CCDEPMODE)'
+MAKE_GENERIC = $(MAKE) 'MAKE=$(MAKE)' 'MAKEFLAGS=$(MAKEFLAGS)' 'CXX=$(CXX)' 'LD=$(LD)' 'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS)' 'CCDEPMODE=$(CCDEPMODE)'
 
 blah:
 	@echo ""
 	@echo "Use the build script."
 	@echo ""
 
-makeres: makeres.c ../lib/bdlib/libbdlib.a
+makeres: makeres.cc ../lib/bdlib/libbdlib.a
 	@echo -e "Compiling: \033[1mmakeres\033[0m"
-	@$(CXX) $(CXXFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CPPFLAGS) $< ../lib/bdlib/libbdlib.a -o $@
+	@$(CXX) $(CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a -o $@
 	@$(STRIP) $@@EXEEXT@
 
-makeset: makeset.c ../lib/bdlib/libbdlib.a
+makeset: makeset.cc ../lib/bdlib/libbdlib.a
 	@echo -e "Compiling: \033[1mmakeset\033[0m"
-	@$(CXX) $(CXXFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CPPFLAGS) $< ../lib/bdlib/libbdlib.a -o $@
+	@$(CXX) $(CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a -o $@
 	@$(STRIP) $@@EXEEXT@
 
-makehelp: makehelp.c ../lib/bdlib/libbdlib.a
+makehelp: makehelp.cc ../lib/bdlib/libbdlib.a
 	@echo -e "Compiling: \033[1mmakehelp\033[0m"
-	@$(CXX) $(CXXFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CPPFLAGS) $< ../lib/bdlib/libbdlib.a -o $@
+	@$(CXX) $(CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a -o $@
 	@$(STRIP) $@@EXEEXT@
 
-sorthelp: sorthelp.c ../lib/bdlib/libbdlib.a
+sorthelp: sorthelp.cc ../lib/bdlib/libbdlib.a
 	@echo -e "Compiling: \033[1msorthelp\033[0m"
-	@$(CXX) $(CXXFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CPPFLAGS) $< ../lib/bdlib/libbdlib.a -o $@
+	@$(CXX) $(CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a -o $@
 	@$(STRIP) $@@EXEEXT@
 
-stringfix: stringfix.c common.h config.h eggdrop.h
+stringfix: stringfix.cc common.h config.h eggdrop.h
 	@echo -e "Compiling: \033[1mstringfix\033[0m"
-	@$(CXX) $(CXXFLAGS) -I$(top_srcdir) -I$(top_srcdir)/pack $(CPPFLAGS) $< -o stringfix
+	@$(CXX) $(CPPFLAGS) -I$(top_srcdir) -I$(top_srcdir)/pack $(CXXFLAGS) $< -o stringfix
 	@$(STRIP) $@@EXEEXT@
 
 #../$(EGGEXEC): build_msg $(OBJS) mycrypto compatability
@@ -115,7 +116,7 @@ stringfix: stringfix.c common.h config.h eggdrop.h
 $(EGGEXEC): stringfix ../$(EGGEXEC)
 
 clean:
-	@rm -f .depend *.o *.So *~ _*.c
+	@rm -f .depend *.o *.So *~ _*.c _*.cc
 
 build_msg:
 	@echo "[*] Compiling core components"

+ 0 - 0
src/adns.c → src/adns.cc


+ 0 - 0
src/auth.c → src/auth.cc


+ 0 - 0
src/base64.c → src/base64.cc


+ 0 - 0
src/bg.c → src/bg.cc


+ 0 - 0
src/binary.c → src/binary.cc


+ 0 - 0
src/binds.c → src/binds.cc


+ 0 - 0
src/botcmd.c → src/botcmd.cc


+ 0 - 0
src/botmsg.c → src/botmsg.cc


+ 0 - 0
src/botnet.c → src/botnet.cc


+ 0 - 0
src/chanprog.c → src/chanprog.cc


+ 0 - 0
src/cmds.c → src/cmds.cc


+ 3 - 2
src/compat/Makefile.in

@@ -10,8 +10,9 @@ include $(top_srcdir)/build/build.mk
 @SET_MAKE@
 
 STRIP = @STRIP@
-CXXFLAGS = @CXXFLAGS@ -I../.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/src @DEFS@ $(CFLGS)
-CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = $(CXXFLAGS)
+CFLAGS = $(CFLGS)
+CPPFLAGS = @CPPFLAGS@ -I../.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/src @DEFS@
 
 OBJS = dirname.o \
 	dn_expand.o \

+ 6 - 0
src/compat/compat.h

@@ -24,9 +24,15 @@
 #include "strsep.h"
 #include "timespec.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 #ifndef HAVE_MEMMEM
 void *memmem(const void *l, size_t l_len, const void *s, size_t s_len);
 #endif
+#ifdef __cplusplus
+}
+#endif
 
 /* These apparently are unsafe without recasting. */
 #define egg_isdigit(x)  isdigit((int)  (unsigned char) (x))

+ 7 - 1
src/compat/dirname.h

@@ -7,6 +7,12 @@
 
 #define dirname my_dirname
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 char *dirname(const char *);
-#endif /* !_DIRNAME_H */
+#ifdef __cplusplus
+}
+#endif
 
+#endif /* !_DIRNAME_H */

+ 6 - 0
src/compat/dn_expand.h

@@ -5,7 +5,13 @@
 #  include "config.h"
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 int my_dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* !_DN_EXPAND_H */
 

+ 6 - 0
src/compat/inet_ntop.h

@@ -16,8 +16,14 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 #ifndef HAVE_INET_NTOP
 const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
 #endif
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* !_EGG_COMPAT_INET_NTOP_H */

+ 6 - 0
src/compat/memcpy.h

@@ -13,9 +13,15 @@
 
 #include <string.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 #ifndef HAVE_MEMCPY
 /* Use our own implementation. */
 void *memcpy(void *dest, const void *src, size_t n);
 #endif
+#ifdef __cplusplus
+}
+#endif
 
 #endif	/* !__EGG_COMPAT_MEMCPY_H */

+ 6 - 0
src/compat/memset.h

@@ -13,10 +13,16 @@
 
 #include <string.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 #ifndef HAVE_MEMSET
 /* Use our own implementation. */
 void *memset(void *dest, int c, size_t n);
 #endif
+#ifdef __cplusplus
+}
+#endif
 
 /* Use memset instead of bzero.
  */

+ 0 - 1
src/compat/memutil.c

@@ -1,7 +1,6 @@
 #include <string.h>
 #include "memcpy.h"
 #include "memutil.h"
-#include "src/main.h"
 #include <stdlib.h>
 
 

+ 8 - 2
src/compat/memutil.h

@@ -17,12 +17,18 @@
 //#define calloc my_calloc
 //#define realloc my_realloc
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void str_redup(char **, const char *);
 char *strdup(const char *);
 char *strldup(const char *, size_t);
-
-
 void *my_calloc(size_t, size_t);
 void *my_realloc(void *, size_t);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* !_MEMUTIL_H */

+ 6 - 0
src/compat/snprintf.h

@@ -23,6 +23,9 @@
 #  endif
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 /* Use the system libraries version of vsnprintf() if available. Otherwise
  * use our own.
  */
@@ -45,4 +48,7 @@ int egg_snprintf();
 #  define egg_snprintf	snprintf
 #endif
 
+#ifdef __cplusplus
+}
+#endif
 #endif	/* !_EGG_COMPAT_SNPRINTF_H_ */

+ 6 - 0
src/compat/strcasecmp.h

@@ -14,6 +14,9 @@
 #include <ctype.h>
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 #ifndef HAVE_STRCASECMP
 /* Use our own implementation. */
 int strcasecmp(const char *, const char *);
@@ -24,4 +27,7 @@ int strcasecmp(const char *, const char *);
 int strncasecmp(const char *, const char *, size_t);
 #endif
 
+#ifdef __cplusplus
+}
+#endif
 #endif	/* !__EGG_COMPAT_STRCASECMP_H */

+ 6 - 0
src/compat/strftime.h

@@ -13,6 +13,9 @@
 
 #include <time.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 /* Use the system libraries version of strftime() if available. Otherwise
  * use our own.
  */
@@ -20,4 +23,7 @@
 size_t strftime(char *s, size_t maxsize, const char *format, const struct tm *tp);
 #endif
 
+#ifdef __cplusplus
+}
+#endif
 #endif	/* !_EGG_COMPAT_STRFTIME_H_ */

+ 6 - 1
src/compat/strlcpy.h

@@ -13,8 +13,13 @@
 #define strlcpy my_strlcpy
 #define strlcat my_strlcat
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 size_t strlcpy(char *, const char *, size_t);
 size_t strlcat(char *, const char *, size_t);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* !_STRLCPY_H */
-

+ 6 - 1
src/compat/strsep.h

@@ -9,7 +9,12 @@
 
 #define strsep my_strsep
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 char *strsep(char **, const char *);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* !_STRSEP_H */
-

+ 0 - 0
src/conf.c → src/conf.cc


+ 0 - 0
src/core_binds.c → src/core_binds.cc


+ 0 - 0
src/crypt.c → src/crypt.cc


+ 3 - 2
src/crypto/Makefile.in

@@ -3,8 +3,9 @@ top_srcdir = @top_srcdir@
 srcdir = @srcdir@
 
 SHELL = @SHELL@
-CXXFLAGS = @CXXFLAGS@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @DEFS@ $(CFLGS)
-CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = $(CXXFLAGS)
+CFLAGS = $(CFLGS)
+CPPFLAGS = @CPPFLAGS@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @DEFS@
 STRIP = @STRIP@
 VPATH = @srcdir@
 

+ 0 - 0
src/crypto/aes_util.c → src/crypto/aes_util.cc


+ 0 - 0
src/crypto/bf_util.c → src/crypto/bf_util.cc


+ 0 - 0
src/crypto/dh_util.c → src/crypto/dh_util.cc


+ 0 - 0
src/dcc.c → src/dcc.cc


+ 0 - 0
src/dccutil.c → src/dccutil.cc


+ 0 - 0
src/debug.c → src/debug.cc


+ 0 - 0
src/dhparam.c → src/dhparam.cc


+ 0 - 0
src/dl.c → src/dl.cc


+ 0 - 0
src/egg_timer.c → src/egg_timer.cc


+ 0 - 0
src/enclink.c → src/enclink.cc


+ 0 - 0
src/flags.c → src/flags.cc


+ 0 - 0
src/garble.c → src/garble.cc


+ 27 - 64
src/generate_defs.sh

@@ -1,59 +1,6 @@
 #! /bin/sh
 
-strip_trailing_slashes() {
-  _STRIP=$1
-  while :
-  do
-    case $_STRIP in
-      ## If the last character is a slash, remove it
-      */) _STRIP=${_STRIP%/} ;;
-      *) break ;;
-    esac
-  done
-}
-
-_basename() {
-  fn_path=$1
-  fn_suffix=$2
-  case $fn_path in
-    "") _BASENAME=; return ;;
-     *)
-        strip_trailing_slashes "$fn_path"
-        case $_STRIP in
-          "") fn_path="/" ;;
-           *) fn_path=${_STRIP##*/} ;;
-        esac
-        ;;
-  esac
-
-
-  case $fn_path in
-    $fn_suffix | "/" ) _BASENAME="$fn_path" ;;
-                    *) _BASENAME=${fn_path%$fn_suffix} ;;
-  esac
-}
-
-basename() {
-  _basename "$@" && echo $_BASENAME
-}
-
-_dirname() {
-  _DIRNAME=$1
-  strip_trailing_slashes "$_DIRNAME"
-  case $_STRIP in
-    "") _DIRNAME='/'; return ;;
-   */*) _DIRNAME="${_STRIP%/*}" ;;
-     *) _DIRNAME='.'; return ;;
-  esac
-  strip_trailing_slashes "$_DIRNAME"
-  _DIRNAME=${_STRIP:-/}
-}
-
-dirname() {
-  _dirname "$@" && echo $_DIRNAME
-}
-
-### Export LC_ALL=C sort(1) stays consistent
+### Export LC_ALL=C so sort(1) stays consistent
 export LC_ALL=C
 
 if [ -z "$SED" -o -z "$CXX" ]; then
@@ -65,19 +12,33 @@ INCLUDES="${TCL_INCLUDES} ${SSL_INCLUDES}"
 
 mkdir -p src/.defs > /dev/null 2>&1
 TMPFILE=$(mktemp "/tmp/pre.XXXXXX")
-for file in $(grep -l DLSYM_GLOBAL src/*.c|grep -v "src/_"); do
-  defsFile_wrappers="src/.defs/$(basename $file .c)_defs.c"
-  defsFile_pre="src/.defs/$(basename $file .c)_pre.h"
-  defsFile_post="src/.defs/$(basename $file .c)_post.h"
+files=$(grep -l DLSYM_GLOBAL src/*.cc|grep -v "src/_")
+for file in ${files}; do
+  suffix=${file##*.}
+  basename=${file%%.*}
+  basename=${basename##*/}
+
+  defsFile_wrappers="src/.defs/${basename}_defs.${suffix}"
+  defsFile_pre="src/.defs/${basename}_pre.h"
+  defsFile_post="src/.defs/${basename}_post.h"
 
   rm -f $defsFile_pre $defsFile_post $defsFile_wrappers > /dev/null 2>&1
-  touch $defsFile_pre $defsFile_post $defsFile_wrappers
+  : > $defsFile_pre
+  : > $defsFile_post
+  : > $defsFile_wrappers
 done
 
-for file in $(grep -l DLSYM_GLOBAL src/*.c|grep -v "src/_"); do
-  defsFile_wrappers="src/.defs/$(basename $file .c)_defs.c"
-  defsFile_pre="src/.defs/$(basename $file .c)_pre.h"
-  defsFile_post="src/.defs/$(basename $file .c)_post.h"
+for file in ${files}; do
+  suffix=${file##*.}
+  basename=${file%%.*}
+  basename=${basename##*/}
+  dirname=${file%%/*}
+
+  echo -n "Generating symbols for ${basename}... "
+
+  defsFile_wrappers="src/.defs/${basename}_defs.${suffix}"
+  defsFile_pre="src/.defs/${basename}_pre.h"
+  defsFile_post="src/.defs/${basename}_post.h"
 
   echo "extern \"C\" {" > $defsFile_wrappers
   echo "extern \"C\" {" > $defsFile_post
@@ -91,7 +52,7 @@ for file in $(grep -l DLSYM_GLOBAL src/*.c|grep -v "src/_"); do
 
   for symbol in $($SED -n -e 's/.*DLSYM_GLOBAL(.*, \([^)]*\).*/\1/p' $file|sort -u); do
     # Check if the typedef is already defined ...
-    typedef=$(grep "^typedef .*(\*${symbol}_t)" $(dirname $file)/$(basename $file .c).h)
+    typedef=$(grep "^typedef .*(\*${symbol}_t)" ${dirname}/${basename}.h)
     # ... if not, generate it
     if [ -z "$typedef" ]; then
       # Trim off any extern "C", trim out the variable names, cleanup whitespace issues
@@ -113,5 +74,7 @@ for file in $(grep -l DLSYM_GLOBAL src/*.c|grep -v "src/_"); do
 
   echo "}" >> $defsFile_wrappers
   echo "}" >> $defsFile_post
+
+  echo "done"
 done
 rm -f $TMPFILE

+ 1 - 1
src/libcrypto.c → src/libcrypto.cc

@@ -32,7 +32,7 @@
 #include <bdlib/src/Array.h>
 
 #include "libcrypto.h"
-#include ".defs/libcrypto_defs.c"
+#include ".defs/libcrypto_defs.cc"
 
 void *libcrypto_handle = NULL;
 static bd::Array<bd::String> my_symbols;

+ 1 - 1
src/libssl.c → src/libssl.cc

@@ -32,7 +32,7 @@
 #include <bdlib/src/Array.h>
 
 #include "libssl.h"
-#include ".defs/libssl_defs.c"
+#include ".defs/libssl_defs.cc"
 
 void *libssl_handle = NULL;
 static bd::Array<bd::String> my_symbols;

+ 1 - 1
src/libtcl.c → src/libtcl.cc

@@ -32,7 +32,7 @@
 #include <bdlib/src/Array.h>
 
 #include "libtcl.h"
-#include ".defs/libtcl_defs.c"
+#include ".defs/libtcl_defs.cc"
 
 #ifdef USE_SCRIPT_TCL
 Tcl_Interp *global_interp = NULL;

+ 0 - 0
src/log.c → src/log.cc


+ 0 - 0
src/main.c → src/main.cc


+ 0 - 0
src/makehelp.c → src/makehelp.cc


+ 0 - 0
src/makeres.c → src/makeres.cc


+ 0 - 0
src/makeset.c → src/makeset.cc


+ 0 - 0
src/makesort.c → src/makesort.cc


+ 0 - 0
src/match.c → src/match.cc


+ 0 - 0
src/misc.c → src/misc.cc


+ 0 - 0
src/misc_file.c → src/misc_file.cc


+ 6 - 5
src/mod/Makefile.in

@@ -9,11 +9,12 @@ MOD_UPDIR = @MOD_UPDIR@
 @SET_MAKE@
 
 STRIP = @STRIP@
-CXXFLAGS = @CXXFLAGS@ -I../.. -I$(top_srcdir) @DEFS@ $(CFLGS)
-CPPFLAGS = @CPPFLAGS@
-MOD_CXXFLAGS = @CXXFLAGS@ -I. -I$(MOD_UPDIR)$(top_srcdir)/src -I$(MOD_UPDIR)$(top_srcdir) \
-  -I$(MOD_UPDIR)$(top_srcdir)/src/mod -I$(MOD_UPDIR)$(top_srcdir)/lib @DEFS@ $(CFLGS)
-MOD_CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = $(CXXFLAGS)
+CFLAGS = $(CFLGS)
+CPPFLAGS = @CPPFLAGS@ -I../.. -I$(top_srcdir)
+MOD_CXXFLAGS = $(CXXFLAGS)
+MOD_CPPFLAGS = @CPPFLAGS@ -I. -I$(MOD_UPDIR)$(top_srcdir)/src -I$(MOD_UPDIR)$(top_srcdir) \
+  -I$(MOD_UPDIR)$(top_srcdir)/src/mod -I$(MOD_UPDIR)$(top_srcdir)/lib @DEFS@
 LIBS = @LIBS@
 
 mods = channels.mod \

+ 0 - 0
src/mod/channels.mod/chanmisc.c → src/mod/channels.mod/chanmisc.cc


+ 3 - 3
src/mod/channels.mod/channels.c → src/mod/channels.mod/channels.cc

@@ -64,9 +64,9 @@ static char *lastdeletedmask = NULL;
 static int 			killed_bots = 0;
 
 #include "channels.h"
-#include "cmdschan.c"
-#include "chanmisc.c"
-#include "userchan.c"
+#include "cmdschan.cc"
+#include "chanmisc.cc"
+#include "userchan.cc"
 
 /* This will close channels if the HUB:leaf count is skewed from config setting */
 static void 

+ 0 - 0
src/mod/channels.mod/cmdschan.c → src/mod/channels.mod/cmdschan.cc


+ 0 - 0
src/mod/channels.mod/userchan.c → src/mod/channels.mod/userchan.cc


+ 0 - 0
src/mod/compress.mod/compress.c → src/mod/compress.mod/compress.cc


+ 0 - 0
src/mod/console.mod/console.c → src/mod/console.mod/console.cc


+ 0 - 0
src/mod/ctcp.mod/ctcp.c → src/mod/ctcp.mod/ctcp.cc


+ 0 - 0
src/mod/irc.mod/chan.c → src/mod/irc.mod/chan.cc


+ 0 - 0
src/mod/irc.mod/cmdsirc.c → src/mod/irc.mod/cmdsirc.cc


+ 4 - 4
src/mod/irc.mod/irc.c → src/mod/irc.mod/irc.cc

@@ -109,10 +109,10 @@ voice_ok(memberlist *m, struct chanset_t *chan)
   return 1;
 }
 
-#include "chan.c"
-#include "mode.c"
-#include "cmdsirc.c"
-#include "msgcmds.c"
+#include "chan.cc"
+#include "mode.cc"
+#include "cmdsirc.cc"
+#include "msgcmds.cc"
 
 static int
 detect_offense(memberlist* m, struct chanset_t *chan, char *msg)

+ 0 - 0
src/mod/irc.mod/mode.c → src/mod/irc.mod/mode.cc


+ 0 - 0
src/mod/irc.mod/msgcmds.c → src/mod/irc.mod/msgcmds.cc


+ 0 - 0
src/mod/server.mod/cmdsserv.c → src/mod/server.mod/cmdsserv.cc


+ 2 - 2
src/mod/server.mod/server.c → src/mod/server.mod/server.cc

@@ -132,7 +132,7 @@ bind_table_t *BT_ctcr = NULL, *BT_ctcp = NULL;
 #define SERVER_CONNECT_BURST_TIME 18
 #define SERVER_CONNECT_BURST_RATE 5 * 7
 
-#include "servmsg.c"
+#include "servmsg.cc"
 
 #define MAXPENALTY 10
 
@@ -164,7 +164,7 @@ static const struct {
 #define Q_PLAY 3
 #define Q_CACHE 4
 
-#include "cmdsserv.c"
+#include "cmdsserv.cc"
 
 
 /*

+ 0 - 0
src/mod/server.mod/servmsg.c → src/mod/server.mod/servmsg.cc


+ 0 - 0
src/mod/share.mod/share.c → src/mod/share.mod/share.cc


+ 0 - 0
src/mod/transfer.mod/transfer.c → src/mod/transfer.mod/transfer.cc


+ 0 - 0
src/mod/update.mod/update.c → src/mod/update.mod/update.cc


+ 0 - 0
src/net.c → src/net.cc


+ 1 - 1
src/openssl.c → src/openssl.cc

@@ -43,7 +43,7 @@ int     ssl_use = 0; /* kyotou */
 
 static int seed_PRNG(void);
 
-#include "dhparam.c"
+#include "dhparam.cc"
 
 static DH* tmp_dh_callback(SSL* ssl, int is_export, int keylength) {
   DH *ret = NULL;

+ 0 - 0
src/response.c → src/response.cc


+ 0 - 0
src/rfc1459.c → src/rfc1459.cc


+ 0 - 0
src/set.c → src/set.cc


+ 0 - 0
src/shell.c → src/shell.cc


+ 0 - 0
src/socket.c → src/socket.cc


+ 0 - 0
src/sorthelp.c → src/sorthelp.cc


+ 0 - 0
src/sprintf.c → src/sprintf.cc


+ 0 - 0
src/stringfix.c → src/stringfix.cc


+ 0 - 0
src/thread.c → src/thread.cc


+ 0 - 0
src/userent.c → src/userent.cc


+ 0 - 0
src/userrec.c → src/userrec.cc


+ 0 - 0
src/users.c → src/users.cc


+ 0 - 0
src/utc-time.c → src/utc-time.cc