diff -ruN -d amule-2.2.0~svn20080218/CVSDATE amule-2.2.2/CVSDATE --- amule-2.2.0~svn20080218/CVSDATE 2008-02-18 06:02:15.000000000 +0000 +++ amule-2.2.2/CVSDATE 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -Mon Feb 18 07:02:15 CET 2008 diff -ruN -d amule-2.2.0~svn20080218/Compilation.flags.in amule-2.2.2/Compilation.flags.in --- amule-2.2.0~svn20080218/Compilation.flags.in 2007-11-29 23:14:37.000000000 +0000 +++ amule-2.2.2/Compilation.flags.in 2008-07-13 03:36:09.000000000 +0000 @@ -1,61 +1,98 @@ +# @configure_input@ + +@SET_MAKE@ + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ ACLOCAL = @ACLOCAL@ +ALCC_FALSE = @ALCC_FALSE@ +ALCC_MANPAGES = @ALCC_MANPAGES@ +ALCC_TRUE = @ALCC_TRUE@ +ALC_FALSE = @ALC_FALSE@ +ALC_MANPAGES = @ALC_MANPAGES@ +ALC_TRUE = @ALC_TRUE@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AMULECMD_MANPAGES = @AMULECMD_MANPAGES@ +AMULEWEB_DEFS = @AMULEWEB_DEFS@ +AMULE_DAEMON_FALSE = @AMULE_DAEMON_FALSE@ +AMULE_DAEMON_MANPAGES = @AMULE_DAEMON_MANPAGES@ +AMULE_DAEMON_TRUE = @AMULE_DAEMON_TRUE@ +AMULE_GUI_FALSE = @AMULE_GUI_FALSE@ +AMULE_GUI_MANPAGES = @AMULE_GUI_MANPAGES@ +AMULE_GUI_TRUE = @AMULE_GUI_TRUE@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BFD_CPPFLAGS = @BFD_CPPFLAGS@ +BFD_LIBS = @BFD_LIBS@ +BUILD_CC = @BUILD_CC@ +BUILD_CFLAGS = @BUILD_CFLAGS@ +BUILD_CPPFLAGS = @BUILD_CPPFLAGS@ +BUILD_EXEEXT = @BUILD_EXEEXT@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +BUILD_LDFLAGS = @BUILD_LDFLAGS@ +CAS_DEFS = @CAS_DEFS@ +CAS_FALSE = @CAS_FALSE@ +CAS_MANPAGES = @CAS_MANPAGES@ +CAS_TRUE = @CAS_TRUE@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -D__GSOCKET_STANDALONE__ +CFLAGS = @CFLAGS@ +COMPILE_CMD_FALSE = @COMPILE_CMD_FALSE@ +COMPILE_CMD_TRUE = @COMPILE_CMD_TRUE@ +COMPILE_NLS_FALSE = @COMPILE_NLS_FALSE@ +COMPILE_NLS_TRUE = @COMPILE_NLS_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CRYPTOPP_CPPFLAGS = @CRYPTOPP_CPPFLAGS@ +CRYPTOPP_LDFLAGS = @CRYPTOPP_LDFLAGS@ +CRYPTOPP_LIBS = @CRYPTOPP_LIBS@ CXX = @CXX@ +CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DISABLE_PROGRESS = @DISABLE_PROGRESS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +ED2K_FALSE = @ED2K_FALSE@ +ED2K_MANPAGES = @ED2K_MANPAGES@ +ED2K_TRUE = @ED2K_TRUE@ EGREP = @EGREP@ +ENABLE_IP2COUNTRY_FALSE = @ENABLE_IP2COUNTRY_FALSE@ +ENABLE_IP2COUNTRY_TRUE = @ENABLE_IP2COUNTRY_TRUE@ +ENABLE_UPNP_FALSE = @ENABLE_UPNP_FALSE@ +ENABLE_UPNP_TRUE = @ENABLE_UPNP_TRUE@ EXEEXT = @EXEEXT@ +GDLIB_CFLAGS = @GDLIB_CFLAGS@ +GDLIB_CONFIG_PATH = @GDLIB_CONFIG_PATH@ +GDLIB_LDFLAGS = @GDLIB_LDFLAGS@ +GDLIB_LIBS = @GDLIB_LIBS@ GENCAT = @GENCAT@ +GENERATE_FLEX_HEADER_FALSE = @GENERATE_FLEX_HEADER_FALSE@ +GENERATE_FLEX_HEADER_TRUE = @GENERATE_FLEX_HEADER_TRUE@ +GEOIP_CPPFLAGS = @GEOIP_CPPFLAGS@ +GEOIP_LDFLAGS = @GEOIP_LDFLAGS@ +GEOIP_LIBS = @GEOIP_LIBS@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ -GTK_USEDVERSION = @GTK_USEDVERSION@ +INCINTL = @INCINTL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -65,18 +102,45 @@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LD = @LD@ LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ +LIBPNG_CFLAGS = @LIBPNG_CFLAGS@ +LIBPNG_CONFIG_PATH = @LIBPNG_CONFIG_PATH@ +LIBPNG_LDFLAGS = @LIBPNG_LDFLAGS@ +LIBPNG_LIBS = @LIBPNG_LIBS@ LIBS = @LIBS@ +LIBUPNP_CFLAGS = @LIBUPNP_CFLAGS@ +LIBUPNP_CPPFLAGS = @LIBUPNP_CPPFLAGS@ +LIBUPNP_LDFLAGS = @LIBUPNP_LDFLAGS@ +LIBUPNP_LIBS = @LIBUPNP_LIBS@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ +MONOLITHIC_FALSE = @MONOLITHIC_FALSE@ +MONOLITHIC_MANPAGES = @MONOLITHIC_MANPAGES@ +MONOLITHIC_TRUE = @MONOLITHIC_TRUE@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ +MULECFLAGS = @MULECFLAGS@ +MULECPPFLAGS = @MULECPPFLAGS@ +MULECXXFLAGS = @MULECXXFLAGS@ +MULELDFLAGS = @MULELDFLAGS@ +MULERCFLAGS = @MULERCFLAGS@ +NEED_CORESERVICES_FALSE = @NEED_CORESERVICES_FALSE@ +NEED_CORESERVICES_TRUE = @NEED_CORESERVICES_TRUE@ +NEED_RC_FALSE = @NEED_RC_FALSE@ +NEED_RC_TRUE = @NEED_RC_TRUE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -87,43 +151,81 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ +POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ +RC = @RC@ +RCFLAGS = @RCFLAGS@ +READLINE_LIBS = @READLINE_LIBS@ +REGEX_LIBS = @REGEX_LIBS@ +RESOLV_LIB = @RESOLV_LIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SVNDATE = @SVNDATE@ +SYS_WIN32_FALSE = @SYS_WIN32_FALSE@ +SYS_WIN32_TRUE = @SYS_WIN32_TRUE@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WEB_FALSE = @WEB_FALSE@ +WEB_MANPAGES = @WEB_MANPAGES@ +WEB_TRUE = @WEB_TRUE@ +WXBASE_CPPFLAGS = @WXBASE_CPPFLAGS@ +WXBASE_LIBS = @WXBASE_LIBS@ +WXCAS_FALSE = @WXCAS_FALSE@ +WXCAS_MANPAGES = @WXCAS_MANPAGES@ +WXCAS_TRUE = @WXCAS_TRUE@ WX_CFLAGS = @WX_CFLAGS@ WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ WX_CONFIG_PATH = @WX_CONFIG_PATH@ WX_CPPFLAGS = @WX_CPPFLAGS@ WX_CXXFLAGS = @WX_CXXFLAGS@ WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@ +WX_DEBUG = @WX_DEBUG@ WX_LIBS = @WX_LIBS@ WX_LIBS_STATIC = @WX_LIBS_STATIC@ -WX_VERSION = @WX_VERSION@ +WX_PORT = @WX_PORT@ +WX_RESCOMP = @WX_RESCOMP@ +WX_SHARED = @WX_SHARED@ +WX_UNICODE = @WX_UNICODE@ +WX_VERSION_FULL = @WX_VERSION_FULL@ +WX_VERSION_MAJOR = @WX_VERSION_MAJOR@ +WX_VERSION_MINOR = @WX_VERSION_MINOR@ +X11LIBS = @X11LIBS@ +XAS_FALSE = @XAS_FALSE@ +XAS_TRUE = @XAS_TRUE@ XGETTEXT = @XGETTEXT@ -ZLIB_CFLAGS = @ZLIB_CFLAGS@ +YACC = @YACC@ +ZLIB_CPPFLAGS = @ZLIB_CPPFLAGS@ +ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ ZLIB_LIBS = @ZLIB_LIBS@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_BUILD_CC = @ac_ct_BUILD_CC@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ +ac_ct_LD = @ac_ct_LD@ ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_RC = @ac_ct_RC@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ +am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -datarootdir = @datarootdir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ @@ -137,6 +239,7 @@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -144,24 +247,3 @@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -SUBDIRS = intl m4 src po - -EXTRA_DIST = config.rpath mkinstalldirs AUTHORS COPYING INSTALL README \ - TODO amule.desktop amule.xpm \ - config.h.in m4/gtk.m4 m4/gtk-2.0.m4 m4/wxwin.m4 - - -icon_DATA = amule.xpm -icondir = $(datadir)/pixmaps - -util_DATA = amule.desktop -utildir = $(datadir)/applications - -ACLOCAL_AMFLAGS = -I m4 -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = intl/Makefile -DIST_SOURCES = -DATA = $(icon_DATA) $(util_DATA) diff -ruN -d amule-2.2.0~svn20080218/Makefile.am amule-2.2.2/Makefile.am --- amule-2.2.0~svn20080218/Makefile.am 2008-02-18 00:06:55.000000000 +0000 +++ amule-2.2.2/Makefile.am 2008-08-08 13:28:47.000000000 +0000 @@ -1,10 +1,15 @@ -SUBDIRS = m4 docs src unittests +SUBDIRS = if COMPILE_NLS SUBDIRS += intl po endif -EXTRA_DIST = amule.rc amule.ico amule.png convert.ico +SUBDIRS += docs src unittests + +EXTRA_DIST = amule.rc amule.ico amule.png convert.ico \ + aMule.spec \ + amule_build_install.sh autogen.sh \ + po/l10n.xsl dist_icon_DATA = icondir = $(datadir)/pixmaps @@ -24,7 +29,15 @@ ACLOCAL_AMFLAGS = -I m4 -DISTCHECK_CONFIGURE_FLAGS = --enable-amulecmd --enable-webserver +DISTCHECK_CONFIGURE_FLAGS = \ + --enable-amulecmd \ + --enable-webserver \ + --enable-amule-daemon \ + --enable-amule-gui \ + --enable-cas \ + --enable-wxcas \ + --enable-alc \ + --enable-alcc # Avoid everything getting built when doing "make check" check-recursive: SUBDIRS = unittests @@ -41,3 +54,6 @@ install-sh \ missing \ mkinstalldirs + +EXTRA__DIST__SUBDIRS = aMule.app debian +include $(top_srcdir)/automake/dist-hook.am diff -ruN -d amule-2.2.0~svn20080218/Makefile.in amule-2.2.2/Makefile.in --- amule-2.2.0~svn20080218/Makefile.in 2008-02-18 06:02:15.000000000 +0000 +++ amule-2.2.2/Makefile.in 2008-08-08 13:29:18.000000000 +0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -45,19 +45,23 @@ $(am__dist_util_DATA_DIST) $(srcdir)/Compilation.flags.in \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(srcdir)/version.rc.in \ - $(top_srcdir)/configure $(top_srcdir)/intl/Makefile.in \ - ABOUT-NLS compile config.guess config.rpath config.sub depcomp \ - install-sh missing mkinstalldirs + $(top_srcdir)/automake/dist-hook.am $(top_srcdir)/configure \ + $(top_srcdir)/intl/Makefile.in ABOUT-NLS compile config.guess \ + config.rpath config.sub depcomp install-sh missing \ + mkinstalldirs subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/build-tools.m4 \ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cryptopp.m4 \ + $(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gdlib.m4 \ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \ $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libpng.m4 \ + $(top_srcdir)/m4/libupnp.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/m4/wxwin.m4 $(top_srcdir)/m4/zlib.m4 \ @@ -91,7 +95,7 @@ DATA = $(dist_icon_DATA) $(dist_util_DATA) ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = m4 docs src unittests intl po +DIST_SUBDIRS = intl po docs src unittests DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -105,25 +109,30 @@ distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALCC_FALSE = @ALCC_FALSE@ +ALCC_MANPAGES = @ALCC_MANPAGES@ ALCC_TRUE = @ALCC_TRUE@ ALC_FALSE = @ALC_FALSE@ +ALC_MANPAGES = @ALC_MANPAGES@ ALC_TRUE = @ALC_TRUE@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AMULECMD_MANPAGES = @AMULECMD_MANPAGES@ AMULEWEB_DEFS = @AMULEWEB_DEFS@ AMULE_DAEMON_FALSE = @AMULE_DAEMON_FALSE@ +AMULE_DAEMON_MANPAGES = @AMULE_DAEMON_MANPAGES@ AMULE_DAEMON_TRUE = @AMULE_DAEMON_TRUE@ AMULE_GUI_FALSE = @AMULE_GUI_FALSE@ +AMULE_GUI_MANPAGES = @AMULE_GUI_MANPAGES@ AMULE_GUI_TRUE = @AMULE_GUI_TRUE@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ -BFD_FLAGS = @BFD_FLAGS@ -BFD_LIB = @BFD_LIB@ +BFD_CPPFLAGS = @BFD_CPPFLAGS@ +BFD_LIBS = @BFD_LIBS@ BUILD_CC = @BUILD_CC@ BUILD_CFLAGS = @BUILD_CFLAGS@ BUILD_CPPFLAGS = @BUILD_CPPFLAGS@ @@ -132,10 +141,10 @@ BUILD_LDFLAGS = @BUILD_LDFLAGS@ CAS_DEFS = @CAS_DEFS@ CAS_FALSE = @CAS_FALSE@ +CAS_MANPAGES = @CAS_MANPAGES@ CAS_TRUE = @CAS_TRUE@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ -CCACHE = @CCACHE@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILE_CMD_FALSE = @COMPILE_CMD_FALSE@ @@ -144,15 +153,9 @@ COMPILE_NLS_TRUE = @COMPILE_NLS_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CRYPTOLIBS = @CRYPTOLIBS@ -CRYPTO_PP_CXXFLAGS = @CRYPTO_PP_CXXFLAGS@ -CRYPTO_PP_INCLUDE_PREFIX = @CRYPTO_PP_INCLUDE_PREFIX@ -CRYPTO_PP_LDFLAGS = @CRYPTO_PP_LDFLAGS@ -CRYPTO_PP_LIB_NAME = @CRYPTO_PP_LIB_NAME@ -CRYPTO_PP_PREFIX = @CRYPTO_PP_PREFIX@ -CRYPTO_PP_STYLE = @CRYPTO_PP_STYLE@ -CRYPTO_PP_VERSION_NUMBER = @CRYPTO_PP_VERSION_NUMBER@ -CRYPTO_PP_VERSION_STRING = @CRYPTO_PP_VERSION_STRING@ +CRYPTOPP_CPPFLAGS = @CRYPTOPP_CPPFLAGS@ +CRYPTOPP_LDFLAGS = @CRYPTOPP_LDFLAGS@ +CRYPTOPP_LIBS = @CRYPTOPP_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -165,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ED2K_FALSE = @ED2K_FALSE@ +ED2K_MANPAGES = @ED2K_MANPAGES@ ED2K_TRUE = @ED2K_TRUE@ EGREP = @EGREP@ ENABLE_IP2COUNTRY_FALSE = @ENABLE_IP2COUNTRY_FALSE@ @@ -173,24 +177,18 @@ ENABLE_UPNP_TRUE = @ENABLE_UPNP_TRUE@ EXEEXT = @EXEEXT@ GDLIB_CFLAGS = @GDLIB_CFLAGS@ -GDLIB_CFLAGS_ONLY = @GDLIB_CFLAGS_ONLY@ GDLIB_CONFIG_PATH = @GDLIB_CONFIG_PATH@ -GDLIB_CPPFLAGS = @GDLIB_CPPFLAGS@ -GDLIB_CXXFLAGS = @GDLIB_CXXFLAGS@ -GDLIB_CXXFLAGS_ONLY = @GDLIB_CXXFLAGS_ONLY@ GDLIB_LDFLAGS = @GDLIB_LDFLAGS@ GDLIB_LIBS = @GDLIB_LIBS@ -GDLIB_LIBS_STATIC = @GDLIB_LIBS_STATIC@ -GDLIB_VERSION = @GDLIB_VERSION@ GENCAT = @GENCAT@ GENERATE_FLEX_HEADER_FALSE = @GENERATE_FLEX_HEADER_FALSE@ GENERATE_FLEX_HEADER_TRUE = @GENERATE_FLEX_HEADER_TRUE@ -GEOIP_INCLUDE = @GEOIP_INCLUDE@ -GEOIP_LIB = @GEOIP_LIB@ +GEOIP_CPPFLAGS = @GEOIP_CPPFLAGS@ +GEOIP_LDFLAGS = @GEOIP_LDFLAGS@ +GEOIP_LIBS = @GEOIP_LIBS@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ -HAVE_FLEX_EXTENDED = @HAVE_FLEX_EXTENDED@ -HAVE_GETTEXT = @HAVE_GETTEXT@ +INCINTL = @INCINTL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -210,10 +208,13 @@ LIBOBJS = @LIBOBJS@ LIBPNG_CFLAGS = @LIBPNG_CFLAGS@ LIBPNG_CONFIG_PATH = @LIBPNG_CONFIG_PATH@ -LIBPNG_CXXFLAGS = @LIBPNG_CXXFLAGS@ LIBPNG_LDFLAGS = @LIBPNG_LDFLAGS@ LIBPNG_LIBS = @LIBPNG_LIBS@ LIBS = @LIBS@ +LIBUPNP_CFLAGS = @LIBUPNP_CFLAGS@ +LIBUPNP_CPPFLAGS = @LIBUPNP_CPPFLAGS@ +LIBUPNP_LDFLAGS = @LIBUPNP_LDFLAGS@ +LIBUPNP_LIBS = @LIBUPNP_LIBS@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ @@ -223,9 +224,15 @@ MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONOLITHIC_FALSE = @MONOLITHIC_FALSE@ +MONOLITHIC_MANPAGES = @MONOLITHIC_MANPAGES@ MONOLITHIC_TRUE = @MONOLITHIC_TRUE@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ +MULECFLAGS = @MULECFLAGS@ +MULECPPFLAGS = @MULECPPFLAGS@ +MULECXXFLAGS = @MULECXXFLAGS@ +MULELDFLAGS = @MULELDFLAGS@ +MULERCFLAGS = @MULERCFLAGS@ NEED_CORESERVICES_FALSE = @NEED_CORESERVICES_FALSE@ NEED_CORESERVICES_TRUE = @NEED_CORESERVICES_TRUE@ NEED_RC_FALSE = @NEED_RC_FALSE@ @@ -238,12 +245,14 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ POSUB = @POSUB@ POW_LIB = @POW_LIB@ RANLIB = @RANLIB@ RC = @RC@ RCFLAGS = @RCFLAGS@ READLINE_LIBS = @READLINE_LIBS@ +REGEX_LIBS = @REGEX_LIBS@ RESOLV_LIB = @RESOLV_LIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ @@ -255,11 +264,12 @@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEB_FALSE = @WEB_FALSE@ +WEB_MANPAGES = @WEB_MANPAGES@ WEB_TRUE = @WEB_TRUE@ -WXBASE_CFLAGS = @WXBASE_CFLAGS@ -WXBASE_CXXFLAGS = @WXBASE_CXXFLAGS@ +WXBASE_CPPFLAGS = @WXBASE_CPPFLAGS@ WXBASE_LIBS = @WXBASE_LIBS@ WXCAS_FALSE = @WXCAS_FALSE@ +WXCAS_MANPAGES = @WXCAS_MANPAGES@ WXCAS_TRUE = @WXCAS_TRUE@ WX_CFLAGS = @WX_CFLAGS@ WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ @@ -280,6 +290,9 @@ X11LIBS = @X11LIBS@ XGETTEXT = @XGETTEXT@ YACC = @YACC@ +ZLIB_CPPFLAGS = @ZLIB_CPPFLAGS@ +ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ ac_ct_AR = @ac_ct_AR@ ac_ct_BUILD_CC = @ac_ct_BUILD_CC@ ac_ct_CC = @ac_ct_CC@ @@ -288,6 +301,7 @@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_RC = @ac_ct_RC@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ @@ -303,8 +317,6 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -ccache = @ccache@ -ccache_prefix = @ccache_prefix@ datadir = @datadir@ docdir = @docdir@ exec_prefix = @exec_prefix@ @@ -328,14 +340,27 @@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -SUBDIRS = m4 docs src unittests $(am__append_1) -EXTRA_DIST = amule.rc amule.ico amule.png convert.ico +SUBDIRS = $(am__append_1) docs src unittests +EXTRA_DIST = amule.rc amule.ico amule.png convert.ico \ + aMule.spec \ + amule_build_install.sh autogen.sh \ + po/l10n.xsl + dist_icon_DATA = $(am__append_2) $(am__append_4) icondir = $(datadir)/pixmaps dist_util_DATA = $(am__append_3) $(am__append_5) utildir = $(datadir)/applications ACLOCAL_AMFLAGS = -I m4 -DISTCHECK_CONFIGURE_FLAGS = --enable-amulecmd --enable-webserver +DISTCHECK_CONFIGURE_FLAGS = \ + --enable-amulecmd \ + --enable-webserver \ + --enable-amule-daemon \ + --enable-amule-gui \ + --enable-cas \ + --enable-wxcas \ + --enable-alc \ + --enable-alcc + MAINTAINERCLEANFILES = ABOUT-NLS \ Makefile.in \ aclocal.m4 \ @@ -349,13 +374,14 @@ missing \ mkinstalldirs +EXTRA__DIST__SUBDIRS = aMule.app debian all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/automake/dist-hook.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -580,7 +606,7 @@ distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) - $(mkdir_p) $(distdir)/. $(distdir)/intl $(distdir)/m4 $(distdir)/po $(distdir)/src/utils/xas + $(mkdir_p) $(distdir)/. $(distdir)/automake $(distdir)/intl $(distdir)/m4 $(distdir)/po $(distdir)/src/utils/xas @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ @@ -622,6 +648,9 @@ || exit 1; \ fi; \ done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ @@ -807,24 +836,35 @@ .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-generic \ - distclean-hdr distclean-recursive distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dist_iconDATA install-dist_utilDATA \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-dist_iconDATA uninstall-dist_utilDATA \ - uninstall-info-am + ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-recursive \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dist_iconDATA \ + install-dist_utilDATA install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-dist_iconDATA \ + uninstall-dist_utilDATA uninstall-info-am # Avoid everything getting built when doing "make check" check-recursive: SUBDIRS = unittests +dist-hook: + for d in $(EXTRA__DIST__SUBDIRS) ; do \ + mkdir $(distdir)/$$d ; \ + for f in `find $(srcdir)/$$d -name '.svn' -prune -o -printf "%P\n"` ; do \ + if test -d $(srcdir)/$$d/$$f ; then \ + mkdir $(distdir)/$$d/$$f ; \ + else \ + cp -p $(srcdir)/$$d/$$f $(distdir)/$$d/$$f ; \ + fi ; \ + done ; \ + done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -ruN -d amule-2.2.0~svn20080218/README.Debian-Packages amule-2.2.2/README.Debian-Packages --- amule-2.2.0~svn20080218/README.Debian-Packages 2008-01-06 14:22:51.000000000 +0000 +++ amule-2.2.2/README.Debian-Packages 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -This debian rules file controls the buildprocess of the packages of aMule you can either run -dpkg-buildpackage -us -uc -b -rfakeroot -to build them all, or you can invoke debian/rules directly with the target you want to be build. If you run -debian/rules without a target, or with the target help, this help will be printed. Other possible targets -are listed below, you can combine them as you need. amule-common, the packages with the themes for the -webserver and i18n-en-gb are build everytime. - -amule Builds the normal GUI-Version of aMule -ed2k Builds the ed2k-client of aMule -cas Builds the cas binary for commandline statistics -wxcas Builds the graphical version of cas -webserver Builds the webserver for controlling aMule -remotegui Builds the remote GUI for controlling aMule -daemon Builds the daemonized version of aMule -alcc Builds the ed2k-link-creation utility of aMule -alc Builds the graphical version of alcc -amulecmd Builds the commandline-client for controlling aMule -amule-dbg Creates the debugging symbols for the amule binary -ed2k-dbg Creates the debugging symbols for the ed2k binary -cas-dbg Creates the debugging symbols for the cas binary -wxcas-dbg Creates the debugging symbols for the wxcas binary -webserver-dbg Creates the debugging symbols for the amuleweb binary -remotegui-dbg Creates the debugging symbols for the amulegui binary -daemon-dbg Creates the debugging symbols for the amuled binary -alcc-dbg Creates the debugging symbols for the alcc binary -alc-dbg Creates the debugging symbols for the alc binary -amulecmd-dbg Creates the debugging symbols for the amulecmd binary -amule-utils Creates the Metapackage for the commandline utilities and all these utils - * alcc - * amulecmd - * cas -amule-utils-gui Creates the Metapackage for the graphical utilities and all these utils - * alc - * remotegui - * wxcas -i18n- Builds the coresponding i18n-packge. Lang has to be one of ar, bg, ca, da, - de, es, et-ee, eu, fi, fr, gl, hr, hu, it, it-ch, ko-kr, lt, nl, - nn, pl, pt-br, pt-pt, ru, sl, sv, tr, zh-cn or zh-tw - If no i18n-package is given, all will be build. - If you just want en_GB, use i18n-en-only - -If one of the -dbg targets is choosen, the corresponding binary will be built, too. In this case, -debugging is enabled, profiling and optimising are disabled. Is no -dbg target choosen, debugging -is disabled, profiling and optimising are enabled. - -The targets can be given in any order and combination - diff -ruN -d amule-2.2.0~svn20080218/SVNDATE amule-2.2.2/SVNDATE --- amule-2.2.0~svn20080218/SVNDATE 2008-02-18 06:02:15.000000000 +0000 +++ amule-2.2.2/SVNDATE 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -Mon Feb 18 07:02:15 CET 2008 diff -ruN -d amule-2.2.0~svn20080218/aMule-CVS.spec amule-2.2.2/aMule-CVS.spec --- amule-2.2.0~svn20080218/aMule-CVS.spec 2008-01-06 13:14:54.000000000 +0000 +++ amule-2.2.2/aMule-CVS.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -%define svndate %(date +%Y%m%d) -%define optflags %{nil} - -Summary: aMule - another eMule p2p client -Name: aMule -Version: CVS -Release: %{svndate} -License: GPL -Group: Applications/Internet -Packager: The aMule Team (http://forum.amule.org/) -Vendor: The aMule Project -URL: http://www.amule.org/ -Source: %{name}-%{version}-%{release}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -%description -aMule is a peer to peer file sharing client, based on the well known eMule. -Starting with 2.0.0 aMule works on Linux, Mac, *BSD and Windows, which makes it -the first multi-platform edonkey network client. - -%pre -echo "****************************************************************************" -echo "Warning: This is a cvs release!" -echo "This release is made for testing purpose and it may cause several problems," -echo "burn your house, kill your dog, etc, but it *should* be safe to use anyway." -echo "If you would like to test some of the great new features go on and install." -echo "Otherwise you may press ctrl-c within the next 10 seconds to abort the" -echo "installation." -echo -n "Waiting for user... " -for i in $(seq 10 -1 1); do - echo -n "$i, " - sleep 1 -done -echo " 0, ok, here we go then... Muhahaha :), installing." - -%prep -%setup -q -n amule-cvs - -%build -%configure \ - --disable-optimize \ - --enable-debug \ - --enable-cas \ - --enable-wxcas \ - --enable-amulecmd \ - --enable-webserver \ - --enable-ccache -%{__make} %{?_smp_mflags} - -%install -[ ! "$RPM_BUILD_ROOT" = "/" ] && %{__rm} -rf "$RPM_BUILD_ROOT" -%{__make} DESTDIR="$RPM_BUILD_ROOT" install -%find_lang amule - -%clean -[ ! "$RPM_BUILD_ROOT" = "/" ] && %{__rm} -rf "$RPM_BUILD_ROOT" - -%files -f amule.lang -%defattr(-,root,root,-) -%{_bindir}/amule -%{_bindir}/ed2k -%{_bindir}/amulecmd -%{_bindir}/cas -%{_bindir}/wxcas -%{_bindir}/amuleweb -%{_bindir}/autostart-xas -%{_libdir}/xchat/plugins/xas.pl -%{_datadir}/applications/* -%{_datadir}/pixmaps/* -%{_mandir}/man1/* -%{_mandir}/*/man1/* -%docdir %{_datadir}/doc/* -%{_datadir}/doc/* -%{_datadir}/cas -%{_datadir}/amule - -%changelog -* Sun Dec 25 2005 Gerd78 -- Really disable optimizations by defining optflags to nil. - -* Mon Apr 19 2005 Marcelo Jimenez -- Removed curl dependency, aMule now uses wxHTTP. - -* Mon Mar 26 2005 Marcelo Jimenez -- Added a distro test, so we know the distro. -- Tests for UTF-8 enabled LANG to use UTF-8 systray. - -* Mon Mar 21 2005 Marcelo Jimenez -- Removed krb5-libs require and krb5-devel buildprereq. curl-lib and - curl-devel is enough. - -* Tue Mar 08 2005 Marcelo Jimenez -- Made it work with cvs snapshots at their very same day. - -* Wed Jun 16 2004 Ariano Bertacca -- added tool package. - -* Sat May 22 2004 Ariano Bertacca -- added webserver package. - -* Sun Mar 28 2004 Ariano Bertacca -- added libcryptopp to dependencies/BuildPreReq -- getting wx-config and wxbase-config from installed rpm to avoid problems - with people using wxGTK-2.5. - Idea taken from aMule-2.0.0rc1.spec done by - deltaHF and - pure_ascii - -* Tue Feb 10 2004 Ariano Bertacca -- modified the BuildPreReq to satisfy amulecmd build requirements. - -* Sat Jan 23 2004 Ariano Bertacca -- initial amule.spec release - diff -ruN -d amule-2.2.0~svn20080218/aMule.spec amule-2.2.2/aMule.spec --- amule-2.2.0~svn20080218/aMule.spec 2007-01-04 01:19:08.000000000 +0000 +++ amule-2.2.2/aMule.spec 2008-08-08 13:28:44.000000000 +0000 @@ -1,6 +1,6 @@ Summary: aMule - another eMule p2p client Name: aMule -Version: 2.2.0 +Version: 2.2.2 Release: 0 License: GPL Group: Applications/Internet diff -ruN -d amule-2.2.0~svn20080218/acinclude.m4 amule-2.2.2/acinclude.m4 --- amule-2.2.0~svn20080218/acinclude.m4 2008-02-14 11:14:38.000000000 +0000 +++ amule-2.2.2/acinclude.m4 2008-07-10 14:32:39.000000000 +0000 @@ -1,487 +1,316 @@ -dnl --------------------------------------------------------------------------- -dnl AM_WXCONFIG_LARGEFILE() -dnl -dnl Test that wxWidgets is built with support for large-files. If not -dnl configure is terminated. -dnl --------------------------------------------------------------------------- -AC_DEFUN([AM_WXCONFIG_LARGEFILE], -[ - AC_LANG_PUSH(C++) - - dnl Backup current flags and setup flags for testing - __CPPFLAGS=${CPPFLAGS} - CPPFLAGS=${WX_CPPFLAGS} - - AC_MSG_CHECKING(that wxWidgets has support for large files) - AC_PREPROC_IFELSE([ - #include - - int main() { - #if !HAVE_LARGEFILE_SUPPORT && !defined(__WXMSW__) - #error No LargeFile support!; - #endif - exit(0); - } - ], , NO_LF="true") - - if test "x${NO_LF}" != "x"; - then - AC_MSG_RESULT(no) - AC_MSG_ERROR([ - Support for large files in wxWidgets is required by aMule. - To continue you must recompile wxWidgets with support for - large files enabled. - ]) - else - AC_MSG_RESULT(yes) - fi - - dnl Restore backup'd flags - CPPFLAGS=${__CPPFLAGS} - - AC_LANG_POP(C++) -]) +# -*- Autoconf -*- +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# dnl --------------------------------------------------------------------------- -dnl AM_OPTIONS_LIBPNG_CONFIG -dnl -dnl adds support for --libpng-prefix and --libpng-config -dnl command line options +dnl Helper functions dnl --------------------------------------------------------------------------- +m4_pattern_forbid(MULE_)dnl Check for unexpanded *MULE_* macros +m4_pattern_allow(AMULE_)dnl Allow the *AMULE_* names -AC_DEFUN([AM_OPTIONS_LIBPNGCONFIG], -[ - AC_ARG_WITH( - [libpng-prefix], - [AS_HELP_STRING( - [--with-libpng-prefix=PREFIX], - [prefix where libpng is installed])], - [libpng_config_prefix="$withval"], - [libpng_config_prefix=""]) - AC_ARG_WITH( - [libpng-exec-prefix], - [AS_HELP_STRING( - [--with-libpng-exec-prefix=PREFIX], - [exec prefix where libpng is installed])], - [libpng_config_exec_prefix="$withval"], - [libpng_config_exec_prefix=""]) - AC_ARG_WITH( - [libpng-config], - [AS_HELP_STRING( - [--with-libpng-config=CONFIG], - [libpng-config script to use])], - [libpng_config_name="$withval"], - [libpng_config_name=""]) -]) +dnl MULE_APPEND(VARNAME, VALUE) +AC_DEFUN([MULE_APPEND], [$1="$$1 $2"]) -dnl --------------------------------------------------------------------------- -dnl AM_PATH_LIBPNGCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl -dnl Test for libpng, and define LIBPNG*FLAGS, LIBPNG_LIBS and LIBPNG_CONFIG_NAME -dnl environment variable to override the default name of the libpng-config script -dnl to use. Set LIBPNG_CONFIG_PATH to specify the full path to libpng-config - -dnl in this case the macro won't even waste time on tests for its existence. -dnl --------------------------------------------------------------------------- +dnl MULE_PREPEND(VARNAME, VALUE) +AC_DEFUN([MULE_PREPEND], [$1="$2 $$1"]) -dnl -dnl Get the cflags and libraries from the libpng-config script -dnl +dnl MULE_ADDFLAG(FLAGTYPE, VALUE) +AC_DEFUN([MULE_ADDFLAG], [MULE_APPEND([MULE[]$1[]FLAGS], [$2])]) -AC_DEFUN([AM_PATH_LIBPNGCONFIG], +dnl MULE_ADDCCXXFLAG(VALUE) +AC_DEFUN([MULE_ADDCCXXFLAG], [ - dnl do we have libpng-config name: it can be libpng-config or gd-config or ... - if test x${LIBPNG_CONFIG_NAME+set} != xset ; then - LIBPNG_CONFIG_NAME=libpng-config - fi - if test "x$libpng_config_name" != x ; then - LIBPNG_CONFIG_NAME="$libpng_config_name" - fi + MULE_ADDFLAG([C], [$1]) + MULE_ADDFLAG([CXX], [$1]) +]) - dnl deal with optional prefixes - if test x$libpng_config_exec_prefix != x ; then - dnl libpng_config_args="$libpng_config_args --exec-prefix=$libpng_config_exec_prefix" - LIBPNG_LOOKUP_PATH="$libpng_config_exec_prefix/bin" - fi - if test x$libpng_config_prefix != x ; then - dnl libpng_config_args="$libpng_config_args --prefix=$libpng_config_prefix" - LIBPNG_LOOKUP_PATH="$LIBPNG_LOOKUP_PATH:$libpng_config_prefix/bin" - fi - - dnl don't search the PATH if LIBPNG_CONFIG_NAME is absolute filename - if test -x "$LIBPNG_CONFIG_NAME" ; then - AC_MSG_CHECKING(for libpng-config) - LIBPNG_CONFIG_PATH="$LIBPNG_CONFIG_NAME" - AC_MSG_RESULT($LIBPNG_CONFIG_PATH) - else - AC_PATH_PROG(LIBPNG_CONFIG_PATH, $LIBPNG_CONFIG_NAME, no, "$LIBPNG_LOOKUP_PATH:$PATH") - fi +dnl MULE_BACKUP(VAR) +AC_DEFUN([MULE_BACKUP], [mule_backup_$1="$$1"]) - if test "$LIBPNG_CONFIG_PATH" != "no" ; then - LIBPNG_VERSION="" - no_libpng="" +dnl MULE_RESTORE(VAR) +AC_DEFUN([MULE_RESTORE], [$1="$mule_backup_$1"]) - min_libpng_version=ifelse([$1], ,1.2.0,$1) - AC_MSG_CHECKING(for libpng version >= $min_libpng_version) +dnl Helper macro for MULE_IF +m4_define([__mule_if_helper], +[m4_if( [$#], 0,, + [$#], 1, [m4_ifvaln([$1], [m4_n([else]) $1])], + [m4_n([elif $1; then]) m4_ifvaln([$2], [$2], :)])dnl +m4_if(m4_eval([$# > 2]), 1, [$0(m4_shiftn(2, $@))])]) - LIBPNG_CONFIG_WITH_ARGS="$LIBPNG_CONFIG_PATH $libpng_config_args" +dnl MULE_IF(CONDITION, [IF-TRUE] [, ELIF-CONDITION, [IF-TRUE]]... [, ELSE-BRANCH]) +m4_define([MULE_IF], +[m4_if( [$#], 0,, + [$#], 1,, + [m4_n([if $1; then]) m4_ifval([$2],[$2], :) +m4_if(m4_eval([$# > 2]), 1, [__mule_if_helper(m4_shiftn(2, $@))])m4_n([fi])])]) - LIBPNG_VERSION=`$LIBPNG_CONFIG_WITH_ARGS --version` - libpng_config_major_version=`echo $LIBPNG_VERSION | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\1/'` - libpng_config_minor_version=`echo $LIBPNG_VERSION | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\2/'` - libpng_config_micro_version=`echo $LIBPNG_VERSION | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\3/'` +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_SYSTEM +dnl +dnl Checks host system type, and sets system-specific flags accordingly. +dnl Sets $SYS to the name of the host os. +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_SYSTEM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl - libpng_requested_major_version=`echo $min_libpng_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\1/'` - libpng_requested_minor_version=`echo $min_libpng_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\2/'` - libpng_requested_micro_version=`echo $min_libpng_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\3/'` + case "${host_os}" in + darwin*) + SYS=darwin + MULECPPFLAGS="-no-cpp-precomp -D_INTL_REDIRECT_MACROS -DNOPCH"; + MULELDFLAGS="-bind_at_load" + touch src/Scanner.cpp + ;; + openbsd*) + SYS=openbsd + LIBS="$LIBS -L/usr/local/lib" + X11LIBS="-lX11 -L/usr/X11R6/lib" + MULECPPFLAGS="-D__OPENBSD__" + ;; + *cygwin* | *mingw32*) + SYS=win32 + MULECPPFLAGS="-DNOMINMAX" + ;; + solaris*) + SYS=solaris + RESOLV_LIB="-lresolv -lnsl" + X11LIBS="-lX11" + LIBS="$LIBS -lrt" + ;; + *netbsd*) + SYS=netbsd + # Now this is against autoconf recommendation that configure should not modify CPPFLAGS and LDFLAGS + # However, these values in NetBSD are required even to run the tests, and this is the easiest way to do it. + # Still, we prepend them, instead of adding, so the user may override them. + MULE_PREPEND([CPPFLAGS], [-I/usr/pkg/include]) + MULE_PREPEND([LDFLAGS], [-R/usr/pkg/lib -L/usr/pkg/lib]) + ;; + *) + SYS=unknown + ;; + esac - libpng_ver_ok="" - if test $libpng_config_major_version -gt $libpng_requested_major_version; then - libpng_ver_ok=yes - else - if test $libpng_config_major_version -eq $libpng_requested_major_version; then - if test $libpng_config_minor_version -gt $libpng_requested_minor_version; then - libpng_ver_ok=yes - else - if test $libpng_config_minor_version -eq $libpng_requested_minor_version; then - if test $libpng_config_micro_version -ge $libpng_requested_micro_version; then - libpng_ver_ok=yes - fi - fi - fi - fi - fi + # -lpthread is needed by Debian but FreeBSD < 5 doesn't support it + AS_IF([test ${SYS:-unknown} != win32], + [ + AC_MSG_CHECKING([if this is a FreeBSD 4 or earlier system]) + AS_IF([test x"`uname -s`" = xFreeBSD && test 0`uname -r | cut -c 1` -lt 5], + [ + MULE_ADDFLAG([LD], [-pthread]) + AC_MSG_RESULT(yes) + ], [ + MULE_ADDFLAG([LD], [-lpthread]) + AC_MSG_RESULT(no) + ]) + ]) - if test "x$libpng_ver_ok" = x ; then - no_libpng=yes - else - LIBPNG_LIBS=`$LIBPNG_CONFIG_WITH_ARGS --libs` - LIBPNG_LDFLAGS=`$LIBPNG_CONFIG_WITH_ARGS --ldflags` - LIBPNG_CFLAGS=`$LIBPNG_CONFIG_WITH_ARGS --cflags` - LIBPNG_CXXFLAGS=$LIBPNG_CFLAGS - fi +AC_SUBST([RESOLV_LIB])dnl +AC_SUBST([X11LIBS])dnl +AC_SUBST([MULECPPFLAGS])dnl +AC_SUBST([MULECFLAGS])dnl +AC_SUBST([MULECXXFLAGS])dnl +AC_SUBST([MULELDFLAGS])dnl +AC_SUBST([MULERCFLAGS])dnl +]) - if test "x$no_libpng" = x ; then - AC_MSG_RESULT(yes (version $LIBPNG_VERSION)) - AC_CHECK_HEADER([gd.h],[$2],[$3]) - else - if test "x$LIBPNG_VERSION" = x; then - dnl no libpng-config at all - AC_MSG_RESULT(no) - else - AC_MSG_RESULT(no (version $LIBPNG_VERSION is not new enough)) - fi +dnl --------------------------------------------------------------------------- +dnl _MULE_CHECK_DEBUG_FLAG +dnl --------------------------------------------------------------------------- +AC_DEFUN([_MULE_CHECK_DEBUG_FLAG], +[AC_REQUIRE([MULE_CHECK_GLIBCXX])dnl - LIBPNG_CFLAGS="" - LIBPNG_CXXFLAGS="" - LIBPNG_LDFLAGS="" - LIBPNG_LIBS="" - ifelse([$3], , :, [$3]) - fi - else - dnl Some RedHat RPMs miss libpng-config, so test for - dnl the usability with default options. - dnl Checking for libpng >= 1.2.0, and ignoring passed VERSION ($1), - dnl to make life simpler. - AC_MSG_CHECKING([for libpng >= 1.2.0]) - dnl Set up LIBS for the test - saved_LIBS="$LIBS" - LIBS="$LIBS -lpng -lz -lm" - dnl Set default (empty) values. - LIBPNG_CFLAGS="" - LIBPNG_CXXFLAGS="" - LIBPNG_LDFLAGS="" - LIBPNG_LIBS="" - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ - #include - #include + AC_ARG_ENABLE( + [debug], + [AS_HELP_STRING([--disable-debug], [disable additional debugging output])], + [USE_DEBUG=${enableval:-yes}], [USE_DEBUG=yes]) - /* Check linking to png library */ - void dummy() { - png_check_sig(NULL, 0); - } - ]], [[ - /* png.h defines PNG_LIBPNG_VER=xyyzz */ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%s", (PNG_LIBPNG_VER >= 10200) ? "yes" : "no"); - fclose(f); - f=fopen("conftestver", "w"); - if (!f) exit(0); - fprintf(f, "%s", PNG_LIBPNG_VER_STRING); - fclose(f); - exit(0); - ]]) - ], [ - if test -f conftestval; then - result=`cat conftestval` - else - result=no - fi - if test x$result = xyes; then - if test -f conftestver; then - LIBPNG_VERSION=`cat conftestver` - lib_version=" (version $LIBPNG_VERSION)" - else - lib_version="" - fi - fi - AC_MSG_RESULT($result$lib_version) - LIBPNG_LIBS="-lpng -lz -lm" - ], [ - result=no - AC_MSG_RESULT($result) + AS_IF([test $USE_DEBUG = yes], + [ + MULE_ADDFLAG([CPP], [-D__DEBUG__]) + MULE_ADDCCXXFLAG([-g]) + AS_IF([test ${GLIBCXX:-no} = yes], [MULE_ADDFLAG([CPP], [-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC])]) + AS_IF([test ${GCC:-no} = yes], [MULE_ADDCCXXFLAG([-W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0])]) + AS_IF([test ${SYS:-unknown} = win32], [MULE_ADDFLAG([RC], [-D__DEBUG__])]) ], [ - AC_MSG_RESULT([cross-compilation detected, checking only the header]) - AC_CHECK_HEADER(png.h, [result=yes], [result=no]) - if test x$result = xyes; then - LIBPNG_VERSION="detected" - LIBPNG_LIBS="-lpng -lz -lm" - fi + AS_IF([test ${GCC:-no} = yes], [MULE_ADDCCXXFLAG([-W -Wall -Wshadow -Wundef])]) ]) - if test x$result = xyes; then - ifelse([$2], , :, [$2]) - else - ifelse([$3], , :, [$3]) - fi - dnl Restore LIBS - LIBS="$saved_LIBS" - fi +]) +dnl --------------------------------------------------------------------------- +dnl _MULE_CHECK_PROFILE_FLAG +dnl --------------------------------------------------------------------------- +AC_DEFUN([_MULE_CHECK_PROFILE_FLAG], +[ + AC_ARG_ENABLE( + [profile], + [AS_HELP_STRING([--enable-profile], [enable code profiling])], + [USE_PROFILE=${enableval:-no}], [USE_PROFILE=no]) - AC_SUBST(LIBPNG_CFLAGS) - AC_SUBST(LIBPNG_CXXFLAGS) - AC_SUBST(LIBPNG_LDFLAGS) - AC_SUBST(LIBPNG_LIBS) + AS_IF([test $USE_PROFILE = yes], + [ + MULE_ADDCCXXFLAG([-pg]) + MULE_ADDFLAG([LD], [-pg]) + ]) ]) -dnl END_OF_PNG - dnl --------------------------------------------------------------------------- -dnl AM_OPTIONS_GDLIBCONFIG -dnl -dnl adds support for --gdlib-prefix and --gdlib-config -dnl command line options +dnl _MULE_CHECK_OPTIMIZE_FLAG dnl --------------------------------------------------------------------------- - -AC_DEFUN([AM_OPTIONS_GDLIBCONFIG], +AC_DEFUN([_MULE_CHECK_OPTIMIZE_FLAG], [ - AC_ARG_WITH( - [gdlib-prefix], - [AS_HELP_STRING( - [--with-gdlib-prefix=PREFIX], - [prefix where gdlib is installed])], - [gdlib_config_prefix="$withval"], - [gdlib_config_prefix=""]) - AC_ARG_WITH( - [gdlib-exec-prefix], - [AS_HELP_STRING( - [--with-gdlib-exec-prefix=PREFIX], - [exec prefix where gdlib is installed])], - [gdlib_config_exec_prefix="$withval"], - [gdlib_config_exec_prefix=""]) - AC_ARG_WITH( - [gdlib-config], - [AS_HELP_STRING( - [--with-gdlib-config=CONFIG], - [gdlib-config script to use])], - [gdlib_config_name="$withval"], - [gdlib_config_name=""]) + AC_ARG_ENABLE( + [optimize], + [AS_HELP_STRING([--enable-optimize], [enable code optimization])], + [USE_OPTIMIZE=${enableval:-no}], [USE_OPTIMIZE=no]) + + AS_IF([test $USE_OPTIMIZE = yes], [MULE_ADDCCXXFLAG([-O2])]) ]) dnl --------------------------------------------------------------------------- -dnl AM_PATH_GDLIBCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl MULE_COMPILATION_FLAGS dnl -dnl Test for gdlib, and define GDLIB*FLAGS, GDLIB_LIBS and GDLIB_CONFIG_NAME -dnl environment variable to override the default name of the gdlib-config script -dnl to use. Set GDLIB_CONFIG_PATH to specify the full path to gdlib-config - -dnl in this case the macro won't even waste time on tests for its existence. +dnl Checks type of compilation requested by user, and sets various flags +dnl accordingly. dnl --------------------------------------------------------------------------- - -dnl -dnl Get the cflags and libraries from the gdlib-config script -dnl -AC_DEFUN([AM_PATH_GDLIBCONFIG], +AC_DEFUN([MULE_COMPILATION_FLAGS], [ - dnl do we have gdlib-config name: it can be gdlib-config or gd-config or ... - if test x${GDLIB_CONFIG_NAME+set} != xset ; then - GDLIB_CONFIG_NAME=gdlib-config - fi - if test "x$gdlib_config_name" != x ; then - gdlib_CONFIG_NAME="$gdlib_config_name" - fi - - dnl deal with optional prefixes - if test x$gdlib_config_exec_prefix != x ; then - dnl gdlib-config doesn't accept --exec-prefix - dnl gdlib_config_args="$gdlib_config_args --exec-prefix=$gdlib_config_exec_prefix" - GDLIB_LOOKUP_PATH="$gdlib_config_exec_prefix/bin" - fi - if test x$gdlib_config_prefix != x ; then - dnl gdlib-config doesn't accept --prefix - dnl gdlib_config_args="$gdlib_config_args --prefix=$gdlib_config_prefix" - GDLIB_LOOKUP_PATH="$GDLIB_LOOKUP_PATH:$gdlib_config_prefix/bin" - fi - - dnl don't search the PATH if GDLIB_CONFIG_NAME is absolute filename - if test -x "$GDLIB_CONFIG_NAME" ; then - AC_MSG_CHECKING(for gdlib-config) - GDLIB_CONFIG_PATH="$GDLIB_CONFIG_NAME" - AC_MSG_RESULT($GDLIB_CONFIG_PATH) - else - AC_PATH_PROG(GDLIB_CONFIG_PATH, $GDLIB_CONFIG_NAME, no, "$GDLIB_LOOKUP_PATH:$PATH") - fi - - if test "$GDLIB_CONFIG_PATH" != "no" ; then - GDLIB_VERSION="" - no_gdlib="" - - min_gdlib_version=ifelse([$1], ,2.0.0,$1) - AC_MSG_CHECKING(for gdlib version >= $min_gdlib_version) - - GDLIB_CONFIG_WITH_ARGS="$GDLIB_CONFIG_PATH $gdlib_config_args" - - GDLIB_VERSION=`$GDLIB_CONFIG_WITH_ARGS --version` - gdlib_config_major_version=`echo $GDLIB_VERSION | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\1/'` - gdlib_config_minor_version=`echo $GDLIB_VERSION | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\2/'` - gdlib_config_micro_version=`echo $GDLIB_VERSION | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\3/'` - - gdlib_requested_major_version=`echo $min_gdlib_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\1/'` - gdlib_requested_minor_version=`echo $min_gdlib_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\2/'` - gdlib_requested_micro_version=`echo $min_gdlib_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\([[0-9|a-z]]*\)/\3/'` + _MULE_CHECK_DEBUG_FLAG + _MULE_CHECK_OPTIMIZE_FLAG + _MULE_CHECK_PROFILE_FLAG - gdlib_ver_ok="" - if test $gdlib_config_major_version -gt $gdlib_requested_major_version; then - gdlib_ver_ok=yes - else - if test $gdlib_config_major_version -eq $gdlib_requested_major_version; then - if test $gdlib_config_minor_version -gt $gdlib_requested_minor_version; then - gdlib_ver_ok=yes - else - if test $gdlib_config_minor_version -eq $gdlib_requested_minor_version; then - if test $gdlib_config_micro_version -ge $gdlib_requested_micro_version; then - gdlib_ver_ok=yes - fi - fi - fi - fi - fi + AC_MSG_CHECKING([if the applications should be statically linked]) + AC_ARG_ENABLE( + [static], + [AS_HELP_STRING([--enable-static], [produce a statically linked executable])], + [AS_IF([test ${enableval:-no} = yes], [MULE_ADDFLAG([LD], [-static])])]) + AC_MSG_RESULT(${enableval:-no}) - if test "x$gdlib_ver_ok" = x ; then - no_gdlib=yes - else - GDLIB_LIBS=`$GDLIB_CONFIG_WITH_ARGS --libs` + MULE_ADDFLAG([CPP], [-DUSE_WX_EXTENSIONS]) +]) - if test "x$gdlib_has_cppflags" = x ; then - dnl no choice but to define all flags like CFLAGS - GDLIB_CFLAGS=`$GDLIB_CONFIG_WITH_ARGS --cflags` - GDLIB_CPPFLAGS=$GDLIB_CFLAGS - GDLIB_CXXFLAGS=$GDLIB_CFLAGS - GDLIB_LDFLAGS=`$GDLIB_CONFIG_WITH_ARGS --ldflags` - GDLIB_CFLAGS_ONLY=$GDLIB_CFLAGS - GDLIB_CXXFLAGS_ONLY=$GDLIB_CFLAGS - else - dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS -- ?? - GDLIB_CPPFLAGS=`$GDLIB_CONFIG_WITH_ARGS --cflags` - GDLIB_CXXFLAGS=`$GDlIB_CONFIG_WITH_ARGS --cflags` - GDLIB_CFLAGS=`$GDLIB_CONFIG_WITH_ARGS --cflags` - GDLIB_LDFLAGS=`$GDLIB_CONFIG_WITH_ARGS --ldflags` +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_GLIBCXX +dnl +dnl Checks whether we use the GNU C++ Library. +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_GLIBCXX], +[dnl +AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl +AC_LANG_ASSERT([C++])dnl - GDLIB_CFLAGS_ONLY=`echo $GDLIB_CFLAGS | sed "s@^$GDLIB_CPPFLAGS *@@"` - GDLIB_CXXFLAGS_ONLY=`echo $GDLIB_CXXFLAGS | sed "s@^$GDLIB_CFLAGS *@@"` - fi - fi + AC_MSG_CHECKING([if we're using the GNU C++ library]) + AC_PREPROC_IFELSE([ + AC_LANG_SOURCE([[ + #include + #ifndef __GLIBCXX__ + #error Non-GNU C++ library found. + #endif + ]]) + ], [GLIBCXX=yes], [GLIBCXX=no]) + AC_MSG_RESULT([$GLIBCXX]) +]) - if test "x$no_gdlib" = x ; then - AC_MSG_RESULT(yes (version $GDLIB_VERSION)) - AC_CHECK_HEADER([gd.h],[$2],[$3]) - else - if test "x$GDLIB_VERSION" = x; then - dnl no gdlib-config at all - AC_MSG_RESULT(no) - else - AC_MSG_RESULT(no (version $GDLIB_VERSION is not new enough)) - fi +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_WX_SUPPORTS_LARGEFILE +dnl +dnl Test that wxWidgets is built with support for large-files. If not +dnl configure is terminated. +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_WX_SUPPORTS_LARGEFILE], +[AC_LANG_ASSERT([C++])dnl - GDLIB_CFLAGS="" - GDLIB_CPPFLAGS="" - GDLIB_CXXFLAGS="" - GDLIB_LDFLAGS="" - GDLIB_LIBS="" - GDLIB_LIBS_STATIC="" - ifelse([$3], , :, [$3]) - fi - fi + dnl Backup current flags and setup flags for testing + MULE_BACKUP([CPPFLAGS]) + MULE_APPEND([CPPFLAGS], [$WX_CPPFLAGS]) + AC_MSG_CHECKING([that wxWidgets has support for large files]) + AC_PREPROC_IFELSE([ + AC_LANG_SOURCE([[ + #include + #if !HAVE_LARGEFILE_SUPPORT && !defined(_LARGE_FILES) && !defined(__WXMSW__) + #error No LargeFile support! + #endif + ]]) + ], [ + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([ + Support for large files in wxWidgets is required by aMule. + To continue you must recompile wxWidgets with support for + large files enabled.]) + ]) - AC_SUBST(GDLIB_CPPFLAGS) - AC_SUBST(GDLIB_CFLAGS) - AC_SUBST(GDLIB_CXXFLAGS) - AC_SUBST(GDLIB_LDFLAGS) - AC_SUBST(GDLIB_CFLAGS_ONLY) - AC_SUBST(GDLIB_CXXFLAGS_ONLY) - AC_SUBST(GDLIB_LIBS) - AC_SUBST(GDLIB_LIBS_STATIC) - AC_SUBST(GDLIB_VERSION) + dnl Restore backup'd flags + MULE_RESTORE([CPPFLAGS]) ]) + dnl -------------------------------------------------------------------------- -dnl CCache support +dnl MULE_CHECK_CCACHE +dnl +dnl Checks if ccache is requested and available, and makes use of it dnl -------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_CCACHE], +[ + AC_ARG_ENABLE([ccache], + [AS_HELP_STRING([--enable-ccache], [enable ccache support for fast recompilation])]) -AC_DEFUN([CHECK_CCACHE], - [ - if test x$ccache_prefix == x ; then - ccache_full=$(which ccache) - ccache_prefix=$(dirname ${ccache_full}) - fi - $ccache_prefix/ccache -V > /dev/null 2>&1 - CCACHE=$? - if test "$CCACHE" != 0; then - result="no" - else - result="yes" - fi - AC_MSG_CHECKING([for ccache presence]) - AC_MSG_RESULT($result) - AC_SUBST(CCACHE) - AC_SUBST(ccache_prefix) - ]) + AC_ARG_WITH([ccache-prefix], + [AS_HELP_STRING([--with-ccache-prefix=PREFIX], [prefix where ccache is installed])]) + AC_MSG_CHECKING([whether ccache support should be added]) + AC_MSG_RESULT([${enable_ccache:-no}]) -AC_DEFUN([AM_OPTIONS_CCACHE_PFX], -[ - AC_ARG_WITH( - [ccache-prefix], - [AS_HELP_STRING( - [--with-ccache-prefix=PREFIX], - [prefix where ccache is installed])], - [ccache_prefix="$withval"], - [ccache_prefix=""]) + AS_IF([test ${enable_ccache:-no} = yes], [ + AC_MSG_CHECKING([for ccache presence]) + AS_IF([test -z "$with_ccache_prefix"], [ + ccache_full=`which ccache` + with_ccache_prefix=`dirname ${ccache_full}` + ]) + AS_IF([$with_ccache_prefix/ccache -V >/dev/null 2>&1], [ + AC_MSG_RESULT([yes]) + CC="$with_ccache_prefix/ccache $CC" + CXX="$with_ccache_prefix/ccache $CXX" + BUILD_CC="$with_ccache_prefix/ccache $BUILD_CC" + ], [ + enable_ccache=no + AC_MSG_RESULT([no]) + ]) + ]) ]) + dnl ---------------------------------------------------- -dnl CHECK_BFD +dnl MULE_CHECK_BFD dnl check if bfd.h is on the system and usable dnl ---------------------------------------------------- -AC_DEFUN([CHECK_BFD], +AC_DEFUN([MULE_CHECK_BFD], [ -AC_MSG_CHECKING([for bfd]) -__LIBS=$LIBS -LIBS="-lbfd -liberty $LIBS" -AC_LINK_IFELSE([ + AC_MSG_CHECKING([for bfd]) + MULE_BACKUP([LIBS]) + MULE_PREPEND([LIBS], [-lbfd -liberty]) + AC_LINK_IFELSE([ AC_LANG_PROGRAM([[ #include #include @@ -490,87 +319,49 @@ ]]) ], [ AC_MSG_RESULT([yes]) - BFD_FLAGS="-DHAVE_BFD" - BFD_LIB="-lbfd -liberty" + BFD_CPPFLAGS="-DHAVE_BFD" + BFD_LIBS="-lbfd -liberty" ], [ AC_MSG_RESULT([no]) AC_MSG_WARN([ bfd.h not found or unusable, please install binutils development package if you are a developer or want to help testing aMule]) ]) -LIBS=${__LIBS} -AC_SUBST(BFD_FLAGS) -AC_SUBST(BFD_LIB) -]) - -dnl ---------------------------------------------------- -dnl CHECK_AUTOPOINT -dnl check if autopoint is installed and fail if not -dnl ---------------------------------------------------- -AC_DEFUN([CHECK_AUTOPOINT], -[ - -AC_MSG_CHECKING([for autopoint]) - -autopoint_version=`autopoint --version | head -n 1 | sed -e 's/.*[[^0-9.]]\([[0-9]]\{1,\}\(\.[[0-9]]\{1,\}\)\{1,2\}\)[[^0-9.]]*/\1/'` -if test x$autopoint_version != x; then - result="yes" -else - result="no" -fi - -HAVE_GETTEXT=$result + MULE_RESTORE([LIBS]) -AC_MSG_RESULT($result ($autopoint_version)) -if test x$result = xno; then - AC_MSG_NOTICE([You need to install GNU gettext/gettext-tools to compile aMule with i18n support]) -fi -AC_SUBST(HAVE_GETTEXT) +AC_SUBST([BFD_CPPFLAGS])dnl +AC_SUBST([BFD_LIBS])dnl ]) + dnl ---------------------------------------------------- -dnl CHECK_FLEX_EXTENDED +dnl MULE_CHECK_FLEX_EXTENDED dnl check if flex can produce header files dnl ---------------------------------------------------- -AC_DEFUN([CHECK_FLEX_EXTENDED], +AC_DEFUN([MULE_CHECK_FLEX_EXTENDED], [ + AC_MSG_CHECKING([for extended flex capabilities]) -AC_MSG_CHECKING([for extended flex capabilities]) - -extended_flex=`flex --help | grep header-file` -if test x"$extended_flex" != x""; then - result="yes" -else - result="no" -fi - -HAVE_FLEX_EXTENDED=$result - -AC_MSG_RESULT($result) - -if test x$result = xno; then - AC_MSG_NOTICE([Your flex version doesn't support --header-file flag. This is not critical, but an upgrade is recommended ]) -fi - -AC_SUBST(HAVE_FLEX_EXTENDED) + extended_flex=`flex --help | grep header-file` + AS_IF([test -n "$extended_flex"], [HAVE_FLEX_EXTENDED=yes], [HAVE_FLEX_EXTENDED=no]) + AC_MSG_RESULT($HAVE_FLEX_EXTENDED) + AS_IF([test $HAVE_FLEX_EXTENDED = no], [AC_MSG_NOTICE([Your flex version doesn't support --header-file flag. This is not critical, but an upgrade is recommended])]) ]) dnl ---------------------------------------------------- -dnl CHECK_EXCEPTIONS +dnl MULE_CHECK_EXCEPTIONS dnl Checks for broken exception-handling. This is needed dnl because exception handling is broken for some archs/ dnl compilers. dnl ---------------------------------------------------- -AC_DEFUN([CHECK_EXCEPTIONS], -[ - AC_MSG_CHECKING([for exception-handling]) +AC_DEFUN([MULE_CHECK_EXCEPTIONS], +[AC_LANG_ASSERT([C++])dnl - AC_LANG_PUSH(C++) + AC_MSG_CHECKING([for exception-handling]) AC_RUN_IFELSE([ - AC_LANG_PROGRAM([], - [[ + AC_LANG_PROGRAM(, [[ try { throw 1; } catch (int) { @@ -590,5 +381,129 @@ Note that broken exception handling in your compiler may lead to unexpected crashes.]) ]) - AC_LANG_POP(C++) +]) + + +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_REGEX([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl +dnl This function will test the existance of a POSIX compliant regex library. +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_REGEX], +[ + AC_CHECK_HEADERS([sys/types.h]) + AC_MSG_CHECKING([for a POSIX compliant regex library]) + regex_found=no + for REGEX_LIBS in '' -lgnurx -lregex; do + MULE_BACKUP([LIBS]) + MULE_PREPEND([LIBS], [$REGEX_LIBS]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #ifdef HAVE_SYS_TYPES_H + # include + #endif + #include + ]], [[ + regex_t preg; + regcomp(&preg, "", REG_EXTENDED); + regmatch_t *pmatch; + regexec(&preg, "", 0, pmatch, 0); + regfree(&preg); + ]]) + ], [ + MULE_RESTORE([LIBS]) + regex_found=yes + break; + ], [MULE_RESTORE([LIBS])]) + done + AC_MSG_RESULT([$regex_found]) + ifelse([$1$2],,, [AS_IF([test $regex_found = yes], [$1], [$2])]) +AC_SUBST([REGEX_LIBS])dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_CXXABI +dnl +dnl This function will test the header and abi::__cxa_demangle() +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_CXXABI], +[AC_LANG_ASSERT([C++])dnl + + AC_MSG_CHECKING([for and __cxa_demangle()]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #include + ]], [[ + int status; + char * demangled = abi::__cxa_demangle("", 0, 0, &status); + std::type_info *ti = abi::__cxa_current_exception_type(); + ]]) + ], [ + AH_TEMPLATE([HAVE_CXXABI], [Define to 1 if you have the header which declares abi::__cxa_demangle()]) + AC_DEFINE([HAVE_CXXABI]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + + +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_EXECINFO +dnl +dnl This function will test the header and backtrace() +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_EXECINFO], +[ + AC_MSG_CHECKING([for and backtrace()]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #include + ]], [[ + void *bt[1]; + int n = backtrace(&bt, 1); + const char **bt_syms = backtrace_symbols(bt, n); + ]]) + ], [ + AH_TEMPLATE([HAVE_EXECINFO], [Define to 1 if you have the header which declares backtrace()]) + AC_DEFINE([HAVE_EXECINFO]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + + +dnl --------------------------------------------------------------------------- +dnl MULE_DENOISER +dnl +dnl Test for denoising level and add denoiser commands to config.status +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_DENOISER], +[ + AC_ARG_WITH([denoise-level], + [AS_HELP_STRING([--with-denoise-level=], [Specifies denoising level (0-4):]) + AS_HELP_STRING([], [0 - Do nothing]) + AS_HELP_STRING([], [4 - Suppress all normal output]) + AS_HELP_STRING([], [(for more information see src/utils/scripts/denoiser.rules)]) + ]) + + AC_MSG_CHECKING([denoising level]) + AS_IF([test ${with_denoise_level:-5} = yes], [with_denoise_level=5]) + AS_IF([test ${with_denoise_level:-5} = no], [with_denoise_level=0]) + AS_IF([test ${with_denoise_level:-5} -gt 4], + [AS_IF([test "${svndate:+set}" = "set"], [with_denoise_level=0], [with_denoise_level=4])]) + AC_MSG_RESULT([$with_denoise_level]) + + AC_CONFIG_COMMANDS([denoiser], [[if test $denoiserlevel -gt 0; then + if test ! -d src/utils/scripts; then mkdir -p src/utils/scripts; fi + sed -e "1{x;s/.*/1/;x;};/^[ ]*\$/d;/^#if /{/level.*$denoiserlevel/{x;s/^/1/;x;b0;};x;s/^/0/;x;:0;d;};/^#else/{x;/^1/{s/1/0/;b1;};s/0/1/;:1;x;d;};/^#endif/{x;s/.//;x;d;};/^[ ]*#/d;x;/^1/{x;b;};x;d" \ + $srcdir/src/utils/scripts/denoiser.rules > src/utils/scripts/denoiser.sed + for i in `find . -name 'Makefile' -print`; do + if test -n "`head -n 1 $i | grep '^#'`"; then + sed -f src/utils/scripts/denoiser.sed $i > $i.tmp && mv $i.tmp $i + fi + done + fi]], [denoiserlevel=$with_denoise_level]) ]) diff -ruN -d amule-2.2.0~svn20080218/aclocal.m4 amule-2.2.2/aclocal.m4 --- amule-2.2.0~svn20080218/aclocal.m4 2008-02-18 06:01:19.000000000 +0000 +++ amule-2.2.2/aclocal.m4 2008-08-08 13:28:58.000000000 +0000 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9.5 -*- Autoconf -*- +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. @@ -28,7 +28,7 @@ # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.5])]) + [AM_AUTOMAKE_VERSION([1.9.6])]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -340,18 +340,6 @@ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 8 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 @@ -892,6 +880,8 @@ m4_include([m4/build-tools.m4]) m4_include([m4/codeset.m4]) m4_include([m4/cryptopp.m4]) +m4_include([m4/fallocate.m4]) +m4_include([m4/gdlib.m4]) m4_include([m4/gettext.m4]) m4_include([m4/glibc21.m4]) m4_include([m4/iconv.m4]) @@ -903,6 +893,10 @@ m4_include([m4/lib-ld.m4]) m4_include([m4/lib-link.m4]) m4_include([m4/lib-prefix.m4]) +m4_include([m4/libpng.m4]) +m4_include([m4/libupnp.m4]) +m4_include([m4/nls.m4]) +m4_include([m4/pkg.m4]) m4_include([m4/progtest.m4]) m4_include([m4/readline.m4]) m4_include([m4/stdint_h.m4]) diff -ruN -d amule-2.2.0~svn20080218/amule.rc amule-2.2.2/amule.rc --- amule-2.2.0~svn20080218/amule.rc 2005-06-30 14:39:06.000000000 +0000 +++ amule-2.2.2/amule.rc 2008-07-10 19:24:42.000000000 +0000 @@ -1,4 +1,6 @@ amule ICON "amule.ico" convert ICON "convert.ico" -#include "wx/msw/wx.rc" +#ifndef MSVC + #include "wx/msw/wx.rc" +#endif diff -ruN -d amule-2.2.0~svn20080218/amule_build_install.sh amule-2.2.2/amule_build_install.sh --- amule-2.2.0~svn20080218/amule_build_install.sh 2008-01-15 19:18:40.000000000 +0000 +++ amule-2.2.2/amule_build_install.sh 2008-07-22 03:26:56.000000000 +0000 @@ -1,99 +1,281 @@ -#! /bin/bash -x +#! /bin/bash + # -# Example usage: -# $ ./amule_build_install.sh cryptopp552.zip libupnp-1.6.3.tar.bz2 wxWidgets-2.8.7.tar.gz aMule-CVS-20080111.tar.bz2 +# Copyright (c) 2004-2008 by Marcelo Roberto Jimenez, phoenix@amule.org # -# Of course, all the above files must be in the current directory. +# All rights reserved. This script is provided under the terms of the GPL. +# + + # +# Example usage: copy all tarballs to a directory, cd to it and +# $ ./amule_build_install.sh +# + + +SCRIPT_VERSION="2.0.0" + USERHOME=$(echo ~) +DEFAULT_PREFIX="${USERHOME}/usr" +DEFAULT_TARDIR=$(pwd) +DEFAULT_UNTARDIR=${DEFAULT_TARDIR}/untars JOBS=4 + +# +# This function uses three parameters: +# $1 - an input parameter specifying a mask for the distribution, +# e.g., 'aMule-CVS-*' for cvs tarballs or 'aMule-*' for distro tarballs. +# $2 - an output parameter with the name of the variable that will +# receive the full file name of the tar archive +# $3 - an output parameter with the name of the variable that will +# receive the basename of the distribution +# +function lookup_distro { + # assign the filename of distribution + # the following is equivalent to execute XXX_FILENAME=$(ls ${TARDIR}/$1) + eval $2=$(ls ${TARDIR}/$1) + + # Now we use indirection to dereference $2 + #echo $2 # evaluates to XXX_FILENAME + #echo ${!2} # evaluates to /home/user/dir/xxx-y.z.t.tar.gz + + # remove the directory and the extension parts and assing it + # to XXX_DISTRO in $3 + case ${!2} in + *.gz) + eval $3=$(basename ${!2} .tar.gz) + ;; + + *.bz2) + eval $3=$(basename ${!2} .tar.bz2) + ;; + + *.zip) + eval $3=$(basename ${!2} .zip) + ;; + esac +} + + +function untar_distro { + # $1 evaluates to /home/user/dir/xxx-y.z.t.tar.gz or .bz2 + local TARCMD= + case $1 in + *.gz) + TARCMD="tar zxf" + ;; + *.bz2) + TARCMD="tar jxf" + ;; + *.zip) + TARCMD="unzip -ao" + ;; + esac + $TARCMD $1 +} + + +function init_package_versions { + # + # Put the software distributions in directory $TARDIR and the + # script does the rest. There can even be a mixture of .tar.gz and + # .tar.bz2 because the untarring routine tests it on the fly + # + # single quotes have to be used here to avoid expansion + # + lookup_distro 'cryptopp*' CRYPTOPP_FILENAME CRYPTOPP_DISTRO + lookup_distro 'libupnp-*' LIBUPNP_FILENAME LIBUPNP_DISTRO + lookup_distro 'wxWidgets-*.*.*.tar.*' WXWIDGETS_FILENAME WXWIDGETS_DISTRO + lookup_distro 'aMule-*' AMULE_FILENAME AMULE_DISTRO + + echo + echo "Software packacge versions:" + echo " cryptopp : $CRYPTOPP_DISTRO" + echo " libupnp : $LIBUPNP_DISTRO" + echo " wxWidgets : $WXWIDGETS_DISTRO" + echo " aMule : $AMULE_DISTRO" + echo +} + + +function init_environment { + echo + echo aMule building script, version $SCRIPT_VERSION + echo + + # only prompt if we're missing information + if [ x$PREFIX = x ] || [ x$TARDIR = x ] || [ x$UNTARDIR = x ] ; then + + PREFIX=${DEFAULT_PREFIX} + echo "Where to install?" + read -p "[${PREFIX}]: " + if [ x$REPLY != x ]; then PREFIX=${REPLY}; fi + + echo + echo "Where are the tarballs?" + TARDIR=${DEFAULT_TARDIR} + read -p "[${TARDIR}]: " + if [ x$REPLY != x ]; then TARDIR=${REPLY}; fi + + echo + echo "Where to untar?" + UNTARDIR=${DEFAULT_UNTARDIR} + read -p "[${UNTARDIR}]: " + if [ x$REPLY != x ]; then UNTARDIR=${REPLY}; fi + + fi + + # test that we have write permissions to the install dir + TST_DIR=${PREFIX}/tmp + TST_FILE=${TST_DIR}/test-if-has-write-permission + mkdir -p ${TST_DIR} + touch ${TST_FILE} + if [ ! -w ${TST_FILE} ]; then + echo "You don't appear to have write permissions to ${PREFIX}." + echo "You must fix that before continuing." + exit + fi + rm -f ${TST_FILE} + + echo + echo "Building for:" + echo " --prefix=${PREFIX}" + echo " tarballs are at ${TARDIR}" + echo " tarballs will be untarred at ${UNTARDIR}" + echo + + # Initialize package version variables + init_package_versions +} + + # # cryptopp # -CRYPTOPP_INSTALL_DIR="${USERHOME}/usr/cryptopp" -CRYPTOPP_SOURCES_DIR="cryptopp_tmpdir" +function build_cryptopp { + CRYPTOPP_INSTALL_DIR="${PREFIX}/cryptopp" + CRYPTOPP_SOURCES_DIR="cryptopp_tmpdir" -rm -rf ${CRYPTOPP_SOURCES_DIR} -mkdir -p ${CRYPTOPP_SOURCES_DIR} -cd ${CRYPTOPP_SOURCES_DIR} + rm -rf ${CRYPTOPP_SOURCES_DIR} + mkdir -p ${CRYPTOPP_SOURCES_DIR} + cd ${CRYPTOPP_SOURCES_DIR} + + untar_distro ${CRYPTOPP_FILENAME} + + make -f GNUmakefile -j${JOBS} + PREFIX=${CRYPTOPP_INSTALL_DIR} make install + cd .. +} -unzip ../$1 -make -f GNUmakefile -j${JOBS} -PREFIX=${CRYPTOPP_INSTALL_DIR} make install -cd .. # # libUPnP # -LIBUPNP_INSTALL_DIR="${USERHOME}/usr/libupnp" -tar jxf $2 -cd libupnp-?.?.? -./configure \ - --enable-debug \ - --prefix=${LIBUPNP_INSTALL_DIR} \ - && \ - make -j${JOBS} > /dev/null && \ - make install > /dev/null -cd .. +function build_libupnp { + untar_distro ${LIBUPNP_FILENAME} + + LIBUPNP_INSTALL_DIR="${PREFIX}/libupnp" + cd libupnp-?.?.? + ./configure \ + --enable-debug \ + --prefix=${LIBUPNP_INSTALL_DIR} \ + && \ + make -j${JOBS} > /dev/null && \ + make install > /dev/null + cd .. +} + # # wxWidgets # -WXWIDGETS_INSTALL_DIR="${USERHOME}/usr/wxWidgets" -tar zxf $3 -cd wxWidgets-?.?.? -./configure \ - --enable-mem_tracing \ - --enable-debug \ - --disable-optimise \ - --enable-debug_flag \ - --enable-debug_info \ - --enable-debug_gdb \ - --with-opengl \ - --enable-gtk2 \ - --enable-unicode \ - --enable-largefile \ - --prefix=${WXWIDGETS_INSTALL_DIR} \ - && \ - make -j${JOBS} > /dev/null && - make install > /dev/null -cd .. +function build_wxwidgets { + untar_distro ${WXWIDGETS_FILENAME} + + WXWIDGETS_INSTALL_DIR="${PREFIX}/wxWidgets" + cd wxWidgets-?.?.? + ./configure \ + --enable-mem_tracing \ + --enable-debug \ + --disable-optimise \ + --enable-debug_flag \ + --enable-debug_info \ + --enable-debug_gdb \ + --with-opengl \ + --enable-gtk2 \ + --enable-unicode \ + --enable-largefile \ + --prefix=${WXWIDGETS_INSTALL_DIR} \ + && \ + make -j${JOBS} > /dev/null && + make install > /dev/null + cd .. +} + # # aMule # -AMULE_INSTALL_DIR="${USERHOME}/usr/amule" -tar jxf $4 -cd amule-cvs -./configure \ - --enable-ccache \ - --with-denoise-level=3 \ - --enable-debug \ - --disable-optimize \ - --enable-verbose \ - --enable-geoip \ - --enable-cas \ - --enable-wxcas \ - --enable-amule-gui \ - --enable-webserver \ - --enable-amulecmd \ - --enable-amule-daemon \ - --with-wx-config=${WXWIDGETS_INSTALL_DIR}/bin/wx-config \ - --prefix=${AMULE_INSTALL_DIR} \ - --with-crypto-prefix=${CRYPTOPP_INSTALL_DIR} \ - && \ - LD_LIBRARY_PATH=${WXWIDGETS_INSTALL_DIR}/lib make -j${JOBS} && \ - LD_LIBRARY_PATH=${WXWIDGETS_INSTALL_DIR}/lib make install > /dev/null +function build_amule { + untar_distro ${AMULE_FILENAME} + + AMULE_INSTALL_DIR="${PREFIX}/amule" + cd amule-cvs + ./configure \ + --enable-ccache \ + --with-denoise-level=3 \ + --enable-debug \ + --disable-optimize \ + --enable-verbose \ + --enable-geoip \ + --enable-cas \ + --enable-wxcas \ + --enable-amule-gui \ + --enable-webserver \ + --enable-amulecmd \ + --enable-amule-daemon \ + --with-wx-config=${WXWIDGETS_INSTALL_DIR}/bin/wx-config \ + --prefix=${AMULE_INSTALL_DIR} \ + --with-crypto-prefix=${CRYPTOPP_INSTALL_DIR} \ + --with-libupnp-prefix=${LIBUPNP_INSTALL_DIR} \ + && \ + LD_LIBRARY_PATH=${WXWIDGETS_INSTALL_DIR}/lib make -j${JOBS} && \ + LD_LIBRARY_PATH=${WXWIDGETS_INSTALL_DIR}/lib make install > /dev/null +} + +# +# Here is where the fun begins... +# +init_environment + +# +# Go to ${UNTARDIR} +# +mkdir -p ${UNTARDIR} +cd ${UNTARDIR} + +# +# Build stuff +# +build_cryptopp +build_libupnp +build_wxwidgets +build_amule + +# +# Leave ${UNTARDIR} +# +cd .. echo -echo Finished compilation +echo Finished compilation. echo You should run aMule like this: echo '$LD_LIBRARY_PATH'=${WXWIDGETS_INSTALL_DIR}/lib:${LIBUPNP_INSTALL_DIR}/lib LANG=en_US.UTF-8 ${AMULE_INSTALL_DIR}/bin/amule echo -echo Of course you may use a different locale. +echo Of course you may choose to use a different locale. echo diff -ruN -d amule-2.2.0~svn20080218/autogen.sh amule-2.2.2/autogen.sh --- amule-2.2.0~svn20080218/autogen.sh 2007-11-29 23:14:37.000000000 +0000 +++ amule-2.2.2/autogen.sh 2008-03-17 23:35:09.000000000 +0000 @@ -43,8 +43,10 @@ echo autopoint honors dataroot variable, not patching. else echo autopoint does not honor dataroot variable, patching. - sed -i -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\ndatadir = @datadir@/g' po/Makefile.in.in - sed -i -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\ndatadir = @datadir@/g' intl/Makefile.in + sed -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\ +datadir = @datadir@/g' po/Makefile.in.in > po/Makefile.in.in.tmp && mv -f po/Makefile.in.in.tmp po/Makefile.in.in + sed -e 's/^datadir *=\(.*\)/datarootdir = @datarootdir@\ +datadir = @datadir@/g' intl/Makefile.in > intl/Makefile.in.tmp && mv -f intl/Makefile.in.tmp intl/Makefile.in fi # if [ -f Makefile -a -x config.status ]; then # CONFIG_FILES=intl/Makefile CONFIG_HEADERS= /bin/sh ./config.status @@ -72,4 +74,3 @@ echo "Running automake --foreign -a -c -f" automake --foreign -a -c -f - diff -ruN -d amule-2.2.0~svn20080218/automake/dist-hook.am amule-2.2.2/automake/dist-hook.am --- amule-2.2.0~svn20080218/automake/dist-hook.am 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/automake/dist-hook.am 2008-02-19 21:59:49.000000000 +0000 @@ -0,0 +1,11 @@ +dist-hook: + for d in $(EXTRA__DIST__SUBDIRS) ; do \ + mkdir $(distdir)/$$d ; \ + for f in `find $(srcdir)/$$d -name '.svn' -prune -o -printf "%P\n"` ; do \ + if test -d $(srcdir)/$$d/$$f ; then \ + mkdir $(distdir)/$$d/$$f ; \ + else \ + cp -p $(srcdir)/$$d/$$f $(distdir)/$$d/$$f ; \ + fi ; \ + done ; \ + done diff -ruN -d amule-2.2.0~svn20080218/automake/manpages.am amule-2.2.2/automake/manpages.am --- amule-2.2.0~svn20080218/automake/manpages.am 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/automake/manpages.am 2008-02-23 13:01:47.000000000 +0000 @@ -0,0 +1,35 @@ +install-data-hook: + @for file in $(SELECTED_MANPAGES); do \ + lang=`echo $$file | sed -e 's/^[^.]*\.//'`; \ + if test $$lang == 1; then \ + echo " $(mkinstalldirs) $(DESTDIR)$(mandir)/man1" ; \ + $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 ; \ + if test -f $(srcdir)/$$file; then name=$(srcdir)/$$file; \ + else name=$$file; fi; \ + inst=`echo $$file | sed -e "s/\.1//" -e '$(transform)'`.1 ; \ + echo " $(INSTALL_DATA) $$name $(DESTDIR)$(mandir)/man1/$$inst" ; \ + $(INSTALL_DATA) $$name $(DESTDIR)$(mandir)/man1/$$inst ; \ + else \ + locale=`echo $$lang | sed -e 's/\..*//'` ; \ + echo " $(mkinstalldirs) $(DESTDIR)$(mandir)/$$locale/man1" ; \ + $(mkinstalldirs) $(DESTDIR)$(mandir)/$$locale/man1 ; \ + if test -f $(srcdir)/$$file; then name=$(srcdir)/$$file; \ + else name=$$file; fi; \ + inst=`echo $$file | sed -e "s/\.$${locale}\.1//" -e '$(transform)'`.1 ; \ + echo " $(INSTALL_DATA) $$name $(DESTDIR)$(mandir)/$$locale/man1/$$inst" ; \ + $(INSTALL_DATA) $$name $(DESTDIR)$(mandir)/$$locale/man1/$$inst ; \ + fi; \ + done + +uninstall-hook: + @for file in $(SELECTED_MANPAGES); do \ + lang=`echo $$file | sed -e 's/^[^.]*\.//'`; \ + if test $$lang == 1; then \ + inst=`echo $$file | sed -e "s/\.1//" -e '$(transform)'`.1 ; \ + rm -f $(DESTDIR)$(mandir)/man1/$$inst ; \ + else \ + locale=`echo $$lang | sed -e 's/\..*//'` ; \ + inst=`echo $$file | sed -e "s/\.$${locale}\.1//" -e '$(transform)'`.1 ; \ + rm -f $(DESTDIR)$(mandir)/$$locale/man1/$$inst ; \ + fi; \ + done diff -ruN -d amule-2.2.0~svn20080218/compile amule-2.2.2/compile --- amule-2.2.0~svn20080218/compile 2008-02-18 06:02:11.000000000 +0000 +++ amule-2.2.2/compile 2008-08-08 13:29:16.000000000 +0000 @@ -1,7 +1,7 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2005-02-03.08 +scriptversion=2005-05-14.22 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # Written by Tom Tromey . @@ -18,7 +18,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff -ruN -d amule-2.2.0~svn20080218/config.guess amule-2.2.2/config.guess --- amule-2.2.0~svn20080218/config.guess 2008-02-18 06:02:15.000000000 +0000 +++ amule-2.2.2/config.guess 2008-08-08 13:29:17.000000000 +0000 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2005-02-10' +timestamp='2005-07-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +17,15 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. @@ -66,11 +68,11 @@ while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -123,7 +125,7 @@ ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -196,55 +198,20 @@ # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amd64:OpenBSD:*:*) - echo x86_64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - cats:OpenBSD:*:*) - echo arm-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - luna88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit 0 ;; + exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -297,40 +264,43 @@ # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe - exit 0 ;; + exit ;; *:OS400:*:*) echo powerpc-ibm-os400 - exit 0 ;; + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -338,32 +308,32 @@ else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 - exit 0 ;; + exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -372,10 +342,10 @@ esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -387,10 +357,10 @@ echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -401,40 +371,40 @@ # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -458,32 +428,33 @@ exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -499,29 +470,29 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -529,7 +500,7 @@ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -544,14 +515,18 @@ exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then @@ -565,28 +540,28 @@ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -648,9 +623,19 @@ esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -658,11 +643,11 @@ fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -690,161 +675,166 @@ exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; + exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; + exit ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; + exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; amd64:CYGWIN*:*:*) echo x86_64-unknown-cygwin - exit 0 ;; + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit 0 ;; + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu - exit 0 ;; + exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu - exit 0 ;; + exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu - exit 0 ;; + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -862,7 +852,7 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -881,14 +871,14 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -902,7 +892,7 @@ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -910,25 +900,25 @@ PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -946,15 +936,15 @@ ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -982,15 +972,18 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -998,27 +991,27 @@ # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:syllable:*:*) + exit ;; + i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable - exit 0 ;; + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -1026,15 +1019,16 @@ else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; + exit ;; M68*:*:R3V[5678]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1126,61 +1120,65 @@ else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in @@ -1188,7 +1186,7 @@ unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1196,25 +1194,25 @@ UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; + exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1225,41 +1223,44 @@ UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; + exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms && exit 0 ;; - I*) echo ia64-dec-vms && exit 0 ;; - V*) echo vax-dec-vms && exit 0 ;; + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix - exit 0 ;; + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1291,7 +1292,7 @@ #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1380,11 +1381,12 @@ } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1393,22 +1395,22 @@ case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1419,7 +1421,9 @@ the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be diff -ruN -d amule-2.2.0~svn20080218/config.h.in amule-2.2.2/config.h.in --- amule-2.2.0~svn20080218/config.h.in 2008-02-18 06:01:29.000000000 +0000 +++ amule-2.2.2/config.h.in 2008-08-08 13:29:03.000000000 +0000 @@ -31,10 +31,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H +/* Define to 1 if you have the header which declares + abi::__cxa_demangle() */ +#undef HAVE_CXXABI + /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_R + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H @@ -45,6 +53,13 @@ /* Define to 1 if you have the `endpwent' function. */ #undef HAVE_ENDPWENT +/* Define to 1 if you have the header which declares backtrace() + */ +#undef HAVE_EXECINFO + +/* Define to 1 if you have the fallocate() function. */ +#undef HAVE_FALLOCATE + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H @@ -90,8 +105,8 @@ /* Define to 1 if you have the `getmntent' function. */ #undef HAVE_GETMNTENT -/* Define to 1 if you have the `getmntinfo' function. */ -#undef HAVE_GETMNTINFO +/* Define to 1 if you have the `getopt_long' function. */ +#undef HAVE_GETOPT_LONG /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE @@ -201,6 +216,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NL_TYPES_H +/* Define to 1 if you have posix_fallocate() and it should be used. */ +#undef HAVE_POSIX_FALLOCATE + /* Define to 1 if you have the `pow' function. */ #undef HAVE_POW @@ -285,6 +303,9 @@ /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME @@ -307,9 +328,18 @@ */ #undef HAVE_SYS_DIR_H +/* Define to 1 if you have the SYS_fallocate syscall number. */ +#undef HAVE_SYS_FALLOCATE + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MNTENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MNTTAB_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H @@ -445,6 +475,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + /* Define if you want GeoIP support. */ #undef SUPPORT_GEOIP diff -ruN -d amule-2.2.0~svn20080218/config.sub amule-2.2.2/config.sub --- amule-2.2.0~svn20080218/config.sub 2008-02-18 06:02:15.000000000 +0000 +++ amule-2.2.2/config.sub 2008-08-08 13:29:17.000000000 +0000 @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2005-02-10' +timestamp='2005-07-08' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +21,15 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -83,11 +84,11 @@ while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +100,7 @@ *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -231,6 +232,7 @@ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ @@ -246,6 +248,7 @@ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ @@ -254,15 +257,17 @@ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | ms1 \ | msp430 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ @@ -271,6 +276,9 @@ | z8k) basic_machine=$basic_machine-unknown ;; + m32c) + basic_machine=$basic_machine-unknown + ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -298,7 +306,7 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ - | bs2000-* \ + | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ @@ -319,6 +327,7 @@ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ @@ -327,6 +336,7 @@ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ + | ms1-* \ | msp430-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ @@ -334,9 +344,10 @@ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ @@ -348,6 +359,8 @@ | ymp-* \ | z8k-*) ;; + m32c-*) + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -758,9 +771,8 @@ basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff ;; os400) basic_machine=powerpc-ibm @@ -1086,12 +1098,9 @@ we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; @@ -1178,7 +1187,8 @@ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1196,7 +1206,7 @@ os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) @@ -1385,6 +1395,9 @@ *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; @@ -1556,7 +1569,7 @@ esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff -ruN -d amule-2.2.0~svn20080218/configure amule-2.2.2/configure --- amule-2.2.0~svn20080218/configure 2008-02-18 06:01:32.000000000 +0000 +++ amule-2.2.2/configure 2008-08-08 13:29:04.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for aMule SVN. +# Generated by GNU Autoconf 2.59 for aMule 2.2.2. # # Report bugs to . # @@ -269,8 +269,8 @@ # Identity of this package. PACKAGE_NAME='aMule' PACKAGE_TARNAME='amule' -PACKAGE_VERSION='SVN' -PACKAGE_STRING='aMule SVN' +PACKAGE_VERSION='2.2.2' +PACKAGE_STRING='aMule 2.2.2' PACKAGE_BUGREPORT='admin@amule.org' ac_unique_file="src/amule.cpp" @@ -311,7 +311,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT RESOLV_LIB X11LIBS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP BUILD_CC ac_ct_BUILD_CC EXEEXT BUILD_EXEEXT BUILD_CPPFLAGS BUILD_CFLAGS BUILD_LDFLAGS EGREP LEX LEXLIB LEX_OUTPUT_ROOT RANLIB ac_ct_RANLIB YACC AR ac_ct_AR LD ac_ct_LD GDLIB_CONFIG_PATH GDLIB_CPPFLAGS GDLIB_CFLAGS GDLIB_CXXFLAGS GDLIB_LDFLAGS GDLIB_CFLAGS_ONLY GDLIB_CXXFLAGS_ONLY GDLIB_LIBS GDLIB_LIBS_STATIC GDLIB_VERSION CAS_DEFS LIBPNG_CONFIG_PATH LIBPNG_CFLAGS LIBPNG_CXXFLAGS LIBPNG_LDFLAGS LIBPNG_LIBS AMULEWEB_DEFS GEOIP_INCLUDE GEOIP_LIB WX_CONFIG_PATH WX_CPPFLAGS WX_CFLAGS WX_CXXFLAGS WX_CFLAGS_ONLY WX_CXXFLAGS_ONLY WX_LIBS WX_LIBS_STATIC WX_VERSION_FULL WX_RESCOMP WX_VERSION_MAJOR WX_VERSION_MINOR WX_UNICODE WX_DEBUG WX_SHARED WX_PORT RC ac_ct_RC RCFLAGS CRYPTO_PP_PREFIX CRYPTO_PP_VERSION_STRING CRYPTO_PP_VERSION_NUMBER CRYPTO_PP_STYLE CRYPTO_PP_LIB_NAME CRYPTO_PP_INCLUDE_PREFIX CRYPTO_PP_CXXFLAGS CRYPTO_PP_LDFLAGS CRYPTOLIBS BFD_FLAGS BFD_LIB HAVE_GETTEXT HAVE_FLEX_EXTENDED ALLOCA MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE GLIBC21 LIBICONV LTLIBICONV INTLBISON USE_NLS BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT INTLOBJS DATADIRNAME INSTOBJEXT GENCAT INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIBOBJS POW_LIB WXBASE_LIBS WXBASE_CFLAGS WXBASE_CXXFLAGS docdir SVNDATE WEB_TRUE WEB_FALSE ED2K_TRUE ED2K_FALSE CAS_TRUE CAS_FALSE WXCAS_TRUE WXCAS_FALSE ALC_TRUE ALC_FALSE ALCC_TRUE ALCC_FALSE AMULE_GUI_TRUE AMULE_GUI_FALSE AMULE_DAEMON_TRUE AMULE_DAEMON_FALSE COMPILE_CMD_TRUE COMPILE_CMD_FALSE MONOLITHIC_TRUE MONOLITHIC_FALSE ENABLE_UPNP_TRUE ENABLE_UPNP_FALSE ENABLE_IP2COUNTRY_TRUE ENABLE_IP2COUNTRY_FALSE SYS_WIN32_TRUE SYS_WIN32_FALSE NEED_RC_TRUE NEED_RC_FALSE NEED_CORESERVICES_TRUE NEED_CORESERVICES_FALSE COMPILE_NLS_TRUE COMPILE_NLS_FALSE GENERATE_FLEX_HEADER_TRUE GENERATE_FLEX_HEADER_FALSE READLINE_LIBS ccache CCACHE ccache_prefix LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os RESOLV_LIB X11LIBS MULECPPFLAGS MULECFLAGS MULECXXFLAGS MULELDFLAGS MULERCFLAGS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP BUILD_CC ac_ct_BUILD_CC EXEEXT BUILD_EXEEXT BUILD_CPPFLAGS BUILD_CFLAGS BUILD_LDFLAGS EGREP LEX LEXLIB LEX_OUTPUT_ROOT RANLIB ac_ct_RANLIB YACC AR ac_ct_AR LD ac_ct_LD ZLIB_CPPFLAGS ZLIB_LDFLAGS ZLIB_LIBS GDLIB_CONFIG_PATH GDLIB_CFLAGS GDLIB_LDFLAGS GDLIB_LIBS CAS_DEFS REGEX_LIBS LIBPNG_CONFIG_PATH LIBPNG_CFLAGS LIBPNG_LDFLAGS LIBPNG_LIBS AMULEWEB_DEFS GEOIP_CPPFLAGS GEOIP_LDFLAGS GEOIP_LIBS WX_CONFIG_PATH WX_CPPFLAGS WX_CFLAGS WX_CXXFLAGS WX_CFLAGS_ONLY WX_CXXFLAGS_ONLY WX_LIBS WX_LIBS_STATIC WX_VERSION_FULL WX_RESCOMP WX_VERSION_MAJOR WX_VERSION_MINOR WX_UNICODE WX_DEBUG WX_SHARED WX_PORT WXBASE_LIBS WXBASE_CPPFLAGS RC RCFLAGS ac_ct_RC PKG_CONFIG ac_pt_PKG_CONFIG LIBUPNP_CPPFLAGS LIBUPNP_CFLAGS LIBUPNP_LDFLAGS LIBUPNP_LIBS CRYPTOPP_CPPFLAGS CRYPTOPP_LDFLAGS CRYPTOPP_LIBS BFD_CPPFLAGS BFD_LIBS ALLOCA LIBOBJS POW_LIB MKINSTALLDIRS MSGFMT GMSGFMT XGETTEXT MSGMERGE GLIBC21 LIBICONV LTLIBICONV INTLBISON USE_NLS BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT INTLOBJS DATADIRNAME INSTOBJEXT GENCAT INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB AMULE_DAEMON_MANPAGES AMULECMD_MANPAGES WEB_MANPAGES AMULE_GUI_MANPAGES CAS_MANPAGES WXCAS_MANPAGES ED2K_MANPAGES ALC_MANPAGES ALCC_MANPAGES MONOLITHIC_MANPAGES INCINTL docdir SVNDATE WEB_TRUE WEB_FALSE ED2K_TRUE ED2K_FALSE CAS_TRUE CAS_FALSE WXCAS_TRUE WXCAS_FALSE ALC_TRUE ALC_FALSE ALCC_TRUE ALCC_FALSE AMULE_GUI_TRUE AMULE_GUI_FALSE AMULE_DAEMON_TRUE AMULE_DAEMON_FALSE COMPILE_CMD_TRUE COMPILE_CMD_FALSE MONOLITHIC_TRUE MONOLITHIC_FALSE ENABLE_UPNP_TRUE ENABLE_UPNP_FALSE ENABLE_IP2COUNTRY_TRUE ENABLE_IP2COUNTRY_FALSE SYS_WIN32_TRUE SYS_WIN32_FALSE NEED_RC_TRUE NEED_RC_FALSE NEED_CORESERVICES_TRUE NEED_CORESERVICES_FALSE COMPILE_NLS_TRUE COMPILE_NLS_FALSE GENERATE_FLEX_HEADER_TRUE GENERATE_FLEX_HEADER_FALSE READLINE_LIBS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -788,6 +788,14 @@ ac_env_RC_value=$RC ac_cv_env_RC_set=${RC+set} ac_cv_env_RC_value=$RC +ac_env_RCFLAGS_set=${RCFLAGS+set} +ac_env_RCFLAGS_value=$RCFLAGS +ac_cv_env_RCFLAGS_set=${RCFLAGS+set} +ac_cv_env_RCFLAGS_value=$RCFLAGS +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG # # Report the --help message. @@ -796,7 +804,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures aMule SVN to adapt to many kinds of systems. +\`configure' configures aMule 2.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -866,7 +874,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of aMule SVN:";; + short | recursive ) echo "Configuration of aMule 2.2.2:";; esac cat <<\_ACEOF @@ -877,11 +885,6 @@ (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-ccache enable ccache support for fast recompilation - --disable-debug disable additional debugging output - --enable-optimize enable code optimizing - --enable-profile enable code profiling - --enable-static produce a statically linked executable --disable-monolithic disable building of the monolithic aMule app --enable-amule-daemon compile aMule daemon version --enable-amulecmd compile aMule command line client @@ -896,6 +899,11 @@ --enable-geoip compile with GeoIP IP2Country library --disable-rpath do not hardcode runtime library paths --disable-nls do not use Native Language Support + --disable-debug disable additional debugging output + --enable-optimize enable code optimization + --enable-profile enable code profiling + --enable-static produce a statically linked executable + --enable-ccache enable ccache support for fast recompilation Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -904,32 +912,17 @@ GeoIP include files location --with-geoip-lib=DIR GeoIP library location --with-geoip-static Explicitly link GeoIP statically (default=no) - --with-denoise-level= - Specifies denoising level (0-4): - 0 - Do nothing - 4 - Suppress all normal output - (for more information see - src/utils/scripts/denoiser.rules) - --without-gnu-malloc Don't assume that we use GNU libc compatible malloc/realloc when cross-compiling - --with-language= Specify a comma-separated list of Languages you want - to have installed - See po/LINGUAS.in for aviable languages - --with-zlib=PREFIX use zlib in PREFIX --with-gdlib-prefix=PREFIX - prefix where gdlib is installed - --with-gdlib-exec-prefix=PREFIX - exec prefix where gdlib is installed + prefix where gdlib is installed (optional) --with-gdlib-config=CONFIG - gdlib-config script to use + gdlib-config script to use (optional) --with-libpng-prefix=PREFIX - prefix where libpng is installed - --with-libpng-exec-prefix=PREFIX - exec prefix where libpng is installed + prefix where libpng is installed (optional) --with-libpng-config=CONFIG - libpng-config script to use + libpng-config script to use (optional) --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH --with-wx-config=CONFIG wx-config script to use (optional) --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional) @@ -943,15 +936,27 @@ even if --disable-debug is given (default is auto) --with-wxversion Build against a specific version of wxWidgets (default is auto) + --with-libupnp-prefix=PREFIX + UPnP library location --with-crypto-prefix=PREFIX prefix where crypto++ is installed --with-x use the X Window System + --with-language= Specify a comma-separated list of languages you want + to have installed. See po/LINGUAS for available + languages --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-included-gettext use the GNU gettext library included here --with-libintl-prefix=DIR search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir + --with-denoise-level= + Specifies denoising level (0-4): + 0 - Do nothing + 4 - Suppress all normal output + (for more information see + src/utils/scripts/denoiser.rules) + --with-ccache-prefix=PREFIX prefix where ccache is installed @@ -966,7 +971,9 @@ CC C compiler command CFLAGS C compiler flags CPP C preprocessor - RC Win32 Resource Compiler + RC Resource Compiler + RCFLAGS Resource Compiler Flags + PKG_CONFIG path to pkg-config utility Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1067,7 +1074,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -aMule configure SVN +aMule configure 2.2.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1081,7 +1088,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by aMule $as_me SVN, which was +It was created by aMule $as_me 2.2.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1417,6 +1424,7 @@ +am__api_version="1.9" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -1442,61 +1450,6 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1778,7 +1731,7 @@ # Define the identity of the package. PACKAGE='amule' - VERSION='SVN' + VERSION='2.2.2' cat >>confdefs.h <<_ACEOF @@ -1937,45 +1890,125 @@ -# Removing -fomit since it causes problems with CryptoPP -CFLAGS="`echo $CFLAGS | sed "s/-fomit-frame-pointer//g"`" -CXXFLAGS="`echo $CXXFLAGS | sed "s/-fomit-frame-pointer//g"`" +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } -# System detection, need AC_CANONICAL_HOST -case "${host_os}" in -"") - SYS=unknown - ;; -darwin*) - SYS=darwin - CFLAGS="${CFLAGS} -no-cpp-precomp -D_INTL_REDIRECT_MACROS -DNOPCH"; - LDFLAGS="$LDFLAGS -bind_at_load" - touch src/Scanner.cpp - ;; -openbsd*) - SYS=openbsd - LIBS="$LIBS -L/usr/local/lib" - X11LIBS="-lX11 -L/usr/X11R6/lib" - CXXFLAGS=" $CXXFLAGS -D__OPENBSD__" - if test "$DEBUG_FLAGS" != ""; then - DEBUG_FLAGS="-Wall -g -fno-inline -D__DEBUG__" - fi - ;; -*cygwin* | *mingw32*) - SYS=win32 - CFLAGS="$CFLAGS -DNOMINMAX" - CXXFLAGS="$CXXFLAGS -DNOMINMAX" - ;; -solaris*) - RESOLV_LIB="-lresolv -lnsl" - X11LIBS="-lX11" - LIBS="$LIBS -lrt" -esac +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -# Checks for programs. + case "${host_os}" in + darwin*) + SYS=darwin + MULECPPFLAGS="-no-cpp-precomp -D_INTL_REDIRECT_MACROS -DNOPCH"; + MULELDFLAGS="-bind_at_load" + touch src/Scanner.cpp + ;; + openbsd*) + SYS=openbsd + LIBS="$LIBS -L/usr/local/lib" + X11LIBS="-lX11 -L/usr/X11R6/lib" + MULECPPFLAGS="-D__OPENBSD__" + ;; + *cygwin* | *mingw32*) + SYS=win32 + MULECPPFLAGS="-DNOMINMAX" + ;; + solaris*) + SYS=solaris + RESOLV_LIB="-lresolv -lnsl" + X11LIBS="-lX11" + LIBS="$LIBS -lrt" + ;; + *netbsd*) + SYS=netbsd + # Now this is against autoconf recommendation that configure should not modify CPPFLAGS and LDFLAGS + # However, these values in NetBSD are required even to run the tests, and this is the easiest way to do it. + # Still, we prepend them, instead of adding, so the user may override them. + CPPFLAGS="-I/usr/pkg/include $CPPFLAGS" + LDFLAGS="-R/usr/pkg/lib -L/usr/pkg/lib $LDFLAGS" + ;; + *) + SYS=unknown + ;; + esac + + # -lpthread is needed by Debian but FreeBSD < 5 doesn't support it + if test ${SYS:-unknown} != win32; then + + echo "$as_me:$LINENO: checking if this is a FreeBSD 4 or earlier system" >&5 +echo $ECHO_N "checking if this is a FreeBSD 4 or earlier system... $ECHO_C" >&6 + if test x"`uname -s`" = xFreeBSD && test 0`uname -r | cut -c 1` -lt 5; then + + MULELDFLAGS="$MULELDFLAGS -pthread" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + + MULELDFLAGS="$MULELDFLAGS -lpthread" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi + + +fi + + + + +mule_backup_CFLAGS="$CFLAGS" +mule_backup_CXXFLAGS="$CXXFLAGS" +mule_backup_BUILD_CFLAGS="$BUILD_CFLAGS" ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4008,49 +4041,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test x$SYS = xwin32; then - for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -fi - if test "$cross_compiling" = yes; then ac_build_prefix= test -n "$build_alias" && ac_build_prefix=$build_alias- @@ -4562,6 +4552,49 @@ BUILD_CC="$CC" ; BUILD_EXEEXT=$EXEEXT fi +CFLAGS="$mule_backup_CFLAGS" +CXXFLAGS="$mule_backup_CXXFLAGS" +BUILD_CFLAGS="$mule_backup_BUILD_CFLAGS" +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then @@ -5082,8 +5115,6 @@ test -n "$YACC" || YACC="yacc" -# Find the right ranlib, even when cross-compiling -# And for some other tools for cross compilation if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 @@ -5401,49 +5432,6 @@ fi -# -# Add args to configure -# -# Check whether --enable-ccache or --disable-ccache was given. -if test "${enable_ccache+set}" = set; then - enableval="$enable_ccache" - ccache=$enableval -else - ccache=no -fi; - -# Check whether --enable-debug or --disable-debug was given. -if test "${enable_debug+set}" = set; then - enableval="$enable_debug" - USE_DEBUG=$enableval -else - USE_DEBUG=yes -fi; - -# Check whether --enable-optimize or --disable-optimize was given. -if test "${enable_optimize+set}" = set; then - enableval="$enable_optimize" - USE_OPTIMIZE=$enableval -else - USE_OPTIMIZE=no -fi; - -# Check whether --enable-profile or --disable-profile was given. -if test "${enable_profile+set}" = set; then - enableval="$enable_profile" - USE_PROFILE=$enableval -else - USE_PROFILE=no -fi; - -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - USE_DEBUG_STATIC=$enableval -else - USE_DEBUG_STATIC=no -fi; - # Check whether --enable-monolithic or --disable-monolithic was given. if test "${enable_monolithic+set}" = set; then enableval="$enable_monolithic" @@ -5463,9 +5451,9 @@ # Check whether --enable-amulecmd or --disable-amulecmd was given. if test "${enable_amulecmd+set}" = set; then enableval="$enable_amulecmd" - BUILDAMULECMD=$enableval + AMULECMD=$enableval else - BUILDAMULECMD=no + AMULECMD=no fi; # Check whether --enable-webserver or --disable-webserver was given. @@ -5547,19 +5535,23 @@ else ENABLE_IP2COUNTRY=no fi; +if test ${ENABLE_IP2COUNTRY:-no} = yes; then + GEOIP_LIBS="-lGeoIP" +fi + # Check whether --with-geoip-headers or --without-geoip-headers was given. if test "${with_geoip_headers+set}" = set; then withval="$with_geoip_headers" - GEOIP_INCLUDE="-I$withval" + GEOIP_CPPFLAGS="-I$withval" fi; # Check whether --with-geoip-lib or --without-geoip-lib was given. if test "${with_geoip_lib+set}" = set; then withval="$with_geoip_lib" - GEOIP_LIB="-L$withval $GEOIP_LIB" + GEOIP_LDFLAGS="-L$withval" fi; @@ -5567,19 +5559,13 @@ if test "${with_geoip_static+set}" = set; then withval="$with_geoip_static" if test "$withval" != "no"; then - GEOIP_LIB="-Wl,-Bstatic $GEOIP_LIB -Wl,-Bdynamic" - fi -fi; - + GEOIP_LIBS="-Wl,-Bstatic $GEOIP_LIBS -Wl,-Bdynamic" +fi -# Check whether --with-denoise-level or --without-denoise-level was given. -if test "${with_denoise_level+set}" = set; then - withval="$with_denoise_level" - denoiselevel="$withval" -else - denoiselevel=yes fi; +# Default is yes, because they're most likely compatible. +# However, this is only used when cross-compiling. # Check whether --with-gnu-malloc or --without-gnu-malloc was given. if test "${with_gnu_malloc+set}" = set; then @@ -5590,20 +5576,9 @@ fi; -# Check whether --with-language or --without-language was given. -if test "${with_language+set}" = set; then - withval="$with_language" - SelectedLangs="$withval" -else - SelectedLangs=all -fi; - # Checking for libs before all other stuff to break # configure as soon as possible in case of a missing one -# to avoid losing to much time - -# Sets gettext version. - +# to avoid losing too much time # Check for zlib @@ -5611,42 +5586,47 @@ # Check whether --with-zlib or --without-zlib was given. if test "${with_zlib+set}" = set; then withval="$with_zlib" - ac_zlib="$withval" -else - ac_zlib=yes -fi; +fi; -ac_zver_max="1" -ac_zver_mid="1" -ac_zver_min="4" - -case "$ac_zlib" in -no) - { { echo "$as_me:$LINENO: error: zlib >= 1.1.4 is required for aMule" >&5 + case "${with_zlib:-yes}" in + no) + { { echo "$as_me:$LINENO: error: zlib >= 1.1.4 is required for aMule" >&5 echo "$as_me: error: zlib >= 1.1.4 is required for aMule" >&2;} { (exit 1); exit 1; }; } - ;; -yes | sys) - ;; -*) - ac_zlib_prefix="$ac_zlib" -esac + ;; + yes | sys) + ;; + *) + zlib_prefix="$with_zlib" + esac + + mule_backup_CPPFLAGS="$CPPFLAGS" + mule_backup_LDFLAGS="$LDFLAGS" + mule_backup_LIBS="$LIBS" + if test -n "$zlib_prefix"; then + + ZLIB_CPPFLAGS="-I$zlib_prefix/include" + ZLIB_LDFLAGS="-L$zlib_prefix/lib" + CPPFLAGS="$CPPFLAGS $ZLIB_CPPFLAGS" + LDFLAGS="$LDFLAGS $ZLIB_LDFLAGS" + +else + + ZLIB_CPPFLAGS= + ZLIB_LDFLAGS= + +fi + + ZLIB_LIBS="-lz" + LIBS="$ZLIB_LIBS $LIBS" - if test -n "$ac_zlib_prefix"; then - ac_tmp_CPPFLAGS="$CPPFLAGS" - ac_tmp_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS -I$ac_zlib_prefix/include" - LDFLAGS="-L$ac_zlib_prefix/lib" - fi - ac_tmp_LIBS="$LIBS" - LIBS="-lz $LIBS" echo "$as_me:$LINENO: checking for zlib >= 1.1.4" >&5 echo $ECHO_N "checking for zlib >= 1.1.4... $ECHO_C" >&6 if test "$cross_compiling" = yes; then result=no - z_version='' + z_version= cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -5656,12 +5636,13 @@ /* end confdefs.h. */ #include + #include int main () { - const char zver[] = "\nZLIB_VERSION_START" ZLIB_VERSION "ZLIB_VERSION_END\n"; + printf("\nZLIB_VERSION_START" ZLIB_VERSION "ZLIB_VERSION_END\n\n"); zlibVersion(); ; @@ -5693,23 +5674,29 @@ (exit $ac_status); }; }; then ZLIB_VERSION=`grep -a '^ZLIB_VERSION_START.*ZLIB_VERSION_END$' conftest$ac_exeext | sed 's/^ZLIB_VERSION_START\(.*\)ZLIB_VERSION_END$/\1/'` - ac_cross_zver_max="`echo $ZLIB_VERSION | cut -d. -f1`" - ac_cross_zver_mid="`echo $ZLIB_VERSION | cut -d. -f2`" - ac_cross_zver_min="`echo $ZLIB_VERSION | cut -d. -f3`" - if test "$ac_cross_zver_max" -gt "$ac_zver_max"; then - result=yes - elif test "$ac_cross_zver_max" -eq "$ac_zver_max"; then - if test "$ac_cross_zver_mid" -gt "$ac_zver_mid"; then - result=yes - elif "$ac_cross_zver_mid" -eq "$ac_zver_mid"; then - if test "$ac_cross_zver_min" -ge "$ac_zver_min"; then - result=yes - fi - fi - fi - if test x$result = xyes; then - z_version=" (version $ZLIB_VERSION)" - fi + cross_zver_max="`echo $ZLIB_VERSION | cut -d. -f1`" + cross_zver_mid="`echo $ZLIB_VERSION | cut -d. -f2`" + cross_zver_min="`echo $ZLIB_VERSION | cut -d. -f3`" + if test "$cross_zver_max" -gt "1"; then + result=yes +elif test "$cross_zver_max" -eq "1"; then + + if test "$cross_zver_mid" -gt "1"; then + result=yes +elif test "$cross_zver_mid" -eq "1"; then + if test "$cross_zver_min" -ge "4"; then + result=yes +fi + +fi + + +fi + + if test ${result:-no} = yes; then + z_version=" (version $ZLIB_VERSION)" +fi + else echo "$as_me: failed program was:" >&5 @@ -5736,16 +5723,15 @@ int main () { - char *zver = zlibVersion(); FILE *f=fopen("conftestval", "w"); if (!f) return 1; fprintf(f, "%s", - zver[0] > '$ac_zver_max' || - (zver[0] == '$ac_zver_max' && - (zver[2] > '$ac_zver_mid' || - (zver[2] == '$ac_zver_mid' && - zver[4] >= '$ac_zver_min'))) ? "yes" : "no"); + zver[0] > '1' || + (zver[0] == '1' && + (zver[2] > '1' || + (zver[2] == '1' && + zver[4] >= '4'))) ? "yes" : "no"); fclose(f); f=fopen("conftestver", "w"); if (f) { @@ -5771,18 +5757,25 @@ (exit $ac_status); }; }; then if test -f conftestval; then - result=`cat conftestval` - else - result=no - fi - if test x$result = xyes; then + result=`cat conftestval` +else + result=no +fi + + if test ${result:-no} = yes; then + if test -f conftestver; then + ZLIB_VERSION=`cat conftestver` z_version=" (version $ZLIB_VERSION)" - else - z_version="" - fi - fi + +else + z_version= +fi + + +fi + echo "$as_me:$LINENO: result: $result$z_version" >&5 echo "${ECHO_T}$result$z_version" >&6 @@ -5800,51 +5793,28 @@ fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - if test x$result = xno; then - if test "${ac_tmp_CPPFLAGS+set}" = set; then - CPPFLAGS="$ac_tmp_CPPFLAGS" - fi - if test "${ac_tmp_LDFLAGS+set}" = set; then - LDFLAGS="$ac_tmp_LDFLAGS" - fi - LIBS="$ac_tmp_LIBS" + + CPPFLAGS="$mule_backup_CPPFLAGS" + LDFLAGS="$mule_backup_LDFLAGS" + LIBS="$mule_backup_LIBS" + + if test ${result:-no} = no; then + + ZLIB_CPPFLAGS= + ZLIB_LDFLAGS= + ZLIB_LIBS= { { echo "$as_me:$LINENO: error: zlib >= 1.1.4 is required for aMule" >&5 echo "$as_me: error: zlib >= 1.1.4 is required for aMule" >&2;} { (exit 1); exit 1; }; } - else - : - fi +fi -if test x$CAS = xyes -o x$WEB = xyes; then -# Check for gd -# Check whether --with-gdlib-prefix or --without-gdlib-prefix was given. -if test "${with_gdlib_prefix+set}" = set; then - withval="$with_gdlib_prefix" - gdlib_config_prefix="$withval" -else - gdlib_config_prefix="" -fi; - -# Check whether --with-gdlib-exec-prefix or --without-gdlib-exec-prefix was given. -if test "${with_gdlib_exec_prefix+set}" = set; then - withval="$with_gdlib_exec_prefix" - gdlib_config_exec_prefix="$withval" -else - gdlib_config_exec_prefix="" -fi; - -# Check whether --with-gdlib-config or --without-gdlib-config was given. -if test "${with_gdlib_config+set}" = set; then - withval="$with_gdlib_config" - gdlib_config_name="$withval" -else - gdlib_config_name="" -fi; +if test x$CAS = xyes; then + # Check for gd echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 @@ -6085,28 +6055,48 @@ - if test x${GDLIB_CONFIG_NAME+set} != xset ; then - GDLIB_CONFIG_NAME=gdlib-config - fi - if test "x$gdlib_config_name" != x ; then - gdlib_CONFIG_NAME="$gdlib_config_name" - fi - if test x$gdlib_config_exec_prefix != x ; then - GDLIB_LOOKUP_PATH="$gdlib_config_exec_prefix/bin" - fi - if test x$gdlib_config_prefix != x ; then - GDLIB_LOOKUP_PATH="$GDLIB_LOOKUP_PATH:$gdlib_config_prefix/bin" - fi +# Check whether --with-gdlib-prefix or --without-gdlib-prefix was given. +if test "${with_gdlib_prefix+set}" = set; then + withval="$with_gdlib_prefix" - if test -x "$GDLIB_CONFIG_NAME" ; then - echo "$as_me:$LINENO: checking for gdlib-config" >&5 +fi; + +# Check whether --with-gdlib-config or --without-gdlib-config was given. +if test "${with_gdlib_config+set}" = set; then + withval="$with_gdlib_config" + +fi; + + GDLIB_VERSION= + + # do we have gdlib-config name: it can be gdlib-config or gd-config or ... + if test x${GDLIB_CONFIG_NAME+set} != xset; then + GDLIB_CONFIG_NAME=gdlib-config +fi + + if test -n "$with_gdlib_config"; then + GDLIB_CONFIG_NAME="$with_gdlib_config" +fi + + + # deal with optional prefix + if test -n "$with_gdlib_prefix"; then + GDLIB_LOOKUP_PATH="$with_gdlib_prefix/bin" +fi + + + # don't search the PATH if GDLIB_CONFIG_NAME is absolute filename + if test -x "$GDLIB_CONFIG_NAME"; then + + echo "$as_me:$LINENO: checking for gdlib-config" >&5 echo $ECHO_N "checking for gdlib-config... $ECHO_C" >&6 - GDLIB_CONFIG_PATH="$GDLIB_CONFIG_NAME" - echo "$as_me:$LINENO: result: $GDLIB_CONFIG_PATH" >&5 + GDLIB_CONFIG_PATH="$GDLIB_CONFIG_NAME" + echo "$as_me:$LINENO: result: $GDLIB_CONFIG_PATH" >&5 echo "${ECHO_T}$GDLIB_CONFIG_PATH" >&6 - else - # Extract the first word of "$GDLIB_CONFIG_NAME", so it can be a program name with args. + +else + # Extract the first word of "$GDLIB_CONFIG_NAME", so it can be a program name with args. set dummy $GDLIB_CONFIG_NAME; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 @@ -6119,7 +6109,7 @@ ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy=""$GDLIB_LOOKUP_PATH:$PATH"" +as_dummy="$GDLIB_LOOKUP_PATH:$PATH" for as_dir in $as_dummy do IFS=$as_save_IFS @@ -6147,77 +6137,62 @@ echo "${ECHO_T}no" >&6 fi - fi +fi - if test "$GDLIB_CONFIG_PATH" != "no" ; then - GDLIB_VERSION="" - no_gdlib="" - min_gdlib_version=2.0.0 - echo "$as_me:$LINENO: checking for gdlib version >= $min_gdlib_version" >&5 -echo $ECHO_N "checking for gdlib version >= $min_gdlib_version... $ECHO_C" >&6 + if test ${GDLIB_CONFIG_PATH:-no} != no; then - GDLIB_CONFIG_WITH_ARGS="$GDLIB_CONFIG_PATH $gdlib_config_args" + echo "$as_me:$LINENO: checking for gdlib version >= 2.0.0" >&5 +echo $ECHO_N "checking for gdlib version >= 2.0.0... $ECHO_C" >&6 + GDLIB_CONFIG_WITH_ARGS="$GDLIB_CONFIG_PATH $gdlib_config_args" - GDLIB_VERSION=`$GDLIB_CONFIG_WITH_ARGS --version` - gdlib_config_major_version=`echo $GDLIB_VERSION | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\1/'` - gdlib_config_minor_version=`echo $GDLIB_VERSION | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\2/'` - gdlib_config_micro_version=`echo $GDLIB_VERSION | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\3/'` + GDLIB_VERSION=`$GDLIB_CONFIG_WITH_ARGS --version` + gdlib_config_major_version=`echo $GDLIB_VERSION | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` + gdlib_config_minor_version=`echo $GDLIB_VERSION | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` + gdlib_config_micro_version=`echo $GDLIB_VERSION | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` - gdlib_requested_major_version=`echo $min_gdlib_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\1/'` - gdlib_requested_minor_version=`echo $min_gdlib_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\2/'` - gdlib_requested_micro_version=`echo $min_gdlib_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\3/'` + gdlib_ver_ok= + if test $gdlib_config_major_version -gt 2; then + gdlib_ver_ok=yes +elif test $gdlib_config_major_version -eq 2; then - gdlib_ver_ok="" - if test $gdlib_config_major_version -gt $gdlib_requested_major_version; then - gdlib_ver_ok=yes - else - if test $gdlib_config_major_version -eq $gdlib_requested_major_version; then - if test $gdlib_config_minor_version -gt $gdlib_requested_minor_version; then - gdlib_ver_ok=yes - else - if test $gdlib_config_minor_version -eq $gdlib_requested_minor_version; then - if test $gdlib_config_micro_version -ge $gdlib_requested_micro_version; then - gdlib_ver_ok=yes - fi - fi - fi - fi - fi + if test $gdlib_config_minor_version -gt 0; then + gdlib_ver_ok=yes +elif test $gdlib_config_minor_version -eq 0; then + if test $gdlib_config_micro_version -ge 0; then + gdlib_ver_ok=yes +fi - if test "x$gdlib_ver_ok" = x ; then - no_gdlib=yes - else - GDLIB_LIBS=`$GDLIB_CONFIG_WITH_ARGS --libs` +fi - if test "x$gdlib_has_cppflags" = x ; then - GDLIB_CFLAGS=`$GDLIB_CONFIG_WITH_ARGS --cflags` - GDLIB_CPPFLAGS=$GDLIB_CFLAGS - GDLIB_CXXFLAGS=$GDLIB_CFLAGS - GDLIB_LDFLAGS=`$GDLIB_CONFIG_WITH_ARGS --ldflags` - GDLIB_CFLAGS_ONLY=$GDLIB_CFLAGS - GDLIB_CXXFLAGS_ONLY=$GDLIB_CFLAGS - else - GDLIB_CPPFLAGS=`$GDLIB_CONFIG_WITH_ARGS --cflags` - GDLIB_CXXFLAGS=`$GDlIB_CONFIG_WITH_ARGS --cflags` - GDLIB_CFLAGS=`$GDLIB_CONFIG_WITH_ARGS --cflags` - GDLIB_LDFLAGS=`$GDLIB_CONFIG_WITH_ARGS --ldflags` - GDLIB_CFLAGS_ONLY=`echo $GDLIB_CFLAGS | sed "s@^$GDLIB_CPPFLAGS *@@"` - GDLIB_CXXFLAGS_ONLY=`echo $GDLIB_CXXFLAGS | sed "s@^$GDLIB_CFLAGS *@@"` - fi - fi +fi - if test "x$no_gdlib" = x ; then - echo "$as_me:$LINENO: result: yes (version $GDLIB_VERSION)" >&5 + + if test -z "$gdlib_ver_ok"; then + + if test -z "$GDLIB_VERSION"; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +else + + echo "$as_me:$LINENO: result: no (version $GDLIB_VERSION is not new enough)" >&5 +echo "${ECHO_T}no (version $GDLIB_VERSION is not new enough)" >&6 + GDLIB_VERSION= + +fi + + +else + + echo "$as_me:$LINENO: result: yes (version $GDLIB_VERSION)" >&5 echo "${ECHO_T}yes (version $GDLIB_VERSION)" >&6 - if test "${ac_cv_header_gd_h+set}" = set; then + GDLIB_CFLAGS="`$GDLIB_CONFIG_WITH_ARGS --cflags`" + GDLIB_LDFLAGS="`$GDLIB_CONFIG_WITH_ARGS --ldflags`" + GDLIB_LIBS="`$GDLIB_CONFIG_WITH_ARGS --libs`" + mule_backup_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $GDLIB_CFLAGS" + if test "${ac_cv_header_gd_h+set}" = set; then echo "$as_me:$LINENO: checking for gd.h" >&5 echo $ECHO_N "checking for gd.h... $ECHO_C" >&6 if test "${ac_cv_header_gd_h+set}" = set; then @@ -6355,247 +6330,82 @@ fi if test $ac_cv_header_gd_h = yes; then - GDLIBFOUND=1 + : +else + GDLIB_VERSION= fi - else - if test "x$GDLIB_VERSION" = x; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - else - echo "$as_me:$LINENO: result: no (version $GDLIB_VERSION is not new enough)" >&5 -echo "${ECHO_T}no (version $GDLIB_VERSION is not new enough)" >&6 - fi - - GDLIB_CFLAGS="" - GDLIB_CPPFLAGS="" - GDLIB_CXXFLAGS="" - GDLIB_LDFLAGS="" - GDLIB_LIBS="" - GDLIB_LIBS_STATIC="" - : - fi - fi - + CFLAGS="$mule_backup_CFLAGS" +fi +fi + if test -n "$GDLIB_VERSION"; then + CAS_DEFS="-D__GD__" + GDLIB_LIBS="-lgd $GDLIB_LIBS" +else + CAS_DEFS= +fi + if test -z "$CAS_DEFS"; then -case "$GDLIBFOUND" in -1) CAS_DEFS="-D__GD__" - GDLIB_LIBS="$GDLIB_LIBS -lgd" - ;; -*){ echo "$as_me:$LINENO: - WARNING: gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found. + { echo "$as_me:$LINENO: WARNING: + gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found. Please check that gdlib-config is in your default path, check out LD_LIBRARY_PATH or equivalent variable. Or this might also be that your gdlib-config has other name. Please try again with --with-gdlib-config=/usr/bin/gdlib-config - (replace /usr/bin/gdlib-config with a valid path to your gdlib-config). - If you use compiled packages check if you have devel pack installed. - To download the latest version check http://www.boutell.com/gd - for sources. - " >&5 -echo "$as_me: - WARNING: gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found. + (replace /usr/bin/gdlib-config with a valid path to your gdlib-config). + If you use compiled packages check if you have devel pack installed. + To download the latest version check http://www.boutell.com/gd + for sources." >&5 +echo "$as_me: WARNING: + gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found. Please check that gdlib-config is in your default path, check out LD_LIBRARY_PATH or equivalent variable. Or this might also be that your gdlib-config has other name. Please try again with --with-gdlib-config=/usr/bin/gdlib-config - (replace /usr/bin/gdlib-config with a valid path to your gdlib-config). - If you use compiled packages check if you have devel pack installed. - To download the latest version check http://www.boutell.com/gd - for sources. - " >&6;} - - CAS_DEFS="" - GDLIB_LIBS="" - GDLIB_CFLAGS="" - GDLIB_LDFLAGS="" - ;; -esac + (replace /usr/bin/gdlib-config with a valid path to your gdlib-config). + If you use compiled packages check if you have devel pack installed. + To download the latest version check http://www.boutell.com/gd + for sources." >&2;} -else - CAS_DEFS="" - GDLIB_LIBS="" - GDLIB_CFLAGS="" - GDLIB_LDFLAGS="" - GDLIB_VERSION="not_needed" fi - - -if test x$WEB = xyes; then -# Check for libpng -# This check _must_ occur *after* the check for gd - - -# Check whether --with-libpng-prefix or --without-libpng-prefix was given. -if test "${with_libpng_prefix+set}" = set; then - withval="$with_libpng_prefix" - libpng_config_prefix="$withval" -else - libpng_config_prefix="" -fi; - -# Check whether --with-libpng-exec-prefix or --without-libpng-exec-prefix was given. -if test "${with_libpng_exec_prefix+set}" = set; then - withval="$with_libpng_exec_prefix" - libpng_config_exec_prefix="$withval" -else - libpng_config_exec_prefix="" -fi; - -# Check whether --with-libpng-config or --without-libpng-config was given. -if test "${with_libpng_config+set}" = set; then - withval="$with_libpng_config" - libpng_config_name="$withval" -else - libpng_config_name="" -fi; - - - - if test x${LIBPNG_CONFIG_NAME+set} != xset ; then - LIBPNG_CONFIG_NAME=libpng-config - fi - if test "x$libpng_config_name" != x ; then - LIBPNG_CONFIG_NAME="$libpng_config_name" - fi - - if test x$libpng_config_exec_prefix != x ; then - LIBPNG_LOOKUP_PATH="$libpng_config_exec_prefix/bin" - fi - if test x$libpng_config_prefix != x ; then - LIBPNG_LOOKUP_PATH="$LIBPNG_LOOKUP_PATH:$libpng_config_prefix/bin" - fi - - if test -x "$LIBPNG_CONFIG_NAME" ; then - echo "$as_me:$LINENO: checking for libpng-config" >&5 -echo $ECHO_N "checking for libpng-config... $ECHO_C" >&6 - LIBPNG_CONFIG_PATH="$LIBPNG_CONFIG_NAME" - echo "$as_me:$LINENO: result: $LIBPNG_CONFIG_PATH" >&5 -echo "${ECHO_T}$LIBPNG_CONFIG_PATH" >&6 - else - # Extract the first word of "$LIBPNG_CONFIG_NAME", so it can be a program name with args. -set dummy $LIBPNG_CONFIG_NAME; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_LIBPNG_CONFIG_PATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $LIBPNG_CONFIG_PATH in - [\\/]* | ?:[\\/]*) - ac_cv_path_LIBPNG_CONFIG_PATH="$LIBPNG_CONFIG_PATH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy=""$LIBPNG_LOOKUP_PATH:$PATH"" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_LIBPNG_CONFIG_PATH="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_LIBPNG_CONFIG_PATH" && ac_cv_path_LIBPNG_CONFIG_PATH="no" - ;; -esac -fi -LIBPNG_CONFIG_PATH=$ac_cv_path_LIBPNG_CONFIG_PATH - -if test -n "$LIBPNG_CONFIG_PATH"; then - echo "$as_me:$LINENO: result: $LIBPNG_CONFIG_PATH" >&5 -echo "${ECHO_T}$LIBPNG_CONFIG_PATH" >&6 else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + GDLIB_VERSION="not_needed" fi - fi - - if test "$LIBPNG_CONFIG_PATH" != "no" ; then - LIBPNG_VERSION="" - no_libpng="" - - min_libpng_version=1.2.0 - echo "$as_me:$LINENO: checking for libpng version >= $min_libpng_version" >&5 -echo $ECHO_N "checking for libpng version >= $min_libpng_version... $ECHO_C" >&6 - - LIBPNG_CONFIG_WITH_ARGS="$LIBPNG_CONFIG_PATH $libpng_config_args" - - LIBPNG_VERSION=`$LIBPNG_CONFIG_WITH_ARGS --version` - libpng_config_major_version=`echo $LIBPNG_VERSION | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\1/'` - libpng_config_minor_version=`echo $LIBPNG_VERSION | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\2/'` - libpng_config_micro_version=`echo $LIBPNG_VERSION | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\3/'` - libpng_requested_major_version=`echo $min_libpng_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\1/'` - libpng_requested_minor_version=`echo $min_libpng_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\2/'` - libpng_requested_micro_version=`echo $min_libpng_version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)\([0-9|a-z]*\)/\3/'` - libpng_ver_ok="" - if test $libpng_config_major_version -gt $libpng_requested_major_version; then - libpng_ver_ok=yes - else - if test $libpng_config_major_version -eq $libpng_requested_major_version; then - if test $libpng_config_minor_version -gt $libpng_requested_minor_version; then - libpng_ver_ok=yes - else - if test $libpng_config_minor_version -eq $libpng_requested_minor_version; then - if test $libpng_config_micro_version -ge $libpng_requested_micro_version; then - libpng_ver_ok=yes - fi - fi - fi - fi - fi +if test x$WEB = xyes; then - if test "x$libpng_ver_ok" = x ; then - no_libpng=yes - else - LIBPNG_LIBS=`$LIBPNG_CONFIG_WITH_ARGS --libs` - LIBPNG_LDFLAGS=`$LIBPNG_CONFIG_WITH_ARGS --ldflags` - LIBPNG_CFLAGS=`$LIBPNG_CONFIG_WITH_ARGS --cflags` - LIBPNG_CXXFLAGS=$LIBPNG_CFLAGS - fi - if test "x$no_libpng" = x ; then - echo "$as_me:$LINENO: result: yes (version $LIBPNG_VERSION)" >&5 -echo "${ECHO_T}yes (version $LIBPNG_VERSION)" >&6 - if test "${ac_cv_header_gd_h+set}" = set; then - echo "$as_me:$LINENO: checking for gd.h" >&5 -echo $ECHO_N "checking for gd.h... $ECHO_C" >&6 -if test "${ac_cv_header_gd_h+set}" = set; then +for ac_header in sys/types.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_gd_h" >&5 -echo "${ECHO_T}$ac_cv_header_gd_h" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? -echo "$as_me:$LINENO: checking gd.h usability" >&5 -echo $ECHO_N "checking gd.h usability... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6603,7 +6413,7 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -6639,15 +6449,15 @@ echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? -echo "$as_me:$LINENO: checking gd.h presence" >&5 -echo $ECHO_N "checking gd.h presence... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -6681,25 +6491,25 @@ # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: gd.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: gd.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: gd.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: gd.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: gd.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: gd.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: gd.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: gd.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: gd.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: gd.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: gd.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: gd.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: gd.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: gd.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: gd.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: gd.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------ ## @@ -6710,51 +6520,263 @@ sed "s/^/$as_me: WARNING: /" >&2 ;; esac -echo "$as_me:$LINENO: checking for gd.h" >&5 -echo $ECHO_N "checking for gd.h... $ECHO_C" >&6 -if test "${ac_cv_header_gd_h+set}" = set; then +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_gd_h=$ac_header_preproc + eval "$as_ac_Header=\$ac_header_preproc" fi -echo "$as_me:$LINENO: result: $ac_cv_header_gd_h" >&5 -echo "${ECHO_T}$ac_cv_header_gd_h" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi -if test $ac_cv_header_gd_h = yes; then - LIBPNGFOUND=1 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi +done - else - if test "x$LIBPNG_VERSION" = x; then - echo "$as_me:$LINENO: result: no" >&5 + echo "$as_me:$LINENO: checking for a POSIX compliant regex library" >&5 +echo $ECHO_N "checking for a POSIX compliant regex library... $ECHO_C" >&6 + regex_found=no + for REGEX_LIBS in '' -lgnurx -lregex; do + mule_backup_LIBS="$LIBS" + LIBS="$REGEX_LIBS $LIBS" + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #ifdef HAVE_SYS_TYPES_H + # include + #endif + #include + +int +main () +{ + + regex_t preg; + regcomp(&preg, "", REG_EXTENDED); + regmatch_t *pmatch; + regexec(&preg, "", 0, pmatch, 0); + regfree(&preg); + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + LIBS="$mule_backup_LIBS" + regex_found=yes + break; + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +LIBS="$mule_backup_LIBS" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + echo "$as_me:$LINENO: result: $regex_found" >&5 +echo "${ECHO_T}$regex_found" >&6 + if test $regex_found = yes; then + : +else + WEB=disabled +fi + + +fi + +if test x$WEB = xyes; then + + +# Check whether --with-libpng-prefix or --without-libpng-prefix was given. +if test "${with_libpng_prefix+set}" = set; then + withval="$with_libpng_prefix" + +fi; + +# Check whether --with-libpng-config or --without-libpng-config was given. +if test "${with_libpng_config+set}" = set; then + withval="$with_libpng_config" + +fi; + + LIBPNG_VERSION= + + # do we have libpng-config name: it can be libpng-config or libpng12-config or ... + if test x${LIBPNG_CONFIG_NAME+set} != xset; then + LIBPNG_CONFIG_NAME=libpng-config +fi + + if test -n "$with_libpng_config"; then + LIBPNG_CONFIG_NAME="$with_libpng_config" +fi + + + # deal with optional prefix + if test -n "$with_libpng_prefix"; then + LIBPNG_LOOKUP_PATH="$with_libpng_prefix/bin" +fi + + + # don't search the PATH if LIBPNG_CONFIG_NAME is absolute filename + if test -x "$LIBPNG_CONFIG_NAME"; then + + echo "$as_me:$LINENO: checking for libpng-config" >&5 +echo $ECHO_N "checking for libpng-config... $ECHO_C" >&6 + LIBPNG_CONFIG_PATH="$LIBPNG_CONFIG_NAME" + echo "$as_me:$LINENO: result: $LIBPNG_CONFIG_PATH" >&5 +echo "${ECHO_T}$LIBPNG_CONFIG_PATH" >&6 + +else + # Extract the first word of "$LIBPNG_CONFIG_NAME", so it can be a program name with args. +set dummy $LIBPNG_CONFIG_NAME; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_LIBPNG_CONFIG_PATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $LIBPNG_CONFIG_PATH in + [\\/]* | ?:[\\/]*) + ac_cv_path_LIBPNG_CONFIG_PATH="$LIBPNG_CONFIG_PATH" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$LIBPNG_LOOKUP_PATH:$PATH" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LIBPNG_CONFIG_PATH="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_LIBPNG_CONFIG_PATH" && ac_cv_path_LIBPNG_CONFIG_PATH="no" + ;; +esac +fi +LIBPNG_CONFIG_PATH=$ac_cv_path_LIBPNG_CONFIG_PATH + +if test -n "$LIBPNG_CONFIG_PATH"; then + echo "$as_me:$LINENO: result: $LIBPNG_CONFIG_PATH" >&5 +echo "${ECHO_T}$LIBPNG_CONFIG_PATH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - else - echo "$as_me:$LINENO: result: no (version $LIBPNG_VERSION is not new enough)" >&5 +fi + +fi + + + if test ${LIBPNG_CONFIG_PATH:-no} != no; then + + echo "$as_me:$LINENO: checking for libpng version >= 1.2.0" >&5 +echo $ECHO_N "checking for libpng version >= 1.2.0... $ECHO_C" >&6 + + LIBPNG_CONFIG_WITH_ARGS="$LIBPNG_CONFIG_PATH $libpng_config_args" + + LIBPNG_VERSION=`$LIBPNG_CONFIG_WITH_ARGS --version` + libpng_config_major_version=`echo $LIBPNG_VERSION | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'` + libpng_config_minor_version=`echo $LIBPNG_VERSION | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'` + libpng_config_micro_version=`echo $LIBPNG_VERSION | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'` + + libpng_ver_ok= + if test $libpng_config_major_version -gt 1; then + libpng_ver_ok=yes +elif test $libpng_config_major_version -eq 1; then + + if test $libpng_config_minor_version -gt 2; then + libpng_ver_ok=yes +elif test $libpng_config_minor_version -eq 2; then + if test $libpng_config_micro_version -ge 0; then + libpng_ver_ok=yes +fi + +fi + + +fi + + + if test -z "$libpng_ver_ok"; then + + if test -z "$LIBPNG_VERSION"; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +else + + echo "$as_me:$LINENO: result: no (version $LIBPNG_VERSION is not new enough)" >&5 echo "${ECHO_T}no (version $LIBPNG_VERSION is not new enough)" >&6 - fi + LIBPNG_VERSION= - LIBPNG_CFLAGS="" - LIBPNG_CXXFLAGS="" - LIBPNG_LDFLAGS="" - LIBPNG_LIBS="" - : - fi - else - echo "$as_me:$LINENO: checking for libpng >= 1.2.0" >&5 +fi + + +else + + LIBPNG_LIBS=`$LIBPNG_CONFIG_WITH_ARGS --libs` + LIBPNG_LDFLAGS=`$LIBPNG_CONFIG_WITH_ARGS --ldflags | sed -e "s/ *${LIBPNG_LIBS}$//"` + LIBPNG_CFLAGS=`$LIBPNG_CONFIG_WITH_ARGS --cflags` + echo "$as_me:$LINENO: result: yes (version $LIBPNG_VERSION)" >&5 +echo "${ECHO_T}yes (version $LIBPNG_VERSION)" >&6 + +fi + + +else + + # Try hard to find a usable libpng + # Some RedHat RPMs miss libpng-config, so test for + # the usability with default options. + echo "$as_me:$LINENO: checking for libpng >= 1.2.0" >&5 echo $ECHO_N "checking for libpng >= 1.2.0... $ECHO_C" >&6 - saved_LIBS="$LIBS" - LIBS="$LIBS -lpng -lz -lm" - LIBPNG_CFLAGS="" - LIBPNG_CXXFLAGS="" - LIBPNG_LDFLAGS="" - LIBPNG_LIBS="" - if test "$cross_compiling" = yes; then + mule_backup_LIBS="$LIBS" + LIBS="-lpng -lz -lm $LIBS" + if test "$cross_compiling" = yes; then - echo "$as_me:$LINENO: result: cross-compilation detected, checking only the header" >&5 + echo "$as_me:$LINENO: result: cross-compilation detected, checking only the header" >&5 echo "${ECHO_T}cross-compilation detected, checking only the header" >&6 - if test "${ac_cv_header_png_h+set}" = set; then + if test "${ac_cv_header_png_h+set}" = set; then echo "$as_me:$LINENO: checking for png.h" >&5 echo $ECHO_N "checking for png.h... $ECHO_C" >&6 if test "${ac_cv_header_png_h+set}" = set; then @@ -6892,48 +6914,44 @@ fi if test $ac_cv_header_png_h = yes; then - result=yes -else - result=no + + LIBPNG_VERSION="detected" + LIBPNG_LIBS="-lpng -lz -lm" + fi - if test x$result = xyes; then - LIBPNG_VERSION="detected" - LIBPNG_LIBS="-lpng -lz -lm" - fi else cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ + /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include - #include + #include + #include - /* Check linking to png library */ - void dummy() { - png_check_sig(NULL, 0); - } + /* Check linking to png library */ + void dummy() { + png_check_sig(NULL, 0); + } int main () { - - /* png.h defines PNG_LIBPNG_VER=xyyzz */ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%s", (PNG_LIBPNG_VER >= 10200) ? "yes" : "no"); - fclose(f); - f=fopen("conftestver", "w"); - if (!f) exit(0); - fprintf(f, "%s", PNG_LIBPNG_VER_STRING); - fclose(f); - exit(0); + /* png.h defines PNG_LIBPNG_VER=xyyzz */ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%s", (PNG_LIBPNG_VER >= 1 * 10000 + 2 * 100 + 0) ? "yes" : "no"); + fclose(f); + f=fopen("conftestver", "w"); + if (!f) exit(0); + fprintf(f, "%s", PNG_LIBPNG_VER_STRING); + fclose(f); + exit(0); ; return 0; @@ -6952,22 +6970,32 @@ echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - if test -f conftestval; then - result=`cat conftestval` - else - result=no - fi - if test x$result = xyes; then - if test -f conftestver; then - LIBPNG_VERSION=`cat conftestver` - lib_version=" (version $LIBPNG_VERSION)" - else - lib_version="" - fi - fi - echo "$as_me:$LINENO: result: $result$lib_version" >&5 + if test -f conftestval; then + result=`cat conftestval` +else + result=no +fi + + if test ${result:-no} = yes; then + + if test -f conftestver; then + + LIBPNG_VERSION=`cat conftestver` + lib_version=" (version $LIBPNG_VERSION)" + +else + + lib_version= + LIBPNG_VERSION="detected" + +fi + + +fi + + echo "$as_me:$LINENO: result: $result$lib_version" >&5 echo "${ECHO_T}$result$lib_version" >&6 - LIBPNG_LIBS="-lpng -lz -lm" + LIBPNG_LIBS="-lpng -lz -lm" else echo "$as_me: program exited with status $ac_status" >&5 @@ -6976,100 +7004,83 @@ ( exit $ac_status ) - result=no - echo "$as_me:$LINENO: result: $result" >&5 + result=no + echo "$as_me:$LINENO: result: $result" >&5 echo "${ECHO_T}$result" >&6 fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - if test x$result = xyes; then - LIBPNGFOUND=1 - else - : - fi - LIBS="$saved_LIBS" - fi - + LIBS="$mule_backup_LIBS" +fi + if test -n "$LIBPNG_VERSION"; then + AMULEWEB_DEFS="-DWITH_LIBPNG" +else + { echo "$as_me:$LINENO: WARNING: libpng-devel >= 1.2.0 is needed for amuleweb" >&5 +echo "$as_me: WARNING: libpng-devel >= 1.2.0 is needed for amuleweb" >&2;} +fi -case "$LIBPNGFOUND" in -1) AMULEWEB_DEFS="-DWITH_LIBPNG" - ;; -*){ echo "$as_me:$LINENO: - WARNING: libpng-devel >= 1.2.0 is needed for amuleweb - " >&5 -echo "$as_me: - WARNING: libpng-devel >= 1.2.0 is needed for amuleweb - " >&6;} - AMULEWEB_DEFS="" - LIBPNG_LIBS="" - LIBPNG_CFLAGS="" - LIBPNG_CXXFLAGS="" - LIBPNG_LDFLAGS="" - ;; -esac else - AMULEWEB_DEFS="" - LIBPNG_LIBS="" - LIBPNG_CFLAGS="" - LIBPNG_CXXFLAGS="" - LIBPNG_LDFLAGS="" - LIBPNG_VERSION="not_needed" + LIBPNG_VERSION="not_needed" fi - # Check for perl File::Copy echo "$as_me:$LINENO: checking for File::Copy" >&5 echo $ECHO_N "checking for File::Copy... $ECHO_C" >&6 - if perl -e "require File::Copy" 2>/dev/null; then - echo "$as_me:$LINENO: result: ok" >&5 +if perl -e "require File::Copy" 2>/dev/null; then + echo "$as_me:$LINENO: result: ok" >&5 echo "${ECHO_T}ok" >&6 - else - { { echo "$as_me:$LINENO: error: File::Copy perl module is required" >&5 +else + { { echo "$as_me:$LINENO: error: File::Copy perl module is required" >&5 echo "$as_me: error: File::Copy perl module is required" >&2;} { (exit 1); exit 1; }; } - fi +fi + # Check if we need the GUI echo "$as_me:$LINENO: checking whether we need the GUI" >&5 echo $ECHO_N "checking whether we need the GUI... $ECHO_C" >&6 -if test x"$MONOLITHIC" = x"yes" ; then - need_gui="yes" +if test x$MONOLITHIC = xyes; then + need_gui=yes fi -if test x"$WXCAS" = x"yes" ; then - need_gui="yes" +if test x$WXCAS = xyes; then + need_gui=yes fi -if test x"$ALC" = x"yes" ; then - need_gui="yes" +if test x$ALC = xyes; then + need_gui=yes fi -if test x"$AMULE_GUI" = x"yes" ; then - need_gui="yes" +if test x$AMULE_GUI = xyes; then + need_gui=yes fi -if test "x${need_gui:+set}" != "xset" ; then - need_gui="no" +if test x${need_gui:+set} != xset; then + need_gui=no fi + echo "$as_me:$LINENO: result: $need_gui" >&5 echo "${ECHO_T}$need_gui" >&6 # Check for GeoIP (required for IP2Country capability) -if test x"$ENABLE_IP2COUNTRY" = x"yes" ; then - GEOIP_LIB="-lGeoIP" - CXXFLAGS="$CXXFLAGS $GEOIP_INCLUDE" - LDFLAGS="$LDFLAGS $GEOIP_LIB" +if test ${ENABLE_IP2COUNTRY:-no} = yes; then + + GEOIP_CPPFLAGS="$GEOIP_CPPFLAGS -DENABLE_IP2COUNTRY=1" + mule_backup_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $GEOIP_CPPFLAGS" + mule_backup_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $GEOIP_LDFLAGS" if test "${ac_cv_header_GeoIP_h+set}" = set; then echo "$as_me:$LINENO: checking for GeoIP.h" >&5 echo $ECHO_N "checking for GeoIP.h... $ECHO_C" >&6 @@ -7292,97 +7303,10 @@ { (exit 1); exit 1; }; } fi -fi - - - - -# Check if the compiler is broken, wrt. exceptions. - - - echo "$as_me:$LINENO: checking for exception-handling" >&5 -echo $ECHO_N "checking for exception-handling... $ECHO_C" >&6 - - ac_ext=cc -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 - - if test "$cross_compiling" = yes; then - - echo "$as_me:$LINENO: result: undeterminable" >&5 -echo "${ECHO_T}undeterminable" >&6 - { echo "$as_me:$LINENO: WARNING: - Cross-compilation detected, so exception handling cannot be tested. - Note that broken exception handling in your compiler may lead to - unexpected crashes." >&5 -echo "$as_me: WARNING: - Cross-compilation detected, so exception handling cannot be tested. - Note that broken exception handling in your compiler may lead to - unexpected crashes." >&2;} - -else - cat >conftest.$ac_ext <<_ACEOF - - /* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - try { - throw 1; - } catch (int) { - return 0; - } - return 1; - - ; - return 0; -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) - - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - { { echo "$as_me:$LINENO: error: Exception handling does not work. Broken compiler?" >&5 -echo "$as_me: error: Exception handling does not work. Broken compiler?" >&2;} - { (exit 1); exit 1; }; } + CPPFLAGS="$mule_backup_CPPFLAGS" + LDFLAGS="$mule_backup_LDFLAGS" fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu @@ -7589,7 +7513,7 @@ fi # Force using a static wxWidgets library if the executable is to be linked statically. -if test "$USE_DEBUG_STATIC" = "yes"; then +if test ${enable_static:-no} = yes; then WX_SHARED=0 fi @@ -8129,89 +8053,15 @@ +# We also need wxBase +WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs adv,core,net` +WXBASE_LIBS=`$WX_CONFIG_WITH_ARGS --libs net` +WXBASE_CPPFLAGS="$WX_CPPFLAGS -DwxUSE_GUI=0" - ac_ext=cc -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 - - - __CPPFLAGS=${CPPFLAGS} - CPPFLAGS=${WX_CPPFLAGS} - - echo "$as_me:$LINENO: checking that wxWidgets has support for large files" >&5 -echo $ECHO_N "checking that wxWidgets has support for large files... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF - - #include - - int main() { - #if !HAVE_LARGEFILE_SUPPORT && !defined(__WXMSW__) - #error No LargeFile support!; - #endif - exit(0); - } - -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - NO_LF="true" -fi -rm -f conftest.err conftest.$ac_ext - - if test "x${NO_LF}" != "x"; - then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - { { echo "$as_me:$LINENO: error: - Support for large files in wxWidgets is required by aMule. - To continue you must recompile wxWidgets with support for - large files enabled. - " >&5 -echo "$as_me: error: - Support for large files in wxWidgets is required by aMule. - To continue you must recompile wxWidgets with support for - large files enabled. - " >&2;} - { (exit 1); exit 1; }; } - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - fi - - CPPFLAGS=${__CPPFLAGS} - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test ${SYS:-unknown} = win32; then -if test x$SYS = xwin32; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 @@ -8292,10 +8142,180 @@ RC="$ac_cv_prog_RC" fi + MULERCFLAGS=`$WX_CONFIG_WITH_ARGS --cflags | $AWK '{ for (i = 1; i <= NF; i++) if (index($i, "-I") != 1 && index($i, "-D") != 1) $i = ""; print }'` - RCFLAGS=`$WX_CONFIG_WITH_ARGS --cflags | $AWK '{ for (i = 1; i <= NF; i++) if (index($i, "-I") != 1 && index($i, "-D") != 1) $i = ""; print }'` +fi + + + +# Check for libupnp +if test "${ENABLE_UPNP:-yes}" = yes; then + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - RCFLAGS="" + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi + +fi + + +# Check whether --with-libupnp-prefix or --without-libupnp-prefix was given. +if test "${with_libupnp_prefix+set}" = set; then + withval="$with_libupnp_prefix" + export PKG_CONFIG_PATH=$withval/lib/pkgconfig +fi; + + if test $cross_compiling = no; then + echo "$as_me:$LINENO: checking for libupnp version >= 1.6.6" >&5 +echo $ECHO_N "checking for libupnp version >= 1.6.6... $ECHO_C" >&6 + if test -n "$PKG_CONFIG"; then + if $PKG_CONFIG libupnp --exists; then + LIBUPNP_VERSION=`$PKG_CONFIG libupnp --modversion` + if $PKG_CONFIG libupnp --atleast-version=1.6.6; then + result=yes + resultstr=" (version $LIBUPNP_VERSION)" + LIBUPNP_CPPFLAGS=`$PKG_CONFIG libupnp --cflags-only-I` + LIBUPNP_CFLAGS=`$PKG_CONFIG libupnp --cflags-only-other` + LIBUPNP_LDFLAGS=`$PKG_CONFIG libupnp --libs-only-L` + LIBUPNP_LIBS=`$PKG_CONFIG libupnp --libs-only-other` + LIBUPNP_LIBS="$LIBUPNP_LIBS `$PKG_CONFIG libupnp --libs-only-l`" + +else + result=no + resultstr=" (version $LIBUPNP_VERSION is not new enough)" + +fi + +else + result=no + resultstr=" (try to use --with-libupnp-prefix=PREFIX)" + +fi + +else + result=no + resultstr=" (pkg-config not found)" + +fi + echo "$as_me:$LINENO: result: $result$resultstr" >&5 +echo "${ECHO_T}$result$resultstr" >&6 + libupnp_error="libupnp >= 1.6.6 not found$resultstr" + +else + result=no + libupnp_error="cross compiling" + +fi + + if test ${result:-no} = yes; then + LIBUPNP_CPPFLAGS="$LIBUPNP_CPPFLAGS -DENABLE_UPNP=1" +else + ENABLE_UPNP=disabled + +fi + + + + fi @@ -8305,189 +8325,419 @@ # Check whether --with-crypto-prefix or --without-crypto-prefix was given. if test "${with_crypto_prefix+set}" = set; then withval="$with_crypto_prefix" - CRYPTO_PP_PREFIX="$withval" -else - CRYPTO_PP_PREFIX="" + fi; + echo "$as_me:$LINENO: checking for crypto++ version >= 5.1" >&5 +echo $ECHO_N "checking for crypto++ version >= 5.1... $ECHO_C" >&6 + cryptopp_file_with_version="cryptlib.h" + CRYPTOPP_STYLE="unknown" + CRYPTOPP_LIB_NAME="unknown" + cryptopp_includedir="unknown" + CRYPTOPP_INCLUDE_PREFIX="unknown" + cryptopp_libdir="unknown" -min_crypto_version=5.1 -echo "$as_me:$LINENO: checking for crypto++ version >= $min_crypto_version" >&5 -echo $ECHO_N "checking for crypto++ version >= $min_crypto_version... $ECHO_C" >&6 + for CRYPTOPP_PREFIX in "$with_crypto_prefix" /usr /usr/local /opt /opt/local /usr/pkg /mingw ; do + if test -z "$CRYPTOPP_PREFIX"; then + continue +fi -crypto_pp_file_with_version="cryptlib.h" -CRYPTO_PP_STYLE="unknown" -CRYPTO_PP_LIB_NAME="unknown" -crypto_pp_include_i="unknown" -CRYPTO_PP_INCLUDE_PREFIX="unknown" -CRYPTO_PP_DEFINE="unknown" -CRYPTO_PP_LIB="unknown" + # Find the Cryptopp header + if test -f $CRYPTOPP_PREFIX/$cryptopp_file_with_version; then + + CRYPTOPP_STYLE="sources" + CRYPTOPP_LIB_NAME="cryptopp" + cryptopp_includedir= + CRYPTOPP_INCLUDE_PREFIX="$CRYPTOPP_PREFIX" + cryptopp_libdir= + break + +elif test -f $CRYPTOPP_PREFIX/include/cryptopp/$cryptopp_file_with_version; then + + CRYPTOPP_STYLE="installed" + CRYPTOPP_LIB_NAME="cryptopp" + cryptopp_includedir="$CRYPTOPP_PREFIX/include" + CRYPTOPP_INCLUDE_PREFIX="$CRYPTOPP_LIB_NAME" + cryptopp_libdir="$CRYPTOPP_PREFIX/lib" + break + +elif test -f $CRYPTOPP_PREFIX/include/crypto++/$cryptopp_file_with_version; then + + # Debian uses libcrypto++5.1 - it's not my fault, please soda patch the package + CRYPTOPP_STYLE="gentoo_debian" + CRYPTOPP_LIB_NAME="crypto++" + cryptopp_includedir="$CRYPTOPP_PREFIX/include" + CRYPTOPP_INCLUDE_PREFIX="$CRYPTOPP_LIB_NAME" + cryptopp_libdir="$CRYPTOPP_PREFIX/lib" + break -# -# Set CRYPTO_PP_PREFIX if the user has not set it in the configure command line -# We don't use AC_CHECK_FILE to avoid caching. -# -if test x$CRYPTO_PP_PREFIX = x ; then - CRYPTO_PP_PREFIX="/usr" fi -# -# Find the Cryptopp header -# -if test -f $CRYPTO_PP_PREFIX/$crypto_pp_file_with_version; then - CRYPTO_PP_STYLE="sources" - CRYPTO_PP_LIB_NAME="cryptopp" - crypto_pp_include_i="$CRYPTO_PP_PREFIX" - CRYPTO_PP_INCLUDE_PREFIX="." - CRYPTO_PP_DEFINE="__CRYPTO_SOURCE__" - CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX" - { { echo "$as_me:$LINENO: error: - Specifying the cryptopp source files directory for \"--with-crypto-prefix=\" - will not work because cryptopp uses headers with the same name of system - headers (e.g. zlib.h) and you must be able to distinguish the system - headers from cryptopp headers in an #include directive. - Please run \"PREFIX=/home/YourUserName/usr/cryptopp make install\" on - the cryptopp directory to properly install cryptopp in your system." >&5 -echo "$as_me: error: - Specifying the cryptopp source files directory for \"--with-crypto-prefix=\" - will not work because cryptopp uses headers with the same name of system - headers (e.g. zlib.h) and you must be able to distinguish the system - headers from cryptopp headers in an #include directive. - Please run \"PREFIX=/home/YourUserName/usr/cryptopp make install\" on - the cryptopp directory to properly install cryptopp in your system." >&2;} - { (exit 1); exit 1; }; } -elif test -f $CRYPTO_PP_PREFIX/include/cryptopp/$crypto_pp_file_with_version; then - CRYPTO_PP_STYLE="installed" - CRYPTO_PP_LIB_NAME="cryptopp" - crypto_pp_include_i="$CRYPTO_PP_PREFIX/include" - CRYPTO_PP_INCLUDE_PREFIX="$CRYPTO_PP_LIB_NAME" - CRYPTO_PP_DEFINE="__CRYPTO_INSTALLED__" - CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX/lib" -elif test -f $CRYPTO_PP_PREFIX/include/crypto++/$crypto_pp_file_with_version; then - # Debian uses libcrypto++5.1 - it's not my fault, please soda patch the package - CRYPTO_PP_STYLE="gentoo_debian" - CRYPTO_PP_LIB_NAME="crypto++" - crypto_pp_include_i="$CRYPTO_PP_PREFIX/include" - CRYPTO_PP_INCLUDE_PREFIX="$CRYPTO_PP_LIB_NAME" - CRYPTO_PP_DEFINE="__CRYPTO_SOURCE__" - CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX/lib" + done + + if test $CRYPTOPP_STYLE = "unknown"; then + result=no; resultstr="" +else + + # Find out the crypto++ version and check against the minimum required + cryptopp_header_path="${cryptopp_includedir+$cryptopp_includedir/}$CRYPTOPP_INCLUDE_PREFIX/$cryptopp_file_with_version" + CRYPTOPP_VERSION_STRING=`grep "Reference Manual" $cryptopp_header_path | sed -e 's/[^0-9]*\([0-9.]*\).*/\1/'` + CRYPTOPP_VERSION_NUMBER=`echo $CRYPTOPP_VERSION_STRING | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + minvers=`echo 5.1 | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + + if test -n "$CRYPTOPP_VERSION_NUMBER" && test "$CRYPTOPP_VERSION_NUMBER" -ge $minvers; then + + result=yes + resultstr=" (version $CRYPTOPP_VERSION_STRING, $CRYPTOPP_STYLE)" + if test -n "$cryptopp_includedir"; then + CRYPTOPP_CPPFLAGS="-I$cryptopp_includedir" +else + CRYPTOPP_CPPFLAGS= fi -# -# Check for success in finding cryptopp -# -if test $CRYPTO_PP_STYLE = "unknown"; then - # - # If the execution reaches here, we have failed. - # + if test -n "$cryptopp_libdir"; then + + CRYPTOPP_LDFLAGS="-L$cryptopp_libdir" + CRYPTOPP_LIBS="-l$CRYPTOPP_LIB_NAME" + +else + + CRYPTOPP_LDFLAGS= + CRYPTOPP_LIBS="${CRYPTOPP_INCLUDE_PREFIX}/lib${CRYPTOPP_LIB_NAME}.a" + +fi + + + + cat >>confdefs.h <<_ACEOF +#define CRYPTOPP_INCLUDE_PREFIX $CRYPTOPP_INCLUDE_PREFIX +_ACEOF + + +else + + result=no + resultstr=" (version $CRYPTOPP_VERSION_STRING is not new enough)" + +fi + + +fi + + + echo "$as_me:$LINENO: result: $result$resultstr" >&5 +echo "${ECHO_T}$result$resultstr" >&6 + + if test ${result:-no} = yes; then + + # Check for CryptoPP >= 5.5 + if test $CRYPTOPP_VERSION_NUMBER -ge "5005000"; then + CRYPTOPP_CPPFLAGS="$CRYPTOPP_CPPFLAGS -D__WEAK_CRYPTO__" +fi + + +else + { { echo "$as_me:$LINENO: error: - Could not find cryptopp header file \"$crypto_pp_file_with_version\". - Please check if the path \"$CRYPTO_PP_PREFIX\" is valid." >&5 + Could not find crypto++ header file \"$cryptopp_file_with_version\". + Please try again with --with-crypto-prefix=/my_crypto_prefix + (replace /my_crypto_prefix with a valid path to your crypto++ + installation directory)." >&5 echo "$as_me: error: - Could not find cryptopp header file \"$crypto_pp_file_with_version\". - Please check if the path \"$CRYPTO_PP_PREFIX\" is valid." >&2;} + Could not find crypto++ header file \"$cryptopp_file_with_version\". + Please try again with --with-crypto-prefix=/my_crypto_prefix + (replace /my_crypto_prefix with a valid path to your crypto++ + installation directory)." >&2;} { (exit 1); exit 1; }; } + fi -# -# Find out the cryptopp version and check against the minimum required -# -crypto_pp_include_dir="$crypto_pp_include_i/$CRYPTO_PP_INCLUDE_PREFIX" -crypto_pp_header_path="$crypto_pp_include_dir/$crypto_pp_file_with_version" -CRYPTO_PP_VERSION_STRING=$(grep "Reference Manual" $crypto_pp_header_path | \ - grep -Eo "([0-9]+\.?+)+") -CRYPTO_PP_VERSION_NUMBER=$(echo $CRYPTO_PP_VERSION_STRING | \ - $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}') -minvers=$(echo $min_crypto_version | \ - $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}') +ac_ext=cc +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 -if test -n "$CRYPTO_PP_VERSION_NUMBER" && test "$CRYPTO_PP_VERSION_NUMBER" -ge $minvers; then - result="yes (version $CRYPTO_PP_VERSION_STRING, $CRYPTO_PP_STYLE)" + + + + echo "$as_me:$LINENO: checking if we're using the GNU C++ library" >&5 +echo $ECHO_N "checking if we're using the GNU C++ library... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + #ifndef __GLIBCXX__ + #error Non-GNU C++ library found. + #endif + + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi else - result="no" + ac_cpp_err=yes fi -echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6 +if test -z "$ac_cpp_err"; then + GLIBCXX=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -# -# FLAGS -# -CRYPTO_PP_CXXFLAGS="-isystem $crypto_pp_include_i -D$CRYPTO_PP_DEFINE" -CRYPTO_PP_LDFLAGS="-L$CRYPTO_PP_LIB" + GLIBCXX=no +fi +rm -f conftest.err conftest.$ac_ext + echo "$as_me:$LINENO: result: $GLIBCXX" >&5 +echo "${ECHO_T}$GLIBCXX" >&6 -cat >>confdefs.h <<_ACEOF -#define CRYPTOPP_INCLUDE_PREFIX $CRYPTO_PP_INCLUDE_PREFIX + mule_backup_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" + + echo "$as_me:$LINENO: checking that wxWidgets has support for large files" >&5 +echo $ECHO_N "checking that wxWidgets has support for large files... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + #include + #if !HAVE_LARGEFILE_SUPPORT && !defined(_LARGE_FILES) && !defined(__WXMSW__) + #error No LargeFile support! + #endif -# -# Exported symbols -# +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + { { echo "$as_me:$LINENO: error: + Support for large files in wxWidgets is required by aMule. + To continue you must recompile wxWidgets with support for + large files enabled." >&5 +echo "$as_me: error: + Support for large files in wxWidgets is required by aMule. + To continue you must recompile wxWidgets with support for + large files enabled." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest.err conftest.$ac_ext + CPPFLAGS="$mule_backup_CPPFLAGS" +# Check if the compiler is broken, wrt. exceptions. -{ echo "$as_me:$LINENO: Crypto++ version number is $CRYPTO_PP_VERSION_NUMBER" >&5 -echo "$as_me: Crypto++ version number is $CRYPTO_PP_VERSION_NUMBER" >&6;} + echo "$as_me:$LINENO: checking for exception-handling" >&5 +echo $ECHO_N "checking for exception-handling... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + echo "$as_me:$LINENO: result: undeterminable" >&5 +echo "${ECHO_T}undeterminable" >&6 + { echo "$as_me:$LINENO: WARNING: + Cross-compilation detected, so exception handling cannot be tested. + Note that broken exception handling in your compiler may lead to + unexpected crashes." >&5 +echo "$as_me: WARNING: + Cross-compilation detected, so exception handling cannot be tested. + Note that broken exception handling in your compiler may lead to + unexpected crashes." >&2;} -CXXFLAGS="$CXXFLAGS $CRYPTO_PP_CXXFLAGS" -LDFLAGS="$LDFLAGS $CRYPTO_PP_LDFLAGS" -CRYPTOLIBS="-l$CRYPTO_PP_LIB_NAME" +else + cat >conftest.$ac_ext <<_ACEOF -case "$CRYPTO_PP_STYLE" in - gentoo_debian | installed | sources) - ;; - *) { { echo "$as_me:$LINENO: error: - WARNING: crypto++ >= $min_crypto_version is not found. - Please check that cryptopp-headers are in your default include path, - check out LD_LIBRARY_PATH or equivalent variable. - Or this might also be that your cryptopp is installed on other path. - Please try again with --with-crypto-prefix=/my_crypto_prefix - (replace /my_crypto_prefix with a valid path to your crypto directory). - To download the latest version check http://www.cryptopp.com for sources. - " >&5 -echo "$as_me: error: - WARNING: crypto++ >= $min_crypto_version is not found. - Please check that cryptopp-headers are in your default include path, - check out LD_LIBRARY_PATH or equivalent variable. - Or this might also be that your cryptopp is installed on other path. - Please try again with --with-crypto-prefix=/my_crypto_prefix - (replace /my_crypto_prefix with a valid path to your crypto directory). - To download the latest version check http://www.cryptopp.com for sources. - " >&2;} + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + try { + throw 1; + } catch (int) { + return 0; + } + return 1; + + ; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + { { echo "$as_me:$LINENO: error: Exception handling does not work. Broken compiler?" >&5 +echo "$as_me: error: Exception handling does not work. Broken compiler?" >&2;} { (exit 1); exit 1; }; } - ;; -esac -# Check for CryptoPP >= 5.5 -if test $CRYPTO_PP_VERSION_NUMBER -ge "5005000"; then - CXXFLAGS="$CXXFLAGS -D__WEAK_CRYPTO__" fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + + echo "$as_me:$LINENO: checking for and __cxa_demangle()" >&5 +echo $ECHO_N "checking for and __cxa_demangle()... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + #include + +int +main () +{ + + int status; + char * demangled = abi::__cxa_demangle("", 0, 0, &status); + std::type_info *ti = abi::__cxa_current_exception_type(); + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + + + cat >>confdefs.h <<\_ACEOF +#define HAVE_CXXABI 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check for bfd.h (to have proper backtraces without using wxExecute) -echo "$as_me:$LINENO: checking for bfd" >&5 + echo "$as_me:$LINENO: checking for bfd" >&5 echo $ECHO_N "checking for bfd... $ECHO_C" >&6 -__LIBS=$LIBS -LIBS="-lbfd -liberty $LIBS" -cat >conftest.$ac_ext <<_ACEOF + mule_backup_LIBS="$LIBS" + LIBS="-lbfd -liberty $LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8534,8 +8784,8 @@ echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - BFD_FLAGS="-DHAVE_BFD" - BFD_LIB="-lbfd -liberty" + BFD_CPPFLAGS="-DHAVE_BFD" + BFD_LIBS="-lbfd -liberty" else echo "$as_me: failed program was:" >&5 @@ -8554,65 +8804,107 @@ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=${__LIBS} - + LIBS="$mule_backup_LIBS" -# Ok, we have all needed libs, now checking for other stuff + echo "$as_me:$LINENO: checking for and backtrace()" >&5 +echo $ECHO_N "checking for and backtrace()... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -echo "$as_me:$LINENO: checking for autopoint" >&5 -echo $ECHO_N "checking for autopoint... $ECHO_C" >&6 + #include -autopoint_version=`autopoint --version | head -n 1 | sed -e 's/.*[^0-9.]\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,2\}\)[^0-9.]*/\1/'` -if test x$autopoint_version != x; then - result="yes" -else - result="no" -fi +int +main () +{ -HAVE_GETTEXT=$result + void *bt[1]; + int n = backtrace(&bt, 1); + const char **bt_syms = backtrace_symbols(bt, n); -echo "$as_me:$LINENO: result: $result ($autopoint_version)" >&5 -echo "${ECHO_T}$result ($autopoint_version)" >&6 -if test x$result = xno; then - { echo "$as_me:$LINENO: You need to install GNU gettext/gettext-tools to compile aMule with i18n support" >&5 -echo "$as_me: You need to install GNU gettext/gettext-tools to compile aMule with i18n support" >&6;} -fi + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then -if test "$LEX" = "flex"; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_EXECINFO 1 +_ACEOF -echo "$as_me:$LINENO: checking for extended flex capabilities" >&5 -echo $ECHO_N "checking for extended flex capabilities... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -extended_flex=`flex --help | grep header-file` -if test x"$extended_flex" != x""; then - result="yes" else - result="no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -HAVE_FLEX_EXTENDED=$result -echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6 +# Ok, we have all needed libs, now checking for other stuff +if test "$LEX" = "flex"; then -if test x$result = xno; then - { echo "$as_me:$LINENO: Your flex version doesn't support --header-file flag. This is not critical, but an upgrade is recommended " >&5 -echo "$as_me: Your flex version doesn't support --header-file flag. This is not critical, but an upgrade is recommended " >&6;} + echo "$as_me:$LINENO: checking for extended flex capabilities" >&5 +echo $ECHO_N "checking for extended flex capabilities... $ECHO_C" >&6 + + extended_flex=`flex --help | grep header-file` + if test -n "$extended_flex"; then + HAVE_FLEX_EXTENDED=yes +else + HAVE_FLEX_EXTENDED=no fi + echo "$as_me:$LINENO: result: $HAVE_FLEX_EXTENDED" >&5 +echo "${ECHO_T}$HAVE_FLEX_EXTENDED" >&6 + if test $HAVE_FLEX_EXTENDED = no; then + { echo "$as_me:$LINENO: Your flex version doesn't support --header-file flag. This is not critical, but an upgrade is recommended" >&5 +echo "$as_me: Your flex version doesn't support --header-file flag. This is not critical, but an upgrade is recommended" >&6;} +fi else - HAVE_FLEX_EXTENDED=no + HAVE_FLEX_EXTENDED=no fi + # Flush standard test results for speeding cache cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -9789,7 +10081,9 @@ -for ac_header in argz.h arpa/inet.h fcntl.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h mntent.h netdb.h netinet/in.h stddef.h nl_types.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/select.h sys/socket.h sys/statvfs.h sys/time.h sys/timeb.h sys/types.h unistd.h + + +for ac_header in argz.h arpa/inet.h fcntl.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h mntent.h netdb.h netinet/in.h stddef.h nl_types.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/ioctl.h sys/mntent.h sys/mnttab.h sys/mount.h sys/param.h sys/resource.h sys/select.h sys/socket.h sys/statvfs.h sys/time.h sys/timeb.h sys/types.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -10902,1021 +11196,59 @@ fi - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - - - - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GMSGFMT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $GMSGFMT in - [\\/]* | ?:[\\/]*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT=$ac_cv_path_GMSGFMT - -if test -n "$GMSGFMT"; then - echo "$as_me:$LINENO: result: $GMSGFMT" >&5 -echo "${ECHO_T}$GMSGFMT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XGETTEXT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test "$XGETTEXT" != ":"; then - echo "$as_me:$LINENO: result: $XGETTEXT" >&5 -echo "${ECHO_T}$XGETTEXT" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - rm -f messages.po - - # Extract the first word of "msgmerge", so it can be a program name with args. -set dummy msgmerge; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MSGMERGE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGMERGE" in - /*) - ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGMERGE="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" - ;; -esac -fi -MSGMERGE="$ac_cv_path_MSGMERGE" -if test "$MSGMERGE" != ":"; then - echo "$as_me:$LINENO: result: $MSGMERGE" >&5 -echo "${ECHO_T}$MSGMERGE" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 -echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 - GMSGFMT=":" - fi - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 -echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 - XGETTEXT=":" - fi - rm -f messages.po - fi - - ac_config_commands="$ac_config_commands default-1" - - -echo "$as_me:$LINENO: checking for library containing strerror" >&5 -echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 -if test "${ac_cv_search_strerror+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_strerror=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char strerror (); -int -main () -{ -strerror (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_strerror="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_strerror" = no; then - for ac_lib in cposix; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char strerror (); -int -main () -{ -strerror (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_strerror="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 -echo "${ECHO_T}$ac_cv_search_strerror" >&6 -if test "$ac_cv_search_strerror" != no; then - test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" - -fi - - - -for ac_header in stdlib.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------ ## -## Report this to admin@amule.org ## -## ------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_func in getpagesize -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -echo "$as_me:$LINENO: checking for working mmap" >&5 -echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 -if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -/* malloc might have been renamed as rpl_malloc. */ -#undef malloc - -/* Thanks to Mike Haertel and Jim Avera for this test. - Here is a matrix of mmap possibilities: - mmap private not fixed - mmap private fixed at somewhere currently unmapped - mmap private fixed at somewhere already mapped - mmap shared not fixed - mmap shared fixed at somewhere currently unmapped - mmap shared fixed at somewhere already mapped - For private mappings, we should verify that changes cannot be read() - back from the file, nor mmap's back from the file at a different - address. (There have been systems where private was not correctly - implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the file system buffer cache - like early versions of FreeBSD and possibly contemporary NetBSD.) - For shared mappings, we should conversely verify that changes get - propagated back to all the places they're supposed to be. - - Grep wants private fixed already mapped. - The main things grep needs to know about mmap are: - * does it exist and is it safe to write into the mmap'd area - * how to use it (BSD variants) */ - -#include -#include - -#if !STDC_HEADERS && !HAVE_STDLIB_H -char *malloc (); -#endif - -/* This mess was copied from the GNU getpagesize.h. */ -#if !HAVE_GETPAGESIZE -/* Assume that all systems that can run configure have sys/param.h. */ -# if !HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 -# endif - -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# if HAVE_SYS_PARAM_H -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -int -main () -{ - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize (); - - /* First, make a file with some known garbage in it. */ - data = (char *) malloc (pagesize); - if (!data) - exit (1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = creat ("conftest.mmap", 0600); - if (fd < 0) - exit (1); - if (write (fd, data, pagesize) != pagesize) - exit (1); - close (fd); - - /* Next, try to mmap the file at a fixed address which already has - something else allocated at it. If we can, also make sure that - we see the same garbage. */ - fd = open ("conftest.mmap", O_RDWR); - if (fd < 0) - exit (1); - data2 = (char *) malloc (2 * pagesize); - if (!data2) - exit (1); - data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit (1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit (1); - - /* Finally, make sure that changes to the mapped area do not - percolate back to the file as seen by read(). (This is a bug on - some variants of i386 svr4.0.) */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = (char *) malloc (pagesize); - if (!data3) - exit (1); - if (read (fd, data3, pagesize) != pagesize) - exit (1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit (1); - close (fd); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_mmap_fixed_mapped=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_mmap_fixed_mapped=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 -echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP 1 -_ACEOF - -fi -rm -f conftest.mmap - - - echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 -echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6 -if test "${ac_cv_gnu_library_2_1+set}" = set; then +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif - +#include +Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Lucky GNU user" >/dev/null 2>&1; then - ac_cv_gnu_library_2_1=yes + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes else - ac_cv_gnu_library_2_1=no + ac_cv_prog_gcc_traditional=no fi rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 -echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6 - - GLIBC21="$ac_cv_gnu_library_2_1" - - - - - echo "$as_me:$LINENO: checking whether integer division by zero raises SIGFPE" >&5 -echo $ECHO_N "checking whether integer division by zero raises SIGFPE... $ECHO_C" >&6 -if test "${gt_cv_int_divbyzero_sigfpe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - if test "$cross_compiling" = yes; then - - # Guess based on the CPU. - case "$host_cpu" in - alpha* | i3456786 | m68k | s390*) - gt_cv_int_divbyzero_sigfpe="guessing yes";; - *) - gt_cv_int_divbyzero_sigfpe="guessing no";; - esac - -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include - -static void -#ifdef __cplusplus -sigfpe_handler (int sig) -#else -sigfpe_handler (sig) int sig; -#endif -{ - /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ - exit (sig != SIGFPE); -} - -int x = 1; -int y = 0; -int z; -int nan; - -int main () -{ - signal (SIGFPE, sigfpe_handler); -/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ -#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) - signal (SIGTRAP, sigfpe_handler); -#endif -/* Linux/SPARC yields signal SIGILL. */ -#if defined (__sparc__) && defined (__linux__) - signal (SIGILL, sigfpe_handler); -#endif - - z = x / y; - nan = y / y; - exit (1); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_int_divbyzero_sigfpe=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -gt_cv_int_divbyzero_sigfpe=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -fi -echo "$as_me:$LINENO: result: $gt_cv_int_divbyzero_sigfpe" >&5 -echo "${ECHO_T}$gt_cv_int_divbyzero_sigfpe" >&6 - case "$gt_cv_int_divbyzero_sigfpe" in - *yes) value=1;; - *) value=0;; - esac - -cat >>confdefs.h <<_ACEOF -#define INTDIV0_RAISES_SIGFPE $value -_ACEOF - - - - echo "$as_me:$LINENO: checking for inttypes.h" >&5 -echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 -if test "${jm_ac_cv_header_inttypes_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#include -int -main () -{ -uintmax_t i = (uintmax_t) -1; - ; - return 0; -} +#include +Autoconf TCGETA _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - jm_ac_cv_header_inttypes_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -jm_ac_cv_header_inttypes_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes fi -echo "$as_me:$LINENO: result: $jm_ac_cv_header_inttypes_h" >&5 -echo "${ECHO_T}$jm_ac_cv_header_inttypes_h" >&6 - if test $jm_ac_cv_header_inttypes_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H_WITH_UINTMAX 1 -_ACEOF +rm -f conftest* fi - - - echo "$as_me:$LINENO: checking for stdint.h" >&5 -echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6 -if test "${jm_ac_cv_header_stdint_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -int -main () -{ -uintmax_t i = (uintmax_t) -1; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - jm_ac_cv_header_stdint_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -jm_ac_cv_header_stdint_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $jm_ac_cv_header_stdint_h" >&5 -echo "${ECHO_T}$jm_ac_cv_header_stdint_h" >&6 - if test $jm_ac_cv_header_stdint_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H_WITH_UINTMAX 1 -_ACEOF - +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" fi +fi - - echo "$as_me:$LINENO: checking for unsigned long long" >&5 -echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6 -if test "${ac_cv_type_unsigned_long_long+set}" = set; then +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -11925,162 +11257,14 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -unsigned long long ull = 1; int i = 63; +$ac_includes_default int main () { -unsigned long long ullmax = (unsigned long long) -1; - return ull << i | ull >> i | ullmax / ull | ullmax % ull; - ; +if ((pid_t *) 0) return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_unsigned_long_long=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_unsigned_long_long=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 -echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6 - if test $ac_cv_type_unsigned_long_long = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UNSIGNED_LONG_LONG 1 -_ACEOF - - fi - - - - - if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then - - test $ac_cv_type_unsigned_long_long = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' - -cat >>confdefs.h <<_ACEOF -#define uintmax_t $ac_type -_ACEOF - - fi - - - echo "$as_me:$LINENO: checking for inttypes.h" >&5 -echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 -if test "${gt_cv_header_inttypes_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -int -main () -{ - - ; +if (sizeof (pid_t)) return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_header_inttypes_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_header_inttypes_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $gt_cv_header_inttypes_h" >&5 -echo "${ECHO_T}$gt_cv_header_inttypes_h" >&6 - if test $gt_cv_header_inttypes_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H 1 -_ACEOF - - fi - - - - if test $gt_cv_header_inttypes_h = yes; then - echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 -echo $ECHO_N "checking whether the inttypes.h PRIxNN macros are broken... $ECHO_C" >&6 -if test "${gt_cv_inttypes_pri_broken+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#ifdef PRId32 -char *p = PRId32; -#endif - -int -main () -{ - ; return 0; } @@ -12107,573 +11291,30 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_inttypes_pri_broken=no + ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gt_cv_inttypes_pri_broken=yes +ac_cv_type_pid_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - fi -echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 -echo "${ECHO_T}$gt_cv_inttypes_pri_broken" >&6 - fi - if test "$gt_cv_inttypes_pri_broken" = yes; then +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else cat >>confdefs.h <<_ACEOF -#define PRI_MACROS_BROKEN 1 +#define pid_t int _ACEOF - fi - - - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" - - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi; -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo "$as_me:$LINENO: checking for ld used by GCC" >&5 -echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${acl_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$acl_cv_path_LD" -if test -n "$LD"; then - echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${acl_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi -fi -echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5 -echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 -with_gnu_ld=$acl_cv_prog_gnu_ld - - echo "$as_me:$LINENO: checking for shared library run path origin" >&5 -echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 -if test "${acl_cv_rpath+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - -fi -echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 -echo "${ECHO_T}$acl_cv_rpath" >&6 - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" - sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" - # Check whether --enable-rpath or --disable-rpath was given. -if test "${enable_rpath+set}" = set; then - enableval="$enable_rpath" - : -else - enable_rpath=yes -fi; - - - - - - - - use_additional=yes - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - -# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then - withval="$with_libiconv_prefix" - - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi - -fi; - LIBICONV= - LTLIBICONV= - INCICONV= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='iconv ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$hardcode_direct" = yes; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBICONV; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" - ;; - esac - done - fi - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" - done - fi - - - - - - - - - - - - - - -for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h +for ac_header in unistd.h vfork.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -12824,28 +11465,7 @@ - - - - - - - - - - - - - - - - - - - -for ac_func in feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ -geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ -strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next +for ac_func in fork vfork do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -12946,1188 +11566,240 @@ fi done - - - - - - - am_save_CPPFLAGS="$CPPFLAGS" - - for element in $INCICONV; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done - - - echo "$as_me:$LINENO: checking for iconv" >&5 -echo $ECHO_N "checking for iconv... $ECHO_C" >&6 -if test "${am_cv_func_iconv+set}" = set; then +if test "x$ac_cv_func_fork" = xyes; then + echo "$as_me:$LINENO: checking for working fork" >&5 +echo $ECHO_N "checking for working fork... $ECHO_C" >&6 +if test "${ac_cv_func_fork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_func_iconv=yes + if test "$cross_compiling" = yes; then + ac_cv_func_fork_works=cross else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} + cat >conftest.$ac_ext <<_ACEOF +/* By Ruediger Kuhlmann. */ + #include + #if HAVE_UNISTD_H + # include + #endif + /* Some systems only have a dummy stub for fork() */ + int main () + { + if (fork() < 0) + exit (1); + exit (0); + } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - am_cv_lib_iconv=yes - am_cv_func_iconv=yes + ac_cv_func_fork_works=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_fork_works=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - -fi -echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 -echo "${ECHO_T}$am_cv_func_iconv" >&6 - if test "$am_cv_func_iconv" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ICONV 1 -_ACEOF - - fi - if test "$am_cv_lib_iconv" = yes; then - echo "$as_me:$LINENO: checking how to link with libiconv" >&5 -echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBICONV" >&5 -echo "${ECHO_T}$LIBICONV" >&6 - else - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - - - - if test "$am_cv_func_iconv" = yes; then - echo "$as_me:$LINENO: checking for iconv declaration" >&5 -echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6 - if test "${am_cv_proto_iconv+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_proto_iconv_arg1="" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -am_cv_proto_iconv_arg1="const" +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi +echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 +echo "${ECHO_T}$ac_cv_func_fork_works" >&6 - am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - echo "$as_me:$LINENO: result: ${ac_t:- - }$am_cv_proto_iconv" >&5 -echo "${ECHO_T}${ac_t:- - }$am_cv_proto_iconv" >&6 - -cat >>confdefs.h <<_ACEOF -#define ICONV_CONST $am_cv_proto_iconv_arg1 -_ACEOF - - fi - - - echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 -echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 -if test "${am_cv_langinfo_codeset+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -char* cs = nl_langinfo(CODESET); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_langinfo_codeset=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -am_cv_langinfo_codeset=no + ac_cv_func_fork_works=$ac_cv_func_fork fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi -echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 -echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 - if test $am_cv_langinfo_codeset = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LANGINFO_CODESET 1 -_ACEOF - - fi - - if test $ac_cv_header_locale_h = yes; then - - echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 -echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 -if test "${am_cv_val_LC_MESSAGES+set}" = set; then +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + echo "$as_me:$LINENO: checking for working vfork" >&5 +echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 +if test "${ac_cv_func_vfork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + if test "$cross_compiling" = yes; then + ac_cv_func_vfork_works=cross +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -int -main () +/* Thanks to Paul Eggert for this test. */ +#include +#include +#include +#include +#include +#if HAVE_UNISTD_H +# include +#endif +#if HAVE_VFORK_H +# include +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif { -return LC_MESSAGES - ; - return 0; + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } } -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_val_LC_MESSAGES=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -am_cv_val_LC_MESSAGES=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 -echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 - if test $am_cv_val_LC_MESSAGES = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LC_MESSAGES 1 -_ACEOF - - fi - - fi - - for ac_prog in bison -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_INTLBISON+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$INTLBISON"; then - ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_INTLBISON="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -INTLBISON=$ac_cv_prog_INTLBISON -if test -n "$INTLBISON"; then - echo "$as_me:$LINENO: result: $INTLBISON" >&5 -echo "${ECHO_T}$INTLBISON" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$INTLBISON" && break -done - - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - echo "$as_me:$LINENO: checking version of bison" >&5 -echo $ECHO_N "checking version of bison... $ECHO_C" >&6 - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - echo "$as_me:$LINENO: result: $ac_prog_version" >&5 -echo "${ECHO_T}$ac_prog_version" >&6 - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi - - - - - - - - - - - - - - - - echo "$as_me:$LINENO: checking whether NLS is requested" >&5 -echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi; - echo "$as_me:$LINENO: result: $USE_NLS" >&5 -echo "${ECHO_T}$USE_NLS" >&6 - - - - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - - LIBINTL= - LTLIBINTL= - POSUB= - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - - echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 -echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 - -# Check whether --with-included-gettext or --without-included-gettext was given. -if test "${with_included_gettext+set}" = set; then - withval="$with_included_gettext" - nls_cv_force_use_gnu_gettext=$withval -else - nls_cv_force_use_gnu_gettext=no -fi; - echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 -echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - - - - - - - echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 -echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings; int main () { -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gt_cv_func_gnugettext1_libc=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6 - - if test "$gt_cv_func_gnugettext1_libc" != "yes"; then - - - - use_additional=yes - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - -# Check whether --with-libintl-prefix or --without-libintl-prefix was given. -if test "${with_libintl_prefix+set}" = set; then - withval="$with_libintl_prefix" - - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi - -fi; - LIBINTL= - LTLIBINTL= - INCINTL= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='intl ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$hardcode_direct" = yes; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBINTL; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + pid_t parent = getpid (); + pid_t child; - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCINTL; do + sparc_address_test (0); - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + child = vfork (); - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBINTL; do + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBINTL; do + while (wait(&status) != child) + ; + exit( + /* Was there some problem with vforking? */ + child < 0 - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" + /* Did the child fail? (This shouldn't happen.) */ + || status - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" - ;; - esac - done - fi - else - LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" - done - fi + /* Did the vfork/compiler bug occur? */ + || parent != getpid() - echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 -echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 -if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCINTL" - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (); -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) - ; - return 0; + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_func_gnugettext1_libintl=yes + ac_cv_func_vfork_works=yes else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gt_cv_func_gnugettext1_libintl=no +( exit $ac_status ) +ac_cv_func_vfork_works=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias (); -int -main () -{ -bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext1_libintl=yes - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS" fi -echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 -echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6 - fi - - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - gt_use_preinstalled_gnugettext=yes - else - LIBINTL= - LTLIBINTL= - INCINTL= - fi - - - if test "$gt_use_preinstalled_gnugettext" != "yes"; then - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - INTLOBJS="\$(GETTOBJS)" - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - LIBINTL="\${top_builddir}/intl/libintl.a $LIBICONV" - LTLIBINTL="\${top_builddir}/intl/libintl.a $LTLIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - CATOBJEXT=.gmo - fi +echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 +echo "${ECHO_T}$ac_cv_func_vfork_works" >&6 +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then +if test "x$ac_cv_func_vfork_works" = xyes; then cat >>confdefs.h <<\_ACEOF -#define ENABLE_NLS 1 +#define HAVE_WORKING_VFORK 1 _ACEOF - else - USE_NLS=no - fi - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then - echo "$as_me:$LINENO: checking how to link with libintl" >&5 -echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $LIBINTL" >&5 -echo "${ECHO_T}$LIBINTL" >&6 - - for element in $INCINTL; do - haveit= - for x in $CPPFLAGS; do - - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" - fi - done - - fi - +else cat >>confdefs.h <<\_ACEOF -#define HAVE_GETTEXT 1 +#define vfork fork _ACEOF +fi +if test "x$ac_cv_func_fork_works" = xyes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_DCGETTEXT 1 +#define HAVE_WORKING_FORK 1 _ACEOF - fi - - POSUB=po - fi - - - if test "$PACKAGE" = gettext; then - BUILD_INCLUDED_LIBINTL=yes - fi - - - - - - - nls_cv_header_intl= - nls_cv_header_libgt= - - DATADIRNAME=share - - - INSTOBJEXT=.mo - - - GENCAT=gencat - - - INTL_LIBTOOL_SUFFIX_PREFIX= - - - - INTLLIBS="$LIBINTL" - - - - +fi +if test x$SYS != xwin32; then -# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. + # getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. echo "$as_me:$LINENO: checking for getmntent in -lsun" >&5 echo $ECHO_N "checking for getmntent in -lsun... $ECHO_C" >&6 if test "${ac_cv_lib_sun_getmntent+set}" = set; then @@ -14437,609 +12109,7 @@ done -if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TIOCGETP -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -else - ac_cv_prog_gcc_traditional=no -fi -rm -f conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TCGETA -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -fi -rm -f conftest* - - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - -echo "$as_me:$LINENO: checking for pid_t" >&5 -echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 -if test "${ac_cv_type_pid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((pid_t *) 0) - return 0; -if (sizeof (pid_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_pid_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_pid_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$ac_cv_type_pid_t" >&6 -if test $ac_cv_type_pid_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - - - -for ac_header in unistd.h vfork.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------ ## -## Report this to admin@amule.org ## -## ------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -for ac_func in fork vfork -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -if test "x$ac_cv_func_fork" = xyes; then - echo "$as_me:$LINENO: checking for working fork" >&5 -echo $ECHO_N "checking for working fork... $ECHO_C" >&6 -if test "${ac_cv_func_fork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_fork_works=cross -else - cat >conftest.$ac_ext <<_ACEOF -/* By Ruediger Kuhlmann. */ - #include - #if HAVE_UNISTD_H - # include - #endif - /* Some systems only have a dummy stub for fork() */ - int main () - { - if (fork() < 0) - exit (1); - exit (0); - } -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_fork_works=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_fork_works=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 -echo "${ECHO_T}$ac_cv_func_fork_works" >&6 - -else - ac_cv_func_fork_works=$ac_cv_func_fork -fi -if test "x$ac_cv_func_fork_works" = xcross; then - case $host in - *-*-amigaos* | *-*-msdosdjgpp*) - # Override, as these systems have only a dummy fork() stub - ac_cv_func_fork_works=no - ;; - *) - ac_cv_func_fork_works=yes - ;; - esac - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} -fi -ac_cv_func_vfork_works=$ac_cv_func_vfork -if test "x$ac_cv_func_vfork" = xyes; then - echo "$as_me:$LINENO: checking for working vfork" >&5 -echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 -if test "${ac_cv_func_vfork_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_vfork_works=cross -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Thanks to Paul Eggert for this test. */ -#include -#include -#include -#include -#include -#if HAVE_UNISTD_H -# include -#endif -#if HAVE_VFORK_H -# include -#endif -/* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. The compiler - is told about this with #include , but some compilers - (e.g. gcc -O) don't grok . Test for this by using a - static variable whose address is put into a register that is - clobbered by the vfork. */ -static void -#ifdef __cplusplus -sparc_address_test (int arg) -# else -sparc_address_test (arg) int arg; -#endif -{ - static pid_t child; - if (!child) { - child = vfork (); - if (child < 0) { - perror ("vfork"); - _exit(2); - } - if (!child) { - arg = getpid(); - write(-1, "", 0); - _exit (arg); - } - } -} - -int -main () -{ - pid_t parent = getpid (); - pid_t child; - - sparc_address_test (0); - - child = vfork (); - - if (child == 0) { - /* Here is another test for sparc vfork register problems. This - test uses lots of local variables, at least as many local - variables as main has allocated so far including compiler - temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris - 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should - reuse the register of parent for one of the local variables, - since it will think that parent can't possibly be used any more - in this routine. Assigning to the local variable will thus - munge parent in the parent process. */ - pid_t - p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), - p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); - /* Convince the compiler that p..p7 are live; otherwise, it might - use the same hardware register for all 8 local variables. */ - if (p != p1 || p != p2 || p != p3 || p != p4 - || p != p5 || p != p6 || p != p7) - _exit(1); - - /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent - from child file descriptors. If the child closes a descriptor - before it execs or exits, this munges the parent's descriptor - as well. Test for this by closing stdout in the child. */ - _exit(close(fileno(stdout)) != 0); - } else { - int status; - struct stat st; - - while (wait(&status) != child) - ; - exit( - /* Was there some problem with vforking? */ - child < 0 - - /* Did the child fail? (This shouldn't happen.) */ - || status - - /* Did the vfork/compiler bug occur? */ - || parent != getpid() - - /* Did the file descriptor bug occur? */ - || fstat(fileno(stdout), &st) != 0 - ); - } -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_vfork_works=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_vfork_works=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 -echo "${ECHO_T}$ac_cv_func_vfork_works" >&6 - -fi; -if test "x$ac_cv_func_fork_works" = xcross; then - ac_cv_func_vfork_works=$ac_cv_func_vfork - { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} -fi - -if test "x$ac_cv_func_vfork_works" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WORKING_VFORK 1 -_ACEOF - -else - -cat >>confdefs.h <<\_ACEOF -#define vfork fork -_ACEOF - -fi -if test "x$ac_cv_func_fork_works" = xyes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_WORKING_FORK 1 -_ACEOF - -fi - -if test x$SYS != xwin32; then -echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 + echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6 if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15185,7 +12255,7 @@ fi -echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 + echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6 if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15266,7 +12336,9 @@ fi + fi + echo "$as_me:$LINENO: checking for working memcmp" >&5 echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 if test "${ac_cv_func_memcmp_working+set}" = set; then @@ -16954,7 +14026,8 @@ done -if test $cross_compiling = yes -a $gnumalloc = yes ; then +if test $cross_compiling = yes -a $gnumalloc = yes; then + { echo "$as_me:$LINENO: WARNING: configure cannot check whether malloc() and realloc() are GNU libc compatible. You have to be ABSOLUTELY sure that they are, otherwise @@ -16965,8 +14038,10 @@ run configure with the --without-gnu-malloc switch." >&2;} ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes + fi + for ac_header in stdlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -17461,9 +14536,7 @@ - - -for ac_func in __argz_count __argz_next __argz_stringify endpwent floor ftruncate getcwd gethostbyaddr gethostbyname gethostname getmntent getmntinfo getpass gettimeofday inet_ntoa localeconv memmove mempcpy memset munmap nl_langinfo pow select setlocale socket sqrt stpcpy strcasecmp strchr strcspn strdup strerror strncasecmp strstr strtoul +for ac_func in __argz_count __argz_next __argz_stringify endpwent floor ftruncate getcwd gethostbyaddr gethostbyname gethostname getpass gettimeofday inet_ntoa localeconv memmove mempcpy memset munmap nl_langinfo pow select setlocale socket sqrt stpcpy strcasecmp strchr strcspn strdup strerror strncasecmp strstr strtoul do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -17571,7 +14644,8 @@ -for ac_func in mkdir getrlimit setrlimit + +for ac_func in mkdir getrlimit setrlimit getopt_long do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -17673,6 +14747,3570 @@ done +mule_backup_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600" +echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 +echo $ECHO_N "checking whether strerror_r is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strerror_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strerror_r + char *p = (char *) strerror_r; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_strerror_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_strerror_r=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strerror_r" >&6 +if test $ac_cv_have_decl_strerror_r = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 0 +_ACEOF + + +fi + + + +for ac_func in strerror_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5 +echo $ECHO_N "checking whether strerror_r returns char *... $ECHO_C" >&6 +if test "${ac_cv_func_strerror_r_char_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strerror_r_char_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + else + # strerror_r is not declared. Choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + extern char *strerror_r (); +int +main () +{ +char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + exit (!isalpha (x)); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strerror_r_char_p=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + fi + +fi +echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5 +echo "${ECHO_T}$ac_cv_func_strerror_r_char_p" >&6 +if test $ac_cv_func_strerror_r_char_p = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STRERROR_R_CHAR_P 1 +_ACEOF + +fi + +CPPFLAGS="$mule_backup_CPPFLAGS" + +# Look for a way to preallocate disk space for files. + + echo "$as_me:$LINENO: checking for fallocate" >&5 +echo $ECHO_N "checking for fallocate... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + +int +main () +{ + + fallocate(0, 0, 0, 0); + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + + + cat >>confdefs.h <<\_ACEOF +#define HAVE_FALLOCATE 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + + echo "$as_me:$LINENO: checking for SYS_fallocate" >&5 +echo $ECHO_N "checking for SYS_fallocate... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + #include + #include + +int +main () +{ + + syscall(SYS_fallocate, 0, (loff_t)0, (loff_t)0); + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + + + cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_FALLOCATE 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + echo "$as_me:$LINENO: checking for posix_fallocate" >&5 +echo $ECHO_N "checking for posix_fallocate... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #define _XOPEN_SOURCE 600 + #include + #ifdef HAVE_FCNTL_H + # include + #endif + +int +main () +{ + + posix_fallocate(0, 0, 0); + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + + + cat >>confdefs.h <<\_ACEOF +#define HAVE_POSIX_FALLOCATE 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +# Checking Native Language Support + + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + + + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + rm -f messages.po + + # Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGMERGE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGMERGE" in + /*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + echo "$as_me:$LINENO: result: $MSGMERGE" >&5 +echo "${ECHO_T}$MSGMERGE" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 +echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 + GMSGFMT=":" + fi + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 + XGETTEXT=":" + fi + rm -f messages.po + fi + + ac_config_commands="$ac_config_commands default-1" + + +echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" + +fi + + + echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 +echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6 +if test "${ac_cv_gnu_library_2_1+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky GNU user" >/dev/null 2>&1; then + ac_cv_gnu_library_2_1=yes +else + ac_cv_gnu_library_2_1=no +fi +rm -f conftest* + + + +fi +echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 +echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6 + + GLIBC21="$ac_cv_gnu_library_2_1" + + + + + echo "$as_me:$LINENO: checking whether integer division by zero raises SIGFPE" >&5 +echo $ECHO_N "checking whether integer division by zero raises SIGFPE... $ECHO_C" >&6 +if test "${gt_cv_int_divbyzero_sigfpe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i3456786 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + +static void +#ifdef __cplusplus +sigfpe_handler (int sig) +#else +sigfpe_handler (sig) int sig; +#endif +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} + +int x = 1; +int y = 0; +int z; +int nan; + +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + + z = x / y; + nan = y / y; + exit (1); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_int_divbyzero_sigfpe=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gt_cv_int_divbyzero_sigfpe=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +fi +echo "$as_me:$LINENO: result: $gt_cv_int_divbyzero_sigfpe" >&5 +echo "${ECHO_T}$gt_cv_int_divbyzero_sigfpe" >&6 + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + +cat >>confdefs.h <<_ACEOF +#define INTDIV0_RAISES_SIGFPE $value +_ACEOF + + + + echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 +if test "${jm_ac_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +uintmax_t i = (uintmax_t) -1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + jm_ac_cv_header_inttypes_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +jm_ac_cv_header_inttypes_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $jm_ac_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$jm_ac_cv_header_inttypes_h" >&6 + if test $jm_ac_cv_header_inttypes_h = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for stdint.h" >&5 +echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6 +if test "${jm_ac_cv_header_stdint_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +uintmax_t i = (uintmax_t) -1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + jm_ac_cv_header_stdint_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +jm_ac_cv_header_stdint_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $jm_ac_cv_header_stdint_h" >&5 +echo "${ECHO_T}$jm_ac_cv_header_stdint_h" >&6 + if test $jm_ac_cv_header_stdint_h = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H_WITH_UINTMAX 1 +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for unsigned long long" >&5 +echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6 +if test "${ac_cv_type_unsigned_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +unsigned long long ull = 1; int i = 63; +int +main () +{ +unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_unsigned_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_unsigned_long_long=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6 + if test $ac_cv_type_unsigned_long_long = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UNSIGNED_LONG_LONG 1 +_ACEOF + + fi + + + + + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then + + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + +cat >>confdefs.h <<_ACEOF +#define uintmax_t $ac_type +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 +if test "${gt_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_header_inttypes_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_header_inttypes_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $gt_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$gt_cv_header_inttypes_h" >&6 + if test $gt_cv_header_inttypes_h = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H 1 +_ACEOF + + fi + + + + if test $gt_cv_header_inttypes_h = yes; then + echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 +echo $ECHO_N "checking whether the inttypes.h PRIxNN macros are broken... $ECHO_C" >&6 +if test "${gt_cv_inttypes_pri_broken+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#ifdef PRId32 +char *p = PRId32; +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_inttypes_pri_broken=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_inttypes_pri_broken=yes +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 +echo "${ECHO_T}$gt_cv_inttypes_pri_broken" >&6 + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + +cat >>confdefs.h <<_ACEOF +#define PRI_MACROS_BROKEN 1 +_ACEOF + + fi + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${acl_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$acl_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${acl_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + acl_cv_prog_gnu_ld=yes +else + acl_cv_prog_gnu_ld=no +fi +fi +echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5 +echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + echo "$as_me:$LINENO: checking for shared library run path origin" >&5 +echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 +if test "${acl_cv_rpath+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 +echo "${ECHO_T}$acl_cv_rpath" >&6 + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" + # Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + : +else + enable_rpath=yes +fi; + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + +fi; + LIBICONV= + LTLIBICONV= + INCICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------ ## +## Report this to admin@amule.org ## +## ------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + + + + + + + + + + + + + + +for ac_func in feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ +geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ +strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + echo "$as_me:$LINENO: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6 +if test "${am_cv_func_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 +echo "${ECHO_T}$am_cv_func_iconv" >&6 + if test "$am_cv_func_iconv" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ICONV 1 +_ACEOF + + fi + if test "$am_cv_lib_iconv" = yes; then + echo "$as_me:$LINENO: checking how to link with libiconv" >&5 +echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $LIBICONV" >&5 +echo "${ECHO_T}$LIBICONV" >&6 + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + if test "$am_cv_func_iconv" = yes; then + echo "$as_me:$LINENO: checking for iconv declaration" >&5 +echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6 + if test "${am_cv_proto_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_proto_iconv_arg1="" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +am_cv_proto_iconv_arg1="const" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" +fi + + am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + echo "$as_me:$LINENO: result: ${ac_t:- + }$am_cv_proto_iconv" >&5 +echo "${ECHO_T}${ac_t:- + }$am_cv_proto_iconv" >&6 + +cat >>confdefs.h <<_ACEOF +#define ICONV_CONST $am_cv_proto_iconv_arg1 +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 +echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 +if test "${am_cv_langinfo_codeset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char* cs = nl_langinfo(CODESET); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_langinfo_codeset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +am_cv_langinfo_codeset=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 +echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 + if test $am_cv_langinfo_codeset = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LANGINFO_CODESET 1 +_ACEOF + + fi + + if test $ac_cv_header_locale_h = yes; then + + echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +return LC_MESSAGES + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_val_LC_MESSAGES=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +am_cv_val_LC_MESSAGES=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 + if test $am_cv_val_LC_MESSAGES = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LC_MESSAGES 1 +_ACEOF + + fi + + fi + + for ac_prog in bison +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_INTLBISON+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$INTLBISON"; then + ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_INTLBISON="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +INTLBISON=$ac_cv_prog_INTLBISON +if test -n "$INTLBISON"; then + echo "$as_me:$LINENO: result: $INTLBISON" >&5 +echo "${ECHO_T}$INTLBISON" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$INTLBISON" && break +done + + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + echo "$as_me:$LINENO: checking version of bison" >&5 +echo $ECHO_N "checking version of bison... $ECHO_C" >&6 + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + echo "$as_me:$LINENO: result: $ac_prog_version" >&5 +echo "${ECHO_T}$ac_prog_version" >&6 + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi + + + +# Check whether --with-language or --without-language was given. +if test "${with_language+set}" = set; then + withval="$with_language" + if test "$withval" = "all"; then + LINGUAS='%UNSET%' +else + LINGUAS="`echo $withval | sed -e 's/,/ /g'`" +fi + +fi; + + + + + + + + + + + + + + + + echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + + + + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + + LIBINTL= + LTLIBINTL= + POSUB= + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 +echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 + +# Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval +else + nls_cv_force_use_gnu_gettext=no +fi; + echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 +echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + + + + + + + echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 +echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6 +if test "${gt_cv_func_gnugettext2_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_domain_bindings + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext2_libc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_gnugettext2_libc=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext2_libc" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext2_libc" >&6 + + if test "$gt_cv_func_gnugettext2_libc" != "yes"; then + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix or --without-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then + withval="$with_libintl_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + +fi; + LIBINTL= + LTLIBINTL= + INCINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 +echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6 +if test "${gt_cv_func_gnugettext2_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext2_libintl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_func_gnugettext2_libintl=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$gt_cv_func_gnugettext2_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (); +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext2_libintl=yes + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext2_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext2_libintl" >&6 + fi + + if test "$gt_cv_func_gnugettext2_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext2_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + INTLOBJS="\$(GETTOBJS)" + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="\${top_builddir}/intl/libintl.a $LIBICONV" + LTLIBINTL="\${top_builddir}/intl/libintl.a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + CATOBJEXT=.gmo + fi + + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + else + USE_NLS=no + fi + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext2_libintl" = "yes"; then + echo "$as_me:$LINENO: checking how to link with libintl" >&5 +echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $LIBINTL" >&5 +echo "${ECHO_T}$LIBINTL" >&6 + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETTEXT 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DCGETTEXT 1 +_ACEOF + + fi + + POSUB=po + fi + + + if test "$PACKAGE" = gettext; then + BUILD_INCLUDED_LIBINTL=yes + fi + + + + + + + nls_cv_header_intl= + nls_cv_header_libgt= + + DATADIRNAME=share + + + INSTOBJEXT=.mo + + + GENCAT=gencat + + + INTL_LIBTOOL_SUFFIX_PREFIX= + + + + INTLLIBS="$LIBINTL" + + + + + + + if test $USE_INCLUDED_LIBINTL = yes; then + INCINTL=-I\${top_builddir}/intl +fi + + + if test x$USE_NLS = xyes; then + + echo "$as_me:$LINENO: checking for autopoint" >&5 +echo $ECHO_N "checking for autopoint... $ECHO_C" >&6 + autopoint_version=`autopoint --version | head -n 1 | sed -e 's/.*[^0-9.]\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,2\}\)[^0-9.]*/\1/'` + if test -n "$autopoint_version"; then + + echo "$as_me:$LINENO: result: yes ($autopoint_version)" >&5 +echo "${ECHO_T}yes ($autopoint_version)" >&6 + + +else + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + USE_NLS=no + +fi + + +fi + + if test x$USE_NLS = xno -a x${enable_nls:-yes} = xyes; then + { echo "$as_me:$LINENO: WARNING: You need to install GNU gettext/gettext-tools to compile aMule with i18n support." >&5 +echo "$as_me: WARNING: You need to install GNU gettext/gettext-tools to compile aMule with i18n support." >&2;} +fi + + + if test ${USE_NLS:-no} = yes; then + + echo "$as_me:$LINENO: checking for requested languages" >&5 +echo $ECHO_N "checking for requested languages... $ECHO_C" >&6 + Generate_Langs=`echo $LINGUAS | $AWK 'OFS="\\\\|" { for (i = 1; i <= NF; ++i) $i = "\\\\." $i; print }'` + + if test "$AMULE_DAEMON" == "yes"; then + + if test -z "$LINGUAS"; then + AMULE_DAEMON_MANPAGES=`ls -1 ${srcdir}/docs/man/amuled.* | sed -e 's:.*/::g'` +else + + AMULE_DAEMON_MANPAGES=`ls -1 ${srcdir}/docs/man/amuled.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + AMULE_DAEMON_MANPAGES="`basename docs/man/amuled.1` $AMULE_DAEMON_MANPAGES" + +fi + + AMULE_DAEMON_MANPAGES=`echo $AMULE_DAEMON_MANPAGES | tr -d '\n'` + +else + AMULE_DAEMON_MANPAGES= +fi + + + + + if test "$AMULECMD" == "yes"; then + + if test -z "$LINGUAS"; then + AMULECMD_MANPAGES=`ls -1 ${srcdir}/docs/man/amulecmd.* | sed -e 's:.*/::g'` +else + + AMULECMD_MANPAGES=`ls -1 ${srcdir}/docs/man/amulecmd.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + AMULECMD_MANPAGES="`basename docs/man/amulecmd.1` $AMULECMD_MANPAGES" + +fi + + AMULECMD_MANPAGES=`echo $AMULECMD_MANPAGES | tr -d '\n'` + +else + AMULECMD_MANPAGES= +fi + + + + + if test "$WEB" == "yes"; then + + if test -z "$LINGUAS"; then + WEB_MANPAGES=`ls -1 ${srcdir}/docs/man/amuleweb.* | sed -e 's:.*/::g'` +else + + WEB_MANPAGES=`ls -1 ${srcdir}/docs/man/amuleweb.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + WEB_MANPAGES="`basename docs/man/amuleweb.1` $WEB_MANPAGES" + +fi + + WEB_MANPAGES=`echo $WEB_MANPAGES | tr -d '\n'` + +else + WEB_MANPAGES= +fi + + + + + if test "$AMULE_GUI" == "yes"; then + + if test -z "$LINGUAS"; then + AMULE_GUI_MANPAGES=`ls -1 ${srcdir}/docs/man/amulegui.* | sed -e 's:.*/::g'` +else + + AMULE_GUI_MANPAGES=`ls -1 ${srcdir}/docs/man/amulegui.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + AMULE_GUI_MANPAGES="`basename docs/man/amulegui.1` $AMULE_GUI_MANPAGES" + +fi + + AMULE_GUI_MANPAGES=`echo $AMULE_GUI_MANPAGES | tr -d '\n'` + +else + AMULE_GUI_MANPAGES= +fi + + + + + if test "$CAS" == "yes"; then + + if test -z "$LINGUAS"; then + CAS_MANPAGES=`ls -1 ${srcdir}/src/utils/cas/docs/cas.* | sed -e 's:.*/::g'` +else + + CAS_MANPAGES=`ls -1 ${srcdir}/src/utils/cas/docs/cas.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + CAS_MANPAGES="`basename src/utils/cas/docs/cas.1` $CAS_MANPAGES" + +fi + + CAS_MANPAGES=`echo $CAS_MANPAGES | tr -d '\n'` + +else + CAS_MANPAGES= +fi + + + + + if test "$WXCAS" == "yes"; then + + if test -z "$LINGUAS"; then + WXCAS_MANPAGES=`ls -1 ${srcdir}/src/utils/wxCas/docs/wxcas.* | sed -e 's:.*/::g'` +else + + WXCAS_MANPAGES=`ls -1 ${srcdir}/src/utils/wxCas/docs/wxcas.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + WXCAS_MANPAGES="`basename src/utils/wxCas/docs/wxcas.1` $WXCAS_MANPAGES" + +fi + + WXCAS_MANPAGES=`echo $WXCAS_MANPAGES | tr -d '\n'` + +else + WXCAS_MANPAGES= +fi + + + + + if test "$ED2K" == "yes"; then + + if test -z "$LINGUAS"; then + ED2K_MANPAGES=`ls -1 ${srcdir}/docs/man/ed2k.* | sed -e 's:.*/::g'` +else + + ED2K_MANPAGES=`ls -1 ${srcdir}/docs/man/ed2k.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + ED2K_MANPAGES="`basename docs/man/ed2k.1` $ED2K_MANPAGES" + +fi + + ED2K_MANPAGES=`echo $ED2K_MANPAGES | tr -d '\n'` + +else + ED2K_MANPAGES= +fi + + + + + if test "$ALC" == "yes"; then + + if test -z "$LINGUAS"; then + ALC_MANPAGES=`ls -1 ${srcdir}/src/utils/aLinkCreator/docs/alc.* | sed -e 's:.*/::g'` +else + + ALC_MANPAGES=`ls -1 ${srcdir}/src/utils/aLinkCreator/docs/alc.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + ALC_MANPAGES="`basename src/utils/aLinkCreator/docs/alc.1` $ALC_MANPAGES" + +fi + + ALC_MANPAGES=`echo $ALC_MANPAGES | tr -d '\n'` + +else + ALC_MANPAGES= +fi + + + + + if test "$ALCC" == "yes"; then + + if test -z "$LINGUAS"; then + ALCC_MANPAGES=`ls -1 ${srcdir}/src/utils/aLinkCreator/docs/alcc.* | sed -e 's:.*/::g'` +else + + ALCC_MANPAGES=`ls -1 ${srcdir}/src/utils/aLinkCreator/docs/alcc.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + ALCC_MANPAGES="`basename src/utils/aLinkCreator/docs/alcc.1` $ALCC_MANPAGES" + +fi + + ALCC_MANPAGES=`echo $ALCC_MANPAGES | tr -d '\n'` + +else + ALCC_MANPAGES= +fi + + + + + if test "$MONOLITHIC" == "yes"; then + + if test -z "$LINGUAS"; then + MONOLITHIC_MANPAGES=`ls -1 ${srcdir}/docs/man/amule.* | sed -e 's:.*/::g'` +else + + MONOLITHIC_MANPAGES=`ls -1 ${srcdir}/docs/man/amule.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + MONOLITHIC_MANPAGES="`basename docs/man/amule.1` $MONOLITHIC_MANPAGES" + +fi + + MONOLITHIC_MANPAGES=`echo $MONOLITHIC_MANPAGES | tr -d '\n'` + +else + MONOLITHIC_MANPAGES= +fi + + + + echo "$as_me:$LINENO: result: ${LINGUAS:-all}" >&5 +echo "${ECHO_T}${LINGUAS:-all}" >&6 + +fi + + + + # Flush standard test results for speeding cache cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -17730,84 +18368,114 @@ rm -f confcache # Other tests +# aMule options -case "$USE_DEBUG" in -yes) DEBUG_FLAGS="-g -D__DEBUG__ -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" - if test x$GCC = xyes; then - DEBUG_FLAGS="$DEBUG_FLAGS -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0" + + # Check whether --enable-debug or --disable-debug was given. +if test "${enable_debug+set}" = set; then + enableval="$enable_debug" + USE_DEBUG=${enableval:-yes} +else + USE_DEBUG=yes +fi; + + if test $USE_DEBUG = yes; then + + MULECPPFLAGS="$MULECPPFLAGS -D__DEBUG__" + + MULECFLAGS="$MULECFLAGS -g" + MULECXXFLAGS="$MULECXXFLAGS -g" + + if test ${GLIBCXX:-no} = yes; then + MULECPPFLAGS="$MULECPPFLAGS -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" fi - if test x$SYS = xwin32; then - RCFLAGS="$RCFLAGS -D__DEBUG__" + if test ${GCC:-no} = yes; then + + MULECFLAGS="$MULECFLAGS -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0" + MULECXXFLAGS="$MULECXXFLAGS -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0" + fi - ;; -*) DEBUG_FLAGS="" - if test x$GCC = xyes; then - DEBUG_FLAGS="$DEBUG_FLAGS -W -Wall -Wshadow -Wundef" + if test ${SYS:-unknown} = win32; then + MULERCFLAGS="$MULERCFLAGS -D__DEBUG__" fi - ;; -esac -#aMule options +else -# Command line tools -case "$BUILDAMULECMD" in -yes) BUILD_AMULECMD="yes" - ;; -*) BUILD_AMULECMD="no" - ;; -esac + if test ${GCC:-no} = yes; then -# For proper compilation flags + MULECFLAGS="$MULECFLAGS -W -Wall -Wshadow -Wundef" + MULECXXFLAGS="$MULECXXFLAGS -W -Wall -Wshadow -Wundef" -WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs adv,core,net` +fi -WXBASE_LIBS=`$WX_CONFIG_WITH_ARGS --libs net` -WXBASE_CXXFLAGS="$WX_CXXFLAGS -DwxUSE_GUI=0" -WXBASE_CFLAGS="$WX_CFLAGS -DwxUSE_GUI=0" -WX_CFLAGS="`echo $WX_CFLAGS | sed "s#-I/#-isystem /#g"`" -WX_CXXFLAGS="`echo $WX_CXXFLAGS | sed "s#-I/#-isystem /#g"`" -WXBASE_CFLAGS="`echo $WXBASE_CFLAGS | sed "s#-I/#-isystem /#g"`" -WXBASE_CXXFLAGS="`echo $WXBASE_CXXFLAGS | sed "s#-I/#-isystem /#g"`" +fi + + + + # Check whether --enable-optimize or --disable-optimize was given. +if test "${enable_optimize+set}" = set; then + enableval="$enable_optimize" + USE_OPTIMIZE=${enableval:-no} +else + USE_OPTIMIZE=no +fi; + if test $USE_OPTIMIZE = yes; then + MULECFLAGS="$MULECFLAGS -O2" + MULECXXFLAGS="$MULECXXFLAGS -O2" +fi -case "$USE_OPTIMIZE" in -yes) OPTIMIZE_FLAGS="-O2" - ;; -*) OPTIMIZE_FLAGS="" - ;; -esac -# Profiling -case "$USE_PROFILE" in -yes) PROFILE_FLAGS="-pg" - ;; -*) PROFILE_FLAGS="" - ;; -esac + # Check whether --enable-profile or --disable-profile was given. +if test "${enable_profile+set}" = set; then + enableval="$enable_profile" + USE_PROFILE=${enableval:-no} +else + USE_PROFILE=no +fi; -echo "$as_me:$LINENO: checking if the applications should be statically linked" >&5 + if test $USE_PROFILE = yes; then + + + MULECFLAGS="$MULECFLAGS -pg" + MULECXXFLAGS="$MULECXXFLAGS -pg" + + MULELDFLAGS="$MULELDFLAGS -pg" + +fi + + + + echo "$as_me:$LINENO: checking if the applications should be statically linked" >&5 echo $ECHO_N "checking if the applications should be statically linked... $ECHO_C" >&6 -case "$USE_DEBUG_STATIC" in -yes) LDFLAGS="$LDFLAGS -static" - ;; -esac -echo "$as_me:$LINENO: result: $USE_DEBUG_STATIC" >&5 -echo "${ECHO_T}$USE_DEBUG_STATIC" >&6 + # Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + if test ${enableval:-no} = yes; then + MULELDFLAGS="$MULELDFLAGS -static" +fi + +fi; + echo "$as_me:$LINENO: result: ${enableval:-no}" >&5 +echo "${ECHO_T}${enableval:-no}" >&6 + + MULECPPFLAGS="$MULECPPFLAGS -DUSE_WX_EXTENSIONS" + # autoconf >= 2.60 already defines ${docdir}, but we always need it. echo "$as_me:$LINENO: checking for docdir" >&5 echo $ECHO_N "checking for docdir... $ECHO_C" >&6 -if test x"$docdir" = x; then - docdir="$datadir"/doc/"$PACKAGE_NAME"-"$PACKAGE_VERSION" - +if test -z "$docdir"; then + docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}" fi + echo "$as_me:$LINENO: result: $docdir" >&5 echo "${ECHO_T}$docdir" >&6 @@ -17823,73 +18491,50 @@ fi echo "$as_me:$LINENO: result: ${svndate:-None required}" >&5 echo "${ECHO_T}${svndate:-None required}" >&6 -test "$svndate" && +if test -n "$svndate"; then + + cat >>confdefs.h <<_ACEOF #define SVNDATE "$svndate" _ACEOF -test x$SYS = xwin32 && test "$svndate" && RCFLAGS="$RCFLAGS -D__PRERELEASE__" -SVNDATE="$svndate" + MULERCFLAGS="$MULERCFLAGS -D__PRERELEASE__" +fi -XRCFLAGS="-Isrc" -CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS $OPTIMIZE_FLAGS $PROFILE_FLAGS -DUSE_WX_EXTENSIONS" -CFLAGS="$CFLAGS $DEBUG_FLAGS $OPTIMIZE_FLAGS $PROFILE_FLAGS -DUSE_WX_EXTENSIONS" +SVNDATE=$svndate -LDFLAGS="$LDFLAGS $PROFILE_FLAGS" -if test x$SYS != xwin32; then - echo "$as_me:$LINENO: checking if this is a FreeBSD 4 or earlier system" >&5 -echo $ECHO_N "checking if this is a FreeBSD 4 or earlier system... $ECHO_C" >&6 - if test x"`uname -s`" = xFreeBSD && test 0`uname -r | cut -c 1` -lt 5; then - LDFLAGS="$LDFLAGS -pthread" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - LDFLAGS="$LDFLAGS -lpthread" - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - fi -fi -case "$USE_NLS" in -yes) - echo -n "Generating ${POSUB}/LINGUAS... " - Generate_Langs=`echo $SelectedLangs | sed -e 's/ .*//' -e 's/,/\\\\|/g'` - if test "$Generate_Langs" = "all"; then - cp ${srcdir}/${POSUB}/LINGUAS.in ${srcdir}/${POSUB}/LINGUAS - else - grep $Generate_Langs ${srcdir}/${POSUB}/LINGUAS.in > ${srcdir}/${POSUB}/LINGUAS - fi - if test `wc -l ${srcdir}/${POSUB}/LINGUAS | sed -e 's/ .*//'` = 0; then - cp ${srcdir}/${POSUB}/LINGUAS.in ${srcdir}/${POSUB}/LINGUAS - fi - echo "$as_me:$LINENO: result: Done" >&5 -echo "${ECHO_T}Done" >&6 - ;; -*) - HAVE_GETTEXT="no" -esac +# Check whether --with-denoise-level or --without-denoise-level was given. +if test "${with_denoise_level+set}" = set; then + withval="$with_denoise_level" -echo "$as_me:$LINENO: checking denoising level" >&5 +fi; + + echo "$as_me:$LINENO: checking denoising level" >&5 echo $ECHO_N "checking denoising level... $ECHO_C" >&6 -if test "$denoiselevel" = "yes"; then - denoiselevel=5 + if test ${with_denoise_level:-5} = yes; then + with_denoise_level=5 fi -if test "$denoiselevel" = "no"; then - denoiselevel=0 + + if test ${with_denoise_level:-5} = no; then + with_denoise_level=0 fi -if test $denoiselevel -gt 4; then - if test "${svndate:+set}" = "set"; then - denoiselevel=0 - else - denoiselevel=4 - fi + + if test ${with_denoise_level:-5} -gt 4; then + if test "${svndate:+set}" = "set"; then + with_denoise_level=0 +else + with_denoise_level=4 fi -echo "$as_me:$LINENO: result: $denoiselevel" >&5 -echo "${ECHO_T}$denoiselevel" >&6 - ac_config_commands="$ac_config_commands denoiser" +fi + + echo "$as_me:$LINENO: result: $with_denoise_level" >&5 +echo "${ECHO_T}$with_denoise_level" >&6 + + ac_config_commands="$ac_config_commands denoiser" @@ -17975,7 +18620,7 @@ -if test x$BUILD_AMULECMD = xyes; then +if test x$AMULECMD = xyes; then COMPILE_CMD_TRUE= COMPILE_CMD_FALSE='#' else @@ -17995,7 +18640,7 @@ -if test x$ENABLE_UPNP = xyes -a x$SYS != xwin32; then +if test x$ENABLE_UPNP = xyes; then ENABLE_UPNP_TRUE= ENABLE_UPNP_FALSE='#' else @@ -18045,7 +18690,7 @@ -if test x$HAVE_GETTEXT = xyes; then +if test x$USE_NLS = xyes; then COMPILE_NLS_TRUE= COMPILE_NLS_FALSE='#' else @@ -18064,7 +18709,8 @@ fi -if test x$BUILDAMULECMD = xyes -o x$WEB = xyes; then +# Check for readline library +if test x$AMULECMD = xyes -o x$WEB = xyes; then echo "$as_me:$LINENO: checking for a readline compatible library" >&5 echo $ECHO_N "checking for a readline compatible library... $ECHO_C" >&6 @@ -18540,54 +19186,57 @@ # DO NOT MOVE UP... THERE'S A REASON TO BE HERE!! + # Check whether --enable-ccache or --disable-ccache was given. +if test "${enable_ccache+set}" = set; then + enableval="$enable_ccache" + +fi; + # Check whether --with-ccache-prefix or --without-ccache-prefix was given. if test "${with_ccache_prefix+set}" = set; then withval="$with_ccache_prefix" - ccache_prefix="$withval" -else - ccache_prefix="" -fi; +fi; -echo "$as_me:$LINENO: checking whether ccache support should be added" >&5 + echo "$as_me:$LINENO: checking whether ccache support should be added" >&5 echo $ECHO_N "checking whether ccache support should be added... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $ccache" >&5 -echo "${ECHO_T}$ccache" >&6 + echo "$as_me:$LINENO: result: ${enable_ccache:-no}" >&5 +echo "${ECHO_T}${enable_ccache:-no}" >&6 + if test ${enable_ccache:-no} = yes; then -case "$ccache" in + echo "$as_me:$LINENO: checking for ccache presence" >&5 +echo $ECHO_N "checking for ccache presence... $ECHO_C" >&6 + if test -z "$with_ccache_prefix"; then -yes) + ccache_full=`which ccache` + with_ccache_prefix=`dirname ${ccache_full}` - if test x$ccache_prefix == x ; then - ccache_full=$(which ccache) - ccache_prefix=$(dirname ${ccache_full}) - fi - $ccache_prefix/ccache -V > /dev/null 2>&1 - CCACHE=$? - if test "$CCACHE" != 0; then - result="no" - else - result="yes" - fi - echo "$as_me:$LINENO: checking for ccache presence" >&5 -echo $ECHO_N "checking for ccache presence... $ECHO_C" >&6 - echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6 +fi + if $with_ccache_prefix/ccache -V >/dev/null 2>&1; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + CC="$with_ccache_prefix/ccache $CC" + CXX="$with_ccache_prefix/ccache $CXX" + BUILD_CC="$with_ccache_prefix/ccache $BUILD_CC" - if [ $CCACHE = 0 ]; then - GCC="$ccache_prefix/ccache $GCC" - CC="$ccache_prefix/ccache $CC" - GXX="$ccache_prefix/ccache $GXX" - CXX="$ccache_prefix/ccache $CXX" - BUILD_CC="$ccache_prefix/ccache $BUILD_CC" - fi -esac +else - ac_config_files="$ac_config_files Makefile docs/Makefile docs/man/Makefile intl/Makefile m4/Makefile src/Makefile src/kademlia/Makefile src/kademlia/utils/Makefile src/kademlia/kademlia/Makefile src/kademlia/routing/Makefile src/kademlia/net/Makefile src/pixmaps/Makefile src/pixmaps/flags_xpm/Makefile src/libs/Makefile src/libs/ec/Makefile src/libs/ec/abstracts/Makefile src/libs/ec/cpp/Makefile src/libs/common/Makefile src/utils/Makefile src/utils/aLinkCreator/Makefile src/utils/aLinkCreator/docs/Makefile src/utils/aLinkCreator/src/Makefile src/utils/cas/Makefile src/utils/cas/docs/Makefile src/utils/wxCas/Makefile src/utils/wxCas/docs/Makefile src/utils/wxCas/src/Makefile src/utils/xas/Makefile src/utils/xas/autostart-xas src/utils/xas/docs/Makefile src/skins/Makefile src/webserver/Makefile src/webserver/src/Makefile src/webserver/default/Makefile src/webserver/php-default/Makefile src/webserver/chicane/Makefile unittests/Makefile unittests/muleunit/Makefile unittests/tests/Makefile" + enable_ccache=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi + + +fi + + + + ac_config_files="$ac_config_files Makefile docs/Makefile docs/man/Makefile intl/Makefile src/Makefile src/pixmaps/Makefile src/pixmaps/flags_xpm/Makefile src/libs/Makefile src/libs/ec/Makefile src/libs/ec/cpp/Makefile src/libs/common/Makefile src/utils/Makefile src/utils/aLinkCreator/Makefile src/utils/aLinkCreator/docs/Makefile src/utils/aLinkCreator/src/Makefile src/utils/cas/Makefile src/utils/cas/docs/Makefile src/utils/fileview/Makefile src/utils/wxCas/Makefile src/utils/wxCas/docs/Makefile src/utils/wxCas/src/Makefile src/utils/xas/Makefile src/utils/xas/autostart-xas src/utils/xas/docs/Makefile src/skins/Makefile src/webserver/Makefile src/webserver/src/Makefile src/webserver/default/Makefile src/webserver/php-default/Makefile src/webserver/chicane/Makefile src/webserver/litoral/Makefile unittests/Makefile unittests/muleunit/Makefile unittests/tests/Makefile" ac_config_files="$ac_config_files po/Makefile.in Compilation.flags" @@ -19105,7 +19754,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by aMule $as_me SVN, which was +This file was extended by aMule $as_me 2.2.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19168,7 +19817,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -aMule config.status SVN +aMule config.status 2.2.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -19275,7 +19924,7 @@ # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" -level=$denoiselevel +denoiserlevel=$with_denoise_level _ACEOF @@ -19290,18 +19939,11 @@ "docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "docs/man/Makefile" ) CONFIG_FILES="$CONFIG_FILES docs/man/Makefile" ;; "intl/Makefile" ) CONFIG_FILES="$CONFIG_FILES intl/Makefile" ;; - "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "src/kademlia/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/kademlia/Makefile" ;; - "src/kademlia/utils/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/kademlia/utils/Makefile" ;; - "src/kademlia/kademlia/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/kademlia/kademlia/Makefile" ;; - "src/kademlia/routing/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/kademlia/routing/Makefile" ;; - "src/kademlia/net/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/kademlia/net/Makefile" ;; "src/pixmaps/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/pixmaps/Makefile" ;; "src/pixmaps/flags_xpm/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/pixmaps/flags_xpm/Makefile" ;; "src/libs/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/libs/Makefile" ;; "src/libs/ec/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/libs/ec/Makefile" ;; - "src/libs/ec/abstracts/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/libs/ec/abstracts/Makefile" ;; "src/libs/ec/cpp/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/libs/ec/cpp/Makefile" ;; "src/libs/common/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/libs/common/Makefile" ;; "src/utils/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/utils/Makefile" ;; @@ -19310,6 +19952,7 @@ "src/utils/aLinkCreator/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/utils/aLinkCreator/src/Makefile" ;; "src/utils/cas/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/utils/cas/Makefile" ;; "src/utils/cas/docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/utils/cas/docs/Makefile" ;; + "src/utils/fileview/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/utils/fileview/Makefile" ;; "src/utils/wxCas/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/utils/wxCas/Makefile" ;; "src/utils/wxCas/docs/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/utils/wxCas/docs/Makefile" ;; "src/utils/wxCas/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/utils/wxCas/src/Makefile" ;; @@ -19322,6 +19965,7 @@ "src/webserver/default/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/webserver/default/Makefile" ;; "src/webserver/php-default/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/webserver/php-default/Makefile" ;; "src/webserver/chicane/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/webserver/chicane/Makefile" ;; + "src/webserver/litoral/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/webserver/litoral/Makefile" ;; "unittests/Makefile" ) CONFIG_FILES="$CONFIG_FILES unittests/Makefile" ;; "unittests/muleunit/Makefile" ) CONFIG_FILES="$CONFIG_FILES unittests/muleunit/Makefile" ;; "unittests/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES unittests/tests/Makefile" ;; @@ -19417,14 +20061,6 @@ s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t @@ -19450,8 +20086,21 @@ s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t s,@RESOLV_LIB@,$RESOLV_LIB,;t t s,@X11LIBS@,$X11LIBS,;t t +s,@MULECPPFLAGS@,$MULECPPFLAGS,;t t +s,@MULECFLAGS@,$MULECFLAGS,;t t +s,@MULECXXFLAGS@,$MULECXXFLAGS,;t t +s,@MULELDFLAGS@,$MULELDFLAGS,;t t +s,@MULERCFLAGS@,$MULERCFLAGS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t @@ -19494,25 +20143,23 @@ s,@ac_ct_AR@,$ac_ct_AR,;t t s,@LD@,$LD,;t t s,@ac_ct_LD@,$ac_ct_LD,;t t +s,@ZLIB_CPPFLAGS@,$ZLIB_CPPFLAGS,;t t +s,@ZLIB_LDFLAGS@,$ZLIB_LDFLAGS,;t t +s,@ZLIB_LIBS@,$ZLIB_LIBS,;t t s,@GDLIB_CONFIG_PATH@,$GDLIB_CONFIG_PATH,;t t -s,@GDLIB_CPPFLAGS@,$GDLIB_CPPFLAGS,;t t s,@GDLIB_CFLAGS@,$GDLIB_CFLAGS,;t t -s,@GDLIB_CXXFLAGS@,$GDLIB_CXXFLAGS,;t t s,@GDLIB_LDFLAGS@,$GDLIB_LDFLAGS,;t t -s,@GDLIB_CFLAGS_ONLY@,$GDLIB_CFLAGS_ONLY,;t t -s,@GDLIB_CXXFLAGS_ONLY@,$GDLIB_CXXFLAGS_ONLY,;t t s,@GDLIB_LIBS@,$GDLIB_LIBS,;t t -s,@GDLIB_LIBS_STATIC@,$GDLIB_LIBS_STATIC,;t t -s,@GDLIB_VERSION@,$GDLIB_VERSION,;t t s,@CAS_DEFS@,$CAS_DEFS,;t t +s,@REGEX_LIBS@,$REGEX_LIBS,;t t s,@LIBPNG_CONFIG_PATH@,$LIBPNG_CONFIG_PATH,;t t s,@LIBPNG_CFLAGS@,$LIBPNG_CFLAGS,;t t -s,@LIBPNG_CXXFLAGS@,$LIBPNG_CXXFLAGS,;t t s,@LIBPNG_LDFLAGS@,$LIBPNG_LDFLAGS,;t t s,@LIBPNG_LIBS@,$LIBPNG_LIBS,;t t s,@AMULEWEB_DEFS@,$AMULEWEB_DEFS,;t t -s,@GEOIP_INCLUDE@,$GEOIP_INCLUDE,;t t -s,@GEOIP_LIB@,$GEOIP_LIB,;t t +s,@GEOIP_CPPFLAGS@,$GEOIP_CPPFLAGS,;t t +s,@GEOIP_LDFLAGS@,$GEOIP_LDFLAGS,;t t +s,@GEOIP_LIBS@,$GEOIP_LIBS,;t t s,@WX_CONFIG_PATH@,$WX_CONFIG_PATH,;t t s,@WX_CPPFLAGS@,$WX_CPPFLAGS,;t t s,@WX_CFLAGS@,$WX_CFLAGS,;t t @@ -19529,23 +20176,25 @@ s,@WX_DEBUG@,$WX_DEBUG,;t t s,@WX_SHARED@,$WX_SHARED,;t t s,@WX_PORT@,$WX_PORT,;t t +s,@WXBASE_LIBS@,$WXBASE_LIBS,;t t +s,@WXBASE_CPPFLAGS@,$WXBASE_CPPFLAGS,;t t s,@RC@,$RC,;t t -s,@ac_ct_RC@,$ac_ct_RC,;t t s,@RCFLAGS@,$RCFLAGS,;t t -s,@CRYPTO_PP_PREFIX@,$CRYPTO_PP_PREFIX,;t t -s,@CRYPTO_PP_VERSION_STRING@,$CRYPTO_PP_VERSION_STRING,;t t -s,@CRYPTO_PP_VERSION_NUMBER@,$CRYPTO_PP_VERSION_NUMBER,;t t -s,@CRYPTO_PP_STYLE@,$CRYPTO_PP_STYLE,;t t -s,@CRYPTO_PP_LIB_NAME@,$CRYPTO_PP_LIB_NAME,;t t -s,@CRYPTO_PP_INCLUDE_PREFIX@,$CRYPTO_PP_INCLUDE_PREFIX,;t t -s,@CRYPTO_PP_CXXFLAGS@,$CRYPTO_PP_CXXFLAGS,;t t -s,@CRYPTO_PP_LDFLAGS@,$CRYPTO_PP_LDFLAGS,;t t -s,@CRYPTOLIBS@,$CRYPTOLIBS,;t t -s,@BFD_FLAGS@,$BFD_FLAGS,;t t -s,@BFD_LIB@,$BFD_LIB,;t t -s,@HAVE_GETTEXT@,$HAVE_GETTEXT,;t t -s,@HAVE_FLEX_EXTENDED@,$HAVE_FLEX_EXTENDED,;t t +s,@ac_ct_RC@,$ac_ct_RC,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t +s,@LIBUPNP_CPPFLAGS@,$LIBUPNP_CPPFLAGS,;t t +s,@LIBUPNP_CFLAGS@,$LIBUPNP_CFLAGS,;t t +s,@LIBUPNP_LDFLAGS@,$LIBUPNP_LDFLAGS,;t t +s,@LIBUPNP_LIBS@,$LIBUPNP_LIBS,;t t +s,@CRYPTOPP_CPPFLAGS@,$CRYPTOPP_CPPFLAGS,;t t +s,@CRYPTOPP_LDFLAGS@,$CRYPTOPP_LDFLAGS,;t t +s,@CRYPTOPP_LIBS@,$CRYPTOPP_LIBS,;t t +s,@BFD_CPPFLAGS@,$BFD_CPPFLAGS,;t t +s,@BFD_LIBS@,$BFD_LIBS,;t t s,@ALLOCA@,$ALLOCA,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@POW_LIB@,$POW_LIB,;t t s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t s,@MSGFMT@,$MSGFMT,;t t s,@GMSGFMT@,$GMSGFMT,;t t @@ -19568,11 +20217,17 @@ s,@LIBINTL@,$LIBINTL,;t t s,@LTLIBINTL@,$LTLIBINTL,;t t s,@POSUB@,$POSUB,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@POW_LIB@,$POW_LIB,;t t -s,@WXBASE_LIBS@,$WXBASE_LIBS,;t t -s,@WXBASE_CFLAGS@,$WXBASE_CFLAGS,;t t -s,@WXBASE_CXXFLAGS@,$WXBASE_CXXFLAGS,;t t +s,@AMULE_DAEMON_MANPAGES@,$AMULE_DAEMON_MANPAGES,;t t +s,@AMULECMD_MANPAGES@,$AMULECMD_MANPAGES,;t t +s,@WEB_MANPAGES@,$WEB_MANPAGES,;t t +s,@AMULE_GUI_MANPAGES@,$AMULE_GUI_MANPAGES,;t t +s,@CAS_MANPAGES@,$CAS_MANPAGES,;t t +s,@WXCAS_MANPAGES@,$WXCAS_MANPAGES,;t t +s,@ED2K_MANPAGES@,$ED2K_MANPAGES,;t t +s,@ALC_MANPAGES@,$ALC_MANPAGES,;t t +s,@ALCC_MANPAGES@,$ALCC_MANPAGES,;t t +s,@MONOLITHIC_MANPAGES@,$MONOLITHIC_MANPAGES,;t t +s,@INCINTL@,$INCINTL,;t t s,@docdir@,$docdir,;t t s,@SVNDATE@,$SVNDATE,;t t s,@WEB_TRUE@,$WEB_TRUE,;t t @@ -19610,9 +20265,6 @@ s,@GENERATE_FLEX_HEADER_TRUE@,$GENERATE_FLEX_HEADER_TRUE,;t t s,@GENERATE_FLEX_HEADER_FALSE@,$GENERATE_FLEX_HEADER_FALSE,;t t s,@READLINE_LIBS@,$READLINE_LIBS,;t t -s,@ccache@,$ccache,;t t -s,@CCACHE@,$CCACHE,;t t -s,@ccache_prefix@,$ccache_prefix,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -20392,9 +21044,9 @@ ;; esac done ;; - denoiser ) if test $level -gt 0; then + denoiser ) if test $denoiserlevel -gt 0; then if test ! -d src/utils/scripts; then mkdir -p src/utils/scripts; fi - sed -e "1{x;s/.*/1/;x;};/^[ ]*\$/d;/^#if /{/level.*$level/{x;s/^/1/;x;b0;};x;s/^/0/;x;:0;d;};/^#else/{x;/^1/{s/1/0/;b1;};s/0/1/;:1;x;d;};/^#endif/{x;s/.//;x;d;};/^[ ]*#/d;x;/^1/{x;b;};x;d" \ + sed -e "1{x;s/.*/1/;x;};/^[ ]*\$/d;/^#if /{/level.*$denoiserlevel/{x;s/^/1/;x;b0;};x;s/^/0/;x;:0;d;};/^#else/{x;/^1/{s/1/0/;b1;};s/0/1/;:1;x;d;};/^#endif/{x;s/.//;x;d;};/^[ ]*#/d;x;/^1/{x;b;};x;d" \ $srcdir/src/utils/scripts/denoiser.rules > src/utils/scripts/denoiser.sed for i in `find . -name 'Makefile' -print`; do if test -n "`head -n 1 $i | grep '^#'`"; then @@ -20446,20 +21098,20 @@ echo echo " **** aMule Core ****" echo " Prefix where aMule should be installed? ${prefix:-none}" -echo " Should aMule be compiled with i18n support? ${HAVE_GETTEXT:-no}" +echo " Should aMule be compiled with i18n support? ${USE_NLS:-no}" echo " Should aMule be compiled in debug mode? ${USE_DEBUG:-no}" echo " Should aMule be compiled with profiling? ${USE_PROFILE:-no}" echo " Should aMule be compiled with optimizations? ${USE_OPTIMIZE:-no}" echo " Should aMule be compiled with UPnP support? ${ENABLE_UPNP:-yes}" -echo " Should aMule be compiled with IP2country support? ${ENABLE_IP2COUNTRY:-yes}" +echo " Should aMule be compiled with IP2country support? ${ENABLE_IP2COUNTRY:-no}" echo " Should aMule monolithic application be built? ${MONOLITHIC:-yes}" echo " Should aMule daemon version be built? ${AMULE_DAEMON:-no}" echo " Should aMule remote gui be built? (EXPERIMENTAL) ${AMULE_GUI:-no}" -echo " Crypto++ library/headers style? ${CRYPTO_PP_STYLE:-not found}" +echo " Crypto++ library/headers style? ${CRYPTOPP_STYLE:-not found}" echo echo " **** aMule TextClient ****" -echo " Should aMule Command Line Client be built? ${BUILD_AMULECMD:-no}" +echo " Should aMule Command Line Client be built? ${AMULECMD:-no}" echo echo " **** aMule WebServer ****" echo " Should aMule WebServer be built? ${WEB:-no}" @@ -20477,7 +21129,7 @@ echo echo " **** General Libraries and Tools ****" -echo " Should ccache support be enabled? ${ccache:-no}" +echo " Should ccache support be enabled? ${enable_ccache:-no}" echo " Libraries aMule will use to build:" wxinfo="$WX_PORT" if test $WX_DEBUG -eq 1; then @@ -20491,7 +21143,43 @@ fi echo " wxWidgets ${WX_VERSION_FULL} ($wxinfo)" -echo " crypto++ ${CRYPTO_PP_VERSION_STRING} (${CRYPTO_PP_STYLE})" +echo " crypto++ ${CRYPTOPP_VERSION_STRING} (${CRYPTOPP_STYLE}, in ${CRYPTOPP_PREFIX})" +if test -n "$with_libupnp_prefix"; then + libupnp_place=" (in $with_libupnp_prefix)" +fi + +if test x${ENABLE_UPNP} = xyes; then + echo " libupnp ${LIBUPNP_VERSION:-Not detected}${libupnp_place:-}" + +fi +if test x${WEB:-no} != xno; then +if test $regex_found = no; then + regex_found="Not detected" +else + if test -z "$REGEX_LIB"; then + regex_found=system +else + regex_found="standalone (in $REGEX_LIB)" +fi + +fi + +echo " regex $regex_found" +fi +if test ${enable_nls:-yes} = yes; then +if test x$USE_NLS = xno; then + libintl_found="Not detected" +else + if test x$USE_INCLUDED_LIBINTL = xyes; then + libintl_found="included" +else + libintl_found="system" +fi + +fi + +echo " libintl $libintl_found" +fi if test x$LIBPNG_VERSION != xnot_needed; then echo " libpng ${LIBPNG_VERSION:-Not detected}" fi @@ -20499,10 +21187,23 @@ echo " libgd ${GDLIB_VERSION:-Not detected}" fi echo " zlib ${ZLIB_VERSION:-Not detected}" -if test x"$LIBPNG_VERSION" = x""; then +if test x$WEB = xdisabled; then echo "" echo "" -echo " WARNING! libpng >= 1.2.0 not found." -echo " amuleweb will be compiled but file download progress bar images will NOT be generated." +echo "WARNING! amuleweb has been disabled because configure could not find" +echo "a POSIX compliant regex library." +echo "" +fi +if test -z "$LIBPNG_VERSION"; then +echo "" +echo "" +echo "WARNING! libpng >= 1.2.0 not found." +echo "amuleweb will be compiled but file download progress bar images will NOT be generated." +echo "" +fi +if test x$ENABLE_UPNP = xdisabled; then +echo "" +echo "" +echo "WARNING! UPnP code has been disabled because ${libupnp_error}." echo "" fi diff -ruN -d amule-2.2.0~svn20080218/configure.in amule-2.2.2/configure.in --- amule-2.2.0~svn20080218/configure.in 2008-02-17 21:09:50.000000000 +0000 +++ amule-2.2.2/configure.in 2008-08-08 13:28:47.000000000 +0000 @@ -1,59 +1,53 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. +# +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# -AC_INIT([aMule],[SVN],[admin@amule.org]) -AC_CANONICAL_HOST +AC_INIT([aMule], [2.2.2], [admin@amule.org]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/amule.cpp]) -AM_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) AM_MAINTAINER_MODE -# Removing -fomit since it causes problems with CryptoPP -CFLAGS="`echo $CFLAGS | sed "s/-fomit-frame-pointer//g"`" -CXXFLAGS="`echo $CXXFLAGS | sed "s/-fomit-frame-pointer//g"`" - -# System detection, need AC_CANONICAL_HOST -case "${host_os}" in -"") - SYS=unknown - ;; -darwin*) - SYS=darwin - CFLAGS="${CFLAGS} -no-cpp-precomp -D_INTL_REDIRECT_MACROS -DNOPCH"; - LDFLAGS="$LDFLAGS -bind_at_load" - touch src/Scanner.cpp - ;; -openbsd*) - SYS=openbsd - LIBS="$LIBS -L/usr/local/lib" - X11LIBS="-lX11 -L/usr/X11R6/lib" - CXXFLAGS=" $CXXFLAGS -D__OPENBSD__" - if test "$DEBUG_FLAGS" != ""; then - DEBUG_FLAGS="-Wall -g -fno-inline -D__DEBUG__" - fi - ;; -*cygwin* | *mingw32*) - SYS=win32 - CFLAGS="$CFLAGS -DNOMINMAX" - CXXFLAGS="$CXXFLAGS -DNOMINMAX" - ;; -solaris*) - RESOLV_LIB="-lresolv -lnsl" - X11LIBS="-lX11" - LIBS="$LIBS -lrt" -esac - -AC_SUBST(RESOLV_LIB) -AC_SUBST(X11LIBS) +dnl Check host system. +MULE_CHECK_SYSTEM -# Checks for programs. +dnl Checks for programs. +dnl Workaround for these checks may alter CFLAGS and CXXFLAGS, especially if they were empty +MULE_BACKUP([CFLAGS]) +MULE_BACKUP([CXXFLAGS]) +MULE_BACKUP([BUILD_CFLAGS]) AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_CC AC_PROG_CPP -AS_IF([test x$SYS = xwin32], [AC_PROG_AWK]) AS_IF([test "$cross_compiling" = yes], [AC_PROG_BUILD_CC], [BUILD_CC="$CC" ; BUILD_EXEEXT=$EXEEXT]) +MULE_RESTORE([CFLAGS]) +MULE_RESTORE([CXXFLAGS]) +MULE_RESTORE([BUILD_CFLAGS]) +AC_PROG_AWK AC_PROG_EGREP AC_PROG_MAKE_SET AC_PROG_LEX @@ -61,51 +55,16 @@ AC_PROG_RANLIB AC_PROG_YACC -# Find the right ranlib, even when cross-compiling -# And for some other tools for cross compilation +dnl Find the right ranlib, even when cross-compiling +dnl And for some other tools for cross compilation AC_CHECK_TOOL(RANLIB, ranlib) AC_CHECK_TOOL(STRIP, strip) AC_CHECK_TOOL(AR, ar) AC_CHECK_TOOL(LD, ld) -# -# Add args to configure -# -AC_ARG_ENABLE( - [ccache], - [AS_HELP_STRING( - [--enable-ccache], - [enable ccache support for fast recompilation])], - [ccache=$enableval], [ccache=no]) - -AC_ARG_ENABLE( - [debug], - [AS_HELP_STRING( - [--disable-debug], - [disable additional debugging output])], - [USE_DEBUG=$enableval], [USE_DEBUG=yes]) - -AC_ARG_ENABLE( - [optimize], - [AS_HELP_STRING( - [--enable-optimize], - [enable code optimizing])], - [USE_OPTIMIZE=$enableval], [USE_OPTIMIZE=no]) - -AC_ARG_ENABLE( - [profile], - [AS_HELP_STRING( - [--enable-profile], - [enable code profiling])], - [USE_PROFILE=$enableval], [USE_PROFILE=no]) - -AC_ARG_ENABLE( - [static], - [AS_HELP_STRING( - [--enable-static], - [produce a statically linked executable])], - [USE_DEBUG_STATIC=$enableval], [USE_DEBUG_STATIC=no]) - +dnl +dnl Add args to configure +dnl AC_ARG_ENABLE( [monolithic], [AS_HELP_STRING( @@ -125,7 +84,7 @@ [AS_HELP_STRING( [--enable-amulecmd], [compile aMule command line client])], - [BUILDAMULECMD=$enableval], [BUILDAMULECMD=no]) + [AMULECMD=$enableval], [AMULECMD=no]) AC_ARG_ENABLE( [webserver], @@ -196,193 +155,111 @@ [--enable-geoip], [compile with GeoIP IP2Country library])], [ENABLE_IP2COUNTRY=$enableval], [ENABLE_IP2COUNTRY=no]) +AS_IF([test ${ENABLE_IP2COUNTRY:-no} = yes], [GEOIP_LIBS="-lGeoIP"]) AC_ARG_WITH( [geoip-headers], AS_HELP_STRING([--with-geoip-headers=DIR], [GeoIP include files location]), - [GEOIP_INCLUDE="-I$withval"]) + [GEOIP_CPPFLAGS="-I$withval"]) AC_ARG_WITH( [geoip-lib], AS_HELP_STRING([--with-geoip-lib=DIR], [GeoIP library location]), - [GEOIP_LIB="-L$withval $GEOIP_LIB"]) + [GEOIP_LDFLAGS="-L$withval"]) AC_ARG_WITH( [geoip-static], AS_HELP_STRING([--with-geoip-static], [Explicitly link GeoIP statically (default=no)]), - [if test "$withval" != "no"; then - GEOIP_LIB="-Wl,-Bstatic $GEOIP_LIB -Wl,-Bdynamic" - fi]) - -AC_ARG_WITH( - [denoise-level], - [AS_HELP_STRING( - [--with-denoise-level=], - [Specifies denoising level (0-4):]) -AS_HELP_STRING([], [0 - Do nothing]) -AS_HELP_STRING([], [4 - Suppress all normal output]) -AS_HELP_STRING([], [(for more information see src/utils/scripts/denoiser.rules)]) - ], - [denoiselevel="$withval"], [denoiselevel=yes]) + [AS_IF([test "$withval" != "no"], [GEOIP_LIBS="-Wl,-Bstatic $GEOIP_LIBS -Wl,-Bdynamic"])]) -dnl Default is yes, because they're most likely compatible. -dnl However, this is only used when cross-compiling. +# Default is yes, because they're most likely compatible. +# However, this is only used when cross-compiling. AC_ARG_WITH( [gnu-malloc], [AS_HELP_STRING([--without-gnu-malloc], [Don't assume that we use GNU libc compatible malloc/realloc when cross-compiling])], [gnumalloc=$withval], [gnumalloc=yes]) -AC_ARG_WITH( - [language], - [AS_HELP_STRING([--with-language=], - [Specify a comma-separated list of Languages you want to have installed]) -AS_HELP_STRING([], [See po/LINGUAS.in for aviable languages]) - ], - [SelectedLangs="$withval"], [SelectedLangs=all]) # Checking for libs before all other stuff to break # configure as soon as possible in case of a missing one -# to avoid losing to much time - -# Sets gettext version. -AM_GNU_GETTEXT_VERSION(0.11.5) +# to avoid losing too much time # Check for zlib -AC_OPTIONS_ZLIB -AC_CHECK_ZLIB([1.1.4], , [AC_MSG_ERROR([zlib >= 1.1.4 is required for aMule])]) - -if test x$CAS = xyes -o x$WEB = xyes; then -# Check for gd -AM_OPTIONS_GDLIBCONFIG - -AM_PATH_GDLIBCONFIG(2.0.0,GDLIBFOUND=1) +MULE_CHECK_ZLIB([1.1.4],, [AC_MSG_ERROR([zlib >= 1.1.4 is required for aMule])]) -case "$GDLIBFOUND" in -1) CAS_DEFS="-D__GD__" - GDLIB_LIBS="$GDLIB_LIBS -lgd" - ;; -*)AC_MSG_NOTICE([ - WARNING: gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found. +AS_IF([test x$CAS = xyes], [ + # Check for gd + MULE_CHECK_GDLIB([2.0.0], [ + CAS_DEFS="-D__GD__" + MULE_PREPEND([GDLIB_LIBS], [-lgd]) + ], [CAS_DEFS=]) + AS_IF([test -z "$CAS_DEFS"], [ + AC_MSG_WARN([ + gd-lib >= 2.0.0, or a functional gd.h (from gd-devel) not found. Please check that gdlib-config is in your default path, check out LD_LIBRARY_PATH or equivalent variable. Or this might also be that your gdlib-config has other name. Please try again with --with-gdlib-config=/usr/bin/gdlib-config - (replace /usr/bin/gdlib-config with a valid path to your gdlib-config). - If you use compiled packages check if you have devel pack installed. - To download the latest version check http://www.boutell.com/gd - for sources. - ]) - - CAS_DEFS="" - GDLIB_LIBS="" - GDLIB_CFLAGS="" - GDLIB_LDFLAGS="" - ;; -esac - -else - CAS_DEFS="" - GDLIB_LIBS="" - GDLIB_CFLAGS="" - GDLIB_LDFLAGS="" - GDLIB_VERSION="not_needed" -fi - -AC_SUBST(CAS_DEFS) - - -if test x$WEB = xyes; then -# Check for libpng -# This check _must_ occur *after* the check for gd -AM_OPTIONS_LIBPNGCONFIG + (replace /usr/bin/gdlib-config with a valid path to your gdlib-config). + If you use compiled packages check if you have devel pack installed. + To download the latest version check http://www.boutell.com/gd + for sources.]) + ]) +], [GDLIB_VERSION="not_needed"]) +AC_SUBST([CAS_DEFS])dnl -AM_PATH_LIBPNGCONFIG(1.2.0,LIBPNGFOUND=1) -case "$LIBPNGFOUND" in -1) AMULEWEB_DEFS="-DWITH_LIBPNG" - ;; -*)AC_MSG_NOTICE([ - WARNING: libpng-devel >= 1.2.0 is needed for amuleweb - ]) - AMULEWEB_DEFS="" - LIBPNG_LIBS="" - LIBPNG_CFLAGS="" - LIBPNG_CXXFLAGS="" - LIBPNG_LDFLAGS="" - ;; -esac -else - AMULEWEB_DEFS="" - LIBPNG_LIBS="" - LIBPNG_CFLAGS="" - LIBPNG_CXXFLAGS="" - LIBPNG_LDFLAGS="" - LIBPNG_VERSION="not_needed" -fi - -AC_SUBST(AMULEWEB_DEFS) +AS_IF([test x$WEB = xyes], [MULE_CHECK_REGEX(, [WEB=disabled])]) +AS_IF([test x$WEB = xyes], + [MULE_CHECK_LIBPNG([1.2.0], [AMULEWEB_DEFS="-DWITH_LIBPNG"], [AC_MSG_WARN([libpng-devel >= 1.2.0 is needed for amuleweb])])], + [LIBPNG_VERSION="not_needed"]) +AC_SUBST([AMULEWEB_DEFS])dnl # Check for perl File::Copy AC_MSG_CHECKING([for File::Copy]) - if perl -e "require File::Copy" 2>/dev/null; then - AC_MSG_RESULT([ok]) - else - AC_MSG_ERROR([File::Copy perl module is required]) - fi +AS_IF([perl -e "require File::Copy" 2>/dev/null], [AC_MSG_RESULT([ok])], [AC_MSG_ERROR([File::Copy perl module is required])]) # Check if we need the GUI AC_MSG_CHECKING([whether we need the GUI]) -if test x"$MONOLITHIC" = x"yes" ; then - need_gui="yes" -fi - -if test x"$WXCAS" = x"yes" ; then - need_gui="yes" -fi - -if test x"$ALC" = x"yes" ; then - need_gui="yes" -fi - -if test x"$AMULE_GUI" = x"yes" ; then - need_gui="yes" -fi - -if test "x${need_gui:+set}" != "xset" ; then - need_gui="no" -fi +AS_IF([test x$MONOLITHIC = xyes], [need_gui=yes]) +AS_IF([test x$WXCAS = xyes], [need_gui=yes]) +AS_IF([test x$ALC = xyes], [need_gui=yes]) +AS_IF([test x$AMULE_GUI = xyes], [need_gui=yes]) +AS_IF([test x${need_gui:+set} != xset], [need_gui=no]) AC_MSG_RESULT($need_gui) # Check for GeoIP (required for IP2Country capability) -if test x"$ENABLE_IP2COUNTRY" = x"yes" ; then - GEOIP_LIB="-lGeoIP" - CXXFLAGS="$CXXFLAGS $GEOIP_INCLUDE" - LDFLAGS="$LDFLAGS $GEOIP_LIB" - AC_CHECK_HEADER(GeoIP.h,, +AS_IF([test ${ENABLE_IP2COUNTRY:-no} = yes], [ + MULE_APPEND([GEOIP_CPPFLAGS], [-DENABLE_IP2COUNTRY=1]) + MULE_BACKUP([CPPFLAGS]) + MULE_APPEND([CPPFLAGS], [$GEOIP_CPPFLAGS]) + MULE_BACKUP([LDFLAGS]) + MULE_APPEND([LDFLAGS], [$GEOIP_LDFLAGS]) + AC_CHECK_HEADER([GeoIP.h],, [AC_MSG_ERROR([--enable-geoip passed to configure, but the GeoIP header files were not found])]) - AC_CHECK_LIB(GeoIP, GeoIP_open, + AC_CHECK_LIB([GeoIP], [GeoIP_open], [AC_DEFINE(SUPPORT_GEOIP, 1, Define if you want GeoIP support.)], [AC_MSG_ERROR([--enable-geoip passed to configure, but the GeoIP libraries were not found])]) -fi -AC_SUBST(GEOIP_INCLUDE) -AC_SUBST(GEOIP_LIB) + MULE_RESTORE([CPPFLAGS]) + MULE_RESTORE([LDFLAGS]) +]) +AC_SUBST([GEOIP_CPPFLAGS])dnl +AC_SUBST([GEOIP_LDFLAGS])dnl +AC_SUBST([GEOIP_LIBS])dnl -# Check if the compiler is broken, wrt. exceptions. -CHECK_EXCEPTIONS - # Check for wx WX_CONFIG_OPTIONS WX_STANDARD_OPTIONS([toolkit,wxshared,wxdebug,wxversion]) # Force using a static wxWidgets library if the executable is to be linked statically. -AS_IF([test "$USE_DEBUG_STATIC" = "yes"], [WX_SHARED=0]) +AS_IF([test ${enable_static:-no} = yes], [WX_SHARED=0]) # Force using a unicode build of the library WX_UNICODE=1 DEBUG=$WX_DEBUG @@ -399,61 +276,63 @@ ]) fi WX_DETECT_STANDARD_OPTION_VALUES -AM_WXCONFIG_LARGEFILE + +# We also need wxBase +WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs adv,core,net` +WXBASE_LIBS=`$WX_CONFIG_WITH_ARGS --libs net` +WXBASE_CPPFLAGS="$WX_CPPFLAGS -DwxUSE_GUI=0" +AC_SUBST([WXBASE_LIBS]) +AC_SUBST([WXBASE_CPPFLAGS]) dnl Get flags for windres -if test x$SYS = xwin32; then +AC_ARG_VAR([RC], [Resource Compiler])dnl +AC_ARG_VAR([RCFLAGS], [Resource Compiler Flags])dnl +AS_IF([test ${SYS:-unknown} = win32], +[ AC_CHECK_TOOL([RC], [windres], [:]) - AC_ARG_VAR([RC], [Win32 Resource Compiler]) - RCFLAGS=`$WX_CONFIG_WITH_ARGS --cflags | $AWK ['{ for (i = 1; i <= NF; i++) if (index($i, "-I") != 1 && index($i, "-D") != 1) $i = ""; print }']` -else - RCFLAGS="" -fi -AC_SUBST(RCFLAGS) + MULERCFLAGS=`$WX_CONFIG_WITH_ARGS --cflags | $AWK ['{ for (i = 1; i <= NF; i++) if (index($i, "-I") != 1 && index($i, "-D") != 1) $i = ""; print }']` +]) -# Check for Crypto++ -AM_OPTIONS_CRYPTO -CHECK_CRYPTO(5.1) +# Check for libupnp +AS_IF([test "${ENABLE_UPNP:-yes}" = yes], [ + LIBUPNP_CHECK( + [1.6.6], + [MULE_APPEND([LIBUPNP_CPPFLAGS], [-DENABLE_UPNP=1])], + [ENABLE_UPNP=disabled] + ) +])dnl -CXXFLAGS="$CXXFLAGS $CRYPTO_PP_CXXFLAGS" -LDFLAGS="$LDFLAGS $CRYPTO_PP_LDFLAGS" -CRYPTOLIBS="-l$CRYPTO_PP_LIB_NAME" -case "$CRYPTO_PP_STYLE" in - gentoo_debian | installed | sources) - ;; - *) AC_MSG_ERROR([ - WARNING: crypto++ >= $min_crypto_version is not found. - Please check that cryptopp-headers are in your default include path, - check out LD_LIBRARY_PATH or equivalent variable. - Or this might also be that your cryptopp is installed on other path. - Please try again with --with-crypto-prefix=/my_crypto_prefix - (replace /my_crypto_prefix with a valid path to your crypto directory). - To download the latest version check http://www.cryptopp.com for sources. - ]) - ;; -esac +# Check for Crypto++ +MULE_CHECK_CRYPTOPP([5.1], [ + # Check for CryptoPP >= 5.5 + AS_IF([test $CRYPTOPP_VERSION_NUMBER -ge "5005000"], [MULE_APPEND([CRYPTOPP_CPPFLAGS], [-D__WEAK_CRYPTO__])]) +], [ + AC_MSG_ERROR([ + Could not find crypto++ header file "$cryptopp_file_with_version". + Please try again with --with-crypto-prefix=/my_crypto_prefix + (replace /my_crypto_prefix with a valid path to your crypto++ + installation directory).]) +]) -# Check for CryptoPP >= 5.5 -if test $CRYPTO_PP_VERSION_NUMBER -ge "5005000"; then - CXXFLAGS="$CXXFLAGS -D__WEAK_CRYPTO__" -fi +dnl Checks requiring C++ +AC_LANG_PUSH([C++]) +MULE_CHECK_GLIBCXX +MULE_CHECK_WX_SUPPORTS_LARGEFILE +# Check if the compiler is broken, wrt. exceptions. +MULE_CHECK_EXCEPTIONS -AC_SUBST(CRYPTOLIBS) +MULE_CHECK_CXXABI +AC_LANG_POP([C++]) # Check for bfd.h (to have proper backtraces without using wxExecute) -CHECK_BFD +MULE_CHECK_BFD +MULE_CHECK_EXECINFO # Ok, we have all needed libs, now checking for other stuff -CHECK_AUTOPOINT - -if test "$LEX" = "flex"; then - CHECK_FLEX_EXTENDED -else - HAVE_FLEX_EXTENDED=no -fi +AS_IF([test "$LEX" = "flex"], [MULE_CHECK_FLEX_EXTENDED], [HAVE_FLEX_EXTENDED=no]) # Flush standard test results for speeding cache AC_CACHE_SAVE @@ -466,7 +345,7 @@ AC_FUNC_ALLOCA AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([argz.h arpa/inet.h fcntl.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h mntent.h netdb.h netinet/in.h stddef.h nl_types.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/select.h sys/socket.h sys/statvfs.h sys/time.h sys/timeb.h sys/types.h unistd.h]) +AC_CHECK_HEADERS([argz.h arpa/inet.h fcntl.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h mntent.h netdb.h netinet/in.h stddef.h nl_types.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/ioctl.h sys/mntent.h sys/mnttab.h sys/mount.h sys/param.h sys/resource.h sys/select.h sys/socket.h sys/statvfs.h sys/time.h sys/timeb.h sys/types.h unistd.h]) AC_HEADER_SYS_WAIT # Checks for typedefs, structures, and compiler characteristics. @@ -484,14 +363,13 @@ # Checks for library functions. AC_FUNC_CLOSEDIR_VOID -AM_GNU_GETTEXT -AC_FUNC_GETMNTENT AC_PROG_GCC_TRADITIONAL AC_FUNC_FORK -if test x$SYS != xwin32; then -AC_FUNC_LSTAT -AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK -fi +AS_IF([test x$SYS != xwin32], [ + AC_FUNC_GETMNTENT + AC_FUNC_LSTAT + AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +]) AC_FUNC_MEMCMP AC_FUNC_MMAP AC_FUNC_SELECT_ARGTYPES @@ -509,97 +387,52 @@ dnl AC_FUNC_STRTOD dnl AC_FUNC_SETVBUF_REVERSED dnl Anyways, do we actually USE them? -if test $cross_compiling = yes -a $gnumalloc = yes ; then +AS_IF([test $cross_compiling = yes -a $gnumalloc = yes], [ AC_MSG_WARN([ configure cannot check whether malloc() and realloc() are GNU libc compatible. You have to be ABSOLUTELY sure that they are, otherwise run configure with the --without-gnu-malloc switch.]) ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes -fi +]) AC_FUNC_MALLOC AC_FUNC_REALLOC -AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify endpwent floor ftruncate getcwd gethostbyaddr gethostbyname gethostname getmntent getmntinfo getpass gettimeofday inet_ntoa localeconv memmove mempcpy memset munmap nl_langinfo pow select setlocale socket sqrt stpcpy strcasecmp strchr strcspn strdup strerror strncasecmp strstr strtoul]) +AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify endpwent floor ftruncate getcwd gethostbyaddr gethostbyname gethostname getpass gettimeofday inet_ntoa localeconv memmove mempcpy memset munmap nl_langinfo pow select setlocale socket sqrt stpcpy strcasecmp strchr strcspn strdup strerror strncasecmp strstr strtoul]) #------------------------------------------------------------------------------- # End of autoscan stuff #------------------------------------------------------------------------------- dnl -dnl autoscan has missed these ones. Maybe because it's win32 stuff? +dnl autoscan has missed these ones. dnl -AC_CHECK_FUNCS([mkdir getrlimit setrlimit]) - -# Flush standard test results for speeding cache -AC_CACHE_SAVE - -# Other tests - -case "$USE_DEBUG" in -yes) DEBUG_FLAGS="-g -D__DEBUG__ -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" - AS_IF([test x$GCC = xyes], [DEBUG_FLAGS="$DEBUG_FLAGS -W -Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0"]) - AS_IF([test x$SYS = xwin32], [RCFLAGS="$RCFLAGS -D__DEBUG__"]) - ;; -*) DEBUG_FLAGS="" - AS_IF([test x$GCC = xyes], [DEBUG_FLAGS="$DEBUG_FLAGS -W -Wall -Wshadow -Wundef"]) - ;; -esac - -#aMule options - -# Command line tools -case "$BUILDAMULECMD" in -yes) BUILD_AMULECMD="yes" - ;; -*) BUILD_AMULECMD="no" - ;; -esac - -# For proper compilation flags - -WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs adv,core,net` - -WXBASE_LIBS=`$WX_CONFIG_WITH_ARGS --libs net` -WXBASE_CXXFLAGS="$WX_CXXFLAGS -DwxUSE_GUI=0" -WXBASE_CFLAGS="$WX_CFLAGS -DwxUSE_GUI=0" +AC_CHECK_FUNCS([mkdir getrlimit setrlimit getopt_long]) -WX_CFLAGS="`echo $WX_CFLAGS | sed "s#-I/#-isystem /#g"`" -WX_CXXFLAGS="`echo $WX_CXXFLAGS | sed "s#-I/#-isystem /#g"`" -WXBASE_CFLAGS="`echo $WXBASE_CFLAGS | sed "s#-I/#-isystem /#g"`" -WXBASE_CXXFLAGS="`echo $WXBASE_CXXFLAGS | sed "s#-I/#-isystem /#g"`" +MULE_BACKUP([CPPFLAGS]) +MULE_APPEND([CPPFLAGS], [-D_XOPEN_SOURCE=600]) +AC_FUNC_STRERROR_R +MULE_RESTORE([CPPFLAGS]) -AC_SUBST(WXBASE_LIBS) -AC_SUBST(WXBASE_CFLAGS) -AC_SUBST(WXBASE_CXXFLAGS) +# Look for a way to preallocate disk space for files. +MULE_CHECK_FALLOCATE -case "$USE_OPTIMIZE" in -yes) OPTIMIZE_FLAGS="-O2" - ;; -*) OPTIMIZE_FLAGS="" - ;; -esac +# Checking Native Language Support +dnl Sets gettext version. +dnl AM_GNU_GETTEXT_VERSION *must not* be moved away from configure.in! +AM_GNU_GETTEXT_VERSION(0.11.5) +MULE_CHECK_NLS -# Profiling -case "$USE_PROFILE" in -yes) PROFILE_FLAGS="-pg" - ;; -*) PROFILE_FLAGS="" - ;; -esac +# Flush standard test results for speeding cache +AC_CACHE_SAVE -AC_MSG_CHECKING([if the applications should be statically linked]) -case "$USE_DEBUG_STATIC" in -yes) LDFLAGS="$LDFLAGS -static" - ;; -esac -AC_MSG_RESULT($USE_DEBUG_STATIC) +# Other tests +# aMule options +MULE_COMPILATION_FLAGS # autoconf >= 2.60 already defines ${docdir}, but we always need it. AC_MSG_CHECKING([for docdir]) -if test x"$docdir" = x; then - docdir="$datadir"/doc/"$PACKAGE_NAME"-"$PACKAGE_VERSION" - AC_SUBST(docdir) -fi -AC_MSG_RESULT($docdir) +AS_IF([test -z "$docdir"], [docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"]) +AC_SUBST([docdir])dnl +AC_MSG_RESULT([$docdir]) # Try to set the SVN checkout-date AC_MSG_CHECKING([for SVNDATE]) @@ -611,77 +444,14 @@ svndate="rev. `svnversion $srcdir | sed -e 's/[[0-9]][[0-9]]*:\(.*\)/\1/' -e 's/\([[0-9]][[0-9]]*\).*/\1/'`" fi AC_MSG_RESULT(${svndate:-None required}) -test "$svndate" && AC_DEFINE_UNQUOTED(SVNDATE, "$svndate", [The checkout date or svn revision number.]) -test x$SYS = xwin32 && test "$svndate" && RCFLAGS="$RCFLAGS -D__PRERELEASE__" -SVNDATE="$svndate" -AC_SUBST(SVNDATE) - -XRCFLAGS="-Isrc" -CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS $OPTIMIZE_FLAGS $PROFILE_FLAGS -DUSE_WX_EXTENSIONS" -CFLAGS="$CFLAGS $DEBUG_FLAGS $OPTIMIZE_FLAGS $PROFILE_FLAGS -DUSE_WX_EXTENSIONS" - -LDFLAGS="$LDFLAGS $PROFILE_FLAGS" -dnl -lpthread is needed by Debian but FreeBSD < 5 doesnt support it -if test x$SYS != xwin32; then - AC_MSG_CHECKING([if this is a FreeBSD 4 or earlier system]) - if test x"`uname -s`" = xFreeBSD && test 0`uname -r | cut -c 1` -lt 5; then - LDFLAGS="$LDFLAGS -pthread" - AC_MSG_RESULT(yes) - else - LDFLAGS="$LDFLAGS -lpthread" - AC_MSG_RESULT(no) - fi -fi - -case "$USE_NLS" in - -yes) - echo -n "Generating ${POSUB}/LINGUAS... " - Generate_Langs=`echo $SelectedLangs | sed -e 's/ .*//' -e 's/,/\\\\|/g'` - if test "$Generate_Langs" = "all"; then - cp ${srcdir}/${POSUB}/LINGUAS.in ${srcdir}/${POSUB}/LINGUAS - else - grep $Generate_Langs ${srcdir}/${POSUB}/LINGUAS.in > ${srcdir}/${POSUB}/LINGUAS - fi - if test `wc -l ${srcdir}/${POSUB}/LINGUAS | sed -e 's/ .*//'` = 0; then - cp ${srcdir}/${POSUB}/LINGUAS.in ${srcdir}/${POSUB}/LINGUAS - fi - AC_MSG_RESULT(Done) - ;; -*) - HAVE_GETTEXT="no" -esac - -dnl -dnl Denoiser -dnl -AC_MSG_CHECKING([denoising level]) -if test "$denoiselevel" = "yes"; then - denoiselevel=5 -fi -if test "$denoiselevel" = "no"; then - denoiselevel=0 -fi -if test $denoiselevel -gt 4; then - if test "${svndate:+set}" = "set"; then - denoiselevel=0 - else - denoiselevel=4 - fi -fi -AC_MSG_RESULT($denoiselevel) - -AC_CONFIG_COMMANDS(denoiser, [[ if test $level -gt 0; then - if test ! -d src/utils/scripts; then mkdir -p src/utils/scripts; fi - sed -e "1{x;s/.*/1/;x;};/^[ ]*\$/d;/^#if /{/level.*$level/{x;s/^/1/;x;b0;};x;s/^/0/;x;:0;d;};/^#else/{x;/^1/{s/1/0/;b1;};s/0/1/;:1;x;d;};/^#endif/{x;s/.//;x;d;};/^[ ]*#/d;x;/^1/{x;b;};x;d" \ - $srcdir/src/utils/scripts/denoiser.rules > src/utils/scripts/denoiser.sed - for i in `find . -name 'Makefile' -print`; do - if test -n "`head -n 1 $i | grep '^#'`"; then - sed -f src/utils/scripts/denoiser.sed $i > $i.tmp && mv $i.tmp $i - fi - done - fi]], [level=$denoiselevel]) +AS_IF([test -n "$svndate"], [ + AC_DEFINE_UNQUOTED([SVNDATE], ["$svndate"], [The checkout date or svn revision number.]) + MULE_ADDFLAG([RC], [-D__PRERELEASE__]) +]) +AC_SUBST([SVNDATE], [$svndate])dnl +dnl Set up the denoiser +MULE_DENOISER AM_CONDITIONAL(WEB, test x$WEB = xyes) AM_CONDITIONAL(ED2K, test x$ED2K = xyes) @@ -691,43 +461,24 @@ AM_CONDITIONAL(ALCC, test x$ALCC = xyes) AM_CONDITIONAL(AMULE_GUI, test x$AMULE_GUI = xyes) AM_CONDITIONAL(AMULE_DAEMON, test x$AMULE_DAEMON = xyes) -AM_CONDITIONAL(COMPILE_CMD, test x$BUILD_AMULECMD = xyes) +AM_CONDITIONAL(COMPILE_CMD, test x$AMULECMD = xyes) AM_CONDITIONAL(MONOLITHIC, test x$MONOLITHIC = xyes) -AM_CONDITIONAL(ENABLE_UPNP, test x$ENABLE_UPNP = xyes -a x$SYS != xwin32) +AM_CONDITIONAL(ENABLE_UPNP, test x$ENABLE_UPNP = xyes) AM_CONDITIONAL(ENABLE_IP2COUNTRY, test x$ENABLE_IP2COUNTRY = xyes) AM_CONDITIONAL(SYS_WIN32, test x$SYS = xwin32) AM_CONDITIONAL(NEED_RC, test x$SYS = xwin32 -a "$RC" != ":") AM_CONDITIONAL(NEED_CORESERVICES, test x$SYS = xdarwin) -AM_CONDITIONAL(COMPILE_NLS, test x$HAVE_GETTEXT = xyes) +AM_CONDITIONAL(COMPILE_NLS, test x$USE_NLS = xyes) AM_CONDITIONAL(GENERATE_FLEX_HEADER, test x$HAVE_FLEX_EXTENDED = xyes) -dnl -dnl Check for readline library -dnl -if test x$BUILDAMULECMD = xyes -o x$WEB = xyes; then +# Check for readline library +if test x$AMULECMD = xyes -o x$WEB = xyes; then VL_LIB_READLINE fi # DO NOT MOVE UP... THERE'S A REASON TO BE HERE!! -AM_OPTIONS_CCACHE_PFX - -AC_MSG_CHECKING([whether ccache support should be added]) -AC_MSG_RESULT($ccache) -AC_SUBST(ccache) - -case "$ccache" in - -yes) - CHECK_CCACHE - if [[ $CCACHE = 0 ]]; then - GCC="$ccache_prefix/ccache $GCC" - CC="$ccache_prefix/ccache $CC" - GXX="$ccache_prefix/ccache $GXX" - CXX="$ccache_prefix/ccache $CXX" - BUILD_CC="$ccache_prefix/ccache $BUILD_CC" - fi -esac +MULE_CHECK_CCACHE dnl dnl Generate the Makefiles @@ -736,18 +487,11 @@ docs/Makefile docs/man/Makefile intl/Makefile - m4/Makefile src/Makefile - src/kademlia/Makefile - src/kademlia/utils/Makefile - src/kademlia/kademlia/Makefile - src/kademlia/routing/Makefile - src/kademlia/net/Makefile src/pixmaps/Makefile src/pixmaps/flags_xpm/Makefile src/libs/Makefile src/libs/ec/Makefile - src/libs/ec/abstracts/Makefile src/libs/ec/cpp/Makefile src/libs/common/Makefile src/utils/Makefile @@ -756,6 +500,7 @@ src/utils/aLinkCreator/src/Makefile src/utils/cas/Makefile src/utils/cas/docs/Makefile + src/utils/fileview/Makefile src/utils/wxCas/Makefile src/utils/wxCas/docs/Makefile src/utils/wxCas/src/Makefile @@ -768,6 +513,7 @@ src/webserver/default/Makefile src/webserver/php-default/Makefile src/webserver/chicane/Makefile + src/webserver/litoral/Makefile unittests/Makefile unittests/muleunit/Makefile unittests/tests/Makefile]) @@ -789,20 +535,20 @@ echo echo " **** aMule Core ****" echo " Prefix where aMule should be installed? ${prefix:-none}" -echo " Should aMule be compiled with i18n support? ${HAVE_GETTEXT:-no}" +echo " Should aMule be compiled with i18n support? ${USE_NLS:-no}" echo " Should aMule be compiled in debug mode? ${USE_DEBUG:-no}" echo " Should aMule be compiled with profiling? ${USE_PROFILE:-no}" echo " Should aMule be compiled with optimizations? ${USE_OPTIMIZE:-no}" echo " Should aMule be compiled with UPnP support? ${ENABLE_UPNP:-yes}" -echo " Should aMule be compiled with IP2country support? ${ENABLE_IP2COUNTRY:-yes}" +echo " Should aMule be compiled with IP2country support? ${ENABLE_IP2COUNTRY:-no}" echo " Should aMule monolithic application be built? ${MONOLITHIC:-yes}" echo " Should aMule daemon version be built? ${AMULE_DAEMON:-no}" echo " Should aMule remote gui be built? (EXPERIMENTAL) ${AMULE_GUI:-no}" -echo " Crypto++ library/headers style? ${CRYPTO_PP_STYLE:-not found}" +echo " Crypto++ library/headers style? ${CRYPTOPP_STYLE:-not found}" echo echo " **** aMule TextClient ****" -echo " Should aMule Command Line Client be built? ${BUILD_AMULECMD:-no}" +echo " Should aMule Command Line Client be built? ${AMULECMD:-no}" echo echo " **** aMule WebServer ****" echo " Should aMule WebServer be built? ${WEB:-no}" @@ -820,13 +566,33 @@ echo echo " **** General Libraries and Tools ****" -echo " Should ccache support be enabled? ${ccache:-no}" +echo " Should ccache support be enabled? ${enable_ccache:-no}" echo " Libraries aMule will use to build:" wxinfo="$WX_PORT" AS_IF([test $WX_DEBUG -eq 1], [wxinfo="$wxinfo,debug"]) AS_IF([test $WX_SHARED -eq 1], [wxinfo="$wxinfo,shared"], [wxinfo="$wxinfo,static"]) echo " wxWidgets ${WX_VERSION_FULL} ($wxinfo)" -echo " crypto++ ${CRYPTO_PP_VERSION_STRING} (${CRYPTO_PP_STYLE})" +echo " crypto++ ${CRYPTOPP_VERSION_STRING} (${CRYPTOPP_STYLE}, in ${CRYPTOPP_PREFIX})" +AS_IF([test -n "$with_libupnp_prefix"], [libupnp_place=" (in $with_libupnp_prefix)"]) +AS_IF([test x${ENABLE_UPNP} = xyes], [dnl +echo " libupnp ${LIBUPNP_VERSION:-Not detected}${libupnp_place:-}" +])dnl +if test x${WEB:-no} != xno; then +AS_IF([test $regex_found = no], + [regex_found="Not detected"], + [AS_IF([test -z "$REGEX_LIB"], + [regex_found=system], + [regex_found="standalone (in $REGEX_LIB)"])]) +echo " regex $regex_found" +fi +if test ${enable_nls:-yes} = yes; then +AS_IF([test x$USE_NLS = xno], + [libintl_found="Not detected"], + [AS_IF([test x$USE_INCLUDED_LIBINTL = xyes], + [libintl_found="included"], + [libintl_found="system"])]) +echo " libintl $libintl_found" +fi if test x$LIBPNG_VERSION != xnot_needed; then echo " libpng ${LIBPNG_VERSION:-Not detected}" fi @@ -834,10 +600,23 @@ echo " libgd ${GDLIB_VERSION:-Not detected}" fi echo " zlib ${ZLIB_VERSION:-Not detected}" -if test x"$LIBPNG_VERSION" = x""; then +if test x$WEB = xdisabled; then echo "" echo "" -echo " WARNING! libpng >= 1.2.0 not found." -echo " amuleweb will be compiled but file download progress bar images will NOT be generated." +echo "WARNING! amuleweb has been disabled because configure could not find" +echo "a POSIX compliant regex library." +echo "" +fi +if test -z "$LIBPNG_VERSION"; then +echo "" +echo "" +echo "WARNING! libpng >= 1.2.0 not found." +echo "amuleweb will be compiled but file download progress bar images will NOT be generated." +echo "" +fi +if test x$ENABLE_UPNP = xdisabled; then +echo "" +echo "" +echo "WARNING! UPnP code has been disabled because ${libupnp_error}." echo "" fi diff -ruN -d amule-2.2.0~svn20080218/depcomp amule-2.2.2/depcomp --- amule-2.2.0~svn20080218/depcomp 2008-02-18 06:02:13.000000000 +0000 +++ amule-2.2.2/depcomp 2008-08-08 13:29:17.000000000 +0000 @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2005-02-09.22 +scriptversion=2005-07-09.11 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. @@ -17,8 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -467,7 +467,8 @@ done "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" diff -ruN -d amule-2.2.0~svn20080218/install-sh amule-2.2.2/install-sh --- amule-2.2.0~svn20080218/install-sh 2008-02-18 06:01:43.000000000 +0000 +++ amule-2.2.2/install-sh 2008-08-08 13:29:08.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2005-02-02.21 +scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the diff -ruN -d amule-2.2.0~svn20080218/m4/Makefile.am amule-2.2.2/m4/Makefile.am --- amule-2.2.0~svn20080218/m4/Makefile.am 2007-08-20 09:06:51.000000000 +0000 +++ amule-2.2.2/m4/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -EXTRA_DIST = build-tools.m4 \ - codeset.m4 \ - gettext.m4 \ - glibc21.m4 \ - iconv.m4 \ - intdiv0.m4 \ - inttypes_h.m4 \ - inttypes.m4 \ - inttypes-pri.m4 \ - isc-posix.m4 \ - lcmessage.m4 \ - lib-ld.m4 \ - lib-link.m4 \ - lib-prefix.m4 \ - progtest.m4 \ - stdint_h.m4 \ - uintmax_t.m4 \ - ulonglong.m4 \ - wxwin.m4 \ - zlib.m4 - -MAINTAINERCLEANFILES = Makefile.in diff -ruN -d amule-2.2.0~svn20080218/m4/Makefile.in amule-2.2.2/m4/Makefile.in --- amule-2.2.0~svn20080218/m4/Makefile.in 2008-02-18 06:01:44.000000000 +0000 +++ amule-2.2.2/m4/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,461 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = m4 -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/build-tools.m4 \ - $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cryptopp.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \ - $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ - $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/wxwin.m4 $(top_srcdir)/m4/zlib.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALCC_FALSE = @ALCC_FALSE@ -ALCC_TRUE = @ALCC_TRUE@ -ALC_FALSE = @ALC_FALSE@ -ALC_TRUE = @ALC_TRUE@ -ALLOCA = @ALLOCA@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AMULEWEB_DEFS = @AMULEWEB_DEFS@ -AMULE_DAEMON_FALSE = @AMULE_DAEMON_FALSE@ -AMULE_DAEMON_TRUE = @AMULE_DAEMON_TRUE@ -AMULE_GUI_FALSE = @AMULE_GUI_FALSE@ -AMULE_GUI_TRUE = @AMULE_GUI_TRUE@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BFD_FLAGS = @BFD_FLAGS@ -BFD_LIB = @BFD_LIB@ -BUILD_CC = @BUILD_CC@ -BUILD_CFLAGS = @BUILD_CFLAGS@ -BUILD_CPPFLAGS = @BUILD_CPPFLAGS@ -BUILD_EXEEXT = @BUILD_EXEEXT@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -BUILD_LDFLAGS = @BUILD_LDFLAGS@ -CAS_DEFS = @CAS_DEFS@ -CAS_FALSE = @CAS_FALSE@ -CAS_TRUE = @CAS_TRUE@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCACHE = @CCACHE@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COMPILE_CMD_FALSE = @COMPILE_CMD_FALSE@ -COMPILE_CMD_TRUE = @COMPILE_CMD_TRUE@ -COMPILE_NLS_FALSE = @COMPILE_NLS_FALSE@ -COMPILE_NLS_TRUE = @COMPILE_NLS_TRUE@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CRYPTOLIBS = @CRYPTOLIBS@ -CRYPTO_PP_CXXFLAGS = @CRYPTO_PP_CXXFLAGS@ -CRYPTO_PP_INCLUDE_PREFIX = @CRYPTO_PP_INCLUDE_PREFIX@ -CRYPTO_PP_LDFLAGS = @CRYPTO_PP_LDFLAGS@ -CRYPTO_PP_LIB_NAME = @CRYPTO_PP_LIB_NAME@ -CRYPTO_PP_PREFIX = @CRYPTO_PP_PREFIX@ -CRYPTO_PP_STYLE = @CRYPTO_PP_STYLE@ -CRYPTO_PP_VERSION_NUMBER = @CRYPTO_PP_VERSION_NUMBER@ -CRYPTO_PP_VERSION_STRING = @CRYPTO_PP_VERSION_STRING@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -ED2K_FALSE = @ED2K_FALSE@ -ED2K_TRUE = @ED2K_TRUE@ -EGREP = @EGREP@ -ENABLE_IP2COUNTRY_FALSE = @ENABLE_IP2COUNTRY_FALSE@ -ENABLE_IP2COUNTRY_TRUE = @ENABLE_IP2COUNTRY_TRUE@ -ENABLE_UPNP_FALSE = @ENABLE_UPNP_FALSE@ -ENABLE_UPNP_TRUE = @ENABLE_UPNP_TRUE@ -EXEEXT = @EXEEXT@ -GDLIB_CFLAGS = @GDLIB_CFLAGS@ -GDLIB_CFLAGS_ONLY = @GDLIB_CFLAGS_ONLY@ -GDLIB_CONFIG_PATH = @GDLIB_CONFIG_PATH@ -GDLIB_CPPFLAGS = @GDLIB_CPPFLAGS@ -GDLIB_CXXFLAGS = @GDLIB_CXXFLAGS@ -GDLIB_CXXFLAGS_ONLY = @GDLIB_CXXFLAGS_ONLY@ -GDLIB_LDFLAGS = @GDLIB_LDFLAGS@ -GDLIB_LIBS = @GDLIB_LIBS@ -GDLIB_LIBS_STATIC = @GDLIB_LIBS_STATIC@ -GDLIB_VERSION = @GDLIB_VERSION@ -GENCAT = @GENCAT@ -GENERATE_FLEX_HEADER_FALSE = @GENERATE_FLEX_HEADER_FALSE@ -GENERATE_FLEX_HEADER_TRUE = @GENERATE_FLEX_HEADER_TRUE@ -GEOIP_INCLUDE = @GEOIP_INCLUDE@ -GEOIP_LIB = @GEOIP_LIB@ -GLIBC21 = @GLIBC21@ -GMSGFMT = @GMSGFMT@ -HAVE_FLEX_EXTENDED = @HAVE_FLEX_EXTENDED@ -HAVE_GETTEXT = @HAVE_GETTEXT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBPNG_CFLAGS = @LIBPNG_CFLAGS@ -LIBPNG_CONFIG_PATH = @LIBPNG_CONFIG_PATH@ -LIBPNG_CXXFLAGS = @LIBPNG_CXXFLAGS@ -LIBPNG_LDFLAGS = @LIBPNG_LDFLAGS@ -LIBPNG_LIBS = @LIBPNG_LIBS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONOLITHIC_FALSE = @MONOLITHIC_FALSE@ -MONOLITHIC_TRUE = @MONOLITHIC_TRUE@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -NEED_CORESERVICES_FALSE = @NEED_CORESERVICES_FALSE@ -NEED_CORESERVICES_TRUE = @NEED_CORESERVICES_TRUE@ -NEED_RC_FALSE = @NEED_RC_FALSE@ -NEED_RC_TRUE = @NEED_RC_TRUE@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -POW_LIB = @POW_LIB@ -RANLIB = @RANLIB@ -RC = @RC@ -RCFLAGS = @RCFLAGS@ -READLINE_LIBS = @READLINE_LIBS@ -RESOLV_LIB = @RESOLV_LIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SVNDATE = @SVNDATE@ -SYS_WIN32_FALSE = @SYS_WIN32_FALSE@ -SYS_WIN32_TRUE = @SYS_WIN32_TRUE@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -WEB_FALSE = @WEB_FALSE@ -WEB_TRUE = @WEB_TRUE@ -WXBASE_CFLAGS = @WXBASE_CFLAGS@ -WXBASE_CXXFLAGS = @WXBASE_CXXFLAGS@ -WXBASE_LIBS = @WXBASE_LIBS@ -WXCAS_FALSE = @WXCAS_FALSE@ -WXCAS_TRUE = @WXCAS_TRUE@ -WX_CFLAGS = @WX_CFLAGS@ -WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ -WX_CONFIG_PATH = @WX_CONFIG_PATH@ -WX_CPPFLAGS = @WX_CPPFLAGS@ -WX_CXXFLAGS = @WX_CXXFLAGS@ -WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@ -WX_DEBUG = @WX_DEBUG@ -WX_LIBS = @WX_LIBS@ -WX_LIBS_STATIC = @WX_LIBS_STATIC@ -WX_PORT = @WX_PORT@ -WX_RESCOMP = @WX_RESCOMP@ -WX_SHARED = @WX_SHARED@ -WX_UNICODE = @WX_UNICODE@ -WX_VERSION_FULL = @WX_VERSION_FULL@ -WX_VERSION_MAJOR = @WX_VERSION_MAJOR@ -WX_VERSION_MINOR = @WX_VERSION_MINOR@ -X11LIBS = @X11LIBS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_BUILD_CC = @ac_ct_BUILD_CC@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_LD = @ac_ct_LD@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_RC = @ac_ct_RC@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -ccache = @ccache@ -ccache_prefix = @ccache_prefix@ -datadir = @datadir@ -docdir = @docdir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -EXTRA_DIST = build-tools.m4 \ - codeset.m4 \ - gettext.m4 \ - glibc21.m4 \ - iconv.m4 \ - intdiv0.m4 \ - inttypes_h.m4 \ - inttypes.m4 \ - inttypes-pri.m4 \ - isc-posix.m4 \ - lcmessage.m4 \ - lib-ld.m4 \ - lib-link.m4 \ - lib-prefix.m4 \ - progtest.m4 \ - stdint_h.m4 \ - uintmax_t.m4 \ - ulonglong.m4 \ - wxwin.m4 \ - zlib.m4 - -MAINTAINERCLEANFILES = Makefile.in -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign m4/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign m4/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -ruN -d amule-2.2.0~svn20080218/m4/build-tools.m4 amule-2.2.2/m4/build-tools.m4 --- amule-2.2.0~svn20080218/m4/build-tools.m4 2006-09-08 10:41:49.000000000 +0000 +++ amule-2.2.2/m4/build-tools.m4 2008-06-02 15:20:44.000000000 +0000 @@ -1,4 +1,26 @@ -# This file is part of the aMule project. -*- Autoconf -*- +# -*- Autoconf -*- +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# # # This package has been tested with GNU Autoconf 2.59, and not guaranteed to # work with any other version. However, you only need to worry about it if diff -ruN -d amule-2.2.0~svn20080218/m4/cryptopp.m4 amule-2.2.2/m4/cryptopp.m4 --- amule-2.2.0~svn20080218/m4/cryptopp.m4 2008-01-27 18:54:49.000000000 +0000 +++ amule-2.2.2/m4/cryptopp.m4 2008-07-19 12:32:04.000000000 +0000 @@ -1,158 +1,142 @@ -dnl -------------------------------------------------------------------------- -dnl Add cryptopp configure option -dnl -------------------------------------------------------------------------- -dnl -dnl This macro sets and substitutes these variables: -AC_DEFUN([AM_OPTIONS_CRYPTO], [ - AC_ARG_WITH( - [crypto-prefix], - [AS_HELP_STRING( - [--with-crypto-prefix=PREFIX], - [prefix where crypto++ is installed])], - [CRYPTO_PP_PREFIX="$withval"], - [CRYPTO_PP_PREFIX=""]) -]) - +# -*- Autoconf -*- +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# dnl -------------------------------------------------------------------------- +dnl MULE_CHECK_CRYPTOPP([VERSION = 5.1], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl dnl Check for cryptopp library dnl -------------------------------------------------------------------------- dnl -dnl This macro sets and substitutes these variables: -dnl - CRYPTO_PP_PREFIX -dnl This is the user or system directory where cryptopp is installed or sources -dnl - CRYPTO_PP_VERSION_STRING +dnl This macro sets these variables: +dnl - CRYPTOPP_PREFIX +dnl This is the user or system directory where crypto++ is installed or sources +dnl - CRYPTOPP_VERSION_STRING dnl Something like "5.5.2" -dnl - CRYPTO_PP_VERSION_NUMBER +dnl - CRYPTOPP_VERSION_NUMBER dnl Something like 5005002 -dnl - CRYPTO_PP_STYLE +dnl - CRYPTOPP_STYLE dnl "sources", "installed" or "gentoo_debian" -dnl - CRYPTO_PP_LIB_NAME +dnl - CRYPTOPP_LIB_NAME dnl "cryptopp" or "crypto++" -dnl - CRYPTO_PP_INCLUDE_PREFIX -dnl The string that goes here: #include <@CRYPTO_PP_INCLUDE_PREFIX@/rsa.h> -dnl - CRYPTO_PP_CXXFLAGS -dnl Flags to be added to CXXFLAGS -dnl - CRYPTO_PP_LDFLAGS +dnl - CRYPTOPP_INCLUDE_PREFIX +dnl The string that goes here: #include <@CRYPTOPP_INCLUDE_PREFIX@/rsa.h> +dnl - CRYPTOPP_CPPFLAGS +dnl Flags to be added to CPPFLAGS +dnl - CRYPTOPP_LDFLAGS dnl Flags to be added to LDFLAGS +dnl - CRYPTOPP_LIBS +dnl Library to be added to LIBS +dnl +dnl The CRYPTOPP_CPPFLAGS, CRYPTOPP_LDFLAGS and CRYPTOPP_LIBS variables are also substituted. dnl dnl Worth notice: -dnl - crypto_pp_include_i -dnl The string that goes in -I or -isystem on CXXFLAGS -dnl - crypto_pp_header_path +dnl - cryptopp_includedir +dnl The string that goes in -I on CPPFLAGS +dnl - cryptopp_libdir +dnl The string that goes in -L on LDFLAGS +dnl - cryptopp_header_path dnl The file we use to discover the version of cryptopp dnl -AC_DEFUN([CHECK_CRYPTO], [ - -min_crypto_version=ifelse([$1], ,5.1,$1) -AC_MSG_CHECKING([for crypto++ version >= $min_crypto_version]) - -crypto_pp_file_with_version="cryptlib.h" - -CRYPTO_PP_STYLE="unknown" -CRYPTO_PP_LIB_NAME="unknown" -crypto_pp_include_i="unknown" -CRYPTO_PP_INCLUDE_PREFIX="unknown" -CRYPTO_PP_DEFINE="unknown" -CRYPTO_PP_LIB="unknown" - -# -# Set CRYPTO_PP_PREFIX if the user has not set it in the configure command line -# We don't use AC_CHECK_FILE to avoid caching. -# -if test x$CRYPTO_PP_PREFIX = x ; then - CRYPTO_PP_PREFIX="/usr" -fi +AC_DEFUN([MULE_CHECK_CRYPTOPP], +[dnl +m4_define([MIN_CRYPTO_VERSION], [m4_ifval([$1], [$1], [5.1])])dnl -# -# Find the Cryptopp header -# -if test -f $CRYPTO_PP_PREFIX/$crypto_pp_file_with_version; then - CRYPTO_PP_STYLE="sources" - CRYPTO_PP_LIB_NAME="cryptopp" - crypto_pp_include_i="$CRYPTO_PP_PREFIX" - CRYPTO_PP_INCLUDE_PREFIX="." - CRYPTO_PP_DEFINE="__CRYPTO_SOURCE__" - CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX" - AC_MSG_ERROR([ - Specifying the cryptopp source files directory for "--with-crypto-prefix=" - will not work because cryptopp uses headers with the same name of system - headers (e.g. zlib.h) and you must be able to distinguish the system - headers from cryptopp headers in an #include directive. - Please run "PREFIX=/home/YourUserName/usr/cryptopp make install" on - the cryptopp directory to properly install cryptopp in your system.]) -elif test -f $CRYPTO_PP_PREFIX/include/cryptopp/$crypto_pp_file_with_version; then - CRYPTO_PP_STYLE="installed" - CRYPTO_PP_LIB_NAME="cryptopp" - crypto_pp_include_i="$CRYPTO_PP_PREFIX/include" - CRYPTO_PP_INCLUDE_PREFIX="$CRYPTO_PP_LIB_NAME" - CRYPTO_PP_DEFINE="__CRYPTO_INSTALLED__" - CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX/lib" -elif test -f $CRYPTO_PP_PREFIX/include/crypto++/$crypto_pp_file_with_version; then - # Debian uses libcrypto++5.1 - it's not my fault, please soda patch the package - CRYPTO_PP_STYLE="gentoo_debian" - CRYPTO_PP_LIB_NAME="crypto++" - crypto_pp_include_i="$CRYPTO_PP_PREFIX/include" - CRYPTO_PP_INCLUDE_PREFIX="$CRYPTO_PP_LIB_NAME" - CRYPTO_PP_DEFINE="__CRYPTO_SOURCE__" - CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX/lib" -fi + AC_ARG_WITH([crypto-prefix], + [AS_HELP_STRING([--with-crypto-prefix=PREFIX], [prefix where crypto++ is installed])]) -# -# Check for success in finding cryptopp -# -if test $CRYPTO_PP_STYLE = "unknown"; then - # - # If the execution reaches here, we have failed. - # - AC_MSG_ERROR([ - Could not find cryptopp header file "$crypto_pp_file_with_version". - Please check if the path "$CRYPTO_PP_PREFIX" is valid.]) -fi + AC_MSG_CHECKING([for crypto++ version >= MIN_CRYPTO_VERSION]) -# -# Find out the cryptopp version and check against the minimum required -# -crypto_pp_include_dir="$crypto_pp_include_i/$CRYPTO_PP_INCLUDE_PREFIX" -crypto_pp_header_path="$crypto_pp_include_dir/$crypto_pp_file_with_version" + cryptopp_file_with_version="cryptlib.h" -CRYPTO_PP_VERSION_STRING=$(grep "Reference Manual" $crypto_pp_header_path | \ - grep -Eo "([[0-9]]+\.?+)+") + CRYPTOPP_STYLE="unknown" + CRYPTOPP_LIB_NAME="unknown" + cryptopp_includedir="unknown" + CRYPTOPP_INCLUDE_PREFIX="unknown" + cryptopp_libdir="unknown" -CRYPTO_PP_VERSION_NUMBER=$(echo $CRYPTO_PP_VERSION_STRING | \ - $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}') + for CRYPTOPP_PREFIX in "$with_crypto_prefix" /usr /usr/local /opt /opt/local /usr/pkg /mingw ; do + AS_IF([test -z "$CRYPTOPP_PREFIX"], [continue]) -minvers=$(echo $min_crypto_version | \ - $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}') + # Find the Cryptopp header + MULE_IF([test -f $CRYPTOPP_PREFIX/$cryptopp_file_with_version], [ + CRYPTOPP_STYLE="sources" + CRYPTOPP_LIB_NAME="cryptopp" + cryptopp_includedir= + CRYPTOPP_INCLUDE_PREFIX="$CRYPTOPP_PREFIX" + cryptopp_libdir= + break + ], [test -f $CRYPTOPP_PREFIX/include/cryptopp/$cryptopp_file_with_version], [ + CRYPTOPP_STYLE="installed" + CRYPTOPP_LIB_NAME="cryptopp" + cryptopp_includedir="$CRYPTOPP_PREFIX/include" + CRYPTOPP_INCLUDE_PREFIX="$CRYPTOPP_LIB_NAME" + cryptopp_libdir="$CRYPTOPP_PREFIX/lib" + break + ], [test -f $CRYPTOPP_PREFIX/include/crypto++/$cryptopp_file_with_version], [ + # Debian uses libcrypto++5.1 - it's not my fault, please soda patch the package + CRYPTOPP_STYLE="gentoo_debian" + CRYPTOPP_LIB_NAME="crypto++" + cryptopp_includedir="$CRYPTOPP_PREFIX/include" + CRYPTOPP_INCLUDE_PREFIX="$CRYPTOPP_LIB_NAME" + cryptopp_libdir="$CRYPTOPP_PREFIX/lib" + break + ]) + done -if test -n "$CRYPTO_PP_VERSION_NUMBER" && test "$CRYPTO_PP_VERSION_NUMBER" -ge $minvers; then - result="yes (version $CRYPTO_PP_VERSION_STRING, $CRYPTO_PP_STYLE)" -else - result="no" -fi -AC_MSG_RESULT([$result]) + AS_IF([test $CRYPTOPP_STYLE = "unknown"], [result=no; resultstr=""], [ + # Find out the crypto++ version and check against the minimum required + cryptopp_header_path="${cryptopp_includedir+$cryptopp_includedir/}$CRYPTOPP_INCLUDE_PREFIX/$cryptopp_file_with_version" + CRYPTOPP_VERSION_STRING=`grep "Reference Manual" $cryptopp_header_path | sed -e ['s/[^0-9]*\([0-9.]*\).*/\1/']` + CRYPTOPP_VERSION_NUMBER=`echo $CRYPTOPP_VERSION_STRING | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'` + minvers=`echo MIN_CRYPTO_VERSION | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'` -# -# FLAGS -# -CRYPTO_PP_CXXFLAGS="-isystem $crypto_pp_include_i -D$CRYPTO_PP_DEFINE" -CRYPTO_PP_LDFLAGS="-L$CRYPTO_PP_LIB" -AH_TEMPLATE([CRYPTOPP_INCLUDE_PREFIX], [Define this to the include prefix of crypto++]) -AC_DEFINE_UNQUOTED([CRYPTOPP_INCLUDE_PREFIX], $CRYPTO_PP_INCLUDE_PREFIX) + AS_IF([test -n "$CRYPTOPP_VERSION_NUMBER" && test "$CRYPTOPP_VERSION_NUMBER" -ge $minvers], [ + result=yes + resultstr=" (version $CRYPTOPP_VERSION_STRING, $CRYPTOPP_STYLE)" + AS_IF([test -n "$cryptopp_includedir"], [CRYPTOPP_CPPFLAGS="-I$cryptopp_includedir"], [CRYPTOPP_CPPFLAGS=]) + AS_IF([test -n "$cryptopp_libdir"], [ + CRYPTOPP_LDFLAGS="-L$cryptopp_libdir" + CRYPTOPP_LIBS="-l$CRYPTOPP_LIB_NAME" + ], [ + CRYPTOPP_LDFLAGS= + CRYPTOPP_LIBS="${CRYPTOPP_INCLUDE_PREFIX}/lib${CRYPTOPP_LIB_NAME}.a" + ]) + AH_TEMPLATE([CRYPTOPP_INCLUDE_PREFIX], [Define this to the include prefix of crypto++]) + AC_DEFINE_UNQUOTED([CRYPTOPP_INCLUDE_PREFIX], $CRYPTOPP_INCLUDE_PREFIX) + ], [ + result=no + resultstr=" (version $CRYPTOPP_VERSION_STRING is not new enough)" + ]) + ]) -# -# Exported symbols -# -AC_SUBST([CRYPTO_PP_PREFIX]) -AC_SUBST([CRYPTO_PP_VERSION_STRING]) -AC_SUBST([CRYPTO_PP_VERSION_NUMBER]) + AC_MSG_RESULT([$result$resultstr]) -AC_SUBST([CRYPTO_PP_STYLE]) -AC_SUBST([CRYPTO_PP_LIB_NAME]) -AC_SUBST([CRYPTO_PP_INCLUDE_PREFIX]) -AC_SUBST([CRYPTO_PP_CXXFLAGS]) -AC_SUBST([CRYPTO_PP_LDFLAGS]) + AS_IF([test ${result:-no} = yes], [$2], [$3]) -AC_MSG_NOTICE([Crypto++ version number is $CRYPTO_PP_VERSION_NUMBER]) +dnl Exported symbols +AC_SUBST([CRYPTOPP_CPPFLAGS])dnl +AC_SUBST([CRYPTOPP_LDFLAGS])dnl +AC_SUBST([CRYPTOPP_LIBS])dnl +m4_undefine([MIN_CRYPTO_VERSION])dnl ]) - diff -ruN -d amule-2.2.0~svn20080218/m4/fallocate.m4 amule-2.2.2/m4/fallocate.m4 --- amule-2.2.0~svn20080218/m4/fallocate.m4 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/m4/fallocate.m4 2008-06-02 15:20:44.000000000 +0000 @@ -0,0 +1,78 @@ +# -*- Autoconf -*- +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# + +AC_DEFUN([MULE_CHECK_FALLOCATE], +[ + AC_MSG_CHECKING([for fallocate]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #include + ]], [[ + fallocate(0, 0, 0, 0); + ]]) + ], [ + AH_TEMPLATE([HAVE_FALLOCATE], [Define to 1 if you have the fallocate() function.]) + AC_DEFINE([HAVE_FALLOCATE]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + + + AC_MSG_CHECKING([for SYS_fallocate]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #include + #include + #include + ]], [[ + syscall(SYS_fallocate, 0, (loff_t)0, (loff_t)0); + ]]) + ], [ + AH_TEMPLATE([HAVE_SYS_FALLOCATE], [Define to 1 if you have the SYS_fallocate syscall number.]) + AC_DEFINE([HAVE_SYS_FALLOCATE]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + + AC_MSG_CHECKING([for posix_fallocate]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #define _XOPEN_SOURCE 600 + #include + #ifdef HAVE_FCNTL_H + # include + #endif + ]], [[ + posix_fallocate(0, 0, 0); + ]]) + ], [ + AH_TEMPLATE([HAVE_POSIX_FALLOCATE], [Define to 1 if you have posix_fallocate() and it should be used.]) + AC_DEFINE([HAVE_POSIX_FALLOCATE]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) diff -ruN -d amule-2.2.0~svn20080218/m4/gdlib.m4 amule-2.2.2/m4/gdlib.m4 --- amule-2.2.0~svn20080218/m4/gdlib.m4 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/m4/gdlib.m4 2008-07-10 15:10:06.000000000 +0000 @@ -0,0 +1,107 @@ +# -*- Autoconf -*- +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# + +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_GDLIB([VERSION = 2.0.0], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl +dnl adds support for --with-gdlib-prefix and --with-gdlib-config +dnl command line options +dnl +dnl Test for gdlib, and define GDLIB_CFLAGS, GDLIB_LIBS and GDLIB_CONFIG_NAME +dnl environment variable to override the default name of the gdlib-config script +dnl to use. Set GDLIB_CONFIG_PATH to specify the full path to gdlib-config - +dnl in this case the macro won't even waste time on tests for its existence. +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_GDLIB], +[dnl +m4_define([REQUIRED_VERSION], [m4_ifval([$1], [$1], [2.0.0])])dnl +m4_define([REQUIRED_VERSION_MAJOR], [m4_bregexp(REQUIRED_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\1])])dnl +m4_define([REQUIRED_VERSION_MINOR], [m4_bregexp(REQUIRED_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\2])])dnl +m4_define([REQUIRED_VERSION_MICRO], [m4_bregexp(REQUIRED_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\3])])dnl + + AC_ARG_WITH([gdlib-prefix], [AS_HELP_STRING([--with-gdlib-prefix=PREFIX], [prefix where gdlib is installed (optional)])]) + AC_ARG_WITH([gdlib-config], [AS_HELP_STRING([--with-gdlib-config=CONFIG], [gdlib-config script to use (optional)])]) + + GDLIB_VERSION= + + # do we have gdlib-config name: it can be gdlib-config or gd-config or ... + AS_IF([test x${GDLIB_CONFIG_NAME+set} != xset], [GDLIB_CONFIG_NAME=gdlib-config]) + AS_IF([test -n "$with_gdlib_config"], [GDLIB_CONFIG_NAME="$with_gdlib_config"]) + + # deal with optional prefix + AS_IF([test -n "$with_gdlib_prefix"], [GDLIB_LOOKUP_PATH="$with_gdlib_prefix/bin"]) + + # don't search the PATH if GDLIB_CONFIG_NAME is absolute filename + AS_IF([test -x "$GDLIB_CONFIG_NAME"], [ + AC_MSG_CHECKING([for gdlib-config]) + GDLIB_CONFIG_PATH="$GDLIB_CONFIG_NAME" + AC_MSG_RESULT([$GDLIB_CONFIG_PATH]) + ], [AC_PATH_PROG([GDLIB_CONFIG_PATH], [$GDLIB_CONFIG_NAME], [no], [$GDLIB_LOOKUP_PATH:$PATH])]) + + AS_IF([test ${GDLIB_CONFIG_PATH:-no} != no], + [ + AC_MSG_CHECKING([for gdlib version >= REQUIRED_VERSION]) + GDLIB_CONFIG_WITH_ARGS="$GDLIB_CONFIG_PATH $gdlib_config_args" + + GDLIB_VERSION=`$GDLIB_CONFIG_WITH_ARGS --version` + gdlib_config_major_version=`echo $GDLIB_VERSION | sed ['s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/']` + gdlib_config_minor_version=`echo $GDLIB_VERSION | sed ['s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/']` + gdlib_config_micro_version=`echo $GDLIB_VERSION | sed ['s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/']` + + gdlib_ver_ok= + MULE_IF([test $gdlib_config_major_version -gt REQUIRED_VERSION_MAJOR], [gdlib_ver_ok=yes], + [test $gdlib_config_major_version -eq REQUIRED_VERSION_MAJOR], [ + MULE_IF([test $gdlib_config_minor_version -gt REQUIRED_VERSION_MINOR], [gdlib_ver_ok=yes], + [test $gdlib_config_minor_version -eq REQUIRED_VERSION_MINOR], + [MULE_IF([test $gdlib_config_micro_version -ge REQUIRED_VERSION_MICRO], [gdlib_ver_ok=yes])]) + ]) + + AS_IF([test -z "$gdlib_ver_ok"], [ + AS_IF([test -z "$GDLIB_VERSION"], [AC_MSG_RESULT([no])], [ + AC_MSG_RESULT([no (version $GDLIB_VERSION is not new enough)]) + GDLIB_VERSION= + ]) + ], [ + AC_MSG_RESULT([yes (version $GDLIB_VERSION)]) + GDLIB_CFLAGS="`$GDLIB_CONFIG_WITH_ARGS --cflags`" + GDLIB_LDFLAGS="`$GDLIB_CONFIG_WITH_ARGS --ldflags`" + GDLIB_LIBS="`$GDLIB_CONFIG_WITH_ARGS --libs`" + MULE_BACKUP([CFLAGS]) + MULE_APPEND([CFLAGS], [$GDLIB_CFLAGS]) + AC_CHECK_HEADER([gd.h],, [GDLIB_VERSION=]) + MULE_RESTORE([CFLAGS]) + ]) + ]) + + AS_IF([test -n "$GDLIB_VERSION"], [$2], [$3]) + +AC_SUBST([GDLIB_CFLAGS])dnl +AC_SUBST([GDLIB_LDFLAGS])dnl +AC_SUBST([GDLIB_LIBS])dnl + +m4_undefine([REQUIRED_VERSION])dnl +m4_undefine([REQUIRED_VERSION_MAJOR])dnl +m4_undefine([REQUIRED_VERSION_MINOR])dnl +m4_undefine([REQUIRED_VERSION_MICRO])dnl +]) diff -ruN -d amule-2.2.0~svn20080218/m4/gettext.m4~ amule-2.2.2/m4/gettext.m4~ --- amule-2.2.0~svn20080218/m4/gettext.m4~ 2008-01-06 06:32:57.000000000 +0000 +++ amule-2.2.2/m4/gettext.m4~ 1970-01-01 00:00:00.000000000 +0000 @@ -1,587 +0,0 @@ -# gettext.m4 serial 17 (gettext-0.11.5) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2002. - -dnl Macro to add for using GNU gettext. - -dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). -dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The -dnl default (if it is not specified or empty) is 'no-libtool'. -dnl INTLSYMBOL should be 'external' for packages with no intl directory, -dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. -dnl If INTLSYMBOL is 'use-libtool', then a libtool library -dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, -dnl depending on --{enable,disable}-{shared,static} and on the presence of -dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library -dnl $(top_builddir)/intl/libintl.a will be created. -dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext -dnl implementations (in libc or libintl) without the ngettext() function -dnl will be ignored. If NEEDSYMBOL is specified and is -dnl 'need-formatstring-macros', then GNU gettext implementations that don't -dnl support the ISO C 99 formatstring macros will be ignored. -dnl INTLDIR is used to find the intl libraries. If empty, -dnl the value `$(top_builddir)/intl/' is used. -dnl -dnl The result of the configuration is one of three cases: -dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled -dnl and used. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 2) GNU gettext has been found in the system's C library. -dnl Catalog format: GNU --> install in $(datadir) -dnl Catalog extension: .mo after installation, .gmo in source tree -dnl 3) No internationalization, always use English msgid. -dnl Catalog format: none -dnl Catalog extension: none -dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. -dnl The use of .gmo is historical (it was needed to avoid overwriting the -dnl GNU format catalogs when building on a platform with an X/Open gettext), -dnl but we keep it in order not to force irrelevant filename changes on the -dnl maintainers. -dnl -AC_DEFUN([AM_GNU_GETTEXT], -[ - dnl Argument checking. - ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , - [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT -])])])])]) - ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , - [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT -])])])]) - define(gt_included_intl, ifelse([$1], [external], [no], [yes])) - define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) - - AC_REQUIRE([AM_PO_SUBDIRS])dnl - ifelse(gt_included_intl, yes, [ - AC_REQUIRE([AM_INTL_SUBDIR])dnl - ]) - - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Sometimes libintl requires libiconv, so first search for libiconv. - dnl Ideally we would do this search only after the - dnl if test "$USE_NLS" = "yes"; then - dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then - dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT - dnl the configure script would need to contain the same shell code - dnl again, outside any 'if'. There are two solutions: - dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. - dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. - dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not - dnl documented, we avoid it. - ifelse(gt_included_intl, yes, , [ - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - ]) - - AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) - - ifelse(gt_included_intl, yes, [ - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - ]) - LIBINTL= - LTLIBINTL= - POSUB= - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - ifelse(gt_included_intl, yes, [ - AC_MSG_CHECKING([whether included gettext is requested]) - AC_ARG_WITH(included-gettext, - [ --with-included-gettext use the GNU gettext library included here], - nls_cv_force_use_gnu_gettext=$withval, - nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - ]) - dnl User does not insist on using GNU NLS library. Figure out what - dnl to use. If GNU gettext is available we use this. Else we have - dnl to fall back to GNU NLS library. - - dnl Add a version number to the cache macros. - define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) - define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) - define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) - - AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings;], - [bindtextdomain ("", ""); -return (long) gettext ("")]ifelse([$2], [need-ngettext], [ + (long) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) - - if test "$gt_cv_func_gnugettext_libc" != "yes"; then - dnl Sometimes libintl requires libiconv, so first search for libiconv. - ifelse(gt_included_intl, yes, , [ - AM_ICONV_LINK - ]) - dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL - dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) - dnl because that would add "-liconv" to LIBINTL and LTLIBINTL - dnl even if libiconv doesn't exist. - AC_LIB_LINKFLAGS_BODY([intl]) - AC_CACHE_CHECK([for GNU gettext in libintl], - gt_cv_func_gnugettext_libintl, - [gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCINTL" - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - dnl Now see whether libintl exists and does not depend on libiconv. - AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], - [bindtextdomain ("", ""); -return (long) gettext ("")]ifelse([$2], [need-ngettext], [ + (long) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) - dnl Now see whether libintl exists and depends on libiconv. - if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], - [bindtextdomain ("", ""); -return (long) gettext ("")]ifelse([$2], [need-ngettext], [ + (long) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - [LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext_libintl=yes - ]) - fi - CPPFLAGS="$gt_save_CPPFLAGS" - LIBS="$gt_save_LIBS"]) - fi - - dnl If an already present or preinstalled GNU gettext() is found, - dnl use it. But if this macro is used in GNU gettext, and GNU - dnl gettext is already preinstalled in libintl, we update this - dnl libintl. (Cf. the install rule in intl/Makefile.in.) - if test "$gt_cv_func_gnugettext_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ - && test "$PACKAGE" != gettext; }; then - gt_use_preinstalled_gnugettext=yes - else - dnl Reset the values set by searching for libintl. - LIBINTL= - LTLIBINTL= - INCINTL= - fi - - ifelse(gt_included_intl, yes, [ - if test "$gt_use_preinstalled_gnugettext" != "yes"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on included GNU gettext library. - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions used to generate GNU NLS library. - INTLOBJS="\$(GETTOBJS)" - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" - LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions to use GNU gettext tools. - CATOBJEXT=.gmo - fi - ]) - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, - [Define to 1 if translation of program messages to the user's native language - is requested.]) - else - USE_NLS=no - fi - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - AC_MSG_CHECKING([how to link with libintl]) - AC_MSG_RESULT([$LIBINTL]) - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) - fi - - dnl For backward compatibility. Some packages may be using this. - AC_DEFINE(HAVE_GETTEXT, 1, - [Define if the GNU gettext() function is already present or preinstalled.]) - AC_DEFINE(HAVE_DCGETTEXT, 1, - [Define if the GNU dcgettext() function is already present or preinstalled.]) - fi - - dnl We need to process the po/ directory. - POSUB=po - fi - - ifelse(gt_included_intl, yes, [ - dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL - dnl to 'yes' because some of the testsuite requires it. - if test "$PACKAGE" = gettext; then - BUILD_INCLUDED_LIBINTL=yes - fi - - dnl Make all variables we use known to autoconf. - AC_SUBST(BUILD_INCLUDED_LIBINTL) - AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATOBJEXT) - AC_SUBST(INTLOBJS) - - dnl For backward compatibility. Some configure.ins may be using this. - nls_cv_header_intl= - nls_cv_header_libgt= - - dnl For backward compatibility. Some Makefiles may be using this. - DATADIRNAME=share - AC_SUBST(DATADIRNAME) - - dnl For backward compatibility. Some Makefiles may be using this. - INSTOBJEXT=.mo - AC_SUBST(INSTOBJEXT) - - dnl For backward compatibility. Some Makefiles may be using this. - GENCAT=gencat - AC_SUBST(GENCAT) - - dnl Enable libtool support if the surrounding package wishes it. - INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix - AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) - ]) - - dnl For backward compatibility. Some Makefiles may be using this. - INTLLIBS="$LIBINTL" - AC_SUBST(INTLLIBS) - - dnl Make all documented variables known to autoconf. - AC_SUBST(LIBINTL) - AC_SUBST(LTLIBINTL) - AC_SUBST(POSUB) -]) - - -dnl Checks for all prerequisites of the po subdirectory, -dnl except for USE_NLS. -AC_DEFUN([AM_PO_SUBDIRS], -[ - AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_MKINSTALLDIRS])dnl - - dnl Perform the following tests also if --disable-nls has been given, - dnl because they are needed for "make dist" to work. - - dnl Search for GNU msgfmt in the PATH. - dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. - dnl The second test excludes FreeBSD msgfmt. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - dnl Search for GNU xgettext 0.11 or newer in the PATH. - dnl The first test excludes Solaris xgettext and early GNU xgettext versions. - dnl The second test excludes FreeBSD xgettext. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - - dnl Search for GNU msgmerge 0.11 or newer in the PATH. - AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, - [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU msgfmt. - if test "$GMSGFMT" != ":"; then - dnl If it is no GNU msgfmt we define it as : so that the - dnl Makefiles still can work. - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - AC_MSG_RESULT( - [found $GMSGFMT program is not GNU msgfmt; ignore it]) - GMSGFMT=":" - fi - fi - - dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - fi - - AC_OUTPUT_COMMANDS([ - for ac_file in $CONFIG_FILES; do - # Support "outfile[:infile[:infile...]]" - case "$ac_file" in - *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - esac - # PO directories have a Makefile.in generated from Makefile.in.in. - case "$ac_file" in */Makefile.in) - # Adjust a relative srcdir. - ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` - ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" - ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` - # In autoconf-2.13 it is called $ac_given_srcdir. - # In autoconf-2.50 it is called $srcdir. - test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" - case "$ac_given_srcdir" in - .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; - /*) top_srcdir="$ac_given_srcdir" ;; - *) top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then - rm -f "$ac_dir/POTFILES" - test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" - # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend - # on $ac_dir but don't depend on user-specified configuration - # parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - if test -n "$ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - fi - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - GMOFILES= - UPDATEPOFILES= - DUMMYPOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do - if test -f "$f"; then - case "$f" in - *.orig | *.bak | *~) ;; - *) cat "$f" >> "$ac_dir/Makefile" ;; - esac - fi - done - fi - ;; - esac - done], - [# Capture the value of obsolete ALL_LINGUAS because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it - # from automake. - eval 'ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - ]) -]) - - -dnl Checks for all prerequisites of the intl subdirectory, -dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, -dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. -AC_DEFUN([AM_INTL_SUBDIR], -[ - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_MKINSTALLDIRS])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_REQUIRE([jm_GLIBC21])dnl - AC_REQUIRE([gt_INTDIV0])dnl - AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl - AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl - AC_REQUIRE([gt_INTTYPES_PRI])dnl - - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ -stdlib.h string.h unistd.h sys/param.h]) - AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ -geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ -strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) - - AM_ICONV - AM_LANGINFO_CODESET - if test $ac_cv_header_locale_h = yes; then - AM_LC_MESSAGES - fi - - dnl intl/plural.c is generated from intl/plural.y. It requires bison, - dnl because plural.y uses bison specific features. It requires at least - dnl bison-1.26 because earlier versions generate a plural.c that doesn't - dnl compile. - dnl bison is only needed for the maintainer (who touches plural.y). But in - dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put - dnl the rule in general Makefile. Now, some people carelessly touch the - dnl files or have a broken "make" program, hence the plural.c rule will - dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not - dnl present or too old. - AC_CHECK_PROGS([INTLBISON], [bison]) - if test -z "$INTLBISON"; then - ac_verc_fail=yes - else - dnl Found it, now check the version. - AC_MSG_CHECKING([version of bison]) -changequote(<<,>>)dnl - ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` - case $ac_prog_version in - '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; - 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) -changequote([,])dnl - ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; - *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; - esac - AC_MSG_RESULT([$ac_prog_version]) - fi - if test $ac_verc_fail = yes; then - INTLBISON=: - fi -]) - - -AC_DEFUN([AM_MKINSTALLDIRS], -[ - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but $(top_srcdir). - dnl Try to locate is. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) -]) - - -dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) -AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff -ruN -d amule-2.2.0~svn20080218/m4/libpng.m4 amule-2.2.2/m4/libpng.m4 --- amule-2.2.0~svn20080218/m4/libpng.m4 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/m4/libpng.m4 2008-06-03 14:16:38.000000000 +0000 @@ -0,0 +1,156 @@ +# -*- Autoconf -*- +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# + +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_LIBPNG([VERSION = 1.2.0], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl +dnl adds support for --with-libpng-prefix and --with-libpng-config +dnl command line options +dnl +dnl Test for libpng, and define LIBPNG_CFLAGS, LIBPNG_LIBS and LIBPNG_CONFIG_NAME +dnl environment variable to override the default name of the libpng-config script +dnl to use. Set LIBPNG_CONFIG_PATH to specify the full path to libpng-config - +dnl in this case the macro won't even waste time on tests for its existence. +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_LIBPNG], +[dnl +m4_define([REQUIRED_VERSION], [m4_ifval([$1], [$1], [1.2.0])])dnl +m4_define([REQUIRED_VERSION_MAJOR], [m4_bregexp(REQUIRED_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\1])])dnl +m4_define([REQUIRED_VERSION_MINOR], [m4_bregexp(REQUIRED_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\2])])dnl +m4_define([REQUIRED_VERSION_MICRO], [m4_bregexp(REQUIRED_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\3])])dnl + + AC_ARG_WITH([libpng-prefix], [AS_HELP_STRING([--with-libpng-prefix=PREFIX], [prefix where libpng is installed (optional)])]) + AC_ARG_WITH([libpng-config], [AS_HELP_STRING([--with-libpng-config=CONFIG], [libpng-config script to use (optional)])]) + + LIBPNG_VERSION= + + # do we have libpng-config name: it can be libpng-config or libpng12-config or ... + AS_IF([test x${LIBPNG_CONFIG_NAME+set} != xset], [LIBPNG_CONFIG_NAME=libpng-config]) + AS_IF([test -n "$with_libpng_config"], [LIBPNG_CONFIG_NAME="$with_libpng_config"]) + + # deal with optional prefix + AS_IF([test -n "$with_libpng_prefix"], [LIBPNG_LOOKUP_PATH="$with_libpng_prefix/bin"]) + + # don't search the PATH if LIBPNG_CONFIG_NAME is absolute filename + AS_IF([test -x "$LIBPNG_CONFIG_NAME"], [ + AC_MSG_CHECKING([for libpng-config]) + LIBPNG_CONFIG_PATH="$LIBPNG_CONFIG_NAME" + AC_MSG_RESULT($LIBPNG_CONFIG_PATH) + ], [AC_PATH_PROG([LIBPNG_CONFIG_PATH], [$LIBPNG_CONFIG_NAME], [no], [$LIBPNG_LOOKUP_PATH:$PATH])]) + + AS_IF([test ${LIBPNG_CONFIG_PATH:-no} != no], + [ + AC_MSG_CHECKING([for libpng version >= REQUIRED_VERSION]) + + LIBPNG_CONFIG_WITH_ARGS="$LIBPNG_CONFIG_PATH $libpng_config_args" + + LIBPNG_VERSION=`$LIBPNG_CONFIG_WITH_ARGS --version` + libpng_config_major_version=`echo $LIBPNG_VERSION | sed ['s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/']` + libpng_config_minor_version=`echo $LIBPNG_VERSION | sed ['s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/']` + libpng_config_micro_version=`echo $LIBPNG_VERSION | sed ['s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/']` + + libpng_ver_ok= + MULE_IF([test $libpng_config_major_version -gt REQUIRED_VERSION_MAJOR], [libpng_ver_ok=yes], + [test $libpng_config_major_version -eq REQUIRED_VERSION_MAJOR], [ + MULE_IF([test $libpng_config_minor_version -gt REQUIRED_VERSION_MINOR], [libpng_ver_ok=yes], + [test $libpng_config_minor_version -eq REQUIRED_VERSION_MINOR], + [MULE_IF([test $libpng_config_micro_version -ge REQUIRED_VERSION_MICRO], [libpng_ver_ok=yes])]) + ]) + + AS_IF([test -z "$libpng_ver_ok"], [ + AS_IF([test -z "$LIBPNG_VERSION"], [AC_MSG_RESULT([no])], [ + AC_MSG_RESULT([no (version $LIBPNG_VERSION is not new enough)]) + LIBPNG_VERSION= + ]) + ], [ + LIBPNG_LIBS=`$LIBPNG_CONFIG_WITH_ARGS --libs` + LIBPNG_LDFLAGS=`$LIBPNG_CONFIG_WITH_ARGS --ldflags | sed -e "s/ *${LIBPNG_LIBS}$//"` + LIBPNG_CFLAGS=`$LIBPNG_CONFIG_WITH_ARGS --cflags` + AC_MSG_RESULT([yes (version $LIBPNG_VERSION)]) + ]) + ], [ + # Try hard to find a usable libpng + # Some RedHat RPMs miss libpng-config, so test for + # the usability with default options. + AC_MSG_CHECKING([for libpng >= REQUIRED_VERSION]) + MULE_BACKUP([LIBS]) + MULE_PREPEND([LIBS], [-lpng -lz -lm]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ + #include + #include + + /* Check linking to png library */ + void dummy() { + png_check_sig(NULL, 0); + } + ]], [dnl Don't use double-quoting here! + /* png.h defines PNG_LIBPNG_VER=xyyzz */ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%s", (PNG_LIBPNG_VER >= REQUIRED_VERSION_MAJOR * 10000 + REQUIRED_VERSION_MINOR * 100 + REQUIRED_VERSION_MICRO) ? "yes" : "no"); + fclose(f); + f=fopen("conftestver", "w"); + if (!f) exit(0); + fprintf(f, "%s", PNG_LIBPNG_VER_STRING); + fclose(f); + exit(0); + ]) + ], [ + AS_IF([test -f conftestval], [result=`cat conftestval`], [result=no]) + AS_IF([test ${result:-no} = yes], [ + AS_IF([test -f conftestver], [ + LIBPNG_VERSION=`cat conftestver` + lib_version=" (version $LIBPNG_VERSION)" + ], [ + lib_version= + LIBPNG_VERSION="detected" + ]) + ]) + AC_MSG_RESULT([$result$lib_version]) + LIBPNG_LIBS="-lpng -lz -lm" + ], [ + result=no + AC_MSG_RESULT([$result]) + ], [ + AC_MSG_RESULT([cross-compilation detected, checking only the header]) + AC_CHECK_HEADER([png.h], [ + LIBPNG_VERSION="detected" + LIBPNG_LIBS="-lpng -lz -lm" + ]) + ]) + MULE_RESTORE([LIBS]) + ]) + + AS_IF([test -n "$LIBPNG_VERSION"], [$2], [$3]) + +AC_SUBST([LIBPNG_CFLAGS])dnl +AC_SUBST([LIBPNG_LDFLAGS])dnl +AC_SUBST([LIBPNG_LIBS])dnl + +m4_undefine([REQUIRED_VERSION])dnl +m4_undefine([REQUIRED_VERSION_MAJOR])dnl +m4_undefine([REQUIRED_VERSION_MINOR])dnl +m4_undefine([REQUIRED_VERSION_MICRO])dnl +]) diff -ruN -d amule-2.2.0~svn20080218/m4/libupnp.m4 amule-2.2.2/m4/libupnp.m4 --- amule-2.2.0~svn20080218/m4/libupnp.m4 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/m4/libupnp.m4 2008-07-13 03:36:09.000000000 +0000 @@ -0,0 +1,97 @@ +# -*- Autoconf -*- +# This file is part of the aMule project. +# This file is part of the libupnp library project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# + +dnl -------------------------------------------------------------------------- +dnl LIBUPNP_CHECK([VERSION = 1.6.6], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl +dnl Check for the libupnp library +dnl -------------------------------------------------------------------------- +dnl +dnl This macro sets these variables: +dnl - LIBUPNP_VERSION +dnl Something like "1.6.7" +dnl - LIBUPNP_CPPFLAGS +dnl Flags to be added to CPPFLAGS +dnl - LIBUPNP_CFLAGS +dnl Flags to be added to CFLAGS +dnl - LIBUPNP_LDFLAGS +dnl Flags to be added to LDFLAGS +dnl - LIBUPNP_LIBS +dnl Library to be added to LIBS +dnl +dnl The LIBUPNP_CPPFLAGS, LIBUPNP_CFLAGS, LIBUPNP_LDFLAGS and LIBUPNP_LIBS variables are also substituted. +dnl +AC_DEFUN([LIBUPNP_CHECK], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +m4_define([MIN_LIBUPNP_VERSION], [m4_ifval([$1], [$1], [1.6.6])])dnl + +dnl Test for --with-libupnp-prefix + AC_ARG_WITH( + [libupnp-prefix], + [AS_HELP_STRING( + [--with-libupnp-prefix=PREFIX], + [UPnP library location])], + [export PKG_CONFIG_PATH=$withval/lib/pkgconfig]) + +dnl Check for libupnp >= MIN_LIBUPNP_VERSION + AS_IF([test $cross_compiling = no], [dnl + AC_MSG_CHECKING([for libupnp version >= MIN_LIBUPNP_VERSION]) + AS_IF([test -n "$PKG_CONFIG"], [dnl + AS_IF([$PKG_CONFIG libupnp --exists], [dnl + LIBUPNP_VERSION=`$PKG_CONFIG libupnp --modversion` + AS_IF([$PKG_CONFIG libupnp --atleast-version=MIN_LIBUPNP_VERSION], [dnl + result=yes + resultstr=" (version $LIBUPNP_VERSION)" + LIBUPNP_CPPFLAGS=`$PKG_CONFIG libupnp --cflags-only-I` + LIBUPNP_CFLAGS=`$PKG_CONFIG libupnp --cflags-only-other` + LIBUPNP_LDFLAGS=`$PKG_CONFIG libupnp --libs-only-L` + LIBUPNP_LIBS=`$PKG_CONFIG libupnp --libs-only-other` + LIBUPNP_LIBS="$LIBUPNP_LIBS `$PKG_CONFIG libupnp --libs-only-l`" + ], [dnl + result=no + resultstr=" (version $LIBUPNP_VERSION is not new enough)" + ])dnl + ], [dnl + result=no + resultstr=" (try to use --with-libupnp-prefix=PREFIX)" + ])dnl + ], [dnl + result=no + resultstr=" (pkg-config not found)" + ])dnl + AC_MSG_RESULT([$result$resultstr]) + libupnp_error="libupnp >= MIN_LIBUPNP_VERSION not found$resultstr" + ], [dnl +dnl Currently cross-compilation with libupnp is not supported. + result=no + libupnp_error="cross compiling" + ])dnl + +dnl Execute the right action. + AS_IF([test ${result:-no} = yes], [$2], [$3]) + +dnl Exported symbols +AC_SUBST([LIBUPNP_CPPFLAGS])dnl +AC_SUBST([LIBUPNP_CFLAGS])dnl +AC_SUBST([LIBUPNP_LDFLAGS])dnl +AC_SUBST([LIBUPNP_LIBS])dnl +m4_undefine([MIN_LIBUPNP_VERSION])dnl +]) diff -ruN -d amule-2.2.0~svn20080218/m4/nls.m4 amule-2.2.2/m4/nls.m4 --- amule-2.2.0~svn20080218/m4/nls.m4 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/m4/nls.m4 2008-06-02 15:20:44.000000000 +0000 @@ -0,0 +1,106 @@ +# -*- Autoconf -*- +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# + +dnl ---------------------------------------------------- +dnl MULE_CHECK_AUTOPOINT([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl check if autopoint is installed +dnl ---------------------------------------------------- +AC_DEFUN([MULE_CHECK_AUTOPOINT], +[ + AC_MSG_CHECKING([for autopoint]) + autopoint_version=`autopoint --version | head -n 1 | sed -e 's/.*[[^0-9.]]\([[0-9]]\{1,\}\(\.[[0-9]]\{1,\}\)\{1,2\}\)[[^0-9.]]*/\1/'` + AS_IF([test -n "$autopoint_version"], [ + AC_MSG_RESULT([yes ($autopoint_version)]) + $1 + ], [ + AC_MSG_RESULT([no]) + $2 + ]) +]) + + +dnl --------------------------------------------------------------------------- +dnl GENERATE_MANS_TO_INSTALL(TESTNAME, BASENAMEPATH) +dnl +dnl This function will generate the list of manpages to be installed. +dnl +dnl TESTNAME is the name of a variable that'll evaluate to yes if this +dnl set of manpages need installing. The list of files will be returned in +dnl the TESTNAME_MANPAGES variable. +dnl +dnl BASENAMEPATH is the path and basename of the manpages we test for, relative +dnl to the package root (top_srcdir) +dnl --------------------------------------------------------------------------- +AC_DEFUN([GENERATE_MANS_TO_INSTALL], +[ + AS_IF([test "$[]$1" == "yes"], [ + AS_IF([test -z "$LINGUAS"], + [$1_MANPAGES=`ls -1 ${srcdir}/$2.* | sed -e 's:.*/::g'`], + [ + $1_MANPAGES=`ls -1 ${srcdir}/$2.* | sed -e 's:.*/::g' | grep $Generate_Langs ` + $1_MANPAGES="`basename $2.1` $[]$1_MANPAGES" + ]) + $1_MANPAGES=`echo $[]$1_MANPAGES | tr -d '\n'` + ], [$1_MANPAGES=]) + +AC_SUBST([$1_MANPAGES])dnl +]) + + +dnl --------------------------------------------------------------------------- +dnl MULE_CHECK_NLS +dnl +dnl Checks and tests everything needed for Native Language Support +dnl --------------------------------------------------------------------------- +AC_DEFUN([MULE_CHECK_NLS], +[ + AC_ARG_WITH([language], + [AS_HELP_STRING([--with-language=], + [Specify a comma-separated list of languages you want to have installed. See po/LINGUAS for available languages])], + [AS_IF([test "$withval" = "all"], [LINGUAS='%UNSET%'], [LINGUAS="`echo $withval | sed -e 's/,/ /g'`"])]) + + AM_GNU_GETTEXT([no-libtool], [need-ngettext]) + AS_IF([test $USE_INCLUDED_LIBINTL = yes], [INCINTL=-I\${top_builddir}/intl]) + + AS_IF([test x$USE_NLS = xyes], [MULE_CHECK_AUTOPOINT(, [USE_NLS=no])]) + AS_IF([test x$USE_NLS = xno -a x${enable_nls:-yes} = xyes], [AC_MSG_WARN([You need to install GNU gettext/gettext-tools to compile aMule with i18n support.])]) + + AS_IF([test ${USE_NLS:-no} = yes], [ + AC_MSG_CHECKING([for requested languages]) + Generate_Langs=`echo $LINGUAS | $AWK ['OFS="\\\\|" { for (i = 1; i <= NF; ++i) $i = "\\\\." $i; print }']` + GENERATE_MANS_TO_INSTALL([AMULE_DAEMON], [docs/man/amuled]) + GENERATE_MANS_TO_INSTALL([AMULECMD], [docs/man/amulecmd]) + GENERATE_MANS_TO_INSTALL([WEB], [docs/man/amuleweb]) + GENERATE_MANS_TO_INSTALL([AMULE_GUI], [docs/man/amulegui]) + GENERATE_MANS_TO_INSTALL([CAS], [src/utils/cas/docs/cas]) + GENERATE_MANS_TO_INSTALL([WXCAS], [src/utils/wxCas/docs/wxcas]) + GENERATE_MANS_TO_INSTALL([ED2K], [docs/man/ed2k]) + GENERATE_MANS_TO_INSTALL([ALC], [src/utils/aLinkCreator/docs/alc]) + GENERATE_MANS_TO_INSTALL([ALCC], [src/utils/aLinkCreator/docs/alcc]) + GENERATE_MANS_TO_INSTALL([MONOLITHIC], [docs/man/amule]) + AC_MSG_RESULT([${LINGUAS:-all}]) + ]) + +AC_SUBST([INCINTL])dnl +]) diff -ruN -d amule-2.2.0~svn20080218/m4/pkg.m4 amule-2.2.2/m4/pkg.m4 --- amule-2.2.0~svn20080218/m4/pkg.m4 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/m4/pkg.m4 2008-07-13 03:36:09.000000000 +0000 @@ -0,0 +1,155 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES diff -ruN -d amule-2.2.0~svn20080218/m4/zlib.m4 amule-2.2.2/m4/zlib.m4 --- amule-2.2.0~svn20080218/m4/zlib.m4 2007-09-10 09:49:13.000000000 +0000 +++ amule-2.2.2/m4/zlib.m4 2008-06-03 14:16:38.000000000 +0000 @@ -1,134 +1,156 @@ +# -*- Autoconf -*- +# This file is part of the aMule Project. +# +# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +# +# Any parts of this program derived from the xMule, lMule or eMule project, +# or contributed by third-party developers are copyrighted by their +# respective authors. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# + dnl ---------------------------------------------------- -dnl AC_OPTIONS_ZLIB +dnl MULE_CHECK_ZLIB([MIN_ZLIB_VERSION = 1.1.4], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl +dnl check if zlib is on the system and is at least MIN_ZLIB_VERSION dnl dnl Add support for --with-zlib command-line parameter. dnl PREFIX may be a directory prefix where zlib is installed, e.g. /usr/local dnl or may be one of the following special keywords: -dnl peer - check zlib in peer directory (not supported, does anyone use it?) dnl sys - use system zlib +dnl +dnl Will set the output variables: +dnl ZLIB_CPPFLAGS +dnl ZLIB_LDFLAGS +dnl ZLIB_LIBS dnl ---------------------------------------------------- -AC_DEFUN([AC_OPTIONS_ZLIB], -[ - AC_ARG_WITH( - [zlib], - AS_HELP_STRING( - [--with-zlib=PREFIX], - [use zlib in PREFIX]), - [ac_zlib="$withval"], - [ac_zlib=yes]) -]) +AC_DEFUN([MULE_CHECK_ZLIB], +[dnl +m4_define([MIN_ZLIB_VERSION], [m4_ifval([$1], [$1], [1.1.4])])dnl +m4_define([zver_max], [m4_bregexp(MIN_ZLIB_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\1])])dnl +m4_define([zver_mid], [m4_bregexp(MIN_ZLIB_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\2])])dnl +m4_define([zver_min], [m4_bregexp(MIN_ZLIB_VERSION, [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\3])])dnl + AC_ARG_WITH([zlib], AS_HELP_STRING([--with-zlib=PREFIX], [use zlib in PREFIX])) -dnl ---------------------------------------------------- -dnl AC_CHECK_ZLIB([MIN_ZLIB_VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl check if zlib is on the system -dnl ---------------------------------------------------- -AC_DEFUN([AC_CHECK_ZLIB], -[ -ac_zver_max="m4_bregexp([$1], [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\1])" -ac_zver_mid="m4_bregexp([$1], [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\2])" -ac_zver_min="m4_bregexp([$1], [\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)], [\3])" + case "${with_zlib:-yes}" in + no) + $3 + ;; + yes | sys) + ;; + *) + zlib_prefix="$with_zlib" + esac -case "$ac_zlib" in -no) - ifelse([$3], , :, [$3]) - ;; -yes | sys) - ;; -*) - ac_zlib_prefix="$ac_zlib" -esac + MULE_BACKUP([CPPFLAGS]) + MULE_BACKUP([LDFLAGS]) + MULE_BACKUP([LIBS]) + AS_IF([test -n "$zlib_prefix"], + [ + ZLIB_CPPFLAGS="-I$zlib_prefix/include" + ZLIB_LDFLAGS="-L$zlib_prefix/lib" + MULE_APPEND([CPPFLAGS], [$ZLIB_CPPFLAGS]) + MULE_APPEND([LDFLAGS], [$ZLIB_LDFLAGS]) + ], [ + ZLIB_CPPFLAGS= + ZLIB_LDFLAGS= + ]) + ZLIB_LIBS="-lz" + MULE_PREPEND([LIBS], [$ZLIB_LIBS]) - if test -n "$ac_zlib_prefix"; then - ac_tmp_CPPFLAGS="$CPPFLAGS" - ac_tmp_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS -I$ac_zlib_prefix/include" - LDFLAGS="-L$ac_zlib_prefix/lib" - fi - ac_tmp_LIBS="$LIBS" - LIBS="-lz $LIBS" AC_MSG_CHECKING([for zlib >= $1]) AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ #include #include - ]], [[ + ]], [dnl Do not use double-quoting here! char *zver = zlibVersion(); FILE *f=fopen("conftestval", "w"); if (!f) return 1; fprintf(f, "%s", - zver[0] > '$ac_zver_max' || - (zver[0] == '$ac_zver_max' && - (zver[2] > '$ac_zver_mid' || - (zver[2] == '$ac_zver_mid' && - zver[4] >= '$ac_zver_min'))) ? "yes" : "no"); + zver[[0]] > 'zver_max' || + (zver[[0]] == 'zver_max' && + (zver[[2]] > 'zver_mid' || + (zver[[2]] == 'zver_mid' && + zver[[4]] >= 'zver_min'))) ? "yes" : "no"); fclose(f); f=fopen("conftestver", "w"); if (f) { fprintf(f, "%s", ZLIB_VERSION); fclose(f); } - ]]) + ]) ], [ - if test -f conftestval; then - result=`cat conftestval` - else - result=no - fi - if test x$result = xyes; then - if test -f conftestver; then + AS_IF([test -f conftestval], [result=`cat conftestval`], [result=no]) + AS_IF([test ${result:-no} = yes], + [ + AS_IF([test -f conftestver], + [ ZLIB_VERSION=`cat conftestver` z_version=" (version $ZLIB_VERSION)" - else - z_version="" - fi - fi - AC_MSG_RESULT($result$z_version) + ], [z_version=]) + ]) + AC_MSG_RESULT([$result$z_version]) ], [ result=no - AC_MSG_RESULT($result) + AC_MSG_RESULT([$result]) ], [ result=no - z_version='' + z_version= AC_LINK_IFELSE([ AC_LANG_PROGRAM([[ #include + #include ]], [[ - const char zver[] = "\nZLIB_VERSION_START" ZLIB_VERSION "ZLIB_VERSION_END\n"; + printf("\nZLIB_VERSION_START" ZLIB_VERSION "ZLIB_VERSION_END\n\n"); zlibVersion(); ]]) ], [ ZLIB_VERSION=`grep -a '^ZLIB_VERSION_START.*ZLIB_VERSION_END$' conftest$ac_exeext | sed 's/^ZLIB_VERSION_START\(.*\)ZLIB_VERSION_END$/\1/'` - ac_cross_zver_max="`echo $ZLIB_VERSION | cut -d. -f1`" - ac_cross_zver_mid="`echo $ZLIB_VERSION | cut -d. -f2`" - ac_cross_zver_min="`echo $ZLIB_VERSION | cut -d. -f3`" - if test "$ac_cross_zver_max" -gt "$ac_zver_max"; then - result=yes - elif test "$ac_cross_zver_max" -eq "$ac_zver_max"; then - if test "$ac_cross_zver_mid" -gt "$ac_zver_mid"; then - result=yes - elif "$ac_cross_zver_mid" -eq "$ac_zver_mid"; then - if test "$ac_cross_zver_min" -ge "$ac_zver_min"; then - result=yes - fi - fi - fi - if test x$result = xyes; then - z_version=" (version $ZLIB_VERSION)" - fi + cross_zver_max="`echo $ZLIB_VERSION | cut -d. -f1`" + cross_zver_mid="`echo $ZLIB_VERSION | cut -d. -f2`" + cross_zver_min="`echo $ZLIB_VERSION | cut -d. -f3`" + MULE_IF([test "$cross_zver_max" -gt "zver_max"], [result=yes], + [test "$cross_zver_max" -eq "zver_max"], [ + MULE_IF([test "$cross_zver_mid" -gt "zver_mid"], [result=yes], + [test "$cross_zver_mid" -eq "zver_mid"], + [MULE_IF([test "$cross_zver_min" -ge "zver_min"], [result=yes])]) + ]) + AS_IF([test ${result:-no} = yes], [z_version=" (version $ZLIB_VERSION)"]) ]) - AC_MSG_RESULT($result$z_version) + AC_MSG_RESULT([$result$z_version]) ]) - if test x$result = xno; then - if test "${ac_tmp_CPPFLAGS+set}" = set; then - CPPFLAGS="$ac_tmp_CPPFLAGS" - fi - if test "${ac_tmp_LDFLAGS+set}" = set; then - LDFLAGS="$ac_tmp_LDFLAGS" - fi - LIBS="$ac_tmp_LIBS" - ifelse([$3], , :, [$3]) - else - ifelse([$2], , :, [$2]) - fi + + MULE_RESTORE([CPPFLAGS]) + MULE_RESTORE([LDFLAGS]) + MULE_RESTORE([LIBS]) + + AS_IF([test ${result:-no} = no], [ + ZLIB_CPPFLAGS= + ZLIB_LDFLAGS= + ZLIB_LIBS= + $3 + ], [$2]) + +AC_SUBST([ZLIB_CPPFLAGS])dnl +AC_SUBST([ZLIB_LDFLAGS])dnl +AC_SUBST([ZLIB_LIBS])dnl +m4_undefine([zver_max])dnl +m4_undefine([zver_mid])dnl +m4_undefine([zver_min])dnl +m4_undefine([MIN_ZLIB_VERSION])dnl ]) diff -ruN -d amule-2.2.0~svn20080218/missing amule-2.2.2/missing --- amule-2.2.0~svn20080218/missing 2008-02-18 06:01:43.000000000 +0000 +++ amule-2.2.2/missing 2008-08-08 13:29:08.000000000 +0000 @@ -1,7 +1,7 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-02-08.22 +scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. @@ -19,8 +19,8 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -297,6 +297,9 @@ # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 touch $file ;; diff -ruN -d amule-2.2.0~svn20080218/mkinstalldirs amule-2.2.2/mkinstalldirs --- amule-2.2.0~svn20080218/mkinstalldirs 2008-02-18 06:02:15.000000000 +0000 +++ amule-2.2.2/mkinstalldirs 2008-08-08 13:29:17.000000000 +0000 @@ -1,7 +1,7 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -scriptversion=2005-02-02.21 +scriptversion=2005-06-29.22 # Original author: Noah Friedman # Created: 1993-05-16 @@ -12,7 +12,7 @@ # . errstatus=0 -dirmode="" +dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... @@ -103,13 +103,21 @@ for file do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + case $file in + /*) pathcomp=/ ;; + *) pathcomp= ;; + esac + oIFS=$IFS + IFS=/ + set fnord $file shift + IFS=$oIFS - pathcomp= for d do - pathcomp="$pathcomp$d" + test "x$d" = x && continue + + pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac @@ -124,7 +132,7 @@ else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" - lasterr="" + lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then @@ -134,7 +142,7 @@ fi fi - pathcomp="$pathcomp/" + pathcomp=$pathcomp/ done done diff -ruN -d amule-2.2.0~svn20080218/src/ArchSpecific.h amule-2.2.2/src/ArchSpecific.h --- amule-2.2.0~svn20080218/src/ArchSpecific.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ArchSpecific.h 2008-05-28 14:10:28.000000000 +0000 @@ -103,7 +103,7 @@ // \} -#if defined(__arm__) || defined(__sparc__) +#if defined(__arm__) || defined(__sparc__) || defined(__mips__) #define ARM_OR_SPARC #endif diff -ruN -d amule-2.2.0~svn20080218/src/BarShader.cpp amule-2.2.2/src/BarShader.cpp --- amule-2.2.0~svn20080218/src/BarShader.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/BarShader.cpp 2008-07-13 15:50:28.000000000 +0000 @@ -39,9 +39,9 @@ m_Height( height ), m_FileSize( 1 ), m_Modifiers( NULL ), - m_used3dlevel( DEFAULT_DEPTH ) + m_used3dlevel( DEFAULT_DEPTH ), + m_Content(width, 0) { - Fill( 0 ); } @@ -53,17 +53,9 @@ } -void CBarShader::Reset() -{ - m_spanlist.clear(); - Fill(0); -} - - void CBarShader::SetFileSize(uint64 fileSize) { m_FileSize = fileSize; - Reset(); } @@ -81,6 +73,16 @@ } +void CBarShader::SetWidth(int width) +{ + if (width > 0) { + m_Width = width; + m_Content.clear(); + m_Content.resize(m_Width, 0); + } +} + + void CBarShader::Set3dDepth( int depth ) { if ( depth < 1 ) { @@ -119,27 +121,71 @@ } -void CBarShader::FillRange(uint64 start, uint64 end, const uint32 color) +void CBarShader::FillRange(uint64 start, uint64 end, uint32 color) { - // Sanity check - wxASSERT( start <= end ); - - if ( start >= m_FileSize ) { + if (start >= end || start >= m_FileSize) { return; } - if ( end >= m_FileSize ) { - end = m_FileSize - 1; + // precision for small files: end must be increased by one + // think of each byte as a visible block, then start points to + // the beginning of its block, but end points to the END of its block + end++; + + if (end > m_FileSize) { + end = m_FileSize; } - m_spanlist.insert( start, end, color ); + uint32 firstPixel = start * m_Width / m_FileSize; + uint32 lastPixel = end * m_Width / m_FileSize; + if (lastPixel == m_Width) { + lastPixel--; + } + double f_Width = m_Width; + // calculate how much of this pixels is to be covered with the fill + double firstCovered = firstPixel + 1 - start * f_Width / m_FileSize; + double lastCovered = end * f_Width / m_FileSize - lastPixel; + // all inside one pixel ? + if (firstPixel == lastPixel) { + BlendPixel(firstPixel, color, firstCovered + lastCovered - 1.0); + } else { + BlendPixel(firstPixel, color, firstCovered); + BlendPixel(lastPixel, color, lastCovered); + // fill pixels between (if any) + for (uint32 i = firstPixel + 1; i < lastPixel; i++) { + m_Content[i] = color; + } + } +} + + +// This function is responsible for drawing ranges that are too small +// to fill a single pixel. To overcome this problem, we gather the +// sum of ranges until we have enough to draw a single pixel. The +// color of this pixel will be the sum of the colors of the ranges +// within the single pixel, each weighted after its relative size. +void CBarShader::BlendPixel(uint32 index, uint32 color, double covered) +{ + uint32 oldcolor = m_Content[index]; + // Colors are added up, so the bar must be initialized black (zero) for blending to work. + // So after blending in 10 * the same color with covered == 0.1, the pixel will + // have the color. + // Blending in black will thus have no effect. + // This works as long each part of the virtual bar is overwritten just once (or left black). + int Red = (int) (GetRValue(oldcolor) + GetRValue(color) * covered + 0.5); + int Green = (int) (GetGValue(oldcolor) + GetGValue(color) * covered + 0.5); + int Blue = (int) (GetBValue(oldcolor) + GetBValue(color) * covered + 0.5); + Red = Red > 255 ? 255 : Red ; + Green = Green > 255 ? 255 : Green; + Blue = Blue > 255 ? 255 : Blue ; + m_Content[index] = RGB(Red, Green, Blue); } void CBarShader::Fill(uint32 color) { - m_spanlist.clear(); - m_spanlist.insert( 0, m_FileSize - 1, color ); + m_Content.clear(); + m_Content.resize(m_Width, color); } @@ -147,12 +193,6 @@ { wxASSERT( dc ); - // Check if there's anything to do ... - if ( m_spanlist.empty() ) { - return; - } - - // Do we need to rebuild the modifiers? if ( !bFlat && !m_Modifiers ) { BuildModifiers(); @@ -163,87 +203,25 @@ rectSpan.y = iTop; rectSpan.height = m_Height; rectSpan.width = 0; + uint32 lastcolor = 0xffffffff; // invalid value dc->SetPen(*wxTRANSPARENT_PEN); - // This modifier is multipled with sizes to allow for better handling of small ranges - const uint64 MOD = 1000; - // This is the number of bits each pixel should contain. - const uint64 bitsPerPixel = (m_FileSize * MOD) / (uint64)m_Width; - - // The initial values for partial pixel drawing - uint64 curPixel = 0; - uint64 curRed = 0; - uint64 curGreen = 0; - uint64 curBlue = 0; - - // Initialize to the first range - SpanList::iterator it = m_spanlist.begin(); - uint64 size = (uint64)( it.keyEnd() - it.keyStart() + 1 ) * MOD; - uint32 color = *it++; - - // Loop until everything has been drawn - while ( size || curPixel ) { - if ( !size && it != m_spanlist.end() ) { - // Fetch the next range and increment the iterator - size = (uint64)( it.keyEnd() - it.keyStart() + 1 ) * MOD; - color = *it++; - } else if ( curPixel || size < bitsPerPixel ) { - // This block is responsible for drawing ranges that are too small - // to fill a single pixel. To overcome this problem, we gather the - // sum of ranges until we have enough to draw a single pixel. The - // color of this pixel will be the sum of the colors of the ranges - // within the single pixel, each weighted after its relative size. - - // See how much we can take from the current range - uint64 curDiff = std::min( size, bitsPerPixel - curPixel ); - - // Increment the current size of the partial pixel - curPixel += curDiff; - - // Add the color of the current range times the ammount of the current - // range that was added to the partial pixel. The result will be divided - // by the length of the partial pixel to get the average. - curRed += curDiff * GetRValue( color ); - curGreen += curDiff * GetGValue( color ); - curBlue += curDiff * GetBValue( color ); - - // If we have a complete pixel, or if we have run out of usable ranges, - // then draw the partial pixel. Note that size is modified below this - // check, so that it only triggers when size was 0 to begin with. - if ( curPixel == bitsPerPixel || !size ) { - // Draw a single line containing the average of the smaller parts - uint32 col = RGB( (uint32)(curRed / curPixel), - (uint32)(curGreen / curPixel), - (uint32)(curBlue / curPixel) ); - - // Reset the partial-pixel - curPixel = curRed = curGreen = curBlue = 0; - - // Increment the position on the device-context - rectSpan.x += rectSpan.width; - rectSpan.width = 1; - - // Draw the line - FillRect(dc, rectSpan, col, bFlat); - } - - // Decrement size - size -= curDiff; + // draw each pixel, draw same colored pixels together + for (int x = 0; x < m_Width; x++) { + uint32 color = m_Content[x]; + if (color == lastcolor) { + rectSpan.width++; } else { - // We are dealing with a range that is large enough to draw by itself. - // We will draw as many complete pixels as we can, and allow the rest - // to be absorbed by the partial pixel. - rectSpan.x += rectSpan.width; - rectSpan.width = size / bitsPerPixel; - - // Unused size will be used by the partial-pixel drawing code. - size = size % bitsPerPixel; - - // Draw the range - FillRect(dc, rectSpan, color, bFlat); + if (rectSpan.width) { + FillRect(dc, rectSpan, lastcolor, bFlat); + rectSpan.x += rectSpan.width; + } + rectSpan.width = 1; + lastcolor = color; } } + FillRect(dc, rectSpan, lastcolor, bFlat); } diff -ruN -d amule-2.2.0~svn20080218/src/BarShader.h amule-2.2.2/src/BarShader.h --- amule-2.2.0~svn20080218/src/BarShader.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/BarShader.h 2008-03-27 12:29:52.000000000 +0000 @@ -27,7 +27,6 @@ #define BARSHADER_H #include "Types.h" // Needed for uint16 and uint32 -#include "RangeMap.h" // Needed for CRangeMap class wxRect; @@ -66,12 +65,9 @@ * @param width The new width. * * Setting this sets the width the bar which is used when it - * is drawn. The BarShader automatically fits the intire span- - * structure inside this area. + * is drawn and resets the pixel buffer to the fill color. */ - void SetWidth(int width) { - m_Width = width; - } + void SetWidth(int width); /** * Sets the height of the drawn bar. @@ -90,52 +86,13 @@ */ void Set3dDepth( int depth ); - - /** - * Returns the current width of the bar. - * - * @return The width of the bar. - */ - int GetWidth() const { - return m_Width; - } - - /** - * Returns the current height of the bar. - * - * @return The height of the bar. - */ - int GetHeight() const { - return m_Height; - } - - /** - * Returns the current 3D-depth of the bar. - * - * @return The 3D-depth of the bar. - */ - int Get3dDepth() const { - return m_used3dlevel; - } - - - /** - * Removes all spans from the bar. - * - * Calling this function deletes all current spans and fills the - * bar with a black span from 0 to filesize. - */ - void Reset(); - /** * Sets a new filesize. * * @param fileSize The new filesize. * * Calling this function sets a new filesize, which is the virtual - * length of the bar. This function does not change any spans already - * present and therefore, they might end up pointing past current - * filesize if the size if smaller than before. + * length of the bar. This function must be called before any filling. */ void SetFileSize(uint64 fileSize); @@ -151,7 +108,7 @@ * removed or resized. If the value of end is larger than the current * filesize, the filesize is increased to the value of end. */ - void FillRange(uint64 start, uint64 end, const uint32 color); + void FillRange(uint64 start, uint64 end, uint32 color); /** * Fill the entire bar with a span of the specified color. @@ -189,6 +146,11 @@ */ void FillRect(wxDC* dc, const wxRect& rectSpan, uint32 color, bool bFlat); + /** + * Blend in a single pixel + */ + void BlendPixel(uint32 index, uint32 color, double covered); + //! The width of the drawn bar int m_Width; //! The height of the drawn bar @@ -200,11 +162,8 @@ //! The current 3d level uint16 m_used3dlevel; - - //! SpanList is defined as a CRangeMap with uint32s as range-data - typedef CRangeMap SpanList; - //! The list of spans. This list is kept sorted. - SpanList m_spanlist; + // color for each pixel across the width is stored here + std::vector m_Content; }; #endif diff -ruN -d amule-2.2.0~svn20080218/src/BaseClient.cpp amule-2.2.2/src/BaseClient.cpp --- amule-2.2.0~svn20080218/src/BaseClient.cpp 2008-02-02 16:43:36.000000000 +0000 +++ amule-2.2.2/src/BaseClient.cpp 2008-06-11 15:01:21.000000000 +0000 @@ -31,6 +31,9 @@ #include #include #include +#include +#include +#include #include @@ -68,6 +71,8 @@ #include "kademlia/kademlia/Kademlia.h" #include "kademlia/kademlia/Prefs.h" #include "kademlia/kademlia/Search.h" +#include "kademlia/kademlia/UDPFirewallTester.h" +#include "kademlia/routing/RoutingZone.h" //#define __PACKET_DEBUG__ @@ -261,8 +266,10 @@ m_fRequestsCryptLayer = 0; m_fSupportsCryptLayer = 0; m_fRequiresCryptLayer = 0; - m_fSupportsSourceEx2 = 0; - + m_fSupportsSourceEx2 = 0; + m_fDirectUDPCallback = 0; + m_dwDirectCallbackTimeout = 0; + m_hasbeenobfuscatinglately = false; } @@ -355,7 +362,8 @@ m_fRequestsCryptLayer = 0; m_fSupportsCryptLayer = 0; m_fRequiresCryptLayer = 0; - m_fSupportsSourceEx2 = 0; + m_fSupportsSourceEx2 = 0; + m_fDirectUDPCallback = 0; } bool CUpDownClient::ProcessHelloPacket(const byte* pachPacket, uint32 nSize) @@ -487,7 +495,7 @@ // 4 Source Exchange // 4 Ext. Requests // 4 Comments - // 1 PeerChache supported + // 1 PeerCache supported // 1 No 'View Shared Files' supported // 1 MultiPacket // 1 Preview @@ -522,28 +530,47 @@ } case CT_EMULE_MISCOPTIONS2: - // 22 Reserved - m_fSupportsSourceEx2 = (temptag.GetInt() >> 10) & 0x01; + // 19 Reserved + // 1 Direct UDP Callback supported and available + // 1 Supports ChatCaptchas + // 1 Supports SourceExachnge2 Packets, ignores SX1 Packet Version + // 1 Requires CryptLayer + // 1 Requests CryptLayer + // 1 Supports CryptLayer + // 1 Reserved (ModBit) + // 1 Ext Multipacket (Hash+Size instead of Hash) + // 1 Large Files (includes support for 64bit tags) + // 4 Kad Version - will go up to version 15 only (may need to add another field at some point in the future) + m_fDirectUDPCallback = (temptag.GetInt() >> 12) & 0x01; + // 1 captcha support + m_fSupportsSourceEx2 = (temptag.GetInt() >> 10) & 0x01; m_fRequiresCryptLayer = (temptag.GetInt() >> 9) & 0x01; m_fRequestsCryptLayer = (temptag.GetInt() >> 8) & 0x01; m_fSupportsCryptLayer = (temptag.GetInt() >> 7) & 0x01; // reserved 1 - m_fExtMultiPacket = (temptag.GetInt() >> 5) & 0x01; + m_fExtMultiPacket = (temptag.GetInt() >> 5) & 0x01; m_fSupportsLargeFiles = (temptag.GetInt() >> 4) & 0x01; - m_byKadVersion = (temptag.GetInt() >> 0) & 0x0f; + m_byKadVersion = (temptag.GetInt() >> 0) & 0x0f; dwEmuleTags |= 8; - + m_fRequestsCryptLayer &= m_fSupportsCryptLayer; m_fRequiresCryptLayer &= m_fRequestsCryptLayer; #ifdef __PACKET_DEBUG__ printf("Hello type packet processing with eMule Misc Options 2:\n"); - printf(" KadVersion = %u\n" , m_byKadVersion ); + printf(" m_fDirectUDPCallback = %i\n", m_fDirectUDPCallback); + printf(" m_fSupportsSourceEx2 = %i\n", m_fSupportsSourceEx2); + printf(" m_fRequiresCryptLayer = %i\n", m_fRequiresCryptLayer); + printf(" m_fRequestsCryptLayer = %i\n", m_fRequestsCryptLayer); + printf(" m_fSupportsCryptLayer = %i\n", m_fSupportsCryptLayer); + printf(" m_fExtMultiPacket = %i\n", m_fExtMultiPacket); + printf(" m_fSupportsLargeFiles = %i\n", m_fSupportsLargeFiles); + printf(" KadVersion = %u\n", m_byKadVersion); printf("That's all.\n"); #endif break; - - // Special tag fo Compat. Clients Misc options. + + // Special tag for Compat. Clients Misc options. case CT_EMULECOMPAT_OPTIONS: // 1 Operative System Info // 1 Value-based-type int tags (experimental!) @@ -645,7 +672,7 @@ } if( GetKadPort() ) { - Kademlia::CKademlia::Bootstrap(wxUINT32_SWAP_ALWAYS(GetIP()), GetKadPort()); + Kademlia::CKademlia::Bootstrap(wxUINT32_SWAP_ALWAYS(GetIP()), GetKadPort(), GetKadVersion() > 1); } return bIsMule; @@ -992,13 +1019,14 @@ uint32 kadUDPPort = 0; if(Kademlia::CKademlia::IsConnected()) { - kadUDPPort = thePrefs::GetEffectiveUDPPort(); + if (Kademlia::CKademlia::GetPrefs()->GetExternalKadPort() != 0 && Kademlia::CKademlia::GetPrefs()->GetUseExternKadPort() && Kademlia::CUDPFirewallTester::IsVerified()) { + kadUDPPort = Kademlia::CKademlia::GetPrefs()->GetExternalKadPort(); + } else { + kadUDPPort = Kademlia::CKademlia::GetPrefs()->GetInternKadPort(); + } } - CTagVarInt tagUdpPorts(CT_EMULE_UDPPORTS, - (kadUDPPort << 16) | - ((uint32)thePrefs::GetEffectiveUDPPort() ), - GetVBTTags() ? 0 : 32); + CTagVarInt tagUdpPorts(CT_EMULE_UDPPORTS, (kadUDPPort << 16) | ((uint32)thePrefs::GetEffectiveUDPPort()), GetVBTTags() ? 0 : 32); tagUdpPorts.WriteTagToFile(data); if( theApp->clientlist->GetBuddy() && theApp->IsFirewalled() ) { @@ -1022,29 +1050,29 @@ // eMule Misc. Options #1 - const uint32 uUdpVer = 4; - const uint32 uDataCompVer = 1; + const uint32 uUdpVer = 4; + const uint32 uDataCompVer = 1; const uint32 uSupportSecIdent = theApp->CryptoAvailable() ? 3 : 0; - const uint32 uSourceExchangeVer = 3; + const uint32 uSourceExchangeVer = 3; const uint32 uExtendedRequestsVer = 2; - const uint32 uAcceptCommentVer = 1; - const uint32 uNoViewSharedFiles = (thePrefs::CanSeeShares() == vsfaNobody) ? 1 : 0; // for backward compatibility this has to be a 'negative' flag - const uint32 uMultiPacket = 1; + const uint32 uAcceptCommentVer = 1; + const uint32 uNoViewSharedFiles = (thePrefs::CanSeeShares() == vsfaNobody) ? 1 : 0; // for backward compatibility this has to be a 'negative' flag + const uint32 uMultiPacket = 1; const uint32 uSupportPreview = 0; // No network preview at all. const uint32 uPeerCache = 0; // No peercache for aMule, baby const uint32 uUnicodeSupport = 1; - const uint32 nAICHVer = 1; // AICH is ENABLED right now. + const uint32 nAICHVer = 1; // AICH is ENABLED right now. CTagVarInt tagMisOptions(CT_EMULE_MISCOPTIONS1, - (nAICHVer << ((4*7)+1)) | + (nAICHVer << ((4*7)+1)) | (uUnicodeSupport << 4*7) | - (uUdpVer << 4*6) | + (uUdpVer << 4*6) | (uDataCompVer << 4*5) | (uSupportSecIdent << 4*4) | (uSourceExchangeVer << 4*3) | - (uExtendedRequestsVer << 4*2) | + (uExtendedRequestsVer << 4*2) | (uAcceptCommentVer << 4*1) | - (uPeerCache << 1*3) | + (uPeerCache << 1*3) | (uNoViewSharedFiles << 1*2) | (uMultiPacket << 1*1) | (uSupportPreview << 1*0) @@ -1052,24 +1080,30 @@ tagMisOptions.WriteTagToFile(data); // eMule Misc. Options #2 - const uint32 uKadVersion = 1; - const uint32 uSupportLargeFiles = 1; + const uint32 uKadVersion = KADEMLIA_VERSION; + const uint32 uSupportLargeFiles = 1; const uint32 uExtMultiPacket = 1; const uint32 uReserved = 0; // mod bit const uint32 uSupportsCryptLayer = thePrefs::IsClientCryptLayerSupported() ? 1 : 0; const uint32 uRequestsCryptLayer = thePrefs::IsClientCryptLayerRequested() ? 1 : 0; const uint32 uRequiresCryptLayer = thePrefs::IsClientCryptLayerRequired() ? 1 : 0; - const uint32 uSupportsSourceEx2 = 1; + const uint32 uSupportsSourceEx2 = 1; + // direct callback is only possible if connected to kad, tcp firewalled and verified UDP open (for example on a full cone NAT) + const uint32 uDirectUDPCallback = (Kademlia::CKademlia::IsRunning() && Kademlia::CKademlia::IsFirewalled() + && !Kademlia::CUDPFirewallTester::IsFirewalledUDP(true) && Kademlia::CUDPFirewallTester::IsVerified()) ? 1 : 0; + CTagVarInt tagMisOptions2(CT_EMULE_MISCOPTIONS2, // (RESERVED ) - (uSupportsSourceEx2 << 10) | + (uDirectUDPCallback << 12) | +// (uSupportsCaptcha << 11) | // No captcha support in aMule + (uSupportsSourceEx2 << 10) | (uRequiresCryptLayer << 9) | (uRequestsCryptLayer << 8) | (uSupportsCryptLayer << 7) | - (uReserved << 6) | - (uExtMultiPacket << 5) | - (uSupportLargeFiles << 4) | - (uKadVersion << 0) + (uReserved << 6) | + (uExtMultiPacket << 5) | + (uSupportLargeFiles << 4) | + (uKadVersion << 0) , GetVBTTags() ? 0 : 32 ); tagMisOptions2.WriteTagToFile(data); @@ -1124,7 +1158,7 @@ // The comment is unicoded, with a uin32 len and safe read // (won't break if string size is < than advertised len) // Truncated to MAXFILECOMMENTLEN size - m_strComment = data.ReadString(GetUnicodeSupport(), 4 /* bytes (it's a uint32)*/, true).Left(MAXFILECOMMENTLEN); + m_strComment = data.ReadString((GetUnicodeSupport() != utf8strNone), 4 /* bytes (it's a uint32)*/, true).Left(MAXFILECOMMENTLEN); AddDebugLogLineM( false, logClient, wxString(wxT("Description for file '")) << m_clientFilename << wxT("' received: ") << m_strComment); @@ -1174,10 +1208,26 @@ } -bool CUpDownClient::Disconnected(const wxString& strReason, bool bFromSocket){ - - // Kad reviewed +bool CUpDownClient::Disconnected(const wxString& strReason, bool bFromSocket) +{ + //wxASSERT(theApp->clientlist->IsValidClient(this)); + // was this a direct callback? + if (m_dwDirectCallbackTimeout != 0) { + theApp->clientlist->RemoveDirectCallback(this); + m_dwDirectCallbackTimeout = 0; + theApp->clientlist->AddDeadSource(this); + AddDebugLogLineM(false, logClient, wxT("Direct callback failed to client ") + GetUserHash().Encode() + wxT(" on ip ") + GetFullIP()); + } + + if (GetKadState() == KS_QUEUED_FWCHECK_UDP || GetKadState() == KS_CONNECTING_FWCHECK_UDP) { + Kademlia::CUDPFirewallTester::SetUDPFWCheckResult(false, true, wxUINT32_SWAP_ALWAYS(GetConnectIP()), 0); // inform the tester that this test was cancelled + } else if (GetKadState() == KS_FWCHECK_UDP) { + Kademlia::CUDPFirewallTester::SetUDPFWCheckResult(false, false, wxUINT32_SWAP_ALWAYS(GetConnectIP()), 0); // inform the tester that this test has failed +// } else if (GetKadState() == KS_CONNECTED_BUDDY) { +// AddDebugLogLineM(false, logClient, wxT("Buddy client disconnected - ") + strReason); + } + //If this is a KAD client object, just delete it! SetKadState(KS_NONE); @@ -1337,11 +1387,13 @@ return true; } } - - if( GetKadState() == KS_QUEUED_FWCHECK ) { + + if (GetKadState() == KS_QUEUED_FWCHECK) { SetKadState(KS_CONNECTING_FWCHECK); + } else if (GetKadState() == KS_QUEUED_FWCHECK_UDP) { + SetKadState(KS_CONNECTING_FWCHECK_UDP); } - + if ( HasLowID() ) { if (!theApp->DoCallback(this)) { //We cannot do a callback! @@ -1364,7 +1416,8 @@ //If ANYTHING changes with the "if(!theApp->DoCallback(this))" above that will let you fall through //with the condition that the source is firewalled and we are firewalled, we must //recheck it before the this check.. - if( HasValidBuddyID() && !GetBuddyIP() && !GetBuddyPort() && !theApp->serverconnect->IsLocalServer(GetServerIP(), GetServerPort())) { + if (HasValidBuddyID() && !GetBuddyIP() && !GetBuddyPort() && !theApp->serverconnect->IsLocalServer(GetServerIP(), GetServerPort()) + && !(SupportsDirectUDPCallback() && thePrefs::GetEffectiveUDPPort() != 0)) { //This is a Kad firewalled source that we want to do a special callback because it has no buddyIP or buddyPort. if( Kademlia::CKademlia::IsConnected() ) { //We are connect to Kad @@ -1388,7 +1441,29 @@ } - if (HasLowID()) { + if (HasLowID() && SupportsDirectUDPCallback() && thePrefs::GetEffectiveUDPPort() != 0 && GetConnectIP() != 0) { // LOWID with DirectCallback + if (m_dwDirectCallbackTimeout != 0) { + AddDebugLogLineM(false, logClient, wxT("ERROR: Trying Direct UDP Callback while already trying to connect to client ") + GetUserHash().Encode()); + return true; // We're already trying a direct connection to this client + } + // a direct callback is possible - since no other parties are involved and only one additional packet overhead + // is used we basically handle it like a normal connection try, no restrictions apply + // we already check above with !theApp->DoCallback(this) if any callback is possible at all + m_dwDirectCallbackTimeout = ::GetTickCount() + SEC2MS(45); + theApp->clientlist->AddDirectCallbackClient(this); + // TODO LOGREMOVE + AddDebugLogLineM(false, logClient, wxString::Format(wxT("Direct Callback on port %u to client "), GetKadPort()) + GetUserHash().Encode()); + + CMemFile data; + data.WriteUInt16(thePrefs::GetPort()); // needs to know our port + data.WriteHash(thePrefs::GetUserHash()); // and userhash + // our connection settings + data.WriteUInt8(Kademlia::CPrefs::GetMyConnectOptions(true, false)); + AddDebugLogLineM(false, logClientUDP, wxT("Sending OP_DIRECTCALLBACKREQ to ") + Uint32_16toStringIP_Port(GetConnectIP(), GetKadPort())); + CPacket* packet = new CPacket(data, OP_EMULEPROT, OP_DIRECTCALLBACKREQ); + theStats::AddUpOverheadOther(packet->GetPacketSize()); + theApp->clientudp->SendPacket(packet, GetConnectIP(), GetKadPort(), ShouldReceiveCryptUDPPackets(), GetUserHash().GetHash(), false, 0); + } else if (HasLowID()) { // LOWID if (GetDownloadState() == DS_CONNECTING) { SetDownloadState(DS_WAITCALLBACK); } @@ -1467,7 +1542,7 @@ } } } - } else { + } else { // HIGHID if (!Connect()) { return false; } @@ -1525,6 +1600,14 @@ SendPublicIPRequest(); } + // was this a direct callback? + if (m_dwDirectCallbackTimeout != 0){ + theApp->clientlist->RemoveDirectCallback(this); + m_dwDirectCallbackTimeout = 0; + // TODO LOGREMOVE + AddDebugLogLineM(false, logClient, wxT("Direct Callback succeeded, connection established to ") + GetUserHash().Encode()); + } + switch (GetKadState()) { case KS_CONNECTING_FWCHECK: SetKadState(KS_CONNECTED_FWCHECK); @@ -1533,6 +1616,10 @@ case KS_INCOMING_BUDDY: SetKadState(KS_CONNECTED_BUDDY); break; + case KS_CONNECTING_FWCHECK_UDP: + SetKadState(KS_FWCHECK_UDP); + SendFirewallCheckUDPRequest(); + break; default: break; } @@ -1874,8 +1961,12 @@ sRet = (CFormat(_("NickName: %s ID: %u")) % GetUserName() % GetUserIDHybrid()) + wxT(" "); if (m_reqfile) { sRet += CFormat(_("Requested: %s\n")) % m_reqfile->GetFileName(); - sRet += CFormat(_("Filestats for this session: Accepted %d of %d requests, %s transferred\n")) % m_reqfile->statistic.GetAccepts() % m_reqfile->statistic.GetRequests() % CastItoXBytes(m_reqfile->statistic.GetTransferred()); - sRet += CFormat(_("Filestats for all sessions: Accepted %d of %d requests, %s transferred\n")) % m_reqfile->statistic.GetAllTimeAccepts() % m_reqfile->statistic.GetAllTimeRequests() % CastItoXBytes(m_reqfile->statistic.GetAllTimeTransferred()); + sRet += CFormat( + wxPLURAL("Filestats for this session: Accepted %d of %d request, %s transferred\n", "Filestats for this session: Accepted %d of %d requests, %s transferred\n", m_reqfile->statistic.GetRequests()) + ) % m_reqfile->statistic.GetAccepts() % m_reqfile->statistic.GetRequests() % CastItoXBytes(m_reqfile->statistic.GetTransferred()); + sRet += CFormat( + wxPLURAL("Filestats for all sessions: Accepted %d of %d request, %s transferred\n", "Filestats for all sessions: Accepted %d of %d requests, %s transferred\n", m_reqfile->statistic.GetAllTimeRequests()) + ) % m_reqfile->statistic.GetAllTimeAccepts() % m_reqfile->statistic.GetAllTimeRequests() % CastItoXBytes(m_reqfile->statistic.GetAllTimeTransferred()); } else { sRet += _("Requested unknown file"); } @@ -1888,7 +1979,7 @@ bool CUpDownClient::SafeSendPacket(CPacket* packet) { if (IsConnected()) { - SendPacket(packet); + SendPacket(packet, true); return true; } else { m_WaitingPackets_list.push_back(packet); @@ -2257,6 +2348,8 @@ m_dwUserIP = val; m_nConnectIP = val; + + m_FullUserIP = Uint32toStringIP(val); } @@ -2433,4 +2526,76 @@ && HasValidHash() && (thePrefs::IsClientCryptLayerRequested() || RequestsCryptLayer()) ); } +void CUpDownClient::SendFirewallCheckUDPRequest() +{ + wxASSERT(GetKadState() == KS_FWCHECK_UDP); + + if (!Kademlia::CKademlia::IsRunning()) { + SetKadState(KS_NONE); + return; + } else if (GetUploadState() != US_NONE || GetDownloadState() != DS_NONE || GetChatState() != MS_NONE || GetKadVersion() <= 5 || GetKadPort() == 0) { + Kademlia::CUDPFirewallTester::SetUDPFWCheckResult(false, true, wxUINT32_SWAP_ALWAYS(GetIP()), 0); // inform the tester that this test was cancelled + SetKadState(KS_NONE); + return; + } + + wxASSERT(Kademlia::CKademlia::GetPrefs()->GetExternalKadPort() != 0); + CMemFile data; + data.WriteUInt16(Kademlia::CKademlia::GetPrefs()->GetInternKadPort()); + data.WriteUInt16(Kademlia::CKademlia::GetPrefs()->GetExternalKadPort()); + data.WriteUInt32(Kademlia::CKademlia::GetPrefs()->GetUDPVerifyKey(GetConnectIP())); + CPacket* packet = new CPacket(data, OP_EMULEPROT, OP_FWCHECKUDPREQ); + theStats::AddUpOverheadKad(packet->GetPacketSize()); + SafeSendPacket(packet); +} + +void CUpDownClient::ProcessFirewallCheckUDPRequest(CMemFile* data) +{ + if (!Kademlia::CKademlia::IsRunning() || Kademlia::CKademlia::GetUDPListener() == NULL) { + //DebugLogWarning(_T("Ignored Kad Firewallrequest UDP because Kad is not running (%s)"), DbgGetClientInfo()); + return; + } + + // first search if we know this IP already, if so the result might be biased and we need tell the requester + bool errorAlreadyKnown = false; + if (GetUploadState() != US_NONE || GetDownloadState() != DS_NONE || GetChatState() != MS_NONE) { + errorAlreadyKnown = true; + } else if (Kademlia::CKademlia::GetRoutingZone()->GetContact(wxUINT32_SWAP_ALWAYS(GetConnectIP()), 0, false) != NULL) { + errorAlreadyKnown = true; + } + + uint16_t remoteInternPort = data->ReadUInt16(); + uint16_t remoteExternPort = data->ReadUInt16(); + uint32_t senderKey = data->ReadUInt32(); + if (remoteInternPort == 0) { + //DebugLogError(_T("UDP Firewallcheck requested with Intern Port == 0 (%s)"), DbgGetClientInfo()); + return; + } +// if (senderKey == 0) +// DebugLogWarning(_T("UDP Firewallcheck requested with SenderKey == 0 (%s)"), DbgGetClientInfo()); + + CMemFile testPacket1; + testPacket1.WriteUInt8(errorAlreadyKnown ? 1 : 0); + testPacket1.WriteUInt16(remoteInternPort); + DebugSend(Kad2FirewallUDP, wxUINT32_SWAP_ALWAYS(GetConnectIP()), remoteInternPort); + Kademlia::CKademlia::GetUDPListener()->SendPacket(testPacket1, KADEMLIA2_FIREWALLUDP, wxUINT32_SWAP_ALWAYS(GetConnectIP()), remoteInternPort, Kademlia::CKadUDPKey(senderKey, theApp->GetPublicIP(false)), NULL); + + // if the client has a router with PAT (and therefore a different extern port than intern), test this port too + if (remoteExternPort != 0 && remoteExternPort != remoteInternPort) { + CMemFile testPacket2; + testPacket2.WriteUInt8(errorAlreadyKnown ? 1 : 0); + testPacket2.WriteUInt16(remoteExternPort); + DebugSend(Kad2FirewalledUDP, wxUINT32_SWAP_ALWAYS(GetConnectIP()), remoteExternPort); + Kademlia::CKademlia::GetUDPListener()->SendPacket(testPacket2, KADEMLIA2_FIREWALLUDP, wxUINT32_SWAP_ALWAYS(GetConnectIP()), remoteExternPort, Kademlia::CKadUDPKey(senderKey, theApp->GetPublicIP(false)), NULL); + } + //DebugLog(_T("Answered UDP Firewallcheck request (%s)"), DbgGetClientInfo()); +} + +void CUpDownClient::SetConnectOptions(uint8_t options, bool encryption, bool callback) +{ + SetCryptLayerSupport((options & 0x01) != 0 && encryption); + SetCryptLayerRequest((options & 0x02) != 0 && encryption); + SetCryptLayerRequires((options & 0x04) != 0 && encryption); + SetDirectUDPCallbackSupport((options & 0x08) != 0 && callback); +} // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/CatDialog.h amule-2.2.2/src/CatDialog.h --- amule-2.2.0~svn20080218/src/CatDialog.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/CatDialog.h 2008-04-04 13:42:07.000000000 +0000 @@ -28,9 +28,8 @@ #include // Needed for wxDialog #include "Types.h" // Needed for uint32 +#include "OtherStructs.h" - -class Category_Struct; class wxStaticBitmap; class wxBitmap; class wxColour; diff -ruN -d amule-2.2.0~svn20080218/src/ClientCredits.h amule-2.2.2/src/ClientCredits.h --- amule-2.2.0~svn20080218/src/ClientCredits.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ClientCredits.h 2008-04-19 14:12:46.000000000 +0000 @@ -34,11 +34,9 @@ #define CRYPT_CIP_LOCALCLIENT 20 #define CRYPT_CIP_NONECLIENT 30 -#ifdef _MSC_VER -#pragma pack(1) -#endif -struct CreditStruct +class CreditStruct { +public: CreditStruct(); CMD4Hash key; @@ -48,13 +46,7 @@ uint16 nReserved3; uint8 nKeySize; byte abySecureIdent[MAXPUBKEYSIZE]; -} -#ifdef _MSC_VER -; -#pragma pack() -#else -__attribute__((__packed__)); -#endif +}; enum EIdentState{ IS_NOTAVAILABLE, diff -ruN -d amule-2.2.0~svn20080218/src/ClientCreditsList.cpp amule-2.2.2/src/ClientCreditsList.cpp --- amule-2.2.0~svn20080218/src/ClientCreditsList.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/ClientCreditsList.cpp 2008-05-13 09:17:36.000000000 +0000 @@ -165,10 +165,10 @@ m_mapClients[newcredits->GetKey()] = newcredits; } - AddLogLineM(false, wxString::Format(_("Creditfile loaded, %u clients are known"),count-cDeleted)); + AddLogLineM(false, wxString::Format(wxPLURAL("Creditfile loaded, %u client is known", "Creditfile loaded, %u clients are known", count - cDeleted), count - cDeleted)); if (cDeleted) { - AddLogLineM(false, wxString::Format(_(" - Credits expired for %u clients!"),cDeleted)); + AddLogLineM(false, wxString::Format(wxPLURAL(" - Credits expired for %u client!", " - Credits expired for %u clients!", cDeleted), cDeleted)); } } catch (const CSafeIOException& e) { AddDebugLogLineM(true, logCredits, wxT("IO error while loading clients.met file: ") + e.what()); @@ -317,17 +317,14 @@ } // load private key - CryptoPP::FileSource *filesource = new CryptoPP::FileSource( - filename2char(theApp->ConfigDir + CRYPTKEY_FILENAME), - true, new CryptoPP::Base64Decoder); - m_pSignkey = new CryptoPP::RSASSA_PKCS1v15_SHA_Signer(*filesource); + CryptoPP::FileSource filesource(filename2char(theApp->ConfigDir + CRYPTKEY_FILENAME), true, new CryptoPP::Base64Decoder); + m_pSignkey = new CryptoPP::RSASSA_PKCS1v15_SHA_Signer(filesource); // calculate and store public key - CryptoPP::RSASSA_PKCS1v15_SHA_Verifier pubkey( - *static_cast(m_pSignkey)); - CryptoPP::ArraySink *asink = new CryptoPP::ArraySink(m_abyMyPublicKey, 80); - pubkey.DEREncode(*asink); - m_nMyPublicKeyLen = asink->TotalPutLength(); - asink->MessageEnd(); + CryptoPP::RSASSA_PKCS1v15_SHA_Verifier pubkey(*static_cast(m_pSignkey)); + CryptoPP::ArraySink asink(m_abyMyPublicKey, 80); + pubkey.DEREncode(asink); + m_nMyPublicKeyLen = asink.TotalPutLength(); + asink.MessageEnd(); } catch (const CryptoPP::Exception& e) { delete static_cast(m_pSignkey); m_pSignkey = NULL; diff -ruN -d amule-2.2.0~svn20080218/src/ClientDetailDialog.cpp amule-2.2.2/src/ClientDetailDialog.cpp --- amule-2.2.0~svn20080218/src/ClientDetailDialog.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/ClientDetailDialog.cpp 2008-05-03 22:54:49.000000000 +0000 @@ -31,6 +31,7 @@ #include "Server.h" // Needed for CServer #include "updownclient.h" // Needed for CUpDownClient #include "muuli_wdr.h" // Needed for ID_CLOSEWND +#include "Preferences.h" // Needed for thePrefs // CClientDetailDialog dialog @@ -119,7 +120,31 @@ CastChild(ID_DSIP, wxStaticText)->SetLabel(_("Unknown")); CastChild(ID_DSNAME, wxStaticText)->SetLabel(_("Unknown")); } - + + // Obfuscation + wxString buffer; + if (thePrefs::IsClientCryptLayerSupported()) { + if (m_client->SupportsCryptLayer()) { + if ((m_client->RequestsCryptLayer() || thePrefs::IsClientCryptLayerRequested()) && m_client->HasObfuscatedConnectionBeenEstablished()) { + buffer = _("Enabled"); + } else { + buffer = _("Supported"); + } + } else { + buffer = _("Not supported"); + } + } else { + buffer = _("Disabled"); + } + CastChild(IDT_OBFUSCATION, wxStaticText)->SetLabel(buffer); + + // Kad + if (m_client->GetKadPort()) { + CastChild(IDT_KAD, wxStaticText)->SetLabel(_("Connected")); + } else { + CastChild(IDT_KAD, wxStaticText)->SetLabel(_("Disconnected")); + } + // File Name const CKnownFile* file = m_client->GetUploadFile(); if (file) { @@ -165,7 +190,7 @@ if (theApp->CryptoAvailable()) { if (m_client->SUINotSupported()) { CastChild(IDC_CDIDENT, wxStaticText)->SetLabel( - _("Not Supported")); + _("Not supported")); } else if (m_client->SUIFailed()) { CastChild(IDC_CDIDENT, wxStaticText)->SetLabel( _("Failed")); diff -ruN -d amule-2.2.0~svn20080218/src/ClientList.cpp amule-2.2.2/src/ClientList.cpp --- amule-2.2.0~svn20080218/src/ClientList.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ClientList.cpp 2008-06-11 14:47:21.000000000 +0000 @@ -25,9 +25,11 @@ #include "ClientList.h" // Interface declarations. +#include #include #include #include +#include #include "amule.h" // Needed for theApp #include "ClientTCPSocket.h" // Needed for CClientTCPSocket @@ -39,14 +41,16 @@ #include "Statistics.h" // Needed for theStats #include "Logger.h" #include "GuiEvents.h" // Needed for Notify_* +#include "Packet.h" #include - -#include "kademlia/routing/Contact.h" - #include "kademlia/kademlia/Search.h" +#include "kademlia/kademlia/SearchManager.h" +#include "kademlia/kademlia/UDPFirewallTester.h" #include "kademlia/net/KademliaUDPListener.h" +#include "kademlia/routing/Contact.h" + /** * CDeletedClient Class @@ -137,7 +141,8 @@ void CClientList::AddToDeleteQueue(CUpDownClient* client) { RemoveFromKadList( client ); - + RemoveDirectCallback( client ); + // We have to remove the client from the list immediatly, to avoit it getting // found by functions such as AttachToAlreadyKnown and GetClientsFromIP, // however, if the client isn't on the clientlist, then it is safe to delete @@ -449,6 +454,14 @@ } +bool CClientList::IsIPAlreadyKnown(uint32_t ip) +{ + // Find all items with the specified ip + std::pair range = m_ipList.equal_range(ip); + return range.first != range.second; +} + + bool CClientList::ComparePriorUserhash(uint32 dwIP, uint16 nPort, void* pNewHash) { std::map::iterator it = m_trackedClientsList.find( dwIP ); @@ -523,7 +536,7 @@ theApp->downloadqueue->RemoveSource( toremove ); Notify_ClientCtrlRemoveClient( toremove ); - + delete toremove; } } @@ -585,6 +598,7 @@ } switch (cur_client->GetKadState()) { case KS_QUEUED_FWCHECK: + case KS_QUEUED_FWCHECK_UDP: //Another client asked us to try to connect to them to check their firewalled status. cur_client->TryToConnect(true); break; @@ -593,10 +607,25 @@ //Ignore this state as we are just waiting for results. break; + case KS_FWCHECK_UDP: + case KS_CONNECTING_FWCHECK_UDP: + // We want a UDP firewallcheck from this client and are just waiting to get connected to send the request + break; + case KS_CONNECTED_FWCHECK: //We successfully connected to the client. //We now send a ack to let them know. - Kademlia::CKademlia::GetUDPListener()->SendNullPacket(KADEMLIA_FIREWALLED_ACK, wxUINT32_SWAP_ALWAYS(cur_client->GetIP()), cur_client->GetKadPort()); + if (cur_client->GetKadVersion() >= 7) { + // The result is now sent per TCP instead of UDP, because this will fail if our intern port is unreachable. + // But we want the TCP testresult regardless if UDP is firewalled, the new UDP state and test takes care of the rest + wxASSERT(cur_client->IsConnected()); + //AddDebugLogLineM(false, logClient, wxT("Sent OP_KAD_FWTCPCHECK_ACK")); + CPacket *packet = new CPacket(OP_KAD_FWTCPCHECK_ACK, 0, OP_EMULEPROT); + cur_client->SafeSendPacket(packet); + } else { + DebugSend(KadFirewalledAckRes, wxUINT32_SWAP_ALWAYS(cur_client->GetIP()), cur_client->GetKadPort()); + Kademlia::CKademlia::GetUDPListener()->SendNullPacket(KADEMLIA_FIREWALLED_ACK_RES, wxUINT32_SWAP_ALWAYS(cur_client->GetIP()), cur_client->GetKadPort(), 0, NULL); + } //We are done with this client. Set Kad status to KS_NONE and it will be removed in the next cycle. cur_client->SetKadState(KS_NONE); break; @@ -647,7 +676,7 @@ //A potential connected buddy client wanting to me in the Kad network //We set our flag to connected to make sure things are still working correctly. buddy = Connected; - + //If m_nBuddyStatus is not connected already, we set this client as our buddy! if( m_nBuddyStatus != Connected ) { m_pBuddy = cur_client; @@ -663,11 +692,11 @@ RemoveFromKadList(cur_client); } } - + //We either never had a buddy, or lost our buddy.. if( buddy == Disconnected ) { if( m_nBuddyStatus != Disconnected || m_pBuddy ) { - if( Kademlia::CKademlia::IsRunning() && theApp->IsFirewalled() ) { + if( Kademlia::CKademlia::IsRunning() && theApp->IsFirewalled() && Kademlia::CUDPFirewallTester::IsFirewalledUDP(true) ) { //We are a lowID client and we just lost our buddy. //Go ahead and instantly try to find a new buddy. Kademlia::CKademlia::GetPrefs()->SetFindBuddy(); @@ -679,16 +708,18 @@ } if ( Kademlia::CKademlia::IsConnected() ) { - if( Kademlia::CKademlia::IsFirewalled() ) { - if( m_nBuddyStatus == Disconnected && Kademlia::CKademlia::GetPrefs()->GetFindBuddy() ) { - //We are a firewalled client with no buddy. We have also waited a set time + // we only need a buddy if direct callback is not available + if(Kademlia::CKademlia::IsFirewalled() && Kademlia::CUDPFirewallTester::IsFirewalledUDP(true)) { + // TODO: Kad buddies won't work with RequireCrypt, so it is disabled for now, but should (and will) + // be fixed in later version + // Update: buddy connections themselves support obfuscation properly since eMule 0.49a and aMule SVN 2008-05-09 + // (this makes it work fine if our buddy uses require crypt), however callback requests don't support it yet so we + // wouldn't be able to answer callback requests with RequireCrypt, protocolchange intended for eMule 0.49b + if(m_nBuddyStatus == Disconnected && Kademlia::CKademlia::GetPrefs()->GetFindBuddy() && !thePrefs::IsClientCryptLayerRequired()) { + AddDebugLogLineM(false, logKadMain, wxT("Starting BuddySearch")); + //We are a firewalled client with no buddy. We have also waited a set time //to try to avoid a false firewalled status.. So lets look for a buddy.. - Kademlia::CSearch *findBuddy = new Kademlia::CSearch; - findBuddy->SetSearchTypes(Kademlia::CSearch::FINDBUDDY); - Kademlia::CUInt128 ID(true); - ID.XOR(Kademlia::CKademlia::GetPrefs()->GetKadID()); - findBuddy->SetTargetID(ID); - if( !Kademlia::CSearchManager::StartSearch(findBuddy) ) { + if (!Kademlia::CSearchManager::PrepareLookup(Kademlia::CSearch::FINDBUDDY, true, Kademlia::CUInt128(true).XOR(Kademlia::CKademlia::GetPrefs()->GetKadID()))) { //This search ID was already going. Most likely reason is that //we found and lost our buddy very quickly and the last search hadn't //had time to be removed yet. Go ahead and set this to happen again @@ -714,6 +745,7 @@ } CleanUpClientList(); + ProcessDirectCallbackList(); } @@ -834,12 +866,12 @@ /* Kad stuff */ -void CClientList::RequestTCP(Kademlia::CContact* contact) +bool CClientList::RequestTCP(Kademlia::CContact* contact, uint8_t connectOptions) { - uint32 nContactIP = wxUINT32_SWAP_ALWAYS(contact->GetIPAddress()); + uint32_t nContactIP = wxUINT32_SWAP_ALWAYS(contact->GetIPAddress()); // don't connect ourself if (theApp->GetPublicIP() == nContactIP && thePrefs::GetPort() == contact->GetTCPPort()) { - return; + return false; } CUpDownClient* pNewClient = FindClientByIP(nContactIP, contact->GetTCPPort()); @@ -847,55 +879,69 @@ if (!pNewClient) { //#warning Do we actually have to check friendstate here? pNewClient = new CUpDownClient(contact->GetTCPPort(), contact->GetIPAddress(), 0, 0, NULL, false, true); + } else if (pNewClient->GetKadState() != KS_NONE) { + return false; // already busy with this client in some way (probably buddy stuff), don't mess with it } //Add client to the lists to be processed. pNewClient->SetKadPort(contact->GetUDPPort()); pNewClient->SetKadState(KS_QUEUED_FWCHECK); + if (contact->GetClientID() != 0) { + uint8_t ID[16]; + contact->GetClientID().ToByteArray(ID); + pNewClient->SetUserHash(CMD4Hash(ID)); + pNewClient->SetConnectOptions(connectOptions, true, false); + } AddToKadList(pNewClient); // This was a direct adding, but I like to check duplicates //This method checks if this is a dup already. AddClient(pNewClient); + return true; } -void CClientList::RequestBuddy(Kademlia::CContact* contact) +void CClientList::RequestBuddy(Kademlia::CContact* contact, uint8_t connectOptions) { - - uint32 nContactIP = wxUINT32_SWAP_ALWAYS(contact->GetIPAddress()); + uint32_t nContactIP = wxUINT32_SWAP_ALWAYS(contact->GetIPAddress()); // Don't connect to ourself if (theApp->GetPublicIP() == nContactIP && thePrefs::GetPort() == contact->GetTCPPort()) { return; } - + CUpDownClient* pNewClient = FindClientByIP(nContactIP, contact->GetTCPPort()); if (!pNewClient) { pNewClient = new CUpDownClient(contact->GetTCPPort(), contact->GetIPAddress(), 0, 0, NULL, false, true ); + } else if (pNewClient->GetKadState() != KS_NONE) { + return; // already busy with this client in some way (probably fw stuff), don't mess with it + } else if (IsKadFirewallCheckIP(nContactIP)) { // doing a kad firewall check with this IP, abort + AddDebugLogLineM(false, logKadMain, wxT("Kad TCP firewallcheck / Buddy request collision for IP ") + Uint32toStringIP(nContactIP)); + return; } //Add client to the lists to be processed. pNewClient->SetKadPort(contact->GetUDPPort()); pNewClient->SetKadState(KS_QUEUED_BUDDY); - byte ID[16]; + uint8_t ID[16]; contact->GetClientID().ToByteArray(ID); pNewClient->SetUserHash(CMD4Hash(ID)); + pNewClient->SetConnectOptions(connectOptions, true, false); AddToKadList(pNewClient); //This method checks if this is a dup already. AddClient(pNewClient); - } -void CClientList::IncomingBuddy(Kademlia::CContact* contact, Kademlia::CUInt128* buddyID ) +bool CClientList::IncomingBuddy(Kademlia::CContact* contact, Kademlia::CUInt128* buddyID) { - - uint32 nContactIP = wxUINT32_SWAP_ALWAYS(contact->GetIPAddress()); + uint32_t nContactIP = wxUINT32_SWAP_ALWAYS(contact->GetIPAddress()); //If aMule already knows this client, abort this.. It could cause conflicts. //Although the odds of this happening is very small, it could still happen. if (FindClientByIP(nContactIP, contact->GetTCPPort())) { - return; + return false; + } else if (IsKadFirewallCheckIP(nContactIP)) { // doing a kad firewall check with this IP, abort + AddDebugLogLineM(false, logKadMain, wxT("Kad TCP firewallcheck / Buddy request collision for IP ") + Uint32toStringIP(nContactIP)); + return false; } - // Don't connect ourself if (theApp->GetPublicIP() == nContactIP && thePrefs::GetPort() == contact->GetTCPPort()) { - return; + return false; // don't connect ourself } //Add client to the lists to be processed. @@ -909,30 +955,46 @@ pNewClient->SetBuddyID(ID); AddToKadList(pNewClient); AddClient(pNewClient); + return true; } - void CClientList::RemoveFromKadList(CUpDownClient* torem) { wxCHECK_RET(torem, wxT("NULL pointer in RemoveFromKadList")); - + if (m_KadSources.erase(torem)) { if(torem == m_pBuddy) { m_pBuddy = NULL; Notify_ServerUpdateED2KInfo(); } } - } - void CClientList::AddToKadList(CUpDownClient* toadd) { wxCHECK_RET(toadd, wxT("NULL pointer in AddToKadList")); - + m_KadSources.insert(toadd); // This will take care of duplicates. } +bool CClientList::DoRequestFirewallCheckUDP(const Kademlia::CContact& contact) +{ + // first make sure we don't know this IP already from somewhere + if (IsIPAlreadyKnown(wxUINT32_SWAP_ALWAYS(contact.GetIPAddress()))) { + return false; + } + // fine, just create the client object, set the state and wait + // TODO: We don't know the client's userhash, this means we cannot build an obfuscated connection, which + // again mean that the whole check won't work on "Require Obfuscation" setting, which is not a huge problem, + // but certainly not nice. Only somewhat acceptable way to solve this is to use the KadID instead. + CUpDownClient* pNewClient = new CUpDownClient(contact.GetTCPPort(), contact.GetIPAddress(), 0, 0, NULL, false, true); + pNewClient->SetKadState(KS_QUEUED_FWCHECK_UDP); + AddDebugLogLineM(false, logClient, wxT("Selected client for UDP Firewallcheck: ") + Uint32toStringIP(wxUINT32_SWAP_ALWAYS(contact.GetIPAddress()))); + AddToKadList(pNewClient); + AddClient(pNewClient); + wxASSERT(!pNewClient->SupportsDirectUDPCallback()); + return true; +} void CClientList::CleanUpClientList() { @@ -959,15 +1021,7 @@ if ((pCurClient->GetUploadState() == US_NONE || pCurClient->GetUploadState() == US_BANNED && !pCurClient->IsBanned()) && pCurClient->GetDownloadState() == DS_NONE && pCurClient->GetChatState() == MS_NONE - && ( - (pCurClient->GetKadState() == KS_NONE) - || ( - (pCurClient->GetKadState() == KS_INCOMING_BUDDY) - && - // We didn't receive the promised buddy on 10 min - ((::GetTickCount() - pCurClient->GetCreationTime()) > KADEMLIABUDDYTIMEOUT) - ) - ) + && pCurClient->GetKadState() == KS_NONE && pCurClient->GetSocket() == NULL) { cDeleted++; @@ -991,8 +1045,8 @@ } if (!(pCurClient->GetKadState() == KS_NONE)) { AddDebugLogLineM(false, logProxy, - CFormat(wxT("Debug: Not deleted client %x with kad state: %i ip: %s time left: %i")) - % (long int)pCurClient % pCurClient->GetKadState() % pCurClient->GetFullIP() % (pCurClient->GetCreationTime()+KADEMLIABUDDYTIMEOUT-::GetTickCount())); + CFormat(wxT("Debug: Not deleted client %x with kad state: %i ip: %s")) + % (long int)pCurClient % pCurClient->GetKadState() % pCurClient->GetFullIP()); } if (!(pCurClient->GetSocket() == NULL)) { AddDebugLogLineM(false, logProxy, @@ -1006,4 +1060,85 @@ AddDebugLogLineM(false, logClient, wxString::Format(wxT("Cleaned ClientList, removed %i not used known clients"), cDeleted)); } } + +void CClientList::AddKadFirewallRequest(uint32 ip) +{ + uint32 ticks = ::GetTickCount(); + IpAndTicks add = { ip, ticks }; + m_firewallCheckRequests.push_front(add); + while (!m_firewallCheckRequests.empty()) { + if (ticks - m_firewallCheckRequests.back().inserted > SEC2MS(180)) { + m_firewallCheckRequests.pop_back(); + } else { + break; + } + } +} + +bool CClientList::IsKadFirewallCheckIP(uint32 ip) const +{ + uint32 ticks = ::GetTickCount(); + for (IpAndTicksList::const_iterator it = m_firewallCheckRequests.begin(); it != m_firewallCheckRequests.end(); ++it) { + if (it->ip == ip && ticks - it->inserted < SEC2MS(180)) { + return true; + } + } + return false; +} + +void CClientList::AddDirectCallbackClient(CUpDownClient* toAdd) +{ + wxASSERT(toAdd->GetDirectCallbackTimeout() != 0); + for (DirectCallbackList::const_iterator it = m_currentDirectCallbacks.begin(); it != m_currentDirectCallbacks.end(); ++it) { + if (*it == toAdd) { + wxFAIL; // might happen very rarely on multiple connection tries, could be fixed in the client class, till then it's not much of a problem though + return; + } + } + m_currentDirectCallbacks.push_back(toAdd); +} + +void CClientList::ProcessDirectCallbackList() +{ + // we do check if any direct callbacks have timed out by now + const uint32_t cur_tick = ::GetTickCount(); + for (DirectCallbackList::iterator it = m_currentDirectCallbacks.begin(); it != m_currentDirectCallbacks.end();) { + DirectCallbackList::iterator it2 = it++; + CUpDownClient* curClient = *it2; + if (curClient->GetDirectCallbackTimeout() < cur_tick) { + wxASSERT(curClient->GetDirectCallbackTimeout() != 0); + // TODO LOGREMOVE + //DebugLog(_T("DirectCallback timed out (%s)"), pCurClient->DbgGetClientInfo()); + m_currentDirectCallbacks.erase(it2); + if (curClient->Disconnected(wxT("Direct Callback Timeout"))) { + curClient->Safe_Delete(); + } + } + } +} + +void CClientList::AddTrackCallbackRequests(uint32_t ip) +{ + uint32_t now = ::GetTickCount(); + IpAndTicks add = { ip, now }; + m_directCallbackRequests.push_front(add); + while (!m_directCallbackRequests.empty()) { + if (now - m_directCallbackRequests.back().inserted > MIN2MS(3)) { + m_directCallbackRequests.pop_back(); + } else { + break; + } + } +} + +bool CClientList::AllowCallbackRequest(uint32_t ip) const +{ + uint32_t now = ::GetTickCount(); + for (IpAndTicksList::const_iterator it = m_directCallbackRequests.begin(); it != m_directCallbackRequests.end(); ++it) { + if (it->ip == ip && now - it->inserted < MIN2MS(3)) { + return false; + } + } + return true; +} // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/ClientList.h amule-2.2.2/src/ClientList.h --- amule-2.2.0~svn20080218/src/ClientList.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ClientList.h 2008-05-09 13:18:54.000000000 +0000 @@ -324,25 +324,34 @@ */ void SetChatState(uint64 client_id, uint8 state); - /* - * Avoids unwanted clients to be forever in the client list - */ - void CleanUpClientList(); - uint8 GetBuddyStatus() const {return m_nBuddyStatus;} // This must be used on CreateKadSourceLink and if we ever add the columns // on shared files control. CUpDownClient* GetBuddy() const { return m_pBuddy; } - void RequestTCP(Kademlia::CContact* contact); - void RequestBuddy(Kademlia::CContact* contact); - void IncomingBuddy(Kademlia::CContact* contact, Kademlia::CUInt128* buddyID ); + bool RequestTCP(Kademlia::CContact* contact, uint8_t connectOptions); + void RequestBuddy(Kademlia::CContact* contact, uint8_t connectOptions); + bool IncomingBuddy(Kademlia::CContact* contact, Kademlia::CUInt128* buddyID); void RemoveFromKadList(CUpDownClient* torem); void AddToKadList(CUpDownClient* toadd); + bool DoRequestFirewallCheckUDP(const Kademlia::CContact& contact); + + void AddKadFirewallRequest(uint32 ip); + bool IsKadFirewallCheckIP(uint32 ip) const; + + // Direct Callback list + void AddDirectCallbackClient(CUpDownClient *toAdd); + void RemoveDirectCallback(CUpDownClient *toRemove) { m_currentDirectCallbacks.remove(toRemove); } + void AddTrackCallbackRequests(uint32_t ip); + bool AllowCallbackRequest(uint32_t ip) const; + +protected: + /* + * Avoids unwanted clients to be forever in the client list + */ + void CleanUpClientList(); + + void ProcessDirectCallbackList(); - // We lack the kad firewall check -// //#warning ALSO FIX THIS, NOW!!! - bool IsKadFirewallCheckIP(uint32 /*ip*/) { return false; } - private: /** * Helperfunction which finds a client matching the specified client. @@ -357,6 +366,17 @@ /** + * Check if we already know this IP. + * + * This function is used to determine if the given IP address + * is already known. + * + * @param ip The IP address to check. + */ + bool IsIPAlreadyKnown(uint32_t ip); + + + /** * Helperfunction which removes the client from the IP-list. */ void RemoveIPFromList( CUpDownClient* client ); @@ -411,6 +431,17 @@ std::set m_KadSources; CUpDownClient* m_pBuddy; uint8 m_nBuddyStatus; + + typedef struct { + uint32 ip; + uint32 inserted; + } IpAndTicks; + typedef std::list IpAndTicksList; + IpAndTicksList m_firewallCheckRequests; + + typedef std::list DirectCallbackList; + DirectCallbackList m_currentDirectCallbacks; + IpAndTicksList m_directCallbackRequests; }; #endif diff -ruN -d amule-2.2.0~svn20080218/src/ClientListCtrl.cpp amule-2.2.2/src/ClientListCtrl.cpp --- amule-2.2.0~svn20080218/src/ClientListCtrl.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/ClientListCtrl.cpp 2008-05-04 01:36:39.000000000 +0000 @@ -30,6 +30,7 @@ #include "amule.h" #include "amuleDlg.h" +#include "BarShader.h" // Needed for CBarShader #include "ChatWnd.h" #include "ClientDetailDialog.h" #include "ClientList.h" @@ -39,6 +40,7 @@ #include "IP2Country.h" // Needed for IP2Country #endif #include "KnownFile.h" +#include "Preferences.h" #include "updownclient.h" #include "UploadQueue.h" @@ -242,7 +244,7 @@ CUpDownClient *client = reinterpret_cast(GetItemData( index )); banned = client->IsBanned(); - validIP = client->GetIP(); + validIP = (client->GetIP() != 0); isfriend = client->IsFriend(); hasdisabledsharedfiles = client->HasDisabledSharedFiles(); } @@ -769,27 +771,51 @@ void CUploadingView::DrawStatusBar( CUpDownClient* client, wxDC* dc, const wxRect& rect1 ) { wxRect rect = rect1; - rect.y += 2; + rect.y += 1; rect.height -= 2; wxPen old_pen = dc->GetPen(); wxBrush old_brush = dc->GetBrush(); + bool bFlat = thePrefs::UseFlatBar(); - dc->SetPen(*wxTRANSPARENT_PEN); - dc->SetBrush( wxBrush( wxColour(220,220,220), wxSOLID ) ); - - dc->DrawRectangle( rect ); - dc->SetBrush(*wxBLACK_BRUSH); + wxRect barRect = rect; + if (!bFlat) { // round bar has a black border, the bar itself is 1 pixel less on each border + barRect.x ++; + barRect.y ++; + barRect.height -= 2; + barRect.width -= 2; + } + static CBarShader s_StatusBar(16); + + uint32 crUnavailable = ( bFlat ? RGB( 224, 224, 224 ) : RGB( 240, 240, 240 ) ); + uint32 crAvailable = ( bFlat ? RGB( 0, 0, 0 ) : RGB( 104, 104, 104 ) ); uint32 partCount = client->GetUpPartCount(); - float blockpixel = (float)(rect.width)/((float)(PARTSIZE*partCount)/1024); - for ( uint32 i = 0; i < partCount; i++ ) { - if ( client->IsUpPartAvailable( i ) ) { - int right = rect.x + (uint32)(((float)PARTSIZE*i/1024)*blockpixel); - int left = rect.x + (uint32)((float)((float)PARTSIZE*(i+1)/1024)*blockpixel); - dc->DrawRectangle( (int)left, rect.y, right - left, rect.height ); - } + // Seems the partfile in the client object is not necessarily valid when bar is drawn for the first time. + // Keep it simple and make all parts same size. + s_StatusBar.SetFileSize(partCount * PARTSIZE); + s_StatusBar.SetHeight(barRect.height); + s_StatusBar.SetWidth(barRect.width); + s_StatusBar.Set3dDepth( thePrefs::Get3DDepth() ); + + uint64 uEnd = 0; + for ( uint64 i = 0; i < partCount; i++ ) { + uint64 uStart = PARTSIZE * i; + uEnd = uStart + PARTSIZE - 1; + + uint32 color = client->IsUpPartAvailable(i) ? crAvailable : crUnavailable; + s_StatusBar.FillRange(uStart, uEnd, color); + } + // fill the rest (if partStatus is empty) + s_StatusBar.FillRange(uEnd + 1, partCount * PARTSIZE - 1, crUnavailable); + s_StatusBar.Draw(dc, barRect.x, barRect.y, bFlat); + + if (!bFlat) { + // Draw black border + dc->SetPen( *wxBLACK_PEN ); + dc->SetBrush( *wxTRANSPARENT_BRUSH ); + dc->DrawRectangle(rect); } dc->SetPen( old_pen ); diff -ruN -d amule-2.2.0~svn20080218/src/ClientTCPSocket.cpp amule-2.2.2/src/ClientTCPSocket.cpp --- amule-2.2.0~svn20080218/src/ClientTCPSocket.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/ClientTCPSocket.cpp 2008-08-01 16:19:42.000000000 +0000 @@ -29,6 +29,7 @@ #include #include // Sometimes we reply with UDP packets. #include +#include #include #include "Preferences.h" // Needed for thePrefs @@ -158,18 +159,22 @@ } } -bool CClientTCPSocket::InitNetworkData() { +bool CClientTCPSocket::InitNetworkData() +{ wxASSERT(!m_remoteip); wxASSERT(!m_client); amuleIPV4Address addr; GetPeer(addr); m_remoteip = StringIPtoUint32(addr.IPAddress()); - + MULE_CHECK(m_remoteip, false); - + if (theApp->ipfilter->IsFiltered(m_remoteip)) { AddDebugLogLineM(false, logClient, wxT("Denied connection from ") + addr.IPAddress() + wxT("(Filtered IP)")); - return false; + return false; + } else if (theApp->clientlist->IsBannedClient(m_remoteip)) { + AddDebugLogLineM(false, logClient, wxT("Denied connection from ") + addr.IPAddress() + wxT("(Banned IP)")); + return false; } else { AddDebugLogLineM(false, logClient, wxT("Accepted connection from ") + addr.IPAddress()); return true; @@ -791,7 +796,7 @@ CMemFile message_file(buffer, size); - wxString message = message_file.ReadString(m_client->GetUnicodeSupport()); + wxString message = message_file.ReadString((m_client->GetUnicodeSupport() != utf8strNone)); if (IsMessageFiltered(message, m_client)) { AddLogLineM( true, CFormat(_("Message filtered from '%s' (IP:%s)")) % m_client->GetUserName() % m_client->GetFullIP()); } else { @@ -929,7 +934,7 @@ } CMemFile data(buffer, size); - wxString strReqDir = data.ReadString(m_client->GetUnicodeSupport()); + wxString strReqDir = data.ReadString((m_client->GetUnicodeSupport() != utf8strNone)); if (thePrefs::CanSeeShares()==vsfaEverybody || (thePrefs::CanSeeShares()==vsfaFriends && m_client->IsFriend())) { AddLogLineM( true, CFormat(_("User %s (%u) requested your sharedfiles-list for directory %s -> accepted")) % m_client->GetUserName() % m_client->GetUserIDHybrid() % strReqDir); wxASSERT( data.GetPosition() == data.GetLength() ); @@ -986,7 +991,7 @@ CMemFile data(buffer, size); uint32 uDirs = data.ReadUInt32(); for (uint32 i = 0; i < uDirs; i++){ - wxString strDir = data.ReadString(m_client->GetUnicodeSupport()); + wxString strDir = data.ReadString((m_client->GetUnicodeSupport() != utf8strNone)); AddLogLineM( true, CFormat( _("User %s (%u) shares directory %s") ) % m_client->GetUserName() % m_client->GetUserIDHybrid() @@ -1014,7 +1019,7 @@ theStats::AddDownOverheadOther(size); CMemFile data(buffer, size); - wxString strDir = data.ReadString(m_client->GetUnicodeSupport()); + wxString strDir = data.ReadString((m_client->GetUnicodeSupport() != utf8strNone)); if (m_client->GetFileListRequested() > 0){ AddLogLineM( true, CFormat( _("User %s (%u) sent sharedfiles-list for directory %s") ) @@ -1187,7 +1192,7 @@ AddDebugLogLineM( false, logRemoteClient, wxT("Remote Client: OP_MULTIPACKET has OP_REQUESTSOURCES(2)") ); uint8 byRequestedVersion = 0; uint16 byRequestedOptions = 0; - if (opcode == OP_REQUESTSOURCES2){ // SX2 requests contains additional data + if (opcode_in == OP_REQUESTSOURCES2){ // SX2 requests contains additional data byRequestedVersion = data_in.ReadUInt8(); byRequestedOptions = data_in.ReadUInt16(); } @@ -1240,7 +1245,7 @@ } if( m_client->GetKadPort() ) { - Kademlia::CKademlia::Bootstrap(wxUINT32_SWAP_ALWAYS(m_client->GetIP()), m_client->GetKadPort()); + Kademlia::CKademlia::Bootstrap(wxUINT32_SWAP_ALWAYS(m_client->GetIP()), m_client->GetKadPort(), m_client->GetKadVersion() > 1); } if (!m_client->CheckHandshakeFinished(OP_EMULEPROT, opcode)) { @@ -1469,6 +1474,7 @@ m_client->SetRemoteQueueRank(newrank); break; } + case OP_REQUESTSOURCES2: case OP_REQUESTSOURCES:{ AddDebugLogLineM( false, logRemoteClient, wxT("Remote Client: OP_REQUESTSOURCES from ") + m_client->GetFullIP() ); @@ -1814,6 +1820,24 @@ } break; } + case OP_FWCHECKUDPREQ: { // Support required for Kadversion >= 6 + AddDebugLogLineM(false, logRemoteClient, wxT("Remote Client: OP_FWCHECKUDPREQ from ") + m_client->GetFullIP()); + theStats::AddDownOverheadOther(size); + CMemFile data_in(buffer, size); + m_client->ProcessFirewallCheckUDPRequest(&data_in); + break; + } + case OP_KAD_FWTCPCHECK_ACK: { // Support required for Kadversion >= 7 + AddDebugLogLineM(false, logRemoteClient, wxT("Remote Client: OP_KAD_FWTCPCHECK_ACK from ") + m_client->GetFullIP()); + if (theApp->clientlist->IsKadFirewallCheckIP(m_client->GetIP())) { + if (Kademlia::CKademlia::IsRunning()) { + Kademlia::CKademlia::GetPrefs()->IncFirewalled(); + } + } else { + AddDebugLogLineM(false, logListenSocket, wxT("Received unrequested OP_KAD_FWTCPCHECK_ACK packet from ") + m_client->GetFullIP()); + } + break; + } default: theStats::AddDownOverheadOther(size); AddDebugLogLineM( false, logRemoteClient, wxString::Format(wxT("eMule packet : unknown opcode: %i %x from "),opcode,opcode) + m_client->GetFullIP()); diff -ruN -d amule-2.2.0~svn20080218/src/ClientUDPSocket.cpp amule-2.2.2/src/ClientUDPSocket.cpp --- amule-2.2.0~svn20080218/src/ClientUDPSocket.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ClientUDPSocket.cpp 2008-05-10 15:59:25.000000000 +0000 @@ -29,6 +29,7 @@ #include #include // Sometimes we reply with TCP packets. #include +#include #include #include // Needed for CFormat @@ -46,7 +47,9 @@ #include "MemFile.h" // Needed for CMemFile #include "Logger.h" #include "kademlia/kademlia/Kademlia.h" +#include "kademlia/utils/KadUDPKey.h" #include "zlib.h" +#include "EncryptedDatagramSocket.h" // // CClientUDPSocket -- Extended eMule UDP socket @@ -72,50 +75,64 @@ } -void CClientUDPSocket::OnPacketReceived(const wxIPV4address& addr, byte* buffer, size_t length) +void CClientUDPSocket::OnPacketReceived(uint32 ip, uint16 port, byte* buffer, size_t length) { wxCHECK_RET(length >= 2, wxT("Invalid packet.")); - uint8 protocol = buffer[0]; - uint8 opcode = buffer[1]; - uint32 ip = StringIPtoUint32(addr.IPAddress()); - uint16 port = addr.Service(); - - try { - switch (protocol) { - case OP_EMULEPROT: - ProcessPacket(buffer + 2,length - 2, opcode, ip, port); - break; - - case OP_KADEMLIAHEADER: - theStats::AddDownOverheadKad(length); - Kademlia::CKademlia::ProcessPacket(buffer, length, wxUINT32_SWAP_ALWAYS(ip), port); - break; - - case OP_KADEMLIAPACKEDPROT: { - theStats::AddDownOverheadKad(length); - uint32 nNewSize = length*10+300; // Should be enough... - std::vector unpack(nNewSize); - uLongf unpackedsize = nNewSize-2; - uint16 result = uncompress(&(unpack[2]), &unpackedsize, buffer + 2, length-2); - if (result == Z_OK) { - unpack[0] = OP_KADEMLIAHEADER; - unpack[1] = opcode; - Kademlia::CKademlia::ProcessPacket(&(unpack[0]), unpackedsize + 2, wxUINT32_SWAP_ALWAYS(ip), port); - } else { - AddDebugLogLineM(false, logClientKadUDP, wxT("Failed to uncompress Kademlia packet")); - } - break; + uint8_t *decryptedBuffer; + uint32_t receiverVerifyKey; + uint32_t senderVerifyKey; + int packetLen = CEncryptedDatagramSocket::DecryptReceivedClient(buffer, length, &decryptedBuffer, ip, &receiverVerifyKey, &senderVerifyKey); + + uint8_t protocol = decryptedBuffer[0]; + uint8_t opcode = decryptedBuffer[1]; + + if (packetLen >= 1) { + try { + switch (protocol) { + case OP_EMULEPROT: + ProcessPacket(decryptedBuffer + 2, packetLen - 2, opcode, ip, port); + break; + + case OP_KADEMLIAHEADER: + theStats::AddDownOverheadKad(length); + if (packetLen >= 2) { + Kademlia::CKademlia::ProcessPacket(decryptedBuffer, packetLen, wxUINT32_SWAP_ALWAYS(ip), port, (Kademlia::CPrefs::GetUDPVerifyKey(ip) == receiverVerifyKey), Kademlia::CKadUDPKey(senderVerifyKey, theApp->GetPublicIP(false))); + } else { + throw wxString(wxT("Kad packet too short")); + } + break; + + case OP_KADEMLIAPACKEDPROT: + theStats::AddDownOverheadKad(length); + if (packetLen >= 2) { + uint32_t newSize = packetLen * 10 + 300; // Should be enough... + std::vector unpack(newSize); + uLongf unpackedsize = newSize - 2; + uint16_t result = uncompress(&(unpack[2]), &unpackedsize, decryptedBuffer + 2, packetLen - 2); + if (result == Z_OK) { + AddDebugLogLineM(false, logClientKadUDP, wxT("Correctly uncompressed Kademlia packet")); + unpack[0] = OP_KADEMLIAHEADER; + unpack[1] = opcode; + Kademlia::CKademlia::ProcessPacket(&(unpack[0]), unpackedsize + 2, wxUINT32_SWAP_ALWAYS(ip), port, (Kademlia::CPrefs::GetUDPVerifyKey(ip) == receiverVerifyKey), Kademlia::CKadUDPKey(senderVerifyKey, theApp->GetPublicIP(false))); + } else { + AddDebugLogLineM(false, logClientKadUDP, wxT("Failed to uncompress Kademlia packet")); + } + } else { + throw wxString(wxT("Kad packet (compressed) too short")); + } + break; + + default: + AddDebugLogLineM(false, logClientUDP, wxString::Format(wxT("Unknown opcode on received packet: 0x%x"), protocol)); } - default: - AddDebugLogLineM(false, logClientUDP, wxString::Format(wxT("Unknown opcode on received packet: 0x%x"), protocol)); + } catch (const wxString& e) { + AddDebugLogLineM(false, logClientUDP, wxT("Error while parsing UDP packet: ") + e); + } catch (const CInvalidPacket& e) { + AddDebugLogLineM(false, logClientUDP, wxT("Invalid UDP packet encountered: ") + e.what()); + } catch (const CEOFException& e) { + AddDebugLogLineM(false, logClientUDP, wxT("Malformed packet encountered while parsing UDP packet: ") + e.what()); } - } catch (const wxString& e) { - AddDebugLogLineM(false, logClientUDP, wxT("Error while parsing UDP packet: ") + e); - } catch (const CInvalidPacket& e) { - AddDebugLogLineM(false, logClientUDP, wxT("Invalid UDP packet encountered: ") + e.what()); - } catch (const CEOFException& e) { - AddDebugLogLineM(false, logClientUDP, wxT("Malformed packet encountered while parsing UDP packet: ") + e.what()); } } @@ -257,7 +274,46 @@ } break; } - + case OP_DIRECTCALLBACKREQ: + { + AddDebugLogLineM( false, logClientUDP, wxT("Client UDP socket: OP_DIRECTCALLBACKREQ") ); + theStats::AddDownOverheadOther(size); + if (!theApp->clientlist->AllowCallbackRequest(host)) { + AddDebugLogLineM(false, logClientUDP, wxT("Ignored DirectCallback Request because this IP (") + Uint32toStringIP(host) + wxT(") has sent too many request within a short time")); + break; + } + // do we accept callbackrequests at all? + if (Kademlia::CKademlia::IsRunning() && Kademlia::CKademlia::IsFirewalled()) { + theApp->clientlist->AddTrackCallbackRequests(host); + CMemFile data(packet, size); + uint16_t remoteTCPPort = data.ReadUInt16(); + CMD4Hash userHash(data.ReadHash()); + uint8_t connectOptions = data.ReadUInt8(); + CUpDownClient* requester = NULL; + CClientList::SourceList clients = theApp->clientlist->GetClientsByHash(userHash); + for (CClientList::SourceList::iterator it = clients.begin(); it != clients.end(); ++it) { + if ((host == 0 || (*it)->GetIP() == host) && (remoteTCPPort == 0 || (*it)->GetUserPort() == remoteTCPPort)) { + requester = *it; + break; + } + } + if (requester == NULL) { + requester = new CUpDownClient(remoteTCPPort, host, 0, 0, NULL, true, true); + requester->SetUserHash(CMD4Hash(userHash)); + theApp->clientlist->AddClient(requester); + } + requester->SetConnectOptions(connectOptions, true, false); + requester->SetDirectUDPCallbackSupport(false); + requester->SetIP(host); + requester->SetUserPort(remoteTCPPort); + //TODO LOGREMOVE + //AddDebugLogLineM(false, logClientUDP, wxT("Accepting incoming DirectCallbackRequest from ") + requester->DbgGetClientInfo()); + requester->TryToConnect(); + } else { + AddDebugLogLineM(false, logClientUDP, wxT("Ignored DirectCallback Request because we do not accept DirectCall backs at all (") + Uint32toStringIP(host) + wxT(")")); + } + break; + } default: theStats::AddDownOverheadOther(size); } diff -ruN -d amule-2.2.0~svn20080218/src/ClientUDPSocket.h amule-2.2.2/src/ClientUDPSocket.h --- amule-2.2.0~svn20080218/src/ClientUDPSocket.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ClientUDPSocket.h 2008-03-23 12:45:12.000000000 +0000 @@ -37,7 +37,7 @@ void OnReceive(int errorCode); private: - void OnPacketReceived(const wxIPV4address& addr, byte* buffer, size_t length); + void OnPacketReceived(uint32 ip, uint16 port, byte* buffer, size_t length); void ProcessPacket(byte* packet, int16 size, int8 opcode, uint32 host, uint16 port); }; diff -ruN -d amule-2.2.0~svn20080218/src/CommentDialogLst.cpp amule-2.2.2/src/CommentDialogLst.cpp --- amule-2.2.0~svn20080218/src/CommentDialogLst.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/CommentDialogLst.cpp 2008-02-19 09:31:34.000000000 +0000 @@ -101,7 +101,7 @@ if (count == 0) { info = _("No comments"); } else { - info = CFormat( _("%s comment(s)")) % CastItoIShort(count); + info = wxString::Format(wxPLURAL("%u comment", "%u comments", count), count); } FindWindow(IDC_CMSTATUS)->SetLabel(info); diff -ruN -d amule-2.2.0~svn20080218/src/CryptoPP_Inc.h amule-2.2.2/src/CryptoPP_Inc.h --- amule-2.2.0~svn20080218/src/CryptoPP_Inc.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/CryptoPP_Inc.h 2008-07-10 13:53:46.000000000 +0000 @@ -35,6 +35,8 @@ #define CRYPTOPP_INCLUDE_PREFIX cryptopp #endif +#define noinline noinline + #define CRYPTO_HEADER(hdr) #include CRYPTO_HEADER(config.h) diff -ruN -d amule-2.2.0~svn20080218/src/DataToText.cpp amule-2.2.2/src/DataToText.cpp --- amule-2.2.0~svn20080218/src/DataToText.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/DataToText.cpp 2008-07-10 15:39:45.000000000 +0000 @@ -125,11 +125,12 @@ switch ((ESourceFrom)source_from) { case SF_LOCAL_SERVER: return wxTRANSLATE("Local Server"); case SF_REMOTE_SERVER: return wxTRANSLATE("Remote Server"); - case SF_KADEMLIA: return wxTRANSLATE("Kad"); + case SF_KADEMLIA: return wxTRANSLATE("Kad"); case SF_SOURCE_EXCHANGE: return wxTRANSLATE("Source Exchange"); - case SF_PASSIVE: return wxTRANSLATE("Passive"); - case SF_LINK: return wxTRANSLATE("Link"); + case SF_PASSIVE: return wxTRANSLATE("Passive"); + case SF_LINK: return wxTRANSLATE("Link"); case SF_SOURCE_SEEDS: return wxTRANSLATE("Source Seeds"); + case SF_SEARCH_RESULT: return wxTRANSLATE("Search Result"); case SF_NONE: default: return wxTRANSLATE("Unknown"); } diff -ruN -d amule-2.2.0~svn20080218/src/DownloadClient.cpp amule-2.2.2/src/DownloadClient.cpp --- amule-2.2.0~svn20080218/src/DownloadClient.cpp 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/DownloadClient.cpp 2008-07-21 08:30:20.000000000 +0000 @@ -344,7 +344,7 @@ throw wxString(wxT("ERROR: Wrong file ID (ProcessFileInfo; m_reqfile!=file)")); } - m_clientFilename = data->ReadString(GetUnicodeSupport()); + m_clientFilename = data->ReadString((GetUnicodeSupport() != utf8strNone)); // 26-Jul-2003: removed requesting the file status for files <= PARTSIZE for better compatibility with ed2k protocol (eDonkeyHybrid). // if the remote client answers the OP_REQUESTFILENAME with OP_REQFILENAMEANSWER the file is shared by the remote client. if we @@ -507,7 +507,7 @@ bool CUpDownClient::DeleteFileRequest(CPartFile* file) { - return m_A4AF_list.erase( file ); + return (m_A4AF_list.erase( file ) > 0); } void CUpDownClient::DeleteAllFileRequests() @@ -931,12 +931,17 @@ // Handle differently depending on whether packed or not if (!packed) { + // security sanitize check + if (nEndPos > cur_block->block->EndOffset) { + AddDebugLogLineM(false, logRemoteClient, CFormat(wxT("Received Blockpacket exceeds requested boundaries (requested end: %u, Part: %u, received end: %u, Part: %u), file: %s remote IP: %s")) % cur_block->block->EndOffset % (uint32)(cur_block->block->EndOffset / PARTSIZE) % nEndPos % (uint32)(nEndPos / PARTSIZE) % m_reqfile->GetFileName() % Uint32toStringIP(GetIP())); + m_reqfile->RemoveBlockFromList(cur_block->block->StartOffset, cur_block->block->EndOffset); + return; + } // Write to disk (will be buffered in part file class) - lenWritten = m_reqfile->WriteToBuffer( size - header_size, + lenWritten = m_reqfile->WriteToBuffer( size - header_size, (byte*)(packet + header_size), - nStartPos, - nEndPos, - cur_block->block ); + nStartPos, nEndPos, + cur_block->block); } else { // Packed wxASSERT( (long int)size > 0 ); diff -ruN -d amule-2.2.0~svn20080218/src/DownloadListCtrl.cpp amule-2.2.2/src/DownloadListCtrl.cpp --- amule-2.2.0~svn20080218/src/DownloadListCtrl.cpp 2008-02-17 11:43:53.000000000 +0000 +++ amule-2.2.2/src/DownloadListCtrl.cpp 2008-07-13 16:41:23.000000000 +0000 @@ -231,6 +231,7 @@ // Check if the new file is visible in the current category if ( file->CheckShowItemInGivenCat( m_category ) ) { ShowFile( file, true ); + SortList(); } } } @@ -479,6 +480,8 @@ for ( it = a4afSources.begin(); it != a4afSources.end(); ++it ) { AddSource( file, *it, A4AF_SOURCE ); } + + SortList(); } else { for ( int i = GetItemCount() - 1; i >= 0; --i ) { CtrlItem_Struct* item = (CtrlItem_Struct*)GetItemData(i); @@ -573,8 +576,12 @@ { ItemList files = ::GetSelectedItems(this, itFILES); if (files.size()) { - wxString question = - _("Are you sure that you wish to delete the selected file(s)?"); + wxString question; + if (files.size() == 1) { + question = _("Are you sure that you wish to delete the selected file?"); + } else { + question = _("Are you sure that you wish to delete the selected files?"); + } if (wxMessageBox( question, _("Cancel"), wxICON_QUESTION | wxYES_NO, this) == wxYES) { for (ItemList::iterator it = files.begin(); it != files.end(); ++it) { CPartFile* file = (*it)->GetFile(); @@ -718,10 +725,16 @@ { wxString feed; ItemList files = ::GetSelectedItems(this, itFILES); + for (ItemList::iterator it = files.begin(); it != files.end(); ++it) { - CPartFile* file = (*it)->GetFile(); - feed += file->GetFeedback(); + if (feed.IsEmpty()) { + feed = CFormat(_("Feedback from: %s (%s)\n\n")) % thePrefs::GetUserNick() % GetFullMuleVersion(); + } else { + feed += wxT("\n"); + } + feed += (*it)->GetFile()->GetFeedback(); } + if (!feed.IsEmpty()) { theApp->CopyTextToClipboard(feed); } @@ -930,7 +943,7 @@ m_menu->Append(MP_GETMAGNETLINK, _("Copy magnet URI to clipboard")); m_menu->Append(MP_GETED2KLINK, - _("Copy ED2k &link to clipboard")); + _("Copy eD2k &link to clipboard")); m_menu->Append(MP_WS, _("Copy feedback to clipboard")); //----------------------------------------------------- @@ -953,26 +966,35 @@ CPartFile* file = item->GetFile(); // then set state - bool fileReady = - (file->GetStatus() != PS_PAUSED) && - (file->GetStatus() != PS_ERROR); - bool fileReady2 = - (file->GetStatus() != PS_ERROR) && - (file->GetStatus() != PS_COMPLETE); - bool fileResumable = - (file->GetStatus() == PS_PAUSED) || - (file->GetStatus() == PS_ERROR) || - (file->GetStatus() == PS_INSUFFICIENT); - + bool canStop; + bool canPause; + bool canCancel; + bool fileResumable; + if (file->GetStatus(true) != PS_ALLOCATING) { + const uint8_t fileStatus = file->GetStatus(); + canStop = + (fileStatus != PS_ERROR) && + (fileStatus != PS_COMPLETE) && + (file->IsStopped() != true); + canPause = (file->GetStatus() != PS_PAUSED) && canStop; + fileResumable = + (fileStatus == PS_PAUSED) || + (fileStatus == PS_ERROR) || + (fileStatus == PS_INSUFFICIENT); + canCancel = fileStatus != PS_COMPLETE; + } else { + canStop = canPause = canCancel = fileResumable = false; + } + wxMenu* menu = m_menu; - menu->Enable( MP_CANCEL, ( file->GetStatus() != PS_COMPLETE ) ); - menu->Enable( MP_PAUSE, fileReady && fileReady2 ); - menu->Enable( MP_STOP, fileReady && fileReady2 ); + menu->Enable( MP_CANCEL, canCancel ); + menu->Enable( MP_PAUSE, canPause ); + menu->Enable( MP_STOP, canStop ); menu->Enable( MP_RESUME, fileResumable ); menu->Enable( MP_CLEARCOMPLETED, m_completedFiles ); wxString view; - if (file->IsPartFile() && !(file->GetStatus() == PS_COMPLETE)) { + if (file->IsPartFile() && (file->GetStatus() != PS_COMPLETE)) { view << CFormat(wxT("%s [%s]")) % _("Preview") % file->GetPartMetFileName().RemoveExt(); } else if ( file->GetStatus() == PS_COMPLETE ) { @@ -981,9 +1003,7 @@ menu->SetLabel(MP_VIEW, view); menu->Enable(MP_VIEW, file->PreviewAvailable() ); - menu->Enable( MP_SWAP_A4AF_TO_THIS_AUTO, fileReady ); menu->Check( MP_SWAP_A4AF_TO_THIS_AUTO, file->IsA4AFAuto() ); - menu->Enable( MP_SWAP_A4AF_TO_ANY_OTHER, fileReady ); int priority = file->IsAutoDownPriority() ? PR_AUTO : file->GetDownPriority(); @@ -993,8 +1013,7 @@ priomenu->Check( MP_PRIOLOW, priority == PR_LOW ); priomenu->Check( MP_PRIOAUTO, priority == PR_AUTO ); - menu->Enable( MP_MENU_PRIO, fileReady2 ); - menu->Enable( MP_MENU_EXTD, fileReady2 ); + menu->Enable( MP_MENU_EXTD, canPause ); PopupMenu(m_menu, evt.GetPoint()); @@ -1011,7 +1030,7 @@ // Only enable the Swap option for A4AF sources m_menu->Enable(MP_CHANGE2FILE, (item->GetType() == A4AF_SOURCE)); // We need a valid IP if we are to message the client - m_menu->Enable(MP_SENDMESSAGE, client->GetIP()); + m_menu->Enable(MP_SENDMESSAGE, (client->GetIP() != 0)); m_menu->Enable(MP_SHOWLIST, !client->HasDisabledSharedFiles()); @@ -1152,7 +1171,7 @@ wxListItem listitem; GetColumn(i, listitem); - if ( listitem.GetWidth() > 0 ) { + if (listitem.GetWidth() > 2*iOffset) { cur_rec.width = listitem.GetWidth() - 2*iOffset; // Make a copy of the current rectangle so we can apply specific tweaks @@ -1177,10 +1196,10 @@ } else { DrawSourceItem(dc, i, target_rec, content); } - - // Increment to the next column - cur_rec.x += listitem.GetWidth(); } + + // Increment to the next column + cur_rec.x += listitem.GetWidth(); } // Draw tree last so it draws over selected and focus (looks better) @@ -1233,8 +1252,7 @@ void CDownloadListCtrl::DrawFileItem( wxDC* dc, int nColumn, const wxRect& rect, CtrlItem_Struct* item ) const { - // force clipper (clip 2 px more than the rectangle from the right side) - wxDCClipper clipper( *dc, rect.GetX(), rect.GetY(), rect.GetWidth() - 2, rect.GetHeight() ); + wxDCClipper clipper( *dc, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight() ); const CPartFile* file = item->GetFile(); @@ -1443,8 +1461,7 @@ void CDownloadListCtrl::DrawSourceItem( wxDC* dc, int nColumn, const wxRect& rect, CtrlItem_Struct* item ) const { - // Force clipper (clip 2 px more than the rectangle from the right side) - wxDCClipper clipper( *dc, rect.GetX(), rect.GetY(), rect.GetWidth() - 2, rect.GetHeight() ); + wxDCClipper clipper( *dc, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight() ); wxString buffer; const CUpDownClient* client = item->GetSource(); @@ -2066,7 +2083,6 @@ s_ChunkBar.SetHeight(rect.height); s_ChunkBar.SetWidth(rect.width); s_ChunkBar.SetFileSize( file->GetFileSize() ); - s_ChunkBar.Fill( crHave ); s_ChunkBar.Set3dDepth( thePrefs::Get3DDepth() ); @@ -2080,11 +2096,17 @@ // Part availability ( of missing parts ) const CPartFile::CGapPtrList& gaplist = file->GetGapList(); CPartFile::CGapPtrList::const_iterator it = gaplist.begin(); + uint64 lastGapEnd = 0; for (; it != gaplist.end(); ++it) { Gap_Struct* gap = *it; // Start position uint32 start = ( gap->start / PARTSIZE ); + // fill the Have-Part (between this gap and the last) + if (gap->start) { + s_ChunkBar.FillRange(lastGapEnd + 1, gap->start - 1, crHave); + } + lastGapEnd = gap->end; // End position uint32 end = ( gap->end / PARTSIZE ) + 1; @@ -2108,21 +2130,35 @@ } uint64 gap_begin = ( i == start ? gap->start : PARTSIZE * i ); - uint64 gap_end = ( i == end - 1 ? gap->end : PARTSIZE * ( i + 1 ) ); + uint64 gap_end = ( i == end - 1 ? gap->end : PARTSIZE * ( i + 1 ) - 1 ); s_ChunkBar.FillRange( gap_begin, gap_end, color); } } + // fill the last Have-Part (between this gap and the last) + s_ChunkBar.FillRange(lastGapEnd + 1, file->GetFileSize() - 1, crHave); // Pending parts const CPartFile::CReqBlockPtrList& requestedblocks_list = file->GetRequestedBlockList(); CPartFile::CReqBlockPtrList::const_iterator it2 = requestedblocks_list.begin(); + // adjacing pending parts must be joined to avoid bright lines between them + uint64 lastStartOffset = 0; + uint64 lastEndOffset = 0; + COLORREF color = file->IsStopped() ? DarkenColour( crPending, 2 ) : crPending; for (; it2 != requestedblocks_list.end(); ++it2) { - COLORREF color = ( file->IsStopped() ? DarkenColour( crPending, 2 ) : crPending ); - s_ChunkBar.FillRange( (*it2)->StartOffset, (*it2)->EndOffset, color ); + if ((*it2)->StartOffset > lastEndOffset + 1) { + // not adjacing, draw last block + s_ChunkBar.FillRange(lastStartOffset, lastEndOffset, color); + lastStartOffset = (*it2)->StartOffset; + lastEndOffset = (*it2)->EndOffset; + } else { + // adjacing, grow block + lastEndOffset = (*it2)->EndOffset; + } } + s_ChunkBar.FillRange(lastStartOffset, lastEndOffset, color); // Draw the progress-bar @@ -2155,9 +2191,9 @@ { static CBarShader s_StatusBar(16); - uint32 crBoth = ( bFlat ? RGB( 0, 150, 0 ) : RGB( 0, 192, 0 ) ); + uint32 crBoth = ( bFlat ? RGB( 0, 150, 0 ) : RGB( 0, 192, 0 ) ); uint32 crNeither = ( bFlat ? RGB( 224, 224, 224 ) : RGB( 240, 240, 240 ) ); - uint32 crClientOnly = ( bFlat ? RGB( 0, 0, 0 ) : RGB( 104, 104, 104 ) ); + uint32 crClientOnly = ( bFlat ? RGB( 0, 0, 0 ) : RGB( 104, 104, 104 ) ); uint32 crPending = ( bFlat ? RGB( 255, 208, 0 ) : RGB( 255, 208, 0 ) ); uint32 crNextPending = ( bFlat ? RGB( 255, 255, 100 ) : RGB( 255, 255, 100 ) ); @@ -2166,7 +2202,6 @@ s_StatusBar.SetFileSize( reqfile->GetFileSize() ); s_StatusBar.SetHeight(rect.height); s_StatusBar.SetWidth(rect.width); - s_StatusBar.Fill(crNeither); s_StatusBar.Set3dDepth( thePrefs::Get3DDepth() ); // Barry - was only showing one part from client, even when reserved bits from 2 parts @@ -2174,39 +2209,43 @@ const BitVector& partStatus = source->GetPartStatus(); + uint64 uEnd = 0; for ( uint64 i = 0; i < partStatus.size(); i++ ) { - if ( partStatus[i]) { - uint64 uEnd; - if (PARTSIZE*(i+1u) > reqfile->GetFileSize()) { - uEnd = reqfile->GetFileSize(); - } else { - uEnd = PARTSIZE*(i+1u); - } - - uint32 color = 0; - if ( reqfile->IsComplete(PARTSIZE*i,PARTSIZE*(i+1)-1)) { - color = crBoth; - } else if ( source->GetDownloadState() == DS_DOWNLOADING && - source->GetLastBlockOffset() < uEnd && - source->GetLastBlockOffset() >= PARTSIZE*i) { - color = crPending; - } else if (gettingParts.GetChar((uint16)i) == 'Y') { - color = crNextPending; - } else { - color = crClientOnly; - } + uint64 uStart = PARTSIZE * i; + uEnd = wxMin(reqfile->GetFileSize(), uStart + PARTSIZE) - 1; - if ( source->GetRequestFile()->IsStopped() ) { - color = DarkenColour( color, 2 ); - } + uint32 color = 0; + if (!partStatus[i]) { + color = crNeither; + } else if ( reqfile->IsComplete(uStart, uEnd)) { + color = crBoth; + } else if ( source->GetDownloadState() == DS_DOWNLOADING && + source->GetLastBlockOffset() <= uEnd && + source->GetLastBlockOffset() >= uStart) { + color = crPending; + } else if (gettingParts.GetChar((uint16)i) == 'Y') { + color = crNextPending; + } else { + color = crClientOnly; + } - s_StatusBar.FillRange( PARTSIZE*i, uEnd, color ); + if ( source->GetRequestFile()->IsStopped() ) { + color = DarkenColour( color, 2 ); } + + s_StatusBar.FillRange(uStart, uEnd, color); } + // fill the rest (if partStatus is empty) + s_StatusBar.FillRange(uEnd + 1, reqfile->GetFileSize() - 1, crNeither); s_StatusBar.Draw(dc, rect.x, rect.y, bFlat); } +#ifdef __WXMSW__ +# define QUOTE wxT("\"") +#else +# define QUOTE wxT("\'") +#endif void CDownloadListCtrl::PreviewFile(CPartFile* file) { @@ -2215,12 +2254,11 @@ // And please, do a warning also :P if (thePrefs::GetVideoPlayer().IsEmpty()) { wxMessageBox(_( - "Please set your prefered video player on preferences.\n" - "Meanwhile, aMule will attempt to use mplayer and you will get this warning on every preview"), + "To prevent this warning to show up in every preview,\nset your preferred video player in preferences (default is mplayer)."), _("File preview"), wxOK, this); // Since newer versions for some reason mplayer does not automatically - // select video output decivce and needs a parameter, go figure... - command = wxT("xterm -T \"aMule Preview\" -iconic -e mplayer '$file'"); + // select video output device and needs a parameter, go figure... + command = wxT("xterm -T \"aMule Preview\" -iconic -e mplayer ") QUOTE wxT("$file") QUOTE; } else { command = thePrefs::GetVideoPlayer(); } @@ -2233,7 +2271,7 @@ if (!command.Replace(wxT("$file"), fileWithoutMet)) { // No magic string, so we just append the filename to the player command // Need to use quotes in case filename contains spaces - command << wxT(" '") << fileWithoutMet << wxT("'"); + command << wxT(" ") << QUOTE << fileWithoutMet << QUOTE; } } else { // This is a complete file @@ -2242,7 +2280,7 @@ if (!command.Replace(wxT("$file"), rawFileName)) { // No magic string, so we just append the filename to the player command // Need to use quotes in case filename contains spaces - command << wxT(" '") << rawFileName << wxT("'"); + command << wxT(" ") << QUOTE << rawFileName << QUOTE; } } diff -ruN -d amule-2.2.0~svn20080218/src/DownloadQueue.cpp amule-2.2.2/src/DownloadQueue.cpp --- amule-2.2.0~svn20080218/src/DownloadQueue.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/DownloadQueue.cpp 2008-07-28 15:41:53.000000000 +0000 @@ -58,6 +58,7 @@ #include "UserEvents.h" #include "MagnetURI.h" // Needed for CMagnetED2KConverter #include "ScopedPtr.h" // Needed for CScopedPtr +#include "PlatformSpecific.h" // Needed for CanFSHandleLargeFiles #include "kademlia/kademlia/Kademlia.h" @@ -128,27 +129,21 @@ // Load part-files for ( size_t i = 0; i < files.size(); i++ ) { printf("\rLoading PartFile %u of %u", (unsigned int)(i + 1), (unsigned int)files.size()); - fileName = files[i].GetFullName(); - - CPartFile* toadd = new CPartFile(); - bool result = toadd->LoadPartFile(path, fileName); + CPartFile *toadd = new CPartFile(); + bool result = toadd->LoadPartFile(path, fileName) != 0; if (!result) { // Try from backup - result = toadd->LoadPartFile(path, fileName, true); + result = toadd->LoadPartFile(path, fileName, true) != 0; } - if (result && !IsFileExisting(toadd->GetFileHash())) { { wxMutexLocker lock(m_mutex); m_filelist.push_back(toadd); } - - NotifyObservers( EventType( EventType::INSERTED, toadd ) ); + NotifyObservers(EventType(EventType::INSERTED, toadd)); Notify_DownloadCtrlAddFile(toadd); } else { - delete toadd; - wxString msg; if (result) { msg << CFormat(wxT("WARNING: Duplicate partfile with hash '%s' found, skipping: %s")) @@ -156,24 +151,25 @@ } else { // If result is false, then reading of both the primary and the backup .met failed AddLogLineM(false, - _("Error: Failed to load backup file. Search http://forum.amule.org for .part.met recovery solutions.")); + _("ERROR: Failed to load backup file. Search http://forum.amule.org for .part.met recovery solutions.")); msg << CFormat(wxT("ERROR: Failed to load PartFile '%s'")) % fileName; } - AddDebugLogLineM(true, logPartFile, msg); // Newline so that the error stays visible. printf(": %s\n", (const char*)unicode2char(msg)); + + // Delete the partfile object in the end. + delete toadd; } } - printf("\nAll PartFiles Loaded.\n"); if ( GetFileCount() == 0 ) { AddLogLineM(false, _("No part files found")); } else { - AddLogLineM(false, wxString::Format(_("Found %u part files"), GetFileCount()) ); - + AddLogLineM(false, wxString::Format(wxPLURAL("Found %u part file", "Found %u part files", GetFileCount()), GetFileCount()) ); + DoSortByPriority(); CheckDiskspace( path ); } @@ -219,23 +215,49 @@ } } -//#warning We must add the sources, review CSearchFile constructor. + void CDownloadQueue::AddSearchToDownload(CSearchFile* toadd, uint8 category) { if ( IsFileExisting(toadd->GetFileHash()) ) { return; } - + if (toadd->GetFileSize() > OLD_MAX_FILE_SIZE) { + if (!PlatformSpecific::CanFSHandleLargeFiles(thePrefs::GetTempDir())) { + AddLogLineM(true, _("Filesystem for Temp directory cannot handle large files.")); + return; + } else if (!PlatformSpecific::CanFSHandleLargeFiles(theApp->glob_prefs->GetCatPath(category))) { + AddLogLineM(true, _("Filesystem for Incoming directory cannot handle large files.")); + return; + } + } + CPartFile* newfile = NULL; try { newfile = new CPartFile(toadd); - } catch (const CInvalidPacket& e) { + } catch (const CInvalidPacket& WXUNUSED(e)) { AddDebugLogLineM(true, logDownloadQueue, wxT("Search-result contained invalid tags, could not add")); } if ( newfile && newfile->GetStatus() != PS_ERROR ) { AddDownload( newfile, thePrefs::AddNewFilesPaused(), category ); + // Add any possible sources + if (toadd->GetClientID() && toadd->GetClientPort()) { + CMemFile sources(1+4+2); + sources.WriteUInt8(1); + sources.WriteUInt32(toadd->GetClientID()); + sources.WriteUInt16(toadd->GetClientPort()); + sources.Reset(); + newfile->AddSources(sources, toadd->GetClientServerIP(), toadd->GetClientServerPort(), SF_SEARCH_RESULT, false); + } + for (std::list::const_iterator it = toadd->GetClients().begin(); it != toadd->GetClients().end(); ++it) { + CMemFile sources(1+4+2); + sources.WriteUInt8(1); + sources.WriteUInt32(it->m_ip); + sources.WriteUInt16(it->m_port); + sources.Reset(); + newfile->AddSources(sources, it->m_serverIP, it->m_serverPort, SF_SEARCH_RESULT, false); + } } else { delete newfile; } @@ -297,8 +319,10 @@ void CDownloadQueue::AddDownload(CPartFile* file, bool paused, uint8 category) { wxCHECK_RET(!IsFileExisting(file->GetFileHash()), wxT("Adding duplicate part-file")); - - if ( paused && GetFileCount() ) { + + if (file->GetStatus(true) == PS_ALLOCATING) { + file->PauseFile(); + } else if (paused && GetFileCount()) { file->StopFile(); } @@ -1294,7 +1318,7 @@ if (link.compare(0, 7, wxT("magnet:")) == 0) { uri = CMagnetED2KConverter(link); if (uri.empty()) { - AddLogLineM(true, CFormat(_("Cannot convert magnet link to ed2k: %s")) % link); + AddLogLineM(true, CFormat(_("Cannot convert magnet link to eD2k: %s")) % link); return false; } } @@ -1323,7 +1347,7 @@ return AddED2KLink( uri.get(), category ); } catch ( const wxString& err ) { - AddLogLineM( true, CFormat( _("Invalid ed2k link! Error: %s")) % err); + AddLogLineM( true, CFormat( _("Invalid eD2k link! ERROR: %s")) % err); } return false; @@ -1358,6 +1382,16 @@ return false; } } else { + if (link->GetSize() > OLD_MAX_FILE_SIZE) { + if (!PlatformSpecific::CanFSHandleLargeFiles(thePrefs::GetTempDir())) { + AddLogLineM(true, _("Filesystem for Temp directory cannot handle large files.")); + return false; + } else if (!PlatformSpecific::CanFSHandleLargeFiles(theApp->glob_prefs->GetCatPath(category))) { + AddLogLineM(true, _("Filesystem for Incoming directory cannot handle large files.")); + return false; + } + } + file = new CPartFile(link); if (file->GetStatus() == PS_ERROR) { @@ -1424,42 +1458,41 @@ NotifyObservers( EventType( EventType::INITIAL, &list ), o ); } -void CDownloadQueue::KademliaSearchFile(uint32 searchID, const Kademlia::CUInt128* pcontactID, const Kademlia::CUInt128* pbuddyID, uint8 type, uint32 ip, uint16 tcp, uint16 udp, uint32 serverip, uint16 serverport, uint8 byCryptOptions) +void CDownloadQueue::KademliaSearchFile(uint32_t searchID, const Kademlia::CUInt128* pcontactID, const Kademlia::CUInt128* pbuddyID, uint8_t type, uint32_t ip, uint16_t tcp, uint16_t udp, uint32_t buddyip, uint16_t buddyport, uint8_t byCryptOptions) { - AddDebugLogLineM(false, logKadSearch, wxString::Format(wxT("Search result sources (type %i)"),type)); - + //Safety measure to make sure we are looking for these sources CPartFile* temp = GetFileByKadFileSearchID(searchID); if( !temp ) { AddDebugLogLineM(false, logKadSearch, wxT("This is not the file we're looking for...")); return; } - + //Do we need more sources? if(!(!temp->IsStopped() && thePrefs::GetMaxSourcePerFile() > temp->GetSourceCount())) { AddDebugLogLineM(false, logKadSearch, wxT("No more sources needed for this file")); return; } - uint32 ED2KID = wxUINT32_SWAP_ALWAYS(ip); - + uint32_t ED2KID = wxUINT32_SWAP_ALWAYS(ip); + if (theApp->ipfilter->IsFiltered(ED2KID)) { AddDebugLogLineM(false, logKadSearch, wxT("Source ip got filtered")); AddDebugLogLineM(false, logIPFilter, CFormat(wxT("IPfiltered source IP=%s received from Kademlia")) % Uint32toStringIP(ED2KID)); return; } - + if( (ip == Kademlia::CKademlia::GetIPAddress() || ED2KID == theApp->GetED2KID()) && tcp == thePrefs::GetPort()) { AddDebugLogLineM(false, logKadSearch, wxT("Trying to add myself as source, ignore")); return; } - + CUpDownClient* ctemp = NULL; - switch( type ) { + switch (type) { case 4: case 1: { - //NonFirewalled users + // NonFirewalled users if(!tcp) { AddDebugLogLineM(false, logKadSearch, CFormat(wxT("Ignored source (IP=%s) received from Kademlia, no tcp port received")) % Uint32toStringIP(ip)); return; @@ -1469,10 +1502,11 @@ AddDebugLogLineM(false, logIPFilter, CFormat(wxT("Ignored source (IP=%s) received from Kademlia, filtered")) % Uint32toStringIP(ED2KID)); return; } - ctemp = new CUpDownClient(tcp,ip,0,0,temp,false, true); + ctemp = new CUpDownClient(tcp, ip, 0, 0, temp, false, true); ctemp->SetSourceFrom(SF_KADEMLIA); - ctemp->SetServerIP(serverip); - ctemp->SetServerPort(serverport); + // not actually sent or needed for HighID sources + //ctemp->SetServerIP(serverip); + //ctemp->SetServerPort(serverport); ctemp->SetKadPort(udp); byte cID[16]; pcontactID->ToByteArray(cID); @@ -1480,16 +1514,16 @@ break; } case 2: { - //Don't use this type... Some clients will process it wrong.. + // Don't use this type... Some clients will process it wrong.. break; } case 5: case 3: { - //This will be a firewaled client connected to Kad only. - //We set the clientID to 1 as a Kad user only has 1 buddy. - ctemp = new CUpDownClient(tcp,1,0,0,temp,false, true); - //The only reason we set the real IP is for when we get a callback - //from this firewalled source, the compare method will match them. + // This will be a firewalled client connected to Kad only. + // We set the clientID to 1 as a Kad user only has 1 buddy. + ctemp = new CUpDownClient(tcp, 1, 0, 0, temp, false, true); + // The only reason we set the real IP is for when we get a callback + // from this firewalled source, the compare method will match them. ctemp->SetSourceFrom(SF_KADEMLIA); ctemp->SetKadPort(udp); byte cID[16]; @@ -1497,36 +1531,52 @@ ctemp->SetUserHash(CMD4Hash(cID)); pbuddyID->ToByteArray(cID); ctemp->SetBuddyID(cID); - ctemp->SetBuddyIP(serverip); - ctemp->SetBuddyPort(serverport); + ctemp->SetBuddyIP(buddyip); + ctemp->SetBuddyPort(buddyport); break; } + case 6: { + // firewalled source which supports direct UDP callback + // if we are firewalled ourself, the source is useless to us + if (theApp->IsFirewalled()) { + break; + } + + if ((byCryptOptions & 0x08) == 0){ + AddDebugLogLineM(false, logKadSearch, CFormat(wxT("Received Kad source type 6 (direct callback) which has the direct callback flag not set (%s)")) % Uint32toStringIP(ED2KID)); + break; + } + + ctemp = new CUpDownClient(tcp, 1, 0, 0, temp, false, true); + ctemp->SetSourceFrom(SF_KADEMLIA); + ctemp->SetKadPort(udp); + ctemp->SetIP(ED2KID); // need to set the IP address, which cannot be used for TCP but for UDP + byte cID[16]; + pcontactID->ToByteArray(cID); + ctemp->SetUserHash(CMD4Hash(cID)); + } } if (ctemp) { // add encryption settings - ctemp->SetCryptLayerSupport((byCryptOptions & 0x01) != 0); - ctemp->SetCryptLayerRequest((byCryptOptions & 0x02) != 0); - ctemp->SetCryptLayerRequires((byCryptOptions & 0x04) != 0); + ctemp->SetConnectOptions(byCryptOptions); - AddDebugLogLineM(false, logKadSearch, CFormat(wxT("Happily adding a source (%s) type %d")) % Uint32_16toStringIP_Port(ip, ctemp->GetUserPort()) % type); + AddDebugLogLineM(false, logKadSearch, CFormat(wxT("Happily adding a source (%s) type %d")) % Uint32_16toStringIP_Port(ED2KID, ctemp->GetUserPort()) % type); CheckAndAddSource(temp, ctemp); } } CPartFile* CDownloadQueue::GetFileByKadFileSearchID(uint32 id) const { - wxMutexLocker lock( m_mutex ); - + for ( uint16 i = 0; i < m_filelist.size(); ++i ) { if ( id == m_filelist[i]->GetKadFileSearchID()) { return m_filelist[ i ]; } } - + return NULL; - } bool CDownloadQueue::DoKademliaFileRequest() diff -ruN -d amule-2.2.0~svn20080218/src/DownloadQueue.h amule-2.2.2/src/DownloadQueue.h --- amule-2.2.0~svn20080218/src/DownloadQueue.h 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/DownloadQueue.h 2008-07-28 15:41:53.000000000 +0000 @@ -295,7 +295,7 @@ /** * Add a Kad source to a download */ - void KademliaSearchFile(uint32 searchID, const Kademlia::CUInt128* pcontactID, const Kademlia::CUInt128* pkadID, uint8 type, uint32 ip, uint16 tcp, uint16 udp, uint32 serverip, uint16 serverport, uint8 byCryptOptions); + void KademliaSearchFile(uint32_t searchID, const Kademlia::CUInt128* pcontactID, const Kademlia::CUInt128* pkadID, uint8_t type, uint32_t ip, uint16_t tcp, uint16_t udp, uint32_t buddyip, uint16_t buddyport, uint8_t byCryptOptions); CPartFile* GetFileByKadFileSearchID(uint32 id) const; diff -ruN -d amule-2.2.0~svn20080218/src/ECSpecialCoreTags.cpp amule-2.2.2/src/ECSpecialCoreTags.cpp --- amule-2.2.0~svn20080218/src/ECSpecialCoreTags.cpp 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/ECSpecialCoreTags.cpp 2008-04-04 14:13:04.000000000 +0000 @@ -74,7 +74,7 @@ if ((tmpShort = (uint8)server->GetFailedCount()) != 0) { AddTag(CECTag(EC_TAG_SERVER_FAILED, tmpShort)); } - if ((tmpShort = (uint8)server->IsStaticMember()) != 0) { + if ((tmpShort = (server->IsStaticMember() ? 1 : 0)) != 0) { AddTag(CECTag(EC_TAG_SERVER_STATIC, tmpShort)); } if (!(tmpStr = server->GetVersion()).IsEmpty()) { @@ -118,6 +118,8 @@ } AddTag(CECTag(EC_TAG_ED2K_ID, theApp->GetED2KID())); } + + AddTag(CECTag(EC_TAG_CLIENT_ID, theApp->GetID())); } CEC_PartFile_Tag::CEC_PartFile_Tag(CPartFile *file, CValueMap &valuemap) @@ -255,6 +257,7 @@ valuemap.CreateTag(EC_TAG_KNOWNFILE_ACCEPT_COUNT_ALL, file->statistic.GetAllTimeAccepts(), this); valuemap.CreateTag(EC_TAG_KNOWNFILE_XFERRED, file->statistic.GetTransferred(), this); valuemap.CreateTag(EC_TAG_KNOWNFILE_XFERRED_ALL, file->statistic.GetAllTimeTransferred(), this); + valuemap.CreateTag(EC_TAG_KNOWNFILE_AICH_MASTERHASH, file->GetAICHMasterHash(), this); valuemap.CreateTag(EC_TAG_PARTFILE_PRIO, (uint64)(file->IsAutoUpPriority() ? file->GetUpPriority() + 10 : file->GetUpPriority()), this); @@ -275,6 +278,7 @@ AddTag(CECTag(EC_TAG_KNOWNFILE_XFERRED, file->statistic.GetTransferred())); AddTag(CECTag(EC_TAG_KNOWNFILE_XFERRED_ALL, file->statistic.GetAllTimeTransferred())); + AddTag(CECTag(EC_TAG_KNOWNFILE_AICH_MASTERHASH, file->GetAICHMasterHash())); AddTag(CECTag(EC_TAG_PARTFILE_PRIO, (uint8)(file->IsAutoUpPriority() ? file->GetUpPriority() + 10 : file->GetUpPriority()))); diff -ruN -d amule-2.2.0~svn20080218/src/ECSpecialMuleTags.cpp amule-2.2.2/src/ECSpecialMuleTags.cpp --- amule-2.2.0~svn20080218/src/ECSpecialMuleTags.cpp 2008-02-12 19:28:43.000000000 +0000 +++ amule-2.2.2/src/ECSpecialMuleTags.cpp 2008-07-10 17:08:40.000000000 +0000 @@ -84,7 +84,8 @@ if (selection & EC_PREFS_GENERAL) { CECEmptyTag user_prefs(EC_TAG_PREFS_GENERAL); user_prefs.AddTag(CECTag(EC_TAG_USER_NICK, thePrefs::GetUserNick())); - user_prefs.AddTag(CECTag(EC_TAG_USER_USERHASH, thePrefs::GetUserHash())); + user_prefs.AddTag(CECTag(EC_TAG_USER_HASH, thePrefs::GetUserHash())); + user_prefs.AddTag(CECTag(EC_TAG_USER_HOST, thePrefs::GetYourHostname())); AddTag(user_prefs); } @@ -205,6 +206,7 @@ if (thePrefs::IsManualHighPrio()) { srv_prefs.AddTag(CECEmptyTag(EC_TAG_SERVERS_MANUAL_HIGH_PRIO)); } + srv_prefs.AddTag(CECTag(EC_TAG_SERVERS_UPDATE_URL, thePrefs::GetEd2kServersUrl())); AddTag(srv_prefs); } @@ -243,16 +245,13 @@ if (thePrefs::GetExtractMetaData()) { filePrefs.AddTag(CECEmptyTag(EC_TAG_FILES_EXTRACT_METADATA)); } - if (thePrefs::GetAllocFullChunk()) { - filePrefs.AddTag(CECEmptyTag(EC_TAG_FILES_ALLOC_FULL_CHUNKS)); - } - if (thePrefs::GetAllocFullPart()) { + if (thePrefs::GetAllocFullFile()) { filePrefs.AddTag(CECEmptyTag(EC_TAG_FILES_ALLOC_FULL_SIZE)); } if (thePrefs::IsCheckDiskspaceEnabled()) { filePrefs.AddTag(CECEmptyTag(EC_TAG_FILES_CHECK_FREE_SPACE)); } - filePrefs.AddTag(CECTag(EC_TAG_FILES_MIN_FREE_SPACE, thePrefs::GetMinFreeDiskSpace())); + filePrefs.AddTag(CECTag(EC_TAG_FILES_MIN_FREE_SPACE, thePrefs::GetMinFreeDiskSpaceMB())); AddTag(filePrefs); } @@ -298,6 +297,17 @@ if (thePrefs::IsSecureIdentEnabled()) { secPrefs.AddTag(CECEmptyTag(EC_TAG_SECURITY_USE_SECIDENT)); } + + if (thePrefs::IsClientCryptLayerSupported()) { + secPrefs.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_SUPPORTED)); + } + if (thePrefs::IsClientCryptLayerRequested()) { + secPrefs.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_REQUESTED)); + } + if (thePrefs::IsClientCryptLayerRequired()) { + secPrefs.AddTag(CECEmptyTag(EC_TAG_SECURITY_OBFUSCATION_REQUIRED)); + } + AddTag(secPrefs); } @@ -312,6 +322,12 @@ cwPrefs.AddTag(CECTag(EC_TAG_CORETW_SRV_KEEPALIVE_TIMEOUT, thePrefs::GetServerKeepAliveTimeout())); AddTag(cwPrefs); } + + if (selection & EC_PREFS_KADEMLIA) { + CECEmptyTag kadPrefs(EC_TAG_PREFS_KADEMLIA); + kadPrefs.AddTag(CECTag(EC_TAG_KADEMLIA_UPDATE_URL, thePrefs::GetKadNodesUrl())); + AddTag(kadPrefs); + } } /** @@ -348,6 +364,12 @@ if ((oneTag = thisTab->GetTagByName(EC_TAG_USER_NICK)) != NULL) { thePrefs::SetUserNick(oneTag->GetStringData()); } + if ((oneTag = thisTab->GetTagByName(EC_TAG_USER_HASH)) != NULL) { + thePrefs::SetUserHash(oneTag->GetMD4Data()); + } + if ((oneTag = thisTab->GetTagByName(EC_TAG_USER_HOST)) != NULL) { + thePrefs::SetYourHostname(oneTag->GetStringData()); + } } // @@ -442,6 +464,9 @@ ApplyBoolean(use_tag, thisTab, thePrefs::SetSafeServerConnectEnabled, EC_TAG_SERVERS_SAFE_SERVER_CONNECT); ApplyBoolean(use_tag, thisTab, thePrefs::SetAutoConnectStaticOnly, EC_TAG_SERVERS_AUTOCONN_STATIC_ONLY); ApplyBoolean(use_tag, thisTab, thePrefs::SetManualHighPrio, EC_TAG_SERVERS_MANUAL_HIGH_PRIO); + if ((oneTag = thisTab->GetTagByName(EC_TAG_SERVERS_UPDATE_URL)) != NULL) { + thePrefs::SetEd2kServersUrl(oneTag->GetStringData()); + } } if ((thisTab = GetTagByName(EC_TAG_PREFS_FILES)) != NULL) { @@ -456,11 +481,10 @@ ApplyBoolean(use_tag, thisTab, thePrefs::SetStartNextFileSame, EC_TAG_FILES_RESUME_SAME_CAT); ApplyBoolean(use_tag, thisTab, thePrefs::SetSrcSeedsOn, EC_TAG_FILES_SAVE_SOURCES); ApplyBoolean(use_tag, thisTab, thePrefs::SetExtractMetaData, EC_TAG_FILES_EXTRACT_METADATA); - ApplyBoolean(use_tag, thisTab, thePrefs::SetAllocFullChunk, EC_TAG_FILES_ALLOC_FULL_CHUNKS); - ApplyBoolean(use_tag, thisTab, thePrefs::SetAllocFullPart, EC_TAG_FILES_ALLOC_FULL_SIZE); + ApplyBoolean(use_tag, thisTab, thePrefs::SetAllocFullFile, EC_TAG_FILES_ALLOC_FULL_SIZE); ApplyBoolean(use_tag, thisTab, thePrefs::SetCheckDiskspaceEnabled, EC_TAG_FILES_CHECK_FREE_SPACE); if ((oneTag = thisTab->GetTagByName(EC_TAG_FILES_MIN_FREE_SPACE)) != NULL) { - thePrefs::SetMinFreeDiskSpace(oneTag->GetInt()); + thePrefs::SetMinFreeDiskSpaceMB(oneTag->GetInt()); } } @@ -501,6 +525,10 @@ } ApplyBoolean(use_tag, thisTab, thePrefs::SetFilterLanIPs, EC_TAG_IPFILTER_FILTER_LAN); ApplyBoolean(use_tag, thisTab, thePrefs::SetSecureIdentEnabled, EC_TAG_SECURITY_USE_SECIDENT); + + ApplyBoolean(use_tag, thisTab, thePrefs::SetClientCryptLayerSupported, EC_TAG_SECURITY_OBFUSCATION_SUPPORTED); + ApplyBoolean(use_tag, thisTab, thePrefs::SetClientCryptLayerRequested, EC_TAG_SECURITY_OBFUSCATION_REQUESTED); + ApplyBoolean(use_tag, thisTab, thePrefs::SetClientCryptLayerRequired, EC_TAG_SECURITY_OBFUSCATION_REQUIRED); } if ((thisTab = GetTagByName(EC_TAG_PREFS_CORETWEAKS)) != NULL) { @@ -519,6 +547,12 @@ } } + if ((thisTab = GetTagByName(EC_TAG_PREFS_KADEMLIA)) != NULL) { + if ((oneTag = thisTab->GetTagByName(EC_TAG_KADEMLIA_UPDATE_URL)) != NULL) { + thePrefs::SetKadNodesUrl(oneTag->GetStringData()); + } + } + theApp->glob_prefs->Save(); } // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/ED2KLinkParser.cpp amule-2.2.2/src/ED2KLinkParser.cpp --- amule-2.2.0~svn20080218/src/ED2KLinkParser.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ED2KLinkParser.cpp 2008-04-01 15:55:21.000000000 +0000 @@ -25,7 +25,7 @@ const int versionMajor = 1; const int versionMinor = 4; -const int versionRevision = 0; +const int versionRevision = 1; #include #include @@ -284,7 +284,7 @@ file << uri << std::endl; - std::cout << "Link succesfully queued." << std::endl; + std::cout << "Link successfully queued." << std::endl; } diff -ruN -d amule-2.2.0~svn20080218/src/EncryptedDatagramSocket.cpp amule-2.2.2/src/EncryptedDatagramSocket.cpp --- amule-2.2.0~svn20080218/src/EncryptedDatagramSocket.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/EncryptedDatagramSocket.cpp 2008-05-25 08:03:22.000000000 +0000 @@ -98,6 +98,7 @@ #include "./kademlia/kademlia/Prefs.h" #include "./kademlia/kademlia/Kademlia.h" #include "RandomFunctions.h" +#include "Statistics.h" #include #include @@ -122,144 +123,210 @@ } -int CEncryptedDatagramSocket::DecryptReceivedClient(uint8* pbyBufIn, int nBufLen, uint8** ppbyBufOut, uint32 dwIP, uint16* nReceiverVerifyKey, uint16* nSenderVerifyKey) { - int nResult = nBufLen; - *ppbyBufOut = pbyBufIn; +int CEncryptedDatagramSocket::DecryptReceivedClient(uint8_t *bufIn, int bufLen, uint8_t **bufOut, uint32_t ip, uint32_t *receiverVerifyKey, uint32_t *senderVerifyKey) +{ + int result = bufLen; + *bufOut = bufIn; - if (nResult <= CRYPT_HEADER_WITHOUTPADDING /*|| !thePrefs.IsClientCryptLayerSupported()*/) - return nResult; + if (receiverVerifyKey == NULL || senderVerifyKey == NULL) { + wxFAIL; + return result; + } - if (nReceiverVerifyKey == NULL || nSenderVerifyKey == NULL){ - wxASSERT( false ); - return nResult; + *receiverVerifyKey = 0; + *senderVerifyKey = 0; + + if (result <= CRYPT_HEADER_WITHOUTPADDING /*|| !thePrefs.IsClientCryptLayerSupported()*/) { + return result; } - switch (pbyBufIn[0]){ + switch (bufIn[0]) { case OP_EMULEPROT: case OP_KADEMLIAPACKEDPROT: case OP_KADEMLIAHEADER: case OP_UDPRESERVEDPROT1: case OP_UDPRESERVEDPROT2: case OP_PACKEDPROT: - return nResult; // no encrypted packet (see description on top) + return result; // no encrypted packet (see description on top) default: ; } - bool bKad = (pbyBufIn[0] & 0x01) == 0; // check the marker bit if this is a kad or ed2k packet, this is only an indicator since old clients have it set random // might be an encrypted packet, try to decrypt - CRC4EncryptableBuffer receivebuffer; - uint32 dwValue = 0; - bool bFlipTry = false; - do{ - bKad = bFlipTry ? !bKad : bKad; + uint32_t value = 0; + // check the marker bit which type this packet could be and which key to test first, this is only an indicator since old clients have it set random + // see the header for marker bits explanation + uint8_t currentTry = ((bufIn[0] & 0x03) == 3) ? 1 : (bufIn[0] & 0x03); + uint8_t tries; + if (Kademlia::CKademlia::GetPrefs() == NULL) { + // if kad never run, no point in checking anything except for ed2k encryption + tries = 1; + currentTry = 1; + } else { + tries = 3; + } + bool kadRecvKeyUsed = false; + bool kad = false; + do { + receivebuffer.FullReset(); + tries--; MD5Sum md5; - - if (bKad){ + + if (currentTry == 0) { + // kad packet with NodeID as key + kad = true; + kadRecvKeyUsed = false; if (Kademlia::CKademlia::GetPrefs()) { - uint8 achKeyData[18]; - memcpy(achKeyData, Kademlia::CKademlia::GetPrefs()->GetKadID().GetData(), 16); - memcpy(achKeyData + 16, pbyBufIn + 1, 2); // random key part sent from remote client - md5.Calculate(achKeyData, sizeof(achKeyData)); + uint8_t keyData[18]; + Kademlia::CKademlia::GetPrefs()->GetKadID().StoreCryptValue((uint8_t *)&keyData); + memcpy(keyData + 16, bufIn + 1, 2); // random key part sent from remote client + md5.Calculate(keyData, sizeof(keyData)); } - } else{ - uint8 achKeyData[23]; - md4cpy(achKeyData, thePrefs::GetUserHash().GetHash()); - achKeyData[20] = MAGICVALUE_UDP; - PokeUInt32(achKeyData + 16, dwIP); - memcpy(achKeyData + 21, pbyBufIn + 1, 2); // random key part sent from remote client - md5.Calculate(achKeyData, sizeof(achKeyData)); + } else if (currentTry == 1) { + // ed2k packet + kad = false; + kadRecvKeyUsed = false; + uint8_t keyData[23]; + md4cpy(keyData, thePrefs::GetUserHash().GetHash()); + keyData[20] = MAGICVALUE_UDP; + PokeUInt32(keyData + 16, ip); + memcpy(keyData + 21, bufIn + 1, 2); // random key part sent from remote client + md5.Calculate(keyData, sizeof(keyData)); + } else if (currentTry == 2) { + // kad packet with ReceiverKey as key + kad = true; + kadRecvKeyUsed = true; + if (Kademlia::CKademlia::GetPrefs()) { + uint8_t keyData[6]; + PokeUInt32(keyData, Kademlia::CPrefs::GetUDPVerifyKey(ip)); + memcpy(keyData + 4, bufIn + 1, 2); // random key part sent from remote client + md5.Calculate(keyData, sizeof(keyData)); + } + } else { + wxFAIL; } - + receivebuffer.SetKey(md5, true); - receivebuffer.RC4Crypt(pbyBufIn + 3, (uint8*)&dwValue, sizeof(dwValue)); - ENDIAN_SWAP_I_32(dwValue); - - bFlipTry = !bFlipTry; // next round try the other possibility - } while (dwValue != MAGICVALUE_UDP_SYNC_CLIENT && bFlipTry); // try to decrypt as ed2k as well as kad packet if needed (max 2 rounds) - - if (dwValue == MAGICVALUE_UDP_SYNC_CLIENT){ - // Yup this is an encrypted packet - //DEBUG_ONLY( DebugLog(_T("Received obfuscated UDP packet from clientIP: %s"), ipstr(dwIP)) ); - uint8 byPadLen; - - receivebuffer.RC4Crypt(pbyBufIn + 7, (uint8*)&byPadLen, 1); - nResult -= CRYPT_HEADER_WITHOUTPADDING; - - if (nResult <= byPadLen){ + receivebuffer.RC4Crypt(bufIn + 3, (uint8_t*)&value, sizeof(value)); + ENDIAN_SWAP_I_32(value); + + currentTry = (currentTry + 1) % 3; + } while (value != MAGICVALUE_UDP_SYNC_CLIENT && tries > 0); // try to decrypt as ed2k as well as kad packet if needed (max 3 rounds) + + if (value == MAGICVALUE_UDP_SYNC_CLIENT) { + // yup this is an encrypted packet +// // debugoutput notices +// // the following cases are "allowed" but shouldn't happen given that there is only our implementation yet +// if (bKad && (pbyBufIn[0] & 0x01) != 0) +// DebugLog(_T("Received obfuscated UDP packet from clientIP: %s with wrong key marker bits (kad packet, ed2k bit)"), ipstr(dwIP)); +// else if (bKad && !bKadRecvKeyUsed && (pbyBufIn[0] & 0x02) != 0) +// DebugLog(_T("Received obfuscated UDP packet from clientIP: %s with wrong key marker bits (kad packet, nodeid key, recvkey bit)"), ipstr(dwIP)); +// else if (bKad && bKadRecvKeyUsed && (pbyBufIn[0] & 0x02) == 0) +// DebugLog(_T("Received obfuscated UDP packet from clientIP: %s with wrong key marker bits (kad packet, recvkey key, nodeid bit)"), ipstr(dwIP)); + + uint8_t padLen; + receivebuffer.RC4Crypt(bufIn + 7, (uint8_t*)&padLen, 1); + result -= CRYPT_HEADER_WITHOUTPADDING; + + if (result <= padLen) { //DebugLogError(_T("Invalid obfuscated UDP packet from clientIP: %s, Paddingsize (%u) larger than received bytes"), ipstr(dwIP), byPadLen); - return nBufLen; // pass through, let the Receivefunction do the errorhandling on this junk + return bufLen; // pass through, let the Receivefunction do the errorhandling on this junk } - - if (byPadLen > 0) { - receivebuffer.RC4Crypt(NULL, NULL, byPadLen); + + if (padLen > 0) { + receivebuffer.RC4Crypt(NULL, NULL, padLen); } - - nResult -= byPadLen; - if (bKad){ - if (nResult <= 4){ + result -= padLen; + + if (kad) { + if (result <= 8) { //DebugLogError(_T("Obfuscated Kad packet with mismatching size (verify keys missing) received from clientIP: %s"), ipstr(dwIP)); - return nBufLen; // pass through, let the Receivefunction do the errorhandling on this junk; + return bufLen; // pass through, let the Receivefunction do the errorhandling on this junk; } // read the verify keys - *nReceiverVerifyKey = PeekUInt16(pbyBufIn + CRYPT_HEADER_WITHOUTPADDING + byPadLen); - *nSenderVerifyKey = PeekUInt16(pbyBufIn + CRYPT_HEADER_WITHOUTPADDING + byPadLen + 2); - nResult -= 4; - } else { - *nReceiverVerifyKey = 0; - *nSenderVerifyKey = 0; + receivebuffer.RC4Crypt(bufIn + CRYPT_HEADER_WITHOUTPADDING + padLen, (uint8_t*)receiverVerifyKey, 4); + receivebuffer.RC4Crypt(bufIn + CRYPT_HEADER_WITHOUTPADDING + padLen + 4, (uint8_t*)senderVerifyKey, 4); + result -= 8; } - - *ppbyBufOut = pbyBufIn + (nBufLen - nResult); - - receivebuffer.RC4Crypt((uint8*)*ppbyBufOut, (uint8*)*ppbyBufOut, nResult); - //theStats.AddDownDataOverheadCrypt(nBufLen - nResult); - return nResult; // done - } else{ + + *bufOut = bufIn + (bufLen - result); + + receivebuffer.RC4Crypt((uint8_t*)*bufOut, (uint8_t*)*bufOut, result); + theStats::AddDownOverheadCrypt(bufLen - result); + return result; // done + } else { //DebugLogWarning(_T("Obfuscated packet expected but magicvalue mismatch on UDP packet from clientIP: %s"), ipstr(dwIP)); - return nBufLen; // pass through, let the Receivefunction do the errorhandling on this junk + return bufLen; // pass through, let the Receivefunction do the errorhandling on this junk } } -int CEncryptedDatagramSocket::EncryptSendClient(uint8** ppbyBuf, int nBufLen, const uint8* pachClientHashOrKadID, bool bKad, uint16 nReceiverVerifyKey, uint16 nSenderVerifyKey) { - wxASSERT( theApp->GetPublicIP() != 0 || bKad ); - wxASSERT( thePrefs::IsClientCryptLayerSupported() ); +// Encrypt packet. Key used: +// pachClientHashOrKadID != NULL -> pachClientHashOrKadID +// pachClientHashOrKadID == NULL && bKad && nReceiverVerifyKey != 0 -> nReceiverVerifyKey +// else -> ASSERT +int CEncryptedDatagramSocket::EncryptSendClient(uint8_t **buf, int bufLen, const uint8_t *clientHashOrKadID, bool kad, uint32_t receiverVerifyKey, uint32_t senderVerifyKey) +{ + wxASSERT(theApp->GetPublicIP() != 0 || kad); + wxASSERT(thePrefs::IsClientCryptLayerSupported()); + wxASSERT(clientHashOrKadID != NULL || receiverVerifyKey != 0); + wxASSERT((receiverVerifyKey == 0 && senderVerifyKey == 0) || kad); - uint8 byPadLen = 0; // padding disabled for UDP currently - const uint32 nCryptHeaderLen = byPadLen + CRYPT_HEADER_WITHOUTPADDING + (bKad ? 4 : 0); - uint32 nCryptedLen = nBufLen + nCryptHeaderLen; - uint8* pachCryptedBuffer = new uint8[nCryptedLen]; + uint8_t padLen = 0; // padding disabled for UDP currently + const uint32_t cryptHeaderLen = padLen + CRYPT_HEADER_WITHOUTPADDING + (kad ? 8 : 0); + uint32_t cryptedLen = bufLen + cryptHeaderLen; + uint8_t *cryptedBuffer = new uint8_t[cryptedLen]; + bool kadRecvKeyUsed = false; - uint16 nRandomKeyPart = GetRandomUint16(); + uint16_t randomKeyPart = GetRandomUint16(); CRC4EncryptableBuffer sendbuffer; MD5Sum md5; - if (bKad) { - uint8 achKeyData[18]; - md4cpy(achKeyData, pachClientHashOrKadID); - PokeUInt16(achKeyData+16, nRandomKeyPart); - md5.Calculate(achKeyData, sizeof(achKeyData)); + if (kad) { + if ((clientHashOrKadID == NULL || CMD4Hash(clientHashOrKadID).IsEmpty()) && receiverVerifyKey != 0) { + kadRecvKeyUsed = true; + uint8_t keyData[6]; + PokeUInt32(keyData, receiverVerifyKey); + PokeUInt16(keyData+4, randomKeyPart); + md5.Calculate(keyData, sizeof(keyData)); + //DEBUG_ONLY( DebugLog(_T("Creating obfuscated Kad packet encrypted by ReceiverKey (%u)"), nReceiverVerifyKey) ); + } + else if (clientHashOrKadID != NULL && !CMD4Hash(clientHashOrKadID).IsEmpty()) { + uint8_t keyData[18]; + md4cpy(keyData, clientHashOrKadID); + PokeUInt16(keyData+16, randomKeyPart); + md5.Calculate(keyData, sizeof(keyData)); + //DEBUG_ONLY( DebugLog(_T("Creating obfuscated Kad packet encrypted by Hash/NodeID %s"), md4str(pachClientHashOrKadID)) ); + } + else { + wxFAIL; + return bufLen; + } } else { - uint8 achKeyData[23]; - md4cpy(achKeyData, pachClientHashOrKadID); - PokeUInt32(achKeyData+16, theApp->GetPublicIP()); - PokeUInt16(achKeyData+21, nRandomKeyPart); - achKeyData[20] = MAGICVALUE_UDP; - md5.Calculate(achKeyData, sizeof(achKeyData)); + uint8_t keyData[23]; + md4cpy(keyData, clientHashOrKadID); + PokeUInt32(keyData+16, theApp->GetPublicIP()); + PokeUInt16(keyData+21, randomKeyPart); + keyData[20] = MAGICVALUE_UDP; + md5.Calculate(keyData, sizeof(keyData)); } - + sendbuffer.SetKey(md5, true); // create the semi random byte encryption header - uint8 bySemiRandomNotProtocolMarker = 0; + uint8_t semiRandomNotProtocolMarker = 0; int i; - for (i = 0; i < 128; i++){ - bySemiRandomNotProtocolMarker = GetRandomUint8(); - bySemiRandomNotProtocolMarker = bKad ? (bySemiRandomNotProtocolMarker & 0xFE) : (bySemiRandomNotProtocolMarker | 0x01); // set the ed2k/kad marker bit + for (i = 0; i < 128; i++) { + semiRandomNotProtocolMarker = GetRandomUint8(); + semiRandomNotProtocolMarker = kad ? (semiRandomNotProtocolMarker & 0xFE) : (semiRandomNotProtocolMarker | 0x01); // set the ed2k/kad marker bit + if (kad) { + semiRandomNotProtocolMarker = kadRecvKeyUsed ? ((semiRandomNotProtocolMarker & 0xFE) | 0x02) : (semiRandomNotProtocolMarker & 0xFC); // set the ed2k/kad and nodeid/reckey markerbit + } else { + semiRandomNotProtocolMarker = (semiRandomNotProtocolMarker | 0x01); // set the ed2k/kad marker bit + } bool bOk = false; - switch (bySemiRandomNotProtocolMarker){ // not allowed values + switch (semiRandomNotProtocolMarker) { // not allowed values case OP_EMULEPROT: case OP_KADEMLIAPACKEDPROT: case OP_KADEMLIAHEADER: @@ -270,42 +337,41 @@ default: bOk = true; } - + if (bOk) { break; } } - - if (i >= 128){ + + if (i >= 128) { // either we have _real_ bad luck or the randomgenerator is a bit messed up - wxASSERT( false ); - bySemiRandomNotProtocolMarker = 0x01; + wxFAIL; + semiRandomNotProtocolMarker = 0x01; } - pachCryptedBuffer[0] = bySemiRandomNotProtocolMarker; - PokeUInt16(pachCryptedBuffer + 1, nRandomKeyPart); - - uint32 dwMagicValue = ENDIAN_SWAP_32(MAGICVALUE_UDP_SYNC_CLIENT); - sendbuffer.RC4Crypt((uint8*)&dwMagicValue, pachCryptedBuffer + 3, 4); - - sendbuffer.RC4Crypt((uint8*)&byPadLen, pachCryptedBuffer + 7, 1); + cryptedBuffer[0] = semiRandomNotProtocolMarker; + PokeUInt16(cryptedBuffer + 1, randomKeyPart); - for (int j = 0; j < byPadLen; j++){ - uint8 byRand = (uint8)rand(); // they actually dont really need to be random, but it doesn't hurts either - sendbuffer.RC4Crypt((uint8*)&byRand, pachCryptedBuffer + CRYPT_HEADER_WITHOUTPADDING + j, 1); + uint32_t magicValue = ENDIAN_SWAP_32(MAGICVALUE_UDP_SYNC_CLIENT); + sendbuffer.RC4Crypt((uint8_t*)&magicValue, cryptedBuffer + 3, 4); + sendbuffer.RC4Crypt((uint8_t*)&padLen, cryptedBuffer + 7, 1); + + for (int j = 0; j < padLen; j++) { + uint8_t byRand = (uint8_t)rand(); // they actually don't really need to be random, but it doesn't hurt either + sendbuffer.RC4Crypt((uint8_t*)&byRand, cryptedBuffer + CRYPT_HEADER_WITHOUTPADDING + j, 1); } - if (bKad){ - sendbuffer.RC4Crypt((uint8*)&nReceiverVerifyKey, pachCryptedBuffer + CRYPT_HEADER_WITHOUTPADDING + byPadLen, 2); - sendbuffer.RC4Crypt((uint8*)&nSenderVerifyKey, pachCryptedBuffer + CRYPT_HEADER_WITHOUTPADDING + byPadLen + 2, 2); + if (kad) { + sendbuffer.RC4Crypt((uint8_t*)&receiverVerifyKey, cryptedBuffer + CRYPT_HEADER_WITHOUTPADDING + padLen, 4); + sendbuffer.RC4Crypt((uint8_t*)&senderVerifyKey, cryptedBuffer + CRYPT_HEADER_WITHOUTPADDING + padLen + 4, 4); } - sendbuffer.RC4Crypt(*ppbyBuf, pachCryptedBuffer + nCryptHeaderLen, nBufLen); - delete[] *ppbyBuf; - *ppbyBuf = pachCryptedBuffer; + sendbuffer.RC4Crypt(*buf, cryptedBuffer + cryptHeaderLen, bufLen); + delete [] *buf; + *buf = cryptedBuffer; - //theStats.AddUpDataOverheadCrypt(nCryptedLen - nBufLen); - return nCryptedLen; + theStats::AddUpOverheadCrypt(cryptedLen - bufLen); + return cryptedLen; } int CEncryptedDatagramSocket::DecryptReceivedServer( @@ -359,7 +425,7 @@ *ppbyBufOut = pbyBufIn + (nBufLen - nResult); receivebuffer.RC4Crypt((uint8*)*ppbyBufOut, (uint8*)*ppbyBufOut, nResult); - //theStats.AddDownDataOverheadCrypt(nBufLen - nResult); + theStats::AddDownOverheadCrypt(nBufLen - nResult); return nResult; // done } else { //DebugLogWarning(_T("Obfuscated packet expected but magicvalue mismatch on UDP packet from ServerIP: %s"), ipstr(dbgIP)); @@ -418,6 +484,6 @@ delete[] *ppbyBuf; *ppbyBuf = pachCryptedBuffer; - //theStats.AddUpDataOverheadCrypt(nCryptedLen - nBufLen); + theStats::AddUpOverheadCrypt(nCryptedLen - nBufLen); return nCryptedLen; } diff -ruN -d amule-2.2.0~svn20080218/src/EncryptedDatagramSocket.h amule-2.2.2/src/EncryptedDatagramSocket.h --- amule-2.2.0~svn20080218/src/EncryptedDatagramSocket.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/EncryptedDatagramSocket.h 2008-05-08 12:18:02.000000000 +0000 @@ -33,9 +33,9 @@ virtual ~CEncryptedDatagramSocket(); // TODO: Make protected once the UDP socket is again its own class. - static int DecryptReceivedClient(uint8* pbyBufIn, int nBufLen, uint8** ppbyBufOut, uint32 dwIP, uint16* nReceiverVerifyKey, uint16* nSenderVerifyKey); - static int EncryptSendClient(uint8** ppbyBuf, int nBufLen, const uint8* pachClientHashOrKadID, bool bKad, uint16 nReceiverVerifyKey, uint16 nSenderVerifyKey); - + static int DecryptReceivedClient(uint8_t *bufIn, int bufLen, uint8_t **bufOut, uint32_t ip, uint32_t *receiverVerifyKey, uint32_t *senderVerifyKey); + static int EncryptSendClient(uint8_t **buf, int bufLen, const uint8_t *clientHashOrKadID, bool kad, uint32_t receiverVerifyKey, uint32_t senderVerifyKey); + static int DecryptReceivedServer(uint8* pbyBufIn, int nBufLen, uint8** ppbyBufOut, uint32 dwBaseKey, uint32 dbgIP); static int EncryptSendServer(uint8** ppbyBuf, int nBufLen, uint32 dwBaseKey); diff -ruN -d amule-2.2.0~svn20080218/src/ExternalConn.cpp amule-2.2.2/src/ExternalConn.cpp --- amule-2.2.0~svn20080218/src/ExternalConn.cpp 2008-02-10 18:59:47.000000000 +0000 +++ amule-2.2.2/src/ExternalConn.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -218,7 +218,7 @@ AddLogLineM(false, _("New external connection accepted")); } else { delete sock; - AddLogLineM(false, _("Error: couldn't accept a new external connection")); + AddLogLineM(false, _("ERROR: couldn't accept a new external connection")); } } @@ -279,7 +279,12 @@ } else if (passwd && passwd->GetMD4Data() == passh) { response = new CECPacket(EC_OP_AUTH_OK); } else { - AddLogLineM(false, wxT("EC Auth failed: (") + passwd->GetMD4Data().Encode() + wxT(" != ") + passh.Encode() + wxT(").")); + if (passwd) { + AddLogLineM(false, wxT("EC Auth failed: (") + passwd->GetMD4Data().Encode() + wxT(" != ") + passh.Encode() + wxT(").")); + } else { + AddLogLineM(false, wxT("EC Auth failed. Password tag missing.")); + } + response = new CECPacket(EC_OP_AUTH_FAIL); response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("Authentication failed."))); } @@ -548,7 +553,7 @@ CECPacket *response = NULL; // request can contain multiple files. - for (int i = 0; i < request->GetTagCount(); ++i) { + for (unsigned int i = 0; i < request->GetTagCount(); ++i) { const CECTag *hashtag = request->GetTagByIndex(i); wxASSERT(hashtag->GetTagName() == EC_TAG_PARTFILE); @@ -559,7 +564,7 @@ if ( !pfile ) { AddLogLineM(false,CFormat(_("Remote PartFile command failed: FileHash not found: %s")) % hash.Encode()); response = new CECPacket(EC_OP_FAILED); - response->AddTag(CECTag(EC_TAG_STRING, CFormat(wxTRANSLATE("FileHash not found: %s")) % hash.Encode())); + response->AddTag(CECTag(EC_TAG_STRING, CFormat(wxString(wxTRANSLATE("FileHash not found: %s"))) % hash.Encode())); //return response; break; } @@ -670,7 +675,7 @@ if ( !srv ) { response = new CECPacket(EC_OP_FAILED); response->AddTag(CECTag(EC_TAG_STRING, - CFormat(wxTRANSLATE("server not found: %s")) % srv_tag->GetIPv4Data().StringIP())); + CFormat(wxString(wxTRANSLATE("server not found: %s"))) % srv_tag->GetIPv4Data().StringIP())); return response; } } @@ -700,7 +705,7 @@ } } else { response = new CECPacket(EC_OP_FAILED); - response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("ED2K is disabled in preferences."))); + response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("eD2k is disabled in preferences."))); } break; } @@ -749,7 +754,7 @@ CECPacket *Get_EC_Response_Search_Results_Download(const CECPacket *request) { CECPacket *response = new CECPacket(EC_OP_STRINGS); - for (int i = 0;i < request->GetTagCount();i++) { + for (unsigned int i = 0;i < request->GetTagCount();i++) { const CECTag *tag = request->GetTagByIndex(i); CMD4Hash hash = tag->GetMD4Data(); uint8 category = tag->GetTagByIndexSafe(0)->GetInt(); @@ -815,7 +820,7 @@ CECPacket *Get_EC_Response_Set_SharedFile_Prio(const CECPacket *request) { CECPacket *response = new CECPacket(EC_OP_NOOP); - for (int i = 0;i < request->GetTagCount();i++) { + for (unsigned int i = 0;i < request->GetTagCount();i++) { const CECTag *tag = request->GetTagByIndex(i); CMD4Hash hash = tag->GetMD4Data(); uint8 prio = tag->GetTagByIndexSafe(0)->GetInt(); @@ -848,7 +853,7 @@ if ( addrtag ) { uint32 ip = addrtag->GetIPv4Data().IP(); uint16 port = addrtag->GetIPv4Data().m_port; - Kademlia::CKademlia::Bootstrap(ip, port); + Kademlia::CKademlia::Bootstrap(ip, port, true); } } else { response = new CECPacket(EC_OP_FAILED); @@ -1050,7 +1055,7 @@ case EC_OP_SHUTDOWN: if (!theApp->IsOnShutDown()) { response = new CECPacket(EC_OP_NOOP); - AddLogLineM(true, _("ExternalConn: shutdown requested")); + AddLogLineM(true, _("External Connection: shutdown requested")); #ifndef AMULE_DAEMON { wxCloseEvent evt; @@ -1066,7 +1071,7 @@ } break; case EC_OP_ADD_LINK: - for(int i = 0; i < request->GetTagCount();i++) { + for(unsigned int i = 0; i < request->GetTagCount();i++) { const CECTag *tag = request->GetTagByIndex(i); wxString link = tag->GetStringData(); int category = tag->GetTagByIndexSafe(0)->GetInt(); @@ -1205,10 +1210,17 @@ } } break; - case EC_OP_SERVER_UPDATE_FROM_URL: - theApp->serverlist->UpdateServerMetFromURL(request->GetTagByIndexSafe(0)->GetStringData()); + case EC_OP_SERVER_UPDATE_FROM_URL: { + wxString url = request->GetTagByIndexSafe(0)->GetStringData(); + + // Save the new url, and update the UI (if not amuled). + Notify_ServersURLChanged(url); + thePrefs::SetEd2kServersUrl(url); + + theApp->serverlist->UpdateServerMetFromURL(url); response = new CECPacket(EC_OP_NOOP); break; + } // // IPFilter // @@ -1366,7 +1378,23 @@ case EC_OP_KAD_STOP: theApp->StopKad(); response = new CECPacket(EC_OP_NOOP); - break; + break; + case EC_OP_KAD_UPDATE_FROM_URL: { + wxString url = request->GetTagByIndexSafe(0)->GetStringData(); + + // Save the new url, and update the UI (if not amuled). + Notify_NodesURLChanged(url); + thePrefs::SetKadNodesUrl(url); + + theApp->UpdateNotesDat(url); + response = new CECPacket(EC_OP_NOOP); + break; + } + case EC_OP_KAD_BOOTSTRAP_FROM_IP: + theApp->BootstrapKad(request->GetTagByIndexSafe(0)->GetInt(), + request->GetTagByIndexSafe(1)->GetInt()); + response = new CECPacket(EC_OP_NOOP); + break; // // Networks @@ -1375,10 +1403,10 @@ if (thePrefs::GetNetworkED2K()) { response = new CECPacket(EC_OP_STRINGS); if (theApp->IsConnectedED2K()) { - response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("Already connected to ED2K."))); + response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("Already connected to eD2k."))); } else { theApp->serverconnect->ConnectToAnyServer(); - response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("Connecting to ED2K..."))); + response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("Connecting to eD2k..."))); } } if (thePrefs::GetNetworkKademlia()) { @@ -1402,7 +1430,7 @@ response = new CECPacket(EC_OP_STRINGS); if (theApp->IsConnectedED2K()) { theApp->serverconnect->Disconnect(); - response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("Disconnected from ED2K."))); + response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("Disconnected from eD2k."))); } if (theApp->IsConnectedKad()) { theApp->StopKad(); @@ -1414,7 +1442,7 @@ break; default: - AddLogLineM(false, wxString::Format(_("ExternalConn: invalid opcode received: %#x"), request->GetOpCode())); + AddLogLineM(false, wxString::Format(_("External Connection: invalid opcode received: %#x"), request->GetOpCode())); wxFAIL; response = new CECPacket(EC_OP_FAILED); response->AddTag(CECTag(EC_TAG_STRING, wxTRANSLATE("Invalid opcode (wrong protocol version?)"))); diff -ruN -d amule-2.2.0~svn20080218/src/ExternalConn.h amule-2.2.2/src/ExternalConn.h --- amule-2.2.0~svn20080218/src/ExternalConn.h 2008-02-05 19:04:40.000000000 +0000 +++ amule-2.2.2/src/ExternalConn.h 2008-04-04 14:13:04.000000000 +0000 @@ -167,7 +167,7 @@ public: CTagSet(const CECPacket *request) : std::set() { - for (int i = 0;i < request->GetTagCount();i++) { + for (unsigned int i = 0;i < request->GetTagCount();i++) { const CECTag *tag = request->GetTagByIndex(i); if ( tag->GetTagName() == OP ) { this->InSet(tag, T()); diff -ruN -d amule-2.2.0~svn20080218/src/ExternalConnector.cpp amule-2.2.2/src/ExternalConnector.cpp --- amule-2.2.0~svn20080218/src/ExternalConnector.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/ExternalConnector.cpp 2008-05-14 03:22:00.000000000 +0000 @@ -29,9 +29,7 @@ #endif #include - #include // Needed for CFormat - #include // For wxStringTokenizer // For readline @@ -62,7 +60,6 @@ #include // Needed for CECFileConfig - #include //------------------------------------------------------------------- @@ -195,21 +192,23 @@ //------------------------------------------------------------------- CaMuleExternalConnector::CaMuleExternalConnector() - : m_commands(*this) + : m_configFile(NULL), + m_port(-1), + m_KeepQuiet(false), + m_Verbose(false), + m_commands(*this), + m_ECClient(NULL), + m_InputLine(NULL), + m_NeedsConfigSave(false), + m_locale(NULL) { - m_ECClient = NULL; - m_KeepQuiet = false; - m_InputLine = NULL; - m_port = -1; - m_NeedsConfigSave = false; - m_Verbose = false; - m_configFile = NULL; SetAppName(wxT("aMule")); } CaMuleExternalConnector::~CaMuleExternalConnector() { delete m_configFile; + delete m_locale; } void CaMuleExternalConnector::OnInitCommandSet() @@ -301,7 +300,6 @@ void CaMuleExternalConnector::GetCommand(const wxString &prompt, char* buffer, size_t buffer_size) { - if( !m_KeepQuiet ) { #ifdef HAVE_LIBREADLINE char *text = readline(unicode2char(prompt + wxT("$ "))); if (text && *text && @@ -328,7 +326,6 @@ } else { strncpy(buffer, "quit", buffer_size); } - } } void CaMuleExternalConnector::TextShell(const wxString &prompt) @@ -413,17 +410,7 @@ if (m_ECClient->IsSocketConnected()) { ShowGreet(); Pre_Shell(); - if (m_KeepQuiet) { - while(true) { - #ifndef __WXMSW__ - pause(); - #else - wxSleep(10); - #endif - } - } else { - TextShell(ProgName); - } + TextShell(ProgName); Post_Shell(); Show(CFormat(_("\nOk, exiting %s...\n")) % ProgName); } @@ -590,10 +577,23 @@ bool retval = wxApp::OnInit(); OnInitCommandSet(); InitCustomLanguages(); - InitLocale(m_locale, StrLang2wx(m_language)); + SetLocale(m_language); return retval; } +wxString CaMuleExternalConnector::SetLocale(const wxString& language) +{ + if (!language.IsEmpty()) { + m_language = language; + if (m_locale) { + delete m_locale; + } + m_locale = new wxLocale; + InitLocale(*m_locale, StrLang2wx(language)); + } + + return m_locale == NULL ? wxString() : m_locale->GetCanonicalName(); +} #if !wxUSE_GUI && defined(__WXMAC__) diff -ruN -d amule-2.2.0~svn20080218/src/ExternalConnector.h amule-2.2.2/src/ExternalConnector.h --- amule-2.2.0~svn20080218/src/ExternalConnector.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ExternalConnector.h 2008-05-14 03:22:00.000000000 +0000 @@ -149,6 +149,10 @@ wxString m_configFileName; protected: + // Set current locale, if language is not empty. + // returns canonical name of set (current) locale + virtual wxString SetLocale(const wxString& language); + long m_port; wxString m_host; CMD4Hash m_password; @@ -167,7 +171,7 @@ char * m_InputLine; bool m_NeedsConfigSave; wxString m_language; - wxLocale m_locale; + wxLocale * m_locale; }; #endif // __EXTERNALCONNECTOR_H__ diff -ruN -d amule-2.2.0~svn20080218/src/FileDetailDialog.cpp amule-2.2.2/src/FileDetailDialog.cpp --- amule-2.2.0~svn20080218/src/FileDetailDialog.cpp 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/FileDetailDialog.cpp 2008-06-01 15:35:26.000000000 +0000 @@ -121,7 +121,7 @@ CastChild(IDC_SOURCECOUNT2,wxControl)->SetLabel(bufferS); bufferS = wxString::Format(wxT("%i (%.1f%%)"), m_file->GetAvailablePartCount(), - (float) ((m_file->GetAvailablePartCount()*100)/ m_file->GetPartCount())); + ((m_file->GetAvailablePartCount() * 100.0f)/ m_file->GetPartCount())); CastChild(IDC_PARTAVAILABLE,wxControl)->SetLabel(bufferS); bufferS = CastSecondsToHM(m_file->GetDlActiveTime()); CastChild(IDC_DLACTIVETIME, wxControl)->SetLabel(bufferS); @@ -149,12 +149,12 @@ void CFileDetailDialog::FillSourcenameList() { CFileDetailListCtrl* pmyListCtrl; - int itempos; + int itempos; + int inserted = 0; pmyListCtrl = CastChild(IDC_LISTCTRLFILENAMES, CFileDetailListCtrl ); // reset for (int i=0;iGetItemCount();i++){ - pmyListCtrl->SetItem(i, 1, wxT("0")); SourcenameItem *item = reinterpret_cast(pmyListCtrl->GetItemData(i)); item->count = 0; } @@ -167,7 +167,6 @@ itempos = pmyListCtrl->FindItem(-1,cur_src.name); if (itempos == -1) { int itemid = pmyListCtrl->InsertItem(0, cur_src.name); - pmyListCtrl->SetItem(0, 1, wxString::Format(wxT("%li"), cur_src.count)); SourcenameItem *item = new SourcenameItem(cur_src.name, cur_src.count); pmyListCtrl->SetItemPtrData(0, reinterpret_cast(item)); // background.. argh -- PA: was in old version - do we still need this? @@ -175,10 +174,10 @@ tmpitem.m_itemId = itemid; tmpitem.SetBackgroundColour(SYSCOLOR(wxSYS_COLOUR_LISTBOX)); pmyListCtrl->SetItem(tmpitem); + inserted++; } else { SourcenameItem *item = reinterpret_cast(pmyListCtrl->GetItemData(itempos)); item->count = cur_src.count; - pmyListCtrl->SetItem(itempos, 1, wxString::Format(wxT("%li"), cur_src.count)); } } #else // CLIENT_GUI @@ -194,7 +193,6 @@ itempos = pmyListCtrl->FindItem(-1,cur_src.GetClientFilename()); if (itempos == -1) { int itemid = pmyListCtrl->InsertItem(0, cur_src.GetClientFilename()); - pmyListCtrl->SetItem(0, 1, wxT("1")); SourcenameItem *item = new SourcenameItem(cur_src.GetClientFilename(), 1); pmyListCtrl->SetItemPtrData(0, reinterpret_cast(item)); // background.. argh -- PA: was in old version - do we still need this? @@ -202,27 +200,30 @@ tmpitem.m_itemId=itemid; tmpitem.SetBackgroundColour(SYSCOLOR(wxSYS_COLOUR_LISTBOX)); pmyListCtrl->SetItem(tmpitem); + inserted++; } else { SourcenameItem *item = reinterpret_cast(pmyListCtrl->GetItemData(itempos)); item->count++; - pmyListCtrl->SetItem(itempos, 1, wxString::Format(wxT("%li"), item->count)); } } #endif // CLIENT_GUI - pmyListCtrl->SortList(); - - // remove 0'er + // remove 0'er and update counts for (int i = 0; i < pmyListCtrl->GetItemCount(); ++i) { SourcenameItem *item = reinterpret_cast(pmyListCtrl->GetItemData(i)); if (item->count == 0) { delete item; pmyListCtrl->DeleteItem(i); i--; // PA: one step back is enough, no need to go back to 0 + } else { + pmyListCtrl->SetItem(i, 1, wxString::Format(wxT("%li"), item->count)); } } - Layout(); + if (inserted) { + pmyListCtrl->SortList(); + } + // no need to call Layout() here, it's called in UpdateData() } diff -ruN -d amule-2.2.0~svn20080218/src/FileLock.h amule-2.2.2/src/FileLock.h --- amule-2.2.0~svn20080218/src/FileLock.h 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/FileLock.h 2008-06-11 23:10:44.000000000 +0000 @@ -58,8 +58,59 @@ */ CFileLock(const std::string& file) #if defined(__WIN32__) || defined(_MSC_VER) - { + : m_ok(false) + { + hd = CreateFileA((file + "_lock").c_str(), + GENERIC_READ | GENERIC_WRITE, + 0, // share - not shareable + NULL, // security - not inheritable + CREATE_ALWAYS, + FILE_ATTRIBUTE_ARCHIVE, + NULL); + if (hd != INVALID_HANDLE_VALUE) { + m_ok = SetLock(true); + } } + + /** Releases the lock, if any is held. */ + ~CFileLock() { + if (m_ok) { + SetLock(false); + } + + if (hd != INVALID_HANDLE_VALUE) { + CloseHandle(hd); + } + } + +private: + //! Not copyable. + CFileLock(const CFileLock&); + //! Not assignable. + CFileLock& operator=(const CFileLock&); + + /** Locks or unlocks the lock-file, returning true on success. */ + bool SetLock(bool doLock) { + // lock/unlock first byte in the file + OVERLAPPED ov; + ov.Offset = ov.OffsetHigh = 0; + BOOL ret; + if (doLock) { + // http://msdn.microsoft.com/en-us/library/ms891385.aspx + ret = LockFileEx(hd, LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &ov); + } else { + // http://msdn.microsoft.com/en-us/library/ms892364.aspx + ret = UnlockFileEx(hd, 0, 1, 0, &ov); + } + return ret != 0; + } + + + //! Desriptor of the file being locked. + HANDLE hd; + + //! Specifies if the file-lock was aquired. + bool m_ok; #else : m_fd(-1), m_ok(false) diff -ruN -d amule-2.2.0~svn20080218/src/FriendList.cpp amule-2.2.2/src/FriendList.cpp --- amule-2.2.0~svn20080218/src/FriendList.cpp 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/FriendList.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -117,10 +117,10 @@ } } } else { - AddLogLineM(false, _("Failed to open friendlist file 'emfriends.met' for reading!")); + AddLogLineM(false, _("Failed to open friend list file 'emfriends.met' for reading!")); } } catch (const CInvalidPacket& e) { - AddDebugLogLineM(true, logGeneral, wxT("Invalid entry in friendlist, file may be corrupt: ") + e.what()); + AddDebugLogLineM(true, logGeneral, wxT("Invalid entry in friend list, file may be corrupt: ") + e.what()); } catch (const CSafeIOException& e) { AddDebugLogLineM(true, logGeneral, wxT("IO error while reading 'emfriends.met': ") + e.what()); } @@ -143,7 +143,7 @@ AddDebugLogLineM(true, logGeneral, wxT("IO failure while saving 'emfriends.met': ") + e.what()); } } else { - AddLogLineM(false, _("Failed to open friendlist file 'emfriends.met' for writing!")); + AddLogLineM(false, _("Failed to open friend list file 'emfriends.met' for writing!")); } } @@ -172,7 +172,7 @@ bool CFriendList::IsAlreadyFriend( uint32 dwLastUsedIP, uint32 nLastUsedPort ) { - return FindFriend( CMD4Hash(), dwLastUsedIP, nLastUsedPort ); + return (FindFriend( CMD4Hash(), dwLastUsedIP, nLastUsedPort ) != NULL); } diff -ruN -d amule-2.2.0~svn20080218/src/FriendListCtrl.cpp amule-2.2.2/src/FriendListCtrl.cpp --- amule-2.2.0~svn20080218/src/FriendListCtrl.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/FriendListCtrl.cpp 2008-04-04 14:13:04.000000000 +0000 @@ -185,7 +185,7 @@ #ifndef CLIENT_GUI for(FriendList::iterator it = theApp->friendlist->m_FriendList.begin(); it != theApp->friendlist->m_FriendList.end(); ++it) { CFriend* core_friend = *it; - AddFriend(core_friend->GetUserHash(), core_friend->GetName(), core_friend->GetIP(), core_friend->GetPort(), core_friend->GetLinkedClient(), core_friend->HasFriendSlot(), false); + AddFriend(core_friend->GetUserHash(), core_friend->GetName(), core_friend->GetIP(), core_friend->GetPort(), (core_friend->GetLinkedClient() != NULL), core_friend->HasFriendSlot(), false); } #endif @@ -214,7 +214,7 @@ bool CFriendListCtrl::IsAlreadyFriend( uint32 dwLastUsedIP, uint32 nLastUsedPort ) { - return FindFriend( CMD4Hash(), dwLastUsedIP, nLastUsedPort ); + return (FindFriend( CMD4Hash(), dwLastUsedIP, nLastUsedPort ) != NULL); } void CFriendListCtrl::OnRightClick(wxMouseEvent& event) @@ -268,7 +268,13 @@ void CFriendListCtrl::OnRemoveFriend(wxCommandEvent& WXUNUSED(event)) { - wxString question = _("Are you sure that you wish to delete the selected friend(s)?"); + wxString question; + if (GetSelectedItemCount() == 1) { + question = _("Are you sure that you wish to delete the selected friend?"); + } else { + question = _("Are you sure that you wish to delete the selected friends?"); + } + if ( wxMessageBox( question, _("Cancel"), wxICON_QUESTION | wxYES_NO, this) == wxYES ) { long index = GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); diff -ruN -d amule-2.2.0~svn20080218/src/GuiEvents.cpp amule-2.2.2/src/GuiEvents.cpp --- amule-2.2.0~svn20080218/src/GuiEvents.cpp 2008-01-14 13:23:46.000000000 +0000 +++ amule-2.2.2/src/GuiEvents.cpp 2008-03-24 20:48:49.000000000 +0000 @@ -18,6 +18,7 @@ # include "ClientListCtrl.h" # include "SharedFilesCtrl.h" # include "DownloadListCtrl.h" +# include "muuli_wdr.h" #endif #ifdef AMULE_DAEMON @@ -87,6 +88,22 @@ #endif } + + void NodesURLChanged(wxString NOT_ON_DAEMON(url)) + { +#ifndef AMULE_DAEMON + CastByID(IDC_NODESLISTURL, NULL, wxTextCtrl)->SetValue(url); +#endif + } + + void ServersURLChanged(wxString NOT_ON_DAEMON(url)) + { +#ifndef AMULE_DAEMON + CastByID(IDC_SERVERLISTURL, NULL, wxTextCtrl)->SetValue(url); +#endif + } + + #ifdef CLIENT_GUI void PartFile_Swap_A4AF(CPartFile* file) @@ -489,7 +506,7 @@ void ShowGUI() { #ifndef AMULE_DAEMON - theApp->amuledlg->Show_aMule(true); + theApp->amuledlg->Iconize(false); #endif } diff -ruN -d amule-2.2.0~svn20080218/src/GuiEvents.h amule-2.2.2/src/GuiEvents.h --- amule-2.2.0~svn20080218/src/GuiEvents.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/GuiEvents.h 2008-02-27 01:21:24.000000000 +0000 @@ -125,7 +125,10 @@ void CategoryUpdate(uint32 cat); void CategoryDelete(uint32 cat); - + void NodesURLChanged(wxString url); + void ServersURLChanged(wxString url); + + // // GUI -> core notification // @@ -425,8 +428,8 @@ // queue list #define Notify_QlistAddClient(ptr) MuleNotify::DoNotify(&MuleNotify::ClientCtrlAddClient, ptr, vtQueued) -#define Notify_QlistRemoveClient(ptr) MuleNotify::DoNotify(&MuleNotify::ClientCtrlRefreshClient, ptr, vtQueued) -#define Notify_QlistRefreshClient(ptr) MuleNotify::DoNotify(&MuleNotify::ClientCtrlRemoveClient, ptr, vtQueued) +#define Notify_QlistRefreshClient(ptr) MuleNotify::DoNotify(&MuleNotify::ClientCtrlRefreshClient, ptr, vtQueued) +#define Notify_QlistRemoveClient(ptr) MuleNotify::DoNotify(&MuleNotify::ClientCtrlRemoveClient, ptr, vtQueued) // server #define Notify_ServerAdd(ptr) MuleNotify::DoNotify(&MuleNotify::ServerAdd, ptr) @@ -464,6 +467,11 @@ #define Notify_CategoryUpdate(cat) MuleNotify::DoNotify(&MuleNotify::CategoryUpdate, cat) #define Notify_CategoryDelete(cat) MuleNotify::DoNotify(&MuleNotify::CategoryDelete, cat) +// server.met/nodes.dat default urls +#define Notify_NodesURLChanged(url) MuleNotify::DoNotify(&MuleNotify::NodesURLChanged, url) +#define Notify_ServersURLChanged(url) MuleNotify::DoNotify(&MuleNotify::ServersURLChanged, url) + + // // GUI -> core notification // @@ -493,7 +501,6 @@ #define CoreNotify_Download_Set_Cat_Prio(cat, pri) MuleNotify::DoNotify(&MuleNotify::Download_Set_Cat_Prio, cat, pri) #define CoreNotify_Download_Set_Cat_Status(cat, st) MuleNotify::DoNotify(&MuleNotify::Download_Set_Cat_Status, cat, st) - #endif // __GUIEVENTS_H__ // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/HTTPDownload.cpp amule-2.2.2/src/HTTPDownload.cpp --- amule-2.2.0~svn20080218/src/HTTPDownload.cpp 2008-02-11 20:25:37.000000000 +0000 +++ amule-2.2.2/src/HTTPDownload.cpp 2008-07-10 14:32:39.000000000 +0000 @@ -42,12 +42,7 @@ #include "muuli_wdr.h" // Needed for ID_CANCEL: Let it here or will fail on win32 #include "MuleGifCtrl.h" -#ifdef __WXMSW__ -typedef wxGauge95 wxGaugeControl; -#else typedef wxGauge wxGaugeControl; -#endif - DECLARE_LOCAL_EVENT_TYPE(wxEVT_HTTP_PROGRESS, wxANY_ID) DECLARE_LOCAL_EVENT_TYPE(wxEVT_HTTP_SHUTDOWN, wxANY_ID) @@ -205,7 +200,8 @@ // Here is our read buffer // Still, I'm sure 4092 is probably a better size. - const unsigned MAX_HTTP_READ = 4092; + // MP: Most people can download at least at 32kbs/s from http... + const unsigned MAX_HTTP_READ = 32768; char buffer[MAX_HTTP_READ]; int current_read = 0; @@ -279,7 +275,7 @@ if (!location.StartsWith(wxT("http://"))) { // This is not a http url - throw wxString(wxT("Invalid URL for server.met download or http redirection (did you forget 'http://' ?)")); + throw wxString(wxT("Invalid URL for http download or http redirection (did you forget 'http://' ?)")); } // Get the host diff -ruN -d amule-2.2.0~svn20080218/src/IP2Country.cpp amule-2.2.2/src/IP2Country.cpp --- amule-2.2.0~svn20080218/src/IP2Country.cpp 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/IP2Country.cpp 2008-06-11 22:06:43.000000000 +0000 @@ -51,10 +51,41 @@ #include #include +#ifdef __WXMAC__ + #include + #include +#endif CIP2Country::CIP2Country() { - m_geoip = GeoIP_new(GEOIP_STANDARD); + m_geoip = NULL; + +#ifdef __WXMAC__ + // For the Mac GUI application, look for GeoIP database in the bundle + CFURLRef GeoIPDBUrl = CFBundleCopyResourceURL( + CFBundleGetMainBundle(), + CFSTR("GeoIP"), CFSTR("dat"), CFSTR("GeoIP") + ); + if (GeoIPDBUrl) { + CFURLRef absoluteURL = + CFURLCopyAbsoluteURL(GeoIPDBUrl); + CFRelease(GeoIPDBUrl); + if (absoluteURL) { + CFStringRef pathString = + CFURLCopyFileSystemPath( + absoluteURL, + kCFURLPOSIXPathStyle); + CFRelease(absoluteURL); + wxString GeoIPDB = wxMacCFStringHolder(pathString). + AsString(wxLocale::GetSystemEncoding()); + + m_geoip = GeoIP_open(unicode2char(GeoIPDB), + GEOIP_STANDARD); + } + } +#endif + if (m_geoip == NULL) + m_geoip = GeoIP_new(GEOIP_STANDARD); // Load data from xpm files for (int i = 0; i < FLAGS_XPM_SIZE; ++i) { @@ -70,7 +101,7 @@ } } - AddLogLineM(false, CFormat(_("Loaded %d flag bitmaps.")) % m_CountryDataMap.size()); + AddLogLineM(false, CFormat(wxPLURAL("Loaded %d flag bitmap.", "Loaded %d flag bitmaps.", m_CountryDataMap.size())) % m_CountryDataMap.size()); } @@ -82,6 +113,13 @@ const CountryData& CIP2Country::GetCountryData(const wxString &ip) { + // Should prevent the crash if the GeoIP database does not exists + if (m_geoip == NULL) { + CountryDataMap::iterator it = m_CountryDataMap.find(wxString(wxT("unknown"))); + it->second.Name = wxT("?"); + return it->second; + } + const wxString CCode = wxString(char2unicode(GeoIP_country_code_by_addr(m_geoip, unicode2char(ip)))).MakeLower(); CountryDataMap::iterator it = m_CountryDataMap.find(CCode); diff -ruN -d amule-2.2.0~svn20080218/src/IPFilter.cpp amule-2.2.2/src/IPFilter.cpp --- amule-2.2.0~svn20080218/src/IPFilter.cpp 2008-02-05 23:50:22.000000000 +0000 +++ amule-2.2.2/src/IPFilter.cpp 2008-02-19 09:31:34.000000000 +0000 @@ -327,10 +327,9 @@ } AddLogLineM(false, - CFormat(_("Loaded %u IP-ranges from '%s'. %u malformed lines were discarded.")) - % filtercount - % file - % discardedCount + ( CFormat(wxPLURAL("Loaded %u IP-range from '%s'.", "Loaded %u IP-ranges from '%s'.", filtercount)) % filtercount % file ) + + wxT(" ") + + ( CFormat(wxPLURAL("%u malformed line was discarded.", "%u malformed lines were discarded.", discardedCount)) % discardedCount ) ); return filtercount; diff -ruN -d amule-2.2.0~svn20080218/src/KadDlg.cpp amule-2.2.2/src/KadDlg.cpp --- amule-2.2.0~svn20080218/src/KadDlg.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/KadDlg.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -33,6 +33,7 @@ #include "Preferences.h" #include "StatisticsDlg.h" #include "ColorFrameCtrl.h" +#include "amuleDlg.h" #ifndef CLIENT_GUI @@ -104,7 +105,7 @@ } -void CKadDlg::UpdateGraph(bool bStatsVisible, const GraphUpdateInfo& update) +void CKadDlg::UpdateGraph(const GraphUpdateInfo& update) { std::vector v(3); v[0] = const_cast(&update.kadnodes[0]); @@ -113,7 +114,7 @@ const std::vector &apfKad(v); unsigned nodeCount = static_cast(update.kadnodes[2]); - if (!bStatsVisible) { + if (!IsShownOnScreen()) { m_kad_scope->DelayPoints(); } else { // Check the current node-count to see if we should increase the graph height @@ -152,8 +153,6 @@ void CKadDlg::OnBnClickedBootstrapClient(wxCommandEvent& WXUNUSED(evt)) { if (FindWindowById(ID_NODECONNECT)->IsEnabled()) { - //#warning TODO EC - #ifndef CLIENT_GUI // Ip is reversed since StringIPtoUint32 returns anti-host and kad expects host order uint32 ip = StringIPtoUint32( ((wxTextCtrl*)FindWindowById( ID_NODE_IP4 ))->GetValue() + @@ -163,24 +162,17 @@ ((wxTextCtrl*)FindWindowById( ID_NODE_IP2 ))->GetValue() + wxT(".") + ((wxTextCtrl*)FindWindowById( ID_NODE_IP1 ))->GetValue() ); - + if (ip == 0) { - wxMessageBox(_("Invalid ip to bootstrap"), _("Warning"), wxOK | wxICON_EXCLAMATION, this); + wxMessageBox(_("Invalid ip to bootstrap"), _("WARNING"), wxOK | wxICON_EXCLAMATION, this); } else { unsigned long port; if (((wxTextCtrl*)FindWindowById( ID_NODE_PORT ))->GetValue().ToULong(&port)) { - if ( !Kademlia::CKademlia::IsRunning() ) { - Kademlia::CKademlia::Start(); - theApp->ShowConnectionState(); - } - Kademlia::CKademlia::Bootstrap(ip, port); + theApp->BootstrapKad(ip, port); } else { - wxMessageBox(_("Invalid port to bootstrap"), _("Warning"), wxOK | wxICON_EXCLAMATION, this); + wxMessageBox(_("Invalid port to bootstrap"), _("WARNING"), wxOK | wxICON_EXCLAMATION, this); } } - #else - wxMessageBox(_("You can't bootstrap an specific ip from remote GUI yet."), _("Message"), wxOK | wxICON_INFORMATION, this); - #endif } else { wxMessageBox(_("Please fill all fields required"), _("Message"), wxOK | wxICON_INFORMATION, this); } @@ -201,27 +193,13 @@ void CKadDlg::OnBnClickedUpdateNodeList(wxCommandEvent& WXUNUSED(evt)) { - //#warning TODO EC - #ifndef CLIENT_GUI if ( wxMessageBox( wxString(_("Are you sure you want to download a new nodes.dat file?\n")) + _("Doing so will remove your current nodes and restart Kademlia connection.") , _("Continue?"), wxICON_EXCLAMATION | wxYES_NO, this) == wxYES ) { wxString strURL = ((wxTextCtrl*)FindWindowById( IDC_NODESLISTURL ))->GetValue(); - if (strURL.Find(wxT("://")) == -1) { - AddLogLineM(true, _("Invalid URL")); - return; - } - wxString strTempFilename(theApp->ConfigDir + wxT("nodes.dat.download")); - - // Save it + thePrefs::SetKadNodesUrl(strURL); - - CHTTPDownloadThread *downloader = new CHTTPDownloadThread(strURL,strTempFilename, HTTP_NodesDat); - downloader->Create(); - downloader->Run(); + theApp->UpdateNotesDat(strURL); } - #else - wxMessageBox(_("You can't update server.met from remote GUI yet."), _("Message"), wxOK | wxICON_INFORMATION, this); - #endif } // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/KadDlg.h amule-2.2.2/src/KadDlg.h --- amule-2.2.0~svn20080218/src/KadDlg.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/KadDlg.h 2008-03-30 14:47:22.000000000 +0000 @@ -44,7 +44,7 @@ void Init(); void SetUpdatePeriod(int step); void SetGraphColors(); - void UpdateGraph(bool bStatsVisible, const GraphUpdateInfo& update); + void UpdateGraph(const GraphUpdateInfo& update); private: COScopeCtrl* m_kad_scope; diff -ruN -d amule-2.2.0~svn20080218/src/KnownFile.cpp amule-2.2.2/src/KnownFile.cpp --- amule-2.2.0~svn20080218/src/KnownFile.cpp 2008-02-14 12:58:57.000000000 +0000 +++ amule-2.2.2/src/KnownFile.cpp 2008-05-04 23:11:25.000000000 +0000 @@ -252,8 +252,7 @@ CKadEntryPtrList::iterator it = m_kadNotes.begin(); for (; it != m_kadNotes.end(); ++it) { Kademlia::CEntry* entry = *it; - if(entry->m_iIP == pEntry->m_iIP || - !entry->m_iSourceID.CompareTo(pEntry->m_iSourceID)) { + if(entry->m_uIP == pEntry->m_uIP || entry->m_uSourceID == pEntry->m_uSourceID) { delete pEntry; return; } @@ -315,7 +314,10 @@ m_lastDateChanged = 0; statistic.fileParent = this; + +#ifndef CLIENT_GUI m_pAICHHashSet = new CAICHHashSet(this); +#endif } @@ -337,11 +339,12 @@ } else { m_bAutoUpPriority = false; } + + m_AICHMasterHash = tag->GetAICHHash(); } CKnownFile::~CKnownFile() { - delete m_pAICHHashSet; } #else // ! CLIENT_GUI @@ -657,9 +660,7 @@ //tags const int iFixedTags = 8; uint32 tagcount = iFixedTags; - if ( m_pAICHHashSet->HasValidMasterHash() && - ( m_pAICHHashSet->GetStatus() == AICH_HASHSETCOMPLETE || - m_pAICHHashSet->GetStatus() == AICH_VERIFIED)) { + if (HasProperAICHHashSet()) { tagcount++; } // Float meta tags are currently not written. All older eMule versions < 0.28a have @@ -725,9 +726,7 @@ priotag.WriteTagToFile(file); //AICH Filehash - if ( m_pAICHHashSet->HasValidMasterHash() && - ( m_pAICHHashSet->GetStatus() == AICH_HASHSETCOMPLETE || - m_pAICHHashSet->GetStatus() == AICH_VERIFIED)) { + if (HasProperAICHHashSet()) { CTagString aichtag(FT_AICH_HASH, m_pAICHHashSet->GetMasterHash().GetString()); aichtag.WriteTagToFile(file); } @@ -1098,7 +1097,7 @@ SetLastPublishTimeKadNotes(0); wxString strCfgPath = wxT("/") + m_abyFileHash.Encode() + wxT("/"); wxConfigBase* cfg = wxConfigBase::Get(); - cfg->Write( strCfgPath + wxT("Rate"), iNewRating); + cfg->Write( strCfgPath + wxT("Rate"), (int)iNewRating); m_iRating = iNewRating; SourceSet::iterator it = m_ClientUploadList.begin(); @@ -1328,4 +1327,41 @@ #endif } + + +wxString CKnownFile::GetAICHMasterHash() const +{ +#ifdef CLIENT_GUI + return m_AICHMasterHash; +#else + if (HasProperAICHHashSet()) { + return m_pAICHHashSet->GetMasterHash().GetString(); + } + + return wxEmptyString; +#endif +} + + +bool CKnownFile::HasProperAICHHashSet() const +{ +#ifdef CLIENT_GUI + return m_AICHMasterHash.Length(); +#else + return m_pAICHHashSet->HasValidMasterHash() && + (m_pAICHHashSet->GetStatus() == AICH_HASHSETCOMPLETE || + m_pAICHHashSet->GetStatus() == AICH_VERIFIED); +#endif +} + +wxString CKnownFile::GetFeedback() const +{ + return wxString(_("File name")) + wxT(": ") + GetFileName().GetPrintable() + wxT("\n") + + _("File size") + wxT(": ") + CastItoXBytes(GetFileSize()) + wxT("\n") + + _("Share ratio") + wxString::Format(wxT(": %.2f%%\n"), (((double)statistic.GetAllTimeTransferred() / (double)GetFileSize()) * 100.0)) + + _("Uploaded") + wxT(": ") + CastItoXBytes(statistic.GetTransferred()) + wxT(" (") + CastItoXBytes(statistic.GetAllTimeTransferred()) + wxT(")\n") + + _("Requested") + CFormat(wxT(": %u (%u)\n")) % statistic.GetRequests() % statistic.GetAllTimeRequests() + + _("Accepted") + CFormat(wxT(": %u (%u)\n")) % statistic.GetAccepts() % statistic.GetAllTimeAccepts() + + _("Complete sources") + CFormat(wxT(": %u\n")) % m_nCompleteSourcesCount; +} // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/KnownFile.h amule-2.2.2/src/KnownFile.h --- amule-2.2.0~svn20080218/src/KnownFile.h 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/KnownFile.h 2008-05-23 23:11:22.000000000 +0000 @@ -52,6 +52,7 @@ #define PS_PAUSED 7 #define PS_COMPLETING 8 #define PS_COMPLETE 9 +#define PS_ALLOCATING 10 #define PR_VERYLOW 4 // I Had to change this because @@ -161,8 +162,7 @@ virtual int8 GetFileRating() const { return m_iRating; } bool HasComment() const { return m_hasComment; } - bool HasRating() const { return m_iUserRating; } - bool HasBadRating() const { return (m_iUserRating == 1); } + bool HasRating() const { return (m_iUserRating != 0); } int8 UserRating() const { return m_iUserRating; } void UpdateFileRatingCommentAvail(); @@ -193,17 +193,9 @@ public: CKnownFile(); explicit CKnownFile(const CSearchFile &searchFile); -#ifdef CLIENT_GUI - CKnownFile(CEC_SharedFile_Tag *); - friend class CSharedFilesRem; -#endif virtual ~CKnownFile(); - #ifndef CLIENT_GUI - virtual void SetFileName(const CPath& filename); - #endif - void SetFilePath(const CPath& filePath); const CPath& GetFilePath() const { return m_filePath; } @@ -216,7 +208,7 @@ virtual void SetFileSize(uint64 nFileSize); // local available part hashs - uint16 GetHashCount() const {return m_hashlist.size();} + size_t GetHashCount() const {return m_hashlist.size();} const CMD4Hash& GetPartHash(uint16 part) const; // nr. of part hashs according the file size wrt ED2K protocol @@ -234,7 +226,7 @@ bool IsAutoUpPriority() const {return m_bAutoUpPriority;} void SetAutoUpPriority(bool flag) {m_bAutoUpPriority = flag;} void UpdateAutoUpPriority(); - uint32 GetQueuedCount() const {return m_ClientUploadList.size();} + size_t GetQueuedCount() const {return m_ClientUploadList.size();} bool LoadHashsetFromFile(const CFileDataIO* file, bool checkhash); void AddUploadingClient(CUpDownClient* client); @@ -286,9 +278,13 @@ SourceSet m_ClientUploadList; ArrayOfUInts16 m_AvailPartFrequency; - // aich - CAICHHashSet* GetAICHHashset() const { return m_pAICHHashSet; } - void SetAICHHashset(CAICHHashSet* val) { m_pAICHHashSet = val; } + /** + * Returns a base-16 encoding of the master hash, or + * an empty string if no such hash exists. + */ + wxString GetAICHMasterHash() const; + /** Returns true if the AICH-Hashset is valid, and verified or complete. */ + bool HasProperAICHHashSet() const; /** * Updates the requency of uploading parts from with the data the client provides. @@ -307,13 +303,33 @@ void ClearPriority(); time_t m_lastDateChanged; + + virtual wxString GetFeedback() const; + + +#ifdef CLIENT_GUI + CKnownFile(CEC_SharedFile_Tag *); + friend class CSharedFilesRem; + +protected: + //! The AICH master-hash, if it is known. + wxString m_AICHMasterHash; +#else + virtual void SetFileName(const CPath& filename); + + // AICH + CAICHHashSet* GetAICHHashset() const { return m_pAICHHashSet; } + void SetAICHHashset(CAICHHashSet* val) { m_pAICHHashSet = val; } + protected: + CAICHHashSet* m_pAICHHashSet; +#endif + bool LoadTagsFromFile(const CFileDataIO* file); bool LoadDateFromFile(const CFileDataIO* file); void LoadComment();//comment ArrayOfCMD4Hash m_hashlist; CPath m_filePath; - CAICHHashSet* m_pAICHHashSet; static void CreateHashFromFile(CFileDataIO* file, uint32 Length, CMD4Hash* Output, CAICHHashTree* pShaHashOut); static void CreateHashFromInput(const byte* input, uint32 Length, CMD4Hash* Output, CAICHHashTree* pShaHashOut); diff -ruN -d amule-2.2.0~svn20080218/src/KnownFileList.cpp amule-2.2.2/src/KnownFileList.cpp --- amule-2.2.0~svn20080218/src/KnownFileList.cpp 2008-02-10 19:23:19.000000000 +0000 +++ amule-2.2.2/src/KnownFileList.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -76,14 +76,14 @@ } if (!file.Open(fullpath)) { - AddLogLineM(true, _("Warning: known.met cannot be opened.")); + AddLogLineM(true, _("WARNING: known.met cannot be opened.")); return false; } try { uint8 version = file.ReadUInt8(); if ((version != MET_HEADER) && (version != MET_HEADER_WITH_LARGEFILES)) { - AddLogLineM(true, _("Warning: Knownfile list corrupted, contains invalid header.")); + AddLogLineM(true, _("WARNING: Knownfile list corrupted, contains invalid header.")); return false; } diff -ruN -d amule-2.2.0~svn20080218/src/ListenSocket.cpp amule-2.2.2/src/ListenSocket.cpp --- amule-2.2.0~svn20080218/src/ListenSocket.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ListenSocket.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -65,7 +65,7 @@ printf("ListenSocket: Ok.\n"); } else { - AddLogLineM( true, _("Error: Could not listen to TCP port.") ); + AddLogLineM( true, _("ERROR: Could not listen to TCP port.") ); printf("ListenSocket: Could not listen to TCP port."); } } diff -ruN -d amule-2.2.0~svn20080218/src/Logger.cpp amule-2.2.2/src/Logger.cpp --- amule-2.2.0~svn20080218/src/Logger.cpp 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/Logger.cpp 2008-08-05 11:12:49.000000000 +0000 @@ -98,6 +98,9 @@ CDebugCategory( logMuleUDP, wxT("MuleUDPSocket" ) ), CDebugCategory( logThreads, wxT("ThreadScheduler" ) ), CDebugCategory( logUPnP, wxT("Universal Plug and Play" ) ), + CDebugCategory( logKadUdpFwTester, wxT("Kademlia UDP Firewall Tester") ), + CDebugCategory( logKadPacketTracking, wxT("Kademlia Packet Tracking") ), + CDebugCategory( logKadEntryTracking, wxT("Kademlia Entry Tracking") ) }; @@ -209,7 +212,10 @@ const wxString &str) { wxString msg; - msg << file.AfterLast(wxFileName::GetPathSeparator()) << wxT("(") << line << wxT("): ") << str; +#ifdef __DEBUG__ + msg << file.AfterLast(wxFileName::GetPathSeparator()).AfterLast(wxT('/')) << wxT("(") << line << wxT("): "); +#endif + msg << str; PushEntry(critical, msg); if (wxThread::IsMain()) { @@ -264,7 +270,7 @@ wxString str(msg); // This is much simpler than manually handling all wx log-types. - bool critical = str.StartsWith(_("Error: ")) || str.StartsWith(_("Warning: ")); + bool critical = str.StartsWith(_("ERROR: ")) || str.StartsWith(_("WARNING: ")); CLogger::AddLogLine(__TFILE__, __LINE__, critical, str); } diff -ruN -d amule-2.2.0~svn20080218/src/Logger.h amule-2.2.2/src/Logger.h --- amule-2.2.0~svn20080218/src/Logger.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/Logger.h 2008-05-08 12:18:02.000000000 +0000 @@ -97,8 +97,14 @@ logMuleUDP, //! Warnings/Errors related to the thread-scheduler. logThreads, - //! Warnings/Errors related to the Universal Plug and Play subsistem. - logUPnP + //! Warnings/Errors related to the Universal Plug and Play subsystem. + logUPnP, + //! Warnings/Errors related to the UDP Firewall Tester + logKadUdpFwTester, + //! Warnings/Errors related to Kad packet tracking. + logKadPacketTracking, + //! Warnings/Errors related to Kad entry tracking. + logKadEntryTracking // IMPORTANT NOTE: when you add values to this enum, update the g_debugcats // array in Logger.cpp! }; diff -ruN -d amule-2.2.0~svn20080218/src/Makefile.am amule-2.2.2/src/Makefile.am --- amule-2.2.0~svn20080218/src/Makefile.am 2008-02-18 00:06:55.000000000 +0000 +++ amule-2.2.2/src/Makefile.am 2008-07-13 03:36:09.000000000 +0000 @@ -1,10 +1,20 @@ +AM_CPPFLAGS = $(MULECPPFLAGS) +AM_CFLAGS = $(MULECFLAGS) +AM_CXXFLAGS = $(MULECXXFLAGS) +AM_LDFLAGS = $(MULELDFLAGS) + +SUBDIRS = libs utils pixmaps skins + if WEB -OPT_WEB = webserver +SUBDIRS += webserver endif -SUBDIRS = libs utils pixmaps kademlia skins $(OPT_WEB) - -EXTRA_DIST = aMule.xpm +EXTRA_DIST = \ + aMule.xpm \ + Parser.y \ + Scanner.h.in \ + Scanner.l \ + muuli.wdr bin_PROGRAMS = @@ -28,30 +38,16 @@ bin_PROGRAMS += amuled endif -DEFS = -DHAVE_CONFIG_H - # Sources - -noinst_LIBRARIES = - +noinst_LIBRARIES = if MONOLITHIC -noinst_LIBRARIES += libmuleappcore.a -else +noinst_LIBRARIES += libmuleappcore.a libmuleappgui.a libmuleappcommon.a +else if AMULE_DAEMON -noinst_LIBRARIES += libmuleappcore.a -endif -endif - -if MONOLITHIC -noinst_LIBRARIES += libmuleappgui.a -noinst_LIBRARIES += libmuleappcommon.a +noinst_LIBRARIES += libmuleappcore.a libmuleappcommon.a else if AMULE_GUI -noinst_LIBRARIES += libmuleappgui.a -noinst_LIBRARIES += libmuleappcommon.a -else -if AMULE_DAEMON -noinst_LIBRARIES += libmuleappcommon.a +noinst_LIBRARIES += libmuleappgui.a libmuleappcommon.a endif endif endif @@ -75,12 +71,7 @@ RandomFunctions.cpp \ kademlia/utils/UInt128.cpp -libmuleappcommon_a_CFLAGS = $(WXBASE_CFLAGS) -I$(srcdir)/libs -I$(srcdir)/include -libmuleappcommon_a_CXXFLAGS = $(WXBASE_CXXFLAGS) -I$(srcdir)/libs -I$(srcdir)/include -if ENABLE_UPNP -libmuleappcommon_a_CFLAGS += -DENABLE_UPNP=1 -libmuleappcommon_a_CXXFLAGS += -DENABLE_UPNP=1 -endif +libmuleappcommon_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS) # Common to core/monolithic @@ -90,18 +81,14 @@ DeadSourceList.cpp \ Scanner.cpp \ Parser.cpp \ - kademlia/utils/LittleEndian.cpp \ + PlatformSpecific.cpp \ + kademlia/kademlia/Entry.cpp \ kademlia/kademlia/SearchManager.cpp \ kademlia/routing/RoutingBin.cpp \ StateMachine.cpp \ ThreadScheduler.cpp -libmuleappcore_a_CFLAGS = $(WXBASE_CFLAGS) -I$(srcdir)/libs -I$(srcdir)/include -libmuleappcore_a_CXXFLAGS = $(WXBASE_CXXFLAGS) -I$(srcdir)/libs -I$(srcdir)/include -if ENABLE_UPNP -libmuleappcore_a_CFLAGS += -DENABLE_UPNP=1 -libmuleappcore_a_CXXFLAGS += -DENABLE_UPNP=1 -endif +libmuleappcore_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS) # Common to gui/monolithic @@ -123,12 +110,7 @@ MuleCollection.cpp \ muuli_wdr.cpp -libmuleappgui_a_CFLAGS = $(WX_CXXFLAGS) -I$(srcdir)/libs -I$(srcdir)/include -libmuleappgui_a_CXXFLAGS = $(WX_CXXFLAGS) -I$(srcdir)/libs -I$(srcdir)/include -if ENABLE_UPNP -libmuleappgui_a_CFLAGS += -DENABLE_UPNP=1 -libmuleappgui_a_CXXFLAGS += -DENABLE_UPNP=1 -endif +libmuleappgui_a_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(LIBUPNP_CPPFLAGS) core_sources = \ RC4Encrypt.cpp \ @@ -163,17 +145,19 @@ UploadBandwidthThrottler.cpp \ UploadClient.cpp \ UploadQueue.cpp \ + kademlia/kademlia/Indexed.cpp \ kademlia/kademlia/Kademlia.cpp \ + kademlia/kademlia/Prefs.cpp \ kademlia/kademlia/Search.cpp \ - kademlia/kademlia/Indexed.cpp \ + kademlia/kademlia/UDPFirewallTester.cpp \ kademlia/net/KademliaUDPListener.cpp \ - kademlia/kademlia/Prefs.cpp \ - kademlia/routing/RoutingZone.cpp \ - kademlia/routing/Contact.cpp + kademlia/net/PacketTracking.cpp \ + kademlia/routing/Contact.cpp \ + kademlia/routing/RoutingZone.cpp if ENABLE_UPNP core_sources += \ - UPnP.cpp \ + UPnPBase.cpp \ UPnPCompatibility.cpp endif @@ -227,35 +211,32 @@ StatTree.cpp \ SHAHashSet.cpp \ TerminationProcess.cpp \ + TerminationProcessAmuleweb.cpp \ UserEvents.cpp \ $(remote_common_sources) # Libs -core_libs = -L. -lmuleappcore -gui_libs = -L. -lmuleappgui $(X11LIBS) $(WX_LIBS) -remote_common_libs = -Llibs/common -Llibs/ec/cpp -lmulecommon -lec $(ZLIB_LIBS) $(RESOLV_LIB) $(BFD_LIB) -common_libs = -L. -lmuleappcommon $(remote_common_libs) $(CRYPTOLIBS) +core_libs = -L. -lmuleappcore $(LIBUPNP_LDFLAGS) $(LIBUPNP_LIBS) +gui_libs = -L. -lmuleappgui $(X11LIBS) $(WX_LIBS) $(GEOIP_LDFLAGS) $(GEOIP_LIBS) +remote_common_libs = -Llibs/common -Llibs/ec/cpp -lmulecommon -lec $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(RESOLV_LIB) $(BFD_LIBS) +common_libs = -L. -lmuleappcommon $(remote_common_libs) $(CRYPTOPP_LDFLAGS) $(CRYPTOPP_LIBS) core_deps = libmuleappcore.a gui_deps = libmuleappgui.a remote_common_deps = libs/common/libmulecommon.a libs/ec/cpp/libec.a common_deps = libmuleappcommon.a $(remote_common_deps) +if SYS_WIN32 +core_libs += -lshlwapi +endif + # # Flags # -core_flags = -if ENABLE_UPNP -core_flags += -DENABLE_UPNP=1 -endif - -gui_flags = $(WX_CXXFLAGS) $(XRCFLAGS) -if ENABLE_IP2COUNTRY -gui_flags += -DENABLE_IP2COUNTRY=1 -endif - -common_flags = -I$(srcdir)/libs -Ilibs -I$(srcdir)/include +core_flags = $(LIBUPNP_CPPFLAGS) $(LIBUPNP_CFLAGS) +gui_flags = $(WX_CPPFLAGS) $(GEOIP_CPPFLAGS) +common_flags = -I$(srcdir)/libs -Ilibs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) # --------- Apps --------- @@ -279,18 +260,18 @@ $(common_sources) amule_DEPENDENCIES = $(common_deps) $(core_deps) $(gui_deps) -amule_CFLAGS = $(core_flags) $(gui_flags) $(common_flags) -amule_CXXFLAGS = $(core_flags) $(gui_flags) $(common_flags) +amule_CPPFLAGS = $(AM_CPPFLAGS) $(core_flags) $(gui_flags) $(common_flags) +amule_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CPPFLAGS_ONLY) amule_LDADD = $(common_libs) $(core_libs) $(gui_libs) amulegui_DEPENDENCIES = $(common_deps) $(gui_deps) -amulegui_CFLAGS = $(gui_flags) $(common_flags) -DCLIENT_GUI -DEC_REMOTE -amulegui_CXXFLAGS = $(gui_flags) $(common_flags) -DCLIENT_GUI -DEC_REMOTE -amulegui_LDADD = $(gui_libs) $(common_libs) $(WXBASE_LIBS) +amulegui_CPPFLAGS = $(AM_CPPFLAGS) $(gui_flags) $(common_flags) -DCLIENT_GUI -DEC_REMOTE +amulegui_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY) +amulegui_LDADD = $(gui_libs) $(common_libs) $(WXBASE_LIBS) amuled_DEPENDENCIES = $(core_deps) $(common_deps) -amuled_CFLAGS = $(WXBASE_CFLAGS) $(core_flags) $(common_flags) -DAMULE_DAEMON -amuled_CXXFLAGS = $(WXBASE_CXXFLAGS) $(core_flags) $(common_flags) -DAMULE_DAEMON +amuled_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) $(core_flags) $(common_flags) -DAMULE_DAEMON +amuled_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY) amuled_LDADD = $(common_libs) $(core_libs) $(WXBASE_LIBS) ed2k_SOURCES = \ @@ -298,7 +279,7 @@ MagnetURI.cpp \ MuleCollection.cpp -ed2k_CPPFLAGS = -DUSE_STD_STRING +ed2k_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_STD_STRING # on Win32 if SYS_WIN32 @@ -306,7 +287,7 @@ endif # on Mac if NEED_CORESERVICES -ed2k_LDFLAGS = -framework CoreServices +ed2k_LDFLAGS = $(AM_LDFLAGS) -framework CoreServices endif amulecmd_SOURCES = \ @@ -315,15 +296,17 @@ $(remote_common_sources) amulecmd_DEPENDENCIES = $(remote_common_deps) -amulecmd_CFLAGS = $(WXBASE_CFLAGS) $(common_flags) -DEC_REMOTE -DECSOCKET_USE_EVENTS=0 -amulecmd_CXXFLAGS = $(WXBASE_CXXFLAGS) $(common_flags) -DEC_REMOTE -DECSOCKET_USE_EVENTS=0 +amulecmd_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) $(common_flags) -DEC_REMOTE -DECSOCKET_USE_EVENTS=0 +amulecmd_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY) #amulecmd_LDADD = $(WXBASE_LIBS) $(READLINE_LIBS) $(remote_common_libs) amulecmd_LDADD = -Llibs/common -Llibs/ec/cpp -lmulecommon -lec \ - $(WXBASE_LIBS) $(READLINE_LIBS) $(ZLIB_LIBS) \ - $(RESOLV_LIB) $(BFD_LIB) + $(WXBASE_LIBS) $(READLINE_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) \ + $(RESOLV_LIB) $(BFD_LIBS) noinst_HEADERS = \ AddFriend.h \ + AsyncDNS.h \ + amule-remote-gui.h \ amuleDlg.h \ amule.h \ amuleIPV4Address.h \ @@ -346,14 +329,16 @@ CommentDialogLst.h \ Constants.h \ CryptoPP_Inc.h \ + DataToText.h \ + DeadSourceList.h \ DirectoryTreeCtrl.h \ DownloadListCtrl.h \ DownloadQueue.h \ ED2KLink.h \ EditServerListDlg.h \ EMSocket.h \ - EncryptedDatagramSocket.cpp \ - EncryptedStreamSocket.cpp \ + EncryptedDatagramSocket.h \ + EncryptedStreamSocket.h \ ExternalConnector.h \ ExternalConn.h \ FileDetailDialog.h \ @@ -388,19 +373,27 @@ muuli_wdr.h \ NetworkFunctions.h \ OScopeCtrl.h \ + Observable.h \ + ObservableQueue.h \ OtherFunctions.h \ OtherStructs.h \ Packet.h \ + Parser.hpp \ PartFileConvert.h \ PartFile.h \ + PlatformSpecific.h \ Preferences.h \ PrefsUnifiedDlg.h \ Proxy.h \ RangeMap.h \ RC4Encrypt.h \ + RLE.h \ + RandomFunctions.h \ SafeFile.h \ + Scanner.h \ ScopedPtr.h \ SearchDlg.h \ + SearchExpr.h \ SearchFile.h \ SearchListCtrl.h \ SearchList.h \ @@ -422,17 +415,21 @@ StatTree.h \ Tag.h \ TerminationProcess.h \ + TerminationProcessAmuleweb.h \ TextClient.h \ ThreadScheduler.h \ ThreadTasks.h \ + ThrottledSocket.h \ Timer.h \ TransferWnd.h \ Types.h \ updownclient.h \ UploadBandwidthThrottler.h \ UploadQueue.h \ - UPnP.h \ - UserEvents.h + UPnPBase.h \ + UPnPCompatibility.h \ + UserEvents.h \ + extern/wxWidgets/listctrl.h MAINTAINERCLEANFILES = Makefile.in @@ -455,7 +452,7 @@ SUFFIXES = .rc .rc.$(OBJEXT): - $(RC) $(RCFLAGS) -I$(top_srcdir) -D__WIN95__ -D__WIN32__ -D__GNUWIN32__ -O COFF -i "$<" -o "$@" + $(RC) $(MULERCFLAGS) -I$(top_srcdir) $(RCFLAGS) -O COFF -i "$<" -o "$@" nodist_amuled_SOURCES = amuled-version.rc nodist_amulecmd_SOURCES = amulecmd-version.rc @@ -471,7 +468,7 @@ abs_builddir=`pwd` ; \ abs_top_srcdir=`cd $(top_srcdir) ; pwd` ; \ cd $( $(srcdir)/Scanner.h @NEED_RC_TRUE@.rc.$(OBJEXT): -@NEED_RC_TRUE@ $(RC) $(RCFLAGS) -I$(top_srcdir) -D__WIN95__ -D__WIN32__ -D__GNUWIN32__ -O COFF -i "$<" -o "$@" +@NEED_RC_TRUE@ $(RC) $(MULERCFLAGS) -I$(top_srcdir) $(RCFLAGS) -O COFF -i "$<" -o "$@" @NEED_RC_TRUE@amulerc.$(OBJEXT): $(srcdir)/../amule.rc amule-version.rc @NEED_RC_TRUE@ cat $^ | \ @@ -4759,7 +4921,7 @@ @NEED_RC_TRUE@ abs_builddir=`pwd` ; \ @NEED_RC_TRUE@ abs_top_srcdir=`cd $(top_srcdir) ; pwd` ; \ @NEED_RC_TRUE@ cd $( "$@" +dist-hook: + for d in $(EXTRA__DIST__SUBDIRS) ; do \ + mkdir $(distdir)/$$d ; \ + for f in `find $(srcdir)/$$d -name '.svn' -prune -o -printf "%P\n"` ; do \ + if test -d $(srcdir)/$$d/$$f ; then \ + mkdir $(distdir)/$$d/$$f ; \ + else \ + cp -p $(srcdir)/$$d/$$f $(distdir)/$$d/$$f ; \ + fi ; \ + done ; \ + done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -ruN -d amule-2.2.0~svn20080218/src/MuleCollection.cpp amule-2.2.2/src/MuleCollection.cpp --- amule-2.2.0~svn20080218/src/MuleCollection.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/MuleCollection.cpp 2008-04-01 15:55:21.000000000 +0000 @@ -353,13 +353,17 @@ std::string line; std::ifstream infile; - infile.open(File.c_str(), std::ifstream::in); + infile.open(File.c_str(), std::ifstream::in|std::ifstream::binary); if (!infile.is_open()) { return false; } - - while (getline(infile, line)) { - if(AddLink(line)) { + + while (getline(infile, line, (char)10 /* LF */)) { + int last = line.size()-1; + if ((1 < last) && ((char)13 /* CR */ == line.at(last))) { + line.erase(last); + } + if (AddLink(line)) { numLinks++; } } diff -ruN -d amule-2.2.0~svn20080218/src/MuleGifCtrl.cpp amule-2.2.2/src/MuleGifCtrl.cpp --- amule-2.2.0~svn20080218/src/MuleGifCtrl.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/MuleGifCtrl.cpp 2008-04-15 11:07:40.000000000 +0000 @@ -116,8 +116,11 @@ if (m_decoder && m_decoder->IsAnimation()) { m_timer.Stop(); m_decoder->GoLastFrame(); - +#if wxCHECK_VERSION(2, 9, 0) + wxTimerEvent evt(m_timer); +#else wxTimerEvent evt; +#endif OnTimer(evt); } } diff -ruN -d amule-2.2.0~svn20080218/src/MuleListCtrl.cpp amule-2.2.2/src/MuleListCtrl.cpp --- amule-2.2.0~svn20080218/src/MuleListCtrl.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/MuleListCtrl.cpp 2008-07-29 11:19:37.000000000 +0000 @@ -132,6 +132,21 @@ wxConfigBase* cfg = wxConfigBase::Get(); + // Set the column widths + wxString buffer; + if (cfg->Read( wxT("/eMule/TableWidths") + m_name, &buffer, wxEmptyString)) { + if (buffer.IsEmpty() || !(buffer[0] >= wxT('0') && buffer[0] <= wxT('9'))) { + // Unknown format, skip + return; + } + int counter = 0; + + wxStringTokenizer tokenizer( buffer, wxT(",") ); + while (tokenizer.HasMoreTokens() && (counter < GetColumnCount())) { + SetColumnWidth(counter++, StrToLong( tokenizer.GetNextToken())); + } + } + // Load sort order (including sort-column) m_sort_orders.clear(); wxString setting = cfg->Read(wxT("/eMule/TableOrdering") + m_name, wxEmptyString); @@ -168,17 +183,6 @@ // Re-enable sorting and resort the contents (if any). m_sort_func = sortFunc; SortList(); - - // Set the column widths - wxString buffer; - if (cfg->Read( wxT("/eMule/TableWidths") + m_name, &buffer, wxEmptyString)) { - int counter = 0; - - wxStringTokenizer tokenizer( buffer, wxT(",") ); - while (tokenizer.HasMoreTokens() && (counter < GetColumnCount())) { - SetColumnWidth(counter++, StrToLong( tokenizer.GetNextToken())); - } - } } diff -ruN -d amule-2.2.0~svn20080218/src/MuleTextCtrl.cpp amule-2.2.2/src/MuleTextCtrl.cpp --- amule-2.2.0~svn20080218/src/MuleTextCtrl.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/MuleTextCtrl.cpp 2008-04-04 14:13:04.000000000 +0000 @@ -97,7 +97,7 @@ wxTextDataObject data; wxTheClipboard->GetData( data ); - canpaste = data.GetTextLength(); + canpaste = (data.GetTextLength() > 0); } wxTheClipboard->Close(); } diff -ruN -d amule-2.2.0~svn20080218/src/MuleTrayIcon.cpp amule-2.2.2/src/MuleTrayIcon.cpp --- amule-2.2.0~svn20080218/src/MuleTrayIcon.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/MuleTrayIcon.cpp 2008-07-10 19:17:36.000000000 +0000 @@ -76,7 +76,7 @@ /****************************************************/ BEGIN_EVENT_TABLE(CMuleTrayIcon, wxTaskBarIcon) - EVT_TASKBAR_LEFT_DOWN(CMuleTrayIcon::SwitchShow) + EVT_TASKBAR_LEFT_DCLICK(CMuleTrayIcon::SwitchShow) EVT_MENU( TRAY_MENU_EXIT, CMuleTrayIcon::Close) EVT_MENU( TRAY_MENU_CONNECT, CMuleTrayIcon::ServerConnection) EVT_MENU( TRAY_MENU_DISCONNECT, CMuleTrayIcon::ServerConnection) @@ -161,17 +161,15 @@ void CMuleTrayIcon::ShowHide(wxCommandEvent& WXUNUSED(event)) { - if (theApp->amuledlg->IsShown()) { - theApp->amuledlg->Hide_aMule(); - } else { - theApp->amuledlg->Show_aMule(); - } + theApp->amuledlg->DoIconize(theApp->amuledlg->IsShown()); } void CMuleTrayIcon::Close(wxCommandEvent& WXUNUSED(event)) { - theApp->amuledlg->Close(); + if (theApp->amuledlg->IsEnabled()) { + theApp->amuledlg->Close(); + } } @@ -335,7 +333,7 @@ wxString label = MOD_VERSION_LONG; traymenu->Append(TRAY_MENU_INFO, label); traymenu->AppendSeparator(); - label = wxString(_("Speed Limits:")) + wxT(" "); + label = wxString(_("Speed limits:")) + wxT(" "); // Check for upload limits unsigned int max_upload = thePrefs::GetMaxUpload(); @@ -357,9 +355,9 @@ } traymenu->Append(TRAY_MENU_INFO, label); - label = wxString::Format(_("Download Speed: %.1f"), theStats::GetDownloadRate() / 1024.0); + label = wxString::Format(_("Download speed: %.1f"), theStats::GetDownloadRate() / 1024.0); traymenu->Append(TRAY_MENU_INFO, label); - label = wxString::Format(_("Upload Speed: %.1f"), theStats::GetUploadRate() / 1024.0); + label = wxString::Format(_("Upload speed: %.1f"), theStats::GetUploadRate() / 1024.0); traymenu->Append(TRAY_MENU_INFO, label); traymenu->AppendSeparator(); @@ -382,7 +380,7 @@ unsigned long id = theApp->GetED2KID(); temp += wxString::Format(wxT("%lu"), id); } else { - temp += _("Not Connected"); + temp += _("Not connected"); } ClientInfoMenu->Append(TRAY_MENU_CLIENTINFO_ITEM,temp); } @@ -396,7 +394,7 @@ temp_name += theApp->serverconnect->GetCurrentServer()->GetListName(); temp_ip += theApp->serverconnect->GetCurrentServer()->GetFullIP(); } else { - temp_name += _("Not Connected"); + temp_name += _("Not connected"); temp_ip += _("Not Connected"); } ClientInfoMenu->Append(TRAY_MENU_CLIENTINFO_ITEM,temp_name); @@ -414,9 +412,9 @@ { wxString temp; if (thePrefs::GetPort()) { - temp = CFormat(_("TCP Port: %d")) % thePrefs::GetPort(); + temp = CFormat(_("TCP port: %d")) % thePrefs::GetPort(); } else { - temp=_("TCP Port: Not Ready"); + temp=_("TCP port: Not ready"); } ClientInfoMenu->Append(TRAY_MENU_CLIENTINFO_ITEM,temp); } @@ -425,9 +423,9 @@ { wxString temp; if (thePrefs::GetEffectiveUDPPort()) { - temp = CFormat(_("UDP Port: %d")) % thePrefs::GetEffectiveUDPPort(); + temp = CFormat(_("UDP port: %d")) % thePrefs::GetEffectiveUDPPort(); } else { - temp=_("UDP Port: Not Ready"); + temp=_("UDP port: Not ready"); } ClientInfoMenu->Append(TRAY_MENU_CLIENTINFO_ITEM,temp); } @@ -452,13 +450,13 @@ // Number of shared files { - wxString temp = CFormat(_("Shared Files: %d")) % theStats::GetSharedFileCount(); + wxString temp = CFormat(_("Shared files: %d")) % theStats::GetSharedFileCount(); ClientInfoMenu->Append(TRAY_MENU_CLIENTINFO_ITEM,temp); } // Number of queued clients { - wxString temp = CFormat(_("Queued Clients: %d")) % theStats::GetWaitingUserCount(); + wxString temp = CFormat(_("Queued clients: %d")) % theStats::GetWaitingUserCount(); ClientInfoMenu->Append(TRAY_MENU_CLIENTINFO_ITEM,temp); } @@ -483,11 +481,11 @@ // Upload Speed sub-menu wxMenu* UploadSpeedMenu = new wxMenu(); - UploadSpeedMenu->SetTitle(_("Upload Limit")); + UploadSpeedMenu->SetTitle(_("Upload limit")); // Download Speed sub-menu wxMenu* DownloadSpeedMenu = new wxMenu(); - DownloadSpeedMenu->SetTitle(_("Download Limit")); + DownloadSpeedMenu->SetTitle(_("Download limit")); // Upload Speed sub-menu { @@ -562,11 +560,8 @@ return traymenu; } -void CMuleTrayIcon::SwitchShow(wxTaskBarIconEvent&) { - if ( theApp->amuledlg->IsShown() ) { - theApp->amuledlg->Hide_aMule(); - } else { - theApp->amuledlg->Show_aMule(); - } +void CMuleTrayIcon::SwitchShow(wxTaskBarIconEvent&) +{ + theApp->amuledlg->DoIconize(theApp->amuledlg->IsShown()); } // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/MuleUDPSocket.cpp amule-2.2.2/src/MuleUDPSocket.cpp --- amule-2.2.0~svn20080218/src/MuleUDPSocket.cpp 2008-02-10 18:59:50.000000000 +0000 +++ amule-2.2.2/src/MuleUDPSocket.cpp 2008-05-08 12:18:02.000000000 +0000 @@ -39,6 +39,9 @@ #include "UploadBandwidthThrottler.h" #include "EncryptedDatagramSocket.h" #include "OtherFunctions.h" +#include "kademlia/kademlia/Prefs.h" +#include "ClientList.h" + CMuleUDPSocket::CMuleUDPSocket(const wxString& name, int id, const amuleIPV4Address& address, const CProxyData* ProxyData) : @@ -158,28 +161,32 @@ lastError = m_socket->LastError(); } + const uint32 ip = StringIPtoUint32(addr.IPAddress()); + const uint16 port = addr.Service(); if (error) { - OnReceiveError(lastError, addr); + OnReceiveError(lastError, ip, port); } else if (length < 2) { // 2 bytes (protocol and opcode) is the smallets possible packet. AddDebugLogLineM(false, logMuleUDP, m_name + wxT(": Invalid Packet received")); - } else if (!StringIPtoUint32(addr.IPAddress())) { + } else if (!ip) { // wxASSERT(0); printf("Unknown ip receiving on UDP packet! Ignoring: '%s'\n", (const char*)unicode2char(addr.IPAddress())); - } else if (!addr.Service()) { + } else if (!port) { // wxASSERT(0); printf("Unknown port receiving an UDP packet! Ignoring\n"); + } else if (theApp->clientlist->IsBannedClient(ip)) { + AddDebugLogLineM(false, logMuleUDP, m_name + wxT(": Dropped packet from banned IP ") + addr.IPAddress()); } else { AddDebugLogLineM(false, logMuleUDP, (m_name + wxT(": Packet received (")) - << addr.IPAddress() << wxT(":") << addr.Service() << wxT("): ") + << addr.IPAddress() << wxT(":") << port << wxT("): ") << length << wxT("b")); - OnPacketReceived(addr, (byte*)buffer, length); + OnPacketReceived(ip, port, (byte*)buffer, length); } } -void CMuleUDPSocket::OnReceiveError(int errorCode, const wxIPV4address& WXUNUSED(addr)) +void CMuleUDPSocket::OnReceiveError(int errorCode, uint32 WXUNUSED(ip), uint16 WXUNUSED(port)) { AddDebugLogLineM(false, logMuleUDP, (m_name + wxT(": Error while reading: ")) << errorCode); } @@ -201,7 +208,7 @@ } -void CMuleUDPSocket::SendPacket(CPacket* packet, uint32 IP, uint16 port, bool bEncrypt, const uint8* pachTargetClientHashORKadID, bool bKad, uint16 nReceiverVerifyKey) +void CMuleUDPSocket::SendPacket(CPacket* packet, uint32 IP, uint16 port, bool bEncrypt, const uint8* pachTargetClientHashORKadID, bool bKad, uint32 nReceiverVerifyKey) { wxCHECK_RET(packet, wxT("Invalid packet.")); /*wxCHECK_RET(port, wxT("Invalid port.")); @@ -230,10 +237,10 @@ newpending.port = port; newpending.packet = packet; newpending.time = GetTickCount(); - newpending.bEncrypt = bEncrypt && pachTargetClientHashORKadID != NULL; + newpending.bEncrypt = bEncrypt && (pachTargetClientHashORKadID != NULL || (bKad && nReceiverVerifyKey != 0)); newpending.bKad = bKad; newpending.nReceiverVerifyKey = nReceiverVerifyKey; - if (newpending.bEncrypt) { + if (newpending.bEncrypt && pachTargetClientHashORKadID != NULL) { md4cpy(newpending.pachTargetClientHashORKadID, pachTargetClientHashORKadID); } else { md4clr(newpending.pachTargetClientHashORKadID); @@ -243,7 +250,7 @@ wxMutexLocker lock(m_mutex); m_queue.push_back(newpending); } - + theApp->uploadBandwidthThrottler->QueueForSendingControlPacket(this); } @@ -264,16 +271,23 @@ UDPPack item = m_queue.front(); CPacket* packet = item.packet; if (GetTickCount() - item.time < UDPMAXQUEUETIME) { - std::vector sendbuffer(packet->GetPacketSize() + 2); - STLCopy_n(packet->GetUDPHeader(), 2, sendbuffer.begin()); - STLCopy_n(packet->GetDataBuffer(), packet->GetPacketSize(), sendbuffer.begin() + 2); - - if (SendTo(&(sendbuffer[0]), packet->GetPacketSize() + 2, item.IP, item.port)) { - sentBytes += packet->GetPacketSize() + 2; + uint32_t len = packet->GetPacketSize() + 2; + uint8_t *sendbuffer = new uint8_t [len]; + memcpy(sendbuffer, packet->GetUDPHeader(), 2); + memcpy(sendbuffer + 2, packet->GetDataBuffer(), packet->GetPacketSize()); + + if (item.bEncrypt && (theApp->GetPublicIP() > 0 || item.bKad)) { + len = CEncryptedDatagramSocket::EncryptSendClient(&sendbuffer, len, item.pachTargetClientHashORKadID, item.bKad, item.nReceiverVerifyKey, (item.bKad ? Kademlia::CPrefs::GetUDPVerifyKey(item.IP) : 0)); + } + + if (SendTo(sendbuffer, len, item.IP, item.port)) { + sentBytes += len; m_queue.pop_front(); delete packet; + delete [] sendbuffer; } else { // TODO: Needs better error handling, see SentTo + delete [] sendbuffer; break; } } else { @@ -290,9 +304,9 @@ } -bool CMuleUDPSocket::SendTo(char* buffer, uint32 length, uint32 ip, uint16 port) +bool CMuleUDPSocket::SendTo(uint8_t *buffer, uint32_t length, uint32_t ip, uint16_t port) { - // Just pretend that we sent the packet in order to avoid infinete loops. + // Just pretend that we sent the packet in order to avoid infinite loops. if (!(m_socket && m_socket->Ok())) { return true; } @@ -302,7 +316,7 @@ addr.Service(port); // We better clear this flag here, status might have been changed - // between the U.B.T. adition and the real sending happening later + // between the U.B.T. addition and the real sending happening later m_busy = false; bool sent = false; m_socket->SendTo(addr, buffer, length); diff -ruN -d amule-2.2.0~svn20080218/src/MuleUDPSocket.h amule-2.2.2/src/MuleUDPSocket.h --- amule-2.2.0~svn20080218/src/MuleUDPSocket.h 2008-02-03 00:01:36.000000000 +0000 +++ amule-2.2.2/src/MuleUDPSocket.h 2008-05-08 12:18:02.000000000 +0000 @@ -90,7 +90,7 @@ /** This function is called by aMule when there are data to be received. */ virtual void OnReceive(int errorCode); /** This function is called by aMule when there is an error while receiving. */ - virtual void OnReceiveError(int errorCode, const wxIPV4address& addr); + virtual void OnReceiveError(int errorCode, uint32 ip, uint16 port); /** This function is called when the socket is lost (see comments in func.) */ virtual void OnDisconnected(int errorCode); @@ -108,7 +108,7 @@ * * Note that CMuleUDPSocket takes ownership of the packet. */ - void SendPacket(CPacket* packet, uint32 IP, uint16 port, bool bEncrypt, const uint8* pachTargetClientHashORKadID, bool bKad, uint16 nReceiverVerifyKey); + void SendPacket(CPacket* packet, uint32 IP, uint16 port, bool bEncrypt, const uint8* pachTargetClientHashORKadID, bool bKad, uint32 nReceiverVerifyKey); /** @@ -126,7 +126,7 @@ * @param buffer The data that has been received. * @param length The length of the data buffer. */ - virtual void OnPacketReceived(const wxIPV4address& addr, byte* buffer, size_t length) = 0; + virtual void OnPacketReceived(uint32 ip, uint16 port, byte* buffer, size_t length) = 0; /** See ThrottledControlSocket::SendControlData */ @@ -136,12 +136,12 @@ /** * Sends a packet to the specified address. * - * @param The data to be sent. + * @param buffer The data to be sent. * @param length the length of the data buffer. * @param ip The target ip address. * @param port The target port. */ - bool SendTo(char* buffer, uint32 length, uint32 ip, uint16 port); + bool SendTo(uint8_t *buffer, uint32_t length, uint32_t ip, uint16_t port); /** @@ -189,7 +189,7 @@ //! Is it a kad packet? bool bKad; // The verification key for RC4 encryption. - uint16 nReceiverVerifyKey; + uint32 nReceiverVerifyKey; // Client hash or kad ID. uint8 pachTargetClientHashORKadID[16]; } ; diff -ruN -d amule-2.2.0~svn20080218/src/NetworkFunctions.cpp amule-2.2.2/src/NetworkFunctions.cpp --- amule-2.2.0~svn20080218/src/NetworkFunctions.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/NetworkFunctions.cpp 2008-05-08 12:18:02.000000000 +0000 @@ -138,14 +138,14 @@ uint32 mask; }; -const int number_of_ranges = sizeof(ranges) / sizeof(IPRange); +const unsigned int number_of_ranges = sizeof(ranges) / sizeof(IPRange); static filter_st filters[number_of_ranges]; // This function is used to initialize the IP filter bool SetupFilter() { - for (int i = 0; i < number_of_ranges; ++i) { + for (unsigned int i = 0; i < number_of_ranges; ++i) { filters[i].addr = StringIPtoUint32( ranges[i].addr ); filters[i].mask = ~wxUINT32_SWAP_ALWAYS((1 << (32 - ranges[i].mask)) - 1); } @@ -160,7 +160,7 @@ bool IsGoodIP(uint32 IP, bool filterLAN) { - for (int i = 0; i < number_of_ranges; ++i) { + for (unsigned int i = 0; i < number_of_ranges; ++i) { if (((IP ^ filters[i].addr) & filters[i].mask) == 0) { if ( filterLAN || !ranges[i].isLAN ) { return false; @@ -170,4 +170,14 @@ return true; } + +bool IsLanIP(uint32_t ip) throw() +{ + for (unsigned int i = 0; i < number_of_ranges; i++) { + if (((ip ^ filters[i].addr) & filters[i].mask) == 0) { + return ranges[i].isLAN; + } + } + return false; +} // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/NetworkFunctions.h amule-2.2.2/src/NetworkFunctions.h --- amule-2.2.0~svn20080218/src/NetworkFunctions.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/NetworkFunctions.h 2008-05-08 12:18:02.000000000 +0000 @@ -112,5 +112,15 @@ return (id < HIGHEST_LOWID_ED2K_KAD); } +/** + * Checks for LAN IPs. + * + * @param ip The IP-address to check. + * @return True if it was a LAN IP, false otherwise. + * + * @note IP must be in anti-host order. + */ +bool IsLanIP(uint32_t ip) throw(); + #endif // NETWORK_FUNCTIONS_H // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/OScopeCtrl.cpp amule-2.2.2/src/OScopeCtrl.cpp --- amule-2.2.0~svn20080218/src/OScopeCtrl.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/OScopeCtrl.cpp 2008-03-31 14:27:50.000000000 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -35,17 +36,15 @@ #include "OScopeCtrl.h" // Interface declarations #include "OtherFunctions.h" // Needed for CastSecondsToHM + BEGIN_EVENT_TABLE(COScopeCtrl,wxControl) - EVT_PAINT(COScopeCtrl::OnPaint) - EVT_SIZE(COScopeCtrl::OnSize) - EVT_TIMER(TIMER_OSCOPE,COScopeCtrl::OnTimer) + EVT_PAINT(COScopeCtrl::OnPaint) + EVT_SIZE(COScopeCtrl::OnSize) + EVT_TIMER(TIMER_OSCOPE,COScopeCtrl::OnTimer) END_EVENT_TABLE() -COScopeCtrl::COScopeCtrl(int cntTrends, int nDecimals, StatsGraphType type, wxWindow*parent) - : wxControl(parent,-1, wxDefaultPosition, wxDefaultSize), timerRedraw(this, TIMER_OSCOPE) -{ -COLORREF crPreset [ 16 ] = { +const COLORREF crPreset [ 16 ] = { RGB( 0xFF, 0x00, 0x00 ), RGB( 0xFF, 0xC0, 0xC0 ), RGB( 0xFF, 0xFF, 0x00 ), RGB( 0xFF, 0xA0, 0x00 ), RGB( 0xA0, 0x60, 0x00 ), RGB( 0x00, 0xFF, 0x00 ), @@ -55,82 +54,58 @@ RGB( 0xFF, 0x00, 0xFF ), RGB( 0xA0, 0x00, 0xA0 ), RGB( 0xFF, 0xFF, 0xFF ), RGB( 0x80, 0x80, 0x80 ) }; + + +COScopeCtrl::COScopeCtrl(int cntTrends, int nDecimals, StatsGraphType type, wxWindow* parent) + : wxControl(parent, -1, wxDefaultPosition, wxDefaultSize) + , timerRedraw(this, TIMER_OSCOPE) +{ // since plotting is based on a LineTo for each new point // we need a starting point (i.e. a "previous" point) // use 0.0 as the default first point. // these are public member variables, and can be changed outside - // (after construction). + // (after construction). + // G.Hayduk: NTrends is the number of trends that will be drawn on // the plot. First 15 plots have predefined colors, but others will // be drawn with white, unless you call SetPlotColor nTrends = cntTrends; pdsTrends = new PlotData_t[nTrends]; - dcPlot=NULL; - dcGrid=NULL; - bmapPlot=NULL; - bmapGrid=NULL; - memDC = NULL; - memBitmap = NULL; - PlotData_t* ppds = pdsTrends; for(unsigned i=0; icrPlot = (i<15 ? crPreset[i] : RGB(255, 255, 255)); - ppds->penPlot=*(wxThePenList->FindOrCreatePen(wxColour(GetRValue(ppds->crPlot),GetGValue(ppds->crPlot),GetBValue(ppds->crPlot)),1,wxSOLID)); + ppds->penPlot=*(wxThePenList->FindOrCreatePen(WxColourFromCr(ppds->crPlot), 1, wxSOLID)); ppds->fPrev = ppds->fLowerLimit = ppds->fUpperLimit = 0.0; } - oldwidth=oldheight=0; bRecreateGraph = bRecreateGrid = bStopped = false; nDelayedPoints = 0; sLastTimestamp = 0.0; sLastPeriod = 1.0; nShiftPixels = 1; nYDecimals = nDecimals; - crBackground = RGB( 0, 0, 0) ; // see also SetBackgroundColor - crGrid = RGB( 0, 255, 255) ; // see also SetGridColor - brushBack=*(wxTheBrushList->FindOrCreateBrush(wxColour(GetRValue(crBackground),GetGValue(crBackground),GetBValue(crBackground)),wxSOLID)); + m_bgColour = wxColour( 0, 0, 0) ; // see also SetBackgroundColor + m_gridColour = wxColour( 0, 255, 255) ; // see also SetGridColor + brushBack=*(wxTheBrushList->FindOrCreateBrush(m_bgColour, wxSOLID)); strXUnits = wxT("X"); // can also be set with SetXUnits strYUnits = wxT("Y"); // can also be set with SetYUnits - bmapOldGrid = NULL ; - bmapOldPlot = NULL ; - nXGrids = 6; nYGrids = 5; graph_type = type; - timerRedraw.SetOwner(this); - // Ensure that various size-constraints are calculated (via OnSize). SetClientSize(GetClientSize()); -} // COScopeCtrl - +} COScopeCtrl::~COScopeCtrl() { - // just to be picky restore the bitmaps for the two memory dc's - // (these dc's are being destroyed so there shouldn't be any leaks) - if (bmapOldGrid != NULL) - dcGrid->SelectObject(wxNullBitmap); - if (bmapOldPlot != NULL) - dcPlot->SelectObject(wxNullBitmap); delete [] pdsTrends; - - if (memDC) { - memDC->SelectObject(wxNullBitmap); - } - - delete memDC; - delete dcGrid; - delete dcPlot; - if(bmapPlot) delete bmapPlot; - if(bmapGrid) delete bmapGrid; - if (memBitmap) delete memBitmap; -} // ~COScopeCtrl +} void COScopeCtrl::SetRange(float fLower, float fUpper, unsigned iTrend) @@ -140,31 +115,23 @@ return; ppds->fLowerLimit = fLower; ppds->fUpperLimit = fUpper; - ppds->fVertScale = (float)nPlotHeight / (fUpper-fLower); + ppds->fVertScale = (float)m_rectPlot.GetHeight() / (fUpper-fLower); ppds->yPrev = GetPlotY(ppds->fPrev, ppds); - if (iTrend==0) + + if (iTrend == 0) { InvalidateCtrl(); - else + } else { InvalidateGraph(); -} // SetRange + } +} void COScopeCtrl::SetRanges(float fLower, float fUpper) { - for(unsigned iTrend=0; iTrendcrPlot == cr) return; ppds->crPlot = cr; - ppds->penPlot=*(wxThePenList->FindOrCreatePen(wxColour(GetRValue(ppds->crPlot),GetGValue(ppds->crPlot),GetBValue(ppds->crPlot)),1,wxSOLID)); + ppds->penPlot=*(wxThePenList->FindOrCreatePen(WxColourFromCr(ppds->crPlot), 1, wxSOLID)); InvalidateGraph(); -} // SetPlotColor +} void COScopeCtrl::SetBackgroundColor(COLORREF cr) { - if (crBackground == cr) + wxColour newCol(WxColourFromCr(cr)); + if (m_bgColour == newCol) { return; - crBackground = cr; - brushBack=*(wxTheBrushList->FindOrCreateBrush(wxColour(GetRValue(crBackground),GetGValue(crBackground),GetBValue(crBackground)),wxSOLID)); + } + + m_bgColour = newCol; + brushBack= *(wxTheBrushList->FindOrCreateBrush(newCol, wxSOLID)); InvalidateCtrl() ; -} // SetBackgroundColor +} void COScopeCtrl::RecreateGrid() { - - if (!dcGrid) { - return; - } - // There is a lot of drawing going on here - particularly in terms of // drawing the grid. Don't panic, this is all being drawn (only once) // to a bitmap. The result is then BitBlt'd to the control whenever needed. bRecreateGrid = false; - if(nClientWidth==0 || nClientHeight==0) - return; - unsigned j, GridPos; + if (m_rectClient.GetWidth() == 0 || m_rectClient.GetHeight() == 0) { + return; + } + + wxMemoryDC dcGrid(m_bmapGrid); + int nCharacters ; - wxPen solidPen=*(wxThePenList->FindOrCreatePen(wxColour(GetRValue(crGrid),GetGValue(crGrid),GetBValue(crGrid)),1,wxSOLID)); + wxPen solidPen=*(wxThePenList->FindOrCreatePen(m_gridColour, 1, wxSOLID)); wxString strTemp; // fill the grid background - dcGrid->SetBrush(brushBack); - dcGrid->SetPen(*wxTRANSPARENT_PEN); - dcGrid->DrawRectangle(rectClient.left,rectClient.top,rectClient.right-rectClient.left, - rectClient.bottom-rectClient.top); + dcGrid.SetBrush(brushBack); + dcGrid.SetPen(*wxTRANSPARENT_PEN); + dcGrid.DrawRectangle(m_rectClient); // draw the plot rectangle: determine how wide the y axis scaling values are, // add the units digit, decimal point, one decimal place, and an extra space nCharacters = std::abs((int)std::log10(std::fabs(pdsTrends[0].fUpperLimit))) ; @@ -236,53 +206,37 @@ // adjust the plot rectangle dimensions // assume 6 pixels per character (this may need to be adjusted) - rectPlot.left = rectClient.left + 6*7+4; - nPlotWidth = rectPlot.right-rectPlot.left; + m_rectPlot.x = m_rectClient.GetLeft() + 6*7+4; // draw the plot rectangle - dcGrid->SetPen(solidPen); - dcGrid->DrawLine(rectPlot.left-1,rectPlot.top,rectPlot.right+1,rectPlot.top); - dcGrid->DrawLine(rectPlot.right+1,rectPlot.top,rectPlot.right+1,rectPlot.bottom+1); - dcGrid->DrawLine(rectPlot.right+1,rectPlot.bottom+1,rectPlot.left-1,rectPlot.bottom+1); - dcGrid->DrawLine(rectPlot.left-1,rectPlot.bottom+1,rectPlot.left-1,rectPlot.top); - dcGrid->SetPen(wxNullPen); - - // draw the dotted lines, - // G.Hayduk: added configurable number of grids - wxColour col(GetRValue(crGrid),GetGValue(crGrid),GetBValue(crGrid)); - wxPen grPen(col,1,wxSOLID); - dcGrid->SetPen(grPen); - - for(j=1; j<(nYGrids+1); ++j){ - GridPos = (rectPlot.bottom-rectPlot.top)*j/( nYGrids + 1 ) + rectPlot.top ; - for (unsigned int i = rectPlot.left; i < rectPlot.right; i += 4) - dcGrid->DrawPoint(i,GridPos); - } + dcGrid.SetPen(solidPen); + dcGrid.DrawRectangle(m_rectPlot.x - 1, m_rectPlot.y - 1, m_rectPlot.GetWidth() + 2, m_rectPlot.GetHeight() + 2); + dcGrid.SetPen(wxNullPen); // create some fonts (horizontal and vertical) - wxFont* axisFont = new wxFont(10,wxSWISS,wxNORMAL,wxNORMAL,FALSE); - dcGrid->SetFont(*axisFont);//,this); + wxFont axisFont(10, wxSWISS, wxNORMAL, wxNORMAL, false); + dcGrid.SetFont(axisFont); // y max - dcGrid->SetTextForeground(wxColour(GetRValue(crGrid),GetGValue(crGrid),GetBValue(crGrid))); + dcGrid.SetTextForeground(m_gridColour); if( strYMax.IsEmpty() ) { strTemp = wxString::Format(wxT("%.*f"), nYDecimals, pdsTrends[ 0 ].fUpperLimit); } else { strTemp = strYMax; } wxCoord sizX,sizY; - dcGrid->GetTextExtent(strTemp,&sizX,&sizY); - dcGrid->DrawText(strTemp,rectPlot.left-4-sizX,rectPlot.top-7); + dcGrid.GetTextExtent(strTemp,&sizX,&sizY); + dcGrid.DrawText(strTemp,m_rectPlot.GetLeft()-4-sizX,m_rectPlot.GetTop()-7); // y min if( strYMin.IsEmpty() ) { strTemp = wxString::Format(wxT("%.*f"), nYDecimals, pdsTrends[ 0 ].fLowerLimit) ; } else { strTemp = strYMin; } - dcGrid->GetTextExtent(strTemp,&sizX,&sizY); - dcGrid->DrawText(strTemp,rectPlot.left-4-sizX, rectPlot.bottom); + dcGrid.GetTextExtent(strTemp,&sizX,&sizY); + dcGrid.DrawText(strTemp,m_rectPlot.GetLeft()-4-sizX, m_rectPlot.GetBottom()); // x units - strTemp = CastSecondsToHM((nPlotWidth/nShiftPixels) * (int)floor(sLastPeriod+0.5)); + strTemp = CastSecondsToHM((m_rectPlot.GetWidth()/nShiftPixels) * (int)floor(sLastPeriod+0.5)); // floor(x + 0.5) is a way of doing round(x) that works with gcc < 3 ... if (bStopped) { strXUnits = CFormat( _("Disabled [%s]") ) % strTemp; @@ -290,221 +244,192 @@ strXUnits = strTemp; } - dcGrid->GetTextExtent(strXUnits,&sizX,&sizY); - dcGrid->DrawText(strXUnits,(rectPlot.left+rectPlot.right)/2-sizX/2,rectPlot.bottom+4); + dcGrid.GetTextExtent(strXUnits,&sizX,&sizY); + dcGrid.DrawText(strXUnits,(m_rectPlot.GetLeft() + m_rectPlot.GetRight())/2-sizX/2,m_rectPlot.GetBottom()+4); // y units if (!strYUnits.IsEmpty()) { - dcGrid->GetTextExtent(strYUnits,&sizX,&sizY); - dcGrid->DrawText(strYUnits, rectPlot.left-4-sizX, (rectPlot.top+rectPlot.bottom)/2-sizY/2); + dcGrid.GetTextExtent(strYUnits,&sizX,&sizY); + dcGrid.DrawText(strYUnits, m_rectPlot.GetLeft()-4-sizX, (m_rectPlot.GetTop()+m_rectPlot.GetBottom())/2-sizY/2); } -// if(!strYUnits.IsEmpty()) -// dcGrid->DrawRotatedText(strYUnits,(rectClient.left+rectPlot.left+4)/2/*+(sizY*2)*/, -// ((rectPlot.bottom+rectPlot.top)/2)+sizX/2,90.0); // no more drawing to this bitmap is needed until the setting are changed - - delete axisFont; - if (bRecreateGraph) + if (bRecreateGraph) { RecreateGraph(false); + } + // finally, force the plot area to redraw - wxRect rect; - rect.x=rectClient.left; - rect.y=rectClient.top; - rect.width=rectClient.right-rectClient.left; - rect.height=rectClient.bottom-rectClient.top; - Refresh(FALSE,&rect); -} // RecreateGrid + Refresh(false); +} void COScopeCtrl::AppendPoints(double sTimestamp, const std::vector &apf) { sLastTimestamp = sTimestamp; - ShiftGraph(1); - DrawPoints(apf, 1); - Refresh(FALSE); -} // AppendPoints + if (nDelayedPoints) { + // Ensures that delayed points get added before the new point. + // We do this by simply drawing the history up to and including + // the new point. + int n = std::min(m_rectPlot.GetWidth(), nDelayedPoints + 1); + nDelayedPoints = 0; + PlotHistory(n, true, false); + } else { + ShiftGraph(1); + DrawPoints(apf, 1); + } + + Refresh(false); +} -void COScopeCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) -{ // no real plotting work is performed here unless we are coming out of a hidden state; +void COScopeCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) +{ + // no real plotting work is performed here unless we are coming out of a hidden state; // normally, just putting the existing bitmaps on the client to avoid flicker, // establish a memory dc and then BitBlt it to the client if (bRecreateGrid || bRecreateGraph) { timerRedraw.Stop(); - if (bRecreateGrid) + + if (bRecreateGrid) { RecreateGrid(); // this will also recreate the graph if that flag is set - else if (bRecreateGraph) + } else if (bRecreateGraph) { RecreateGraph(true); + } } - if (nDelayedPoints>0) { // we've just come out of hiding, so catch up - int n = std::min(nPlotWidth, nDelayedPoints); + if (nDelayedPoints) { // we've just come out of hiding, so catch up + int n = std::min(m_rectPlot.GetWidth(), nDelayedPoints); nDelayedPoints = 0; // (this is more efficient than plotting in the PlotHistory(n, true, false); // background because the bitmap is shifted only } // once for all delayed points together) - wxPaintDC dc(this); - DoBlit(); - dc.Blit(0,0,nClientWidth,nClientHeight, memDC,0,0); - -} // OnPaint - -void COScopeCtrl::DoBlit() -{ - if (!memDC) { - wxASSERT(!memBitmap); - memBitmap = new wxBitmap(nClientWidth,nClientHeight); - memDC = new wxMemoryDC; - memDC->SelectObject(*memBitmap); - } else { - wxASSERT(memBitmap); - if ((memBitmap->GetHeight() != nClientHeight) - || (memBitmap->GetWidth() != nClientWidth)) { - // New bitmap. - memDC->SelectObject(wxNullBitmap); - delete memBitmap; - memBitmap = new wxBitmap(nClientWidth,nClientHeight); - memDC->SelectObject(*memBitmap); - } - } + wxBufferedPaintDC dc(this); - wxASSERT(memDC); - // We have assured that we have a valid and resized if needed // wxDc and bitmap. Proceed to blit. + dc.DrawBitmap(m_bmapGrid, 0, 0, false); - memDC->Blit(0,0,nClientWidth,nClientHeight,dcGrid,0,0); - // now add the plot on top as a "pattern" via SRCPAINT. - // works well with dark background and a light plot - memDC->Blit(0,0,nClientWidth,nClientHeight,dcPlot,0,0 -#ifndef __WXMAC__ - ,wxOR -#endif - ); - - // Ready. - + // Overwrites the plot section of the image + dc.DrawBitmap(m_bmapPlot, m_rectPlot.x, m_rectPlot.y, false); + + // draw the dotted lines. + // This is done last because wxMAC does't support the wxOR logical + // operation, preventing us from simply blitting the plot on top of + // the grid bitmap. + wxColour col(m_gridColour); + wxPen grPen(col, 1, wxLONG_DASH); + dc.SetPen(grPen); + for (unsigned j = 1; j < (nYGrids + 1); ++j) { + unsigned GridPos = (m_rectPlot.GetHeight())*j/( nYGrids + 1 ) + m_rectPlot.GetTop(); + + dc.DrawLine(m_rectPlot.GetLeft(), GridPos, m_rectPlot.GetRight(), GridPos); + } } -void COScopeCtrl::OnSize(wxSizeEvent& evt) +void COScopeCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) { // This gets called repeatedly as the user resizes the app; // we use the timer mechanism through InvalidateCtrl to avoid unnecessary redrawing // NOTE: OnSize automatically gets called during the setup of the control - if(oldwidth==evt.GetSize().GetWidth() && oldheight==evt.GetSize().GetHeight()) - return; - oldwidth=evt.GetSize().GetWidth(); - oldheight=evt.GetSize().GetHeight(); - wxRect myrect=GetClientRect(); - rectClient.left=myrect.x; - rectClient.top=myrect.y; - rectClient.right=myrect.x+myrect.width; - rectClient.bottom=myrect.y+myrect.height; - if(myrect.width<1 || myrect.height<1) + if(GetClientRect() == m_rectClient) { return; + } + + m_rectClient = GetClientRect(); + if (m_rectClient.GetWidth() < 1 || m_rectClient.GetHeight() < 1) { + return; + } - // set some member variables to avoid multiple function calls - nClientHeight = myrect.height; - nClientWidth = myrect.width; // the "left" coordinate and "width" will be modified in // InvalidateCtrl to be based on the y axis scaling - rectPlot.left = 20 ; - rectPlot.top = 10 ; - rectPlot.right = std::max(rectPlot.left+1, rectClient.right-10); - rectPlot.bottom = std::max(rectPlot.top+1, rectClient.bottom-25); - nPlotHeight = rectPlot.bottom-rectPlot.top; - nPlotWidth = rectPlot.right-rectPlot.left; + m_rectPlot.SetLeft(20); + m_rectPlot.SetTop(10); + m_rectPlot.SetRight(std::max(m_rectPlot.GetLeft() + 1, m_rectClient.GetRight() - 40)); + m_rectPlot.SetBottom(std::max(m_rectPlot.GetTop() + 1, m_rectClient.GetBottom() - 25)); + PlotData_t* ppds = pdsTrends; for(unsigned iTrend=0; iTrendfVertScale = (float)nPlotHeight / (ppds->fUpperLimit-ppds->fLowerLimit); + ppds->fVertScale = (float)m_rectPlot.GetHeight() / (ppds->fUpperLimit-ppds->fLowerLimit); ppds->yPrev = GetPlotY(ppds->fPrev, ppds); } - // destroy grid dc and bitmap (InvalidateCtrl recreates them in new size) - if(dcGrid) { - dcGrid->SelectObject(wxNullBitmap); - delete dcGrid; + if (!m_bmapGrid.IsOk() || (m_rectClient != wxSize(m_bmapGrid.GetWidth(), m_bmapGrid.GetHeight()))) { + m_bmapGrid.Create(m_rectClient.GetWidth(), m_rectClient.GetHeight()); } - dcGrid=new wxMemoryDC; - if(bmapGrid) - delete bmapGrid; - bmapGrid = new wxBitmap(nClientWidth,nClientHeight); - dcGrid->SelectObject(*bmapGrid); - - if(dcPlot) { - dcPlot->SelectObject(wxNullBitmap); - delete dcPlot; + if (!m_bmapPlot.IsOk() || (m_rectPlot != wxSize(m_bmapPlot.GetWidth(), m_bmapPlot.GetHeight()))) { + m_bmapPlot.Create(m_rectPlot.GetWidth(), m_rectPlot.GetHeight()); } - dcPlot=new wxMemoryDC; - if(bmapPlot) - delete bmapPlot; - bmapPlot = new wxBitmap(nClientWidth, nClientHeight); - dcPlot->SelectObject(*bmapPlot); InvalidateCtrl(); -} // OnSize +} void COScopeCtrl::ShiftGraph(unsigned cntPoints) { - if (dcPlot == NULL) - return; + wxMemoryDC dcPlot(m_bmapPlot); + unsigned cntPixelOffset = cntPoints*nShiftPixels; - if (cntPixelOffset >= (unsigned)nPlotWidth) - cntPixelOffset = nPlotWidth; - else - dcPlot->Blit(rectPlot.left,rectPlot.top+1, nPlotWidth, nPlotHeight, dcPlot, - rectPlot.left+cntPixelOffset, rectPlot.top+1); // scroll graph to the left - // clear a rectangle over the right side of plot prior to adding the new points - dcPlot->SetPen(*wxTRANSPARENT_PEN); - dcPlot->SetBrush(brushBack); // fill with background color - dcPlot->DrawRectangle(rectPlot.right-cntPixelOffset+1, rectPlot.top, - cntPixelOffset, rectPlot.bottom-rectPlot.top+1); -} // ShiftGraph + if (cntPixelOffset >= (unsigned)m_rectPlot.GetWidth()) { + cntPixelOffset = m_rectPlot.GetWidth(); + } else { + dcPlot.Blit(0, 0, m_rectPlot.GetWidth(), m_rectPlot.GetHeight(), &dcPlot, + cntPixelOffset, 0); // scroll graph to the left + } + // clear a rectangle over the right side of plot prior to adding the new points + dcPlot.SetPen(*wxTRANSPARENT_PEN); + dcPlot.SetBrush(brushBack); // fill with background color + dcPlot.DrawRectangle(m_rectPlot.GetWidth()-cntPixelOffset, 0, + cntPixelOffset, m_rectPlot.GetHeight()); +} unsigned COScopeCtrl::GetPlotY(float fPlot, PlotData_t* ppds) { - if (fPlot <= ppds->fLowerLimit) - return rectPlot.bottom; - else if (fPlot >= ppds->fUpperLimit) - return rectPlot.top+1; - else - return rectPlot.bottom - (unsigned)((fPlot - ppds->fLowerLimit) * ppds->fVertScale); -} // GetPlotY - + if (fPlot <= ppds->fLowerLimit) { + return m_rectPlot.GetBottom(); + } else if (fPlot >= ppds->fUpperLimit) { + return m_rectPlot.GetTop() + 1; + } else { + return m_rectPlot.GetBottom() - (unsigned)((fPlot - ppds->fLowerLimit) * ppds->fVertScale); + } +} void COScopeCtrl::DrawPoints(const std::vector &apf, unsigned cntPoints) -{ // this appends a new set of data points to a graph; all of the plotting is +{ + // this appends a new set of data points to a graph; all of the plotting is // directed to the memory based bitmap associated with dcPlot // the will subsequently be BitBlt'd to the client in OnPaint - if (dcPlot == NULL) { - printf("COScopeCtrl::DrawPoints - dcPlot==NULL unexpected\n"); - return; - } // draw the next line segement - unsigned x, y, yPrev; - unsigned cntPixelOffset = std::min((unsigned)(nPlotWidth-1), (cntPoints-1)*nShiftPixels); + unsigned y, yPrev; + unsigned cntPixelOffset = std::min((unsigned)(m_rectPlot.GetWidth()-1), (cntPoints-1)*nShiftPixels); PlotData_t* ppds = pdsTrends; + wxMemoryDC dcPlot(m_bmapPlot); + for (unsigned iTrend=0; iTrendyPrev; - dcPlot->SetPen(ppds->penPlot); - for (x=rectPlot.right-cntPixelOffset; x<=rectPlot.right; x+=nShiftPixels) { + dcPlot.SetPen(ppds->penPlot); + + for (int x = m_rectPlot.GetRight() - cntPixelOffset; x <= m_rectPlot.GetRight(); x+=nShiftPixels) { y = GetPlotY(*pf--, ppds); - dcPlot->DrawLine(x-nShiftPixels, yPrev, x, y); + + // Map onto the smaller bitmap + dcPlot.DrawLine(x - nShiftPixels - m_rectPlot.GetX(), + yPrev - m_rectPlot.GetY(), + x - m_rectPlot.GetX(), + y - m_rectPlot.GetY()); + yPrev = y; } ppds->fPrev = *(pf+1); ppds->yPrev = yPrev; } -} // DrawPoints +} #ifndef CLIENT_GUI @@ -533,7 +458,7 @@ } DrawPoints(apf, cntFilled); if (bRefresh) - Refresh(FALSE); + Refresh(false); } for (i = 0; i < nTrends; ++i) { delete [] apf[i]; @@ -550,7 +475,7 @@ } else { // No history (yet) for Kad. } -} // PlotHistory +} #else //#warning CORE/GUI -- EC needed void COScopeCtrl::PlotHistory(unsigned, bool, bool) @@ -563,12 +488,13 @@ { bRecreateGraph = false; nDelayedPoints = 0; - dcPlot->SetBrush(brushBack); - dcPlot->SetPen(*wxTRANSPARENT_PEN); - dcPlot->DrawRectangle(rectClient.left, rectClient.top, rectClient.right-rectClient.left, - rectClient.bottom-rectClient.top); - PlotHistory(nPlotWidth, false, bRefresh); -} // RecreateGraph + + wxMemoryDC dcPlot(m_bmapPlot); + dcPlot.SetBackground(brushBack); + dcPlot.Clear(); + + PlotHistory(m_rectPlot.GetWidth(), false, bRefresh); +} void COScopeCtrl::Reset(double sNewPeriod) @@ -579,7 +505,7 @@ sLastPeriod = sNewPeriod; InvalidateCtrl(); } -} // Reset +} void COScopeCtrl::Stop() @@ -587,19 +513,19 @@ bStopped = true; bRecreateGraph = false; RecreateGrid(); -} // Stop +} void COScopeCtrl::InvalidateCtrl(bool bInvalidateGraph, bool bInvalidateGrid) { timerRedraw.Stop(); - timerRedraw.SetOwner(this,TIMER_OSCOPE); - if (bInvalidateGraph) - bRecreateGraph = true; - if (bInvalidateGrid) - bRecreateGrid = true; + timerRedraw.SetOwner(this, TIMER_OSCOPE); + + bRecreateGraph |= bInvalidateGraph; + bRecreateGrid |= bInvalidateGrid; + timerRedraw.Start(100); -} // InvalidateCtrl +} void COScopeCtrl::OnTimer(wxTimerEvent& WXUNUSED(evt)) @@ -612,7 +538,7 @@ */ { if( !theApp->amuledlg || !theApp->amuledlg->SafeState()) { - return; + return; } timerRedraw.Stop(); if (bRecreateGrid) { @@ -620,6 +546,6 @@ } else if (bRecreateGraph) { RecreateGraph(true); } +} -} // OnTimer // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/OScopeCtrl.h amule-2.2.2/src/OScopeCtrl.h --- amule-2.2.0~svn20080218/src/OScopeCtrl.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/OScopeCtrl.h 2008-03-30 14:47:22.000000000 +0000 @@ -33,6 +33,7 @@ #include // Needed for wxControl #include // Needed for wxTimer #include +#include #include "Color.h" // Needed for COLORREF and RGB #include "Statistics.h" // Needed for StatsGraphType @@ -49,19 +50,16 @@ friend class CStatisticsDlg; public: - COScopeCtrl(int NTrends, int nDecimals, StatsGraphType type, wxWindow* parent=NULL); + COScopeCtrl(int NTrends, int nDecimals, StatsGraphType type, wxWindow* parent = NULL); ~COScopeCtrl(); void SetRange(float dLower, float dUpper, unsigned iTrend = 0); void SetRanges(float dLower, float dUpper); - void SetXUnits(const wxString& string, - const wxString& XMin = wxEmptyString, const wxString& XMax = wxEmptyString); void SetYUnits(const wxString& string, const wxString& YMin = wxEmptyString, const wxString& YMax = wxEmptyString); void SetBackgroundColor(COLORREF color); void SetGridColor(COLORREF color); void SetPlotColor(COLORREF color, unsigned iTrend = 0); - COLORREF GetPlotColor(unsigned iTrend = 0) {return pdsTrends[iTrend].crPlot;} float GetUpperLimit() { return pdsTrends[0].fUpperLimit; } void Reset(double sNewPeriod); void Stop(); @@ -69,10 +67,6 @@ void RecreateGrid(); void AppendPoints(double sTimestamp, const std::vector &apf); void DelayPoints() { nDelayedPoints++; } - unsigned GetPlotHeightPixels() { return nPlotHeight; } - unsigned GetPlotWidthPoints() { return nPlotWidth/nShiftPixels; } - wxBitmap* GetBitmapPlot() { return bmapPlot; } - wxBitmap* GetBitmapGrid() { return bmapGrid; } StatsGraphType graph_type; @@ -83,10 +77,10 @@ unsigned nShiftPixels; // amount to shift with each new point unsigned nYDecimals; - wxString strXUnits, strXMin, strXMax; + wxString strXUnits; wxString strYUnits, strYMin, strYMax; - COLORREF crBackground; - COLORREF crGrid; + wxColour m_bgColour; + wxColour m_gridColour; typedef struct PlotDataStruct { COLORREF crPlot; // data plot color @@ -103,28 +97,16 @@ DECLARE_EVENT_TABLE() PlotData_t *pdsTrends; - int nClientHeight; - int nClientWidth; - int nPlotHeight; - int nPlotWidth; - - RECT rectClient; - RECT rectPlot; - wxBrush brushBack; + wxRect m_rectClient; + wxRect m_rectPlot; + wxBrush brushBack; + wxBitmap m_bmapGrid; + wxBitmap m_bmapPlot; - wxMemoryDC* dcGrid; - wxMemoryDC* dcPlot; - wxMemoryDC* memDC; - wxBitmap* memBitmap; - wxBitmap* bmapOldGrid; - wxBitmap* bmapOldPlot; - wxBitmap* bmapGrid; - wxBitmap* bmapPlot; void InvalidateGraph() { InvalidateCtrl(true, false); } void InvalidateGrid() { InvalidateCtrl(false, true); } private: - int oldwidth, oldheight; bool bRecreateGrid, bRecreateGraph, bStopped; int nDelayedPoints; double sLastTimestamp; @@ -138,7 +120,6 @@ void DrawPoints(const std::vector &apf, unsigned cntPoints); unsigned GetPlotY(float fPlot, PlotData_t* ppds); void InvalidateCtrl(bool bInvalidateGraph = true, bool bInvalidateGrid = true); - void DoBlit(); }; #endif // OSCOPECTRL_H diff -ruN -d amule-2.2.0~svn20080218/src/ObservableQueue.h amule-2.2.2/src/ObservableQueue.h --- amule-2.2.0~svn20080218/src/ObservableQueue.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ObservableQueue.h 2008-04-04 14:13:04.000000000 +0000 @@ -215,7 +215,7 @@ /** * Overloaded notification function. */ - void ReceiveNotification( const ObservableType*, const EventType& e ); + virtual void ReceiveNotification( const ObservableType*, const EventType& e ); /** @@ -410,7 +410,7 @@ template bool CQueueObserver::IsActive() const { - return m_owner; + return (m_owner != NULL); } diff -ruN -d amule-2.2.0~svn20080218/src/OtherFunctions.cpp amule-2.2.2/src/OtherFunctions.cpp --- amule-2.2.0~svn20080218/src/OtherFunctions.cpp 2008-02-13 11:15:51.000000000 +0000 +++ amule-2.2.2/src/OtherFunctions.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -28,14 +28,9 @@ #include -#include #include // Needed for wxFileName #include // Needed for wxLogNull -#ifdef __WXMSW__ - #include // Do_not_auto_remove -#endif - #ifdef HAVE_CONFIG_H #include "config.h" // Needed for a number of defines #endif @@ -58,10 +53,6 @@ #include #endif -#if !defined(AMULE_DAEMON) && (!defined(EC_REMOTE) || defined(CLIENT_GUI)) -#include "amule.h" // Needed for theApp -#endif - wxString GetMuleVersion() { @@ -118,7 +109,7 @@ { if (count < 1024) - return wxString::Format( wxT("%.0f "), (float)(uint32)count) + _("bytes") ; + return wxString::Format( wxT("%.0f "), (float)(uint32)count) + wxPLURAL("byte", "bytes", count) ; else if (count < 1048576) return wxString::Format( wxT("%.0f "), (float)(uint32)count/1024) + _("kB") ; else if (count < 1073741824) @@ -128,7 +119,7 @@ else return wxString::Format( wxT("%.3f "), (float)count/1099511627776LL) + _("TB") ; - return _("Error"); + return _("ERROR"); } @@ -146,14 +137,14 @@ else if (count < 1000000000000000LL) return wxString::Format(wxT("%.2f"),(float)count/1000000000000LL) + _("T"); - return _("Error"); + return _("ERROR"); } wxString CastItoSpeed(uint32 bytes) { if (bytes < 1024) - return wxString::Format(wxT("%u "), bytes) + _("bytes/sec"); + return wxString::Format(wxT("%u "), bytes) + wxPLURAL("byte/sec", "bytes/sec", bytes); else if (bytes < 1048576) return wxString::Format(wxT("%.2f "), bytes / 1024.0) + _("kB/s"); else @@ -200,7 +191,7 @@ (count % 3600)/60) + _("hours"); } - return _("Error"); + return _("ERROR"); } @@ -292,44 +283,7 @@ } -// Get the max number of connections that the OS supports, or -1 for default -int GetMaxConnections() -{ - int maxconn = -1; -#ifdef __WXMSW__ - // Try to get the max connection value in the registry - wxRegKey key( wxT("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\VxD\\MSTCP\\MaxConnections") ); - wxString value; - if ( key.Exists() ) { - value = key.QueryDefaultValue(); - } - if ( !value.IsEmpty() && value.IsNumber() ) { - long mc; - value.ToLong(&mc); - maxconn = (int)mc; - } else { - switch (wxGetOsVersion()) { - case wxOS_WINDOWS_9X: - // This includes all Win9x versions - maxconn = 50; - break; - case wxOS_WINDOWS_NT: - // This includes NT based windows - maxconn = 500; - break; - default: - // Anything else. Let aMule decide... - break; - } - } -#else - // Any other OS can just use the default number of connections -#endif - return maxconn; -} - - -// Return the text assosiated with a rating of a file +// Return the text associated with a rating of a file wxString GetRateString(uint16 rate) { switch ( rate ) { @@ -1074,28 +1028,6 @@ } -void MilliSleep(uint32 msecs) -{ - #ifdef __WXBASE__ - #ifdef __WXMSW__ - if (msecs) { - wxSleep(msecs); - } - #else - struct timespec waittime; - waittime.tv_sec = 0; - waittime.tv_nsec = msecs * 1000 /*micro*/* 1000 /*nano*/; - struct timespec remtime; - while ((nanosleep(&waittime,&remtime)==-1) && (errno == EINTR)) { - memcpy(&waittime,&remtime,sizeof(struct timespec)); - } - #endif - #else - wxMilliSleep(msecs); - #endif -} - - wxString GetConfigDir() { // Cache the path. @@ -1147,9 +1079,8 @@ if (language != wxLANGUAGE_CUSTOM) { -#if defined(__WXMAC__) - wxStandardPathsBase &spb(wxStandardPaths::Get()); - locale.AddCatalogLookupPathPrefix(JoinPaths(spb.GetDataDir(), wxT("locale"))); +#if defined(__WXMAC__) || defined(__WXMSW__) + locale.AddCatalogLookupPathPrefix(JoinPaths(wxStandardPaths::Get().GetDataDir(), wxT("locale"))); #endif locale.AddCatalog(wxT(PACKAGE)); @@ -1218,24 +1149,4 @@ return password.Encode(); } -#if !defined(AMULE_DAEMON) && (!defined(EC_REMOTE) || defined(CLIENT_GUI)) - -bool IsLocaleAvailable(int id) -{ - // This supresses error-messages about invalid locales. - wxLogNull logTarget; - wxLocale locale_to_check; - - if (id == wxLANGUAGE_DEFAULT || id == theApp->m_locale.GetLanguage()) - return true; - - InitLocale(locale_to_check, id); - if (locale_to_check.IsOk()) { - return locale_to_check.IsLoaded(wxT(PACKAGE)); - } else { - return false; - } -} - -#endif /* !AMULE_DEAMON && (!EC_REMOTE || CLIENT_GUI) */ // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/OtherFunctions.h amule-2.2.2/src/OtherFunctions.h --- amule-2.2.0~svn20080218/src/OtherFunctions.h 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/OtherFunctions.h 2008-05-28 13:52:48.000000000 +0000 @@ -261,10 +261,7 @@ wxString GetFiletypeByName(const CPath& filename, bool translated = true); -// Returns the max number of connections the current OS can handle. -// Currently anything but windows will return the default value (-1); -int GetMaxConnections(); -// Returns the name assosiated with a category value. +// Returns the name associated with a category value. wxString GetCatTitle(int catid); /* Other */ @@ -352,8 +349,6 @@ #define IP_FROM_GUI_ID(x) (x >> 16) -void MilliSleep(uint32 msecs); - inline const long int make_full_ed2k_version(int a, int b, int c) { return ((a << 17) | (b << 10) | (c << 7)); @@ -376,14 +371,6 @@ void InitLocale(wxLocale& locale, int language); /** - * Returns true when the locale could be set, false otherwise. - * - * Currently it doesn't check if the catalog for the locale - * is installed, but I hope that's next. - */ -bool IsLocaleAvailable(int id); - -/** * Converts a string locale definition to a wxLANGUAGE id. */ int StrLang2wx(const wxString& language); diff -ruN -d amule-2.2.0~svn20080218/src/OtherStructs.h amule-2.2.2/src/OtherStructs.h --- amule-2.2.0~svn20080218/src/OtherStructs.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/OtherStructs.h 2008-04-04 13:42:07.000000000 +0000 @@ -26,6 +26,7 @@ #ifndef OTHERSTRUCTS_H #define OTHERSTRUCTS_H +#include // Defined in struct z_stream_s; @@ -144,5 +145,15 @@ __attribute__((__packed__)); #endif +struct Category_Struct +{ + CPath path; + wxString title; + wxString comment; + uint32 color; + uint8 prio; +}; + + #endif // OTHERSTRUCTS_H // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/PartFile.cpp amule-2.2.2/src/PartFile.cpp --- amule-2.2.0~svn20080218/src/PartFile.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/PartFile.cpp 2008-07-21 08:30:20.000000000 +0000 @@ -59,9 +59,10 @@ #include "Logger.h" #include // Needed for CFormat #include // Needed for GetLastModificationTime -#include "ThreadTasks.h" // Needed for CHashingTask/CCompletionTask +#include "ThreadTasks.h" // Needed for CHashingTask/CCompletionTask/CAllocateFileTask #include "GuiEvents.h" // Needed for Notify_* #include "DataToText.h" // Needed for OriginToText() +#include "PlatformSpecific.h" // Needed for CreateSparseFile() #include "kademlia/kademlia/Kademlia.h" #include "kademlia/kademlia/Search.h" @@ -259,6 +260,7 @@ void CPartFile::CreatePartFile() { +#ifndef CLIENT_GUI // use lowest free partfilenumber for free file (InterCeptor) int i = 0; do { @@ -277,29 +279,32 @@ m_gaplist.push_back(gap); CPath partPath = m_fullname.RemoveExt(); - if (m_hpartfile.Create(partPath, true)) { + bool fileCreated; + if (thePrefs::GetAllocFullFile()) { + fileCreated = m_hpartfile.Create(partPath.GetRaw(), true); m_hpartfile.Close(); - - if(!m_hpartfile.Open(partPath, CFile::read_write)) { - AddLogLineM(false,_("ERROR: Failed to open partfile)")); - SetPartFileStatus(PS_ERROR); - } } else { + fileCreated = PlatformSpecific::CreateSparseFile(partPath, GetFileSize()); + } + if (!fileCreated) { AddLogLineM(false,_("ERROR: Failed to create partfile)")); SetPartFileStatus(PS_ERROR); } SetFilePath(thePrefs::GetTempDir()); - if (thePrefs::GetAllocFullPart()) { - //#warning Code for full file alloc - should be done on thread. + if (thePrefs::GetAllocFullFile()) { + SetPartFileStatus(PS_ALLOCATING); + CThreadScheduler::AddTask(new CAllocateFileTask(this, thePrefs::AddNewFilesPaused())); + } else { + AllocationFinished(); } - - m_hashsetneeded = GetED2KPartHashCount(); + m_hashsetneeded = (GetED2KPartHashCount() > 0); SavePartFile(true); SetActive(theApp->IsConnected()); +#endif } @@ -326,13 +331,13 @@ try { CFile metFile(curMetFilename, CFile::read); if (!metFile.IsOpened()) { - AddLogLineM(false, CFormat( _("Error: Failed to open part.met file: %s ==> %s") ) + AddLogLineM(false, CFormat( _("ERROR: Failed to open part.met file: %s ==> %s") ) % curMetFilename % GetFileName() ); return false; } else if (metFile.GetLength() == 0) { - AddLogLineM(false, CFormat( _("Error: part.met file is 0 size: %s ==> %s") ) + AddLogLineM(false, CFormat( _("ERROR: part.met file is 0 size: %s ==> %s") ) % m_partmetfilename % GetFileName() ); @@ -343,7 +348,7 @@ if (version != PARTFILE_VERSION && version != PARTFILE_SPLITTEDVERSION && version != PARTFILE_VERSION_LARGEFILE){ metFile.Close(); //if (version == 83) return ImportShareazaTempFile(...) - AddLogLineM(false, CFormat( _("Error: Invalid part.met fileversion: %s ==> %s") ) + AddLogLineM(false, CFormat( _("ERROR: Invalid part.met fileversion: %s ==> %s") ) % m_partmetfilename % GetFileName() ); return false; @@ -439,7 +444,7 @@ break; } case FT_STATUS: { - m_paused = newtag.GetInt(); + m_paused = (newtag.GetInt() == 1); m_stopped = m_paused; break; } @@ -592,8 +597,8 @@ % m_partmetfilename % e.what() ); return false; - } catch (const CEOFException& e) { - AddLogLineM(true, CFormat( _("Error: %s (%s) is corrupt (wrong tagcount), unable to load file.") ) + } catch (const CEOFException& WXUNUSED(e)) { + AddLogLineM(true, CFormat( _("ERROR: %s (%s) is corrupt (wrong tagcount), unable to load file.") ) % m_partmetfilename % GetFileName() ); AddLogLineM(true, _("Trying to recover file info...")); @@ -700,7 +705,7 @@ // It's pointless to rehash an empty file, since the case // where a user has zero'd a file is handled above ... if (m_hpartfile.GetLength()) { - AddLogLineM(false, CFormat( _("Warning: %s might be corrupted (%i)") ) + AddLogLineM(false, CFormat( _("WARNING: %s might be corrupted (%i)") ) % partFilePath % (m_lastDateChanged - file_date) ); // rehash @@ -1016,13 +1021,14 @@ /* v2: Added to keep track of too old seeds */ file.WriteUInt32(wxDateTime::Now().GetTicks()); - AddLogLineM(false, CFormat( _("Saved %i sources seeds for partfile: %s (%s)") ) + AddLogLineM(false, CFormat( wxPLURAL("Saved %i source seed for partfile: %s (%s)", "Saved %i source seeds for partfile: %s (%s)", n_sources) ) % n_sources % m_fullname % GetFileName()); } catch (const CIOFailureException& e) { AddDebugLogLineM(true, logPartFile, CFormat( wxT("Error saving partfile's seeds file (%s - %s): %s") ) % m_partmetfilename + % GetFileName() % e.what() ); n_sources = 0; @@ -1125,7 +1131,12 @@ if (GetED2KPartHashCount() == 0){ if (IsComplete(0, GetFileSize()-1)){ if (result->GetFileHash() != GetFileHash()){ - AddLogLineM(false, CFormat( _("Found corrupted part (%d) in %d parts file %s - FileResultHash |%s| FileHash |%s|") ) + AddLogLineM(false, + CFormat(wxPLURAL( + "Found corrupted part (%d) in %d part file %s - FileResultHash |%s| FileHash |%s|", + "Found corrupted part (%d) in %d parts file %s - FileResultHash |%s| FileHash |%s|", + 0) + ) % 1 % 0 % GetFileName() @@ -1148,7 +1159,12 @@ if ( i < result->GetHashCount() ) wronghash = result->GetPartHash(i); - AddLogLineM(false, CFormat( _("Found corrupted part (%d) in %d parts file %s - FileResultHash |%s| FileHash |%s|") ) + AddLogLineM(false, + CFormat(wxPLURAL( + "Found corrupted part (%d) in %d part file %s - FileResultHash |%s| FileHash |%s|", + "Found corrupted part (%d) in %d parts file %s - FileResultHash |%s| FileHash |%s|", + GetED2KPartHashCount()) + ) % ( i + 1 ) % GetED2KPartHashCount() % GetFileName() @@ -1224,14 +1240,16 @@ m_gaplist.erase(it2); delete cur_gap; continue; - } else if (cur_gap->start >= start && cur_gap->start <= end) { - // a part of this gap is in the new gap - extend limit and delete + } else if (cur_gap->start >= start && cur_gap->start <= end + 1) { + // head of this gap is in the new gap, or this gap is + // directly behind the new gap - extend limit and delete end = cur_gap->end; m_gaplist.erase(it2); delete cur_gap; continue; - } else if (cur_gap->end <= end && cur_gap->end >= start) { - // a part of this gap is in the new gap - extend limit and delete + } else if (cur_gap->end <= end && cur_gap->end >= start - 1) { + // tail of this gap is in the new gap, or this gap is + // directly before the new gap - extend limit and delete start = cur_gap->start; m_gaplist.erase(it2); delete cur_gap; @@ -1239,13 +1257,18 @@ } else if (start >= cur_gap->start && end <= cur_gap->end){ // new gap is already inside this gap - return return; + // now all cases of overlap are ruled out + } else if (cur_gap->start > start) { + // this gap is the first behind the new gap -> insert before it + it = it2; + break; } } Gap_Struct* new_gap = new Gap_Struct; new_gap->start = start; new_gap->end = end; - m_gaplist.push_back(new_gap); + m_gaplist.insert(it, new_gap); UpdateDisplayedInfo(); } @@ -1692,7 +1715,7 @@ return true; } -void CPartFile::AddSources(CMemFile& sources,uint32 serverip, uint16 serverport, unsigned /*origin*/, bool bWithObfuscationAndHash) +void CPartFile::AddSources(CMemFile& sources,uint32 serverip, uint16 serverport, unsigned origin, bool bWithObfuscationAndHash) { uint8 count = sources.ReadUInt8(); uint8 debug_lowiddropped = 0; @@ -1744,10 +1767,10 @@ if(thePrefs::GetMaxSourcePerFile() > GetSourceCount()) { ++debug_possiblesources; CUpDownClient* newsource = new CUpDownClient(port,userid,serverip,serverport,this, true, true); - - newsource->SetCryptLayerSupport((byCryptOptions & 0x01) != 0); - newsource->SetCryptLayerRequest((byCryptOptions & 0x02) != 0); - newsource->SetCryptLayerRequires((byCryptOptions & 0x04) != 0); + + newsource->SetSourceFrom((ESourceFrom)origin); + newsource->SetConnectOptions(byCryptOptions, true, false); + if ((byCryptOptions & 0x80) != 0) { newsource->SetUserHash(achUserHash); } @@ -2216,7 +2239,7 @@ if (errorOccured) { m_paused = true; SetPartFileStatus(PS_ERROR); - AddLogLineM(true, CFormat( _("Unexpected file error while completing %s. File paused") )% GetFileName() ); + AddLogLineM(true, CFormat( _("Unexpected error while completing %s. File paused") )% GetFileName() ); } else { m_fullname = newname; @@ -2360,12 +2383,12 @@ { if ((GetHashCount() <= partnumber) && (GetPartCount() > 1)) { AddLogLineM(true, - CFormat( _("Warning: Unable to hash downloaded part - hashset incomplete for '%s'") ) + CFormat( _("WARNING: Unable to hash downloaded part - hashset incomplete for '%s'") ) % GetFileName() ); m_hashsetneeded = true; return true; } else if ((GetHashCount() <= partnumber) && GetPartCount() != 1) { - AddLogLineM(true, CFormat( _("Error: Unable to hash downloaded part - hashset incomplete (%s). This should never happen")) % GetFileName() ); + AddLogLineM(true, CFormat( _("ERROR: Unable to hash downloaded part - hashset incomplete (%s). This should never happen")) % GetFileName() ); m_hashsetneeded = true; return true; } else { @@ -2542,7 +2565,7 @@ } -bool CPartFile::CheckFreeDiskSpace( uint32 neededSpace ) +bool CPartFile::CheckFreeDiskSpace( uint64 neededSpace ) { uint64 free = CPath::GetFreeSpaceAt(GetFilePath()); if (free == static_cast(wxInvalidOffset)) { @@ -2616,7 +2639,7 @@ const BitVector& reqstatus = forClient->GetPartStatus(); bool KnowNeededParts = !reqstatus.empty(); //wxASSERT(rcvstatus.size() == GetPartCount()); // Obviously! - if (reqstatus.size() != GetPartCount()) { + if (KnowNeededParts && (reqstatus.size() != GetPartCount())) { // Yuck. Same file but different part count? Seriously fucked up. AddDebugLogLineM(false, logPartFile, wxString::Format(wxT("Impossible situation: different partcounts for the same part file: %i (client) and %i (file)"),reqstatus.size(),GetPartCount())); return NULL; @@ -2875,9 +2898,7 @@ } if (uPacketSXVersion >= 4) { - newsource->SetCryptLayerSupport((byCryptOptions & 0x01) != 0); - newsource->SetCryptLayerRequest((byCryptOptions & 0x02) != 0); - newsource->SetCryptLayerRequires((byCryptOptions & 0x04) != 0); + newsource->SetConnectOptions(byCryptOptions, true, false); } newsource->SetSourceFrom((ESourceFrom)nSourceFrom); @@ -2958,6 +2979,25 @@ return 0; } + // security sanitize check to make sure we do not write anything into an already hashed complete chunk + const uint64 nStartChunk = start / PARTSIZE; + const uint64 nEndChunk = end / PARTSIZE; + if (IsComplete(PARTSIZE * (uint64)nStartChunk, (PARTSIZE * (uint64)(nStartChunk + 1)) - 1)) { + AddDebugLogLineM(false, logPartFile, CFormat(wxT("Received data touches already hashed chunk - ignored (start): %u-%u; File=%s")) % start % end % GetFileName()); + return 0; + } else if (nStartChunk != nEndChunk) { + if (IsComplete(PARTSIZE * (uint64)nEndChunk, (PARTSIZE * (uint64)(nEndChunk + 1)) - 1)) { + AddDebugLogLineM(false, logPartFile, CFormat(wxT("Received data touches already hashed chunk - ignored (end): %u-%u; File=%s")) % start % end % GetFileName()); + return 0; + } +#ifdef __DEBUG__ + else { + AddDebugLogLineM(false, logPartFile, CFormat(wxT("Received data crosses chunk boundaries: %u-%u; File=%s")) % start % end % GetFileName()); + } +#endif + } + + // Create copy of data as new buffer byte *buffer = new byte[lenData]; memcpy(buffer, data, lenData); @@ -3218,6 +3258,9 @@ CUpDownClient* cur_src = *it; if (!cur_src->GetFileComment().IsEmpty()) { + if (thePrefs::IsCommentFiltered(cur_src->GetFileComment())) { + continue; + } m_hasComment = true; } @@ -3816,7 +3859,9 @@ wxString mybuffer; if ((status == PS_HASHING) || (status == PS_WAITINGFORHASH)) { - mybuffer=_("Hashing"); + mybuffer=_("Hashing"); + } else if (status == PS_ALLOCATING) { + mybuffer = _("Allocating"); } else { switch (GetStatus()) { case PS_COMPLETING: @@ -3832,7 +3877,7 @@ mybuffer=_("Erroneous"); break; case PS_INSUFFICIENT: - mybuffer = _("Insufficient Diskspace"); + mybuffer = _("Insufficient disk space"); break; default: if (GetTransferingSrcCount()>0) { @@ -3877,24 +3922,14 @@ } -wxString CPartFile::GetFeedback() +wxString CPartFile::GetFeedback() const { - wxString retval - = CFormat(wxT("Feedback from: %s (%s)\n")) % thePrefs::GetUserNick() % GetFullMuleVersion() - + CFormat(wxT("File name: %s\n")) % GetFileName() - + CFormat(wxT("File size: %s\n")) % CastItoXBytes(GetFileSize()); - - if (GetStatus() == PS_COMPLETE) { - retval += wxT("Downloaded: Complete\n"); - } else { - retval += CFormat(wxT("Downloaded: %s (%.2f%%)\n")) % CastItoXBytes(GetCompletedSize()) % GetPercentCompleted() - + CFormat(wxT("Transferred: %s (%s)\n")) % CastItoXBytes(statistic.GetTransferred()) % CastItoXBytes(statistic.GetAllTimeTransferred()) - + CFormat(wxT("Requested: %u (%u)\n")) % statistic.GetRequests() % statistic.GetAllTimeRequests() - + CFormat(wxT("Accepted: %d (%d)\n")) % statistic.GetAccepts() % statistic.GetAllTimeAccepts() - + CFormat(wxT("Sources: %u\n")) % GetSourceCount(); + wxString retval = CKnownFile::GetFeedback(); + if (GetStatus() != PS_COMPLETE) { + retval += wxString(_("Downloaded")) + wxT(": ") + CastItoXBytes(GetCompletedSize()) + wxString::Format(wxT(" (%.2f%%)\n"), GetPercentCompleted()) + + _("Sources") + CFormat(wxT(": %u\n")) % GetSourceCount(); } - - return retval + wxString::Format(wxT("Complete Sources: %u\n"), m_nCompleteSourcesCount); + return retval + _("Status") + wxT(": ") + getPartfileStatus() + wxT("\n"); } @@ -4121,5 +4156,13 @@ return NULL; } +void CPartFile::AllocationFinished() +{ + if (!m_hpartfile.Open(GetFullName().RemoveExt(), CFile::read_write)) { + AddLogLineM(false, CFormat(_("ERROR: Failed to open partfile '%s'")) % GetFullName()); + SetPartFileStatus(PS_ERROR); + } +} + #endif // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/PartFile.h amule-2.2.2/src/PartFile.h --- amule-2.2.0~svn20080218/src/PartFile.h 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/PartFile.h 2008-07-10 17:08:40.000000000 +0000 @@ -150,10 +150,10 @@ double GetPercentCompleted() const { return percentcompleted; } #ifndef CLIENT_GUI - uint16 GetSourceCount() const { return m_SrcList.size(); } - uint16 GetSrcA4AFCount() const { return m_A4AFsrclist.size(); } + uint16 GetSourceCount() const { return (uint16)m_SrcList.size(); } + uint16 GetSrcA4AFCount() const { return (uint16)m_A4AFsrclist.size(); } #else - uint16 m_source_count, m_a4af_source_count; + uint16 m_source_count, m_a4af_source_count; uint16 GetSourceCount() const { return m_source_count; } uint16 GetSrcA4AFCount() const { return m_a4af_source_count; } #endif @@ -164,7 +164,7 @@ uint64 GetNeededSpace(); - wxString GetFeedback(); + virtual wxString GetFeedback() const; wxString getPartfileStatus() const; //<<--9/21/02 sint32 getTimeRemaining() const; //<<--9/21/02 @@ -297,6 +297,7 @@ const FileRatingList &GetRatingAndComments(); + void AllocationFinished(); private: //! A local list of sources that are invalid for this file. #ifndef CLIENT_GUI @@ -317,7 +318,7 @@ void CreatePartFile(); void Init(); - bool CheckFreeDiskSpace( uint32 neededSpace = 0 ); + bool CheckFreeDiskSpace( uint64 neededSpace = 0 ); bool IsCorruptedPart(uint16 partnumber); @@ -399,7 +400,7 @@ void SetLocalSrcRequestQueued(bool value) { m_localSrcReqQueued = value; } void AddA4AFSource(CUpDownClient* src) { m_A4AFsrclist.insert(src); } - bool RemoveA4AFSource(CUpDownClient* src) { return m_A4AFsrclist.erase(src); } + bool RemoveA4AFSource(CUpDownClient* src) { return (m_A4AFsrclist.erase(src) > 0); } uint32 GetLastSearchTime() const { return m_lastsearchtime; } void SetLastSearchTime(uint32 time) { m_lastsearchtime = time; } diff -ruN -d amule-2.2.0~svn20080218/src/PartFileConvert.cpp amule-2.2.2/src/PartFileConvert.cpp --- amule-2.2.0~svn20080218/src/PartFileConvert.cpp 2008-02-14 13:41:29.000000000 +0000 +++ amule-2.2.2/src/PartFileConvert.cpp 2008-07-10 14:32:39.000000000 +0000 @@ -97,7 +97,7 @@ CDirIterator finder(folder); CPath file = finder.GetFirstFile(CDirIterator::File, wxT("*.part.met")); - while (!file.IsOk()) { + while (file.IsOk()) { ConvertToeMule(folder.JoinPaths(file), deletesource); file = finder.GetNextFile(); count++; @@ -112,7 +112,7 @@ */ file = finder.GetFirstFile(CDirIterator::Dir, wxT("*.*")); - while (!file.IsOk()) { + while (file.IsOk()) { ScanFolderToAdd(folder.JoinPaths(file), deletesource); file = finder.GetNextFile(); @@ -306,7 +306,7 @@ unsigned maxindex = 0; unsigned partfilecount = 0; CPath filePath = finder.GetFirstFile(CDirIterator::File, filepartindex + wxT(".*.part")); - while (!filePath.IsOk()) { + while (filePath.IsOk()) { long l; ++partfilecount; filePath.GetFullName().RemoveExt().GetExt().ToLong(&l); @@ -610,10 +610,10 @@ switch (ret) { case CONV_OK : return _("Completed"); case CONV_INPROGRESS : return _("In progress"); - case CONV_OUTOFDISKSPACE : return _("Error: Out of diskspace"); - case CONV_PARTMETNOTFOUND : return _("Error: Partmet not found"); - case CONV_IOERROR : return _("Error: IO error!"); - case CONV_FAILED : return _("Error: Failed!"); + case CONV_OUTOFDISKSPACE : return _("ERROR: Out of diskspace"); + case CONV_PARTMETNOTFOUND : return _("ERROR: Partmet not found"); + case CONV_IOERROR : return _("ERROR: IO error!"); + case CONV_FAILED : return _("ERROR: Failed!"); case CONV_QUEUE : return _("Queued"); case CONV_ALREADYEXISTS : return _("Already downloading"); case CONV_BADFORMAT : return _("Unknown or bad tempfile format."); @@ -633,7 +633,7 @@ #ifndef __WXMSW__ /* XPM */ -static char * convert_xpm[] = { +static const char * convert_xpm[] = { "16 16 9 1", " c None", ". c #B20000", diff -ruN -d amule-2.2.0~svn20080218/src/PlatformSpecific.cpp amule-2.2.2/src/PlatformSpecific.cpp --- amule-2.2.0~svn20080218/src/PlatformSpecific.cpp 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/src/PlatformSpecific.cpp 2008-07-29 11:27:11.000000000 +0000 @@ -0,0 +1,310 @@ +// +// This file is part of the aMule Project. +// +// Copyright (c) 2008 aMule Team ( admin@amule.org / http://www.amule.org ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + +#include "PlatformSpecific.h" + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +// NTFS Sparse Files (only for MSW) +#ifdef __WXMSW__ +#include "common/Format.h" +#include "Logger.h" +#include +#include +#ifndef FSCTL_SET_SPARSE +# define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) +#endif +#ifndef FSCTL_SET_ZERO_DATA +# define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA) +#endif + +// Create a message from a Windows error code +static wxString SystemError() +{ + WCHAR * lpMsgBuf = NULL; + + FormatMessageW( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError(), + 0, // Default language + (LPWSTR) &lpMsgBuf, + 0, + NULL + ); + + wxString ret(lpMsgBuf); + LocalFree(lpMsgBuf); + return ret; +} + +// Create a file in sparse mode +bool PlatformSpecific::CreateSparseFile(const CPath& name, uint64_t size) +{ + DWORD dwReturnedBytes=0; + + HANDLE hd = CreateFileW(name.GetRaw().c_str(), + GENERIC_READ | GENERIC_WRITE, + 0, // share - not shareable + NULL, // security - not inheritable + CREATE_ALWAYS, + FILE_ATTRIBUTE_ARCHIVE, + NULL); + if (hd == INVALID_HANDLE_VALUE) { + AddDebugLogLineM(true, logPartFile, CFormat(wxT("converting %s to sparse failed (OPEN): %s ")) % name % SystemError()); + return false; + } + + if (!DeviceIoControl(hd, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &dwReturnedBytes, NULL)) { + AddDebugLogLineM(true, logPartFile, CFormat(wxT("converting %s to sparse failed (SET_SPARSE): %s ")) % name % SystemError()); + } else { + // FILE_ZERO_DATA_INFORMATION is not defined here + struct { + uint64 FileOffset; + uint64 BeyondFinalZero; + } fzdi; + fzdi.FileOffset = 0; + fzdi.BeyondFinalZero = size; + LARGE_INTEGER largo; + largo.QuadPart = size; + + // zero the data + if (!DeviceIoControl(hd, FSCTL_SET_ZERO_DATA, (LPVOID) &fzdi, sizeof(fzdi), NULL, 0, &dwReturnedBytes, NULL)) { + AddDebugLogLineM(true, logPartFile, CFormat(wxT("converting %s to sparse failed (ZERO): %s")) % name % SystemError()); + } else if (!SetFilePointerEx(hd, largo, NULL, FILE_BEGIN) || !SetEndOfFile(hd)) { + AddDebugLogLineM(true, logPartFile, CFormat(wxT("converting %s to sparse failed (SEEK): %s")) % name % SystemError()); + } + } + CloseHandle(hd); + return true; +} + +#else // non Windows systems don't need all this +#include "CFile.h" + +bool PlatformSpecific::CreateSparseFile(const CPath& name, uint64_t WXUNUSED(size)) +{ + CFile f; + return f.Create(name.GetRaw(), true) && f.Close(); +} + +#endif + +#ifdef __WXMSW__ +#include +#include + +// Get the max number of connections that the OS supports, or -1 for default +int PlatformSpecific::GetMaxConnections() +{ + int maxconn = -1; + // Try to get the max connection value in the registry + wxRegKey key( wxT("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\VxD\\MSTCP\\MaxConnections") ); + wxString value; + if ( key.Exists() ) { + value = key.QueryDefaultValue(); + } + if ( !value.IsEmpty() && value.IsNumber() ) { + long mc; + value.ToLong(&mc); + maxconn = (int)mc; + } else { + switch (wxGetOsVersion()) { + case wxOS_WINDOWS_9X: + // This includes all Win9x versions + maxconn = 50; + break; + case wxOS_WINDOWS_NT: + // This includes NT based windows + maxconn = 500; + break; + default: + // Anything else. Let aMule decide... + break; + } + } + + return maxconn; +} +#endif + + +#ifdef __WXMSW__ +#include +#include + +static PlatformSpecific::EFSType doGetFilesystemType(const CPath& path) +{ + wxWritableWCharBuffer pathRaw(path.GetRaw()); + LPWSTR volume = pathRaw; + if (!PathStripToRootW(volume)) { + return PlatformSpecific::fsOther; + } + PathAddBackslashW(volume); + + DWORD maximumComponentLength = 0; + DWORD filesystemFlags = 0; + WCHAR filesystemNameBuffer[128]; + if (!GetVolumeInformationW(volume, NULL, 0, NULL, &maximumComponentLength, &filesystemFlags, filesystemNameBuffer, 128)) { + return PlatformSpecific::fsOther; + } + if (wxStrnicmp(filesystemNameBuffer, wxT("FAT"), 3) == 0) { + return PlatformSpecific::fsFAT; + } else if (wxStrcmp(filesystemNameBuffer, wxT("NTFS")) == 0) { + return PlatformSpecific::fsNTFS; + } + return PlatformSpecific::fsOther; +}; + +#elif defined(HAVE_GETMNTENT) && defined(HAVE_MNTENT_H) +#include +#include +#include +#ifndef _PATH_MOUNTED +# define _PATH_MOUNTED "/etc/mtab" +#endif +#include + +static PlatformSpecific::EFSType doGetFilesystemType(const CPath& path) +{ + struct mntent *entry = NULL; + PlatformSpecific::EFSType retval = PlatformSpecific::fsOther; + FILE *mnttab = fopen(_PATH_MOUNTED, "r"); + unsigned bestPrefixLen = 0; + + if (mnttab == NULL) { + return PlatformSpecific::fsOther; + } + + while ((entry = getmntent(mnttab)) != NULL) { + if (entry->mnt_dir) { + wxString dir = char2unicode(entry->mnt_dir); + if (dir == path.GetRaw().Mid(0, dir.Length())) { + if (dir.Length() >= bestPrefixLen) { + if (entry->mnt_type == NULL) { + break; + } else if (!strcmp(entry->mnt_type, "ntfs")) { + retval = PlatformSpecific::fsNTFS; + } else if (!strcmp(entry->mnt_type, "msdos") || + !strcmp(entry->mnt_type, "umsdos") || + !strcmp(entry->mnt_type, "vfat") || + !strncmp(entry->mnt_type, "fat", 3)) { + retval = PlatformSpecific::fsFAT; + } else if (!strcmp(entry->mnt_type, "hfs")) { + retval = PlatformSpecific::fsHFS; + } else if (!strcmp(entry->mnt_type, "hpfs")) { + retval = PlatformSpecific::fsHPFS; + } else if (!strcmp(entry->mnt_type, "minix")) { + retval = PlatformSpecific::fsMINIX; + } /* Add more filesystem types here */ + else if (dir.Length() > bestPrefixLen) { + retval = PlatformSpecific::fsOther; + } + bestPrefixLen = dir.Length(); + } + } + } + } + fclose(mnttab); + return retval; +} +#elif defined(HAVE_GETMNTENT) && defined(HAVE_SYS_MNTENT_H) && defined(HAVE_SYS_MNTTAB_H) +#include +#include +#include +#include +#ifndef MNTTAB +# define MNTTAB "/etc/mnttab" +#endif +#include + +static PlatformSpecific::EFSType doGetFilesystemType(const CPath& path) +{ + struct mnttab *entry = NULL; + PlatformSpecific::EFSType retval = PlatformSpecific::fsOther; + FILE *mnttab = fopen(MNTTAB, "r"); + unsigned bestPrefixLen = 0; + + if (mnttab == NULL) { + return PlatformSpecific::fsOther; + } + + while (getmntent(mnttab, entry) == 0) { + if (entry->mnt_mountp) { + wxString dir = char2unicode(entry->mnt_mountp); + if (dir == path.GetRaw().Mid(0, dir.Length())) { + if (dir.Length() >= bestPrefixLen) { + if (entry->mnt_fstype == NULL) { + break; + } else if (!strcmp(entry->mnt_fstype, MNTTYPE_PCFS)) { + retval = PlatformSpecific::fsFAT; + } else if (hasmntopt(entry, MNTOPT_NOLARGEFILES)) { + // MINIX is a file system that can handle special chars but has no large files. + retval = PlatformSpecific::fsMINIX; + } else if (dir.Length() > bestPrefixLen) { + retval = PlatformSpecific::fsOther; + } + bestPrefixLen = dir.Length(); + } + } + } + } + fclose(mnttab); + return retval; +} + +#else + +// No way to determine filesystem type, all restrictions apply. +static inline PlatformSpecific::EFSType doGetFilesystemType(const CPath& WXUNUSED(path)) +{ + return PlatformSpecific::fsOther; +} + +#endif + +#include +#include + +PlatformSpecific::EFSType PlatformSpecific::GetFilesystemType(const CPath& path) +{ + typedef std::map FSMap; + // Caching previous results, to speed up further checks. + static FSMap s_fscache; + // Lock used to ensure the integrity of the cache. + static wxMutex s_lock; + + wxCHECK_MSG(path.IsOk(), fsOther, wxT("Invalid path in GetFilesystemType()")); + + wxMutexLocker locker(s_lock); + + FSMap::iterator it = s_fscache.find(path.GetRaw()); + if (it != s_fscache.end()) { + return it->second; + } + + return s_fscache[path.GetRaw()] = doGetFilesystemType(path); +} diff -ruN -d amule-2.2.0~svn20080218/src/PlatformSpecific.h amule-2.2.2/src/PlatformSpecific.h --- amule-2.2.0~svn20080218/src/PlatformSpecific.h 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/src/PlatformSpecific.h 2008-06-05 13:57:58.000000000 +0000 @@ -0,0 +1,139 @@ +// +// This file is part of the aMule Project. +// +// Copyright (c) 2008 aMule Team ( admin@amule.org / http://www.amule.org ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + +#ifndef PLATFORMSPECIFIC_H +#define PLATFORMSPECIFIC_H + +#include +#include "Types.h" + + +namespace PlatformSpecific { + + +/** + * Create sparse file. + * + * This function will create the named file sparse if possible. + * + * @param name The file to be created (sparse if possible). + * @param size The desired size of the file. + * @return true, if creating the file succeeded, false otherwise. + */ +bool CreateSparseFile(const CPath& name, uint64_t size); + + +/** + * Returns the max number of connections the current OS can handle. + * + * Currently anything but windows will return the default value (-1); + */ +#ifdef __WXMSW__ +int GetMaxConnections(); +#else +inline int GetMaxConnections() { return -1; } +#endif + + +/** + * File system types returned by GetFilesystemType + */ +enum EFSType { + fsFAT, //! File Allocation Table + fsNTFS, //! New Technology File System + fsHFS, //! Hierarchical File System + fsHPFS, //! High Performace File System + fsMINIX, //! Minix file system + fsOther //! Unknown, other +}; + +/** + * Find out the filesystem type of the given path. + * + * @param path The path for which the filesystem type should be checked. + * @return The filesystem type of the given path. + * + * This function returns fsOther on unknown or network file systems (because the + * real filesystem type cannot be determined). + */ +EFSType GetFilesystemType(const CPath& path); + + +/** + * Checks if the filesystem can handle special chars. + * + * @param path The path for which the file system should be checked. + * @return true if the underlying filesystem can handle special chars. + * + * This function checks if the file system of the given path can handle + * special chars e.g. ':' in file names. This function will always return + * false on MSW, since Windows cannot handle those characters on any file system. + * + * Based on http://en.wikipedia.org/wiki/Comparison_of_file_systems + */ +#ifdef __WXMSW__ +inline bool CanFSHandleSpecialChars(const CPath& WXUNUSED(path)) { return false; } +#else +// Other filesystem types may be added +inline bool CanFSHandleSpecialChars(const CPath& path) +{ + switch (GetFilesystemType(path)) { + case fsFAT: + case fsHFS: + return false; + default: + return true; + } +} +#endif + + +/** + * Check if the filesystem can handle large files. + * + * @param path The path for which the filesystem should be checked. + * @return true if the underlying filesystem can handle large files. + * + * This function checks if the file system of the given path can handle + * large files (>4GB). + * + * Based on http://en.wikipedia.org/wiki/Comparison_of_file_systems + */ +inline bool CanFSHandleLargeFiles(const CPath& path) +{ + switch (GetFilesystemType(path)) { + case fsFAT: + case fsHFS: + case fsHPFS: + case fsMINIX: + return false; + default: + return true; + } +} + + +}; /* namespace PlatformSpecific */ + +#endif /* PLATFORMSPECIFIC_H */ diff -ruN -d amule-2.2.0~svn20080218/src/Preferences.cpp amule-2.2.2/src/Preferences.cpp --- amule-2.2.0~svn20080218/src/Preferences.cpp 2008-02-14 12:58:57.000000000 +0000 +++ amule-2.2.2/src/Preferences.cpp 2008-06-11 16:12:31.000000000 +0000 @@ -57,9 +57,12 @@ #endif #include "RandomFunctions.h" -#include "OtherFunctions.h" +#ifndef CLIENT_GUI +#include "PlatformSpecific.h" // Needed for PlatformSpecific::GetMaxConnections() +#endif #define DEFAULT_TCP_PORT 4662 +#define DEFAULT_UDP_PORT 4672 // Static variables COLORREF CPreferences::s_colors[cntStatColors]; @@ -139,19 +142,15 @@ bool CPreferences::s_bshowoverhead; bool CPreferences::s_bDAP; bool CPreferences::s_bUAP; -bool CPreferences::s_bDisableKnownClientList; -bool CPreferences::s_bDisableQueueList; bool CPreferences::s_ShowRatesOnTitle; wxString CPreferences::s_VideoPlayer; bool CPreferences::s_moviePreviewBackup; -bool CPreferences::s_indicateratings; bool CPreferences::s_showAllNotCats; bool CPreferences::s_msgonlyfriends; bool CPreferences::s_msgsecure; uint8 CPreferences::s_filterlevel; uint8 CPreferences::s_iFileBufferSize; uint8 CPreferences::s_iQueueSize; -uint16 CPreferences::s_maxmsgsessions; wxString CPreferences::s_datetimeformat; wxString CPreferences::s_sWebPassword; wxString CPreferences::s_sWebLowPassword; @@ -178,10 +177,9 @@ bool CPreferences::s_UseSrcSeeds; bool CPreferences::s_ProgBar; bool CPreferences::s_Percent; -bool CPreferences::s_SecIdent; +bool CPreferences::s_SecIdent; bool CPreferences::s_ExtractMetaData; -bool CPreferences::s_AllocFullPart; -bool CPreferences::s_AllocFullChunk; +bool CPreferences::s_allocFullFile; uint16 CPreferences::s_Browser; wxString CPreferences::s_CustomBrowser; bool CPreferences::s_BrowserTab; @@ -614,8 +612,9 @@ #ifndef AMULE_DAEMON typedef struct { - int id; - bool available; + int id; + bool available; + wxString displayname; wxString name; } LangInfo; @@ -626,52 +625,44 @@ * Add new languages here, as this list overrides the one defined in muuli.wdr */ static LangInfo aMuleLanguages[] = { - { wxLANGUAGE_DEFAULT, true, wxTRANSLATE("System default") }, - { wxLANGUAGE_ARABIC, true, wxTRANSLATE("Arabic") }, - { wxLANGUAGE_BASQUE, true, wxTRANSLATE("Basque") }, - { wxLANGUAGE_BULGARIAN, true, wxTRANSLATE("Bulgarian") }, - { wxLANGUAGE_CATALAN, true, wxTRANSLATE("Catalan") }, - { wxLANGUAGE_CHINESE_SIMPLIFIED, true, wxTRANSLATE("Chinese (Simplified)") }, - { wxLANGUAGE_CHINESE_TRADITIONAL, true, wxTRANSLATE("Chinese (Traditional)") }, - { wxLANGUAGE_CROATIAN, true, wxTRANSLATE("Croatian") }, - { wxLANGUAGE_CZECH, true, wxTRANSLATE("Czech") }, - { wxLANGUAGE_DANISH, true, wxTRANSLATE("Danish") }, - { wxLANGUAGE_DUTCH, true, wxTRANSLATE("Dutch") }, - { wxLANGUAGE_ENGLISH_UK, true, wxTRANSLATE("English (U.K.)") }, -// Unmaintained language file: en_US.po -// { wxLANGUAGE_ENGLISH_US, true, wxTRANSLATE("English (U.S.)") }, - { wxLANGUAGE_ESTONIAN, true, wxTRANSLATE("Estonian") }, - { wxLANGUAGE_FINNISH, true, wxTRANSLATE("Finnish") }, - { wxLANGUAGE_FRENCH, true, wxTRANSLATE("French") }, - { wxLANGUAGE_GALICIAN, true, wxTRANSLATE("Galician") }, - { wxLANGUAGE_GERMAN, true, wxTRANSLATE("German") }, - { wxLANGUAGE_GREEK, true, wxTRANSLATE("Greek") }, - { wxLANGUAGE_HUNGARIAN, true, wxTRANSLATE("Hungarian") }, - { wxLANGUAGE_ITALIAN, true, wxTRANSLATE("Italian") }, - { wxLANGUAGE_ITALIAN_SWISS, true, wxTRANSLATE("Italian (Swiss)") }, - { wxLANGUAGE_JAPANESE, true, wxTRANSLATE("Japanese") }, - { wxLANGUAGE_KOREAN, true, wxTRANSLATE("Korean") }, - { wxLANGUAGE_LITHUANIAN, true, wxTRANSLATE("Lithuanian") }, - { wxLANGUAGE_NORWEGIAN_NYNORSK, true, wxTRANSLATE("Norwegian (Nynorsk)") }, // nn_NO would be the full id - { wxLANGUAGE_POLISH, true, wxTRANSLATE("Polish") }, - { wxLANGUAGE_PORTUGUESE, true, wxTRANSLATE("Portuguese") }, - { wxLANGUAGE_PORTUGUESE_BRAZILIAN, true, wxTRANSLATE("Portuguese (Brazilian)") }, - { wxLANGUAGE_RUSSIAN, true, wxTRANSLATE("Russian") }, - { wxLANGUAGE_SLOVENIAN, true, wxTRANSLATE("Slovenian") }, - { wxLANGUAGE_SPANISH, true, wxTRANSLATE("Spanish") }, - { wxLANGUAGE_SWEDISH, true, wxTRANSLATE("Swedish") }, -// Unmaintained language file: es_MX.po -// { wxLANGUAGE_SPANISH_MEXICAN, true, wxTRANSLATE("Spanish (Mexican)") }, - { wxLANGUAGE_TURKISH, true, wxTRANSLATE("Turkish") }, -// Yet no real support for "custom" -// { wxLANGUAGE_CUSTOM, true, wxTRANSLATE("Custom") }, + { wxLANGUAGE_DEFAULT, true, wxEmptyString, wxTRANSLATE("System default") }, + { wxLANGUAGE_ALBANIAN, true, wxEmptyString, wxTRANSLATE("Albanian") }, + { wxLANGUAGE_ARABIC, true, wxEmptyString, wxTRANSLATE("Arabic") }, + { wxLANGUAGE_BASQUE, true, wxEmptyString, wxTRANSLATE("Basque") }, + { wxLANGUAGE_BULGARIAN, true, wxEmptyString, wxTRANSLATE("Bulgarian") }, + { wxLANGUAGE_CATALAN, true, wxEmptyString, wxTRANSLATE("Catalan") }, + { wxLANGUAGE_CHINESE_SIMPLIFIED, true, wxEmptyString, wxTRANSLATE("Chinese (Simplified)") }, + { wxLANGUAGE_CHINESE_TRADITIONAL, true, wxEmptyString, wxTRANSLATE("Chinese (Traditional)") }, + { wxLANGUAGE_CROATIAN, true, wxEmptyString, wxTRANSLATE("Croatian") }, + { wxLANGUAGE_CZECH, true, wxEmptyString, wxTRANSLATE("Czech") }, + { wxLANGUAGE_DANISH, true, wxEmptyString, wxTRANSLATE("Danish") }, + { wxLANGUAGE_DUTCH, true, wxEmptyString, wxTRANSLATE("Dutch") }, + { wxLANGUAGE_ENGLISH_UK, true, wxEmptyString, wxTRANSLATE("English (U.K.)") }, + { wxLANGUAGE_ESTONIAN, true, wxEmptyString, wxTRANSLATE("Estonian") }, + { wxLANGUAGE_FINNISH, true, wxEmptyString, wxTRANSLATE("Finnish") }, + { wxLANGUAGE_FRENCH, true, wxEmptyString, wxTRANSLATE("French") }, + { wxLANGUAGE_GALICIAN, true, wxEmptyString, wxTRANSLATE("Galician") }, + { wxLANGUAGE_GERMAN, true, wxEmptyString, wxTRANSLATE("German") }, + { wxLANGUAGE_GREEK, true, wxEmptyString, wxTRANSLATE("Greek") }, + { wxLANGUAGE_HEBREW, true, wxEmptyString, wxTRANSLATE("Hebrew") }, + { wxLANGUAGE_HUNGARIAN, true, wxEmptyString, wxTRANSLATE("Hungarian") }, + { wxLANGUAGE_ITALIAN, true, wxEmptyString, wxTRANSLATE("Italian") }, + { wxLANGUAGE_ITALIAN_SWISS, true, wxEmptyString, wxTRANSLATE("Italian (Swiss)") }, + { wxLANGUAGE_JAPANESE, true, wxEmptyString, wxTRANSLATE("Japanese") }, + { wxLANGUAGE_KOREAN, true, wxEmptyString, wxTRANSLATE("Korean") }, + { wxLANGUAGE_LITHUANIAN, true, wxEmptyString, wxTRANSLATE("Lithuanian") }, + { wxLANGUAGE_NORWEGIAN_NYNORSK, true, wxEmptyString, wxTRANSLATE("Norwegian (Nynorsk)") }, + { wxLANGUAGE_POLISH, true, wxEmptyString, wxTRANSLATE("Polish") }, + { wxLANGUAGE_PORTUGUESE, true, wxEmptyString, wxTRANSLATE("Portuguese") }, + { wxLANGUAGE_PORTUGUESE_BRAZILIAN, true, wxEmptyString, wxTRANSLATE("Portuguese (Brazilian)") }, + { wxLANGUAGE_RUSSIAN, true, wxEmptyString, wxTRANSLATE("Russian") }, + { wxLANGUAGE_SLOVENIAN, true, wxEmptyString, wxTRANSLATE("Slovenian") }, + { wxLANGUAGE_SPANISH, true, wxEmptyString, wxTRANSLATE("Spanish") }, + { wxLANGUAGE_SWEDISH, true, wxEmptyString, wxTRANSLATE("Swedish") }, + { wxLANGUAGE_TURKISH, true, wxEmptyString, wxTRANSLATE("Turkish") }, }; -bool TranslatedSort( const LangInfo& a, const LangInfo& b ) { - return wxStricmp( wxGetTranslation( a.name ), wxGetTranslation( b.name) ) < 0; -} - typedef Cfg_Int Cfg_PureInt; class Cfg_Lang : public Cfg_PureInt @@ -711,11 +702,6 @@ virtual bool TransferToWindow() { - // Sort the list after the current locale - std::sort( aMuleLanguages + 1, // Dont include DEFAULT - aMuleLanguages + itemsof(aMuleLanguages), - TranslatedSort ); - wxChoice *langSelector = dynamic_cast(m_widget); // clear existing list langSelector->Clear(); @@ -723,11 +709,26 @@ m_selection = 0; int wxId = StrLang2wx(thePrefs::GetLanguageID()); - // Add all other languages in alphabetical order - // and find the index of the selected language. + // Find available languages and translate them + aMuleLanguages[0].displayname = wxGetTranslation(aMuleLanguages[0].name); + for (unsigned int i = 1; i < itemsof(aMuleLanguages); ++i) + { + // This supresses error-messages about invalid locales. + wxLogNull logTarget; + wxLocale locale_to_check; + + InitLocale(locale_to_check, aMuleLanguages[i].id); + if (locale_to_check.IsOk() && locale_to_check.IsLoaded(wxT(PACKAGE))) { + aMuleLanguages[i].displayname = wxString(wxGetTranslation(aMuleLanguages[i].name)) + wxT(" [") + aMuleLanguages[i].name + wxT("]"); + } else { + aMuleLanguages[i].available = false; + } + } + + // Add all available languages and find the index of the selected language. for ( unsigned int i = 0, j = 0; i < itemsof(aMuleLanguages); i++) { - if ((aMuleLanguages[i].available = IsLocaleAvailable(aMuleLanguages[i].id)) == true) { - langSelector->Append( wxGetTranslation(aMuleLanguages[i].name) ); + if (aMuleLanguages[i].available) { + langSelector->Append(aMuleLanguages[i].displayname); if ( aMuleLanguages[i].id == wxId ) { m_selection = j; } @@ -928,10 +929,10 @@ #endif /** - * Misc + * Browser options **/ #ifdef __WXMAC__ - int browser = 8; // this is a "magic number" and will break if + int browser = 9; // this is a "magic number" and will break if // more browser choices are added in the interface, // but there isn't a symbolic name defined wxString customBrowser = wxT("/usr/bin/open"); @@ -940,9 +941,14 @@ wxString customBrowser; // left empty #endif - NewCfgItem(IDC_BROWSER, (MkCfg_Int( wxT("/FakeCheck/Browser"), s_Browser, browser ))); - NewCfgItem(IDC_BROWSERTABS, (new Cfg_Bool( wxT("/FakeCheck/BrowserTab"), s_BrowserTab, true ))); - NewCfgItem(IDC_BROWSERSELF, (new Cfg_Str( wxT("/FakeCheck/CustomBrowser"), s_CustomBrowser, customBrowser ))); + NewCfgItem(IDC_BROWSER, (MkCfg_Int( wxT("/Browser/DefaultBrowser"), s_Browser, browser ))); + NewCfgItem(IDC_BROWSERTABS, (new Cfg_Bool( wxT("/Browser/OpenPageInTab"), s_BrowserTab, true ))); + NewCfgItem(IDC_BROWSERSELF, (new Cfg_Str( wxT("/Browser/CustomBrowserString"), s_CustomBrowser, customBrowser ))); + + + /** + * Misc + **/ NewCfgItem(IDC_QUEUESIZE, (MkCfg_Int( wxT("/eMule/QueueSizePref"), s_iQueueSize, 50 ))); @@ -960,7 +966,7 @@ NewCfgItem(IDC_MAXDOWN, (MkCfg_Int( wxT("/eMule/MaxDownload"), s_maxdownload, 0 ))); NewCfgItem(IDC_SLOTALLOC, (MkCfg_Int( wxT("/eMule/SlotAllocation"), s_slotallocation, 2 ))); NewCfgItem(IDC_PORT, (MkCfg_Int( wxT("/eMule/Port"), s_port, DEFAULT_TCP_PORT ))); - NewCfgItem(IDC_UDPPORT, (MkCfg_Int( wxT("/eMule/UDPPort"), s_udpport, 4672 ))); + NewCfgItem(IDC_UDPPORT, (MkCfg_Int( wxT("/eMule/UDPPort"), s_udpport, DEFAULT_UDP_PORT ))); NewCfgItem(IDC_UDPDISABLE, (new Cfg_Bool( wxT("/eMule/UDPDisable"), s_UDPDisable, false ))); NewCfgItem(IDC_ADDRESS, (new Cfg_Str( wxT("/eMule/Address"), s_Addr, wxEmptyString))); NewCfgItem(IDC_AUTOCONNECT, (new Cfg_Bool( wxT("/eMule/Autoconnect"), s_autoconnect, true ))); @@ -985,13 +991,13 @@ * Servers **/ NewCfgItem(IDC_REMOVEDEAD, (new Cfg_Bool( wxT("/eMule/RemoveDeadServer"), s_deadserver, 1 ))); - NewCfgItem(IDC_SERVERRETRIES, (MkCfg_Int( wxT("/eMule/DeadServerRetry"), s_deadserverretries, 2 ))); + NewCfgItem(IDC_SERVERRETRIES, (MkCfg_Int( wxT("/eMule/DeadServerRetry"), s_deadserverretries, 3 ))); NewCfgItem(IDC_SERVERKEEPALIVE, (MkCfg_Int( wxT("/eMule/ServerKeepAliveTimeout"), s_dwServerKeepAliveTimeoutMins, 0 ))); NewCfgItem(IDC_RECONN, (new Cfg_Bool( wxT("/eMule/Reconnect"), s_reconnect, true ))); NewCfgItem(IDC_SCORE, (new Cfg_Bool( wxT("/eMule/Scoresystem"), s_scorsystem, true ))); NewCfgItem(IDC_AUTOSERVER, (new Cfg_Bool( wxT("/eMule/Serverlist"), s_autoserverlist, false ))); - NewCfgItem(IDC_UPDATESERVERCONNECT, (new Cfg_Bool( wxT("/eMule/AddServersFromServer"), s_addserversfromserver, true))); - NewCfgItem(IDC_UPDATESERVERCLIENT, (new Cfg_Bool( wxT("/eMule/AddServersFromClient"), s_addserversfromclient, true ))); + NewCfgItem(IDC_UPDATESERVERCONNECT, (new Cfg_Bool( wxT("/eMule/AddServerListFromServer"), s_addserversfromserver, false))); + NewCfgItem(IDC_UPDATESERVERCLIENT, (new Cfg_Bool( wxT("/eMule/AddServerListFromClient"), s_addserversfromclient, false ))); NewCfgItem(IDC_SAFESERVERCONNECT, (new Cfg_Bool( wxT("/eMule/SafeServerConnect"), s_safeServerConnect, false ))); NewCfgItem(IDC_AUTOCONNECTSTATICONLY, (new Cfg_Bool( wxT("/eMule/AutoConnectStaticOnly"), s_autoconnectstaticonly, false ))); NewCfgItem(IDC_UPNP_ENABLED, (new Cfg_Bool( wxT("/eMule/UPnPEnabled"), s_UPnPEnabled, false ))); @@ -1030,9 +1036,11 @@ NewCfgItem(IDC_FULLCHUNKTRANS, (new Cfg_Bool( wxT("/eMule/FullChunkTransfers"), s_btransferfullchunks, true ))); NewCfgItem(IDC_STARTNEXTFILE, (new Cfg_Bool( wxT("/eMule/StartNextFile"), s_bstartnextfile, false ))); NewCfgItem(IDC_STARTNEXTFILE_SAME, (new Cfg_Bool( wxT("/eMule/StartNextFileSameCat"), s_bstartnextfilesame, false ))); + NewCfgItem(IDC_SRCSEEDS, (new Cfg_Bool( wxT("/ExternalConnect/UseSrcSeeds"), s_UseSrcSeeds, false ))); NewCfgItem(IDC_FILEBUFFERSIZE, (MkCfg_Int( wxT("/eMule/FileBufferSizePref"), s_iFileBufferSize, 16 ))); NewCfgItem(IDC_DAP, (new Cfg_Bool( wxT("/eMule/DAPPref"), s_bDAP, true ))); NewCfgItem(IDC_UAP, (new Cfg_Bool( wxT("/eMule/UAPPref"), s_bUAP, true ))); + NewCfgItem(IDC_ALLOCFULLFILE, (new Cfg_Bool( wxT("/eMule/AllocateFullFile"), s_allocFullFile, false ))); /** * Web Server @@ -1066,7 +1074,7 @@ **/ NewCfgItem(IDC_ENABLETRAYICON, (new Cfg_Bool( wxT("/eMule/EnableTrayIcon"), s_trayiconenabled, false ))); NewCfgItem(IDC_MINTRAY, (new Cfg_Bool( wxT("/eMule/MinToTray"), s_mintotray, false ))); - NewCfgItem(IDC_EXIT, (new Cfg_Bool( wxT("/eMule/ConfirmExit"), s_confirmExit, false ))); + NewCfgItem(IDC_EXIT, (new Cfg_Bool( wxT("/eMule/ConfirmExit"), s_confirmExit, true ))); NewCfgItem(IDC_STARTMIN, (new Cfg_Bool( wxT("/eMule/StartupMinimized"), s_startMinimized, false ))); /** @@ -1075,10 +1083,10 @@ NewCfgItem(IDC_3DDEPTH, (MkCfg_Int( wxT("/eMule/3DDepth"), s_depth3D, 10 ))); NewCfgItem(IDC_TOOLTIPDELAY, (MkCfg_Int( wxT("/eMule/ToolTipDelay"), s_iToolDelayTime, 1 ))); NewCfgItem(IDC_SHOWOVERHEAD, (new Cfg_Bool( wxT("/eMule/ShowOverhead"), s_bshowoverhead, false ))); - NewCfgItem(IDC_EXTCATINFO, (new Cfg_Bool( wxT("/eMule/ShowInfoOnCatTabs"), s_showCatTabInfos, false ))); + NewCfgItem(IDC_EXTCATINFO, (new Cfg_Bool( wxT("/eMule/ShowInfoOnCatTabs"), s_showCatTabInfos, true ))); NewCfgItem(IDC_FED2KLH, (new Cfg_Bool( wxT("/Razor_Preferences/FastED2KLinksHandler"), s_FastED2KLinksHandler, true ))); NewCfgItem(IDC_PROGBAR, (new Cfg_Bool( wxT("/ExternalConnect/ShowProgressBar"), s_ProgBar, true ))); - NewCfgItem(IDC_PERCENT, (new Cfg_Bool( wxT("/ExternalConnect/ShowPercent"), s_Percent, false ))); + NewCfgItem(IDC_PERCENT, (new Cfg_Bool( wxT("/ExternalConnect/ShowPercent"), s_Percent, true ))); NewCfgItem(IDC_USESKINFILES, (new Cfg_Bool( wxT("/SkinGUIOptions/UseSkinFiles"), s_UseSkinFiles, false ))); NewCfgItem(IDC_SKIN, (new Cfg_Skin( wxT("/SkinGUIOptions/Skin"), s_Skin, wxEmptyString ))); NewCfgItem(IDC_SHOWRATEONTITLE, (new Cfg_Bool( wxT("/eMule/ShowRatesOnTitle"), s_ShowRatesOnTitle, false ))); @@ -1096,8 +1104,8 @@ **/ NewCfgItem(IDC_SLIDER, (MkCfg_Int( wxT("/eMule/StatGraphsInterval"), s_trafficOMeterInterval, 3 ))); NewCfgItem(IDC_SLIDER2, (MkCfg_Int( wxT("/eMule/statsInterval"), s_statsInterval, 30 ))); - NewCfgItem(IDC_DOWNLOAD_CAP, (MkCfg_Int( wxT("/eMule/DownloadCapacity"), s_maxGraphDownloadRate, 3 ))); - NewCfgItem(IDC_UPLOAD_CAP, (MkCfg_Int( wxT("/eMule/UploadCapacity"), s_maxGraphUploadRate, 3 ))); + NewCfgItem(IDC_DOWNLOAD_CAP, (MkCfg_Int( wxT("/eMule/DownloadCapacity"), s_maxGraphDownloadRate, 300 ))); + NewCfgItem(IDC_UPLOAD_CAP, (MkCfg_Int( wxT("/eMule/UploadCapacity"), s_maxGraphUploadRate, 100 ))); NewCfgItem(IDC_SLIDER3, (MkCfg_Int( wxT("/eMule/StatsAverageMinutes"), s_statsAverageMinutes, 5 ))); NewCfgItem(IDC_SLIDER4, (MkCfg_Int( wxT("/eMule/VariousStatisticsMaxValue"), s_statsMax, 100 ))); NewCfgItem(IDC_CLIENTVERSIONS, (MkCfg_Int( wxT("/Statistics/MaxClientVersions"), s_maxClientVersions, 0 ))); @@ -1119,7 +1127,7 @@ /** * Message Filter **/ - NewCfgItem(IDC_MSGFILTER, (new Cfg_Bool( wxT("/eMule/FilterMessages"), s_MustFilterMessages, false ))); + NewCfgItem(IDC_MSGFILTER, (new Cfg_Bool( wxT("/eMule/FilterMessages"), s_MustFilterMessages, true ))); NewCfgItem(IDC_MSGFILTER_ALL, (new Cfg_Bool( wxT("/eMule/FilterAllMessages"), s_FilterAllMessages, false ))); NewCfgItem(IDC_MSGFILTER_NONFRIENDS, (new Cfg_Bool( wxT("/eMule/MessagesFromFriendsOnly"), s_msgonlyfriends, false ))); NewCfgItem(IDC_MSGFILTER_NONSECURE, (new Cfg_Bool( wxT("/eMule/MessageFromValidSourcesOnly"), s_msgsecure, true ))); @@ -1142,7 +1150,7 @@ /** * Version check **/ - NewCfgItem(IDC_NEWVERSION, (new Cfg_Bool( wxT("/eMule/NewVersionCheck"), s_NewVersionCheck, false ))); + NewCfgItem(IDC_NEWVERSION, (new Cfg_Bool( wxT("/eMule/NewVersionCheck"), s_NewVersionCheck, true ))); /** * Obfuscation @@ -1165,16 +1173,12 @@ s_MiscList.push_back( new Cfg_Str( wxT("/eMule/YourHostname"), s_yourHostname, wxEmptyString ) ); s_MiscList.push_back( new Cfg_Str( wxT("/eMule/DateTimeFormat"), s_datetimeformat, wxT("%A, %x, %X") ) ); - s_MiscList.push_back( new Cfg_Bool( wxT("/eMule/IndicateRatings"), s_indicateratings, true ) ); s_MiscList.push_back( MkCfg_Int( wxT("/eMule/AllcatType"), s_allcatType, 0 ) ); s_MiscList.push_back( new Cfg_Bool( wxT("/eMule/ShowAllNotCats"), s_showAllNotCats, false ) ); - s_MiscList.push_back( new Cfg_Bool( wxT("/eMule/DisableKnownClientList"), s_bDisableKnownClientList, false ) ); - s_MiscList.push_back( new Cfg_Bool( wxT("/eMule/DisableQueueList"), s_bDisableQueueList, false ) ); - s_MiscList.push_back( MkCfg_Int( wxT("/eMule/MaxMessageSessions"), s_maxmsgsessions, 50 ) ); s_MiscList.push_back( MkCfg_Int( wxT("/eMule/SmartIdState"), s_smartidstate, 0 ) ); - s_MiscList.push_back( new Cfg_Bool( wxT("/eMule/DropSlowSources"), s_DropSlowSources, false ) ); + s_MiscList.push_back( new Cfg_Bool( wxT("/eMule/DropSlowSources"), s_DropSlowSources, false ) ); s_MiscList.push_back( new Cfg_Str( wxT("/eMule/KadNodesUrl"), s_KadURL, wxT("http://emule-inside.net/nodes.dat") ) ); s_MiscList.push_back( new Cfg_Str( wxT("/eMule/Ed2kServersUrl"), s_Ed2kURL, wxT("http://gruk.org/server.met.gz") ) ); @@ -1390,7 +1394,8 @@ int32 CPreferences::GetRecommendedMaxConnections() { - int iRealMax = ::GetMaxConnections(); +#ifndef CLIENT_GUI + int iRealMax = PlatformSpecific::GetMaxConnections(); if(iRealMax == -1 || iRealMax > 520) { return 500; } @@ -1401,6 +1406,9 @@ return iRealMax - 10; } return iRealMax - 20; +#else + return 500; +#endif } @@ -1437,7 +1445,7 @@ cfg->Write( wxT("Incoming"), CPath::ToUniv(m_CatList[i]->path) ); cfg->Write( wxT("Comment"), m_CatList[i]->comment ); cfg->Write( wxT("Color"), wxString::Format(wxT("%u"), m_CatList[i]->color) ); - cfg->Write( wxT("Priority"), m_CatList[i]->prio ); + cfg->Write( wxT("Priority"), (int)m_CatList[i]->prio ); } cfg->Flush(); @@ -1603,35 +1611,37 @@ #ifndef __WXMSW__ if( s_BrowserTab ) switch ( s_Browser ) { - case 0: cmd = wxT("kfmclient exec '%s'"); break; - case 1: cmd = wxT("sh -c \"if ! mozilla -remote 'openURL(%s, new-tab)'; then mozilla '%s'; fi\""); break; - case 2: cmd = wxT("sh -c \"if ! firefox -remote 'openURL(%s, new-tab)'; then firefox '%s'; fi\""); break; - case 3: cmd = wxT("sh -c \"if ! MozillaFirebird -remote 'openURL(%s, new-tab)'; then MozillaFirebird '%s'; fi\""); break; - case 4: cmd = wxT("opera --newpage '%s'"); break; - case 5: cmd = wxT("sh -c \"if ! netscape -remote 'openURLs(%s,new-tab)'; then netscape '%s'; fi\""); break; - case 6: cmd = wxT("galeon -n '%s'"); break; - case 7: cmd = wxT("epiphany -n '%s'"); break; - case 8: cmd = s_CustomBrowser; break; + case 0: cmd = wxEmptyString; break; + case 1: cmd = wxT("kfmclient exec '%s'"); break; + case 2: cmd = wxT("sh -c \"if ! mozilla -remote 'openURL(%s, new-tab)'; then mozilla '%s'; fi\""); break; + case 3: cmd = wxT("sh -c \"if ! firefox -remote 'openURL(%s, new-tab)'; then firefox '%s'; fi\""); break; + case 4: cmd = wxT("sh -c \"if ! MozillaFirebird -remote 'openURL(%s, new-tab)'; then MozillaFirebird '%s'; fi\""); break; + case 5: cmd = wxT("opera --newpage '%s'"); break; + case 6: cmd = wxT("sh -c \"if ! netscape -remote 'openURLs(%s,new-tab)'; then netscape '%s'; fi\""); break; + case 7: cmd = wxT("galeon -n '%s'"); break; + case 8: cmd = wxT("epiphany -n '%s'"); break; + case 9: cmd = s_CustomBrowser; break; default: AddLogLineM( true, _("Unable to determine selected browser!") ); } else switch ( s_Browser ) { - case 0: cmd = wxT("konqueror '%s'"); break; - case 1: cmd = wxT("sh -c 'mozilla %s'"); break; - case 2: cmd = wxT("firefox '%s'"); break; - case 3: cmd = wxT("MozillaFirebird '%s'"); break; - case 4: cmd = wxT("opera '%s'"); break; - case 5: cmd = wxT("netscape '%s'"); break; - case 6: cmd = wxT("galeon '%s'"); break; - case 7: cmd = wxT("epiphany '%s'"); break; - case 8: cmd = s_CustomBrowser; break; + case 0: cmd = wxEmptyString; break; + case 1: cmd = wxT("konqueror '%s'"); break; + case 2: cmd = wxT("sh -c 'mozilla %s'"); break; + case 3: cmd = wxT("firefox '%s'"); break; + case 4: cmd = wxT("MozillaFirebird '%s'"); break; + case 5: cmd = wxT("opera '%s'"); break; + case 6: cmd = wxT("netscape '%s'"); break; + case 7: cmd = wxT("galeon '%s'"); break; + case 8: cmd = wxT("epiphany '%s'"); break; + case 9: cmd = s_CustomBrowser; break; default: AddLogLineM( true, _("Unable to determine selected browser!") ); } #else switch ( s_Browser ) { - case 0: cmd = wxT(""); break; + case 0: cmd = wxEmptyString; break; case 1: cmd = s_CustomBrowser; break; default: AddLogLineM( true, _("Unable to determine selected browser!") ); @@ -1684,7 +1694,14 @@ wxArrayString lines = file.ReadLines(txtReadDefault, wxConvUTF8); for (size_t i = 0; i < lines.size(); ++i) { - shareddir_list.push_back(CPath::FromUniv(lines[i])); + CPath path = CPath::FromUniv(lines[i]); + + if (path.DirExists()) { + shareddir_list.push_back(path); + } else { + printf("Dropping non-existing shared directory: %s\n", + (const char*)unicode2char(path.GetRaw())); + } } } #endif diff -ruN -d amule-2.2.0~svn20080218/src/Preferences.h amule-2.2.2/src/Preferences.h --- amule-2.2.0~svn20080218/src/Preferences.h 2008-02-14 12:58:57.000000000 +0000 +++ amule-2.2.2/src/Preferences.h 2008-07-10 17:08:40.000000000 +0000 @@ -30,11 +30,11 @@ #include "Color.h" // Needed for COLORREF #include // Needed for wxArrayString -#include // Needed for CPath #include #include "Proxy.h" +#include "OtherStructs.h" class CPreferences; class wxConfigBase; @@ -47,16 +47,6 @@ vsfaNobody = 2 }; -struct Category_Struct -{ - CPath path; - wxString title; - wxString comment; - uint32 color; - uint8 prio; -}; - - /** * Base-class for automatically loading and saving of preferences. * @@ -206,6 +196,7 @@ static const CPath& GetTempDir() { return s_tempdir; } static void SetTempDir(const CPath& dir) { s_tempdir = dir; } static const CMD4Hash& GetUserHash() { return s_userhash; } + static void SetUserHash(const CMD4Hash& h) { s_userhash = h; } static uint16 GetMaxUpload() { return s_maxupload; } static uint16 GetSlotAllocation() { return s_slotallocation; } static bool IsICHEnabled() { return s_ICH; } @@ -217,6 +208,7 @@ static bool DoMinToTray() { return s_mintotray; } static void SetMinToTray(bool val) { s_mintotray = val; } static bool UseTrayIcon() { return s_trayiconenabled; } + static void SetUseTrayIcon(bool val) { s_trayiconenabled = val; } static bool DoAutoConnect() { return s_autoconnect; } static void SetAutoConnect(bool inautoconnect) {s_autoconnect = inautoconnect; } @@ -320,10 +312,12 @@ static bool IsCheckDiskspaceEnabled() { return s_checkDiskspace; } static void SetCheckDiskspaceEnabled(bool val) { s_checkDiskspace = val; } - static uint32 GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace; } - static void SetMinFreeDiskSpace(uint32 val) { s_uMinFreeDiskSpace = val; } + static uint32 GetMinFreeDiskSpaceMB() { return s_uMinFreeDiskSpace; } + static uint64 GetMinFreeDiskSpace() { return s_uMinFreeDiskSpace * 1048576ull; } + static void SetMinFreeDiskSpaceMB(uint32 val) { s_uMinFreeDiskSpace = val; } static const wxString& GetYourHostname() { return s_yourHostname; } + static void SetYourHostname(const wxString& s) { s_yourHostname = s; } static void SetMaxUpload(uint16 in); static void SetMaxDownload(uint16 in); @@ -442,10 +436,8 @@ static bool ShowProgBar() { return s_ProgBar; } static bool ShowPercent() { return s_Percent; } - static bool GetAllocFullPart() { return s_AllocFullPart; }; - static void SetAllocFullPart(bool val) { s_AllocFullPart = val; } - static bool GetAllocFullChunk() { return s_AllocFullChunk; }; - static void SetAllocFullChunk(bool val) { s_AllocFullChunk = val; } + static bool GetAllocFullFile() { return s_allocFullFile; }; + static void SetAllocFullFile(bool val) { s_allocFullFile = val; } static wxString GetBrowser(); @@ -528,16 +520,20 @@ static void SetEd2kServersUrl(const wxString& url) { s_Ed2kURL = url; } // Crypt - static bool IsClientCryptLayerSupported() { return s_IsClientCryptLayerSupported; } + static bool IsClientCryptLayerSupported() {return s_IsClientCryptLayerSupported;} static bool IsClientCryptLayerRequested() {return IsClientCryptLayerSupported() && s_bCryptLayerRequested;} - static bool IsClientCryptLayerRequired() { return s_IsClientCryptLayerRequired; } + static bool IsClientCryptLayerRequired() {return IsClientCryptLayerRequested() && s_IsClientCryptLayerRequired;} static bool IsClientCryptLayerRequiredStrict() {return false;} // not even incoming test connections will be answered static bool IsServerCryptLayerUDPEnabled() {return IsClientCryptLayerSupported();} static bool IsServerCryptLayerTCPRequested() {return IsClientCryptLayerRequested();} - static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();} - static uint32 GetKadUDPKey() {return s_dwKadUDPKey;} - static uint8 GetCryptTCPPaddingLength() { return s_byCryptTCPPaddingLength; } + static bool IsServerCryptLayerTCPRequired() {return IsClientCryptLayerRequired();} + static uint32 GetKadUDPKey() {return s_dwKadUDPKey;} + static uint8 GetCryptTCPPaddingLength() {return s_byCryptTCPPaddingLength;} + static void SetClientCryptLayerSupported(bool v) {s_IsClientCryptLayerSupported = v;} + static void SetClientCryptLayerRequested(bool v) {s_bCryptLayerRequested = v; } + static void SetClientCryptLayerRequired(bool v) {s_IsClientCryptLayerRequired = v;} + protected: static int32 GetRecommendedMaxConnections(); @@ -645,14 +641,11 @@ static bool s_bshowoverhead; static bool s_bDAP; static bool s_bUAP; - static bool s_bDisableKnownClientList; - static bool s_bDisableQueueList; static bool s_ShowRatesOnTitle; static wxString s_VideoPlayer; static bool s_moviePreviewBackup; - static bool s_indicateratings; static bool s_showAllNotCats; static bool s_msgonlyfriends; @@ -661,7 +654,6 @@ static uint8 s_iFileBufferSize; static uint8 s_iQueueSize; - static uint16 s_maxmsgsessions; static wxString s_datetimeformat; static bool s_ToolbarOrientation; @@ -712,8 +704,7 @@ static bool s_ExtractMetaData; - static bool s_AllocFullPart; - static bool s_AllocFullChunk; + static bool s_allocFullFile; static uint16 s_Browser; static wxString s_CustomBrowser; diff -ruN -d amule-2.2.0~svn20080218/src/PrefsUnifiedDlg.cpp amule-2.2.2/src/PrefsUnifiedDlg.cpp --- amule-2.2.0~svn20080218/src/PrefsUnifiedDlg.cpp 2008-02-12 19:28:43.000000000 +0000 +++ amule-2.2.2/src/PrefsUnifiedDlg.cpp 2008-08-01 16:55:09.000000000 +0000 @@ -81,16 +81,16 @@ EVT_CHECKBOX(IDC_FILTERCOMMENTS, PrefsUnifiedDlg::OnCheckBoxChange) EVT_CHECKBOX(IDC_STARTNEXTFILE, PrefsUnifiedDlg::OnCheckBoxChange) EVT_CHECKBOX(IDC_ENABLETRAYICON, PrefsUnifiedDlg::OnCheckBoxChange) - EVT_CHECKBOX(IDC_VERTTOOLBAR, PrefsUnifiedDlg::OnCheckBoxChange) + EVT_CHECKBOX(IDC_VERTTOOLBAR, PrefsUnifiedDlg::OnCheckBoxChange) + EVT_CHECKBOX(IDC_SUPPORT_PO, PrefsUnifiedDlg::OnCheckBoxChange) + EVT_CHECKBOX(IDC_ENABLE_PO_OUTGOING, PrefsUnifiedDlg::OnCheckBoxChange) + EVT_CHECKBOX(IDC_ENFORCE_PO_INCOMING, PrefsUnifiedDlg::OnCheckBoxChange) EVT_BUTTON(ID_PREFS_OK_TOP, PrefsUnifiedDlg::OnOk) - EVT_BUTTON(ID_OK, PrefsUnifiedDlg::OnOk) - EVT_BUTTON(ID_PREFS_CANCEL_TOP, PrefsUnifiedDlg::OnCancel) // Browse buttons // EVT_BUTTON(IDC_SELSKIN, PrefsUnifiedDlg::OnButtonDir) - EVT_BUTTON(IDC_BTN_BROWSE_WAV, PrefsUnifiedDlg::OnButtonBrowseWav) EVT_BUTTON(IDC_BROWSEV, PrefsUnifiedDlg::OnButtonBrowseApplication) EVT_BUTTON(IDC_SELTEMPDIR, PrefsUnifiedDlg::OnButtonDir) EVT_BUTTON(IDC_SELINCDIR, PrefsUnifiedDlg::OnButtonDir) @@ -127,6 +127,28 @@ /** + * Creates an command-event for the given checkbox. + * + * This can be used enforce logical constraints by passing by + * sending a check-box event for each checkbox, when transfering + * to the UI. However, it should also be used for checkboxes that + * have no side-effects other than enabling/disabling other + * widgets in the preferences dialogs. + */ +void SendCheckBoxEvent(wxWindow* parent, int id) +{ + wxCheckBox* widget = CastByID(id, parent, wxCheckBox); + wxCHECK_RET(widget, wxT("Invalid widget in CreateEvent")); + + wxCommandEvent evt(wxEVT_COMMAND_CHECKBOX_CLICKED, id); + evt.SetInt(widget->IsChecked() ? 1 : 0); + + parent->ProcessEvent(evt); +} + + + +/** * This struct provides a general way to represent config-tabs. */ struct PrefsPage @@ -155,8 +177,6 @@ { wxTRANSLATE("Directories"), PreferencesDirectoriesTab, 17, NULL }, { wxTRANSLATE("Statistics"), PreferencesStatisticsTab, 10, NULL }, { wxTRANSLATE("Security"), PreferencesSecurityTab, 22, NULL }, - //Notications are disabled since they havent been implemented - //{ wxTRANSLATE("Notifications"), PreferencesNotifyTab, 18, NULL }, { wxTRANSLATE("Gui Tweaks"), PreferencesGuiTweaksTab, 19, NULL }, { wxTRANSLATE("Core Tweaks"), PreferencesaMuleTweaksTab, 12, NULL }, { wxTRANSLATE("Events"), PreferencesEventsTab, 5, NULL } @@ -238,6 +258,16 @@ } list->SetColumnWidth(0, wxLIST_AUTOSIZE); } +#ifdef __DEBUG__ + else if (pages[i].m_function == PreferencesDebug) { + int count = CLogger::GetDebugCategoryCount(); + wxCheckListBox* list = CastChild( ID_DEBUGCATS, wxCheckListBox ); + + for ( int j = 0; j < count; j++ ) { + list->Append( CLogger::GetDebugCategory( j ).GetName() ); + } + } +#endif // Align and resize the page Fit(); @@ -292,6 +322,9 @@ #ifdef __WXMSW__ FindWindow(IDC_VERTTOOLBAR)->Enable(false); #endif + + // Position the dialog. + Center(); } @@ -381,19 +414,20 @@ } FindWindow(IDC_MSGWORD)->Enable(CastChild(IDC_MSGFILTER_WORD, wxCheckBox)->IsChecked()); - - FindWindow(IDC_COMMENTWORD)->Enable(CastChild(IDC_FILTERCOMMENTS, wxCheckBox)->IsChecked()); - - // Set debugging toggles + FindWindow(IDC_COMMENTWORD)->Enable(CastChild(IDC_FILTERCOMMENTS, wxCheckBox)->IsChecked()); + + // Protocol obfuscation + ::SendCheckBoxEvent(this, IDC_SUPPORT_PO); + ::SendCheckBoxEvent(this, IDC_ENABLE_PO_OUTGOING); + ::SendCheckBoxEvent(this, IDC_ENFORCE_PO_INCOMING); + #ifdef __DEBUG__ + // Set debugging toggles int count = CLogger::GetDebugCategoryCount(); wxCheckListBox* list = CastChild( ID_DEBUGCATS, wxCheckListBox ); for ( int i = 0; i < count; i++ ) { - const CDebugCategory& cat = CLogger::GetDebugCategory( i ); - - list->Append( cat.GetName() ); - list->Check( i, cat.IsEnabled() ); + list->Check( i, CLogger::GetDebugCategory( i ).IsEnabled() ); } #endif @@ -425,15 +459,13 @@ theApp->amuledlg->m_kademliawnd->SetGraphColors(); } - // Get debugging toggles #ifdef __DEBUG__ + // Get debugging toggles int count = CLogger::GetDebugCategoryCount(); wxCheckListBox* list = CastChild( ID_DEBUGCATS, wxCheckListBox ); for ( int i = 0; i < count; i++ ) { - const CDebugCategory& cat = CLogger::GetDebugCategory( i ); - - CLogger::SetEnabled( cat.GetType(), list->IsChecked( i ) ); + CLogger::SetEnabled( CLogger::GetDebugCategory( i ).GetType(), list->IsChecked( i ) ); } #endif @@ -484,7 +516,7 @@ if ((CPath::GetFileSize(theApp->ConfigDir + wxT("addresses.dat")) == 0) && CastChild(IDC_AUTOSERVER, wxCheckBox)->IsChecked() ) { thePrefs::UnsetAutoServerStart(); - wxMessageBox(wxString::wxString( _("Your Auto-update servers list is in blank.\n'Auto-update serverlist at startup' will be disabled.")), + wxMessageBox(wxString::wxString( _("Your Auto-update server list is empty.\n'Auto-update server list at startup will be disabled.")), _("Message"), wxOK | wxICON_INFORMATION, this); } @@ -575,7 +607,7 @@ if (!thePrefs::GetNetworkED2K() && !thePrefs::GetNetworkKademlia()) { wxMessageBox(wxString::wxString( - _("Both ED2K and Kad network are disabled.\nYou won't be able to connect until you enable at least one of them."))); + _("Both eD2k and Kad network are disabled.\nYou won't be able to connect until you enable at least one of them."))); } if (thePrefs::GetNetworkKademlia() && thePrefs::IsUDPDisabled()) { @@ -583,6 +615,10 @@ _("Message"), wxOK | wxICON_INFORMATION, this); } + if (CfgChanged(IDC_NETWORKKAD) || CfgChanged(IDC_NETWORKED2K)) { + theApp->amuledlg->DoNetworkRearrange(); + } + if (restart_needed) { wxMessageBox(restart_needed_msg + _("\nYou MUST restart aMule now.\nIf you do not restart now, don't complain if anything bad happens.\n"), _("WARNING"),wxICON_EXCLAMATION,this); } @@ -726,6 +762,7 @@ } else { theApp->amuledlg->RemoveSystray(); } + thePrefs::SetUseTrayIcon(value); break; case ID_PROXY_AUTO_SERVER_CONNECT_WITHOUT_PROXY: @@ -735,9 +772,20 @@ // Update the first tool (conn button) theApp->amuledlg->ShowConnectionState(); break; + + case IDC_ENFORCE_PO_INCOMING: + FindWindow(IDC_ENABLE_PO_OUTGOING)->Enable(!value); + break; + + case IDC_ENABLE_PO_OUTGOING: + FindWindow(IDC_SUPPORT_PO)->Enable(!value); + FindWindow(IDC_ENFORCE_PO_INCOMING)->Enable(value); + break; + case IDC_SUPPORT_PO: FindWindow(IDC_ENABLE_PO_OUTGOING)->Enable(value); - FindWindow(IDC_ENFORCE_PO_INCOMING)->Enable(value); + break; + default: break; } @@ -827,20 +875,6 @@ } -void PrefsUnifiedDlg::OnButtonBrowseWav(wxCommandEvent& WXUNUSED(evt)) -{ - wxString str = wxFileSelector( - _("Browse wav"), wxEmptyString, wxEmptyString, - wxT("*.wav"), _("File wav (*.wav)|*.wav||"), 0, this ); - - if ( !str.IsEmpty() ) { - wxTextCtrl* widget = CastChild( IDC_EDIT_TBN_WAVFILE, wxTextCtrl ); - - widget->SetValue( str ); - } -} - - void PrefsUnifiedDlg::OnButtonBrowseApplication(wxCommandEvent& event) { wxString title; @@ -879,7 +913,7 @@ { wxString fullpath( theApp->ConfigDir + wxT("addresses.dat") ); - EditServerListDlg* test = new EditServerListDlg(this, _("Edit Serverlist"), + EditServerListDlg* test = new EditServerListDlg(this, _("Edit server list"), _("Add here URL's to download server.met files.\nOnly one url on each line."), fullpath ); @@ -936,14 +970,14 @@ switch ( event.GetId() ) { case IDC_SLIDER: id = IDC_SLIDERINFO; - label = wxString::Format( _("Update delay: %d secs"), event.GetPosition() ); + label = wxString::Format( wxPLURAL("Update delay: %d second", "Update delay: %d seconds", event.GetPosition()), event.GetPosition() ); theApp->amuledlg->m_statisticswnd->SetUpdatePeriod(event.GetPosition()); theApp->amuledlg->m_kademliawnd->SetUpdatePeriod(event.GetPosition()); break; case IDC_SLIDER3: id = IDC_SLIDERINFO3; - label = wxString::Format( _("Time for average graph: %d mins"), event.GetPosition() ); + label = wxString::Format( wxPLURAL("Time for average graph: %d minute", "Time for average graph: %d minutes", event.GetPosition()), event.GetPosition() ); theApp->m_statistics->SetAverageMinutes(event.GetPosition()); break; @@ -955,25 +989,26 @@ case IDC_SLIDER2: id = IDC_SLIDERINFO2; - label = wxString::Format( _("Update delay : %d secs"), event.GetPosition() ); + label = wxString::Format( wxPLURAL("Update delay : %d second", "Update delay : %d seconds", event.GetPosition()), event.GetPosition() ); break; case IDC_FILEBUFFERSIZE: id = IDC_FILEBUFFERSIZE_STATIC; - label = wxString::Format( _("File Buffer Size: %d bytes"), event.GetPosition() * 15000 ); + // Yes, it seems odd to add the singular form here, but other languages might need to know the number to select the appropriate translation + label = wxString::Format( wxPLURAL("File Buffer Size: %d byte", "File Buffer Size: %d bytes", event.GetPosition() * 15000), event.GetPosition() * 15000 ); break; case IDC_QUEUESIZE: id = IDC_QUEUESIZE_STATIC; - label = wxString::Format( _("Upload Queue Size: %d clients"), event.GetPosition() * 100 ); + // Yes, it seems odd to add the singular form here, but other languages might need to know the number to select the appropriate translation + label = wxString::Format( wxPLURAL("Upload Queue Size: %d client", "Upload Queue Size: %d clients", event.GetPosition() * 100), event.GetPosition() * 100 ); break; case IDC_SERVERKEEPALIVE: id = IDC_SERVERKEEPALIVE_LABEL; if ( event.GetPosition() ) { - label = wxString::Format( _("Server connection refresh interval: %d minutes"), - event.GetPosition() ); + label = wxString::Format( wxPLURAL("Server connection refresh interval: %d minute", "Server connection refresh interval: %d minutes", event.GetPosition()), event.GetPosition() ); } else { label = wxString::Format( _("Server connection refresh interval: Disabled") ); } @@ -1027,25 +1062,22 @@ void PrefsUnifiedDlg::OnUserEventSelected(wxListEvent& event) { for (unsigned int i = 0; i < CUserEvents::GetCount(); ++i) { - CastChild(USEREVENTS_FIRST_ID + i * USEREVENTS_IDS_PER_EVENT, wxPanel)->Hide(); + IDC_PREFS_EVENTS_PAGE->Hide(i+1); } - CastChild(event.GetData(), wxPanel)->Show(); + IDC_PREFS_EVENTS_PAGE->Show((event.GetData() - USEREVENTS_FIRST_ID) / USEREVENTS_IDS_PER_EVENT + 1, true); - Layout(); + IDC_PREFS_EVENTS_PAGE->Layout(); event.Skip(); } void PrefsUnifiedDlg::CreateEventPanels(const int idx, const wxString& vars, wxWindow* parent) { - wxPanel *item0 = new wxPanel(parent, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT); - - wxBoxSizer *item1 = new wxBoxSizer(wxVERTICAL); - wxStaticBox *item8 = new wxStaticBox( item0, -1, CFormat(_("Execute command on `%s' event")) % wxGetTranslation(CUserEvents::GetDisplayName(static_cast(idx))) ); + wxStaticBox *item8 = new wxStaticBox( parent, -1, CFormat(_("Execute command on `%s' event")) % wxGetTranslation(CUserEvents::GetDisplayName(static_cast(idx))) ); wxStaticBoxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL ); - wxCheckBox *item9 = new wxCheckBox( item0, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT + 1, _("Enable command execution on core"), wxDefaultPosition, wxDefaultSize, 0 ); + wxCheckBox *item9 = new wxCheckBox( parent, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT + 1, _("Enable command execution on core"), wxDefaultPosition, wxDefaultSize, 0 ); item7->Add( item9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); wxFlexGridSizer *item10 = new wxFlexGridSizer( 3, 0, 0 ); @@ -1053,16 +1085,16 @@ item10->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 0 ); - wxStaticText *item11 = new wxStaticText( item0, -1, _("Core command:"), wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticText *item11 = new wxStaticText( parent, -1, _("Core command:"), wxDefaultPosition, wxDefaultSize, 0 ); item10->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 ); - wxTextCtrl *item12 = new wxTextCtrl( item0, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT + 2, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); + wxTextCtrl *item12 = new wxTextCtrl( parent, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT + 2, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); item12->Enable(CUserEvents::IsCoreCommandEnabled(static_cast(idx))); item10->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item7->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 ); - wxCheckBox *item14 = new wxCheckBox( item0, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT + 3, _("Enable command execution on GUI"), wxDefaultPosition, wxDefaultSize, 0 ); + wxCheckBox *item14 = new wxCheckBox( parent, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT + 3, _("Enable command execution on GUI"), wxDefaultPosition, wxDefaultSize, 0 ); item7->Add( item14, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); wxFlexGridSizer *item15 = new wxFlexGridSizer( 3, 0, 0 ); @@ -1070,25 +1102,21 @@ item15->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 0 ); - wxStaticText *item16 = new wxStaticText( item0, -1, _("GUI command:"), wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticText *item16 = new wxStaticText( parent, -1, _("GUI command:"), wxDefaultPosition, wxDefaultSize, 0 ); item15->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 ); - wxTextCtrl *item17 = new wxTextCtrl( item0, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT + 4, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); + wxTextCtrl *item17 = new wxTextCtrl( parent, USEREVENTS_FIRST_ID + idx * USEREVENTS_IDS_PER_EVENT + 4, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); item17->Enable(CUserEvents::IsGUICommandEnabled(static_cast(idx))); item15->Add( item17, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item7->Add( item15, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 ); - wxStaticText *item13 = new wxStaticText( item0, -1, _("The following variables will be replaced:") + vars, wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticText *item13 = new wxStaticText( parent, -1, _("The following variables will be replaced:") + vars, wxDefaultPosition, wxDefaultSize, 0 ); item7->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - item0->SetSizer(item1); - item1->SetSizeHints(item0); - - IDC_PREFS_EVENTS_PAGE->Add(item0, 0, wxGROW | wxEXPAND); + IDC_PREFS_EVENTS_PAGE->Add(item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); - item0->Hide(); + IDC_PREFS_EVENTS_PAGE->Layout(); + IDC_PREFS_EVENTS_PAGE->Hide(idx + 1); } // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/PrefsUnifiedDlg.h amule-2.2.2/src/PrefsUnifiedDlg.h --- amule-2.2.0~svn20080218/src/PrefsUnifiedDlg.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/PrefsUnifiedDlg.h 2008-04-03 19:24:17.000000000 +0000 @@ -101,7 +101,6 @@ void OnCancel(wxCommandEvent &event); void OnClose(wxCloseEvent &event); - void OnButtonBrowseWav(wxCommandEvent &event); void OnButtonBrowseApplication(wxCommandEvent &event); void OnButtonDir(wxCommandEvent& event); void OnButtonEditAddr(wxCommandEvent& event); diff -ruN -d amule-2.2.0~svn20080218/src/Proxy.cpp amule-2.2.2/src/Proxy.cpp --- amule-2.2.0~svn20080218/src/Proxy.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/Proxy.cpp 2008-04-04 14:13:04.000000000 +0000 @@ -172,7 +172,7 @@ try { const wxIPV4address &peer = dynamic_cast(peerAddress); m_peerAddress = new amuleIPV4Address(peer); - } catch (const std::bad_cast& e) { + } catch (const std::bad_cast& WXUNUSED(e)) { // Should process other types of wxIPAddres before quitting AddDebugLogLineM(false, logProxy, wxT("(1)bad_cast exception!")); wxASSERT(false); @@ -1374,7 +1374,7 @@ amuleIPV4Address &a = dynamic_cast(addr); a.Hostname( PeekUInt32( m_proxyTCPSocket.GetBuffer()+4 ) ); a.Service( ENDIAN_NTOHS( RawPeekUInt16( m_proxyTCPSocket.GetBuffer()+8) ) ); - } catch (const std::bad_cast& e) { + } catch (const std::bad_cast& WXUNUSED(e)) { AddDebugLogLineM(false, logProxy, wxT("(2)bad_cast exception!")); wxASSERT(false); diff -ruN -d amule-2.2.0~svn20080218/src/RC4Encrypt.cpp amule-2.2.2/src/RC4Encrypt.cpp --- amule-2.2.0~svn20080218/src/RC4Encrypt.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/RC4Encrypt.cpp 2008-05-09 18:44:17.000000000 +0000 @@ -27,6 +27,7 @@ #include "RC4Encrypt.h" #include + #include CRC4EncryptableBuffer::CRC4EncryptableBuffer() : m_encrypted(false), m_hasKey(false), m_key() @@ -54,13 +55,7 @@ void CRC4EncryptableBuffer::Encrypt() { wxASSERT(!m_encrypted); - // This is not optimal. At all. - int n = GetLength(); - std::vector orig_buffer(n); - memcpy(&(orig_buffer[0]), GetRawBuffer(), n); - RC4Crypt(&(orig_buffer[0]), GetRawBuffer(), n); - //DumpMem(orig_buffer, n, wxT("Orig buffer: ")); - //DumpMem(GetRawBuffer() ,n, wxT("Encrypted buffer: ")); + RC4Crypt(GetRawBuffer(), GetRawBuffer(), GetLength()); m_encrypted = true; } @@ -148,6 +143,13 @@ void CRC4EncryptableBuffer::ResetData() { m_encrypted = false; - // Should we clear the keys? + // Not touching the keys. CMemFile::ResetData(); } + +void CRC4EncryptableBuffer::FullReset() +{ + ResetData(); + m_hasKey = false; + memset(&m_key, 0, sizeof(RC4_Key_Struct)); +} diff -ruN -d amule-2.2.0~svn20080218/src/RC4Encrypt.h amule-2.2.2/src/RC4Encrypt.h --- amule-2.2.0~svn20080218/src/RC4Encrypt.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/RC4Encrypt.h 2008-05-09 16:02:17.000000000 +0000 @@ -80,6 +80,9 @@ // Also clears the encryption flag void ResetData(); + // Resets everything, as if the object has just been created. + void FullReset(); + private: bool m_encrypted; bool m_hasKey; diff -ruN -d amule-2.2.0~svn20080218/src/SafeFile.cpp amule-2.2.2/src/SafeFile.cpp --- amule-2.2.0~svn20080218/src/SafeFile.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/SafeFile.cpp 2008-05-08 10:30:11.000000000 +0000 @@ -29,10 +29,9 @@ #include "ScopedPtr.h" // Needed for CScopedPtr and CScopedArray - #define CHECK_BOM(size, x) ((size >= 3) && (x[0] == (char)0xEF) && (x[1] == (char)0xBB) && (x[2] == (char)0xBF)) -const char BOMHeader[3] = {0xEF, 0xBB, 0xBF}; +const char BOMHeader[3] = { '\xEF', '\xBB', '\xBF'}; CSafeIOException::CSafeIOException(const wxString& type, const wxString& desc) @@ -159,13 +158,15 @@ } +// UInt128 values are stored a little weird way... +// Four little-endian 32-bit numbers, stored in +// big-endian order CUInt128 CFileDataIO::ReadUInt128() const { CUInt128 value; - uint32* data = (uint32*)value.GetDataPtr(); - for (int i = 0; i < (128/32); i++) { + for (int i = 0; i < 4; i++) { // Four 32bits chunks - data[i] = ReadUInt32(); + value.Set32BitChunk(i, ReadUInt32()); } return value; @@ -189,7 +190,7 @@ } -unsigned char* CFileDataIO::ReadBsob(uint8* puSize) +unsigned char* CFileDataIO::ReadBsob(uint8* puSize) const { MULE_VALIDATE_PARAMS(puSize, wxT("NULL pointer argument in ReadBsob")); @@ -282,9 +283,12 @@ } +// UInt128 values are stored a little weird way... +// Four little-endian 32-bit numbers, stored in +// big-endian order void CFileDataIO::WriteUInt128(const Kademlia::CUInt128& value) { - for (int i = 0; i < (128/32); i++) { + for (int i = 0; i < 4; i++) { // Four 32bits chunks WriteUInt32(value.Get32BitChunk(i)); } @@ -322,7 +326,7 @@ } } default: { - // Raw strings are saved as Latin-1 + // Non UTF-8 strings are saved as Latin-1 wxCharBuffer s1 = wxConvISO8859_1.cWC2MB(str); WriteStringCore(s1, utf8strNone, SizeLen); } @@ -332,7 +336,7 @@ void CFileDataIO::WriteStringCore(const char *s, EUtf8Str eEncode, uint8 SizeLen) { - unsigned int sLength = s ? strlen(s) : 0; + uint32 sLength = s ? strlen(s) : 0; uint32 real_length = 0; if (eEncode == utf8strOptBOM) { real_length = sLength + 3; // For BOM header. @@ -346,8 +350,21 @@ break; case sizeof(uint16): - // Can't be higher than a uint16 - wxASSERT(real_length < (uint16)0xFFFF); + // We must not allow too long strings to be written, + // as this would allow for a buggy clients to "poison" + // us, by sending ISO8859-1 strings that expand to a + // greater than 16b length when converted as UTF-8. + if (real_length > 0xFFFF) { + wxFAIL_MSG(wxT("String is too long to be saved")); + + real_length = std::min(real_length, 0xFFFF); + if (eEncode == utf8strOptBOM) { + sLength = real_length - 3; + } else { + sLength = real_length; + } + } + WriteUInt16(real_length); break; @@ -372,7 +389,7 @@ } -CTag *CFileDataIO::ReadTag(bool bOptACP) +CTag *CFileDataIO::ReadTag(bool bOptACP) const { CTag *retVal = NULL; wxString name; @@ -459,7 +476,7 @@ } -void CFileDataIO::ReadTagPtrList(TagPtrList* taglist, bool bOptACP) +void CFileDataIO::ReadTagPtrList(TagPtrList* taglist, bool bOptACP) const { MULE_VALIDATE_PARAMS(taglist, wxT("NULL pointer argument in ReadTagPtrList")); @@ -504,7 +521,6 @@ WriteFloat(tag.GetFloat()); break; case TAGTYPE_BSOB: - // Used for uint128 on Kad now WriteBsob(tag.GetBsob(), tag.GetBsobSize()); break; case TAGTYPE_UINT16: diff -ruN -d amule-2.2.0~svn20080218/src/SafeFile.h amule-2.2.2/src/SafeFile.h --- amule-2.2.0~svn20080218/src/SafeFile.h 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/SafeFile.h 2008-05-08 10:30:11.000000000 +0000 @@ -128,14 +128,14 @@ * @see CSafeFileIO::Read */ //@{ - virtual uint8 ReadUInt8() const; - virtual uint16 ReadUInt16() const; - virtual uint32 ReadUInt32() const; - virtual uint64 ReadUInt64() const; - virtual CUInt128 ReadUInt128() const; - virtual CMD4Hash ReadHash() const; - virtual float ReadFloat() const; - virtual unsigned char* ReadBsob(uint8* size); + virtual uint8 ReadUInt8() const; + virtual uint16 ReadUInt16() const; + virtual uint32 ReadUInt32() const; + virtual uint64 ReadUInt64() const; + virtual CUInt128 ReadUInt128() const; + virtual CMD4Hash ReadHash() const; + virtual float ReadFloat() const; + virtual unsigned char* ReadBsob(uint8* size) const; //@} /** @@ -199,8 +199,8 @@ /* Warning: Special Kad functions, needs documentation */ - CTag* ReadTag(bool bOptACP = false); - void ReadTagPtrList(TagPtrList* taglist, bool bOptACP = false); + CTag* ReadTag(bool bOptACP = false) const; + void ReadTagPtrList(TagPtrList* taglist, bool bOptACP = false) const; void WriteTag(const CTag& tag); void WriteTagPtrList(const TagPtrList& tagList); diff -ruN -d amule-2.2.0~svn20080218/src/Scanner.cpp amule-2.2.2/src/Scanner.cpp --- amule-2.2.0~svn20080218/src/Scanner.cpp 2008-01-13 03:07:28.000000000 +0000 +++ amule-2.2.2/src/Scanner.cpp 2008-07-10 16:20:17.000000000 +0000 @@ -560,6 +560,10 @@ #include "libs/common/StringFunctions.h" +#ifdef _MSC_VER +#define isatty(DUMMY) 0 +#endif + #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[] = __FILE__; diff -ruN -d amule-2.2.0~svn20080218/src/Scanner.l amule-2.2.2/src/Scanner.l --- amule-2.2.0~svn20080218/src/Scanner.l 2006-03-21 04:52:48.000000000 +0000 +++ amule-2.2.2/src/Scanner.l 2008-07-10 16:20:17.000000000 +0000 @@ -7,6 +7,10 @@ #include "libs/common/StringFunctions.h" +#ifdef _MSC_VER +#define isatty(DUMMY) 0 +#endif + #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE diff -ruN -d amule-2.2.0~svn20080218/src/SearchDlg.cpp amule-2.2.2/src/SearchDlg.cpp --- amule-2.2.0~svn20080218/src/SearchDlg.cpp 2008-02-16 23:58:31.000000000 +0000 +++ amule-2.2.2/src/SearchDlg.cpp 2008-05-11 15:38:09.000000000 +0000 @@ -46,7 +46,6 @@ // just to keep compiler happy static wxCommandEvent nullEvent; - BEGIN_EVENT_TABLE(CSearchDlg, wxPanel) EVT_BUTTON( IDC_STARTS, CSearchDlg::OnBnClickedStart) EVT_TEXT_ENTER( IDC_SEARCHNAME, CSearchDlg::OnBnClickedStart) @@ -104,15 +103,18 @@ #endif // Sanity sanity - wxASSERT(CastChild( ID_SEARCHTYPE, wxChoice )->GetString(0) == _("Local")); - wxASSERT(CastChild( ID_SEARCHTYPE, wxChoice )->GetString(2) == _("Kad")); - - if (thePrefs::GetNetworkED2K()){ - CastChild( ID_SEARCHTYPE, wxChoice )->SetSelection(0); - } else { - CastChild( ID_SEARCHTYPE, wxChoice )->SetSelection(2); - } + wxChoice* searchchoice = CastChild( ID_SEARCHTYPE, wxChoice ); + wxASSERT(searchchoice); + wxASSERT(searchchoice->GetString(0) == _("Local")); + wxASSERT(searchchoice->GetString(2) == _("Kad")); + wxASSERT(searchchoice->GetCount() == 4); + + m_searchchoices = searchchoice->GetStrings(); + // Let's break it now. + + FixSearchTypes(); + CastChild( IDC_TypeSearch, wxChoice )->SetSelection(0); CastChild( IDC_SEARCHMINSIZE, wxChoice )->SetSelection(2); CastChild( IDC_SEARCHMAXSIZE, wxChoice )->SetSelection(2); @@ -129,6 +131,29 @@ { } +void CSearchDlg::FixSearchTypes() +{ + wxChoice* searchchoice = CastChild( ID_SEARCHTYPE, wxChoice ); + + searchchoice->Clear(); + + // We should have only filedonkey now. Let's insert stuff. + + int pos = 0; + + if (thePrefs::GetNetworkED2K()){ + searchchoice->Insert(m_searchchoices[0], pos++); + searchchoice->Insert(m_searchchoices[1], pos++); + } + + if (thePrefs::GetNetworkKademlia()) { + searchchoice->Insert(m_searchchoices[2], pos++); + } + + searchchoice->Insert(m_searchchoices[3], pos++); + + searchchoice->SetSelection(0); +} CSearchListCtrl* CSearchDlg::GetSearchList( wxUIntPtr id ) { @@ -224,7 +249,7 @@ } -void CSearchDlg::OnSearchPageChanged(wxNotebookEvent& evt) +void CSearchDlg::OnSearchPageChanged(wxNotebookEvent& WXUNUSED(evt)) { int selection = m_notebook->GetSelection(); @@ -239,7 +264,7 @@ if ( selection != -1 ) { CSearchListCtrl *ctrl = dynamic_cast(m_notebook->GetPage(selection)); - bool enable = ctrl->GetSelectedItemCount(); + bool enable = (ctrl->GetSelectedItemCount() > 0); FindWindow(IDC_SDOWNLOAD)->Enable( enable ); // set IDC_SEARCHNAME control to search text of currently selected tab @@ -278,8 +303,19 @@ wxChoice* choice = CastChild( ID_SEARCHTYPE, wxChoice ); - // Web seaches - switch ( choice->GetSelection() ) { + // Magic. + + int searchtype = choice->GetSelection(); + + if (!thePrefs::GetNetworkED2K()) { + searchtype += 2; + } + + if (!thePrefs::GetNetworkKademlia()) { + searchtype += 1; + } + + switch ( searchtype ) { // Local Search case 0: // Global Search @@ -481,10 +517,10 @@ uint32 sizemax = GetTypeSize( (uint8) CastChild( IDC_SEARCHMAXSIZE, wxChoice )->GetSelection() ); // Parameter Minimum Size - params.minSize = CastChild( IDC_SPINSEARCHMIN, wxSpinCtrl )->GetValue() * sizemin; + params.minSize = (uint64_t)(CastChild( IDC_SPINSEARCHMIN, wxSpinCtrl )->GetValue()) * (uint64_t)sizemin; // Parameter Maximum Size - params.maxSize = CastChild( IDC_SPINSEARCHMAX, wxSpinCtrl )->GetValue() * sizemax; + params.maxSize = (uint64_t)(CastChild( IDC_SPINSEARCHMAX, wxSpinCtrl )->GetValue()) * (uint64_t)sizemax; if ((params.maxSize < params.minSize) && (params.maxSize)) { wxMessageDialog dlg(this, @@ -514,36 +550,36 @@ ); break; } - - if (CastChild( IDC_TypeSearch, wxChoice )->GetStringSelection() != wxT("Any")) { - if (CastChild( IDC_TypeSearch, wxChoice )->GetStringSelection() != wxGetTranslation(params.typeText)) { - printf("Translation problem: %s(%d):\n\t'%s'\n\t'%s'\n\t'%s'\n", __FILE__, __LINE__, - (const char *)unicode2char(CastChild( IDC_TypeSearch, wxChoice )->GetStringSelection()), - (const char *)unicode2char(wxGetTranslation(params.typeText)), - (const char *)unicode2char(params.typeText)); - } - wxASSERT(/* Translation problem */ - CastChild( IDC_TypeSearch, wxChoice )->GetStringSelection() == - wxGetTranslation(params.typeText)); - } } SearchType search_type = KadSearch; - switch (CastChild( ID_SEARCHTYPE, wxChoice )->GetSelection()) { - case 0: // Local Search - search_type = LocalSearch; - break; - case 1: // Global Search - search_type = GlobalSearch; - break; - case 2: // Kad search - search_type = KadSearch; - break; - default: - // Should never happen - wxASSERT(0); - break; + + int selection = CastChild( ID_SEARCHTYPE, wxChoice )->GetSelection(); + + if (!thePrefs::GetNetworkED2K()) { + selection += 2; } + + if (!thePrefs::GetNetworkKademlia()) { + selection += 1; + } + + switch (selection) { + case 0: // Local Search + search_type = LocalSearch; + break; + case 1: // Global Search + search_type = GlobalSearch; + break; + case 2: // Kad search + search_type = KadSearch; + break; + default: + // Should never happen + wxASSERT(0); + break; + } + uint32 real_id = m_nSearchID; wxString error = theApp->searchlist->StartNewSearch(&real_id, search_type, params); if (!error.IsEmpty()) { diff -ruN -d amule-2.2.0~svn20080218/src/SearchDlg.h amule-2.2.2/src/SearchDlg.h --- amule-2.2.0~svn20080218/src/SearchDlg.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/SearchDlg.h 2008-04-19 03:47:37.000000000 +0000 @@ -136,6 +136,8 @@ void StartNewSearch(); + void FixSearchTypes(); + private: // Event handlers void OnFieldChanged(wxEvent& evt); @@ -164,6 +166,8 @@ CMuleNotebook* m_notebook; + wxArrayString m_searchchoices; + DECLARE_EVENT_TABLE() }; diff -ruN -d amule-2.2.0~svn20080218/src/SearchFile.cpp amule-2.2.2/src/SearchFile.cpp --- amule-2.2.0~svn20080218/src/SearchFile.cpp 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/SearchFile.cpp 2008-07-10 16:20:17.000000000 +0000 @@ -30,15 +30,20 @@ #include "MemFile.h" // Needed for CMemFile #include "Preferences.h" // Needed for thePrefs #include "GuiEvents.h" +#include "Logger.h" +#include "PartFile.h" // Needed for CPartFile::CanAddSource -CSearchFile::CSearchFile(const CMemFile& data, bool optUTF8, wxUIntPtr searchID, uint32 WXUNUSED(serverIP), uint16 WXUNUSED(serverPort), const wxString& directory, bool kademlia) +CSearchFile::CSearchFile(const CMemFile& data, bool optUTF8, wxUIntPtr searchID, uint32_t serverIP, uint16_t serverPort, const wxString& directory, bool kademlia) : m_parent(NULL), m_showChildren(false), m_searchID(searchID), m_sourceCount(0), m_completeSourceCount(0), m_kademlia(kademlia), - m_directory(directory) + m_directory(directory), + m_clientServerIP(serverIP), + m_clientServerPort(serverPort), + m_kadPublishInfo(0) { m_abyFileHash = data.ReadHash(); m_clientID = data.ReadUInt32(); @@ -62,7 +67,7 @@ SetFileSize(tag.GetInt()); break; case FT_FILESIZE_HI: - SetFileSize( (((uint64)tag.GetInt()) << 32) + GetFileSize()); + SetFileSize((((uint64)tag.GetInt()) << 32) + GetFileSize()); break; case FT_FILERATING: m_iUserRating = (tag.GetInt() & 0xF) / 3; @@ -92,9 +97,13 @@ m_sourceCount(other.m_sourceCount), m_completeSourceCount(other.m_completeSourceCount), m_kademlia(other.m_kademlia), + m_directory(other.m_directory), + m_clients(other.m_clients), m_clientID(other.m_clientID), m_clientPort(other.m_clientPort), - m_directory(other.m_directory) + m_clientServerIP(other.m_clientServerIP), + m_clientServerPort(other.m_clientServerPort), + m_kadPublishInfo(other.m_kadPublishInfo) { for (size_t i = 0; i < other.m_children.size(); ++i) { m_children.push_back(new CSearchFile(*other.m_children.at(i))); @@ -110,17 +119,60 @@ } -void CSearchFile::AddSources(uint32 count, uint32 count_complete) +void CSearchFile::AddClient(const ClientStruct& client) +{ + for (std::list::const_iterator it = m_clients.begin(); it != m_clients.end(); ++it) { + if (client.m_ip == it->m_ip && client.m_port == it->m_port) return; + } + m_clients.push_back(client); +} + + +void CSearchFile::MergeResults(const CSearchFile& other) { + // Sources if (m_kademlia) { - m_sourceCount = std::max(m_sourceCount, count); - m_completeSourceCount = std::max(m_completeSourceCount, count_complete); + m_sourceCount = std::max(m_sourceCount, other.m_sourceCount); + m_completeSourceCount = std::max(m_completeSourceCount, other.m_completeSourceCount); } else { - m_sourceCount += count; - m_completeSourceCount += count_complete; + m_sourceCount += other.m_sourceCount; + m_completeSourceCount += other.m_completeSourceCount; } -} + // Publish info + if (m_kadPublishInfo == 0) { + if (other.m_kadPublishInfo != 0) { + m_kadPublishInfo = other.m_kadPublishInfo; + } + } else { + if (other.m_kadPublishInfo != 0) { + m_kadPublishInfo = + std::max(m_kadPublishInfo & 0xFF000000, other.m_kadPublishInfo & 0xFF000000) | + std::max(m_kadPublishInfo & 0x00FF0000, other.m_kadPublishInfo & 0x00FF0000) | + (((m_kadPublishInfo & 0x0000FFFF) + (other.m_kadPublishInfo & 0x0000FFFF)) >> 1); + } + } + + // Rating + if (m_iUserRating != 0) { + if (other.m_iUserRating != 0) { + m_iUserRating = (m_iUserRating + other.m_iUserRating) / 2; + } + } else { + if (other.m_iUserRating != 0) { + m_iUserRating = other.m_iUserRating; + } + } + + // copy possible available sources from new result + if (other.GetClientID() && other.GetClientPort()) { + // pre-filter sources which would be dropped by CPartFile::AddSources + if (CPartFile::CanAddSource(other.GetClientID(), other.GetClientPort(), other.GetClientServerIP(), other.GetClientServerPort())) { + CSearchFile::ClientStruct client(other.GetClientID(), other.GetClientPort(), other.GetClientServerIP(), other.GetClientServerPort()); + AddClient(client); + } + } +} void CSearchFile::AddChild(CSearchFile* file) { @@ -131,16 +183,30 @@ wxCHECK_RET(GetFileHash() == file->GetFileHash(), wxT("Mismatching child/parent hashes")); wxCHECK_RET(GetFileSize() == file->GetFileSize(), wxT("Mismatching child/parent sizes")); + // If no children exists, then we add the current item. + if (GetChildren().empty()) { + // Merging duplicate names instead of adding a new one + if (file->GetFileName() == GetFileName()) { + AddDebugLogLineM( false, logSearch, CFormat(wxT("Merged results for '%s'")) % GetFileName()); + MergeResults(*file); + delete file; + return; + } else { + // The first child will always be the first result we received. + AddDebugLogLineM(false, logSearch, CFormat(wxT("Created initial child for result '%s'")) % GetFileName()); + m_children.push_back(new CSearchFile(*this)); + m_children.back()->m_parent = this; + } + } + file->m_parent = this; - // TODO: Doesn't handle results with same name but diff. rating. for (size_t i = 0; i < m_children.size(); ++i) { CSearchFile* other = m_children.at(i); - + // Merge duplicate filenames if (other->GetFileName() == file->GetFileName()) { - other->AddSources(file->GetSourceCount(), file->GetCompleteSourceCount()); + other->MergeResults(*file); UpdateParent(); - Notify_Search_Update_Sources(other); delete file; return; } @@ -159,29 +225,72 @@ void CSearchFile::UpdateParent() { wxCHECK_RET(!m_parent, wxT("UpdateParent called on child item")); - - size_t ratingCount = 0, ratingTotal = 0; - size_t max = 0, index = 0; - for (size_t i = 0; i < m_children.size(); ++i) { - const CSearchFile* child = m_children.at(index); - + + uint32_t sourceCount = 0; // ed2k: sum of all sources, kad: the max sources found + uint32_t completeSourceCount = 0; // ed2k: sum of all sources, kad: the max sources found + uint32_t differentNames = 0; // max known different names + uint32_t publishersKnown = 0; // max publishers known + uint32_t trustValue = 0; // average trust value + unsigned publishInfoTags = 0; + unsigned ratingCount = 0; + unsigned ratingTotal = 0; + CSearchResultList::const_iterator best = m_children.begin(); + for (CSearchResultList::const_iterator it = m_children.begin(); it != m_children.end(); ++it) { + const CSearchFile* child = *it; + // Locate the most common name - if (child->GetSourceCount() > max) { - max = child->GetSourceCount(); - index = i; + if (child->GetSourceCount() > (*best)->GetSourceCount()) { + best = it; } - // Create sum of ratings so that the parent contains the avg. + // Sources + if (m_kademlia) { + sourceCount = std::max(sourceCount, child->m_sourceCount); + completeSourceCount = std::max(completeSourceCount, child->m_completeSourceCount); + } else { + sourceCount += child->m_sourceCount; + completeSourceCount += child->m_completeSourceCount; + } + + // Publish info + if (child->GetKadPublishInfo() != 0) { + differentNames = std::max(differentNames, (child->GetKadPublishInfo() & 0xFF000000) >> 24); + publishersKnown = std::max(publishersKnown, (child->GetKadPublishInfo() & 0x00FF0000) >> 16); + trustValue += child->GetKadPublishInfo() & 0x0000FFFF; + publishInfoTags++; + } + + // Rating if (child->HasRating()) { - ratingCount += 1; + ratingCount++; ratingTotal += child->UserRating(); } + + // Available sources + if (child->GetClientID() && child->GetClientPort()) { + CSearchFile::ClientStruct client(child->GetClientID(), child->GetClientPort(), child->GetClientServerIP(), child->GetClientServerPort()); + AddClient(client); + } + for (std::list::const_iterator cit = child->m_clients.begin(); cit != child->m_clients.end(); ++cit) { + AddClient(*cit); + } } - if (ratingCount) { - m_iUserRating = (ratingTotal / ratingCount); + m_sourceCount = sourceCount; + m_completeSourceCount = completeSourceCount; + + if (publishInfoTags > 0) { + m_kadPublishInfo = ((differentNames & 0x000000FF) << 24) | ((publishersKnown & 0x000000FF) << 16) | ((trustValue / publishInfoTags) & 0x0000FFFF); + } else { + m_kadPublishInfo = 0; } - SetFileName(m_children.at(index)->GetFileName()); + if (ratingCount > 0) { + m_iUserRating = ratingTotal / ratingCount; + } else { + m_iUserRating = 0; + } + + SetFileName((*best)->GetFileName()); } // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/SearchFile.h amule-2.2.2/src/SearchFile.h --- amule-2.2.0~svn20080218/src/SearchFile.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/SearchFile.h 2008-07-10 15:39:45.000000000 +0000 @@ -79,8 +79,8 @@ const CMemFile& data, bool optUTF8, wxUIntPtr searchID, - uint32 serverIP = 0, - uint16 serverPort = 0, + uint32_t serverIP = 0, + uint16_t serverPort = 0, const wxString& directory = wxEmptyString, bool kademlia = false); @@ -90,14 +90,14 @@ /** - * Adds the given sources to the file. + * Merges the two results into one. * - * @param count Total source count. - * @param count_complete Number of sources that have the complete file. + * Merges the other result into this one, updating + * various informations. * - * Note that for Kademlia results, only the largest value is used. + * @param other The file to be merged into this. */ - void AddSources(uint32 count, uint32 count_complete); + void MergeResults(const CSearchFile& other); /** Returns the total number of sources. */ uint32 GetSourceCount() const; @@ -125,21 +125,44 @@ * * Note that a file can either be a parent _or_ * a child, but not both. Also note that it is - * only legal to add children whoose filesize and + * only legal to add children whose filesize and * filehash matches the parent's. AddChild takes * ownership of the file. */ void AddChild(CSearchFile* file); + struct ClientStruct { + ClientStruct() + : m_ip(0), m_port(0), m_serverIP(0), m_serverPort(0) + {} + + ClientStruct(uint32_t ip, uint16_t port, uint32_t serverIP, uint16_t serverPort) + : m_ip(ip), m_port(port), m_serverIP(serverIP), m_serverPort(serverPort) + {} + + uint32_t m_ip; + uint16_t m_port; + uint32_t m_serverIP; + uint32_t m_serverPort; + }; + + void AddClient(const ClientStruct& client); + const std::list& GetClients() const { return m_clients; } + + uint32_t GetClientID() const throw() { return m_clientID; } + void SetClientID(uint32_t clientID) throw() { m_clientID = clientID; } + uint16_t GetClientPort() const throw() { return m_clientPort; } + void SetClientPort(uint16_t port) throw() { m_clientPort = port; } + uint32_t GetClientServerIP() const throw() { return m_clientServerIP; } + void SetClientServerIP(uint32_t serverIP) throw() { m_clientServerIP = serverIP; } + uint16_t GetClientServerPort() const throw() { return m_clientServerPort; } + void SetClientServerPort(uint16_t port) throw() { m_clientServerPort = port; } + int GetClientsCount() const { return ((GetClientID() && GetClientPort()) ? 1 : 0) + m_clients.size(); } + - //@{ - //! TODO: Currently not used. - uint32 GetClientID() const; - void SetClientID(uint32 clientID); - uint16 GetClientPort() const; - void SetClientPort(uint16 port); - //@} - + void SetKadPublishInfo(uint32_t val) throw() { m_kadPublishInfo = val; } + uint32_t GetKadPublishInfo() const throw() { return m_kadPublishInfo; } + private: //! CSearchFile is not assignable. CSearchFile& operator=(const CSearchFile& other); @@ -169,11 +192,18 @@ //@{ //! TODO: Currently not used. - uint32 m_clientID; - uint16 m_clientPort; wxString m_directory; //@} + std::list m_clients; + uint32_t m_clientID; + uint16_t m_clientPort; + uint32_t m_clientServerIP; + uint16_t m_clientServerPort; + + //! Kademlia publish information. + uint32_t m_kadPublishInfo; + friend class CPartFile; friend class CSearchListRem; }; @@ -237,28 +267,5 @@ } -inline uint32 CSearchFile::GetClientID() const -{ - return m_clientID; -} - - -inline void CSearchFile::SetClientID(uint32 clientID) -{ - m_clientID = clientID; -} - - -inline uint16 CSearchFile::GetClientPort() const -{ - return m_clientPort; -} - - -inline void CSearchFile::SetClientPort(uint16 port) -{ - m_clientPort = port; -} - #endif // SEARCHLIST_H // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/SearchList.cpp amule-2.2.2/src/SearchList.cpp --- amule-2.2.0~svn20080218/src/SearchList.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/SearchList.cpp 2008-07-10 15:39:45.000000000 +0000 @@ -27,6 +27,7 @@ #include #include +#include #include #include "updownclient.h" // Needed for CUpDownClient @@ -134,10 +135,13 @@ class CSearchExprTarget { public: - CSearchExprTarget(CMemFile* pData, EUtf8Str eStrEncode) + CSearchExprTarget(CMemFile* pData, EUtf8Str eStrEncode, bool supports64bit, bool& using64bit) + : m_data(pData), + m_eStrEncode(eStrEncode), + m_supports64bit(supports64bit), + m_using64bit(using64bit) { - m_data = pData; - m_eStrEncode = eStrEncode; + m_using64bit = false; } void WriteBooleanAND() @@ -187,74 +191,48 @@ m_data->WriteString(pszMetaTagID); // meta tag ID } - void WriteMetaDataSearchParam(uint8 uMetaTagID, uint8 uOperator, uint32 uValue, bool WXUNUSED(bEd2k)) + void WriteMetaDataSearchParam(uint8_t uMetaTagID, uint8_t uOperator, uint64_t value) { - m_data->WriteUInt8(3); // numeric parameter type - m_data->WriteUInt32(uValue); // numeric value + bool largeValue = value > wxULL(0xFFFFFFFF); + if (largeValue && m_supports64bit) { + m_using64bit = true; + m_data->WriteUInt8(8); // numeric parameter type (int64) + m_data->WriteUInt64(value); // numeric value + } else { + if (largeValue) { + value = 0xFFFFFFFFu; + } + m_data->WriteUInt8(3); // numeric parameter type (int32) + m_data->WriteUInt32(value); // numeric value + } m_data->WriteUInt8(uOperator); // comparison operator m_data->WriteUInt16(sizeof(uint8)); // meta tag ID length m_data->WriteUInt8(uMetaTagID); // meta tag ID name } - void WriteMetaDataSearchParam(const wxString& pszMetaTagID, uint8 uOperator, uint32 uValue, bool WXUNUSED(bEd2k)) - { - m_data->WriteUInt8(3); // numeric parameter type - m_data->WriteUInt32(uValue); // numeric value - m_data->WriteUInt8(uOperator); // comparison operator - m_data->WriteString(pszMetaTagID); // meta tag ID - } - - void WriteOldMinMetaDataSearchParam(uint8 uMetaTagID, uint32 uValue, bool bEd2k) - { - uint8 uOperator; - if (bEd2k){ - uOperator = ED2K_SEARCH_OP_GREATER; - uValue -= 1; - } else { - uOperator = KAD_SEARCH_OP_GREATER_EQUAL; - } - WriteMetaDataSearchParam(uMetaTagID, uOperator, uValue, bEd2k); - } - - void WriteOldMinMetaDataSearchParam(const wxString& pszMetaTagID, uint32 uValue, bool bEd2k) - { - uint8 uOperator; - if (bEd2k){ - uOperator = ED2K_SEARCH_OP_GREATER; - uValue -= 1; - } else { - uOperator = KAD_SEARCH_OP_GREATER_EQUAL; - } - WriteMetaDataSearchParam(pszMetaTagID, uOperator, uValue, bEd2k); - } - - void WriteOldMaxMetaDataSearchParam(const wxString& pszMetaTagID, uint32 uValue, bool bEd2k) - { - uint8 uOperator; - if (bEd2k){ - uOperator = ED2K_SEARCH_OP_LESS; - uValue += 1; - } else { - uOperator = KAD_SEARCH_OP_LESS_EQUAL; - } - WriteMetaDataSearchParam(pszMetaTagID, uOperator, uValue, bEd2k); - } - - void WriteOldMaxMetaDataSearchParam(uint8 uMetaTagID, uint32 uValue, bool bEd2k) + void WriteMetaDataSearchParam(const wxString& pszMetaTagID, uint8_t uOperator, uint64_t value) { - uint8 uOperator; - if (bEd2k){ - uOperator = ED2K_SEARCH_OP_LESS; - uValue += 1; + bool largeValue = value > wxULL(0xFFFFFFFF); + if (largeValue && m_supports64bit) { + m_using64bit = true; + m_data->WriteUInt8(8); // numeric parameter type (int64) + m_data->WriteUInt64(value); // numeric value } else { - uOperator = KAD_SEARCH_OP_LESS_EQUAL; + if (largeValue) { + value = 0xFFFFFFFFu; + } + m_data->WriteUInt8(3); // numeric parameter type (int32) + m_data->WriteUInt32(value); // numeric value } - WriteMetaDataSearchParam(uMetaTagID, uOperator, uValue, bEd2k); + m_data->WriteUInt8(uOperator); // comparison operator + m_data->WriteString(pszMetaTagID); // meta tag ID } protected: CMemFile* m_data; EUtf8Str m_eStrEncode; + bool m_supports64bit; + bool& m_using64bit; }; @@ -273,7 +251,8 @@ m_searchType(LocalSearch), m_searchInProgress(false), m_currentSearch(-1), - m_searchPacket(NULL) + m_searchPacket(NULL), + m_64bitSearchPacket(false) { } @@ -312,7 +291,7 @@ if ((type == KadSearch) && !Kademlia::CKademlia::IsRunning()) { return _("Kad search can't be done if Kad is not running"); } else if ((type != KadSearch) && !theApp->IsConnectedED2K()) { - return _("ED2K search can't be done if ED2K is not connected"); + return _("eD2k search can't be done if eD2k is not connected"); } if (params.typeText != ED2KFTSTR_PROGRAM) { @@ -327,8 +306,11 @@ m_resultType.Clear(); } - // This MemFile is automatically free'd, except for kad searches. - CMemFilePtr data = CreateSearchData(params, type); + bool supports64bit = type == KadSearch ? true : theApp->serverconnect->GetCurrentServer() != NULL && (theApp->serverconnect->GetCurrentServer()->GetTCPFlags() & SRV_TCPFLG_LARGEFILES); + bool packetUsing64bit; + + // This MemFile is automatically free'd + CMemFilePtr data = CreateSearchData(params, type, supports64bit, packetUsing64bit); if (data.get() == NULL) { wxASSERT(_astrParserErrors.Count()); @@ -348,10 +330,10 @@ Kademlia::CSearchManager::StopSearch(0xffffffff, false); } - // Kad search takes ownership of data and searchstring will get tokenized there + // searchstring will get tokenized there // The tab must be created with the Kad search ID, so seardhID is updated. Kademlia::CSearch* search = Kademlia::CSearchManager::PrepareFindKeywords( - params.searchString, data.release(), *searchID); + params.searchString, data->GetLength(), data->GetRawBuffer(), *searchID); *searchID = search->GetSearchID(); } catch (const wxString& what) { @@ -370,9 +352,8 @@ if (type == GlobalSearch) { m_searchPacket = searchPacket; - - // The OPCode must be changed since global searches are UDP requests - m_searchPacket->SetOpCode(OP_GLOBSEARCHREQ); + m_64bitSearchPacket = packetUsing64bit; + m_searchPacket->SetOpCode(OP_GLOBSEARCHREQ); // will be changed later when actually sending the packet!! } } @@ -411,7 +392,7 @@ / theApp->serverlist->GetServerCount(); case KadSearch: - // We cannot meassure the progress of Kad searches. + // We cannot measure the progress of Kad searches. return 0; default: @@ -443,9 +424,38 @@ // We've already requested from the local server. continue; } else { - theStats::AddUpOverheadServer(m_searchPacket->GetPacketSize()); - theApp->serverconnect->SendUDPPacket(m_searchPacket, server, false); - CoreNotify_Search_Update_Progress(GetSearchProgress()); + if (server->SupportsLargeFilesUDP() && (server->GetUDPFlags() & SRV_UDPFLG_EXT_GETFILES)) { + CMemFile data(50); + uint32_t tagCount = 1; + data.WriteUInt32(tagCount); + CTagVarInt flags(CT_SERVER_UDPSEARCH_FLAGS, SRVCAP_UDP_NEWTAGS_LARGEFILES); + flags.WriteNewEd2kTag(&data); + CPacket *extSearchPacket = new CPacket(OP_GLOBSEARCHREQ3, m_searchPacket->GetPacketSize() + (uint32_t)data.GetLength(), OP_EDONKEYPROT); + extSearchPacket->CopyToDataBuffer(0, data.GetRawBuffer(), data.GetLength()); + extSearchPacket->CopyToDataBuffer(data.GetLength(), m_searchPacket->GetDataBuffer(), m_searchPacket->GetPacketSize()); + theStats::AddUpOverheadServer(extSearchPacket->GetPacketSize()); + theApp->serverconnect->SendUDPPacket(extSearchPacket, server, true); + AddDebugLogLineM(false, logServerUDP, wxT("Sending OP_GLOBSEARCHREQ3 to server ") + Uint32_16toStringIP_Port(server->GetIP(), server->GetPort())); + } else if (server->GetUDPFlags() & SRV_UDPFLG_EXT_GETFILES) { + if (!m_64bitSearchPacket || server->SupportsLargeFilesUDP()) { + m_searchPacket->SetOpCode(OP_GLOBSEARCHREQ2); + AddDebugLogLineM(false, logServerUDP, wxT("Sending OP_GLOBSEARCHREQ2 to server ") + Uint32_16toStringIP_Port(server->GetIP(), server->GetPort())); + theStats::AddUpOverheadServer(m_searchPacket->GetPacketSize()); + theApp->serverconnect->SendUDPPacket(m_searchPacket, server, false); + } else { + AddDebugLogLineM(false, logServerUDP, wxT("Skipped UDP search on server ") + Uint32_16toStringIP_Port(server->GetIP(), server->GetPort()) + wxT(": No large file support")); + } + } else { + if (!m_64bitSearchPacket || server->SupportsLargeFilesUDP()) { + m_searchPacket->SetOpCode(OP_GLOBSEARCHREQ); + AddDebugLogLineM(false, logServerUDP, wxT("Sending OP_GLOBSEARCHREQ to server ") + Uint32_16toStringIP_Port(server->GetIP(), server->GetPort())); + theStats::AddUpOverheadServer(m_searchPacket->GetPacketSize()); + theApp->serverconnect->SendUDPPacket(m_searchPacket, server, false); + } else { + AddDebugLogLineM(false, logServerUDP, wxT("Skipped UDP search on server ") + Uint32_16toStringIP_Port(server->GetIP(), server->GetPort()) + wxT(": No large file support")); + } + } + CoreNotify_Search_Update_Progress(GetSearchProgress()); return; } } @@ -470,7 +480,7 @@ const CMemFile packet(in_packet, size); uint32 results = packet.ReadUInt32(); - bool unicoded = sender->GetUnicodeSupport(); + bool unicoded = (sender->GetUnicodeSupport() != utf8strNone); for (unsigned int i = 0; i != results; ++i){ CSearchFile* toadd = new CSearchFile(packet, unicoded, searchID, 0, 0, directory); if (sender){ @@ -489,27 +499,27 @@ uint8 ucMore = packet.ReadUInt8(); if (ucMore == 0x00 || ucMore == 0x01){ if (moreResultsAvailable) { - *moreResultsAvailable = (bool)ucMore; + *moreResultsAvailable = (ucMore == 1); } } } } -void CSearchList::ProcessSearchAnswer(const byte* in_packet, uint32 size, bool optUTF8, uint32 WXUNUSED(serverIP), uint16 WXUNUSED(serverPort)) +void CSearchList::ProcessSearchAnswer(const uint8_t* in_packet, uint32_t size, bool optUTF8, uint32_t serverIP, uint16_t serverPort) { - CMemFile packet(in_packet,size); + CMemFile packet(in_packet, size); - uint32 results = packet.ReadUInt32(); - for (unsigned int i = 0; i != results; ++i) { - AddToList(new CSearchFile(packet, optUTF8, m_currentSearch)); + uint32_t results = packet.ReadUInt32(); + for (; results > 0; --results) { + AddToList(new CSearchFile(packet, optUTF8, m_currentSearch, serverIP, serverPort), false); } } -void CSearchList::ProcessUDPSearchAnswer(const CMemFile& packet, bool optUTF8, uint32 serverIP, uint16 serverPort) +void CSearchList::ProcessUDPSearchAnswer(const CMemFile& packet, bool optUTF8, uint32_t serverIP, uint16_t serverPort) { - AddToList(new CSearchFile(packet, optUTF8, m_currentSearch, serverIP, serverPort)); + AddToList(new CSearchFile(packet, optUTF8, m_currentSearch, serverIP, serverPort), false); } @@ -548,48 +558,11 @@ for (size_t i = 0; i < results.size(); ++i) { CSearchFile* item = results.at(i); - if ((toadd->GetFileHash() == item->GetFileHash()) - && (toadd->GetFileSize() == item->GetFileSize())) { - - AddDebugLogLineM(false, logSearch, - CFormat(wxT("Received duplicate results for '%s' : %s")) - % item->GetFileName() % item->GetFileHash().Encode()); - - // If no children exists, then we add the current item. The - // "parent" item will show the most common filename and the - // sum of sources for all variants. - if (item->GetChildren().empty()) { - if (toadd->GetFileName() == item->GetFileName()) { - AddDebugLogLineM( false, logSearch, - CFormat(wxT("Merged results for '%s'")) - % item->GetFileName()); - - // Merge duplicate items rather than creating a child item - item->AddSources(toadd->GetSourceCount(), toadd->GetCompleteSourceCount()); - Notify_Search_Update_Sources(item); - delete toadd; - return true; - } else { - AddDebugLogLineM(false, logSearch, - CFormat(wxT("Created initial child for result '%s'")) - % item->GetFileName()); - - // The first child will always be the first result we received. - item->AddChild(new CSearchFile(*item)); - } - } - - AddDebugLogLineM( false, logSearch, - CFormat(wxT("Adding child '%s' to result '%s'")) - % toadd->GetFileName() % item->GetFileName()); - - // Parent item includes sum of all sources for this file - item->AddSources(toadd->GetSourceCount(), toadd->GetCompleteSourceCount()); + if ((toadd->GetFileHash() == item->GetFileHash()) && (toadd->GetFileSize() == item->GetFileSize())) { + AddDebugLogLineM(false, logSearch, CFormat(wxT("Received duplicate results for '%s' : %s")) % item->GetFileName() % item->GetFileHash().Encode()); // Add the child, possibly updating the parents filename. - item->AddChild(toadd); - + item->AddChild(toadd); Notify_Search_Update_Sources(item); - return true; } } @@ -601,7 +574,7 @@ // New unique result, simply add and display. results.push_back(toadd); Notify_Search_Add_Result(toadd); - + return true; } @@ -649,10 +622,8 @@ } -CSearchList::CMemFilePtr CSearchList::CreateSearchData(const CSearchParams& params, SearchType type) +CSearchList::CMemFilePtr CSearchList::CreateSearchData(const CSearchParams& params, SearchType type, bool supports64bit, bool& packetUsing64bit) { - const bool kad = (type == KadSearch); - // Count the number of used parameters unsigned int parametercount = 0; if ( !params.typeText.IsEmpty() ) ++parametercount; @@ -660,7 +631,7 @@ if ( params.maxSize > 0 ) ++parametercount; if ( params.availability > 0 ) ++parametercount; if ( !params.extension.IsEmpty() ) ++parametercount; - + wxString typeText = params.typeText; if (typeText == ED2KFTSTR_ARCHIVE){ // eDonkeyHybrid 0.48 uses type "Pro" for archives files @@ -675,14 +646,6 @@ // Must write parametercount - 1 parameter headers CMemFilePtr data(new CMemFile(100)); - if (type == KadSearch) { - // We need to make some room for the keyword hash - data->WriteUInt128(CUInt128()); - // and the search type (0/1 if there is ed2k data or not) - // There will obviously be... at least the search string. - data->WriteUInt8(0); - } - _astrParserErrors.Empty(); _SearchExpr.m_aExpr.Empty(); @@ -723,7 +686,7 @@ #endif /* Leave the unicode comment there, please... */ - CSearchExprTarget target(data.get(), true /*I assume everyone is unicoded */ ? utf8strRaw : utf8strNone); + CSearchExprTarget target(data.get(), true /*I assume everyone is unicoded */ ? utf8strRaw : utf8strNone, supports64bit, packetUsing64bit); unsigned int iParameterCount = 0; if (_SearchExpr.m_aExpr.GetCount() <= 1) { @@ -757,21 +720,21 @@ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteOldMinMetaDataSearchParam(FT_FILESIZE, params.minSize, !kad); + target.WriteMetaDataSearchParam(FT_FILESIZE, ED2K_SEARCH_OP_GREATER, params.minSize); } if (params.maxSize > 0){ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteOldMaxMetaDataSearchParam(FT_FILESIZE, params.maxSize, !kad); + target.WriteMetaDataSearchParam(FT_FILESIZE, ED2K_SEARCH_OP_LESS, params.maxSize); } if (params.availability > 0){ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteOldMinMetaDataSearchParam(FT_SOURCES, params.availability, !kad); + target.WriteMetaDataSearchParam(FT_SOURCES, ED2K_SEARCH_OP_GREATER, params.availability); } if (!params.extension.IsEmpty()){ @@ -787,49 +750,49 @@ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteOldMinMetaDataSearchParam(FT_COMPLETE_SOURCES, complete, !kad); + target.WriteMetaDataSearchParam(FT_COMPLETE_SOURCES, ED2K_SEARCH_OP_GREATER, complete); } if (minBitrate > 0){ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteOldMinMetaDataSearchParam(kad ? TAG_MEDIA_BITRATE : FT_ED2K_MEDIA_BITRATE, minBitrate, !kad); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_BITRATE : FT_ED2K_MEDIA_BITRATE, ED2K_SEARCH_OP_GREATER, minBitrate); } if (minLength > 0){ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteOldMinMetaDataSearchParam(kad ? TAG_MEDIA_LENGTH : FT_ED2K_MEDIA_LENGTH, minLength, !kad); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_LENGTH : FT_ED2K_MEDIA_LENGTH, ED2K_SEARCH_OP_GREATER, minLength); } if (!codec.IsEmpty()){ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteMetaDataSearchParam(kad ? TAG_MEDIA_CODEC : FT_ED2K_MEDIA_CODEC, codec); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_CODEC : FT_ED2K_MEDIA_CODEC, codec); } if (!title.IsEmpty()){ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteMetaDataSearchParam(kad ? TAG_MEDIA_TITLE : FT_ED2K_MEDIA_TITLE, title); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_TITLE : FT_ED2K_MEDIA_TITLE, title); } if (!album.IsEmpty()){ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteMetaDataSearchParam(kad ? TAG_MEDIA_ALBUM : FT_ED2K_MEDIA_ALBUM, album); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_ALBUM : FT_ED2K_MEDIA_ALBUM, album); } if (!artist.IsEmpty()){ if (++iParameterCount < parametercount) { target.WriteBooleanAND(); } - target.WriteMetaDataSearchParam(kad ? TAG_MEDIA_ARTIST : FT_ED2K_MEDIA_ARTIST, artist); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_ARTIST : FT_ED2K_MEDIA_ARTIST, artist); } #endif // 0 @@ -934,15 +897,15 @@ } if (params.minSize > 0) { - target.WriteOldMinMetaDataSearchParam(FT_FILESIZE, params.minSize, !kad); + target.WriteMetaDataSearchParam(FT_FILESIZE, ED2K_SEARCH_OP_GREATER, params.minSize); } if (params.maxSize > 0) { - target.WriteOldMaxMetaDataSearchParam(FT_FILESIZE, params.maxSize, !kad); + target.WriteMetaDataSearchParam(FT_FILESIZE, ED2K_SEARCH_OP_LESS, params.maxSize); } if (params.availability > 0) { - target.WriteOldMinMetaDataSearchParam(FT_SOURCES, params.availability, !kad); + target.WriteMetaDataSearchParam(FT_SOURCES, ED2K_SEARCH_OP_GREATER, params.availability); } if (!params.extension.IsEmpty()) { @@ -952,31 +915,31 @@ //#warning TODO - third and last warning of the same series. #if 0 if (complete > 0) { - target.WriteOldMinMetaDataSearchParam(FT_COMPLETE_SOURCES, pParams->uComplete, !kad); + target.WriteMetaDataSearchParam(FT_COMPLETE_SOURCES, ED2K_SEARCH_OP_GREATER, pParams->uComplete); } if (minBitrate > 0) { - target.WriteOldMinMetaDataSearchParam(kad ? TAG_MEDIA_BITRATE : FT_ED2K_MEDIA_BITRATE, minBitrate, !kad); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_BITRATE : FT_ED2K_MEDIA_BITRATE, ED2K_SEARCH_OP_GREATER, minBitrate); } if (minLength > 0) { - target.WriteOldMinMetaDataSearchParam(kad ? TAG_MEDIA_LENGTH : FT_ED2K_MEDIA_LENGTH, minLength, bEd2k); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_LENGTH : FT_ED2K_MEDIA_LENGTH, ED2K_SEARCH_OP_GREATER, minLength); } if (!codec.IsEmpty()) { - target.WriteMetaDataSearchParam(kad ? TAG_MEDIA_CODEC : FT_ED2K_MEDIA_CODEC, codec); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_CODEC : FT_ED2K_MEDIA_CODEC, codec); } if (!title.IsEmpty()) { - target.WriteMetaDataSearchParam(kad ? TAG_MEDIA_TITLE : FT_ED2K_MEDIA_TITLE, title); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_TITLE : FT_ED2K_MEDIA_TITLE, title); } if (!album.IsEmpty()) { - target.WriteMetaDataSearchParam(kad ? TAG_MEDIA_ALBUM : FT_ED2K_MEDIA_ALBUM, album); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_ALBUM : FT_ED2K_MEDIA_ALBUM, album); } if (!artist.IsEmpty()) { - target.WriteMetaDataSearchParam(kad ? TAG_MEDIA_ARTIST : FT_ED2K_MEDIA_ARTIST, artist); + target.WriteMetaDataSearchParam(type == KadSearch ? TAG_MEDIA_ARTIST : FT_ED2K_MEDIA_ARTIST, artist); } #endif // 0 @@ -987,8 +950,8 @@ } -void CSearchList::KademliaSearchKeyword(uint32 searchID, const Kademlia::CUInt128* fileID, - const wxString& name, uint64 size, const wxString& type, const TagPtrList& taglist) +void CSearchList::KademliaSearchKeyword(uint32_t searchID, const Kademlia::CUInt128 *fileID, + const wxString& name, uint64_t size, const wxString& type, uint32_t kadPublishInfo, const TagPtrList& taglist) { EUtf8Str eStrEncode = utf8strRaw; @@ -996,10 +959,10 @@ byte fileid[16]; fileID->ToByteArray(fileid); temp.WriteHash(CMD4Hash(fileid)); - + temp.WriteUInt32(0); // client IP temp.WriteUInt16(0); // client port - + // write tag list unsigned int uFilePosTagCount = temp.GetPosition(); uint32 tagcount = 0; @@ -1025,13 +988,16 @@ (*it)->WriteTagToFile(&temp,eStrEncode); tagcount++; } - + temp.Seek(uFilePosTagCount, wxFromStart); temp.WriteUInt32(tagcount); - + temp.Seek(0, wxFromStart); - - AddToList(new CSearchFile(temp, (eStrEncode == utf8strRaw), searchID, 0, 0, wxEmptyString, true)); + + CSearchFile *tempFile = new CSearchFile(temp, (eStrEncode == utf8strRaw), searchID, 0, 0, wxEmptyString, true); + tempFile->SetKadPublishInfo(kadPublishInfo); + + AddToList(tempFile); } // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/SearchList.h amule-2.2.2/src/SearchList.h --- amule-2.2.0~svn20080218/src/SearchList.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/SearchList.h 2008-07-10 16:20:17.000000000 +0000 @@ -69,11 +69,11 @@ //! The filename extension. May be empty. wxString extension; //! The smallest filesize in bytes to accept, zero for any. - uint32 minSize; + uint64_t minSize; //! The largest filesize in bytes to accept, zero for any. - uint32 maxSize; + uint64_t maxSize; //! The minumum available (source-count), zero for any. - uint32 availability; + uint32_t availability; }; /** Constructor. */ @@ -137,8 +137,8 @@ * @param serverIP The IP of the server sending the results. * @param serverPort The Port of the server sending the results. */ - void ProcessSearchAnswer(const byte* packet, uint32 size, bool optUTF8, uint32 serverIP, uint16 serverPort); - + void ProcessSearchAnswer(const uint8_t* packet, uint32_t size, bool optUTF8, uint32_t serverIP, uint16_t serverPort); + /** * Processes a search-result sent via UDP. Only one result is read from the packet. * @@ -154,13 +154,14 @@ * Adds a result in the form of a kad search-keyword to the specified result-list. * * @param searchID The search to which this result belongs. - * @param pfileID The hash of the result-file. + * @param fileID The hash of the result-file. * @param name The filename of the result. * @param size The filesize of the result. * @param type The filetype of the result (TODO: Not used?) - * @param taglist List of additional tags assosiated with the search-result. + * @param kadPublishInfo The kademlia publish information of the result. + * @param taglist List of additional tags associated with the search-result. */ - void KademliaSearchKeyword(uint32 searchID, const Kademlia::CUInt128* pfileID, const wxString& name, uint64 size, const wxString& type, const TagPtrList& taglist); + void KademliaSearchKeyword(uint32_t searchID, const Kademlia::CUInt128 *fileID, const wxString& name, uint64_t size, const wxString& type, uint32_t kadPublishInfo, const TagPtrList& taglist); private: @@ -183,7 +184,7 @@ typedef std::auto_ptr CMemFilePtr; /** Create a basic search-packet for the given search-type. */ - CMemFilePtr CreateSearchData(const CSearchParams& params, SearchType type); + CMemFilePtr CreateSearchData(const CSearchParams& params, SearchType type, bool supports64bit, bool& packetUsing64bit); //! Timer used for global search intervals. @@ -201,6 +202,9 @@ //! The current packet used for searches. CPacket* m_searchPacket; + //! Does the current search packet contain 64bit values? + bool m_64bitSearchPacket; + //! Queue of servers to ask when doing global searches. //! TODO: Replace with 'cookie' system. CQueueObserver m_serverQueue; diff -ruN -d amule-2.2.0~svn20080218/src/SearchListCtrl.cpp amule-2.2.2/src/SearchListCtrl.cpp --- amule-2.2.0~svn20080218/src/SearchListCtrl.cpp 2008-01-31 20:18:08.000000000 +0000 +++ amule-2.2.2/src/SearchListCtrl.cpp 2008-07-10 15:39:45.000000000 +0000 @@ -169,7 +169,7 @@ CSearchFile* parent = toshow->GetParent(); if (newid > 0) { - CSearchFile* before = (CSearchFile*)GetItemData(newid - 1); + CSearchFile* before = (CSearchFile*)GetItemData(newid - 1); wxASSERT(before); if (parent) { wxASSERT((before->GetParent() == parent) || (before == parent)); @@ -196,7 +196,20 @@ SetItem(newid, ID_SEARCH_COL_SIZE, CastItoXBytes( toshow->GetFileSize() ) ); // Source count - wxString temp = wxString::Format( wxT("%d (%d)"), toshow->GetSourceCount(), toshow->GetCompleteSourceCount() ); + wxString temp = wxString::Format(wxT("%d"), toshow->GetSourceCount()); + if (toshow->GetCompleteSourceCount()) { + temp += wxString::Format(wxT(" (%d)"), toshow->GetCompleteSourceCount()); + } + if (toshow->GetClientsCount()) { + temp += wxString::Format(wxT(" [%d]"), toshow->GetClientsCount()); + } +#ifdef __DEBUG__ + if (toshow->GetKadPublishInfo() == 0) { + temp += wxT(" | -"); + } else { + temp += wxString::Format(wxT(" | N:%u, P:%u, T:%0.2f"), (toshow->GetKadPublishInfo() & 0xFF000000) >> 24, (toshow->GetKadPublishInfo() & 0x00FF0000) >> 16, (toshow->GetKadPublishInfo() & 0x0000FFFF) / 100.0); + } +#endif SetItem( newid, ID_SEARCH_COL_SOURCES, temp ); // File-type @@ -232,13 +245,26 @@ if (index != -1) { // Update the filename, which may be changed in case of multiple variants. SetItem(index, ID_SEARCH_COL_NAME, toupdate->GetFileName().GetPrintable()); - - wxString temp = wxString::Format( wxT("%d (%d)"), toupdate->GetSourceCount(), toupdate->GetCompleteSourceCount()); + + wxString temp = wxString::Format(wxT("%d"), toupdate->GetSourceCount()); + if (toupdate->GetCompleteSourceCount()) { + temp += wxString::Format(wxT(" (%d)"), toupdate->GetCompleteSourceCount()); + } + if (toupdate->GetClientsCount()) { + temp += wxString::Format(wxT(" [%d]"), toupdate->GetClientsCount()); + } +#ifdef __DEBUG__ + if (toupdate->GetKadPublishInfo() == 0) { + temp += wxT(" | -"); + } else { + temp += wxString::Format(wxT(" | N:%u, P:%u, T:%0.2f"), (toupdate->GetKadPublishInfo() & 0xFF000000) >> 24, (toupdate->GetKadPublishInfo() & 0x00FF0000) >> 16, (toupdate->GetKadPublishInfo() & 0x0000FFFF) / 100.0); + } +#endif SetItem(index, ID_SEARCH_COL_SOURCES, temp); - + UpdateItemColor(index); - - // Deletions of items causes rather large ammount of flicker, so to + + // Deletions of items causes rather large amount of flicker, so to // avoid this, we resort the list to ensure correct ordering. if (!IsItemSorted(index)) { SortList(); @@ -433,7 +459,7 @@ // Modifies the result, 1 for ascending, -1 for decending int modifier = (sortData & CMuleListCtrl::SORT_DES) ? -1 : 1; - bool alternate = (sortData & CMuleListCtrl::SORT_ALT); + bool alternate = (sortData & CMuleListCtrl::SORT_ALT) != 0; // Decide if which should files we should sort by. wxUIntPtr parent1 = reinterpret_cast(file1->GetParent()); @@ -565,7 +591,7 @@ menu.Append(MP_RAZORSTATS, _("Get Razorback 2's stats for this file")); menu.AppendSeparator(); */ - menu.Append(MP_SEARCHRELATED, _("Search related files (ED2k, local server)")); + menu.Append(MP_SEARCHRELATED, _("Search related files (eD2k, local server)")); menu.AppendSeparator(); //#warning Uncomment this here to test the MP_MARK_AS_KNOWN feature. Beware! You are on your own here, this might break "known.met" @@ -574,10 +600,10 @@ menu.AppendSeparator(); #endif - menu.Append(MP_GETED2KLINK, _("Copy ED2k link to clipboard")); + menu.Append(MP_GETED2KLINK, _("Copy eD2k link to clipboard")); // These should only be enabled for single-selections - bool enable = GetSelectedItemCount(); + bool enable = (GetSelectedItemCount() == 1); menu.Enable(MP_GETED2KLINK, enable); menu.Enable(MP_MENU_CATS, (theApp->glob_prefs->GetCatCount() > 1)); @@ -877,7 +903,7 @@ CSearchFile* parent = file->GetParent(); if (item > 0) { - CSearchFile* before = (CSearchFile*)GetItemData(item - 1); + CSearchFile* before = (CSearchFile*)GetItemData(item - 1); wxASSERT(before); if (parent) { wxASSERT((before->GetParent() == parent) || (before == parent)); diff -ruN -d amule-2.2.0~svn20080218/src/Server.cpp amule-2.2.2/src/Server.cpp --- amule-2.2.0~svn20080218/src/Server.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/Server.cpp 2008-04-04 14:13:04.000000000 +0000 @@ -150,7 +150,7 @@ lastpinged = 0; lastpingedtime = 0; m_dwRealLastPingedTime = 0; - staticservermember=0; + staticservermember=false; maxusers=0; m_uTCPFlags = 0; m_uUDPFlags = 0; diff -ruN -d amule-2.2.0~svn20080218/src/Server.h amule-2.2.2/src/Server.h --- amule-2.2.0~svn20080218/src/Server.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/Server.h 2008-04-04 14:13:04.000000000 +0000 @@ -27,6 +27,7 @@ #define SERVER_H #include "Tag.h" +#include "OtherStructs.h" #include #include @@ -35,7 +36,6 @@ #include #endif -class ServerMet_Struct; class CFileDataIO; // Server priority @@ -94,7 +94,7 @@ uint32 GetFailedCount() const {return failedcount;} void SetID(uint32 newip); const wxString &GetDynIP() const {return dynip;} - bool HasDynIP() const {return dynip.Length();} + bool HasDynIP() const {return !dynip.IsEmpty() ;} void SetDynIP(const wxString& newdynip); uint32 GetLastPingedTime() const {return lastpingedtime;} @@ -143,13 +143,13 @@ uint32 GetServerKeyUDPIP() const {return m_dwIPServerKeyUDP;} - bool GetUnicodeSupport() const {return GetTCPFlags() & SRV_TCPFLG_UNICODE;} - bool GetRelatedSearchSupport() const {return GetTCPFlags() & SRV_TCPFLG_RELATEDSEARCH;} - bool SupportsLargeFilesTCP() const {return GetTCPFlags() & SRV_TCPFLG_LARGEFILES;} - bool SupportsLargeFilesUDP() const {return GetUDPFlags() & SRV_UDPFLG_LARGEFILES;} - bool SupportsObfuscationUDP() const {return (GetUDPFlags() & SRV_UDPFLG_UDPOBFUSCATION)!=0;} - bool SupportsObfuscationTCP() const {return GetObfuscationPortTCP() != 0 && ((GetUDPFlags() & SRV_UDPFLG_TCPOBFUSCATION)!=0 || (GetTCPFlags() & SRV_TCPFLG_TCPOBFUSCATION)!=0);} - bool SupportsGetSourcesObfuscation() const {return (GetTCPFlags() & SRV_TCPFLG_TCPOBFUSCATION)!=0;} // mapped to TCPFLAG_TCPOBFU + bool GetUnicodeSupport() const {return (GetTCPFlags() & SRV_TCPFLG_UNICODE) != 0;} + bool GetRelatedSearchSupport() const {return (GetTCPFlags() & SRV_TCPFLG_RELATEDSEARCH) != 0;} + bool SupportsLargeFilesTCP() const {return (GetTCPFlags() & SRV_TCPFLG_LARGEFILES) != 0;} + bool SupportsLargeFilesUDP() const {return (GetUDPFlags() & SRV_UDPFLG_LARGEFILES) != 0;} + bool SupportsObfuscationUDP() const {return (GetUDPFlags() & SRV_UDPFLG_UDPOBFUSCATION) != 0;} + bool SupportsObfuscationTCP() const {return (GetObfuscationPortTCP() != 0) && (((GetUDPFlags() & SRV_UDPFLG_TCPOBFUSCATION) != 0) || ((GetTCPFlags() & SRV_TCPFLG_TCPOBFUSCATION) != 0));} + bool SupportsGetSourcesObfuscation() const {return (GetTCPFlags() & SRV_TCPFLG_TCPOBFUSCATION) != 0;} // mapped to TCPFLAG_TCPOBFU const wxString& GetAuxPortsList() const {return m_auxPorts;} void SetAuxPortsList(const wxString& val) {m_auxPorts = val;} @@ -183,7 +183,7 @@ uint32 m_uDescReqChallenge; uint8 lastdescpingedcout; TagPtrList m_taglist; - uint8 staticservermember; + bool staticservermember; wxString m_strVersion; uint32 m_uTCPFlags; uint32 m_uUDPFlags; diff -ruN -d amule-2.2.0~svn20080218/src/ServerConnect.cpp amule-2.2.2/src/ServerConnect.cpp --- amule-2.2.0~svn20080218/src/ServerConnect.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ServerConnect.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -53,7 +53,7 @@ void CServerConnect::TryAnotherConnectionrequest() { - if ( connectionattemps.size() < (( thePrefs::IsSafeServerConnectEnabled()) ? 1 : 2) ) { + if ( connectionattemps.size() < (unsigned)(( thePrefs::IsSafeServerConnectEnabled()) ? 1 : 2) ) { CServer* next_server = used_list->GetNextServer(m_bTryObfuscated); @@ -85,7 +85,7 @@ void CServerConnect::ConnectToAnyServer(bool prioSort, bool bNoCrypt) { if (!thePrefs::GetNetworkED2K()){ - AddLogLineM(true,_("ED2K network disabled on preferences, not connecting.")); + AddLogLineM(true,_("eD2k network disabled on preferences, not connecting.")); return; } @@ -108,7 +108,7 @@ } if (!anystatic) { connecting = false; - AddLogLineM(true,_("No valid servers to connect in serverlist found")); + AddLogLineM(true,_("No valid servers to which to connect found in server list")); return; } } @@ -121,7 +121,7 @@ if (used_list->GetServerCount()==0 ) { connecting = false; - AddLogLineM(true,_("No valid servers to connect in serverlist found")); + AddLogLineM(true,_("No valid servers to which to connect found in server list")); return; } @@ -134,7 +134,7 @@ void CServerConnect::ConnectToServer(CServer* server, bool multiconnect, bool bNoCrypt) { if (!thePrefs::GetNetworkED2K()){ - AddLogLineM(true,_("ED2K network disabled on preferences, not connecting.")); + AddLogLineM(true,_("eD2k network disabled on preferences, not connecting.")); return; } @@ -174,16 +174,6 @@ } } -#define CAPABLE_ZLIB 0x01 -#define CAPABLE_IP_IN_LOGIN_FRAME 0x02 -#define CAPABLE_AUXPORT 0x04 -#define CAPABLE_NEWTAGS 0x08 -#define CAPABLE_UNICODE 0x10 -#define CAPABLE_LARGEFILES 0x100 -#define SRVCAP_SUPPORTCRYPT 0x0200 -#define SRVCAP_REQUESTCRYPT 0x0400 -#define SRVCAP_REQUIRECRYPT 0x0800 - void CServerConnect::ConnectionEstablished(CServerSocket* sender) { if (connecting == false) @@ -388,7 +378,7 @@ bool autoretry= !singleconnecting; StopConnectionTry(); if ((thePrefs::Reconnect()) && (autoretry) && (!m_idRetryTimer.IsRunning())){ - AddLogLineM(false, wxString::Format(_("Automatic connection to server will retry in %d seconds"), CS_RETRYCONNECTTIME)); + AddLogLineM(false, wxString::Format(wxPLURAL("Automatic connection to server will retry in %d second", "Automatic connection to server will retry in %d seconds", CS_RETRYCONNECTTIME), CS_RETRYCONNECTTIME)); m_idRetryTimer.Start(1000*CS_RETRYCONNECTTIME); } break; @@ -457,7 +447,7 @@ ServerSocketMap::iterator it = connectionattemps.begin(); while ( it != connectionattemps.end() ){ if ( !it->second ) { - AddLogLineM(false, _("Error: Socket invalid at timeoutcheck")); + AddLogLineM(false, _("ERROR: Socket invalid at timeout check")); connectionattemps.erase( it ); return; } diff -ruN -d amule-2.2.0~svn20080218/src/ServerList.cpp amule-2.2.2/src/ServerList.cpp --- amule-2.2.0~svn20080218/src/ServerList.cpp 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/ServerList.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -165,9 +165,9 @@ Notify_ServerThaw(); if (!merge) { - AddLogLineM(true, wxString::Format(_("%i servers in server.met found"),fservercount)); + AddLogLineM(true, wxString::Format(wxPLURAL("%i server in server.met found", "%i servers in server.met found", fservercount), fservercount)); } else { - AddLogLineM(true, wxString::Format(_("%d servers added"), iAddCount)); + AddLogLineM(true, wxString::Format(wxPLURAL("%d server added", "%d servers added", iAddCount), iAddCount)); } } catch (const CInvalidPacket& err) { AddLogLineM(true, wxT("Error: the file server.met is corrupted: ") + err.what()); @@ -814,7 +814,7 @@ uint8 url_count = theApp->glob_prefs->adresses_list.GetCount(); if (!url_count) { - AddLogLineM(true, _("No serverlist address entry in 'addresses.dat' found. Please paste a valid serverlist address into this file in order to auto-update your serverlist")); + AddLogLineM(true, _("No server list address entry in 'addresses.dat' found. Please paste a valid server list address into this file in order to auto-update your server list")); return; } // Do current URL. Callback function will take care of the others. @@ -836,7 +836,7 @@ return; } else { AddLogLineM(true, CFormat( - _("Warning, invalid URL specified for auto-updating of servers: %s") ) % URI); + _("WARNING: invalid URL specified for auto-updating of servers: %s") ) % URI); } current_url_index++; } diff -ruN -d amule-2.2.0~svn20080218/src/ServerList.h amule-2.2.2/src/ServerList.h --- amule-2.2.0~svn20080218/src/ServerList.h 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/ServerList.h 2008-04-04 12:53:45.000000000 +0000 @@ -48,7 +48,7 @@ void ServerStats(); void ResetServerPos() {m_serverpos = m_servers.begin();} CServer* GetNextServer(bool bOnlyObfuscated = false); - uint32 GetServerCount() {return m_servers.size();} + size_t GetServerCount() {return m_servers.size();} CServer* GetServerByAddress(const wxString& address, uint16 port) const; CServer* GetServerByIP(uint32 nIP) const; CServer* GetServerByIPTCP(uint32 nIP, uint16 nPort) const; diff -ruN -d amule-2.2.0~svn20080218/src/ServerListCtrl.cpp amule-2.2.2/src/ServerListCtrl.cpp --- amule-2.2.0~svn20080218/src/ServerListCtrl.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/ServerListCtrl.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -421,21 +421,33 @@ serverPrioMenu->Append( MP_PRIOHIGH, _("High") ); serverMenu->Append( MP_CONNECTTO, _("Connect to server") ); serverMenu->Append( 12345, _("Priority"), serverPrioMenu ); - + serverMenu->AppendSeparator(); - serverMenu->Append( MP_ADDTOSTATIC, _("Mark server(s) as static") ); - serverMenu->Append( MP_REMOVEFROMSTATIC, _("Mark server(s) as non-static") ); - + if (GetSelectedItemCount() == 1) { + serverMenu->Append( MP_ADDTOSTATIC, _("Mark server as static") ); + serverMenu->Append( MP_REMOVEFROMSTATIC, _("Mark server as non-static") ); + } else { + serverMenu->Append( MP_ADDTOSTATIC, _("Mark servers as static") ); + serverMenu->Append( MP_REMOVEFROMSTATIC, _("Mark servers as non-static") ); + } + serverMenu->AppendSeparator(); - - serverMenu->Append( MP_REMOVE, _("Remove server(s)") ); + + if (GetSelectedItemCount() == 1) { + serverMenu->Append( MP_REMOVE, _("Remove server") ); + } else { + serverMenu->Append( MP_REMOVE, _("Remove servers") ); + } serverMenu->Append( MP_REMOVEALL, _("Remove all servers") ); - + serverMenu->AppendSeparator(); - - serverMenu->Append( MP_GETED2KLINK, _("Copy ED2k link(s) to clipboard") ); + if (GetSelectedItemCount() == 1) { + serverMenu->Append( MP_GETED2KLINK, _("Copy eD2k link to clipboard") ); + } else { + serverMenu->Append( MP_GETED2KLINK, _("Copy eD2k links to clipboard") ); + } serverMenu->Enable( MP_REMOVEFROMSTATIC, enable_static_off ); serverMenu->Enable( MP_ADDTOSTATIC, enable_static_on ); @@ -553,7 +565,12 @@ } } else if ( event.GetId() == MP_REMOVE ) { if ( GetSelectedItemCount() ) { - wxString question = _("Are you sure that you wish to delete the selected server(s)?"); + wxString question; + if (GetSelectedItemCount() == 1) { + question = _("Are you sure that you wish to delete the selected server?"); + } else { + question = _("Are you sure that you wish to delete the selected servers?"); + } if ( wxMessageBox( question, _("Cancel"), wxICON_QUESTION | wxYES_NO, this) == wxYES ) { RemoveAllServers(wxLIST_STATE_SELECTED); diff -ruN -d amule-2.2.0~svn20080218/src/ServerSocket.cpp amule-2.2.2/src/ServerSocket.cpp --- amule-2.2.0~svn20080218/src/ServerSocket.cpp 2008-01-31 17:44:50.000000000 +0000 +++ amule-2.2.2/src/ServerSocket.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -256,7 +256,7 @@ } else { servername = _("Server"); } - AddLogLineM(false, CFormat( _("Error: %s (%s) - %s") ) + AddLogLineM(false, CFormat( _("ERROR: %s (%s) - %s") ) % servername % Uint32_16toStringIP_Port(cur_server->GetIP(), cur_server->GetPort()) % message.Mid(5,message.Len()).Trim(wxT(" :"))); @@ -271,7 +271,7 @@ } else { servername = _("Server"); } - AddLogLineM(false, CFormat( _("Warning: %s (%s) - %s") ) + AddLogLineM(false, CFormat( _("WARNING: %s (%s) - %s") ) % servername % Uint32_16toStringIP_Port(cur_server->GetIP(), cur_server->GetPort()) % message.Mid(5,message.Len()).Trim(wxT(" :"))); @@ -415,6 +415,11 @@ theApp->ShowConnectionState(); AddLogLineM(false, wxString::Format(_("New clientid is %u"),new_id)); + if (::IsLowID(new_id)) { + AddLogLineM(true, _("WARNING: You have received Low-ID!")); + AddLogLineM(false, _("\tMost likely this is because you're behind a firewall or router.")); + AddLogLineM(false, _("\tFor more information, please refer to http://wiki.amule.org")); + } theApp->downloadqueue->ResetLocalServerRequests(); break; @@ -531,7 +536,7 @@ } delete servers; if (addcount) { - AddLogLineM(false, wxString::Format(_("Received %d new servers"), addcount)); + AddLogLineM(false, wxString::Format(wxPLURAL("Received %d new server", "Received %d new servers", addcount), addcount)); } theApp->serverlist->SaveServerMet(); AddLogLineM(false, _("Saving of server-list completed.")); @@ -562,15 +567,11 @@ client->SetCryptLayerSupport(false); client->SetCryptLayerRequires(false); } else { - client->SetCryptLayerSupport((byCryptOptions & 0x01) != 0); - client->SetCryptLayerRequest((byCryptOptions & 0x02) != 0); - client->SetCryptLayerRequires((byCryptOptions & 0x04) != 0); + client->SetConnectOptions(byCryptOptions, true, false); } } else if (size >= 23) { client->SetUserHash(achUserHash); - client->SetCryptLayerSupport((byCryptOptions & 0x01) != 0); - client->SetCryptLayerRequest((byCryptOptions & 0x02) != 0); - client->SetCryptLayerRequires((byCryptOptions & 0x04) != 0); + client->SetConnectOptions(byCryptOptions, true, false); } if (client) { diff -ruN -d amule-2.2.0~svn20080218/src/ServerUDPSocket.cpp amule-2.2.2/src/ServerUDPSocket.cpp --- amule-2.2.0~svn20080218/src/ServerUDPSocket.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ServerUDPSocket.cpp 2008-03-23 12:45:12.000000000 +0000 @@ -60,14 +60,13 @@ } -void CServerUDPSocket::OnPacketReceived(const wxIPV4address& addr, byte* buffer, size_t length) +void CServerUDPSocket::OnPacketReceived(uint32 serverip, uint16 serverport, byte* buffer, size_t length) { wxCHECK_RET(length >= 2, wxT("Invalid packet.")); size_t nPayLoadLen = length; byte* pBuffer = buffer; - uint32 serverip = StringIPtoUint32(addr.IPAddress()); - CServer* pServer = theApp->serverlist->GetServerByIPUDP(serverip, addr.Service(), true); + CServer* pServer = theApp->serverlist->GetServerByIPUDP(serverip, serverport, true); if (pServer && thePrefs::IsServerCryptLayerUDPEnabled() && ((pServer->GetServerKeyUDP() != 0 && pServer->SupportsObfuscationUDP()) || (pServer->GetCryptPingReplyPending() && pServer->GetChallenge() != 0))) { @@ -93,7 +92,7 @@ if (protocol == OP_EDONKEYPROT) { CMemFile data(pBuffer + 2, nPayLoadLen - 2); - ProcessPacket(data, opcode, addr.IPAddress(), addr.Service()); + ProcessPacket(data, opcode, serverip, serverport); } else { AddDebugLogLineM( false, logServerUDP, wxString::Format( wxT("Received invalid packet, protocol (0x%x) and opcode (0x%x)"), protocol, opcode )); @@ -103,14 +102,15 @@ } -void CServerUDPSocket::ProcessPacket(CMemFile& packet, uint8 opcode, const wxString& host, uint16 port) +void CServerUDPSocket::ProcessPacket(CMemFile& packet, uint8 opcode, uint32 ip, uint16 port) { - CServer* update = theApp->serverlist->GetServerByIPUDP(StringIPtoUint32(host), port, true); + CServer* update = theApp->serverlist->GetServerByIPUDP(ip, port, true); unsigned size = packet.GetLength(); theStats::AddDownOverheadOther(size); AddDebugLogLineM( false, logServerUDP, - CFormat( wxT("Received UDP server packet from %s:%u, opcode (0x%x)")) % host % port % opcode ); + CFormat( wxT("Received UDP server packet from %s:%u, opcode (0x%x)")) % + Uint32toStringIP(ip) % port % opcode ); try { // Imported: OP_GLOBSEARCHRES, OP_GLOBFOUNDSOURCES & OP_GLOBSERVSTATRES @@ -122,7 +122,7 @@ // process all search result packets do{ - theApp->searchlist->ProcessUDPSearchAnswer(packet, true, StringIPtoUint32(host), port - 4); + theApp->searchlist->ProcessUDPSearchAnswer(packet, true, ip, port - 4); if (packet.GetPosition() + 2 < size) { // An additional packet? @@ -148,7 +148,7 @@ do { CMD4Hash fileid = packet.ReadHash(); if (CPartFile* file = theApp->downloadqueue->GetFileByID(fileid)) { - file->AddSources(packet, StringIPtoUint32(host), port-4, SF_REMOTE_SERVER, false); + file->AddSources(packet, ip, port-4, SF_REMOTE_SERVER, false); } else { AddDebugLogLineM( true, logServerUDP, wxT("Sources received for unknown file") ); // skip sources for that file @@ -174,7 +174,7 @@ case OP_GLOBSERVSTATRES:{ // Reviewed with 0.47c if (!update) { - throw wxString(wxT("Unknown server on a OP_GLOBSERVSTATRES packet (") + host + wxString::Format(wxT(":%d)"), port-4)); + throw wxString(wxT("Unknown server on a OP_GLOBSERVSTATRES packet (") + Uint32toStringIP(ip) + wxString::Format(wxT(":%d)"), port-4)); } if( size < 12) { throw(wxString(wxString::Format(wxT("Invalid OP_GLOBSERVSTATRES packet (size=%u)"),size))); @@ -336,12 +336,12 @@ } -void CServerUDPSocket::OnReceiveError(int errorCode, const wxIPV4address& addr) +void CServerUDPSocket::OnReceiveError(int errorCode, uint32 ip, uint16 port) { - CMuleUDPSocket::OnReceiveError(errorCode, addr); + CMuleUDPSocket::OnReceiveError(errorCode, ip, port); // If we are not currently pinging this server, increase the failure counter - CServer* pServer = theApp->serverlist->GetServerByIPUDP(StringIPtoUint32(addr.IPAddress()), addr.Service(), true); + CServer* pServer = theApp->serverlist->GetServerByIPUDP(ip, port, true); if (pServer && !pServer->GetCryptPingReplyPending() && GetTickCount() - pServer->GetLastPinged() >= SEC2MS(30)) { pServer->AddFailedCount(); Notify_ServerRefresh(pServer); diff -ruN -d amule-2.2.0~svn20080218/src/ServerUDPSocket.h amule-2.2.2/src/ServerUDPSocket.h --- amule-2.2.0~svn20080218/src/ServerUDPSocket.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ServerUDPSocket.h 2008-03-23 12:45:12.000000000 +0000 @@ -41,11 +41,11 @@ void SendPacket(CPacket* packet, CServer* host, bool delPacket, bool rawpacket, uint16 port_offset); void OnHostnameResolved(uint32 ip); - virtual void OnReceiveError(int errorCode, const wxIPV4address& addr); + virtual void OnReceiveError(int errorCode, uint32 ip, uint16 port); private: - void OnPacketReceived(const wxIPV4address& addr, byte* buffer, size_t length); - void ProcessPacket(CMemFile& packet, uint8 opcode, const wxString& host, uint16 port); + void OnPacketReceived(uint32 ip, uint16 port, byte* buffer, size_t length); + void ProcessPacket(CMemFile& packet, uint8 opcode, uint32 ip, uint16 port); void SendQueue(); struct ServerUDPPacket { diff -ruN -d amule-2.2.0~svn20080218/src/ServerWnd.cpp amule-2.2.2/src/ServerWnd.cpp --- amule-2.2.0~svn20080218/src/ServerWnd.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/ServerWnd.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -159,7 +159,7 @@ wxListCtrl* ED2KInfoList = CastChild( ID_ED2KINFO, wxListCtrl ); ED2KInfoList->DeleteAllItems(); - ED2KInfoList->InsertItem(0, _("ED2K Status:")); + ED2KInfoList->InsertItem(0, _("eD2k Status:")); if (theApp->IsConnectedED2K()) { ED2KInfoList->SetItem(0, 1, _("Connected")); diff -ruN -d amule-2.2.0~svn20080218/src/SharedFileList.cpp amule-2.2.2/src/SharedFileList.cpp --- amule-2.2.0~svn20080218/src/SharedFileList.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/SharedFileList.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -48,7 +48,7 @@ #include #include #include "GuiEvents.h" // Needed for Notify_* - +#include "SHAHashSet.h" // Needed for CAICHHash #include "kademlia/kademlia/Kademlia.h" @@ -349,16 +349,13 @@ } if (addedFiles == 0) { - AddLogLineM(false, wxString::Format(_("Found %i known shared files"), - GetCount())); - + AddLogLineM(false, wxString::Format(wxPLURAL("Found %i known shared file", "Found %i known shared files", GetCount()), GetCount())); + // Make sure the AICH-hashes are up to date. CThreadScheduler::AddTask(new CAICHSyncTask()); } else { // New files, AICH thread will be run at the end of the hashing thread. - AddLogLineM(false, - wxString::Format(_("Found %i known shared files, %i unknown"), - GetCount(), addedFiles)); + AddLogLineM(false, wxString::Format(wxPLURAL("Found %i known shared file, %i unknown", "Found %i known shared files, %i unknown", GetCount()), GetCount(), addedFiles)); } } @@ -367,7 +364,7 @@ bool CheckDirectory(const wxString& a, const CPath& b) { if (CPath(a).IsSameDir(b)) { - AddLogLineM(true, CFormat( _("ERROR! Attempted to share %s") ) % a); + AddLogLineM(true, CFormat( _("ERROR: Attempted to share %s") ) % a); return true; } @@ -1062,4 +1059,33 @@ return false; } + + +void CSharedFileList::CheckAICHHashes(const std::list& hashes) +{ + wxMutexLocker locker(list_mut); + + // Now we check that all files which are in the sharedfilelist have a + // corresponding hash in our list. Those how don't are queued for hashing. + CKnownFileMap::iterator it = m_Files_map.begin(); + for (; it != m_Files_map.end(); ++it) { + const CKnownFile* file = it->second; + + if (file->IsPartFile() == false) { + CAICHHashSet* hashset = file->GetAICHHashset(); + + if (hashset->GetStatus() == AICH_HASHSETCOMPLETE) { + if (std::find(hashes.begin(), hashes.end(), hashset->GetMasterHash()) != hashes.end()) { + continue; + } + } + + hashset->SetStatus(AICH_ERROR); + + CThreadScheduler::AddTask(new CHashingTask(file)); + } + } + +} + // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/SharedFileList.h amule-2.2.2/src/SharedFileList.h --- amule-2.2.0~svn20080218/src/SharedFileList.h 2008-02-12 19:28:43.000000000 +0000 +++ amule-2.2.2/src/SharedFileList.h 2008-04-04 12:53:45.000000000 +0000 @@ -41,6 +41,7 @@ class CUpDownClient; class CPublishKeywordList; class CPath; +class CAICHHash; typedef std::map CKnownFileMap; @@ -56,8 +57,8 @@ short GetFilePriorityByID(const CMD4Hash& filehash); const CKnownFile* GetFileByIndex(unsigned int index) const; void CreateOfferedFilePacket(CKnownFile* cur_file, CMemFile* files, CServer* pServer, CUpDownClient* pClient); - uint32 GetCount() { wxMutexLocker lock(list_mut); return m_Files_map.size(); } - uint32 GetFileCount() { wxMutexLocker lock(list_mut); return m_Files_map.size(); } + size_t GetCount() { wxMutexLocker lock(list_mut); return m_Files_map.size(); } + size_t GetFileCount() { wxMutexLocker lock(list_mut); return m_Files_map.size(); } void CopyFileList(std::vector& out_list); void UpdateItem(CKnownFile* toupdate); unsigned AddFilesFromDirectory(const CPath& directory); @@ -74,6 +75,12 @@ void RemoveKeywords(CKnownFile* pFile); // This is actually unused, but keep it here - will be needed later. void ClearKadSourcePublishInfo(); + + /** + * Checks for files which missing or wrong AICH hashes. + * Those that are found are scheduled for ACIH hashing. + */ + void CheckAICHHashes(const std::list& hashes); private: bool AddFile(CKnownFile* pFile); diff -ruN -d amule-2.2.0~svn20080218/src/SharedFilesCtrl.cpp amule-2.2.2/src/SharedFilesCtrl.cpp --- amule-2.2.0~svn20080218/src/SharedFilesCtrl.cpp 2008-02-17 00:12:04.000000000 +0000 +++ amule-2.2.2/src/SharedFilesCtrl.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -159,21 +159,18 @@ m_menu->AppendSeparator(); } m_menu->Append(MP_GETMAGNETLINK,_("Copy magnet &URI to clipboard")); - m_menu->Append(MP_GETED2KLINK,_("Copy ED2k &link to clipboard")); - m_menu->Append(MP_GETSOURCEED2KLINK,_("Copy ED2k link to clipboard (&Source)")); - m_menu->Append(MP_GETCRYPTSOURCEDED2KLINK,_("Copy ED2k link to clipboard (Source) (&With Crypt options)")); - m_menu->Append(MP_GETHOSTNAMESOURCEED2KLINK,_("Copy ED2k link to clipboard (&Hostname)")); - m_menu->Append(MP_GETHOSTNAMECRYPTSOURCEED2KLINK,_("Copy ED2k link to clipboard (Hostname) (With &Crypt options)")); - m_menu->Append(MP_GETAICHED2KLINK,_("Copy ED2k link to clipboard (&AICH info)")); + m_menu->Append(MP_GETED2KLINK,_("Copy eD2k &link to clipboard")); + m_menu->Append(MP_GETSOURCEED2KLINK,_("Copy eD2k link to clipboard (&Source)")); + m_menu->Append(MP_GETCRYPTSOURCEDED2KLINK,_("Copy eD2k link to clipboard (Source) (&With Crypt options)")); + m_menu->Append(MP_GETHOSTNAMESOURCEED2KLINK,_("Copy eD2k link to clipboard (&Hostname)")); + m_menu->Append(MP_GETHOSTNAMECRYPTSOURCEED2KLINK,_("Copy eD2k link to clipboard (Hostname) (With &Crypt options)")); + m_menu->Append(MP_GETAICHED2KLINK,_("Copy eD2k link to clipboard (&AICH info)")); m_menu->Append(MP_WS,_("Copy feedback to clipboard")); - m_menu->Enable(MP_GETAICHED2KLINK, file->GetAICHHashset()->HasValidMasterHash() && - (file->GetAICHHashset()->GetStatus() == AICH_VERIFIED || - file->GetAICHHashset()->GetStatus() == AICH_HASHSETCOMPLETE)); + m_menu->Enable(MP_GETAICHED2KLINK, file->HasProperAICHHashSet()); m_menu->Enable(MP_GETHOSTNAMESOURCEED2KLINK, !thePrefs::GetYourHostname().IsEmpty()); m_menu->Enable(MP_GETHOSTNAMECRYPTSOURCEED2KLINK, !thePrefs::GetYourHostname().IsEmpty()); m_menu->Enable(MP_RENAME, file->IsPartFile()); - m_menu->Enable(MP_WS, file->IsPartFile()); PopupMenu( m_menu, event.GetPoint() ); @@ -189,14 +186,15 @@ wxString feed; long index = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); while (index != -1) { - CKnownFile* file = (CKnownFile*)GetItemData(index); - - if (file->IsPartFile()) { - feed += dynamic_cast(file)->GetFeedback(); + if (feed.IsEmpty()) { + feed = CFormat(_("Feedback from: %s (%s)\n\n")) % thePrefs::GetUserNick() % GetFullMuleVersion(); + } else { + feed += wxT("\n"); } - + feed += ((CKnownFile*)GetItemData(index))->GetFeedback(); index = GetNextItem(index, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } + if (!feed.IsEmpty()) { theApp->CopyTextToClipboard(feed); } @@ -305,7 +303,7 @@ if ( event.GetId() == MP_GETSOURCEED2KLINK || event.GetId() == MP_GETCRYPTSOURCEDED2KLINK) { if ( !theApp->IsConnectedED2K() || theApp->serverconnect->IsLowID() ) { - wxMessageBox(_("You need a HighID to create a valid sourcelink"), _("Warning"), wxOK | wxICON_ERROR, this); + wxMessageBox(_("You need a HighID to create a valid sourcelink"), _("WARNING"), wxOK | wxICON_ERROR, this); return; } @@ -355,7 +353,7 @@ CKnownFile* file2 = (CKnownFile*)item2; int mod = (sortData & CMuleListCtrl::SORT_DES) ? -1 : 1; - bool altSorting = (sortData & CMuleListCtrl::SORT_ALT); + bool altSorting = (sortData & CMuleListCtrl::SORT_ALT) > 0; switch (sortData & CMuleListCtrl::COLUMN_MASK) { // Sort by filename. @@ -510,7 +508,7 @@ for ( int i = 0; i < GetColumnCount(); ++i ) { const int columnWidth = GetColumnWidth(i); - if (columnWidth) { + if (columnWidth > 2*SPARE_PIXELS_HORZ) { wxRect columnRect( columnLeft + SPARE_PIXELS_HORZ, rect.y, columnWidth - 2 * SPARE_PIXELS_HORZ, rect.height); @@ -651,21 +649,42 @@ const ArrayOfUInts16& list = file->IsPartFile() ? ((CPartFile*)file)->m_SrcpartFrequency : file->m_AvailPartFrequency; + wxPen old_pen = dc->GetPen(); + wxBrush old_brush = dc->GetBrush(); + bool bFlat = thePrefs::UseFlatBar(); + + wxRect barRect = rect; + if (!bFlat) { // round bar has a black border, the bar itself is 1 pixel less on each border + barRect.x ++; + barRect.y ++; + barRect.height -= 2; + barRect.width -= 2; + } static CBarShader s_ChunkBar; s_ChunkBar.SetFileSize( file->GetFileSize() ); - s_ChunkBar.SetHeight( rect.GetHeight() ); - s_ChunkBar.SetWidth( rect.GetWidth() ); + s_ChunkBar.SetHeight( barRect.GetHeight() ); + s_ChunkBar.SetWidth( barRect.GetWidth() ); s_ChunkBar.Set3dDepth( CPreferences::Get3DDepth() ); - s_ChunkBar.Fill( RGB(255, 0, 0) ); + uint64 end = 0; for ( unsigned int i = 0; i < list.size(); ++i ) { - if ( list[i] ) { - COLORREF color = RGB(0, (210-(22*( list[i] - 1 ) ) < 0) ? 0 : 210-(22*( list[i] - 1 ) ), 255); - uint64 start = PARTSIZE * static_cast(i); - uint64 end = PARTSIZE * static_cast(i + 1); - s_ChunkBar.FillRange(start, end, color); - } + COLORREF color = list[i] ? (RGB(0, (210-(22*( list[i] - 1 ) ) < 0) ? 0 : 210-(22*( list[i] - 1 ) ), 255)) + : RGB(255, 0, 0); + uint64 start = PARTSIZE * static_cast(i); + end = PARTSIZE * static_cast(i + 1); + s_ChunkBar.FillRange(start, end, color); } - s_ChunkBar.Draw(dc, rect.GetLeft(), rect.GetTop(), CPreferences::UseFlatBar() ); + s_ChunkBar.FillRange(end + 1, file->GetFileSize() - 1, RGB(255, 0, 0)); + s_ChunkBar.Draw(dc, barRect.x, barRect.y, bFlat); + + if (!bFlat) { + // Draw black border + dc->SetPen( *wxBLACK_PEN ); + dc->SetBrush( *wxTRANSPARENT_BRUSH ); + dc->DrawRectangle(rect); + } + + dc->SetPen( old_pen ); + dc->SetBrush( old_brush ); } void CSharedFilesCtrl::OnGetRazorStats( wxCommandEvent& WXUNUSED(event) ) diff -ruN -d amule-2.2.0~svn20080218/src/StatTree.cpp amule-2.2.2/src/StatTree.cpp --- amule-2.2.0~svn20080218/src/StatTree.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/StatTree.cpp 2008-03-29 17:17:44.000000000 +0000 @@ -45,11 +45,22 @@ #include // Needed for CEC_StatTree_Node_Tag #endif + +#ifndef EC_REMOTE +uint32_t NewStatTreeItemId() +{ + static uint32_t lastid = 0; + + return ++lastid; +} +#endif + /* CStatTreeItemBase */ #ifdef EC_REMOTE CStatTreeItemBase::CStatTreeItemBase(const CECTag *tag) : m_label(((CEC_StatTree_Node_Tag*)tag)->GetDisplayString()) + , m_uniqueid(tag->GetTagByNameSafe(EC_TAG_STATTREE_NODEID)->GetInt()) { wxASSERT(tag->GetTagName() == EC_TAG_STATTREE_NODE); @@ -191,6 +202,7 @@ if (IsVisible()) { wxMutexLocker lock(m_lock); CECTag *tag = new CECTag(EC_TAG_STATTREE_NODE, m_label); + tag->AddTag(CECTag(EC_TAG_STATTREE_NODEID, m_uniqueid)); AddECValues(tag); m_visible_counter = max_children - 1; for (std::list::const_iterator it = m_children.begin(); @@ -282,10 +294,11 @@ } -/* CStatTreeItemCounter */ +/* CStatTreeItemCounterTmpl */ #ifndef AMULE_DAEMON -wxString CStatTreeItemCounter::GetDisplayString() const +template +wxString CStatTreeItemCounterTmpl<_Tp>::GetDisplayString() const { wxString my_label = wxGetTranslation(m_label); // This is needed for client names, for example @@ -303,61 +316,19 @@ wxString result = CFormat(wxT("%u")) % m_value; if ((m_flags & stShowPercent) && m_parent) { result.append(wxString::Format(wxT(" (%.2f%%)"), - ((double)m_value / ((CStatTreeItemCounter*)m_parent)->m_value) * 100.0)); + ((double)m_value / ((CStatTreeItemCounterTmpl<_Tp>*)m_parent)->m_value) * 100.0)); } return label % result; } } -#endif - -void CStatTreeItemCounter::AddECValues(CECTag *tag) const -{ - CECTag value(EC_TAG_STAT_NODE_VALUE, (uint64)m_value); - if (m_displaymode == dmBytes) { - value.AddTag(CECTag(EC_TAG_STAT_VALUE_TYPE, (uint8)EC_VALUE_BYTES)); - } else { - value.AddTag(CECTag(EC_TAG_STAT_VALUE_TYPE, (uint8)EC_VALUE_ISTRING)); - if ((m_flags & stShowPercent) && m_parent) { - CECTag tmp(EC_TAG_STAT_NODE_VALUE, - ((double)m_value / ((CStatTreeItemCounter*)m_parent)->m_value) * 100.0); - tmp.AddTag(CECTag(EC_TAG_STAT_VALUE_TYPE, (uint8)EC_VALUE_DOUBLE)); - value.AddTag(tmp); - } - } - tag->AddTag(value); -} +template wxString CStatTreeItemCounter::GetDisplayString() const; +template wxString CStatTreeItemNativeCounter::GetDisplayString() const; -#ifndef USE_64BIT_ARCH -/* CStatTreeItemNativeCounter */ - -#ifndef AMULE_DAEMON -wxString CStatTreeItemNativeCounter::GetDisplayString() const -{ - wxString my_label = wxGetTranslation(m_label); - if (my_label == m_label) { - if (m_label.Right(4) == wxT(": %s")) { - my_label = wxGetTranslation( - m_label.Mid(0, m_label.Length() - 4)) + - wxString(wxT(": %s")); - } - } - CFormat label(my_label); - if (m_displaymode == dmBytes) { - return label % CastItoXBytes(m_value); - } else { - wxString result = CFormat(wxT("%u")) % m_value; - if ((m_flags & stShowPercent) && m_parent) { - result.append(wxString::Format( - wxT(" (%.2f%%)"), - ((double)m_value / ((CStatTreeItemNativeCounter*)m_parent)->m_value) * 100.0)); - } - return label % result; - } -} #endif -void CStatTreeItemNativeCounter::AddECValues(CECTag *tag) const +template +void CStatTreeItemCounterTmpl<_Tp>::AddECValues(CECTag *tag) const { CECTag value(EC_TAG_STAT_NODE_VALUE, (uint64)m_value); if (m_displaymode == dmBytes) { @@ -366,15 +337,16 @@ value.AddTag(CECTag(EC_TAG_STAT_VALUE_TYPE, (uint8)EC_VALUE_ISTRING)); if ((m_flags & stShowPercent) && m_parent) { CECTag tmp(EC_TAG_STAT_NODE_VALUE, - ((double)m_value / ((CStatTreeItemNativeCounter*)m_parent)->m_value) * 100.0); + ((double)m_value / ((CStatTreeItemCounterTmpl<_Tp>*)m_parent)->m_value) * 100.0); tmp.AddTag(CECTag(EC_TAG_STAT_VALUE_TYPE, (uint8)EC_VALUE_DOUBLE)); value.AddTag(tmp); } } tag->AddTag(value); } -#endif /* USE_64BIT_ARCH */ +template void CStatTreeItemCounter::AddECValues(CECTag *tag) const; +template void CStatTreeItemNativeCounter::AddECValues(CECTag *tag) const; /* CStatTreeItemUlDlCounter */ diff -ruN -d amule-2.2.0~svn20080218/src/StatTree.h amule-2.2.2/src/StatTree.h --- amule-2.2.0~svn20080218/src/StatTree.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/StatTree.h 2008-05-22 13:02:26.000000000 +0000 @@ -36,37 +36,17 @@ */ -#ifndef EC_REMOTE // CLIENT_GUI - -// Try to determine sizeof(int) -#if defined(__INT_MAX__) && defined(__LONG_MAX__) - #if __INT_MAX__ != __LONG_MAX__ - #define USE_64BIT_ARCH - #endif +#ifndef EC_REMOTE // i.e. not CLIENT_GUI +# define VIRTUAL virtual #else - // #include would be enough, but we shouldn't depend on - // non-standard includes. However, we still do it :) -#ifndef _MSC_VER - #include -#endif - #ifdef __WORDSIZE - #if __WORDSIZE == 64 - #define USE_64BIT_ARCH - #endif - #endif +# define VIRTUAL #endif -// If we cannot determine wordsize, assume that we use 32bit arch. - -#define VIRTUAL virtual - -#else -#define VIRTUAL -#endif /* !EC_REMOTE / EC_REMOTE */ #include // Needed for std::list #include // Needed for wxString #include // Needed for wxMutex +#include "Types.h" #ifndef EC_REMOTE @@ -127,6 +107,8 @@ class CECTag; +uint32_t NewStatTreeItemId(); + /** * Base tree item class @@ -143,7 +125,8 @@ * @param flags Flags to use. */ CStatTreeItemBase(const wxString &label, unsigned flags = stNone) - : m_label(label), m_parent(NULL), m_flags(flags), m_id(0) + : m_label(label), m_parent(NULL), m_flags(flags), m_id(0), + m_uniqueid(NewStatTreeItemId()) {} #else /** @@ -151,8 +134,8 @@ * * @param label Visible text for the item. */ - CStatTreeItemBase(const wxString &label) - : m_label(label) + CStatTreeItemBase(const wxString &label, uint32_t uniqueid) + : m_label(label), m_uniqueid(uniqueid) {} /** @@ -280,6 +263,11 @@ * core tree while updating the GUI tree. */ wxMutex& GetLock() { return m_lock; } + + /** + * Returns the unique ID of this node. + */ + uint32_t GetUniqueId() const { return m_uniqueid; } #endif /* !AMULE_DAEMON */ /** @@ -335,6 +323,9 @@ uint32_t m_visible_counter; #endif + //! Unique ID of this node. + uint32_t m_uniqueid; + //! Children of this node. std::list m_children; @@ -464,14 +455,15 @@ /** - * Counter-type tree item. + * Counter-type tree item template. * * Able to show percentage compared to parent, hide itself * when value is zero, and nice functions for changing the value. * stShowPercent and stHideIfZero flags take effect only on * this node. */ -class CStatTreeItemCounter : public CStatTreeItemBase +template +class CStatTreeItemCounterTmpl : public CStatTreeItemBase { public: /** @@ -479,7 +471,7 @@ * * @see CStatTreeItemBase::CStatTreeItemBase */ - CStatTreeItemCounter( + CStatTreeItemCounterTmpl( const wxString &label, unsigned flags = stNone) : @@ -490,22 +482,22 @@ /** * Retrieve counter value. */ - uint64_t GetValue() const { return m_value; } + _Tp GetValue() const { return m_value; } /** * Retrieve counter value. */ - operator uint64_t() const { return m_value; } + operator _Tp() const { return m_value; } /** * Set counter to given value. */ - void SetValue(uint64_t value) { m_value = value; } + void SetValue(_Tp value) { m_value = value; } /** * Set counter to given value. */ - void operator=(uint64_t value) { m_value = value; } + void operator=(_Tp value) { m_value = value; } /** * Increase value by 1. @@ -520,12 +512,12 @@ /** * Increase value by given amount. */ - void operator+=(uint64_t value) { m_value += value; } + void operator+=(_Tp value) { m_value += value; } /** * Decrease value by given amount. */ - void operator-=(uint64_t value) { m_value -= value; } + void operator-=(_Tp value) { m_value -= value; } /** * Sets the desired display mode of value. @@ -558,118 +550,15 @@ virtual void AddECValues(CECTag *tag) const; //! Actual value of the counter. - uint64_t m_value; + _Tp m_value; //! Display mode of the value. enum EDisplayMode m_displaymode; }; -// For speed reasons, we define a 32bit counter for 32bit archs. -#ifndef USE_64BIT_ARCH -/** - * Counter-type tree item, with native-sized value. - * - * On 32bit arcs it's defined as a separate class, on - * 64bit archs it is typedef'd to CStatTreeItemCounter. - * - * @see CStatTreeItemCounter - */ -class CStatTreeItemNativeCounter : public CStatTreeItemBase -{ -public: - - /** - * Constructor. - * - * @see CStatTreeItemCounter::CStatTreeItemCounter - */ - CStatTreeItemNativeCounter( - const wxString &label, - unsigned flags = stNone) - : - CStatTreeItemBase(label, flags), - m_value(0), - m_displaymode(dmDefault) {} - - /** - * Retrieve counter value. - */ - uint32_t GetValue() const { return m_value; } - - /** - * Retrieve counter value. - */ - operator uint32_t() const { return m_value; } - - /** - * Set counter to given value. - */ - void SetValue(uint32_t value) { m_value = value; } - - /** - * Set counter to given value. - */ - void operator=(uint32_t value) { m_value = value; } - - /** - * Increase value by 1. - */ - void operator++() { ++m_value; } - - /** - * Decrease value by 1. - */ - void operator--() { --m_value; } - - /** - * Increase value by given amount. - */ - void operator+=(uint32_t value) { m_value += value; } - - /** - * Decrease value by given amount. - */ - void operator-=(uint32_t value) { m_value -= value; } - - /** - * Sets the desired display mode of value. - */ - void SetDisplayMode(enum EDisplayMode mode) { m_displaymode = mode; } - -#ifndef AMULE_DAEMON - /** - * @see CStatTreeItemCounter::GetDisplayString() - */ - virtual wxString GetDisplayString() const; -#endif - - /** - * @see CStatTreeItemCounter::IsVisible() - */ - virtual bool IsVisible() const - { - return (m_flags & stHideIfZero) ? (m_value != 0) : true; - } - -protected: - /** - * Add values to EC tag being generated. - * - * @param tag The tag to which values should be added. - * - * @see CStatTreeItemBase::AddECValues - */ - virtual void AddECValues(CECTag *tag) const; - - //! Actual value of the counter. - uint32_t m_value; +typedef CStatTreeItemCounterTmpl CStatTreeItemCounter; +typedef CStatTreeItemCounterTmpl CStatTreeItemNativeCounter; - //! Display mode of the value. - enum EDisplayMode m_displaymode; -}; -#else // using 64bit arch - typedef CStatTreeItemCounter CStatTreeItemNativeCounter; -#endif /* USE_64BIT_ARCH */ /** * A counter, which does not display its value :P diff -ruN -d amule-2.2.0~svn20080218/src/Statistics.cpp amule-2.2.2/src/Statistics.cpp --- amule-2.2.0~svn20080218/src/Statistics.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/Statistics.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -160,6 +160,7 @@ CStatTreeItemPackets* CStatistics::s_sourceXchgUpOverhead; CStatTreeItemPackets* CStatistics::s_serverUpOverhead; CStatTreeItemPackets* CStatistics::s_kadUpOverhead; +CStatTreeItemCounter* CStatistics::s_cryptUpOverhead; CStatTreeItemNativeCounter* CStatistics::s_activeUploads; CStatTreeItemNativeCounter* CStatistics::s_waitingUploads; CStatTreeItemCounter* CStatistics::s_totalSuccUploads; @@ -173,6 +174,7 @@ CStatTreeItemPackets* CStatistics::s_sourceXchgDownOverhead; CStatTreeItemPackets* CStatistics::s_serverDownOverhead; CStatTreeItemPackets* CStatistics::s_kadDownOverhead; +CStatTreeItemCounter* CStatistics::s_cryptDownOverhead; CStatTreeItemNativeCounter* CStatistics::s_foundSources; CStatTreeItemNativeCounter* CStatistics::s_activeDownloads; @@ -655,6 +657,8 @@ s_totalUpOverhead->AddPacketCounter(s_serverUpOverhead); s_kadUpOverhead = (CStatTreeItemPackets*)tmpRoot2->AddChild(new CStatTreeItemPackets(wxTRANSLATE("Kad Overhead (Packets): %s"))); s_totalUpOverhead->AddPacketCounter(s_kadUpOverhead); + s_cryptUpOverhead = (CStatTreeItemCounter*)tmpRoot2->AddChild(new CStatTreeItemCounter(wxTRANSLATE("Crypt overhead (UDP): %s"))); + s_cryptUpOverhead->SetDisplayMode(dmBytes); s_activeUploads = (CStatTreeItemNativeCounter*)tmpRoot2->AddChild(new CStatTreeItemNativeCounter(wxTRANSLATE("Active Uploads: %s"))); s_waitingUploads = (CStatTreeItemNativeCounter*)tmpRoot2->AddChild(new CStatTreeItemNativeCounter(wxTRANSLATE("Waiting Uploads: %s"))); s_totalSuccUploads = (CStatTreeItemCounter*)tmpRoot2->AddChild(new CStatTreeItemCounter(wxTRANSLATE("Total successful upload sessions: %s"))); @@ -674,16 +678,18 @@ s_totalDownOverhead->AddPacketCounter(s_serverDownOverhead); s_kadDownOverhead = (CStatTreeItemPackets*)tmpRoot2->AddChild(new CStatTreeItemPackets(wxTRANSLATE("Kad Overhead (Packets): %s"))); s_totalDownOverhead->AddPacketCounter(s_kadDownOverhead); + s_cryptDownOverhead = (CStatTreeItemCounter*)tmpRoot2->AddChild(new CStatTreeItemCounter(wxTRANSLATE("Crypt overhead (UDP): %s"))); + s_cryptDownOverhead->SetDisplayMode(dmBytes); s_foundSources = (CStatTreeItemNativeCounter*)tmpRoot2->AddChild(new CStatTreeItemNativeCounter(wxTRANSLATE("Found Sources: %s"), stSortChildren | stSortByValue)); s_activeDownloads = (CStatTreeItemNativeCounter*)tmpRoot2->AddChild(new CStatTreeItemNativeCounter(wxTRANSLATE("Active Downloads (chunks): %s"))); tmpRoot1->AddChild(new CStatTreeItemRatio(wxTRANSLATE("Session UL:DL Ratio (Total): %s"), s_sessionUpload, s_sessionDownload), 3); tmpRoot1 = s_statTree->AddChild(new CStatTreeItemBase(wxTRANSLATE("Connection"))); - tmpRoot1->AddChild(new CStatTreeItemAverageSpeed(wxTRANSLATE("Average Downloadrate (Session): %s"), s_sessionDownload, s_uptime)); - tmpRoot1->AddChild(new CStatTreeItemAverageSpeed(wxTRANSLATE("Average Uploadrate (Session): %s"), s_sessionUpload, s_uptime)); - s_downloadrate = (CStatTreeItemRateCounter*)tmpRoot1->AddChild(new CStatTreeItemRateCounter(wxTRANSLATE("Max Downloadrate (Session): %s"), true, 30000)); - s_uploadrate = (CStatTreeItemRateCounter*)tmpRoot1->AddChild(new CStatTreeItemRateCounter(wxTRANSLATE("Max Uploadrate (Session): %s"), true, 30000)); + tmpRoot1->AddChild(new CStatTreeItemAverageSpeed(wxTRANSLATE("Average download rate (Session): %s"), s_sessionDownload, s_uptime)); + tmpRoot1->AddChild(new CStatTreeItemAverageSpeed(wxTRANSLATE("Average upload rate (Session): %s"), s_sessionUpload, s_uptime)); + s_downloadrate = (CStatTreeItemRateCounter*)tmpRoot1->AddChild(new CStatTreeItemRateCounter(wxTRANSLATE("Max download rate (Session): %s"), true, 30000)); + s_uploadrate = (CStatTreeItemRateCounter*)tmpRoot1->AddChild(new CStatTreeItemRateCounter(wxTRANSLATE("Max upload rate (Session): %s"), true, 30000)); s_reconnects = (CStatTreeItemReconnects*)tmpRoot1->AddChild(new CStatTreeItemReconnects(wxTRANSLATE("Reconnects: %i"))); s_sinceFirstTransfer = (CStatTreeItemTimer*)tmpRoot1->AddChild(new CStatTreeItemTimer(wxTRANSLATE("Time Since First Transfer: %s"), stHideIfZero)); s_sinceConnected = (CStatTreeItemTimer*)tmpRoot1->AddChild(new CStatTreeItemTimer(wxTRANSLATE("Connected To Server Since: %s"))); @@ -694,14 +700,14 @@ tmpRoot1->AddChild(new CStatTreeItemPeakConnections(wxTRANSLATE("Peak Connections (estimate): %i"))); s_clients = (CStatTreeItemHiddenCounter*)s_statTree->AddChild(new CStatTreeItemHiddenCounter(wxTRANSLATE("Clients"), stSortChildren | stSortByValue)); - s_unknown = (CStatTreeItemCounter*)s_clients->AddChild(new CStatTreeItemCounter(wxTRANSLATE("Unknown") wxT(": %s")), 6); + s_unknown = (CStatTreeItemCounter*)s_clients->AddChild(new CStatTreeItemCounter(wxString(wxTRANSLATE("Unknown")) + wxT(": %s")), 6); //s_lowID = (CStatTreeItem*)s_clients->AddChild(new CStatTreeItem(wxTRANSLATE("LowID: %u (%.2f%% Total %.2f%% Known)")), 5); //s_secIdentOnOff = (CStatTreeItem*)s_clients->AddChild(new CStatTreeItem(wxTRANSLATE("SecIdent On/Off: %u (%.2f%%) : %u (%.2f%%)")), 4); #ifdef __DEBUG__ s_hasSocket = (CStatTreeItemNativeCounter*)s_clients->AddChild(new CStatTreeItemNativeCounter(wxT("HasSocket: %s")), 3); #endif - s_filtered = (CStatTreeItemNativeCounter*)s_clients->AddChild(new CStatTreeItemNativeCounter(wxTRANSLATE("Filtered") wxT(": %s")), 2); - s_banned = (CStatTreeItemNativeCounter*)s_clients->AddChild(new CStatTreeItemNativeCounter(wxTRANSLATE("Banned") wxT(": %s")), 1); + s_filtered = (CStatTreeItemNativeCounter*)s_clients->AddChild(new CStatTreeItemNativeCounter(wxString(wxTRANSLATE("Filtered")) + wxT(": %s")), 2); + s_banned = (CStatTreeItemNativeCounter*)s_clients->AddChild(new CStatTreeItemNativeCounter(wxString(wxTRANSLATE("Banned")) + wxT(": %s")), 1); s_clients->AddChild(new CStatTreeItemTotalClients(wxTRANSLATE("Total: %i Known: %i"), s_clients, s_unknown), 0x80000000); // TODO: Use counters? @@ -722,7 +728,7 @@ s_numberOfShared = (CStatTreeItemCounter*)tmpRoot1->AddChild(new CStatTreeItemCounter(wxTRANSLATE("Number of Shared Files: %s"))); s_sizeOfShare = (CStatTreeItemCounter*)tmpRoot1->AddChild(new CStatTreeItemCounter(wxTRANSLATE("Total size of Shared Files: %s"))); s_sizeOfShare->SetDisplayMode(dmBytes); - tmpRoot1->AddChild(new CStatTreeItemAverage(wxTRANSLATE("Average filesize: %s"), s_sizeOfShare, s_numberOfShared, dmBytes)); + tmpRoot1->AddChild(new CStatTreeItemAverage(wxTRANSLATE("Average file size: %s"), s_sizeOfShare, s_numberOfShared, dmBytes)); } @@ -737,11 +743,6 @@ s_avgConnections->SetValue(theApp->listensocket->GetAverageConnections()); -#if 0 - (*cli13) = wxString::Format(_("LowID: %u (%.2f%% Total %.2f%% Known)"),#lowid , (#total>0)?((double)100*#lowid/#total):0, (double)100*#knownLowID/#known); - (*cli14) = wxString::Format(_("SecIdent On/Off: %u (%.2f%%) : %u (%.2f%%)"), #secOn , ((#eMule+#aMule)>0)?((double)100*#secOn / (#eMule+#aMule)):0, #secOff, ((#eMule+#aMule)>0)?((double)100*#secOff /(#eMule+#aMule) ):0); -#endif - // get serverstats // TODO: make these realtime, too uint32 servfail; @@ -933,7 +934,7 @@ s_start_time = GetTickCount64(); // Init Tree - s_statTree = new CStatTreeItemBase(_("Statistics")); + s_statTree = new CStatTreeItemBase(_("Statistics"), 0); // Clear stat data container for (int i = 0; i < sdTotalItems; ++i) { diff -ruN -d amule-2.2.0~svn20080218/src/Statistics.h amule-2.2.2/src/Statistics.h --- amule-2.2.0~svn20080218/src/Statistics.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/Statistics.h 2008-05-25 08:03:22.000000000 +0000 @@ -27,9 +27,8 @@ #ifndef STATISTICS_H #define STATISTICS_H -#include "GetTickCount.h" // Needed for GetTickCount64() #include "StatTree.h" // Needed for CStatTreeItem* classes - +#include "GetTickCount.h" // Needed for GetTickCount64() #include // Needed for std::deque @@ -252,6 +251,7 @@ static void AddUpOverheadSourceExchange(uint32 size){ (*s_sourceXchgUpOverhead) += size; (*s_upOverheadRate) += size; } static void AddUpOverheadServer(uint32 size) { (*s_serverUpOverhead) += size; (*s_upOverheadRate) += size; } static void AddUpOverheadKad(uint32 size) { (*s_kadUpOverhead) += size; (*s_upOverheadRate) += size; } + static void AddUpOverheadCrypt(uint32_t size) { (*s_cryptUpOverhead) += size; } static void AddUpOverheadOther(uint32 size) { (*s_totalUpOverhead) += size; (*s_upOverheadRate) += size; } static double GetUpOverheadRate() { return s_upOverheadRate->GetRate(); } static void AddSuccessfulUpload() { ++(*s_totalSuccUploads); } @@ -271,6 +271,7 @@ static void AddDownOverheadSourceExchange(uint32 size){ (*s_sourceXchgDownOverhead) += size; (*s_downOverheadRate) += size; } static void AddDownOverheadServer(uint32 size) { (*s_serverDownOverhead) += size; (*s_downOverheadRate) += size; } static void AddDownOverheadKad(uint32 size) { (*s_kadDownOverhead) += size; (*s_downOverheadRate) += size; } + static void AddDownOverheadCrypt(uint32_t size) { (*s_cryptDownOverhead) += size; } static void AddDownOverheadOther(uint32 size) { (*s_totalDownOverhead) += size; (*s_downOverheadRate) += size; } static double GetDownOverheadRate() { return s_downOverheadRate->GetRate(); } static void AddFoundSource() { ++(*s_foundSources); } @@ -411,6 +412,7 @@ static CStatTreeItemPackets* s_sourceXchgUpOverhead; static CStatTreeItemPackets* s_serverUpOverhead; static CStatTreeItemPackets* s_kadUpOverhead; + static CStatTreeItemCounter* s_cryptUpOverhead; static CStatTreeItemNativeCounter* s_activeUploads; static CStatTreeItemNativeCounter* s_waitingUploads; static CStatTreeItemCounter* s_totalSuccUploads; @@ -424,6 +426,7 @@ static CStatTreeItemPackets* s_sourceXchgDownOverhead; static CStatTreeItemPackets* s_serverDownOverhead; static CStatTreeItemPackets* s_kadDownOverhead; + static CStatTreeItemCounter* s_cryptDownOverhead; static CStatTreeItemNativeCounter* s_foundSources; static CStatTreeItemNativeCounter* s_activeDownloads; diff -ruN -d amule-2.2.0~svn20080218/src/StatisticsDlg.cpp amule-2.2.2/src/StatisticsDlg.cpp --- amule-2.2.0~svn20080218/src/StatisticsDlg.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/StatisticsDlg.cpp 2008-03-30 14:47:22.000000000 +0000 @@ -33,6 +33,22 @@ #include "muuli_wdr.h" // Needed for statsDlg() #include "StatisticsDlg.h" // Interface declarations + +class CTreeItemData : public wxTreeItemData +{ + public: + explicit CTreeItemData(uint32_t uniqueid) + : m_uniqueid(uniqueid) + {} + + uint32_t GetUniqueId() const throw() { return m_uniqueid; } + void SetUniqueId(uint32_t val) throw() { m_uniqueid = val; } + + private: + uint32_t m_uniqueid; +}; + + // CStatisticsDlg panel COLORREF CStatisticsDlg::getColors(unsigned num) @@ -139,7 +155,7 @@ } } -void CStatisticsDlg::UpdateStatGraphs(bool bStatsVisible, const uint32 peakconnections, const GraphUpdateInfo& update) +void CStatisticsDlg::UpdateStatGraphs(const uint32 peakconnections, const GraphUpdateInfo& update) { std::vector v1(3); @@ -158,7 +174,7 @@ v3[2] = const_cast(&update.connections[2]); const std::vector &apfConn(v3); - if (!bStatsVisible) { + if (!IsShownOnScreen()) { pscopeDL->DelayPoints(); pscopeUL->DelayPoints(); pscopeConn->DelayPoints(); @@ -175,8 +191,10 @@ pscopeConn->SetRange(0.0, (float)nScale*pscopeConn->GetUpperLimit(), 1); } - if (!bStatsVisible) + + if (!IsShownOnScreen()) { return; + } pscopeDL->AppendPoints(update.timestamp, apfDown); pscopeUL->AppendPoints(update.timestamp, apfUp); @@ -239,18 +257,36 @@ #endif } +void CStatisticsDlg::GetExpandedNodes(NodeIdSet& nodeset, const wxTreeItemId& root) +{ + wxTreeItemIdValue cookie; + wxTreeItemId temp_it = stattree->GetFirstChild(root,cookie); + + while (temp_it.IsOk()) { + if (stattree->IsExpanded(temp_it)) { + nodeset.insert(dynamic_cast(stattree->GetItemData(temp_it))->GetUniqueId()); + } + if (stattree->ItemHasChildren(temp_it)) { + GetExpandedNodes(nodeset, temp_it); + } + temp_it = stattree->GetNextSibling(temp_it); + } +} void CStatisticsDlg::ShowStatistics(bool init) { + NodeIdSet ExpandedNodes; + // If it's not the first initialization of the tree, i.e. application startup if (!init) { + GetExpandedNodes(ExpandedNodes, stattree->GetRootItem()); // Update sorting / get tree via EC m_stats->UpdateStatsTree(); } CStatTreeItemBase* treeRoot = theStats::GetTreeRoot(); wxTreeItemId root = stattree->GetRootItem(); - FillTree(treeRoot, root); + FillTree(treeRoot, root, ExpandedNodes); #ifdef CLIENT_GUI if (!init) { static bool firstUpdate = true; @@ -275,7 +311,7 @@ } -void CStatisticsDlg::FillTree(CStatTreeItemBase* statssubtree, wxTreeItemId& StatsGUITree) +void CStatisticsDlg::FillTree(CStatTreeItemBase* statssubtree, wxTreeItemId& StatsGUITree, const NodeIdSet& expandednodes) { wxMutexLocker lock(statssubtree->GetLock()); @@ -294,14 +330,22 @@ // There's already a child there, update it. stattree->SetItemText(temp_GUI_it, (*temp_it)->GetDisplayString()); temp_item = temp_GUI_it; + uint32_t uid = (*temp_it)->GetUniqueId(); + dynamic_cast(stattree->GetItemData(temp_GUI_it))->SetUniqueId(uid); + if (expandednodes.find(uid) != expandednodes.end()) { + stattree->Expand(temp_GUI_it); + } else { + stattree->Collapse(temp_GUI_it); + } temp_GUI_it = stattree->GetNextSibling(temp_GUI_it); } else { // No more child on GUI, add them. temp_item = stattree->AppendItem(StatsGUITree,(*temp_it)->GetDisplayString()); + stattree->SetItemData(temp_item, new CTreeItemData((*temp_it)->GetUniqueId())); } // Has childs? if ((*temp_it)->HasVisibleChildren()) { - FillTree((*temp_it), temp_item); + FillTree((*temp_it), temp_item, expandednodes); } else { stattree->DeleteChildren(temp_item); } diff -ruN -d amule-2.2.0~svn20080218/src/StatisticsDlg.h amule-2.2.2/src/StatisticsDlg.h --- amule-2.2.0~svn20080218/src/StatisticsDlg.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/StatisticsDlg.h 2008-03-30 14:47:22.000000000 +0000 @@ -28,6 +28,10 @@ #include // Needed for wxPanel +#include // Needed for std::set + +typedef std::set NodeIdSet; + class COScopeCtrl; class CStatistics; @@ -48,12 +52,13 @@ CStatisticsDlg(wxWindow* pParent, CStatistics* stats); ~CStatisticsDlg(); - void UpdateStatGraphs(bool bStatsVisible, const uint32 peakconnections, const GraphUpdateInfo& update); + void UpdateStatGraphs(const uint32 peakconnections, const GraphUpdateInfo& update); void SetUpdatePeriod(int step); void ResetAveragingTime(); void ShowStatistics(bool init = false); void SetARange(bool SetDownload, int maxValue); - void FillTree(CStatTreeItemBase* statssubtree, wxTreeItemId& StatsGUITree); + void FillTree(CStatTreeItemBase* statssubtree, wxTreeItemId& StatsGUITree, const NodeIdSet& expandednodes); + void GetExpandedNodes(NodeIdSet& nodeset, const wxTreeItemId& root); void Init(); void InitTree(); void InitGraphs(); diff -ruN -d amule-2.2.0~svn20080218/src/Tag.cpp amule-2.2.2/src/Tag.cpp --- amule-2.2.0~svn20080218/src/Tag.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/Tag.cpp 2008-05-08 10:28:26.000000000 +0000 @@ -68,6 +68,10 @@ m_nSize = rTag.GetBlobSize(); m_pData = new unsigned char[rTag.GetBlobSize()]; memcpy(m_pData, rTag.GetBlob(), rTag.GetBlobSize()); + } else if (rTag.IsBsob()) { + m_nSize = rTag.GetBsobSize(); + m_pData = new unsigned char[rTag.GetBsobSize()]; + memcpy(m_pData, rTag.GetBsob(), rTag.GetBsobSize()); } else { wxASSERT(0); m_uVal = 0; @@ -219,6 +223,12 @@ delete [] m_pData; m_pData = p; memcpy(m_pData, rhs.GetBlob(), rhs.GetBlobSize()); + } else if (rhs.IsBsob()) { + m_nSize = rhs.GetBsobSize(); + unsigned char *p = new unsigned char[rhs.GetBsobSize()]; + delete [] m_pData; + m_pData = p; + memcpy(m_pData, rhs.GetBsob(), rhs.GetBsobSize()); } else { wxASSERT(0); m_uVal = 0; diff -ruN -d amule-2.2.0~svn20080218/src/TerminationProcess.h amule-2.2.2/src/TerminationProcess.h --- amule-2.2.0~svn20080218/src/TerminationProcess.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/TerminationProcess.h 2008-03-02 03:36:14.000000000 +0000 @@ -24,6 +24,10 @@ // +#ifndef TERMINATIONPROCESS +#define TERMINATIONPROCESS + + #include @@ -39,3 +43,6 @@ wxString m_cmd; }; + +#endif // TERMINATIONPROCESS + diff -ruN -d amule-2.2.0~svn20080218/src/TerminationProcessAmuleweb.cpp amule-2.2.2/src/TerminationProcessAmuleweb.cpp --- amule-2.2.0~svn20080218/src/TerminationProcessAmuleweb.cpp 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/src/TerminationProcessAmuleweb.cpp 2008-03-02 03:36:14.000000000 +0000 @@ -0,0 +1,46 @@ +// +// This file is part of the aMule Project. +// +// Copyright (c) 2008-2008 Marcelo Roberto Jimenez ( phoenix@amule.org ) +// Copyright (c) 2008-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + + +#include "TerminationProcessAmuleweb.h" + + +CTerminationProcessAmuleweb::CTerminationProcessAmuleweb(const wxString &cmd, long *webserver_pid) +: +CTerminationProcess(cmd), +m_webserver_pid(webserver_pid) +{ +} + + +void CTerminationProcessAmuleweb::OnTerminate(int pid, int status) +{ + // Tell the application that the webserver is no longer running + *m_webserver_pid = 0; + + // Normal termination processing here + CTerminationProcess::OnTerminate(pid, status); +} + diff -ruN -d amule-2.2.0~svn20080218/src/TerminationProcessAmuleweb.h amule-2.2.2/src/TerminationProcessAmuleweb.h --- amule-2.2.0~svn20080218/src/TerminationProcessAmuleweb.h 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/src/TerminationProcessAmuleweb.h 2008-03-02 03:36:14.000000000 +0000 @@ -0,0 +1,48 @@ +// +// This file is part of the aMule Project. +// +// Copyright (c) 2008-2008 Marcelo Roberto Jimenez ( phoenix@amule.org ) +// Copyright (c) 2008-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + + +#ifndef TERMINATIONPROCESSAMULEWEB +#define TERMINATIONPROCESSAMULEWEB + + +#include "TerminationProcess.h" // for CTerminationProcess + + +// This is the handler for process termination events. +// Used on some calls to wxExecute(). +class CTerminationProcessAmuleweb : public CTerminationProcess +{ +private: + long *m_webserver_pid; + +public: + CTerminationProcessAmuleweb(const wxString &cmd, long *webserver_pid); + virtual void OnTerminate(int pid, int status); +}; + + +#endif // TERMINATIONPROCESSAMULEWEB + diff -ruN -d amule-2.2.0~svn20080218/src/TextClient.cpp amule-2.2.2/src/TextClient.cpp --- amule-2.2.0~svn20080218/src/TextClient.cpp 2008-01-30 01:35:32.000000000 +0000 +++ amule-2.2.2/src/TextClient.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -28,11 +28,14 @@ #include "config.h" // Needed for VERSION #endif +#include + +#include "TextClient.h" + #ifndef __WXMSW__ #include // Do_not_auto_remove #endif -#include "TextClient.h" //------------------------------------------------------------------- @@ -248,7 +251,7 @@ case CMD_ID_SET_IPFILTER_CLIENTS_OFF: case CMD_ID_SET_IPFILTER_SERVERS_OFF: { - if (CmdId == CMD_ID_SET_IPFILTER_CLIENTS_ON | CmdId == CMD_ID_SET_IPFILTER_CLIENTS_OFF) { + if (CmdId == CMD_ID_SET_IPFILTER_CLIENTS_ON || CmdId == CMD_ID_SET_IPFILTER_CLIENTS_OFF) { CmdId = CMD_ID_GET_IPFILTER_STATE_CLIENTS; } else if (CmdId == CMD_ID_SET_IPFILTER_SERVERS_ON || CmdId == CMD_ID_SET_IPFILTER_SERVERS_OFF) { CmdId = CMD_ID_GET_IPFILTER_STATE_SERVERS; @@ -665,7 +668,7 @@ const CECTag *connMaxUL = tab->GetTagByName(EC_TAG_CONN_MAX_UL); const CECTag *connMaxDL = tab->GetTagByName(EC_TAG_CONN_MAX_DL); if (connMaxUL && connMaxDL) { - s << wxString::Format(_("Bandwidth Limits: Up: %u kB/s, Down: %u kB/s.\n"), + s << wxString::Format(_("Bandwidth limits: Up: %u kB/s, Down: %u kB/s.\n"), (uint16)connMaxUL->GetInt(), (uint16)connMaxDL->GetInt()); } @@ -683,7 +686,7 @@ case EC_OP_STATS: { CEC_ConnState_Tag *connState = (CEC_ConnState_Tag*)response->GetTagByName(EC_TAG_CONNSTATE); if (connState) { - s << _("ED2K") << wxT(": "); + s << _("eD2k") << wxT(": "); if (connState->IsConnectedED2K()) { CECTag *server = connState->GetTagByName(EC_TAG_SERVER); CECTag *serverName = server ? server->GetTagByName(EC_TAG_SERVER_NAME) : NULL; @@ -840,42 +843,27 @@ wxTRANSLATE("Show connection status, current up/download speeds, etc.\n"), CMD_PARAM_NEVER); m_commands.AddCommand(wxT("Statistics"), CMD_ID_STATTREE, wxTRANSLATE("Show full statistics tree."), - wxTRANSLATE("Optionally, a number in the range 0-255 can be passed as an argument to this\n" - "command, which tells how many entries of the client version subtrees should be\n" - "shown. Passing 0 or omitting it means 'unlimited'.\n" - "\n" - "Example: 'statistics 5' will show only the top 5 versions for each client type.\n")); + wxTRANSLATE("Optionally, a number in the range 0-255 can be passed as an argument to this\ncommand, which tells how many entries of the client version subtrees should be\nshown. Passing 0 or omitting it means 'unlimited'.\n\nExample: 'statistics 5' will show only the top 5 versions for each client type.\n")); - m_commands.AddCommand(wxT("Shutdown"), CMD_ID_SHUTDOWN, wxTRANSLATE("Shutdown aMule."), - wxTRANSLATE("Shutdown the remote running core (amule/amuled).\n" - "This will also shut down the text client, since it is unusable without a\n" - "running core.\n"), CMD_PARAM_NEVER); + m_commands.AddCommand(wxT("Shutdown"), CMD_ID_SHUTDOWN, wxTRANSLATE("Shut down aMule."), + wxTRANSLATE("Shut down the remote running core (amule/amuled).\nThis will also shut down the text client, since it is unusable without a\nrunning core.\n"), CMD_PARAM_NEVER); tmp = m_commands.AddCommand(wxT("Reload"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Reloads the given object."), wxEmptyString, CMD_PARAM_NEVER); tmp->AddCommand(wxT("Shared"), CMD_ID_RELOAD_SHARED, wxTRANSLATE("Reloads shared files list."), wxEmptyString, CMD_PARAM_NEVER); tmp->AddCommand(wxT("IPFilter"), CMD_ID_RELOAD_IPFILTER, wxTRANSLATE("Reloads IP Filter table from file."), wxEmptyString, CMD_PARAM_NEVER); tmp = m_commands.AddCommand(wxT("Connect"), CMD_ID_CONNECT, wxTRANSLATE("Connect to the network."), - wxTRANSLATE("This will connect to all networks that are enabled in Preferences.\n" - "You may also optionally specify a server address in IP:Port form, to connect to\n" - "that server only. The IP must be a dotted decimal IPv4 address,\n" - "or a resolvable DNS name."), CMD_PARAM_OPTIONAL); - tmp->AddCommand(wxT("ED2K"), CMD_ID_CONNECT_ED2K, wxTRANSLATE("Connect to ED2K only."), wxEmptyString, CMD_PARAM_NEVER); + wxTRANSLATE("This will connect to all networks that are enabled in Preferences.\nYou may also optionally specify a server address in IP:Port form, to connect to\nthat server only. The IP must be a dotted decimal IPv4 address,\nor a resolvable DNS name."), CMD_PARAM_OPTIONAL); + tmp->AddCommand(wxT("ED2K"), CMD_ID_CONNECT_ED2K, wxTRANSLATE("Connect to eD2k only."), wxEmptyString, CMD_PARAM_NEVER); tmp->AddCommand(wxT("Kad"), CMD_ID_CONNECT_KAD, wxTRANSLATE("Connect to Kad only."), wxEmptyString, CMD_PARAM_NEVER); tmp = m_commands.AddCommand(wxT("Disconnect"), CMD_ID_DISCONNECT, wxTRANSLATE("Disconnect from the network."), wxTRANSLATE("This will disconnect from all networks that are currently connected.\n"), CMD_PARAM_NEVER); - tmp->AddCommand(wxT("ED2K"), CMD_ID_DISCONNECT_ED2K, wxTRANSLATE("Disconnect from ED2K only."), wxEmptyString, CMD_PARAM_NEVER); + tmp->AddCommand(wxT("ED2K"), CMD_ID_DISCONNECT_ED2K, wxTRANSLATE("Disconnect from eD2k only."), wxEmptyString, CMD_PARAM_NEVER); tmp->AddCommand(wxT("Kad"), CMD_ID_DISCONNECT_KAD, wxTRANSLATE("Disconnect from Kad only."), wxEmptyString, CMD_PARAM_NEVER); - m_commands.AddCommand(wxT("Add"), CMD_ID_ADDLINK, wxTRANSLATE("Adds an ed2k or magnet link to core."), - wxTRANSLATE("The ed2k link to be added can be:\n" - "*) a file link (ed2k://|file|...), it will be added to the download queue,\n" - "*) a server link (ed2k://|server|...), it will be added to the server list,\n" - "*) or a serverlist link, in which case all servers in the list will be added to the\n" - " server list.\n" - "\n" - "The magnet link must contain the ed2k hash and file length.\n"), CMD_PARAM_ALWAYS); + m_commands.AddCommand(wxT("Add"), CMD_ID_ADDLINK, wxTRANSLATE("Adds an eD2k or magnet link to core."), + wxTRANSLATE("The eD2k link to be added can be:\n*) a file link (ed2k://|file|...), it will be added to the download queue,\n*) a server link (ed2k://|server|...), it will be added to the server list,\n*) or a serverlist link, in which case all servers in the list will be added to the\n server list.\n\nThe magnet link must contain the eD2k hash and file length.\n"), CMD_PARAM_ALWAYS); tmp = m_commands.AddCommand(wxT("Set"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Set a preference value."), wxEmptyString, CMD_PARAM_NEVER); @@ -890,8 +878,7 @@ tmp3->AddCommand(wxT("On"), CMD_ID_SET_IPFILTER_SERVERS_ON, wxTRANSLATE("Turn IP filtering on for servers."), wxEmptyString, CMD_PARAM_NEVER); tmp3->AddCommand(wxT("Off"), CMD_ID_SET_IPFILTER_SERVERS_OFF, wxTRANSLATE("Turn IP filtering off for servers."), wxEmptyString, CMD_PARAM_NEVER); tmp2->AddCommand(wxT("Level"), CMD_ID_SET_IPFILTER_LEVEL, wxTRANSLATE("Select IP filtering level."), - wxTRANSLATE("Valid filtering levels are in the range 0-255, and it's default (initial)\n" - "value is 127.\n"), CMD_PARAM_ALWAYS); + wxTRANSLATE("Valid filtering levels are in the range 0-255, and it's default (initial)\nvalue is 127.\n"), CMD_PARAM_ALWAYS); tmp2 = tmp->AddCommand(wxT("BwLimit"), CMD_ERR_INCOMPLETE, wxTRANSLATE("Set bandwidth limits."), wxTRANSLATE("The value given to these commands has to be in kilobytes/sec.\n"), CMD_PARAM_NEVER); @@ -912,11 +899,7 @@ tmp->AddCommand(wxT("BwLimits"), CMD_ID_GET_BWLIMITS, wxTRANSLATE("Get bandwidth limits."), wxEmptyString, CMD_PARAM_NEVER); tmp = m_commands.AddCommand(wxT("Search"), CMD_ID_SEARCH, wxTRANSLATE("Makes a search."), - wxTRANSLATE("A search type has to be specified by giving the type:\n" - " GLOBAL\n" - " LOCAL\n" - " KAD\n" - "Example: 'search kad file' will execute a kad search for \"file\".\n"), CMD_PARAM_ALWAYS); + wxTRANSLATE("A search type has to be specified by giving the type:\n GLOBAL\n LOCAL\n KAD\nExample: 'search kad file' will execute a kad search for \"file\".\n"), CMD_PARAM_ALWAYS); tmp->AddCommand(wxT("global"), CMD_ID_SEARCH_GLOBAL, wxTRANSLATE("Executes a global search."), wxEmptyString, CMD_PARAM_ALWAYS); tmp->AddCommand(wxT("local"), CMD_ID_SEARCH_LOCAL, wxTRANSLATE("Executes a local search"), wxEmptyString, CMD_PARAM_ALWAYS); tmp->AddCommand(wxT("kad"), CMD_ID_SEARCH_KAD, wxTRANSLATE("Executes a kad search"), wxEmptyString, CMD_PARAM_ALWAYS); @@ -928,8 +911,7 @@ wxTRANSLATE("Shows the progress of a search.\n"), CMD_PARAM_NEVER); m_commands.AddCommand(wxT("Download"), CMD_ID_DOWNLOAD, wxTRANSLATE("Start downloading a file"), - wxTRANSLATE("The number of a file from the last search has to be given.\n" - "Example: 'download 12' will start to download the file with the number 12 of the previous search.\n"), CMD_PARAM_ALWAYS); + wxTRANSLATE("The number of a file from the last search has to be given.\nExample: 'download 12' will start to download the file with the number 12 of the previous search.\n"), CMD_PARAM_ALWAYS); // @@ -967,9 +949,8 @@ // #define DEPRECATED(OLDCMD, ID, NEWCMD, PARAM) \ - m_commands.AddCommand(wxT(OLDCMD), CMD_ID_##ID | CMD_DEPRECATED, CFormat(wxTRANSLATE("Deprecated command, now '%s'.")) % wxT(NEWCMD), \ - CFormat(wxTRANSLATE("This is a deprecated command, and may be removed in the future.\n" \ - "Use '%s' instead.\n")) % wxT(NEWCMD), CMD_PARAM_##PARAM) + m_commands.AddCommand(wxT(OLDCMD), CMD_ID_##ID | CMD_DEPRECATED, CFormat(wxTRANSLATE("Deprecated command, use '%s' instead.")) % wxT(NEWCMD), \ + CFormat(wxTRANSLATE("This is a deprecated command, and may be removed in the future.\nUse '%s' instead.\n")) % wxT(NEWCMD), CMD_PARAM_##PARAM) DEPRECATED("Stats", STATUS, "Status", NEVER); DEPRECATED("SetIPFilter", SET_IPFILTER, "Set IPFilter", OPTIONAL); diff -ruN -d amule-2.2.0~svn20080218/src/ThreadTasks.cpp amule-2.2.2/src/ThreadTasks.cpp --- amule-2.2.0~svn20080218/src/ThreadTasks.cpp 2008-02-12 19:28:43.000000000 +0000 +++ amule-2.2.2/src/ThreadTasks.cpp 2008-05-28 12:27:19.000000000 +0000 @@ -31,12 +31,11 @@ #include "PartFile.h" // Needed for CPartFile #include "Logger.h" // Needed for Add(Debug)LogLineM #include // Needed for CFormat -#include // Needed for CheckFileExists #include "amule.h" // Needed for theApp #include "KnownFileList.h" // Needed for theApp->knownfiles #include "Preferences.h" // Needed for thePrefs #include "ScopedPtr.h" // Needed for CScopedPtr and CScopedArray - +#include "PlatformSpecific.h" // Needed for CanFSHandleSpecialChars //! This hash represents the value for an empty MD4 hashing @@ -309,35 +308,9 @@ AddDebugLogLineM( false, logAICHThread, wxT("Masterhashes of known files have been loaded.") ); -#ifndef AMULE_DAEMON - // Since we will be modifying objects in the main thread, - // we need to keep it from messing with the same objects. - wxMutexGuiLocker guiLock; -#else - //#warning Thread-safety needed -#endif - // Now we check that all files which are in the sharedfilelist have a // corresponding hash in our list. Those how don't are queued for hashing. - for (unsigned i = 0; i < theApp->sharedfiles->GetCount(); ++i) { - const CKnownFile* kfile = theApp->sharedfiles->GetFileByIndex(i); - - if (TestDestroy()) { - break; - } else if (kfile && !kfile->IsPartFile()) { - CAICHHashSet* hashset = kfile->GetAICHHashset(); - - if (hashset->GetStatus() == AICH_HASHSETCOMPLETE) { - if (std::find(hashlist.begin(), hashlist.end(), hashset->GetMasterHash()) != hashlist.end()) { - continue; - } - } - - hashset->SetStatus(AICH_ERROR); - - CThreadScheduler::AddTask(new CHashingTask(kfile)); - } - } + theApp->sharedfiles->CheckAICHHashes(hashlist); } @@ -442,9 +415,7 @@ } } - // Check if the target directory is on a Fat32 FS, since that needs extra cleanups. - bool isFat32 = (CheckFileSystem(targetPath) == FS_IsFAT32); - CPath dstName = m_filename.Cleanup(true, isFat32); + CPath dstName = m_filename.Cleanup(true, PlatformSpecific::CanFSHandleSpecialChars(targetPath)); // Avoid empty filenames ... if (!dstName.IsOk()) { @@ -509,6 +480,119 @@ +//////////////////////////////////////////////////////////// +// CAllocateFileTask + +#ifdef HAVE_FALLOCATE +# include +#elif defined HAVE_SYS_FALLOCATE +# include +# include +# include +#elif defined HAVE_POSIX_FALLOCATE +# define _XOPEN_SOURCE 600 +# include +# ifdef HAVE_FCNTL_H +# include +# endif +#endif +#include +#include + +CAllocateFileTask::CAllocateFileTask(CPartFile *file, bool pause) + // GetPrintable is used to improve the readability of the log. + : CThreadTask(wxT("Allocating"), file->GetFullName().RemoveExt().GetPrintable(), ETP_High), + m_file(file), m_pause(pause), m_result(ENOSYS) +{ + wxASSERT(file != NULL); +} + +void CAllocateFileTask::Entry() +{ + if (m_file->GetFileSize() == 0) { + m_result = 0; + return; + } + + uint64_t minFree = thePrefs::IsCheckDiskspaceEnabled() ? thePrefs::GetMinFreeDiskSpace() : 0; + int64_t freeSpace = CPath::GetFreeSpaceAt(thePrefs::GetTempDir()); + + // Don't even try to allocate, if there's no space to complete the operation. + if (freeSpace != wxInvalidOffset) { + if ((uint64_t)freeSpace < m_file->GetFileSize() + minFree) { + m_result = ENOSPC; + return; + } + } + + CFile file; + file.Open(m_file->GetFullName().RemoveExt(), CFile::read_write); + +#ifdef __WXMSW__ + try { + // File is already created as non-sparse, so we only need to set the length. + // This will fail to allocate the file e.g. under wine on linux/ext3, + // but works with NTFS and FAT32. + file.Seek(m_file->GetFileSize() - 1, wxFromStart); + file.WriteUInt8(0); + file.Close(); + m_result = 0; + } catch (const CSafeIOException&) { + m_result = errno; + } +#else + // Use kernel level routines if possible +# ifdef HAVE_FALLOCATE + m_result = fallocate(file.fd(), 0, 0, m_file->GetFileSize()); +# elif defined HAVE_SYS_FALLOCATE + m_result = syscall(SYS_fallocate, file.fd(), 0, (loff_t)0, (loff_t)m_file->GetFileSize()); + if (m_result == -1) { + m_result = errno; + } +# elif defined HAVE_POSIX_FALLOCATE + // otherwise use glibc implementation, if available + m_result = posix_fallocate(file.fd(), 0, m_file->GetFileSize()); +# endif + + if (m_result != 0 && m_result != ENOSPC) { + // If everything else fails, use slow-and-dirty method of allocating the file: write the whole file with zeroes. +# define BLOCK_SIZE 1048576 /* Write 1 MB blocks */ + void *zero = calloc(1, BLOCK_SIZE); + if (zero != NULL) { + try { + uint64_t size = m_file->GetFileSize(); + for (; size >= BLOCK_SIZE; size -= BLOCK_SIZE) { + file.Write(zero, BLOCK_SIZE); + } + if (size > 0) { + file.Write(zero, size); + } + file.Close(); + m_result = 0; + } catch (const CSafeIOException&) { + m_result = errno; + } + free(zero); + } else { + m_result = ENOMEM; + } + } + +#endif + if (file.IsOpened()) { + file.Close(); + } +} + +void CAllocateFileTask::OnExit() +{ + // Notify the app that the preallocation has finished for this file. + CAllocFinishedEvent evt(m_file, m_pause, m_result); + + wxPostEvent(wxTheApp, evt); +} + + //////////////////////////////////////////////////////////// // CHashingEvent @@ -582,4 +666,15 @@ return m_fullPath; } + +//////////////////////////////////////////////////////////// +// CAllocFinishedEvent + +DEFINE_LOCAL_EVENT_TYPE(MULE_EVT_ALLOC_FINISHED) + +wxEvent *CAllocFinishedEvent::Clone() const +{ + return new CAllocFinishedEvent(m_file, m_pause, m_result); +} + // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/ThreadTasks.h amule-2.2.2/src/ThreadTasks.h --- amule-2.2.0~svn20080218/src/ThreadTasks.h 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/ThreadTasks.h 2008-05-23 23:11:22.000000000 +0000 @@ -65,7 +65,6 @@ */ CHashingTask(const CPath& path, const CPath& filename, const CPartFile* part = NULL); -protected: /** * Schedules a KnownFile to have a AICH hashset created, used by CAICHSyncTask. * @@ -74,6 +73,7 @@ **/ CHashingTask(const CKnownFile* toAICHHash); +protected: //! Specifies which hashes should be calculated when the task is executed. enum EHashes { EH_AICH = 1, @@ -109,8 +109,6 @@ EHashes m_toHash; //! If a partfile or an AICH hashing, this pointer stores it for callbacks. const CKnownFile* m_owner; - - friend class CAICHSyncTask; }; @@ -170,6 +168,33 @@ }; +/** + * This task preallocates space for a newly created partfile. + */ +class CAllocateFileTask : public CThreadTask +{ + public: + /** Creates a thread that will allocate disk space for the full file. */ + CAllocateFileTask(CPartFile *file, bool pause); + + protected: + /** See CThreadTask::Entry */ + virtual void Entry(); + + /** See CThreadTask::OnExit */ + virtual void OnExit(); + + private: + //! The partfile for which this task allocates space. + CPartFile * m_file; + + //! Should this download start paused? + bool m_pause; + + //! Result of the preallocation. + long m_result; +}; + /** * This event is used to signal the completion of a hashing event. @@ -233,6 +258,45 @@ }; +/** + * This event is sent when preallocation of a new partfile is finished. + */ +DECLARE_LOCAL_EVENT_TYPE(MULE_EVT_ALLOC_FINISHED, -1); +class CAllocFinishedEvent : public wxEvent +{ + public: + /** Constructor, see getter function for description of parameters. */ + CAllocFinishedEvent(CPartFile *file, bool pause, long result) + : wxEvent(-1, MULE_EVT_ALLOC_FINISHED), + m_file(file), m_pause(pause), m_result(result) + {} + + /** @see wxEvent::Clone */ + virtual wxEvent *Clone() const; + + /** Returns the partfile for which preallocation was requested. */ + CPartFile *GetFile() const throw() { return m_file; } + + /** Returns whether the partfile should start paused. */ + bool IsPaused() const throw() { return m_pause; } + + /** Returns the result of preallocation: true on success, false otherwise. */ + bool Succeeded() const throw() { return m_result == 0; } + + /** Returns the result of the preallocation. */ + long GetResult() const throw() { return m_result; } + + private: + //! The partfile for which preallocation was requested. + CPartFile * m_file; + + //! Should the download start paused? + bool m_pause; + + //! Result of preallocation + long m_result; +}; + DECLARE_LOCAL_EVENT_TYPE(MULE_EVT_HASHING, -1) DECLARE_LOCAL_EVENT_TYPE(MULE_EVT_AICH_HASHING, -1) DECLARE_LOCAL_EVENT_TYPE(MULE_EVT_FILE_COMPLETED, -1) @@ -240,6 +304,7 @@ typedef void (wxEvtHandler::*MuleHashingEventFunction)(CHashingEvent&); typedef void (wxEvtHandler::*MuleCompletionEventFunction)(CCompletionEvent&); +typedef void (wxEvtHandler::*MuleAllocFinishedEventFunction)(CAllocFinishedEvent&); //! Event-handler for completed hashings of new shared files and partfiles. #define EVT_MULE_HASHING(func) \ @@ -259,6 +324,12 @@ (wxObjectEventFunction) (wxEventFunction) \ wxStaticCastEvent(MuleCompletionEventFunction, &func), (wxObject*) NULL), - +//! Event-handler for partfile preallocation finished events. +#define EVT_MULE_ALLOC_FINISHED(func) \ + DECLARE_EVENT_TABLE_ENTRY(MULE_EVT_ALLOC_FINISHED, -1, -1, \ + (wxObjectEventFunction) (wxEventFunction) \ + wxStaticCastEvent(MuleAllocFinishedEventFunction, &func), (wxObject*) NULL), + + #endif // TASKS_H // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/TransferWnd.h amule-2.2.2/src/TransferWnd.h --- amule-2.2.0~svn20080218/src/TransferWnd.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/TransferWnd.h 2008-04-04 13:42:07.000000000 +0000 @@ -28,9 +28,8 @@ #include // Needed for wxPanel #include "Types.h" // Needed for uint32 +#include "OtherStructs.h" - -class Category_Struct; class CClientListCtrl; class CDownloadListCtrl; class CMuleNotebook; diff -ruN -d amule-2.2.0~svn20080218/src/Types.h amule-2.2.2/src/Types.h --- amule-2.2.0~svn20080218/src/Types.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/Types.h 2008-06-11 23:10:44.000000000 +0000 @@ -157,7 +157,8 @@ R_OK = 4 // read }; #endif // W_OK -#else + #include // Do_not_auto_remove +#elif !defined(_MSC_VER) typedef struct sRECT { uint32 left; uint32 top; diff -ruN -d amule-2.2.0~svn20080218/src/UPnP.cpp amule-2.2.2/src/UPnP.cpp --- amule-2.2.0~svn20080218/src/UPnP.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/UPnP.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1760 +0,0 @@ -// -// This file is part of the aMule Project. -// -// Copyright (c) 2006-2008 Marcelo Roberto Jimenez ( phoenix@amule.org ) -// Copyright (c) 2006-2008 aMule Team ( admin@amule.org / http://www.amule.org ) -// -// Any parts of this program derived from the xMule, lMule or eMule project, -// or contributed by third-party developers are copyrighted by their -// respective authors. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -// - -#define UPNP_C - -#include "UPnP.h" - - -#include // For dlopen(), dlsym(), dlclose() -#include // For transform() - - -#ifdef __GNUC__ - #if __GNUC__ >= 4 - #define REINTERPRET_CAST(x) reinterpret_cast - #endif -#endif -#ifndef REINTERPRET_CAST - // Let's hope that function pointers are equal in size to data pointers - #define REINTERPRET_CAST(x) (x) -#endif - - -/** - * Case insensitive std::string comparison - */ -bool stdStringIsEqualCI(const std::string &s1, const std::string &s2) -{ - std::string ns1(s1); - std::string ns2(s2); - transform(ns1.begin(), ns1.end(), ns1.begin(), tolower); - transform(ns2.begin(), ns2.end(), ns2.begin(), tolower); - return ns1 == ns2; -} - - -CUPnPPortMapping::CUPnPPortMapping( - int port, - const std::string &protocol, - bool enabled, - const std::string &description) -: -m_port(), -m_protocol(protocol), -m_enabled(enabled ? "1" : "0"), -m_description(description), -m_key() -{ - std::ostringstream oss; - oss << port; - m_port = oss.str(); - m_key = m_protocol + m_port; -} - - -CDynamicLibHandle::CDynamicLibHandle(const char *libname) -: -m_libname(libname), -m_LibraryHandle(dlopen(libname, RTLD_LAZY)) -{ - std::ostringstream msg; - if (!m_LibraryHandle) { - msg << "error(CDynamicLibHandle): Unable to dlopen " << - m_libname << ". Check PATH and LD_LIBRARY_PATH."; - AddLogLineM(true, logUPnP, msg); -// throw CUPnPException(msg); - } else { - msg << "Successfully opened " << m_libname << "."; - AddLogLineM(false, logUPnP, msg); - } -} - - -CDynamicLibHandle::~CDynamicLibHandle() -{ - if (m_LibraryHandle) { - std::ostringstream msg; - int err_code = dlclose(m_LibraryHandle); - if (err_code) { - msg << "error(CDynamicLibHandle): Error closing " << - m_libname << ": " << dlerror() << - "."; - fprintf(stderr, "%s\n", msg.str().c_str()); - AddLogLineM(true, logUPnP, msg); - } else { - msg << "Successfully closed " << m_libname << "."; - AddLogLineM(false, logUPnP, msg); - } - } -} - - -const std::string &CUPnPLib::UPNP_ROOT_DEVICE = - "upnp:rootdevice"; - -const std::string &CUPnPLib::UPNP_DEVICE_IGW = - "urn:schemas-upnp-org:device:InternetGatewayDevice:1"; -const std::string &CUPnPLib::UPNP_DEVICE_WAN = - "urn:schemas-upnp-org:device:WANDevice:1"; -const std::string &CUPnPLib::UPNP_DEVICE_WAN_CONNECTION = - "urn:schemas-upnp-org:device:WANConnectionDevice:1"; -const std::string &CUPnPLib::UPNP_DEVICE_LAN = - "urn:schemas-upnp-org:device:LANDevice:1"; - -const std::string &CUPnPLib::UPNP_SERVICE_LAYER3_FORWARDING = - "urn:schemas-upnp-org:service:Layer3Forwarding:1"; -const std::string &CUPnPLib::UPNP_SERVICE_WAN_COMMON_INTERFACE_CONFIG = - "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1"; -const std::string &CUPnPLib::UPNP_SERVICE_WAN_IP_CONNECTION = - "urn:schemas-upnp-org:service:WANIPConnection:1"; -const std::string &CUPnPLib::UPNP_SERVICE_WAN_PPP_CONNECTION = - "urn:schemas-upnp-org:service:WANPPPConnection:1"; - - -const char *CUPnPLib::s_LibIXMLSymbols[] = -{ -/* 0*/ "ixmlNode_getFirstChild", -/* 1*/ "ixmlNode_getNextSibling", -/* 2*/ "ixmlNode_getNodeName", -/* 3*/ "ixmlNode_getNodeValue", -/* 4*/ "ixmlNode_getAttributes", -/* 5*/ "ixmlDocument_free", -/* 6*/ "ixmlNamedNodeMap_getNamedItem", -/* 7*/ "ixmlNamedNodeMap_free", -}; - - -const char *CUPnPLib::s_LibUPnPSymbols[] = -{ -/* 0*/ "UpnpInit", -/* 1*/ "UpnpFinish", -/* 2*/ "UpnpGetServerPort", -/* 3*/ "UpnpGetServerIpAddress", -/* 4*/ "UpnpRegisterClient", -/* 5*/ "UpnpUnRegisterClient", -/* 6*/ "UpnpSearchAsync", -/* 7*/ "UpnpGetServiceVarStatus", -/* 8*/ "UpnpSendAction", -/* 9*/ "UpnpSendActionAsync", -/*10*/ "UpnpSubscribe", -/*11*/ "UpnpUnSubscribe", -/*12*/ "UpnpDownloadXmlDoc", -/*13*/ "UpnpResolveURL", -/*14*/ "UpnpMakeAction", -/*15*/ "UpnpAddToAction", -/*16*/ "UpnpGetErrorMessage", -}; - - -#ifdef __DARWIN__ - #include - #include - - // Dynamic libraries have different names in different systems - const char *libIXMLName = "libixml.2.dylib"; - const char *libUPnP2Name = "libupnp.2.dylib"; - const char *libUPNP3Name = "libupnp.3.dylib"; -#else // Linux and other compatible systems - const char *libIXMLName = "libixml.so.2"; - const char *libUPnP2Name = "libupnp.so.2"; - const char *libUPNP3Name = "libupnp.so.3"; -#endif - - -const std::string CUPnPLib::addLibraryPath(const char *name) -{ -#ifdef __DARWIN__ - CFBundleRef bundle = CFBundleGetMainBundle(); - CFURLRef frameworkURL = CFBundleCopyPrivateFrameworksURL(bundle); - CFStringRef libName = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8); - CFURLRef libURL = CFURLCreateCopyAppendingPathComponent( - NULL, frameworkURL, libName, false); - char result[MAXPATHLEN]; - CFURLGetFileSystemRepresentation( - libURL, true, (UInt8 *)result, (CFIndex)MAXPATHLEN); - CFRelease(libName); - CFRelease(libURL); - CFRelease(frameworkURL); - - return static_cast(result); -#else // Linux and other compatible systems - return static_cast(name); -#endif -} - - -CUPnPLib::CUPnPLib(CUPnPControlPoint &ctrlPoint) -: -m_ctrlPoint(ctrlPoint), -m_LibIXMLHandle(addLibraryPath(libIXMLName).c_str()), -m_LibUPnPHandle2(addLibraryPath(libUPnP2Name).c_str()), -m_LibUPnPHandle3(addLibraryPath(libUPNP3Name).c_str()), -m_LibUPnPHandle(NULL) -{ - // There are two versions of libUPnP in the market, - // check for the one that we have in the system. - if (m_LibUPnPHandle3.Get()) { - m_LibUPnPHandle = &m_LibUPnPHandle3; - } else if (m_LibUPnPHandle2.Get()) { - m_LibUPnPHandle = &m_LibUPnPHandle2; - } else { - std::ostringstream msg; - msg << "error(CDynamicLibHandle): Unable to dlopen " - "one or more UPnP component libraries. " - "Check PATH and LD_LIBRARY_PATH."; - AddLogLineM(true, logUPnP, msg); - throw CUPnPException(msg); - } - - // IXML - m_ixmlNode_getFirstChild = - REINTERPRET_CAST(IXML_Node *(*)(IXML_Node *)) - (dlsym(m_LibIXMLHandle.Get(), s_LibIXMLSymbols[0])); - m_ixmlNode_getNextSibling = - REINTERPRET_CAST(IXML_Node *(*)(IXML_Node *)) - (dlsym(m_LibIXMLHandle.Get(), s_LibIXMLSymbols[1])); - m_ixmlNode_getNodeName = - REINTERPRET_CAST(const DOMString (*)(IXML_Node *)) - (dlsym(m_LibIXMLHandle.Get(), s_LibIXMLSymbols[2])); - m_ixmlNode_getNodeValue = - REINTERPRET_CAST(const DOMString (*)(IXML_Node *)) - (dlsym(m_LibIXMLHandle.Get(), s_LibIXMLSymbols[3])); - m_ixmlNode_getAttributes = - REINTERPRET_CAST(IXML_NamedNodeMap *(*)(IXML_Node *)) - (dlsym(m_LibIXMLHandle.Get(), s_LibIXMLSymbols[4])); - m_ixmlDocument_free = - REINTERPRET_CAST(void (*)(IXML_Document *)) - (dlsym(m_LibIXMLHandle.Get(), s_LibIXMLSymbols[5])); - m_ixmlNamedNodeMap_getNamedItem = - REINTERPRET_CAST(IXML_Node *(*)(IXML_NamedNodeMap *, const DOMString)) - (dlsym(m_LibIXMLHandle.Get(), s_LibIXMLSymbols[6])); - m_ixmlNamedNodeMap_free = - REINTERPRET_CAST(void (*)(IXML_NamedNodeMap *)) - (dlsym(m_LibIXMLHandle.Get(), s_LibIXMLSymbols[7])); - - // UPnP - m_UpnpInit = - REINTERPRET_CAST(int (*)(const char *, int)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[0])); - m_UpnpFinish = - REINTERPRET_CAST(void (*)()) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[1])); - m_UpnpGetServerPort = - REINTERPRET_CAST(unsigned short (*)()) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[2])); - m_UpnpGetServerIpAddress = - REINTERPRET_CAST(char * (*)()) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[3])); - m_UpnpRegisterClient = - REINTERPRET_CAST(int (*)(Upnp_FunPtr, const void *, UpnpClient_Handle *)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[4])); - m_UpnpUnRegisterClient = - REINTERPRET_CAST(int (*)(UpnpClient_Handle)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[5])); - m_UpnpSearchAsync = - REINTERPRET_CAST(int (*)(UpnpClient_Handle, int, const char *, const void *)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[6])); - m_UpnpGetServiceVarStatus = - REINTERPRET_CAST(int (*)(UpnpClient_Handle, const char *, const char *, DOMString *)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[7])); - m_UpnpSendAction = - REINTERPRET_CAST(int (*)(UpnpClient_Handle, const char *, const char *, const char *, - IXML_Document *, IXML_Document **)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[8])); - m_UpnpSendActionAsync = - REINTERPRET_CAST(int (*)(UpnpClient_Handle, const char *, const char *, const char *, - IXML_Document *, Upnp_FunPtr, const void *)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[9])); - m_UpnpSubscribe = - REINTERPRET_CAST(int (*)(UpnpClient_Handle, const char *, int *, Upnp_SID)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[10])); - m_UpnpUnSubscribe = - REINTERPRET_CAST(int (*)(UpnpClient_Handle, Upnp_SID)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[11])); - m_UpnpDownloadXmlDoc = - REINTERPRET_CAST(int (*)(const char *, IXML_Document **)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[12])); - m_UpnpResolveURL = - REINTERPRET_CAST(int (*)(const char *, const char *, char *)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[13])); - m_UpnpMakeAction = - REINTERPRET_CAST(IXML_Document *(*)(const char *, const char *, int, const char *, ...)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[14])); - m_UpnpAddToAction = - REINTERPRET_CAST(int (*)(IXML_Document **, const char *, const char *, const char *, const char *)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[15])); - m_UpnpGetErrorMessage = - REINTERPRET_CAST(const char *(*)(int)) - (dlsym(m_LibUPnPHandle->Get(), s_LibUPnPSymbols[16])); -} - - -std::string CUPnPLib::GetUPnPErrorMessage(int code) const -{ - return m_UpnpGetErrorMessage(code); -} - - -std::string CUPnPLib::processUPnPErrorMessage( - const std::string &messsage, - int errorCode, - const DOMString errorString, - IXML_Document *doc) const -{ - std::ostringstream msg; - if (errorString == NULL || *errorString == 0) { - errorString = "Not available"; - } - if (errorCode > 0) { - msg << "Error: " << - messsage << - ": Error code :'"; - if (doc) { - CUPnPError e(*this, doc); - msg << e.getErrorCode() << - "', Error description :'" << - e.getErrorDescription() << - "'."; - } else { - msg << errorCode << - "', Error description :'" << - errorString << - "'."; - } - AddLogLineM(false, logUPnP, msg); - } else { - msg << "Error: " << - messsage << - ": UPnP SDK error: " << - GetUPnPErrorMessage(errorCode) << - " (" << errorCode << ")."; - AddLogLineM(false, logUPnP, msg); - } - - return msg.str(); -} - - -void CUPnPLib::ProcessActionResponse( - IXML_Document *RespDoc, - const std::string &actionName) const -{ - std::ostringstream msg; - msg << "Response: "; - IXML_Element *root = Element_GetRootElement(RespDoc); - IXML_Element *child = Element_GetFirstChild(root); - if (child) { - while (child) { - const DOMString childTag = Element_GetTag(child); - std::string childValue = Element_GetTextValue(child); - msg << "\n " << - childTag << "='" << - childValue << "'"; - child = Element_GetNextSibling(child); - } - } else { - msg << "\n Empty response for action '" << - actionName << "'."; - } - AddDebugLogLineM(false, logUPnP, msg); -} - - -/** - * This function returns the root node of a given document. - */ -IXML_Element *CUPnPLib::Element_GetRootElement( - IXML_Document *doc) const -{ - IXML_Element *root = REINTERPRET_CAST(IXML_Element *)( - m_ixmlNode_getFirstChild( - REINTERPRET_CAST(IXML_Node *)(doc))); - - return root; -} - - -/** - * This function returns the first child of a given element. - */ -IXML_Element *CUPnPLib::Element_GetFirstChild( - IXML_Element *parent) const -{ - IXML_Node *node = REINTERPRET_CAST(IXML_Node *)(parent); - IXML_Node *child = m_ixmlNode_getFirstChild(node); - - return REINTERPRET_CAST(IXML_Element *)(child); -} - - -/** - * This function returns the next sibling of a given child. - */ -IXML_Element *CUPnPLib::Element_GetNextSibling( - IXML_Element *child) const -{ - IXML_Node *node = REINTERPRET_CAST(IXML_Node *)(child); - IXML_Node *sibling = m_ixmlNode_getNextSibling(node); - - return REINTERPRET_CAST(IXML_Element *)(sibling); -} - - -/** - * This function returns the element tag (name) - */ -const DOMString CUPnPLib::Element_GetTag( - IXML_Element *element) const -{ - IXML_Node *node = REINTERPRET_CAST(IXML_Node *)(element); - const DOMString tag = m_ixmlNode_getNodeName(node); - - return tag; -} - - -/** - * This function returns the TEXT node value of the current node. - */ -const std::string CUPnPLib::Element_GetTextValue( - IXML_Element *element) const -{ - if (!element) { - return stdEmptyString; - } - IXML_Node *text = m_ixmlNode_getFirstChild( - REINTERPRET_CAST(IXML_Node *)(element)); - const DOMString s = m_ixmlNode_getNodeValue(text); - std::string ret; - if (s) { - ret = s; - } - - return ret; -} - - -/** - * This function returns the TEXT node value of the first child matching tag. - */ -const std::string CUPnPLib::Element_GetChildValueByTag( - IXML_Element *element, - const DOMString tag) const -{ - IXML_Element *child = - Element_GetFirstChildByTag(element, tag); - - return Element_GetTextValue(child); -} - - -/** - * Returns the first child element that matches the requested tag or - * NULL if not found. - */ -IXML_Element *CUPnPLib::Element_GetFirstChildByTag( - IXML_Element *element, - const DOMString tag) const -{ - if (!element || !tag) { - return NULL; - } - - IXML_Node *node = REINTERPRET_CAST(IXML_Node *)(element); - IXML_Node *child = m_ixmlNode_getFirstChild(node); - const DOMString childTag = m_ixmlNode_getNodeName(child); - while(child && childTag && strcmp(tag, childTag)) { - child = m_ixmlNode_getNextSibling(child); - childTag = m_ixmlNode_getNodeName(child); - } - - return REINTERPRET_CAST(IXML_Element *)(child); -} - - -/** - * Returns the next sibling element that matches the requested tag. Should be - * used with the return value of Element_GetFirstChildByTag(). - */ -IXML_Element *CUPnPLib::Element_GetNextSiblingByTag( - IXML_Element *element, const DOMString tag) const -{ - if (!element || !tag) { - return NULL; - } - - IXML_Node *child = REINTERPRET_CAST(IXML_Node *)(element); - const DOMString childTag = NULL; - do { - child = m_ixmlNode_getNextSibling(child); - childTag = m_ixmlNode_getNodeName(child); - } while(child && childTag && strcmp(tag, childTag)); - - return REINTERPRET_CAST(IXML_Element *)(child); -} - - -const std::string CUPnPLib::Element_GetAttributeByTag( - IXML_Element *element, const DOMString tag) const -{ - IXML_NamedNodeMap *NamedNodeMap = m_ixmlNode_getAttributes( - REINTERPRET_CAST(IXML_Node *)(element)); - IXML_Node *attribute = m_ixmlNamedNodeMap_getNamedItem(NamedNodeMap, tag); - const DOMString s = m_ixmlNode_getNodeValue(attribute); - std::string ret; - if (s) { - ret = s; - } - m_ixmlNamedNodeMap_free(NamedNodeMap); - - return ret; -} - - -CUPnPError::CUPnPError( - const CUPnPLib &upnpLib, - IXML_Document *errorDoc) -: -m_root (upnpLib.Element_GetRootElement(errorDoc)), -m_ErrorCode (upnpLib.Element_GetChildValueByTag(m_root, "errorCode")), -m_ErrorDescription(upnpLib.Element_GetChildValueByTag(m_root, "errorDescription")) -{ -} - - -CUPnPArgument::CUPnPArgument( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *argument, - const std::string &WXUNUSED(SCPDURL)) -: -m_UPnPControlPoint(upnpControlPoint), -m_name (upnpLib.Element_GetChildValueByTag(argument, "name")), -m_direction (upnpLib.Element_GetChildValueByTag(argument, "direction")), -m_retval (upnpLib.Element_GetFirstChildByTag(argument, "retval")), -m_relatedStateVariable(upnpLib.Element_GetChildValueByTag(argument, "relatedStateVariable")) -{ - std::ostringstream msg; - msg << "\n Argument:" << - "\n name: " << m_name << - "\n direction: " << m_direction << - "\n retval: " << m_retval << - "\n relatedStateVariable: " << m_relatedStateVariable; - AddDebugLogLineM(false, logUPnP, msg); -} - - -CUPnPAction::CUPnPAction( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *action, - const std::string &SCPDURL) -: -m_UPnPControlPoint(upnpControlPoint), -m_ArgumentList(upnpControlPoint, upnpLib, action, SCPDURL), -m_name(upnpLib.Element_GetChildValueByTag(action, "name")) -{ - std::ostringstream msg; - msg << "\n Action:" << - "\n name: " << m_name; - AddDebugLogLineM(false, logUPnP, msg); -} - - -CUPnPAllowedValue::CUPnPAllowedValue( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *allowedValue, - const std::string &WXUNUSED(SCPDURL)) -: -m_UPnPControlPoint(upnpControlPoint), -m_allowedValue(upnpLib.Element_GetTextValue(allowedValue)) -{ - std::ostringstream msg; - msg << "\n AllowedValue:" << - "\n allowedValue: " << m_allowedValue; - AddDebugLogLineM(false, logUPnP, msg); -} - - -CUPnPStateVariable::CUPnPStateVariable( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *stateVariable, - const std::string &SCPDURL) -: -m_UPnPControlPoint(upnpControlPoint), -m_AllowedValueList(upnpControlPoint, upnpLib, stateVariable, SCPDURL), -m_name (upnpLib.Element_GetChildValueByTag(stateVariable, "name")), -m_dataType (upnpLib.Element_GetChildValueByTag(stateVariable, "dataType")), -m_defaultValue(upnpLib.Element_GetChildValueByTag(stateVariable, "defaultValue")), -m_sendEvents (upnpLib.Element_GetAttributeByTag (stateVariable, "sendEvents")) -{ - std::ostringstream msg; - msg << "\n StateVariable:" << - "\n name: " << m_name << - "\n dataType: " << m_dataType << - "\n defaultValue: " << m_defaultValue << - "\n sendEvents: " << m_sendEvents; - AddDebugLogLineM(false, logUPnP, msg); -} - - -CUPnPSCPD::CUPnPSCPD( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *scpd, - const std::string &SCPDURL) -: -m_UPnPControlPoint(upnpControlPoint), -m_ActionList(upnpControlPoint, upnpLib, scpd, SCPDURL), -m_ServiceStateTable(upnpControlPoint, upnpLib, scpd, SCPDURL), -m_SCPDURL(SCPDURL) -{ -} - - -CUPnPArgumentValue::CUPnPArgumentValue() -: -m_argument(), -m_value() -{ -} - - -CUPnPArgumentValue::CUPnPArgumentValue( - const std::string &argument, const std::string &value) -: -m_argument(argument), -m_value(value) -{ -} - - -CUPnPService::CUPnPService( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *service, - const std::string &URLBase) -: -m_UPnPControlPoint(upnpControlPoint), -m_upnpLib(upnpLib), -m_serviceType(upnpLib.Element_GetChildValueByTag(service, "serviceType")), -m_serviceId (upnpLib.Element_GetChildValueByTag(service, "serviceId")), -m_SCPDURL (upnpLib.Element_GetChildValueByTag(service, "SCPDURL")), -m_controlURL (upnpLib.Element_GetChildValueByTag(service, "controlURL")), -m_eventSubURL(upnpLib.Element_GetChildValueByTag(service, "eventSubURL")), -m_timeout(1801), -m_SCPD(NULL) -{ - std::ostringstream msg; - int errcode; - - std::vector vscpdURL(URLBase.length() + m_SCPDURL.length() + 1); - char *scpdURL = &vscpdURL[0]; - errcode = upnpLib.m_UpnpResolveURL( - URLBase.c_str(), - m_SCPDURL.c_str(), - scpdURL); - if( errcode != UPNP_E_SUCCESS ) { - msg << "Error generating scpdURL from " << - "|" << URLBase << "|" << - m_SCPDURL << "|."; - AddDebugLogLineM(false, logUPnP, msg); - } else { - m_absSCPDURL = scpdURL; - } - - std::vector vcontrolURL( - URLBase.length() + m_controlURL.length() + 1); - char *controlURL = &vcontrolURL[0]; - errcode = upnpLib.m_UpnpResolveURL( - URLBase.c_str(), - m_controlURL.c_str(), - controlURL); - if( errcode != UPNP_E_SUCCESS ) { - msg << "Error generating controlURL from " << - "|" << URLBase << "|" << - m_controlURL << "|."; - AddDebugLogLineM(false, logUPnP, msg); - } else { - m_absControlURL = controlURL; - } - - std::vector veventURL( - URLBase.length() + m_eventSubURL.length() + 1); - char *eventURL = &veventURL[0]; - errcode = upnpLib.m_UpnpResolveURL( - URLBase.c_str(), - m_eventSubURL.c_str(), - eventURL); - if( errcode != UPNP_E_SUCCESS ) { - msg << "Error generating eventURL from " << - "|" << URLBase << "|" << - m_eventSubURL << "|."; - AddDebugLogLineM(false, logUPnP, msg); - } else { - m_absEventSubURL = eventURL; - } - - msg << "\n Service:" << - "\n serviceType: " << m_serviceType << - "\n serviceId: " << m_serviceId << - "\n SCPDURL: " << m_SCPDURL << - "\n absSCPDURL: " << m_absSCPDURL << - "\n controlURL: " << m_controlURL << - "\n absControlURL: " << m_absControlURL << - "\n eventSubURL: " << m_eventSubURL << - "\n absEventSubURL: " << m_absEventSubURL; - AddDebugLogLineM(false, logUPnP, msg); - - if ( m_serviceType == upnpLib.UPNP_SERVICE_WAN_IP_CONNECTION || - m_serviceType == upnpLib.UPNP_SERVICE_WAN_PPP_CONNECTION) { -//#warning Delete this code on release. - //if (!upnpLib.m_ctrlPoint.WanServiceDetected()) { - // This condition can be used to suspend the parse - // of the XML tree. -//#warning Delete this code when m_WanService is no longer used. - upnpLib.m_ctrlPoint.SetWanService(this); - // Log it - msg.str(""); - msg << "WAN Service Detected: '" << - m_serviceType << "'."; - AddDebugLogLineM(true, logUPnP, msg); - // Subscribe - upnpLib.m_ctrlPoint.Subscribe(*this); -//#warning Delete this code on release. -#if 0 - } else { - msg.str(""); - msg << "WAN service detected again: '" << - m_serviceType << - "'. Will only use the first instance."; - AddDebugLogLineM(true, logUPnP, msg); - } -#endif - } else { - msg.str(""); - msg << "Uninteresting service detected: '" << - m_serviceType << "'. Ignoring."; - AddDebugLogLineM(true, logUPnP, msg); - } -} - - -CUPnPService::~CUPnPService() -{ -} - - -bool CUPnPService::Execute( - const std::string &ActionName, - const std::vector &ArgValue) const -{ - std::ostringstream msg; - std::ostringstream msgAction("Sending action "); - // Check for correct action name - ActionList::const_iterator itAction = - m_SCPD->GetActionList().find(ActionName); - if (itAction == m_SCPD->GetActionList().end()) { - msg << "Invalid action name '" << ActionName << - "' for service '" << GetServiceType() << "'."; - AddDebugLogLineM(false, logUPnP, msg); - return false; - } - msgAction << ActionName << "("; - bool firstTime = true; - // Check for correct Argument/Value pairs - const CUPnPAction &action = *(itAction->second); - for (unsigned int i = 0; i < ArgValue.size(); ++i) { - ArgumentList::const_iterator itArg = - action.GetArgumentList().find(ArgValue[i].GetArgument()); - if (itArg == action.GetArgumentList().end()) { - msg << "Invalid argument name '" << ArgValue[i].GetArgument() << - "' for action '" << action.GetName() << - "' for service '" << GetServiceType() << "'."; - AddDebugLogLineM(false, logUPnP, msg); - return false; - } - const CUPnPArgument &argument = *(itArg->second); - if (tolower(argument.GetDirection()[0]) != 'i' || - tolower(argument.GetDirection()[1]) != 'n') { - msg << "Invalid direction for argument '" << - ArgValue[i].GetArgument() << - "' for action '" << action.GetName() << - "' for service '" << GetServiceType() << "'."; - AddDebugLogLineM(false, logUPnP, msg); - return false; - } - const std::string relatedStateVariableName = - argument.GetRelatedStateVariable(); - if (!relatedStateVariableName.empty()) { - ServiceStateTable::const_iterator itSVT = - m_SCPD->GetServiceStateTable(). - find(relatedStateVariableName); - if (itSVT == m_SCPD->GetServiceStateTable().end()) { - msg << "Inconsistent Service State Table, did not find '" << - relatedStateVariableName << - "' for argument '" << argument.GetName() << - "' for action '" << action.GetName() << - "' for service '" << GetServiceType() << "'."; - AddDebugLogLineM(false, logUPnP, msg); - return false; - } - const CUPnPStateVariable &stateVariable = *(itSVT->second); - if ( !stateVariable.GetAllowedValueList().empty() && - stateVariable.GetAllowedValueList().find(ArgValue[i].GetValue()) == - stateVariable.GetAllowedValueList().end()) { - msg << "Value not allowed '" << ArgValue[i].GetValue() << - "' for state variable '" << relatedStateVariableName << - "' for argument '" << argument.GetName() << - "' for action '" << action.GetName() << - "' for service '" << GetServiceType() << "'."; - AddDebugLogLineM(false, logUPnP, msg); - return false; - } - } - if (firstTime) { - firstTime = false; - } else { - msgAction << ", "; - } - msgAction << - ArgValue[i].GetArgument() << - "='" << - ArgValue[i].GetValue() << - "'"; - } - msgAction << ")"; - AddDebugLogLineM(false, logUPnP, msgAction); - // Everything is ok, make the action - IXML_Document *ActionDoc = NULL; - if (ArgValue.size()) { - for (unsigned int i = 0; i < ArgValue.size(); ++i) { - int ret = m_upnpLib.m_UpnpAddToAction( - &ActionDoc, - action.GetName().c_str(), - GetServiceType().c_str(), - ArgValue[i].GetArgument().c_str(), - ArgValue[i].GetValue().c_str()); - if (ret != UPNP_E_SUCCESS) { - m_upnpLib.processUPnPErrorMessage( - "m_UpnpAddToAction", ret, NULL, NULL); - return false; - } - } - } else { - ActionDoc = m_upnpLib.m_UpnpMakeAction( - action.GetName().c_str(), - GetServiceType().c_str(), - 0, NULL); - if (!ActionDoc) { - msg << "Error: m_UpnpMakeAction returned NULL."; - AddLogLineM(false, logUPnP, msg); - return false; - } - } -#if 0 - // Send the action asynchronously - m_upnpLib.m_UpnpSendActionAsync( - m_UPnPControlPoint.GetUPnPClientHandle(), - GetAbsControlURL().c_str(), - GetServiceType().c_str(), - NULL, ActionDoc, - static_cast(&CUPnPControlPoint::Callback), - NULL); - return true; -#endif - - // Send the action synchronously - IXML_Document *RespDoc = NULL; - int ret = m_upnpLib.m_UpnpSendAction( - m_UPnPControlPoint.GetUPnPClientHandle(), - GetAbsControlURL().c_str(), - GetServiceType().c_str(), - NULL, ActionDoc, &RespDoc); - if (ret != UPNP_E_SUCCESS) { - m_upnpLib.processUPnPErrorMessage( - "m_UpnpSendAction", ret, NULL, RespDoc); - m_upnpLib.m_ixmlDocument_free(ActionDoc); - m_upnpLib.m_ixmlDocument_free(RespDoc); - return false; - } - m_upnpLib.m_ixmlDocument_free(ActionDoc); - - // Check the response document - m_upnpLib.ProcessActionResponse( - RespDoc, action.GetName()); - - // Free the response document - m_upnpLib.m_ixmlDocument_free(RespDoc); - - return true; -} - - -const std::string CUPnPService::GetStateVariable( - const std::string &stateVariableName) const -{ - std::ostringstream msg; - DOMString StVarVal; - int ret = m_upnpLib.m_UpnpGetServiceVarStatus( - m_UPnPControlPoint.GetUPnPClientHandle(), - GetAbsControlURL().c_str(), - stateVariableName.c_str(), - &StVarVal); - if (ret != UPNP_E_SUCCESS) { - msg << "GetStateVariable(\"" << - stateVariableName << - "\"): in a call to m_UpnpGetServiceVarStatus"; - m_upnpLib.processUPnPErrorMessage( - msg.str(), ret, StVarVal, NULL); - return stdEmptyString; - } - msg << "GetStateVariable: " << - stateVariableName << - "='" << - StVarVal << - "'."; - AddDebugLogLineM(false, logUPnP, msg); - return stdEmptyString; -} - - -CUPnPDevice::CUPnPDevice( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *device, - const std::string &URLBase) -: -m_UPnPControlPoint(upnpControlPoint), -m_DeviceList(upnpControlPoint, upnpLib, device, URLBase), -m_ServiceList(upnpControlPoint, upnpLib, device, URLBase), -m_deviceType (upnpLib.Element_GetChildValueByTag(device, "deviceType")), -m_friendlyName (upnpLib.Element_GetChildValueByTag(device, "friendlyName")), -m_manufacturer (upnpLib.Element_GetChildValueByTag(device, "manufacturer")), -m_manufacturerURL (upnpLib.Element_GetChildValueByTag(device, "manufacturerURL")), -m_modelDescription (upnpLib.Element_GetChildValueByTag(device, "modelDescription")), -m_modelName (upnpLib.Element_GetChildValueByTag(device, "modelName")), -m_modelNumber (upnpLib.Element_GetChildValueByTag(device, "modelNumber")), -m_modelURL (upnpLib.Element_GetChildValueByTag(device, "modelURL")), -m_serialNumber (upnpLib.Element_GetChildValueByTag(device, "serialNumber")), -m_UDN (upnpLib.Element_GetChildValueByTag(device, "UDN")), -m_UPC (upnpLib.Element_GetChildValueByTag(device, "UPC")), -m_presentationURL (upnpLib.Element_GetChildValueByTag(device, "presentationURL")) -{ - std::ostringstream msg; - int presURLlen = strlen(URLBase.c_str()) + - strlen(m_presentationURL.c_str()) + 2; - std::vector vpresURL(presURLlen); - char* presURL = &vpresURL[0]; - int errcode = upnpLib.m_UpnpResolveURL( - URLBase.c_str(), - m_presentationURL.c_str(), - presURL); - if (errcode != UPNP_E_SUCCESS) { - msg << "Error generating presentationURL from " << - "|" << URLBase << "|" << - m_presentationURL << "|."; - AddDebugLogLineM(false, logUPnP, msg); - } else { - m_presentationURL = presURL; - } - - msg.str(""); - msg << "\n Device: " << - "\n friendlyName: " << m_friendlyName << - "\n deviceType: " << m_deviceType << - "\n manufacturer: " << m_manufacturer << - "\n manufacturerURL: " << m_manufacturerURL << - "\n modelDescription: " << m_modelDescription << - "\n modelName: " << m_modelName << - "\n modelNumber: " << m_modelNumber << - "\n modelURL: " << m_modelURL << - "\n serialNumber: " << m_serialNumber << - "\n UDN: " << m_UDN << - "\n UPC: " << m_UPC << - "\n presentationURL: " << m_presentationURL; - AddDebugLogLineM(false, logUPnP, msg); -} - - -CUPnPRootDevice::CUPnPRootDevice( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *rootDevice, - const std::string &OriginalURLBase, - const std::string &FixedURLBase, - const char *location, - int expires) -: -CUPnPDevice(upnpControlPoint, upnpLib, rootDevice, FixedURLBase), -m_UPnPControlPoint(upnpControlPoint), -m_URLBase(OriginalURLBase), -m_location(location), -m_expires(expires) -{ - std::ostringstream msg; - msg << - "\n Root Device: " << - "\n URLBase: " << m_URLBase << - "\n Fixed URLBase: " << FixedURLBase << - "\n location: " << m_location << - "\n expires: " << m_expires; - AddDebugLogLineM(false, logUPnP, msg); -} - - -CUPnPControlPoint *CUPnPControlPoint::s_CtrlPoint = NULL; - - -CUPnPControlPoint::CUPnPControlPoint(unsigned short udpPort) -: -m_upnpLib(*this), -m_UPnPClientHandle(), -m_RootDeviceMap(), -m_ServiceMap(), -m_ActivePortMappingsMap(), -m_RootDeviceListMutex(), -m_IGWDeviceDetected(false), -m_WanService(NULL) -{ - // Pointer to self - s_CtrlPoint = this; - // Null string at first - std::ostringstream msg; - - // Start UPnP - int ret; - char *ipAddress = NULL; - unsigned short port = 0; - ret = m_upnpLib.m_UpnpInit(ipAddress, udpPort); - if (ret != UPNP_E_SUCCESS) { - msg << "error(UpnpInit): Error code "; - goto error; - } - port = m_upnpLib.m_UpnpGetServerPort(); - ipAddress = m_upnpLib.m_UpnpGetServerIpAddress(); - msg << "bound to " << ipAddress << ":" << - port << "."; - AddLogLineM(false, logUPnP, msg); - msg.str(""); - ret = m_upnpLib.m_UpnpRegisterClient( - static_cast(&CUPnPControlPoint::Callback), - &m_UPnPClientHandle, - &m_UPnPClientHandle); - if (ret != UPNP_E_SUCCESS) { - msg << "error(UpnpRegisterClient): Error registering callback: "; - goto error; - } - - // We could ask for just the right device here. If the root device - // contains the device we want, it will respond with the full XML doc, - // including the root device and every sub-device it has. - // - // But lets find out what we have in our network by calling UPNP_ROOT_DEVICE. - // - // We should not search twice, because this will produce two - // UPNP_DISCOVERY_SEARCH_TIMEOUT events, and we might end with problems - // on the mutex. - ret = m_upnpLib.m_UpnpSearchAsync(m_UPnPClientHandle, 3, m_upnpLib.UPNP_ROOT_DEVICE.c_str(), NULL); - //ret = m_upnpLib.m_UpnpSearchAsync(m_UPnPClientHandle, 3, m_upnpLib.UPNP_DEVICE_IGW.c_str(), this); - //ret = m_upnpLib.m_UpnpSearchAsync(m_UPnPClientHandle, 3, m_upnpLib.UPNP_DEVICE_LAN.c_str(), this); - //ret = m_upnpLib.m_UpnpSearchAsync(m_UPnPClientHandle, 3, m_upnpLib.UPNP_DEVICE_WAN_CONNECTION.c_str(), this); - if (ret != UPNP_E_SUCCESS) { - msg << "error(UpnpSearchAsync): Error sending search request: "; - goto error; - } - - // Wait for the UPnP initialization to complete. - { - // Lock the search timeout mutex - m_WaitForSearchTimeoutMutex.Lock(); - - // Lock it again, so that we block. Unlocking will only happen - // when the UPNP_DISCOVERY_SEARCH_TIMEOUT event occurs at the - // callback. - CUPnPMutexLocker lock(m_WaitForSearchTimeoutMutex); - } - return; - - // Error processing -error: - m_upnpLib.m_UpnpFinish(); - msg << ret << ": " << m_upnpLib.GetUPnPErrorMessage(ret) << "."; - throw CUPnPException(msg); -} - - -CUPnPControlPoint::~CUPnPControlPoint() -{ - for( RootDeviceMap::iterator it = m_RootDeviceMap.begin(); - it != m_RootDeviceMap.end(); - ++it) { - delete it->second; - } - // Remove all first - // RemoveAll(); - m_upnpLib.m_UpnpUnRegisterClient(m_UPnPClientHandle); - m_upnpLib.m_UpnpFinish(); -} - - -bool CUPnPControlPoint::AddPortMappings( - std::vector &upnpPortMapping) -{ - std::ostringstream msg; - if (!WanServiceDetected()) { - msg << "UPnP Error: " - "CUPnPControlPoint::AddPortMapping: " - "Wan Service not detected."; - AddLogLineM(true, logUPnP, msg); - return false; - } - - int n = upnpPortMapping.size(); - bool ok = false; - - // Check the number of port mappings before - std::istringstream PortMappingNumberOfEntries( - m_WanService->GetStateVariable( - "PortMappingNumberOfEntries")); - unsigned long oldNumberOfEntries; - PortMappingNumberOfEntries >> oldNumberOfEntries; - - // Add the enabled port mappings - for (int i = 0; i < n; ++i) { - if (upnpPortMapping[i].getEnabled() == "1") { - // Add the mapping to the control point - // active mappings list - m_ActivePortMappingsMap[upnpPortMapping[i].getKey()] = - upnpPortMapping[i]; - - // Add the port mapping - PrivateAddPortMapping(upnpPortMapping[i]); - } - } - - // Test some variables, this is deprecated, might not work - // with some routers - m_WanService->GetStateVariable("ConnectionType"); - m_WanService->GetStateVariable("PossibleConnectionTypes"); - m_WanService->GetStateVariable("ConnectionStatus"); - m_WanService->GetStateVariable("Uptime"); - m_WanService->GetStateVariable("LastConnectionError"); - m_WanService->GetStateVariable("RSIPAvailable"); - m_WanService->GetStateVariable("NATEnabled"); - m_WanService->GetStateVariable("ExternalIPAddress"); - m_WanService->GetStateVariable("PortMappingNumberOfEntries"); - m_WanService->GetStateVariable("PortMappingLeaseDuration"); - - // Just for testing - std::vector argval; - argval.resize(0); - m_WanService->Execute("GetStatusInfo", argval); - -#if 0 - // These do not work. Their value must be requested for a - // specific port mapping. - m_WanService->GetStateVariable("PortMappingEnabled"); - m_WanService->GetStateVariable("RemoteHost"); - m_WanService->GetStateVariable("ExternalPort"); - m_WanService->GetStateVariable("InternalPort"); - m_WanService->GetStateVariable("PortMappingProtocol"); - m_WanService->GetStateVariable("InternalClient"); - m_WanService->GetStateVariable("PortMappingDescription"); -#endif - - // Debug only - msg.str(""); - msg << "CUPnPControlPoint::DeletePortMappings: " - "m_ActivePortMappingsMap.size() == " << - m_ActivePortMappingsMap.size(); - AddDebugLogLineM(false, logUPnP, msg); - - // Not very good, must find a better test - PortMappingNumberOfEntries.str( - m_WanService->GetStateVariable( - "PortMappingNumberOfEntries")); - unsigned long newNumberOfEntries; - PortMappingNumberOfEntries >> newNumberOfEntries; - ok = newNumberOfEntries - oldNumberOfEntries == 4; - - return ok; -} - - -void CUPnPControlPoint::RefreshPortMappings() -{ - for ( PortMappingMap::iterator it = m_ActivePortMappingsMap.begin(); - it != m_ActivePortMappingsMap.end(); - ++it) { - PrivateAddPortMapping(it->second); - } - - // For testing - m_WanService->GetStateVariable("PortMappingNumberOfEntries"); -} - - -bool CUPnPControlPoint::PrivateAddPortMapping( - CUPnPPortMapping &upnpPortMapping) -{ - // Get an IP address. The UPnP server one must do. - std::string ipAddress(m_upnpLib.m_UpnpGetServerIpAddress()); - - // Start building the action - std::string actionName("AddPortMapping"); - std::vector argval(8); - - // Action parameters - argval[0].SetArgument("NewRemoteHost"); - argval[0].SetValue(""); - argval[1].SetArgument("NewExternalPort"); - argval[1].SetValue(upnpPortMapping.getPort()); - argval[2].SetArgument("NewProtocol"); - argval[2].SetValue(upnpPortMapping.getProtocol()); - argval[3].SetArgument("NewInternalPort"); - argval[3].SetValue(upnpPortMapping.getPort()); - argval[4].SetArgument("NewInternalClient"); - argval[4].SetValue(ipAddress); - argval[5].SetArgument("NewEnabled"); - argval[5].SetValue("1"); - argval[6].SetArgument("NewPortMappingDescription"); - argval[6].SetValue(upnpPortMapping.getDescription()); - argval[7].SetArgument("NewLeaseDuration"); - argval[7].SetValue("0"); - - // Execute - bool ret = true; - for (ServiceMap::iterator it = m_ServiceMap.begin(); - it != m_ServiceMap.end(); ++it) { - ret &= it->second->Execute(actionName, argval); - } - - return ret; -} - - -bool CUPnPControlPoint::DeletePortMappings( - std::vector &upnpPortMapping) -{ - std::ostringstream msg; - if (!WanServiceDetected()) { - msg << "UPnP Error: " - "CUPnPControlPoint::DeletePortMapping: " - "Wan Service not detected."; - AddLogLineM(true, logUPnP, msg); - return false; - } - - int n = upnpPortMapping.size(); - bool ok = false; - - // Check the number of port mappings before - std::istringstream PortMappingNumberOfEntries( - m_WanService->GetStateVariable( - "PortMappingNumberOfEntries")); - unsigned long oldNumberOfEntries; - PortMappingNumberOfEntries >> oldNumberOfEntries; - - // Delete the enabled port mappings - for (int i = 0; i < n; ++i) { - if (upnpPortMapping[i].getEnabled() == "1") { - // Delete the mapping from the control point - // active mappings list - PortMappingMap::iterator it = - m_ActivePortMappingsMap.find( - upnpPortMapping[i].getKey()); - if (it != m_ActivePortMappingsMap.end()) { - m_ActivePortMappingsMap.erase(it); - } else { - msg << "UPnP Error: " - "CUPnPControlPoint::DeletePortMapping: " - "Mapping was not found in the active " - "mapping map."; - AddLogLineM(true, logUPnP, msg); - } - - // Delete the port mapping - PrivateDeletePortMapping(upnpPortMapping[i]); - } - } - - // Debug only - msg.str(""); - msg << "CUPnPControlPoint::DeletePortMappings: " - "m_ActivePortMappingsMap.size() == " << - m_ActivePortMappingsMap.size(); - AddDebugLogLineM(false, logUPnP, msg); - - // Not very good, must find a better test - PortMappingNumberOfEntries.str( - m_WanService->GetStateVariable( - "PortMappingNumberOfEntries")); - unsigned long newNumberOfEntries; - PortMappingNumberOfEntries >> newNumberOfEntries; - ok = oldNumberOfEntries - newNumberOfEntries == 4; - - return ok; -} - - -bool CUPnPControlPoint::PrivateDeletePortMapping( - CUPnPPortMapping &upnpPortMapping) -{ - // Start building the action - std::string actionName("DeletePortMapping"); - std::vector argval(3); - - // Action parameters - argval[0].SetArgument("NewRemoteHost"); - argval[0].SetValue(""); - argval[1].SetArgument("NewExternalPort"); - argval[1].SetValue(upnpPortMapping.getPort()); - argval[2].SetArgument("NewProtocol"); - argval[2].SetValue(upnpPortMapping.getProtocol()); - - // Execute - bool ret = true; - for (ServiceMap::iterator it = m_ServiceMap.begin(); - it != m_ServiceMap.end(); ++it) { - ret &= it->second->Execute(actionName, argval); - } - - return ret; -} - - -// This function is static -int CUPnPControlPoint::Callback(Upnp_EventType EventType, void *Event, void * /*Cookie*/) -{ - std::ostringstream msg; - std::ostringstream msg2; - // Somehow, this is unreliable. UPNP_DISCOVERY_ADVERTISEMENT_ALIVE events - // happen with a wrong cookie and... boom! - // CUPnPControlPoint *upnpCP = static_cast(Cookie); - CUPnPControlPoint *upnpCP = CUPnPControlPoint::s_CtrlPoint; - - //fprintf(stderr, "Callback: %d, Cookie: %p\n", EventType, Cookie); - switch (EventType) { - case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE: - //fprintf(stderr, "Callback: UPNP_DISCOVERY_ADVERTISEMENT_ALIVE\n"); - msg << "error(UPNP_DISCOVERY_ADVERTISEMENT_ALIVE): "; - msg2<< "UPNP_DISCOVERY_ADVERTISEMENT_ALIVE: "; - goto upnpDiscovery; - case UPNP_DISCOVERY_SEARCH_RESULT: { - //fprintf(stderr, "Callback: UPNP_DISCOVERY_SEARCH_RESULT\n"); - msg << "error(UPNP_DISCOVERY_SEARCH_RESULT): "; - msg2<< "UPNP_DISCOVERY_SEARCH_RESULT: "; - // UPnP Discovery -upnpDiscovery: - struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event; - IXML_Document *doc = NULL; - int ret; - if (d_event->ErrCode != UPNP_E_SUCCESS) { - msg << upnpCP->m_upnpLib.GetUPnPErrorMessage(d_event->ErrCode) << "."; - AddDebugLogLineM(true, logUPnP, msg); - } - // Get the XML tree device description in doc - ret = upnpCP->m_upnpLib.m_UpnpDownloadXmlDoc(d_event->Location, &doc); - if (ret != UPNP_E_SUCCESS) { - msg << "Error retrieving device description from " << - d_event->Location << ": " << - upnpCP->m_upnpLib.GetUPnPErrorMessage(ret) << "."; - AddDebugLogLineM(true, logUPnP, msg); - } else { - msg2 << "Retrieving device description from " << - d_event->Location << "."; - AddDebugLogLineM(false, logUPnP, msg2); - } - if (doc) { - // Get the root node - IXML_Element *root = - upnpCP->m_upnpLib.Element_GetRootElement(doc); - // Extract the URLBase - const std::string urlBase = upnpCP->m_upnpLib. - Element_GetChildValueByTag(root, "URLBase"); - // Get the root device - IXML_Element *rootDevice = upnpCP->m_upnpLib. - Element_GetFirstChildByTag(root, "device"); - // Extract the deviceType - std::string devType(upnpCP->m_upnpLib. - Element_GetChildValueByTag(rootDevice, "deviceType")); - // Only add device if it is an InternetGatewayDevice - if (stdStringIsEqualCI(devType, upnpCP->m_upnpLib.UPNP_DEVICE_IGW)) { - // This condition can be used to auto-detect - // the UPnP device we are interested in. - // Obs.: Don't block the entry here on this - // condition! There may be more than one device, - // and the first that enters may not be the one - // we are interested in! - upnpCP->SetIGWDeviceDetected(true); - // Log it if not UPNP_DISCOVERY_ADVERTISEMENT_ALIVE, - // we don't want to spam our logs. - if (EventType != UPNP_DISCOVERY_ADVERTISEMENT_ALIVE) { - msg.str("Internet Gateway Device Detected."); - AddLogLineM(true, logUPnP, msg); - } - // Add the root device to our list - upnpCP->AddRootDevice(rootDevice, urlBase, - d_event->Location, d_event->Expires); - } - // Free the XML doc tree - upnpCP->m_upnpLib.m_ixmlDocument_free(doc); - } - break; - } - case UPNP_DISCOVERY_SEARCH_TIMEOUT: { - //fprintf(stderr, "Callback: UPNP_DISCOVERY_SEARCH_TIMEOUT\n"); - // Search timeout - msg << "UPNP_DISCOVERY_SEARCH_TIMEOUT."; - AddDebugLogLineM(false, logUPnP, msg); - - // Unlock the search timeout mutex - upnpCP->m_WaitForSearchTimeoutMutex.Unlock(); - - break; - } - case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: { - //fprintf(stderr, "Callback: UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE\n"); - // UPnP Device Removed - struct Upnp_Discovery *dab_event = (struct Upnp_Discovery *)Event; - if (dab_event->ErrCode != UPNP_E_SUCCESS) { - msg << "error(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE): " << - upnpCP->m_upnpLib.GetUPnPErrorMessage(dab_event->ErrCode) << - "."; - AddDebugLogLineM(true, logUPnP, msg); - } - std::string devType = dab_event->DeviceType; - // Check for an InternetGatewayDevice and removes it from the list - transform(devType.begin(), devType.end(), devType.begin(), tolower); - if (stdStringIsEqualCI(devType, upnpCP->m_upnpLib.UPNP_DEVICE_IGW)) { - upnpCP->RemoveRootDevice(dab_event->DeviceId); - } - break; - } - case UPNP_EVENT_RECEIVED: { - //fprintf(stderr, "Callback: UPNP_EVENT_RECEIVED\n"); - // Event reveived - struct Upnp_Event *e_event = (struct Upnp_Event *)Event; - const std::string Sid = e_event->Sid; - // Parses the event - upnpCP->OnEventReceived(Sid, e_event->EventKey, e_event->ChangedVariables); - break; - } - case UPNP_EVENT_SUBSCRIBE_COMPLETE: - //fprintf(stderr, "Callback: UPNP_EVENT_SUBSCRIBE_COMPLETE\n"); - msg << "error(UPNP_EVENT_SUBSCRIBE_COMPLETE): "; - goto upnpEventRenewalComplete; - case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: - //fprintf(stderr, "Callback: UPNP_EVENT_UNSUBSCRIBE_COMPLETE\n"); - msg << "error(UPNP_EVENT_UNSUBSCRIBE_COMPLETE): "; - goto upnpEventRenewalComplete; - case UPNP_EVENT_RENEWAL_COMPLETE: { - //fprintf(stderr, "Callback: UPNP_EVENT_RENEWAL_COMPLETE\n"); - msg << "error(UPNP_EVENT_RENEWAL_COMPLETE): "; -upnpEventRenewalComplete: - struct Upnp_Event_Subscribe *es_event = - (struct Upnp_Event_Subscribe *)Event; - if (es_event->ErrCode != UPNP_E_SUCCESS) { - msg << "Error in Event Subscribe Callback"; - upnpCP->m_upnpLib.processUPnPErrorMessage( - msg.str(), es_event->ErrCode, NULL, NULL); - } else { -#if 0 - TvCtrlPointHandleSubscribeUpdate( - es_event->PublisherUrl, - es_event->Sid, - es_event->TimeOut ); -#endif - } - - break; - } - - case UPNP_EVENT_AUTORENEWAL_FAILED: - //fprintf(stderr, "Callback: UPNP_EVENT_AUTORENEWAL_FAILED\n"); - msg << "error(UPNP_EVENT_AUTORENEWAL_FAILED): "; - msg2 << "UPNP_EVENT_AUTORENEWAL_FAILED: "; - goto upnpEventSubscriptionExpired; - case UPNP_EVENT_SUBSCRIPTION_EXPIRED: { - //fprintf(stderr, "Callback: UPNP_EVENT_SUBSCRIPTION_EXPIRED\n"); - msg << "error(UPNP_EVENT_SUBSCRIPTION_EXPIRED): "; - msg2 << "UPNP_EVENT_SUBSCRIPTION_EXPIRED: "; -upnpEventSubscriptionExpired: - struct Upnp_Event_Subscribe *es_event = - (struct Upnp_Event_Subscribe *)Event; - Upnp_SID newSID; - int TimeOut = 1801; - int ret = upnpCP->m_upnpLib.m_UpnpSubscribe( - upnpCP->m_UPnPClientHandle, - es_event->PublisherUrl, - &TimeOut, - newSID); - if (ret != UPNP_E_SUCCESS) { - msg << "Error Subscribing to EventURL"; - upnpCP->m_upnpLib.processUPnPErrorMessage( - msg.str(), es_event->ErrCode, NULL, NULL); - } else { - ServiceMap::iterator it = - upnpCP->m_ServiceMap.find(es_event->PublisherUrl); - if (it != upnpCP->m_ServiceMap.end()) { - CUPnPService &service = *(it->second); - service.SetTimeout(TimeOut); - service.SetSID(newSID); - msg2 << "Re-subscribed to EventURL '" << - es_event->PublisherUrl << - "' with SID == '" << - newSID << "'."; - AddDebugLogLineM(true, logUPnP, msg2); - // In principle, we should test to see if the - // service is the same. But here we only have one - // service, so... - upnpCP->RefreshPortMappings(); - } else { - msg << "Error: did not find service " << - newSID << " in the service map."; - AddDebugLogLineM(true, logUPnP, msg); - } - } - break; - } - case UPNP_CONTROL_ACTION_COMPLETE: { - //fprintf(stderr, "Callback: UPNP_CONTROL_ACTION_COMPLETE\n"); - // This is here if we choose to do this asynchronously - struct Upnp_Action_Complete *a_event = - (struct Upnp_Action_Complete *)Event; - if (a_event->ErrCode != UPNP_E_SUCCESS) { - upnpCP->m_upnpLib.processUPnPErrorMessage( - "m_UpnpSendActionAsync", - a_event->ErrCode, NULL, - a_event->ActionResult); - } else { - // Check the response document - upnpCP->m_upnpLib.ProcessActionResponse( - a_event->ActionResult, - ""); - } - /* No need for any processing here, just print out results. - * Service state table updates are handled by events. - */ - break; - } - case UPNP_CONTROL_GET_VAR_COMPLETE: { - //fprintf(stderr, "Callback: UPNP_CONTROL_GET_VAR_COMPLETE\n"); - msg << "error(UPNP_CONTROL_GET_VAR_COMPLETE): "; - struct Upnp_State_Var_Complete *sv_event = - (struct Upnp_State_Var_Complete *)Event; - if (sv_event->ErrCode != UPNP_E_SUCCESS) { - msg << "m_UpnpGetServiceVarStatusAsync"; - upnpCP->m_upnpLib.processUPnPErrorMessage( - msg.str(), sv_event->ErrCode, NULL, NULL); - } else { -#if 0 - // Warning: The use of UpnpGetServiceVarStatus and - // UpnpGetServiceVarStatusAsync is deprecated by the - // UPnP forum. - TvCtrlPointHandleGetVar( - sv_event->CtrlUrl, - sv_event->StateVarName, - sv_event->CurrentVal ); -#endif - } - break; - } - // ignore these cases, since this is not a device - case UPNP_CONTROL_GET_VAR_REQUEST: - //fprintf(stderr, "Callback: UPNP_CONTROL_GET_VAR_REQUEST\n"); - msg << "error(UPNP_CONTROL_GET_VAR_REQUEST): "; - goto eventSubscriptionRequest; - case UPNP_CONTROL_ACTION_REQUEST: - //fprintf(stderr, "Callback: UPNP_CONTROL_ACTION_REQUEST\n"); - msg << "error(UPNP_CONTROL_ACTION_REQUEST): "; - goto eventSubscriptionRequest; - case UPNP_EVENT_SUBSCRIPTION_REQUEST: - //fprintf(stderr, "Callback: UPNP_EVENT_SUBSCRIPTION_REQUEST\n"); - msg << "error(UPNP_EVENT_SUBSCRIPTION_REQUEST): "; -eventSubscriptionRequest: - msg << "This is not a UPnP Device, this is a UPnP Control Point, event ignored."; - AddDebugLogLineM(true, logUPnP, msg); - break; - default: - // Humm, this is not good, we forgot to handle something... - fprintf(stderr, - "Callback: default... Unknown event:'%d', not good.\n", - EventType); - msg << "error(UPnP::Callback): Event not handled:'" << - EventType << "'."; - fprintf(stderr, "%s\n", msg.str().c_str()); - AddDebugLogLineM(true, logUPnP, msg); - // Better not throw in the callback. Who would catch it? - //throw CUPnPException(msg); - break; - } - - return 0; -} - - -void CUPnPControlPoint::OnEventReceived( - const std::string &Sid, - int EventKey, - IXML_Document *ChangedVariablesDoc) -{ - std::ostringstream msg; - msg << "UPNP_EVENT_RECEIVED:" << - "\n SID: " << Sid << - "\n Key: " << EventKey << - "\n Property list:"; - IXML_Element *root = - m_upnpLib.Element_GetRootElement(ChangedVariablesDoc); - IXML_Element *child = - m_upnpLib.Element_GetFirstChild(root); - if (child) { - while (child) { - IXML_Element *child2 = - m_upnpLib.Element_GetFirstChild(child); - const DOMString childTag = - m_upnpLib.Element_GetTag(child2); - std::string childValue = - m_upnpLib.Element_GetTextValue(child2); - msg << "\n " << - childTag << "='" << - childValue << "'"; - child = m_upnpLib.Element_GetNextSibling(child); - } - } else { - msg << "\n Empty property list."; - } - AddDebugLogLineM(true, logUPnP, msg); - // Freeing that doc segfaults. Probably should not be freed. - //m_upnpLib.m_ixmlDocument_free(ChangedVariablesDoc); -} - - -void CUPnPControlPoint::AddRootDevice( - IXML_Element *rootDevice, const std::string &urlBase, - const char *location, int expires) -{ - // Lock the Root Device List - CUPnPMutexLocker lock(m_RootDeviceListMutex); - - // Root node's URLBase - std::string OriginalURLBase(urlBase); - std::string FixedURLBase(OriginalURLBase.empty() ? - location : - OriginalURLBase); - - // Get the UDN (Unique Device Name) - std::string UDN( - m_upnpLib.Element_GetChildValueByTag(rootDevice, "UDN")); - RootDeviceMap::iterator it = m_RootDeviceMap.find(UDN); - bool alreadyAdded = it != m_RootDeviceMap.end(); - if (alreadyAdded) { - // Just set the expires field - it->second->SetExpires(expires); - } else { - // Add a new root device to the root device list - CUPnPRootDevice *upnpRootDevice = new CUPnPRootDevice( - *this, m_upnpLib, rootDevice, - OriginalURLBase, FixedURLBase, - location, expires); - m_RootDeviceMap[upnpRootDevice->GetUDN()] = upnpRootDevice; - } -} - - -void CUPnPControlPoint::RemoveRootDevice(const char *udn) -{ - // Lock the Root Device List - CUPnPMutexLocker lock(m_RootDeviceListMutex); - - // Remove - std::string UDN(udn); - RootDeviceMap::iterator it = m_RootDeviceMap.find(UDN); - if (it != m_RootDeviceMap.end()) { - delete it->second; - m_RootDeviceMap.erase(UDN); - } -} - - -void CUPnPControlPoint::Subscribe(CUPnPService &service) -{ - std::ostringstream msg; - int errcode = m_upnpLib.m_UpnpSubscribe(m_UPnPClientHandle, - service.GetAbsEventSubURL().c_str(), - service.GetTimeoutAddr(), - service.GetSID()); - if (errcode == UPNP_E_SUCCESS) { - m_ServiceMap[service.GetAbsEventSubURL()] = &service; - msg << "Successfully subscribed to service " << - service.GetServiceType() << ", absEventSubURL: " << - service.GetAbsEventSubURL() << "."; - AddLogLineM(true, logUPnP, msg); - - IXML_Document *scpdDoc = NULL; - errcode = m_upnpLib.m_UpnpDownloadXmlDoc( - service.GetAbsSCPDURL().c_str(), &scpdDoc); - if (errcode == UPNP_E_SUCCESS) { - // Get the root node - IXML_Element *scpdRoot = - m_upnpLib.Element_GetRootElement(scpdDoc); - CUPnPSCPD *scpd = new CUPnPSCPD(*this, m_upnpLib, - scpdRoot, service.GetAbsSCPDURL()); - service.SetSCPD(scpd); - } else { - msg.str(""); - msg << "Error getting SCPD Document from " << - service.GetAbsSCPDURL() << "."; - AddLogLineM(true, logUPnP, msg); - } - } else { - msg << "Error subscribing to service " << - service.GetServiceType() << ", absEventSubURL: " << - service.GetAbsEventSubURL() << ", error: " << - m_upnpLib.GetUPnPErrorMessage(errcode) << "."; - goto error; - } - - return; - - // Error processing -error: - AddLogLineM(true, logUPnP, msg); -} - - -void CUPnPControlPoint::Unsubscribe(CUPnPService &service) -{ - ServiceMap::iterator it = m_ServiceMap.find(service.GetAbsEventSubURL()); - m_ServiceMap.erase(it); - m_upnpLib.m_UpnpUnSubscribe(m_UPnPClientHandle, service.GetSID()); -} - - -// File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/UPnP.h amule-2.2.2/src/UPnP.h --- amule-2.2.0~svn20080218/src/UPnP.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/UPnP.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,696 +0,0 @@ -// -// This file is part of the aMule Project. -// -// Copyright (c) 2006-2008 Marcelo Roberto Jimenez ( phoenix@amule.org ) -// Copyright (c) 2006-2008 aMule Team ( admin@amule.org / http://www.amule.org ) -// -// Any parts of this program derived from the xMule, lMule or eMule project, -// or contributed by third-party developers are copyrighted by their -// respective authors. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -// - - -// This define must not conflict with the one in the standard header -#ifndef AMULE_UPNP_H -#define AMULE_UPNP_H - - -#include -#include -#include - - -#include "UPnPCompatibility.h" - - -#ifdef UPNP_C - std::string stdEmptyString; -#else // UPNP_C - extern std::string stdEmptyString; -#endif // UPNP_C - - -/** - * Case insensitive std::string comparison - */ -bool stdStringIsEqualCI( - const std::string &s1, - const std::string &s2); - - -class CUPnPPortMapping -{ -private: - std::string m_port; - std::string m_protocol; - std::string m_enabled; - std::string m_description; - std::string m_key; - -public: - CUPnPPortMapping( - int port = 0, - const std::string &protocol = stdEmptyString, - bool enabled = false, - const std::string &description = stdEmptyString); - ~CUPnPPortMapping() {} - - const std::string &getPort() const - { return m_port; } - const std::string &getProtocol() const - { return m_protocol; } - const std::string &getEnabled() const - { return m_enabled; } - const std::string &getDescription() const - { return m_description; } - const std::string &getKey() const - { return m_key; } -}; - - -class CDynamicLibHandle -{ -private: - std::string m_libname; - void *const m_LibraryHandle; - CDynamicLibHandle(const CDynamicLibHandle &); - CDynamicLibHandle &operator=(const CDynamicLibHandle &); - -public: - CDynamicLibHandle(const char *libname); - ~CDynamicLibHandle(); - void *Get() const { return m_LibraryHandle; } -}; - - -class CUPnPControlPoint; - - -class CUPnPLib -{ -public: - static const std::string &UPNP_ROOT_DEVICE; - static const std::string &UPNP_DEVICE_IGW; - static const std::string &UPNP_DEVICE_WAN; - static const std::string &UPNP_DEVICE_WAN_CONNECTION; - static const std::string &UPNP_DEVICE_LAN; - static const std::string &UPNP_SERVICE_LAYER3_FORWARDING; - static const std::string &UPNP_SERVICE_WAN_COMMON_INTERFACE_CONFIG; - static const std::string &UPNP_SERVICE_WAN_IP_CONNECTION; - static const std::string &UPNP_SERVICE_WAN_PPP_CONNECTION; - CUPnPControlPoint &m_ctrlPoint; - -private: - // dlopen stuff - static const int NUM_LIB_IXML_SYMBOLS = 8; - static const char *s_LibIXMLSymbols[NUM_LIB_IXML_SYMBOLS]; - static const int NUM_LIB_UPNP_SYMBOLS = 17; - static const char *s_LibUPnPSymbols[NUM_LIB_UPNP_SYMBOLS]; - CDynamicLibHandle m_LibIXMLHandle; - CDynamicLibHandle m_LibUPnPHandle2; - CDynamicLibHandle m_LibUPnPHandle3; - CDynamicLibHandle *m_LibUPnPHandle; - const std::string addLibraryPath(const char *name); - -public: - CUPnPLib(CUPnPControlPoint &ctrlPoint); - ~CUPnPLib() {} - - // Convenience function so we don't have to write explicit calls - // to char2unicode every time - std::string GetUPnPErrorMessage(int code) const; - - // Convenience function to avoid repetitive processing of error - // messages - std::string processUPnPErrorMessage( - const std::string &messsage, - int code, - const DOMString errorString, - IXML_Document *doc) const; - - // Processing response to actions - void ProcessActionResponse( - IXML_Document *RespDoc, - const std::string &actionName) const; - - // IXML_Element - IXML_Element *Element_GetRootElement( - IXML_Document *doc) const; - IXML_Element *Element_GetFirstChild( - IXML_Element *parent) const; - IXML_Element *Element_GetNextSibling( - IXML_Element *child) const; - const DOMString Element_GetTag( - IXML_Element *element) const; - const std::string Element_GetTextValue( - IXML_Element *element) const; - const std::string Element_GetChildValueByTag( - IXML_Element *element, - const DOMString tag) const; - IXML_Element *Element_GetFirstChildByTag( - IXML_Element *element, - const DOMString tag) const; - IXML_Element *Element_GetNextSiblingByTag( - IXML_Element *element, - const DOMString tag) const; - const std::string Element_GetAttributeByTag( - IXML_Element *element, - const DOMString tag) const; - - // ixml api - IXML_Node *(*m_ixmlNode_getFirstChild)(IXML_Node *nodeptr); - IXML_Node *(*m_ixmlNode_getNextSibling)(IXML_Node *nodeptr); - const DOMString (*m_ixmlNode_getNodeName)(IXML_Node *nodeptr); - const DOMString (*m_ixmlNode_getNodeValue)(IXML_Node *nodeptr); - IXML_NamedNodeMap *(*m_ixmlNode_getAttributes)(IXML_Node *nodeptr); - void (*m_ixmlDocument_free)(IXML_Document *doc); - IXML_Node *(*m_ixmlNamedNodeMap_getNamedItem)( - IXML_NamedNodeMap *nnMap, const DOMString name); - void (*m_ixmlNamedNodeMap_free)(IXML_NamedNodeMap *nnMap); - - // upnp api - // 1 - Initialization and Registration - int (*m_UpnpInit)(const char *IPAddress, int Port); - void (*m_UpnpFinish)(); - unsigned short (*m_UpnpGetServerPort)(); - char *(*m_UpnpGetServerIpAddress)(); - int (*m_UpnpRegisterClient)(Upnp_FunPtr Callback, - const void *Cookie, UpnpClient_Handle *Hnd); - int (*m_UpnpUnRegisterClient)(UpnpClient_Handle Hnd); - // 2 - Discovery - int (*m_UpnpSearchAsync)(UpnpClient_Handle Hnd, int Mx, - const char *Target, const void *Cookie); - // 3 - Control - int (*m_UpnpGetServiceVarStatus)(UpnpClient_Handle Hnd, const char *ActionURL, - const char *VarName, DOMString *StVarVal); - int (*m_UpnpSendAction)(UpnpClient_Handle Hnd, const char *ActionURL, - const char *ServiceType, const char *DevUDN, IXML_Document *Action, - IXML_Document **RespNode); - int (*m_UpnpSendActionAsync)(UpnpClient_Handle Hnd, const char *ActionURL, - const char *ServiceType, const char *DevUDN, IXML_Document *Action, - Upnp_FunPtr Callback, const void *Cookie); - // 4 - Eventing - int (*m_UpnpSubscribe)(UpnpClient_Handle Hnd, - const char *PublisherUrl, int *TimeOut, Upnp_SID SubsId); - int (*m_UpnpUnSubscribe)(UpnpClient_Handle Hnd, Upnp_SID SubsId); - // 5 - HTTP - int (*m_UpnpDownloadXmlDoc)(const char *url, IXML_Document **xmlDoc); - // 6 - Optional Tools API - int (*m_UpnpResolveURL)(const char *BaseURL, - const char *RelURL, char *AbsURL); - IXML_Document *(*m_UpnpMakeAction)( - const char *ActionName, const char *ServType, int NumArg, - const char *Arg, ...); - int (*m_UpnpAddToAction)( - IXML_Document **ActionDoc, const char *ActionName, - const char *ServType, const char *ArgName, const char *ArgVal); - const char *(*m_UpnpGetErrorMessage)(int ErrorCode); -}; - - -class CUPnPControlPoint; - -/* - * Even though we can retrieve the upnpLib handler from the upnpControlPoint, - * we must pass it separetly at this point, because the class CUPnPControlPoint - * must be declared after. - * - * CUPnPLib can only be removed from the constructor once we agree to link to - * UPnPLib explicitly, making this dlopen() stuff unnecessary. - */ -template -class CXML_List : public std::map -{ -public: - CXML_List( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *parent, - const std::string &url); - ~CXML_List(); -}; - - -template -CXML_List::CXML_List( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *parent, - const std::string &url) -{ - IXML_Element *elementList = - upnpLib.Element_GetFirstChildByTag(parent, XML_LIST_NAME); - unsigned int i = 0; - for ( IXML_Element *element = upnpLib.Element_GetFirstChildByTag(elementList, XML_ELEMENT_NAME); - element; - element = upnpLib.Element_GetNextSiblingByTag(element, XML_ELEMENT_NAME)) { - // Add a new element to the element list - T *upnpElement = new T(upnpControlPoint, upnpLib, element, url); - (*this)[upnpElement->GetKey()] = upnpElement; - ++i; - } - std::ostringstream msg; - msg << "\n " << XML_LIST_NAME << ": " << - i << " " << XML_ELEMENT_NAME << "s."; - AddDebugLogLineM(false, logUPnP, msg); -} - - -template -CXML_List::~CXML_List() -{ - typename CXML_List::iterator it; - for(it = this->begin(); it != this->end(); ++it) { - delete (*it).second; - } -} - -#ifdef UPNP_C - char s_argument[] = "argument"; - char s_argumentList[] = "argumentList"; - char s_action[] = "action"; - char s_actionList[] = "actionList"; - char s_allowedValue[] = "allowedValue"; - char s_allowedValueList[] = "allowedValueList"; - char s_stateVariable[] = "stateVariable"; - char s_serviceStateTable[] = "serviceStateTable"; - char s_service[] = "service"; - char s_serviceList[] = "serviceList"; - char s_device[] = "device"; - char s_deviceList[] = "deviceList"; -#else // UPNP_C - extern char s_argument[]; - extern char s_argumentList[]; - extern char s_action[]; - extern char s_actionList[]; - extern char s_allowedValue[]; - extern char s_allowedValueList[]; - extern char s_stateVariable[]; - extern char s_serviceStateTable[]; - extern char s_service[]; - extern char s_serviceList[]; - extern char s_device[]; - extern char s_deviceList[]; -#endif // UPNP_C - - -class CUPnPArgument; -typedef CXML_List ArgumentList; -class CUPnPAction; -typedef CXML_List ActionList; -class CUPnPStateVariable; -typedef CXML_List ServiceStateTable; -class CUPnPAllowedValue; -typedef CXML_List AllowedValueList; -class CUPnPService; -typedef CXML_List ServiceList; -class CUPnPDevice; -typedef CXML_List DeviceList; - - -class CUPnPError -{ -private: - IXML_Element *m_root; - const std::string m_ErrorCode; - const std::string m_ErrorDescription; -public: - CUPnPError( - const CUPnPLib &upnpLib, - IXML_Document *errorDoc); - ~CUPnPError() {} - const std::string &getErrorCode() const - { return m_ErrorCode; } - const std::string &getErrorDescription() const - { return m_ErrorDescription; } -}; - - -class CUPnPArgument -{ -private: - const CUPnPControlPoint &m_UPnPControlPoint; - const std::string m_name; - const std::string m_direction; - bool m_retval; - const std::string m_relatedStateVariable; - -public: - CUPnPArgument( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *argument, - const std::string &SCPDURL); - ~CUPnPArgument() {} - const std::string &GetName() const - { return m_name; } - const std::string &GetDirection() const - { return m_direction; } - bool GetRetVal() const - { return m_retval; } - const std::string &GetRelatedStateVariable() const - { return m_relatedStateVariable; } - const std::string &GetKey() const - { return m_name; } -}; - - - -class CUPnPAction -{ -private: - const CUPnPControlPoint &m_UPnPControlPoint; - ArgumentList m_ArgumentList; - const std::string m_name; - -public: - CUPnPAction( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *action, - const std::string &SCPDURL); - ~CUPnPAction() {} - const std::string &GetName() const - { return m_name; } - const std::string &GetKey() const - { return m_name; } - const ArgumentList &GetArgumentList() const - { return m_ArgumentList; } -}; - - -class CUPnPAllowedValue -{ -private: - const CUPnPControlPoint &m_UPnPControlPoint; - const std::string m_allowedValue; - -public: - CUPnPAllowedValue( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *allowedValue, - const std::string &SCPDURL); - ~CUPnPAllowedValue() {} - const std::string &GetAllowedValue() const - { return m_allowedValue; } - const std::string &GetKey() const - { return m_allowedValue; } -}; - - -class CUPnPStateVariable -{ -private: - const CUPnPControlPoint &m_UPnPControlPoint; - AllowedValueList m_AllowedValueList; - const std::string m_name; - const std::string m_dataType; - const std::string m_defaultValue; - const std::string m_sendEvents; - -public: - CUPnPStateVariable( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *stateVariable, - const std::string &URLBase); - ~CUPnPStateVariable() {} - const std::string &GetNname() const - { return m_name; } - const std::string &GetDataType() const - { return m_dataType; } - const std::string &GetDefaultValue() const - { return m_defaultValue; } - const std::string &GetKey() const - { return m_name; } - const AllowedValueList &GetAllowedValueList() const - { return m_AllowedValueList; } -}; - - -class CUPnPSCPD -{ -private: - const CUPnPControlPoint &m_UPnPControlPoint; - ActionList m_ActionList; - ServiceStateTable m_ServiceStateTable; - const std::string m_SCPDURL; - -public: - CUPnPSCPD( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *scpd, - const std::string &SCPDURL); - ~CUPnPSCPD() {} - const ActionList &GetActionList() const - { return m_ActionList; } - const ServiceStateTable &GetServiceStateTable() const - { return m_ServiceStateTable; } -}; - - -class CUPnPArgumentValue -{ -private: - std::string m_argument; - std::string m_value; - -public: - CUPnPArgumentValue(); - CUPnPArgumentValue(const std::string &argument, const std::string &value); - ~CUPnPArgumentValue() {} - - const std::string &GetArgument() const { return m_argument; } - const std::string &GetValue() const { return m_value; } - const std::string &SetArgument(const std::string& argument) { return m_argument = argument; } - const std::string &SetValue(const std::string &value) { return m_value = value; } -}; - - -class CUPnPService -{ -private: - const CUPnPControlPoint &m_UPnPControlPoint; - CUPnPLib &m_upnpLib; - const std::string m_serviceType; - const std::string m_serviceId; - const std::string m_SCPDURL; - const std::string m_controlURL; - const std::string m_eventSubURL; - std::string m_absSCPDURL; - std::string m_absControlURL; - std::string m_absEventSubURL; - int m_timeout; - Upnp_SID m_SID; - std::auto_ptr m_SCPD; - -public: - CUPnPService( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *service, - const std::string &URLBase); - ~CUPnPService(); - - const std::string &GetServiceType() const - { return m_serviceType; } - const std::string &GetServiceId() const - { return m_serviceId; } - const std::string &GetSCPDURL() const - { return m_SCPDURL; } - const std::string &GetAbsSCPDURL() const - { return m_absSCPDURL; } - const std::string &GetControlURL() const - { return m_controlURL; } - const std::string &GetEventSubURL() const - { return m_eventSubURL; } - const std::string &GetAbsControlURL() const - { return m_absControlURL; } - const std::string &GetAbsEventSubURL() const - { return m_absEventSubURL; } - int GetTimeout() const - { return m_timeout; } - void SetTimeout(int t) - { m_timeout = t; } - int *GetTimeoutAddr() - { return &m_timeout; } - char *GetSID() - { return m_SID; } - void SetSID(const char *s) - { memcpy(m_SID, s, sizeof(Upnp_SID)); } - const std::string &GetKey() const - { return m_serviceId; } - bool IsSubscribed() const - { return m_SCPD.get() != NULL; } - void SetSCPD(CUPnPSCPD *SCPD) - { m_SCPD.reset(SCPD); } - - bool Execute( - const std::string &ActionName, - const std::vector &ArgValue) const; - const std::string GetStateVariable( - const std::string &stateVariableName) const; -}; - - -class CUPnPDevice -{ -private: - const CUPnPControlPoint &m_UPnPControlPoint; - - // Please, lock these lists before use - DeviceList m_DeviceList; - ServiceList m_ServiceList; - - const std::string m_deviceType; - const std::string m_friendlyName; - const std::string m_manufacturer; - const std::string m_manufacturerURL; - const std::string m_modelDescription; - const std::string m_modelName; - const std::string m_modelNumber; - const std::string m_modelURL; - const std::string m_serialNumber; - const std::string m_UDN; - const std::string m_UPC; - std::string m_presentationURL; - -public: - CUPnPDevice( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *device, - const std::string &URLBase); - ~CUPnPDevice() {} - - const std::string &GetUDN() const - { return m_UDN; } - const std::string &GetDeviceType() const - { return m_deviceType; } - const std::string &GetFriendlyName() const - { return m_friendlyName; } - const std::string &GetPresentationURL() const - { return m_presentationURL; } - const std::string &GetKey() const - { return m_UDN; } -}; - - -class CUPnPRootDevice : public CUPnPDevice -{ -private: - const CUPnPControlPoint &m_UPnPControlPoint; - const std::string m_URLBase; - const std::string m_location; - int m_expires; - -public: - CUPnPRootDevice( - const CUPnPControlPoint &upnpControlPoint, - CUPnPLib &upnpLib, - IXML_Element *rootDevice, - const std::string &OriginalURLBase, - const std::string &FixedURLBase, - const char *location, - int expires); - ~CUPnPRootDevice() {} - - const std::string &GetURLBase() const - { return m_URLBase; } - const std::string &GetLocation() const - { return m_location; } - int GetExpires() const - { return m_expires; } - void SetExpires(int expires) - { m_expires = expires; } -}; - - -typedef std::map RootDeviceMap; -typedef std::map ServiceMap; -typedef std::map PortMappingMap; - - -class CUPnPControlPoint -{ -private: - static CUPnPControlPoint *s_CtrlPoint; - // upnp stuff - CUPnPLib m_upnpLib; - UpnpClient_Handle m_UPnPClientHandle; - RootDeviceMap m_RootDeviceMap; - ServiceMap m_ServiceMap; - PortMappingMap m_ActivePortMappingsMap; - CUPnPMutex m_RootDeviceListMutex; - bool m_IGWDeviceDetected; -//#warning This variable is for testing purposes only and should disappear on release. - CUPnPService *m_WanService; - CUPnPMutex m_WaitForSearchTimeoutMutex; - -public: - CUPnPControlPoint(unsigned short udpPort); - ~CUPnPControlPoint(); - void Subscribe(CUPnPService &service); - void Unsubscribe(CUPnPService &service); - bool AddPortMappings( - std::vector &upnpPortMapping); - bool DeletePortMappings( - std::vector &upnpPortMapping); - - UpnpClient_Handle GetUPnPClientHandle() const - { return m_UPnPClientHandle; } - - bool GetIGWDeviceDetected() const - { return m_IGWDeviceDetected; } - void SetIGWDeviceDetected(bool b) - { m_IGWDeviceDetected = b; } - bool WanServiceDetected() const - { return !m_ServiceMap.empty(); } - void SetWanService(CUPnPService *service) - { m_WanService = service; } - - // Callback function - static int Callback( - Upnp_EventType EventType, - void* Event, - void* Cookie); - -private: - void OnEventReceived( - const std::string &Sid, - int EventKey, - IXML_Document *ChangedVariables); - void AddRootDevice( - IXML_Element *rootDevice, - const std::string &urlBase, - const char *location, - int expires); - void RemoveRootDevice( - const char *udn); - void RefreshPortMappings(); - bool PrivateAddPortMapping( - CUPnPPortMapping &upnpPortMapping); - bool PrivateDeletePortMapping( - CUPnPPortMapping &upnpPortMapping); -}; - - -#endif /* AMULE_UPNP_H */ - -// File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/UPnPBase.cpp amule-2.2.2/src/UPnPBase.cpp --- amule-2.2.0~svn20080218/src/UPnPBase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/src/UPnPBase.cpp 2008-07-15 02:08:44.000000000 +0000 @@ -0,0 +1,1575 @@ +// +// This file is part of the aMule Project. +// +// Copyright (c) 2004-2008 Marcelo Roberto Jimenez ( phoenix@amule.org ) +// Copyright (c) 2006-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + +#define UPNP_C + +#include "UPnPBase.h" + + +#include // For dlopen(), dlsym(), dlclose() +#include // For transform() + + +#ifdef __GNUC__ + #if __GNUC__ >= 4 + #define REINTERPRET_CAST(x) reinterpret_cast + #endif +#endif +#ifndef REINTERPRET_CAST + // Let's hope that function pointers are equal in size to data pointers + #define REINTERPRET_CAST(x) (x) +#endif + + +/** + * Case insensitive std::string comparison + */ +bool stdStringIsEqualCI(const std::string &s1, const std::string &s2) +{ + std::string ns1(s1); + std::string ns2(s2); + std::transform(ns1.begin(), ns1.end(), ns1.begin(), tolower); + std::transform(ns2.begin(), ns2.end(), ns2.begin(), tolower); + return ns1 == ns2; +} + + +CUPnPPortMapping::CUPnPPortMapping( + int port, + const std::string &protocol, + bool enabled, + const std::string &description) +: +m_port(), +m_protocol(protocol), +m_enabled(enabled ? "1" : "0"), +m_description(description), +m_key() +{ + std::ostringstream oss; + oss << port; + m_port = oss.str(); + m_key = m_protocol + m_port; +} + + +const std::string &CUPnPLib::UPNP_ROOT_DEVICE = + "upnp:rootdevice"; + +const std::string &CUPnPLib::UPNP_DEVICE_IGW = + "urn:schemas-upnp-org:device:InternetGatewayDevice:1"; +const std::string &CUPnPLib::UPNP_DEVICE_WAN = + "urn:schemas-upnp-org:device:WANDevice:1"; +const std::string &CUPnPLib::UPNP_DEVICE_WAN_CONNECTION = + "urn:schemas-upnp-org:device:WANConnectionDevice:1"; +const std::string &CUPnPLib::UPNP_DEVICE_LAN = + "urn:schemas-upnp-org:device:LANDevice:1"; + +const std::string &CUPnPLib::UPNP_SERVICE_LAYER3_FORWARDING = + "urn:schemas-upnp-org:service:Layer3Forwarding:1"; +const std::string &CUPnPLib::UPNP_SERVICE_WAN_COMMON_INTERFACE_CONFIG = + "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1"; +const std::string &CUPnPLib::UPNP_SERVICE_WAN_IP_CONNECTION = + "urn:schemas-upnp-org:service:WANIPConnection:1"; +const std::string &CUPnPLib::UPNP_SERVICE_WAN_PPP_CONNECTION = + "urn:schemas-upnp-org:service:WANPPPConnection:1"; + + +CUPnPLib::CUPnPLib(CUPnPControlPoint &ctrlPoint) +: +m_ctrlPoint(ctrlPoint) +{ +} + + +std::string CUPnPLib::GetUPnPErrorMessage(int code) const +{ + return UpnpGetErrorMessage(code); +} + + +std::string CUPnPLib::processUPnPErrorMessage( + const std::string &messsage, + int errorCode, + const DOMString errorString, + IXML_Document *doc) const +{ + std::ostringstream msg; + if (errorString == NULL || *errorString == 0) { + errorString = "Not available"; + } + if (errorCode > 0) { + msg << "Error: " << + messsage << + ": Error code :'"; + if (doc) { + CUPnPError e(*this, doc); + msg << e.getErrorCode() << + "', Error description :'" << + e.getErrorDescription() << + "'."; + } else { + msg << errorCode << + "', Error description :'" << + errorString << + "'."; + } + AddLogLineM(false, logUPnP, msg); + } else { + msg << "Error: " << + messsage << + ": UPnP SDK error: " << + GetUPnPErrorMessage(errorCode) << + " (" << errorCode << ")."; + AddLogLineM(false, logUPnP, msg); + } + + return msg.str(); +} + + +void CUPnPLib::ProcessActionResponse( + IXML_Document *RespDoc, + const std::string &actionName) const +{ + std::ostringstream msg; + msg << "Response: "; + IXML_Element *root = Element_GetRootElement(RespDoc); + IXML_Element *child = Element_GetFirstChild(root); + if (child) { + while (child) { + const DOMString childTag = Element_GetTag(child); + std::string childValue = Element_GetTextValue(child); + msg << "\n " << + childTag << "='" << + childValue << "'"; + child = Element_GetNextSibling(child); + } + } else { + msg << "\n Empty response for action '" << + actionName << "'."; + } + AddDebugLogLineM(false, logUPnP, msg); +} + + +/*! + * \brief Returns the root node of a given document. + */ +IXML_Element *CUPnPLib::Element_GetRootElement( + IXML_Document *doc) const +{ + IXML_Element *root = REINTERPRET_CAST(IXML_Element *)( + ixmlNode_getFirstChild( + REINTERPRET_CAST(IXML_Node *)(doc))); + + return root; +} + + +/*! + * \brief Returns the first child of a given element. + */ +IXML_Element *CUPnPLib::Element_GetFirstChild( + IXML_Element *parent) const +{ + IXML_Node *node = REINTERPRET_CAST(IXML_Node *)(parent); + IXML_Node *child = ixmlNode_getFirstChild(node); + + return REINTERPRET_CAST(IXML_Element *)(child); +} + + +/*! + * \brief Returns the next sibling of a given child. + */ +IXML_Element *CUPnPLib::Element_GetNextSibling( + IXML_Element *child) const +{ + IXML_Node *node = REINTERPRET_CAST(IXML_Node *)(child); + IXML_Node *sibling = ixmlNode_getNextSibling(node); + + return REINTERPRET_CAST(IXML_Element *)(sibling); +} + + +/*! + * \brief Returns the element tag (name) + */ +const DOMString CUPnPLib::Element_GetTag( + IXML_Element *element) const +{ + IXML_Node *node = REINTERPRET_CAST(IXML_Node *)(element); + const DOMString tag = ixmlNode_getNodeName(node); + + return tag; +} + + +/*! + * \brief Returns the TEXT node value of the current node. + */ +const std::string CUPnPLib::Element_GetTextValue( + IXML_Element *element) const +{ + if (!element) { + return stdEmptyString; + } + IXML_Node *text = ixmlNode_getFirstChild( + REINTERPRET_CAST(IXML_Node *)(element)); + const DOMString s = ixmlNode_getNodeValue(text); + std::string ret; + if (s) { + ret = s; + } + + return ret; +} + + +/*! + * \brief Returns the TEXT node value of the first child matching tag. + */ +const std::string CUPnPLib::Element_GetChildValueByTag( + IXML_Element *element, + const DOMString tag) const +{ + IXML_Element *child = + Element_GetFirstChildByTag(element, tag); + + return Element_GetTextValue(child); +} + + +/*! + * \brief Returns the first child element that matches the requested tag or + * NULL if not found. + */ +IXML_Element *CUPnPLib::Element_GetFirstChildByTag( + IXML_Element *element, + const DOMString tag) const +{ + if (!element || !tag) { + return NULL; + } + + IXML_Node *node = REINTERPRET_CAST(IXML_Node *)(element); + IXML_Node *child = ixmlNode_getFirstChild(node); + const DOMString childTag = ixmlNode_getNodeName(child); + while(child && childTag && strcmp(tag, childTag)) { + child = ixmlNode_getNextSibling(child); + childTag = ixmlNode_getNodeName(child); + } + + return REINTERPRET_CAST(IXML_Element *)(child); +} + + +/*! + * \brief Returns the next sibling element that matches the requested tag. Should be + * used with the return value of Element_GetFirstChildByTag(). + */ +IXML_Element *CUPnPLib::Element_GetNextSiblingByTag( + IXML_Element *element, const DOMString tag) const +{ + if (!element || !tag) { + return NULL; + } + + IXML_Node *child = REINTERPRET_CAST(IXML_Node *)(element); + const DOMString childTag = NULL; + do { + child = ixmlNode_getNextSibling(child); + childTag = ixmlNode_getNodeName(child); + } while(child && childTag && strcmp(tag, childTag)); + + return REINTERPRET_CAST(IXML_Element *)(child); +} + + +const std::string CUPnPLib::Element_GetAttributeByTag( + IXML_Element *element, const DOMString tag) const +{ + IXML_NamedNodeMap *NamedNodeMap = ixmlNode_getAttributes( + REINTERPRET_CAST(IXML_Node *)(element)); + IXML_Node *attribute = ixmlNamedNodeMap_getNamedItem(NamedNodeMap, tag); + const DOMString s = ixmlNode_getNodeValue(attribute); + std::string ret; + if (s) { + ret = s; + } + ixmlNamedNodeMap_free(NamedNodeMap); + + return ret; +} + + +CUPnPError::CUPnPError( + const CUPnPLib &upnpLib, + IXML_Document *errorDoc) +: +m_root (upnpLib.Element_GetRootElement(errorDoc)), +m_ErrorCode (upnpLib.Element_GetChildValueByTag(m_root, "errorCode")), +m_ErrorDescription(upnpLib.Element_GetChildValueByTag(m_root, "errorDescription")) +{ +} + + +CUPnPArgument::CUPnPArgument( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *argument, + const std::string &WXUNUSED(SCPDURL)) +: +m_UPnPControlPoint(upnpControlPoint), +m_name (upnpLib.Element_GetChildValueByTag(argument, "name")), +m_direction (upnpLib.Element_GetChildValueByTag(argument, "direction")), +m_retval (upnpLib.Element_GetFirstChildByTag(argument, "retval")), +m_relatedStateVariable(upnpLib.Element_GetChildValueByTag(argument, "relatedStateVariable")) +{ + std::ostringstream msg; + msg << "\n Argument:" << + "\n name: " << m_name << + "\n direction: " << m_direction << + "\n retval: " << m_retval << + "\n relatedStateVariable: " << m_relatedStateVariable; + AddDebugLogLineM(false, logUPnP, msg); +} + + +CUPnPAction::CUPnPAction( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *action, + const std::string &SCPDURL) +: +m_UPnPControlPoint(upnpControlPoint), +m_ArgumentList(upnpControlPoint, upnpLib, action, SCPDURL), +m_name(upnpLib.Element_GetChildValueByTag(action, "name")) +{ + std::ostringstream msg; + msg << "\n Action:" << + "\n name: " << m_name; + AddDebugLogLineM(false, logUPnP, msg); +} + + +CUPnPAllowedValue::CUPnPAllowedValue( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *allowedValue, + const std::string &WXUNUSED(SCPDURL)) +: +m_UPnPControlPoint(upnpControlPoint), +m_allowedValue(upnpLib.Element_GetTextValue(allowedValue)) +{ + std::ostringstream msg; + msg << "\n AllowedValue:" << + "\n allowedValue: " << m_allowedValue; + AddDebugLogLineM(false, logUPnP, msg); +} + + +CUPnPStateVariable::CUPnPStateVariable( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *stateVariable, + const std::string &SCPDURL) +: +m_UPnPControlPoint(upnpControlPoint), +m_AllowedValueList(upnpControlPoint, upnpLib, stateVariable, SCPDURL), +m_name (upnpLib.Element_GetChildValueByTag(stateVariable, "name")), +m_dataType (upnpLib.Element_GetChildValueByTag(stateVariable, "dataType")), +m_defaultValue(upnpLib.Element_GetChildValueByTag(stateVariable, "defaultValue")), +m_sendEvents (upnpLib.Element_GetAttributeByTag (stateVariable, "sendEvents")) +{ + std::ostringstream msg; + msg << "\n StateVariable:" << + "\n name: " << m_name << + "\n dataType: " << m_dataType << + "\n defaultValue: " << m_defaultValue << + "\n sendEvents: " << m_sendEvents; + AddDebugLogLineM(false, logUPnP, msg); +} + + +CUPnPSCPD::CUPnPSCPD( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *scpd, + const std::string &SCPDURL) +: +m_UPnPControlPoint(upnpControlPoint), +m_ActionList(upnpControlPoint, upnpLib, scpd, SCPDURL), +m_ServiceStateTable(upnpControlPoint, upnpLib, scpd, SCPDURL), +m_SCPDURL(SCPDURL) +{ +} + + +CUPnPArgumentValue::CUPnPArgumentValue() +: +m_argument(), +m_value() +{ +} + + +CUPnPArgumentValue::CUPnPArgumentValue( + const std::string &argument, const std::string &value) +: +m_argument(argument), +m_value(value) +{ +} + + +CUPnPService::CUPnPService( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *service, + const std::string &URLBase) +: +m_UPnPControlPoint(upnpControlPoint), +m_upnpLib(upnpLib), +m_serviceType(upnpLib.Element_GetChildValueByTag(service, "serviceType")), +m_serviceId (upnpLib.Element_GetChildValueByTag(service, "serviceId")), +m_SCPDURL (upnpLib.Element_GetChildValueByTag(service, "SCPDURL")), +m_controlURL (upnpLib.Element_GetChildValueByTag(service, "controlURL")), +m_eventSubURL(upnpLib.Element_GetChildValueByTag(service, "eventSubURL")), +m_timeout(1801), +m_SCPD(NULL) +{ + std::ostringstream msg; + int errcode; + + std::vector vscpdURL(URLBase.length() + m_SCPDURL.length() + 1); + char *scpdURL = &vscpdURL[0]; + errcode = UpnpResolveURL( + URLBase.c_str(), + m_SCPDURL.c_str(), + scpdURL); + if( errcode != UPNP_E_SUCCESS ) { + msg << "Error generating scpdURL from " << + "|" << URLBase << "|" << + m_SCPDURL << "|."; + AddDebugLogLineM(false, logUPnP, msg); + } else { + m_absSCPDURL = scpdURL; + } + + std::vector vcontrolURL( + URLBase.length() + m_controlURL.length() + 1); + char *controlURL = &vcontrolURL[0]; + errcode = UpnpResolveURL( + URLBase.c_str(), + m_controlURL.c_str(), + controlURL); + if( errcode != UPNP_E_SUCCESS ) { + msg << "Error generating controlURL from " << + "|" << URLBase << "|" << + m_controlURL << "|."; + AddDebugLogLineM(false, logUPnP, msg); + } else { + m_absControlURL = controlURL; + } + + std::vector veventURL( + URLBase.length() + m_eventSubURL.length() + 1); + char *eventURL = &veventURL[0]; + errcode = UpnpResolveURL( + URLBase.c_str(), + m_eventSubURL.c_str(), + eventURL); + if( errcode != UPNP_E_SUCCESS ) { + msg << "Error generating eventURL from " << + "|" << URLBase << "|" << + m_eventSubURL << "|."; + AddDebugLogLineM(false, logUPnP, msg); + } else { + m_absEventSubURL = eventURL; + } + + msg << "\n Service:" << + "\n serviceType: " << m_serviceType << + "\n serviceId: " << m_serviceId << + "\n SCPDURL: " << m_SCPDURL << + "\n absSCPDURL: " << m_absSCPDURL << + "\n controlURL: " << m_controlURL << + "\n absControlURL: " << m_absControlURL << + "\n eventSubURL: " << m_eventSubURL << + "\n absEventSubURL: " << m_absEventSubURL; + AddDebugLogLineM(false, logUPnP, msg); + + if (m_serviceType == upnpLib.UPNP_SERVICE_WAN_IP_CONNECTION || + m_serviceType == upnpLib.UPNP_SERVICE_WAN_PPP_CONNECTION) { +#if 0 + m_serviceType == upnpLib.UPNP_SERVICE_WAN_PPP_CONNECTION || + m_serviceType == upnpLib.UPNP_SERVICE_WAN_COMMON_INTERFACE_CONFIG || + m_serviceType == upnpLib.UPNP_SERVICE_LAYER3_FORWARDING) { +#endif +#if 0 +//#warning Delete this code on release. + if (!upnpLib.m_ctrlPoint.WanServiceDetected()) { + // This condition can be used to suspend the parse + // of the XML tree. +#endif +//#warning Delete this code when m_WanService is no longer used. + upnpLib.m_ctrlPoint.SetWanService(this); + // Log it + msg.str(""); + msg << "WAN Service Detected: '" << + m_serviceType << "'."; + AddDebugLogLineM(true, logUPnP, msg); + // Subscribe + upnpLib.m_ctrlPoint.Subscribe(*this); +#if 0 +//#warning Delete this code on release. + } else { + msg.str(""); + msg << "WAN service detected again: '" << + m_serviceType << + "'. Will only use the first instance."; + AddDebugLogLineM(true, logUPnP, msg); + } +#endif + } else { + msg.str(""); + msg << "Uninteresting service detected: '" << + m_serviceType << "'. Ignoring."; + AddDebugLogLineM(true, logUPnP, msg); + } +} + + +CUPnPService::~CUPnPService() +{ +} + + +bool CUPnPService::Execute( + const std::string &ActionName, + const std::vector &ArgValue) const +{ + std::ostringstream msg; + if (m_SCPD.get() == NULL) { + msg << "Service without SCPD Document, cannot execute action '" << ActionName << + "' for service '" << GetServiceType() << "'."; + AddDebugLogLineM(false, logUPnP, msg); + return false; + } + std::ostringstream msgAction("Sending action "); + // Check for correct action name + ActionList::const_iterator itAction = + m_SCPD->GetActionList().find(ActionName); + if (itAction == m_SCPD->GetActionList().end()) { + msg << "Invalid action name '" << ActionName << + "' for service '" << GetServiceType() << "'."; + AddDebugLogLineM(false, logUPnP, msg); + return false; + } + msgAction << ActionName << "("; + bool firstTime = true; + // Check for correct Argument/Value pairs + const CUPnPAction &action = *(itAction->second); + for (unsigned int i = 0; i < ArgValue.size(); ++i) { + ArgumentList::const_iterator itArg = + action.GetArgumentList().find(ArgValue[i].GetArgument()); + if (itArg == action.GetArgumentList().end()) { + msg << "Invalid argument name '" << ArgValue[i].GetArgument() << + "' for action '" << action.GetName() << + "' for service '" << GetServiceType() << "'."; + AddDebugLogLineM(false, logUPnP, msg); + return false; + } + const CUPnPArgument &argument = *(itArg->second); + if (tolower(argument.GetDirection()[0]) != 'i' || + tolower(argument.GetDirection()[1]) != 'n') { + msg << "Invalid direction for argument '" << + ArgValue[i].GetArgument() << + "' for action '" << action.GetName() << + "' for service '" << GetServiceType() << "'."; + AddDebugLogLineM(false, logUPnP, msg); + return false; + } + const std::string relatedStateVariableName = + argument.GetRelatedStateVariable(); + if (!relatedStateVariableName.empty()) { + ServiceStateTable::const_iterator itSVT = + m_SCPD->GetServiceStateTable(). + find(relatedStateVariableName); + if (itSVT == m_SCPD->GetServiceStateTable().end()) { + msg << "Inconsistent Service State Table, did not find '" << + relatedStateVariableName << + "' for argument '" << argument.GetName() << + "' for action '" << action.GetName() << + "' for service '" << GetServiceType() << "'."; + AddDebugLogLineM(false, logUPnP, msg); + return false; + } + const CUPnPStateVariable &stateVariable = *(itSVT->second); + if ( !stateVariable.GetAllowedValueList().empty() && + stateVariable.GetAllowedValueList().find(ArgValue[i].GetValue()) == + stateVariable.GetAllowedValueList().end()) { + msg << "Value not allowed '" << ArgValue[i].GetValue() << + "' for state variable '" << relatedStateVariableName << + "' for argument '" << argument.GetName() << + "' for action '" << action.GetName() << + "' for service '" << GetServiceType() << "'."; + AddDebugLogLineM(false, logUPnP, msg); + return false; + } + } + if (firstTime) { + firstTime = false; + } else { + msgAction << ", "; + } + msgAction << + ArgValue[i].GetArgument() << + "='" << + ArgValue[i].GetValue() << + "'"; + } + msgAction << ")"; + AddDebugLogLineM(false, logUPnP, msgAction); + // Everything is ok, make the action + IXML_Document *ActionDoc = NULL; + if (ArgValue.size()) { + for (unsigned int i = 0; i < ArgValue.size(); ++i) { + int ret = UpnpAddToAction( + &ActionDoc, + action.GetName().c_str(), + GetServiceType().c_str(), + ArgValue[i].GetArgument().c_str(), + ArgValue[i].GetValue().c_str()); + if (ret != UPNP_E_SUCCESS) { + m_upnpLib.processUPnPErrorMessage( + "UpnpAddToAction", ret, NULL, NULL); + return false; + } + } + } else { + ActionDoc = UpnpMakeAction( + action.GetName().c_str(), + GetServiceType().c_str(), + 0, NULL); + if (!ActionDoc) { + msg << "Error: UpnpMakeAction returned NULL."; + AddLogLineM(false, logUPnP, msg); + return false; + } + } +#if 0 + // Send the action asynchronously + UpnpSendActionAsync( + m_UPnPControlPoint.GetUPnPClientHandle(), + GetAbsControlURL().c_str(), + GetServiceType().c_str(), + NULL, ActionDoc, + static_cast(&CUPnPControlPoint::Callback), + NULL); + return true; +#endif + + // Send the action synchronously + IXML_Document *RespDoc = NULL; + int ret = UpnpSendAction( + m_UPnPControlPoint.GetUPnPClientHandle(), + GetAbsControlURL().c_str(), + GetServiceType().c_str(), + NULL, ActionDoc, &RespDoc); + if (ret != UPNP_E_SUCCESS) { + m_upnpLib.processUPnPErrorMessage( + "UpnpSendAction", ret, NULL, RespDoc); + ixmlDocument_free(ActionDoc); + ixmlDocument_free(RespDoc); + return false; + } + ixmlDocument_free(ActionDoc); + + // Check the response document + m_upnpLib.ProcessActionResponse( + RespDoc, action.GetName()); + + // Free the response document + ixmlDocument_free(RespDoc); + + return true; +} + + +const std::string CUPnPService::GetStateVariable( + const std::string &stateVariableName) const +{ + std::ostringstream msg; + DOMString StVarVal; + int ret = UpnpGetServiceVarStatus( + m_UPnPControlPoint.GetUPnPClientHandle(), + GetAbsControlURL().c_str(), + stateVariableName.c_str(), + &StVarVal); + if (ret != UPNP_E_SUCCESS) { + msg << "GetStateVariable(\"" << + stateVariableName << + "\"): in a call to UpnpGetServiceVarStatus"; + m_upnpLib.processUPnPErrorMessage( + msg.str(), ret, StVarVal, NULL); + return stdEmptyString; + } + msg << "GetStateVariable: " << + stateVariableName << + "='" << + StVarVal << + "'."; + AddDebugLogLineM(false, logUPnP, msg); + return stdEmptyString; +} + + +CUPnPDevice::CUPnPDevice( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *device, + const std::string &URLBase) +: +m_UPnPControlPoint(upnpControlPoint), +m_DeviceList(upnpControlPoint, upnpLib, device, URLBase), +m_ServiceList(upnpControlPoint, upnpLib, device, URLBase), +m_deviceType (upnpLib.Element_GetChildValueByTag(device, "deviceType")), +m_friendlyName (upnpLib.Element_GetChildValueByTag(device, "friendlyName")), +m_manufacturer (upnpLib.Element_GetChildValueByTag(device, "manufacturer")), +m_manufacturerURL (upnpLib.Element_GetChildValueByTag(device, "manufacturerURL")), +m_modelDescription (upnpLib.Element_GetChildValueByTag(device, "modelDescription")), +m_modelName (upnpLib.Element_GetChildValueByTag(device, "modelName")), +m_modelNumber (upnpLib.Element_GetChildValueByTag(device, "modelNumber")), +m_modelURL (upnpLib.Element_GetChildValueByTag(device, "modelURL")), +m_serialNumber (upnpLib.Element_GetChildValueByTag(device, "serialNumber")), +m_UDN (upnpLib.Element_GetChildValueByTag(device, "UDN")), +m_UPC (upnpLib.Element_GetChildValueByTag(device, "UPC")), +m_presentationURL (upnpLib.Element_GetChildValueByTag(device, "presentationURL")) +{ + std::ostringstream msg; + int presURLlen = strlen(URLBase.c_str()) + + strlen(m_presentationURL.c_str()) + 2; + std::vector vpresURL(presURLlen); + char* presURL = &vpresURL[0]; + int errcode = UpnpResolveURL( + URLBase.c_str(), + m_presentationURL.c_str(), + presURL); + if (errcode != UPNP_E_SUCCESS) { + msg << "Error generating presentationURL from " << + "|" << URLBase << "|" << + m_presentationURL << "|."; + AddDebugLogLineM(false, logUPnP, msg); + } else { + m_presentationURL = presURL; + } + + msg.str(""); + msg << "\n Device: " << + "\n friendlyName: " << m_friendlyName << + "\n deviceType: " << m_deviceType << + "\n manufacturer: " << m_manufacturer << + "\n manufacturerURL: " << m_manufacturerURL << + "\n modelDescription: " << m_modelDescription << + "\n modelName: " << m_modelName << + "\n modelNumber: " << m_modelNumber << + "\n modelURL: " << m_modelURL << + "\n serialNumber: " << m_serialNumber << + "\n UDN: " << m_UDN << + "\n UPC: " << m_UPC << + "\n presentationURL: " << m_presentationURL; + AddDebugLogLineM(false, logUPnP, msg); +} + + +CUPnPRootDevice::CUPnPRootDevice( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *rootDevice, + const std::string &OriginalURLBase, + const std::string &FixedURLBase, + const char *location, + int expires) +: +CUPnPDevice(upnpControlPoint, upnpLib, rootDevice, FixedURLBase), +m_UPnPControlPoint(upnpControlPoint), +m_URLBase(OriginalURLBase), +m_location(location), +m_expires(expires) +{ + std::ostringstream msg; + msg << + "\n Root Device: " << + "\n URLBase: " << m_URLBase << + "\n Fixed URLBase: " << FixedURLBase << + "\n location: " << m_location << + "\n expires: " << m_expires; + AddDebugLogLineM(false, logUPnP, msg); +} + + +CUPnPControlPoint *CUPnPControlPoint::s_CtrlPoint = NULL; + + +CUPnPControlPoint::CUPnPControlPoint(unsigned short udpPort) +: +m_upnpLib(*this), +m_UPnPClientHandle(), +m_RootDeviceMap(), +m_ServiceMap(), +m_ActivePortMappingsMap(), +m_RootDeviceListMutex(), +m_IGWDeviceDetected(false), +m_WanService(NULL) +{ + // Pointer to self + s_CtrlPoint = this; + // Null string at first + std::ostringstream msg; + + // Start UPnP + int ret; + char *ipAddress = NULL; + unsigned short port = 0; + ret = UpnpInit(ipAddress, udpPort); + if (ret != UPNP_E_SUCCESS) { + msg << "error(UpnpInit): Error code "; + goto error; + } + port = UpnpGetServerPort(); + ipAddress = UpnpGetServerIpAddress(); + msg << "bound to " << ipAddress << ":" << + port << "."; + AddLogLineM(false, logUPnP, msg); + msg.str(""); + ret = UpnpRegisterClient( + static_cast(&CUPnPControlPoint::Callback), + &m_UPnPClientHandle, + &m_UPnPClientHandle); + if (ret != UPNP_E_SUCCESS) { + msg << "error(UpnpRegisterClient): Error registering callback: "; + goto error; + } + + // We could ask for just the right device here. If the root device + // contains the device we want, it will respond with the full XML doc, + // including the root device and every sub-device it has. + // + // But lets find out what we have in our network by calling UPNP_ROOT_DEVICE. + // + // We should not search twice, because this will produce two + // UPNP_DISCOVERY_SEARCH_TIMEOUT events, and we might end with problems + // on the mutex. + ret = UpnpSearchAsync(m_UPnPClientHandle, 3, m_upnpLib.UPNP_ROOT_DEVICE.c_str(), NULL); + //ret = UpnpSearchAsync(m_UPnPClientHandle, 3, m_upnpLib.UPNP_DEVICE_IGW.c_str(), this); + //ret = UpnpSearchAsync(m_UPnPClientHandle, 3, m_upnpLib.UPNP_DEVICE_LAN.c_str(), this); + //ret = UpnpSearchAsync(m_UPnPClientHandle, 3, m_upnpLib.UPNP_DEVICE_WAN_CONNECTION.c_str(), this); + if (ret != UPNP_E_SUCCESS) { + msg << "error(UpnpSearchAsync): Error sending search request: "; + goto error; + } + + // Wait for the UPnP initialization to complete. + { + // Lock the search timeout mutex + m_WaitForSearchTimeoutMutex.Lock(); + + // Lock it again, so that we block. Unlocking will only happen + // when the UPNP_DISCOVERY_SEARCH_TIMEOUT event occurs at the + // callback. + CUPnPMutexLocker lock(m_WaitForSearchTimeoutMutex); + } + return; + + // Error processing +error: + UpnpFinish(); + msg << ret << ": " << m_upnpLib.GetUPnPErrorMessage(ret) << "."; + throw CUPnPException(msg); +} + + +CUPnPControlPoint::~CUPnPControlPoint() +{ + for( RootDeviceMap::iterator it = m_RootDeviceMap.begin(); + it != m_RootDeviceMap.end(); + ++it) { + delete it->second; + } + // Remove all first + // RemoveAll(); + UpnpUnRegisterClient(m_UPnPClientHandle); + UpnpFinish(); +} + + +bool CUPnPControlPoint::AddPortMappings( + std::vector &upnpPortMapping) +{ + std::ostringstream msg; + if (!WanServiceDetected()) { + msg << "UPnP Error: " + "CUPnPControlPoint::AddPortMapping: " + "WAN Service not detected."; + AddLogLineM(true, logUPnP, msg); + return false; + } + + int n = upnpPortMapping.size(); + bool ok = false; + + // Check the number of port mappings before + std::istringstream PortMappingNumberOfEntries( + m_WanService->GetStateVariable( + "PortMappingNumberOfEntries")); + unsigned long oldNumberOfEntries; + PortMappingNumberOfEntries >> oldNumberOfEntries; + + // Add the enabled port mappings + for (int i = 0; i < n; ++i) { + if (upnpPortMapping[i].getEnabled() == "1") { + // Add the mapping to the control point + // active mappings list + m_ActivePortMappingsMap[upnpPortMapping[i].getKey()] = + upnpPortMapping[i]; + + // Add the port mapping + PrivateAddPortMapping(upnpPortMapping[i]); + } + } + + // Test some variables, this is deprecated, might not work + // with some routers + m_WanService->GetStateVariable("ConnectionType"); + m_WanService->GetStateVariable("PossibleConnectionTypes"); + m_WanService->GetStateVariable("ConnectionStatus"); + m_WanService->GetStateVariable("Uptime"); + m_WanService->GetStateVariable("LastConnectionError"); + m_WanService->GetStateVariable("RSIPAvailable"); + m_WanService->GetStateVariable("NATEnabled"); + m_WanService->GetStateVariable("ExternalIPAddress"); + m_WanService->GetStateVariable("PortMappingNumberOfEntries"); + m_WanService->GetStateVariable("PortMappingLeaseDuration"); + + // Just for testing + std::vector argval; + argval.resize(0); + m_WanService->Execute("GetStatusInfo", argval); + +#if 0 + // These do not work. Their value must be requested for a + // specific port mapping. + m_WanService->GetStateVariable("PortMappingEnabled"); + m_WanService->GetStateVariable("RemoteHost"); + m_WanService->GetStateVariable("ExternalPort"); + m_WanService->GetStateVariable("InternalPort"); + m_WanService->GetStateVariable("PortMappingProtocol"); + m_WanService->GetStateVariable("InternalClient"); + m_WanService->GetStateVariable("PortMappingDescription"); +#endif + + // Debug only + msg.str(""); + msg << "CUPnPControlPoint::DeletePortMappings: " + "m_ActivePortMappingsMap.size() == " << + m_ActivePortMappingsMap.size(); + AddDebugLogLineM(false, logUPnP, msg); + + // Not very good, must find a better test + PortMappingNumberOfEntries.str( + m_WanService->GetStateVariable( + "PortMappingNumberOfEntries")); + unsigned long newNumberOfEntries; + PortMappingNumberOfEntries >> newNumberOfEntries; + ok = newNumberOfEntries - oldNumberOfEntries == 4; + + return ok; +} + + +void CUPnPControlPoint::RefreshPortMappings() +{ + for ( PortMappingMap::iterator it = m_ActivePortMappingsMap.begin(); + it != m_ActivePortMappingsMap.end(); + ++it) { + PrivateAddPortMapping(it->second); + } + + // For testing + m_WanService->GetStateVariable("PortMappingNumberOfEntries"); +} + + +bool CUPnPControlPoint::PrivateAddPortMapping( + CUPnPPortMapping &upnpPortMapping) +{ + // Get an IP address. The UPnP server one must do. + std::string ipAddress(UpnpGetServerIpAddress()); + + // Start building the action + std::string actionName("AddPortMapping"); + std::vector argval(8); + + // Action parameters + argval[0].SetArgument("NewRemoteHost"); + argval[0].SetValue(""); + argval[1].SetArgument("NewExternalPort"); + argval[1].SetValue(upnpPortMapping.getPort()); + argval[2].SetArgument("NewProtocol"); + argval[2].SetValue(upnpPortMapping.getProtocol()); + argval[3].SetArgument("NewInternalPort"); + argval[3].SetValue(upnpPortMapping.getPort()); + argval[4].SetArgument("NewInternalClient"); + argval[4].SetValue(ipAddress); + argval[5].SetArgument("NewEnabled"); + argval[5].SetValue("1"); + argval[6].SetArgument("NewPortMappingDescription"); + argval[6].SetValue(upnpPortMapping.getDescription()); + argval[7].SetArgument("NewLeaseDuration"); + argval[7].SetValue("0"); + + // Execute + bool ret = true; + for (ServiceMap::iterator it = m_ServiceMap.begin(); + it != m_ServiceMap.end(); ++it) { + ret &= it->second->Execute(actionName, argval); + } + + return ret; +} + + +bool CUPnPControlPoint::DeletePortMappings( + std::vector &upnpPortMapping) +{ + std::ostringstream msg; + if (!WanServiceDetected()) { + msg << "UPnP Error: " + "CUPnPControlPoint::DeletePortMapping: " + "WAN Service not detected."; + AddLogLineM(true, logUPnP, msg); + return false; + } + + int n = upnpPortMapping.size(); + bool ok = false; + + // Check the number of port mappings before + std::istringstream PortMappingNumberOfEntries( + m_WanService->GetStateVariable( + "PortMappingNumberOfEntries")); + unsigned long oldNumberOfEntries; + PortMappingNumberOfEntries >> oldNumberOfEntries; + + // Delete the enabled port mappings + for (int i = 0; i < n; ++i) { + if (upnpPortMapping[i].getEnabled() == "1") { + // Delete the mapping from the control point + // active mappings list + PortMappingMap::iterator it = + m_ActivePortMappingsMap.find( + upnpPortMapping[i].getKey()); + if (it != m_ActivePortMappingsMap.end()) { + m_ActivePortMappingsMap.erase(it); + } else { + msg << "UPnP Error: " + "CUPnPControlPoint::DeletePortMapping: " + "Mapping was not found in the active " + "mapping map."; + AddLogLineM(true, logUPnP, msg); + } + + // Delete the port mapping + PrivateDeletePortMapping(upnpPortMapping[i]); + } + } + + // Debug only + msg.str(""); + msg << "CUPnPControlPoint::DeletePortMappings: " + "m_ActivePortMappingsMap.size() == " << + m_ActivePortMappingsMap.size(); + AddDebugLogLineM(false, logUPnP, msg); + + // Not very good, must find a better test + PortMappingNumberOfEntries.str( + m_WanService->GetStateVariable( + "PortMappingNumberOfEntries")); + unsigned long newNumberOfEntries; + PortMappingNumberOfEntries >> newNumberOfEntries; + ok = oldNumberOfEntries - newNumberOfEntries == 4; + + return ok; +} + + +bool CUPnPControlPoint::PrivateDeletePortMapping( + CUPnPPortMapping &upnpPortMapping) +{ + // Start building the action + std::string actionName("DeletePortMapping"); + std::vector argval(3); + + // Action parameters + argval[0].SetArgument("NewRemoteHost"); + argval[0].SetValue(""); + argval[1].SetArgument("NewExternalPort"); + argval[1].SetValue(upnpPortMapping.getPort()); + argval[2].SetArgument("NewProtocol"); + argval[2].SetValue(upnpPortMapping.getProtocol()); + + // Execute + bool ret = true; + for (ServiceMap::iterator it = m_ServiceMap.begin(); + it != m_ServiceMap.end(); ++it) { + ret &= it->second->Execute(actionName, argval); + } + + return ret; +} + + +// This function is static +int CUPnPControlPoint::Callback(Upnp_EventType EventType, void *Event, void * /*Cookie*/) +{ + std::ostringstream msg; + std::ostringstream msg2; + // Somehow, this is unreliable. UPNP_DISCOVERY_ADVERTISEMENT_ALIVE events + // happen with a wrong cookie and... boom! + // CUPnPControlPoint *upnpCP = static_cast(Cookie); + CUPnPControlPoint *upnpCP = CUPnPControlPoint::s_CtrlPoint; + + //fprintf(stderr, "Callback: %d, Cookie: %p\n", EventType, Cookie); + switch (EventType) { + case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE: + //fprintf(stderr, "Callback: UPNP_DISCOVERY_ADVERTISEMENT_ALIVE\n"); + msg << "error(UPNP_DISCOVERY_ADVERTISEMENT_ALIVE): "; + msg2<< "UPNP_DISCOVERY_ADVERTISEMENT_ALIVE: "; + goto upnpDiscovery; + case UPNP_DISCOVERY_SEARCH_RESULT: { + //fprintf(stderr, "Callback: UPNP_DISCOVERY_SEARCH_RESULT\n"); + msg << "error(UPNP_DISCOVERY_SEARCH_RESULT): "; + msg2<< "UPNP_DISCOVERY_SEARCH_RESULT: "; + // UPnP Discovery +upnpDiscovery: + struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event; + IXML_Document *doc = NULL; + int ret; + if (d_event->ErrCode != UPNP_E_SUCCESS) { + msg << upnpCP->m_upnpLib.GetUPnPErrorMessage(d_event->ErrCode) << "."; + AddDebugLogLineM(true, logUPnP, msg); + } + // Get the XML tree device description in doc + ret = UpnpDownloadXmlDoc(d_event->Location, &doc); + if (ret != UPNP_E_SUCCESS) { + msg << "Error retrieving device description from " << + d_event->Location << ": " << + upnpCP->m_upnpLib.GetUPnPErrorMessage(ret) << "."; + AddDebugLogLineM(true, logUPnP, msg); + } else { + msg2 << "Retrieving device description from " << + d_event->Location << "."; + AddDebugLogLineM(false, logUPnP, msg2); + } + if (doc) { + // Get the root node + IXML_Element *root = + upnpCP->m_upnpLib.Element_GetRootElement(doc); + // Extract the URLBase + const std::string urlBase = upnpCP->m_upnpLib. + Element_GetChildValueByTag(root, "URLBase"); + // Get the root device + IXML_Element *rootDevice = upnpCP->m_upnpLib. + Element_GetFirstChildByTag(root, "device"); + // Extract the deviceType + std::string devType(upnpCP->m_upnpLib. + Element_GetChildValueByTag(rootDevice, "deviceType")); + // Only add device if it is an InternetGatewayDevice + if (stdStringIsEqualCI(devType, upnpCP->m_upnpLib.UPNP_DEVICE_IGW)) { + // This condition can be used to auto-detect + // the UPnP device we are interested in. + // Obs.: Don't block the entry here on this + // condition! There may be more than one device, + // and the first that enters may not be the one + // we are interested in! + upnpCP->SetIGWDeviceDetected(true); + // Log it if not UPNP_DISCOVERY_ADVERTISEMENT_ALIVE, + // we don't want to spam our logs. + if (EventType != UPNP_DISCOVERY_ADVERTISEMENT_ALIVE) { + msg.str("Internet Gateway Device Detected."); + AddLogLineM(true, logUPnP, msg); + } + // Add the root device to our list + upnpCP->AddRootDevice(rootDevice, urlBase, + d_event->Location, d_event->Expires); + } + // Free the XML doc tree + ixmlDocument_free(doc); + } + break; + } + case UPNP_DISCOVERY_SEARCH_TIMEOUT: { + //fprintf(stderr, "Callback: UPNP_DISCOVERY_SEARCH_TIMEOUT\n"); + // Search timeout + msg << "UPNP_DISCOVERY_SEARCH_TIMEOUT."; + AddDebugLogLineM(false, logUPnP, msg); + + // Unlock the search timeout mutex + upnpCP->m_WaitForSearchTimeoutMutex.Unlock(); + + break; + } + case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: { + //fprintf(stderr, "Callback: UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE\n"); + // UPnP Device Removed + struct Upnp_Discovery *dab_event = (struct Upnp_Discovery *)Event; + if (dab_event->ErrCode != UPNP_E_SUCCESS) { + msg << "error(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE): " << + upnpCP->m_upnpLib.GetUPnPErrorMessage(dab_event->ErrCode) << + "."; + AddDebugLogLineM(true, logUPnP, msg); + } + std::string devType = dab_event->DeviceType; + // Check for an InternetGatewayDevice and removes it from the list + std::transform(devType.begin(), devType.end(), devType.begin(), tolower); + if (stdStringIsEqualCI(devType, upnpCP->m_upnpLib.UPNP_DEVICE_IGW)) { + upnpCP->RemoveRootDevice(dab_event->DeviceId); + } + break; + } + case UPNP_EVENT_RECEIVED: { + //fprintf(stderr, "Callback: UPNP_EVENT_RECEIVED\n"); + // Event reveived + struct Upnp_Event *e_event = (struct Upnp_Event *)Event; + const std::string Sid = e_event->Sid; + // Parses the event + upnpCP->OnEventReceived(Sid, e_event->EventKey, e_event->ChangedVariables); + break; + } + case UPNP_EVENT_SUBSCRIBE_COMPLETE: + //fprintf(stderr, "Callback: UPNP_EVENT_SUBSCRIBE_COMPLETE\n"); + msg << "error(UPNP_EVENT_SUBSCRIBE_COMPLETE): "; + goto upnpEventRenewalComplete; + case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: + //fprintf(stderr, "Callback: UPNP_EVENT_UNSUBSCRIBE_COMPLETE\n"); + msg << "error(UPNP_EVENT_UNSUBSCRIBE_COMPLETE): "; + goto upnpEventRenewalComplete; + case UPNP_EVENT_RENEWAL_COMPLETE: { + //fprintf(stderr, "Callback: UPNP_EVENT_RENEWAL_COMPLETE\n"); + msg << "error(UPNP_EVENT_RENEWAL_COMPLETE): "; +upnpEventRenewalComplete: + struct Upnp_Event_Subscribe *es_event = + (struct Upnp_Event_Subscribe *)Event; + if (es_event->ErrCode != UPNP_E_SUCCESS) { + msg << "Error in Event Subscribe Callback"; + upnpCP->m_upnpLib.processUPnPErrorMessage( + msg.str(), es_event->ErrCode, NULL, NULL); + } else { +#if 0 + TvCtrlPointHandleSubscribeUpdate( + es_event->PublisherUrl, + es_event->Sid, + es_event->TimeOut ); +#endif + } + + break; + } + + case UPNP_EVENT_AUTORENEWAL_FAILED: + //fprintf(stderr, "Callback: UPNP_EVENT_AUTORENEWAL_FAILED\n"); + msg << "error(UPNP_EVENT_AUTORENEWAL_FAILED): "; + msg2 << "UPNP_EVENT_AUTORENEWAL_FAILED: "; + goto upnpEventSubscriptionExpired; + case UPNP_EVENT_SUBSCRIPTION_EXPIRED: { + //fprintf(stderr, "Callback: UPNP_EVENT_SUBSCRIPTION_EXPIRED\n"); + msg << "error(UPNP_EVENT_SUBSCRIPTION_EXPIRED): "; + msg2 << "UPNP_EVENT_SUBSCRIPTION_EXPIRED: "; +upnpEventSubscriptionExpired: + struct Upnp_Event_Subscribe *es_event = + (struct Upnp_Event_Subscribe *)Event; + Upnp_SID newSID; + int TimeOut = 1801; + int ret = UpnpSubscribe( + upnpCP->m_UPnPClientHandle, + es_event->PublisherUrl, + &TimeOut, + newSID); + if (ret != UPNP_E_SUCCESS) { + msg << "Error Subscribing to EventURL"; + upnpCP->m_upnpLib.processUPnPErrorMessage( + msg.str(), es_event->ErrCode, NULL, NULL); + } else { + ServiceMap::iterator it = + upnpCP->m_ServiceMap.find(es_event->PublisherUrl); + if (it != upnpCP->m_ServiceMap.end()) { + CUPnPService &service = *(it->second); + service.SetTimeout(TimeOut); + service.SetSID(newSID); + msg2 << "Re-subscribed to EventURL '" << + es_event->PublisherUrl << + "' with SID == '" << + newSID << "'."; + AddDebugLogLineM(true, logUPnP, msg2); + // In principle, we should test to see if the + // service is the same. But here we only have one + // service, so... + upnpCP->RefreshPortMappings(); + } else { + msg << "Error: did not find service " << + newSID << " in the service map."; + AddDebugLogLineM(true, logUPnP, msg); + } + } + break; + } + case UPNP_CONTROL_ACTION_COMPLETE: { + //fprintf(stderr, "Callback: UPNP_CONTROL_ACTION_COMPLETE\n"); + // This is here if we choose to do this asynchronously + struct Upnp_Action_Complete *a_event = + (struct Upnp_Action_Complete *)Event; + if (a_event->ErrCode != UPNP_E_SUCCESS) { + upnpCP->m_upnpLib.processUPnPErrorMessage( + "UpnpSendActionAsync", + a_event->ErrCode, NULL, + a_event->ActionResult); + } else { + // Check the response document + upnpCP->m_upnpLib.ProcessActionResponse( + a_event->ActionResult, + ""); + } + /* No need for any processing here, just print out results. + * Service state table updates are handled by events. + */ + break; + } + case UPNP_CONTROL_GET_VAR_COMPLETE: { + //fprintf(stderr, "Callback: UPNP_CONTROL_GET_VAR_COMPLETE\n"); + msg << "error(UPNP_CONTROL_GET_VAR_COMPLETE): "; + struct Upnp_State_Var_Complete *sv_event = + (struct Upnp_State_Var_Complete *)Event; + if (sv_event->ErrCode != UPNP_E_SUCCESS) { + msg << "m_UpnpGetServiceVarStatusAsync"; + upnpCP->m_upnpLib.processUPnPErrorMessage( + msg.str(), sv_event->ErrCode, NULL, NULL); + } else { +#if 0 + // Warning: The use of UpnpGetServiceVarStatus and + // UpnpGetServiceVarStatusAsync is deprecated by the + // UPnP forum. + TvCtrlPointHandleGetVar( + sv_event->CtrlUrl, + sv_event->StateVarName, + sv_event->CurrentVal ); +#endif + } + break; + } + // ignore these cases, since this is not a device + case UPNP_CONTROL_GET_VAR_REQUEST: + //fprintf(stderr, "Callback: UPNP_CONTROL_GET_VAR_REQUEST\n"); + msg << "error(UPNP_CONTROL_GET_VAR_REQUEST): "; + goto eventSubscriptionRequest; + case UPNP_CONTROL_ACTION_REQUEST: + //fprintf(stderr, "Callback: UPNP_CONTROL_ACTION_REQUEST\n"); + msg << "error(UPNP_CONTROL_ACTION_REQUEST): "; + goto eventSubscriptionRequest; + case UPNP_EVENT_SUBSCRIPTION_REQUEST: + //fprintf(stderr, "Callback: UPNP_EVENT_SUBSCRIPTION_REQUEST\n"); + msg << "error(UPNP_EVENT_SUBSCRIPTION_REQUEST): "; +eventSubscriptionRequest: + msg << "This is not a UPnP Device, this is a UPnP Control Point, event ignored."; + AddDebugLogLineM(true, logUPnP, msg); + break; + default: + // Humm, this is not good, we forgot to handle something... + fprintf(stderr, + "Callback: default... Unknown event:'%d', not good.\n", + EventType); + msg << "error(UPnP::Callback): Event not handled:'" << + EventType << "'."; + fprintf(stderr, "%s\n", msg.str().c_str()); + AddDebugLogLineM(true, logUPnP, msg); + // Better not throw in the callback. Who would catch it? + //throw CUPnPException(msg); + break; + } + + return 0; +} + + +void CUPnPControlPoint::OnEventReceived( + const std::string &Sid, + int EventKey, + IXML_Document *ChangedVariablesDoc) +{ + std::ostringstream msg; + msg << "UPNP_EVENT_RECEIVED:" << + "\n SID: " << Sid << + "\n Key: " << EventKey << + "\n Property list:"; + IXML_Element *root = + m_upnpLib.Element_GetRootElement(ChangedVariablesDoc); + IXML_Element *child = + m_upnpLib.Element_GetFirstChild(root); + if (child) { + while (child) { + IXML_Element *child2 = + m_upnpLib.Element_GetFirstChild(child); + const DOMString childTag = + m_upnpLib.Element_GetTag(child2); + std::string childValue = + m_upnpLib.Element_GetTextValue(child2); + msg << "\n " << + childTag << "='" << + childValue << "'"; + child = m_upnpLib.Element_GetNextSibling(child); + } + } else { + msg << "\n Empty property list."; + } + AddDebugLogLineM(true, logUPnP, msg); + // Freeing that doc segfaults. Probably should not be freed. + //ixmlDocument_free(ChangedVariablesDoc); +} + + +void CUPnPControlPoint::AddRootDevice( + IXML_Element *rootDevice, const std::string &urlBase, + const char *location, int expires) +{ + // Lock the Root Device List + CUPnPMutexLocker lock(m_RootDeviceListMutex); + + // Root node's URLBase + std::string OriginalURLBase(urlBase); + std::string FixedURLBase(OriginalURLBase.empty() ? + location : + OriginalURLBase); + + // Get the UDN (Unique Device Name) + std::string UDN( + m_upnpLib.Element_GetChildValueByTag(rootDevice, "UDN")); + RootDeviceMap::iterator it = m_RootDeviceMap.find(UDN); + bool alreadyAdded = it != m_RootDeviceMap.end(); + if (alreadyAdded) { + // Just set the expires field + it->second->SetExpires(expires); + } else { + // Add a new root device to the root device list + CUPnPRootDevice *upnpRootDevice = new CUPnPRootDevice( + *this, m_upnpLib, rootDevice, + OriginalURLBase, FixedURLBase, + location, expires); + m_RootDeviceMap[upnpRootDevice->GetUDN()] = upnpRootDevice; + } +} + + +void CUPnPControlPoint::RemoveRootDevice(const char *udn) +{ + // Lock the Root Device List + CUPnPMutexLocker lock(m_RootDeviceListMutex); + + // Remove + std::string UDN(udn); + RootDeviceMap::iterator it = m_RootDeviceMap.find(UDN); + if (it != m_RootDeviceMap.end()) { + delete it->second; + m_RootDeviceMap.erase(UDN); + } +} + + +void CUPnPControlPoint::Subscribe(CUPnPService &service) +{ + std::ostringstream msg; + + IXML_Document *scpdDoc = NULL; + int errcode = UpnpDownloadXmlDoc( + service.GetAbsSCPDURL().c_str(), &scpdDoc); + if (errcode == UPNP_E_SUCCESS) { + // Get the root node of this service (the SCPD Document) + IXML_Element *scpdRoot = + m_upnpLib.Element_GetRootElement(scpdDoc); + CUPnPSCPD *scpd = new CUPnPSCPD(*this, m_upnpLib, + scpdRoot, service.GetAbsSCPDURL()); + service.SetSCPD(scpd); + m_ServiceMap[service.GetAbsEventSubURL()] = &service; + msg << "Successfully retrieved SCPD Document for service " << + service.GetServiceType() << ", absEventSubURL: " << + service.GetAbsEventSubURL() << "."; + AddLogLineM(true, logUPnP, msg); + msg.str(""); + + // Now try to subscribe to this service. If the subscription + // is not successfull, we will not be notified about events, + // but it may be possible to use the service anyway. + errcode = UpnpSubscribe(m_UPnPClientHandle, + service.GetAbsEventSubURL().c_str(), + service.GetTimeoutAddr(), + service.GetSID()); + if (errcode == UPNP_E_SUCCESS) { + msg << "Successfully subscribed to service " << + service.GetServiceType() << ", absEventSubURL: " << + service.GetAbsEventSubURL() << "."; + AddLogLineM(true, logUPnP, msg); + } else { + msg << "Error subscribing to service " << + service.GetServiceType() << ", absEventSubURL: " << + service.GetAbsEventSubURL() << ", error: " << + m_upnpLib.GetUPnPErrorMessage(errcode) << "."; + goto error; + } + } else { + msg << "Error getting SCPD Document from " << + service.GetAbsSCPDURL() << "."; + AddLogLineM(true, logUPnP, msg); + } + + return; + + // Error processing +error: + AddLogLineM(true, logUPnP, msg); +} + + +void CUPnPControlPoint::Unsubscribe(CUPnPService &service) +{ + ServiceMap::iterator it = m_ServiceMap.find(service.GetAbsEventSubURL()); + if (it != m_ServiceMap.end()) { + m_ServiceMap.erase(it); + UpnpUnSubscribe(m_UPnPClientHandle, service.GetSID()); + } +} + + +// File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/UPnPBase.h amule-2.2.2/src/UPnPBase.h --- amule-2.2.0~svn20080218/src/UPnPBase.h 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/src/UPnPBase.h 2008-07-13 03:36:09.000000000 +0000 @@ -0,0 +1,620 @@ +// +// This file is part of the aMule Project. +// +// Copyright (c) 2004-2008 Marcelo Roberto Jimenez ( phoenix@amule.org ) +// Copyright (c) 2006-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + + +// This define must not conflict with the one in the standard header +#ifndef AMULE_UPNP_H +#define AMULE_UPNP_H + + +#include +#include +#include +#include + +#include "UPnPCompatibility.h" + + +#ifdef UPNP_C + std::string stdEmptyString; +#else // UPNP_C + extern std::string stdEmptyString; +#endif // UPNP_C + + +/** + * Case insensitive std::string comparison + */ +bool stdStringIsEqualCI( + const std::string &s1, + const std::string &s2); + + +class CUPnPPortMapping +{ +private: + std::string m_port; + std::string m_protocol; + std::string m_enabled; + std::string m_description; + std::string m_key; + +public: + CUPnPPortMapping( + int port = 0, + const std::string &protocol = stdEmptyString, + bool enabled = false, + const std::string &description = stdEmptyString); + ~CUPnPPortMapping() {} + + const std::string &getPort() const + { return m_port; } + const std::string &getProtocol() const + { return m_protocol; } + const std::string &getEnabled() const + { return m_enabled; } + const std::string &getDescription() const + { return m_description; } + const std::string &getKey() const + { return m_key; } +}; + + +class CUPnPControlPoint; + + +class CUPnPLib +{ +public: + static const std::string &UPNP_ROOT_DEVICE; + static const std::string &UPNP_DEVICE_IGW; + static const std::string &UPNP_DEVICE_WAN; + static const std::string &UPNP_DEVICE_WAN_CONNECTION; + static const std::string &UPNP_DEVICE_LAN; + static const std::string &UPNP_SERVICE_LAYER3_FORWARDING; + static const std::string &UPNP_SERVICE_WAN_COMMON_INTERFACE_CONFIG; + static const std::string &UPNP_SERVICE_WAN_IP_CONNECTION; + static const std::string &UPNP_SERVICE_WAN_PPP_CONNECTION; + CUPnPControlPoint &m_ctrlPoint; + +public: + CUPnPLib(CUPnPControlPoint &ctrlPoint); + ~CUPnPLib() {} + + // Convenience function so we don't have to write explicit calls + // to char2unicode every time + std::string GetUPnPErrorMessage(int code) const; + + // Convenience function to avoid repetitive processing of error + // messages + std::string processUPnPErrorMessage( + const std::string &messsage, + int code, + const DOMString errorString, + IXML_Document *doc) const; + + // Processing response to actions + void ProcessActionResponse( + IXML_Document *RespDoc, + const std::string &actionName) const; + + // IXML_Element + IXML_Element *Element_GetRootElement( + IXML_Document *doc) const; + IXML_Element *Element_GetFirstChild( + IXML_Element *parent) const; + IXML_Element *Element_GetNextSibling( + IXML_Element *child) const; + const DOMString Element_GetTag( + IXML_Element *element) const; + const std::string Element_GetTextValue( + IXML_Element *element) const; + const std::string Element_GetChildValueByTag( + IXML_Element *element, + const DOMString tag) const; + IXML_Element *Element_GetFirstChildByTag( + IXML_Element *element, + const DOMString tag) const; + IXML_Element *Element_GetNextSiblingByTag( + IXML_Element *element, + const DOMString tag) const; + const std::string Element_GetAttributeByTag( + IXML_Element *element, + const DOMString tag) const; +}; + + +class CUPnPControlPoint; + +/* + * Even though we can retrieve the upnpLib handler from the upnpControlPoint, + * we must pass it separetly at this point, because the class CUPnPControlPoint + * must be declared after. + * + * CUPnPLib can only be removed from the constructor once we agree to link to + * UPnPLib explicitly, making this dlopen() stuff unnecessary. + */ +template +class CXML_List : public std::map +{ +public: + CXML_List( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *parent, + const std::string &url); + ~CXML_List(); +}; + + +template +CXML_List::CXML_List( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *parent, + const std::string &url) +{ + IXML_Element *elementList = + upnpLib.Element_GetFirstChildByTag(parent, XML_LIST_NAME); + unsigned int i = 0; + for ( IXML_Element *element = upnpLib.Element_GetFirstChildByTag(elementList, XML_ELEMENT_NAME); + element; + element = upnpLib.Element_GetNextSiblingByTag(element, XML_ELEMENT_NAME)) { + // Add a new element to the element list + T *upnpElement = new T(upnpControlPoint, upnpLib, element, url); + (*this)[upnpElement->GetKey()] = upnpElement; + ++i; + } + std::ostringstream msg; + msg << "\n " << XML_LIST_NAME << ": " << + i << " " << XML_ELEMENT_NAME << "s."; + AddDebugLogLineM(false, logUPnP, msg); +} + + +template +CXML_List::~CXML_List() +{ + typename CXML_List::iterator it; + for(it = this->begin(); it != this->end(); ++it) { + delete (*it).second; + } +} + +#ifdef UPNP_C + char s_argument[] = "argument"; + char s_argumentList[] = "argumentList"; + char s_action[] = "action"; + char s_actionList[] = "actionList"; + char s_allowedValue[] = "allowedValue"; + char s_allowedValueList[] = "allowedValueList"; + char s_stateVariable[] = "stateVariable"; + char s_serviceStateTable[] = "serviceStateTable"; + char s_service[] = "service"; + char s_serviceList[] = "serviceList"; + char s_device[] = "device"; + char s_deviceList[] = "deviceList"; +#else // UPNP_C + extern char s_argument[]; + extern char s_argumentList[]; + extern char s_action[]; + extern char s_actionList[]; + extern char s_allowedValue[]; + extern char s_allowedValueList[]; + extern char s_stateVariable[]; + extern char s_serviceStateTable[]; + extern char s_service[]; + extern char s_serviceList[]; + extern char s_device[]; + extern char s_deviceList[]; +#endif // UPNP_C + + +class CUPnPArgument; +typedef CXML_List ArgumentList; +class CUPnPAction; +typedef CXML_List ActionList; +class CUPnPStateVariable; +typedef CXML_List ServiceStateTable; +class CUPnPAllowedValue; +typedef CXML_List AllowedValueList; +class CUPnPService; +typedef CXML_List ServiceList; +class CUPnPDevice; +typedef CXML_List DeviceList; + + +class CUPnPError +{ +private: + IXML_Element *m_root; + const std::string m_ErrorCode; + const std::string m_ErrorDescription; +public: + CUPnPError( + const CUPnPLib &upnpLib, + IXML_Document *errorDoc); + ~CUPnPError() {} + const std::string &getErrorCode() const + { return m_ErrorCode; } + const std::string &getErrorDescription() const + { return m_ErrorDescription; } +}; + + +class CUPnPArgument +{ +private: + const CUPnPControlPoint &m_UPnPControlPoint; + const std::string m_name; + const std::string m_direction; + bool m_retval; + const std::string m_relatedStateVariable; + +public: + CUPnPArgument( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *argument, + const std::string &SCPDURL); + ~CUPnPArgument() {} + const std::string &GetName() const + { return m_name; } + const std::string &GetDirection() const + { return m_direction; } + bool GetRetVal() const + { return m_retval; } + const std::string &GetRelatedStateVariable() const + { return m_relatedStateVariable; } + const std::string &GetKey() const + { return m_name; } +}; + + + +class CUPnPAction +{ +private: + const CUPnPControlPoint &m_UPnPControlPoint; + ArgumentList m_ArgumentList; + const std::string m_name; + +public: + CUPnPAction( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *action, + const std::string &SCPDURL); + ~CUPnPAction() {} + const std::string &GetName() const + { return m_name; } + const std::string &GetKey() const + { return m_name; } + const ArgumentList &GetArgumentList() const + { return m_ArgumentList; } +}; + + +class CUPnPAllowedValue +{ +private: + const CUPnPControlPoint &m_UPnPControlPoint; + const std::string m_allowedValue; + +public: + CUPnPAllowedValue( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *allowedValue, + const std::string &SCPDURL); + ~CUPnPAllowedValue() {} + const std::string &GetAllowedValue() const + { return m_allowedValue; } + const std::string &GetKey() const + { return m_allowedValue; } +}; + + +class CUPnPStateVariable +{ +private: + const CUPnPControlPoint &m_UPnPControlPoint; + AllowedValueList m_AllowedValueList; + const std::string m_name; + const std::string m_dataType; + const std::string m_defaultValue; + const std::string m_sendEvents; + +public: + CUPnPStateVariable( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *stateVariable, + const std::string &URLBase); + ~CUPnPStateVariable() {} + const std::string &GetNname() const + { return m_name; } + const std::string &GetDataType() const + { return m_dataType; } + const std::string &GetDefaultValue() const + { return m_defaultValue; } + const std::string &GetKey() const + { return m_name; } + const AllowedValueList &GetAllowedValueList() const + { return m_AllowedValueList; } +}; + + +class CUPnPSCPD +{ +private: + const CUPnPControlPoint &m_UPnPControlPoint; + ActionList m_ActionList; + ServiceStateTable m_ServiceStateTable; + const std::string m_SCPDURL; + +public: + CUPnPSCPD( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *scpd, + const std::string &SCPDURL); + ~CUPnPSCPD() {} + const ActionList &GetActionList() const + { return m_ActionList; } + const ServiceStateTable &GetServiceStateTable() const + { return m_ServiceStateTable; } +}; + + +class CUPnPArgumentValue +{ +private: + std::string m_argument; + std::string m_value; + +public: + CUPnPArgumentValue(); + CUPnPArgumentValue(const std::string &argument, const std::string &value); + ~CUPnPArgumentValue() {} + + const std::string &GetArgument() const { return m_argument; } + const std::string &GetValue() const { return m_value; } + const std::string &SetArgument(const std::string& argument) { return m_argument = argument; } + const std::string &SetValue(const std::string &value) { return m_value = value; } +}; + + +class CUPnPService +{ +private: + const CUPnPControlPoint &m_UPnPControlPoint; + CUPnPLib &m_upnpLib; + const std::string m_serviceType; + const std::string m_serviceId; + const std::string m_SCPDURL; + const std::string m_controlURL; + const std::string m_eventSubURL; + std::string m_absSCPDURL; + std::string m_absControlURL; + std::string m_absEventSubURL; + int m_timeout; + Upnp_SID m_SID; + std::auto_ptr m_SCPD; + +public: + CUPnPService( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *service, + const std::string &URLBase); + ~CUPnPService(); + + const std::string &GetServiceType() const + { return m_serviceType; } + const std::string &GetServiceId() const + { return m_serviceId; } + const std::string &GetSCPDURL() const + { return m_SCPDURL; } + const std::string &GetAbsSCPDURL() const + { return m_absSCPDURL; } + const std::string &GetControlURL() const + { return m_controlURL; } + const std::string &GetEventSubURL() const + { return m_eventSubURL; } + const std::string &GetAbsControlURL() const + { return m_absControlURL; } + const std::string &GetAbsEventSubURL() const + { return m_absEventSubURL; } + int GetTimeout() const + { return m_timeout; } + void SetTimeout(int t) + { m_timeout = t; } + int *GetTimeoutAddr() + { return &m_timeout; } + char *GetSID() + { return m_SID; } + void SetSID(const char *s) + { memcpy(m_SID, s, sizeof(Upnp_SID)); } + const std::string &GetKey() const + { return m_serviceId; } + bool IsSubscribed() const + { return m_SCPD.get() != NULL; } + void SetSCPD(CUPnPSCPD *SCPD) + { m_SCPD.reset(SCPD); } + + bool Execute( + const std::string &ActionName, + const std::vector &ArgValue) const; + const std::string GetStateVariable( + const std::string &stateVariableName) const; +}; + + +class CUPnPDevice +{ +private: + const CUPnPControlPoint &m_UPnPControlPoint; + + // Please, lock these lists before use + DeviceList m_DeviceList; + ServiceList m_ServiceList; + + const std::string m_deviceType; + const std::string m_friendlyName; + const std::string m_manufacturer; + const std::string m_manufacturerURL; + const std::string m_modelDescription; + const std::string m_modelName; + const std::string m_modelNumber; + const std::string m_modelURL; + const std::string m_serialNumber; + const std::string m_UDN; + const std::string m_UPC; + std::string m_presentationURL; + +public: + CUPnPDevice( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *device, + const std::string &URLBase); + ~CUPnPDevice() {} + + const std::string &GetUDN() const + { return m_UDN; } + const std::string &GetDeviceType() const + { return m_deviceType; } + const std::string &GetFriendlyName() const + { return m_friendlyName; } + const std::string &GetPresentationURL() const + { return m_presentationURL; } + const std::string &GetKey() const + { return m_UDN; } +}; + + +class CUPnPRootDevice : public CUPnPDevice +{ +private: + const CUPnPControlPoint &m_UPnPControlPoint; + const std::string m_URLBase; + const std::string m_location; + int m_expires; + +public: + CUPnPRootDevice( + const CUPnPControlPoint &upnpControlPoint, + CUPnPLib &upnpLib, + IXML_Element *rootDevice, + const std::string &OriginalURLBase, + const std::string &FixedURLBase, + const char *location, + int expires); + ~CUPnPRootDevice() {} + + const std::string &GetURLBase() const + { return m_URLBase; } + const std::string &GetLocation() const + { return m_location; } + int GetExpires() const + { return m_expires; } + void SetExpires(int expires) + { m_expires = expires; } +}; + + +typedef std::map RootDeviceMap; +typedef std::map ServiceMap; +typedef std::map PortMappingMap; + + +class CUPnPControlPoint +{ +private: + static CUPnPControlPoint *s_CtrlPoint; + // upnp stuff + CUPnPLib m_upnpLib; + UpnpClient_Handle m_UPnPClientHandle; + RootDeviceMap m_RootDeviceMap; + ServiceMap m_ServiceMap; + PortMappingMap m_ActivePortMappingsMap; + CUPnPMutex m_RootDeviceListMutex; + bool m_IGWDeviceDetected; +//#warning This variable is for testing purposes only and should disappear on release. + CUPnPService *m_WanService; + CUPnPMutex m_WaitForSearchTimeoutMutex; + +public: + CUPnPControlPoint(unsigned short udpPort); + ~CUPnPControlPoint(); + void Subscribe(CUPnPService &service); + void Unsubscribe(CUPnPService &service); + bool AddPortMappings( + std::vector &upnpPortMapping); + bool DeletePortMappings( + std::vector &upnpPortMapping); + + UpnpClient_Handle GetUPnPClientHandle() const + { return m_UPnPClientHandle; } + + bool GetIGWDeviceDetected() const + { return m_IGWDeviceDetected; } + void SetIGWDeviceDetected(bool b) + { m_IGWDeviceDetected = b; } + bool WanServiceDetected() const + { return !m_ServiceMap.empty(); } + void SetWanService(CUPnPService *service) + { m_WanService = service; } + + // Callback function + static int Callback( + Upnp_EventType EventType, + void* Event, + void* Cookie); + +private: + void OnEventReceived( + const std::string &Sid, + int EventKey, + IXML_Document *ChangedVariables); + void AddRootDevice( + IXML_Element *rootDevice, + const std::string &urlBase, + const char *location, + int expires); + void RemoveRootDevice( + const char *udn); + void RefreshPortMappings(); + bool PrivateAddPortMapping( + CUPnPPortMapping &upnpPortMapping); + bool PrivateDeletePortMapping( + CUPnPPortMapping &upnpPortMapping); +}; + + +#endif /* AMULE_UPNP_H */ + +// File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/UPnPCompatibility.h amule-2.2.2/src/UPnPCompatibility.h --- amule-2.2.0~svn20080218/src/UPnPCompatibility.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/UPnPCompatibility.h 2008-07-13 03:36:09.000000000 +0000 @@ -27,7 +27,9 @@ #ifndef UPNPCOMPATIBILITY_H #define UPNPCOMPATIBILITY_H -#include "extern/upnp/upnp.h" + +#include "upnp.h" +#include "upnptools.h" #include diff -ruN -d amule-2.2.0~svn20080218/src/UploadBandwidthThrottler.cpp amule-2.2.2/src/UploadBandwidthThrottler.cpp --- amule-2.2.0~svn20080218/src/UploadBandwidthThrottler.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/UploadBandwidthThrottler.cpp 2008-04-04 14:13:04.000000000 +0000 @@ -175,7 +175,7 @@ */ bool UploadBandwidthThrottler::RemoveFromStandardListNoLock(ThrottledFileSocket* socket) { - return EraseFirstValue( m_StandardOrder_list, socket ); + return (EraseFirstValue( m_StandardOrder_list, socket ) > 0); } diff -ruN -d amule-2.2.0~svn20080218/src/UploadClient.cpp amule-2.2.2/src/UploadClient.cpp --- amule-2.2.0~svn20080218/src/UploadClient.cpp 2008-02-17 19:45:01.000000000 +0000 +++ amule-2.2.2/src/UploadClient.cpp 2008-04-04 14:13:04.000000000 +0000 @@ -319,7 +319,7 @@ AddDebugLogLineM(false, logClient, wxT("Client '") + GetUserName() + wxT("' caused error while creating packet (") + error + wxT(") - disconnecting client")); } catch (const CIOFailureException& error) { AddDebugLogLineM(true, logClient, wxT("IO failure while reading requested file: ") + error.what()); - } catch (const CEOFException& error) { + } catch (const CEOFException& WXUNUSED(error)) { AddDebugLogLineM(true, logClient, GetClientFullInfo() + wxT(" requested file-data at an invalid position - disconnecting")); } diff -ruN -d amule-2.2.0~svn20080218/src/UserEvents.h amule-2.2.2/src/UserEvents.h --- amule-2.2.0~svn20080218/src/UserEvents.h 2008-01-29 17:55:00.000000000 +0000 +++ amule-2.2.2/src/UserEvents.h 2008-06-07 16:30:13.000000000 +0000 @@ -68,7 +68,7 @@ ((CPartFile*)object)->GetFileName().GetRaw() ) \ USEREVENTS_REPLACE_VAR( \ wxT("HASH"), \ - wxTRANSLATE("The ed2k hash of the file."), \ + wxTRANSLATE("The eD2k hash of the file."), \ ((CPartFile*)object)->GetFileHash().Encode() ) \ USEREVENTS_REPLACE_VAR( \ wxT("SIZE"), \ diff -ruN -d amule-2.2.0~svn20080218/src/amule-gui.cpp amule-2.2.2/src/amule-gui.cpp --- amule-2.2.0~svn20080218/src/amule-gui.cpp 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/amule-gui.cpp 2008-05-23 23:11:22.000000000 +0000 @@ -86,6 +86,9 @@ // HTTPDownload finished EVT_MULE_INTERNAL(wxEVT_CORE_FINISHED_HTTP_DOWNLOAD, -1, CamuleGuiApp::OnFinishedHTTPDownload) + + // Disk space preallocation finished + EVT_MULE_ALLOC_FINISHED(CamuleGuiApp::OnFinishedAllocation) END_EVENT_TABLE() @@ -212,7 +215,7 @@ { bool ClipBoardOpen = wxTheClipboard->Open(); if (ClipBoardOpen) { - wxTheClipboard->UsePrimarySelection(TRUE); + wxTheClipboard->UsePrimarySelection(false); wxTheClipboard->SetData(new wxTextDataObject(strText)); wxTheClipboard->Close(); } diff -ruN -d amule-2.2.0~svn20080218/src/amule-remote-gui.cpp amule-2.2.2/src/amule-remote-gui.cpp --- amule-2.2.0~svn20080218/src/amule-remote-gui.cpp 2008-02-12 19:28:43.000000000 +0000 +++ amule-2.2.2/src/amule-remote-gui.cpp 2008-06-07 16:30:13.000000000 +0000 @@ -64,7 +64,8 @@ #include "SharedFilesWnd.h" // Needed for CSharedFilesWnd #include "TransferWnd.h" // Needed for CTransferWnd #include "updownclient.h" -#include "ServerListCtrl.h" +#include "ServerListCtrl.h" // Needed for CServerListCtrl +#include "MagnetURI.h" // Needed for CMagnetURI CEConnectDlg::CEConnectDlg() @@ -285,7 +286,7 @@ if (!m_connect->ConnectToCore(dialog->Host(), dialog->Port(), dialog->Login(), dialog->PassHash(), wxT("amule-remote"), wxT("0x0001"))) { - wxMessageBox(_("Connection failed "),_("Error"),wxOK); + wxMessageBox(_("Connection failed "),_("ERROR"),wxOK); return false; } @@ -336,6 +337,7 @@ dialog->Destroy(); m_ConnState = 0; + m_clientID = 0; serverconnect = new CServerConnectRem(m_connect); m_statistics = new CStatistics(*m_connect); @@ -360,10 +362,7 @@ wxT("Displays the current version number.")); cmdline.AddSwitch(wxT("h"), wxT("help"), wxT("Displays this information.")); - cmdline.AddOption(wxT("geometry"), wxEmptyString, wxT( - "Sets the geometry of the app.\n" - "\t\t\t uses the same format as standard X11 apps:\n" - "\t\t\t[=][{xX}][{+-}{+-}]")); + cmdline.AddOption(wxT("geometry"), wxEmptyString, wxT("Sets the geometry of the app.\n\t\t\t uses the same format as standard X11 apps:\n\t\t\t[=][{xX}][{+-}{+-}]")); cmdline.Parse(); bool geometry_enabled = false; @@ -424,22 +423,79 @@ } -// -// Remote gui can't create links by itself. Pass request or retrieve from container ? -// -wxString CamuleRemoteGuiApp::CreateMagnetLink(const CAbstractFile *) +wxString CamuleRemoteGuiApp::CreateMagnetLink(const CAbstractFile* f) { - return wxEmptyString; + // TODO: Remove duplicate code (also in amule.cpp) ... + CMagnetURI uri; + + uri.AddField(wxT("dn"), f->GetFileName().Cleanup(false).GetPrintable()); + uri.AddField(wxT("xt"), wxString(wxT("urn:ed2k:")) + f->GetFileHash().Encode().Lower()); + uri.AddField(wxT("xl"), wxString::Format(wxT("%") wxLongLongFmtSpec wxT("u"), f->GetFileSize())); + + return uri.GetLink(); } -wxString CamuleRemoteGuiApp::CreateED2kLink(CAbstractFile const*, bool, bool, bool) +wxString CamuleRemoteGuiApp::CreateED2kLink(const CAbstractFile* f, bool add_source, bool use_hostname, bool addcryptoptions) { - return wxEmptyString; + // TODO: Avoid duplicate code (also in amule.cpp) ... + wxASSERT(!(!add_source && (use_hostname || addcryptoptions))); + // Construct URL like this: ed2k://|file||||/ + wxString strURL = CFormat(wxT("ed2k://|file|%s|%i|%s|/")) + % f->GetFileName().Cleanup(false) + % f->GetFileSize() % f->GetFileHash().Encode(); + + if (add_source && IsConnected() && !IsFirewalled()) { + // Create the first part of the URL + strURL << wxT("|sources,"); + + if (use_hostname) { + strURL << thePrefs::GetYourHostname(); + } else { + uint32 clientID = GetID(); + strURL << (uint8) clientID << wxT(".") << + (uint8)(clientID >> 8) << wxT(".") << + (uint8)(clientID >> 16) << wxT(".") << + (uint8)(clientID >> 24); + } + + strURL << wxT(":") << + thePrefs::GetPort(); + + if (addcryptoptions) { + const uint8 uSupportsCryptLayer = thePrefs::IsClientCryptLayerSupported() ? 1 : 0; + const uint8 uRequestsCryptLayer = thePrefs::IsClientCryptLayerRequested() ? 1 : 0; + const uint8 uRequiresCryptLayer = thePrefs::IsClientCryptLayerRequired() ? 1 : 0; + const uint8 byCryptOptions = (uRequiresCryptLayer << 2) | (uRequestsCryptLayer << 1) | (uSupportsCryptLayer << 0) | (uSupportsCryptLayer ? 0x80 : 0x00); + + strURL << wxT(":") << byCryptOptions; + + if (byCryptOptions & 0x80) { + strURL << wxT(":") << thePrefs::GetUserHash().Encode(); + } + + } + strURL << wxT("|/"); + } else if (add_source) { + AddLogLineM(true, _("WARNING: You can't add yourself as a source for an eD2k link while having a lowid.")); + } + + // Result is "ed2k://|file||||/|sources,[(|):[:cryptoptions[:hash]]]|/" + return strURL; } -wxString CamuleRemoteGuiApp::CreateED2kAICHLink(CKnownFile const *) + +wxString CamuleRemoteGuiApp::CreateED2kAICHLink(const CKnownFile* f) { - return wxEmptyString; + // TODO: Avoid duplicate code (also in amule.cpp) ... + // Create the first part of the URL + wxString strURL = CreateED2kLink(f); + // Append the AICH info + if (f->HasProperAICHHashSet()) { + strURL << wxT("|h=") << f->GetAICHMasterHash() << wxT("|/"); + } + + // Result is "ed2k://|file||||/|h=|/" + return strURL; } @@ -450,6 +506,16 @@ } +bool CamuleRemoteGuiApp::IsFirewalled() const +{ + if (IsConnectedED2K() && !serverconnect->IsLowID()) { + return false; + } + + return IsFirewalledKad(); +} + + bool CamuleRemoteGuiApp::IsConnectedED2K() const { return serverconnect && serverconnect->IsConnected(); } @@ -465,6 +531,25 @@ } +void CamuleRemoteGuiApp::BootstrapKad(uint32 ip, uint16 port) +{ + CECPacket req(EC_OP_KAD_BOOTSTRAP_FROM_IP); + req.AddTag(CECTag(EC_TAG_BOOTSTRAP_IP, ip)); + req.AddTag(CECTag(EC_TAG_BOOTSTRAP_PORT, port)); + + m_connect->SendPacket(&req); +} + + +void CamuleRemoteGuiApp::UpdateNotesDat(const wxString& url) +{ + CECPacket req(EC_OP_KAD_UPDATE_FROM_URL); + req.AddTag(CECTag(EC_TAG_KADEMLIA_UPDATE_URL, url)); + + m_connect->SendPacket(&req); +} + + void CamuleRemoteGuiApp::DisconnectED2K() { if (IsConnectedED2K()) { m_connect->DisconnectED2K(); @@ -472,11 +557,18 @@ } -uint32 CamuleRemoteGuiApp::GetED2KID() const { +uint32 CamuleRemoteGuiApp::GetED2KID() const +{ return serverconnect ? serverconnect->GetClientID() : 0; } +uint32 CamuleRemoteGuiApp::GetID() const +{ + return m_clientID; +} + + void CamuleRemoteGuiApp::ShowUserCount() { wxString buffer = CFormat(_("Users: E: %s K: %s | Files E: %s K: %s")) % CastItoIShort(theStats::GetED2KUsers()) % @@ -512,7 +604,8 @@ EC_PREFS_SRCDROP | EC_PREFS_SECURITY | EC_PREFS_CORETWEAKS | - EC_PREFS_REMOTECONTROLS; + EC_PREFS_REMOTECONTROLS | + EC_PREFS_KADEMLIA; m_exchange_recv_selected_prefs = m_exchange_send_selected_prefs | EC_PREFS_CATEGORIES; @@ -682,6 +775,7 @@ theApp->m_ConnState = 0; CServer *server; m_ID = tag->GetEd2kId(); + theApp->m_clientID = tag->GetClientId(); if (tag->IsConnectedED2K()) { CECTag *srvtag = tag->GetTagByName(EC_TAG_SERVER); @@ -740,9 +834,8 @@ void CServerListRem::UpdateServerMetFromURL(wxString url) { - // FIXME: The value in the serverwnd does not get saved. CECPacket req(EC_OP_SERVER_UPDATE_FROM_URL); - req.AddTag(CECTag(EC_TAG_SERVERS_URL_LIST, url)); + req.AddTag(CECTag(EC_TAG_SERVERS_UPDATE_URL, url)); m_conn->SendPacket(&req); } @@ -959,6 +1052,7 @@ file->statistic.alltimeaccepted = tag->GetAllAccepts(); file->statistic.transferred = tag->GetXferred(); file->statistic.alltimetransferred = tag->GetAllXferred(); + file->m_iUpPriority = tag->Prio(); } if (file->m_iUpPriority >= 10) { file->m_iUpPriority -= 10; diff -ruN -d amule-2.2.0~svn20080218/src/amule-remote-gui.h amule-2.2.2/src/amule-remote-gui.h --- amule-2.2.0~svn20080218/src/amule-remote-gui.h 2008-02-12 19:28:43.000000000 +0000 +++ amule-2.2.2/src/amule-remote-gui.h 2008-02-27 12:56:36.000000000 +0000 @@ -729,6 +729,7 @@ void SetOSFiles(wxString ) { /* onlinesig is created on remote side */ } bool IsConnected() const { return IsConnectedED2K() || IsConnectedKad(); } + bool IsFirewalled() const; bool IsConnectedED2K() const; bool IsConnectedKad() const { @@ -744,6 +745,11 @@ void StartKad(); void StopKad(); + /** Bootstraps kad from the specified IP (must be in hostorder). */ + void BootstrapKad(uint32 ip, uint16 port); + /** Updates the nodes.dat file from the specified url. */ + void UpdateNotesDat(const wxString& str); + void DisconnectED2K(); bool CryptoAvailable() const; @@ -753,6 +759,7 @@ void ShowUserCount(); uint8 m_ConnState; + uint32 m_clientID; wxLocale m_locale; diff -ruN -d amule-2.2.0~svn20080218/src/amule.cpp amule-2.2.2/src/amule.cpp --- amule-2.2.0~svn20080218/src/amule.cpp 2008-02-17 21:00:43.000000000 +0000 +++ amule-2.2.2/src/amule.cpp 2008-07-13 03:36:09.000000000 +0000 @@ -30,12 +30,14 @@ #include "amule.h" // Interface declarations. #include +#include #include #include #ifdef HAVE_CONFIG_H #include "config.h" // Needed for HAVE_GETRLIMIT, HAVE_SETRLIMIT, - // HAVE_SYS_RESOURCE_H, HAVE_SYS_STATVFS_H and VERSION + // HAVE_SYS_RESOURCE_H, HAVE_SYS_STATVFS_H, VERSION + // and ENABLE_NLS #endif #include @@ -73,7 +75,7 @@ #include "ServerConnect.h" // Needed for CServerConnect #include "ServerUDPSocket.h" // Needed for CServerUDPSocket #include "Statistics.h" // Needed for CStatistics -#include "TerminationProcess.h" // Needed for CTerminationProcess +#include "TerminationProcessAmuleweb.h" // Needed for CTerminationProcessAmuleweb #include "ThreadTasks.h" #include "updownclient.h" // Needed for CUpDownClient #include "UploadQueue.h" // Needed for CUploadQueue @@ -81,7 +83,7 @@ #include "UserEvents.h" #ifdef ENABLE_UPNP -#include "UPnP.h" // Needed for UPnP +#include "UPnPBase.h" // Needed for UPnP #endif #ifdef __WXMAC__ @@ -94,6 +96,8 @@ #include // Do_not_auto_remove #endif #include + + #include "amuleDlg.h" #endif @@ -208,6 +212,9 @@ // wxWidgets log-events are saved in it as well. delete applog; applog = NULL; + + free(strFullMuleVersion); + free(strOSDescription); } int CamuleApp::OnExit() @@ -412,7 +419,9 @@ #endif // This can't be on constructor or wx2.4.2 doesn't set it. + #if !wxCHECK_VERSION(2, 9, 0) SetVendorName(wxT("TikuWarez")); + #endif SetAppName(wxT("aMule")); wxString FullMuleVersion = GetFullMuleVersion(); @@ -622,8 +631,10 @@ // Build the filenames for the two OS files SetOSFiles(thePrefs::GetOSDir().GetRaw()); +#ifdef ENABLE_NLS // Load localization settings Localize_mule(); +#endif // Configure EC for amuled when invoked with ec-config if (ec_config) { @@ -659,7 +670,7 @@ wxT("and you are advised to run aMule as an normal\n") wxT("user instead."); - ShowAlert(msg, _("Warning"), wxCENTRE | wxOK | wxICON_ERROR); + ShowAlert(msg, _("WARNING"), wxCENTRE | wxOK | wxICON_ERROR); fprintf(stderr, "\n--------------------------------------------------\n"); fprintf(stderr, "%s", (const char*)unicode2UTF8(msg)); @@ -718,27 +729,34 @@ uploadqueue = new CUploadQueue(); ipfilter = new CIPFilter(); - // Create main dialog - InitGui(geometry_enabled, geom_string); - - uploadBandwidthThrottler = new UploadBandwidthThrottler(); - - serverlist->Init(); - - // init downloadqueue - downloadqueue->LoadMetFiles(thePrefs::GetTempDir()); - // Creates all needed listening sockets wxString msg; - bool ok; - ok = ReinitializeNetwork(&msg); - if (!msg.IsEmpty()) { + if (!ReinitializeNetwork(&msg)) { printf("\n%s\n", (const char *)unicode2char(msg)); } - // reload shared files - sharedfiles->Reload(); + // Create main dialog, or fork to background (daemon). + InitGui(geometry_enabled, geom_string); + +#if !defined(__WXMAC__) && defined(AMULE_DAEMON) + // Need to refresh wxSingleInstanceChecker after the daemon fork() ! + if (enable_daemon_fork) { + //#warning TODO: fix wxSingleInstanceChecker for amuled on Mac (wx link problems) + delete m_singleInstance; + m_singleInstance = new wxSingleInstanceChecker(wxT("muleLock"), ConfigDir); + // No need to check IsAnotherRunning() - we've done it before. + } +#endif + // Has to be created after the call to InitGui, as fork + // (when using posix threads) only replicates the mainthread, + // and the UBT constructor creates a thread. + uploadBandwidthThrottler = new UploadBandwidthThrottler(); + + // These must be initialized after the gui is loaded. + serverlist->Init(); + downloadqueue->LoadMetFiles(thePrefs::GetTempDir()); + sharedfiles->Reload(); if (thePrefs::IPFilterAutoLoad()) { ipfilter->Update(thePrefs::IPFilterURL()); @@ -766,7 +784,7 @@ _("You don't have any server in the server list.\nDo you want aMule to download a new list now?")), wxString(_("Server list download")), wxYES_NO, - (wxWindow*)theApp->amuledlg)) + static_cast(theApp->amuledlg))) #endif { // workaround amuled crash @@ -819,19 +837,19 @@ wxT("' '--amule-config-file=") + aMuleConfigFile + wxT("'"); - CTerminationProcess *p = new CTerminationProcess(cmd); + CTerminationProcessAmuleweb *p = new CTerminationProcessAmuleweb(cmd, &webserver_pid); webserver_pid = wxExecute(cmd, wxEXEC_ASYNC, p); bool webserver_ok = webserver_pid > 0; if (webserver_ok) { - AddLogLineM(true, CFormat(_("webserver running on pid %d")) % webserver_pid); + AddLogLineM(true, CFormat(_("web server running on pid %d")) % webserver_pid); } else { delete p; ShowAlert(_( - "You requested to run webserver from startup, " + "You requested to run web server on startup, " "but the amuleweb binary cannot be run. " - "Please install the package containing aMule webserver, " + "Please install the package containing aMule web server, " "or compile aMule using --enable-webserver and run make install"), - _("Error"), wxOK | wxICON_ERROR); + _("ERROR"), wxOK | wxICON_ERROR); } } #endif /* ! __WXMSW__ */ @@ -952,7 +970,7 @@ err = CFormat( _("Port %u is not available!\n\nThis means that you will be LOWID.\n\nCheck your network to make sure the port is open for output and input.")) % (unsigned int)(thePrefs::GetPort()); - ShowAlert(err, _("Error"), wxOK | wxICON_ERROR); + ShowAlert(err, _("ERROR"), wxOK | wxICON_ERROR); } // Create the UDP socket. @@ -1027,14 +1045,13 @@ % f->GetFileName().Cleanup(false) % f->GetFileSize() % f->GetFileHash().Encode(); - if (add_source && IsConnectedED2K() && !serverconnect->IsLowID() ) { - - uint32 clientID = GetID(); + if (add_source && IsConnected() && !IsFirewalled()) { // Create the first part of the URL - strURL<< wxT("|sources,"); + strURL << wxT("|sources,"); if (use_hostname) { strURL << thePrefs::GetYourHostname(); } else { + uint32 clientID = GetID(); strURL << (uint8) clientID << wxT(".") << (uint8)(clientID >> 8) << wxT(".") << (uint8)(clientID >> 16) << wxT(".") << @@ -1055,14 +1072,12 @@ if (byCryptOptions & 0x80) { strURL << wxT(":") << thePrefs::GetUserHash().Encode(); } - } strURL << wxT("|/"); } else if (add_source) { - AddLogLineM(true, _("WARNING: You can't add yourself as a source for a ed2k link while being lowid.")); + AddLogLineM(true, _("WARNING: You can't add yourself as a source for an eD2k link while having a lowid.")); } - // Result is "ed2k://|file||||/|sources,[(|):[:cryptoptions[:hash]]]|/" return strURL; } @@ -1073,13 +1088,8 @@ // Create the first part of the URL wxString strURL = CreateED2kLink(f); // Append the AICH info - if (f->GetAICHHashset()->HasValidMasterHash() && - ( - f->GetAICHHashset()->GetStatus() == AICH_VERIFIED || - f->GetAICHHashset()->GetStatus() == AICH_HASHSETCOMPLETE - )) { - strURL << wxT("|h=") << f->GetAICHHashset()->GetMasterHash().GetString(); - strURL << wxT("|/"); + if (f->HasProperAICHHashSet()) { + strURL << wxT("|h=") << f->GetAICHMasterHash() << wxT("|/"); } // Result is "ed2k://|file||||/|h=|/" @@ -1299,13 +1309,14 @@ info += _("This version is a testing version, updated daily, and\n"); info += _("we give no warranty it won't break anything, burn your house,\n"); info += _("or kill your dog. But it *should* be safe to use anyway.\n"); - } else if (new_version == wxT("2.2.0")) { + } else if (new_version == wxT("2.2.1")) { thePrefs::SetAddServersFromServer(false); thePrefs::SetAddServersFromClient(false); info += _("The following options have been changed in this release for security reasons:\n"); info += _("\n* Enabled Protocol Obfuscation support for incoming and outgoing connections.\n"); info += _("\n* Disabled updating the server list from other server and clients.\n"); info += _("\nFor more information on the reason for this changes, seach\nthe aMule wiki at http://wiki.amule.org for \"fake servers\" info.\nIt's important that you clear any fake server from your server list for aMule to work properly."); + info += _("\n\nAdditionally, the browser settings have been reset to the system default. Please configure your browser options again if needed.\n"); } // General info @@ -1326,7 +1337,7 @@ m_emulesig_path = JoinPaths(new_path, wxT("onlinesig.dat")); m_amulesig_path = JoinPaths(new_path, wxT("amulesig.dat")); } else { - ShowAlert(_("The folder for Online Signature files you specified is INVALID!\n OnlineSignature will be DISABLED until you fix it on preferences."), _("Error"), wxOK | wxICON_ERROR); + ShowAlert(_("The folder for Online Signature files you specified is INVALID!\n OnlineSignature will be DISABLED until you fix it on preferences."), _("ERROR"), wxOK | wxICON_ERROR); m_emulesig_path.Clear(); m_amulesig_path.Clear(); } @@ -1597,6 +1608,27 @@ CUserEvents::ProcessEvent(CUserEvents::DownloadCompleted, completed); } +void CamuleApp::OnFinishedAllocation(CAllocFinishedEvent& evt) +{ + CPartFile *file = evt.GetFile(); + wxCHECK_RET(file, wxT("Allocation finished event sent for unspecified file")); + wxASSERT_MSG(downloadqueue->IsPartFile(file), wxT("CAllocFinishedEvent for unknown partfile")); + + file->SetPartFileStatus(PS_EMPTY); + + if (evt.Succeeded()) { + if (evt.IsPaused()) { + file->StopFile(); + } else { + file->ResumeFile(); + } + } else { + AddLogLineM(false, CFormat(_("Disk space preallocation for file '%s' failed: %s")) % file->GetFileName() % wxString(UTF82unicode(std::strerror(evt.GetResult())))); + file->StopFile(); + } + + file->AllocationFinished(); +}; void CamuleApp::OnNotifyEvent(CMuleGUIEvent& evt) { @@ -1987,10 +2019,21 @@ theApp->serverlist->GetUserFileStatus( totaluser, totalfile ); - wxString buffer = - CFormat(_("Users: E: %s K: %s | Files E: %s K: %s")) % CastItoIShort(totaluser) % - CastItoIShort(Kademlia::CKademlia::GetKademliaUsers()) % CastItoIShort(totalfile) % CastItoIShort(Kademlia::CKademlia::GetKademliaFiles()); + wxString buffer; + + static const wxString s_singlenetstatusformat = _("Users: %s | Files: %s"); + static const wxString s_bothnetstatusformat = _("Users: E: %s K: %s | Files: E: %s K: %s"); + if (thePrefs::GetNetworkED2K() && thePrefs::GetNetworkKademlia()) { + buffer = CFormat(s_bothnetstatusformat) % CastItoIShort(totaluser) % CastItoIShort(Kademlia::CKademlia::GetKademliaUsers()) % CastItoIShort(totalfile) % CastItoIShort(Kademlia::CKademlia::GetKademliaFiles()); + } else if (thePrefs::GetNetworkED2K()) { + buffer = CFormat(s_singlenetstatusformat) % CastItoIShort(totaluser) % CastItoIShort(totalfile); + } else if (thePrefs::GetNetworkKademlia()) { + buffer = CFormat(s_singlenetstatusformat) % CastItoIShort(Kademlia::CKademlia::GetKademliaUsers()) % CastItoIShort(Kademlia::CKademlia::GetKademliaFiles()); + } else { + buffer = _("No networks selected"); + } + Notify_ShowUserCount(buffer); } @@ -2041,9 +2084,7 @@ Notify_ShowConnState(state); if (old_state != state) { - // Get the changed value - int changed_flags = old_state ^ state; if (changed_flags & CONNECTED_ED2K) { @@ -2062,7 +2103,7 @@ if ( theApp->serverconnect->IsConnecting() ) { AddLogLine(CFormat(_("Connecting to %s")) % connected_server); } else { - AddLogLine(_("Disconnected from ED2K")); + AddLogLine(_("Disconnected from eD2k")); } } } @@ -2088,9 +2129,12 @@ } old_state = state; + + theApp->downloadqueue->OnConnectionState(IsConnected()); } ShowUserCount(); + Notify_ShowConnState(state); } @@ -2158,9 +2202,31 @@ } } + +void CamuleApp::BootstrapKad(uint32 ip, uint16 port) +{ + if (!Kademlia::CKademlia::IsRunning()) { + Kademlia::CKademlia::Start(); + theApp->ShowConnectionState(); + } + + Kademlia::CKademlia::Bootstrap(ip, port, true); +} + + +void CamuleApp::UpdateNotesDat(const wxString& url) +{ + wxString strTempFilename(theApp->ConfigDir + wxT("nodes.dat.download")); + + CHTTPDownloadThread *downloader = new CHTTPDownloadThread(url, strTempFilename, HTTP_NodesDat); + downloader->Create(); + downloader->Run(); +} + + void CamuleApp::DisconnectED2K() { - // Stop Kad if it's running + // Stop ED2K if it's running if (IsConnectedED2K()) { serverconnect->Disconnect(); } diff -ruN -d amule-2.2.0~svn20080218/src/amule.h amule-2.2.2/src/amule.h --- amule-2.2.0~svn20080218/src/amule.h 2008-02-10 18:59:47.000000000 +0000 +++ amule-2.2.2/src/amule.h 2008-05-23 23:11:22.000000000 +0000 @@ -77,6 +77,7 @@ class CHashingEvent; class CMuleInternalEvent; class CCompletionEvent; +class CAllocFinishedEvent; class wxExecuteData; class CLoggingEvent; @@ -220,6 +221,12 @@ void StartKad(); void StopKad(); + /** Bootstraps kad from the specified IP (must be in hostorder). */ + void BootstrapKad(uint32 ip, uint16 port); + /** Updates the nodes.dat file from the specified url. */ + void UpdateNotesDat(const wxString& str); + + void DisconnectED2K(); bool CryptoAvailable() const; @@ -261,6 +268,7 @@ void OnFinishedHashing(CHashingEvent& evt); void OnFinishedAICHHashing(CHashingEvent& evt); void OnFinishedCompletion(CCompletionEvent& evt); + void OnFinishedAllocation(CAllocFinishedEvent& evt); void OnFinishedHTTPDownload(CMuleInternalEvent& evt); void OnHashingShutdown(CMuleInternalEvent&); void OnNotifyEvent(CMuleGUIEvent& evt); diff -ruN -d amule-2.2.0~svn20080218/src/amuleDlg.cpp amule-2.2.2/src/amuleDlg.cpp --- amule-2.2.0~svn20080218/src/amuleDlg.cpp 2008-02-17 11:43:53.000000000 +0000 +++ amule-2.2.2/src/amuleDlg.cpp 2008-08-05 11:12:49.000000000 +0000 @@ -36,6 +36,8 @@ #include #include #include +#include +#include // Needed for wxWindowUpdateLocker #include @@ -103,7 +105,6 @@ EVT_ICONIZE(CamuleDlg::OnMinimize) EVT_BUTTON(ID_BUTTON_FAST, CamuleDlg::OnBnClickedFast) - EVT_BUTTON(IDC_SHOWSTATUSTEXT, CamuleDlg::OnBnStatusText) EVT_TIMER(ID_GUI_TIMER_EVENT, CamuleDlg::OnGUITimer) @@ -143,6 +144,7 @@ m_imagelist(16,16), m_tblist(32,32), m_prefsVisible(false), +m_wndToolbar(NULL), m_wndTaskbarNotifier(NULL), m_nActiveDialog(DT_NETWORKS_WND), m_is_safe_state(false), @@ -187,15 +189,9 @@ wxInitAllImageHandlers(); Apply_Clients_Skin(); - bool override_where = where != wxDefaultPosition; - bool override_size = - dlg_size.x != DEFAULT_SIZE_X || - dlg_size.y != DEFAULT_SIZE_Y; - if (!LoadGUIPrefs(override_where, override_size)) { - // Prefs not loaded for some reason, exit - AddLogLineM( true, wxT("Error! Unable to load Preferences") ); - return; - } +#ifdef __WXMSW__ + wxSystemOptions::SetOption(wxT("msw.remap"), 0); +#endif SetIcon(wxICON(aMule)); @@ -210,7 +206,6 @@ s_main->Add(p_cnt, 0, wxGROW|wxEXPAND, 0); muleDlg(p_cnt, false, true); SetSizer(s_main, true); - Create_Toolbar(thePrefs::VerticalToolbar()); m_serverwnd = new CServerWnd(p_cnt, m_srv_split_pos); AddLogLineM(false, wxEmptyString); @@ -242,13 +237,26 @@ // Create the GUI timer gui_timer=new wxTimer(this,ID_GUI_TIMER_EVENT); if (!gui_timer) { - AddLogLine(false, _("Fatal Error: Failed to create Timer")); + AddLogLine(false, _("FATAL ERROR: Failed to create Timer")); exit(1); } - // Set Serverlist as active window - SetActiveDialog(DT_NETWORKS_WND, m_serverwnd); - m_wndToolbar->ToggleTool(ID_BUTTONNETWORKS, true ); + // Set transfers as active window + Create_Toolbar(thePrefs::VerticalToolbar()); + SetActiveDialog(DT_TRANSFER_WND, m_transferwnd); + // Prepare the dialog, sets the splitter-position + m_transferwnd->Prepare(); + m_wndToolbar->ToggleTool(ID_BUTTONTRANSFER, true ); + + bool override_where = (where != wxDefaultPosition); + bool override_size = ( + (dlg_size.x != DEFAULT_SIZE_X) || + (dlg_size.y != DEFAULT_SIZE_Y) ); + if (!LoadGUIPrefs(override_where, override_size)) { + // Prefs not loaded for some reason, exit + AddLogLineM( true, wxT("Error! Unable to load Preferences") ); + return; + } m_is_safe_state = true; @@ -263,11 +271,7 @@ Show(true); // Must we start minimized? if (thePrefs::GetStartMinimized()) { - if (thePrefs::UseTrayIcon() && thePrefs::DoMinToTray()) { - Hide_aMule(); - } else { - Iconize(true); - } + DoIconize(true); } // Set shortcut keys @@ -277,6 +281,24 @@ SetAcceleratorTable(wxAcceleratorTable(itemsof(entries), entries)); ShowED2KLinksHandler( thePrefs::GetFED2KLH() ); + + wxNotebook* logs_notebook = CastChild( ID_SRVLOG_NOTEBOOK, wxNotebook); + wxNotebook* networks_notebook = CastChild( ID_NETNOTEBOOK, wxNotebook); + + wxASSERT(logs_notebook->GetPageCount() == 4); + wxASSERT(networks_notebook->GetPageCount() == 2); + + for (int i = 0; i < logs_notebook->GetPageCount(); ++i) { + m_logpages[i].page = logs_notebook->GetPage(i); + m_logpages[i].name = logs_notebook->GetPageText(i); + } + + for (int i = 0; i < networks_notebook->GetPageCount(); ++i) { + m_networkpages[i].page = networks_notebook->GetPage(i); + m_networkpages[i].name = networks_notebook->GetPageText(i); + } + + DoNetworkRearrange(); } @@ -348,6 +370,9 @@ void CamuleDlg::CreateSystray() { + wxCHECK_RET(m_wndTaskbarNotifier == NULL, + wxT("Systray already created")); + m_wndTaskbarNotifier = new CMuleTrayIcon(); // This will effectively show the Tray Icon. UpdateTrayIcon(0); @@ -363,7 +388,7 @@ void CamuleDlg::OnToolBarButton(wxCommandEvent& ev) { - static int lastbutton = ID_BUTTONNETWORKS; + static int lastbutton = ID_BUTTONTRANSFER; // Kry - just if the GUI is ready for it if ( m_is_safe_state ) { @@ -460,9 +485,9 @@ if (m_is_safe_state) { if (m_prefsDialog == NULL) { m_prefsDialog = new PrefsUnifiedDlg(this); - m_prefsDialog->TransferToWindow(); } + m_prefsDialog->TransferToWindow(); m_prefsDialog->Show(true); m_prefsDialog->Raise(); } @@ -485,6 +510,10 @@ SaveGUIPrefs(); theApp->amuledlg = NULL; + +#ifdef ENABLE_IP2COUNTRY + delete m_IP2Country; +#endif printf("aMule dialog destroyed\n"); } @@ -528,16 +557,7 @@ #endif } -} - - -void CamuleDlg::OnBnStatusText(wxCommandEvent& WXUNUSED(evt)) -{ - wxString line = CastChild(wxT("infoLabel"), wxStaticText)->GetLabel(); - - if (!line.IsEmpty()) { - wxMessageBox(line, wxString(_("Status text")), wxOK|wxICON_INFORMATION, this); - } + ShowConnectionState(); } @@ -573,11 +593,14 @@ ct->AppendText( wxT("\n") ); } else { // Bold critical log-lines + // Windows doesn't support this feature, and it causes GDI resource leaks +#ifndef __WXMSW__ wxTextAttr style = ct->GetDefaultStyle(); wxFont font = style.GetFont(); font.SetWeight(addtostatusbar ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL); style.SetFont(font); ct->SetDefaultStyle(style); +#endif // Split multi-line messages into individual lines wxStringTokenizer tokens( bufferline, wxT("\n") ); @@ -597,6 +620,7 @@ wxStaticText* text = CastChild( wxT("infoLabel"), wxStaticText ); // Only show the first line if multiple lines text->SetLabel( bufferline.BeforeFirst( wxT('\n') ) ); + text->SetToolTip( bufferline ); text->GetParent()->Layout(); } @@ -616,17 +640,10 @@ } } -void CamuleDlg::ShowConnectionState() + +void CamuleDlg::ShowConnectionState(bool skinChanged) { - enum ed2k_state { sED2KUnknown = -1, sDisconnected = 0, sLowID = 1, sConnecting = 2, sHighID = 3 }; - enum kad_state { sKadUnknown = -1, sOff = 4, sFirewalled = 5, sOK = 6 }; - static ed2k_state LastED2KState = sED2KUnknown; - static kad_state LastKadState = sKadUnknown; static wxImageList status_arrows(16,16,true,0); - wxMemoryDC bitmap_dc; - - theApp->downloadqueue->OnConnectionState(theApp->IsConnected()); - if (!status_arrows.GetImageCount()) { // Generate the image list (This is only done once) for (int t = 0; t < 7; ++t) { @@ -636,152 +653,143 @@ m_serverwnd->UpdateED2KInfo(); m_serverwnd->UpdateKadInfo(); - - ed2k_state NewED2KState; - kad_state NewKadState; - - wxStaticText* connLabel = CastChild( wxT("connLabel"), wxStaticText ); - - wxString connected_server; - CServer* ed2k_server = theApp->serverconnect->GetCurrentServer(); - if (ed2k_server) { - connected_server = ed2k_server->GetListName(); - } - - if ( theApp->IsConnectedED2K() ) { - if ( theApp->serverconnect->IsLowID() ) { - NewED2KState = sLowID; + + + //////////////////////////////////////////////////////////// + // Determine the status of the networks + // + enum ED2KState { ED2KOff = 0, ED2KLowID = 1, ED2KConnecting = 2, ED2KHighID = 3 }; + enum EKadState { EKadOff = 4, EKadFW = 5, EKadConnecting = 5, EKadOK = 6 }; + + ED2KState ed2kState = ED2KOff; + EKadState kadState = EKadOff; + + //////////////////////////////////////////////////////////// + // Update the label on the status-bar and determine + // the states of the two networks. + // + wxString msgED2K; + if (theApp->IsConnectedED2K()) { + CServer* server = theApp->serverconnect->GetCurrentServer(); + if (server) { + msgED2K = CFormat(wxT("eD2k: %s")) % server->GetListName(); + } + + if (theApp->serverconnect->IsLowID()) { + ed2kState = ED2KLowID; } else { - NewED2KState = sHighID; + ed2kState = ED2KHighID; } - } else if ( theApp->serverconnect->IsConnecting() ) { - NewED2KState = sConnecting; - } else { - NewED2KState = sDisconnected; + } else if (theApp->serverconnect->IsConnecting()) { + msgED2K = _("eD2k: Connecting"); + + ed2kState = ED2KConnecting; + } else if (thePrefs::GetNetworkED2K()) { + msgED2K = _("eD2k: Disconnected"); } + wxString msgKad; if (theApp->IsConnectedKad()) { - if (!theApp->IsFirewalledKad()) { - NewKadState = sOK; + if (theApp->IsFirewalledKad()) { + msgKad = _("Kad: Firewalled"); + + kadState = EKadFW; } else { - NewKadState = sFirewalled; + msgKad = _("Kad: Connected"); + + kadState = EKadOK; } - } else { - NewKadState = sOff; + } else if (theApp->IsKadRunning()) { + msgKad = _("Kad: Connecting"); + + kadState = EKadConnecting; + } else if (thePrefs::GetNetworkKademlia()) { + msgKad = _("Kad: Off"); } - if ( (LastED2KState != NewED2KState) || (LastKadState != NewKadState)) { - - wxStaticBitmap* conn_bitmap = CastChild( wxT("connImage"), wxStaticBitmap ); - wxASSERT(conn_bitmap); - - wxBitmap conn_image = conn_bitmap->GetBitmap(); - - bitmap_dc.SelectObject(conn_image); - - m_wndToolbar->DeleteTool(ID_BUTTONCONNECT); + wxStaticText* connLabel = CastChild( wxT("connLabel"), wxStaticText ); + wxCHECK_RET(connLabel, wxT("'connLabel' widget not found")); + + wxString labelMsg; + if (msgED2K.Length() && msgKad.Length()) { + labelMsg = msgED2K + wxT(" | ") + msgKad; + } else { + labelMsg = msgED2K + msgKad; + } + + connLabel->SetLabel(labelMsg); + connLabel->GetParent()->Layout(); + + + //////////////////////////////////////////////////////////// + // Update the connect/disconnect/cancel button. + // + enum EConnState { + ECS_Unknown, + ECS_Connected, + ECS_Connecting, + ECS_Disconnected + }; + + static EConnState s_oldState = ECS_Unknown; + EConnState currentState = ECS_Disconnected; + + if (theApp->serverconnect->IsConnecting() || + (theApp->IsKadRunning() && !theApp->IsConnectedKad())) { + currentState = ECS_Connecting; + } else if (theApp->IsConnected()) { + currentState = ECS_Connected; + } else { + currentState = ECS_Disconnected; + } + + if ( (true == skinChanged) || (currentState != s_oldState)) { + wxWindowUpdateLocker freezer(m_wndToolbar); - if ((NewED2KState != sDisconnected) || (NewKadState != sOff)) { - if (NewED2KState == sConnecting) { - m_wndToolbar->InsertTool(0, ID_BUTTONCONNECT, _("Cancel"), - thePrefs::UseSkins() ? m_tblist.GetBitmap(2) : connButImg(2), - wxNullBitmap, wxITEM_NORMAL, - _("Stops the current connection attempts")); - } else { - /* ED2K connected or Kad connected */ - wxString popup = _("Disconnect from "); - - if (NewED2KState != sDisconnected) { - popup += _("current server"); - if (NewKadState != sOff) { - popup += _(" and "); - } - } - - if (NewKadState != sOff) { - popup += wxT("Kad"); - } - - m_wndToolbar->InsertTool(0, ID_BUTTONCONNECT, _("Disconnect"), - thePrefs::UseSkins() ? m_tblist.GetBitmap(1) : connButImg(1), - wxNullBitmap, wxITEM_NORMAL, - popup); - - } - } else { - m_wndToolbar->InsertTool(0, ID_BUTTONCONNECT, _("Connect"), - thePrefs::UseSkins() ? m_tblist.GetBitmap(0) : connButImg(0), - wxNullBitmap, wxITEM_NORMAL, - _("Connect to any server and/or Kad")); + wxToolBarToolBase* toolbarTool = m_wndToolbar->RemoveTool(ID_BUTTONCONNECT); + + switch (currentState) { + case ECS_Connecting: + toolbarTool->SetLabel(_("Cancel")); + toolbarTool->SetShortHelp(_("Stop the current connection attempts")); + toolbarTool->SetNormalBitmap(m_tblist.GetBitmap(2)); + break; + + case ECS_Connected: + toolbarTool->SetLabel(_("Disconnect")); + toolbarTool->SetShortHelp(_("Disconnect from the currently connected networks")); + toolbarTool->SetNormalBitmap(m_tblist.GetBitmap(1)); + break; + + default: + toolbarTool->SetLabel(_("Connect")); + toolbarTool->SetShortHelp(_("Connect to the currently enabled networks")); + toolbarTool->SetNormalBitmap(m_tblist.GetBitmap(0)); } - + + m_wndToolbar->InsertTool(0, toolbarTool); m_wndToolbar->Realize(); - - if ( LastED2KState != NewED2KState ) { - - switch ( NewED2KState ) { - case sLowID: - // Display a warning about LowID connections - AddLogLine(true, _("WARNING: You have received Low-ID!")); - AddLogLine(false, _("\tMost likely this is because you're behind a firewall or router.")); - AddLogLine(false, _("\tFor more information, please refer to http://wiki.amule.org")); - - case sHighID: { - wxStaticText* tx = CastChild( wxT("infoLabel"), wxStaticText ); - tx->SetLabel(CFormat(_("Connection established on: %s")) % connected_server); - connLabel->SetLabel(connected_server); - - break; - } - case sConnecting: - connLabel->SetLabel(_("Connecting")); - break; - - case sDisconnected: - connLabel->SetLabel(_("Not Connected")); - break; - - default: - break; - } - /* Draw ED2K arrow */ - status_arrows.Draw(NewED2KState, bitmap_dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); - - LastED2KState = NewED2KState; - - } - - if (NewKadState != LastKadState) { - int index = connLabel->GetLabel().Find(wxT(" (Kad:")); - - if (index == -1) { - index = connLabel->GetLabel().Length(); - } - - if (NewKadState == sOK) { - connLabel->SetLabel(connLabel->GetLabel().Left(index) + wxT(" (Kad: ok)")); - } else if (NewKadState == sFirewalled) { - connLabel->SetLabel(connLabel->GetLabel().Left(index) + wxT(" (Kad: firewalled)")); - } else { - connLabel->SetLabel(connLabel->GetLabel().Left(index) + wxT(" (Kad: off)")); - } - - /* Kad Connecting arrow */ - status_arrows.Draw(NewKadState, bitmap_dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); - - LastKadState = NewKadState; - } - - connLabel->GetParent()->Layout(); - conn_bitmap->SetBitmap(conn_image); - } else { - if (theApp->IsConnectedED2K()) { - connLabel->SetLabel(connected_server); - connLabel->GetParent()->Layout(); - } + + s_oldState = currentState; } + + + //////////////////////////////////////////////////////////// + // Update the globe-icon in the lower-right corner. + // + wxStaticBitmap* connBitmap = CastChild( wxT("connImage"), wxStaticBitmap ); + wxCHECK_RET(connBitmap, wxT("'connImage' widget not found")); + + wxBitmap statusIcon = connBitmap->GetBitmap(); + wxMemoryDC bitmapDC(statusIcon); + + status_arrows.Draw(kadState, bitmapDC, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); + status_arrows.Draw(ed2kState, bitmapDC, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); + + connBitmap->SetBitmap(statusIcon); } + void CamuleDlg::ShowUserCount(const wxString& info) { wxStaticText* label = CastChild( wxT("userLabel"), wxStaticText ); @@ -793,6 +801,7 @@ label->GetParent()->Layout(); } + void CamuleDlg::ShowTransferRate() { float kBpsUp = theStats::GetUploadRate() / 1024.0; @@ -816,6 +825,7 @@ SetTitle(theApp->m_FrameTitle + UpDownSpeed); } + wxASSERT((m_wndTaskbarNotifier != NULL) == thePrefs::UseTrayIcon()); if (m_wndTaskbarNotifier) { // set trayicon-icon int percentDown = (int)ceil((kBpsDown*100) / thePrefs::GetMaxGraphDownloadRate()); @@ -863,6 +873,9 @@ } } + Enable(false); + Show(false); + theApp->ShutDown(evt); } @@ -898,10 +911,12 @@ wxString section = wxT("/Razor_Preferences/"); // Get window size and position - int x1 = config->Read(section + wxT("MAIN_X_POS"), -1l); - int y1 = config->Read(section + wxT("MAIN_Y_POS"), -1l); - int x2 = config->Read(section + wxT("MAIN_X_SIZE"), 0l); - int y2 = config->Read(section + wxT("MAIN_Y_SIZE"), 0l); + int x1 = config->Read(section + wxT("MAIN_X_POS"), -1); + int y1 = config->Read(section + wxT("MAIN_Y_POS"), -1); + int x2 = config->Read(section + wxT("MAIN_X_SIZE"), -1); + int y2 = config->Read(section + wxT("MAIN_Y_SIZE"), -1); + + int maximized = config->Read(section + wxT("Maximized"), 01); // Kry - Random usable pos for m_srv_split_pos m_srv_split_pos = config->Read(section + wxT("SRV_SPLITTER_POS"), 463l); @@ -910,19 +925,28 @@ SetSize(x2, y2); } else { #ifndef __WXGTK__ - // Probably first run. Only works for gtk2 + // Probably first run. Maximize(); #endif } } if (!override_pos) { - // If x1 and y1 != 0 Redefine location + // If x1 and y1 != -1 Redefine location if(x1 != -1 && y1 != -1) { - Move(x1, y1); + wxRect display = wxGetClientDisplayRect(); + if (x1 <= display.GetRightTop().x && y1 <= display.GetRightBottom().y) { + Move(x1, y1); + } else { + // It's offscreen... so let's not. + } } } + if (!override_size && !override_pos && maximized) { + Maximize(); + } + return true; } @@ -949,9 +973,12 @@ // Saving window size and position config->Write(section+wxT("MAIN_X_POS"), (long) x1); config->Write(section+wxT("MAIN_Y_POS"), (long) y1); + config->Write(section+wxT("MAIN_X_SIZE"), (long) x2); config->Write(section+wxT("MAIN_Y_SIZE"), (long) y2); + config->Write(section+wxT("Maximized"), (long) (IsMaximized() ? 1 : 0)); + // Saving sash position of splitter in server window config->Write(section+wxT("SRV_SPLITTER_POS"), (long) m_srv_split_pos); @@ -963,63 +990,43 @@ } -void CamuleDlg::Hide_aMule(bool iconize) +void CamuleDlg::DoIconize(bool iconize) { - if (IsShown() && ((m_last_iconizing + 2000) < GetTickCount())) { // 1 secs for sanity - m_last_iconizing = GetTickCount(); - - if (m_prefsDialog && m_prefsDialog->IsShown()) { - m_prefsVisible = true; - m_prefsDialog->Iconize(true);; - m_prefsDialog->Show(false); - } else { - m_prefsVisible = false; - } - + if (m_wndTaskbarNotifier && thePrefs::DoMinToTray()) { if (iconize) { - Iconize(true); - } - - Show(false); - } - -} - - -void CamuleDlg::Show_aMule(bool uniconize) -{ - if (!IsShown() && ((m_last_iconizing + 1000) < GetTickCount())) { // 1 secs for sanity - m_last_iconizing = GetTickCount(); - - if (m_prefsDialog && m_prefsVisible) { - m_prefsDialog->Show(true); - m_prefsDialog->Raise(); - } - - if (uniconize) { + // Skip() will do it. + //Iconize(true); + if (SafeState()) { + Show(false); + } + } else { Show(true); Raise(); } + } else { + // Will be done by Skip(); + //Iconize(iconize); } } - void CamuleDlg::OnMinimize(wxIconizeEvent& evt) { - if (m_wndTaskbarNotifier && thePrefs::DoMinToTray()) { - if (evt.Iconized()) { - Hide_aMule(false); +// Evil Hack: check if the mouse is inside the window +#ifndef __WINDOWS__ + if (GetScreenRect().Contains(wxGetMousePosition())) +#endif + { + if (m_prefsDialog && m_prefsDialog->IsShown()) { + // Veto. } else { - if (SafeState()) { - Show_aMule(true); - } else { - Show_aMule(false); + if (m_wndTaskbarNotifier) { + DoIconize(evt.Iconized()); } + evt.Skip(); } - } + } } - void CamuleDlg::OnGUITimer(wxTimerEvent& WXUNUSED(evt)) { // Former TimerProc section @@ -1033,8 +1040,6 @@ return; } - bool bStatsVisible = (!IsIconized() && StatisticsWindowActive()); - #ifndef CLIENT_GUI static uint32 msPrevGraph; int msGraphUpdate = thePrefs::GetTrafficOMeterInterval() * 1000; @@ -1044,8 +1049,8 @@ GraphUpdateInfo update = theApp->m_statistics->GetPointsForUpdate(); - m_statisticswnd->UpdateStatGraphs(bStatsVisible, theStats::GetPeakConnections(), update); - m_kademliawnd->UpdateGraph(!IsIconized() && (m_activewnd == m_serverwnd), update); + m_statisticswnd->UpdateStatGraphs(theStats::GetPeakConnections(), update); + m_kademliawnd->UpdateGraph(update); } #else //#warning TODO: CORE/GUI -- EC needed @@ -1053,7 +1058,7 @@ int sStatsUpdate = thePrefs::GetStatsInterval(); if ((sStatsUpdate > 0) && ((int)(msCur - msPrevStats) > sStatsUpdate*1000)) { - if (bStatsVisible) { + if (m_statisticswnd->IsShownOnScreen()) { msPrevStats = msCur; m_statisticswnd->ShowStatistics(); } @@ -1091,14 +1096,8 @@ int pos = m_wndToolbar->GetToolPos(ID_BUTTONMESSAGES); wxASSERT(pos == 6); // so we don't miss a change on wx2.4 - m_wndToolbar->DeleteTool(ID_BUTTONMESSAGES); - m_wndToolbar->InsertTool(pos,ID_BUTTONMESSAGES, _("Messages"), - m_tblist.GetBitmap(m_CurrentBlinkBitmap), - wxNullBitmap, - wxITEM_CHECK, - _("Messages Window") ); - m_wndToolbar->Realize(); - + wxWindowUpdateLocker freezer(m_wndToolbar); + m_wndToolbar->SetToolNormalBitmap(ID_BUTTONMESSAGES, m_tblist.GetBitmap(m_CurrentBlinkBitmap)); } @@ -1113,11 +1112,11 @@ wxString cmd; cmd = thePrefs::GetBrowser(); - if ( !cmd.IsEmpty() ) { - wxString tmp = url; - // Pipes cause problems, so escape them - tmp.Replace( wxT("|"), wxT("%7C") ); + wxString tmp = url; + // Pipes cause problems, so escape them + tmp.Replace( wxT("|"), wxT("%7C") ); + if ( !cmd.IsEmpty() ) { if (!cmd.Replace(wxT("%s"), tmp)) { // No %s found, just append the url cmd += wxT(" ") + tmp; @@ -1130,34 +1129,9 @@ } else { delete p; } -#ifdef __WXMSW__ } else { - wxFileType* ft = - wxTheMimeTypesManager->GetFileTypeFromExtension(wxT("html")); - if (!ft) { - wxLogError(wxT("Impossible to determine the file type for extension html. Please edit your MIME types.")); - return; - } - - bool ok = ft->GetOpenCommand( - &cmd, wxFileType::MessageParameters(url, wxT(""))); - delete ft; - - if (!ok) { - wxMessageBox( - _("Could not determine the command for running the browser."), - wxT("Browsing problem"), wxOK|wxICON_EXCLAMATION, this); - return; - } - - wxPuts(wxT("Launch Command: ") + cmd); - CTerminationProcess *p = new CTerminationProcess(cmd); - if (wxExecute(cmd, wxEXEC_ASYNC, p)) { - return; - } else { - delete p; - } -#endif // __WXMSW__ + wxLaunchDefaultBrowser(tmp); + return; } // Unable to execute browser. But this error message doesn't make sense, // cosidering that you _can't_ set the browser executable path... =/ @@ -1210,7 +1184,7 @@ ret = false; } else if (!m_skinFileName.IsFileReadable()) { AddLogLineM(true, CFormat( - _("Warning: Unable to open skin file '%s' for read")) % + _("WARNING: Unable to open skin file '%s' for read")) % skinFileName); ret = false; } @@ -1304,53 +1278,40 @@ // Build aMule toolbar wndToolbar->SetMargins(0, 0); - if (theApp->IsConnectedED2K()) { - wndToolbar->AddTool(ID_BUTTONCONNECT, - _("Disconnect"), m_tblist.GetBitmap(1), - wxNullBitmap, wxITEM_NORMAL, - _("Disconnect from any server and/or Kad")); - } else if (theApp->serverconnect && theApp->serverconnect->IsConnecting()) { - wndToolbar->AddTool(ID_BUTTONCONNECT, - _("Cancel"), m_tblist.GetBitmap(2), - wxNullBitmap, wxITEM_NORMAL, - _("Stops the current connection attempts")); - } else { - wndToolbar->AddTool(ID_BUTTONCONNECT, - _("Connect"), m_tblist.GetBitmap(0), - wxNullBitmap, wxITEM_NORMAL, - _("Connect to any server and/or Kad")); - } + + // Placeholder. Gets updated by ShowConnectionState + wndToolbar->AddTool(ID_BUTTONCONNECT, wxT("..."), m_tblist.GetBitmap(0)); + wndToolbar->AddSeparator(); wndToolbar->AddTool(ID_BUTTONNETWORKS, _("Networks"), m_tblist.GetBitmap(3), wxNullBitmap, wxITEM_CHECK, - _("Networks Window")); - wndToolbar->ToggleTool(ID_BUTTONNETWORKS, true); + _("Networks window")); wndToolbar->AddTool(ID_BUTTONSEARCH, _("Searches"), m_tblist.GetBitmap(5), wxNullBitmap, wxITEM_CHECK, - _("Searches Window")); + _("Searches window")); wndToolbar->AddTool(ID_BUTTONTRANSFER, _("Transfers"), m_tblist.GetBitmap(4), wxNullBitmap, wxITEM_CHECK, - _("Files Transfers Window")); + _("Files transfers window")); wndToolbar->AddTool(ID_BUTTONSHARED, - _("Shared Files"), m_tblist.GetBitmap(6), + _("Shared files"), m_tblist.GetBitmap(6), wxNullBitmap, wxITEM_CHECK, - _("Shared Files Window")); + _("Shared files window")); wndToolbar->AddTool(ID_BUTTONMESSAGES, _("Messages"), m_tblist.GetBitmap(7), wxNullBitmap, wxITEM_CHECK, - _("Messages Window")); + _("Messages window")); wndToolbar->AddTool(ID_BUTTONSTATISTICS, _("Statistics"), m_tblist.GetBitmap(8), wxNullBitmap, wxITEM_CHECK, - _("Statistics Graph Window")); + _("Statistics graph window")); wndToolbar->AddSeparator(); wndToolbar->AddTool(ID_BUTTONNEWPREFERENCES, _("Preferences"), m_tblist.GetBitmap(9), wxNullBitmap, wxITEM_NORMAL, - _("Preferences Settings Window")); + _("Preferences settings window")); wndToolbar->AddTool(ID_BUTTONIMPORT, _("Import"), m_tblist.GetBitmap(10), wxNullBitmap, wxITEM_NORMAL, @@ -1359,7 +1320,15 @@ _("About"), m_tblist.GetBitmap(11), wxNullBitmap, wxITEM_NORMAL, _("About/Help")); + + wndToolbar->ToggleTool(ID_BUTTONTRANSFER, true); + + // Needed for non-GTK platforms, where the + // items don't get added immediatly. wndToolbar->Realize(); + + // Updates the "Connect" button, and so on. + ShowConnectionState(true); } @@ -1368,19 +1337,35 @@ Freeze(); // Create ToolBar from the one designed by wxDesigner (BigBob) wxToolBar *current = GetToolBar(); + + wxASSERT(current == m_wndToolbar); + if (current) { - current->Destroy(); - SetToolBar(NULL); // Remove old one if present + bool oldorientation = ((current->GetWindowStyle() & wxTB_VERTICAL) == wxTB_VERTICAL); + if (oldorientation != orientation) { + current->Destroy(); + SetToolBar(NULL); // Remove old one if present + m_wndToolbar = NULL; + } else { + current->ClearTools(); + } } - m_wndToolbar = CreateToolBar( - (orientation ? wxTB_VERTICAL : wxTB_HORIZONTAL) | - wxNO_BORDER | wxTB_TEXT | wxTB_3DBUTTONS | - wxTB_FLAT | wxCLIP_CHILDREN | wxTB_NODIVIDER); - m_wndToolbar->SetToolBitmapSize(wxSize(32, 32)); + + if (!m_wndToolbar) { + m_wndToolbar = CreateToolBar( + (orientation ? wxTB_VERTICAL : wxTB_HORIZONTAL) | + wxNO_BORDER | wxTB_TEXT | wxTB_3DBUTTONS | + wxTB_FLAT | wxCLIP_CHILDREN | wxTB_NODIVIDER); + + + m_wndToolbar->SetToolBitmapSize(wxSize(32, 32)); + } + Apply_Toolbar_Skin(m_wndToolbar); -#ifdef CLIENT_GUI - m_wndToolbar->DeleteTool(ID_BUTTONIMPORT); -#endif + #ifdef CLIENT_GUI + m_wndToolbar->DeleteTool(ID_BUTTONIMPORT); + #endif + Thaw(); } @@ -1422,4 +1407,81 @@ Close(); } +void CamuleDlg::DoNetworkRearrange() +{ + + wxWindowUpdateLocker freezer(this); + + wxToolBarToolBase* toolbarTool = m_wndToolbar->RemoveTool(ID_BUTTONNETWORKS); + + wxNotebook* logs_notebook = CastChild( ID_SRVLOG_NOTEBOOK, wxNotebook); + wxNotebook* networks_notebook = CastChild( ID_NETNOTEBOOK, wxNotebook); + + while (logs_notebook->GetPageCount() > 1) { + logs_notebook->RemovePage(logs_notebook->GetPageCount() - 1); + } + + while (networks_notebook->GetPageCount() > 0) { + networks_notebook->RemovePage(networks_notebook->GetPageCount() - 1); + } + + if (thePrefs::GetNetworkED2K()) { + logs_notebook->AddPage(m_logpages[1].page, m_logpages[1].name); + logs_notebook->AddPage(m_logpages[2].page, m_logpages[2].name); + } + + m_networkpages[0].page->Show(thePrefs::GetNetworkED2K()); + + if (thePrefs::GetNetworkKademlia()) { + logs_notebook->AddPage(m_logpages[3].page, m_logpages[3].name); + } + + m_networkpages[1].page->Show(thePrefs::GetNetworkKademlia()); + + networks_notebook->Show(thePrefs::GetNetworkED2K() && thePrefs::GetNetworkKademlia()); + + wxWindow* replacement = NULL; + + m_networknotebooksizer->Clear(); + + if (thePrefs::GetNetworkED2K() && thePrefs::GetNetworkKademlia()) { + toolbarTool->SetLabel(_("Networks")); + + m_networkpages[0].page->Reparent(networks_notebook); + m_networkpages[1].page->Reparent(networks_notebook); + + networks_notebook->AddPage(m_networkpages[0].page, m_networkpages[0].name); + networks_notebook->AddPage(m_networkpages[1].page, m_networkpages[1].name); + + replacement = networks_notebook; + + } else if (thePrefs::GetNetworkED2K()) { + toolbarTool->SetLabel(_("eD2k network")); + replacement = m_networkpages[0].page; + m_networkpages[1].page->Reparent(m_networknotebooksizer->GetContainingWindow()); + } else if (thePrefs::GetNetworkKademlia()) { + toolbarTool->SetLabel(_("Kad network")); + m_networkpages[0].page->Reparent(m_networknotebooksizer->GetContainingWindow()); + replacement = m_networkpages[1].page; + } else { + // No networks. + toolbarTool->SetLabel(_("No network")); + } + + if (replacement) { + replacement->Reparent(m_networknotebooksizer->GetContainingWindow()); + m_networknotebooksizer->Add( replacement, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); + m_networknotebooksizer->Layout(); + } + + m_wndToolbar->InsertTool(2, toolbarTool); + + m_wndToolbar->EnableTool(ID_BUTTONNETWORKS, (thePrefs::GetNetworkED2K() || thePrefs::GetNetworkKademlia())); + m_wndToolbar->EnableTool(ID_BUTTONCONNECT, (thePrefs::GetNetworkED2K() || thePrefs::GetNetworkKademlia())); + + m_wndToolbar->Realize(); + + m_searchwnd->FixSearchTypes(); +} + // File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/amuleDlg.h amule-2.2.2/src/amuleDlg.h --- amule-2.2.0~svn20080218/src/amuleDlg.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/amuleDlg.h 2008-08-05 11:12:49.000000000 +0000 @@ -54,6 +54,10 @@ class CMuleTrayIcon; +struct PageType { + wxWindow* page; + wxString name; +}; #define MP_RESTORE 4001 #define MP_CONNECT 4002 @@ -114,7 +118,7 @@ void ResetLog(int id); void ShowUserCount(const wxString& info = wxEmptyString); - void ShowConnectionState(); + void ShowConnectionState(bool skinChanged = false); void ShowTransferRate(); bool StatisticsWindowActive() @@ -150,9 +154,8 @@ void OnClose(wxCloseEvent& evt); void OnBnConnect(wxCommandEvent& evt); - void Hide_aMule(bool iconize = true); - void Show_aMule(bool uniconize = true); - + void DoIconize(bool iconize); + bool SafeState() { return m_is_safe_state; } void LaunchUrl(const wxString &url); @@ -178,6 +181,8 @@ void SetMessageBlink(bool state) { m_BlinkMessages = state; } void Create_Toolbar(bool orientation); + void DoNetworkRearrange(); + #ifdef ENABLE_IP2COUNTRY CIP2Country* m_IP2Country; #endif @@ -206,7 +211,6 @@ #endif void OnMinimize(wxIconizeEvent& evt); void OnBnClickedFast(wxCommandEvent& evt); - void OnBnStatusText(wxCommandEvent& evt); void OnGUITimer(wxTimerEvent& evt); void OnMainGUISizeChange(wxSizeEvent& evt); void OnExit(wxCommandEvent& evt); @@ -230,9 +234,10 @@ wxZipEntry *entry; ZipCatalog cat; - bool LoadGUIPrefs( - bool override_pos, - bool override_size); + PageType m_logpages[4]; + PageType m_networkpages[2]; + + bool LoadGUIPrefs(bool override_pos, bool override_size); bool SaveGUIPrefs(); void UpdateTrayIcon(int percent); @@ -240,10 +245,7 @@ void Apply_Clients_Skin(); void Apply_Toolbar_Skin(wxToolBar *wndToolbar); bool Check_and_Init_Skin(); - void Add_Skin_Icon( - const wxString &iconName, - const wxBitmap &stdIcon, - bool useSkins); + void Add_Skin_Icon(const wxString &iconName, const wxBitmap &stdIcon, bool useSkins); void ToogleED2KLinksHandler(); void SetMessagesTool(); void OnKeyPressed(wxKeyEvent& evt); diff -ruN -d amule-2.2.0~svn20080218/src/amuled.cpp amule-2.2.2/src/amuled.cpp --- amule-2.2.0~svn20080218/src/amuled.cpp 2008-02-17 11:07:50.000000000 +0000 +++ amule-2.2.2/src/amuled.cpp 2008-05-23 23:11:22.000000000 +0000 @@ -28,9 +28,13 @@ #include #ifdef HAVE_CONFIG_H - #include "config.h" // Needed for HAVE_SYS_RESOURCE_H + #include "config.h" // Needed for HAVE_SYS_RESOURCE_H, HAVE_STRERROR_R and STRERROR_R_CHAR_P #endif +// Prefer the POSIX interface to strerror_r() +#define _XOPEN_SOURCE 600 +#include // Do_not_auto_remove + #include #include "Preferences.h" // Needed for CPreferences @@ -59,6 +63,53 @@ #include #endif +#ifndef HAVE_STRERROR_R + +// Replacement strerror_r() function for systems that don't have any. +// Note that this replacement function is NOT thread-safe! +static int rpl_strerror_r(int errnum, char *buf, size_t buflen) +{ + char *tmp = strerror(errnum); + if (tmp == NULL) { + errno = EINVAL; + return -1; + } else { + strncpy(buf, tmp, buflen - 1); + buf[buflen - 1] = '\0'; + if (strlen(tmp) >= buflen) { + errno = ERANGE; + return -1; + } + } + return 0; +} + +# define strerror_r(errnum, buf, buflen) rpl_strerror_r(errnum, buf, buflen) +#else +# ifdef STRERROR_R_CHAR_P + +// Replacement strerror_r() function for systems that return a char*. +static int rpl_strerror_r(int errnum, char *buf, size_t buflen) +{ + char *tmp = strerror_r(errnum, buf, buflen); + if (tmp == NULL) { + errno = EINVAL; + return -1; + } else if (tmp != buf) { + strncpy(buf, tmp, buflen - 1); + buf[buflen - 1] = '\0'; + if (strlen(tmp) >= buflen) { + errno = ERANGE; + return -1; + } + } + return 0; +} + +# define strerror_r(errnum, buf, buflen) rpl_strerror_r(errnum, buf, buflen) +# endif +#endif + BEGIN_EVENT_TABLE(CamuleDaemonApp, wxAppConsole) // // Socket handlers @@ -97,6 +148,9 @@ // HTTPDownload finished EVT_MULE_INTERNAL(wxEVT_CORE_FINISHED_HTTP_DOWNLOAD, -1, CamuleDaemonApp::OnFinishedHTTPDownload) + + // Disk space preallocation finished + EVT_MULE_ALLOC_FINISHED(CamuleDaemonApp::OnFinishedAllocation) END_EVENT_TABLE() IMPLEMENT_APP(CamuleDaemonApp) diff -ruN -d amule-2.2.0~svn20080218/src/extern/upnp/ixml.h amule-2.2.2/src/extern/upnp/ixml.h --- amule-2.2.0~svn20080218/src/extern/upnp/ixml.h 2008-01-14 13:23:46.000000000 +0000 +++ amule-2.2.2/src/extern/upnp/ixml.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2000-2003 Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither name of Intel Corporation nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -// Modified by Angel Vidal Veiga (kry@amule.org) for the aMule project. -// Really crippled version of the original header. Keep just what we need. - -#ifndef _IXML_H_ -#define _IXML_H_ - -typedef int BOOL; - -#define DOMString char * - -#ifndef IN -#define IN -#endif - -/**@name DOM Interfaces - * The Document Object Model consists of a set of objects and interfaces - * for accessing and manipulating documents. IXML does not implement all - * the interfaces documented in the DOM2-Core recommendation but defines - * a subset of the most useful interfaces. A description of the supported - * interfaces and methods is presented in this section. - * - * For a complete discussion on the object model, the object hierarchy, - * etc., refer to section 1.1 of the DOM2-Core recommendation. - */ - -//@{ - - -/*================================================================ -* -* DOM node type -* -* -*=================================================================*/ -typedef enum -{ - eINVALID_NODE = 0, - eELEMENT_NODE = 1, - eATTRIBUTE_NODE = 2, - eTEXT_NODE = 3, - eCDATA_SECTION_NODE = 4, - eENTITY_REFERENCE_NODE = 5, - eENTITY_NODE = 6, - ePROCESSING_INSTRUCTION_NODE = 7, - eCOMMENT_NODE = 8, - eDOCUMENT_NODE = 9, - eDOCUMENT_TYPE_NODE = 10, - eDOCUMENT_FRAGMENT_NODE = 11, - eNOTATION_NODE = 12 - -} IXML_NODE_TYPE; - -/*================================================================ -* -* DOM data structures -* -* -*=================================================================*/ - -typedef struct _IXML_Document *Docptr; - -typedef struct _IXML_Node *Nodeptr; - -typedef struct _IXML_Node -{ - DOMString nodeName; - DOMString nodeValue; - IXML_NODE_TYPE nodeType; - DOMString namespaceURI; - DOMString prefix; - DOMString localName; - BOOL readOnly; - - Nodeptr parentNode; - Nodeptr firstChild; - Nodeptr prevSibling; - Nodeptr nextSibling; - Nodeptr firstAttr; - Docptr ownerDocument; - -} IXML_Node; - -typedef struct _IXML_Document -{ - IXML_Node n; -} IXML_Document; - -typedef struct _IXML_Element -{ - IXML_Node n; - DOMString tagName; - -} IXML_Element; - -typedef struct _IXML_NamedNodeMap -{ - IXML_Node *nodeItem; - struct _IXML_NamedNodeMap *next; -} IXML_NamedNodeMap; - -//@} - -#endif // _IXML_H_ -// File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/extern/upnp/upnp.h amule-2.2.2/src/extern/upnp/upnp.h --- amule-2.2.0~svn20080218/src/extern/upnp/upnp.h 2007-12-18 19:30:25.000000000 +0000 +++ amule-2.2.2/src/extern/upnp/upnp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,351 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2000-2003 Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither name of Intel Corporation nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -// Modified by Angel Vidal Veiga (kry@amule.org) for the aMule project. -// Really crippled version of the original header. Keep just what we need. - -#ifndef UPNP_H -#define UPNP_H - -#include "ixml.h" - -#ifndef __WIN32__ -#include -#else -#include -#endif - -#define LINE_SIZE 180 -#define NAME_SIZE 256 - -/// @name Constants, Structures, and Types -//@{ - -/** @name UPNP_E_SUCCESS [0] - * {\tt UPNP_E_SUCCESS} signifies that the operation completed successfully. - * For asynchronous functions, this only means that the packet generated by - * the operation was successfully transmitted on the network. The result of - * the entire operation comes as part of the callback for that operation. - */ -//@{ -#define UPNP_E_SUCCESS 0 -//@} - -/** Returned when a control point application registers with {\bf - * UpnpRegisterClient}. Client handles can only be used with - * functions that operate with a client handle. */ - -typedef int UpnpClient_Handle; - -/** @name UPnP_EventType - @memo The reason code for an event callback. - @doc The {\bf Event} parameter will be different depending on the - reason for the callback. The descriptions for each event - type describe the contents of the {\bf Event} parameter. - */ - -enum Upnp_EventType_e { - - // - // Control callbacks - // - - /** Received by a device when a control point issues a control - * request. The {\bf Event} parameter contains a pointer to a {\bf - * Upnp_Action_Request} structure containing the action. The application - * stores the results of the action in this structure. */ - - UPNP_CONTROL_ACTION_REQUEST, - - /** A {\bf UpnpSendActionAsync} call completed. The {\bf Event} - * parameter contains a pointer to a {\bf Upnp_Action_Complete} structure - * with the results of the action. */ - - UPNP_CONTROL_ACTION_COMPLETE, - - /** Received by a device when a query for a single service variable - * arrives. The {\bf Event} parameter contains a pointer to a {\bf - * Upnp_State_Var_Request} structure containing the name of the variable - * and value. */ - - UPNP_CONTROL_GET_VAR_REQUEST, - - /** A {\bf UpnpGetServiceVarStatus} call completed. The {\bf Event} - * parameter contains a pointer to a {\bf Upnp_State_Var_Complete} structure - * containing the value for the variable. */ - - UPNP_CONTROL_GET_VAR_COMPLETE, - - // - // Discovery callbacks - // - - /** Received by a control point when a new device or service is available. - * The {\bf Event} parameter contains a pointer to a {\bf - * Upnp_Discovery} structure with the information about the device - * or service. */ - - UPNP_DISCOVERY_ADVERTISEMENT_ALIVE, - - /** Received by a control point when a device or service shuts down. The {\bf - * Event} parameter contains a pointer to a {\bf Upnp_Discovery} - * structure containing the information about the device or - * service. */ - - UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE, - - /** Received by a control point when a matching device or service responds. - * The {\bf Event} parameter contains a pointer to a {\bf - * Upnp_Discovery} structure containing the information about - * the reply to the search request. */ - - UPNP_DISCOVERY_SEARCH_RESULT, - - /** Received by a control point when the search timeout expires. The - * SDK generates no more callbacks for this search after this - * event. The {\bf Event} parameter is {\tt NULL}. */ - - UPNP_DISCOVERY_SEARCH_TIMEOUT, - - // - // Eventing callbacks - // - - /** Received by a device when a subscription arrives. - * The {\bf Event} parameter contains a pointer to a {\bf - * Upnp_Subscription_Request} structure. At this point, the - * subscription has already been accepted. {\bf UpnpAcceptSubscription} - * needs to be called to confirm the subscription and transmit the - * initial state table. This can be done during this callback. The SDK - * generates no events for a subscription unless the device - * application calls {\bf UpnpAcceptSubscription}. - */ - - UPNP_EVENT_SUBSCRIPTION_REQUEST, - - /** Received by a control point when an event arrives. The {\bf - * Event} parameter contains a {\bf Upnp_Event} structure - * with the information about the event. */ - - UPNP_EVENT_RECEIVED, - - /** A {\bf UpnpRenewSubscriptionAsync} call completed. The status of - * the renewal is in the {\bf Event} parameter as a {\bf - * Upnp_Event_Subscription} structure. */ - - UPNP_EVENT_RENEWAL_COMPLETE, - - /** A {\bf UpnpSubscribeAsync} call completed. The status of the - * subscription is in the {\bf Event} parameter as a {\bf - * Upnp_Event_Subscription} structure. */ - - UPNP_EVENT_SUBSCRIBE_COMPLETE, - - /** A {\bf UpnpUnSubscribeAsync} call completed. The status of the - * subscription is in the {\bf Event} parameter as a {\bf - * Upnp_Event_Subscribe} structure. */ - - UPNP_EVENT_UNSUBSCRIBE_COMPLETE, - - /** The auto-renewal of a client subscription failed. - * The {\bf Event} parameter is a {\bf Upnp_Event_Subscribe} structure - * with the error code set appropriately. The subscription is no longer - * valid. */ - - UPNP_EVENT_AUTORENEWAL_FAILED, - - /** A client subscription has expired. This will only occur - * if auto-renewal of subscriptions is disabled. - * The {\bf Event} parameter is a {\bf Upnp_Event_Subscribe} - * structure. The subscription is no longer valid. */ - - UPNP_EVENT_SUBSCRIPTION_EXPIRED - -}; - -typedef enum Upnp_EventType_e Upnp_EventType; - -/** The {\bf Upnp_SID} holds the subscription identifier for a subscription - between a client and a device. The SID is a string representation of - a globally unique id (GUID) and should not be modified. - */ - -typedef char Upnp_SID[44]; - -/** All callback functions share the same prototype, documented below. - * Note that any memory passed to the callback function - * is valid only during the callback and should be copied if it - * needs to persist. This callback function needs to be thread - * safe. The context of the callback is always on a valid thread - * context and standard synchronization methods can be used. Note, - * however, because of this the callback cannot call SDK functions - * unless explicitly noted. - * - * \begin{verbatim} - int CallbackFxn( Upnp_EventType EventType, void* Event, void* Cookie ); - \end{verbatim} - * - * where {\bf EventType} is the event that triggered the callback, - * {\bf Event} is a structure that denotes event-specific information for that - * event, and {\bf Cookie} is the user data passed when the callback was - * registered. - * - * See {\bf Upnp_EventType} for more information on the callback values and - * the associated {\bf Event} parameter. - * - * The return value of the callback is currently ignored. It may be used - * in the future to communicate results back to the SDK. - */ - -typedef int (*Upnp_FunPtr) ( - IN Upnp_EventType EventType, - IN void *Event, - IN void *Cookie - ); - -// -// This typedef is required by Doc++ to parse the last entry of the -// Upnp_Discovery structure correctly. -// - -struct Upnp_Discovery -{ - /** The result code of the {\bf UpnpSearchAsync} call. */ - int ErrCode; - - /** The expiration time of the advertisement. */ - int Expires; - - /** The unique device identifier. */ - char DeviceId[LINE_SIZE]; - - /** The device type. */ - char DeviceType[LINE_SIZE]; - - /** The service type. */ - char ServiceType[LINE_SIZE]; - - /** The service version. */ - char ServiceVer[LINE_SIZE]; - - /** The URL to the UPnP description document for the device. */ - char Location[LINE_SIZE]; - - /** The operating system the device is running. */ - char Os[LINE_SIZE]; - - /** Date when the response was generated. */ - char Date[LINE_SIZE]; - - /** Confirmation that the MAN header was understood by the device. */ - char Ext[LINE_SIZE]; - - /** The host address of the device responding to the search. */ - struct sockaddr_in DestAddr; -}; - -struct Upnp_Action_Complete -{ - /** The result of the operation. */ - int ErrCode; - - /** The control URL for service. */ - char CtrlUrl[NAME_SIZE]; - - /** The DOM document describing the action. */ - IXML_Document *ActionRequest; - - /** The DOM document describing the result of the action. */ - IXML_Document *ActionResult; -}; - -/** Represents the reply for the current value of a state variable in an - asynchronous call. */ - -struct Upnp_State_Var_Complete -{ - /** The result of the operation. */ - int ErrCode; - - /** The control URL for the service. */ - char CtrlUrl[NAME_SIZE]; - - /** The name of the variable. */ - char StateVarName[NAME_SIZE]; - - /** The current value of the variable or error string in case of error. */ - DOMString CurrentVal; -}; - -/** Returned along with a {\bf UPNP_EVENT_RECEIVED} callback. */ - -struct Upnp_Event -{ - /** The subscription ID for this subscription. */ - Upnp_SID Sid; - - /** The event sequence number. */ - int EventKey; - - /** The DOM tree representing the changes generating the event. */ - IXML_Document *ChangedVariables; - -}; - -/** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or {\bf - * UPNP_EVENT_UNSUBSCRIBE_COMPLETE} callback. */ - -struct Upnp_Event_Subscribe { - - /** The SID for this subscription. For subscriptions, this only - * contains a valid SID if the {\bf Upnp_EventSubscribe.result} field - * contains a {\tt UPNP_E_SUCCESS} result code. For unsubscriptions, - * this contains the SID from which the subscription is being - * unsubscribed. */ - - Upnp_SID Sid; - - /** The result of the operation. */ - int ErrCode; - - /** The event URL being subscribed to or removed from. */ - char PublisherUrl[NAME_SIZE]; - - /** The actual subscription time (for subscriptions only). */ - int TimeOut; - -}; - -//@} // Constants, Structures, and Types - -#endif - -// File_checked_for_headers diff -ruN -d amule-2.2.0~svn20080218/src/extern/wxWidgets/listctrl.cpp amule-2.2.2/src/extern/wxWidgets/listctrl.cpp --- amule-2.2.0~svn20080218/src/extern/wxWidgets/listctrl.cpp 2008-01-31 22:49:40.000000000 +0000 +++ amule-2.2.2/src/extern/wxWidgets/listctrl.cpp 2008-04-01 18:41:23.000000000 +0000 @@ -3,7 +3,7 @@ // Purpose: generic implementation of wxListCtrl // Author: Robert Roebling // Vadim Zeitlin (virtual list control support) -// Id: $Id: listctrl.cpp 8038 2008-01-31 22:49:40Z xaignar $ +// Id: $Id: listctrl.cpp 8318 2008-04-01 18:41:23Z gonosztopi $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -235,7 +235,7 @@ // wxListLineData (internal) //----------------------------------------------------------------------------- -WX_DECLARE_EXPORTED_LIST(wxListItemData, wxListItemDataList); +WX_DECLARE_LIST(wxListItemData, wxListItemDataList); #include WX_DEFINE_LIST(wxListItemDataList) @@ -367,7 +367,7 @@ int width); }; -WX_DECLARE_EXPORTED_OBJARRAY(wxListLineData, wxListLineDataArray); +WX_DECLARE_OBJARRAY(wxListLineData, wxListLineDataArray); #include WX_DEFINE_OBJARRAY(wxListLineDataArray) @@ -480,7 +480,7 @@ // wxListMainWindow (internal) //----------------------------------------------------------------------------- -WX_DECLARE_EXPORTED_LIST(wxListHeaderData, wxListHeaderDataList); +WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList); #include WX_DEFINE_LIST(wxListHeaderDataList) @@ -1572,6 +1572,14 @@ int xOld = x; x += width; + // Fix for a bug in wxWidgets. + // This has been reported as patch 1898914: + // http://sourceforge.net/tracker/index.php?func=detail&aid=1898914&group_id=9863&atid=309863 + // + // Prevents the drawing of images into the + // next collumn, in case of small widths. + wxDCClipper clipper(*dc, xOld, rect.y, width - 8, rect.height); + if ( item->HasImage() ) { int ix, iy; @@ -2713,10 +2721,27 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { + // wxBufferedPaintDC falls over in the case of dimensions that + // are zero, as cann happen when a splitter is moved so that + // the entire window is hidden (e.g. on the transfers window). + // + // This has been reported as patch #1899643: + // http://sourceforge.net/tracker/index.php?func=detail&aid=1899643&group_id=9863&atid=309863 + wxSize size = GetClientSize(); + if ((size.x <= 0) || (size.y <= 0)) { + wxPaintDC dc(this); + return; + } + // Note: a wxPaintDC must be constructed even if no drawing is // done (a Windows requirement). wxBufferedPaintDC dc( this ); + // Ensure an uniform background color, as to avoid differences between + // the automatically cleared parts and the rest of the canvas. + dc.SetBackground(*(wxTheBrushList->FindOrCreateBrush( + wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX), wxSOLID))); + if ( m_freezeCount ) return; diff -ruN -d amule-2.2.0~svn20080218/src/extern/wxWidgets/listctrl.h amule-2.2.2/src/extern/wxWidgets/listctrl.h --- amule-2.2.0~svn20080218/src/extern/wxWidgets/listctrl.h 2008-01-04 12:53:45.000000000 +0000 +++ amule-2.2.2/src/extern/wxWidgets/listctrl.h 2008-04-01 18:41:23.000000000 +0000 @@ -3,7 +3,7 @@ // Purpose: Generic list control // Author: Robert Roebling // Created: 01/02/97 -// RCS-ID: $Id: listctrl.h 7897 2008-01-04 12:53:45Z xaignar $ +// RCS-ID: $Id: listctrl.h 8318 2008-04-01 18:41:23Z gonosztopi $ // Copyright: (c) 1998 Robert Roebling and Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -32,20 +32,20 @@ // constants // ---------------------------------------------------------------------------- -extern WXDLLEXPORT_DATA(const wxChar) wxListCtrlNameStr[]; +extern const wxChar wxListCtrlNameStr[]; //----------------------------------------------------------------------------- // internal classes //----------------------------------------------------------------------------- -class WXDLLEXPORT wxListHeaderWindow; -class WXDLLEXPORT wxListMainWindow; +class wxListHeaderWindow; +class wxListMainWindow; //----------------------------------------------------------------------------- // wxListCtrl //----------------------------------------------------------------------------- -class WXDLLEXPORT wxGenericListCtrl: public wxControl +class wxGenericListCtrl: public wxControl { public: @@ -254,7 +254,7 @@ virtual wxListItemAttr *OnGetItemAttr(long item) const; // it calls our OnGetXXX() functions - friend class WXDLLEXPORT wxListMainWindow; + friend class wxListMainWindow; private: // create the header window @@ -276,7 +276,7 @@ * the run-time information. */ -class WXDLLEXPORT wxListCtrl: public wxGenericListCtrl +class wxListCtrl: public wxGenericListCtrl { public: wxListCtrl() {} diff -ruN -d amule-2.2.0~svn20080218/src/include/common/ClientVersion.h amule-2.2.2/src/include/common/ClientVersion.h --- amule-2.2.0~svn20080218/src/include/common/ClientVersion.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/common/ClientVersion.h 2008-08-08 13:28:47.000000000 +0000 @@ -44,10 +44,9 @@ // RELEASERS: REMOVE THE DEFINE ON THE RELEASES, PLEASE // AND FIX THE MOD_VERSION_LONG -#define __SVN__ #ifndef VERSION - #define VERSION "2.2.0" + #define VERSION "2.2.2" #endif #ifdef __SVN__ @@ -58,7 +57,7 @@ #define VERSION_MJR 2 #define VERSION_MIN 2 -#define VERSION_UPDATE 0 +#define VERSION_UPDATE 2 #ifndef PACKAGE #define PACKAGE "amule" diff -ruN -d amule-2.2.0~svn20080218/src/include/protocol/ed2k/Client2Client/TCP.h amule-2.2.2/src/include/protocol/ed2k/Client2Client/TCP.h --- amule-2.2.0~svn20080218/src/include/protocol/ed2k/Client2Client/TCP.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/protocol/ed2k/Client2Client/TCP.h 2008-05-08 12:18:02.000000000 +0000 @@ -96,7 +96,9 @@ OP_COMPRESSEDPART_I64 = 0xA1, // OP_SENDINGPART_I64 = 0xA2, // OP_REQUESTPARTS_I64 = 0xA3, // - OP_MULTIPACKET_EXT = 0xA4 + OP_MULTIPACKET_EXT = 0xA4, +// OP_CHATCAPTCHAREQ = 0xA5, // Unused on aMule - no Captcha +// OP_CHATCAPTCHARES = 0xA6, // Unused on aMule - no Captcha }; #endif // ED2KC2CTCP_H diff -ruN -d amule-2.2.0~svn20080218/src/include/protocol/ed2k/Client2Server/UDP.h amule-2.2.2/src/include/protocol/ed2k/Client2Server/UDP.h --- amule-2.2.0~svn20080218/src/include/protocol/ed2k/Client2Server/UDP.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/protocol/ed2k/Client2Server/UDP.h 2008-05-11 15:38:09.000000000 +0000 @@ -27,6 +27,8 @@ #define ED2KC2SUDP_H enum OP_ClientToServerUDP { + OP_GLOBSEARCHREQ3 = 0x90, // <1 tag set> + OP_GLOBSEARCHREQ2 = 0x92, // OP_GLOBGETSOURCES2 = 0x94, // // largefiles only: (17.8) OP_GLOBSERVSTATREQ = 0x96, // (null) @@ -45,12 +47,12 @@ }; // Server UDP flags -#define SRV_UDPFLG_EXT_GETSOURCES 0x00000001 -#define SRV_UDPFLG_EXT_GETFILES 0x00000002 -#define SRV_UDPFLG_NEWTAGS 0x00000008 -#define SRV_UDPFLG_UNICODE 0x00000010 -#define SRV_UDPFLG_EXT_GETSOURCES2 0x00000020 -#define SRV_UDPFLG_LARGEFILES 0x00000100 +#define SRV_UDPFLG_EXT_GETSOURCES 0x00000001 +#define SRV_UDPFLG_EXT_GETFILES 0x00000002 +#define SRV_UDPFLG_NEWTAGS 0x00000008 +#define SRV_UDPFLG_UNICODE 0x00000010 +#define SRV_UDPFLG_EXT_GETSOURCES2 0x00000020 +#define SRV_UDPFLG_LARGEFILES 0x00000100 #define SRV_UDPFLG_UDPOBFUSCATION 0x00000200 #define SRV_UDPFLG_TCPOBFUSCATION 0x00000400 diff -ruN -d amule-2.2.0~svn20080218/src/include/protocol/kad/Client2Client/UDP.h amule-2.2.2/src/include/protocol/kad/Client2Client/UDP.h --- amule-2.2.0~svn20080218/src/include/protocol/kad/Client2Client/UDP.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/protocol/kad/Client2Client/UDP.h 2008-04-14 16:00:35.000000000 +0000 @@ -27,35 +27,35 @@ #define KADC2CUDP_H enum KademliaV1OPcodes { - KADEMLIA_BOOTSTRAP_REQ = 0x00, // - KADEMLIA_BOOTSTRAP_RES = 0x08, // *(CNT) + KADEMLIA_BOOTSTRAP_REQ = 0x00, // + KADEMLIA_BOOTSTRAP_RES = 0x08, // *(CNT) - KADEMLIA_HELLO_REQ = 0x10, // - KADEMLIA_HELLO_RES = 0x18, // + KADEMLIA_HELLO_REQ = 0x10, // + KADEMLIA_HELLO_RES = 0x18, // - KADEMLIA_REQ = 0x20, // + KADEMLIA_REQ = 0x20, // KADEMLIA_RES = 0x28, // *(CNT) KADEMLIA_SEARCH_REQ = 0x30, // [ext] // UNUSED = 0x31, // Old Opcode, don't use. - KADEMLIA_SRC_NOTES_REQ = 0x32, // + KADEMLIA_SEARCH_NOTES_REQ = 0x32, // KADEMLIA_SEARCH_RES = 0x38, // ( *(CNT2))*(CNT1) // UNUSED = 0x39, // Old Opcode, don't use. - KADEMLIA_SRC_NOTES_RES = 0x3A, // ( *(CNT2))*(CNT1) + KADEMLIA_SEARCH_NOTES_RES = 0x3A, // ( *(CNT2))*(CNT1) - KADEMLIA_PUBLISH_REQ = 0x40, // ( *(CNT2))*(CNT1) + KADEMLIA_PUBLISH_REQ = 0x40, // ( *(CNT2))*(CNT1) // UNUSED = 0x41, // Old Opcode, don't use. - KADEMLIA_PUB_NOTES_REQ = 0x42, // *(CNT2))*(CNT1) - KADEMLIA_PUBLISH_RES = 0x48, // + KADEMLIA_PUBLISH_NOTES_REQ = 0x42, // *(CNT2))*(CNT1) + KADEMLIA_PUBLISH_RES = 0x48, // // UNUSED = 0x49, // Old Opcode, don't use. - KADEMLIA_PUB_NOTES_RES = 0x4A, // + KADEMLIA_PUBLISH_NOTES_RES = 0x4A, // - KADEMLIA_FIREWALLED_REQ = 0x50, // - KADEMLIA_FINDBUDDY_REQ = 0x51, // - KADEMLIA_CALLBACK_REQ = 0x52, // - KADEMLIA_FIREWALLED_RES = 0x58, // - KADEMLIA_FIREWALLED_ACK = 0x59, // (null) - KADEMLIA_FINDBUDDY_RES = 0x5A // + KADEMLIA_FIREWALLED_REQ = 0x50, // + KADEMLIA_FINDBUDDY_REQ = 0x51, // + KADEMLIA_CALLBACK_REQ = 0x52, // + KADEMLIA_FIREWALLED_RES = 0x58, // + KADEMLIA_FIREWALLED_ACK_RES = 0x59, // (null) + KADEMLIA_FINDBUDDY_RES = 0x5A // }; #endif // KADC2CUDP_H diff -ruN -d amule-2.2.0~svn20080218/src/include/protocol/kad/Constants.h amule-2.2.2/src/include/protocol/kad/Constants.h --- amule-2.2.0~svn20080218/src/include/protocol/kad/Constants.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/protocol/kad/Constants.h 2008-05-08 12:18:02.000000000 +0000 @@ -26,30 +26,26 @@ #ifndef KADCONSTANTS_H #define KADCONSTANTS_H -// Kad search expression comparison operators -enum kad_search_compare { - KAD_SEARCH_OP_GREATER_EQUAL = 1, // eMule 0.40+; NOTE: this different than ED2K! - KAD_SEARCH_OP_LESS_EQUAL // eMule 0.40+; NOTE: this different than ED2K! -}; +#include // MOD Note: Do not change this part - Merkur #define KADEMLIAASKTIME SEC2MS(1) //1 second -#define KADEMLIATOTALFILE 7 //Total files to search sources for. +#define KADEMLIATOTALFILE 5 //Total files to search sources for. #define KADEMLIAREASKTIME HR2MS(1) //1 hour #define KADEMLIAPUBLISHTIME SEC(2) //2 second -#define KADEMLIATOTALSTORENOTES 1 //Total hashes to store. -#define KADEMLIATOTALSTORESRC 2 //Total hashes to store. -#define KADEMLIATOTALSTOREKEY 1 //Total hashes to store. -#define KADEMLIAREPUBLISHTIMES HR2S(5) //5 hours -#define KADEMLIAREPUBLISHTIMEN HR2S(24) //24 hours -#define KADEMLIAREPUBLISHTIMEK HR2S(24) //24 hours -#define KADEMLIADISCONNECTDELAY MIN2S(20) //20 mins +#define KADEMLIATOTALSTORENOTES 1 //Total hashes to store. +#define KADEMLIATOTALSTORESRC 3 //Total hashes to store. +#define KADEMLIATOTALSTOREKEY 2 //Total hashes to store. +#define KADEMLIAREPUBLISHTIMES HR2S(5) //5 hours +#define KADEMLIAREPUBLISHTIMEN HR2S(24) //24 hours +#define KADEMLIAREPUBLISHTIMEK HR2S(24) //24 hours +#define KADEMLIADISCONNECTDELAY MIN2S(20) //20 mins #define KADEMLIAMAXINDEX 50000 //Total keyword indexes. #define KADEMLIAMAXENTRIES 60000 //Total keyword entries. -#define KADEMLIAMAXSOUCEPERFILE 300 //Max number of sources per file in index. -#define KADEMLIAMAXNOTESPERFILE 50 //Max number of notes per entry in index. -#define KADEMLIABUDDYTIMEOUT MIN2MS(10) // 10 min to receive the buddy +#define KADEMLIAMAXSOURCEPERFILE 1000 //Max number of sources per file in index. +#define KADEMLIAMAXNOTESPERFILE 150 //Max number of notes per entry in index. +#define KADEMLIAFIREWALLCHECKS 4 //Firewallcheck Request at a time // MOD Note: end // Kad parameters diff -ruN -d amule-2.2.0~svn20080218/src/include/protocol/kad2/Client2Client/TCP.h amule-2.2.2/src/include/protocol/kad2/Client2Client/TCP.h --- amule-2.2.0~svn20080218/src/include/protocol/kad2/Client2Client/TCP.h 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/src/include/protocol/kad2/Client2Client/TCP.h 2008-05-08 12:18:02.000000000 +0000 @@ -0,0 +1,34 @@ +// +// This file is part of the aMule Project. +// +// Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +// Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net ) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + +#ifndef KAD2_C2C_TCP_H +#define KAD2_C2C_TCP_H + +enum Ed2kTCPOpcodesForKademliaV2 { + OP_FWCHECKUDPREQ = 0xA7, // *Support required for Kadversion >= 6 + OP_KAD_FWTCPCHECK_ACK = 0xA8 // (null/reserved), replaces KADEMLIA_FIREWALLED_ACK_RES, *Support required for Kadversion >= 7 +}; + +#endif // KAD2_C2C_TCP_H diff -ruN -d amule-2.2.0~svn20080218/src/include/protocol/kad2/Client2Client/UDP.h amule-2.2.2/src/include/protocol/kad2/Client2Client/UDP.h --- amule-2.2.0~svn20080218/src/include/protocol/kad2/Client2Client/UDP.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/protocol/kad2/Client2Client/UDP.h 2008-08-04 08:56:52.000000000 +0000 @@ -26,20 +26,31 @@ #ifndef KAD2C2CUDP_H #define KAD2C2CUDP_H -enum KademliaV2OPCodes { - KADEMLIA2_BOOTSTRAP_REQ = 0x01, - KADEMLIA2_BOOTSTRAP_RES = 0x09, - KADEMLIA2_HELLO_REQ = 0x11, - KADEMLIA2_HELLO_RES = 0x19, - KADEMLIA2_REQ = 0x21, - KADEMLIA2_RES = 0x29, - KADEMLIA2_SEARCH_KEY_REQ = 0x33, - KADEMLIA2_SEARCH_NOTES_REQ = 0x35, - KADEMLIA2_SEARCH_RES = 0x3B, - KADEMLIA2_PUBLISH_KEY_REQ = 0x43, - KADEMLIA2_PUBLISH_SOURCE_REQ = 0x44, - KADEMLIA2_PUBLISH_NOTES_REQ = 0x45, - KADEMLIA2_PUBLISH_RES = 0x4B +enum Ed2kUDPOpcodesForKademliaV2 { + OP_DIRECTCALLBACKREQ = 0x95 // +}; + +enum Kademlia2Opcodes { + KADEMLIA2_BOOTSTRAP_REQ = 0x01, + KADEMLIA2_BOOTSTRAP_RES = 0x09, + KADEMLIA2_HELLO_REQ = 0x11, + KADEMLIA2_HELLO_RES = 0x19, + KADEMLIA2_REQ = 0x21, + KADEMLIA2_HELLO_RES_ACK = 0x22, // + KADEMLIA2_RES = 0x29, + KADEMLIA2_SEARCH_KEY_REQ = 0x33, + KADEMLIA2_SEARCH_SOURCE_REQ = 0x34, + KADEMLIA2_SEARCH_NOTES_REQ = 0x35, + KADEMLIA2_SEARCH_RES = 0x3B, + KADEMLIA2_PUBLISH_KEY_REQ = 0x43, + KADEMLIA2_PUBLISH_SOURCE_REQ = 0x44, + KADEMLIA2_PUBLISH_NOTES_REQ = 0x45, + KADEMLIA2_PUBLISH_RES = 0x4B, + KADEMLIA2_PUBLISH_RES_ACK = 0x4C, // (null) + KADEMLIA_FIREWALLED2_REQ = 0x53, // + KADEMLIA2_PING = 0x60, // (null) + KADEMLIA2_PONG = 0x61, // (null) + KADEMLIA2_FIREWALLUDP = 0x62 // }; #endif // KAD2C2CUDP_H diff -ruN -d amule-2.2.0~svn20080218/src/include/protocol/kad2/Constants.h amule-2.2.2/src/include/protocol/kad2/Constants.h --- amule-2.2.0~svn20080218/src/include/protocol/kad2/Constants.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/protocol/kad2/Constants.h 2008-07-28 15:41:53.000000000 +0000 @@ -26,4 +26,6 @@ #ifndef KAD2CONSTANTS_H #define KAD2CONSTANTS_H +#define KADEMLIA_VERSION 0x08 /* 0.49b */ + #endif // KAD2CONSTANTS_H diff -ruN -d amule-2.2.0~svn20080218/src/include/tags/ClientTags.h amule-2.2.2/src/include/tags/ClientTags.h --- amule-2.2.0~svn20080218/src/include/tags/ClientTags.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/tags/ClientTags.h 2008-05-11 15:38:09.000000000 +0000 @@ -27,42 +27,69 @@ #define CLIENTTAGS_H enum client_tags { - CT_NAME = 0x01, - CT_PORT = 0x0F, - CT_VERSION = 0x11, - CT_SERVER_FLAGS = 0x20, // currently only used to inform a server about supported features - CT_EMULECOMPAT_OPTIONS = 0xEF, - CT_EMULE_RESERVED1 = 0xF0, - CT_EMULE_RESERVED2 = 0xF1, - CT_EMULE_RESERVED3 = 0xF2, - CT_EMULE_RESERVED4 = 0xF3, - CT_EMULE_RESERVED5 = 0xF4, - CT_EMULE_RESERVED6 = 0xF5, - CT_EMULE_RESERVED7 = 0xF6, - CT_EMULE_RESERVED8 = 0xF7, - CT_EMULE_RESERVED9 = 0xF8, - CT_EMULE_UDPPORTS = 0xF9, - CT_EMULE_MISCOPTIONS1 = 0xFA, - CT_EMULE_VERSION = 0xFB, - CT_EMULE_BUDDYIP = 0xFC, - CT_EMULE_BUDDYUDP = 0xFD, - CT_EMULE_MISCOPTIONS2 = 0xFE, - CT_EMULE_RESERVED13 = 0xFF + CT_NAME = 0x01, + CT_SERVER_UDPSEARCH_FLAGS = 0x0E, + CT_PORT = 0x0F, + CT_VERSION = 0x11, + CT_SERVER_FLAGS = 0x20, // currently only used to inform a server about supported features + CT_EMULECOMPAT_OPTIONS = 0xEF, + CT_EMULE_RESERVED1 = 0xF0, + CT_EMULE_RESERVED2 = 0xF1, + CT_EMULE_RESERVED3 = 0xF2, + CT_EMULE_RESERVED4 = 0xF3, + CT_EMULE_RESERVED5 = 0xF4, + CT_EMULE_RESERVED6 = 0xF5, + CT_EMULE_RESERVED7 = 0xF6, + CT_EMULE_RESERVED8 = 0xF7, + CT_EMULE_RESERVED9 = 0xF8, + CT_EMULE_UDPPORTS = 0xF9, + CT_EMULE_MISCOPTIONS1 = 0xFA, + CT_EMULE_VERSION = 0xFB, + CT_EMULE_BUDDYIP = 0xFC, + CT_EMULE_BUDDYUDP = 0xFD, + CT_EMULE_MISCOPTIONS2 = 0xFE, + CT_EMULE_RESERVED13 = 0xFF }; // Old MuleInfo tags enum MuleInfo_tags { - ET_COMPRESSION = 0x20u, - ET_UDPPORT = 0x21u, - ET_UDPVER = 0x22u, - ET_SOURCEEXCHANGE = 0x23u, - ET_COMMENTS = 0x24u, - ET_EXTENDEDREQUEST = 0x25u, - ET_COMPATIBLECLIENT = 0x26u, - ET_FEATURES = 0x27u, //! bit 0: SecIdent v1 - bit 1: SecIdent v2 - ET_MOD_VERSION = 0x55u, - // ET_FEATURESET = 0x54u, // int - [Bloodymad Featureset] // UNUSED - ET_OS_INFO = 0x94u // Reused rand tag (MOD_OXY), because the type is unknown + ET_COMPRESSION = 0x20u, + ET_UDPPORT = 0x21u, + ET_UDPVER = 0x22u, + ET_SOURCEEXCHANGE = 0x23u, + ET_COMMENTS = 0x24u, + ET_EXTENDEDREQUEST = 0x25u, + ET_COMPATIBLECLIENT = 0x26u, + ET_FEATURES = 0x27u, //! bit 0: SecIdent v1 - bit 1: SecIdent v2 + ET_MOD_VERSION = 0x55u, + // ET_FEATURESET = 0x54u, // int - [Bloodymad Featureset] // UNUSED + ET_OS_INFO = 0x94u // Reused rand tag (MOD_OXY), because the type is unknown +}; + +// Server capabilities, values for CT_SERVER_FLAGS +enum ServerCapabilites { + SRVCAP_ZLIB = 0x0001, + SRVCAP_IP_IN_LOGIN = 0x0002, + SRVCAP_AUXPORT = 0x0004, + SRVCAP_NEWTAGS = 0x0008, + SRVCAP_UNICODE = 0x0010, + SRVCAP_LARGEFILES = 0x0100, + SRVCAP_SUPPORTCRYPT = 0x0200, + SRVCAP_REQUESTCRYPT = 0x0400, + SRVCAP_REQUIRECRYPT = 0x0800 +}; + +// aMule used to use these names +#define CAPABLE_ZLIB SRVCAP_ZLIB +#define CAPABLE_IP_IN_LOGIN_FRAME SRVCAP_IP_IN_LOGIN +#define CAPABLE_AUXPORT SRVCAP_AUXPORT +#define CAPABLE_NEWTAGS SRVCAP_NEWTAGS +#define CAPABLE_UNICODE SRVCAP_UNICODE +#define CAPABLE_LARGEFILES SRVCAP_LARGEFILES + +// Server capabilities, values for CT_SERVER_UDPSEARCH_FLAGS +enum ServerUDPCapabilities { + SRVCAP_UDP_NEWTAGS_LARGEFILES = 0x01 }; #endif // CLIENTTAGS_H diff -ruN -d amule-2.2.0~svn20080218/src/include/tags/FileTags.h amule-2.2.2/src/include/tags/FileTags.h --- amule-2.2.0~svn20080218/src/include/tags/FileTags.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/tags/FileTags.h 2008-07-28 15:41:53.000000000 +0000 @@ -57,7 +57,8 @@ // associated file (supported // by eserver 16.46+) statistic -#define FT_ATTRANSFERRED 0x50 // +#define FT_PUBLISHINFO 0x33 // +#define FT_ATTRANSFERRED 0x50 // #define FT_ATREQUESTED 0x51 // #define FT_ATACCEPTED 0x52 // #define FT_CATEGORY 0x53 // @@ -98,12 +99,14 @@ #define TAG_PERMISSIONS wxT("\x16") #define TAG_QTIME wxT("\x16") #define TAG_PARTS wxT("\x17") +#define TAG_PUBLISHINFO wxT("\x33") // #define TAG_MEDIA_ARTIST wxT("\xD0") // #define TAG_MEDIA_ALBUM wxT("\xD1") // #define TAG_MEDIA_TITLE wxT("\xD2") // #define TAG_MEDIA_LENGTH wxT("\xD3") // !!! #define TAG_MEDIA_BITRATE wxT("\xD4") // #define TAG_MEDIA_CODEC wxT("\xD5") // +#define TAG_KADMISCOPTIONS wxT("\xF2") // #define TAG_ENCRYPTION wxT("\xF3") // #define TAG_FILERATING wxT("\xF7") // #define TAG_BUDDYHASH wxT("\xF8") // diff -ruN -d amule-2.2.0~svn20080218/src/include/tags/ServerTags.h amule-2.2.2/src/include/tags/ServerTags.h --- amule-2.2.0~svn20080218/src/include/tags/ServerTags.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/include/tags/ServerTags.h 2008-05-11 15:38:09.000000000 +0000 @@ -28,27 +28,27 @@ // server.met and server status. enum Server_tags { - ST_SERVERNAME = 0x01, // + ST_SERVERNAME = 0x01, // // Unused (0x02-0x0A) - ST_DESCRIPTION = 0x0B, // - ST_PING = 0x0C, // - ST_FAIL = 0x0D, // - ST_PREFERENCE = 0x0E, // + ST_DESCRIPTION = 0x0B, // + ST_PING = 0x0C, // + ST_FAIL = 0x0D, // + ST_PREFERENCE = 0x0E, // // Unused (0x0F-0x84) - ST_DYNIP = 0x85, - ST_LASTPING_DEPRECATED = 0x86, // // DEPRECATED, use 0x90 - ST_MAXUSERS = 0x87, - ST_SOFTFILES = 0x88, - ST_HARDFILES = 0x89, + ST_DYNIP = 0x85, + ST_LASTPING_DEPRECATED = 0x86, // // DEPRECATED, use 0x90 + ST_MAXUSERS = 0x87, + ST_SOFTFILES = 0x88, + ST_HARDFILES = 0x89, // Unused (0x8A-0x8F) - ST_LASTPING = 0x90, // - ST_VERSION = 0x91, // - ST_UDPFLAGS = 0x92, // - ST_AUXPORTSLIST = 0x93, // - ST_LOWIDUSERS = 0x94, // - ST_UDPKEY = 0x95, // - ST_UDPKEYIP = 0x96, // - ST_TCPPORTOBFUSCATION = 0x97, // + ST_LASTPING = 0x90, // + ST_VERSION = 0x91, // + ST_UDPFLAGS = 0x92, // + ST_AUXPORTSLIST = 0x93, // + ST_LOWIDUSERS = 0x94, // + ST_UDPKEY = 0x95, // + ST_UDPKEYIP = 0x96, // + ST_TCPPORTOBFUSCATION = 0x97, // ST_UDPPORTOBFUSCATION = 0x98 // }; diff -ruN -d amule-2.2.0~svn20080218/src/kademlia/Makefile.am amule-2.2.2/src/kademlia/Makefile.am --- amule-2.2.0~svn20080218/src/kademlia/Makefile.am 2007-08-20 09:45:15.000000000 +0000 +++ amule-2.2.2/src/kademlia/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -SUBDIRS = kademlia net routing utils - - -MAINTAINERCLEANFILES = Makefile.in diff -ruN -d amule-2.2.0~svn20080218/src/kademlia/Makefile.in amule-2.2.2/src/kademlia/Makefile.in --- amule-2.2.0~svn20080218/src/kademlia/Makefile.in 2008-02-18 06:01:52.000000000 +0000 +++ amule-2.2.2/src/kademlia/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,597 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src/kademlia -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/build-tools.m4 \ - $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cryptopp.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \ - $(top_srcdir)/m4/inttypes-pri.m4 $(top_srcdir)/m4/inttypes.m4 \ - $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/stdint_h.m4 \ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/wxwin.m4 $(top_srcdir)/m4/zlib.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALCC_FALSE = @ALCC_FALSE@ -ALCC_TRUE = @ALCC_TRUE@ -ALC_FALSE = @ALC_FALSE@ -ALC_TRUE = @ALC_TRUE@ -ALLOCA = @ALLOCA@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AMULEWEB_DEFS = @AMULEWEB_DEFS@ -AMULE_DAEMON_FALSE = @AMULE_DAEMON_FALSE@ -AMULE_DAEMON_TRUE = @AMULE_DAEMON_TRUE@ -AMULE_GUI_FALSE = @AMULE_GUI_FALSE@ -AMULE_GUI_TRUE = @AMULE_GUI_TRUE@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BFD_FLAGS = @BFD_FLAGS@ -BFD_LIB = @BFD_LIB@ -BUILD_CC = @BUILD_CC@ -BUILD_CFLAGS = @BUILD_CFLAGS@ -BUILD_CPPFLAGS = @BUILD_CPPFLAGS@ -BUILD_EXEEXT = @BUILD_EXEEXT@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -BUILD_LDFLAGS = @BUILD_LDFLAGS@ -CAS_DEFS = @CAS_DEFS@ -CAS_FALSE = @CAS_FALSE@ -CAS_TRUE = @CAS_TRUE@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCACHE = @CCACHE@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -COMPILE_CMD_FALSE = @COMPILE_CMD_FALSE@ -COMPILE_CMD_TRUE = @COMPILE_CMD_TRUE@ -COMPILE_NLS_FALSE = @COMPILE_NLS_FALSE@ -COMPILE_NLS_TRUE = @COMPILE_NLS_TRUE@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CRYPTOLIBS = @CRYPTOLIBS@ -CRYPTO_PP_CXXFLAGS = @CRYPTO_PP_CXXFLAGS@ -CRYPTO_PP_INCLUDE_PREFIX = @CRYPTO_PP_INCLUDE_PREFIX@ -CRYPTO_PP_LDFLAGS = @CRYPTO_PP_LDFLAGS@ -CRYPTO_PP_LIB_NAME = @CRYPTO_PP_LIB_NAME@ -CRYPTO_PP_PREFIX = @CRYPTO_PP_PREFIX@ -CRYPTO_PP_STYLE = @CRYPTO_PP_STYLE@ -CRYPTO_PP_VERSION_NUMBER = @CRYPTO_PP_VERSION_NUMBER@ -CRYPTO_PP_VERSION_STRING = @CRYPTO_PP_VERSION_STRING@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -ED2K_FALSE = @ED2K_FALSE@ -ED2K_TRUE = @ED2K_TRUE@ -EGREP = @EGREP@ -ENABLE_IP2COUNTRY_FALSE = @ENABLE_IP2COUNTRY_FALSE@ -ENABLE_IP2COUNTRY_TRUE = @ENABLE_IP2COUNTRY_TRUE@ -ENABLE_UPNP_FALSE = @ENABLE_UPNP_FALSE@ -ENABLE_UPNP_TRUE = @ENABLE_UPNP_TRUE@ -EXEEXT = @EXEEXT@ -GDLIB_CFLAGS = @GDLIB_CFLAGS@ -GDLIB_CFLAGS_ONLY = @GDLIB_CFLAGS_ONLY@ -GDLIB_CONFIG_PATH = @GDLIB_CONFIG_PATH@ -GDLIB_CPPFLAGS = @GDLIB_CPPFLAGS@ -GDLIB_CXXFLAGS = @GDLIB_CXXFLAGS@ -GDLIB_CXXFLAGS_ONLY = @GDLIB_CXXFLAGS_ONLY@ -GDLIB_LDFLAGS = @GDLIB_LDFLAGS@ -GDLIB_LIBS = @GDLIB_LIBS@ -GDLIB_LIBS_STATIC = @GDLIB_LIBS_STATIC@ -GDLIB_VERSION = @GDLIB_VERSION@ -GENCAT = @GENCAT@ -GENERATE_FLEX_HEADER_FALSE = @GENERATE_FLEX_HEADER_FALSE@ -GENERATE_FLEX_HEADER_TRUE = @GENERATE_FLEX_HEADER_TRUE@ -GEOIP_INCLUDE = @GEOIP_INCLUDE@ -GEOIP_LIB = @GEOIP_LIB@ -GLIBC21 = @GLIBC21@ -GMSGFMT = @GMSGFMT@ -HAVE_FLEX_EXTENDED = @HAVE_FLEX_EXTENDED@ -HAVE_GETTEXT = @HAVE_GETTEXT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBOBJS = @LIBOBJS@ -LIBPNG_CFLAGS = @LIBPNG_CFLAGS@ -LIBPNG_CONFIG_PATH = @LIBPNG_CONFIG_PATH@ -LIBPNG_CXXFLAGS = @LIBPNG_CXXFLAGS@ -LIBPNG_LDFLAGS = @LIBPNG_LDFLAGS@ -LIBPNG_LIBS = @LIBPNG_LIBS@ -LIBS = @LIBS@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONOLITHIC_FALSE = @MONOLITHIC_FALSE@ -MONOLITHIC_TRUE = @MONOLITHIC_TRUE@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -NEED_CORESERVICES_FALSE = @NEED_CORESERVICES_FALSE@ -NEED_CORESERVICES_TRUE = @NEED_CORESERVICES_TRUE@ -NEED_RC_FALSE = @NEED_RC_FALSE@ -NEED_RC_TRUE = @NEED_RC_TRUE@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -POSUB = @POSUB@ -POW_LIB = @POW_LIB@ -RANLIB = @RANLIB@ -RC = @RC@ -RCFLAGS = @RCFLAGS@ -READLINE_LIBS = @READLINE_LIBS@ -RESOLV_LIB = @RESOLV_LIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SVNDATE = @SVNDATE@ -SYS_WIN32_FALSE = @SYS_WIN32_FALSE@ -SYS_WIN32_TRUE = @SYS_WIN32_TRUE@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -WEB_FALSE = @WEB_FALSE@ -WEB_TRUE = @WEB_TRUE@ -WXBASE_CFLAGS = @WXBASE_CFLAGS@ -WXBASE_CXXFLAGS = @WXBASE_CXXFLAGS@ -WXBASE_LIBS = @WXBASE_LIBS@ -WXCAS_FALSE = @WXCAS_FALSE@ -WXCAS_TRUE = @WXCAS_TRUE@ -WX_CFLAGS = @WX_CFLAGS@ -WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ -WX_CONFIG_PATH = @WX_CONFIG_PATH@ -WX_CPPFLAGS = @WX_CPPFLAGS@ -WX_CXXFLAGS = @WX_CXXFLAGS@ -WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@ -WX_DEBUG = @WX_DEBUG@ -WX_LIBS = @WX_LIBS@ -WX_LIBS_STATIC = @WX_LIBS_STATIC@ -WX_PORT = @WX_PORT@ -WX_RESCOMP = @WX_RESCOMP@ -WX_SHARED = @WX_SHARED@ -WX_UNICODE = @WX_UNICODE@ -WX_VERSION_FULL = @WX_VERSION_FULL@ -WX_VERSION_MAJOR = @WX_VERSION_MAJOR@ -WX_VERSION_MINOR = @WX_VERSION_MINOR@ -X11LIBS = @X11LIBS@ -XGETTEXT = @XGETTEXT@ -YACC = @YACC@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_BUILD_CC = @ac_ct_BUILD_CC@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_LD = @ac_ct_LD@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_RC = @ac_ct_RC@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -ccache = @ccache@ -ccache_prefix = @ccache_prefix@ -datadir = @datadir@ -docdir = @docdir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -SUBDIRS = kademlia net routing utils -MAINTAINERCLEANFILES = Makefile.in -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/kademlia/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/kademlia/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-recursive - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-recursive ctags ctags-recursive \ - distclean distclean-generic distclean-recursive distclean-tags \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -ruN -d amule-2.2.0~svn20080218/src/kademlia/kademlia/Defines.h amule-2.2.2/src/kademlia/kademlia/Defines.h --- amule-2.2.0~svn20080218/src/kademlia/kademlia/Defines.h 2008-01-27 20:32:36.000000000 +0000 +++ amule-2.2.2/src/kademlia/kademlia/Defines.h 2008-04-14 16:00:35.000000000 +0000 @@ -43,28 +43,28 @@ namespace Kademlia { //////////////////////////////////////// -#define SEARCHTOLERANCE 16777216 -const unsigned int K = 10; -#define KBASE 4 -#define KK 5 -#define ALPHA_QUERY 3 -#define LOG_BASE_EXPONENT 5 -#define HELLO_TIMEOUT 20 -#define SEARCH_JUMPSTART 2 -#define SEARCH_LIFETIME 45 -#define SEARCHFILE_LIFETIME 45 +#define SEARCHTOLERANCE 16777216 +const unsigned int K = 10; +#define KBASE 4 +#define KK 5 +#define ALPHA_QUERY 3 +#define LOG_BASE_EXPONENT 5 +#define HELLO_TIMEOUT 20 +#define SEARCH_JUMPSTART 1 +#define SEARCH_LIFETIME 45 +#define SEARCHFILE_LIFETIME 45 #define SEARCHKEYWORD_LIFETIME 45 #define SEARCHNOTES_LIFETIME 45 -#define SEARCHNODE_LIFETIME 45 +#define SEARCHNODE_LIFETIME 45 #define SEARCHNODECOMP_LIFETIME 10 #define SEARCHSTOREFILE_LIFETIME 140 #define SEARCHSTOREKEYWORD_LIFETIME 140 #define SEARCHSTORENOTES_LIFETIME 100 #define SEARCHFINDBUDDY_LIFETIME 100 #define SEARCHFINDSOURCE_LIFETIME 45 -#define SEARCHFILE_TOTAL 300 -#define SEARCHKEYWORD_TOTAL 300 -#define SEARCHNOTES_TOTAL 50 +#define SEARCHFILE_TOTAL 300 +#define SEARCHKEYWORD_TOTAL 300 +#define SEARCHNOTES_TOTAL 50 #define SEARCHSTOREFILE_TOTAL 10 #define SEARCHSTOREKEYWORD_TOTAL 10 #define SEARCHSTORENOTES_TOTAL 10 diff -ruN -d amule-2.2.0~svn20080218/src/kademlia/kademlia/Entry.cpp amule-2.2.2/src/kademlia/kademlia/Entry.cpp --- amule-2.2.0~svn20080218/src/kademlia/kademlia/Entry.cpp 1970-01-01 00:00:00.000000000 +0000 +++ amule-2.2.2/src/kademlia/kademlia/Entry.cpp 2008-05-08 16:44:01.000000000 +0000 @@ -0,0 +1,602 @@ +// +// This file is part of the aMule Project. +// +// Copyright (c) 2008 Dévai Tamás ( gonosztopi@amule.org ) +// Copyright (c) 2004-2008 aMule Team ( admin@amule.org / http://www.amule.org ) +// Copyright (c) 2003 Barry Dunne (http://www.emule-project.net) +// +// Any parts of this program derived from the xMule, lMule or eMule project, +// or contributed by third-party developers are copyrighted by their +// respective authors. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +// + +// Note To Mods // +/* +Please do not change anything here and release it.. +There is going to be a new forum created just for the Kademlia side of the client.. +If you feel there is an error or a way to improve something, please +post it in the forum first and let us look at it.. If it is a real improvement, +it will be added to the offical client.. Changing something without knowing +what all it does can cause great harm to the network if released in mass form.. +Any mod that changes anything within the Kademlia side will not be allowed to advertise +there client on the eMule forum.. +*/ + +#include "Entry.h" +#include +#include +#include +#include "Indexed.h" +#include "../../SafeFile.h" +#include "../../GetTickCount.h" +#include "../../Logger.h" +#include "../../NetworkFunctions.h" + +using namespace Kademlia; + +CKeyEntry::GlobalPublishIPMap CKeyEntry::s_globalPublishIPs; + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////// CEntry +CEntry::~CEntry() +{ + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + delete *it; + } +} + +CEntry* CEntry::Copy() const +{ + CEntry* entry = new CEntry(); + for (FileNameList::const_iterator it = m_filenames.begin(); it != m_filenames.end(); ++it) { + entry->m_filenames.push_back(*it); + } + entry->m_uIP = m_uIP; + entry->m_uKeyID.SetValue(m_uKeyID); + entry->m_tLifeTime = m_tLifeTime; + entry->m_uSize = m_uSize; + entry->m_bSource = m_bSource; + entry->m_uSourceID.SetValue(m_uSourceID); + entry->m_uTCPport = m_uTCPport; + entry->m_uUDPport = m_uUDPport; + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + entry->m_taglist.push_back((*it)->CloneTag()); + } + return entry; +} + +uint64_t CEntry::GetIntTagValue(const wxString& tagname, bool includeVirtualTags) const +{ + uint64_t result = 0; + GetIntTagValue(tagname, result, includeVirtualTags); + return result; +} + +bool CEntry::GetIntTagValue(const wxString& tagname, uint64_t& value, bool includeVirtualTags) const +{ + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if ((*it)->IsInt() && ((*it)->GetName() == tagname)) { + value = (*it)->GetInt(); + return true; + } + } + + if (includeVirtualTags) { + // SizeTag is not stored anymore, but queried in some places + if (tagname == TAG_FILESIZE) { + value = m_uSize; + return true; + } + } + value = 0; + return false; +} + +wxString CEntry::GetStrTagValue(const wxString& tagname) const +{ + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if (((*it)->GetName() == tagname) && (*it)->IsStr()) { + return (*it)->GetStr(); + } + } + return wxEmptyString; +} + +void CEntry::SetFileName(const wxString& name) +{ + if (!m_filenames.empty()) { + wxFAIL; + m_filenames.clear(); + } + sFileNameEntry sFN = { name, 1 }; + m_filenames.push_front(sFN); +} + +wxString CEntry::GetCommonFileName() const +{ + // return the filename on which most publishers seem to agree on + // due to the counting, this doesn't has to be excact, we just want to make sure to not use a filename which just + // a few bad publishers used and base or search matching and answering on this, instead of the most popular name + // Note: The Index values are not the acutal numbers of publishers, but just a relativ number to compare to other entries + FileNameList::const_iterator result = m_filenames.end(); + uint32_t highestPopularityIndex = 0; + for (FileNameList::const_iterator it = m_filenames.begin(); it != m_filenames.end(); ++it) { + if (it->m_popularityIndex > highestPopularityIndex) { + highestPopularityIndex = it->m_popularityIndex; + result = it; + } + } + wxString strResult(result != m_filenames.end() ? result->m_filename : wxString(wxEmptyString)); + wxASSERT(!strResult.IsEmpty() || m_filenames.empty()); + return strResult; +} + +void CEntry::WriteTagListInc(CFileDataIO* data, uint32_t increaseTagNumber) +{ + // write taglist and add name + size tag + wxCHECK_RET(data != NULL, wxT("data must not be NULL")); + + uint32_t count = GetTagCount() + increaseTagNumber; // will include name and size tag in the count if needed + wxASSERT(count <= 0xFF); + data->WriteUInt8((uint8_t)count); + + if (!GetCommonFileName().IsEmpty()){ + wxASSERT(count > m_taglist.size()); + data->WriteTag(CTagString(TAG_FILENAME, GetCommonFileName())); + } + if (m_uSize != 0){ + wxASSERT(count > m_taglist.size()); + data->WriteTag(CTagVarInt(TAG_FILESIZE, m_uSize)); + } + + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + data->WriteTag(**it); + } +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////// CKeyEntry +CKeyEntry::CKeyEntry() +{ + m_publishingIPs = NULL; + m_trustValue = 0; + m_lastTrustValueCalc = 0; +} + +CKeyEntry::~CKeyEntry() +{ + if (m_publishingIPs != NULL) { + for (PublishingIPList::const_iterator it = m_publishingIPs->begin(); it != m_publishingIPs->end(); ++it) { + AdjustGlobalPublishTracking(it->m_ip, false, wxT("instance delete")); + } + delete m_publishingIPs; + m_publishingIPs = NULL; + } +} + +bool CKeyEntry::SearchTermsMatch(const SSearchTerm* searchTerm) const +{ + // boolean operators + if (searchTerm->type == SSearchTerm::AND) { + return SearchTermsMatch(searchTerm->left) && SearchTermsMatch(searchTerm->right); + } + + if (searchTerm->type == SSearchTerm::OR) { + return SearchTermsMatch(searchTerm->left) || SearchTermsMatch(searchTerm->right); + } + + if (searchTerm->type == SSearchTerm::NOT) { + return SearchTermsMatch(searchTerm->left) && !SearchTermsMatch(searchTerm->right); + } + + // word which is to be searched in the file name (and in additional meta data as done by some ed2k servers???) + if (searchTerm->type == SSearchTerm::String) { + int strSearchTerms = searchTerm->astr->GetCount(); + if (strSearchTerms == 0) { + return false; + } + // if there are more than one search strings specified (e.g. "aaa bbb ccc") the entire string is handled + // like "aaa AND bbb AND ccc". search all strings from the string search term in the tokenized list of + // the file name. all strings of string search term have to be found (AND) + wxString commonFileNameLower(GetCommonFileNameLowerCase()); + for (int i = 0; i < strSearchTerms; i++) { + // this will not give the same results as when tokenizing the filename string, but it is 20 times faster. + if (commonFileNameLower.Find((*(searchTerm->astr))[i]) == -1) { + return false; + } + } + return true; + } + + if (searchTerm->type == SSearchTerm::MetaTag) { + if (searchTerm->tag->GetType() == 2) { // meta tags with string values + if (searchTerm->tag->GetName() == TAG_FILEFORMAT) { + // 21-Sep-2006 []: Special handling for TAG_FILEFORMAT which is already part + // of the filename and thus does not need to get published nor stored explicitly, + wxString commonFileName(GetCommonFileName()); + int ext = commonFileName.Find(wxT('.'), true); + if (ext != wxNOT_FOUND) { + return commonFileName.Mid(ext + 1).CmpNoCase(searchTerm->tag->GetStr()) == 0; + } + } else { + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if ((*it)->IsStr() && searchTerm->tag->GetName() == (*it)->GetName()) { + return (*it)->GetStr().CmpNoCase(searchTerm->tag->GetStr()) == 0; + } + } + } + } + } else if (searchTerm->type == SSearchTerm::OpGreaterEqual) { + if (searchTerm->tag->IsInt()) { // meta tags with integer values + uint64_t value; + if (GetIntTagValue(searchTerm->tag->GetName(), value, true)) { + return value >= searchTerm->tag->GetInt(); + } + } else if (searchTerm->tag->IsFloat()) { // meta tags with float values + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if ((*it)->IsFloat() && searchTerm->tag->GetName() == (*it)->GetName()) { + return (*it)->GetFloat() >= searchTerm->tag->GetFloat(); + } + } + } + } else if (searchTerm->type == SSearchTerm::OpLessEqual) { + if (searchTerm->tag->IsInt()) { // meta tags with integer values + uint64_t value; + if (GetIntTagValue(searchTerm->tag->GetName(), value, true)) { + return value <= searchTerm->tag->GetInt(); + } + } else if (searchTerm->tag->IsFloat()) { // meta tags with float values + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if ((*it)->IsFloat() && searchTerm->tag->GetName() == (*it)->GetName()) { + return (*it)->GetFloat() <= searchTerm->tag->GetFloat(); + } + } + } + } else if (searchTerm->type == SSearchTerm::OpGreater) { + if (searchTerm->tag->IsInt()) { // meta tags with integer values + uint64_t value; + if (GetIntTagValue(searchTerm->tag->GetName(), value, true)) { + return value > searchTerm->tag->GetInt(); + } + } else if (searchTerm->tag->IsFloat()) { // meta tags with float values + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if ((*it)->IsFloat() && searchTerm->tag->GetName() == (*it)->GetName()) { + return (*it)->GetFloat() > searchTerm->tag->GetFloat(); + } + } + } + } else if (searchTerm->type == SSearchTerm::OpLess) { + if (searchTerm->tag->IsInt()) { // meta tags with integer values + uint64_t value; + if (GetIntTagValue(searchTerm->tag->GetName(), value, true)) { + return value < searchTerm->tag->GetInt(); + } + } else if (searchTerm->tag->IsFloat()) { // meta tags with float values + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if ((*it)->IsFloat() && searchTerm->tag->GetName() == (*it)->GetName()) { + return (*it)->GetFloat() < searchTerm->tag->GetFloat(); + } + } + } + } else if (searchTerm->type == SSearchTerm::OpEqual) { + if (searchTerm->tag->IsInt()) { // meta tags with integer values + uint64_t value; + if (GetIntTagValue(searchTerm->tag->GetName(), value, true)) { + return value == searchTerm->tag->GetInt(); + } + } else if (searchTerm->tag->IsFloat()) { // meta tags with float values + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if ((*it)->IsFloat() && searchTerm->tag->GetName() == (*it)->GetName()) { + return (*it)->GetFloat() == searchTerm->tag->GetFloat(); + } + } + } + } else if (searchTerm->type == SSearchTerm::OpNotEqual) { + if (searchTerm->tag->IsInt()) { // meta tags with integer values + uint64_t value; + if (GetIntTagValue(searchTerm->tag->GetName(), value, true)) { + return value != searchTerm->tag->GetInt(); + } + } else if (searchTerm->tag->IsFloat()) { // meta tags with float values + for (TagPtrList::const_iterator it = m_taglist.begin(); it != m_taglist.end(); ++it) { + if ((*it)->IsFloat() && searchTerm->tag->GetName() == (*it)->GetName()) { + return (*it)->GetFloat() != searchTerm->tag->GetFloat(); + } + } + } + } + + return false; +} + +void CKeyEntry::AdjustGlobalPublishTracking(uint32_t ip, bool increase, const wxString& dbgReason) +{ + uint32_t count = 0; + bool found = false; + GlobalPublishIPMap::const_iterator it = s_globalPublishIPs.find(ip & 0xFFFFFF00 /* /24 netmask, take care of endian if needed*/); + if (it != s_globalPublishIPs.end()) { + count = it->second; + found = true; + } + + if (increase) { + count++; + } else { + count--; + } + + if (found || increase) { + s_globalPublishIPs[ip & 0xFFFFFF00] = count; + } else { + wxFAIL; + } + //LOGTODO + //if (!dbgReason.IsEmpty()) + // AddDebugLogLineM(false, logKadEntryTracking, (increase ? wxT("Adding ") : wxT("Removing ")) + Uint32toStringIP(wxUINT32_SWAP_ALWAYS(ip & 0xFFFFFF00)) + wxT(" (") + Uint32toStringIP(wxUINT32_SWAP_ALWAYS(ip)) + wxT(") - (") + dbgReason + wxString::Format(wxT("), new count %u"),count)); +} + +void CKeyEntry::MergeIPsAndFilenames(CKeyEntry* fromEntry) +{ + // this is called when replacing a stored entry with a refreshed one. + // we want to take over the tracked IPs and the different filenames from the old entry, the rest is still + // "overwritten" with the refreshed values. This might be not perfect for the taglist in some cases, but we can't afford + // to store hundreds of taglists to figure out the best one like we do for the filenames now + if (m_publishingIPs != NULL) { // This instance needs to be a new entry, otherwise we don't want/need to merge + wxASSERT(fromEntry == NULL); + wxASSERT(!m_publishingIPs->empty()); + wxASSERT(!m_filenames.empty()); + return; + } + + bool refresh = false; + if (fromEntry == NULL || fromEntry->m_publishingIPs == NULL) { + wxASSERT(fromEntry == NULL); + // if called with NULL, this is a complete new entry and we need to initalize our lists + if (m_publishingIPs == NULL) { + m_publishingIPs = new PublishingIPList(); + } + // update the global track map below + } else { + delete m_publishingIPs; // should be always NULL, already ASSERTed above if not + + // merge the tracked IPs, add this one if not already on the list + m_publishingIPs = fromEntry->m_publishingIPs; + fromEntry->m_publishingIPs = NULL; + bool fastRefresh = false; + for (PublishingIPList::iterator it = m_publishingIPs->begin(); it != m_publishingIPs->end(); ++it) { + if (it->m_ip == m_uIP) { + refresh = true; + if ((time(NULL) - it->m_lastPublish) < (KADEMLIAREPUBLISHTIMES - HR2S(1))) { + //AddDebugLogLineM(false, logKadEntryTracking, wxT("FastRefresh publish, ip: ") + Uint32toStringIP(wxUINT32_SWAP_ALWAYS(m_uIP))); + fastRefresh = true; // refreshed faster than expected, will not count into filenamepopularity index + } + it->m_lastPublish = time(NULL); + m_publishingIPs->push_back(*it); + m_publishingIPs->erase(it); + break; + } + } + + // copy over trust value, in case we don't want to recalculate + m_trustValue = fromEntry->m_trustValue; + m_lastTrustValueCalc = fromEntry->m_lastTrustValueCalc; + + // copy over the different names, if they are different the one we have right now + wxASSERT(m_filenames.size() == 1); // we should have only one name here, since it's the entry from one single source + sFileNameEntry currentName = { wxEmptyString, 0 }; + if (m_filenames.size() != 0) { + currentName = m_filenames.front(); + m_filenames.pop_front(); + } + + bool duplicate = false; + for (FileNameList::iterator it = fromEntry->m_filenames.begin(); it != fromEntry->m_filenames.end(); ++it) { + sFileNameEntry nameToCopy = *it; + if (currentName.m_filename.CmpNoCase(nameToCopy.m_filename) == 0) { + // the filename of our new entry matches with our old, increase the popularity index for the old one + duplicate = true; + if (!fastRefresh) { + nameToCopy.m_popularityIndex++; + } + } + m_filenames.push_back(nameToCopy); + } + if (!duplicate) { + m_filenames.push_back(currentName); + } + } + + // if this was a refresh done, otherwise update the global track map + if (!refresh) { + wxASSERT(m_uIP != 0); + sPublishingIP add = { m_uIP, time(NULL) }; + m_publishingIPs->push_back(add); + + // add the publisher to the tacking list + AdjustGlobalPublishTracking(m_uIP, true, wxT("new publisher")); + + // we keep track of max 100 IPs, in order to avoid too much time for calculation/storing/loading. + if (m_publishingIPs->size() > 100) { + sPublishingIP curEntry = m_publishingIPs->front(); + m_publishingIPs->pop_front(); + AdjustGlobalPublishTracking(curEntry.m_ip, false, wxT("more than 100 publishers purge")); + } + + // since we added a new publisher, we want to (re)calculate the trust value for this entry + ReCalculateTrustValue(); + } +// #ifdef __DEBUG__ +// AddDebugLogLineM(false, logKadEntryTracking, wxString(wxT("Indexed Keyword, Refresh: ")) + (refresh ? wxT("Yes") : wxT("No")) + wxT(", Current Publisher: ") + Uint32toStringIP(wxUINT32_SWAP_ALWAYS(m_uIP)) + wxString::Format(wxT(", Total Publishers: %u, Total different Names: %u, TrustValue: %.2f, file: "), m_publishingIPs->size(), m_filenames.size(), m_trustValue) + m_uSourceID.ToHexString()); +// #endif +} + +void CKeyEntry::ReCalculateTrustValue() +{ +#define PUBLISHPOINTSSPERSUBNET 10.0 + // The trustvalue is supposed to be an indicator how trustworthy/important (or spammy) this entry is and lies between 0 and ~10000, + // but mostly we say everything below 1 is bad, everything above 1 is good. It is calculated by looking at how many different + // IPs/24 have published this entry and how many entries each of those IPs have. + // Each IP/24 has x (say 3) points. This means if one IP publishes 3 different entries without any other IP publishing those entries, + // each of those entries will have 3 / 3 = 1 Trustvalue. Thats fine. If it publishes 6 alone, each entry has 3 / 6 = 0.5 trustvalue - not so good + // However if there is another publisher for entry 5, which only publishes this entry then we have 3/6 + 3/1 = 3.5 trustvalue for this entry + // + // What's the point? With this rating we try to avoid getting spammed with entries for a given keyword by a small IP range, which blends out + // all other entries for this keyword do to its amount as well as giving an indicator for the searcher. So if we are the node to index "Knoppix", and someone + // from 1 IP publishes 500 times "knoppix casino 500% bonus.txt", all those entries will have a trustvalue of 0.006 and we make sure that + // on search requests for knoppix, those entries are only returned after all entries with a trustvalue > 1 were sent (if there is still space). + // + // Its important to note that entry with < 1 do NOT get ignored or singled out, this only comes into play if we have 300 more results for + // a search request rating > 1 + wxCHECK_RET(m_publishingIPs != NULL, wxT("No publishing IPs?")); + + m_lastTrustValueCalc = ::GetTickCount(); + m_trustValue = 0; + wxASSERT(!m_publishingIPs->empty()); + for (PublishingIPList::iterator it = m_publishingIPs->begin(); it != m_publishingIPs->end(); ++it) { + sPublishingIP curEntry = *it; + uint32_t count = 0; + GlobalPublishIPMap::const_iterator itMap = s_globalPublishIPs.find(curEntry.m_ip & 0xFFFFFF00 /* /24 netmask, take care of endian if needed*/); + if (itMap != s_globalPublishIPs.end()) { + count = itMap->second; + } + if (count > 0) { + m_trustValue += PUBLISHPOINTSSPERSUBNET / count; + } else { + AddDebugLogLineM(false, logKadEntryTracking, wxT("Inconsistency in RecalcualteTrustValue()")); + wxFAIL; + } + } +} + +double CKeyEntry::GetTrustValue() +{ + // update if last calcualtion is too old, will assert if this entry is not supposed to have a trustvalue + if (::GetTickCount() - m_lastTrustValueCalc > MIN2MS(10)) { + ReCalculateTrustValue(); + } + return m_trustValue; +} + +void CKeyEntry::CleanUpTrackedPublishers() +{ + if (m_publishingIPs == NULL) { + return; + } + + time_t now = time(NULL); + while (!m_publishingIPs->empty()) { + // entries are ordered, older ones first + sPublishingIP curEntry = m_publishingIPs->front(); + if (now - curEntry.m_lastPublish > KADEMLIAREPUBLISHTIMEK) { + AdjustGlobalPublishTracking(curEntry.m_ip, false, wxT("cleanup")); + m_publishingIPs->pop_front(); + } else { + break; + } + } +} + +void CKeyEntry::WritePublishTrackingDataToFile(CFileDataIO* data) +{ + // format: <{} Names_Count><{