diff --git a/.gitignore b/.gitignore index 60f1a2614..51166f509 100644 --- a/.gitignore +++ b/.gitignore @@ -16,23 +16,3 @@ /doc/*.toc /doc/contributed_modules.tex /doc/version.tex -/src/*.beam -/src/*.so -/src/*.so.dSYM -/src/*/*.beam -/src/*/Makefile -/src/Makefile -/src/XmppAddr.asn1db -/src/XmppAddr.erl -/src/XmppAddr.hrl -/src/aclocal.m4 -/src/autom4te.cache -/src/config.log -/src/config.status -/src/ejabberd.init -/src/ejabberdctl.example -/src/eldap/ELDAPv3.asn1db -/src/eldap/ELDAPv3.erl -/src/eldap/ELDAPv3.hrl -/src/eldap/eldap_filter_yecc.erl -/src/epam diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 000000000..60478c6ac --- /dev/null +++ b/Makefile.in @@ -0,0 +1,238 @@ +REBAR = @REBAR@ +INSTALL = @INSTALL@ +SED = @SED@ +ERL = @ERL@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +DESTDIR = + +# /etc/ejabberd/ +ETCDIR = $(DESTDIR)@sysconfdir@/ejabberd + +# /sbin/ +SBINDIR = $(DESTDIR)@sbindir@ + +# /lib/ejabberd/ +EJABBERDDIR = $(DESTDIR)@libdir@/ejabberd + +# /share/doc/ejabberd +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +datarootdir = @datarootdir@ +DOCDIR = $(DESTDIR)@docdir@ + +# /usr/lib/ejabberd/ebin/ +BEAMDIR = $(EJABBERDDIR)/ebin + +# /usr/lib/ejabberd/include/ +INCLUDEDIR = $(EJABBERDDIR)/include + +# /usr/lib/ejabberd/priv/ +PRIVDIR = $(EJABBERDDIR)/priv + +# /usr/lib/ejabberd/priv/bin +PBINDIR = $(PRIVDIR)/bin + +# /usr/lib/ejabberd/priv/lib +SODIR = $(PRIVDIR)/lib + +# /usr/lib/ejabberd/priv/msgs +MSGSDIR = $(PRIVDIR)/msgs + +# /var/lib/ejabberd/ +SPOOLDIR = $(DESTDIR)@localstatedir@/lib/ejabberd + +# /var/lock/ejabberdctl +CTLLOCKDIR = $(DESTDIR)@localstatedir@/lock/ejabberdctl + +# /var/lib/ejabberd/.erlang.cookie +COOKIEFILE = $(SPOOLDIR)/.erlang.cookie + +# /var/log/ejabberd/ +LOGDIR = $(DESTDIR)@localstatedir@/log/ejabberd + +INSTALLUSER=@INSTALLUSER@ +# if no user was enabled, don't set privileges or ownership +ifeq ($(INSTALLUSER),) + O_USER= + G_USER= + CHOWN_COMMAND=echo + CHOWN_OUTPUT=/dev/null + INIT_USER=root +else + O_USER=-o $(INSTALLUSER) + G_USER=-g $(INSTALLUSER) + CHOWN_COMMAND=chown + CHOWN_OUTPUT=&1 + INIT_USER=$(INSTALLUSER) +endif + +all: deps src + +deps: + $(REBAR) get-deps + +src: + $(REBAR) compile + +translations: + contrib/extract_translations/prepare-translation.sh -updateall + +doc: + echo making $$target in doc; \ + (cd doc && $(MAKE) $$target) || exit 1 + +edoc: + $(ERL) -noinput +B -eval \ + 'case edoc:application(ejabberd, ".", []) of ok -> halt(0); error -> halt(1) end.' + +install: all + # + # Configuration files + $(INSTALL) -d -m 750 $(G_USER) $(ETCDIR) + [ -f $(ETCDIR)/ejabberd.cfg ] \ + && $(INSTALL) -b -m 640 $(G_USER) ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg-new \ + || $(INSTALL) -b -m 640 $(G_USER) ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg + $(SED) -e "s*{{rootdir}}*@prefix@*" \ + -e "s*{{installuser}}*@INSTALLUSER@*" \ + -e "s*{{libdir}}*@libdir@*" \ + -e "s*{{sysconfdir}}*@sysconfdir@*" \ + -e "s*{{localstatedir}}*@localstatedir@*" \ + -e "s*{{docdir}}*@docdir@*" \ + -e "s*{{erl}}*@ERL@*" ejabberdctl.template \ + > ejabberdctl.example + [ -f $(ETCDIR)/ejabberdctl.cfg ] \ + && $(INSTALL) -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg-new \ + || $(INSTALL) -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg + $(INSTALL) -b -m 644 $(G_USER) inetrc $(ETCDIR)/inetrc + # + # Administration script + [ -d $(SBINDIR) ] || $(INSTALL) -d -m 755 $(SBINDIR) + $(INSTALL) -m 550 $(G_USER) ejabberdctl.example $(SBINDIR)/ejabberdctl + # + # Init script + $(SED) -e "s*@ctlscriptpath@*$(SBINDIR)*" \ + -e "s*@installuser@*$(INIT_USER)*" ejabberd.init.template \ + > ejabberd.init + chmod 755 ejabberd.init + # + # Binary Erlang files + $(INSTALL) -d $(BEAMDIR) + $(INSTALL) -m 644 ebin/*.app $(BEAMDIR) + $(INSTALL) -m 644 ebin/*.beam $(BEAMDIR) + $(INSTALL) -m 644 deps/*/ebin/*.app $(BEAMDIR) + $(INSTALL) -m 644 deps/*/ebin/*.beam $(BEAMDIR) + rm -f $(BEAMDIR)/configure.beam + # + # ejabberd header files + $(INSTALL) -d $(INCLUDEDIR) + $(INSTALL) -m 644 include/*.hrl $(INCLUDEDIR) + $(INSTALL) -m 644 deps/*/include/*.hrl $(INCLUDEDIR) + # + # Binary C programs + $(INSTALL) -d $(PBINDIR) + $(INSTALL) -m 750 $(O_USER) tools/captcha.sh $(PBINDIR) + # + # Binary system libraries + $(INSTALL) -d $(SODIR) + #$(INSTALL) -m 644 priv/lib/*.so $(SODIR) + $(INSTALL) -m 644 deps/*/priv/lib/*.so $(SODIR) + # + # Translated strings + $(INSTALL) -d $(MSGSDIR) + $(INSTALL) -m 644 priv/msgs/*.msg $(MSGSDIR) + # + # Spool directory + $(INSTALL) -d -m 750 $(O_USER) $(SPOOLDIR) + $(CHOWN_COMMAND) -R @INSTALLUSER@ $(SPOOLDIR) >$(CHOWN_OUTPUT) + chmod -R 750 $(SPOOLDIR) + [ ! -f $(COOKIEFILE) ] || { $(CHOWN_COMMAND) @INSTALLUSER@ $(COOKIEFILE) >$(CHOWN_OUTPUT) ; chmod 400 $(COOKIEFILE) ; } + # + # ejabberdctl lock directory + $(INSTALL) -d -m 750 $(O_USER) $(CTLLOCKDIR) + $(CHOWN_COMMAND) -R @INSTALLUSER@ $(CTLLOCKDIR) >$(CHOWN_OUTPUT) + chmod -R 750 $(CTLLOCKDIR) + # + # Log directory + $(INSTALL) -d -m 750 $(O_USER) $(LOGDIR) + $(CHOWN_COMMAND) -R @INSTALLUSER@ $(LOGDIR) >$(CHOWN_OUTPUT) + chmod -R 750 $(LOGDIR) + # + # Documentation + $(INSTALL) -d $(DOCDIR) + $(INSTALL) -m 644 doc/dev.html $(DOCDIR) + $(INSTALL) -m 644 doc/guide.html $(DOCDIR) + $(INSTALL) -m 644 doc/*.png $(DOCDIR) + $(INSTALL) -m 644 doc/*.txt $(DOCDIR) + [ -f doc/guide.pdf ] \ + && $(INSTALL) -m 644 doc/guide.pdf $(DOCDIR) \ + || echo "No doc/guide.pdf was built" + $(INSTALL) -m 644 COPYING $(DOCDIR) + +uninstall: uninstall-binary + +uninstall-binary: + rm -f $(SBINDIR)/ejabberdctl + rm -fr $(DOCDIR) + rm -f $(BEAMDIR)/*.beam + rm -f $(BEAMDIR)/*.app + rm -fr $(BEAMDIR) + rm -f $(INCLUDEDIR)/*.hrl + rm -fr $(INCLUDEDIR) + rm -fr $(PBINDIR) + rm -f $(SODIR)/*.so + rm -fr $(SODIR) + rm -f $(MSGSDIR)/*.msgs + rm -fr $(MSGSDIR) + rm -fr $(PRIVDIR) + rm -fr $(EJABBERDDIR) + +uninstall-all: uninstall-binary + rm -rf $(ETCDIR) + rm -rf $(EJABBERDDIR) + rm -rf $(SPOOLDIR) + rm -rf $(CTLLOCKDIR) + rm -rf $(LOGDIR) + +clean: + $(REBAR) clean + +clean-rel: + rm -rf rel/ejabberd + +distclean: clean clean-rel + rm -f config.status + rm -f config.log + rm -rf autom4te.cache + rm -rf deps + rm -rf ebin + rm -f Makefile + rm -f vars.config + rm -f src/ejabberd.app.src + [ ! -f ../ChangeLog ] || rm -f ../ChangeLog + +rel: all + $(REBAR) generate + +TAGS: + etags *.erl + +Makefile: Makefile.in + +deps := $(filter-out deps/riak_pb/ebin, $(wildcard deps/*/ebin)) + +erlang.plt: + -dialyzer --build_plt --output_plt erlang.plt \ + --apps kernel stdlib sasl crypto public_key ssl mnesia \ + inets odbc tools compiler erts webtool runtime_tools asn1 \ + observer xmerl et gs wx syntax_tools $(deps) + +plt: erlang.plt + +dialyzer: plt + -dialyzer --plt erlang.plt --add_to_plt --output_plt ejabberd.plt \ + --get_warnings -o dialyzer.log ebin + +.PHONY: src doc edoc dialyzer Makefile TAGS clean clean-rel distclean rel plt \ + install uninstall uninstall-binary uninstall-all translations diff --git a/src/Makefile.win32 b/Makefile.win32 similarity index 100% rename from src/Makefile.win32 rename to Makefile.win32 diff --git a/README b/README index bd54491f4..32b68109e 100644 --- a/README +++ b/README @@ -14,8 +14,6 @@ To compile ejabberd you need: - OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption. - Zlib 1.2.3 or higher, for Stream Compression support (XEP-0138). Optional. - - Erlang mysql library. Optional. MySQL authentication/storage. - - Erlang pgsql library. Optional. PostgreSQL authentication/storage. - PAM library. Optional. For Pluggable Authentication Modules (PAM). - GNU Iconv 1.8 or higher, for the IRC Transport (mod_irc). Optional. Not needed on systems with GNU Libc. @@ -25,7 +23,7 @@ To compile ejabberd you need: 1. Compile and install on *nix systems -To compile ejabberd, go to the directory src/ and execute the commands: +To compile ejabberd execute the commands: ./configure make diff --git a/src/eldap/ELDAPv3.asn b/asn1/ELDAPv3.asn1 similarity index 100% rename from src/eldap/ELDAPv3.asn rename to asn1/ELDAPv3.asn1 diff --git a/src/XmppAddr.asn1 b/asn1/XmppAddr.asn1 similarity index 100% rename from src/XmppAddr.asn1 rename to asn1/XmppAddr.asn1 diff --git a/src/configure b/configure similarity index 55% rename from src/configure rename to configure index e10c21b7b..e6ab4a344 100755 --- a/src/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for ejabberd 3.0.0. +# Generated by GNU Autoconf 2.67 for ejabberd 3.0.0. # # Report bugs to . # @@ -91,7 +91,6 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -217,18 +216,11 @@ IFS=$as_save_IFS # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -565,114 +557,60 @@ PACKAGE_STRING='ejabberd 3.0.0' PACKAGE_BUGREPORT='ejabberd@process-one.net' PACKAGE_URL='' -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - ac_default_prefix=/ ac_subst_vars='LTLIBOBJS -ERLCFLAGS -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -md2 -INSTALLUSER -SSL_CFLAGS -SSL_LIBS +LIBOBJS +tools +http +pubsub_ng +debug +iconv +json +riak +stun +zlib +pam +pgsql +mysql +db_type nif full_xml transient_supervisors -db_type flash_hack roster_gateway_workaround hipe -PAM_LIBS -PAM_CFLAGS -make_pam -pam -ZLIB_LIBS -ZLIB_CFLAGS -make_ejabberd_zlib -ejabberd_zlib -make_web -web -make_tls -tls -make_odbc -odbc -make_eldap -eldap -make_mod_pubsub_ng -mod_pubsub_ng -make_mod_pubsub -mod_pubsub -make_mod_proxy65 -mod_proxy65 -make_mod_muc -mod_muc -make_mod_irc -mod_irc -LIBOBJS -EXPAT_LIBS -EXPAT_CFLAGS -EGREP -GREP -CPP -LIBICONV -ERLANG_SSLVER -ERLANG_LIBS -ERLANG_CFLAGS -ERL +ERLANG_LIB_VER_runtime_tools +ERLANG_LIB_DIR_runtime_tools +ERLANG_LIB_VER_tools +ERLANG_LIB_DIR_tools +ERLANG_LIB_VER_compiler +ERLANG_LIB_DIR_compiler +ERLANG_LIB_VER_odbc +ERLANG_LIB_DIR_odbc +ERLANG_LIB_VER_inets +ERLANG_LIB_DIR_inets +ERLANG_LIB_VER_mnesia +ERLANG_LIB_DIR_mnesia +ERLANG_LIB_VER_ssl +ERLANG_LIB_DIR_ssl +ERLANG_LIB_VER_public_key +ERLANG_LIB_DIR_public_key +ERLANG_LIB_VER_crypto +ERLANG_LIB_DIR_crypto +ERLANG_LIB_VER_sasl +ERLANG_LIB_DIR_sasl +INSTALLUSER +MAKE +REBAR +ESCRIPT +ERLCFLAGS ERLC +ERL +SED +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM SET_MAKE -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC target_alias host_alias build_alias @@ -714,41 +652,32 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -with_erlang -with_libiconv_prefix -with_expat -enable_mod_irc -enable_mod_muc -enable_mod_proxy65 -enable_mod_pubsub -enable_mod_pubsub_ng -enable_eldap -enable_odbc -enable_tls -enable_web -enable_ejabberd_zlib -with_zlib -enable_pam -with_pam enable_hipe enable_roster_gateway_workaround enable_flash_hack -enable_mssql enable_transient_supervisors enable_full_xml +enable_mssql +enable_tools +enable_all enable_nif -with_openssl +enable_mysql +enable_pgsql +enable_pam +enable_zlib +enable_stun +enable_riak +enable_json +enable_iconv +enable_debug +enable_pubsub_ng +enable_http enable_user ' ac_precious_vars='build_alias host_alias target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP +ERL ERLC ERLCFLAGS' @@ -1155,7 +1084,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1349,11 +1278,6 @@ Fine tuning of the installation directories: _ACEOF cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi @@ -1367,56 +1291,47 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-mod_irc enable mod_irc (default: yes) - --enable-mod_muc enable mod_muc (default: yes) - --enable-mod_proxy65 enable mod_proxy65 (default: yes) - --enable-mod_pubsub enable mod_pubsub (default: yes) - --enable-mod_pubsub_ng enable mod_pubsub_ng (default: yes) - --enable-eldap enable eldap (default: yes) - --enable-odbc enable odbc (default: no) - --enable-tls enable tls (default: yes) - --enable-web enable web (default: yes) - --enable-ejabberd_zlib enable ejabberd_zlib (default: yes) - --enable-pam enable pam (default: no) --enable-hipe compile natively with HiPE, not recommended (default: no) --enable-roster-gateway-workaround turn on workaround for processing gateway subscriptions (default: no) --enable-flash-hack support Adobe Flash client XML (default: no) - --enable-mssql use Microsoft SQL Server database (default: no, - requires --enable-odbc) --enable-transient_supervisors use Erlang supervision for transient process - (default: yes) + (default: no) --enable-full-xml use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients) + --enable-mssql use Microsoft SQL Server database (default: no, + requires --enable-odbc) + --enable-tools build development tools (currently the ejabberd + profiler only, default: no) + --enable-all same as --enable-nif --enable-mysql --enable-pgsql + --enable-pam --enable-zlib --enable-stun + --enable-riak --enable-json --enable-iconv + --enable-debug --enable-pubsub-ng --enable-http + (useful for Dialyzer checks, default: no) --enable-nif replace some functions with C equivalents. Requires Erlang R13B04 or higher (default: no) + --enable-mysql enable MySQL support (default: no) + --enable-pgsql enable PostgreSQL support (default: no) + --enable-pam enable PAM support (default: no) + --enable-zlib enable Stream Compression (XEP-0138) using zlib + (default: yes) + --enable-stun enable STUN support (default: no) + --enable-riak enable Riak support (default: no) + --enable-json enable JSON support for mod_bosh (default: no) + --enable-iconv enable iconv support (default: yes) + --enable-debug enable debug information (default: yes) + --enable-pubsub-ng enable PubSub NG (default: no) + --enable-http build external HTTP libraries ('ibrowse' and + 'lhttpc', default: no) --enable-user[[[=USER]]] allow this system user to start ejabberd (default: no) -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-erlang=PREFIX path to erlc and erl - --with-libiconv-prefix=PREFIX - prefix where libiconv is installed - --with-expat=PREFIX prefix where EXPAT is installed - --with-zlib=PREFIX prefix where zlib is installed - --with-pam=PREFIX prefix where PAM is installed - --with-openssl=PREFIX prefix where OPENSSL is installed - Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor + ERL Erlang/OTP interpreter command [autodetected] ERLC Erlang/OTP compiler command [autodetected] ERLCFLAGS Erlang/OTP compiler flags [none] @@ -1487,7 +1402,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF ejabberd configure 3.0.0 -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1500,291 +1415,6 @@ fi ## Autoconf initialization. ## ## ------------------------ ## -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## --------------------------------------- ## -## Report this to ejabberd@process-one.net ## -## --------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - # ac_fn_erl_try_run LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes @@ -1822,7 +1452,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_erl_try_run @@ -1831,7 +1461,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by ejabberd $as_me 3.0.0, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2089,7 +1719,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -2180,801 +1810,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Checks for programs. -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 -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -3001,125 +1841,215 @@ $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# 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: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + 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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall" fi -#locating erlang - -# Check whether --with-erlang was given. -if test "${with_erlang+set}" = set; then : - withval=$with_erlang; -fi - - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}erlc", so it can be a program name with args. -set dummy ${ac_tool_prefix}erlc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ERLC+:} false; then : - $as_echo_n "(cached) " >&6 +# Checks Erlang runtime and compiler +if test -n "$ERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for erl" >&5 +$as_echo_n "checking for erl... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ERL" >&5 +$as_echo "$ERL" >&6; } else - case $ERLC in - [\\/]* | ?:[\\/]*) - ac_cv_path_ERLC="$ERLC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$with_erlang:$with_erlang/bin:$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_ERLC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ERLC=$ac_cv_path_ERLC -if test -n "$ERLC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ERLC" >&5 -$as_echo "$ERLC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_ERLC"; then - ac_pt_ERLC=$ERLC - # Extract the first word of "erlc", so it can be a program name with args. -set dummy erlc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_ERLC+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_ERLC in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_ERLC="$ac_pt_ERLC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$with_erlang:$with_erlang/bin:$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_ac_pt_ERLC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_ERLC=$ac_cv_path_ac_pt_ERLC -if test -n "$ac_pt_ERLC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ERLC" >&5 -$as_echo "$ac_pt_ERLC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_ERLC" = x; then - ERLC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - ERLC=$ac_pt_ERLC - fi -else - ERLC="$ac_cv_path_ERLC" -fi - - if test -n "$ac_tool_prefix"; then + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}erl", so it can be a program name with args. set dummy ${ac_tool_prefix}erl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ERL+:} false; then : +if test "${ac_cv_path_ERL+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ERL in @@ -3128,8 +2058,7 @@ else ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$with_erlang:$with_erlang/bin:$PATH" -for as_dir in $as_dummy +for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -3163,7 +2092,7 @@ if test -z "$ac_cv_path_ERL"; then set dummy erl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_ERL+:} false; then : +if test "${ac_cv_path_ac_pt_ERL+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_ERL in @@ -3172,8 +2101,7 @@ else ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="$with_erlang:$with_erlang/bin:$PATH" -for as_dir in $as_dummy +for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -3200,7 +2128,7 @@ $as_echo "no" >&6; } fi if test "x$ac_pt_ERL" = x; then - ERL="" + ERL="not found" else case $cross_compiling:$ac_tool_warned in yes:) @@ -3213,1826 +2141,13 @@ esac else ERL="$ac_cv_path_ERL" fi - - - if test "z$ERLC" = "z" || test "z$ERL" = "z"; then - as_fn_error $? "erlang not found" "$LINENO" 5 - fi - - - cat >>conftest.erl <<_EOF - --module(conftest). --author('alexey@sevcom.net'). - --export([start/0]). - -start() -> - EIDirS = code:lib_dir("erl_interface") ++ "\n", - EILibS = libpath("erl_interface") ++ "\n", - RootDirS = code:root_dir() ++ "\n", - file:write_file("conftest.out", list_to_binary(EIDirS ++ EILibS ++ ssldef() ++ RootDirS)), - halt(). - -ssldef() -> - OTP = (catch erlang:system_info(otp_release)), - if - OTP >= "R14" -> "-DSSL40\n"; - OTP >= "R12" -> "-DSSL39\n"; - true -> "\n" - end. - -%% return physical architecture based on OS/Processor -archname() -> - ArchStr = erlang:system_info(system_architecture), - case os:type() of - {win32, _} -> "windows"; - {unix,UnixName} -> - Specs = string:tokens(ArchStr,"-"), - Cpu = case lists:nth(2,Specs) of - "pc" -> "x86"; - _ -> hd(Specs) - end, - atom_to_list(UnixName) ++ "-" ++ Cpu; - _ -> "generic" - end. - -%% Return arch-based library path or a default value if this directory -%% does not exist -libpath(App) -> - PrivDir = code:priv_dir(App), - ArchDir = archname(), - LibArchDir = filename:join([PrivDir,"lib",ArchDir]), - case file:list_dir(LibArchDir) of - %% Arch lib dir exists: We use it - {ok, _List} -> LibArchDir; - %% Arch lib dir does not exist: Return the default value - %% ({error, enoent}): - _Error -> code:lib_dir("erl_interface") ++ "/lib" - end. - -_EOF - - if ! $ERLC conftest.erl; then - as_fn_error $? "could not compile sample program" "$LINENO" 5 - fi - - if ! $ERL -s conftest -noshell; then - as_fn_error $? "could not run sample program" "$LINENO" 5 - fi - - if ! test -f conftest.out; then - as_fn_error $? "erlang program was not properly executed, (conftest.out was not produced)" "$LINENO" 5 - fi - - # First line - ERLANG_EI_DIR=`cat conftest.out | head -n 1` - # Second line - ERLANG_EI_LIB=`cat conftest.out | head -n 2 | tail -n 1` - # Third line - ERLANG_SSLVER=`cat conftest.out | head -n 3 | tail -n 1` - # End line - ERLANG_DIR=`cat conftest.out | tail -n 1` - - ERLANG_CFLAGS="-I$ERLANG_EI_DIR/include -I$ERLANG_DIR/usr/include" - ERLANG_LIBS="-L$ERLANG_EI_LIB -lerl_interface -lei" - - - - - - - -#locating iconv - - - -# Check whether --with-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then : - withval=$with_libiconv_prefix; - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/include; then CFLAGS="$CFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 -$as_echo_n "checking for iconv... " >&6; } -if ${am_cv_func_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else - - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - am_cv_func_iconv=yes -fi -rm -f core 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 -liconv" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - am_cv_lib_iconv=yes - am_cv_func_iconv=yes +if test "$ERL" = "not found"; then + as_fn_error $? "Erlang/OTP interpreter (erl) not found but required" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - am_save_CFLAGS="$CFLAGS" - am_save_LDFLAGS="$LDFLAGS" - LIBS="$LIBS -liconv" - LDFLAGS="$LDFLAGS -L/usr/local/lib" - CFLAGS="$CFLAGS -I/usr/local/include" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ -iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - am_cv_lib_iconv=yes - am_cv_func_iconv=yes - CPPFLAGS="$CPPFLAGS -I/usr/local/include" -else - LDFLAGS="$am_save_LDFLAGS" - CFLAGS="$am_save_CFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$am_save_LIBS" - fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 -$as_echo "$am_cv_func_iconv" >&6; } - if test "$am_cv_func_iconv" = yes; then - -$as_echo "#define HAVE_ICONV 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 -$as_echo_n "checking for iconv declaration... " >&6; } - if ${am_cv_proto_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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 -if ac_fn_c_try_compile "$LINENO"; then : - am_cv_proto_iconv_arg1="" -else - am_cv_proto_iconv_arg1="const" -fi -rm -f core 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/( /(/'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_t:- - }$am_cv_proto_iconv" >&5 -$as_echo "${ac_t:- - }$am_cv_proto_iconv" >&6; } - -cat >>confdefs.h <<_ACEOF -#define ICONV_CONST $am_cv_proto_iconv_arg1 -_ACEOF - - fi - LIBICONV= - if test "$am_cv_lib_iconv" = yes; then - LIBICONV="-liconv" - fi - - -#locating libexpat -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -# Check whether --with-expat was given. -if test "${with_expat+set}" = set; then : - withval=$with_expat; -fi - - - EXPAT_CFLAGS= - EXPAT_LIBS= - if test x"$with_expat" != x; then - EXPAT_CFLAGS="-I$with_expat/include" - EXPAT_LIBS="-L$with_expat/lib" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML_ParserCreate in -lexpat" >&5 -$as_echo_n "checking for XML_ParserCreate in -lexpat... " >&6; } -if ${ac_cv_lib_expat_XML_ParserCreate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lexpat "$EXPAT_LIBS" $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char XML_ParserCreate (); -int -main () -{ -return XML_ParserCreate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_expat_XML_ParserCreate=yes -else - ac_cv_lib_expat_XML_ParserCreate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_expat_XML_ParserCreate" >&5 -$as_echo "$ac_cv_lib_expat_XML_ParserCreate" >&6; } -if test "x$ac_cv_lib_expat_XML_ParserCreate" = xyes; then : - EXPAT_LIBS="$EXPAT_LIBS -lexpat" - expat_found=yes -else - expat_found=no -fi - - if test $expat_found = no; then - as_fn_error $? "Could not find development files of Expat library" "$LINENO" 5 - fi - expat_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $EXPAT_CFLAGS" - expat_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" - for ac_header in expat.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "expat.h" "ac_cv_header_expat_h" "$ac_includes_default" -if test "x$ac_cv_header_expat_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_EXPAT_H 1 -_ACEOF - -else - expat_found=no -fi - -done - - if test $expat_found = no; then - as_fn_error $? "Could not find expat.h" "$LINENO" 5 - fi - CFLAGS="$expat_save_CFLAGS" - CPPFLAGS="$expat_save_CPPFLAGS" - - - - - -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes -else - ac_cv_c_const=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h - -fi - - -# Check Erlang headers are installed -#AC_CHECK_HEADER(erl_driver.h,,[AC_MSG_ERROR([cannot find Erlang header files])]) - -# Change default prefix - - -# Checks for library functions. -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - -int -main () -{ -return ! malloc (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes -else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : - -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - - -$as_echo "#define malloc rpl_malloc" >>confdefs.h - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - - - -mod_irc= -make_mod_irc= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build mod_irc" >&5 -$as_echo_n "checking whether build mod_irc... " >&6; } -# Check whether --enable-mod_irc was given. -if test "${enable_mod_irc+set}" = set; then : - enableval=$enable_mod_irc; mr_enable_mod_irc="$enableval" -else - mr_enable_mod_irc=yes -fi - -if test "$mr_enable_mod_irc" = "yes"; then -mod_irc=mod_irc -make_mod_irc=mod_irc/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_mod_irc" >&5 -$as_echo "$mr_enable_mod_irc" >&6; } - - - - - -mod_muc= -make_mod_muc= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build mod_muc" >&5 -$as_echo_n "checking whether build mod_muc... " >&6; } -# Check whether --enable-mod_muc was given. -if test "${enable_mod_muc+set}" = set; then : - enableval=$enable_mod_muc; mr_enable_mod_muc="$enableval" -else - mr_enable_mod_muc=yes -fi - -if test "$mr_enable_mod_muc" = "yes"; then -mod_muc=mod_muc -make_mod_muc=mod_muc/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_mod_muc" >&5 -$as_echo "$mr_enable_mod_muc" >&6; } - - - - - -mod_proxy65= -make_mod_proxy65= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build mod_proxy65" >&5 -$as_echo_n "checking whether build mod_proxy65... " >&6; } -# Check whether --enable-mod_proxy65 was given. -if test "${enable_mod_proxy65+set}" = set; then : - enableval=$enable_mod_proxy65; mr_enable_mod_proxy65="$enableval" -else - mr_enable_mod_proxy65=yes -fi - -if test "$mr_enable_mod_proxy65" = "yes"; then -mod_proxy65=mod_proxy65 -make_mod_proxy65=mod_proxy65/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_mod_proxy65" >&5 -$as_echo "$mr_enable_mod_proxy65" >&6; } - - - - - -mod_pubsub= -make_mod_pubsub= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build mod_pubsub" >&5 -$as_echo_n "checking whether build mod_pubsub... " >&6; } -# Check whether --enable-mod_pubsub was given. -if test "${enable_mod_pubsub+set}" = set; then : - enableval=$enable_mod_pubsub; mr_enable_mod_pubsub="$enableval" -else - mr_enable_mod_pubsub=yes -fi - -if test "$mr_enable_mod_pubsub" = "yes"; then -mod_pubsub=mod_pubsub -make_mod_pubsub=mod_pubsub/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_mod_pubsub" >&5 -$as_echo "$mr_enable_mod_pubsub" >&6; } - - - - - -mod_pubsub_ng= -make_mod_pubsub_ng= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build mod_pubsub_ng" >&5 -$as_echo_n "checking whether build mod_pubsub_ng... " >&6; } -# Check whether --enable-mod_pubsub_ng was given. -if test "${enable_mod_pubsub_ng+set}" = set; then : - enableval=$enable_mod_pubsub_ng; mr_enable_mod_pubsub_ng="$enableval" -else - mr_enable_mod_pubsub_ng=yes -fi - -if test "$mr_enable_mod_pubsub_ng" = "yes"; then -mod_pubsub_ng=mod_pubsub_ng -make_mod_pubsub_ng=mod_pubsub_ng/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_mod_pubsub_ng" >&5 -$as_echo "$mr_enable_mod_pubsub_ng" >&6; } - - - - - -eldap= -make_eldap= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build eldap" >&5 -$as_echo_n "checking whether build eldap... " >&6; } -# Check whether --enable-eldap was given. -if test "${enable_eldap+set}" = set; then : - enableval=$enable_eldap; mr_enable_eldap="$enableval" -else - mr_enable_eldap=yes -fi - -if test "$mr_enable_eldap" = "yes"; then -eldap=eldap -make_eldap=eldap/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_eldap" >&5 -$as_echo "$mr_enable_eldap" >&6; } - - - - - -odbc= -make_odbc= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build odbc" >&5 -$as_echo_n "checking whether build odbc... " >&6; } -# Check whether --enable-odbc was given. -if test "${enable_odbc+set}" = set; then : - enableval=$enable_odbc; mr_enable_odbc="$enableval" -else - mr_enable_odbc=no -fi - -if test "$mr_enable_odbc" = "yes"; then -odbc=odbc -make_odbc=odbc/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_odbc" >&5 -$as_echo "$mr_enable_odbc" >&6; } - - - - - -tls= -make_tls= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build tls" >&5 -$as_echo_n "checking whether build tls... " >&6; } -# Check whether --enable-tls was given. -if test "${enable_tls+set}" = set; then : - enableval=$enable_tls; mr_enable_tls="$enableval" -else - mr_enable_tls=yes -fi - -if test "$mr_enable_tls" = "yes"; then -tls=tls -make_tls=tls/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_tls" >&5 -$as_echo "$mr_enable_tls" >&6; } - - - - - -web= -make_web= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build web" >&5 -$as_echo_n "checking whether build web... " >&6; } -# Check whether --enable-web was given. -if test "${enable_web+set}" = set; then : - enableval=$enable_web; mr_enable_web="$enableval" -else - mr_enable_web=yes -fi - -if test "$mr_enable_web" = "yes"; then -web=web -make_web=web/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_web" >&5 -$as_echo "$mr_enable_web" >&6; } - - - - - - -ejabberd_zlib= -make_ejabberd_zlib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build ejabberd_zlib" >&5 -$as_echo_n "checking whether build ejabberd_zlib... " >&6; } -# Check whether --enable-ejabberd_zlib was given. -if test "${enable_ejabberd_zlib+set}" = set; then : - enableval=$enable_ejabberd_zlib; mr_enable_ejabberd_zlib="$enableval" -else - mr_enable_ejabberd_zlib=yes -fi - -if test "$mr_enable_ejabberd_zlib" = "yes"; then -ejabberd_zlib=ejabberd_zlib -make_ejabberd_zlib=ejabberd_zlib/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_ejabberd_zlib" >&5 -$as_echo "$mr_enable_ejabberd_zlib" >&6; } - - - - -#locating zlib - -# Check whether --with-zlib was given. -if test "${with_zlib+set}" = set; then : - withval=$with_zlib; -fi - - -if test x"$ejabberd_zlib" != x; then - ZLIB_CFLAGS= - ZLIB_LIBS= - if test x"$with_zlib" != x; then - ZLIB_CFLAGS="-I$with_zlib/include" - ZLIB_LIBS="-L$with_zlib/lib" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzgets in -lz" >&5 -$as_echo_n "checking for gzgets in -lz... " >&6; } -if ${ac_cv_lib_z_gzgets+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz "$ZLIB_LIBS" $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gzgets (); -int -main () -{ -return gzgets (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_z_gzgets=yes -else - ac_cv_lib_z_gzgets=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzgets" >&5 -$as_echo "$ac_cv_lib_z_gzgets" >&6; } -if test "x$ac_cv_lib_z_gzgets" = xyes; then : - ZLIB_LIBS="$ZLIB_LIBS -lz" - zlib_found=yes -else - zlib_found=no -fi - - if test $zlib_found = no; then - as_fn_error $? "Could not find development files of zlib library. Install them or disable \`ejabberd_zlib' with: --disable-ejabberd_zlib" "$LINENO" 5 - fi - zlib_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ZLIB_CFLAGS" - zlib_save_CPPFLAGS="$CFLAGS" - CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS" - for ac_header in zlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ZLIB_H 1 -_ACEOF - -else - zlib_found=no -fi - -done - - if test $zlib_found = no; then - as_fn_error $? "Could not find zlib.h. Install it or disable \`ejabberd_zlib' with: --disable-ejabberd_zlib" "$LINENO" 5 - fi - CFLAGS="$zlib_save_CFLAGS" - CPPFLAGS="$zlib_save_CPPFLAGS" - - - -fi - - - -pam= -make_pam= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build pam" >&5 -$as_echo_n "checking whether build pam... " >&6; } -# Check whether --enable-pam was given. -if test "${enable_pam+set}" = set; then : - enableval=$enable_pam; mr_enable_pam="$enableval" -else - mr_enable_pam=no -fi - -if test "$mr_enable_pam" = "yes"; then -pam=pam -make_pam=pam/Makefile -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mr_enable_pam" >&5 -$as_echo "$mr_enable_pam" >&6; } - - - - -#locating PAM - -# Check whether --with-pam was given. -if test "${with_pam+set}" = set; then : - withval=$with_pam; -fi - -if test x"$pam" != x; then - PAM_CFLAGS= - PAM_LIBS= - if test x"$with_pam" != x; then - PAM_CFLAGS="-I$with_pam/include" - PAM_LIBS="-L$with_pam/lib" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5 -$as_echo_n "checking for pam_start in -lpam... " >&6; } -if ${ac_cv_lib_pam_pam_start+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpam "$PAM_LIBS" $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pam_start (); -int -main () -{ -return pam_start (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pam_pam_start=yes -else - ac_cv_lib_pam_pam_start=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_start" >&5 -$as_echo "$ac_cv_lib_pam_pam_start" >&6; } -if test "x$ac_cv_lib_pam_pam_start" = xyes; then : - PAM_LIBS="$PAM_LIBS -lpam" - pam_found=yes -else - pam_found=no -fi - - if test $pam_found = no; then - as_fn_error $? "Could not find development files of PAM library. Install them or disable \`pam' with: --disable-pam" "$LINENO" 5 - fi - pam_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PAM_CFLAGS" - pam_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $PAM_CFLAGS" - for ac_header in security/pam_appl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "security/pam_appl.h" "ac_cv_header_security_pam_appl_h" "$ac_includes_default" -if test "x$ac_cv_header_security_pam_appl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SECURITY_PAM_APPL_H 1 -_ACEOF - -else - pam_found=no -fi - -done - - if test $pam_found = no; then - as_fn_error $? "Could not find security/pam_appl.h. Install it or disable \`pam' with: --disable-pam" "$LINENO" 5 - fi - CFLAGS="$pam_save_CFLAGS" - CPPFLAGS="$pam_save_CPPFLAGS" - - - -fi - - -# Check whether --enable-hipe was given. -if test "${enable_hipe+set}" = set; then : - enableval=$enable_hipe; case "${enableval}" in - yes) hipe=true ;; - no) hipe=false ;; - *) as_fn_error $? "bad value ${enableval} for --enable-hipe" "$LINENO" 5 ;; -esac -else - hipe=false -fi - - - -# Check whether --enable-roster_gateway_workaround was given. -if test "${enable_roster_gateway_workaround+set}" = set; then : - enableval=$enable_roster_gateway_workaround; case "${enableval}" in - yes) roster_gateway_workaround=true ;; - no) roster_gateway_workaround=false ;; - *) as_fn_error $? "bad value ${enableval} for --enable-roster-gateway-workaround" "$LINENO" 5 ;; -esac -else - roster_gateway_workaround=false -fi - - - -# Check whether --enable-flash_hack was given. -if test "${enable_flash_hack+set}" = set; then : - enableval=$enable_flash_hack; case "${enableval}" in - yes) flash_hack=true ;; - no) flash_hack=false ;; - *) as_fn_error $? "bad value ${enableval} for --enable-flash-hack" "$LINENO" 5 ;; -esac -else - flash_hack=false -fi - - - -# Check whether --enable-mssql was given. -if test "${enable_mssql+set}" = set; then : - enableval=$enable_mssql; case "${enableval}" in - yes) db_type=mssql ;; - no) db_type=generic ;; - *) as_fn_error $? "bad value ${enableval} for --enable-mssql" "$LINENO" 5 ;; -esac -else - db_type=generic -fi - - - -# Check whether --enable-transient_supervisors was given. -if test "${enable_transient_supervisors+set}" = set; then : - enableval=$enable_transient_supervisors; case "${enableval}" in - yes) transient_supervisors=true ;; - no) transient_supervisors=false ;; - *) as_fn_error $? "bad value ${enableval} for --enable-transient_supervisors" "$LINENO" 5 ;; -esac -else - transient_supervisors=true -fi - - - -# Check whether --enable-full_xml was given. -if test "${enable_full_xml+set}" = set; then : - enableval=$enable_full_xml; case "${enableval}" in - yes) full_xml=true ;; - no) full_xml=false ;; - *) as_fn_error $? "bad value ${enableval} for --enable-full-xml" "$LINENO" 5 ;; -esac -else - full_xml=false -fi - - - -# Check whether --enable-nif was given. -if test "${enable_nif+set}" = set; then : - enableval=$enable_nif; case "${enableval}" in - yes) nif=true ;; - no) nif=false ;; - *) as_fn_error $? "bad value ${enableval} for --enable-nif" "$LINENO" 5 ;; -esac -else - nif=false -fi - - - -ac_config_files="$ac_config_files Makefile $make_mod_irc $make_mod_muc $make_mod_pubsub $make_mod_pubsub_ng $make_mod_proxy65 $make_eldap $make_pam $make_web stringprep/Makefile stun/Makefile $make_tls $make_odbc $make_ejabberd_zlib" - -#openssl - -# Check whether --with-openssl was given. -if test "${with_openssl+set}" = set; then : - withval=$with_openssl; -fi - -unset SSL_LIBS; -unset SSL_CFLAGS; -have_openssl=no -if test x"$tls" != x; then - for ssl_prefix in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do - printf "looking for openssl in $ssl_prefix...\n" - SSL_CFLAGS="-I$ssl_prefix/include" - SSL_LIBS="-L$ssl_prefix/lib -lcrypto" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5 -$as_echo_n "checking for SSL_new in -lssl... " >&6; } -if ${ac_cv_lib_ssl_SSL_new+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lssl $SSL_LIBS $SSL_CFLAGS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char SSL_new (); -int -main () -{ -return SSL_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ssl_SSL_new=yes -else - ac_cv_lib_ssl_SSL_new=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5 -$as_echo "$ac_cv_lib_ssl_SSL_new" >&6; } -if test "x$ac_cv_lib_ssl_SSL_new" = xyes; then : - have_openssl=yes -else - have_openssl=no -fi - - if test x"$have_openssl" = xyes; then - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="-I$ssl_prefix/include $CPPFLAGS" - for ac_header in openssl/ssl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default" -if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_SSL_H 1 -_ACEOF - have_openssl_h=yes -fi - -done - - CPPFLAGS=$save_CPPFLAGS - if test x"$have_openssl_h" = xyes; then - have_openssl=yes - printf "openssl found in $ssl_prefix\n"; - SSL_LIBS="-L$ssl_prefix/lib -lssl -lcrypto" - CPPFLAGS="-I$ssl_prefix/include $CPPFLAGS" - SSL_CFLAGS="-DHAVE_SSL" - break - fi - else - # Clear this from the autoconf cache, so in the next pass of - # this loop with different -L arguments, it will test again. - unset ac_cv_lib_ssl_SSL_new - fi - done -if test x${have_openssl} != xyes; then - as_fn_error $? "Could not find development files of OpenSSL library. Install them or disable \`tls' with: --disable-tls" "$LINENO" 5 -fi - - -fi - -# If ssl is kerberized it need krb5.h -# On RedHat and OpenBSD, krb5.h is in an unsual place: -KRB5_INCLUDE="`krb5-config --cflags 2>/dev/null`" -if test -n "$KRB5_INCLUDE" ; then - CPPFLAGS="$CPPFLAGS $KRB5_INCLUDE" -else - # For RedHat For BSD - for D in /usr/kerberos/include /usr/include/kerberos /usr/include/kerberosV - do - if test -d $D ; then - CPPFLAGS="$CPPFLAGS -I$D" - fi - done -fi -ac_fn_c_check_header_mongrel "$LINENO" "krb5.h" "ac_cv_header_krb5_h" "$ac_includes_default" -if test "x$ac_cv_header_krb5_h" = xyes; then : - -fi - - - -ENABLEUSER="" -# Check whether --enable-user was given. -if test "${enable_user+set}" = set; then : - enableval=$enable_user; case "${enableval}" in - yes) ENABLEUSER=`whoami` ;; - no) ENABLEUSER="" ;; - *) ENABLEUSER=$enableval - esac -fi - -if test "$ENABLEUSER" != ""; then - echo "allow this system user to start ejabberd: $ENABLEUSER" - INSTALLUSER=$ENABLEUSER - -fi - -ac_fn_c_check_header_mongrel "$LINENO" "openssl/md2.h" "ac_cv_header_openssl_md2_h" "$ac_includes_default" -if test "x$ac_cv_header_openssl_md2_h" = xyes; then : - md2=true -else - md2=false -fi - - - - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -$as_echo_n "checking target system type... " >&6; } -if ${ac_cv_target+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -$as_echo "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - -#AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$target") -#AC_SUBST(target_os) - - -case "$target_os" in - *darwin10*) - echo "Target OS is 'Darwin10'" - ac_ext=erl -ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' -ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' - if test -n "$ERLC"; then +if test -n "$ERLC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for erlc" >&5 $as_echo_n "checking for erlc... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ERLC" >&5 @@ -5043,7 +2158,7 @@ else set dummy ${ac_tool_prefix}erlc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ERLC+:} false; then : +if test "${ac_cv_path_ERLC+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ERLC in @@ -5086,7 +2201,7 @@ if test -z "$ac_cv_path_ERLC"; then set dummy erlc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_ERLC+:} false; then : +if test "${ac_cv_path_ac_pt_ERLC+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_ERLC in @@ -5122,7 +2237,7 @@ $as_echo "no" >&6; } fi if test "x$ac_pt_ERLC" = x; then - ERLC="" + ERLC="not found" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5138,45 +2253,1220 @@ fi fi +if test "$ERLC" = "not found"; then + as_fn_error $? "Erlang/OTP compiler (erlc) not found but required" "$LINENO" 5 +fi -if test "$cross_compiling" = yes; then : + +# Checks and sets ERLANG_ROOT_DIR and ERLANG_LIB_DIR variable +# AC_ERLANG_SUBST_ROOT_DIR +# AC_ERLANG_SUBST_LIB_DIR + +#locating escript +# Extract the first word of "escript", so it can be a program name with args. +set dummy escript; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ESCRIPT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ESCRIPT in + [\\/]* | ?:[\\/]*) + ac_cv_path_ESCRIPT="$ESCRIPT" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ESCRIPT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ESCRIPT=$ac_cv_path_ESCRIPT +if test -n "$ESCRIPT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ESCRIPT" >&5 +$as_echo "$ESCRIPT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +#locating rebar +# Extract the first word of "rebar", so it can be a program name with args. +set dummy rebar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_REBAR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $REBAR in + [\\/]* | ?:[\\/]*) + ac_cv_path_REBAR="$REBAR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_REBAR="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_REBAR" && ac_cv_path_REBAR="./rebar" + ;; +esac +fi +REBAR=$ac_cv_path_REBAR +if test -n "$REBAR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $REBAR" >&5 +$as_echo "$REBAR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +#locating make +# Extract the first word of "make", so it can be a program name with args. +set dummy make; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_MAKE+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MAKE"; then + ac_cv_prog_MAKE="$MAKE" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MAKE="make" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MAKE=$ac_cv_prog_MAKE +if test -n "$MAKE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE" >&5 +$as_echo "$MAKE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +if test "x$ESCRIPT" = "x"; then + as_fn_error $? "'escript' was not found" "$LINENO" 5 +fi + +if test "x$MAKE" = "x"; then + as_fn_error $? "'make' was not found" "$LINENO" 5 +fi + +# Change default prefix + + +# Check whether --enable-hipe was given. +if test "${enable_hipe+set}" = set; then : + enableval=$enable_hipe; case "${enableval}" in + yes) hipe=true ;; + no) hipe=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-hipe" "$LINENO" 5 ;; +esac +else + hipe=false +fi + + +# Check whether --enable-roster_gateway_workaround was given. +if test "${enable_roster_gateway_workaround+set}" = set; then : + enableval=$enable_roster_gateway_workaround; case "${enableval}" in + yes) roster_gateway_workaround=true ;; + no) roster_gateway_workaround=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-roster-gateway-workaround" "$LINENO" 5 ;; +esac +else + roster_gateway_workaround=false +fi + + +# Check whether --enable-flash_hack was given. +if test "${enable_flash_hack+set}" = set; then : + enableval=$enable_flash_hack; case "${enableval}" in + yes) flash_hack=true ;; + no) flash_hack=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-flash-hack" "$LINENO" 5 ;; +esac +else + flash_hack=false +fi + + +# Check whether --enable-transient_supervisors was given. +if test "${enable_transient_supervisors+set}" = set; then : + enableval=$enable_transient_supervisors; case "${enableval}" in + yes) transient_supervisors=true ;; + no) transient_supervisors=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-transient_supervisors" "$LINENO" 5 ;; +esac +else + transient_supervisors=false +fi + + +# Check whether --enable-full_xml was given. +if test "${enable_full_xml+set}" = set; then : + enableval=$enable_full_xml; case "${enableval}" in + yes) full_xml=true ;; + no) full_xml=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-full-xml" "$LINENO" 5 ;; +esac +else + full_xml=false +fi + + +# Check whether --enable-mssql was given. +if test "${enable_mssql+set}" = set; then : + enableval=$enable_mssql; case "${enableval}" in + yes) db_type=mssql ;; + no) db_type=generic ;; + *) as_fn_error $? "bad value ${enableval} for --enable-mssql" "$LINENO" 5 ;; +esac +else + db_type=generic +fi + + +# Check whether --enable-tools was given. +if test "${enable_tools+set}" = set; then : + enableval=$enable_tools; case "${enableval}" in + yes) tools=true ;; + no) tools=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-tools" "$LINENO" 5 ;; +esac +else + tools=false +fi + + +# Check whether --enable-all was given. +if test "${enable_all+set}" = set; then : + enableval=$enable_all; case "${enableval}" in + yes) nif=true mysql=true pgsql=true pam=true zlib=true stun=true riak=true json=true iconv=true debug=true pubsub_ng=true http=true ;; + no) nif=false mysql=false pgsql=false pam=false zlib=false stun=false riak=false json=false iconv=false debug=false pubsub_ng=false http=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-all" "$LINENO" 5 ;; +esac +fi + + +# Check whether --enable-nif was given. +if test "${enable_nif+set}" = set; then : + enableval=$enable_nif; case "${enableval}" in + yes) nif=true ;; + no) nif=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-nif" "$LINENO" 5 ;; +esac +else + if test "x$nif" = "x"; then nif=false; fi +fi + + +# Check whether --enable-mysql was given. +if test "${enable_mysql+set}" = set; then : + enableval=$enable_mysql; case "${enableval}" in + yes) mysql=true ;; + no) mysql=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-mysql" "$LINENO" 5 ;; +esac +else + if test "x$mysql" = "x"; then mysql=false; fi +fi + + +# Check whether --enable-pgsql was given. +if test "${enable_pgsql+set}" = set; then : + enableval=$enable_pgsql; case "${enableval}" in + yes) pgsql=true ;; + no) pgsql=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-pgsql" "$LINENO" 5 ;; +esac +else + if test "x$pgsql" = "x"; then pgsql=false; fi +fi + + +# Check whether --enable-pam was given. +if test "${enable_pam+set}" = set; then : + enableval=$enable_pam; case "${enableval}" in + yes) pam=true ;; + no) pam=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-pam" "$LINENO" 5 ;; +esac +else + if test "x$pam" = "x"; then pam=false; fi +fi + + +# Check whether --enable-zlib was given. +if test "${enable_zlib+set}" = set; then : + enableval=$enable_zlib; case "${enableval}" in + yes) zlib=true ;; + no) zlib=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-zlib" "$LINENO" 5 ;; +esac +else + if test "x$zlib" = "x"; then zlib=true; fi +fi + + +# Check whether --enable-stun was given. +if test "${enable_stun+set}" = set; then : + enableval=$enable_stun; case "${enableval}" in + yes) stun=true ;; + no) stun=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-stun" "$LINENO" 5 ;; +esac +else + if test "x$stun" = "x"; then stun=false; fi +fi + + +# Check whether --enable-riak was given. +if test "${enable_riak+set}" = set; then : + enableval=$enable_riak; case "${enableval}" in + yes) riak=true ;; + no) riak=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-riak" "$LINENO" 5 ;; +esac +else + if test "x$riak" = "x"; then riak=false; fi +fi + + +# Check whether --enable-json was given. +if test "${enable_json+set}" = set; then : + enableval=$enable_json; case "${enableval}" in + yes) json=true ;; + no) json=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-json" "$LINENO" 5 ;; +esac +else + if test "x$json" = "x"; then json=false; fi +fi + + +# Check whether --enable-iconv was given. +if test "${enable_iconv+set}" = set; then : + enableval=$enable_iconv; case "${enableval}" in + yes) iconv=true ;; + no) iconv=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-iconv" "$LINENO" 5 ;; +esac +else + if test "x$iconv" = "x"; then iconv=true; fi +fi + + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; case "${enableval}" in + yes) debug=true ;; + no) debug=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-debug" "$LINENO" 5 ;; +esac +else + if test "x$debug" = "x"; then debug=true; fi +fi + + +# Check whether --enable-pubsub_ng was given. +if test "${enable_pubsub_ng+set}" = set; then : + enableval=$enable_pubsub_ng; case "${enableval}" in + yes) pubsub_ng=true ;; + no) pubsub_ng=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-pubsub-ng" "$LINENO" 5 ;; +esac +else + if test "x$pubsub_ng" = "x"; then pubsub_ng=false; fi +fi + + +# Check whether --enable-http was given. +if test "${enable_http+set}" = set; then : + enableval=$enable_http; case "${enableval}" in + yes) http=true ;; + no) http=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-http" "$LINENO" 5 ;; +esac +else + if test "x$http" = "x"; then http=false; fi +fi + + +ac_config_files="$ac_config_files Makefile vars.config src/ejabberd.app.src" + + +ENABLEUSER="" +# Check whether --enable-user was given. +if test "${enable_user+set}" = set; then : + enableval=$enable_user; case "${enableval}" in + yes) ENABLEUSER=`whoami` ;; + no) ENABLEUSER="" ;; + *) ENABLEUSER=$enableval + esac +fi + +if test "$ENABLEUSER" != ""; then + echo "allow this system user to start ejabberd: $ENABLEUSER" + INSTALLUSER=$ENABLEUSER + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'sasl' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'sasl' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_sasl+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling -See \`config.log' for more details" "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5 ; } else cat > conftest.$ac_ext <<_ACEOF -module(conftest). -export([start/0]). start() -> - halt(case erlang:system_info(wordsize) of - 8 -> 0; 4 -> 1 end) + ReturnValue = case code:lib_dir("sasl") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) . _ACEOF if ac_fn_erl_try_run "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: found 64-bit Erlang" >&5 -$as_echo "$as_me: found 64-bit Erlang" >&6;} - CBIT=-m64 + ac_cv_erlang_lib_dir_sasl=`cat conftest.out` + rm -f conftest.out else - { $as_echo "$as_me:${as_lineno-$LINENO}: found 32-bit Erlang" >&5 -$as_echo "$as_me: found 32-bit Erlang" >&6;} - CBIT=-m32 + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_sasl="not found" + rm -f conftest.out + fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - ;; - *) - echo "Target OS is '$target_os'" - CBIT="" - ;; -esac -CFLAGS="$CFLAGS $CBIT" -LD_SHARED="$LD_SHARED $CBIT" -echo "CBIT is set to '$CBIT'" + 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_sasl" >&5 +$as_echo "$ac_cv_erlang_lib_dir_sasl" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'sasl' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'sasl' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_sasl+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_sasl" = "not found"; then : + ac_cv_erlang_lib_ver_sasl="not found" +else + ac_cv_erlang_lib_ver_sasl=`$as_echo "$ac_cv_erlang_lib_dir_sasl" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_sasl" >&5 +$as_echo "$ac_cv_erlang_lib_ver_sasl" >&6; } +ERLANG_LIB_DIR_sasl=$ac_cv_erlang_lib_dir_sasl + +ERLANG_LIB_VER_sasl=$ac_cv_erlang_lib_ver_sasl + +if test "$ac_cv_erlang_lib_dir_sasl" = "not found"; then : + as_fn_error $? "Erlang application 'sasl' was not found" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'crypto' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'crypto' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_crypto+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("crypto") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_crypto=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_crypto="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_crypto" >&5 +$as_echo "$ac_cv_erlang_lib_dir_crypto" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'crypto' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'crypto' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_crypto+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_crypto" = "not found"; then : + ac_cv_erlang_lib_ver_crypto="not found" +else + ac_cv_erlang_lib_ver_crypto=`$as_echo "$ac_cv_erlang_lib_dir_crypto" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_crypto" >&5 +$as_echo "$ac_cv_erlang_lib_ver_crypto" >&6; } +ERLANG_LIB_DIR_crypto=$ac_cv_erlang_lib_dir_crypto + +ERLANG_LIB_VER_crypto=$ac_cv_erlang_lib_ver_crypto + +if test "$ac_cv_erlang_lib_dir_crypto" = "not found"; then : + as_fn_error $? "Erlang application 'crypto' was not found" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'public_key' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'public_key' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_public_key+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("public_key") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_public_key=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_public_key="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_public_key" >&5 +$as_echo "$ac_cv_erlang_lib_dir_public_key" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'public_key' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'public_key' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_public_key+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_public_key" = "not found"; then : + ac_cv_erlang_lib_ver_public_key="not found" +else + ac_cv_erlang_lib_ver_public_key=`$as_echo "$ac_cv_erlang_lib_dir_public_key" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_public_key" >&5 +$as_echo "$ac_cv_erlang_lib_ver_public_key" >&6; } +ERLANG_LIB_DIR_public_key=$ac_cv_erlang_lib_dir_public_key + +ERLANG_LIB_VER_public_key=$ac_cv_erlang_lib_ver_public_key + +if test "$ac_cv_erlang_lib_dir_public_key" = "not found"; then : + as_fn_error $? "Erlang application 'public_key' was not found" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'ssl' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'ssl' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_ssl+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("ssl") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_ssl=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_ssl="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_ssl" >&5 +$as_echo "$ac_cv_erlang_lib_dir_ssl" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'ssl' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'ssl' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_ssl+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_ssl" = "not found"; then : + ac_cv_erlang_lib_ver_ssl="not found" +else + ac_cv_erlang_lib_ver_ssl=`$as_echo "$ac_cv_erlang_lib_dir_ssl" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_ssl" >&5 +$as_echo "$ac_cv_erlang_lib_ver_ssl" >&6; } +ERLANG_LIB_DIR_ssl=$ac_cv_erlang_lib_dir_ssl + +ERLANG_LIB_VER_ssl=$ac_cv_erlang_lib_ver_ssl + +if test "$ac_cv_erlang_lib_dir_ssl" = "not found"; then : + as_fn_error $? "Erlang application 'ssl' was not found" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'mnesia' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'mnesia' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_mnesia+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("mnesia") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_mnesia=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_mnesia="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_mnesia" >&5 +$as_echo "$ac_cv_erlang_lib_dir_mnesia" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'mnesia' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'mnesia' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_mnesia+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_mnesia" = "not found"; then : + ac_cv_erlang_lib_ver_mnesia="not found" +else + ac_cv_erlang_lib_ver_mnesia=`$as_echo "$ac_cv_erlang_lib_dir_mnesia" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_mnesia" >&5 +$as_echo "$ac_cv_erlang_lib_ver_mnesia" >&6; } +ERLANG_LIB_DIR_mnesia=$ac_cv_erlang_lib_dir_mnesia + +ERLANG_LIB_VER_mnesia=$ac_cv_erlang_lib_ver_mnesia + +if test "$ac_cv_erlang_lib_dir_mnesia" = "not found"; then : + as_fn_error $? "Erlang application 'mnesia' was not found" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'inets' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'inets' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_inets+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("inets") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_inets=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_inets="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_inets" >&5 +$as_echo "$ac_cv_erlang_lib_dir_inets" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'inets' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'inets' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_inets+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_inets" = "not found"; then : + ac_cv_erlang_lib_ver_inets="not found" +else + ac_cv_erlang_lib_ver_inets=`$as_echo "$ac_cv_erlang_lib_dir_inets" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_inets" >&5 +$as_echo "$ac_cv_erlang_lib_ver_inets" >&6; } +ERLANG_LIB_DIR_inets=$ac_cv_erlang_lib_dir_inets + +ERLANG_LIB_VER_inets=$ac_cv_erlang_lib_ver_inets + +if test "$ac_cv_erlang_lib_dir_inets" = "not found"; then : + as_fn_error $? "Erlang application 'inets' was not found" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'odbc' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'odbc' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_odbc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("odbc") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_odbc=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_odbc="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_odbc" >&5 +$as_echo "$ac_cv_erlang_lib_dir_odbc" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'odbc' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'odbc' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_odbc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_odbc" = "not found"; then : + ac_cv_erlang_lib_ver_odbc="not found" +else + ac_cv_erlang_lib_ver_odbc=`$as_echo "$ac_cv_erlang_lib_dir_odbc" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_odbc" >&5 +$as_echo "$ac_cv_erlang_lib_ver_odbc" >&6; } +ERLANG_LIB_DIR_odbc=$ac_cv_erlang_lib_dir_odbc + +ERLANG_LIB_VER_odbc=$ac_cv_erlang_lib_ver_odbc + +if test "$ac_cv_erlang_lib_dir_odbc" = "not found"; then : + as_fn_error $? "Erlang application 'odbc' was not found" "$LINENO" 5 +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'compiler' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'compiler' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_compiler+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("compiler") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_compiler=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_compiler="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_compiler" >&5 +$as_echo "$ac_cv_erlang_lib_dir_compiler" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'compiler' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'compiler' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_compiler+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_compiler" = "not found"; then : + ac_cv_erlang_lib_ver_compiler="not found" +else + ac_cv_erlang_lib_ver_compiler=`$as_echo "$ac_cv_erlang_lib_dir_compiler" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_compiler" >&5 +$as_echo "$ac_cv_erlang_lib_ver_compiler" >&6; } +ERLANG_LIB_DIR_compiler=$ac_cv_erlang_lib_dir_compiler + +ERLANG_LIB_VER_compiler=$ac_cv_erlang_lib_ver_compiler + +if test "$ac_cv_erlang_lib_dir_compiler" = "not found"; then : + as_fn_error $? "Erlang application 'compiler' was not found" "$LINENO" 5 +fi + +if test "x$tools" = "xtrue"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'tools' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'tools' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_tools+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("tools") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_tools=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_tools="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_tools" >&5 +$as_echo "$ac_cv_erlang_lib_dir_tools" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'tools' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'tools' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_tools+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_tools" = "not found"; then : + ac_cv_erlang_lib_ver_tools="not found" +else + ac_cv_erlang_lib_ver_tools=`$as_echo "$ac_cv_erlang_lib_dir_tools" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_tools" >&5 +$as_echo "$ac_cv_erlang_lib_ver_tools" >&6; } +ERLANG_LIB_DIR_tools=$ac_cv_erlang_lib_dir_tools + +ERLANG_LIB_VER_tools=$ac_cv_erlang_lib_ver_tools + +if test "$ac_cv_erlang_lib_dir_tools" = "not found"; then : + as_fn_error $? "Erlang application 'tools' was not found" "$LINENO" 5 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'runtime_tools' library subdirectory" >&5 +$as_echo_n "checking for Erlang/OTP 'runtime_tools' library subdirectory... " >&6; } +if test "${ac_cv_erlang_lib_dir_runtime_tools+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=erl +ac_compile='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5' +ac_link='$ERLC $ERLCFLAGS -b beam conftest.$ac_ext >&5 && echo "#!/bin/sh" > conftest$ac_exeext && $as_echo "\"$ERL\" -run conftest start -run init stop -noshell" >> conftest$ac_exeext && chmod +x conftest$ac_exeext' + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run test program while cross compiling +See \`config.log' for more details" "$LINENO" 5 ; } +else + cat > conftest.$ac_ext <<_ACEOF +-module(conftest). +-export([start/0]). + +start() -> + ReturnValue = case code:lib_dir("runtime_tools") of + {error, bad_name} -> + file:write_file("conftest.out", "not found\n"), + 1; + LibDir -> + file:write_file("conftest.out", LibDir), + 0 + end, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir_runtime_tools=`cat conftest.out` + rm -f conftest.out +else + if test ! -f conftest.out; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "test Erlang program execution failed +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_erlang_lib_dir_runtime_tools="not found" + rm -f conftest.out + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam 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 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_dir_runtime_tools" >&5 +$as_echo "$ac_cv_erlang_lib_dir_runtime_tools" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP 'runtime_tools' library version" >&5 +$as_echo_n "checking for Erlang/OTP 'runtime_tools' library version... " >&6; } +if test "${ac_cv_erlang_lib_ver_runtime_tools+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$ac_cv_erlang_lib_dir_runtime_tools" = "not found"; then : + ac_cv_erlang_lib_ver_runtime_tools="not found" +else + ac_cv_erlang_lib_ver_runtime_tools=`$as_echo "$ac_cv_erlang_lib_dir_runtime_tools" | sed -n -e 's,^.*-\([^/-]*\)$,\1,p'` +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_erlang_lib_ver_runtime_tools" >&5 +$as_echo "$ac_cv_erlang_lib_ver_runtime_tools" >&6; } +ERLANG_LIB_DIR_runtime_tools=$ac_cv_erlang_lib_dir_runtime_tools + +ERLANG_LIB_VER_runtime_tools=$ac_cv_erlang_lib_ver_runtime_tools + +if test "$ac_cv_erlang_lib_dir_runtime_tools" = "not found"; then : + as_fn_error $? "Erlang application 'runtime_tools' was not found" "$LINENO" 5 +fi + +fi + + + + + + + + + + + + + + + + + + + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5242,21 +3532,10 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then + test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi + cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -5324,7 +3603,7 @@ LTLIBOBJS=$ac_ltlibobjs -: "${CONFIG_STATUS=./config.status}" +: ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -5425,7 +3704,6 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5733,7 +4011,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by ejabberd $as_me 3.0.0, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5786,7 +4064,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ ejabberd config.status 3.0.0 -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -5795,6 +4073,7 @@ gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' +INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF @@ -5896,21 +4175,10 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "$make_mod_irc") CONFIG_FILES="$CONFIG_FILES $make_mod_irc" ;; - "$make_mod_muc") CONFIG_FILES="$CONFIG_FILES $make_mod_muc" ;; - "$make_mod_pubsub") CONFIG_FILES="$CONFIG_FILES $make_mod_pubsub" ;; - "$make_mod_pubsub_ng") CONFIG_FILES="$CONFIG_FILES $make_mod_pubsub_ng" ;; - "$make_mod_proxy65") CONFIG_FILES="$CONFIG_FILES $make_mod_proxy65" ;; - "$make_eldap") CONFIG_FILES="$CONFIG_FILES $make_eldap" ;; - "$make_pam") CONFIG_FILES="$CONFIG_FILES $make_pam" ;; - "$make_web") CONFIG_FILES="$CONFIG_FILES $make_web" ;; - "stringprep/Makefile") CONFIG_FILES="$CONFIG_FILES stringprep/Makefile" ;; - "stun/Makefile") CONFIG_FILES="$CONFIG_FILES stun/Makefile" ;; - "$make_tls") CONFIG_FILES="$CONFIG_FILES $make_tls" ;; - "$make_odbc") CONFIG_FILES="$CONFIG_FILES $make_odbc" ;; - "$make_ejabberd_zlib") CONFIG_FILES="$CONFIG_FILES $make_ejabberd_zlib" ;; + "vars.config") CONFIG_FILES="$CONFIG_FILES vars.config" ;; + "src/ejabberd.app.src") CONFIG_FILES="$CONFIG_FILES src/ejabberd.app.src" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -5931,10 +4199,9 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= ac_tmp= + tmp= trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -5942,13 +4209,12 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -5970,7 +4236,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF @@ -5998,7 +4264,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -6046,7 +4312,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && +cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -6078,7 +4344,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -6118,7 +4384,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -6137,7 +4403,7 @@ do for ac_f do case $ac_f in - -) ac_f="$ac_tmp/stdin";; + -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -6146,7 +4412,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -6172,8 +4438,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -6243,6 +4509,10 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix # CONFIG_FILE # + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 @@ -6296,24 +4566,24 @@ s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$ac_tmp/stdin" + rm -f "$tmp/stdin" case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; diff --git a/configure.ac b/configure.ac new file mode 100644 index 000000000..1b016ea27 --- /dev/null +++ b/configure.ac @@ -0,0 +1,266 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.53) +AC_PACKAGE_VERSION(3.0.0) +AC_INIT(ejabberd, 3.0.0, [ejabberd@process-one.net], [ejabberd]) + +# Checks for programs. +AC_PROG_MAKE_SET +AC_PROG_INSTALL +AC_PROG_SED + +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -Wall" +fi + +# Checks Erlang runtime and compiler +AC_ERLANG_NEED_ERL +AC_ERLANG_NEED_ERLC + +# Checks and sets ERLANG_ROOT_DIR and ERLANG_LIB_DIR variable +# AC_ERLANG_SUBST_ROOT_DIR +# AC_ERLANG_SUBST_LIB_DIR + +#locating escript +AC_PATH_PROG([ESCRIPT], [escript], []) + +#locating rebar +AC_PATH_PROG([REBAR], [rebar], [./rebar]) + +#locating make +AC_CHECK_PROG([MAKE], [make], [make], []) + +if test "x$ESCRIPT" = "x"; then + AC_MSG_ERROR(['escript' was not found]) +fi + +if test "x$MAKE" = "x"; then + AC_MSG_ERROR(['make' was not found]) +fi + +# Change default prefix +AC_PREFIX_DEFAULT(/) + +AC_ARG_ENABLE(hipe, +[AC_HELP_STRING([--enable-hipe], [compile natively with HiPE, not recommended (default: no)])], +[case "${enableval}" in + yes) hipe=true ;; + no) hipe=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-hipe) ;; +esac],[hipe=false]) + +AC_ARG_ENABLE(roster_gateway_workaround, +[AC_HELP_STRING([--enable-roster-gateway-workaround], [turn on workaround for processing gateway subscriptions (default: no)])], +[case "${enableval}" in + yes) roster_gateway_workaround=true ;; + no) roster_gateway_workaround=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-roster-gateway-workaround) ;; +esac],[roster_gateway_workaround=false]) + +AC_ARG_ENABLE(flash_hack, +[AC_HELP_STRING([--enable-flash-hack], [support Adobe Flash client XML (default: no)])], +[case "${enableval}" in + yes) flash_hack=true ;; + no) flash_hack=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-flash-hack) ;; +esac],[flash_hack=false]) + +AC_ARG_ENABLE(transient_supervisors, +[AC_HELP_STRING([--enable-transient_supervisors], [use Erlang supervision for transient process (default: no)])], +[case "${enableval}" in + yes) transient_supervisors=true ;; + no) transient_supervisors=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-transient_supervisors) ;; +esac],[transient_supervisors=false]) + +AC_ARG_ENABLE(full_xml, +[AC_HELP_STRING([--enable-full-xml], [use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)])], +[case "${enableval}" in + yes) full_xml=true ;; + no) full_xml=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-full-xml) ;; +esac],[full_xml=false]) + +AC_ARG_ENABLE(mssql, +[AC_HELP_STRING([--enable-mssql], [use Microsoft SQL Server database (default: no, requires --enable-odbc)])], +[case "${enableval}" in + yes) db_type=mssql ;; + no) db_type=generic ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-mssql) ;; +esac],[db_type=generic]) + +AC_ARG_ENABLE(tools, +[AC_HELP_STRING([--enable-tools], [build development tools (currently the ejabberd profiler only, default: no)])], +[case "${enableval}" in + yes) tools=true ;; + no) tools=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;; +esac],[tools=false]) + +AC_ARG_ENABLE(all, +[AC_HELP_STRING([--enable-all], [same as --enable-nif --enable-mysql --enable-pgsql --enable-pam --enable-zlib --enable-stun --enable-riak --enable-json --enable-iconv --enable-debug --enable-pubsub-ng --enable-http (useful for Dialyzer checks, default: no)])], +[case "${enableval}" in + yes) nif=true mysql=true pgsql=true pam=true zlib=true stun=true riak=true json=true iconv=true debug=true pubsub_ng=true http=true ;; + no) nif=false mysql=false pgsql=false pam=false zlib=false stun=false riak=false json=false iconv=false debug=false pubsub_ng=false http=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-all) ;; +esac],[]) + +AC_ARG_ENABLE(nif, +[AC_HELP_STRING([--enable-nif], [replace some functions with C equivalents. Requires Erlang R13B04 or higher (default: no)])], +[case "${enableval}" in + yes) nif=true ;; + no) nif=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-nif) ;; +esac],[if test "x$nif" = "x"; then nif=false; fi]) + +AC_ARG_ENABLE(mysql, +[AC_HELP_STRING([--enable-mysql], [enable MySQL support (default: no)])], +[case "${enableval}" in + yes) mysql=true ;; + no) mysql=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-mysql) ;; +esac],[if test "x$mysql" = "x"; then mysql=false; fi]) + +AC_ARG_ENABLE(pgsql, +[AC_HELP_STRING([--enable-pgsql], [enable PostgreSQL support (default: no)])], +[case "${enableval}" in + yes) pgsql=true ;; + no) pgsql=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-pgsql) ;; +esac],[if test "x$pgsql" = "x"; then pgsql=false; fi]) + +AC_ARG_ENABLE(pam, +[AC_HELP_STRING([--enable-pam], [enable PAM support (default: no)])], +[case "${enableval}" in + yes) pam=true ;; + no) pam=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-pam) ;; +esac],[if test "x$pam" = "x"; then pam=false; fi]) + +AC_ARG_ENABLE(zlib, +[AC_HELP_STRING([--enable-zlib], [enable Stream Compression (XEP-0138) using zlib (default: yes)])], +[case "${enableval}" in + yes) zlib=true ;; + no) zlib=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-zlib) ;; +esac],[if test "x$zlib" = "x"; then zlib=true; fi]) + +AC_ARG_ENABLE(stun, +[AC_HELP_STRING([--enable-stun], [enable STUN support (default: no)])], +[case "${enableval}" in + yes) stun=true ;; + no) stun=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-stun) ;; +esac],[if test "x$stun" = "x"; then stun=false; fi]) + +AC_ARG_ENABLE(riak, +[AC_HELP_STRING([--enable-riak], [enable Riak support (default: no)])], +[case "${enableval}" in + yes) riak=true ;; + no) riak=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-riak) ;; +esac],[if test "x$riak" = "x"; then riak=false; fi]) + +AC_ARG_ENABLE(json, +[AC_HELP_STRING([--enable-json], [enable JSON support for mod_bosh (default: no)])], +[case "${enableval}" in + yes) json=true ;; + no) json=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-json) ;; +esac],[if test "x$json" = "x"; then json=false; fi]) + +AC_ARG_ENABLE(iconv, +[AC_HELP_STRING([--enable-iconv], [enable iconv support (default: yes)])], +[case "${enableval}" in + yes) iconv=true ;; + no) iconv=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-iconv) ;; +esac],[if test "x$iconv" = "x"; then iconv=true; fi]) + +AC_ARG_ENABLE(debug, +[AC_HELP_STRING([--enable-debug], [enable debug information (default: yes)])], +[case "${enableval}" in + yes) debug=true ;; + no) debug=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; +esac],[if test "x$debug" = "x"; then debug=true; fi]) + +AC_ARG_ENABLE(pubsub_ng, +[AC_HELP_STRING([--enable-pubsub-ng], [enable PubSub NG (default: no)])], +[case "${enableval}" in + yes) pubsub_ng=true ;; + no) pubsub_ng=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-pubsub-ng) ;; +esac],[if test "x$pubsub_ng" = "x"; then pubsub_ng=false; fi]) + +AC_ARG_ENABLE(http, +[AC_HELP_STRING([--enable-http], [build external HTTP libraries ('ibrowse' and 'lhttpc', default: no)])], +[case "${enableval}" in + yes) http=true ;; + no) http=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-http) ;; +esac],[if test "x$http" = "x"; then http=false; fi]) + +AC_CONFIG_FILES([Makefile + vars.config + src/ejabberd.app.src]) + +ENABLEUSER="" +AC_ARG_ENABLE(user, + [AS_HELP_STRING([--enable-user[[[[=USER]]]]], [allow this system user to start ejabberd (default: no)])], + [case "${enableval}" in + yes) ENABLEUSER=`whoami` ;; + no) ENABLEUSER="" ;; + *) ENABLEUSER=$enableval + esac], + []) +if test "$ENABLEUSER" != ""; then + echo "allow this system user to start ejabberd: $ENABLEUSER" + AC_SUBST([INSTALLUSER], [$ENABLEUSER]) +fi + +AC_ERLANG_CHECK_LIB([sasl], [], + [AC_MSG_ERROR([Erlang application 'sasl' was not found])]) +AC_ERLANG_CHECK_LIB([crypto], [], + [AC_MSG_ERROR([Erlang application 'crypto' was not found])]) +AC_ERLANG_CHECK_LIB([public_key], [], + [AC_MSG_ERROR([Erlang application 'public_key' was not found])]) +AC_ERLANG_CHECK_LIB([ssl], [], + [AC_MSG_ERROR([Erlang application 'ssl' was not found])]) +AC_ERLANG_CHECK_LIB([mnesia], [], + [AC_MSG_ERROR([Erlang application 'mnesia' was not found])]) +AC_ERLANG_CHECK_LIB([inets], [], + [AC_MSG_ERROR([Erlang application 'inets' was not found])]) +AC_ERLANG_CHECK_LIB([odbc], [], + [AC_MSG_ERROR([Erlang application 'odbc' was not found])]) +AC_ERLANG_CHECK_LIB([compiler], [], + [AC_MSG_ERROR([Erlang application 'compiler' was not found])]) +if test "x$tools" = "xtrue"; then + AC_ERLANG_CHECK_LIB([tools], [], + [AC_MSG_ERROR([Erlang application 'tools' was not found])]) + AC_ERLANG_CHECK_LIB([runtime_tools], [], + [AC_MSG_ERROR([Erlang application 'runtime_tools' was not found])]) +fi + +AC_SUBST(hipe) +AC_SUBST(roster_gateway_workaround) +AC_SUBST(flash_hack) +AC_SUBST(transient_supervisors) +AC_SUBST(full_xml) +AC_SUBST(nif) +AC_SUBST(db_type) +AC_SUBST(mysql) +AC_SUBST(pgsql) +AC_SUBST(pam) +AC_SUBST(zlib) +AC_SUBST(stun) +AC_SUBST(riak) +AC_SUBST(json) +AC_SUBST(iconv) +AC_SUBST(debug) +AC_SUBST(pubsub_ng) +AC_SUBST(http) +AC_SUBST(tools) + +AC_OUTPUT diff --git a/src/configure.bat b/configure.bat similarity index 100% rename from src/configure.bat rename to configure.bat diff --git a/contrib/extract_translations/prepare-translation.sh b/contrib/extract_translations/prepare-translation.sh index 9f2d54ad6..0f16eeeb8 100755 --- a/contrib/extract_translations/prepare-translation.sh +++ b/contrib/extract_translations/prepare-translation.sh @@ -15,13 +15,13 @@ prepare_dirs () ERL=`which erl` EJA_SRC_DIR=$EJA_DIR/src/ - EJA_MSGS_DIR=$EJA_SRC_DIR/msgs/ + EJA_MSGS_DIR=$EJA_DIR/priv/msgs/ EXTRACT_DIR=$EJA_DIR/contrib/extract_translations/ EXTRACT_ERL=$EXTRACT_DIR/extract_translations.erl EXTRACT_BEAM=$EXTRACT_DIR/extract_translations.beam SRC_DIR=$RUN_DIR/src - MSGS_DIR=$SRC_DIR/msgs + MSGS_DIR=$EJA_DIR/priv/msgs if !([[ -n $EJA_DIR ]]) then @@ -288,8 +288,8 @@ translation_instructions () echo " $MSGS_PATH" } -EJA_DIR=`pwd`/.. -RUN_DIR=`pwd`/.. +EJA_DIR=`pwd` +RUN_DIR=`pwd` PROJECT=ejabberd while [ $# -ne 0 ] ; do diff --git a/doc/guide.tex b/doc/guide.tex index 390f0743e..1785cc6a6 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -386,10 +386,34 @@ Some options that you may be interested in modifying: \titem{--enable-pam} Enable the PAM authentication method (see section \ref{pam}). - \titem{--enable-odbc or --enable-mssql} + \titem{--enable-mssql} Required if you want to use an external database. See section~\ref{database} for more information. + \titem{--enable-tools} + Enable the use of development tools. + + \titem{--enable-mysql} + Enable MySQL support (see section \ref{mysql}). + + \titem{--enable-pgsql} + Enable PostgreSQL support (see section \ref{pgsql}). + + \titem{--enable-zlib} + Enable Stream Compression (XEP-0138) using zlib. + + \titem{--enable-stun} + Enable STUN support (see section \ref{stun}). + + \titem{--enable-riak} + Enable Riak support. + + \titem{--enable-iconv} + Enable iconv support. This is needed for \term{mod\_irc} (see seciont \ref{modirc}). + + \titem{--enable-debug} + Compile with \term{+debug\_info} enabled. + \titem{--enable-full-xml} Enable the use of XML based optimisations. It will for example use CDATA to escape characters in the XMPP stream. @@ -1257,6 +1281,7 @@ The following authentication methods are supported by \ejabberd{}: \ref{mssql} and \ref{odbc}. \item anonymous --- See section~\ref{saslanonymous}. \item pam --- See section~\ref{pam}. +\item riak --- See section~\ref{riak}. \end{itemize} Account creation is only supported by internal, external and odbc methods. @@ -1972,14 +1997,8 @@ For example: \makesubsection{mysql}{MySQL} \ind{MySQL}\ind{MySQL!schema} -Although this section will describe \ejabberd{}'s configuration when you want to -use the native MySQL driver, it does not describe MySQL's installation and -database creation. Check the MySQL documentation and the tutorial \footahref{http://support.process-one.net/doc/display/MESSENGER/Using+ejabberd+with+MySQL+native+driver}{Using ejabberd with MySQL native driver} for information regarding these topics. -Note that the tutorial contains information about \ejabberd{}'s configuration -which is duplicate to this section. - -Moreover, the file mysql.sql in the directory src/odbc might be interesting for -you. This file contains the \ejabberd{} schema for MySQL. At the end of the file +There is a file \term{mysql.sql} in the directory \term{odbc}. +This file contains the \ejabberd{} schema for MySQL. At the end of the file you can find information to update your database schema. @@ -1987,19 +2006,13 @@ you can find information to update your database schema. \ind{MySQL!Driver Compilation} You can skip this step if you installed \ejabberd{} using a binary installer or -if the binary packages of \ejabberd{} you are using include support for MySQL. +if the binary packages of \ejabberd{} you are using include support for ODBC. -\begin{enumerate} -\item First, install the \footahref{http://support.process-one.net/doc/display/CONTRIBS/Yxa}{Erlang - MySQL library}. Make sure the compiled files are in your Erlang path; you can - put them for example in the same directory as your \ejabberd{} .beam files. -\item Then, configure and install \ejabberd{} with ODBC support enabled (this is - also needed for native MySQL support!). This can be done, by using next - commands: +Use \term{--enable-mysql} configure option in order to build \ejabberd{} with +MySQL support: \begin{verbatim} -./configure --enable-odbc && make install +./configure --enable-mysql && make install \end{verbatim} -\end{enumerate} \makesubsubsection{configuremysql}{Database Connection} @@ -2072,16 +2085,9 @@ that you cannot have several variants of the same module loaded! \makesubsection{mssql}{Microsoft SQL Server} \ind{Microsoft SQL Server}\ind{Microsoft SQL Server!schema} -Although this section will describe \ejabberd{}'s configuration when you want to -use Microsoft SQL Server, it does not describe Microsoft SQL Server's -installation and database creation. Check the MySQL documentation and the -tutorial \footahref{http://support.process-one.net/doc/display/MESSENGER/Using+ejabberd+with+MySQL+native+driver}{Using ejabberd with MySQL native driver} for information regarding these topics. -Note that the tutorial contains information about \ejabberd{}'s configuration -which is duplicate to this section. - -Moreover, the file mssql.sql in the directory src/odbc might be interesting for -you. This file contains the \ejabberd{} schema for Microsoft SQL Server. At the end -of the file you can find information to update your database schema. +There is a file \term{mssql.sql} in the directory \term{odbc}. +This file contains the \ejabberd{} schema for Microsoft SQL Server. At the end of the file +you can find information to update your database schema. \makesubsubsection{compilemssql}{Driver Compilation} @@ -2090,11 +2096,10 @@ of the file you can find information to update your database schema. You can skip this step if you installed \ejabberd{} using a binary installer or if the binary packages of \ejabberd{} you are using include support for ODBC. -If you want to use Microsoft SQL Server with ODBC, you need to configure, -compile and install \ejabberd{} with support for ODBC and Microsoft SQL Server -enabled. This can be done, by using next commands: +Use \term{--enable-mssql} configure option in order to build \ejabberd{} with +Microsoft SQL Server support: \begin{verbatim} -./configure --enable-odbc --enable-mssql && make install +./configure --enable-mssql && make install \end{verbatim} @@ -2139,13 +2144,7 @@ module loaded! \makesubsection{pgsql}{PostgreSQL} \ind{PostgreSQL}\ind{PostgreSQL!schema} -Although this section will describe \ejabberd{}'s configuration when you want to -use the native PostgreSQL driver, it does not describe PostgreSQL's installation -and database creation. Check the PostgreSQL documentation and the tutorial \footahref{http://support.process-one.net/doc/display/MESSENGER/Using+ejabberd+with+MySQL+native+driver}{Using ejabberd with MySQL native driver} for information regarding these topics. -Note that the tutorial contains information about \ejabberd{}'s configuration -which is duplicate to this section. - -Also the file pg.sql in the directory src/odbc might be interesting for you. +There is a file \term{pg.sql} in the directory \term{odbc}. This file contains the \ejabberd{} schema for PostgreSQL. At the end of the file you can find information to update your database schema. @@ -2157,19 +2156,11 @@ You can skip this step if you installed \ejabberd{} using a binary installer or if the binary packages of \ejabberd{} you are using include support for PostgreSQL. -\begin{enumerate} -\item First, install the Erlang pgsql library from - \footahref{http://www.ejabberd.im/ejabberd-modules/}{ejabberd-modules SVN repository}. - Make sure the compiled - files are in your Erlang path; you can put them for example in the same - directory as your \ejabberd{} .beam files. -\item Then, configure, compile and install \ejabberd{} with ODBC support enabled - (this is also needed for native PostgreSQL support!). This can be done, by - using next commands: +Use \term{--enable-pgsql} configure option in order to build \ejabberd{} with +PostgreSQL support: \begin{verbatim} -./configure --enable-odbc && make install +./configure --enable-pgsql && make install \end{verbatim} -\end{enumerate} \makesubsubsection{configurepgsql}{Database Connection} @@ -2236,31 +2227,6 @@ Keep in mind that you cannot have several variants of the same module loaded! \makesubsection{odbc}{ODBC Compatible} \ind{databases!ODBC} -Although this section will describe \ejabberd{}'s configuration when you want to -use the ODBC driver, it does not describe the installation and database creation -of your database. Check the documentation of your database. The tutorial \footahref{http://support.process-one.net/doc/display/MESSENGER/Using+ejabberd+with+MySQL+native+driver}{Using ejabberd with MySQL native driver} also can help you. Note that the tutorial -contains information about \ejabberd{}'s configuration which is duplicate to -this section. - - -\makesubsubsection{compileodbc}{Driver Compilation} - -You can skip this step if you installed \ejabberd{} using a binary installer or -if the binary packages of \ejabberd{} you are using include support for -ODBC. - -\begin{enumerate} -\item First, install the \footahref{http://support.process-one.net/doc/display/CONTRIBS/Yxa}{Erlang - MySQL library}. Make sure the compiled files are in your Erlang path; you can - put them for example in the same directory as your \ejabberd{} .beam files. -\item Then, configure, compile and install \ejabberd{} with ODBC support - enabled. This can be done, by using next commands: -\begin{verbatim} -./configure --enable-odbc && make install -\end{verbatim} -\end{enumerate} - - \makesubsubsection{configureodbc}{Database Connection} \ind{ODBC!Database Connection} diff --git a/src/ejabberd.cfg.example b/ejabberd.cfg.example similarity index 100% rename from src/ejabberd.cfg.example rename to ejabberd.cfg.example diff --git a/src/ejabberd.init.template b/ejabberd.init.template similarity index 100% rename from src/ejabberd.init.template rename to ejabberd.init.template diff --git a/src/ejabberdctl.cfg.example b/ejabberdctl.cfg.example similarity index 100% rename from src/ejabberdctl.cfg.example rename to ejabberdctl.cfg.example diff --git a/src/ejabberdctl.template b/ejabberdctl.template old mode 100644 new mode 100755 similarity index 92% rename from src/ejabberdctl.template rename to ejabberdctl.template index 7957cacc1..387eaab7b --- a/src/ejabberdctl.template +++ b/ejabberdctl.template @@ -7,12 +7,14 @@ ERL_MAX_PORTS=32000 ERL_PROCESSES=250000 ERL_MAX_ETS_TABLES=1400 +SCRIPT_DIR=$(cd ${0%/*} && pwd) + # define default environment variables NODE=ejabberd HOST=localhost ERLANG_NODE=$NODE@$HOST -ERL=@erl@ -INSTALLUSER=@installuser@ +ERL={{erl}} +INSTALLUSER={{installuser}} # parse command line parameters ARGS= @@ -33,7 +35,7 @@ done # Define ejabberd variable if they have not been defined from the command line if [ "$ETCDIR" = "" ] ; then - ETCDIR=@SYSCONFDIR@/ejabberd + ETCDIR={{sysconfdir}}/ejabberd fi if [ "$EJABBERD_CONFIG_PATH" = "" ] ; then EJABBERD_CONFIG_PATH=$ETCDIR/ejabberd.cfg @@ -45,13 +47,13 @@ if [ -f "$EJABBERDCTL_CONFIG_PATH" ] ; then . "$EJABBERDCTL_CONFIG_PATH" fi if [ "$LOGS_DIR" = "" ] ; then - LOGS_DIR=@LOCALSTATEDIR@/log/ejabberd + LOGS_DIR={{localstatedir}}/log/ejabberd fi if [ "$SPOOLDIR" = "" ] ; then - SPOOLDIR=@LOCALSTATEDIR@/lib/ejabberd + SPOOLDIR={{localstatedir}}/lib/ejabberd fi if [ "$EJABBERD_DOC_PATH" = "" ] ; then - EJABBERD_DOC_PATH=@DOCDIR@ + EJABBERD_DOC_PATH={{docdir}} fi if [ "$ERLANG_NODE_ARG" != "" ] ; then ERLANG_NODE=$ERLANG_NODE_ARG @@ -92,23 +94,25 @@ fi ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES $ERL_OPTIONS" # define additional environment variables -if [ "$EJABBERDDIR" = "" ] ; then - EJABBERDDIR=@LIBDIR@/ejabberd -fi -if [ "$EJABBERD_EBIN_PATH" = "" ] ; then - EJABBERD_EBIN_PATH=$EJABBERDDIR/ebin -fi -if [ "$EJABBERD_PRIV_PATH" = "" ] ; then - EJABBERD_PRIV_PATH=$EJABBERDDIR/priv -fi -if [ "$EJABBERD_BIN_PATH" = "" ] ; then - EJABBERD_BIN_PATH=$EJABBERD_PRIV_PATH/bin -fi -if [ "$EJABBERD_SO_PATH" = "" ] ; then - EJABBERD_SO_PATH=$EJABBERD_PRIV_PATH/lib -fi -if [ "$EJABBERD_MSGS_PATH" = "" ] ; then - EJABBERD_MSGS_PATH=$EJABBERD_PRIV_PATH/msgs +if [ "{{release}}" != "true" ] ; then + if [ "$EJABBERDDIR" = "" ] ; then + EJABBERDDIR={{libdir}}/ejabberd + fi + if [ "$EJABBERD_EBIN_PATH" = "" ] ; then + EJABBERD_EBIN_PATH=$EJABBERDDIR/ebin + fi + if [ "$EJABBERD_PRIV_PATH" = "" ] ; then + EJABBERD_PRIV_PATH=$EJABBERDDIR/priv + fi + if [ "$EJABBERD_BIN_PATH" = "" ] ; then + EJABBERD_BIN_PATH=$EJABBERD_PRIV_PATH/bin + fi + if [ "$EJABBERD_SO_PATH" = "" ] ; then + EJABBERD_SO_PATH=$EJABBERD_PRIV_PATH/lib + fi + if [ "$EJABBERD_MSGS_PATH" = "" ] ; then + EJABBERD_MSGS_PATH=$EJABBERD_PRIV_PATH/msgs + fi fi EJABBERD_LOG_PATH=$LOGS_DIR/ejabberd.log @@ -258,7 +262,7 @@ ctl () # using flock if available. Expects a linux-style # flock that can lock a file descriptor. MAXCONNID=100 - CONNLOCKDIR=@LOCALSTATEDIR@/lock/ejabberdctl + CONNLOCKDIR={{localstatedir}}/lock/ejabberdctl FLOCK='/usr/bin/flock' if [ ! -x "$FLOCK" ] || [ ! -d "$CONNLOCKDIR" ] ; then JOT='/usr/bin/jot' diff --git a/src/adhoc.hrl b/include/adhoc.hrl similarity index 100% rename from src/adhoc.hrl rename to include/adhoc.hrl diff --git a/src/web/bosh.hrl b/include/bosh.hrl similarity index 100% rename from src/web/bosh.hrl rename to include/bosh.hrl diff --git a/src/ejabberd.hrl b/include/ejabberd.hrl similarity index 72% rename from src/ejabberd.hrl rename to include/ejabberd.hrl index 912ea2ce0..4a2d25cd1 100644 --- a/src/ejabberd.hrl +++ b/include/ejabberd.hrl @@ -27,7 +27,7 @@ -define(MYLANG, ejabberd_config:get_mylang()). --define(MSGS_DIR, <<"msgs">>). +-define(MSGS_DIR, filename:join(["priv", "msgs"])). -define(CONFIG_PATH, <<"ejabberd.cfg">>). @@ -59,27 +59,3 @@ -type scram() :: #scram{}. -define(SCRAM_DEFAULT_ITERATION_COUNT, 4096). - -%% --------------------------------- -%% Logging mechanism - --define(PRINT(Format, Args), io:format(Format, Args)). - --define(DEBUG(Format, Args), - ejabberd_logger:debug_msg(?MODULE, ?LINE, Format, - Args)). - --define(INFO_MSG(Format, Args), - ejabberd_logger:info_msg(?MODULE, ?LINE, Format, Args)). - --define(WARNING_MSG(Format, Args), - ejabberd_logger:warning_msg(?MODULE, ?LINE, Format, - Args)). - --define(ERROR_MSG(Format, Args), - ejabberd_logger:error_msg(?MODULE, ?LINE, Format, - Args)). - --define(CRITICAL_MSG(Format, Args), - ejabberd_logger:critical_msg(?MODULE, ?LINE, Format, - Args)). diff --git a/src/ejabberd_c2s.hrl b/include/ejabberd_c2s.hrl similarity index 100% rename from src/ejabberd_c2s.hrl rename to include/ejabberd_c2s.hrl diff --git a/src/ejabberd_commands.hrl b/include/ejabberd_commands.hrl similarity index 100% rename from src/ejabberd_commands.hrl rename to include/ejabberd_commands.hrl diff --git a/src/ejabberd_config.hrl b/include/ejabberd_config.hrl similarity index 100% rename from src/ejabberd_config.hrl rename to include/ejabberd_config.hrl diff --git a/src/ejabberd_ctl.hrl b/include/ejabberd_ctl.hrl similarity index 100% rename from src/ejabberd_ctl.hrl rename to include/ejabberd_ctl.hrl diff --git a/src/web/ejabberd_http.hrl b/include/ejabberd_http.hrl similarity index 100% rename from src/web/ejabberd_http.hrl rename to include/ejabberd_http.hrl diff --git a/src/web/ejabberd_web_admin.hrl b/include/ejabberd_web_admin.hrl similarity index 100% rename from src/web/ejabberd_web_admin.hrl rename to include/ejabberd_web_admin.hrl diff --git a/src/eldap/eldap.hrl b/include/eldap.hrl similarity index 100% rename from src/eldap/eldap.hrl rename to include/eldap.hrl diff --git a/src/web/http_bind.hrl b/include/http_bind.hrl similarity index 100% rename from src/web/http_bind.hrl rename to include/http_bind.hrl diff --git a/src/jlib.hrl b/include/jlib.hrl similarity index 98% rename from src/jlib.hrl rename to include/jlib.hrl index fe4dbbf02..271c32a8d 100644 --- a/src/jlib.hrl +++ b/include/jlib.hrl @@ -215,6 +215,8 @@ -define(NS_BOB, <<"urn:xmpp:bob">>). +-include("xml.hrl"). + -define(STANZA_ERROR(Code, Type, Condition), #xmlel{name = <<"error">>, attrs = [{<<"code">>, Code}, {<<"type">>, Type}], @@ -617,19 +619,6 @@ -type(ljid() :: {binary(), binary(), binary()}). --record(xmlel, -{ - name = <<"">> :: binary(), - attrs = [] :: [attr()], - children = [] :: [xmlel() | cdata()] -}). - --type(cdata() :: {xmlcdata, CData::binary()}). - --type(attr() :: {Name::binary(), Value::binary()}). - --type(xmlel() :: #xmlel{}). - -record(iq, {id = <<"">> :: binary(), type = get :: get | set | result | error, xmlns = <<"">> :: binary(), diff --git a/src/licence.hrl b/include/licence.hrl similarity index 100% rename from src/licence.hrl rename to include/licence.hrl diff --git a/src/stringprep/stringprep_sup.erl b/include/logger.hrl similarity index 59% rename from src/stringprep/stringprep_sup.erl rename to include/logger.hrl index bd578fa5e..d61b61ac0 100644 --- a/src/stringprep/stringprep_sup.erl +++ b/include/logger.hrl @@ -1,9 +1,4 @@ -%%%------------------------------------------------------------------- -%%% File : stringprep_sup.erl -%%% Author : Mickael Remond -%%% Description : Supervisor for the Stringprep worker. -%%% Created : 29 Jun 2007 by Mickael Remond -%%% +%%%---------------------------------------------------------------------- %%% %%% ejabberd, Copyright (C) 2002-2013 ProcessOne %%% @@ -22,24 +17,20 @@ %%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA %%% 02111-1307 USA %%% -%%%------------------------------------------------------------------- +%%%---------------------------------------------------------------------- +-define(PRINT(Format, Args), io:format(Format, Args)). --module(stringprep_sup). +-define(DEBUG(Format, Args), + ejabberd_logger:debug_msg(?MODULE, ?LINE, Format, Args)). --behaviour(supervisor). +-define(INFO_MSG(Format, Args), + ejabberd_logger:info_msg(?MODULE, ?LINE, Format, Args)). -%% API --export([start_link/0]). +-define(WARNING_MSG(Format, Args), + ejabberd_logger:warning_msg(?MODULE, ?LINE, Format, Args)). -%% Supervisor callbacks --export([init/1]). +-define(ERROR_MSG(Format, Args), + ejabberd_logger:error_msg(?MODULE, ?LINE, Format, Args)). --define(SERVER, ?MODULE). - -start_link() -> - supervisor:start_link({local, ?SERVER}, ?MODULE, []). - -init([]) -> - StringPrep = {stringprep, {stringprep, start_link, []}, - permanent, brutal_kill, worker, [stringprep]}, - {ok, {{one_for_all, 10, 1}, [StringPrep]}}. +-define(CRITICAL_MSG(Format, Args), + ejabberd_logger:critical_msg(?MODULE, ?LINE, Format, Args)). diff --git a/src/mod_muc/mod_muc_room.hrl b/include/mod_muc_room.hrl similarity index 100% rename from src/mod_muc/mod_muc_room.hrl rename to include/mod_muc_room.hrl diff --git a/src/mod_privacy.hrl b/include/mod_privacy.hrl similarity index 100% rename from src/mod_privacy.hrl rename to include/mod_privacy.hrl diff --git a/src/mod_proxy65/mod_proxy65.hrl b/include/mod_proxy65.hrl similarity index 100% rename from src/mod_proxy65/mod_proxy65.hrl rename to include/mod_proxy65.hrl diff --git a/src/mod_roster.hrl b/include/mod_roster.hrl similarity index 100% rename from src/mod_roster.hrl rename to include/mod_roster.hrl diff --git a/src/mod_pubsub/pubsub.hrl b/include/pubsub.hrl similarity index 100% rename from src/mod_pubsub/pubsub.hrl rename to include/pubsub.hrl diff --git a/src/inetrc b/inetrc similarity index 100% rename from src/inetrc rename to inetrc diff --git a/src/install-sh b/install-sh similarity index 100% rename from src/install-sh rename to install-sh diff --git a/src/mod_pubsub_ng/exmpp_pubsub.erl b/mod_pubsub_ng/exmpp_pubsub.erl similarity index 97% rename from src/mod_pubsub_ng/exmpp_pubsub.erl rename to mod_pubsub_ng/exmpp_pubsub.erl index 9486cbd8d..f7d4d2ad6 100644 --- a/src/mod_pubsub_ng/exmpp_pubsub.erl +++ b/mod_pubsub_ng/exmpp_pubsub.erl @@ -273,15 +273,15 @@ Subscription_Options :: []} ). --type(subscription() - :: {Subscription_State :: exmpp_pubsub:subscription_state(), - SubId :: exmpp_pubsub:subId(), - Resource :: undefined | xmpp_jid:resource_jid() | {'caps', xmpp_jid:resource_jid()}, - Subscription_Options :: [] | pubsub_options:options_subscription()} -%% :: exmpp_pubsub:subscription_subscribed() -%% | exmpp_pubsub:subscription_pending() -%% | exmpp_pubsub:subscription_unconfigured() -). +%% -type(subscription() +%% :: {Subscription_State :: exmpp_pubsub:subscription_state(), +%% SubId :: exmpp_pubsub:subId(), +%% Resource :: undefined | xmpp_jid:resource_jid() | {'caps', xmpp_jid:resource_jid()}, +%% Subscription_Options :: [] | pubsub_options:options_subscription()} +%% %% :: exmpp_pubsub:subscription_subscribed() +%% %% | exmpp_pubsub:subscription_pending() +%% %% | exmpp_pubsub:subscription_unconfigured() +%% ). -type(subscriptions() :: [exmpp_pubsub:subscription(),...] diff --git a/src/mod_pubsub_ng/mod_pubsub_dev.erl b/mod_pubsub_ng/mod_pubsub_dev.erl similarity index 100% rename from src/mod_pubsub_ng/mod_pubsub_dev.erl rename to mod_pubsub_ng/mod_pubsub_dev.erl diff --git a/src/mod_pubsub_ng/node_flat_dev.erl b/mod_pubsub_ng/node_flat_dev.erl similarity index 100% rename from src/mod_pubsub_ng/node_flat_dev.erl rename to mod_pubsub_ng/node_flat_dev.erl diff --git a/src/mod_pubsub_ng/pubsub_api.hrl b/mod_pubsub_ng/pubsub_api.hrl similarity index 100% rename from src/mod_pubsub_ng/pubsub_api.hrl rename to mod_pubsub_ng/pubsub_api.hrl diff --git a/src/mod_pubsub_ng/pubsub_broadcast.erl b/mod_pubsub_ng/pubsub_broadcast.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_broadcast.erl rename to mod_pubsub_ng/pubsub_broadcast.erl diff --git a/src/mod_pubsub_ng/pubsub_core.erl b/mod_pubsub_ng/pubsub_core.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_core.erl rename to mod_pubsub_ng/pubsub_core.erl diff --git a/src/mod_pubsub_ng/pubsub_db.erl b/mod_pubsub_ng/pubsub_db.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_db.erl rename to mod_pubsub_ng/pubsub_db.erl diff --git a/src/mod_pubsub_ng/pubsub_db_mnesia.erl b/mod_pubsub_ng/pubsub_db_mnesia.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_db_mnesia.erl rename to mod_pubsub_ng/pubsub_db_mnesia.erl diff --git a/src/mod_pubsub_ng/pubsub_dev.hrl b/mod_pubsub_ng/pubsub_dev.hrl similarity index 99% rename from src/mod_pubsub_ng/pubsub_dev.hrl rename to mod_pubsub_ng/pubsub_dev.hrl index 9a695ca16..e2c873b1e 100644 --- a/src/mod_pubsub_ng/pubsub_dev.hrl +++ b/mod_pubsub_ng/pubsub_dev.hrl @@ -2,6 +2,7 @@ %-include_lib("exmpp/include/exmpp.hrl"). %-include_lib("exmpp/include/exmpp_jid.hrl"). +-include("logger.hrl"). -include("ejabberd.hrl"). -include("mod_roster.hrl"). -include("jlib.hrl"). diff --git a/src/mod_pubsub_ng/pubsub_disco.erl b/mod_pubsub_ng/pubsub_disco.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_disco.erl rename to mod_pubsub_ng/pubsub_disco.erl diff --git a/src/mod_pubsub_ng/pubsub_groups.erl b/mod_pubsub_ng/pubsub_groups.erl similarity index 99% rename from src/mod_pubsub_ng/pubsub_groups.erl rename to mod_pubsub_ng/pubsub_groups.erl index 79270637a..622094401 100644 --- a/src/mod_pubsub_ng/pubsub_groups.erl +++ b/mod_pubsub_ng/pubsub_groups.erl @@ -76,10 +76,10 @@ -type(n0des() :: [Node::n0de(),...]). --type(subscription() - :: {NodeIdx :: exmpp_pubsub:nodeIdx(), - Groups :: roster_groups()} -). +%% -type(subscription() +%% :: {NodeIdx :: exmpp_pubsub:nodeIdx(), +%% Groups :: roster_groups()} +%% ). -type(subscriptions() :: [Subscription::subscription(),...]). diff --git a/src/mod_pubsub_ng/pubsub_hooks.erl b/mod_pubsub_ng/pubsub_hooks.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_hooks.erl rename to mod_pubsub_ng/pubsub_hooks.erl diff --git a/src/mod_pubsub_ng/pubsub_index_dev.erl b/mod_pubsub_ng/pubsub_index_dev.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_index_dev.erl rename to mod_pubsub_ng/pubsub_index_dev.erl diff --git a/src/mod_pubsub_ng/pubsub_options.erl b/mod_pubsub_ng/pubsub_options.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_options.erl rename to mod_pubsub_ng/pubsub_options.erl diff --git a/src/mod_pubsub_ng/pubsub_parser.erl b/mod_pubsub_ng/pubsub_parser.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_parser.erl rename to mod_pubsub_ng/pubsub_parser.erl diff --git a/src/mod_pubsub_ng/pubsub_tools.erl b/mod_pubsub_ng/pubsub_tools.erl similarity index 100% rename from src/mod_pubsub_ng/pubsub_tools.erl rename to mod_pubsub_ng/pubsub_tools.erl diff --git a/src/mod_pubsub_ng/xmpp_xdata.erl b/mod_pubsub_ng/xmpp_xdata.erl similarity index 100% rename from src/mod_pubsub_ng/xmpp_xdata.erl rename to mod_pubsub_ng/xmpp_xdata.erl diff --git a/src/msgs/ca.msg b/priv/msgs/ca.msg similarity index 100% rename from src/msgs/ca.msg rename to priv/msgs/ca.msg diff --git a/src/msgs/ca.po b/priv/msgs/ca.po similarity index 100% rename from src/msgs/ca.po rename to priv/msgs/ca.po diff --git a/src/msgs/cs.msg b/priv/msgs/cs.msg similarity index 100% rename from src/msgs/cs.msg rename to priv/msgs/cs.msg diff --git a/src/msgs/cs.po b/priv/msgs/cs.po similarity index 100% rename from src/msgs/cs.po rename to priv/msgs/cs.po diff --git a/src/msgs/de.msg b/priv/msgs/de.msg similarity index 100% rename from src/msgs/de.msg rename to priv/msgs/de.msg diff --git a/src/msgs/de.po b/priv/msgs/de.po similarity index 100% rename from src/msgs/de.po rename to priv/msgs/de.po diff --git a/src/msgs/ejabberd.pot b/priv/msgs/ejabberd.pot similarity index 100% rename from src/msgs/ejabberd.pot rename to priv/msgs/ejabberd.pot diff --git a/src/msgs/el.msg b/priv/msgs/el.msg similarity index 100% rename from src/msgs/el.msg rename to priv/msgs/el.msg diff --git a/src/msgs/el.po b/priv/msgs/el.po similarity index 100% rename from src/msgs/el.po rename to priv/msgs/el.po diff --git a/src/msgs/eo.msg b/priv/msgs/eo.msg similarity index 100% rename from src/msgs/eo.msg rename to priv/msgs/eo.msg diff --git a/src/msgs/eo.po b/priv/msgs/eo.po similarity index 100% rename from src/msgs/eo.po rename to priv/msgs/eo.po diff --git a/src/msgs/es.msg b/priv/msgs/es.msg similarity index 100% rename from src/msgs/es.msg rename to priv/msgs/es.msg diff --git a/src/msgs/es.po b/priv/msgs/es.po similarity index 100% rename from src/msgs/es.po rename to priv/msgs/es.po diff --git a/src/msgs/fr.msg b/priv/msgs/fr.msg similarity index 100% rename from src/msgs/fr.msg rename to priv/msgs/fr.msg diff --git a/src/msgs/fr.po b/priv/msgs/fr.po similarity index 100% rename from src/msgs/fr.po rename to priv/msgs/fr.po diff --git a/src/msgs/gl.msg b/priv/msgs/gl.msg similarity index 100% rename from src/msgs/gl.msg rename to priv/msgs/gl.msg diff --git a/src/msgs/gl.po b/priv/msgs/gl.po similarity index 100% rename from src/msgs/gl.po rename to priv/msgs/gl.po diff --git a/src/msgs/id.msg b/priv/msgs/id.msg similarity index 100% rename from src/msgs/id.msg rename to priv/msgs/id.msg diff --git a/src/msgs/id.po b/priv/msgs/id.po similarity index 100% rename from src/msgs/id.po rename to priv/msgs/id.po diff --git a/src/msgs/it.msg b/priv/msgs/it.msg similarity index 100% rename from src/msgs/it.msg rename to priv/msgs/it.msg diff --git a/src/msgs/it.po b/priv/msgs/it.po similarity index 100% rename from src/msgs/it.po rename to priv/msgs/it.po diff --git a/src/msgs/ja.msg b/priv/msgs/ja.msg similarity index 100% rename from src/msgs/ja.msg rename to priv/msgs/ja.msg diff --git a/src/msgs/ja.po b/priv/msgs/ja.po similarity index 100% rename from src/msgs/ja.po rename to priv/msgs/ja.po diff --git a/src/msgs/nl.msg b/priv/msgs/nl.msg similarity index 100% rename from src/msgs/nl.msg rename to priv/msgs/nl.msg diff --git a/src/msgs/nl.po b/priv/msgs/nl.po similarity index 100% rename from src/msgs/nl.po rename to priv/msgs/nl.po diff --git a/src/msgs/no.msg b/priv/msgs/no.msg similarity index 100% rename from src/msgs/no.msg rename to priv/msgs/no.msg diff --git a/src/msgs/no.po b/priv/msgs/no.po similarity index 100% rename from src/msgs/no.po rename to priv/msgs/no.po diff --git a/src/msgs/pl.msg b/priv/msgs/pl.msg similarity index 100% rename from src/msgs/pl.msg rename to priv/msgs/pl.msg diff --git a/src/msgs/pl.po b/priv/msgs/pl.po similarity index 100% rename from src/msgs/pl.po rename to priv/msgs/pl.po diff --git a/src/msgs/pt-br.msg b/priv/msgs/pt-br.msg similarity index 100% rename from src/msgs/pt-br.msg rename to priv/msgs/pt-br.msg diff --git a/src/msgs/pt-br.po b/priv/msgs/pt-br.po similarity index 100% rename from src/msgs/pt-br.po rename to priv/msgs/pt-br.po diff --git a/src/msgs/pt.msg b/priv/msgs/pt.msg similarity index 100% rename from src/msgs/pt.msg rename to priv/msgs/pt.msg diff --git a/src/msgs/pt.po b/priv/msgs/pt.po similarity index 100% rename from src/msgs/pt.po rename to priv/msgs/pt.po diff --git a/src/msgs/ru.msg b/priv/msgs/ru.msg similarity index 100% rename from src/msgs/ru.msg rename to priv/msgs/ru.msg diff --git a/src/msgs/ru.po b/priv/msgs/ru.po similarity index 100% rename from src/msgs/ru.po rename to priv/msgs/ru.po diff --git a/src/msgs/sk.msg b/priv/msgs/sk.msg similarity index 100% rename from src/msgs/sk.msg rename to priv/msgs/sk.msg diff --git a/src/msgs/sk.po b/priv/msgs/sk.po similarity index 100% rename from src/msgs/sk.po rename to priv/msgs/sk.po diff --git a/src/msgs/sv.msg b/priv/msgs/sv.msg similarity index 100% rename from src/msgs/sv.msg rename to priv/msgs/sv.msg diff --git a/src/msgs/sv.po b/priv/msgs/sv.po similarity index 100% rename from src/msgs/sv.po rename to priv/msgs/sv.po diff --git a/src/msgs/th.msg b/priv/msgs/th.msg similarity index 100% rename from src/msgs/th.msg rename to priv/msgs/th.msg diff --git a/src/msgs/th.po b/priv/msgs/th.po similarity index 100% rename from src/msgs/th.po rename to priv/msgs/th.po diff --git a/src/msgs/tr.msg b/priv/msgs/tr.msg similarity index 100% rename from src/msgs/tr.msg rename to priv/msgs/tr.msg diff --git a/src/msgs/tr.po b/priv/msgs/tr.po similarity index 100% rename from src/msgs/tr.po rename to priv/msgs/tr.po diff --git a/src/msgs/uk.msg b/priv/msgs/uk.msg similarity index 100% rename from src/msgs/uk.msg rename to priv/msgs/uk.msg diff --git a/src/msgs/uk.po b/priv/msgs/uk.po similarity index 100% rename from src/msgs/uk.po rename to priv/msgs/uk.po diff --git a/src/msgs/vi.msg b/priv/msgs/vi.msg similarity index 100% rename from src/msgs/vi.msg rename to priv/msgs/vi.msg diff --git a/src/msgs/vi.po b/priv/msgs/vi.po similarity index 100% rename from src/msgs/vi.po rename to priv/msgs/vi.po diff --git a/src/msgs/wa.msg b/priv/msgs/wa.msg similarity index 100% rename from src/msgs/wa.msg rename to priv/msgs/wa.msg diff --git a/src/msgs/wa.po b/priv/msgs/wa.po similarity index 100% rename from src/msgs/wa.po rename to priv/msgs/wa.po diff --git a/src/msgs/zh.msg b/priv/msgs/zh.msg similarity index 100% rename from src/msgs/zh.msg rename to priv/msgs/zh.msg diff --git a/src/msgs/zh.po b/priv/msgs/zh.po similarity index 100% rename from src/msgs/zh.po rename to priv/msgs/zh.po diff --git a/rebar b/rebar new file mode 100755 index 000000000..68a96bd05 Binary files /dev/null and b/rebar differ diff --git a/rebar.config.script b/rebar.config.script new file mode 100644 index 000000000..b4d1047af --- /dev/null +++ b/rebar.config.script @@ -0,0 +1,131 @@ +%%%------------------------------------------------------------------- +%%% @author Evgeniy Khramtsov +%%% @copyright (C) 2013, Evgeniy Khramtsov +%%% @doc +%%% +%%% @end +%%% Created : 1 May 2013 by Evgeniy Khramtsov +%%%------------------------------------------------------------------- +Cfg = case file:consult("vars.config") of + {ok, Terms} -> + Terms; + _Err -> + [] + end, + +Macros = lists:flatmap( + fun({roster_gateway_workaround, true}) -> + [{d, 'ROSTER_GATEWAY_WORKAROUND'}]; + ({flash_hack, true}) -> + [{d, 'ENABLE_FLASH_HACK'}]; + ({transient_supervisors, true}) -> + [{d, 'NO_TRANSIENT_SUPERVISORS'}]; + ({nif, true}) -> + [{d, 'NIF'}]; + ({db_type, mssql}) -> + [{d, 'mssql'}]; + (_) -> + [] + end, Cfg), + +DebugInfo = case lists:keysearch(debug, 1, Cfg) of + {value, {debug, true}} -> + [debug_info]; + _ -> + [] + end, + +HiPE = case lists:keysearch(hipe, 1, Cfg) of + {value, {hipe, true}} -> + [native]; + _ -> + [] + end, + +Includes = [{i, "include"}, + {i, filename:join(["deps", "p1_xml", "include"])}], + +SrcDirs = lists:foldl( + fun({pubsub_ng, true}, Acc) -> + [mod_pubsub_ng|Acc]; + ({tools, true}, Acc) -> + [tools|Acc]; + (_, Acc) -> + Acc + end, [], Cfg), + +Deps = [{p1_logger, ".*", {git, "git://github.com/processone/p1_logger"}}, + {p1_cache_tab, ".*", {git, "git://github.com/processone/cache_tab"}}, + {p1_tls, ".*", {git, "git://github.com/processone/tls"}}, + {p1_stringprep, ".*", {git, "git://github.com/processone/stringprep"}}, + {p1_xml, ".*", {git, "git://github.com/processone/xml"}}, + {xmlrpc, ".*", {git, "git://github.com/rds13/xmlrpc"}}], + +ConfigureCmd = fun(Pkg, Flags) -> + {'get-deps', + "sh -c 'cd deps/" ++ Pkg ++ + " && ./configure" ++ Flags ++ "'"} + end, + +XMLFlags = lists:foldl( + fun({nif, true}, Acc) -> + Acc ++ " --enable-nif"; + ({full_xml, true}, Acc) -> + Acc ++ " --enable-full-xml"; + ({flash_hack, true}, Acc) -> + Acc ++ " --enable-flash-hack"; + (_, Acc) -> + Acc + end, "", Cfg), + +PostHooks = [ConfigureCmd("p1_tls", ""), + ConfigureCmd("p1_stringprep", ""), + ConfigureCmd("p1_xml", XMLFlags)], + +CfgDeps = lists:flatmap( + fun({mysql, true}) -> + [{p1_mysql, ".*", {git, "git://github.com/processone/mysql"}}]; + ({pgsql, true}) -> + [{p1_pgsql, ".*", {git, "git://github.com/processone/pgsql"}}]; + ({pam, true}) -> + [{p1_pam, ".*", {git, "git://github.com/processone/epam"}}]; + ({zlib, true}) -> + [{p1_zlib, ".*", {git, "git://github.com/processone/zlib"}}]; + ({stun, true}) -> + [{p1_stun, ".*", {git, "git://github.com/processone/stun"}}]; + ({riak, true}) -> + [{riakc, ".*", {git, "git://github.com/basho/riak-erlang-client"}}]; + ({json, true}) -> + [{jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}]; + ({iconv, true}) -> + [{p1_iconv, ".*", {git, "git://github.com/processone/eiconv"}}]; + ({http, true}) -> + [{ibrowse, ".*", {git, "git://github.com/cmullaparthi/ibrowse"}}, + {lhttpc, ".*", {git, "git://github.com/esl/lhttpc"}}]; + (_) -> + [] + end, Cfg), + +CfgPostHooks = lists:flatmap( + fun({pam, true}) -> + [ConfigureCmd("p1_pam", "")]; + ({zlib, true}) -> + [ConfigureCmd("p1_zlib", "")]; + ({iconv, true}) -> + [ConfigureCmd("p1_iconv", "")]; + (_) -> + [] + end, Cfg), + +Config = [{erl_opts, Includes ++ Macros ++ HiPE ++ DebugInfo ++ + [{src_dirs, [asn1, src | SrcDirs]}]}, + {sub_dirs, ["rel"]}, + {post_hooks, PostHooks ++ CfgPostHooks}, + {deps, Deps ++ CfgDeps}], +%%io:format("ejabberd configuration:~n ~p~n", [Config]), +Config. + +%% Local Variables: +%% mode: erlang +%% End: +%% vim: set filetype=erlang tabstop=8: diff --git a/rel/files/erl b/rel/files/erl new file mode 100755 index 000000000..6f65e3fc9 --- /dev/null +++ b/rel/files/erl @@ -0,0 +1,34 @@ +#!/bin/sh + +## This script replaces the default "erl" in erts-VSN/bin. This is necessary +## as escript depends on erl and in turn, erl depends on having access to a +## bootscript (start.boot). Note that this script is ONLY invoked as a side-effect +## of running escript -- the embedded node bypasses erl and uses erlexec directly +## (as it should). +## +## Note that this script makes the assumption that there is a start_clean.boot +## file available in $ROOTDIR/release/VSN. + +# Determine the abspath of where this script is executing from. +ERTS_BIN_DIR=$(cd ${0%/*} && pwd) + +# Now determine the root directory -- this script runs from erts-VSN/bin, +# so we simply need to strip off two dirs from the end of the ERTS_BIN_DIR +# path. +ROOTDIR=${ERTS_BIN_DIR%/*/*} + +# Parse out release and erts info +START_ERL=`cat $ROOTDIR/releases/start_erl.data` +ERTS_VSN=${START_ERL% *} +APP_VSN=${START_ERL#* } + +BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin +EMU=beam +PROGNAME=`echo $0 | sed 's/.*\\///'` +CMD="$BINDIR/erlexec" +export EMU +export ROOTDIR +export BINDIR +export PROGNAME + +exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"} diff --git a/rel/files/install_upgrade.escript b/rel/files/install_upgrade.escript new file mode 100644 index 000000000..56cea1963 --- /dev/null +++ b/rel/files/install_upgrade.escript @@ -0,0 +1,44 @@ +#!/usr/bin/env escript +%%! -noshell -noinput +%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ft=erlang ts=4 sw=4 et + +-define(TIMEOUT, 60000). +-define(INFO(Fmt,Args), io:format(Fmt,Args)). + +main([NodeName, Cookie, ReleasePackage]) -> + TargetNode = start_distribution(NodeName, Cookie), + {ok, Vsn} = rpc:call(TargetNode, release_handler, unpack_release, + [ReleasePackage], ?TIMEOUT), + ?INFO("Unpacked Release ~p~n", [Vsn]), + {ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler, + check_install_release, [Vsn], ?TIMEOUT), + {ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler, + install_release, [Vsn], ?TIMEOUT), + ?INFO("Installed Release ~p~n", [Vsn]), + ok = rpc:call(TargetNode, release_handler, make_permanent, [Vsn], ?TIMEOUT), + ?INFO("Made Release ~p Permanent~n", [Vsn]); +main(_) -> + init:stop(1). + +start_distribution(NodeName, Cookie) -> + MyNode = make_script_node(NodeName), + {ok, _Pid} = net_kernel:start([MyNode, shortnames]), + erlang:set_cookie(node(), list_to_atom(Cookie)), + TargetNode = make_target_node(NodeName), + case {net_kernel:hidden_connect_node(TargetNode), + net_adm:ping(TargetNode)} of + {true, pong} -> + ok; + {_, pang} -> + io:format("Node ~p not responding to pings.\n", [TargetNode]), + init:stop(1) + end, + TargetNode. + +make_target_node(Node) -> + [_, Host] = string:tokens(atom_to_list(node()), "@"), + list_to_atom(lists:concat([Node, "@", Host])). + +make_script_node(Node) -> + list_to_atom(lists:concat([Node, "_upgrader_", os:getpid()])). diff --git a/rel/reltool.config.script b/rel/reltool.config.script new file mode 100644 index 000000000..64ba40491 --- /dev/null +++ b/rel/reltool.config.script @@ -0,0 +1,104 @@ +%%%------------------------------------------------------------------- +%%% @author Evgeniy Khramtsov +%%% @copyright (C) 2013, Evgeniy Khramtsov +%%% @doc +%%% +%%% @end +%%% Created : 8 May 2013 by Evgeniy Khramtsov +%%%------------------------------------------------------------------- +Vars = case file:consult(filename:join(["..", "vars.config"])) of + {ok, Terms} -> + Terms; + _Err -> + [] + end, + +RequiredOTPApps = [sasl, crypto, public_key, ssl, + mnesia, inets, odbc, compiler], + +ConfiguredOTPApps = lists:flatmap( + fun({tools, true}) -> + [tools, runtime_tools]; + (_) -> + [] + end, Vars), + +OTPApps = RequiredOTPApps ++ ConfiguredOTPApps, + +DepRequiredApps = [p1_logger, p1_cache_tab, p1_tls, p1_stringprep, p1_xml, xmlrpc], + +DepConfiguredApps = lists:flatmap( + fun({mysql, true}) -> [p1_mysql]; + ({pgsql, true}) -> [p1_pgsql]; + ({pam, true}) -> [p1_pam]; + ({zlib, true}) -> [p1_zlib]; + ({stun, true}) -> [p1_stun]; + ({riak, true}) -> [riakc, riak_pb, protobuffs]; + ({json, true}) -> [jiffy]; + ({iconv, true}) -> [p1_iconv]; + ({http, true}) -> [ibrowse, lhttpc]; + (_) -> [] + end, Vars), + +DepApps = DepRequiredApps ++ DepConfiguredApps, + +Sys = [{lib_dirs, []}, + {erts, [{mod_cond, derived}, {app_file, strip}]}, + {app_file, strip}, + {rel, "ejabberd", proplists:get_value(vsn, Vars), + [ + kernel, + stdlib, + ejabberd + ] ++ OTPApps ++ DepApps}, + {rel, "start_clean", "", + [ + kernel, + stdlib + ]}, + {boot_rel, "ejabberd"}, + {profile, embedded}, + {incl_cond, exclude}, + {excl_archive_filters, [".*"]}, %% Do not archive built libs + {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)", + "^erts.*/(doc|info|include|lib|man|src)"]}, + {excl_app_filters, ["\.gitignore"]}, + {app, stdlib, [{incl_cond, include}]}, + {app, kernel, [{incl_cond, include}]}, + {app, ejabberd, [{incl_cond, include}, {lib_dir, ".."}]}] +++ lists:map( + fun(App) -> + {app, App, [{incl_cond, include}, + {lib_dir, "../deps/" ++ atom_to_list(App)}]} + end, DepApps) +++ lists:map( + fun(App) -> + {app, App, [{incl_cond, include}]} + end, OTPApps). + +Overlay = [ + {mkdir, "var/log/ejabberd"}, + {mkdir, "var/lock"}, + {mkdir, "var/lib/ejabberd"}, + {mkdir, "etc/ejabberd"}, + {mkdir, "doc"}, + {template, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, + {template, "../ejabberdctl.template", "bin/ejabberdctl"}, + {copy, "../ejabberdctl.cfg.example", "etc/ejabberd/ejabberdctl.cfg"}, + {copy, "../ejabberd.cfg.example", "etc/ejabberd/ejabberd.cfg"}, + {copy, "../inetrc", "etc/ejabberd/inetrc"}, + {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"} + ], + +Config = [{sys, Sys}, + {overlay_vars, "../vars.config"}, + {target_dir, "ejabberd"}, + {overlay, Overlay}], + +%%io:format("ejabberd release:~n ~p~n", [Config]), +Config. + +%% Local Variables: +%% mode: erlang +%% End: +%% vim: set filetype=erlang tabstop=8: diff --git a/src/odbc/mssql2000.sql b/sql/mssql2000.sql similarity index 100% rename from src/odbc/mssql2000.sql rename to sql/mssql2000.sql diff --git a/src/odbc/mssql2005.sql b/sql/mssql2005.sql similarity index 100% rename from src/odbc/mssql2005.sql rename to sql/mssql2005.sql diff --git a/src/odbc/mysql.sql b/sql/mysql.sql similarity index 100% rename from src/odbc/mysql.sql rename to sql/mysql.sql diff --git a/src/odbc/pg.sql b/sql/pg.sql similarity index 100% rename from src/odbc/pg.sql rename to sql/pg.sql diff --git a/src/Makefile.in b/src/Makefile.in deleted file mode 100644 index 6db5543c3..000000000 --- a/src/Makefile.in +++ /dev/null @@ -1,323 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -EXPAT_CFLAGS = @EXPAT_CFLAGS@ -ERLANG_CFLAGS= @ERLANG_CFLAGS@ - -EXPAT_LIBS = @EXPAT_LIBS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -ASN_FLAGS = -bber_bin +der +compact_bit_string +optimize +noobj - -INSTALLUSER=@INSTALLUSER@ -# if no user was enabled, don't set privileges or ownership -ifeq ($(INSTALLUSER),) - O_USER= - G_USER= - CHOWN_COMMAND=echo - CHOWN_OUTPUT=/dev/null - INIT_USER=root -else - O_USER=-o $(INSTALLUSER) - G_USER=-g $(INSTALLUSER) - CHOWN_COMMAND=chown - CHOWN_OUTPUT=&1 - INIT_USER=$(INSTALLUSER) -endif - -EFLAGS += @ERLANG_SSLVER@ -pa . -ERLANG_CFLAGS += @ERLANG_SSLVER@ - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -DEBUGTOOLS = p1_prof.erl -ifdef debugtools - SOURCES+=$(DEBUGTOOLS) -endif - -ifeq (@hipe@, true) - EFLAGS+=+native -endif - -ifeq (@roster_gateway_workaround@, true) - EFLAGS+=-DROSTER_GATEWAY_WORKAROUND -endif - -ifeq (@full_xml@, true) - EFLAGS+=-DFULL_XML_SUPPORT -endif - -ifeq (@nif@, true) - EFLAGS+=-DNIF - ERLSHLIBS=xml.so -endif - -ifeq (@transient_supervisors@, false) - EFLAGS+=-DNO_TRANSIENT_SUPERVISORS -endif - -ifeq (@md2@, true) - EFLAGS+=-DHAVE_MD2 - ERLANG_CFLAGS += -DHAVE_MD2 -endif - -INSTALL_EPAM= -ifeq (@pam@, pam) - INSTALL_EPAM=install -m 750 $(O_USER) epam $(PBINDIR) -endif - -ifeq (@flash_hack@, true) - ERLC_FLAGS+=-DENABLE_FLASH_HACK - CPPFLAGS+=-DENABLE_FLASH_HACK -endif - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -SUBDIRS = @mod_irc@ @mod_pubsub@ @mod_muc@ @mod_proxy65@ @eldap@ @pam@ @web@ stringprep stun @tls@ @odbc@ @ejabberd_zlib@ -ERLSHLIBS += expat_erl.so -ERLBEHAVS = cyrsasl.erl gen_mod.erl p1_fsm.erl ejabberd_auth.erl -SOURCES_ALL = $(wildcard *.erl) -SOURCES_MISC = $(ERLBEHAVS) $(DEBUGTOOLS) -SOURCES += $(filter-out $(SOURCES_MISC),$(SOURCES_ALL)) -ERLBEHAVBEAMS = $(ERLBEHAVS:.erl=.beam) -BEAMS = $(SOURCES:.erl=.beam) - -DESTDIR = - -# /etc/ejabberd/ -ETCDIR = $(DESTDIR)@sysconfdir@/ejabberd - -# /sbin/ -SBINDIR = $(DESTDIR)@sbindir@ - -# /lib/ejabberd/ -EJABBERDDIR = $(DESTDIR)@libdir@/ejabberd - -# /share/doc/ejabberd -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -datarootdir = @datarootdir@ -DOCDIR = $(DESTDIR)@docdir@ - -# /usr/lib/ejabberd/ebin/ -BEAMDIR = $(EJABBERDDIR)/ebin - -# /usr/lib/ejabberd/include/ -INCLUDEDIR = $(EJABBERDDIR)/include - -# /usr/lib/ejabberd/priv/ -PRIVDIR = $(EJABBERDDIR)/priv - -# /usr/lib/ejabberd/priv/bin -PBINDIR = $(PRIVDIR)/bin - -# /usr/lib/ejabberd/priv/lib -SODIR = $(PRIVDIR)/lib - -# /usr/lib/ejabberd/priv/msgs -MSGSDIR = $(PRIVDIR)/msgs - -# /var/lib/ejabberd/ -SPOOLDIR = $(DESTDIR)@localstatedir@/lib/ejabberd - -# /var/lock/ejabberdctl -CTLLOCKDIR = $(DESTDIR)@localstatedir@/lock/ejabberdctl - -# /var/lib/ejabberd/.erlang.cookie -COOKIEFILE = $(SPOOLDIR)/.erlang.cookie - -# /var/log/ejabberd/ -LOGDIR = $(DESTDIR)@localstatedir@/log/ejabberd - -# Assume Linux-style dynamic library flags -DYNAMIC_LIB_CFLAGS = -fpic -shared -ifeq ($(shell uname),Darwin) - DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress -endif -ifeq ($(shell uname),SunOs) - DYNAMIC_LIB_CFLAGS = -KPIC -G -z text -endif - -all: $(ERLSHLIBS) compile-beam all-recursive - -compile-beam: XmppAddr.hrl $(ERLBEHAVBEAMS) $(BEAMS) - -$(BEAMS): $(ERLBEHAVBEAMS) - -all-recursive: $(ERLBEHAVBEAMS) - -%.beam: %.erl - @ERLC@ -W $(EFLAGS) $< - - -all-recursive install-recursive uninstall-recursive \ -clean-recursive distclean-recursive \ -mostlyclean-recursive maintainer-clean-recursive: - @subdirs="$(SUBDIRS)"; for subdir in $$subdirs; do \ - target=`echo $@|sed 's,-recursive,,'`; \ - echo making $$target in $$subdir; \ - (cd $$subdir && $(MAKE) $$target) || exit 1; \ - done - - -%.hrl: %.asn1 - @ERLC@ $(ASN_FLAGS) $< - @ERLC@ -W $(EFLAGS) $*.erl - -$(ERLSHLIBS): %.so: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS) \ - $(subst ../,,$(subst .so,.c,$@)) \ - $(EXPAT_LIBS) \ - $(EXPAT_CFLAGS) \ - $(ERLANG_LIBS) \ - $(ERLANG_CFLAGS) \ - -o $@ \ - $(DYNAMIC_LIB_CFLAGS) - -translations: - ../contrib/extract_translations/prepare-translation.sh -updateall - -install: all - # - # Configuration files - install -d -m 750 $(G_USER) $(ETCDIR) - [ -f $(ETCDIR)/ejabberd.cfg ] \ - && install -b -m 640 $(G_USER) ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg-new \ - || install -b -m 640 $(G_USER) ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg - sed -e "s*@rootdir@*@prefix@*" \ - -e "s*@installuser@*@INSTALLUSER@*" \ - -e "s*@LIBDIR@*@libdir@*" \ - -e "s*@SYSCONFDIR@*@sysconfdir@*" \ - -e "s*@LOCALSTATEDIR@*@localstatedir@*" \ - -e "s*@DOCDIR@*@docdir@*" \ - -e "s*@erl@*@ERL@*" ejabberdctl.template \ - > ejabberdctl.example - [ -f $(ETCDIR)/ejabberdctl.cfg ] \ - && install -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg-new \ - || install -b -m 640 $(G_USER) ejabberdctl.cfg.example $(ETCDIR)/ejabberdctl.cfg - install -b -m 644 $(G_USER) inetrc $(ETCDIR)/inetrc - # - # Administration script - [ -d $(SBINDIR) ] || install -d -m 755 $(SBINDIR) - install -m 550 $(G_USER) ejabberdctl.example $(SBINDIR)/ejabberdctl - # - # Init script - sed -e "s*@ctlscriptpath@*$(SBINDIR)*" \ - -e "s*@installuser@*$(INIT_USER)*" ejabberd.init.template \ - > ejabberd.init - chmod 755 ejabberd.init - # - # Binary Erlang files - install -d $(BEAMDIR) - install -m 644 *.app $(BEAMDIR) - install -m 644 *.beam $(BEAMDIR) - rm -f $(BEAMDIR)/configure.beam - # - # ejabberd header files - install -d $(INCLUDEDIR) - install -m 644 *.hrl $(INCLUDEDIR) - install -d $(INCLUDEDIR)/eldap/ - install -m 644 eldap/*.hrl $(INCLUDEDIR)/eldap/ - install -d $(INCLUDEDIR)/mod_muc/ - install -m 644 mod_muc/*.hrl $(INCLUDEDIR)/mod_muc/ - install -d $(INCLUDEDIR)/mod_proxy65/ - install -m 644 mod_proxy65/*.hrl $(INCLUDEDIR)/mod_proxy65/ - install -d $(INCLUDEDIR)/mod_pubsub/ - install -m 644 mod_pubsub/*.hrl $(INCLUDEDIR)/mod_pubsub/ - install -d $(INCLUDEDIR)/mod_pubsub_ng/ - install -m 644 mod_pubsub_ng/*.hrl $(INCLUDEDIR)/mod_pubsub_ng/ - install -d $(INCLUDEDIR)/web/ - install -m 644 web/*.hrl $(INCLUDEDIR)/web/ - # - # Binary C programs - install -d $(PBINDIR) - install -m 750 $(O_USER) ../tools/captcha.sh $(PBINDIR) - $(INSTALL_EPAM) - # - # Binary system libraries - install -d $(SODIR) - install -m 644 *.so $(SODIR) - # - # Translated strings - install -d $(MSGSDIR) - install -m 644 msgs/*.msg $(MSGSDIR) - # - # Spool directory - install -d -m 750 $(O_USER) $(SPOOLDIR) - $(CHOWN_COMMAND) -R @INSTALLUSER@ $(SPOOLDIR) >$(CHOWN_OUTPUT) - chmod -R 750 $(SPOOLDIR) - [ ! -f $(COOKIEFILE) ] || { $(CHOWN_COMMAND) @INSTALLUSER@ $(COOKIEFILE) >$(CHOWN_OUTPUT) ; chmod 400 $(COOKIEFILE) ; } - # - # ejabberdctl lock directory - install -d -m 750 $(O_USER) $(CTLLOCKDIR) - $(CHOWN_COMMAND) -R @INSTALLUSER@ $(CTLLOCKDIR) >$(CHOWN_OUTPUT) - chmod -R 750 $(CTLLOCKDIR) - # - # Log directory - install -d -m 750 $(O_USER) $(LOGDIR) - $(CHOWN_COMMAND) -R @INSTALLUSER@ $(LOGDIR) >$(CHOWN_OUTPUT) - chmod -R 750 $(LOGDIR) - # - # Documentation - install -d $(DOCDIR) - install -m 644 ../doc/dev.html $(DOCDIR) - install -m 644 ../doc/guide.html $(DOCDIR) - install -m 644 ../doc/*.png $(DOCDIR) - install -m 644 ../doc/*.txt $(DOCDIR) - [ -f ../doc/guide.pdf ] \ - && install -m 644 ../doc/guide.pdf $(DOCDIR) \ - || echo "No ../doc/guide.pdf was built" - install -m 644 ../COPYING $(DOCDIR) - -uninstall: uninstall-binary - -uninstall-binary: - rm -f $(SBINDIR)/ejabberdctl - rm -fr $(DOCDIR) - rm -f $(BEAMDIR)/*.beam - rm -f $(BEAMDIR)/*.app - rm -fr $(BEAMDIR) - rm -f $(INCLUDEDIR)/*.hrl - rm -fr $(INCLUDEDIR) - rm -fr $(PBINDIR) - rm -f $(SODIR)/*.so - rm -fr $(SODIR) - rm -f $(MSGSDIR)/*.msgs - rm -fr $(MSGSDIR) - rm -fr $(PRIVDIR) - rm -fr $(EJABBERDDIR) - -uninstall-all: uninstall-binary - rm -rf $(ETCDIR) - rm -rf $(EJABBERDDIR) - rm -rf $(SPOOLDIR) - rm -rf $(CTLLOCKDIR) - rm -rf $(LOGDIR) - -clean: clean-recursive clean-local - -clean-local: - rm -f *.beam $(ERLSHLIBS) epam ejabberdctl.example - rm -f XmppAddr.asn1db XmppAddr.erl XmppAddr.hrl - -distclean: distclean-recursive clean-local - rm -f config.status - rm -f config.log - rm -f Makefile - [ ! -f ../ChangeLog ] || rm -f ../ChangeLog - -TAGS: - etags *.erl - -Makefile: Makefile.in - -dialyzer: $(BEAMS) - @dialyzer -c . diff --git a/src/acinclude.m4 b/src/acinclude.m4 deleted file mode 100644 index 62b40ab2b..000000000 --- a/src/acinclude.m4 +++ /dev/null @@ -1,350 +0,0 @@ -AC_DEFUN([AM_WITH_EXPAT], -[ AC_ARG_WITH(expat, - [AC_HELP_STRING([--with-expat=PREFIX], [prefix where EXPAT is installed])]) - - EXPAT_CFLAGS= - EXPAT_LIBS= - if test x"$with_expat" != x; then - EXPAT_CFLAGS="-I$with_expat/include" - EXPAT_LIBS="-L$with_expat/lib" - fi - - AC_CHECK_LIB(expat, XML_ParserCreate, - [ EXPAT_LIBS="$EXPAT_LIBS -lexpat" - expat_found=yes ], - [ expat_found=no ], - "$EXPAT_LIBS") - if test $expat_found = no; then - AC_MSG_ERROR([Could not find development files of Expat library]) - fi - expat_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $EXPAT_CFLAGS" - expat_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" - AC_CHECK_HEADERS(expat.h, , expat_found=no) - if test $expat_found = no; then - AC_MSG_ERROR([Could not find expat.h]) - fi - CFLAGS="$expat_save_CFLAGS" - CPPFLAGS="$expat_save_CPPFLAGS" - - AC_SUBST(EXPAT_CFLAGS) - AC_SUBST(EXPAT_LIBS) -]) - -AC_DEFUN([AM_WITH_ZLIB], -[ AC_ARG_WITH(zlib, - [AC_HELP_STRING([--with-zlib=PREFIX], [prefix where zlib is installed])]) - -if test x"$ejabberd_zlib" != x; then - ZLIB_CFLAGS= - ZLIB_LIBS= - if test x"$with_zlib" != x; then - ZLIB_CFLAGS="-I$with_zlib/include" - ZLIB_LIBS="-L$with_zlib/lib" - fi - - AC_CHECK_LIB(z, gzgets, - [ ZLIB_LIBS="$ZLIB_LIBS -lz" - zlib_found=yes ], - [ zlib_found=no ], - "$ZLIB_LIBS") - if test $zlib_found = no; then - AC_MSG_ERROR([Could not find development files of zlib library. Install them or disable `ejabberd_zlib' with: --disable-ejabberd_zlib]) - fi - zlib_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ZLIB_CFLAGS" - zlib_save_CPPFLAGS="$CFLAGS" - CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS" - AC_CHECK_HEADERS(zlib.h, , zlib_found=no) - if test $zlib_found = no; then - AC_MSG_ERROR([Could not find zlib.h. Install it or disable `ejabberd_zlib' with: --disable-ejabberd_zlib]) - fi - CFLAGS="$zlib_save_CFLAGS" - CPPFLAGS="$zlib_save_CPPFLAGS" - - AC_SUBST(ZLIB_CFLAGS) - AC_SUBST(ZLIB_LIBS) -fi -]) - -AC_DEFUN([AM_WITH_PAM], -[ AC_ARG_WITH(pam, - [AC_HELP_STRING([--with-pam=PREFIX], [prefix where PAM is installed])]) -if test x"$pam" != x; then - PAM_CFLAGS= - PAM_LIBS= - if test x"$with_pam" != x; then - PAM_CFLAGS="-I$with_pam/include" - PAM_LIBS="-L$with_pam/lib" - fi - - AC_CHECK_LIB(pam, pam_start, - [ PAM_LIBS="$PAM_LIBS -lpam" - pam_found=yes ], - [ pam_found=no ], - "$PAM_LIBS") - if test $pam_found = no; then - AC_MSG_ERROR([Could not find development files of PAM library. Install them or disable `pam' with: --disable-pam]) - fi - pam_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PAM_CFLAGS" - pam_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $PAM_CFLAGS" - AC_CHECK_HEADERS(security/pam_appl.h, , pam_found=no) - if test $pam_found = no; then - AC_MSG_ERROR([Could not find security/pam_appl.h. Install it or disable `pam' with: --disable-pam]) - fi - CFLAGS="$pam_save_CFLAGS" - CPPFLAGS="$pam_save_CPPFLAGS" - - AC_SUBST(PAM_CFLAGS) - AC_SUBST(PAM_LIBS) -fi -]) - -AC_DEFUN([AM_WITH_ERLANG], -[ AC_ARG_WITH(erlang, - [AC_HELP_STRING([--with-erlang=PREFIX], [path to erlc and erl])]) - - AC_PATH_TOOL(ERLC, erlc, , $with_erlang:$with_erlang/bin:$PATH) - AC_PATH_TOOL(ERL, erl, , $with_erlang:$with_erlang/bin:$PATH) - - if test "z$ERLC" = "z" || test "z$ERL" = "z"; then - AC_MSG_ERROR([erlang not found]) - fi - - - cat >>conftest.erl <<_EOF - --module(conftest). --author('alexey@sevcom.net'). - --export([[start/0]]). - -start() -> - EIDirS = code:lib_dir("erl_interface") ++ "\n", - EILibS = libpath("erl_interface") ++ "\n", - RootDirS = code:root_dir() ++ "\n", - file:write_file("conftest.out", list_to_binary(EIDirS ++ EILibS ++ ssldef() ++ RootDirS)), - halt(). - -ssldef() -> - OTP = (catch erlang:system_info(otp_release)), - if - OTP >= "R14" -> "-DSSL40\n"; - OTP >= "R12" -> "-DSSL39\n"; - true -> "\n" - end. - -%% return physical architecture based on OS/Processor -archname() -> - ArchStr = erlang:system_info(system_architecture), - case os:type() of - {win32, _} -> "windows"; - {unix,UnixName} -> - Specs = string:tokens(ArchStr,"-"), - Cpu = case lists:nth(2,Specs) of - "pc" -> "x86"; - _ -> hd(Specs) - end, - atom_to_list(UnixName) ++ "-" ++ Cpu; - _ -> "generic" - end. - -%% Return arch-based library path or a default value if this directory -%% does not exist -libpath(App) -> - PrivDir = code:priv_dir(App), - ArchDir = archname(), - LibArchDir = filename:join([[PrivDir,"lib",ArchDir]]), - case file:list_dir(LibArchDir) of - %% Arch lib dir exists: We use it - {ok, _List} -> LibArchDir; - %% Arch lib dir does not exist: Return the default value - %% ({error, enoent}): - _Error -> code:lib_dir("erl_interface") ++ "/lib" - end. - -_EOF - - if ! $ERLC conftest.erl; then - AC_MSG_ERROR([could not compile sample program]) - fi - - if ! $ERL -s conftest -noshell; then - AC_MSG_ERROR([could not run sample program]) - fi - - if ! test -f conftest.out; then - AC_MSG_ERROR([erlang program was not properly executed, (conftest.out was not produced)]) - fi - - # First line - ERLANG_EI_DIR=`cat conftest.out | head -n 1` - # Second line - ERLANG_EI_LIB=`cat conftest.out | head -n 2 | tail -n 1` - # Third line - ERLANG_SSLVER=`cat conftest.out | head -n 3 | tail -n 1` - # End line - ERLANG_DIR=`cat conftest.out | tail -n 1` - - ERLANG_CFLAGS="-I$ERLANG_EI_DIR/include -I$ERLANG_DIR/usr/include" - ERLANG_LIBS="-L$ERLANG_EI_LIB -lerl_interface -lei" - - AC_SUBST(ERLANG_CFLAGS) - AC_SUBST(ERLANG_LIBS) - AC_SUBST(ERLANG_SSLVER) - AC_SUBST(ERLC) - AC_SUBST(ERL) -]) - -AC_DEFUN([AC_MOD_ENABLE], -[ -$1= -make_$1= -AC_MSG_CHECKING([whether build $1]) -AC_ARG_ENABLE($1, - [AC_HELP_STRING([--enable-$1], [enable $1 (default: $2)])], - [mr_enable_$1="$enableval"], - [mr_enable_$1=$2]) -if test "$mr_enable_$1" = "yes"; then -$1=$1 -make_$1=$1/Makefile -fi -AC_MSG_RESULT($mr_enable_$1) -AC_SUBST($1) -AC_SUBST(make_$1) - -]) - - -dnl From Bruno Haible. - -AC_DEFUN([AM_ICONV], -[ - dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and - dnl those with the standalone portable GNU libiconv installed). - AC_ARG_WITH([libiconv-prefix], - [AC_HELP_STRING([--with-libiconv-prefix=PREFIX], [prefix where libiconv is installed])], [ - for dir in `echo "$withval" | tr : ' '`; do - if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi - if test -d $dir/include; then CFLAGS="$CFLAGS -I$dir/include"; fi - if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi - done - ]) - - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_func_iconv=yes) - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS -liconv" - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_lib_iconv=yes - am_cv_func_iconv=yes) - LIBS="$am_save_LIBS" - fi - dnl trying /usr/local - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - am_save_CFLAGS="$CFLAGS" - am_save_LDFLAGS="$LDFLAGS" - LIBS="$LIBS -liconv" - LDFLAGS="$LDFLAGS -L/usr/local/lib" - CFLAGS="$CFLAGS -I/usr/local/include" - AC_TRY_LINK([#include -#include ], - [iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);], - am_cv_lib_iconv=yes - am_cv_func_iconv=yes - CPPFLAGS="$CPPFLAGS -I/usr/local/include", - LDFLAGS="$am_save_LDFLAGS" - CFLAGS="$am_save_CFLAGS") - LIBS="$am_save_LIBS" - fi - - ]) - if test "$am_cv_func_iconv" = yes; then - AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL(am_cv_proto_iconv, [ - AC_TRY_COMPILE([ -#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 -], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") - 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);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([$]{ac_t:- - }[$]am_cv_proto_iconv) - AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, - [Define as const if the declaration of iconv() needs const.]) - fi - LIBICONV= - if test "$am_cv_lib_iconv" = yes; then - LIBICONV="-liconv" - fi - AC_SUBST(LIBICONV) -]) - -dnl -AC_DEFUN([AM_WITH_OPENSSL], -[ AC_ARG_WITH(openssl, - [AC_HELP_STRING([--with-openssl=PREFIX], [prefix where OPENSSL is installed])]) -unset SSL_LIBS; -unset SSL_CFLAGS; -have_openssl=no -if test x"$tls" != x; then - for ssl_prefix in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do - printf "looking for openssl in $ssl_prefix...\n" - SSL_CFLAGS="-I$ssl_prefix/include" - SSL_LIBS="-L$ssl_prefix/lib -lcrypto" - AC_CHECK_LIB(ssl, SSL_new, [ have_openssl=yes ], [ have_openssl=no ], [ $SSL_LIBS $SSL_CFLAGS ]) - if test x"$have_openssl" = xyes; then - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="-I$ssl_prefix/include $CPPFLAGS" - AC_CHECK_HEADERS(openssl/ssl.h, have_openssl_h=yes) - CPPFLAGS=$save_CPPFLAGS - if test x"$have_openssl_h" = xyes; then - have_openssl=yes - printf "openssl found in $ssl_prefix\n"; - SSL_LIBS="-L$ssl_prefix/lib -lssl -lcrypto" - CPPFLAGS="-I$ssl_prefix/include $CPPFLAGS" - SSL_CFLAGS="-DHAVE_SSL" - break - fi - else - # Clear this from the autoconf cache, so in the next pass of - # this loop with different -L arguments, it will test again. - unset ac_cv_lib_ssl_SSL_new - fi - done -if test x${have_openssl} != xyes; then - AC_MSG_ERROR([Could not find development files of OpenSSL library. Install them or disable `tls' with: --disable-tls]) -fi -AC_SUBST(SSL_LIBS) -AC_SUBST(SSL_CFLAGS) -fi -]) -dnl diff --git a/src/acl.erl b/src/acl.erl index 77c55e79d..88e6f6884 100644 --- a/src/acl.erl +++ b/src/acl.erl @@ -32,6 +32,7 @@ match_rule/3, match_acl/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -record(acl, {aclname, aclspec}). diff --git a/src/adhoc.erl b/src/adhoc.erl index ef81978a5..60babebfb 100644 --- a/src/adhoc.erl +++ b/src/adhoc.erl @@ -35,6 +35,7 @@ ]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include("adhoc.hrl"). diff --git a/src/beam_util.erl b/src/beam_util.erl deleted file mode 100644 index 5104ca285..000000000 --- a/src/beam_util.erl +++ /dev/null @@ -1,56 +0,0 @@ -%% Copyright (C) 2009 Romuald du Song . -%% All rights reserved. -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions -%% are met: -%% -%% 1. Redistributions of source code must retain the above copyright -%% notice, this list of conditions and the following disclaimer. -%% 2. 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. -%% -%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. --module(beam_util). - --export([module_export_list/1, filter_arity/3]). - - -%% Module = string() -%% Function = atom() -module_export_list( Module ) -> - {_Module, _Binary, Filename} = code:get_object_code(Module), - case beam_lib:info( Filename ) of - {error, beam_lib, _} -> - false; - [ _ , _ , _ ] -> - case beam_lib:chunks( Filename, [exports]) of - {ok, {_, [{exports, Exports}]}} -> - Exports; - {error, beam_lib, Er} -> - false - end - end. - -%% Module = string() -%% Arity = integer() -%% Exports = list() -filter_arity( Function, Arity, Exports) -> - case lists:filter( - fun( EFName ) -> {Function, Arity} == EFName end, - Exports ) of - [{_, _}] -> true; - [] -> false - end. diff --git a/src/cache_tab.erl b/src/cache_tab.erl deleted file mode 100644 index 95343e4f5..000000000 --- a/src/cache_tab.erl +++ /dev/null @@ -1,609 +0,0 @@ -%%%------------------------------------------------------------------- -%%% File : cache_tab.erl -%%% Author : Evgeniy Khramtsov -%%% Description : Caching key-value table -%%% -%%% Created : 29 Aug 2010 by Evgeniy Khramtsov -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%------------------------------------------------------------------- --module(cache_tab). - --define(GEN_SERVER, gen_server). - --behaviour(?GEN_SERVER). - -%% API --export([start_link/4, new/2, delete/1, delete/3, lookup/3, - insert/4, info/2, tab2list/1, setopts/2, - dirty_lookup/3, dirty_insert/4, dirty_delete/3, - all/0, test/0]). - -%% gen_server callbacks --export([init/1, handle_call/3, handle_cast/2, handle_info/2, - terminate/2, code_change/3]). - --include("ejabberd.hrl"). - --record(state, {tab = treap:empty(), - name, - size = 0, - owner, - max_size, - life_time, - warn, - hits = 0, - miss = 0, - procs_num, - cache_missed, - lru, - shrink_size}). - --define(PROCNAME, ?MODULE). --define(CALL_TIMEOUT, 60000). - -%% Defaults --define(MAX_SIZE, 1000). --define(WARN, true). --define(CACHE_MISSED, true). --define(LRU, true). --define(LIFETIME, 600). %% 10 minutes - -%%==================================================================== -%% API -%%==================================================================== -start_link(Proc, Tab, Opts, Owner) -> - ?GEN_SERVER:start_link( - {local, Proc}, ?MODULE, [Tab, Opts, get_proc_num(), Owner], []). - -new(Tab, Opts) -> - Res = lists:flatmap( - fun(Proc) -> - Spec = {{Tab, Proc}, - {?MODULE, start_link, - [Proc, Tab, Opts, self()]}, - permanent, - brutal_kill, - worker, - [?MODULE]}, - case supervisor:start_child(cache_tab_sup, Spec) of - {ok, _Pid} -> - [ok]; - R -> - [R] - end - end, get_all_procs(Tab)), - case lists:filter(fun(ok) -> false; (_) -> true end, Res) of - [] -> - ok; - Err -> - {error, Err} - end. - -delete(Tab) -> - lists:foreach( - fun(Proc) -> - supervisor:terminate_child(cache_tab_sup, {Tab, Proc}), - supervisor:delete_child(cache_tab_sup, {Tab, Proc}) - end, get_all_procs(Tab)). - -delete(Tab, Key, F) -> - ?GEN_SERVER:call( - get_proc_by_hash(Tab, Key), {delete, Key, F}, ?CALL_TIMEOUT). - -dirty_delete(Tab, Key, F) -> - F(), - ?GEN_SERVER:call( - get_proc_by_hash(Tab, Key), {cache_delete, Key}, ?CALL_TIMEOUT). - -lookup(Tab, Key, F) -> - ?GEN_SERVER:call( - get_proc_by_hash(Tab, Key), {lookup, Key, F}, ?CALL_TIMEOUT). - -dirty_lookup(Tab, Key, F) -> - Proc = get_proc_by_hash(Tab, Key), - case ?GEN_SERVER:call(Proc, {cache_lookup, Key}, ?CALL_TIMEOUT) of - {ok, '$cached_mismatch'} -> - error; - {ok, Val} -> - {ok, Val}; - _ -> - {Result, NewVal} = case F() of - {ok, Val} -> - {{ok, Val}, Val}; - _ -> - {error, '$cached_mismatch'} - end, - ?GEN_SERVER:call( - Proc, {cache_insert, Key, NewVal}, ?CALL_TIMEOUT), - Result - end. - -insert(Tab, Key, Val, F) -> - ?GEN_SERVER:call( - get_proc_by_hash(Tab, Key), {insert, Key, Val, F}, ?CALL_TIMEOUT). - -dirty_insert(Tab, Key, Val, F) -> - F(), - ?GEN_SERVER:call( - get_proc_by_hash(Tab, Key), {cache_insert, Key, Val}, ?CALL_TIMEOUT). - -info(Tab, Info) -> - case lists:map( - fun(Proc) -> - ?GEN_SERVER:call(Proc, {info, Info}, ?CALL_TIMEOUT) - end, get_all_procs(Tab)) of - Res when Info == size -> - {ok, lists:sum(Res)}; - Res when Info == all -> - {ok, Res}; - Res when Info == ratio -> - {H, M} = lists:foldl( - fun({Hits, Miss}, {HitsAcc, MissAcc}) -> - {HitsAcc + Hits, MissAcc + Miss} - end, {0, 0}, Res), - {ok, [{hits, H}, {miss, M}]}; - _ -> - {error, badarg} - end. - -setopts(Tab, Opts) -> - lists:foreach( - fun(Proc) -> - ?GEN_SERVER:call(Proc, {setopts, Opts}, ?CALL_TIMEOUT) - end, get_all_procs(Tab)). - -tab2list(Tab) -> - lists:flatmap( - fun(Proc) -> - ?GEN_SERVER:call(Proc, tab2list, ?CALL_TIMEOUT) - end, get_all_procs(Tab)). - -all() -> - lists:usort( - [Tab || {{Tab, _}, _, _, _} <- supervisor:which_children(cache_tab_sup)]). - -%%==================================================================== -%% gen_server callbacks -%%==================================================================== -init([Tab, Opts, N, Pid]) -> - State = #state{procs_num = N, - owner = Pid, - name = Tab}, - {ok, do_setopts(State, Opts)}. - -handle_call({lookup, Key, F}, _From, #state{tab = T} = State) -> - CleanPrio = clean_priority(State#state.life_time), - case treap:lookup(Key, T) of - {ok, Prio, Val} when (State#state.lru == true) or (Prio =< CleanPrio) -> - Hits = State#state.hits, - NewState = treap_update(Key, Val, State#state{hits = Hits + 1}), - case Val of - '$cached_mismatch' -> - {reply, error, NewState}; - _ -> - {reply, {ok, Val}, NewState} - end; - _ -> - case catch F() of - {ok, Val} -> - Miss = State#state.miss, - NewState = treap_insert(Key, Val, State), - {reply, {ok, Val}, NewState#state{miss = Miss + 1}}; - {'EXIT', Reason} -> - print_error(lookup, [Key], Reason, State), - {reply, error, State}; - _ -> - Miss = State#state.miss, - NewState = State#state{miss = Miss + 1}, - if State#state.cache_missed -> - {reply, error, - treap_insert(Key, '$cached_mismatch', NewState)}; - true -> - {reply, error, NewState} - end - end - end; -handle_call({cache_lookup, Key}, _From, #state{tab = T} = State) -> - CleanPrio = clean_priority(State#state.life_time), - case treap:lookup(Key, T) of - {ok, Prio, Val} when (State#state.lru == true) or (Prio =< CleanPrio) -> - Hits = State#state.hits, - NewState = treap_update(Key, Val, State#state{hits = Hits + 1}), - {reply, {ok, Val}, NewState}; - _ -> - Miss = State#state.miss, - NewState = State#state{miss = Miss + 1}, - {reply, error, NewState} - end; -handle_call({insert, Key, Val, F}, _From, #state{tab = T} = State) -> - case treap:lookup(Key, T) of - {ok, _Prio, Val} -> - {reply, ok, treap_update(Key, Val, State)}; - _ -> - case catch F() of - {'EXIT', Reason} -> - print_error(insert, [Key, Val], Reason, State), - {reply, ok, State}; - _ -> - {reply, ok, treap_insert(Key, Val, State)} - end - end; -handle_call({cache_insert, _, '$cached_mismatch'}, _From, - #state{cache_missed = false} = State) -> - {reply, ok, State}; -handle_call({cache_insert, Key, Val}, _From, State) -> - {reply, ok, treap_insert(Key, Val, State)}; -handle_call({delete, Key, F}, _From, State) -> - NewState = treap_delete(Key, State), - case catch F() of - {'EXIT', Reason} -> - print_error(delete, [Key], Reason, State); - _ -> - ok - end, - {reply, ok, NewState}; -handle_call({cache_delete, Key}, _From, State) -> - NewState = treap_delete(Key, State), - {reply, ok, NewState}; -handle_call({info, Info}, _From, State) -> - Res = case Info of - size -> - State#state.size; - ratio -> - {State#state.hits, State#state.miss}; - all -> - [{max_size, State#state.max_size}, - {life_time, State#state.life_time}, - {shrink_size, State#state.shrink_size}, - {size, State#state.size}, - {owner, State#state.owner}, - {hits, State#state.hits}, - {miss, State#state.miss}, - {cache_missed, State#state.cache_missed}, - {lru, State#state.lru}, - {warn, State#state.warn}]; - _ -> - badarg - end, - {reply, Res, State}; -handle_call(tab2list, _From, #state{tab = T} = State) -> - Res = treap:fold( - fun({Key, _, Val}, Acc) -> - [{Key, Val}|Acc] - end, [], T), - {reply, Res, State}; -handle_call({setopts, Opts}, _From, State) -> - {reply, ok, do_setopts(State, Opts)}; -handle_call(_Request, _From, State) -> - Reply = ok, - {reply, Reply, State}. - -handle_cast(_Msg, State) -> - {noreply, State}. - -handle_info(_Info, State) -> - {noreply, State}. - -terminate(_Reason, _State) -> - ok. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%-------------------------------------------------------------------- -%%% Internal functions -%%-------------------------------------------------------------------- -do_setopts(#state{procs_num = N} = State, Opts) -> - MaxSize = case {proplists:get_value(max_size, Opts), - State#state.max_size} of - {MS, _} when is_integer(MS), MS > 0 -> - round(MS/N); - {unlimited, _} -> - unlimited; - {_, undefined} -> - round(?MAX_SIZE/N); - {_, MS} -> - MS - end, - LifeTime = case {proplists:get_value(life_time, Opts), - State#state.life_time} of - {LT, _} when is_integer(LT), LT > 0 -> - LT*1000*1000; - {unlimited, _} -> - unlimited; - {_, undefined} -> - ?LIFETIME*1000*1000; - {_, LT} -> - LT - end, - ShrinkSize = case {proplists:get_value(shrink_size, Opts), - State#state.shrink_size} of - {SS, _} when is_integer(SS), SS > 0 -> - round(SS/N); - _ when is_integer(MaxSize) -> - round(MaxSize/2); - _ -> - unlimited - end, - Warn = case {proplists:get_value(warn, Opts), - State#state.warn} of - {true, _} -> - true; - {false, _} -> - false; - {_, undefined} -> - ?WARN; - {_, W} -> - W - end, - CacheMissed = case proplists:get_value( - cache_missed, Opts, State#state.cache_missed) of - false -> - false; - true -> - true; - _ -> - ?CACHE_MISSED - end, - LRU = case proplists:get_value( - lru, Opts, State#state.lru) of - false -> - false; - true -> - true; - _ -> - ?LRU - end, - State#state{max_size = MaxSize, - warn = Warn, - life_time = LifeTime, - cache_missed = CacheMissed, - lru = LRU, - shrink_size = ShrinkSize}. - -get_proc_num() -> - case catch erlang:system_info(logical_processors) of - Num when is_integer(Num) -> - Num; - _ -> - 1 - end. - -get_proc_by_hash(Tab, Term) -> - N = erlang:phash2(Term, get_proc_num()) + 1, - get_proc(Tab, N). - -get_proc(Tab, N) -> - list_to_atom(atom_to_list(?PROCNAME) ++ "_" ++ - atom_to_list(Tab) ++ "_" ++ integer_to_list(N)). - -get_all_procs(Tab) -> - [get_proc(Tab, N) || N <- lists:seq(1, get_proc_num())]. - -now_priority() -> - {MSec, Sec, USec} = now(), - -((MSec*1000000 + Sec)*1000000 + USec). - -clean_priority(LifeTime) -> - if is_integer(LifeTime) -> - now_priority() + LifeTime; - true -> - unlimited - end. - -treap_update(Key, Val, #state{tab = T, lru = LRU} = State) -> - if LRU -> - Priority = now_priority(), - NewT = treap:insert(Key, Priority, Val, T), - State#state{tab = NewT}; - true -> - State - end. - -treap_insert(Key, Val, State) -> - State1 = clean_treap(State), - #state{size = Size} = State2 = shrink_treap(State1), - T = State2#state.tab, - case treap:lookup(Key, T) of - {ok, _, Val} -> - treap_update(Key, Val, State2); - {ok, _, _} -> - NewT = treap:insert(Key, now_priority(), Val, T), - State2#state{tab = NewT}; - _ -> - NewT = treap:insert(Key, now_priority(), Val, T), - State2#state{tab = NewT, size = Size+1} - end. - -treap_delete(Key, #state{tab = T, size = Size} = State) -> - case treap:lookup(Key, T) of - {ok, _, _} -> - NewT = treap:delete(Key, T), - clean_treap(State#state{tab = NewT, size = Size-1}); - _ -> - State - end. - -clean_treap(#state{tab = T, size = Size, life_time = LifeTime} = State) -> - if is_integer(LifeTime) -> - Priority = now_priority(), - {Cleaned, NewT} = clean_treap(T, Priority + LifeTime, 0), - State#state{size = Size - Cleaned, tab = NewT}; - true -> - State - end. - -clean_treap(Treap, CleanPriority, N) -> - case treap:is_empty(Treap) of - true -> - {N, Treap}; - false -> - {_Key, Priority, _Value} = treap:get_root(Treap), - if Priority > CleanPriority -> - clean_treap(treap:delete_root(Treap), CleanPriority, N+1); - true -> - {N, Treap} - end - end. - -shrink_treap(#state{tab = T, - max_size = MaxSize, - shrink_size = ShrinkSize, - warn = Warn, - size = Size} = State) when Size >= MaxSize -> - if Warn -> - ?WARNING_MSG("shrinking table:~n" - "** Table: ~p~n" - "** Processes Number: ~p~n" - "** Max Size: ~p items~n" - "** Shrink Size: ~p items~n" - "** Life Time: ~p microseconds~n" - "** Hits/Miss: ~p/~p~n" - "** Owner: ~p~n" - "** Cache Missed: ~p~n" - "** Instruction: you have to tune cacheing options" - " if this message repeats too frequently", - [State#state.name, State#state.procs_num, - MaxSize, ShrinkSize, State#state.life_time, - State#state.hits, State#state.miss, - State#state.owner, State#state.cache_missed]); - true -> - ok - end, - {Shrinked, NewT} = shrink_treap(T, ShrinkSize, 0), - State#state{tab = NewT, size = Size - Shrinked}; -shrink_treap(State) -> - State. - -shrink_treap(T, ShrinkSize, ShrinkSize) -> - {ShrinkSize, T}; -shrink_treap(T, ShrinkSize, N) -> - case treap:is_empty(T) of - true -> - {N, T}; - false -> - shrink_treap(treap:delete_root(T), ShrinkSize, N+1) - end. - -print_error(Operation, Args, Reason, State) -> - ?ERROR_MSG("callback failed:~n" - "** Tab: ~p~n" - "** Owner: ~p~n" - "** Operation: ~p~n" - "** Args: ~p~n" - "** Reason: ~p", - [State#state.name, State#state.owner, - Operation, Args, Reason]). - -%%-------------------------------------------------------------------- -%%% Tests -%%-------------------------------------------------------------------- --define(lookup, dirty_lookup). --define(delete, dirty_delete). --define(insert, dirty_insert). -%%-define(lookup, lookup). -%%-define(delete, delete). -%%-define(insert, insert). - -test() -> - LifeTime = 2, - ok = new(test_tbl, [{life_time, LifeTime}, {max_size, unlimited}]), - check([]), - ok = ?insert(test_tbl, "key", "value", fun() -> ok end), - check([{"key", "value"}]), - {ok, "value"} = ?lookup(test_tbl, "key", fun() -> error end), - check([{"key", "value"}]), - io:format("** waiting for ~p seconds to check if LRU works fine...~n", - [LifeTime+1]), - timer:sleep(timer:seconds(LifeTime+1)), - ok = ?insert(test_tbl, "key1", "value1", fun() -> ok end), - check([{"key1", "value1"}]), - ok = ?delete(test_tbl, "key1", fun() -> ok end), - {ok, "value"} = ?lookup(test_tbl, "key", fun() -> {ok, "value"} end), - check([{"key", "value"}]), - ok = ?delete(test_tbl, "key", fun() -> ok end), - check([]), - %% io:format("** testing buggy callbacks...~n"), - %% delete(test_tbl, "key", fun() -> erlang:error(badarg) end), - %% insert(test_tbl, "key", "val", fun() -> erlang:error(badarg) end), - %% lookup(test_tbl, "key", fun() -> erlang:error(badarg) end), - check([]), - delete(test_tbl), - test1(). - -test1() -> - MaxSize = 10, - ok = new(test_tbl, [{max_size, MaxSize}, {shrink_size, 1}, {warn, false}]), - lists:foreach( - fun(N) -> - ok = ?insert(test_tbl, N, N, fun() -> ok end) - end, lists:seq(1, MaxSize*get_proc_num())), - {ok, MaxSize} = info(test_tbl, size), - delete(test_tbl), - test2(). - -test2() -> - LifeTime = 2, - ok = new(test_tbl, [{life_time, LifeTime}, - {max_size, unlimited}, - {lru, false}]), - check([]), - ok = ?insert(test_tbl, "key", "value", fun() -> ok end), - {ok, "value"} = ?lookup(test_tbl, "key", fun() -> error end), - check([{"key", "value"}]), - io:format("** waiting for ~p seconds to check if non-LRU works fine...~n", - [LifeTime+1]), - timer:sleep(timer:seconds(LifeTime+1)), - error = ?lookup(test_tbl, "key", fun() -> error end), - check([{"key", '$cached_mismatch'}]), - ok = ?insert(test_tbl, "key", "value1", fun() -> ok end), - check([{"key", "value1"}]), - delete(test_tbl), - io:format("** testing speed, this may take a while...~n"), - test3(1000), - test3(10000), - test3(100000), - test3(1000000). - -test3(Iter) -> - ok = new(test_tbl, [{max_size, unlimited}, {life_time, unlimited}]), - L = lists:seq(1, Iter), - T1 = now(), - lists:foreach( - fun(N) -> - ok = ?insert(test_tbl, N, N, fun() -> ok end) - end, L), - io:format("** average insert (size = ~p): ~p usec~n", - [Iter, round(timer:now_diff(now(), T1)/Iter)]), - T2 = now(), - lists:foreach( - fun(N) -> - {ok, N} = ?lookup(test_tbl, N, fun() -> ok end) - end, L), - io:format("** average lookup (size = ~p): ~p usec~n", - [Iter, round(timer:now_diff(now(), T2)/Iter)]), - {ok, Iter} = info(test_tbl, size), - delete(test_tbl). - -check(List) -> - Size = length(List), - {ok, Size} = info(test_tbl, size), - List = tab2list(test_tbl). diff --git a/src/cache_tab_sup.erl b/src/cache_tab_sup.erl deleted file mode 100644 index 5b016f681..000000000 --- a/src/cache_tab_sup.erl +++ /dev/null @@ -1,53 +0,0 @@ -%%%------------------------------------------------------------------- -%%% File : cache_tab_sup.erl -%%% Author : Evgeniy Khramtsov -%%% Description : Cache tables supervisor -%%% -%%% Created : 30 Aug 2010 by Evgeniy Khramtsov -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%------------------------------------------------------------------- --module(cache_tab_sup). - --behaviour(supervisor). - -%% API --export([start_link/0]). - -%% Supervisor callbacks --export([init/1]). - --define(SERVER, ?MODULE). - -%%==================================================================== -%% API functions -%%==================================================================== -start_link() -> - supervisor:start_link({local, ?SERVER}, ?MODULE, []). - -%%==================================================================== -%% Supervisor callbacks -%%==================================================================== -init([]) -> - {ok, {{one_for_one,10,1}, []}}. - -%%==================================================================== -%% Internal functions -%%==================================================================== diff --git a/src/config.guess b/src/config.guess deleted file mode 100644 index e3a2116a7..000000000 --- a/src/config.guess +++ /dev/null @@ -1,1533 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. - -timestamp='2009-06-10' - -# 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 -# 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 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. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -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) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - 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 ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # 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 ;; - 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 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - 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 ;; - 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 - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - 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 ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - 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 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - 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 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - 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 - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $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 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - 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 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - 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 ;; - *:AIX:*:[456]) - 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 - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - 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 -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - 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 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - 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 ;; - 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 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T | authenticamd | genuineintel) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - 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 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - 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 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - 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 - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - 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 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - 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 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - 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 - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - 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 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/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 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - 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; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { 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; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - 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; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - 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 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - 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 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - 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 ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$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; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/config.sub b/src/config.sub deleted file mode 100644 index eb0389a69..000000000 --- a/src/config.sub +++ /dev/null @@ -1,1693 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. - -timestamp='2009-06-11' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# 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 -# 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 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. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | 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 | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tile*) - basic_machine=tile-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/configure.ac b/src/configure.ac deleted file mode 100644 index 029af27ad..000000000 --- a/src/configure.ac +++ /dev/null @@ -1,192 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.53) -AC_INIT(ejabberd, m4_esyscmd([grep -o -E "\{vsn,.\".*\"\}" ejabberd.app | cut -d \" -f 2 | tr -d '\n']), [ejabberd@process-one.net], [ejabberd]) - -# Checks for programs. -AC_PROG_CC -AC_PROG_MAKE_SET - -if test "x$GCC" = "xyes"; then - CFLAGS="$CFLAGS -Wall" -fi - -#locating erlang -AM_WITH_ERLANG -#locating iconv -AM_ICONV -#locating libexpat -AM_WITH_EXPAT - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST - -# Check Erlang headers are installed -#AC_CHECK_HEADER(erl_driver.h,,[AC_MSG_ERROR([cannot find Erlang header files])]) - -# Change default prefix -AC_PREFIX_DEFAULT(/) - -# Checks for library functions. -AC_FUNC_MALLOC -AC_HEADER_STDC - -AC_MOD_ENABLE(mod_irc, yes) -AC_MOD_ENABLE(mod_muc, yes) -AC_MOD_ENABLE(mod_proxy65, yes) -AC_MOD_ENABLE(mod_pubsub, yes) -AC_MOD_ENABLE(mod_pubsub_ng, yes) -AC_MOD_ENABLE(eldap, yes) -AC_MOD_ENABLE(odbc, no) -AC_MOD_ENABLE(tls, yes) -AC_MOD_ENABLE(web, yes) - -AC_MOD_ENABLE(ejabberd_zlib, yes) -#locating zlib -AM_WITH_ZLIB - -AC_MOD_ENABLE(pam, no) -#locating PAM -AM_WITH_PAM - -AC_ARG_ENABLE(hipe, -[AC_HELP_STRING([--enable-hipe], [compile natively with HiPE, not recommended (default: no)])], -[case "${enableval}" in - yes) hipe=true ;; - no) hipe=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-hipe) ;; -esac],[hipe=false]) -AC_SUBST(hipe) - -AC_ARG_ENABLE(roster_gateway_workaround, -[AC_HELP_STRING([--enable-roster-gateway-workaround], [turn on workaround for processing gateway subscriptions (default: no)])], -[case "${enableval}" in - yes) roster_gateway_workaround=true ;; - no) roster_gateway_workaround=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-roster-gateway-workaround) ;; -esac],[roster_gateway_workaround=false]) -AC_SUBST(roster_gateway_workaround) - -AC_ARG_ENABLE(flash_hack, -[AC_HELP_STRING([--enable-flash-hack], [support Adobe Flash client XML (default: no)])], -[case "${enableval}" in - yes) flash_hack=true ;; - no) flash_hack=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-flash-hack) ;; -esac],[flash_hack=false]) -AC_SUBST(flash_hack) - -AC_ARG_ENABLE(mssql, -[AC_HELP_STRING([--enable-mssql], [use Microsoft SQL Server database (default: no, requires --enable-odbc)])], -[case "${enableval}" in - yes) db_type=mssql ;; - no) db_type=generic ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-mssql) ;; -esac],[db_type=generic]) -AC_SUBST(db_type) - -AC_ARG_ENABLE(transient_supervisors, -[AC_HELP_STRING([--enable-transient_supervisors], [use Erlang supervision for transient process (default: yes)])], -[case "${enableval}" in - yes) transient_supervisors=true ;; - no) transient_supervisors=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-transient_supervisors) ;; -esac],[transient_supervisors=true]) -AC_SUBST(transient_supervisors) - -AC_ARG_ENABLE(full_xml, -[AC_HELP_STRING([--enable-full-xml], [use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)])], -[case "${enableval}" in - yes) full_xml=true ;; - no) full_xml=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-full-xml) ;; -esac],[full_xml=false]) -AC_SUBST(full_xml) - -AC_ARG_ENABLE(nif, -[AC_HELP_STRING([--enable-nif], [replace some functions with C equivalents. Requires Erlang R13B04 or higher (default: no)])], -[case "${enableval}" in - yes) nif=true ;; - no) nif=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-nif) ;; -esac],[nif=false]) -AC_SUBST(nif) - -AC_CONFIG_FILES([Makefile - $make_mod_irc - $make_mod_muc - $make_mod_pubsub - $make_mod_pubsub_ng - $make_mod_proxy65 - $make_eldap - $make_pam - $make_web - stringprep/Makefile - stun/Makefile - $make_tls - $make_odbc - $make_ejabberd_zlib]) -#openssl -AM_WITH_OPENSSL -# If ssl is kerberized it need krb5.h -# On RedHat and OpenBSD, krb5.h is in an unsual place: -KRB5_INCLUDE="`krb5-config --cflags 2>/dev/null`" -if test -n "$KRB5_INCLUDE" ; then - CPPFLAGS="$CPPFLAGS $KRB5_INCLUDE" -else - # For RedHat For BSD - for D in /usr/kerberos/include /usr/include/kerberos /usr/include/kerberosV - do - if test -d $D ; then - CPPFLAGS="$CPPFLAGS -I$D" - fi - done -fi -AC_CHECK_HEADER(krb5.h,,) - -ENABLEUSER="" -AC_ARG_ENABLE(user, - [AS_HELP_STRING([--enable-user[[[[=USER]]]]], [allow this system user to start ejabberd (default: no)])], - [case "${enableval}" in - yes) ENABLEUSER=`whoami` ;; - no) ENABLEUSER="" ;; - *) ENABLEUSER=$enableval - esac], - []) -if test "$ENABLEUSER" != ""; then - echo "allow this system user to start ejabberd: $ENABLEUSER" - AC_SUBST([INSTALLUSER], [$ENABLEUSER]) -fi - -AC_CHECK_HEADER(openssl/md2.h, md2=true, md2=false) -AC_SUBST(md2) - -AC_CANONICAL_SYSTEM -#AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$target") -#AC_SUBST(target_os) - - -case "$target_os" in - *darwin10*) - echo "Target OS is 'Darwin10'" - AC_LANG(Erlang) - AC_RUN_IFELSE( - [AC_LANG_PROGRAM([],[dnl - halt(case erlang:system_info(wordsize) of - 8 -> 0; 4 -> 1 end)])], - [AC_MSG_NOTICE(found 64-bit Erlang) - CBIT=-m64], - [AC_MSG_NOTICE(found 32-bit Erlang) - CBIT=-m32]) - ;; - *) - echo "Target OS is '$target_os'" - CBIT="" - ;; -esac -CFLAGS="$CFLAGS $CBIT" -LD_SHARED="$LD_SHARED $CBIT" -echo "CBIT is set to '$CBIT'" - -AC_OUTPUT diff --git a/src/configure.erl b/src/configure.erl index 87b7bc208..6f0b1dd4e 100644 --- a/src/configure.erl +++ b/src/configure.erl @@ -30,6 +30,7 @@ -export([start/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). start() -> Static = case os:getenv("arg") of diff --git a/src/cyrsasl.erl b/src/cyrsasl.erl index 08f6ad7bd..cde5a4893 100644 --- a/src/cyrsasl.erl +++ b/src/cyrsasl.erl @@ -32,6 +32,7 @@ server_new/7, server_start/3, server_step/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). %% -export_type([ diff --git a/src/cyrsasl_digest.erl b/src/cyrsasl_digest.erl index 3633ee049..50990c5fc 100644 --- a/src/cyrsasl_digest.erl +++ b/src/cyrsasl_digest.erl @@ -31,6 +31,7 @@ -export([start/1, stop/0, mech_new/4, mech_step/2, parse/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -behaviour(cyrsasl). diff --git a/src/cyrsasl_scram.erl b/src/cyrsasl_scram.erl index 33d18cd1a..4a85ecbf2 100644 --- a/src/cyrsasl_scram.erl +++ b/src/cyrsasl_scram.erl @@ -31,6 +31,7 @@ -export([start/1, stop/0, mech_new/4, mech_step/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -behaviour(cyrsasl). diff --git a/src/dynamic_compile.erl b/src/dynamic_compile.erl deleted file mode 100644 index 1fe2dcaad..000000000 --- a/src/dynamic_compile.erl +++ /dev/null @@ -1,268 +0,0 @@ -%% Copyright (c) 2007 -%% Mats Cronqvist -%% Chris Newcombe -%% Jacob Vorreuter -%% -%% Permission is hereby granted, free of charge, to any person -%% obtaining a copy of this software and associated documentation -%% files (the "Software"), to deal in the Software without -%% restriction, including without limitation the rights to use, -%% copy, modify, merge, publish, distribute, sublicense, and/or sell -%% copies of the Software, and to permit persons to whom the -%% Software is furnished to do so, subject to the following -%% conditions: -%% -%% The above copyright notice and this permission notice shall be -%% included in all copies or substantial portions of the Software. -%% -%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -%% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -%% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -%% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -%% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -%% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -%% OTHER DEALINGS IN THE SOFTWARE. - -%%%------------------------------------------------------------------- -%%% File : dynamic_compile.erl -%%% Description : -%%% Authors : Mats Cronqvist -%%% Chris Newcombe -%%% Jacob Vorreuter -%%% TODO : -%%% - add support for limit include-file depth (and prevent circular references) -%%% prevent circular macro expansion set FILE correctly when -module() is found -%%% -include_lib support $ENVVAR in include filenames -%%% substitute-stringize (??MACRO) -%%% -undef/-ifdef/-ifndef/-else/-endif -%%% -file(File, Line) -%%%------------------------------------------------------------------- --module(dynamic_compile). - -%% API --export([from_string/1, from_string/2]). - --import(lists, [reverse/1, keyreplace/4]). - -%%==================================================================== -%% API -%%==================================================================== -%%-------------------------------------------------------------------- -%% Function: -%% Description: -%% Returns a binary that can be used with -%% code:load_binary(Module, ModuleFilenameForInternalRecords, Binary). -%%-------------------------------------------------------------------- -from_string(CodeStr) -> - from_string(CodeStr, []). - -% takes Options as for compile:forms/2 -from_string(CodeStr, CompileFormsOptions) -> - %% Initialise the macro dictionary with the default predefined macros, - %% (adapted from epp.erl:predef_macros/1 - Filename = "compiled_from_string", - %%Machine = list_to_atom(erlang:system_info(machine)), - Ms0 = dict:new(), - % Ms1 = dict:store('FILE', {[], "compiled_from_string"}, Ms0), - % Ms2 = dict:store('LINE', {[], 1}, Ms1), % actually we might add special code for this - % Ms3 = dict:store('MODULE', {[], undefined}, Ms2), - % Ms4 = dict:store('MODULE_STRING', {[], undefined}, Ms3), - % Ms5 = dict:store('MACHINE', {[], Machine}, Ms4), - % InitMD = dict:store(Machine, {[], true}, Ms5), - InitMD = Ms0, - - %% From the docs for compile:forms: - %% When encountering an -include or -include_dir directive, the compiler searches for header files in the following directories: - %% 1. ".", the current working directory of the file server; - %% 2. the base name of the compiled file; - %% 3. the directories specified using the i option. The directory specified last is searched first. - %% In this case, #2 is meaningless. - IncludeSearchPath = ["." | reverse([Dir || {i, Dir} <- CompileFormsOptions])], - {RevForms, _OutMacroDict} = scan_and_parse(CodeStr, Filename, 1, [], InitMD, IncludeSearchPath), - Forms = reverse(RevForms), - - %% note: 'binary' is forced as an implicit option, whether it is provided or not. - case compile:forms(Forms, CompileFormsOptions) of - {ok, ModuleName, CompiledCodeBinary} when is_binary(CompiledCodeBinary) -> - {ModuleName, CompiledCodeBinary}; - {ok, ModuleName, CompiledCodeBinary, []} when is_binary(CompiledCodeBinary) -> % empty warnings list - {ModuleName, CompiledCodeBinary}; - {ok, _ModuleName, _CompiledCodeBinary, Warnings} -> - throw({?MODULE, warnings, Warnings}); - Other -> - throw({?MODULE, compile_forms, Other}) - end. - -%%==================================================================== -%% Internal functions -%%==================================================================== -%%% Code from Mats Cronqvist -%%% See http://www.erlang.org/pipermail/erlang-questions/2007-March/025507.html -%%%## 'scan_and_parse' -%%% -%%% basically we call the OTP scanner and parser (erl_scan and -%%% erl_parse) line-by-line, but check each scanned line for (or -%%% definitions of) macros before parsing. -%% returns {ReverseForms, FinalMacroDict} -scan_and_parse([], _CurrFilename, _CurrLine, RevForms, MacroDict, _IncludeSearchPath) -> - {RevForms, MacroDict}; - -scan_and_parse(RemainingText, CurrFilename, CurrLine, RevForms, MacroDict, IncludeSearchPath) -> - case scanner(RemainingText, CurrLine, MacroDict) of - {tokens, NLine, NRemainingText, Toks} -> - {ok, Form} = erl_parse:parse_form(Toks), - scan_and_parse(NRemainingText, CurrFilename, NLine, [Form | RevForms], MacroDict, IncludeSearchPath); - {macro, NLine, NRemainingText, NMacroDict} -> - scan_and_parse(NRemainingText, CurrFilename, NLine, RevForms,NMacroDict, IncludeSearchPath); - {include, NLine, NRemainingText, IncludeFilename} -> - IncludeFileRemainingTextents = read_include_file(IncludeFilename, IncludeSearchPath), - %%io:format("include file ~p contents: ~n~p~nRemainingText = ~p~n", [IncludeFilename,IncludeFileRemainingTextents, RemainingText]), - %% Modify the FILE macro to reflect the filename - %%IncludeMacroDict = dict:store('FILE', {[],IncludeFilename}, MacroDict), - IncludeMacroDict = MacroDict, - - %% Process the header file (inc. any nested header files) - {RevIncludeForms, IncludedMacroDict} = scan_and_parse(IncludeFileRemainingTextents, IncludeFilename, 1, [], IncludeMacroDict, IncludeSearchPath), - %io:format("include file results = ~p~n", [R]), - %% Restore the FILE macro in the NEW MacroDict (so we keep any macros defined in the header file) - %%NMacroDict = dict:store('FILE', {[],CurrFilename}, IncludedMacroDict), - NMacroDict = IncludedMacroDict, - - %% Continue with the original file - scan_and_parse(NRemainingText, CurrFilename, NLine, RevIncludeForms ++ RevForms, NMacroDict, IncludeSearchPath); - done -> - scan_and_parse([], CurrFilename, CurrLine, RevForms, MacroDict, IncludeSearchPath) - end. - -scanner(Text, Line, MacroDict) -> - case erl_scan:tokens([],Text,Line) of - {done, {ok,Toks,NLine}, LeftOverChars} -> - case pre_proc(Toks, MacroDict) of - {tokens, NToks} -> {tokens, NLine, LeftOverChars, NToks}; - {macro, NMacroDict} -> {macro, NLine, LeftOverChars, NMacroDict}; - {include, Filename} -> {include, NLine, LeftOverChars, Filename} - end; - {more, _Continuation} -> - %% This is supposed to mean "term is not yet complete" (i.e. a '.' has - %% not been reached yet). - %% However, for some bizarre reason we also get this if there is a comment after the final '.' in a file. - %% So we check to see if Text only consists of comments. - case is_only_comments(Text) of - true -> - done; - false -> - throw({incomplete_term, Text, Line}) - end - end. - -is_only_comments(Text) -> is_only_comments(Text, not_in_comment). - -is_only_comments([], _) -> true; -is_only_comments([$ |T], not_in_comment) -> is_only_comments(T, not_in_comment); % skipping whitspace outside of comment -is_only_comments([$\t |T], not_in_comment) -> is_only_comments(T, not_in_comment); % skipping whitspace outside of comment -is_only_comments([$\n |T], not_in_comment) -> is_only_comments(T, not_in_comment); % skipping whitspace outside of comment -is_only_comments([$% |T], not_in_comment) -> is_only_comments(T, in_comment); % found start of a comment -is_only_comments(_, not_in_comment) -> false; -% found any significant char NOT in a comment -is_only_comments([$\n |T], in_comment) -> is_only_comments(T, not_in_comment); % found end of a comment -is_only_comments([_ |T], in_comment) -> is_only_comments(T, in_comment). % skipping over in-comment chars - -%%%## 'pre-proc' -%%% -%%% have to implement a subset of the pre-processor, since epp insists -%%% on running on a file. -%%% only handles 2 cases; -%% -define(MACRO, something). -%% -define(MACRO(VAR1,VARN),{stuff,VAR1,more,stuff,VARN,extra,stuff}). -pre_proc([{'-',_},{atom,_,define},{'(',_},{_,_,Name}|DefToks],MacroDict) -> - false = dict:is_key(Name, MacroDict), - case DefToks of - [{',',_} | Macro] -> - {macro, dict:store(Name, {[], macro_body_def(Macro, [])}, MacroDict)}; - [{'(',_} | Macro] -> - {macro, dict:store(Name, macro_params_body_def(Macro, []), MacroDict)} - end; - -pre_proc([{'-',_}, {atom,_,include}, {'(',_}, {string,_,Filename}, {')',_}, {dot,_}], _MacroDict) -> - {include, Filename}; - -pre_proc(Toks,MacroDict) -> - {tokens, subst_macros(Toks, MacroDict)}. - -macro_params_body_def([{')',_},{',',_} | Toks], RevParams) -> - {reverse(RevParams), macro_body_def(Toks, [])}; -macro_params_body_def([{var,_,Param} | Toks], RevParams) -> - macro_params_body_def(Toks, [Param | RevParams]); -macro_params_body_def([{',',_}, {var,_,Param} | Toks], RevParams) -> - macro_params_body_def(Toks, [Param | RevParams]). - -macro_body_def([{')',_}, {dot,_}], RevMacroBodyToks) -> - reverse(RevMacroBodyToks); -macro_body_def([Tok|Toks], RevMacroBodyToks) -> - macro_body_def(Toks, [Tok | RevMacroBodyToks]). - -subst_macros(Toks, MacroDict) -> - reverse(subst_macros_rev(Toks, MacroDict, [])). - -%% returns a reversed list of tokes -subst_macros_rev([{'?',_}, {_,LineNum,'LINE'} | Toks], MacroDict, RevOutToks) -> - %% special-case for ?LINE, to avoid creating a new MacroDict for every line in the source file - subst_macros_rev(Toks, MacroDict, [{integer,LineNum,LineNum}] ++ RevOutToks); - -subst_macros_rev([{'?',_}, {_,_,Name}, {'(',_} = Paren | Toks], MacroDict, RevOutToks) -> - case dict:fetch(Name, MacroDict) of - {[], MacroValue} -> - %% This macro does not have any vars, so ignore the fact that the invocation is followed by "(...stuff" - %% Recursively expand any macro calls inside this macro's value - %% TODO: avoid infinite expansion due to circular references (even indirect ones) - RevExpandedOtherMacrosToks = subst_macros_rev(MacroValue, MacroDict, []), - subst_macros_rev([Paren|Toks], MacroDict, RevExpandedOtherMacrosToks ++ RevOutToks); - ParamsAndBody -> - %% This macro does have vars. - %% Collect all of the passe arguments, in an ordered list - {NToks, Arguments} = subst_macros_get_args(Toks, []), - %% Expand the varibles - ExpandedParamsToks = subst_macros_subst_args_for_vars(ParamsAndBody, Arguments), - %% Recursively expand any macro calls inside this macro's value - %% TODO: avoid infinite expansion due to circular references (even indirect ones) - RevExpandedOtherMacrosToks = subst_macros_rev(ExpandedParamsToks, MacroDict, []), - subst_macros_rev(NToks, MacroDict, RevExpandedOtherMacrosToks ++ RevOutToks) - end; - -subst_macros_rev([{'?',_}, {_,_,Name} | Toks], MacroDict, RevOutToks) -> - %% This macro invocation does not have arguments. - %% Therefore the definition should not have parameters - {[], MacroValue} = dict:fetch(Name, MacroDict), - - %% Recursively expand any macro calls inside this macro's value - %% TODO: avoid infinite expansion due to circular references (even indirect ones) - RevExpandedOtherMacrosToks = subst_macros_rev(MacroValue, MacroDict, []), - subst_macros_rev(Toks, MacroDict, RevExpandedOtherMacrosToks ++ RevOutToks); - -subst_macros_rev([Tok|Toks], MacroDict, RevOutToks) -> -subst_macros_rev(Toks, MacroDict, [Tok|RevOutToks]); -subst_macros_rev([], _MacroDict, RevOutToks) -> RevOutToks. - -subst_macros_get_args([{')',_} | Toks], RevArgs) -> - {Toks, reverse(RevArgs)}; -subst_macros_get_args([{',',_}, {var,_,ArgName} | Toks], RevArgs) -> - subst_macros_get_args(Toks, [ArgName| RevArgs]); -subst_macros_get_args([{var,_,ArgName} | Toks], RevArgs) -> - subst_macros_get_args(Toks, [ArgName | RevArgs]). - -subst_macros_subst_args_for_vars({[], BodyToks}, []) -> - BodyToks; -subst_macros_subst_args_for_vars({[Param | Params], BodyToks}, [Arg|Args]) -> - NBodyToks = keyreplace(Param, 3, BodyToks, {var,1,Arg}), - subst_macros_subst_args_for_vars({Params, NBodyToks}, Args). - -read_include_file(Filename, IncludeSearchPath) -> - case file:path_open(IncludeSearchPath, Filename, [read, raw, binary]) of - {ok, IoDevice, FullName} -> - {ok, Data} = file:read(IoDevice, filelib:file_size(FullName)), - file:close(IoDevice), - binary_to_list(Data); - {error, Reason} -> - throw({failed_to_read_include_file, Reason, Filename, IncludeSearchPath}) - end. \ No newline at end of file diff --git a/src/ejabberd.app b/src/ejabberd.app deleted file mode 100644 index 349b4ecb2..000000000 --- a/src/ejabberd.app +++ /dev/null @@ -1,156 +0,0 @@ -%% $Id$ - -{application, ejabberd, - [{description, "ejabberd"}, - {vsn, "3.0.0"}, - {modules, [acl, - adhoc, - configure, - cyrsasl_anonymous, - cyrsasl, - cyrsasl_digest, - cyrsasl_plain, - cyrsasl_scram, - ejabberd_admin, - ejabberd_app, - ejabberd_auth_anonymous, - ejabberd_auth, - ejabberd_auth_external, - ejabberd_auth_internal, - ejabberd_auth_ldap, - ejabberd_auth_odbc, - ejabberd_auth_pam, - ejabberd, - ejabberd_c2s, - ejabberd_c2s_config, - ejabberd_config, - ejabberd_ctl, - ejabberd_frontend_socket, - ejabberd_hooks, - ejabberd_http, - ejabberd_http_bind, - ejabberd_http_poll, - ejabberd_listener, - ejabberd_local, - ejabberd_logger_h, - ejabberd_loglevel, - ejabberd_node_groups, - ejabberd_rdbms, - ejabberd_receiver, - ejabberd_router, - ejabberd_router_multicast, - ejabberd_s2s, - ejabberd_s2s_in, - ejabberd_s2s_out, - ejabberd_service, - ejabberd_sm, - ejabberd_socket, - ejabberd_sup, - ejabberd_system_monitor, - ejabberd_tmp_sup, - ejabberd_update, - ejabberd_web_admin, - ejabberd_web, - ejabberd_zlib, - ejd2odbc, - eldap, - eldap_filter, - eldap_pool, - eldap_utils, - 'ELDAPv3', - extauth, - gen_iq_handler, - gen_mod, - gen_pubsub_node, - gen_pubsub_nodetree, - iconv, - idna, - jd2ejd, - jlib, - mod_adhoc, - mod_announce, - mod_caps, - mod_configure2, - mod_configure, - mod_disco, - mod_echo, - mod_http_bind, - mod_http_fileserver, - mod_irc, - mod_irc_connection, - mod_last, - mod_muc, - mod_muc_log, - mod_muc_room, - mod_offline, - mod_privacy, - mod_private, - mod_proxy65, - mod_proxy65_lib, - mod_proxy65_service, - mod_proxy65_sm, - mod_proxy65_stream, - mod_pubsub, - mod_register, - mod_roster, - mod_service_log, - mod_shared_roster, - mod_stats, - mod_time, - mod_vcard, - mod_vcard_ldap, - mod_version, - node_buddy, - node_club, - node_default, - node_dispatch, - node_pep, - node_private, - node_public, - nodetree_default, - nodetree_virtual, - p1_fsm, - p1_mnesia, - p1_prof, - randoms, - sha, - shaper, - stringprep, - stringprep_sup, - tls, - translate, - xml, - xml_stream, - 'XmppAddr' - ]}, - {registered, [ejabberd, - ejabberd_sup, - ejabberd_auth, - ejabberd_router, - ejabberd_router_multicast, - ejabberd_sm, - ejabberd_s2s, - ejabberd_local, - ejabberd_listeners, - ejabberd_iq_sup, - ejabberd_service_sup, - ejabberd_s2s_out_sup, - ejabberd_s2s_in_sup, - ejabberd_c2s_sup, - ejabberd_mod_roster, - ejabberd_mod_echo, - ejabberd_mod_pubsub, - ejabberd_mod_irc, - ejabberd_mod_muc, - ejabberd_offline, - random_generator - ]}, - {applications, [kernel, stdlib]}, - {env, []}, - {mod, {ejabberd_app, []}}]}. - - -%% Local Variables: -%% mode: erlang -%% End: -%% vim: set filetype=erlang tabstop=8: diff --git a/src/ejabberd.app.src.in b/src/ejabberd.app.src.in new file mode 100644 index 000000000..4b0864831 --- /dev/null +++ b/src/ejabberd.app.src.in @@ -0,0 +1,16 @@ +%% $Id$ + +{application, ejabberd, + [{description, "@PACKAGE_NAME@"}, + {vsn, "@PACKAGE_VERSION@"}, + {modules, []}, + {registered, []}, + {applications, [kernel, stdlib]}, + {env, []}, + {mod, {ejabberd_app, []}}]}. + + +%% Local Variables: +%% mode: erlang +%% End: +%% vim: set filetype=erlang tabstop=8: diff --git a/src/ejabberd.erl b/src/ejabberd.erl index 258662473..7b83f19a1 100644 --- a/src/ejabberd.erl +++ b/src/ejabberd.erl @@ -27,9 +27,10 @@ -module(ejabberd). -author('alexey@process-one.net'). --export([start/0, stop/0, - get_pid_file/0, - get_so_path/0, get_bin_path/0]). +-export([start/0, stop/0, start_app/1, + get_pid_file/0]). + +-include("logger.hrl"). start() -> %%ejabberd_cover:start(), @@ -39,32 +40,6 @@ stop() -> application:stop(ejabberd). %%ejabberd_cover:stop(). -get_so_path() -> - case os:getenv("EJABBERD_SO_PATH") of - false -> - case code:priv_dir(ejabberd) of - {error, _} -> - "."; - Path -> - filename:join([Path, "lib"]) - end; - Path -> - Path - end. - -get_bin_path() -> - case os:getenv("EJABBERD_BIN_PATH") of - false -> - case code:priv_dir(ejabberd) of - {error, _} -> - "."; - Path -> - filename:join([Path, "bin"]) - end; - Path -> - Path - end. - %% @spec () -> false | string() get_pid_file() -> case os:getenv("EJABBERD_PID_PATH") of @@ -75,3 +50,28 @@ get_pid_file() -> Path -> Path end. + +start_app(App) when not is_list(App) -> + start_app([App]); +start_app([App|Apps]) -> + case application:start(App) of + ok -> + start_app(Apps); + {error, {already_started, _}} -> + start_app(Apps); + {error, {not_started, DepApp}} -> + case lists:member(DepApp, [App|Apps]) of + true -> + ?CRITICAL_MSG("failed to start application '~p': " + "circular dependency on '~p' detected", + [App, DepApp]), + erlang:error(application_start_failed); + false -> + start_app([DepApp,App|Apps]) + end; + Err -> + ?CRITICAL_MSG("failed to start application '~p': ~p", [App, Err]), + erlang:error(application_start_failed) + end; +start_app([]) -> + ok. diff --git a/src/ejabberd_admin.erl b/src/ejabberd_admin.erl index f0e4f4c66..b0f847337 100644 --- a/src/ejabberd_admin.erl +++ b/src/ejabberd_admin.erl @@ -55,6 +55,7 @@ ]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("ejabberd_commands.hrl"). start() -> @@ -109,7 +110,7 @@ commands() -> result = {res, rescode}}, #ejabberd_commands{name = get_loglevel, tags = [logs, server], desc = "Get the current loglevel", - module = ejabberd_loglevel, function = get, + module = ejabberd_logger, function = get, args = [], result = {leveltuple, {tuple, [{levelnumber, integer}, {levelatom, atom}, @@ -279,27 +280,7 @@ status() -> reopen_log() -> ejabberd_hooks:run(reopen_log_hook, []), - %% TODO: Use the Reopen log API for logger_h ? - ejabberd_logger_h:reopen_log(), - case application:get_env(sasl,sasl_error_logger) of - {ok, {file, SASLfile}} -> - error_logger:delete_report_handler(sasl_report_file_h), - ejabberd_logger_h:rotate_log(SASLfile), - error_logger:add_report_handler(sasl_report_file_h, - {SASLfile, get_sasl_error_logger_type()}); - _ -> false - end, - ok. - -%% Function copied from Erlang/OTP lib/sasl/src/sasl.erl which doesn't export it -get_sasl_error_logger_type () -> - case application:get_env (sasl, errlog_type) of - {ok, error} -> error; - {ok, progress} -> progress; - {ok, all} -> all; - {ok, Bad} -> exit ({bad_config, {sasl, {errlog_type, Bad}}}); - _ -> all - end. + ejabberd_logger:reopen_log(). %%% %%% Stop Kindly diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl index a18af480b..4db7307e5 100644 --- a/src/ejabberd_app.erl +++ b/src/ejabberd_app.erl @@ -32,21 +32,18 @@ -export([start_modules/0,start/2, get_log_path/0, prep_stop/1, stop/1, init/0]). -include("ejabberd.hrl"). - +-include("logger.hrl"). %%% %%% Application API %%% start(normal, _Args) -> - ejabberd_loglevel:set(4), + ejabberd_logger:set(4), write_pid_file(), - application:start(sasl), + start_apps(), randoms:start(), db_init(), - sha:start(), - stringprep_sup:start_link(), - xml:start(), start(), translate:start(), acl:start(), @@ -107,20 +104,13 @@ init() -> %erlang:system_flag(fullsweep_after, 0), %error_logger:logfile({open, ?LOG_PATH}), LogPath = get_log_path(), - error_logger:add_report_handler(ejabberd_logger_h, LogPath), - erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv), - case erl_ddll:load_driver(ejabberd:get_so_path(), expat_erl) of - ok -> ok; - {error, already_loaded} -> ok - end, - Port = open_port({spawn, "expat_erl"}, [binary]), - loop(Port). + ejabberd_logger:set_logfile(LogPath), + loop(). - -loop(Port) -> +loop() -> receive _ -> - loop(Port) + loop() end. db_init() -> @@ -249,3 +239,12 @@ delete_pid_file() -> PidFilename -> file:delete(PidFilename) end. + +start_apps() -> + ejabberd:start_app(sasl), + ejabberd:start_app(ssl), + ejabberd:start_app(p1_tls), + ejabberd:start_app(p1_xml), + ejabberd:start_app(p1_stringprep), + ejabberd:start_app(p1_zlib), + ejabberd:start_app(p1_cache_tab). diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl index bdcbb1471..f8ac2a3eb 100644 --- a/src/ejabberd_auth.erl +++ b/src/ejabberd_auth.erl @@ -52,6 +52,7 @@ -export([create_users/5]). -include("ejabberd.hrl"). +-include("logger.hrl"). -type opts() :: [{prefix, binary()} | {from, integer()} | {to, integer()} | {limit, integer()} | diff --git a/src/ejabberd_auth_anonymous.erl b/src/ejabberd_auth_anonymous.erl index 80cc1b99b..2c98b87a9 100644 --- a/src/ejabberd_auth_anonymous.erl +++ b/src/ejabberd_auth_anonymous.erl @@ -48,6 +48,7 @@ plain_password_required/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_auth_external.erl b/src/ejabberd_auth_external.erl index 84551d0c2..ed0d159f1 100644 --- a/src/ejabberd_auth_external.erl +++ b/src/ejabberd_auth_external.erl @@ -42,6 +42,7 @@ plain_password_required/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). start(Host) -> Cmd = ejabberd_config:get_local_option( diff --git a/src/ejabberd_auth_internal.erl b/src/ejabberd_auth_internal.erl index 16da2e472..a557d7087 100644 --- a/src/ejabberd_auth_internal.erl +++ b/src/ejabberd_auth_internal.erl @@ -42,6 +42,7 @@ plain_password_required/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). -record(passwd, {us = {<<"">>, <<"">>} :: {binary(), binary()} | '$1', password = <<"">> :: binary() | scram() | '_'}). diff --git a/src/ejabberd_auth_ldap.erl b/src/ejabberd_auth_ldap.erl index c7046d45f..1913c49b9 100644 --- a/src/ejabberd_auth_ldap.erl +++ b/src/ejabberd_auth_ldap.erl @@ -47,8 +47,9 @@ plain_password_required/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). --include("eldap/eldap.hrl"). +-include("eldap.hrl"). -record(state, {host = <<"">> :: binary(), diff --git a/src/ejabberd_auth_odbc.erl b/src/ejabberd_auth_odbc.erl index 709be3bc7..2419f4d28 100644 --- a/src/ejabberd_auth_odbc.erl +++ b/src/ejabberd_auth_odbc.erl @@ -42,6 +42,7 @@ plain_password_required/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). start(_Host) -> ok. diff --git a/src/ejabberd_auth_pam.erl b/src/ejabberd_auth_pam.erl index 092728136..b6747a52c 100644 --- a/src/ejabberd_auth_pam.erl +++ b/src/ejabberd_auth_pam.erl @@ -40,11 +40,7 @@ plain_password_required/0]). start(_Host) -> - case epam:start() of - {ok, _} -> ok; - {error, {already_started, _}} -> ok; - Err -> Err - end. + ejabberd:start_app(p1_pam). set_password(_User, _Server, _Password) -> {error, not_allowed}. diff --git a/src/ejabberd_auth_riak.erl b/src/ejabberd_auth_riak.erl index c4f23488b..9d23d18de 100644 --- a/src/ejabberd_auth_riak.erl +++ b/src/ejabberd_auth_riak.erl @@ -42,6 +42,7 @@ plain_password_required/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). -record(passwd, {us = {<<"">>, <<"">>} :: {binary(), binary()} | '$1', password = <<"">> :: binary() | scram() | '_'}). diff --git a/src/web/ejabberd_bosh.erl b/src/ejabberd_bosh.erl similarity index 99% rename from src/web/ejabberd_bosh.erl rename to src/ejabberd_bosh.erl index f53e60b9d..566d13b1d 100644 --- a/src/web/ejabberd_bosh.erl +++ b/src/ejabberd_bosh.erl @@ -45,6 +45,7 @@ code_change/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 9bec834f0..71194538b 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -57,6 +57,7 @@ migrate_shutdown/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl index 3279335ff..8d04cdd60 100644 --- a/src/ejabberd_captcha.erl +++ b/src/ejabberd_captcha.erl @@ -43,8 +43,9 @@ -include("jlib.hrl"). -include("ejabberd.hrl"). +-include("logger.hrl"). --include("web/ejabberd_http.hrl"). +-include("ejabberd_http.hrl"). -define(VFIELD(Type, Var, Value), #xmlel{name = <<"field">>, diff --git a/src/ejabberd_check.erl b/src/ejabberd_check.erl index 352251806..5dde19186 100644 --- a/src/ejabberd_check.erl +++ b/src/ejabberd_check.erl @@ -29,6 +29,7 @@ -export([libs/0, config/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("ejabberd_config.hrl"). %% TODO: diff --git a/src/ejabberd_cluster.erl b/src/ejabberd_cluster.erl index 178842ae2..9279b8059 100644 --- a/src/ejabberd_cluster.erl +++ b/src/ejabberd_cluster.erl @@ -20,6 +20,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -define(HASHTBL, nodes_hash). diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index c176139ee..5e70b3b5c 100644 --- a/src/ejabberd_commands.erl +++ b/src/ejabberd_commands.erl @@ -222,6 +222,7 @@ -include("ejabberd_commands.hrl"). -include("ejabberd.hrl"). +-include("logger.hrl"). init() -> diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index bd9291cd3..c4206426e 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -38,6 +38,7 @@ -export([convert_table_to_binary/5]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("ejabberd_config.hrl"). -include_lib("kernel/include/file.hrl"). @@ -452,7 +453,7 @@ process_term(Term, State) -> {ejabberdctl_access_commands, ACs} -> add_option(ejabberdctl_access_commands, ACs, State); {loglevel, Loglevel} -> - ejabberd_loglevel:set(Loglevel), + ejabberd_logger:set(Loglevel), State; {max_fsm_queue, N} -> add_option(max_fsm_queue, N, State); diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl index 49727d15e..a9a6f6725 100644 --- a/src/ejabberd_ctl.erl +++ b/src/ejabberd_ctl.erl @@ -57,6 +57,7 @@ -include("ejabberd_ctl.hrl"). -include("ejabberd_commands.hrl"). -include("ejabberd.hrl"). +-include("logger.hrl"). %%----------------------------- diff --git a/src/ejabberd_frontend_socket.erl b/src/ejabberd_frontend_socket.erl index 0f5cb35d2..fb4d74bd5 100644 --- a/src/ejabberd_frontend_socket.erl +++ b/src/ejabberd_frontend_socket.erl @@ -157,7 +157,7 @@ handle_call({compress, Data}, _From, State) -> Reply = ok, {reply, Reply, State#socket_state{socket = ZlibSocket, - sockmod = ejabberd_zlib}, + sockmod = ezlib}, ?HIBERNATE_TIMEOUT}; handle_call(reset_stream, _From, State) -> ejabberd_receiver:reset_stream(State#socket_state.receiver), diff --git a/src/ejabberd_hooks.erl b/src/ejabberd_hooks.erl index e4f9f597b..3891fd9ff 100644 --- a/src/ejabberd_hooks.erl +++ b/src/ejabberd_hooks.erl @@ -55,6 +55,7 @@ terminate/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). %% Timeout of 5 seconds in calls to distributed hooks -define(TIMEOUT_DISTRIBUTED_HOOK, 5000). diff --git a/src/web/ejabberd_http.erl b/src/ejabberd_http.erl similarity index 99% rename from src/web/ejabberd_http.erl rename to src/ejabberd_http.erl index 7da79b3e8..eab2332bb 100644 --- a/src/web/ejabberd_http.erl +++ b/src/ejabberd_http.erl @@ -36,6 +36,7 @@ -export([init/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/ejabberd_http_bind.erl b/src/ejabberd_http_bind.erl similarity index 99% rename from src/web/ejabberd_http_bind.erl rename to src/ejabberd_http_bind.erl index 95fb14f8b..01de942b0 100644 --- a/src/web/ejabberd_http_bind.erl +++ b/src/ejabberd_http_bind.erl @@ -23,6 +23,7 @@ http_get/2, prepare_response/4, process_request/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/ejabberd_http_bindjson.erl b/src/ejabberd_http_bindjson.erl similarity index 99% rename from src/web/ejabberd_http_bindjson.erl rename to src/ejabberd_http_bindjson.erl index 245416142..75af8fdb4 100644 --- a/src/web/ejabberd_http_bindjson.erl +++ b/src/ejabberd_http_bindjson.erl @@ -22,6 +22,7 @@ http_get/2, prepare_response/4, process_request/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/ejabberd_http_poll.erl b/src/ejabberd_http_poll.erl similarity index 99% rename from src/web/ejabberd_http_poll.erl rename to src/ejabberd_http_poll.erl index ee3e42ac7..02bb7734a 100644 --- a/src/web/ejabberd_http_poll.erl +++ b/src/ejabberd_http_poll.erl @@ -37,6 +37,7 @@ controlling_process/2, close/1, process/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/ejabberd_http_ws.erl b/src/ejabberd_http_ws.erl similarity index 99% rename from src/web/ejabberd_http_ws.erl rename to src/ejabberd_http_ws.erl index 750c8a8be..ba830016a 100644 --- a/src/web/ejabberd_http_ws.erl +++ b/src/ejabberd_http_ws.erl @@ -37,6 +37,7 @@ socket_handoff/6]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/ejabberd_http_wsjson.erl b/src/ejabberd_http_wsjson.erl similarity index 99% rename from src/web/ejabberd_http_wsjson.erl rename to src/ejabberd_http_wsjson.erl index b7cae693e..53fca1871 100644 --- a/src/web/ejabberd_http_wsjson.erl +++ b/src/ejabberd_http_wsjson.erl @@ -38,6 +38,7 @@ close/1, socket_handoff/6]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl index a953dc9f8..23f2935c6 100644 --- a/src/ejabberd_listener.erl +++ b/src/ejabberd_listener.erl @@ -41,6 +41,7 @@ ]). -include("ejabberd.hrl"). +-include("logger.hrl"). %% We do not block on send anymore. -define(TCP_SEND_TIMEOUT, 15000). @@ -597,7 +598,8 @@ check_rate_limit(Interval) -> validate_cfg(L) -> lists:map( - fun({PortIPTransport, Mod, Opts}) when is_atom(Mod), is_list(Opts) -> + fun({PortIPTransport, Mod1, Opts}) when is_atom(Mod1), is_list(Opts) -> + Mod = prepare_mod(Mod1), case PortIPTransport of Port when ?IS_PORT(Port) -> {Port, Mod, Opts}; @@ -622,3 +624,11 @@ prepare_ip(IP) when is_list(IP) -> Addr; prepare_ip(IP) when is_binary(IP) -> prepare_ip(binary_to_list(IP)). + +prepare_mod(ejabberd_stun) -> + prepare_mod(stun); +prepare_mod(stun) -> + ejabberd:start_app(p1_stun), + stun; +prepare_mod(Mod) -> + Mod. diff --git a/src/ejabberd_local.erl b/src/ejabberd_local.erl index 3607356f0..b3fdeabc0 100644 --- a/src/ejabberd_local.erl +++ b/src/ejabberd_local.erl @@ -45,6 +45,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_logger.erl b/src/ejabberd_logger.erl index f036c1e72..afb1f3f3d 100644 --- a/src/ejabberd_logger.erl +++ b/src/ejabberd_logger.erl @@ -1,35 +1,70 @@ %%%------------------------------------------------------------------- %%% @author Evgeniy Khramtsov -%%% @copyright (C) 2012, Evgeniy Khramtsov -%%% @doc This module is needed to shut up Dialyzer +%%% @copyright (C) 2013, Evgeniy Khramtsov +%%% @doc +%%% %%% @end -%%% Created : 10 Jul 2012 by Evgeniy Khramtsov +%%% Created : 12 May 2013 by Evgeniy Khramtsov %%%------------------------------------------------------------------- -module(ejabberd_logger). --compile({no_auto_import, [{get, 0}]}). - %% API --export([debug_msg/4, info_msg/4, warning_msg/4, - error_msg/4, critical_msg/4, get/0]). +-export([start/0, set_logfile/1, reopen_log/0, get/0, set/1, + debug_msg/4, info_msg/4, warning_msg/4, error_msg/4, + critical_msg/4]). %%%=================================================================== %%% API %%%=================================================================== --spec debug_msg(atom(), pos_integer(), string(), list()) -> ok. --spec info_msg(atom(), pos_integer(), string(), list()) -> ok. --spec warning_msg(atom(), pos_integer(), string(), list()) -> ok. --spec error_msg(atom(), pos_integer(), string(), list()) -> ok. --spec critical_msg(atom(), pos_integer(), string(), list()) -> ok. --spec get() -> {non_neg_integer(), [{atom(), non_neg_integer()}]}. +start() -> + ok. -debug_msg(_Mod, _Line, _Format, _Args) -> ok. -info_msg(_Mod, _Line, _Format, _Args) -> ok. -warning_msg(_Mod, _Line, _Format, _Args) -> ok. -error_msg(_Mod, _Line, _Format, _Args) -> ok. -critical_msg(_Mod, _Line, _Format, _Args) -> ok. -get() -> {0, [{foo, 0}]}. +set_logfile(FileName) -> + error_logger:add_report_handler(p1_logger_h, FileName). + +reopen_log() -> + %% TODO: Use the Reopen log API for logger_h ? + p1_logger_h:reopen_log(), + case application:get_env(sasl,sasl_error_logger) of + {ok, {file, SASLfile}} -> + error_logger:delete_report_handler(sasl_report_file_h), + p1_logger_h:rotate_log(SASLfile), + error_logger:add_report_handler(sasl_report_file_h, + {SASLfile, get_sasl_error_logger_type()}); + _ -> false + end, + ok. + +get() -> + p1_loglevel:get(). + +set(LogLevel) -> + p1_loglevel:set(LogLevel). + +debug_msg(Mod, Line, Format, Args) -> + p1_logger:debug_msg(Mod, Line, Format, Args). + +info_msg(Mod, Line, Format, Args) -> + p1_logger:info_msg(Mod, Line, Format, Args). + +warning_msg(Mod, Line, Format, Args) -> + p1_logger:warning_msg(Mod, Line, Format, Args). + +error_msg(Mod, Line, Format, Args) -> + p1_logger:error_msg(Mod, Line, Format, Args). + +critical_msg(Mod, Line, Format, Args) -> + p1_logger:critical_msg(Mod, Line, Format, Args). %%%=================================================================== %%% Internal functions %%%=================================================================== +%% Function copied from Erlang/OTP lib/sasl/src/sasl.erl which doesn't export it +get_sasl_error_logger_type () -> + case application:get_env (sasl, errlog_type) of + {ok, error} -> error; + {ok, progress} -> progress; + {ok, all} -> all; + {ok, Bad} -> exit ({bad_config, {sasl, {errlog_type, Bad}}}); + _ -> all + end. diff --git a/src/ejabberd_logger_h.erl b/src/ejabberd_logger_h.erl deleted file mode 100644 index 6f3e0a6d8..000000000 --- a/src/ejabberd_logger_h.erl +++ /dev/null @@ -1,236 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : ejabberd_logger_h.erl -%%% Author : Alexey Shchepin -%%% Purpose : Manage Erlang logging. -%%% Created : 23 Oct 2003 by Alexey Shchepin -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(ejabberd_logger_h). --author('alexey@process-one.net'). - --behaviour(gen_event). - -%% gen_event callbacks --export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2, - code_change/3, reopen_log/0, rotate_log/1]). - --record(state, {fd, file}). - -%%%---------------------------------------------------------------------- -%%% Callback functions from gen_event -%%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Func: init/1 -%% Returns: {ok, State} | -%% Other -%%---------------------------------------------------------------------- -init(File) -> - case file:open(File, [append, raw]) of - {ok, Fd} -> - {ok, #state{fd = Fd, file = File}}; - Error -> - Error - end. - -%%---------------------------------------------------------------------- -%% Func: handle_event/2 -%% Returns: {ok, State} | -%% {swap_handler, Args1, State1, Mod2, Args2} | -%% remove_handler -%%---------------------------------------------------------------------- -handle_event(Event, State) -> - write_event(State#state.fd, {erlang:localtime(), Event}), - {ok, State}. - -%%---------------------------------------------------------------------- -%% Func: handle_call/2 -%% Returns: {ok, Reply, State} | -%% {swap_handler, Reply, Args1, State1, Mod2, Args2} | -%% {remove_handler, Reply} -%%---------------------------------------------------------------------- -handle_call(_Request, State) -> - Reply = ok, - {ok, Reply, State}. - -%%---------------------------------------------------------------------- -%% Func: handle_info/2 -%% Returns: {ok, State} | -%% {swap_handler, Args1, State1, Mod2, Args2} | -%% remove_handler -%%---------------------------------------------------------------------- -handle_info({'EXIT', _Fd, _Reason}, _State) -> - remove_handler; -handle_info({emulator, _GL, reopen}, State) -> - file:close(State#state.fd), - rotate_log(State#state.file), - case file:open(State#state.file, [append, raw]) of - {ok, Fd} -> - {ok, State#state{fd = Fd}}; - Error -> - Error - end; -handle_info({emulator, GL, Chars}, State) -> - write_event(State#state.fd, {erlang:localtime(), {emulator, GL, Chars}}), - {ok, State}; -handle_info(_Info, State) -> - {ok, State}. - -%%---------------------------------------------------------------------- -%% Func: terminate/2 -%% Purpose: Shutdown the server -%% Returns: any -%%---------------------------------------------------------------------- -terminate(_Reason, _State) -> - ok. - -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -reopen_log() -> - error_logger ! {emulator, noproc, reopen}. - -%%%---------------------------------------------------------------------- -%%% Internal functions -%%%---------------------------------------------------------------------- - -% Copied from erlang_logger_file_h.erl -write_event(Fd, {Time, {error, _GL, {Pid, Format, Args}}}) -> - T = write_time(Time), - case catch io_lib:format(add_node(Format,Pid), Args) of - S when is_list(S) -> - file:write(Fd, io_lib:format(T ++ S, [])); - _ -> - F = add_node("ERROR: ~p - ~p~n", Pid), - file:write(Fd, io_lib:format(T ++ F, [Format,Args])) - end; -write_event(Fd, {Time, {emulator, _GL, Chars}}) -> - T = write_time(Time), - case catch io_lib:format(Chars, []) of - S when is_list(S) -> - file:write(Fd, io_lib:format(T ++ S, [])); - _ -> - file:write(Fd, io_lib:format(T ++ "ERROR: ~p ~n", [Chars])) - end; -write_event(Fd, {Time, {info, _GL, {Pid, Info, _}}}) -> - T = write_time(Time), - file:write(Fd, io_lib:format(T ++ add_node("~p~n",Pid), [Info])); -write_event(Fd, {Time, {error_report, _GL, {Pid, std_error, Rep}}}) -> - T = write_time(Time), - S = format_report(Rep), - file:write(Fd, io_lib:format(T ++ S ++ add_node("", Pid), [])); -write_event(Fd, {Time, {info_report, _GL, {Pid, std_info, Rep}}}) -> - T = write_time(Time, "INFO REPORT"), - S = format_report(Rep), - file:write(Fd, io_lib:format(T ++ S ++ add_node("", Pid), [])); -write_event(Fd, {Time, {info_msg, _GL, {Pid, Format, Args}}}) -> - T = write_time(Time, "INFO REPORT"), - case catch io_lib:format(add_node(Format,Pid), Args) of - S when is_list(S) -> - file:write(Fd, io_lib:format(T ++ S, [])); - _ -> - F = add_node("ERROR: ~p - ~p~n", Pid), - file:write(Fd, io_lib:format(T ++ F, [Format,Args])) - end; -write_event(Fd, {Time, {warning_report, _GL, {Pid, std_warning, Rep}}}) -> - T = write_time(Time, "WARNING REPORT"), - S = format_report(Rep), - file:write(Fd, io_lib:format(T ++ S ++ add_node("", Pid), [])); -write_event(Fd, {Time, {warning_msg, _GL, {Pid, Format, Args}}}) -> - T = write_time(Time, "WARNING REPORT"), - case catch io_lib:format(add_node(Format,Pid), Args) of - S when is_list(S) -> - file:write(Fd, io_lib:format(T ++ S, [])); - _ -> - F = add_node("ERROR: ~p - ~p~n", Pid), - file:write(Fd, io_lib:format(T ++ F, [Format,Args])) - end; -write_event(_, _) -> - ok. - -format_report(Rep) when is_list(Rep) -> - case string_p(Rep) of - true -> - io_lib:format("~s~n",[Rep]); - _ -> - format_rep(Rep) - end; -format_report(Rep) -> - io_lib:format("~p~n",[Rep]). - -format_rep([{Tag,Data}|Rep]) -> - io_lib:format(" ~p: ~p~n",[Tag,Data]) ++ format_rep(Rep); -format_rep([Other|Rep]) -> - io_lib:format(" ~p~n",[Other]) ++ format_rep(Rep); -format_rep(_) -> - []. - -add_node(X, Pid) when is_atom(X) -> - add_node(atom_to_list(X), Pid); -add_node(X, Pid) when node(Pid) /= node() -> - lists:concat([X,"** at node ",node(Pid)," **~n"]); -add_node(X, _) -> - X. - -string_p([]) -> - false; -string_p(Term) -> - string_p1(Term). - -string_p1([H|T]) when is_integer(H), H >= $\s, H < 255 -> - string_p1(T); -string_p1([$\n|T]) -> string_p1(T); -string_p1([$\r|T]) -> string_p1(T); -string_p1([$\t|T]) -> string_p1(T); -string_p1([$\v|T]) -> string_p1(T); -string_p1([$\b|T]) -> string_p1(T); -string_p1([$\f|T]) -> string_p1(T); -string_p1([$\e|T]) -> string_p1(T); -string_p1([H|T]) when is_list(H) -> - case string_p1(H) of - true -> string_p1(T); - _ -> false - end; -string_p1([]) -> true; -string_p1(_) -> false. - -write_time(Time) -> write_time(Time, "ERROR REPORT"). - -write_time({{Y,Mo,D},{H,Mi,S}}, Type) -> - io_lib:format("~n=~s==== ~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w ===~n", - [Type, Y, Mo, D, H, Mi, S]). - -%% @doc Rename the log file if exists, to "*-old.log". -%% This is needed in systems when the file must be closed before rotation (Windows). -%% On most Unix-like system, the file can be renamed from the command line and -%% the log can directly be reopened. -%% @spec (Filename::string()) -> ok -rotate_log(Filename) -> - case file:read_file_info(Filename) of - {ok, _FileInfo} -> - RotationName = filename:rootname(Filename), - file:rename(Filename, [RotationName, "-old.log"]), - ok; - {error, _Reason} -> - ok - end. - diff --git a/src/ejabberd_loglevel.erl b/src/ejabberd_loglevel.erl deleted file mode 100644 index 0306b0b88..000000000 --- a/src/ejabberd_loglevel.erl +++ /dev/null @@ -1,194 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : ejabberd_loglevel.erl -%%% Author : Mickael Remond -%%% Purpose : Loglevel switcher. -%%% Be careful: you should not have any ejabberd_logger module -%%% as ejabberd_loglevel switcher is compiling and loading -%%% dynamically a "virtual" ejabberd_logger module (Described -%%% in a string at the end of this module). -%%% Created : 29 Nov 2006 by Mickael Remond -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(ejabberd_loglevel). --author('mickael.remond@process-one.net'). - --export([set/1, - get/0, - set_custom/2, - clear_custom/0, - clear_custom/1]). - --include("ejabberd.hrl"). - --define(LOGMODULE, "error_logger"). - -%% Error levels: --record(loglevel, {ordinal, - name, - description, - function = no_log, - event_type = no_log, - msg_prefix = no_log}). - --define(LOG_LEVELS, - [#loglevel{ordinal = 0, name = no_log, description = "No log"}, - #loglevel{ordinal = 1, name = critical, description = "Critical", - function = critical_msg, event_type = error, msg_prefix = "C"}, - #loglevel{ordinal = 2, name = error, description = "Error", - function = error_msg, event_type = error, msg_prefix = "E"}, - #loglevel{ordinal = 3, name = warning, description = "Warning", - function = warning_msg, event_type = warning_msg, msg_prefix = "W"}, - #loglevel{ordinal = 4, name = info, description = "Info", - function = info_msg, event_type = info_msg, msg_prefix = "I"}, - #loglevel{ordinal = 5, name = debug, description = "Debug", - function = debug_msg, event_type = info_msg, msg_prefix = "D"}]). - -%% @type level() = integer() | atom(). - -%% @spec () -> {DefaultLevelOrdinal::integer(), [{Module::atom(), LevelOrdinal::integer()}]} -%% @doc Get the default and all custom levels -get() -> - {DefaultLevel, _CustomLevels} = ejabberd_logger:get(), - case lists:keysearch(DefaultLevel, #loglevel.ordinal, ?LOG_LEVELS) of - {value, Result = #loglevel{}} -> - {Result#loglevel.ordinal, Result#loglevel.name, Result#loglevel.description}; - _ -> - erlang:error({no_such_loglevel, DefaultLevel}) - end. - -%% @spec (DefaultLevel::level() | {DefaultLevel::level(), [{Module::atom(), Level::level()}]}) -> -%% {module, ejabberd_logger} -%% @doc Set the default and all custom levels -set(DefaultLevel) when is_atom(DefaultLevel) orelse is_integer(DefaultLevel) -> - set({DefaultLevel, []}); -set({DefaultLevel, CustomLevels}) when is_list(CustomLevels) -> - DefaultInt = level_to_integer(DefaultLevel), - CustomInts = [level_to_integer(C) || C <- CustomLevels], - Loglevel = {DefaultInt, CustomInts}, - try - {Mod,Code} = dynamic_compile:from_string(ejabberd_logger_src(Loglevel)), - code:load_binary(Mod, ?LOGMODULE ++ ".erl", Code) - catch - Type:Error -> ?CRITICAL_MSG("Error compiling logger (~p): ~p~n", [Type, Error]) - end; -set(_) -> - exit("Invalid loglevel format"). - -%% @spec (Module::atom(), CustomLevel::level()) -> ok -%% @doc Set a custom level -set_custom(Module, Level) -> - {DefaultLevel, CustomLevels} = ejabberd_logger:get(), - case lists:keysearch(Module, 1, CustomLevels) of - {value, {Module, Level}} -> - ok; - {value, _} -> - set({DefaultLevel, lists:keyreplace(Module, 1, CustomLevels, {Module, Level})}); - _ -> - set({DefaultLevel, [{Module, Level} | CustomLevels]}) - end. - -%% @spec () -> ok -%% @doc Clear all custom levels -clear_custom() -> - {DefaultLevel, _CustomLevels} = ejabberd_logger:get(), - set({DefaultLevel, []}). - -%% @spec (Module::atom()) -> ok -%% @doc Clear a custom level -clear_custom(Module) -> - {DefaultLevel, CustomLevels} = ejabberd_logger:get(), - case lists:keysearch(Module, 1, CustomLevels) of - {value, _} -> - set({DefaultLevel, lists:keydelete(Module, 1, CustomLevels)}); - _ -> - ok - end. - -level_to_integer(Level) when is_integer(Level) -> - Level; -level_to_integer({Module, Level}) -> - {Module, level_to_integer(Level)}; -level_to_integer(Level) -> - case lists:keysearch(Level, #loglevel.name, ?LOG_LEVELS) of - {value, #loglevel{ordinal = Int}} -> Int; - _ -> erlang:error({no_such_loglevel, Level}) - end. - -%% -------------------------------------------------------------- -%% Code of the ejabberd logger, dynamically compiled and loaded -%% This allows to dynamically change log level while keeping a -%% very efficient code. -ejabberd_logger_src(Loglevel) -> - lists:flatten([header_src(), - get_src(Loglevel), - [log_src(Loglevel, LevelSpec) || LevelSpec <- ?LOG_LEVELS], - notify_src()]). - -header_src() -> - "-module(ejabberd_logger). - -author('mickael.remond@process-one.net'). - - -export([debug_msg/4, - info_msg/4, - warning_msg/4, - error_msg/4, - critical_msg/4, - get/0]). - ". - -get_src(Loglevel) -> - io_lib:format("get() -> ~w. - ", [Loglevel]). - -log_src(_Loglevel, #loglevel{function = no_log}) -> - []; -log_src({DefaultLevel, [{Module, Level} | Tail]}, Spec = #loglevel{ordinal = MinLevel}) - when Level < MinLevel andalso MinLevel =< DefaultLevel -> - [atom_to_list(Spec#loglevel.function), "(", atom_to_list(Module), ", _, _, _) -> ok; - ", log_src({DefaultLevel, Tail}, Spec)]; -log_src({DefaultLevel, [{Module, Level} | Tail]}, Spec = #loglevel{ordinal = MinLevel}) - when DefaultLevel < MinLevel andalso MinLevel =< Level -> - [atom_to_list(Spec#loglevel.function), "(", atom_to_list(Module), " = Module, Line, Format, Args) ->", - log_notify_src(Spec), "; - ", log_src({DefaultLevel, Tail}, Spec)]; -log_src({DefaultLevel, [_Head | Tail]}, Spec = #loglevel{}) -> - log_src({DefaultLevel, Tail}, Spec); -log_src({DefaultLevel, []}, Spec = #loglevel{ordinal = MinLevel}) - when DefaultLevel < MinLevel -> - [atom_to_list(Spec#loglevel.function), "(_, _, _, _) -> ok. - "]; -log_src({_DefaultLevel, []}, Spec = #loglevel{}) -> - [atom_to_list(Spec#loglevel.function), "(Module, Line, Format, Args) ->", - log_notify_src(Spec), ". - "]. - -log_notify_src(Spec = #loglevel{}) -> - ["notify(", atom_to_list(Spec#loglevel.event_type), ", - \"", Spec#loglevel.msg_prefix, "(~p:~p:~p) : \"++Format++\"~n\", - [self(), Module, Line | Args])"]. - -notify_src() -> - %% Distribute the message to the Erlang error logger - "notify(Type, Format, Args) -> - LoggerMsg = {Type, group_leader(), {self(), Format, Args}}, - gen_event:notify(error_logger, LoggerMsg). - ". diff --git a/src/odbc/ejabberd_odbc.erl b/src/ejabberd_odbc.erl similarity index 99% rename from src/odbc/ejabberd_odbc.erl rename to src/ejabberd_odbc.erl index 68b18b7a2..261d46fda 100644 --- a/src/odbc/ejabberd_odbc.erl +++ b/src/ejabberd_odbc.erl @@ -49,6 +49,7 @@ session_established/2, session_established/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -record(state, {db_ref = self() :: pid(), @@ -462,7 +463,7 @@ abort_on_driver_error(Reply, From) -> %% == pure ODBC code odbc_connect(SQLServer) -> - application:start(odbc), + ejabberd:start_app(odbc), odbc:connect(SQLServer, [{scrollable_cursors, off}]). %% == Native PostgreSQL code diff --git a/src/odbc/ejabberd_odbc_sup.erl b/src/ejabberd_odbc_sup.erl similarity index 99% rename from src/odbc/ejabberd_odbc_sup.erl rename to src/ejabberd_odbc_sup.erl index 0c748d147..2ddc751f8 100644 --- a/src/odbc/ejabberd_odbc_sup.erl +++ b/src/ejabberd_odbc_sup.erl @@ -33,6 +33,7 @@ get_pids/1, get_random_pid/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -define(DEFAULT_POOL_SIZE, 10). diff --git a/src/ejabberd_piefxis.erl b/src/ejabberd_piefxis.erl index b789c4c8a..205d60d54 100644 --- a/src/ejabberd_piefxis.erl +++ b/src/ejabberd_piefxis.erl @@ -14,6 +14,7 @@ -define(CHUNK_SIZE, 1024*20). %20k -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include("mod_privacy.hrl"). -include("mod_roster.hrl"). diff --git a/src/ejabberd_rdbms.erl b/src/ejabberd_rdbms.erl index d97d2b35e..6e1ce7333 100644 --- a/src/ejabberd_rdbms.erl +++ b/src/ejabberd_rdbms.erl @@ -31,15 +31,14 @@ -export([start/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). start() -> - case catch ejabberd_odbc_sup:module_info() of - {'EXIT', {undef, _}} -> - ?INFO_MSG("ejabberd has not been compiled with " - "relational database support. Skipping " - "database startup.", - []); - _ -> start_hosts() + case lists:any(fun needs_odbc/1, ?MYHOSTS) of + true -> + start_hosts(); + false -> + ok end. start_hosts() -> diff --git a/src/ejabberd_receiver.erl b/src/ejabberd_receiver.erl index fb51ff8ce..99fcecf68 100644 --- a/src/ejabberd_receiver.erl +++ b/src/ejabberd_receiver.erl @@ -41,10 +41,11 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -record(state, - {socket :: inet:socket() | tls:tls_socket() | ejabberd_zlib:zlib_socket(), - sock_mod = gen_tcp :: gen_tcp | tls | ejabberd_zlib, + {socket :: inet:socket() | tls:tls_socket() | ezlib:zlib_socket(), + sock_mod = gen_tcp :: gen_tcp | tls | ezlib, shaper_state = none :: shaper:shaper(), c2s_pid :: pid(), max_stanza_size = infinity :: non_neg_integer() | infinity, @@ -98,7 +99,7 @@ starttls(Pid, TLSOpts, Data) -> do_call(Pid, {starttls, TLSOpts, Data}). -spec compress(pid(), iodata() | undefined) -> {error, any()} | - {ok, ejabberd_zlib:zlib_socket()}. + {ok, ezlib:zlib_socket()}. compress(Pid, Data) -> do_call(Pid, {compress, Data}). @@ -170,7 +171,7 @@ handle_call({compress, Data}, _From, c2s_pid = C2SPid, socket = Socket, sock_mod = SockMod, max_stanza_size = MaxStanzaSize} = State) -> - {ok, ZlibSocket} = ejabberd_zlib:enable_zlib(SockMod, + {ok, ZlibSocket} = ezlib:enable_zlib(SockMod, Socket), if Data /= undefined -> do_send(State, Data); true -> ok @@ -179,9 +180,9 @@ handle_call({compress, Data}, _From, NewXMLStreamState = xml_stream:new(C2SPid, MaxStanzaSize), NewState = State#state{socket = ZlibSocket, - sock_mod = ejabberd_zlib, + sock_mod = ezlib, xml_stream_state = NewXMLStreamState}, - case ejabberd_zlib:recv_data(ZlibSocket, <<"">>) of + case ezlib:recv_data(ZlibSocket, <<"">>) of {ok, ZlibData} -> {reply, {ok, ZlibSocket}, process_data(ZlibData, NewState), ?HIBERNATE_TIMEOUT}; @@ -249,8 +250,8 @@ handle_info({Tag, _TCPSocket, Data}, ?HIBERNATE_TIMEOUT}; {error, _Reason} -> {stop, normal, State} end; - ejabberd_zlib -> - case ejabberd_zlib:recv_data(Socket, Data) of + ezlib -> + case ezlib:recv_data(Socket, Data) of {ok, ZlibData} -> {noreply, process_data(ZlibData, State), ?HIBERNATE_TIMEOUT}; diff --git a/src/ejabberd_riak.erl b/src/ejabberd_riak.erl index 204bfd95b..5d2267a05 100644 --- a/src/ejabberd_riak.erl +++ b/src/ejabberd_riak.erl @@ -42,6 +42,7 @@ terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -record(state, {pid = self() :: pid()}). diff --git a/src/ejabberd_riak_sup.erl b/src/ejabberd_riak_sup.erl index d19b9fbe9..5f27e0a7f 100644 --- a/src/ejabberd_riak_sup.erl +++ b/src/ejabberd_riak_sup.erl @@ -38,6 +38,7 @@ ]). -include("ejabberd.hrl"). +-include("logger.hrl"). -define(DEFAULT_POOL_SIZE, 10). -define(DEFAULT_RIAK_START_INTERVAL, 30). % 30 seconds @@ -54,6 +55,7 @@ start() -> riak_server, fun(_) -> true end, false), if StartRiak -> + ejabberd:start_app(riakc), do_start(); true -> ok diff --git a/src/ejabberd_router.erl b/src/ejabberd_router.erl index bd5a72e1a..b00a4f315 100644 --- a/src/ejabberd_router.erl +++ b/src/ejabberd_router.erl @@ -43,6 +43,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_router_multicast.erl b/src/ejabberd_router_multicast.erl index b497c47bf..bf7820fa1 100644 --- a/src/ejabberd_router_multicast.erl +++ b/src/ejabberd_router_multicast.erl @@ -26,6 +26,7 @@ terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -record(route_multicast, {domain, pid}). diff --git a/src/ejabberd_s2s.erl b/src/ejabberd_s2s.erl index 341c5d474..f2176b8dd 100644 --- a/src/ejabberd_s2s.erl +++ b/src/ejabberd_s2s.erl @@ -50,6 +50,7 @@ -export([get_info_s2s_connections/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_s2s_in.erl b/src/ejabberd_s2s_in.erl index 492d6fe4b..f34c61057 100644 --- a/src/ejabberd_s2s_in.erl +++ b/src/ejabberd_s2s_in.erl @@ -41,6 +41,7 @@ handle_info/3, print_state/1, terminate/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_s2s_out.erl b/src/ejabberd_s2s_out.erl index 50a9bcf53..3c1a4c80a 100644 --- a/src/ejabberd_s2s_out.erl +++ b/src/ejabberd_s2s_out.erl @@ -46,6 +46,7 @@ get_addr_port/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_service.erl b/src/ejabberd_service.erl index 239b18f4a..97905519e 100644 --- a/src/ejabberd_service.erl +++ b/src/ejabberd_service.erl @@ -43,6 +43,7 @@ handle_info/3, terminate/3, print_state/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl index ecd6ab5a2..c562a0e29 100644 --- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -53,6 +53,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_sm_handler.erl b/src/ejabberd_sm_handler.erl index 6f0fcdac4..3902e51fd 100644 --- a/src/ejabberd_sm_handler.erl +++ b/src/ejabberd_sm_handler.erl @@ -40,6 +40,7 @@ terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -record(state, {}). diff --git a/src/ejabberd_socket.erl b/src/ejabberd_socket.erl index 4e0d4c93a..096bc46a9 100644 --- a/src/ejabberd_socket.erl +++ b/src/ejabberd_socket.erl @@ -37,16 +37,17 @@ change_socket/2, sockname/1, peername/1, is_remote_receiver/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -type sockmod() :: ejabberd_http_poll | ejabberd_bosh | ejabberd_http_bind | ejabberd_http_bindjson | ejabberd_http_ws | ejabberd_http_wsjson | - gen_tcp | tls | ejabberd_zlib. + gen_tcp | tls | ezlib. -type receiver() :: pid () | atom(). -type socket() :: pid() | inet:socket() | tls:tls_socket() | - ejabberd_zlib:zlib_socket() | + ezlib:zlib_socket() | ejabberd_bosh:bosh_socket() | ejabberd_http_ws:ws_socket() | ejabberd_http_poll:poll_socket(). @@ -151,7 +152,7 @@ compress(SocketData, Data) -> ejabberd_receiver:compress(SocketData#socket_state.receiver, Data), SocketData#socket_state{socket = ZlibSocket, - sockmod = ejabberd_zlib}. + sockmod = ezlib}. reset_stream(SocketData) when is_pid(SocketData#socket_state.receiver) -> @@ -254,8 +255,8 @@ get_conn_type(#socket_state{sockmod = SockMod, socket = Socket}) -> case SockMod of gen_tcp -> c2s; tls -> c2s_tls; - ejabberd_zlib -> - case ejabberd_zlib:get_sockmod(Socket) of + ezlib -> + case ezlib:get_sockmod(Socket) of gen_tcp -> c2s_compressed; tls -> c2s_compressed_tls end; diff --git a/src/ejabberd_sup.erl b/src/ejabberd_sup.erl index 26ea97403..5b85f1f33 100644 --- a/src/ejabberd_sup.erl +++ b/src/ejabberd_sup.erl @@ -175,21 +175,6 @@ init([]) -> infinity, supervisor, [ejabberd_sm_sup]}, - STUNSupervisor = - {ejabberd_stun_sup, - {ejabberd_tmp_sup, start_link, - [ejabberd_stun_sup, ejabberd_stun]}, - permanent, - infinity, - supervisor, - [ejabberd_tmp_sup]}, - CacheTabSupervisor = - {cache_tab_sup, - {cache_tab_sup, start_link, []}, - permanent, - infinity, - supervisor, - [cache_tab_sup]}, {ok, {{one_for_one, 10, 1}, [Hooks, SystemMonitor, @@ -208,9 +193,7 @@ init([]) -> HTTPSupervisor, HTTPPollSupervisor, IQSupervisor, - STUNSupervisor, FrontendSocketSupervisor, - CacheTabSupervisor, Listener]}}. diff --git a/src/ejabberd_system_monitor.erl b/src/ejabberd_system_monitor.erl index aaf5d068f..3d61d0c35 100644 --- a/src/ejabberd_system_monitor.erl +++ b/src/ejabberd_system_monitor.erl @@ -39,6 +39,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/ejabberd_update.erl b/src/ejabberd_update.erl index 4d2ea1d6f..574fad025 100644 --- a/src/ejabberd_update.erl +++ b/src/ejabberd_update.erl @@ -31,6 +31,7 @@ -export([update/0, update/1, update_info/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). %%==================================================================== %% API diff --git a/src/web/ejabberd_web.erl b/src/ejabberd_web.erl similarity index 99% rename from src/web/ejabberd_web.erl rename to src/ejabberd_web.erl index a036447ac..3bceddd29 100644 --- a/src/web/ejabberd_web.erl +++ b/src/ejabberd_web.erl @@ -32,6 +32,7 @@ -export([make_xhtml/1, make_xhtml/2, error/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/ejabberd_web_admin.erl b/src/ejabberd_web_admin.erl similarity index 99% rename from src/web/ejabberd_web_admin.erl rename to src/ejabberd_web_admin.erl index 5989818ba..fa34b6cd1 100644 --- a/src/web/ejabberd_web_admin.erl +++ b/src/ejabberd_web_admin.erl @@ -36,6 +36,7 @@ term_to_id/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/ejabberd_websocket.erl b/src/ejabberd_websocket.erl similarity index 99% rename from src/web/ejabberd_websocket.erl rename to src/ejabberd_websocket.erl index ca70cf23d..f4c62212c 100644 --- a/src/web/ejabberd_websocket.erl +++ b/src/ejabberd_websocket.erl @@ -43,6 +43,7 @@ -export([connect/2, check/2, socket_handoff/7]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/ejabberd_ws.erl b/src/ejabberd_ws.erl similarity index 100% rename from src/web/ejabberd_ws.erl rename to src/ejabberd_ws.erl diff --git a/src/ejabberd_xmlrpc.erl b/src/ejabberd_xmlrpc.erl index 93c1d9781..0fc401646 100644 --- a/src/ejabberd_xmlrpc.erl +++ b/src/ejabberd_xmlrpc.erl @@ -20,6 +20,7 @@ -export([start/2, handler/2, socket_type/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("mod_roster.hrl"). diff --git a/src/ejabberd_zlib/Makefile.in b/src/ejabberd_zlib/Makefile.in deleted file mode 100644 index b572c1169..000000000 --- a/src/ejabberd_zlib/Makefile.in +++ /dev/null @@ -1,63 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ZLIB_CFLAGS = @ZLIB_CFLAGS@ -ZLIB_LIBS = @ZLIB_LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -# Assume Linux-style dynamic library flags -DYNAMIC_LIB_CFLAGS = -fpic -shared -ifeq ($(shell uname),Darwin) - DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress -endif -ifeq ($(shell uname),SunOs) - DYNAMIC_LIB_CFLAGS = -KPIC -G -z text -endif - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -ERLSHLIBS = ../ejabberd_zlib_drv.so -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - -all: $(BEAMS) $(ERLSHLIBS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -#all: $(ERLSHLIBS) -# erl -s make all report "{outdir, \"..\"}" -noinput -s erlang halt - -$(ERLSHLIBS): ../%.so: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ - $(subst ../,,$(subst .so,.c,$@)) \ - $(LIBS) \ - $(ZLIB_LIBS) \ - $(ZLIB_CFLAGS) \ - $(ERLANG_LIBS) \ - $(ERLANG_CFLAGS) \ - -o $@ \ - $(DYNAMIC_LIB_CFLAGS) - -clean: - rm -f $(BEAMS) $(ERLSHLIBS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl diff --git a/src/ejabberd_zlib/Makefile.win32 b/src/ejabberd_zlib/Makefile.win32 deleted file mode 100644 index 0041df83c..000000000 --- a/src/ejabberd_zlib/Makefile.win32 +++ /dev/null @@ -1,36 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\ejabberd_zlib.beam - -SOURCE = ejabberd_zlib_drv.c -OBJECT = ejabberd_zlib_drv.o -DLL = $(OUTDIR)\ejabberd_zlib_drv.dll - -ALL : $(DLL) $(BEAMS) - -CLEAN : - -@erase $(DLL) - -@erase $(OUTDIR)\ejabberd_zlib_drv.exp - -@erase $(OUTDIR)\ejabberd_zlib_drv.lib - -@erase $(OBJECT) - -@erase $(BEAMS) - -$(OUTDIR)\ejabberd_zlib.beam : ejabberd_zlib.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_zlib.erl - -CC=cl.exe -CC_FLAGS=-nologo -D__WIN32__ -DWIN32 -DWINDOWS -D_WIN32 -DNT -MD -Ox -I"$(ERLANG_DIR)\usr\include" -I"$(EI_DIR)\include" -I"$(ZLIB_DIR)\include" - -LD=link.exe -LD_FLAGS=-release -nologo -incremental:no -dll "$(EI_DIR)\lib\ei_md.lib" "$(EI_DIR)\lib\erl_interface_md.lib" "$(ZLIB_LIB)" MSVCRT.LIB kernel32.lib advapi32.lib gdi32.lib user32.lib comctl32.lib comdlg32.lib shell32.lib - -$(DLL) : $(OBJECT) - $(LD) $(LD_FLAGS) -out:$@ $< - -$(OBJECT) : $(SOURCE) - $(CC) $(CC_FLAGS) -c -Fo$@ $< - diff --git a/src/ejabberd_zlib/ejabberd_zlib.erl b/src/ejabberd_zlib/ejabberd_zlib.erl deleted file mode 100644 index 3dee8d687..000000000 --- a/src/ejabberd_zlib/ejabberd_zlib.erl +++ /dev/null @@ -1,208 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : ejabberd_zlib.erl -%%% Author : Alexey Shchepin -%%% Purpose : Interface to zlib -%%% Created : 19 Jan 2006 by Alexey Shchepin -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(ejabberd_zlib). - --author('alexey@process-one.net'). - --behaviour(gen_server). - --export([start/0, start_link/0, enable_zlib/2, - disable_zlib/1, send/2, recv/2, recv/3, recv_data/2, - setopts/2, sockname/1, peername/1, get_sockmod/1, - controlling_process/2, close/1]). - -%% Internal exports, call-back functions. --export([init/1, handle_call/3, handle_cast/2, - handle_info/2, code_change/3, terminate/2]). - --define(DEFLATE, 1). - --define(INFLATE, 2). - --record(zlibsock, {sockmod :: atom(), - socket :: inet:socket(), - zlibport :: port()}). - --type zlib_socket() :: #zlibsock{}. - --export_type([zlib_socket/0]). - -start() -> - gen_server:start({local, ?MODULE}, ?MODULE, [], []). - -start_link() -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [], - []). - -init([]) -> - case erl_ddll:load_driver(ejabberd:get_so_path(), - ejabberd_zlib_drv) - of - ok -> ok; - {error, already_loaded} -> ok - end, - Port = open_port({spawn, "ejabberd_zlib_drv"}, - [binary]), - {ok, Port}. - -%%% -------------------------------------------------------- -%%% The call-back functions. -%%% -------------------------------------------------------- - -handle_call(_, _, State) -> {noreply, State}. - -handle_cast(_, State) -> {noreply, State}. - -handle_info({'EXIT', Port, Reason}, Port) -> - {stop, {port_died, Reason}, Port}; -handle_info({'EXIT', _Pid, _Reason}, Port) -> - {noreply, Port}; -handle_info(_, State) -> {noreply, State}. - -code_change(_OldVsn, State, _Extra) -> {ok, State}. - -terminate(_Reason, Port) -> Port ! {self, close}, ok. - --spec enable_zlib(atom(), inet:socket()) -> {ok, zlib_socket()}. - -enable_zlib(SockMod, Socket) -> - case erl_ddll:load_driver(ejabberd:get_so_path(), - ejabberd_zlib_drv) - of - ok -> ok; - {error, already_loaded} -> ok - end, - Port = open_port({spawn, "ejabberd_zlib_drv"}, - [binary]), - {ok, - #zlibsock{sockmod = SockMod, socket = Socket, - zlibport = Port}}. - --spec disable_zlib(zlib_socket()) -> {atom(), inet:socket()}. - -disable_zlib(#zlibsock{sockmod = SockMod, - socket = Socket, zlibport = Port}) -> - port_close(Port), {SockMod, Socket}. - --spec recv(zlib_socket(), number()) -> {ok, binary()} | {error, any()}. - -recv(Socket, Length) -> recv(Socket, Length, infinity). - --spec recv(zlib_socket(), number(), timeout()) -> {ok, binary()} | - {error, any()}. - -recv(#zlibsock{sockmod = SockMod, socket = Socket} = - ZlibSock, - Length, Timeout) -> - case SockMod:recv(Socket, Length, Timeout) of - {ok, Packet} -> recv_data(ZlibSock, Packet); - {error, _Reason} = Error -> Error - end. - --spec recv_data(zlib_socket(), iodata()) -> {ok, binary()} | {error, any()}. - -recv_data(#zlibsock{sockmod = SockMod, - socket = Socket} = - ZlibSock, - Packet) -> - case SockMod of - gen_tcp -> recv_data2(ZlibSock, Packet); - _ -> - case SockMod:recv_data(Socket, Packet) of - {ok, Packet2} -> recv_data2(ZlibSock, Packet2); - Error -> Error - end - end. - -recv_data2(ZlibSock, Packet) -> - case catch recv_data1(ZlibSock, Packet) of - {'EXIT', Reason} -> {error, Reason}; - Res -> Res - end. - -recv_data1(#zlibsock{zlibport = Port} = _ZlibSock, - Packet) -> - case port_control(Port, ?INFLATE, Packet) of - <<0, In/binary>> -> {ok, In}; - <<1, Error/binary>> -> {error, (Error)} - end. - --spec send(zlib_socket(), iodata()) -> ok | {error, binary() | inet:posix()}. - -send(#zlibsock{sockmod = SockMod, socket = Socket, - zlibport = Port}, - Packet) -> - case port_control(Port, ?DEFLATE, Packet) of - <<0, Out/binary>> -> SockMod:send(Socket, Out); - <<1, Error/binary>> -> {error, (Error)} - end. - --spec setopts(zlib_socket(), list()) -> ok | {error, inet:posix()}. - -setopts(#zlibsock{sockmod = SockMod, socket = Socket}, - Opts) -> - case SockMod of - gen_tcp -> inet:setopts(Socket, Opts); - _ -> SockMod:setopts(Socket, Opts) - end. - --spec sockname(zlib_socket()) -> {ok, {inet:ip_address(), inet:port_number()}} | - {error, inet:posix()}. - -sockname(#zlibsock{sockmod = SockMod, - socket = Socket}) -> - case SockMod of - gen_tcp -> inet:sockname(Socket); - _ -> SockMod:sockname(Socket) - end. - --spec get_sockmod(zlib_socket()) -> atom(). - -get_sockmod(#zlibsock{sockmod = SockMod}) -> SockMod. - --spec peername(zlib_socket()) -> {ok, {inet:ip_address(), inet:port_number()}} | - {error, inet:posix()}. - -peername(#zlibsock{sockmod = SockMod, - socket = Socket}) -> - case SockMod of - gen_tcp -> inet:peername(Socket); - _ -> SockMod:peername(Socket) - end. - --spec controlling_process(zlib_socket(), pid()) -> ok | {error, atom()}. - -controlling_process(#zlibsock{sockmod = SockMod, - socket = Socket}, - Pid) -> - SockMod:controlling_process(Socket, Pid). - --spec close(zlib_socket()) -> true. - -close(#zlibsock{sockmod = SockMod, socket = Socket, - zlibport = Port}) -> - SockMod:close(Socket), port_close(Port). diff --git a/src/ejabberd_zlib/ejabberd_zlib_drv.c b/src/ejabberd_zlib/ejabberd_zlib_drv.c deleted file mode 100644 index ea1cc74ca..000000000 --- a/src/ejabberd_zlib/ejabberd_zlib_drv.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * ejabberd, Copyright (C) 2002-2013 ProcessOne - * - * 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 - * - */ - -#include -#include -#include -#include - -/* - * R15B changed several driver callbacks to use ErlDrvSizeT and - * ErlDrvSSizeT typedefs instead of int. - * This provides missing typedefs on older OTP versions. - */ -#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2 -typedef int ErlDrvSizeT; -typedef int ErlDrvSSizeT; -#endif - -#define BUF_SIZE 1024 - -typedef struct { - ErlDrvPort port; - z_stream *d_stream; - z_stream *i_stream; -} ejabberd_zlib_data; - -static void* zlib_alloc(void* data, unsigned int items, unsigned int size) -{ - return (void*) driver_alloc(items*size); -} - -static void zlib_free(void* data, void* addr) -{ - driver_free(addr); -} - -static ErlDrvData ejabberd_zlib_drv_start(ErlDrvPort port, char *buff) -{ - ejabberd_zlib_data *d = - (ejabberd_zlib_data *)driver_alloc(sizeof(ejabberd_zlib_data)); - d->port = port; - - d->d_stream = (z_stream *)driver_alloc(sizeof(z_stream)); - - d->d_stream->zalloc = zlib_alloc; - d->d_stream->zfree = zlib_free; - d->d_stream->opaque = (voidpf)0; - - deflateInit(d->d_stream, Z_DEFAULT_COMPRESSION); - - d->i_stream = (z_stream *)driver_alloc(sizeof(z_stream)); - - d->i_stream->zalloc = zlib_alloc; - d->i_stream->zfree = zlib_free; - d->i_stream->opaque = (voidpf)0; - - inflateInit(d->i_stream); - - set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY); - - return (ErlDrvData)d; -} - -static void ejabberd_zlib_drv_stop(ErlDrvData handle) -{ - ejabberd_zlib_data *d = (ejabberd_zlib_data *)handle; - - deflateEnd(d->d_stream); - driver_free(d->d_stream); - - inflateEnd(d->i_stream); - driver_free(d->i_stream); - - driver_free((char *)handle); -} - - -#define DEFLATE 1 -#define INFLATE 2 - -#define die_unless(cond, errstr) \ - if (!(cond)) \ - { \ - rlen = strlen(errstr) + 1; \ - b = driver_realloc_binary(b, rlen); \ - b->orig_bytes[0] = 1; \ - strncpy(b->orig_bytes + 1, errstr, rlen - 1); \ - *rbuf = (char *)b; \ - return rlen; \ - } - - -static ErlDrvSSizeT ejabberd_zlib_drv_control(ErlDrvData handle, - unsigned int command, - char *buf, ErlDrvSizeT len, - char **rbuf, ErlDrvSizeT rlen) -{ - ejabberd_zlib_data *d = (ejabberd_zlib_data *)handle; - int err; - int size; - ErlDrvBinary *b; - - switch (command) - { - case DEFLATE: - size = BUF_SIZE + 1; - rlen = 1; - b = driver_alloc_binary(size); - b->orig_bytes[0] = 0; - - d->d_stream->next_in = (unsigned char *)buf; - d->d_stream->avail_in = len; - d->d_stream->avail_out = 0; - err = Z_OK; - - while (err == Z_OK && d->d_stream->avail_out == 0) - { - d->d_stream->next_out = (unsigned char *)b->orig_bytes + rlen; - d->d_stream->avail_out = BUF_SIZE; - - err = deflate(d->d_stream, Z_SYNC_FLUSH); - die_unless((err == Z_OK) || (err == Z_STREAM_END), - "Deflate error"); - - rlen += (BUF_SIZE - d->d_stream->avail_out); - size += (BUF_SIZE - d->d_stream->avail_out); - b = driver_realloc_binary(b, size); - } - b = driver_realloc_binary(b, rlen); - *rbuf = (char *)b; - return rlen; - case INFLATE: - size = BUF_SIZE + 1; - rlen = 1; - b = driver_alloc_binary(size); - b->orig_bytes[0] = 0; - - if (len > 0) { - d->i_stream->next_in = (unsigned char *)buf; - d->i_stream->avail_in = len; - d->i_stream->avail_out = 0; - err = Z_OK; - - while (err == Z_OK && d->i_stream->avail_out == 0) - { - d->i_stream->next_out = (unsigned char *)b->orig_bytes + rlen; - d->i_stream->avail_out = BUF_SIZE; - - err = inflate(d->i_stream, Z_SYNC_FLUSH); - die_unless((err == Z_OK) || (err == Z_STREAM_END), - "Inflate error"); - - rlen += (BUF_SIZE - d->i_stream->avail_out); - size += (BUF_SIZE - d->i_stream->avail_out); - b = driver_realloc_binary(b, size); - } - } - b = driver_realloc_binary(b, rlen); - *rbuf = (char *)b; - return rlen; - } - - b = driver_alloc_binary(1); - b->orig_bytes[0] = 0; - *rbuf = (char *)b; - return 1; -} - - -ErlDrvEntry ejabberd_zlib_driver_entry = { - NULL, /* F_PTR init, N/A */ - ejabberd_zlib_drv_start, /* L_PTR start, called when port is opened */ - ejabberd_zlib_drv_stop, /* F_PTR stop, called when port is closed */ - NULL, /* F_PTR output, called when erlang has sent */ - NULL, /* F_PTR ready_input, called when input descriptor ready */ - NULL, /* F_PTR ready_output, called when output descriptor ready */ - "ejabberd_zlib_drv", /* char *driver_name, the argument to open_port */ - NULL, /* F_PTR finish, called when unloaded */ - NULL, /* handle */ - ejabberd_zlib_drv_control, /* F_PTR control, port_command callback */ - NULL, /* F_PTR timeout, reserved */ - NULL, /* F_PTR outputv, reserved */ - /* Added in Erlang/OTP R15B: */ - NULL, /* ready_async */ - NULL, /* flush */ - NULL, /* call */ - NULL, /* event */ - ERL_DRV_EXTENDED_MARKER, /* extended_marker */ - ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */ - ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */ - 0, /* driver_flags */ - NULL, /* handle2 */ - NULL, /* process_exit */ - NULL /* stop_select */ -}; - -DRIVER_INIT(ejabberd_zlib_drv) /* must match name in driver_entry */ -{ - return &ejabberd_zlib_driver_entry; -} - - diff --git a/src/eldap/eldap.erl b/src/eldap.erl similarity index 99% rename from src/eldap/eldap.erl rename to src/eldap.erl index e1a18af3b..dbfdb3adc 100644 --- a/src/eldap/eldap.erl +++ b/src/eldap.erl @@ -66,6 +66,7 @@ -behaviour(gen_fsm). -include("ejabberd.hrl"). +-include("logger.hrl"). %% External exports -export([start_link/1, start_link/6]). @@ -429,7 +430,6 @@ get_handle(Name) when is_binary(Name) -> %%%---------------------------------------------------------------------- init([Hosts, Port, Rootdn, Passwd, Opts]) -> - catch ssl:start(), Encrypt = case gen_mod:get_opt(encrypt, Opts, fun(tls) -> tls; (starttls) -> starttls; diff --git a/src/eldap/Makefile.in b/src/eldap/Makefile.in deleted file mode 100644 index a44bee595..000000000 --- a/src/eldap/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# $Id: Makefile.in 2842 2009-12-29 19:10:52Z badlop $ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ASN_FLAGS = -bber_bin +optimize +binary_strings - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += @ERLANG_SSLVER@ -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -OUTDIR = .. -SOURCES = $(wildcard *.erl) ELDAPv3.erl eldap_filter_yecc.erl -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(BEAMS) ELDAPv3.beam eldap_filter_yecc.beam - -ELDAPv3.beam: ELDAPv3.erl - -ELDAPv3.erl: ELDAPv3.asn - @ERLC@ $(ASN_FLAGS) -W $(EFLAGS) $< - @ERL@ -noinput +B -eval \ - 'case file:read_file("ELDAPv3.erl") of {ok, Data} -> NewData = re:replace(Data, "\\?RT_BER:decode_octet_string", "eldap_utils:decode_octet_string", [global]), file:write_file("ELDAPv3.erl", NewData), halt(0); _Err -> halt(1) end' - -eldap_filter_yecc.beam: eldap_filter_yecc.erl - -eldap_filter_yecc.erl: eldap_filter_yecc.yrl - @ERLC@ -W $< - -$(OUTDIR)/%.beam: %.erl ELDAPv3.erl eldap_filter_yecc.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -clean: - rm -f ELDAPv3.asn1db - rm -f ELDAPv3.erl - rm -f ELDAPv3.hrl - rm -f ELDAPv3.beam - rm -f eldap_filter_yecc.erl - rm -f eldap_filter_yecc.beam - rm -f $(BEAMS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl - diff --git a/src/eldap/Makefile.win32 b/src/eldap/Makefile.win32 deleted file mode 100644 index 394055d41..000000000 --- a/src/eldap/Makefile.win32 +++ /dev/null @@ -1,44 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\eldap.beam ..\eldap_filter.beam ..\eldap_pool.beam ..\eldap_utils.beam ..\eldap_filter_yecc.beam - -ASN_FLAGS = -bber_bin +optimize - -ALL : $(BEAMS) - -Clean : - -@erase ELDAPv3.asn1db - -@erase ELDAPv3.erl - -@erase ELDAPv3.hrl - -@erase ELDAPv3.beam - -@erase eldap_filter_yecc.erl - -@erase eldap_filter_yecc.beam - -@erase $(BEAMS) - -ELDAPv3.erl : ELDAPv3.asn - erlc $(ASN_FLAGS) -W $(EFLAGS) ELDAPv3.asn - -eldap_filter_yecc.erl: eldap_filter_yecc.yrl - erlc -W eldap_filter_yecc.yrl - -$(OUTDIR)\eldap.beam : eldap.erl ELDAPv3.erl - erlc -W $(EFLAGS) -o $(OUTDIR) eldap.erl - -$(OUTDIR)\ELDAPv3.beam : ELDAPv3.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ELDAPv3.erl - -$(OUTDIR)\eldap_filter.beam : eldap_filter.erl - erlc -W $(EFLAGS) -o $(OUTDIR) eldap_filter.erl - -$(OUTDIR)\eldap_utils.beam : eldap_utils.erl - erlc -W $(EFLAGS) -o $(OUTDIR) eldap_utils.erl - -$(OUTDIR)\eldap_pool.beam : eldap_pool.erl - erlc -W $(EFLAGS) -o $(OUTDIR) eldap_pool.erl - -$(OUTDIR)\eldap_filter_yecc.beam : eldap_filter_yecc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) eldap_filter_yecc.erl diff --git a/src/eldap/eldap_filter.erl b/src/eldap_filter.erl similarity index 100% rename from src/eldap/eldap_filter.erl rename to src/eldap_filter.erl diff --git a/src/eldap/eldap_filter_yecc.yrl b/src/eldap_filter_yecc.yrl similarity index 100% rename from src/eldap/eldap_filter_yecc.yrl rename to src/eldap_filter_yecc.yrl diff --git a/src/eldap/eldap_pool.erl b/src/eldap_pool.erl similarity index 99% rename from src/eldap/eldap_pool.erl rename to src/eldap_pool.erl index c189fb1e8..361d473ab 100644 --- a/src/eldap/eldap_pool.erl +++ b/src/eldap_pool.erl @@ -33,6 +33,7 @@ modify_passwd/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). bind(PoolName, DN, Passwd) -> do_request(PoolName, {bind, [DN, Passwd]}). diff --git a/src/eldap/eldap_utils.erl b/src/eldap_utils.erl similarity index 99% rename from src/eldap/eldap_utils.erl rename to src/eldap_utils.erl index 9cae2c0a3..ec64b3aa4 100644 --- a/src/eldap/eldap_utils.erl +++ b/src/eldap_utils.erl @@ -41,6 +41,7 @@ uids_domain_subst/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("eldap.hrl"). %% Generate an 'or' LDAP query on one or several attributes diff --git a/src/expat_erl.c b/src/expat_erl.c deleted file mode 100644 index 94f5446b5..000000000 --- a/src/expat_erl.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - * ejabberd, Copyright (C) 2002-2013 ProcessOne - * - * 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 - * - */ - - -#include -#include -#include -#include -#include - - -#define XML_START 0 -#define XML_END 1 -#define XML_CDATA 2 -#define XML_ERROR 3 - -#define PARSE_COMMAND 0 -#define PARSE_FINAL_COMMAND 1 - -/* - * R15B changed several driver callbacks to use ErlDrvSizeT and - * ErlDrvSSizeT typedefs instead of int. - * This provides missing typedefs on older OTP versions. - */ -#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2 -typedef int ErlDrvSizeT; -typedef int ErlDrvSSizeT; -#endif - -ei_x_buff event_buf; -ei_x_buff xmlns_buf; - -typedef struct { - ErlDrvPort port; - XML_Parser parser; -} expat_data; - -static XML_Memory_Handling_Suite ms; - -void encode_name(const XML_Char *name) -{ - char *name_start; - char *prefix_start; - char *buf; - int name_len, prefix_len, buf_len; - - if ((name_start = strchr(name, '\n'))) { - if ((prefix_start = strchr(name_start+1, '\n'))) { - name_len = prefix_start - name_start; - prefix_len = strlen(prefix_start+1); - buf_len = prefix_len + name_len; - buf = driver_alloc(buf_len); - memcpy(buf, prefix_start+1, prefix_len); - memcpy(buf+prefix_len, name_start, name_len); - buf[prefix_len] = ':'; - ei_x_encode_binary(&event_buf, buf, buf_len); - driver_free(buf); - } else { - ei_x_encode_binary(&event_buf, name_start+1, strlen(name_start+1)); - }; - } else { - ei_x_encode_binary(&event_buf, name, strlen(name)); - } -} - -void *erlXML_StartElementHandler(expat_data *d, - const XML_Char *name, - const XML_Char **atts) -{ - int i; - - ei_x_encode_list_header(&event_buf, 1); - ei_x_encode_tuple_header(&event_buf, 2); - ei_x_encode_long(&event_buf, XML_START); - ei_x_encode_tuple_header(&event_buf, 2); - encode_name(name); - ei_x_append(&event_buf, &xmlns_buf); - ei_x_free(&xmlns_buf); - ei_x_new(&xmlns_buf); - - for (i = 0; atts[i]; i += 2) {} - - if (i > 0) - { - ei_x_encode_list_header(&event_buf, i/2); - - for (i = 0; atts[i]; i += 2) - { - ei_x_encode_tuple_header(&event_buf, 2); - encode_name(atts[i]); - ei_x_encode_binary(&event_buf, atts[i+1], strlen(atts[i+1])); - } - } - - ei_x_encode_empty_list(&event_buf); - - return NULL; -} - -void *erlXML_EndElementHandler(expat_data *d, - const XML_Char *name) -{ - ei_x_encode_list_header(&event_buf, 1); - ei_x_encode_tuple_header(&event_buf, 2); - ei_x_encode_long(&event_buf, XML_END); - encode_name(name); - return NULL; -} - -void *erlXML_CharacterDataHandler(expat_data *d, - const XML_Char *s, - int len) -{ - ei_x_encode_list_header(&event_buf, 1); - ei_x_encode_tuple_header(&event_buf, 2); - ei_x_encode_long(&event_buf, XML_CDATA); - ei_x_encode_binary(&event_buf, s, len); - return NULL; -} - -void *erlXML_StartNamespaceDeclHandler(expat_data *d, - const XML_Char *prefix, - const XML_Char *uri) -{ - int prefix_len; - char *buf; - - /* From the expat documentation: - "For a default namespace declaration (xmlns='...'), - the prefix will be null ... - ... The URI will be null for the case where - the default namespace is being unset." - - FIXME: I'm not quite sure what all that means */ - if (uri == NULL) - return NULL; - - ei_x_encode_list_header(&xmlns_buf, 1); - ei_x_encode_tuple_header(&xmlns_buf, 2); - if (prefix) { - prefix_len = strlen(prefix); - buf = driver_alloc(7 + prefix_len); - strcpy(buf, "xmlns:"); - strcpy(buf+6, prefix); - ei_x_encode_binary(&xmlns_buf, buf, strlen(buf)); - driver_free(buf); - } else { - ei_x_encode_binary(&xmlns_buf, "xmlns", strlen("xmlns")); - }; - ei_x_encode_binary(&xmlns_buf, uri, strlen(uri)); - - return NULL; -} - -static ErlDrvData expat_erl_start(ErlDrvPort port, char *buff) -{ - expat_data* d = (expat_data*)driver_alloc(sizeof(expat_data)); - d->port = port; - d->parser = XML_ParserCreate_MM("UTF-8", &ms, "\n"); - XML_SetUserData(d->parser, d); - - set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY); - - XML_SetStartElementHandler( - d->parser, (XML_StartElementHandler)erlXML_StartElementHandler); - XML_SetEndElementHandler( - d->parser, (XML_EndElementHandler)erlXML_EndElementHandler); - XML_SetCharacterDataHandler( - d->parser, (XML_CharacterDataHandler)erlXML_CharacterDataHandler); - - XML_SetStartNamespaceDeclHandler( - d->parser, (XML_StartNamespaceDeclHandler) erlXML_StartNamespaceDeclHandler); - XML_SetReturnNSTriplet(d->parser, 1); - - XML_SetDefaultHandler(d->parser, NULL); - - return (ErlDrvData)d; -} - -static void expat_erl_stop(ErlDrvData handle) -{ - XML_ParserFree(((expat_data *)handle)->parser); - driver_free((char*)handle); -} - -static ErlDrvSSizeT expat_erl_control(ErlDrvData drv_data, - unsigned int command, - char *buf, ErlDrvSizeT len, - char **rbuf, ErlDrvSizeT rlen) -{ - expat_data* d = (expat_data*)drv_data; - int res, errcode; - char *errstring; - ErlDrvBinary *b; - size_t size; - - switch (command) - { - case PARSE_COMMAND: - case PARSE_FINAL_COMMAND: - ei_x_new_with_version(&event_buf); - ei_x_new(&xmlns_buf); -#ifdef ENABLE_FLASH_HACK - /* Flash hack - Flash clients send a null byte after the stanza. Remove that... */ - { - int i; - int found_null = 0; - - /* Maybe the Flash client sent many stanzas in one packet. - If so, there is a null byte between every stanza. */ - for (i = 0; i < len; i++) { - if (buf[i] == '\0') { - buf[i] = ' '; - found_null = 1; - } - } - - /* And also remove the closing slash if this is a - flash:stream element. Assume that flash:stream is the - last element in the packet, and entirely contained in - it. This requires that a null byte has been found. */ - if (found_null && strstr(buf, " - buf[len - 3] is / (maybe) - */ - if (buf[len - 3] == '/') - buf[len - 3] = ' '; - } -#endif /* ENABLE_FLASH_HACK */ - - res = XML_Parse(d->parser, buf, len, command == PARSE_FINAL_COMMAND); - - if(!res) - { - errcode = XML_GetErrorCode(d->parser); - errstring = (char *)XML_ErrorString(errcode); - - ei_x_encode_list_header(&event_buf, 1); - ei_x_encode_tuple_header(&event_buf, 2); - ei_x_encode_long(&event_buf, XML_ERROR); - ei_x_encode_tuple_header(&event_buf, 2); - ei_x_encode_long(&event_buf, errcode); - ei_x_encode_binary(&event_buf, errstring, strlen(errstring)); - } - - ei_x_encode_empty_list(&event_buf); - - size = event_buf.index; - - b = driver_alloc_binary(size); - memcpy(b->orig_bytes, event_buf.buff, size); - - ei_x_free(&event_buf); - ei_x_free(&xmlns_buf); - - *rbuf = (char *)b; - return size; - default: - return 0; - } -} - -ErlDrvEntry expat_driver_entry = { - NULL, /* F_PTR init, N/A */ - expat_erl_start, /* L_PTR start, called when port is opened */ - expat_erl_stop, /* F_PTR stop, called when port is closed */ - NULL, /* F_PTR output, called when erlang has sent */ - NULL, /* F_PTR ready_input, called when input descriptor ready */ - NULL, /* F_PTR ready_output, called when output descriptor ready */ - "expat_erl", /* char *driver_name, the argument to open_port */ - NULL, /* F_PTR finish, called when unloaded */ - NULL, /* handle */ - expat_erl_control, /* F_PTR control, port_command callback */ - NULL, /* F_PTR timeout, reserved */ - NULL, /* F_PTR outputv, reserved */ - /* Added in Erlang/OTP R15B: */ - NULL, /* ready_async */ - NULL, /* flush */ - NULL, /* call */ - NULL, /* event */ - ERL_DRV_EXTENDED_MARKER, /* extended_marker */ - ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */ - ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */ - 0, /* driver_flags */ - NULL, /* handle2 */ - NULL, /* process_exit */ - NULL /* stop_select */ -}; - -DRIVER_INIT(expat_erl) /* must match name in driver_entry */ -{ - ms.malloc_fcn = driver_alloc; - ms.realloc_fcn = driver_realloc; - ms.free_fcn = driver_free; - return &expat_driver_entry; -} - - diff --git a/src/extauth.erl b/src/extauth.erl index 6a7f8d7b9..0403b56b4 100644 --- a/src/extauth.erl +++ b/src/extauth.erl @@ -33,6 +33,7 @@ remove_user/3, is_user_exists/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -define(INIT_TIMEOUT, 60000). diff --git a/src/gen_iq_handler.erl b/src/gen_iq_handler.erl index a2d33c2da..d1b107cb7 100644 --- a/src/gen_iq_handler.erl +++ b/src/gen_iq_handler.erl @@ -40,6 +40,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -record(state, {host = <<"">> :: binary(), diff --git a/src/gen_mod.erl b/src/gen_mod.erl index de15d5758..7498529e6 100644 --- a/src/gen_mod.erl +++ b/src/gen_mod.erl @@ -38,6 +38,7 @@ %%-export([behaviour_info/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -record(ejabberd_module, {module_host = {undefined, <<"">>} :: {atom(), binary()}, diff --git a/src/mod_pubsub/gen_pubsub_node.erl b/src/gen_pubsub_node.erl similarity index 100% rename from src/mod_pubsub/gen_pubsub_node.erl rename to src/gen_pubsub_node.erl diff --git a/src/mod_pubsub/gen_pubsub_nodetree.erl b/src/gen_pubsub_nodetree.erl similarity index 100% rename from src/mod_pubsub/gen_pubsub_nodetree.erl rename to src/gen_pubsub_nodetree.erl diff --git a/src/http_p1.erl b/src/http_p1.erl index 38a8cb716..343a0bf46 100644 --- a/src/http_p1.erl +++ b/src/http_p1.erl @@ -39,11 +39,10 @@ -ifdef(USE_IBROWSE). start() -> - ibrowse:start(), - ssl:start(). + ejabberd:start_app(ibrowse). stop() -> - ibrowse:stop(). + application:stop(ibrowse). request(Method, URL, Hdrs, Body, Opts) -> TimeOut = proplists:get_value(timeout, Opts, infinity), @@ -62,13 +61,10 @@ request(Method, URL, Hdrs, Body, Opts) -> -ifdef(USE_LHTTPC). start() -> - application:start(crypto), - application:start(ssl), - lhttpc:start(). + ejabberd:start_app(lhttpc). stop() -> - lhttpc:stop(), - application:stop(ssl). + application:stop(lhttpc). request(Method, URL, Hdrs, Body, Opts) -> TimeOut = proplists:get_value(timeout, Opts, infinity), @@ -86,12 +82,10 @@ request(Method, URL, Hdrs, Body, Opts) -> -else. start() -> - inets:start(), - ssl:start(). + ejabberd:start_app(inets). stop() -> - inets:stop(), - ssl:stop(). + ejabberd:start_app(inets). to_list(Str) when is_binary(Str) -> binary_to_list(Str); diff --git a/src/jd2ejd.erl b/src/jd2ejd.erl index a5d2f9961..a60033998 100644 --- a/src/jd2ejd.erl +++ b/src/jd2ejd.erl @@ -32,6 +32,7 @@ -export([import_file/1, import_dir/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/log.hrl b/src/log.hrl deleted file mode 100644 index 0f025e570..000000000 --- a/src/log.hrl +++ /dev/null @@ -1,38 +0,0 @@ -%% Copyright (C) 2003 Joakim Grebenö . -%% All rights reserved. -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions -%% are met: -%% -%% 1. Redistributions of source code must retain the above copyright -%% notice, this list of conditions and the following disclaimer. -%% 2. 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. -%% -%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. - --define(INFO_LOG(Reason), - error_logger:info_report({?MODULE, ?LINE, Reason})). - --define(ERROR_LOG(Reason), - error_logger:error_report({?MODULE, ?LINE, Reason})). - --ifdef(DEBUG). --define(DEBUG_LOG(Reason), - error_logger:info_report({debug, ?MODULE, ?LINE, Reason})). --else. --define(DEBUG_LOG(Reason), ok). --endif. diff --git a/src/mod_ack.erl b/src/mod_ack.erl index 24cc3f427..b0723bcfa 100644 --- a/src/mod_ack.erl +++ b/src/mod_ack.erl @@ -44,6 +44,7 @@ -include("jlib.hrl"). -include("ejabberd.hrl"). +-include("logger.hrl"). -define(PROCNAME, ejabberd_mod_ack). diff --git a/src/mod_adhoc.erl b/src/mod_adhoc.erl index 81329fd6a..929c216ff 100644 --- a/src/mod_adhoc.erl +++ b/src/mod_adhoc.erl @@ -37,6 +37,7 @@ ping_item/4, ping_command/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_admin_p1.erl b/src/mod_admin_p1.erl index fcb4c4c53..cc79ca841 100644 --- a/src/mod_admin_p1.erl +++ b/src/mod_admin_p1.erl @@ -91,6 +91,7 @@ send_chat/3, send_message/4, send_stanza/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("ejabberd_commands.hrl"). diff --git a/src/mod_announce.erl b/src/mod_announce.erl index 293c73638..b4d3f989c 100644 --- a/src/mod_announce.erl +++ b/src/mod_announce.erl @@ -46,6 +46,7 @@ announce_items/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include("adhoc.hrl"). diff --git a/src/mod_applepush.erl b/src/mod_applepush.erl index 95f4b0a09..8134b9a55 100644 --- a/src/mod_applepush.erl +++ b/src/mod_applepush.erl @@ -35,6 +35,7 @@ -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include("mod_privacy.hrl"). diff --git a/src/mod_applepush_service.erl b/src/mod_applepush_service.erl index 86ec564a3..437b6f552 100644 --- a/src/mod_applepush_service.erl +++ b/src/mod_applepush_service.erl @@ -22,6 +22,7 @@ -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include_lib("kernel/include/file.hrl"). @@ -65,7 +66,6 @@ start_link(Host, Opts) -> gen_server:start_link({local, Proc}, ?MODULE, [Host, Opts], []). start(Host, Opts) -> - ssl:start(), MyHosts = case catch gen_mod:get_opt( hosts, Opts, fun(L) when is_list(L) -> diff --git a/src/mod_blocking.erl b/src/mod_blocking.erl index e52c29511..bb0341f37 100644 --- a/src/mod_blocking.erl +++ b/src/mod_blocking.erl @@ -32,6 +32,7 @@ process_iq_set/4, process_iq_get/5]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/mod_bosh.erl b/src/mod_bosh.erl similarity index 98% rename from src/web/mod_bosh.erl rename to src/mod_bosh.erl index be58e32d1..85ce101a5 100644 --- a/src/web/mod_bosh.erl +++ b/src/mod_bosh.erl @@ -38,6 +38,7 @@ migrate/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). @@ -185,11 +186,9 @@ start_jiffy(Opts) -> false -> ok; true -> - case application:start(jiffy) of + case catch ejabberd:start_app(jiffy) of ok -> ok; - {error, {already_started, _}} -> - ok; Err -> ?WARNING_MSG("Failed to start JSON codec (jiffy): ~p. " "JSON support will be disabled", [Err]) diff --git a/src/mod_c2s_debug.erl b/src/mod_c2s_debug.erl index 9da40e7ab..4cfbf6440 100644 --- a/src/mod_c2s_debug.erl +++ b/src/mod_c2s_debug.erl @@ -26,6 +26,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_caps.erl b/src/mod_caps.erl index 3575ef597..23af4a0ea 100644 --- a/src/mod_caps.erl +++ b/src/mod_caps.erl @@ -50,6 +50,7 @@ c2s_presence_in/2, c2s_broadcast_recipients/6]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl index c48ae4646..fd1598098 100644 --- a/src/mod_carboncopy.erl +++ b/src/mod_carboncopy.erl @@ -47,6 +47,7 @@ -define(NS_FORWARD, <<"urn:xmpp:forward:0">>). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -define(PROCNAME, ?MODULE). -define(TABLE, carboncopy). diff --git a/src/mod_configure.erl b/src/mod_configure.erl index 74c56c02a..1a755c20b 100644 --- a/src/mod_configure.erl +++ b/src/mod_configure.erl @@ -40,6 +40,7 @@ adhoc_sm_items/4, adhoc_sm_commands/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_configure2.erl b/src/mod_configure2.erl index 366538632..c4d482d02 100644 --- a/src/mod_configure2.erl +++ b/src/mod_configure2.erl @@ -33,6 +33,7 @@ -export([start/2, stop/1, process_local_iq/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_disco.erl b/src/mod_disco.erl index c883e0782..d62251686 100644 --- a/src/mod_disco.erl +++ b/src/mod_disco.erl @@ -39,6 +39,7 @@ register_extra_domain/2, unregister_extra_domain/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_echo.erl b/src/mod_echo.erl index 14d99de4b..f10df45de 100644 --- a/src/mod_echo.erl +++ b/src/mod_echo.erl @@ -41,6 +41,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/mod_http_bind.erl b/src/mod_http_bind.erl similarity index 99% rename from src/web/mod_http_bind.erl rename to src/mod_http_bind.erl index 8ea8f6781..a302bf5a3 100644 --- a/src/web/mod_http_bind.erl +++ b/src/mod_http_bind.erl @@ -41,6 +41,7 @@ -export([start/2, stop/1, process/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/mod_http_bindjson.erl b/src/mod_http_bindjson.erl similarity index 99% rename from src/web/mod_http_bindjson.erl rename to src/mod_http_bindjson.erl index 8ff21d012..94bec7605 100644 --- a/src/web/mod_http_bindjson.erl +++ b/src/mod_http_bindjson.erl @@ -43,6 +43,7 @@ -export([start/2, stop/1, process/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/mod_http_fileserver.erl b/src/mod_http_fileserver.erl similarity index 99% rename from src/web/mod_http_fileserver.erl rename to src/mod_http_fileserver.erl index f0f8e0f0d..300bb26eb 100644 --- a/src/web/mod_http_fileserver.erl +++ b/src/mod_http_fileserver.erl @@ -39,6 +39,7 @@ -export([process/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/mod_http_fileserver_log.erl b/src/mod_http_fileserver_log.erl similarity index 99% rename from src/web/mod_http_fileserver_log.erl rename to src/mod_http_fileserver_log.erl index 8f634f487..6ceb37ef4 100644 --- a/src/web/mod_http_fileserver_log.erl +++ b/src/mod_http_fileserver_log.erl @@ -9,6 +9,7 @@ reopen_log/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_ip_blacklist.erl b/src/mod_ip_blacklist.erl index 0759db94a..3e8e2d2e3 100644 --- a/src/mod_ip_blacklist.erl +++ b/src/mod_ip_blacklist.erl @@ -41,6 +41,7 @@ -export([is_ip_in_c2s_blacklist/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -define(PROCNAME, ?MODULE). @@ -68,7 +69,6 @@ preinit(Parent, State) -> stop(_Host) -> ok. init(State) -> - inets:start(), ets:new(bl_c2s, [named_table, public, {keypos, #bl_c2s.ip}]), update_bl_c2s(), diff --git a/src/mod_irc/mod_irc.erl b/src/mod_irc.erl similarity index 99% rename from src/mod_irc/mod_irc.erl rename to src/mod_irc.erl index a90302f6b..ec9c68699 100644 --- a/src/mod_irc/mod_irc.erl +++ b/src/mod_irc.erl @@ -41,6 +41,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). @@ -98,7 +99,7 @@ stop(Host) -> %%==================================================================== init([Host, Opts]) -> - iconv:start(), + ejabberd:start_app(p1_iconv), MyHost = gen_mod:get_opt_host(Host, Opts, <<"irc.@HOST@">>), case gen_mod:db_type(Opts) of diff --git a/src/mod_irc/Makefile.in b/src/mod_irc/Makefile.in deleted file mode 100644 index 9dcf9f182..000000000 --- a/src/mod_irc/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ @LIBICONV@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -# Assume Linux-style dynamic library flags -DYNAMIC_LIB_CFLAGS = -fpic -shared -ifeq ($(shell uname),Darwin) - DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress -endif -ifeq ($(shell uname),SunOs) - DYNAMIC_LIB_CFLAGS = -KPIC -G -z text -endif - - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -ERLSHLIBS = ../iconv_erl.so -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - -all: $(BEAMS) $(ERLSHLIBS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -#all: $(ERLSHLIBS) -# erl -s make all report "{outdir, \"..\"}" -noinput -s erlang halt - -$(ERLSHLIBS): ../%.so: %.c - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) \ - $(subst ../,,$(subst .so,.c,$@)) \ - $(LIBS) \ - $(ERLANG_CFLAGS) \ - $(ERLANG_LIBS) \ - -o $@ \ - $(DYNAMIC_LIB_CFLAGS) - -clean: - rm -f $(BEAMS) $(ERLSHLIBS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl - diff --git a/src/mod_irc/Makefile.win32 b/src/mod_irc/Makefile.win32 deleted file mode 100644 index fb0671104..000000000 --- a/src/mod_irc/Makefile.win32 +++ /dev/null @@ -1,42 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\iconv.beam ..\mod_irc.beam ..\mod_irc_connection.beam - -SOURCE = iconv_erl.c -OBJECT = iconv_erl.o -DLL = $(OUTDIR)\iconv_erl.dll - -ALL : $(DLL) $(BEAMS) - -CLEAN : - -@erase $(DLL) - -@erase $(OUTDIR)\iconv_erl.exp - -@erase $(OUTDIR)\iconv_erl.lib - -@erase $(OBJECT) - -@erase $(BEAMS) - -$(OUTDIR)\iconv.beam : iconv.erl - erlc -W $(EFLAGS) -o $(OUTDIR) iconv.erl - -$(OUTDIR)\mod_irc.beam : mod_irc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_irc.erl - -$(OUTDIR)\mod_irc_connection.beam : mod_irc_connection.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_irc_connection.erl - -CC=cl.exe -CC_FLAGS=-nologo -D__WIN32__ -DWIN32 -DWINDOWS -D_WIN32 -DNT -MD -Ox -I"$(ERLANG_DIR)\usr\include" -I"$(EI_DIR)\include" -I"$(ICONV_DIR)\include" - -LD=link.exe -LD_FLAGS=-release -nologo -incremental:no -dll "$(EI_DIR)\lib\ei_md.lib" "$(EI_DIR)\lib\erl_interface_md.lib" "$(ICONV_LIB)" MSVCRT.LIB kernel32.lib advapi32.lib gdi32.lib user32.lib comctl32.lib comdlg32.lib shell32.lib - -$(DLL) : $(OBJECT) - $(LD) $(LD_FLAGS) -out:$@ $< - -$(OBJECT) : $(SOURCE) - $(CC) $(CC_FLAGS) -c -Fo$@ $< - diff --git a/src/mod_irc/iconv.erl b/src/mod_irc/iconv.erl deleted file mode 100644 index 511097c62..000000000 --- a/src/mod_irc/iconv.erl +++ /dev/null @@ -1,82 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : iconv.erl -%%% Author : Alexey Shchepin -%%% Purpose : Interface to libiconv -%%% Created : 16 Feb 2003 by Alexey Shchepin -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(iconv). - --author('alexey@process-one.net'). - --behaviour(gen_server). - --export([start/0, start_link/0, convert/3]). - -%% Internal exports, call-back functions. --export([init/1, handle_call/3, handle_cast/2, - handle_info/2, code_change/3, terminate/2]). - -start() -> - gen_server:start({local, ?MODULE}, ?MODULE, [], []). - -start_link() -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [], - []). - -init([]) -> - case erl_ddll:load_driver(ejabberd:get_so_path(), - iconv_erl) - of - ok -> ok; - {error, already_loaded} -> ok - end, - Port = open_port({spawn, "iconv_erl"}, []), - ets:new(iconv_table, [set, public, named_table]), - ets:insert(iconv_table, {port, Port}), - {ok, Port}. - -%%% -------------------------------------------------------- -%%% The call-back functions. -%%% -------------------------------------------------------- - -handle_call(_, _, State) -> {noreply, State}. - -handle_cast(_, State) -> {noreply, State}. - -handle_info({'EXIT', Port, Reason}, Port) -> - {stop, {port_died, Reason}, Port}; -handle_info({'EXIT', _Pid, _Reason}, Port) -> - {noreply, Port}; -handle_info(_, State) -> {noreply, State}. - -code_change(_OldVsn, State, _Extra) -> {ok, State}. - -terminate(_Reason, Port) -> Port ! {self, close}, ok. - --spec convert(binary(), binary(), binary()) -> binary(). - -convert(From, To, String) -> - [{port, Port} | _] = ets:lookup(iconv_table, port), - Bin = term_to_binary({binary_to_list(From), binary_to_list(To), binary_to_list(String)}), - BRes = port_control(Port, 1, Bin), - (BRes). diff --git a/src/mod_irc/iconv_erl.c b/src/mod_irc/iconv_erl.c deleted file mode 100644 index 20d9389a8..000000000 --- a/src/mod_irc/iconv_erl.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * ejabberd, Copyright (C) 2002-2013 ProcessOne - * - * 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 - * - */ - -#include -#include -#include -#include -#include - -/* - * R15B changed several driver callbacks to use ErlDrvSizeT and - * ErlDrvSSizeT typedefs instead of int. - * This provides missing typedefs on older OTP versions. - */ -#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2 -typedef int ErlDrvSizeT; -typedef int ErlDrvSSizeT; -#endif - -typedef struct { - ErlDrvPort port; - iconv_t cd; -} iconv_data; - - -static ErlDrvData iconv_erl_start(ErlDrvPort port, char *buff) -{ - iconv_data* d = (iconv_data*)driver_alloc(sizeof(iconv_data)); - d->port = port; - d->cd = NULL; - - set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY); - - return (ErlDrvData)d; -} - -static void iconv_erl_stop(ErlDrvData handle) -{ - driver_free((char*)handle); -} - -static ErlDrvSSizeT iconv_erl_control(ErlDrvData drv_data, - unsigned int command, - char *buf, ErlDrvSizeT len, - char **rbuf, ErlDrvSizeT rlen) -{ - int i; - int size; - int index = 0; - int avail; - size_t inleft, outleft; - ErlDrvBinary *b; - char *from, *to, *string, *stmp, *rstring, *rtmp; - iconv_t cd; - int invalid_utf8_as_latin1 = 0; - - ei_decode_version(buf, &index, &i); - ei_decode_tuple_header(buf, &index, &i); - ei_get_type(buf, &index, &i, &size); - from = driver_alloc(size + 1); - ei_decode_string(buf, &index, from); - - ei_get_type(buf, &index, &i, &size); - to = driver_alloc(size + 1); - ei_decode_string(buf, &index, to); - - ei_get_type(buf, &index, &i, &size); - stmp = string = driver_alloc(size + 1); - ei_decode_string(buf, &index, string); - - /* Special mode: parse as UTF-8 if possible; otherwise assume it's - Latin-1. Makes no difference when encoding. */ - if (strcmp(from, "utf-8+latin-1") == 0) { - from[5] = '\0'; - invalid_utf8_as_latin1 = 1; - } - if (strcmp(to, "utf-8+latin-1") == 0) { - to[5] = '\0'; - } - cd = iconv_open(to, from); - - if (cd == (iconv_t) -1) { - cd = iconv_open("ascii", "ascii"); - if (cd == (iconv_t) -1) { - *rbuf = (char*)(b = driver_alloc_binary(size)); - memcpy(b->orig_bytes, string, size); - - driver_free(from); - driver_free(to); - driver_free(string); - - return size; - } - } - - outleft = avail = 4*size; - inleft = size; - rtmp = rstring = driver_alloc(avail); - while (inleft > 0) { - if (iconv(cd, &stmp, &inleft, &rtmp, &outleft) == (size_t) -1) { - if (invalid_utf8_as_latin1 && (*stmp & 0x80) && outleft >= 2) { - /* Encode one byte of (assumed) Latin-1 into two bytes of UTF-8 */ - *rtmp++ = 0xc0 | ((*stmp & 0xc0) >> 6); - *rtmp++ = 0x80 | (*stmp & 0x3f); - outleft -= 2; - } - stmp++; - inleft--; - } - } - - size = rtmp - rstring; - - *rbuf = (char*)(b = driver_alloc_binary(size)); - memcpy(b->orig_bytes, rstring, size); - - driver_free(from); - driver_free(to); - driver_free(string); - driver_free(rstring); - iconv_close(cd); - - return size; -} - - - -ErlDrvEntry iconv_driver_entry = { - NULL, /* F_PTR init, N/A */ - iconv_erl_start, /* L_PTR start, called when port is opened */ - iconv_erl_stop, /* F_PTR stop, called when port is closed */ - NULL, /* F_PTR output, called when erlang has sent */ - NULL, /* F_PTR ready_input, called when input descriptor ready */ - NULL, /* F_PTR ready_output, called when output descriptor ready */ - "iconv_erl", /* char *driver_name, the argument to open_port */ - NULL, /* F_PTR finish, called when unloaded */ - NULL, /* handle */ - iconv_erl_control, /* F_PTR control, port_command callback */ - NULL, /* F_PTR timeout, reserved */ - NULL, /* F_PTR outputv, reserved */ - /* Added in Erlang/OTP R15B: */ - NULL, /* ready_async */ - NULL, /* flush */ - NULL, /* call */ - NULL, /* event */ - ERL_DRV_EXTENDED_MARKER, /* extended_marker */ - ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */ - ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */ - 0, /* driver_flags */ - NULL, /* handle2 */ - NULL, /* process_exit */ - NULL /* stop_select */ -}; - -DRIVER_INIT(iconv_erl) /* must match name in driver_entry */ -{ - return &iconv_driver_entry; -} - - diff --git a/src/mod_irc/mod_irc_connection.erl b/src/mod_irc_connection.erl similarity index 99% rename from src/mod_irc/mod_irc_connection.erl rename to src/mod_irc_connection.erl index 324a9ee45..5b9d98b80 100644 --- a/src/mod_irc/mod_irc_connection.erl +++ b/src/mod_irc_connection.erl @@ -41,6 +41,7 @@ code_change/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_last.erl b/src/mod_last.erl index 06ed0ca03..15831e991 100644 --- a/src/mod_last.erl +++ b/src/mod_last.erl @@ -35,6 +35,7 @@ store_last_info/4, get_last_info/2, remove_user/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_mnesia_mngt.erl b/src/mod_mnesia_mngt.erl index f7aa962a6..c64e9004a 100644 --- a/src/mod_mnesia_mngt.erl +++ b/src/mod_mnesia_mngt.erl @@ -20,6 +20,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_muc/mod_muc.erl b/src/mod_muc.erl similarity index 99% rename from src/mod_muc/mod_muc.erl rename to src/mod_muc.erl index df83d6723..5521d5e93 100644 --- a/src/mod_muc/mod_muc.erl +++ b/src/mod_muc.erl @@ -46,6 +46,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_muc/Makefile.in b/src/mod_muc/Makefile.in deleted file mode 100644 index 5ede5e521..000000000 --- a/src/mod_muc/Makefile.in +++ /dev/null @@ -1,42 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -ifeq (@transient_supervisors@, false) - EFLAGS+=-DNO_TRANSIENT_SUPERVISORS -endif - -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(BEAMS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -clean: - rm -f $(BEAMS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl - diff --git a/src/mod_muc/Makefile.win32 b/src/mod_muc/Makefile.win32 deleted file mode 100644 index 5107b1069..000000000 --- a/src/mod_muc/Makefile.win32 +++ /dev/null @@ -1,21 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\mod_muc.beam ..\mod_muc_log.beam ..\mod_muc_room.beam - -ALL : $(BEAMS) - -CLEAN : - -@erase $(BEAMS) - -$(OUTDIR)\mod_muc.beam : mod_muc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_muc.erl - -$(OUTDIR)\mod_muc_log.beam : mod_muc_log.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_muc_log.erl - -$(OUTDIR)\mod_muc_room.beam : mod_muc_room.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_muc_room.erl diff --git a/src/mod_muc/mod_muc_log.erl b/src/mod_muc_log.erl similarity index 99% rename from src/mod_muc/mod_muc_log.erl rename to src/mod_muc_log.erl index 4640bbab4..3ef273802 100644 --- a/src/mod_muc/mod_muc_log.erl +++ b/src/mod_muc_log.erl @@ -41,6 +41,7 @@ handle_info/2, terminate/2, code_change/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_muc/mod_muc_room.erl b/src/mod_muc_room.erl similarity index 99% rename from src/mod_muc/mod_muc_room.erl rename to src/mod_muc_room.erl index afb773aa2..9621e29fb 100644 --- a/src/mod_muc/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -43,6 +43,7 @@ print_state/1, code_change/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_multicast.erl b/src/mod_multicast.erl index 566628feb..9aaa252f9 100644 --- a/src/mod_multicast.erl +++ b/src/mod_multicast.erl @@ -24,6 +24,7 @@ -export([purge_loop/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_offline.erl b/src/mod_offline.erl index 7028c5eff..a1aa81b7a 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -40,12 +40,13 @@ export/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). --include("web/ejabberd_http.hrl"). +-include("ejabberd_http.hrl"). --include("web/ejabberd_web_admin.hrl"). +-include("ejabberd_web_admin.hrl"). -record(offline_msg, {us = {<<"">>, <<"">>} :: {binary(), binary()}, diff --git a/src/mod_ping.erl b/src/mod_ping.erl index 1e8af5ecf..3501053d2 100644 --- a/src/mod_ping.erl +++ b/src/mod_ping.erl @@ -33,6 +33,7 @@ -behavior(gen_server). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_pres_counter.erl b/src/mod_pres_counter.erl index 9246f8d55..30f5308c0 100644 --- a/src/mod_pres_counter.erl +++ b/src/mod_pres_counter.erl @@ -31,6 +31,7 @@ -export([start/2, stop/1, check_packet/6]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_privacy.erl b/src/mod_privacy.erl index dc488ddab..7cf7f5d04 100644 --- a/src/mod_privacy.erl +++ b/src/mod_privacy.erl @@ -47,6 +47,7 @@ sql_set_privacy_list/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_private.erl b/src/mod_private.erl index 7d21d119d..13336c565 100644 --- a/src/mod_private.erl +++ b/src/mod_private.erl @@ -34,6 +34,7 @@ remove_user/2, get_data/2, export/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_proxy65/mod_proxy65.erl b/src/mod_proxy65.erl similarity index 100% rename from src/mod_proxy65/mod_proxy65.erl rename to src/mod_proxy65.erl diff --git a/src/mod_proxy65/Makefile.in b/src/mod_proxy65/Makefile.in deleted file mode 100644 index 3fc94c662..000000000 --- a/src/mod_proxy65/Makefile.in +++ /dev/null @@ -1,38 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(BEAMS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -clean: - rm -f $(BEAMS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl - diff --git a/src/mod_proxy65/Makefile.win32 b/src/mod_proxy65/Makefile.win32 deleted file mode 100644 index 7683097d3..000000000 --- a/src/mod_proxy65/Makefile.win32 +++ /dev/null @@ -1,27 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\mod_proxy65.beam ..\mod_proxy65_lib.beam ..\mod_proxy65_service.beam ..\mod_proxy65_sm.beam ..\mod_proxy65_stream.beam - -ALL : $(BEAMS) - -CLEAN : - -@erase $(BEAMS) - -$(OUTDIR)\mod_proxy65.beam : mod_proxy65.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_proxy65.erl - -$(OUTDIR)\mod_proxy65_service.beam : mod_proxy65_service.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_proxy65_service.erl - -$(OUTDIR)\mod_proxy65_sm.beam : mod_proxy65_sm.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_proxy65_sm.erl - -$(OUTDIR)\mod_proxy65_stream.beam : mod_proxy65_stream.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_proxy65_stream.erl - -$(OUTDIR)\mod_proxy65_lib.beam : mod_proxy65_lib.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_proxy65_lib.erl diff --git a/src/mod_proxy65/mod_proxy65_lib.erl b/src/mod_proxy65_lib.erl similarity index 100% rename from src/mod_proxy65/mod_proxy65_lib.erl rename to src/mod_proxy65_lib.erl diff --git a/src/mod_proxy65/mod_proxy65_service.erl b/src/mod_proxy65_service.erl similarity index 99% rename from src/mod_proxy65/mod_proxy65_service.erl rename to src/mod_proxy65_service.erl index f7e047947..dde53d94e 100644 --- a/src/mod_proxy65/mod_proxy65_service.erl +++ b/src/mod_proxy65_service.erl @@ -39,6 +39,7 @@ delete_listener/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_proxy65/mod_proxy65_sm.erl b/src/mod_proxy65_sm.erl similarity index 100% rename from src/mod_proxy65/mod_proxy65_sm.erl rename to src/mod_proxy65_sm.erl diff --git a/src/mod_proxy65/mod_proxy65_stream.erl b/src/mod_proxy65_stream.erl similarity index 99% rename from src/mod_proxy65/mod_proxy65_stream.erl rename to src/mod_proxy65_stream.erl index 805317834..b2e03e709 100644 --- a/src/mod_proxy65/mod_proxy65_stream.erl +++ b/src/mod_proxy65_stream.erl @@ -45,6 +45,7 @@ -include("mod_proxy65.hrl"). -include("ejabberd.hrl"). +-include("logger.hrl"). -define(WAIT_TIMEOUT, 60000). diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub.erl similarity index 99% rename from src/mod_pubsub/mod_pubsub.erl rename to src/mod_pubsub.erl index dc798707e..c25cfac91 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -52,6 +52,7 @@ -behaviour(gen_mod). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("adhoc.hrl"). diff --git a/src/mod_pubsub/Makefile.in b/src/mod_pubsub/Makefile.in deleted file mode 100644 index 88bf2ba0c..000000000 --- a/src/mod_pubsub/Makefile.in +++ /dev/null @@ -1,46 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -OUTDIR = .. -ERLBEHAVS = gen_pubsub_node.erl gen_pubsub_nodetree.erl -SOURCES_ALL = $(wildcard *.erl) -SOURCES = $(filter-out $(ERLBEHAVS),$(SOURCES_ALL)) -ERLBEHAVBEAMS = $(addprefix $(OUTDIR)/,$(ERLBEHAVS:.erl=.beam)) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: mod_pubsub_odbc.erl $(ERLBEHAVBEAMS) $(BEAMS) - -$(BEAMS): $(ERLBEHAVBEAMS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -clean: - rm -f $(BEAMS) - -distclean: clean - rm -f Makefile - -mod_pubsub_odbc.erl: - patch -o mod_pubsub_odbc.erl mod_pubsub.erl pubsub_odbc.patch - -TAGS: - etags *.erl - diff --git a/src/mod_pubsub/Makefile.win32 b/src/mod_pubsub/Makefile.win32 deleted file mode 100644 index 8308f242a..000000000 --- a/src/mod_pubsub/Makefile.win32 +++ /dev/null @@ -1,87 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\gen_pubsub_node.beam ..\gen_pubsub_nodetree.beam ..\mod_pubsub.beam ..\mod_pubsub_odbc.beam ..\node_buddy.beam ..\node_club.beam ..\node_dag.beam ..\node_dispatch.beam ..\node_flat.beam ..\node_flat_odbc.beam ..\node_hometree.beam ..\node_hometree_odbc.beam ..\node_mb.beam ..\node_pep.beam ..\node_pep_odbc.beam ..\node_private.beam ..\node_public.beam ..\nodetree_dag.beam ..\nodetree_tree.beam ..\nodetree_tree_odbc.beam ..\nodetree_virtual.beam ..\pubsub_db_odbc.beam ..\pubsub_index.beam ..\pubsub_subscription.beam ..\pubsub_subscription_odbc.beam - -ALL : $(BEAMS) - -CLEAN : - -@erase $(BEAMS) - -$(OUTDIR)\gen_pubsub_node.beam : gen_pubsub_node.erl - erlc -W $(EFLAGS) -o $(OUTDIR) gen_pubsub_node.erl - -$(OUTDIR)\gen_pubsub_nodetree.beam : gen_pubsub_nodetree.erl - erlc -W $(EFLAGS) -o $(OUTDIR) gen_pubsub_nodetree.erl - -$(OUTDIR)\mod_pubsub.beam : mod_pubsub.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_pubsub.erl - -$(OUTDIR)\mod_pubsub_odbc.beam : mod_pubsub_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_pubsub_odbc.erl - -$(OUTDIR)\node_buddy.beam : node_buddy.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_buddy.erl - -$(OUTDIR)\node_club.beam : node_club.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_club.erl - -$(OUTDIR)\node_dag.beam : node_dag.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_dag.erl - -$(OUTDIR)\node_dispatch.beam : node_dispatch.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_dispatch.erl - -$(OUTDIR)\node_flat.beam : node_flat.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_flat.erl - -$(OUTDIR)\node_flat_odbc.beam : node_flat_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_flat_odbc.erl - -$(OUTDIR)\node_hometree.beam : node_hometree.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_hometree.erl - -$(OUTDIR)\node_hometree_odbc.beam : node_hometree_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_hometree_odbc.erl - -$(OUTDIR)\node_mb.beam : node_mb.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_mb.erl - -$(OUTDIR)\node_pep.beam : node_pep.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_pep.erl - -$(OUTDIR)\node_pep_odbc.beam : node_pep_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_pep_odbc.erl - -$(OUTDIR)\node_private.beam : node_private.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_private.erl - -$(OUTDIR)\node_public.beam : node_public.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_public.erl - -$(OUTDIR)\nodetree_dag.beam : nodetree_dag.erl - erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_dag.erl - -$(OUTDIR)\nodetree_tree.beam : nodetree_tree.erl - erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_tree.erl - -$(OUTDIR)\nodetree_tree_odbc.beam : nodetree_tree_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_tree_odbc.erl - -$(OUTDIR)\nodetree_virtual.beam : nodetree_virtual.erl - erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_virtual.erl - -$(OUTDIR)\pubsub_db_odbc.beam : pubsub_db_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) pubsub_db_odbc.erl - -$(OUTDIR)\pubsub_index.beam : pubsub_index.erl - erlc -W $(EFLAGS) -o $(OUTDIR) pubsub_index.erl - -$(OUTDIR)\pubsub_subscription.beam : pubsub_subscription.erl - erlc -W $(EFLAGS) -o $(OUTDIR) pubsub_subscription.erl - -$(OUTDIR)\pubsub_subscription_odbc.beam : pubsub_subscription_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) pubsub_subscription_odbc.erl diff --git a/src/mod_pubsub_ng/Makefile.in b/src/mod_pubsub_ng/Makefile.in deleted file mode 100644 index 9a114a1a3..000000000 --- a/src/mod_pubsub_ng/Makefile.in +++ /dev/null @@ -1,62 +0,0 @@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -OUTDIR = .. -ERLBEHAVS = gen_pubsub_node.erl gen_pubsub_nodetree.erl -SOURCES_ALL = $(wildcard *.erl) -SOURCES = $(filter-out $(ERLBEHAVS),$(SOURCES_ALL)) -ERLBEHAVBEAMS = $(addprefix $(OUTDIR)/,$(ERLBEHAVS:.erl=.beam)) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(ERLBEHAVBEAMS) $(BEAMS) - -$(BEAMS): $(ERLBEHAVBEAMS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -clean: - rm -f $(BEAMS) - -distclean: clean - rm -f Makefile - - - -TAGS: - etags *.erl - - -DEVDOCDIR=../../doc/devdoc -DDTDIR=.. -HTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.html) -ERLHTMLS = $(SOURCES:%.erl=../../doc/devdoc/%.erl.html) -SVGS = $(SOURCES:%.erl=../../doc/devdoc/%.svg) - -devdoc: $(HTMLS) $(ERLHTMLS) $(SVGS) - -$(DEVDOCDIR)/%.erl.html: %.erl - @ERL@ -noshell -pa $(DEVDOCDIR) -run escobar_run file $< $(DDTDIR) -s init stop - -$(DEVDOCDIR)/%.html: %.erl - @ERL@ -noshell -run edoc_run file $< \ - '[{dir,"$(DDTDIR)"},{packages,false},{todo,true},{private,true},{def,{vsn,"$(VSN)"}},{stylesheet,"process-one.css"},{overview,"overview.edoc"}]' -s init stop - -$(DEVDOCDIR)/%.svg: %.erl - @ERL@ -noshell -pa $(DEVDOCDIR) -run funrelg dir $< $(DDTDIR) -s init stop - diff --git a/src/mod_pubsub_ng/Makefile.win32 b/src/mod_pubsub_ng/Makefile.win32 deleted file mode 100644 index 6d5707b23..000000000 --- a/src/mod_pubsub_ng/Makefile.win32 +++ /dev/null @@ -1,88 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\exmpp_pubsub.beam ..\pubsub_disco.beam ..\mod_pubsub_dev.beam ..\pubsub_hooks.beam ..\mod_pubsub_odbc.beam ..\pubsub_index_dev.beam ..\pubsub_broadcast.beam ..\pubsub_options.beam ..\pubsub_core.beam ..\pubsub_parser.beam ..\pubsub_db.beam ..\xmpp_xdata.beam ..\pubsub_db_mnesia.beam - - -ALL : $(BEAMS) - -CLEAN : - -@erase $(BEAMS) - -$(OUTDIR)\gen_pubsub_node.beam : gen_pubsub_node.erl - erlc -W $(EFLAGS) -o $(OUTDIR) gen_pubsub_node.erl - -$(OUTDIR)\gen_pubsub_nodetree.beam : gen_pubsub_nodetree.erl - erlc -W $(EFLAGS) -o $(OUTDIR) gen_pubsub_nodetree.erl - -$(OUTDIR)\mod_pubsub.beam : mod_pubsub.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_pubsub.erl - -$(OUTDIR)\mod_pubsub_odbc.beam : mod_pubsub_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_pubsub_odbc.erl - -$(OUTDIR)\node_buddy.beam : node_buddy.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_buddy.erl - -$(OUTDIR)\node_club.beam : node_club.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_club.erl - -$(OUTDIR)\node_dag.beam : node_dag.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_dag.erl - -$(OUTDIR)\node_dispatch.beam : node_dispatch.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_dispatch.erl - -$(OUTDIR)\node_flat.beam : node_flat.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_flat.erl - -$(OUTDIR)\node_flat_odbc.beam : node_flat_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_flat_odbc.erl - -$(OUTDIR)\node_hometree.beam : node_hometree.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_hometree.erl - -$(OUTDIR)\node_hometree_odbc.beam : node_hometree_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_hometree_odbc.erl - -$(OUTDIR)\node_mb.beam : node_mb.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_mb.erl - -$(OUTDIR)\node_pep.beam : node_pep.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_pep.erl - -$(OUTDIR)\node_pep_odbc.beam : node_pep_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_pep_odbc.erl - -$(OUTDIR)\node_private.beam : node_private.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_private.erl - -$(OUTDIR)\node_public.beam : node_public.erl - erlc -W $(EFLAGS) -o $(OUTDIR) node_public.erl - -$(OUTDIR)\nodetree_dag.beam : nodetree_dag.erl - erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_dag.erl - -$(OUTDIR)\nodetree_tree.beam : nodetree_tree.erl - erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_tree.erl - -$(OUTDIR)\nodetree_tree_odbc.beam : nodetree_tree_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_tree_odbc.erl - -$(OUTDIR)\nodetree_virtual.beam : nodetree_virtual.erl - erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_virtual.erl - -$(OUTDIR)\pubsub_db_odbc.beam : pubsub_db_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) pubsub_db_odbc.erl - -$(OUTDIR)\pubsub_index.beam : pubsub_index.erl - erlc -W $(EFLAGS) -o $(OUTDIR) pubsub_index.erl - -$(OUTDIR)\pubsub_subscription.beam : pubsub_subscription.erl - erlc -W $(EFLAGS) -o $(OUTDIR) pubsub_subscription.erl - -$(OUTDIR)\pubsub_subscription_odbc.beam : pubsub_subscription_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) pubsub_subscription_odbc.erl diff --git a/src/mod_pubsub/mod_pubsub_odbc.erl b/src/mod_pubsub_odbc.erl similarity index 99% rename from src/mod_pubsub/mod_pubsub_odbc.erl rename to src/mod_pubsub_odbc.erl index 956272a90..2197606ef 100644 --- a/src/mod_pubsub/mod_pubsub_odbc.erl +++ b/src/mod_pubsub_odbc.erl @@ -52,6 +52,7 @@ -behaviour(gen_mod). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("adhoc.hrl"). diff --git a/src/mod_register.erl b/src/mod_register.erl index 348c7cc25..66209bed3 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -35,6 +35,7 @@ process_iq/3, send_registration_notifications/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/web/mod_register_web.erl b/src/mod_register_web.erl similarity index 99% rename from src/web/mod_register_web.erl rename to src/mod_register_web.erl index ad9473825..605ded360 100644 --- a/src/web/mod_register_web.erl +++ b/src/mod_register_web.erl @@ -59,6 +59,7 @@ -export([start/2, stop/1, process/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_roster.erl b/src/mod_roster.erl index b15b2ed86..eb22194f6 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -53,14 +53,15 @@ -export([create_rosters/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("web/ejabberd_http.hrl"). +-include("ejabberd_http.hrl"). --include("web/ejabberd_web_admin.hrl"). +-include("ejabberd_web_admin.hrl"). -export_type([subscription/0]). diff --git a/src/mod_service_log.erl b/src/mod_service_log.erl index 35e01cde5..b20e93bb1 100644 --- a/src/mod_service_log.erl +++ b/src/mod_service_log.erl @@ -34,6 +34,7 @@ log_user_receive/5]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl index 59ebf1ad8..a7dd7f1ff 100644 --- a/src/mod_shared_roster.erl +++ b/src/mod_shared_roster.erl @@ -46,14 +46,15 @@ command_list_users/2, command_list_groups/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("web/ejabberd_http.hrl"). +-include("ejabberd_http.hrl"). --include("web/ejabberd_web_admin.hrl"). +-include("ejabberd_web_admin.hrl"). -include("ejabberd_commands.hrl"). diff --git a/src/mod_shared_roster_ldap.erl b/src/mod_shared_roster_ldap.erl index c4b3c2f06..95b33fa91 100644 --- a/src/mod_shared_roster_ldap.erl +++ b/src/mod_shared_roster_ldap.erl @@ -43,10 +43,11 @@ out_subscription/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("eldap/eldap.hrl"). +-include("eldap.hrl"). -define(CACHE_SIZE, 1000). diff --git a/src/mod_sic.erl b/src/mod_sic.erl index fbaa165e8..b1ae44d04 100644 --- a/src/mod_sic.erl +++ b/src/mod_sic.erl @@ -34,6 +34,7 @@ process_sm_iq/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_stats.erl b/src/mod_stats.erl index f988626fd..a35928975 100644 --- a/src/mod_stats.erl +++ b/src/mod_stats.erl @@ -33,6 +33,7 @@ -export([start/2, stop/1, process_local_iq/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). start(Host, Opts) -> diff --git a/src/mod_time.erl b/src/mod_time.erl index e97616a6e..0e18d7efe 100644 --- a/src/mod_time.erl +++ b/src/mod_time.erl @@ -36,6 +36,7 @@ % TODO: Remove once XEP-0090 is Obsolete -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index 78e9db2b9..877080bc3 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -35,6 +35,7 @@ remove_user/2, export/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl index be9bc7c53..7711353d2 100644 --- a/src/mod_vcard_ldap.erl +++ b/src/mod_vcard_ldap.erl @@ -41,8 +41,9 @@ remove_user/1, route/4]). -include("ejabberd.hrl"). +-include("logger.hrl"). --include("eldap/eldap.hrl"). +-include("eldap.hrl"). -include("jlib.hrl"). diff --git a/src/mod_vcard_xupdate.erl b/src/mod_vcard_xupdate.erl index 3fbe23155..7d06a15a5 100644 --- a/src/mod_vcard_xupdate.erl +++ b/src/mod_vcard_xupdate.erl @@ -16,6 +16,7 @@ -export([update_presence/3, vcard_set/3, export/1]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_version.erl b/src/mod_version.erl index 088961a6b..a36f62889 100644 --- a/src/mod_version.erl +++ b/src/mod_version.erl @@ -33,6 +33,7 @@ -export([start/2, stop/1, process_local_iq/3]). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). diff --git a/src/mod_pubsub/node.template b/src/node.template similarity index 100% rename from src/mod_pubsub/node.template rename to src/node.template diff --git a/src/mod_pubsub/node_buddy.erl b/src/node_buddy.erl similarity index 100% rename from src/mod_pubsub/node_buddy.erl rename to src/node_buddy.erl diff --git a/src/mod_pubsub/node_club.erl b/src/node_club.erl similarity index 100% rename from src/mod_pubsub/node_club.erl rename to src/node_club.erl diff --git a/src/mod_pubsub/node_dag.erl b/src/node_dag.erl similarity index 100% rename from src/mod_pubsub/node_dag.erl rename to src/node_dag.erl diff --git a/src/mod_pubsub/node_dispatch.erl b/src/node_dispatch.erl similarity index 100% rename from src/mod_pubsub/node_dispatch.erl rename to src/node_dispatch.erl diff --git a/src/mod_pubsub/node_flat.erl b/src/node_flat.erl similarity index 100% rename from src/mod_pubsub/node_flat.erl rename to src/node_flat.erl diff --git a/src/mod_pubsub/node_flat_odbc.erl b/src/node_flat_odbc.erl similarity index 100% rename from src/mod_pubsub/node_flat_odbc.erl rename to src/node_flat_odbc.erl diff --git a/src/mod_pubsub/node_hometree.erl b/src/node_hometree.erl similarity index 100% rename from src/mod_pubsub/node_hometree.erl rename to src/node_hometree.erl diff --git a/src/mod_pubsub/node_hometree_odbc.erl b/src/node_hometree_odbc.erl similarity index 100% rename from src/mod_pubsub/node_hometree_odbc.erl rename to src/node_hometree_odbc.erl diff --git a/src/mod_pubsub/node_mb.erl b/src/node_mb.erl similarity index 99% rename from src/mod_pubsub/node_mb.erl rename to src/node_mb.erl index 528974b3d..8f74d9837 100644 --- a/src/mod_pubsub/node_mb.erl +++ b/src/node_mb.erl @@ -37,6 +37,7 @@ -author('eric@ohmforce.com'). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("pubsub.hrl"). diff --git a/src/mod_pubsub/node_pep.erl b/src/node_pep.erl similarity index 99% rename from src/mod_pubsub/node_pep.erl rename to src/node_pep.erl index d8e69d246..f347aa1b6 100644 --- a/src/mod_pubsub/node_pep.erl +++ b/src/node_pep.erl @@ -31,6 +31,7 @@ -author('christophe.romain@process-one.net'). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("pubsub.hrl"). diff --git a/src/mod_pubsub/node_pep_odbc.erl b/src/node_pep_odbc.erl similarity index 99% rename from src/mod_pubsub/node_pep_odbc.erl rename to src/node_pep_odbc.erl index 029635cc9..dcbaeae3d 100644 --- a/src/mod_pubsub/node_pep_odbc.erl +++ b/src/node_pep_odbc.erl @@ -31,6 +31,7 @@ -author('christophe.romain@process-one.net'). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("pubsub.hrl"). diff --git a/src/mod_pubsub/node_private.erl b/src/node_private.erl similarity index 100% rename from src/mod_pubsub/node_private.erl rename to src/node_private.erl diff --git a/src/mod_pubsub/node_public.erl b/src/node_public.erl similarity index 100% rename from src/mod_pubsub/node_public.erl rename to src/node_public.erl diff --git a/src/mod_pubsub/nodetree_dag.erl b/src/nodetree_dag.erl similarity index 99% rename from src/mod_pubsub/nodetree_dag.erl rename to src/nodetree_dag.erl index 7123df5c2..03dc71259 100644 --- a/src/mod_pubsub/nodetree_dag.erl +++ b/src/nodetree_dag.erl @@ -29,6 +29,7 @@ -include_lib("stdlib/include/qlc.hrl"). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("pubsub.hrl"). diff --git a/src/mod_pubsub/nodetree_tree.erl b/src/nodetree_tree.erl similarity index 100% rename from src/mod_pubsub/nodetree_tree.erl rename to src/nodetree_tree.erl diff --git a/src/mod_pubsub/nodetree_tree_odbc.erl b/src/nodetree_tree_odbc.erl similarity index 100% rename from src/mod_pubsub/nodetree_tree_odbc.erl rename to src/nodetree_tree_odbc.erl diff --git a/src/mod_pubsub/nodetree_virtual.erl b/src/nodetree_virtual.erl similarity index 100% rename from src/mod_pubsub/nodetree_virtual.erl rename to src/nodetree_virtual.erl diff --git a/src/odbc/Makefile.in b/src/odbc/Makefile.in deleted file mode 100644 index 3f4898d3a..000000000 --- a/src/odbc/Makefile.in +++ /dev/null @@ -1,38 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(BEAMS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -D@db_type@ -o $(OUTDIR) $< - -clean: - rm -f $(BEAMS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl - diff --git a/src/odbc/Makefile.win32 b/src/odbc/Makefile.win32 deleted file mode 100644 index 2775468b7..000000000 --- a/src/odbc/Makefile.win32 +++ /dev/null @@ -1,22 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\ejabberd_odbc.beam ..\ejabberd_odbc_sup.beam ..\odbc_queries.beam - -ALL : $(BEAMS) - -CLEAN : - -@erase $(BEAMS) - -$(OUTDIR)\ejabberd_odbc.beam : ejabberd_odbc.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_odbc.erl - -$(OUTDIR)\ejabberd_odbc_sup.beam : ejabberd_odbc_sup.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_odbc_sup.erl - -$(OUTDIR)\odbc_queries.beam : odbc_queries.erl - erlc -W $(EFLAGS) -o $(OUTDIR) -D$(DBTYPE) odbc_queries.erl - diff --git a/src/odbc/odbc_queries.erl b/src/odbc_queries.erl similarity index 99% rename from src/odbc/odbc_queries.erl rename to src/odbc_queries.erl index b29d054aa..7c92d9a0c 100644 --- a/src/odbc/odbc_queries.erl +++ b/src/odbc_queries.erl @@ -67,6 +67,7 @@ -endif. -include("ejabberd.hrl"). +-include("logger.hrl"). join([], _Sep) -> []; join([H | T], Sep) -> [H, [[Sep, X] || X <- T]]. diff --git a/src/pam/Makefile.in b/src/pam/Makefile.in deleted file mode 100644 index bde289402..000000000 --- a/src/pam/Makefile.in +++ /dev/null @@ -1,47 +0,0 @@ -# $Id: Makefile.in 775 2007-05-29 14:31:12Z mremond $ - -CC = @CC@ -CFLAGS = @CFLAGS@ @PAM_CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ @PAM_LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -ERLSHLIBS = ../epam -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(BEAMS) $(ERLSHLIBS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -#all: $(ERLSHLIBS) -# erl -s make all report "{outdir, \"..\"}" -noinput -s erlang halt - -$(ERLSHLIBS): ../%: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ - $(subst ../,,$(subst ,.c,$@)) $(LIBS) \ - $(ERLANG_LIBS) $(ERLANG_CFLAGS) \ - -o $@ -lpthread - -clean: - rm -f $(BEAMS) $(ERLSHLIBS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl diff --git a/src/pam/epam.c b/src/pam/epam.c deleted file mode 100644 index 505e308cf..000000000 --- a/src/pam/epam.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * ejabberd, Copyright (C) 2002-2013 ProcessOne - * - * 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 - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#define dec_int16(s) ((((unsigned char*) (s))[0] << 8) | \ - (((unsigned char*) (s))[1])) - -#define enc_int16(i, s) {((unsigned char*)(s))[0] = ((i) >> 8) & 0xff; \ - ((unsigned char*)(s))[1] = (i) & 0xff;} - -#define BUFSIZE (1 << 16) -#define CMD_AUTH 0 -#define CMD_ACCT 1 - -typedef unsigned char byte; - -#ifdef PAM_FAIL_DELAY -static void delay_fn(int retval, unsigned usec_delay, void *appdata_ptr) -{ - /* No delay. However, looks like some PAM modules ignore this */ -} -#endif - -static int misc_conv(int num_msg, - const struct pam_message **msg, - struct pam_response **resp, - void *password) -{ - int msg_style; - if (num_msg != 1) - return PAM_CONV_ERR; - msg_style = msg[0]->msg_style; - if ((msg_style != PAM_PROMPT_ECHO_OFF) && (msg_style != PAM_PROMPT_ECHO_ON)) - return PAM_CONV_ERR; - *resp = malloc(sizeof(struct pam_response)); - (*resp)[0].resp_retcode = 0; - (*resp)[0].resp = strdup(password); - return PAM_SUCCESS; -} - -static int auth(char *service, char *user, char *password) -{ - struct pam_conv conv = {misc_conv, password}; - int retval; - pam_handle_t *pamh = NULL; - retval = pam_start(service, user, &conv, &pamh); - if (retval == PAM_SUCCESS) - retval = pam_set_item(pamh, PAM_RUSER, user); -#ifdef PAM_FAIL_DELAY - if (retval == PAM_SUCCESS) - retval = pam_set_item(pamh, PAM_FAIL_DELAY, (void *)delay_fn); -#endif - if (retval == PAM_SUCCESS) - retval = pam_authenticate(pamh, 0); - if (retval == PAM_SUCCESS) - retval = pam_acct_mgmt(pamh, 0); - pam_end(pamh, retval); - return retval; -} - -static int acct_mgmt(char *service, char *user) -{ - struct pam_conv conv = {misc_conv, NULL}; - int retval; - pam_handle_t *pamh = NULL; - retval = pam_start(service, user, &conv, &pamh); - if (retval == PAM_SUCCESS) - retval = pam_set_item(pamh, PAM_RUSER, user); -#ifdef PAM_FAIL_DELAY - if (retval == PAM_SUCCESS) - retval = pam_set_item(pamh, PAM_FAIL_DELAY, (void *)delay_fn); -#endif - if (retval == PAM_SUCCESS) - retval = pam_acct_mgmt(pamh, 0); - pam_end(pamh, retval); - return retval; -} - -static int read_buf(int fd, byte *buf, int len) -{ - int i, got = 0; - do { - if ((i = read(fd, buf+got, len-got)) <= 0) { - if (i == 0) return got; - if (errno != EINTR) - return got; - i = 0; - } - got += i; - } while (got < len); - return (len); -} - -static int read_cmd(byte *buf) -{ - int len; - if (read_buf(0, buf, 2) != 2) - return 0; - len = dec_int16(buf); - if (read_buf(0, buf, len) != len) - return 0; - return 1; -} - -static int write_buf(int fd, char *buf, int len) -{ - int i, done = 0; - do { - if ((i = write(fd, buf+done, len-done)) < 0) { - if (errno != EINTR) - return (i); - i = 0; - } - done += i; - } while (done < len); - return (len); -} - -static int write_cmd(char *buf, int len) -{ - byte hd[2]; - enc_int16(len, hd); - if (write_buf(1, (char *)hd, 2) != 2) - return 0; - if (write_buf(1, buf, len) != len) - return 0; - return 1; -} - -static int process_reply(ETERM *pid, int cmd, int res) -{ - ETERM *result; - ETERM *errbin; - int len, retval; - const char *errtxt; - byte *buf; - if (res == PAM_SUCCESS) - result = erl_format("{~i, ~w, true}", cmd, pid); - else - { - errtxt = pam_strerror(NULL, res); - errbin = erl_mk_binary(errtxt, strlen(errtxt)); - result = erl_format("{~i, ~w, {false, ~w}}", cmd, pid, errbin); - erl_free_term(errbin); - } - len = erl_term_len(result); - buf = erl_malloc(len); - erl_encode(result, buf); - retval = write_cmd((char *)buf, len); - erl_free_term(result); - erl_free(buf); - return retval; -} - -static int process_acct(ETERM *pid, ETERM *data) -{ - int retval = 0; - ETERM *pattern, *srv, *user; - char *service, *username; - pattern = erl_format("{Srv, User}"); - if (erl_match(pattern, data)) - { - srv = erl_var_content(pattern, "Srv"); - service = erl_iolist_to_string(srv); - user = erl_var_content(pattern, "User"); - username = erl_iolist_to_string(user); - retval = process_reply(pid, CMD_ACCT, acct_mgmt(service, username)); - erl_free_term(srv); - erl_free_term(user); - erl_free(service); - erl_free(username); - } - erl_free_term(pattern); - return retval; -} - -static int process_auth(ETERM *pid, ETERM *data) -{ - int retval = 0; - ETERM *pattern, *srv, *user, *pass; - char *service, *username, *password; - pattern = erl_format("{Srv, User, Pass}"); - if (erl_match(pattern, data)) - { - srv = erl_var_content(pattern, "Srv"); - service = erl_iolist_to_string(srv); - user = erl_var_content(pattern, "User"); - username = erl_iolist_to_string(user); - pass = erl_var_content(pattern, "Pass"); - password = erl_iolist_to_string(pass); - retval = process_reply(pid, CMD_AUTH, auth(service, username, password)); - erl_free_term(srv); - erl_free_term(user); - erl_free_term(pass); - erl_free(service); - erl_free(username); - erl_free(password); - }; - erl_free_term(pattern); - return retval; -} - -static int process_command(byte *buf) -{ - int retval = 0; - ETERM *pattern, *tuple, *cmd, *port, *data; - pattern = erl_format("{Cmd, Port, Data}"); - tuple = erl_decode(buf); - if (erl_match(pattern, tuple)) - { - cmd = erl_var_content(pattern, "Cmd"); - port = erl_var_content(pattern, "Port"); - data = erl_var_content(pattern, "Data"); - switch (ERL_INT_VALUE(cmd)) - { - case CMD_AUTH: - retval = process_auth(port, data); - break; - case CMD_ACCT: - retval = process_acct(port, data); - break; - }; - erl_free_term(cmd); - erl_free_term(port); - erl_free_term(data); - } - erl_free_term(pattern); - erl_free_term(tuple); - return retval; -} - -static void loop(void) -{ - byte buf[BUFSIZE]; - int retval = 0; - do { - if (read_cmd(buf) > 0) - retval = process_command(buf); - else - retval = 0; - } while (retval); -} - -int main(int argc, char *argv[]) -{ - erl_init(NULL, 0); - loop(); - return 0; -} diff --git a/src/pam/epam.erl b/src/pam/epam.erl deleted file mode 100644 index 93b156b10..000000000 --- a/src/pam/epam.erl +++ /dev/null @@ -1,142 +0,0 @@ -%%%------------------------------------------------------------------- -%%% File : epam.erl -%%% Author : Evgeniy Khramtsov -%%% Purpose : PAM authentication and accounting management -%%% Created : 5 Jul 2007 by Evgeniy Khramtsov -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%------------------------------------------------------------------- - --module(epam). - --author('xram@jabber.ru'). - --behaviour(gen_server). - --include_lib("kernel/include/file.hrl"). - --include("ejabberd.hrl"). - -%% API --export([start_link/0, start/0, stop/0]). - --export([authenticate/3, acct_mgmt/2]). - -%% gen_server callbacks --export([init/1, handle_call/3, handle_cast/2, - handle_info/2, terminate/2, code_change/3]). - --define(WARNING, - "File ~p is world-wide executable. This " - "is a possible security hole in your " - "system. This file must be setted root " - "on execution and only ejabberd must " - "be able to read/execute it. You have " - "been warned :)"). - --define(PROCNAME, ?MODULE). - --define(CMD_AUTH, 0). - --define(CMD_ACCT, 1). - --record(state, {port}). - -start() -> - ChildSpec = {?PROCNAME, {?MODULE, start_link, []}, - transient, 1000, worker, [?MODULE]}, - supervisor:start_child(ejabberd_sup, ChildSpec). - -stop() -> - gen_server:call(?PROCNAME, stop), - supervisor:terminate_child(ejabberd_sup, ?PROCNAME), - supervisor:delete_child(ejabberd_sup, ?PROCNAME). - -start_link() -> - gen_server:start_link({local, ?PROCNAME}, ?MODULE, [], - []). - -authenticate(Srv, User, Pass) - when is_binary(Srv), is_binary(User), is_binary(Pass) -> - gen_server:call(?PROCNAME, - {authenticate, Srv, User, Pass}). - -acct_mgmt(Srv, User) - when is_binary(Srv), is_binary(User) -> - gen_server:call(?PROCNAME, {acct_mgmt, Srv, User}). - -init([]) -> - FileName = filename:join(ejabberd:get_bin_path(), - "epam"), - case file:read_file_info(FileName) of - {ok, Info} -> - Mode = Info#file_info.mode band 2049, - if Mode == 2049 -> ?WARNING_MSG((?WARNING), [FileName]); - true -> ok - end, - Port = open_port({spawn, FileName}, - [{packet, 2}, binary, exit_status]), - {ok, #state{port = Port}}; - {error, Reason} -> - ?ERROR_MSG("Can't open file ~p: ~p", - [FileName, Reason]), - error - end. - -terminate(_Reason, #state{port = Port}) -> - catch port_close(Port), ok. - -handle_call({authenticate, Srv, User, Pass}, From, - State) -> - Port = State#state.port, - Data = term_to_binary({?CMD_AUTH, From, - {Srv, User, Pass}}), - port_command(Port, Data), - {noreply, State}; -handle_call({acct_mgmt, Srv, User}, From, State) -> - Port = State#state.port, - Data = term_to_binary({?CMD_ACCT, From, {Srv, User}}), - port_command(Port, Data), - {noreply, State}; -handle_call(stop, _From, State) -> - {stop, normal, ok, State}; -handle_call(_Request, _From, State) -> - {reply, bad_request, State}. - -handle_info({Port, {data, Data}}, - #state{port = Port} = State) -> - case binary_to_term(Data) of - {Cmd, To, Reply} - when Cmd == (?CMD_AUTH); Cmd == (?CMD_ACCT) -> - gen_server:reply(To, Reply); - Err -> - ?ERROR_MSG("Got invalid reply from ~p: ~p", [Port, Err]) - end, - {noreply, State}; -handle_info({Port, {exit_status, _}}, - #state{port = Port} = State) -> - {stop, port_died, State}; -handle_info(Msg, State) -> - ?WARNING_MSG("Got unexpected message: ~p", [Msg]), - {noreply, State}. - -handle_cast(_Msg, State) -> {noreply, State}. - -code_change(_OldVsn, State, _Extra) -> {ok, State}. diff --git a/src/web/pshb_http.erl b/src/pshb_http.erl similarity index 99% rename from src/web/pshb_http.erl rename to src/pshb_http.erl index 63f53e340..a3fab7fc2 100644 --- a/src/web/pshb_http.erl +++ b/src/pshb_http.erl @@ -41,12 +41,13 @@ -compile({no_auto_import, [{error, 1}]}). -include("ejabberd.hrl"). +-include("logger.hrl"). -include("jlib.hrl"). -include("ejabberd_http.hrl"). --include("mod_pubsub/pubsub.hrl"). +-include("pubsub.hrl"). -export([process/2]). diff --git a/src/mod_pubsub/pubsub_db_odbc.erl b/src/pubsub_db_odbc.erl similarity index 100% rename from src/mod_pubsub/pubsub_db_odbc.erl rename to src/pubsub_db_odbc.erl diff --git a/src/mod_pubsub/pubsub_debug.erl b/src/pubsub_debug.erl similarity index 100% rename from src/mod_pubsub/pubsub_debug.erl rename to src/pubsub_debug.erl diff --git a/src/mod_pubsub/pubsub_index.erl b/src/pubsub_index.erl similarity index 100% rename from src/mod_pubsub/pubsub_index.erl rename to src/pubsub_index.erl diff --git a/src/mod_pubsub/pubsub_odbc.patch b/src/pubsub_odbc.patch similarity index 100% rename from src/mod_pubsub/pubsub_odbc.patch rename to src/pubsub_odbc.patch diff --git a/src/mod_pubsub/pubsub_subscription.erl b/src/pubsub_subscription.erl similarity index 100% rename from src/mod_pubsub/pubsub_subscription.erl rename to src/pubsub_subscription.erl diff --git a/src/mod_pubsub/pubsub_subscription_odbc.erl b/src/pubsub_subscription_odbc.erl similarity index 100% rename from src/mod_pubsub/pubsub_subscription_odbc.erl rename to src/pubsub_subscription_odbc.erl diff --git a/src/sha.erl b/src/sha.erl deleted file mode 100644 index fd8391c25..000000000 --- a/src/sha.erl +++ /dev/null @@ -1,113 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : sha.erl -%%% Author : Alexey Shchepin -%%% Purpose : -%%% Created : 20 Dec 2002 by Alexey Shchepin -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(sha). - --author('alexey@process-one.net'). - --export([start/0, sha/1, sha1/1, sha224/1, sha256/1, - sha384/1, sha512/1, to_hexlist/1]). - --ifdef(HAVE_MD2). - --export([md2/1]). - --endif. - --include("ejabberd.hrl"). - --define(DRIVER, sha_drv). - -start() -> - crypto:start(), - Res = case erl_ddll:load_driver(ejabberd:get_so_path(), - ?DRIVER) - of - ok -> ok; - {error, already_loaded} -> ok; - Err -> Err - end, - case Res of - ok -> - Port = open_port({spawn, atom_to_list(?DRIVER)}, - [binary]), - register(?DRIVER, Port); - {error, Reason} -> - ?CRITICAL_MSG("unable to load driver '~s': ~s", - [driver_path(), erl_ddll:format_error(Reason)]) - end. - -digit_to_xchar(D) when (D >= 0) and (D < 10) -> D + 48; -digit_to_xchar(D) -> D + 87. - --spec sha(binary()) -> binary(). - -sha(Text) -> - Bin = crypto:sha(Text), - to_hexlist(Bin). - --spec to_hexlist(binary()) -> binary(). - -to_hexlist(Bin) -> - iolist_to_binary(lists:reverse(ints_to_rxstr(binary_to_list(Bin), []))). - -ints_to_rxstr([], Res) -> Res; -ints_to_rxstr([N | Ns], Res) -> - ints_to_rxstr(Ns, - [digit_to_xchar(N rem 16), digit_to_xchar(N div 16) - | Res]). - --spec sha1(binary()) -> binary(). --spec sha224(binary()) -> binary(). --spec sha256(binary()) -> binary(). --spec sha384(binary()) -> binary(). --spec sha512(binary()) -> binary(). - -sha1(Text) -> crypto:sha(Text). - -sha224(Text) -> erlang:port_control(?DRIVER, 224, Text). - -sha256(Text) -> erlang:port_control(?DRIVER, 256, Text). - -sha384(Text) -> erlang:port_control(?DRIVER, 384, Text). - -sha512(Text) -> erlang:port_control(?DRIVER, 512, Text). - --ifdef(HAVE_MD2). - --spec md2(binary()) -> binary(). - -md2(Text) -> erlang:port_control(?DRIVER, 2, Text). - --endif. - -driver_path() -> - Suffix = case os:type() of - {win32, _} -> ".dll"; - _ -> ".so" - end, - filename:join(ejabberd:get_so_path(), - atom_to_list(?DRIVER) ++ Suffix). diff --git a/src/shaper.erl b/src/shaper.erl index c86acd701..37c1a30c9 100644 --- a/src/shaper.erl +++ b/src/shaper.erl @@ -31,6 +31,7 @@ -export([new/1, new1/1, update/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). -record(maxrate, {maxrate = 0 :: integer(), lastrate = 0.0 :: float(), diff --git a/src/web/simple_ws_check.erl b/src/simple_ws_check.erl similarity index 96% rename from src/web/simple_ws_check.erl rename to src/simple_ws_check.erl index d897b1ecc..b06dbd5d7 100644 --- a/src/web/simple_ws_check.erl +++ b/src/simple_ws_check.erl @@ -3,6 +3,7 @@ -export([is_acceptable/6]). -include("ejabberd.hrl"). +-include("logger.hrl"). is_acceptable([<<"true">>] = Path, Q, Origin, Protocol, IP, Headers) -> diff --git a/src/stringprep/Makefile.in b/src/stringprep/Makefile.in deleted file mode 100644 index 7c4997d26..000000000 --- a/src/stringprep/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -# Assume Linux-style dynamic library flags -DYNAMIC_LIB_CFLAGS = -fpic -shared -ifeq ($(shell uname),Darwin) - DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress -endif -ifeq ($(shell uname),SunOs) - DYNAMIC_LIB_CFLAGS = -KPIC -G -z text -endif - - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -ERLSHLIBS = ../stringprep_drv.so -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(BEAMS) $(ERLSHLIBS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -#all: $(ERLSHLIBS) -# erl -s make all report "{outdir, \"..\"}" -noinput -s erlang halt - -$(ERLSHLIBS): ../%.so: %.c uni_data.c uni_norm.c - $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDES) \ - $(subst ../,,$(subst .so,.c,$@)) $(LIBS) \ - $(ERLANG_LIBS) \ - $(ERLANG_CFLAGS) \ - -o $@ \ - $(DYNAMIC_LIB_CFLAGS) - -clean: - rm -f $(BEAMS) $(ERLSHLIBS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl - diff --git a/src/stringprep/Makefile.win32 b/src/stringprep/Makefile.win32 deleted file mode 100644 index b044a105d..000000000 --- a/src/stringprep/Makefile.win32 +++ /dev/null @@ -1,40 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\stringprep.beam ..\stringprep_sup.beam - -SOURCE = stringprep_drv.c -AUXIL = uni_data.c uni_norm.c -OBJECT = stringprep_drv.o -DLL = $(OUTDIR)\stringprep_drv.dll - -ALL : $(DLL) $(BEAMS) - -CLEAN : - -@erase $(DLL) - -@erase $(OUTDIR)\stringprep_drv.exp - -@erase $(OUTDIR)\stringprep_drv.lib - -@erase $(OBJECT) - -@erase $(BEAMS) - -$(OUTDIR)\stringprep.beam : stringprep.erl - erlc -W $(EFLAGS) -o $(OUTDIR) stringprep.erl - -$(OUTDIR)\stringprep_sup.beam : stringprep_sup.erl - erlc -W $(EFLAGS) -o $(OUTDIR) stringprep_sup.erl - -CC=cl.exe -CC_FLAGS=-nologo -D__WIN32__ -DWIN32 -DWINDOWS -D_WIN32 -DNT -MD -Ox -I"$(ERLANG_DIR)\usr\include" -I"$(EI_DIR)\include" - -LD=link.exe -LD_FLAGS=-release -nologo -incremental:no -dll "$(EI_DIR)\lib\ei_md.lib" "$(EI_DIR)\lib\erl_interface_md.lib" MSVCRT.LIB kernel32.lib advapi32.lib gdi32.lib user32.lib comctl32.lib comdlg32.lib shell32.lib - -$(DLL) : $(OBJECT) - $(LD) $(LD_FLAGS) -out:$@ $< - -$(OBJECT) : $(SOURCE) $(AUXIL) - $(CC) $(CC_FLAGS) -c -Fo$@ $< - diff --git a/src/stringprep/stringprep.erl b/src/stringprep/stringprep.erl deleted file mode 100644 index f1ba20258..000000000 --- a/src/stringprep/stringprep.erl +++ /dev/null @@ -1,108 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : stringprep.erl -%%% Author : Alexey Shchepin -%%% Purpose : Interface to stringprep_drv -%%% Created : 16 Feb 2003 by Alexey Shchepin -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(stringprep). - --author('alexey@process-one.net'). - --behaviour(gen_server). - --export([start/0, start_link/0, tolower/1, nameprep/1, - nodeprep/1, resourceprep/1]). - -%% Internal exports, call-back functions. --export([init/1, handle_call/3, handle_cast/2, - handle_info/2, code_change/3, terminate/2]). - --define(STRINGPREP_PORT, stringprep_port). - --define(NAMEPREP_COMMAND, 1). - --define(NODEPREP_COMMAND, 2). - --define(RESOURCEPREP_COMMAND, 3). - -start() -> - gen_server:start({local, ?MODULE}, ?MODULE, [], []). - -start_link() -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [], - []). - -init([]) -> - case erl_ddll:load_driver(ejabberd:get_so_path(), - stringprep_drv) - of - ok -> ok; - {error, already_loaded} -> ok - end, - Port = open_port({spawn, "stringprep_drv"}, []), - register(?STRINGPREP_PORT, Port), - {ok, Port}. - -%%% -------------------------------------------------------- -%%% The call-back functions. -%%% -------------------------------------------------------- - -handle_call(_, _, State) -> {noreply, State}. - -handle_cast(_, State) -> {noreply, State}. - -handle_info({'EXIT', Port, Reason}, Port) -> - {stop, {port_died, Reason}, Port}; -handle_info({'EXIT', _Pid, _Reason}, Port) -> - {noreply, Port}; -handle_info(_, State) -> {noreply, State}. - -code_change(_OldVsn, State, _Extra) -> {ok, State}. - -terminate(_Reason, Port) -> Port ! {self, close}, ok. - --spec tolower(binary()) -> binary() | error. - -tolower(String) -> control(0, String). - --spec nameprep(binary()) -> binary() | error. - -nameprep(String) -> control(?NAMEPREP_COMMAND, String). - --spec nodeprep(binary()) -> binary() | error. - -nodeprep(String) -> control(?NODEPREP_COMMAND, String). - --spec resourceprep(binary()) -> binary() | error. - -resourceprep(String) -> - control(?RESOURCEPREP_COMMAND, String). - -control(Command, String) -> - case port_control(?STRINGPREP_PORT, Command, String) of - <<0, _/binary>> -> error; - <<1, Res/binary>> -> binary:copy(Res) - %% Result is usually a very small binary, that fit into a heap binary. - %% binary:copy() ensure that's the case, instead of keeping a subbinary or - %% refcount binary around - end. diff --git a/src/stringprep/stringprep_drv.c b/src/stringprep/stringprep_drv.c deleted file mode 100644 index cada92372..000000000 --- a/src/stringprep/stringprep_drv.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * ejabberd, Copyright (C) 2002-2013 ProcessOne - * - * 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 - * - */ - -#include -#include -#include -#include - -#include "uni_data.c" -#include "uni_norm.c" - -#define NAMEPREP_COMMAND 1 -#define NODEPREP_COMMAND 2 -#define RESOURCEPREP_COMMAND 3 - -/* - * R15B changed several driver callbacks to use ErlDrvSizeT and - * ErlDrvSSizeT typedefs instead of int. - * This provides missing typedefs on older OTP versions. - */ -#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2 -typedef int ErlDrvSizeT; -typedef int ErlDrvSSizeT; -#endif - -typedef struct { - ErlDrvPort port; -} stringprep_data; - - -static ErlDrvData stringprep_erl_start(ErlDrvPort port, char *buff) -{ - stringprep_data* d = (stringprep_data*)driver_alloc(sizeof(stringprep_data)); - d->port = port; - - set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY); - - return (ErlDrvData)d; -} - -static void stringprep_erl_stop(ErlDrvData handle) -{ - driver_free((char*)handle); -} - - -/* Hangul constants */ -#define SBase 0xAC00 -#define LBase 0x1100 -#define VBase 0x1161 -#define TBase 0x11A7 -#define LCount 19 -#define VCount 21 -#define TCount 28 -#define NCount (VCount * TCount) -#define SCount (LCount * NCount) - -/* - * "canonical_ordering" and "compose" functions are based on nfkc.c from Gnome - * library - */ - -static void canonical_ordering(int *str, int len) -{ - int i, j, t; - int last, next; - - last = GetUniCharCClass(str[0]); - for (i = 0; i < len - 1; i++) - { - next = GetUniCharCClass(str[i + 1]); - if (next != 0 && last > next) - { - for (j = i; j >= 0; j--) - { - if (GetUniCharCClass(str[j]) <= next) - break; - t = str[j + 1]; - str[j + 1] = str[j]; - str[j] = t; - } - next = last; - } - last = next; - } -} - - -static int compose(int ch1, int ch2) -{ - int info1, info2; - - if (LBase <= ch1 && ch1 < LBase + LCount && - VBase <= ch2 && ch2 < VBase + VCount) { - return SBase + ((ch1 - LBase) * VCount + (ch2 - VBase)) * TCount; - } - - if (SBase <= ch1 && ch1 < SBase + SCount && ((ch1 - SBase) % TCount) == 0 && - TBase <= ch2 && ch2 < TBase + TCount) { - return ch1 + ch2 - TBase; - } - - info1 = GetUniCharCompInfo(ch1); - if (info1 != -1 && info1 & CompSingleMask) { - if (!(info1 & CompSecondMask) && - ch2 == compFirstList[info1 & CompMask][0]) { - return compFirstList[info1 & CompMask][1]; - } else - return 0; - } - - info2 = GetUniCharCompInfo(ch2); - if (info2 != -1 && info2 & CompSingleMask) { - if ((info2 & CompSecondMask) && - ch1 == compSecondList[info2 & CompMask][0]) { - return compSecondList[info2 & CompMask][1]; - } else - return 0; - } - - if (info1 != -1 && info2 != -1 && - !(info1 & CompSecondMask) && (info2 & CompSecondMask)) - return compBothList[info1][info2 & CompMask]; - else - return 0; -} - - -#define ADD_UCHAR(ruc) \ - if (ruc <= 0x7F) { \ - if (pos >= size) { \ - size = 2*size + 1; \ - rstring = driver_realloc_binary(rstring, size); \ - } \ - rstring->orig_bytes[pos] = (char) ruc; \ - pos++; \ - } else if (ruc <= 0x7FF) { \ - if (pos + 1 >= size) { \ - size = 2*size + 2; \ - rstring = driver_realloc_binary(rstring, size); \ - } \ - rstring->orig_bytes[pos] = (char) ((ruc >> 6) | 0xC0); \ - rstring->orig_bytes[pos+1] = (char) ((ruc | 0x80) & 0xBF); \ - pos += 2; \ - } else if (ruc <= 0xFFFF) { \ - if (pos + 2 >= size) { \ - size = 2*size + 3; \ - rstring = driver_realloc_binary(rstring, size); \ - } \ - rstring->orig_bytes[pos] = (char) ((ruc >> 12) | 0xE0); \ - rstring->orig_bytes[pos+1] = (char) (((ruc >> 6) | 0x80) & 0xBF); \ - rstring->orig_bytes[pos+2] = (char) ((ruc | 0x80) & 0xBF); \ - pos += 3; \ - } else if (ruc <= 0x1FFFFF) { \ - if (pos + 3 >= size) { \ - size = 2*size + 4; \ - rstring = driver_realloc_binary(rstring, size); \ - } \ - rstring->orig_bytes[pos] = (char) ((ruc >> 18) | 0xF0); \ - rstring->orig_bytes[pos+1] = (char) (((ruc >> 12) | 0x80) & 0xBF); \ - rstring->orig_bytes[pos+2] = (char) (((ruc >> 6) | 0x80) & 0xBF); \ - rstring->orig_bytes[pos+3] = (char) ((ruc | 0x80) & 0xBF); \ - pos += 4; \ - } - -#define ADD_UCHAR32(str, pos, len, ch) \ - if (pos >= len) { \ - len = 2*len + 1; \ - str = driver_realloc(str, len * sizeof(int)); \ - } \ - str[pos] = ch; \ - pos++; - - -#define ADD_DECOMP(ruc) \ - info = GetUniCharDecompInfo(ruc); \ - if (info >= 0) { \ - decomp_len = GetDecompLen(info); \ - decomp_shift = GetDecompShift(info); \ - for (j = 0; j < decomp_len; j++) { \ - ADD_UCHAR32(str32, str32pos, str32len, \ - decompList[decomp_shift + j]); \ - } \ - } else { \ - ADD_UCHAR32(str32, str32pos, str32len, ruc); \ - } - - - -static ErlDrvSSizeT stringprep_erl_control(ErlDrvData drv_data, - unsigned int command, - char *buf, ErlDrvSizeT len, - char **rbuf, ErlDrvSizeT rlen) -{ - int i, j, pos=1; - unsigned char c; - int bad = 0; - int uc = 0, ruc; - int size; - int info; - int prohibit = 0, tolower = 0; - ErlDrvBinary *rstring; - int *mc; - int *str32; - int str32len, str32pos = 0; - int decomp_len, decomp_shift; - int comp_pos, comp_starter_pos; - int cclass_prev, cclass2; - int ch1, ch2; - int first_ral, last_ral, have_ral, have_l; - - size = len + 1; - - rstring = driver_alloc_binary(size); - rstring->orig_bytes[0] = 0; - - str32len = len + 1; - - str32 = driver_alloc(str32len * sizeof(int)); - - switch (command) - { - case 0: - prohibit = ACMask; - tolower = 1; - break; - - case NAMEPREP_COMMAND: - prohibit = ACMask; - tolower = 1; - break; - - case NODEPREP_COMMAND: - prohibit = ACMask | C11Mask | C21Mask | XNPMask; - tolower = 1; - break; - - case RESOURCEPREP_COMMAND: - prohibit = ACMask | C21Mask; - tolower = 0; - break; - } - - for (i = 0; i < len; i++) - { - c = buf[i]; - if (c < 0x80) { - uc = c; - } else if (c < 0xC0) { - bad = 1; - } else if (c < 0xE0) { - if (i+1 < len && (buf[i+1] & 0xC0) == 0x80) { - uc = ((c & 0x1F) << 6) | (buf[i+1] & 0x3F); - i++; - } else { - bad = 1; - } - } else if (c < 0xF0) { - if (i+2 < len && (buf[i+1] & 0xC0) == 0x80 && - (buf[i+2] & 0xC0) == 0x80) { - uc = ((c & 0x0F) << 12) - | ((buf[i+1] & 0x3F) << 6) - | (buf[i+2] & 0x3F); - i += 2; - } else { - bad = 1; - } - } else if (c < 0xF8) { - if (i+3 < len && - (buf[i+1] & 0xC0) == 0x80 && - (buf[i+2] & 0xC0) == 0x80 && - (buf[i+3] & 0xC0) == 0x80) { - uc = ((c & 0x07) << 18) - | ((buf[i+1] & 0x3F) << 12) - | ((buf[i+2] & 0x3F) << 6) - | (buf[i+3] & 0x3F); - i += 3; - if (uc > 0x10FFFF) - bad = 1; - } else { - bad = 1; - } - } else { - bad = 1; - } - - if (bad) { - *rbuf = (char *)rstring; - driver_free(str32); - return 1; - } - - info = GetUniCharInfo(uc); - - if (!(info & B1Mask)) - { - if (tolower) { - if (!(info & MCMask)) - { - ruc = uc + GetDelta(info); - ADD_DECOMP(ruc); - } else { - mc = GetMC(info); - for (j = 1; j <= mc[0]; j++) { - ruc = mc[j]; - ADD_DECOMP(ruc); - } - } - } else { - ruc = uc; - ADD_DECOMP(ruc); - } - } - } - - if (str32pos == 0) { - rstring->orig_bytes[0] = 1; - *rbuf = (char *)rstring; - driver_free(str32); - return 1; - } - - canonical_ordering(str32, str32pos); - - comp_pos = 1; - comp_starter_pos = 0; - ch1 = str32[0]; - cclass_prev = GetUniCharCClass(ch1); - for (i = 1; i < str32pos; i++) - { - ch2 = str32[i]; - cclass2 = GetUniCharCClass(ch2); - if ((cclass_prev == 0 || cclass2 > cclass_prev) && - (ruc = compose(ch1, ch2))) { - ch1 = ruc; - } else { - if (cclass2 == 0) { - str32[comp_starter_pos] = ch1; - comp_starter_pos = comp_pos++; - ch1 = ch2; - cclass_prev = 0; - } else { - str32[comp_pos++] = ch2; - cclass_prev = cclass2; - } - } - } - str32[comp_starter_pos] = ch1; - str32pos = comp_pos; - - last_ral = have_ral = have_l = 0; - info = GetUniCharInfo(str32[0]); - first_ral = info & D1Mask; - for (i = 0; i < str32pos; i++) - { - ruc = str32[i]; - info = GetUniCharInfo(ruc); - if (info & prohibit) { - *rbuf = (char *)rstring; - driver_free(str32); - return 1; - } - last_ral = info & D1Mask; - have_ral = have_ral || last_ral; - have_l |= info & D2Mask; - ADD_UCHAR(ruc); - } - - if (have_ral && (!first_ral || !last_ral || have_l)) { - *rbuf = (char *)rstring; - driver_free(str32); - return 1; - } - - rstring->orig_bytes[0] = 1; - *rbuf = (char *)rstring; - driver_free(str32); - - return pos; -} - - - -ErlDrvEntry stringprep_driver_entry = { - NULL, /* F_PTR init, N/A */ - stringprep_erl_start, /* L_PTR start, called when port is opened */ - stringprep_erl_stop, /* F_PTR stop, called when port is closed */ - NULL, /* F_PTR output, called when erlang has sent */ - NULL, /* F_PTR ready_input, called when input descriptor ready */ - NULL, /* F_PTR ready_output, called when output descriptor ready */ - "stringprep_drv", /* char *driver_name, the argument to open_port */ - NULL, /* F_PTR finish, called when unloaded */ - NULL, /* handle */ - stringprep_erl_control, /* F_PTR control, port_command callback */ - NULL, /* F_PTR timeout, reserved */ - NULL, /* F_PTR outputv, reserved */ - /* Added in Erlang/OTP R15B: */ - NULL, /* ready_async */ - NULL, /* flush */ - NULL, /* call */ - NULL, /* event */ - ERL_DRV_EXTENDED_MARKER, /* extended_marker */ - ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */ - ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */ - 0, /* driver_flags */ - NULL, /* handle2 */ - NULL, /* process_exit */ - NULL /* stop_select */ -}; - -DRIVER_INIT(stringprep_erl) /* must match name in driver_entry */ -{ - return &stringprep_driver_entry; -} - diff --git a/src/stringprep/uni_data.c b/src/stringprep/uni_data.c deleted file mode 100644 index 1c76ee811..000000000 --- a/src/stringprep/uni_data.c +++ /dev/null @@ -1,1257 +0,0 @@ -/* - * uni_data.c -- - * - * Declarations of Unicode character information tables. This file is - * automatically generated by the uni_parse.tcl script. Do not - * modify this file by hand. - * - * Copyright (c) 1998 by Scriptics Corporation. - * All rights reserved. - * - * Modified for ejabberd by Alexey Shchepin - * - * RCS: @(#) $Id$ - */ - -/* - * A 16-bit Unicode character is split into two parts in order to index - * into the following tables. The lower OFFSET_BITS comprise an offset - * into a page of characters. The upper bits comprise the page number. - */ - -#define OFFSET_BITS 8 - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned char pageMap[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 8, 8, 8, 8, 8, 25, 26, 27, 28, 29, 30, 31, 29, - 32, 33, 29, 29, 29, 8, 8, 8, 34, 35, 36, 37, 38, 39, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 40, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 41, 21, 21, 21, 21, 42, 8, 8, 8, 8, 8, 8, 8, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 21, 45, 46, 47, 48, 49, 50, 8, 8, 8, 51, 52, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 53, 54, 8, 8, 55, - 56, 57, 58, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 59, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 21, 21, 60, 8,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 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 61, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 61 -}; - -/* - * The groupMap is indexed by combining the alternate page number with - * the page offset and returns a group number that identifies a unique - * set of character attributes. - */ - -static unsigned short int groupMap[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, - 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, - 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 7, 2, 2, 2, 2, 2, 2, 2, 8, 2, 2, - 2, 2, 5, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 9, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 5, 5, 5, 5, 5, - 5, 5, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 11, 5, 10, 5, 10, 5, 10, 5, 5, - 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 12, 10, 5, - 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 13, 10, 5, 10, 5, 10, 5, 14, 5, 15, 10, 5, 10, 5, - 16, 10, 5, 17, 17, 10, 5, 5, 18, 19, 20, 10, 5, 17, 21, 5, 22, 23, - 10, 5, 5, 5, 22, 24, 5, 25, 10, 5, 10, 5, 10, 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, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, - 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 5, 2, 2, 2, - 2, 6, 2, 2, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, - 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 5, - 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 6, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 6, 6, 10, 5, 6, 6, 6, - 6, 6, 6, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 6, 6, 5, 5, 5, 5, 5, 5, - 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 56, 6, 5, 2, 6, - 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 6, 2, 2, 2, 57, 2, 57, 2, 2, 57, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 6, 6, 6, 6, 6, 57, 57, 57, - 57, 57, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 57, 6, 6, 6, - 57, 6, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 6, 6, 6, 6, 6, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 57, 57, 57, 2, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 2, 2, 2, 2, 2, 2, 2, 58, 2, 2, 2, 2, 2, 2, 2, 57, 57, 2, - 2, 2, 2, 2, 2, 2, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 57, 57, 57, 57, - 57, 6, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 6, 6, - 57, 2, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 6, 6, 6, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 57, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,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, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 59, 60, 61, 62, 63, 64, 6, 6, 6, 6, 10, 5, 10, 5, - 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, 5, 10, - 5, 10, 5, 10, 5, 10, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 65, - 65, 65, 65, 65, 65, 65, 65, 5, 5, 5, 5, 5, 5, 6, 6, 65, 65, 65, 65, - 65, 65, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 65, 65, 65, 65, 65, 65, 65, 65, - 5, 5, 5, 5, 5, 5, 5, 5, 65, 65, 65, 65, 65, 65, 65, 65, 5, 5, 5, 5, - 5, 5, 6, 6, 65, 65, 65, 65, 65, 65, 6, 6, 66, 5, 67, 5, 68, 5, 69, - 5, 6, 65, 6, 65, 6, 65, 6, 65, 5, 5, 5, 5, 5, 5, 5, 5, 65, 65, 65, - 65, 65, 65, 65, 65, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 5, 5, 118, 119, 120, 6, 121, 122, 65, 65, 123, 123, 124, 2, 125, - 2, 2, 2, 126, 127, 128, 6, 129, 130, 131, 131, 131, 131, 132, 2, 2, - 2, 5, 5, 133, 134, 6, 6, 135, 136, 65, 65, 137, 137, 6, 2, 2, 2, 5, - 5, 138, 139, 140, 5, 141, 142, 65, 65, 143, 143, 144, 2, 2, 2, 6, 6, - 145, 146, 147, 6, 148, 149, 150, 150, 151, 151, 152, 2, 2, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 153, 153, 153, 154, 58, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, - 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 2, 6, 6, 6, - 6, 6, 6, 6, 6, 153, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, - 5, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 2, 2, 2, 2, 2, 2, 2, 2, 155, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 2, 2, 156, 157, 2, 2, 2, 158, 2, 159, 5, 160, 161, - 162, 5, 5, 163, 164, 165, 5, 2, 163, 166, 2, 2, 167, 167, 167, 168, - 169, 2, 2, 170, 171, 172, 2, 168, 2, 173, 2, 174, 2, 175, 176, 177, - 177, 2, 5, 178, 178, 2, 179, 5, 5, 5, 5, 5, 5, 2, 6, 6, 5, 180, 181, - 2, 2, 2, 2, 2, 182, 5, 5, 5, 5, 2, 2, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 183, 183, 183, 183, 183, 183, 183, 183, - 183, 183, 183, 183, 183, 183, 183, 183, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2,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6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 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, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 6, 6, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 6, 6, 6, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2, 6, 6, 6, 6, 57, 57, 57, 57, - 57, 6, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 6, 6, 153, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, - 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 2, 2, 2, 2, 2, 2, 2, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 5, 5, 5, 5, - 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 249, - 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 250, - 6, 250, 250, 6, 6, 250, 6, 6, 250, 250, 6, 6, 250, 250, 250, 250, 6, - 250, 250, 250, 250, 250, 250, 250, 250, 5, 5, 5, 5, 6, 5, 6, 5, 5, - 5, 5, 6, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 251, 251, 251, 251, - 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, - 251, 251, 251, 251, 251, 251, 251, 251, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 252, 252, 6, 252, - 252, 252, 252, 6, 6, 252, 252, 252, 252, 252, 252, 252, 252, 6, 252, - 252, 252, 252, 252, 252, 252, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 253, 253, 6, 253, 253, 253, - 253, 6, 253, 253, 253, 253, 253, 6, 253, 6, 6, 6, 253, 253, 253, 253, - 253, 253, 253, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, - 259, 259, 259, 259, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 260, 260, 260, 260, 260, - 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, 261, 260, - 260, 260, 260, 260, 260, 260, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 262, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 263, - 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, - 263, 263, 264, 263, 263, 263, 263, 263, 263, 263, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 265, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 267, 266, 266, 266, 266, 266, 266, 266, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 268, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 269, 269, 269, 269, 269, 269, 269, - 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 270, 269, 269, 269, - 269, 269, 269, 269, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 271, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 272, 272, 272, - 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, - 273, 272, 272, 272, 272, 272, 272, 272, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 274, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,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6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 6, 6 -}; - -/* - * Each group represents a unique set of character attributes. The attributes - * are encoded into a 32-bit value as follows: - * - * Bit 0 A.1 | C.1.2 | C.2.2 | C.3 -- C.9 - * - * Bit 1 C.1.1 - * - * Bit 2 C.2.1 - * - * Bit 3 B.1 - * - * Bit 4 D.1 - * - * Bit 5 D.2 - * - * Bit 6 XNP - * - * Bit 7 Case maps to several characters - * - * Bits 8-10 Reserved for future use. - * - * Bits 11-31 Case delta: delta for case conversions. This should be the - * highest field so we can easily sign extend. - */ - -static int groups[] = { - 4, 2, 0, 64, 65568, 32, 1, 8, 1587232, 160, 2080, 2208, 4256, - -247776, -548832, 430112, 421920, 419872, 161824, 413728, 415776, - 423968, 432160, 428064, 436256, 438304, 446496, 444448, 448544, - 4128, 6304, -198624, -114656, -266208, 237568, 8352, 77856, 75808, - 131104, 129056, 10400, 12448, -61408, -51168, -26592, -12256, - -18400, -30688, -45024, -110560, -98272, -96224, -122848, -131040, - 163872, 98336, 14496, 16, 17, 16544, 18592, 20640, 22688, 24736, - -118752, -16352, 26784, 28832, 30880, 32928, 34976, 37024, 39072, - 41120, 43168, 45216, 47264, 49312, 51360, 53408, 55456, 57504, - 59552, 61600, 63648, 65696, 67744, 69792, 71840, 73888, 75936, - 77984, 80032, 82080, 84128, 86176, 88224, 90272, 92320, 94368, - 96416, 98464, 100512, 102560, 104608, 106656, 108704, 110752, - 112800, 114848, 116896, 118944, 120992, 123040, 125088, 127136, - 129184, 131232, 133280, 135328, 137376, 139424, 141472, -151520, - 143520, -14690272, 145568, 147616, 149664, 151712, 153760, -176096, - 155808, 157856, 159904, 161952, 164000, -204768, 166048, 168096, - 170144, 172192, 174240, -229344, -14304, 176288, 178336, 180384, - 182432, 184480, -262112, -258016, 186528, 9, 33, 188544, -17102816, - 190592, -16080864, 192640, -17111008, -17113056, -17115104, -17119200, - -17121248, -17117152, 194688, -17123296, -17125344, -17127392, - 196736, 198784, 200832, -15394784, -17133536, -17168352, -16920544, - -17190880, -17192928, -17182688, -15488992, -15464416, -17237984, - 32800, 53280, 202912, 204960, 207008, 209056, 211104, 213152, - 215200, 217248, 219296, 221344, 223392, 225440, 227488, 229536, - 231584, 233632, 235680, 237728, 239776, 241824, 243872, 245920, - 247968, 250016, 252064, 254112, 256160, 258208, 260256, 262304, - 264352, 266400, 268448, 270496, 272544, 274592, 276640, 278688, - 280736, 282784, 284832, 286880, 288928, 290976, 293024, 295072, - 297120, 299168, 301216, 303264, 305312, 307360, 309408, 311456, - 313504, 315552, 317600, 319648, 321696, 323744, 325792, 81952, - -245168096, -245274592, -245381088, -245487584, -245594080, -245700576, - -245807072, -245913568, -246020064, -246126560, -246233056, -246339552, - -246446048, -244824032, -244844512, -244875232, -244942816, -244963296, - -244994016, -245061600, -245082080, -245112800, -245180384, -245200864, - -245231584, -245299168, -245319648, -245350368 -}; - -/* - * Table for characters that lowercased to multiple ones - */ - -static int multiCaseTable[][4] = { - {2, 115, 115}, - {2, 105, 775}, - {2, 700, 110}, - {2, 106, 780}, - {2, 32, 953}, - {3, 953, 776, 769}, - {3, 965, 776, 769}, - {2, 1381, 1410}, - {2, 104, 817}, - {2, 116, 776}, - {2, 119, 778}, - {2, 121, 778}, - {2, 97, 702}, - {2, 965, 787}, - {3, 965, 787, 768}, - {3, 965, 787, 769}, - {3, 965, 787, 834}, - {2, 7936, 953}, - {2, 7937, 953}, - {2, 7938, 953}, - {2, 7939, 953}, - {2, 7940, 953}, - {2, 7941, 953}, - {2, 7942, 953}, - {2, 7943, 953}, - {2, 7936, 953}, - {2, 7937, 953}, - {2, 7938, 953}, - {2, 7939, 953}, - {2, 7940, 953}, - {2, 7941, 953}, - {2, 7942, 953}, - {2, 7943, 953}, - {2, 7968, 953}, - {2, 7969, 953}, - {2, 7970, 953}, - {2, 7971, 953}, - {2, 7972, 953}, - {2, 7973, 953}, - {2, 7974, 953}, - {2, 7975, 953}, - {2, 7968, 953}, - {2, 7969, 953}, - {2, 7970, 953}, - {2, 7971, 953}, - {2, 7972, 953}, - {2, 7973, 953}, - {2, 7974, 953}, - {2, 7975, 953}, - {2, 8032, 953}, - {2, 8033, 953}, - {2, 8034, 953}, - {2, 8035, 953}, - {2, 8036, 953}, - {2, 8037, 953}, - {2, 8038, 953}, - {2, 8039, 953}, - {2, 8032, 953}, - {2, 8033, 953}, - {2, 8034, 953}, - {2, 8035, 953}, - {2, 8036, 953}, - {2, 8037, 953}, - {2, 8038, 953}, - {2, 8039, 953}, - {2, 8048, 953}, - {2, 945, 953}, - {2, 940, 953}, - {2, 945, 834}, - {3, 945, 834, 953}, - {2, 945, 953}, - {2, 8052, 953}, - {2, 951, 953}, - {2, 942, 953}, - {2, 951, 834}, - {3, 951, 834, 953}, - {2, 951, 953}, - {3, 953, 776, 768}, - {3, 953, 776, 769}, - {2, 953, 834}, - {3, 953, 776, 834}, - {3, 965, 776, 768}, - {3, 965, 776, 769}, - {2, 961, 787}, - {2, 965, 834}, - {3, 965, 776, 834}, - {2, 8060, 953}, - {2, 969, 953}, - {2, 974, 953}, - {2, 969, 834}, - {3, 969, 834, 953}, - {2, 969, 953}, - {2, 114, 115}, - {2, 176, 99}, - {2, 176, 102}, - {2, 110, 111}, - {2, 115, 109}, - {3, 116, 101, 108}, - {2, 116, 109}, - {3, 104, 112, 97}, - {2, 97, 117}, - {2, 111, 118}, - {2, 112, 97}, - {2, 110, 97}, - {2, 956, 97}, - {2, 109, 97}, - {2, 107, 97}, - {2, 107, 98}, - {2, 109, 98}, - {2, 103, 98}, - {2, 112, 102}, - {2, 110, 102}, - {2, 956, 102}, - {2, 104, 122}, - {3, 107, 104, 122}, - {3, 109, 104, 122}, - {3, 103, 104, 122}, - {3, 116, 104, 122}, - {2, 112, 97}, - {3, 107, 112, 97}, - {3, 109, 112, 97}, - {3, 103, 112, 97}, - {2, 112, 118}, - {2, 110, 118}, - {2, 956, 118}, - {2, 109, 118}, - {2, 107, 118}, - {2, 109, 118}, - {2, 112, 119}, - {2, 110, 119}, - {2, 956, 119}, - {2, 109, 119}, - {2, 107, 119}, - {2, 109, 119}, - {2, 107, 969}, - {2, 109, 969}, - {2, 98, 113}, - {3, 99, 111, 46}, - {2, 100, 98}, - {2, 103, 121}, - {2, 104, 112}, - {2, 107, 107}, - {2, 107, 109}, - {2, 112, 104}, - {3, 112, 112, 109}, - {2, 112, 114}, - {2, 115, 118}, - {2, 119, 98}, - {2, 102, 102}, - {2, 102, 105}, - {2, 102, 108}, - {3, 102, 102, 105}, - {3, 102, 102, 108}, - {2, 115, 116}, - {2, 115, 116}, - {2, 1396, 1398}, - {2, 1396, 1381}, - {2, 1396, 1387}, - {2, 1406, 1398}, - {2, 1396, 1389} -}; - -/* - * The following constants are used to determine the category of a - * Unicode character. - */ - -#define ACMask (1 << 0) -#define C11Mask (1 << 1) -#define C21Mask (1 << 2) -#define B1Mask (1 << 3) -#define D1Mask (1 << 4) -#define D2Mask (1 << 5) -#define XNPMask (1 << 6) -#define MCMask (1 << 7) - -/* - * The following macros extract the fields of the character info. The - * GetDelta() macro is complicated because we can't rely on the C compiler - * to do sign extension on right shifts. - */ - -#define GetCaseType(info) (((info) & 0xE0) >> 5) -#define GetCategory(info) ((info) & 0x1F) -#define GetDelta(info) (((info) > 0) ? ((info) >> 11) : (~(~((info)) >> 11))) -#define GetMC(info) (multiCaseTable[GetDelta(info)]) - -/* - * This macro extracts the information about a character from the - * Unicode character tables. - */ - -#define GetUniCharInfo(ch) (groups[groupMap[(pageMap[(((int)(ch)) & 0x1fffff) >> OFFSET_BITS] << OFFSET_BITS) | ((ch) & ((1 << OFFSET_BITS)-1))]]) - diff --git a/src/stringprep/uni_norm.c b/src/stringprep/uni_norm.c deleted file mode 100644 index 7575f1405..000000000 --- a/src/stringprep/uni_norm.c +++ /dev/null @@ -1,3264 +0,0 @@ -/* - * uni_norm.c -- - * - * Declarations of Unicode character information tables. This file is - * automatically generated by the uni_parse2.tcl script. Do not - * modify this file by hand. - * - * Copyright (c) 1998 by Scriptics Corporation. - * All rights reserved. - * - * Modified for ejabberd by Alexey Shchepin - * - * RCS: @(#) $Id$ - */ - -/* - * A 16-bit Unicode character is split into two parts in order to index - * into the following tables. The lower CCLASS_OFFSET_BITS comprise an offset - * into a page of characters. The upper bits comprise the page number. - */ - -#define CCLASS_OFFSET_BITS 8 - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned char cclassPageMap[] = { - 0, 0, 0, 1, 2, 3, 4, 5, 0, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, - 0, 0, 14, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0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0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* - * The cclassGroupMap is indexed by combining the alternate page number with - * the page offset and returns a combining class number. - */ - -static unsigned char cclassGroupMap[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, - 230, 230, 230, 230, 230, 230, 230, 230, 230, 232, 220, 220, 220, 220, - 232, 216, 220, 220, 220, 220, 220, 202, 202, 220, 220, 220, 220, 202, - 202, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1, 1, 1, - 1, 1, 220, 220, 220, 220, 230, 230, 230, 230, 230, 230, 230, 230, 240, - 230, 220, 220, 220, 230, 230, 230, 220, 220, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 234, 234, 233, 230, 230, 230, 230, 230, - 230, 230, 230, 230, 230, 230, 230, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -#define GetUniCharCClass(ch) (cclassGroupMap[(cclassPageMap[(((int)(ch)) & 0x1fffff) >> CCLASS_OFFSET_BITS] << CCLASS_OFFSET_BITS) | ((ch) & ((1 << CCLASS_OFFSET_BITS)-1))]) - - -#define DECOMP_OFFSET_BITS 8 - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned char decompPageMap[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 16, 17, 18, 19, 20, 21, 22, 7, 7, 7, 7, - 7, 23, 7, 7, 7, 24, 25, 26, 27, 28, 29, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 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, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 -}; - -/* - * The decompGroupMap is indexed by combining the alternate page number with - * the page offset and returns a group number that identifies a length and - * shift of decomposition sequence in decompList - */ - -static int decompGroupMap[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65536, -1, -1, -1, -1, -1, -1, -1, 131073, - -1, 65539, -1, -1, -1, -1, 131076, -1, -1, 65542, 65543, 131080, 65546, - -1, -1, 131083, 65549, 65550, -1, 196623, 196626, 196629, -1, 131096, - 131098, 131100, 131102, 131104, 131106, -1, 131108, 131110, 131112, - 131114, 131116, 131118, 131120, 131122, 131124, -1, 131126, 131128, - 131130, 131132, 131134, 131136, -1, -1, 131138, 131140, 131142, 131144, - 131146, -1, -1, 131148, 131150, 131152, 131154, 131156, 131158, -1, - 131160, 131162, 131164, 131166, 131168, 131170, 131172, 131174, 131176, - -1, 131178, 131180, 131182, 131184, 131186, 131188, -1, -1, 131190, - 131192, 131194, 131196, 131198, -1, 131200, 131202, 131204, 131206, - 131208, 131210, 131212, 131214, 131216, 131218, 131220, 131222, 131224, - 131226, 131228, 131230, 131232, -1, -1, 131234, 131236, 131238, 131240, - 131242, 131244, 131246, 131248, 131250, 131252, 131254, 131256, 131258, - 131260, 131262, 131264, 131266, 131268, 131270, 131272, -1, -1, 131274, - 131276, 131278, 131280, 131282, 131284, 131286, 131288, 131290, -1, - 131292, 131294, 131296, 131298, 131300, 131302, -1, 131304, 131306, - 131308, 131310, 131312, 131314, 131316, 131318, -1, -1, 131320, 131322, - 131324, 131326, 131328, 131330, 131332, -1, -1, 131334, 131336, 131338, - 131340, 131342, 131344, -1, -1, 131346, 131348, 131350, 131352, 131354, - 131356, 131358, 131360, 131362, 131364, 131366, 131368, 131370, 131372, - 131374, 131376, 131378, 131380, -1, -1, 131382, 131384, 131386, 131388, - 131390, 131392, 131394, 131396, 131398, 131400, 131402, 131404, 131406, - 131408, 131410, 131412, 131414, 131416, 131418, 131420, 131422, 131424, - 131426, 65892, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 131429, 131431, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 131433, 131435, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 196973, 196976, 196979, 131446, 131448, - 131450, 131452, 131454, 131456, 131458, 131460, 131462, 131464, 131466, - 131468, 131470, 131472, 197010, 197013, 197016, 197019, 197022, 197025, - 197028, 197031, -1, 197034, 197037, 197040, 197043, 131510, 131512, - -1, -1, 131514, 131516, 131518, 131520, 131522, 131524, 197062, 197065, - 131532, 131534, 131536, 131538, 131540, 131542, 131544, 131546, -1, - -1, 131548, 131550, 197088, 197091, 131558, 131560, 131562, 131564, - 131566, 131568, 131570, 131572, 131574, 131576, 131578, 131580, 131582, - 131584, 131586, 131588, 131590, 131592, 131594, 131596, 131598, 131600, - 131602, 131604, 131606, 131608, 131610, 131612, 131614, 131616, 131618, - 131620, -1, -1, 131622, 131624, -1, -1, -1, -1, -1, -1, 131626, 131628, - 131630, 131632, 197170, 197173, 197176, 197179, 131646, 131648, 197186, - 197189, 131656, 131658, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66124, 66125, 66126, 66127, - 66128, 66129, 66130, 66131, 66132, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 131669, 131671, 131673, 131675, 131677, 131679, - -1, -1, 66145, 66146, 65892, 66147, 66148, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 66149, 66150, -1, 66151, 131688, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 66154, -1, -1, -1, -1, -1, 131691, -1, -1, -1, 66157, - -1, -1, -1, -1, -1, 131080, 197230, 131697, 66163, 131700, 131702, - 131704, -1, 131706, -1, 131708, 131710, 197248, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 131715, 131717, 131719, 131721, 131723, 131725, 197263, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131730, 131732, 131734, 131736, 131738, - -1, 66204, 66205, 66206, 131708, 131717, 66207, 66208, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 66209, 66210, 66211, -1, 66212, 66213, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131750, 131752, -1, 131754, -1, -1, - -1, 131756, -1, -1, -1, -1, 131758, 131760, 131762, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 131764, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 131766, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131768, 131770, -1, - 131772, -1, -1, -1, 131774, -1, -1, -1, -1, 131776, 131778, 131780, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 131782, 131784, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131786, - 131788, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131790, - 131792, 131794, 131796, -1, -1, 131798, 131800, -1, -1, 131802, 131804, - 131806, 131808, 131810, 131812, -1, -1, 131814, 131816, 131818, 131820, - 131822, 131824, -1, -1, 131826, 131828, 131830, 131832, 131834, 131836, - 131838, 131840, 131842, 131844, 131846, 131848, -1, -1, 131850, 131852, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 131854, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131856, 131858, 131860, 131862, 131864, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131866, 131868, 131870, 131872, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 131874, -1, 131876, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 131878, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131880, -1, -1, -1, -1, -1, - -1, -1, 131882, -1, -1, 131884, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 131886, 131888, 131890, 131892, - 131894, 131896, 131898, 131900, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131902, 131904, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131906, - 131908, -1, 131910, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 131912, -1, -1, 131914, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 131916, 131918, 131920, -1, -1, - 131922, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131924, -1, - -1, 131926, 131928, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 131930, 131932, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131934, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131936, 131938, - 131940, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 131942, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131944, -1, -1, -1, -1, -1, -1, 131946, - 131948, -1, 131950, 197488, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131955, 131957, - 131959, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 131961, -1, 131963, 197501, 131968, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131970, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 131972, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131974, - 131976, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66442, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 131979, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131981, -1, -1, - -1, -1, 131983, -1, -1, -1, -1, 131985, -1, -1, -1, -1, 131987, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131989, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 131991, -1, 131993, 131995, 197533, 132000, 197538, - -1, -1, -1, -1, -1, -1, -1, 132005, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 132007, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 132009, -1, -1, -1, -1, 132011, -1, -1, -1, -1, 132013, - -1, -1, -1, -1, 132015, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 132017, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 132019, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 132021, 132023, 132025, 132027, 132029, - 132031, 132033, 132035, 197573, 197576, 132043, 132045, 132047, 132049, - 132051, 132053, 132055, 132057, 132059, 132061, 197599, 197602, 197605, - 197608, 132075, 132077, 132079, 132081, 197619, 197622, 132089, 132091, - 132093, 132095, 132097, 132099, 132101, 132103, 132105, 132107, 132109, - 132111, 132113, 132115, 132117, 132119, 197657, 197660, 132127, 132129, - 132131, 132133, 132135, 132137, 132139, 132141, 197679, 197682, 132149, - 132151, 132153, 132155, 132157, 132159, 132161, 132163, 132165, 132167, - 132169, 132171, 132173, 132175, 132177, 132179, 132181, 132183, 197721, - 197724, 197727, 197730, 197733, 197736, 197739, 197742, 132209, 132211, - 132213, 132215, 132217, 132219, 132221, 132223, 197761, 197764, 132231, - 132233, 132235, 132237, 132239, 132241, 197779, 197782, 197785, 197788, - 197791, 197794, 132261, 132263, 132265, 132267, 132269, 132271, 132273, - 132275, 132277, 132279, 132281, 132283, 132285, 132287, 197825, 197828, - 197831, 197834, 132301, 132303, 132305, 132307, 132309, 132311, 132313, - 132315, 132317, 132319, 132321, 132323, 132325, 132327, 132329, 132331, - 132333, 132335, 132337, 132339, 132341, 132343, 132345, 132347, 132349, - 132351, 132353, 132355, 132357, 132359, 132361, 132237, -1, -1, -1, - -1, 132363, 132365, 132367, 132369, 197907, 197910, 197913, 197916, - 197919, 197922, 197925, 197928, 197931, 197934, 197937, 197940, 197943, - 197946, 197949, 197952, 197955, 197958, 197961, 197964, 132431, 132433, - 132435, 132437, 132439, 132441, 197979, 197982, 197985, 197988, 197991, - 197994, 197997, 198000, 198003, 198006, 132473, 132475, 132477, 132479, - 132481, 132483, 132485, 132487, 198025, 198028, 198031, 198034, 198037, - 198040, 198043, 198046, 198049, 198052, 198055, 198058, 198061, 198064, - 198067, 198070, 198073, 198076, 198079, 198082, 132549, 132551, 132553, - 132555, 198093, 198096, 198099, 198102, 198105, 198108, 198111, 198114, - 198117, 198120, 132587, 132589, 132591, 132593, 132595, 132597, 132599, - 132601, -1, -1, -1, -1, -1, -1, 132603, 132605, 198143, 198146, 198149, - 198152, 198155, 198158, 132625, 132627, 198165, 198168, 198171, 198174, - 198177, 198180, 132647, 132649, 198187, 198190, 198193, 198196, -1, - -1, 132663, 132665, 198203, 198206, 198209, 198212, -1, -1, 132679, - 132681, 198219, 198222, 198225, 198228, 198231, 198234, 132701, 132703, - 198241, 198244, 198247, 198250, 198253, 198256, 132723, 132725, 198263, - 198266, 198269, 198272, 198275, 198278, 132745, 132747, 198285, 198288, - 198291, 198294, 198297, 198300, 132767, 132769, 198307, 198310, 198313, - 198316, -1, -1, 132783, 132785, 198323, 198326, 198329, 198332, -1, - -1, 132799, 132801, 198339, 198342, 198345, 198348, 198351, 198354, - -1, 132821, -1, 198359, -1, 198362, -1, 198365, 132832, 132834, 198372, - 198375, 198378, 198381, 198384, 198387, 132854, 132856, 198394, 198397, - 198400, 198403, 198406, 198409, 132876, 131719, 132878, 131721, 132880, - 131723, 132882, 131725, 132884, 131734, 132886, 131736, 132888, 131738, - -1, -1, 198426, 198429, 263968, 263972, 263976, 263980, 263984, 263988, - 198456, 198459, 263998, 264002, 264006, 264010, 264014, 264018, 198486, - 198489, 264028, 264032, 264036, 264040, 264044, 264048, 198516, 198519, - 264058, 264062, 264066, 264070, 264074, 264078, 198546, 198549, 264088, - 264092, 264096, 264100, 264104, 264108, 198576, 198579, 264118, 264122, - 264126, 264130, 264134, 264138, 133070, 133072, 198610, 133077, 198615, - -1, 133082, 198620, 133087, 133089, 133091, 131697, 133093, 133095, - 67561, 133095, 133098, 198636, 198639, 133106, 198644, -1, 133111, - 198649, 133116, 131700, 133118, 131702, 133120, 198658, 198661, 198664, - 133131, 133133, 198671, 197248, -1, -1, 133138, 198676, 133143, 133145, - 133147, 131704, -1, 198685, 198688, 198691, 133158, 133160, 198698, - 197263, 133165, 133167, 133169, 198707, 133174, 133176, 133178, 131708, - 133180, 198718, 197230, 67649, -1, -1, 198722, 133189, 198727, -1, - 133194, 198732, 133199, 131706, 133201, 131710, 133203, 131080, 133205, - -1, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, - 65536, 65536, -1, -1, -1, -1, -1, -1, 67671, -1, -1, -1, -1, -1, 133208, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67674, 133211, 198749, - -1, -1, -1, -1, -1, -1, -1, -1, 65536, -1, -1, -1, 133216, 198754, - -1, 133221, 198759, -1, -1, -1, -1, 133226, -1, 133228, -1, -1, -1, - -1, -1, -1, -1, -1, 133230, 133232, 133234, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 264308, -1, -1, -1, -1, -1, -1, -1, 65536, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67704, - 67705, -1, -1, 67706, 67707, 67708, 67709, 67710, 67711, 67712, 67713, - 67714, 67715, 67716, 67717, 67704, 65549, 65542, 65543, 67706, 67707, - 67708, 67709, 67710, 67711, 67712, 67713, 67714, 67715, 67716, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 133254, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 198792, 198795, 67726, - 133263, -1, 198801, 198804, 67735, -1, 133272, 67738, 67739, 67739, - 67739, 66124, 67740, 67741, 67741, 67742, 66146, -1, 67743, 133280, - -1, -1, 67746, 67747, 67748, 67748, 67748, -1, -1, 133285, 198823, - 133290, -1, 67756, -1, 67757, -1, 67756, -1, 67758, 131106, 67759, - 67726, -1, 67760, 67761, 67762, -1, 67763, 65550, 67764, 67765, 67766, - 67767, 67705, -1, -1, -1, 67768, 67769, 67770, 67771, -1, -1, -1, -1, - 67772, 67773, 67760, 67705, 66126, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 198846, 198849, 198852, 198855, 198858, 198861, 198864, 198867, - 198870, 198873, 198876, 198879, 133346, 67741, 133348, 198886, 133353, - 67819, 133356, 198894, 264433, 133365, 67831, 133368, 198906, 67742, - 67726, 67772, 67763, 67705, 133373, 198911, 133378, 67844, 133381, - 198919, 264458, 133390, 66147, 133392, 198930, 66146, 67861, 67773, - 67862, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133399, 133401, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133403, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133405, 133407, - 133409, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 133411, -1, -1, -1, -1, 133413, -1, -1, 133415, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 133417, -1, 133419, -1, -1, -1, -1, -1, 133421, 198959, - -1, 133426, 198964, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 133431, -1, -1, 133433, -1, -1, 133435, -1, 133437, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 133439, -1, 133441, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 133443, 133445, 133447, 133449, 133451, -1, -1, 133453, - 133455, -1, -1, 133457, 133459, -1, -1, -1, -1, -1, -1, 133461, 133463, - -1, -1, 133465, 133467, -1, -1, 133469, 133471, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133473, 133475, 133477, - 133479, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133481, - 133483, 133485, 133487, -1, -1, -1, -1, -1, -1, 133489, 133491, 133493, - 133495, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67961, 67962, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65549, - 65542, 65543, 67706, 67707, 67708, 67709, 67710, 67711, 133499, 133501, - 133503, 133505, 133507, 133509, 133511, 133513, 133515, 133517, 133519, - 199057, 199060, 199063, 199066, 199069, 199072, 199075, 199078, 199081, - 264620, 264624, 264628, 264632, 264636, 264640, 264644, 264648, 264652, - 264656, 264660, 133592, 133594, 133596, 133598, 133600, 133602, 133604, - 133606, 133608, 199146, 199149, 199152, 199155, 199158, 199161, 199164, - 199167, 199170, 199173, 199176, 199179, 199182, 199185, 199188, 199191, - 199194, 199197, 199200, 199203, 199206, 199209, 199212, 199215, 199218, - 199221, 199224, 199227, 199230, 199233, 199236, 199239, 199242, 199245, - 199248, 199251, 199254, 68185, 67759, 67726, 67772, 67761, 67762, 68186, - 67739, 67741, 68187, 67758, 67742, 67763, 67743, 68188, 67746, 67747, - 67748, 68189, 68190, 68191, 67819, 68192, 67831, 68193, 67756, 65539, - 68194, 67861, 67773, 67760, 68195, 67738, 66124, 67705, 66126, 68196, - 66146, 67862, 67717, 65550, 68197, 68198, 66127, 65892, 68199, 68200, - 67844, 66131, 66147, 66132, 68201, 67704, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 264810, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 199278, 133745, 199283, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133750, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 68216, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 68217, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 68218, 68219, 68220, 68221, 68222, 68223, 68224, 68225, - 68226, 68227, 68228, 68229, 68230, 68231, 68232, 68233, 68234, 68235, - 68236, 68237, 68238, 68239, 68240, 68241, 68242, 68243, 68244, 68245, - 68246, 68247, 68248, 68249, 68250, 68251, 68252, 68253, 68254, 68255, - 68256, 68257, 68258, 68259, 68260, 68261, 68262, 68263, 68264, 68265, - 68266, 68267, 68268, 68269, 68270, 68271, 68272, 68273, 68274, 68275, - 68276, 68277, 68278, 68279, 68280, 68281, 68282, 68283, 68284, 68285, - 68286, 68287, 68288, 68289, 68290, 68291, 68292, 68293, 68294, 68295, - 68296, 68297, 68298, 68299, 68300, 68301, 68302, 68303, 68304, 68305, - 68306, 68307, 68308, 68309, 68310, 68311, 68312, 68313, 68314, 68315, - 68316, 68317, 68318, 68319, 68320, 68321, 68322, 68323, 68324, 68325, - 68326, 68327, 68328, 68329, 68330, 68331, 68332, 68333, 68334, 68335, - 68336, 68337, 68338, 68339, 68340, 68341, 68342, 68343, 68344, 68345, - 68346, 68347, 68348, 68349, 68350, 68351, 68352, 68353, 68354, 68355, - 68356, 68357, 68358, 68359, 68360, 68361, 68362, 68363, 68364, 68365, - 68366, 68367, 68368, 68369, 68370, 68371, 68372, 68373, 68374, 68375, - 68376, 68377, 68378, 68379, 68380, 68381, 68382, 68383, 68384, 68385, - 68386, 68387, 68388, 68389, 68390, 68391, 68392, 68393, 68394, 68395, - 68396, 68397, 68398, 68399, 68400, 68401, 68402, 68403, 68404, 68405, - 68406, 68407, 68408, 68409, 68410, 68411, 68412, 68413, 68414, 68415, - 68416, 68417, 68418, 68419, 68420, 68421, 68422, 68423, 68424, 68425, - 68426, 68427, 68428, 68429, 68430, 68431, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 65536, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 68432, -1, 68241, 68433, 68434, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133971, -1, 133973, - -1, 133975, -1, 133977, -1, 133979, -1, 133981, -1, 133983, -1, 133985, - -1, 133987, -1, 133989, -1, 133991, -1, 133993, -1, -1, 133995, -1, - 133997, -1, 133999, -1, -1, -1, -1, -1, -1, 134001, 134003, -1, 134005, - 134007, -1, 134009, 134011, -1, 134013, 134015, -1, 134017, 134019, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 134021, -1, -1, -1, -1, -1, -1, 134023, 134025, - -1, 134027, 134029, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 134031, -1, 134033, -1, 134035, -1, 134037, -1, 134039, -1, 134041, - -1, 134043, -1, 134045, -1, 134047, -1, 134049, -1, 134051, -1, 134053, - -1, -1, 134055, -1, 134057, -1, 134059, -1, -1, -1, -1, -1, -1, 134061, - 134063, -1, 134065, 134067, -1, 134069, 134071, -1, 134073, 134075, - -1, 134077, 134079, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 134081, -1, -1, 134083, 134085, - 134087, 134089, -1, -1, -1, 134091, 134093, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 68559, 68560, 68561, 68562, 68563, - 68564, 68565, 68566, 68567, 68568, 68569, 68570, 68571, 68572, 68573, - 68574, 68575, 68576, 68577, 68578, 68579, 68580, 68581, 68582, 68583, - 68584, 68585, 68586, 68587, 68588, 68589, 68590, 68591, 68592, 68593, - 68594, 68595, 68596, 68597, 68598, 68599, 68600, 68601, 68602, 68603, - 68604, 68605, 68606, 68607, 68608, 68609, 68610, 68611, 68612, 68613, - 68614, 68615, 68616, 68617, 68618, 68619, 68620, 68621, 68622, 68623, - 68624, 68625, 68626, 68627, 68628, 68629, 68630, 68631, 68632, 68633, - 68634, 68635, 68636, 68637, 68638, 68639, 68640, 68641, 68642, 68643, - 68644, 68645, 68646, 68647, 68648, 68649, 68650, 68651, 68652, -1, - -1, -1, 68218, 68224, 68653, 68654, 68655, 68656, 68657, 68658, 68222, - 68659, 68660, 68661, 68662, 68226, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 199735, 199738, 199741, 199744, 199747, 199750, 199753, - 199756, 199759, 199762, 199765, 199768, 199771, 199774, 265313, 265317, - 265321, 265325, 265329, 265333, 265337, 265341, 265345, 265349, 265353, - 265357, 265361, 265365, 265369, -1, -1, -1, 199837, 199840, 199843, - 199846, 199849, 199852, 199855, 199858, 199861, 199864, 199867, 199870, - 199873, 199876, 199879, 199882, 199885, 199888, 199891, 199894, 199897, - 199900, 199903, 199906, 199909, 199912, 199915, 199918, 199921, 199924, - 199927, 199930, 199933, 199936, 199939, 199942, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 134409, 134411, 134413, 134415, 134417, - 134419, 134421, 134423, 134425, 134427, 134429, 134431, 134433, 134435, - 134437, 68559, 68562, 68565, 68567, 68575, 68576, 68579, 68581, 68582, - 68584, 68585, 68586, 68587, 68588, 134439, 134441, 134443, 134445, - 134447, 134449, 134451, 134453, 134455, 134457, 134459, 134461, 134463, - 134465, -1, -1, -1, -1, 68218, 68224, 68653, 68654, 68931, 68932, 68933, - 68229, 68934, 68241, 68291, 68303, 68302, 68292, 68384, 68249, 68289, - 68935, 68936, 68937, 68938, 68939, 68940, 68941, 68942, 68943, 68944, - 68255, 68945, 68946, 68947, 68948, 68949, 68950, 68951, 68952, 68655, - 68656, 68657, 68953, 68954, 68955, 68956, 68957, 68958, 68959, 68960, - 68961, 68962, 134499, 134501, 134503, 134505, 134507, 134509, 134511, - 134513, 134515, 134517, 134519, 134521, 134523, 134525, 134527, 134529, - 134531, 134533, 134535, 134537, 134539, 134541, 134543, 134545, 200083, - 200086, 200089, -1, -1, -1, -1, 69020, 69021, 69022, 69023, 69024, - 69025, 69026, 69027, 69028, 69029, 69030, 69031, 69032, 69033, 69034, - 69035, 69036, 69037, 69038, 69039, 69040, 69041, 69042, 69043, 69044, - 69045, 69046, 69047, 69048, 69049, 69050, 69051, 69052, 69053, 69054, - 69055, 69056, 69057, 69058, 69059, 69060, 69061, 69062, 69063, 69064, - 69065, 69066, -1, 331211, 265680, 331220, 200153, 331228, 200161, 200164, - 396775, 265709, 200177, 200180, 200183, 265722, 265726, 265730, 265734, - 265738, 265742, 265746, 396822, 134684, 396830, 396836, 331306, 265775, - 396851, 396857, 265791, 200259, 200262, 265801, 265805, 331345, 331350, - 200283, 200286, 265825, 200293, 200296, 134763, 134765, 200303, 200306, - 396917, 265851, 331391, 396932, 265866, 200334, 200337, 396948, 265882, - 396958, 200356, 331431, 200364, 265903, 200371, 265910, 331450, 265919, - 331459, 265928, 134860, 331470, 200403, 200406, 265945, 200413, 200416, - 200419, 331494, 265963, 134895, 397041, 200439, 331514, 265983, 265987, - 200455, 200458, 265997, 134929, 266003, 331543, 134940, 397086, 200484, - 134951, 134953, 134955, 134957, 134959, 134961, 134963, 134965, 134967, - 134969, 200507, 200510, 200513, 200516, 200519, 200522, 200525, 200528, - 200531, 200534, 200537, 200540, 200543, 200546, 200549, 200552, 135019, - 135021, 200559, 135026, 135028, -1, -1, -1, -1, 135030, 135032, 135034, - 135036, 266110, 135042, 135044, 135046, 135048, 135050, 135052, 135054, - 135056, 200594, 266133, 135065, 135067, 135069, 135071, 135073, 135075, - 135077, 200615, 200618, 200621, 200624, 135091, 135093, 135095, 135097, - 135099, 135101, 135103, 135105, 135107, 135109, 200647, 200650, 135117, - 200655, 200658, 200661, 135128, 200666, 200669, 266208, 135140, 200678, - 200681, 200684, 200687, 331762, 397303, 135165, 135167, 135169, 135171, - 135173, 135175, 135177, 135179, 135181, 135183, 135185, 135187, 135189, - 135191, 135193, 135195, 135197, 135199, 266273, 135205, 135207, 135209, - 266283, 200751, 135218, 135220, 135222, 135224, 135226, 135228, 135230, - 135232, 135234, 135236, 200774, 135241, 135243, 200781, 200784, 135251, - 266325, 200793, 135260, 135262, 135264, 135266, -1, -1, 135268, 135270, - 135272, 135274, 135276, 135278, 135280, 135282, 135284, 200822, 200825, - 200828, 200831, 200834, 200837, 200840, 200843, 200846, 200849, 200852, - 200855, 200858, 200861, 200864, 200867, 200870, 200873, 200876, 200879, - 200882, 200885, -1, 69816, 69817, 68376, 69818, 69819, 69820, 69821, - 68430, 68430, 69822, 68384, 69823, 69824, 69825, 69826, 69827, 69828, - 69829, 69830, 69831, 69832, 69833, 69834, 69835, 69836, 69837, 69838, - 69839, 69840, 69841, 69842, 69843, 69844, 69845, 69846, 69847, 69848, - 69849, 69850, 69851, 69852, 69853, 69854, 69855, 69856, 69857, 69858, - 69859, 69860, 69861, 69862, 69863, 68342, 69864, 69865, 69866, 69867, - 69868, 69869, 69870, 69871, 69872, 69873, 69874, 68415, 69875, 69876, - 69877, 69878, 69879, 69880, 69881, 69882, 69883, 69884, 69885, 69886, - 69887, 69888, 69889, 69890, 69891, 69892, 69893, 69894, 69895, 69896, - 69897, 69898, 69899, 69900, 69901, 69832, 69902, 69903, 69904, 69905, - 69906, 69907, 69908, 69909, 69910, 69911, 69912, 69913, 69914, 69915, - 69916, 69917, 69918, 69919, 69920, 69921, 68378, 69922, 69923, 69924, - 69925, 69926, 69927, 69928, 69929, 69930, 69931, 69932, 69933, 69934, - 69935, 69936, 68255, 69937, 69938, 69939, 69940, 69941, 69942, 69943, - 69944, 68236, 69945, 69946, 69947, 69948, 69949, 69950, 69951, 69952, - 69953, 69954, 69955, 69956, 69957, 69958, 69959, 69960, 69961, 69962, - 69963, 69964, 69965, 69966, 69920, 69967, 69968, 69969, 69970, 69971, - 69972, 69973, 69974, 69904, 69975, 69976, 69977, 69978, 69979, 69980, - 69981, 69982, 69983, 69984, 69985, 69986, 69987, 69988, 69989, 69990, - 69991, 69992, 69993, 69994, 69832, 69995, 69996, 69997, 69998, 68429, - 69999, 70000, 70001, 70002, 70003, 70004, 70005, 70006, 70007, 70008, - 70009, 70010, 68932, 70011, 70012, 70013, 70014, 70015, 70016, 70017, - 70018, 70019, 69906, 70020, 70021, 70022, 70023, 70024, 70025, 70026, - 70027, 70028, 70029, 70030, 70031, 70032, 68383, 70033, 70034, 70035, - 70036, 70037, 70038, 70039, 70040, 70041, 70042, 70043, 70044, 70045, - 68334, 70046, 70047, 70048, 70049, 70050, 70051, 70052, 70053, 70054, - 70055, 70056, 70057, 70058, 70059, 70060, 70061, 68361, 70062, 68364, - 70063, 70064, 70065, -1, -1, 70066, -1, 70067, -1, -1, 70068, 70069, - 70070, 70071, 70072, 70073, 70074, 70075, 70076, 68341, -1, 70077, - -1, 70078, -1, -1, 70079, 70080, -1, -1, -1, 70081, 70082, 70083, 70084, - -1, -1, 70085, 70086, 70087, 70088, 70089, 70090, 70091, 70092, 70093, - 70094, 70095, 70096, 68262, 70097, 70098, 70099, 70100, 70101, 70102, - 70103, 70104, 70105, 70106, 70107, 70108, 70109, 70110, 70111, 68937, - 70112, 70113, 70114, 70115, 68941, 70116, 70117, 70118, 70119, 70120, - 69956, 70121, 70122, 70123, 70124, 70125, 70126, 70126, 70127, 70128, - 70129, 70130, 70131, 70132, 70133, 70134, 70079, 70135, 70136, 70137, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135674, 135676, - 135678, 201216, 201219, 135686, 135686, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 135688, 135690, 135692, 135694, 135696, -1, -1, - -1, -1, -1, 135698, -1, 135700, 70166, 67764, 67767, 70167, 70168, - 70169, 70170, 70171, 70172, 67712, 135709, 135711, 201249, 201252, - 135719, 135721, 135723, 135725, 135727, 135729, 135731, 135733, 135735, - -1, 135737, 135739, 135741, 135743, 135745, -1, 135747, -1, 135749, - 135751, -1, 135753, 135755, -1, 135757, 135759, 135761, 135763, 135765, - 135767, 135769, 135771, 135773, 135775, 70241, 70241, 70242, 70242, - 70242, 70242, 70243, 70243, 70243, 70243, 70244, 70244, 70244, 70244, - 70245, 70245, 70245, 70245, 70246, 70246, 70246, 70246, 70247, 70247, - 70247, 70247, 70248, 70248, 70248, 70248, 70249, 70249, 70249, 70249, - 70250, 70250, 70250, 70250, 70251, 70251, 70251, 70251, 70252, 70252, - 70252, 70252, 70253, 70253, 70253, 70253, 70254, 70254, 70255, 70255, - 70256, 70256, 70257, 70257, 70258, 70258, 70259, 70259, 70260, 70260, - 70260, 70260, 70261, 70261, 70261, 70261, 70262, 70262, 70262, 70262, - 70263, 70263, 70263, 70263, 70264, 70264, 70265, 70265, 70265, 70265, - 131874, 131874, 70266, 70266, 70266, 70266, 70267, 70267, 70267, 70267, - 70268, 70268, 131878, 131878, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 70269, 70269, 70269, 70269, 70270, 70270, 70271, - 70271, 70272, 70272, 131870, 70273, 70273, 70274, 70274, 70275, 70275, - 70276, 70276, 70276, 70276, 70277, 70277, 201350, 201350, 201353, 201353, - 201356, 201356, 201359, 201359, 201362, 201362, 201365, 201365, 201368, - 201368, 201368, 201371, 201371, 201371, 70302, 70302, 70302, 70302, - 201375, 201378, 201381, 201371, 201384, 135851, 135853, 135855, 135857, - 135859, 135861, 135863, 135865, 135867, 135869, 135871, 135873, 135875, - 135877, 135879, 135881, 135883, 135885, 135887, 135889, 135891, 135893, - 135895, 135897, 135899, 135901, 135903, 135905, 135907, 135909, 135911, - 135913, 135915, 135917, 135919, 135921, 135923, 135925, 135927, 135929, - 135931, 135933, 135935, 135937, 135939, 135941, 135943, 135945, 135947, - 135949, 135951, 135953, 135955, 135957, 135959, 135961, 135963, 135965, - 135967, 135969, 135971, 135973, 135975, 135977, 135979, 135981, 135983, - 135985, 135987, 135989, 135991, 135993, 135995, 135997, 135999, 136001, - 136003, 136005, 136007, 136009, 136011, 136013, 136015, 136017, 136019, - 136021, 136023, 136025, 136027, 201565, 201568, 201571, 201574, 201577, - 201580, 201583, 201586, 201381, 201589, 201371, 201384, 136056, 136058, - 135857, 136060, 135859, 135861, 136062, 136064, 135869, 136066, 135871, - 135873, 136068, 136070, 135877, 136072, 135879, 135881, 135939, 135941, - 135947, 135949, 135951, 135959, 135961, 135963, 135965, 135973, 135975, - 135977, 136074, 135985, 136076, 136078, 135997, 136080, 135999, 136001, - 136027, 136082, 136084, 136017, 136086, 136019, 136021, 201375, 201378, - 201624, 201381, 201627, 135851, 135853, 135855, 135857, 136094, 135863, - 135865, 135867, 135869, 136096, 135877, 135883, 135885, 135887, 135889, - 135891, 135895, 135897, 135899, 135901, 135903, 135905, 136098, 135907, - 135909, 135911, 135913, 135915, 135917, 135921, 135923, 135925, 135927, - 135929, 135931, 135933, 135935, 135937, 135943, 135945, 135953, 135955, - 135957, 135959, 135961, 135967, 135969, 135971, 135973, 136100, 135979, - 135981, 135983, 135985, 135991, 135993, 135995, 135997, 136102, 136003, - 136005, 136104, 136011, 136013, 136015, 136017, 136106, 201381, 201627, - 135857, 136094, 135869, 136096, 135877, 136108, 135903, 136110, 136112, - 136114, 135959, 135961, 135973, 135997, 136102, 136017, 136106, 201652, - 201655, 201658, 136125, 136127, 136129, 136131, 136133, 136135, 136137, - 136139, 136141, 136143, 136145, 136147, 136149, 136151, 136153, 136155, - 136157, 136159, 136161, 136163, 136165, 136167, 136169, 136112, 136171, - 136173, 136175, 136177, 136125, 136127, 136129, 136131, 136133, 136135, - 136137, 136139, 136141, 136143, 136145, 136147, 136149, 136151, 136153, - 136155, 136157, 136159, 136161, 136163, 136165, 136167, 136169, 136112, - 136171, 136173, 136175, 136177, 136165, 136167, 136169, 136112, 136110, - 136114, 135919, 135897, 135899, 135901, 136165, 136167, 136169, 135919, - 135921, 136179, 136179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 201717, 201720, 201720, 201723, 201726, - 201729, 201732, 201735, 201738, 201738, 201741, 201744, 201747, 201750, - 201753, 201756, 201756, 201759, 201762, 201762, 201765, 201765, 201768, - 201771, 201771, 201774, 201777, 201777, 201780, 201780, 201783, 201786, - 201786, 201789, 201789, 201792, 201795, 201798, 201801, 201801, 201804, - 201807, 201810, 201813, 201816, 201816, 201819, 201822, 201825, 201828, - 201831, 201834, 201834, 201837, 201837, 201840, 201840, 201843, 201846, - 201849, 201852, 201855, 201858, 201861, -1, -1, 201864, 201867, 201870, - 201873, 201876, 201879, 201879, 201882, 201885, 201888, 201891, 201891, - 201894, 201897, 201900, 201903, 201906, 201909, 201912, 201915, 201918, - 201921, 201924, 201927, 201930, 201933, 201936, 201939, 201942, 201945, - 201948, 201951, 201954, 201957, 201819, 201825, 201960, 201963, 201966, - 201969, 201972, 201975, 201972, 201966, 201978, 201981, 201984, 201987, - 201990, 201975, 201798, 201768, 201993, 201996, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 201999, 202002, 267541, 267545, 267549, 267553, 267557, 267561, - 267565, 202033, 1185076, 529734, 267598, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133211, 70994, 70995, 70996, - 70996, 67715, 67716, 70997, 70998, 70999, 71000, 71001, 71002, 71003, - 71004, 67961, 67962, 71005, 71006, 71007, 71008, -1, -1, -1, -1, 133228, - 133228, 133228, 133228, 70996, 70996, 70996, 71009, 71010, 67674, -1, - 66157, 71011, 71012, 71013, 70994, 67715, 67716, 70997, 70998, 70999, - 71000, 71014, 71015, 71016, 67712, 71017, 71018, 71019, 67714, -1, - 71020, 71021, 71022, 71023, -1, -1, -1, -1, 136560, 136562, 136564, - -1, 136566, -1, 136568, 136570, 136572, 136574, 136576, 136578, 136580, - 136582, 136584, 136586, 71052, 131856, 131856, 131858, 131858, 131860, - 131860, 131862, 131862, 131864, 131864, 131864, 131864, 71053, 71053, - 71054, 71054, 71054, 71054, 71055, 71055, 71056, 71056, 71056, 71056, - 71057, 71057, 71057, 71057, 71058, 71058, 71058, 71058, 71059, 71059, - 71059, 71059, 71060, 71060, 71060, 71060, 71061, 71061, 71062, 71062, - 71063, 71063, 71064, 71064, 71065, 71065, 71065, 71065, 71066, 71066, - 71066, 71066, 71067, 71067, 71067, 71067, 71068, 71068, 71068, 71068, - 71069, 71069, 71069, 71069, 71070, 71070, 71070, 71070, 71071, 71071, - 71071, 71071, 71072, 71072, 71072, 71072, 71073, 71073, 71073, 71073, - 71074, 71074, 71074, 71074, 71075, 71075, 71075, 71075, 71076, 71076, - 71076, 71076, 71077, 71077, 71077, 71077, 71078, 71078, 71078, 71078, - 71079, 71079, 71079, 71079, 71080, 71080, 70277, 70277, 71081, 71081, - 71081, 71081, 202154, 202154, 202157, 202157, 202160, 202160, 136627, - 136627, -1, -1, -1, -1, 71013, 71093, 71014, 71021, 71022, 71015, 71094, - 67715, 67716, 71016, 67712, 71009, 71017, 67674, 71095, 67704, 65549, - 65542, 65543, 67706, 67707, 67708, 67709, 67710, 67711, 71011, 66157, - 71018, 67714, 71019, 71012, 71023, 68185, 67759, 67726, 67772, 67761, - 67762, 68186, 67739, 67741, 68187, 67758, 67742, 67763, 67743, 68188, - 67746, 67747, 67748, 68189, 68190, 68191, 67819, 68192, 67831, 68193, - 67756, 71096, 71020, 71097, 71098, 70996, 67649, 65539, 68194, 67861, - 67773, 67760, 68195, 67738, 66124, 67705, 66126, 68196, 66146, 67862, - 67717, 65550, 68197, 68198, 66127, 65892, 68199, 68200, 67844, 66131, - 66147, 66132, 68201, 70997, 71099, 70998, 71100, 71101, 71102, 71103, - 71005, 71006, 71010, 71104, 69066, 71105, 71106, 71107, 71108, 71109, - 71110, 71111, 71112, 71113, 71114, 69020, 69021, 69022, 69023, 69024, - 69025, 69026, 69027, 69028, 69029, 69030, 69031, 69032, 69033, 69034, - 69035, 69036, 69037, 69038, 69039, 69040, 69041, 69042, 69043, 69044, - 69045, 69046, 69047, 69048, 69049, 69050, 69051, 69052, 69053, 69054, - 69055, 69056, 69057, 69058, 69059, 69060, 69061, 69062, 69063, 71115, - 71116, 71117, 68610, 68559, 68560, 68561, 68562, 68563, 68564, 68565, - 68566, 68567, 68568, 68569, 68570, 68571, 68572, 68573, 68574, 68575, - 68576, 68577, 68578, 68579, 68580, 68581, 68582, 68583, 68584, 68585, - 68586, 68587, 68588, -1, -1, -1, 68589, 68590, 68591, 68592, 68593, - 68594, -1, -1, 68595, 68596, 68597, 68598, 68599, 68600, -1, -1, 68601, - 68602, 68603, 68604, 68605, 68606, -1, -1, 68607, 68608, 68609, -1, - -1, -1, 71118, 71119, 71120, 131076, 71121, 71122, 71123, -1, 71124, - 71125, 71126, 71127, 71128, 71129, 71130, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 136667, 136669, 202207, 202210, 202213, 202216, 202219, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 136686, 136688, 202226, 202229, 202232, 202235, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 68185, 67759, 67726, 67772, 67761, 67762, - 68186, 67739, 67741, 68187, 67758, 67742, 67763, 67743, 68188, 67746, - 67747, 67748, 68189, 68190, 68191, 67819, 68192, 67831, 68193, 67756, - 65539, 68194, 67861, 67773, 67760, 68195, 67738, 66124, 67705, 66126, - 68196, 66146, 67862, 67717, 65550, 68197, 68198, 66127, 65892, 68199, - 68200, 67844, 66131, 66147, 66132, 68201, 68185, 67759, 67726, 67772, - 67761, 67762, 68186, 67739, 67741, 68187, 67758, 67742, 67763, 67743, - 68188, 67746, 67747, 67748, 68189, 68190, 68191, 67819, 68192, 67831, - 68193, 67756, 65539, 68194, 67861, 67773, 67760, 68195, 67738, -1, - 67705, 66126, 68196, 66146, 67862, 67717, 65550, 68197, 68198, 66127, - 65892, 68199, 68200, 67844, 66131, 66147, 66132, 68201, 68185, 67759, - 67726, 67772, 67761, 67762, 68186, 67739, 67741, 68187, 67758, 67742, - 67763, 67743, 68188, 67746, 67747, 67748, 68189, 68190, 68191, 67819, - 68192, 67831, 68193, 67756, 65539, 68194, 67861, 67773, 67760, 68195, - 67738, 66124, 67705, 66126, 68196, 66146, 67862, 67717, 65550, 68197, - 68198, 66127, 65892, 68199, 68200, 67844, 66131, 66147, 66132, 68201, - 68185, -1, 67726, 67772, -1, -1, 68186, -1, -1, 68187, 67758, -1, -1, - 67743, 68188, 67746, 67747, -1, 68189, 68190, 68191, 67819, 68192, - 67831, 68193, 67756, 65539, 68194, 67861, 67773, -1, 68195, -1, 66124, - 67705, 66126, 68196, -1, 67862, 67717, -1, 68197, 68198, 66127, 65892, - 68199, 68200, 67844, 66131, 66147, 66132, 68201, 68185, 67759, 67726, - 67772, 67761, 67762, 68186, 67739, 67741, 68187, 67758, 67742, 67763, - 67743, 68188, 67746, 67747, 67748, 68189, 68190, 68191, 67819, 68192, - 67831, 68193, 67756, 65539, 68194, 67861, 67773, 67760, 68195, 67738, - 66124, 67705, 66126, 68196, 66146, 67862, 67717, 65550, 68197, 68198, - 66127, 65892, 68199, 68200, 67844, 66131, 66147, 66132, 68201, 68185, - 67759, -1, 67772, 67761, 67762, 68186, -1, -1, 68187, 67758, 67742, - 67763, 67743, 68188, 67746, 67747, -1, 68189, 68190, 68191, 67819, - 68192, 67831, 68193, -1, 65539, 68194, 67861, 67773, 67760, 68195, - 67738, 66124, 67705, 66126, 68196, 66146, 67862, 67717, 65550, 68197, - 68198, 66127, 65892, 68199, 68200, 67844, 66131, 66147, 66132, 68201, - 68185, 67759, -1, 67772, 67761, 67762, 68186, -1, 67741, 68187, 67758, - 67742, 67763, -1, 68188, -1, -1, -1, 68189, 68190, 68191, 67819, 68192, - 67831, 68193, -1, 65539, 68194, 67861, 67773, 67760, 68195, 67738, - 66124, 67705, 66126, 68196, 66146, 67862, 67717, 65550, 68197, 68198, - 66127, 65892, 68199, 68200, 67844, 66131, 66147, 66132, 68201, 68185, - 67759, 67726, 67772, 67761, 67762, 68186, 67739, 67741, 68187, 67758, - 67742, 67763, 67743, 68188, 67746, 67747, 67748, 68189, 68190, 68191, - 67819, 68192, 67831, 68193, 67756, 65539, 68194, 67861, 67773, 67760, - 68195, 67738, 66124, 67705, 66126, 68196, 66146, 67862, 67717, 65550, - 68197, 68198, 66127, 65892, 68199, 68200, 67844, 66131, 66147, 66132, - 68201, 68185, 67759, 67726, 67772, 67761, 67762, 68186, 67739, 67741, - 68187, 67758, 67742, 67763, 67743, 68188, 67746, 67747, 67748, 68189, - 68190, 68191, 67819, 68192, 67831, 68193, 67756, 65539, 68194, 67861, - 67773, 67760, 68195, 67738, 66124, 67705, 66126, 68196, 66146, 67862, - 67717, 65550, 68197, 68198, 66127, 65892, 68199, 68200, 67844, 66131, - 66147, 66132, 68201, 68185, 67759, 67726, 67772, 67761, 67762, 68186, - 67739, 67741, 68187, 67758, 67742, 67763, 67743, 68188, 67746, 67747, - 67748, 68189, 68190, 68191, 67819, 68192, 67831, 68193, 67756, 65539, - 68194, 67861, 67773, 67760, 68195, 67738, 66124, 67705, 66126, 68196, - 66146, 67862, 67717, 65550, 68197, 68198, 66127, 65892, 68199, 68200, - 67844, 66131, 66147, 66132, 68201, 68185, 67759, 67726, 67772, 67761, - 67762, 68186, 67739, 67741, 68187, 67758, 67742, 67763, 67743, 68188, - 67746, 67747, 67748, 68189, 68190, 68191, 67819, 68192, 67831, 68193, - 67756, 65539, 68194, 67861, 67773, 67760, 68195, 67738, 66124, 67705, - 66126, 68196, 66146, 67862, 67717, 65550, 68197, 68198, 66127, 65892, - 68199, 68200, 67844, 66131, 66147, 66132, 68201, 68185, 67759, 67726, - 67772, 67761, 67762, 68186, 67739, 67741, 68187, 67758, 67742, 67763, - 67743, 68188, 67746, 67747, 67748, 68189, 68190, 68191, 67819, 68192, - 67831, 68193, 67756, 65539, 68194, 67861, 67773, 67760, 68195, 67738, - 66124, 67705, 66126, 68196, 66146, 67862, 67717, 65550, 68197, 68198, - 66127, 65892, 68199, 68200, 67844, 66131, 66147, 66132, 68201, 68185, - 67759, 67726, 67772, 67761, 67762, 68186, 67739, 67741, 68187, 67758, - 67742, 67763, 67743, 68188, 67746, 67747, 67748, 68189, 68190, 68191, - 67819, 68192, 67831, 68193, 67756, 65539, 68194, 67861, 67773, 67760, - 68195, 67738, 66124, 67705, 66126, 68196, 66146, 67862, 67717, 65550, - 68197, 68198, 66127, 65892, 68199, 68200, 67844, 66131, 66147, 66132, - 68201, -1, -1, -1, -1, 71166, 71167, 67769, 71168, 71169, 71170, 71171, - 66212, 71172, 71173, 71174, 71175, 71176, 71177, 71178, 67770, 71179, - 66212, 71180, 71181, 66206, 71182, 71183, 71184, 67757, 71185, 71186, - 66204, 67768, 71187, 66213, 71188, 71189, 66205, 67561, 66209, 71190, - 65546, 71191, 71192, 71193, 66208, 66210, 66211, 71194, 71195, 71196, - 66207, 71197, 71198, 71199, 71200, 66213, 66205, 66209, 66207, 66210, - 66208, 71166, 71167, 67769, 71168, 71169, 71170, 71171, 66212, 71172, - 71173, 71174, 71175, 71176, 71177, 71178, 67770, 71179, 66212, 71180, - 71181, 66206, 71182, 71183, 71184, 67757, 71185, 71186, 66204, 67768, - 71187, 66213, 71188, 71189, 66205, 67561, 66209, 71190, 65546, 71191, - 71192, 71193, 66208, 66210, 66211, 71194, 71195, 71196, 66207, 71197, - 71198, 71199, 71200, 66213, 66205, 66209, 66207, 66210, 66208, 71166, - 71167, 67769, 71168, 71169, 71170, 71171, 66212, 71172, 71173, 71174, - 71175, 71176, 71177, 71178, 67770, 71179, 66212, 71180, 71181, 66206, - 71182, 71183, 71184, 67757, 71185, 71186, 66204, 67768, 71187, 66213, - 71188, 71189, 66205, 67561, 66209, 71190, 65546, 71191, 71192, 71193, - 66208, 66210, 66211, 71194, 71195, 71196, 66207, 71197, 71198, 71199, - 71200, 66213, 66205, 66209, 66207, 66210, 66208, 71166, 71167, 67769, - 71168, 71169, 71170, 71171, 66212, 71172, 71173, 71174, 71175, 71176, - 71177, 71178, 67770, 71179, 66212, 71180, 71181, 66206, 71182, 71183, - 71184, 67757, 71185, 71186, 66204, 67768, 71187, 66213, 71188, 71189, - 66205, 67561, 66209, 71190, 65546, 71191, 71192, 71193, 66208, 66210, - 66211, 71194, 71195, 71196, 66207, 71197, 71198, 71199, 71200, 66213, - 66205, 66209, 66207, 66210, 66208, 71166, 71167, 67769, 71168, 71169, - 71170, 71171, 66212, 71172, 71173, 71174, 71175, 71176, 71177, 71178, - 67770, 71179, 66212, 71180, 71181, 66206, 71182, 71183, 71184, 67757, - 71185, 71186, 66204, 67768, 71187, 66213, 71188, 71189, 66205, 67561, - 66209, 71190, 65546, 71191, 71192, 71193, 66208, 66210, 66211, 71194, - 71195, 71196, 66207, 71197, 71198, 71199, 71200, 66213, 66205, 66209, - 66207, 66210, 66208, -1, -1, -1, -1, 67704, 65549, 65542, 65543, 67706, - 67707, 67708, 67709, 67710, 67711, 67704, 65549, 65542, 65543, 67706, - 67707, 67708, 67709, 67710, 67711, 67704, 65549, 65542, 65543, 67706, - 67707, 67708, 67709, 67710, 67711, 67704, 65549, 65542, 65543, 67706, - 67707, 67708, 67709, 67710, 67711, 67704, 65549, 65542, 65543, 67706, - 67707, 67708, 67709, 67710, 67711, 71201, 71202, 71203, 71204, 71205, - 70085, 71206, 71207, 71208, 71209, 70086, 71210, 71211, 71212, 70087, - 71213, 71214, 71215, 71216, 71217, 71218, 71219, 71220, 71221, 71222, - 71223, 71224, 71225, 71226, 68234, 71227, 71228, 71229, 71230, 71231, - 71232, 71233, 71234, 70088, 70089, 71235, 71236, 71237, 69908, 71238, - 70090, 71239, 71240, 71241, 71242, 71242, 71242, 71243, 71244, 71245, - 71246, 71247, 71248, 71249, 71250, 71251, 71252, 71253, 71254, 71255, - 71256, 71257, 71258, 71259, 71260, 71260, 71261, 71262, 71263, 71264, - 71265, 70092, 71266, 71267, 71268, 70054, 71269, 71270, 71271, 71272, - 71273, 71274, 71275, 71276, 71277, 71278, 71279, 71280, 71281, 71282, - 71283, 71284, 71285, 71286, 71287, 71288, 71289, 71290, 71291, 71292, - 71293, 71294, 71294, 71295, 71296, 71297, 69904, 71298, 71299, 71300, - 71301, 71302, 68260, 71303, 71304, 68262, 71305, 71306, 71307, 71308, - 71309, 71310, 71311, 71312, 71313, 71314, 71315, 71316, 71317, 71318, - 71319, 71320, 71321, 71322, 71323, 71324, 71325, 69852, 71326, 68272, - 71327, 71327, 71328, 71329, 71329, 71330, 71331, 71332, 71333, 71334, - 71335, 71336, 71337, 71338, 71339, 71340, 71341, 71342, 70097, 71343, - 71344, 71345, 71346, 71347, 71346, 71348, 70099, 71349, 71350, 71351, - 71352, 70100, 69825, 71353, 71354, 71355, 71356, 71357, 71358, 71359, - 71360, 71361, 71362, 71363, 71364, 71365, 71366, 71367, 71368, 71369, - 71370, 71371, 71372, 71373, 71374, 70101, 71375, 71376, 71377, 71378, - 71379, 71380, 70103, 71381, 71382, 71383, 71384, 71385, 71386, 71387, - 71388, 69853, 71389, 71390, 71391, 71392, 71393, 71394, 71395, 71396, - 71397, 70104, 71398, 71399, 71400, 71401, 71402, 71403, 71404, 71405, - 71406, 71407, 71408, 71409, 71410, 71411, 71412, 71413, 71414, 71415, - 69921, 71416, 71417, 71418, 71419, 71420, 71421, 71422, 71423, 71424, - 71425, 71426, 70105, 70004, 71427, 71428, 71429, 71430, 71431, 71432, - 71433, 71434, 71435, 71436, 71437, 71438, 71439, 71440, 71441, 71442, - 71443, 71444, 71445, 71446, 71447, 71448, 71449, 71450, 71451, 71452, - 71453, 71454, 71455, 71456, 71457, 71458, 71459, 71460, 71461, 71462, - 71463, 71464, 71465, 71466, 71467, 71468, 71468, 71469, 71470, 71471, - 71472, 71473, 71474, 71475, 71476, 71477, 71478, 69907, 71479, 71480, - 71481, 71482, 71483, 71484, 71485, 71486, 71487, 71488, 71489, 71490, - 71491, 71492, 71492, 71493, 71494, 71495, 71496, 71497, 71498, 71499, - 69870, 71500, 71501, 71502, 70115, 71503, 71504, 70074, 71505, 71506, - 70118, 71507, 71508, 71509, 71510, 71510, 71511, 71512, 71513, 71514, - 71515, 71516, 71517, 71518, 71519, 71520, 71521, 71522, 71523, 71524, - 71525, 71526, 71527, 71528, 71529, 71530, 71531, 71532, 71533, 71534, - 71535, 71536, 71537, 70124, 71538, 71539, 71540, 71541, 71542, 71543, - 71544, 71545, 71546, 71547, 71548, 71549, 71550, 71551, 71552, 71553, - 71328, 71554, 71555, 71556, 71557, 71558, 71559, 71560, 71561, 71562, - 71563, 71564, 71565, 69924, 71566, 71567, 71568, 71569, 71570, 71571, - 70127, 71572, 71573, 71574, 71575, 71576, 71577, 71578, 71579, 71580, - 71581, 71582, 71583, 71584, 71585, 71586, 71587, 71588, 71589, 71590, - 71591, 69865, 71592, 71593, 71594, 71595, 71596, 71597, 71598, 71599, - 71600, 71601, 71602, 71603, 71604, 71605, 71606, 68362, 71607, 71608, - 71609, 71610, 71611, 71612, 71613, 71614, 71615, 71616, 71617, 71618, - 71619, 68369, 71620, 71621, 71622, 71623, 71624, 71625, 71626, 71627, - 71628, 71629, 71630, 71631, 71632, 71633, 71634, 71635, 71636, 71637, - 71638, 71639, 71640, 71641, 71642, 71643, 71644, 71645, 71646, 71647, - 71648, 71649, 71650, 71651, 71652, 71653, 71654, 71655, 71656, 71657, - 71658, 71659, 71660, 71661, 71662, 71663, 71663, 71664, 71665, 71666, - 71667, 71668, 71669, 71670, 71671, 71672, 71673, 71674, 71675, 71676, - 71677, 71678, 71679, 71680, 71681, 71682, 71683, 71684, 68417, 71685, - 68421, 71686, 71687, 71688, 71689, 68426, 71690, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 -}; - -/* - * List of decomposition sequences - */ - -static int decompList[] = { - 32, 32, 776, 97, 32, 772, 50, 51, 32, 769, 956, 32, 807, 49, 111, 49, - 8260, 52, 49, 8260, 50, 51, 8260, 52, 65, 768, 65, 769, 65, 770, 65, - 771, 65, 776, 65, 778, 67, 807, 69, 768, 69, 769, 69, 770, 69, 776, - 73, 768, 73, 769, 73, 770, 73, 776, 78, 771, 79, 768, 79, 769, 79, - 770, 79, 771, 79, 776, 85, 768, 85, 769, 85, 770, 85, 776, 89, 769, - 97, 768, 97, 769, 97, 770, 97, 771, 97, 776, 97, 778, 99, 807, 101, - 768, 101, 769, 101, 770, 101, 776, 105, 768, 105, 769, 105, 770, 105, - 776, 110, 771, 111, 768, 111, 769, 111, 770, 111, 771, 111, 776, 117, - 768, 117, 769, 117, 770, 117, 776, 121, 769, 121, 776, 65, 772, 97, - 772, 65, 774, 97, 774, 65, 808, 97, 808, 67, 769, 99, 769, 67, 770, - 99, 770, 67, 775, 99, 775, 67, 780, 99, 780, 68, 780, 100, 780, 69, - 772, 101, 772, 69, 774, 101, 774, 69, 775, 101, 775, 69, 808, 101, - 808, 69, 780, 101, 780, 71, 770, 103, 770, 71, 774, 103, 774, 71, 775, - 103, 775, 71, 807, 103, 807, 72, 770, 104, 770, 73, 771, 105, 771, - 73, 772, 105, 772, 73, 774, 105, 774, 73, 808, 105, 808, 73, 775, 73, - 74, 105, 106, 74, 770, 106, 770, 75, 807, 107, 807, 76, 769, 108, 769, - 76, 807, 108, 807, 76, 780, 108, 780, 76, 183, 108, 183, 78, 769, 110, - 769, 78, 807, 110, 807, 78, 780, 110, 780, 700, 110, 79, 772, 111, - 772, 79, 774, 111, 774, 79, 779, 111, 779, 82, 769, 114, 769, 82, 807, - 114, 807, 82, 780, 114, 780, 83, 769, 115, 769, 83, 770, 115, 770, - 83, 807, 115, 807, 83, 780, 115, 780, 84, 807, 116, 807, 84, 780, 116, - 780, 85, 771, 117, 771, 85, 772, 117, 772, 85, 774, 117, 774, 85, 778, - 117, 778, 85, 779, 117, 779, 85, 808, 117, 808, 87, 770, 119, 770, - 89, 770, 121, 770, 89, 776, 90, 769, 122, 769, 90, 775, 122, 775, 90, - 780, 122, 780, 115, 79, 795, 111, 795, 85, 795, 117, 795, 68, 90, 780, - 68, 122, 780, 100, 122, 780, 76, 74, 76, 106, 108, 106, 78, 74, 78, - 106, 110, 106, 65, 780, 97, 780, 73, 780, 105, 780, 79, 780, 111, 780, - 85, 780, 117, 780, 85, 776, 772, 117, 776, 772, 85, 776, 769, 117, - 776, 769, 85, 776, 780, 117, 776, 780, 85, 776, 768, 117, 776, 768, - 65, 776, 772, 97, 776, 772, 65, 775, 772, 97, 775, 772, 198, 772, 230, - 772, 71, 780, 103, 780, 75, 780, 107, 780, 79, 808, 111, 808, 79, 808, - 772, 111, 808, 772, 439, 780, 658, 780, 106, 780, 68, 90, 68, 122, - 100, 122, 71, 769, 103, 769, 78, 768, 110, 768, 65, 778, 769, 97, 778, - 769, 198, 769, 230, 769, 216, 769, 248, 769, 65, 783, 97, 783, 65, - 785, 97, 785, 69, 783, 101, 783, 69, 785, 101, 785, 73, 783, 105, 783, - 73, 785, 105, 785, 79, 783, 111, 783, 79, 785, 111, 785, 82, 783, 114, - 783, 82, 785, 114, 785, 85, 783, 117, 783, 85, 785, 117, 785, 83, 806, - 115, 806, 84, 806, 116, 806, 72, 780, 104, 780, 65, 775, 97, 775, 69, - 807, 101, 807, 79, 776, 772, 111, 776, 772, 79, 771, 772, 111, 771, - 772, 79, 775, 111, 775, 79, 775, 772, 111, 775, 772, 89, 772, 121, - 772, 104, 614, 106, 114, 633, 635, 641, 119, 121, 32, 774, 32, 775, - 32, 778, 32, 808, 32, 771, 32, 779, 611, 108, 120, 661, 768, 769, 787, - 776, 769, 697, 32, 837, 59, 32, 776, 769, 913, 769, 183, 917, 769, - 919, 769, 921, 769, 927, 769, 933, 769, 937, 769, 953, 776, 769, 921, - 776, 933, 776, 945, 769, 949, 769, 951, 769, 953, 769, 965, 776, 769, - 953, 776, 965, 776, 959, 769, 965, 769, 969, 769, 946, 952, 933, 966, - 960, 954, 961, 962, 920, 949, 1045, 768, 1045, 776, 1043, 769, 1030, - 776, 1050, 769, 1048, 768, 1059, 774, 1048, 774, 1080, 774, 1077, 768, - 1077, 776, 1075, 769, 1110, 776, 1082, 769, 1080, 768, 1091, 774, 1140, - 783, 1141, 783, 1046, 774, 1078, 774, 1040, 774, 1072, 774, 1040, 776, - 1072, 776, 1045, 774, 1077, 774, 1240, 776, 1241, 776, 1046, 776, 1078, - 776, 1047, 776, 1079, 776, 1048, 772, 1080, 772, 1048, 776, 1080, 776, - 1054, 776, 1086, 776, 1256, 776, 1257, 776, 1069, 776, 1101, 776, 1059, - 772, 1091, 772, 1059, 776, 1091, 776, 1059, 779, 1091, 779, 1063, 776, - 1095, 776, 1067, 776, 1099, 776, 1381, 1410, 1575, 1619, 1575, 1620, - 1608, 1620, 1575, 1621, 1610, 1620, 1575, 1652, 1608, 1652, 1735, 1652, - 1610, 1652, 1749, 1620, 1729, 1620, 1746, 1620, 2344, 2364, 2352, 2364, - 2355, 2364, 2325, 2364, 2326, 2364, 2327, 2364, 2332, 2364, 2337, 2364, - 2338, 2364, 2347, 2364, 2351, 2364, 2503, 2494, 2503, 2519, 2465, 2492, - 2466, 2492, 2479, 2492, 2610, 2620, 2616, 2620, 2582, 2620, 2583, 2620, - 2588, 2620, 2603, 2620, 2887, 2902, 2887, 2878, 2887, 2903, 2849, 2876, - 2850, 2876, 2962, 3031, 3014, 3006, 3015, 3006, 3014, 3031, 3142, 3158, - 3263, 3285, 3270, 3285, 3270, 3286, 3270, 3266, 3270, 3266, 3285, 3398, - 3390, 3399, 3390, 3398, 3415, 3545, 3530, 3545, 3535, 3545, 3535, 3530, - 3545, 3551, 3661, 3634, 3789, 3762, 3755, 3737, 3755, 3745, 3851, 3906, - 4023, 3916, 4023, 3921, 4023, 3926, 4023, 3931, 4023, 3904, 4021, 3953, - 3954, 3953, 3956, 4018, 3968, 4018, 3953, 3968, 4019, 3968, 4019, 3953, - 3968, 3953, 3968, 3986, 4023, 3996, 4023, 4001, 4023, 4006, 4023, 4011, - 4023, 3984, 4021, 4133, 4142, 65, 805, 97, 805, 66, 775, 98, 775, 66, - 803, 98, 803, 66, 817, 98, 817, 67, 807, 769, 99, 807, 769, 68, 775, - 100, 775, 68, 803, 100, 803, 68, 817, 100, 817, 68, 807, 100, 807, - 68, 813, 100, 813, 69, 772, 768, 101, 772, 768, 69, 772, 769, 101, - 772, 769, 69, 813, 101, 813, 69, 816, 101, 816, 69, 807, 774, 101, - 807, 774, 70, 775, 102, 775, 71, 772, 103, 772, 72, 775, 104, 775, - 72, 803, 104, 803, 72, 776, 104, 776, 72, 807, 104, 807, 72, 814, 104, - 814, 73, 816, 105, 816, 73, 776, 769, 105, 776, 769, 75, 769, 107, - 769, 75, 803, 107, 803, 75, 817, 107, 817, 76, 803, 108, 803, 76, 803, - 772, 108, 803, 772, 76, 817, 108, 817, 76, 813, 108, 813, 77, 769, - 109, 769, 77, 775, 109, 775, 77, 803, 109, 803, 78, 775, 110, 775, - 78, 803, 110, 803, 78, 817, 110, 817, 78, 813, 110, 813, 79, 771, 769, - 111, 771, 769, 79, 771, 776, 111, 771, 776, 79, 772, 768, 111, 772, - 768, 79, 772, 769, 111, 772, 769, 80, 769, 112, 769, 80, 775, 112, - 775, 82, 775, 114, 775, 82, 803, 114, 803, 82, 803, 772, 114, 803, - 772, 82, 817, 114, 817, 83, 775, 115, 775, 83, 803, 115, 803, 83, 769, - 775, 115, 769, 775, 83, 780, 775, 115, 780, 775, 83, 803, 775, 115, - 803, 775, 84, 775, 116, 775, 84, 803, 116, 803, 84, 817, 116, 817, - 84, 813, 116, 813, 85, 804, 117, 804, 85, 816, 117, 816, 85, 813, 117, - 813, 85, 771, 769, 117, 771, 769, 85, 772, 776, 117, 772, 776, 86, - 771, 118, 771, 86, 803, 118, 803, 87, 768, 119, 768, 87, 769, 119, - 769, 87, 776, 119, 776, 87, 775, 119, 775, 87, 803, 119, 803, 88, 775, - 120, 775, 88, 776, 120, 776, 89, 775, 121, 775, 90, 770, 122, 770, - 90, 803, 122, 803, 90, 817, 122, 817, 104, 817, 116, 776, 119, 778, - 121, 778, 97, 702, 65, 803, 97, 803, 65, 777, 97, 777, 65, 770, 769, - 97, 770, 769, 65, 770, 768, 97, 770, 768, 65, 770, 777, 97, 770, 777, - 65, 770, 771, 97, 770, 771, 65, 803, 770, 97, 803, 770, 65, 774, 769, - 97, 774, 769, 65, 774, 768, 97, 774, 768, 65, 774, 777, 97, 774, 777, - 65, 774, 771, 97, 774, 771, 65, 803, 774, 97, 803, 774, 69, 803, 101, - 803, 69, 777, 101, 777, 69, 771, 101, 771, 69, 770, 769, 101, 770, - 769, 69, 770, 768, 101, 770, 768, 69, 770, 777, 101, 770, 777, 69, - 770, 771, 101, 770, 771, 69, 803, 770, 101, 803, 770, 73, 777, 105, - 777, 73, 803, 105, 803, 79, 803, 111, 803, 79, 777, 111, 777, 79, 770, - 769, 111, 770, 769, 79, 770, 768, 111, 770, 768, 79, 770, 777, 111, - 770, 777, 79, 770, 771, 111, 770, 771, 79, 803, 770, 111, 803, 770, - 79, 795, 769, 111, 795, 769, 79, 795, 768, 111, 795, 768, 79, 795, - 777, 111, 795, 777, 79, 795, 771, 111, 795, 771, 79, 795, 803, 111, - 795, 803, 85, 803, 117, 803, 85, 777, 117, 777, 85, 795, 769, 117, - 795, 769, 85, 795, 768, 117, 795, 768, 85, 795, 777, 117, 795, 777, - 85, 795, 771, 117, 795, 771, 85, 795, 803, 117, 795, 803, 89, 768, - 121, 768, 89, 803, 121, 803, 89, 777, 121, 777, 89, 771, 121, 771, - 945, 787, 945, 788, 945, 787, 768, 945, 788, 768, 945, 787, 769, 945, - 788, 769, 945, 787, 834, 945, 788, 834, 913, 787, 913, 788, 913, 787, - 768, 913, 788, 768, 913, 787, 769, 913, 788, 769, 913, 787, 834, 913, - 788, 834, 949, 787, 949, 788, 949, 787, 768, 949, 788, 768, 949, 787, - 769, 949, 788, 769, 917, 787, 917, 788, 917, 787, 768, 917, 788, 768, - 917, 787, 769, 917, 788, 769, 951, 787, 951, 788, 951, 787, 768, 951, - 788, 768, 951, 787, 769, 951, 788, 769, 951, 787, 834, 951, 788, 834, - 919, 787, 919, 788, 919, 787, 768, 919, 788, 768, 919, 787, 769, 919, - 788, 769, 919, 787, 834, 919, 788, 834, 953, 787, 953, 788, 953, 787, - 768, 953, 788, 768, 953, 787, 769, 953, 788, 769, 953, 787, 834, 953, - 788, 834, 921, 787, 921, 788, 921, 787, 768, 921, 788, 768, 921, 787, - 769, 921, 788, 769, 921, 787, 834, 921, 788, 834, 959, 787, 959, 788, - 959, 787, 768, 959, 788, 768, 959, 787, 769, 959, 788, 769, 927, 787, - 927, 788, 927, 787, 768, 927, 788, 768, 927, 787, 769, 927, 788, 769, - 965, 787, 965, 788, 965, 787, 768, 965, 788, 768, 965, 787, 769, 965, - 788, 769, 965, 787, 834, 965, 788, 834, 933, 788, 933, 788, 768, 933, - 788, 769, 933, 788, 834, 969, 787, 969, 788, 969, 787, 768, 969, 788, - 768, 969, 787, 769, 969, 788, 769, 969, 787, 834, 969, 788, 834, 937, - 787, 937, 788, 937, 787, 768, 937, 788, 768, 937, 787, 769, 937, 788, - 769, 937, 787, 834, 937, 788, 834, 945, 768, 949, 768, 951, 768, 953, - 768, 959, 768, 965, 768, 969, 768, 945, 787, 837, 945, 788, 837, 945, - 787, 768, 837, 945, 788, 768, 837, 945, 787, 769, 837, 945, 788, 769, - 837, 945, 787, 834, 837, 945, 788, 834, 837, 913, 787, 837, 913, 788, - 837, 913, 787, 768, 837, 913, 788, 768, 837, 913, 787, 769, 837, 913, - 788, 769, 837, 913, 787, 834, 837, 913, 788, 834, 837, 951, 787, 837, - 951, 788, 837, 951, 787, 768, 837, 951, 788, 768, 837, 951, 787, 769, - 837, 951, 788, 769, 837, 951, 787, 834, 837, 951, 788, 834, 837, 919, - 787, 837, 919, 788, 837, 919, 787, 768, 837, 919, 788, 768, 837, 919, - 787, 769, 837, 919, 788, 769, 837, 919, 787, 834, 837, 919, 788, 834, - 837, 969, 787, 837, 969, 788, 837, 969, 787, 768, 837, 969, 788, 768, - 837, 969, 787, 769, 837, 969, 788, 769, 837, 969, 787, 834, 837, 969, - 788, 834, 837, 937, 787, 837, 937, 788, 837, 937, 787, 768, 837, 937, - 788, 768, 837, 937, 787, 769, 837, 937, 788, 769, 837, 937, 787, 834, - 837, 937, 788, 834, 837, 945, 774, 945, 772, 945, 768, 837, 945, 837, - 945, 769, 837, 945, 834, 945, 834, 837, 913, 774, 913, 772, 913, 768, - 913, 837, 32, 787, 953, 32, 834, 32, 776, 834, 951, 768, 837, 951, - 837, 951, 769, 837, 951, 834, 951, 834, 837, 917, 768, 919, 768, 919, - 837, 32, 787, 768, 32, 787, 769, 32, 787, 834, 953, 774, 953, 772, - 953, 776, 768, 953, 834, 953, 776, 834, 921, 774, 921, 772, 921, 768, - 32, 788, 768, 32, 788, 769, 32, 788, 834, 965, 774, 965, 772, 965, - 776, 768, 961, 787, 961, 788, 965, 834, 965, 776, 834, 933, 774, 933, - 772, 933, 768, 929, 788, 32, 776, 768, 96, 969, 768, 837, 969, 837, - 969, 769, 837, 969, 834, 969, 834, 837, 927, 768, 937, 768, 937, 837, - 32, 788, 8208, 32, 819, 46, 46, 46, 46, 46, 46, 8242, 8242, 8242, 8242, - 8242, 8245, 8245, 8245, 8245, 8245, 33, 33, 32, 773, 63, 63, 63, 33, - 33, 63, 8242, 8242, 8242, 8242, 48, 105, 52, 53, 54, 55, 56, 57, 43, - 8722, 61, 40, 41, 110, 82, 115, 97, 47, 99, 97, 47, 115, 67, 176, 67, - 99, 47, 111, 99, 47, 117, 400, 176, 70, 103, 72, 295, 73, 76, 78, 78, - 111, 80, 81, 82, 83, 77, 84, 69, 76, 84, 77, 90, 937, 75, 66, 101, - 69, 70, 77, 1488, 1489, 1490, 1491, 947, 915, 928, 8721, 68, 100, 49, - 8260, 51, 50, 8260, 51, 49, 8260, 53, 50, 8260, 53, 51, 8260, 53, 52, - 8260, 53, 49, 8260, 54, 53, 8260, 54, 49, 8260, 56, 51, 8260, 56, 53, - 8260, 56, 55, 8260, 56, 49, 8260, 73, 73, 73, 73, 73, 73, 86, 86, 86, - 73, 86, 73, 73, 86, 73, 73, 73, 73, 88, 88, 88, 73, 88, 73, 73, 105, - 105, 105, 105, 105, 105, 118, 118, 118, 105, 118, 105, 105, 118, 105, - 105, 105, 105, 120, 120, 105, 120, 105, 105, 99, 109, 8592, 824, 8594, - 824, 8596, 824, 8656, 824, 8660, 824, 8658, 824, 8707, 824, 8712, 824, - 8715, 824, 8739, 824, 8741, 824, 8747, 8747, 8747, 8747, 8747, 8750, - 8750, 8750, 8750, 8750, 8764, 824, 8771, 824, 8773, 824, 8776, 824, - 61, 824, 8801, 824, 8781, 824, 60, 824, 62, 824, 8804, 824, 8805, 824, - 8818, 824, 8819, 824, 8822, 824, 8823, 824, 8826, 824, 8827, 824, 8834, - 824, 8835, 824, 8838, 824, 8839, 824, 8866, 824, 8872, 824, 8873, 824, - 8875, 824, 8828, 824, 8829, 824, 8849, 824, 8850, 824, 8882, 824, 8883, - 824, 8884, 824, 8885, 824, 12296, 12297, 49, 48, 49, 49, 49, 50, 49, - 51, 49, 52, 49, 53, 49, 54, 49, 55, 49, 56, 49, 57, 50, 48, 40, 49, - 41, 40, 50, 41, 40, 51, 41, 40, 52, 41, 40, 53, 41, 40, 54, 41, 40, - 55, 41, 40, 56, 41, 40, 57, 41, 40, 49, 48, 41, 40, 49, 49, 41, 40, - 49, 50, 41, 40, 49, 51, 41, 40, 49, 52, 41, 40, 49, 53, 41, 40, 49, - 54, 41, 40, 49, 55, 41, 40, 49, 56, 41, 40, 49, 57, 41, 40, 50, 48, - 41, 49, 46, 50, 46, 51, 46, 52, 46, 53, 46, 54, 46, 55, 46, 56, 46, - 57, 46, 49, 48, 46, 49, 49, 46, 49, 50, 46, 49, 51, 46, 49, 52, 46, - 49, 53, 46, 49, 54, 46, 49, 55, 46, 49, 56, 46, 49, 57, 46, 50, 48, - 46, 40, 97, 41, 40, 98, 41, 40, 99, 41, 40, 100, 41, 40, 101, 41, 40, - 102, 41, 40, 103, 41, 40, 104, 41, 40, 105, 41, 40, 106, 41, 40, 107, - 41, 40, 108, 41, 40, 109, 41, 40, 110, 41, 40, 111, 41, 40, 112, 41, - 40, 113, 41, 40, 114, 41, 40, 115, 41, 40, 116, 41, 40, 117, 41, 40, - 118, 41, 40, 119, 41, 40, 120, 41, 40, 121, 41, 40, 122, 41, 65, 71, - 74, 79, 83, 84, 85, 87, 89, 98, 102, 107, 112, 113, 116, 117, 122, - 8747, 8747, 8747, 8747, 58, 58, 61, 61, 61, 61, 61, 61, 10973, 824, - 27597, 40863, 19968, 20008, 20022, 20031, 20057, 20101, 20108, 20128, - 20154, 20799, 20837, 20843, 20866, 20886, 20907, 20960, 20981, 20992, - 21147, 21241, 21269, 21274, 21304, 21313, 21340, 21353, 21378, 21430, - 21448, 21475, 22231, 22303, 22763, 22786, 22794, 22805, 22823, 22899, - 23376, 23424, 23544, 23567, 23586, 23608, 23662, 23665, 24027, 24037, - 24049, 24062, 24178, 24186, 24191, 24308, 24318, 24331, 24339, 24400, - 24417, 24435, 24515, 25096, 25142, 25163, 25903, 25908, 25991, 26007, - 26020, 26041, 26080, 26085, 26352, 26376, 26408, 27424, 27490, 27513, - 27571, 27595, 27604, 27611, 27663, 27668, 27700, 28779, 29226, 29238, - 29243, 29247, 29255, 29273, 29275, 29356, 29572, 29577, 29916, 29926, - 29976, 29983, 29992, 30000, 30091, 30098, 30326, 30333, 30382, 30399, - 30446, 30683, 30690, 30707, 31034, 31160, 31166, 31348, 31435, 31481, - 31859, 31992, 32566, 32593, 32650, 32701, 32769, 32780, 32786, 32819, - 32895, 32905, 33251, 33258, 33267, 33276, 33292, 33307, 33311, 33390, - 33394, 33400, 34381, 34411, 34880, 34892, 34915, 35198, 35211, 35282, - 35328, 35895, 35910, 35925, 35960, 35997, 36196, 36208, 36275, 36523, - 36554, 36763, 36784, 36789, 37009, 37193, 37318, 37324, 37329, 38263, - 38272, 38428, 38582, 38585, 38632, 38737, 38750, 38754, 38761, 38859, - 38893, 38899, 38913, 39080, 39131, 39135, 39318, 39321, 39340, 39592, - 39640, 39647, 39717, 39727, 39730, 39740, 39770, 40165, 40565, 40575, - 40613, 40635, 40643, 40653, 40657, 40697, 40701, 40718, 40723, 40736, - 40763, 40778, 40786, 40845, 40860, 40864, 12306, 21316, 21317, 12363, - 12441, 12365, 12441, 12367, 12441, 12369, 12441, 12371, 12441, 12373, - 12441, 12375, 12441, 12377, 12441, 12379, 12441, 12381, 12441, 12383, - 12441, 12385, 12441, 12388, 12441, 12390, 12441, 12392, 12441, 12399, - 12441, 12399, 12442, 12402, 12441, 12402, 12442, 12405, 12441, 12405, - 12442, 12408, 12441, 12408, 12442, 12411, 12441, 12411, 12442, 12358, - 12441, 32, 12441, 32, 12442, 12445, 12441, 12424, 12426, 12459, 12441, - 12461, 12441, 12463, 12441, 12465, 12441, 12467, 12441, 12469, 12441, - 12471, 12441, 12473, 12441, 12475, 12441, 12477, 12441, 12479, 12441, - 12481, 12441, 12484, 12441, 12486, 12441, 12488, 12441, 12495, 12441, - 12495, 12442, 12498, 12441, 12498, 12442, 12501, 12441, 12501, 12442, - 12504, 12441, 12504, 12442, 12507, 12441, 12507, 12442, 12454, 12441, - 12527, 12441, 12528, 12441, 12529, 12441, 12530, 12441, 12541, 12441, - 12467, 12488, 4352, 4353, 4522, 4354, 4524, 4525, 4355, 4356, 4357, - 4528, 4529, 4530, 4531, 4532, 4533, 4378, 4358, 4359, 4360, 4385, 4361, - 4362, 4363, 4364, 4365, 4366, 4367, 4368, 4369, 4370, 4449, 4450, 4451, - 4452, 4453, 4454, 4455, 4456, 4457, 4458, 4459, 4460, 4461, 4462, 4463, - 4464, 4465, 4466, 4467, 4468, 4469, 4448, 4372, 4373, 4551, 4552, 4556, - 4558, 4563, 4567, 4569, 4380, 4573, 4575, 4381, 4382, 4384, 4386, 4387, - 4391, 4393, 4395, 4396, 4397, 4398, 4399, 4402, 4406, 4416, 4423, 4428, - 4593, 4594, 4439, 4440, 4441, 4484, 4485, 4488, 4497, 4498, 4500, 4510, - 4513, 19977, 22235, 19978, 20013, 19979, 30002, 19993, 19969, 22825, - 22320, 40, 4352, 41, 40, 4354, 41, 40, 4355, 41, 40, 4357, 41, 40, - 4358, 41, 40, 4359, 41, 40, 4361, 41, 40, 4363, 41, 40, 4364, 41, 40, - 4366, 41, 40, 4367, 41, 40, 4368, 41, 40, 4369, 41, 40, 4370, 41, 40, - 4352, 4449, 41, 40, 4354, 4449, 41, 40, 4355, 4449, 41, 40, 4357, 4449, - 41, 40, 4358, 4449, 41, 40, 4359, 4449, 41, 40, 4361, 4449, 41, 40, - 4363, 4449, 41, 40, 4364, 4449, 41, 40, 4366, 4449, 41, 40, 4367, 4449, - 41, 40, 4368, 4449, 41, 40, 4369, 4449, 41, 40, 4370, 4449, 41, 40, - 4364, 4462, 41, 40, 19968, 41, 40, 20108, 41, 40, 19977, 41, 40, 22235, - 41, 40, 20116, 41, 40, 20845, 41, 40, 19971, 41, 40, 20843, 41, 40, - 20061, 41, 40, 21313, 41, 40, 26376, 41, 40, 28779, 41, 40, 27700, - 41, 40, 26408, 41, 40, 37329, 41, 40, 22303, 41, 40, 26085, 41, 40, - 26666, 41, 40, 26377, 41, 40, 31038, 41, 40, 21517, 41, 40, 29305, - 41, 40, 36001, 41, 40, 31069, 41, 40, 21172, 41, 40, 20195, 41, 40, - 21628, 41, 40, 23398, 41, 40, 30435, 41, 40, 20225, 41, 40, 36039, - 41, 40, 21332, 41, 40, 31085, 41, 40, 20241, 41, 40, 33258, 41, 40, - 33267, 41, 50, 49, 50, 50, 50, 51, 50, 52, 50, 53, 50, 54, 50, 55, - 50, 56, 50, 57, 51, 48, 51, 49, 51, 50, 51, 51, 51, 52, 51, 53, 4352, - 4449, 4354, 4449, 4355, 4449, 4357, 4449, 4358, 4449, 4359, 4449, 4361, - 4449, 4363, 4449, 4364, 4449, 4366, 4449, 4367, 4449, 4368, 4449, 4369, - 4449, 4370, 4449, 20116, 20845, 19971, 20061, 26666, 26377, 31038, - 21517, 29305, 36001, 31069, 21172, 31192, 30007, 36969, 20778, 21360, - 27880, 38917, 20241, 20889, 27491, 24038, 21491, 21307, 23447, 23398, - 30435, 20225, 36039, 21332, 22812, 51, 54, 51, 55, 51, 56, 51, 57, - 52, 48, 52, 49, 52, 50, 52, 51, 52, 52, 52, 53, 52, 54, 52, 55, 52, - 56, 52, 57, 53, 48, 49, 26376, 50, 26376, 51, 26376, 52, 26376, 53, - 26376, 54, 26376, 55, 26376, 56, 26376, 57, 26376, 49, 48, 26376, 49, - 49, 26376, 49, 50, 26376, 12450, 12452, 12454, 12456, 12458, 12459, - 12461, 12463, 12465, 12467, 12469, 12471, 12473, 12475, 12477, 12479, - 12481, 12484, 12486, 12488, 12490, 12491, 12492, 12493, 12494, 12495, - 12498, 12501, 12504, 12507, 12510, 12511, 12512, 12513, 12514, 12516, - 12518, 12520, 12521, 12522, 12523, 12524, 12525, 12527, 12528, 12529, - 12530, 12450, 12495, 12442, 12540, 12488, 12450, 12523, 12501, 12449, - 12450, 12531, 12504, 12442, 12450, 12450, 12540, 12523, 12452, 12491, - 12531, 12463, 12441, 12452, 12531, 12481, 12454, 12457, 12531, 12456, - 12473, 12463, 12540, 12488, 12441, 12456, 12540, 12459, 12540, 12458, - 12531, 12473, 12458, 12540, 12512, 12459, 12452, 12522, 12459, 12521, - 12483, 12488, 12459, 12525, 12522, 12540, 12459, 12441, 12525, 12531, - 12459, 12441, 12531, 12510, 12461, 12441, 12459, 12441, 12461, 12441, - 12491, 12540, 12461, 12517, 12522, 12540, 12461, 12441, 12523, 12479, - 12441, 12540, 12461, 12525, 12461, 12525, 12463, 12441, 12521, 12512, - 12461, 12525, 12513, 12540, 12488, 12523, 12461, 12525, 12527, 12483, - 12488, 12463, 12441, 12521, 12512, 12463, 12441, 12521, 12512, 12488, - 12531, 12463, 12523, 12475, 12441, 12452, 12525, 12463, 12525, 12540, - 12493, 12465, 12540, 12473, 12467, 12523, 12490, 12467, 12540, 12507, - 12442, 12469, 12452, 12463, 12523, 12469, 12531, 12481, 12540, 12512, - 12471, 12522, 12531, 12463, 12441, 12475, 12531, 12481, 12475, 12531, - 12488, 12479, 12441, 12540, 12473, 12486, 12441, 12471, 12488, 12441, - 12523, 12488, 12531, 12490, 12494, 12494, 12483, 12488, 12495, 12452, - 12484, 12495, 12442, 12540, 12475, 12531, 12488, 12495, 12442, 12540, - 12484, 12495, 12441, 12540, 12524, 12523, 12498, 12442, 12450, 12473, - 12488, 12523, 12498, 12442, 12463, 12523, 12498, 12442, 12467, 12498, - 12441, 12523, 12501, 12449, 12521, 12483, 12488, 12441, 12501, 12451, - 12540, 12488, 12501, 12441, 12483, 12471, 12455, 12523, 12501, 12521, - 12531, 12504, 12463, 12479, 12540, 12523, 12504, 12442, 12477, 12504, - 12442, 12491, 12498, 12504, 12523, 12484, 12504, 12442, 12531, 12473, - 12504, 12442, 12540, 12471, 12441, 12504, 12441, 12540, 12479, 12507, - 12442, 12452, 12531, 12488, 12507, 12441, 12523, 12488, 12507, 12531, - 12507, 12442, 12531, 12488, 12441, 12507, 12540, 12523, 12507, 12540, - 12531, 12510, 12452, 12463, 12525, 12510, 12452, 12523, 12510, 12483, - 12495, 12510, 12523, 12463, 12510, 12531, 12471, 12519, 12531, 12511, - 12463, 12525, 12531, 12511, 12522, 12511, 12522, 12495, 12441, 12540, - 12523, 12513, 12459, 12441, 12513, 12459, 12441, 12488, 12531, 12513, - 12540, 12488, 12523, 12516, 12540, 12488, 12441, 12516, 12540, 12523, - 12518, 12450, 12531, 12522, 12483, 12488, 12523, 12522, 12521, 12523, - 12498, 12442, 12540, 12523, 12540, 12501, 12441, 12523, 12524, 12512, - 12524, 12531, 12488, 12465, 12441, 12531, 12527, 12483, 12488, 48, - 28857, 49, 28857, 50, 28857, 51, 28857, 52, 28857, 53, 28857, 54, 28857, - 55, 28857, 56, 28857, 57, 28857, 49, 48, 28857, 49, 49, 28857, 49, - 50, 28857, 49, 51, 28857, 49, 52, 28857, 49, 53, 28857, 49, 54, 28857, - 49, 55, 28857, 49, 56, 28857, 49, 57, 28857, 50, 48, 28857, 50, 49, - 28857, 50, 50, 28857, 50, 51, 28857, 50, 52, 28857, 104, 80, 97, 100, - 97, 65, 85, 98, 97, 114, 111, 86, 112, 99, 24179, 25104, 26157, 21644, - 22823, 27491, 26126, 27835, 26666, 24335, 20250, 31038, 112, 65, 110, - 65, 956, 65, 109, 65, 107, 65, 75, 66, 77, 66, 71, 66, 99, 97, 108, - 107, 99, 97, 108, 112, 70, 110, 70, 956, 70, 956, 103, 109, 103, 107, - 103, 72, 122, 107, 72, 122, 77, 72, 122, 71, 72, 122, 84, 72, 122, - 956, 108, 109, 108, 100, 108, 107, 108, 102, 109, 110, 109, 956, 109, - 109, 109, 99, 109, 107, 109, 109, 109, 50, 99, 109, 50, 109, 50, 107, - 109, 50, 109, 109, 51, 99, 109, 51, 109, 51, 107, 109, 51, 109, 8725, - 115, 109, 8725, 115, 50, 80, 97, 107, 80, 97, 77, 80, 97, 71, 80, 97, - 114, 97, 100, 114, 97, 100, 8725, 115, 114, 97, 100, 8725, 115, 50, - 112, 115, 110, 115, 956, 115, 109, 115, 112, 86, 110, 86, 956, 86, - 109, 86, 107, 86, 77, 86, 112, 87, 110, 87, 956, 87, 109, 87, 107, - 87, 77, 87, 107, 937, 77, 937, 97, 46, 109, 46, 66, 113, 99, 99, 99, - 100, 67, 8725, 107, 103, 67, 111, 46, 100, 66, 71, 121, 104, 97, 72, - 80, 105, 110, 75, 75, 75, 77, 107, 116, 108, 109, 108, 110, 108, 111, - 103, 108, 120, 109, 98, 109, 105, 108, 109, 111, 108, 80, 72, 112, - 46, 109, 46, 80, 80, 77, 80, 82, 115, 114, 83, 118, 87, 98, 49, 26085, - 50, 26085, 51, 26085, 52, 26085, 53, 26085, 54, 26085, 55, 26085, 56, - 26085, 57, 26085, 49, 48, 26085, 49, 49, 26085, 49, 50, 26085, 49, - 51, 26085, 49, 52, 26085, 49, 53, 26085, 49, 54, 26085, 49, 55, 26085, - 49, 56, 26085, 49, 57, 26085, 50, 48, 26085, 50, 49, 26085, 50, 50, - 26085, 50, 51, 26085, 50, 52, 26085, 50, 53, 26085, 50, 54, 26085, - 50, 55, 26085, 50, 56, 26085, 50, 57, 26085, 51, 48, 26085, 51, 49, - 26085, 35912, 26356, 36040, 28369, 20018, 21477, 22865, 21895, 22856, - 25078, 30313, 32645, 34367, 34746, 35064, 37007, 27138, 27931, 28889, - 29662, 33853, 37226, 39409, 20098, 21365, 27396, 29211, 34349, 40478, - 23888, 28651, 34253, 35172, 25289, 33240, 34847, 24266, 26391, 28010, - 29436, 37070, 20358, 20919, 21214, 25796, 27347, 29200, 30439, 34310, - 34396, 36335, 38706, 39791, 40442, 30860, 31103, 32160, 33737, 37636, - 35542, 22751, 24324, 31840, 32894, 29282, 30922, 36034, 38647, 22744, - 23650, 27155, 28122, 28431, 32047, 32311, 38475, 21202, 32907, 20956, - 20940, 31260, 32190, 33777, 38517, 35712, 25295, 35582, 20025, 23527, - 24594, 29575, 30064, 21271, 30971, 20415, 24489, 19981, 27852, 25976, - 32034, 21443, 22622, 30465, 33865, 35498, 27578, 27784, 25342, 33509, - 25504, 30053, 20142, 20841, 20937, 26753, 31975, 33391, 35538, 37327, - 21237, 21570, 24300, 26053, 28670, 31018, 38317, 39530, 40599, 40654, - 26310, 27511, 36706, 24180, 24976, 25088, 25754, 28451, 29001, 29833, - 31178, 32244, 32879, 36646, 34030, 36899, 37706, 21015, 21155, 21693, - 28872, 35010, 24265, 24565, 25467, 27566, 31806, 29557, 20196, 22265, - 23994, 24604, 29618, 29801, 32666, 32838, 37428, 38646, 38728, 38936, - 20363, 31150, 37300, 38584, 24801, 20102, 20698, 23534, 23615, 26009, - 29134, 30274, 34044, 36988, 26248, 38446, 21129, 26491, 26611, 27969, - 28316, 29705, 30041, 30827, 32016, 39006, 25134, 38520, 20523, 23833, - 28138, 36650, 24459, 24900, 26647, 38534, 21033, 21519, 23653, 26131, - 26446, 26792, 27877, 29702, 30178, 32633, 35023, 35041, 38626, 21311, - 28346, 21533, 29136, 29848, 34298, 38563, 40023, 40607, 26519, 28107, - 33256, 31520, 31890, 29376, 28825, 35672, 20160, 33590, 21050, 20999, - 24230, 25299, 31958, 23429, 27934, 26292, 36667, 38477, 24275, 20800, - 21952, 22618, 26228, 20958, 29482, 30410, 31036, 31070, 31077, 31119, - 38742, 31934, 34322, 35576, 36920, 37117, 39151, 39164, 39208, 40372, - 20398, 20711, 20813, 21193, 21220, 21329, 21917, 22022, 22120, 22592, - 22696, 23652, 24724, 24936, 24974, 25074, 25935, 26082, 26257, 26757, - 28023, 28186, 28450, 29038, 29227, 29730, 30865, 31049, 31048, 31056, - 31062, 31117, 31118, 31296, 31361, 31680, 32265, 32321, 32626, 32773, - 33261, 33401, 33879, 35088, 35222, 35585, 35641, 36051, 36104, 36790, - 38627, 38911, 38971, 102, 102, 102, 105, 102, 108, 102, 102, 105, 102, - 102, 108, 115, 116, 1396, 1398, 1396, 1381, 1396, 1387, 1406, 1398, - 1396, 1389, 1497, 1460, 1522, 1463, 1506, 1492, 1499, 1500, 1501, 1512, - 1514, 1513, 1473, 1513, 1474, 1513, 1468, 1473, 1513, 1468, 1474, 1488, - 1463, 1488, 1464, 1488, 1468, 1489, 1468, 1490, 1468, 1491, 1468, 1492, - 1468, 1493, 1468, 1494, 1468, 1496, 1468, 1497, 1468, 1498, 1468, 1499, - 1468, 1500, 1468, 1502, 1468, 1504, 1468, 1505, 1468, 1507, 1468, 1508, - 1468, 1510, 1468, 1511, 1468, 1512, 1468, 1513, 1468, 1514, 1468, 1493, - 1465, 1489, 1471, 1499, 1471, 1508, 1471, 1488, 1500, 1649, 1659, 1662, - 1664, 1658, 1663, 1657, 1700, 1702, 1668, 1667, 1670, 1671, 1677, 1676, - 1678, 1672, 1688, 1681, 1705, 1711, 1715, 1713, 1722, 1723, 1729, 1726, - 1746, 1709, 1735, 1734, 1736, 1739, 1733, 1737, 1744, 1609, 1610, 1620, - 1575, 1610, 1620, 1749, 1610, 1620, 1608, 1610, 1620, 1735, 1610, 1620, - 1734, 1610, 1620, 1736, 1610, 1620, 1744, 1610, 1620, 1609, 1740, 1610, - 1620, 1580, 1610, 1620, 1581, 1610, 1620, 1605, 1610, 1620, 1610, 1576, - 1580, 1576, 1581, 1576, 1582, 1576, 1605, 1576, 1609, 1576, 1610, 1578, - 1580, 1578, 1581, 1578, 1582, 1578, 1605, 1578, 1609, 1578, 1610, 1579, - 1580, 1579, 1605, 1579, 1609, 1579, 1610, 1580, 1581, 1580, 1605, 1581, - 1580, 1581, 1605, 1582, 1580, 1582, 1581, 1582, 1605, 1587, 1580, 1587, - 1581, 1587, 1582, 1587, 1605, 1589, 1581, 1589, 1605, 1590, 1580, 1590, - 1581, 1590, 1582, 1590, 1605, 1591, 1581, 1591, 1605, 1592, 1605, 1593, - 1580, 1593, 1605, 1594, 1580, 1594, 1605, 1601, 1580, 1601, 1581, 1601, - 1582, 1601, 1605, 1601, 1609, 1601, 1610, 1602, 1581, 1602, 1605, 1602, - 1609, 1602, 1610, 1603, 1575, 1603, 1580, 1603, 1581, 1603, 1582, 1603, - 1604, 1603, 1605, 1603, 1609, 1603, 1610, 1604, 1580, 1604, 1581, 1604, - 1582, 1604, 1605, 1604, 1609, 1604, 1610, 1605, 1580, 1605, 1581, 1605, - 1582, 1605, 1605, 1605, 1609, 1605, 1610, 1606, 1580, 1606, 1581, 1606, - 1582, 1606, 1605, 1606, 1609, 1606, 1610, 1607, 1580, 1607, 1605, 1607, - 1609, 1607, 1610, 1610, 1580, 1610, 1581, 1610, 1582, 1610, 1605, 1610, - 1609, 1610, 1610, 1584, 1648, 1585, 1648, 1609, 1648, 32, 1612, 1617, - 32, 1613, 1617, 32, 1614, 1617, 32, 1615, 1617, 32, 1616, 1617, 32, - 1617, 1648, 1610, 1620, 1585, 1610, 1620, 1586, 1610, 1620, 1606, 1576, - 1585, 1576, 1586, 1576, 1606, 1578, 1585, 1578, 1586, 1578, 1606, 1579, - 1585, 1579, 1586, 1579, 1606, 1605, 1575, 1606, 1585, 1606, 1586, 1606, - 1606, 1610, 1585, 1610, 1586, 1610, 1606, 1610, 1620, 1582, 1610, 1620, - 1607, 1576, 1607, 1578, 1607, 1589, 1582, 1604, 1607, 1606, 1607, 1607, - 1648, 1610, 1607, 1579, 1607, 1587, 1607, 1588, 1605, 1588, 1607, 1600, - 1614, 1617, 1600, 1615, 1617, 1600, 1616, 1617, 1591, 1609, 1591, 1610, - 1593, 1609, 1593, 1610, 1594, 1609, 1594, 1610, 1587, 1609, 1587, 1610, - 1588, 1609, 1588, 1610, 1581, 1609, 1581, 1610, 1580, 1609, 1580, 1610, - 1582, 1609, 1582, 1610, 1589, 1609, 1589, 1610, 1590, 1609, 1590, 1610, - 1588, 1580, 1588, 1581, 1588, 1582, 1588, 1585, 1587, 1585, 1589, 1585, - 1590, 1585, 1575, 1611, 1578, 1580, 1605, 1578, 1581, 1580, 1578, 1581, - 1605, 1578, 1582, 1605, 1578, 1605, 1580, 1578, 1605, 1581, 1578, 1605, - 1582, 1580, 1605, 1581, 1581, 1605, 1610, 1581, 1605, 1609, 1587, 1581, - 1580, 1587, 1580, 1581, 1587, 1580, 1609, 1587, 1605, 1581, 1587, 1605, - 1580, 1587, 1605, 1605, 1589, 1581, 1581, 1589, 1605, 1605, 1588, 1581, - 1605, 1588, 1580, 1610, 1588, 1605, 1582, 1588, 1605, 1605, 1590, 1581, - 1609, 1590, 1582, 1605, 1591, 1605, 1581, 1591, 1605, 1605, 1591, 1605, - 1610, 1593, 1580, 1605, 1593, 1605, 1605, 1593, 1605, 1609, 1594, 1605, - 1605, 1594, 1605, 1610, 1594, 1605, 1609, 1601, 1582, 1605, 1602, 1605, - 1581, 1602, 1605, 1605, 1604, 1581, 1605, 1604, 1581, 1610, 1604, 1581, - 1609, 1604, 1580, 1580, 1604, 1582, 1605, 1604, 1605, 1581, 1605, 1581, - 1580, 1605, 1581, 1605, 1605, 1581, 1610, 1605, 1580, 1581, 1605, 1580, - 1605, 1605, 1582, 1580, 1605, 1582, 1605, 1605, 1580, 1582, 1607, 1605, - 1580, 1607, 1605, 1605, 1606, 1581, 1605, 1606, 1581, 1609, 1606, 1580, - 1605, 1606, 1580, 1609, 1606, 1605, 1610, 1606, 1605, 1609, 1610, 1605, - 1605, 1576, 1582, 1610, 1578, 1580, 1610, 1578, 1580, 1609, 1578, 1582, - 1610, 1578, 1582, 1609, 1578, 1605, 1610, 1578, 1605, 1609, 1580, 1605, - 1610, 1580, 1581, 1609, 1580, 1605, 1609, 1587, 1582, 1609, 1589, 1581, - 1610, 1588, 1581, 1610, 1590, 1581, 1610, 1604, 1580, 1610, 1604, 1605, - 1610, 1610, 1581, 1610, 1610, 1580, 1610, 1610, 1605, 1610, 1605, 1605, - 1610, 1602, 1605, 1610, 1606, 1581, 1610, 1593, 1605, 1610, 1603, 1605, - 1610, 1606, 1580, 1581, 1605, 1582, 1610, 1604, 1580, 1605, 1603, 1605, - 1605, 1580, 1581, 1610, 1581, 1580, 1610, 1605, 1580, 1610, 1601, 1605, - 1610, 1576, 1581, 1610, 1587, 1582, 1610, 1606, 1580, 1610, 1589, 1604, - 1746, 1602, 1604, 1746, 1575, 1604, 1604, 1607, 1575, 1603, 1576, 1585, - 1605, 1581, 1605, 1583, 1589, 1604, 1593, 1605, 1585, 1587, 1608, 1604, - 1593, 1604, 1610, 1607, 1608, 1587, 1604, 1605, 1589, 1604, 1609, 1589, - 1604, 1609, 32, 1575, 1604, 1604, 1607, 32, 1593, 1604, 1610, 1607, - 32, 1608, 1587, 1604, 1605, 1580, 1604, 32, 1580, 1604, 1575, 1604, - 1607, 1585, 1740, 1575, 1604, 8212, 8211, 95, 123, 125, 12308, 12309, - 12304, 12305, 12298, 12299, 12300, 12301, 12302, 12303, 44, 12289, - 58, 63, 33, 35, 38, 42, 45, 60, 62, 92, 36, 37, 64, 32, 1611, 1600, - 1611, 32, 1612, 32, 1613, 32, 1614, 1600, 1614, 32, 1615, 1600, 1615, - 32, 1616, 1600, 1616, 32, 1617, 1600, 1617, 32, 1618, 1600, 1618, 1569, - 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, - 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1601, 1602, 1603, 1604, - 1605, 1606, 1607, 1608, 1610, 1604, 1575, 1619, 1604, 1575, 1620, 1604, - 1575, 1621, 1604, 1575, 34, 39, 47, 91, 93, 94, 124, 126, 10629, 10630, - 12290, 12539, 12449, 12451, 12453, 12455, 12457, 12515, 12517, 12519, - 12483, 12540, 12531, 12441, 12442, 162, 163, 172, 166, 165, 8361, 9474, - 8592, 8593, 8594, 8595, 9632, 9675, 119127, 119141, 119128, 119141, - 119128, 119141, 119150, 119128, 119141, 119151, 119128, 119141, 119152, - 119128, 119141, 119153, 119128, 119141, 119154, 119225, 119141, 119226, - 119141, 119225, 119141, 119150, 119226, 119141, 119150, 119225, 119141, - 119151, 119226, 119141, 119151, 913, 914, 916, 917, 918, 919, 921, - 922, 923, 924, 925, 926, 927, 929, 931, 932, 934, 935, 936, 8711, 945, - 948, 950, 951, 955, 957, 958, 959, 963, 964, 965, 967, 968, 969, 8706, - 20029, 20024, 20033, 131362, 20320, 20411, 20482, 20602, 20633, 20687, - 13470, 132666, 20820, 20836, 20855, 132380, 13497, 20839, 20877, 132427, - 20887, 20900, 20172, 20908, 20917, 168415, 20995, 13535, 21051, 21062, - 21106, 21111, 13589, 21191, 21242, 21253, 21254, 21321, 21338, 21363, - 21373, 21375, 133676, 28784, 21450, 21471, 133987, 21483, 21489, 21510, - 21662, 21560, 21576, 21608, 21666, 21750, 21776, 21843, 21859, 21892, - 21913, 21931, 21939, 21954, 22294, 22295, 22097, 22132, 22766, 22478, - 22516, 22541, 22411, 22578, 22577, 22700, 136420, 22770, 22775, 22790, - 22810, 22818, 22882, 136872, 136938, 23020, 23067, 23079, 23000, 23142, - 14062, 136042, 23304, 23358, 137672, 23491, 23512, 23539, 138008, 23551, - 23558, 24371, 14209, 23648, 23744, 23693, 138724, 23875, 138726, 23918, - 23915, 23932, 24033, 24034, 14383, 24061, 24104, 24125, 24169, 14434, - 139651, 14460, 24240, 24243, 24246, 172946, 140081, 33281, 24354, 14535, - 144056, 156122, 24418, 24427, 14563, 24474, 24525, 24535, 24569, 24705, - 14650, 14620, 141012, 24775, 24904, 24908, 24910, 24954, 25010, 24996, - 25007, 25054, 25104, 25115, 25181, 25265, 25300, 25424, 142092, 25405, - 25340, 25448, 25475, 25572, 142321, 25634, 25541, 25513, 14894, 25705, - 25726, 25757, 25719, 14956, 25964, 143370, 26083, 26360, 26185, 15129, - 15112, 15076, 20882, 20885, 26368, 26268, 32941, 17369, 26395, 26401, - 26462, 26451, 144323, 15177, 26618, 26501, 26706, 144493, 26766, 26655, - 26900, 15261, 26946, 27043, 27114, 27304, 145059, 27355, 15384, 27425, - 145575, 27476, 15438, 27506, 27551, 27579, 146061, 138507, 146170, - 27726, 146620, 27839, 27853, 27751, 27926, 27966, 28009, 28024, 28037, - 146718, 27956, 28207, 28270, 15667, 28363, 28359, 147153, 28153, 28526, - 147294, 147342, 28614, 28729, 28702, 28699, 15766, 28746, 28797, 28791, - 28845, 132389, 28997, 148067, 29084, 17323, 29224, 29237, 29264, 149000, - 29312, 29333, 149301, 149524, 29562, 29579, 16044, 29605, 16056, 29767, - 29788, 29809, 29829, 29898, 16155, 29988, 150582, 30014, 150674, 139679, - 30224, 151457, 151480, 151620, 16380, 16392, 30452, 151795, 151794, - 151833, 151859, 30494, 30495, 30538, 16441, 30603, 16454, 16534, 152605, - 30798, 30924, 16611, 153126, 153242, 153285, 31211, 16687, 31306, 31311, - 153980, 154279, 31406, 16898, 154539, 31686, 31689, 16935, 154752, - 31954, 17056, 31976, 31971, 32000, 155526, 32099, 17153, 32199, 32258, - 32325, 17204, 156200, 156231, 17241, 156377, 32634, 156478, 32661, - 32762, 156890, 156963, 32864, 157096, 32880, 144223, 17365, 32946, - 33027, 17419, 33086, 23221, 157607, 157621, 144275, 144284, 33284, - 36766, 17515, 33425, 33419, 33437, 21171, 33457, 33459, 33469, 33510, - 158524, 33565, 33635, 33709, 33571, 33725, 33767, 33619, 33738, 33740, - 33756, 158774, 159083, 158933, 17707, 34033, 34035, 34070, 160714, - 34148, 159532, 17757, 17761, 159665, 159954, 17771, 34384, 34407, 34409, - 34473, 34440, 34574, 34530, 34681, 34600, 34667, 34694, 19799, 34785, - 34817, 17913, 34912, 161383, 35031, 35038, 17973, 35066, 13499, 161966, - 162150, 18110, 18119, 35488, 35565, 35722, 162984, 36011, 36033, 36123, - 36215, 163631, 133124, 36299, 36284, 36336, 133342, 36564, 36664, 165330, - 165357, 37012, 37105, 37137, 165678, 37147, 37432, 37591, 37592, 37500, - 37881, 37909, 166906, 38283, 18837, 38327, 167287, 18918, 38595, 23986, - 38691, 168261, 168474, 19054, 19062, 38880, 168970, 19122, 169110, - 38923, 38953, 169398, 39138, 19251, 39209, 39335, 39362, 39422, 19406, - 170800, 39698, 40000, 40189, 19662, 19693, 40295, 172238, 19704, 172293, - 172558, 172689, 19798, 40702, 40709, 40719, 40726, 173568 -}; - - -/* - * This macro extracts the information about a character from the - * Unicode character tables. - */ - -#define GetUniCharDecompInfo(ch) (decompGroupMap[(decompPageMap[(((int)(ch)) & 0x1fffff) >> DECOMP_OFFSET_BITS] << DECOMP_OFFSET_BITS) | ((ch) & ((1 << DECOMP_OFFSET_BITS)-1))]) - -#define GetDecompShift(info) ((info) & 0xffff) -#define GetDecompLen(info) ((info) >> 16) - - -#define COMP_OFFSET_BITS 8 - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned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 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5 -}; - -/* - * The groupMap is indexed by combining the alternate page number with - * the page offset and returns a group number that identifies a unique - * set of character attributes. - */ - -static int compGroupMap[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 65564, 65640, 65738, -1, -1, 30, - 91, 141, 65, 121, 65701, 38, 94, 1, 65604, 124, 44, 100, 12, 76, 77, - -1, 48, 105, 17, 84, 136, 54, 113, 23, 24, -1, -1, -1, -1, -1, -1, - 140, 64, 120, 71, 123, 65573, 99, 10, 75, 129, 47, 104, 16, 15, 83, - 135, -1, 110, 22, 86, 137, 59, 117, 118, 28, 89, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, - 65713, 65575, 101, 65550, -1, -1, 42, -1, -1, -1, -1, 65576, -1, -1, - -1, -1, 130, 50, 65678, -1, 65628, -1, -1, -1, 115, -1, -1, -1, -1, - -1, 32, -1, 65742, 65600, 67, 65704, -1, -1, 5, -1, -1, -1, -1, 65549, - -1, -1, -1, -1, 107, 20, 65626, -1, 65587, -1, -1, -1, 87, -1, -1, - -1, -1, -1, 142, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 106, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, 93, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65624, 65722, -1, -1, -1, -1, 65632, 65730, - -1, -1, -1, -1, -1, -1, 65597, 65699, 65567, 65649, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65728, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, 131, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, 33, -1, -1, - -1, -1, -1, -1, 65546, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65593, 65696, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65675, - 65554, 65625, 65724, -1, -1, -1, -1, 65731, 65590, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 65729, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 131073, 131074, 131075, 131077, 131079, -1, 131080, 131082, 131083, - 131084, 131098, 131102, 131085, -1, -1, 131086, -1, 131087, -1, 131076, - 131078, -1, -1, -1, -1, -1, -1, 131103, -1, -1, -1, -1, -1, -1, -1, - 131088, 131104, 131101, 131097, 131092, 131089, -1, -1, -1, -1, 131094, - 131093, -1, 131090, 131095, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 131091, -1, -1, 131072, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 34, -1, -1, -1, 122, -1, 96, -1, 8, -1, -1, -1, -1, -1, 80, - -1, 65586, -1, -1, -1, 85, -1, -1, -1, 26, -1, -1, 65539, -1, 65707, - -1, -1, 2, -1, -1, -1, 95, -1, 7, -1, 125, -1, -1, -1, -1, -1, 51, - -1, 111, -1, -1, -1, 56, -1, -1, -1, 0, 138, 62, -1, -1, 65664, -1, - -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 65736, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, -1, - 65714, -1, 103, 14, 65622, 132, -1, 65581, -1, -1, -1, 65727, -1, -1, - -1, -1, 139, -1, -1, -1, 65566, -1, -1, -1, 65706, -1, 65663, -1, -1, - 72, -1, -1, 65670, -1, 79, 133, 65582, 52, -1, 65556, -1, -1, -1, 65687, - -1, -1, -1, -1, 63, -1, -1, -1, 65744, -1, -1, -1, 65659, -1, 65595, - -1, -1, -1, -1, -1, -1, -1, -1, 65658, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65661, 65545, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 65651, 65542, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 65682, 65559, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 143, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 65733, -1, 65657, -1, -1, -1, -1, -1, -1, -1, -1, 196618, 131108, 196619, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65618, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65612, -1, -1, 65611, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65734, -1, -1, -1, -1, -1, -1, -1, - 65656, -1, -1, 65655, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 196611, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 196612, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 196613, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 196614, 196615, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65577, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131105, -1, -1, - -1, -1, -1, -1, -1, 98, 65584, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 131106, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65578, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 65716, -1, -1, 196616, -1, -1, -1, 127, -1, -1, -1, 65630, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 131107, 196617, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131096, -1, - -1, -1, -1, -1, -1, -1, 19, 65695, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 196610, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 131081, -1, -1, -1, -1, 196608, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3, -1, -1, 65538, -1, -1, 196609, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65616, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65679, - 65557, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65685, 65561, -1, -1, -1, -1, -1, -1, 65743, 65601, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 114, 25, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65673, 65553, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 65540, 65605, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 82, 134, 65591, 65692, 65693, 65565, 65641, 65739, 58, - 116, 65568, 65652, 65543, 65609, 65610, 65710, 36, 92, -1, -1, -1, - -1, -1, -1, 9, 73, -1, -1, -1, -1, -1, -1, 53, 108, 65690, 65563, 65639, - 65737, 65598, 65700, 27, 88, 65541, 65606, 65607, 65709, 65572, 65667, - 11, 69, -1, -1, -1, -1, -1, -1, 126, 45, -1, -1, -1, -1, -1, -1, 13, - 78, -1, -1, -1, -1, -1, -1, 55, 112, -1, -1, -1, -1, -1, -1, 29, 90, - -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, 128, 46, 65683, - 65560, 65635, 65732, 65592, 65694, 109, 21, 65642, 65740, 65599, 65702, - 65569, 65653, 65544, -1, -1, -1, 65574, -1, -1, -1, -1, -1, -1, -1, - 65552, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65537, -1, -1, -1, -1, -1, -1, -1, - -1, 40, -1, -1, -1, -1, -1, -1, 65680, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65570, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65705, -1, 65660, -1, 65614, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65698, -1, 65644, -1, 65741, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65711, -1, -1, -1, -1, 65619, -1, -1, 65676, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 65668, -1, 65548, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65648, - -1, -1, -1, -1, -1, -1, 65547, -1, 65715, -1, -1, 65551, -1, -1, -1, - -1, 65681, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 65596, -1, -1, 65647, 65536, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65721, 65583, -1, -1, 65558, 65631, -1, - -1, 65688, 65562, 65637, 65735, -1, -1, -1, -1, 65646, 65745, -1, -1, - 65571, 65662, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65580, 65579, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65602, -1, - -1, -1, -1, -1, 65613, 65712, -1, 65669, -1, -1, -1, -1, -1, -1, 65555, - 65629, 65725, 65588, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65718, -1, -1, - -1, -1, 65708, -1, 65703, -1, 65697, -1, 65686, -1, 65684, -1, 65677, - -1, 65671, -1, 65665, -1, 65650, -1, 65645, -1, 65638, -1, 65633, -1, - -1, 65623, -1, 65620, -1, 65615, -1, -1, -1, -1, -1, -1, 60, -1, -1, - 74, -1, -1, 68, -1, -1, 61, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 131099, 131100, -1, -1, 65717, -1, -1, -1, -1, - -1, -1, -1, -1, 65691, -1, -1, -1, -1, 65674, -1, 65672, -1, 65666, - -1, 65654, -1, 65643, -1, 65636, -1, 65634, -1, 65627, -1, 65621, -1, - 65617, -1, 65608, -1, 65603, -1, -1, 65594, -1, 65589, -1, 65585, -1, - -1, -1, -1, -1, -1, 41, -1, -1, 31, -1, -1, 49, -1, -1, 43, -1, -1, - 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 65726, 65723, 65720, 65719, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 65689, -1, -1 -}; - -/* - * Lists of compositions for characters that appears only in one composition - */ - -static int compFirstList[][2] = { - {824, 8817}, {837, 8119}, {3530, 3549}, {837, 8116}, {770, 7896}, - {837, 8090}, {776, 1243}, {837, 8076}, {837, 8114}, {783, 1143}, - {780, 494}, {824, 8772}, {824, 8742}, {769, 7727}, {769, 7688}, - {824, 8777}, {837, 8178}, {770, 7879}, {772, 481}, {824, 8938}, - {769, 1116}, {772, 7737}, {824, 8824}, {776, 1259}, {837, 8099}, - {772, 7773}, {824, 8833}, {837, 8083}, {824, 8814}, {837, 8069}, - {776, 1268}, {776, 7802}, {837, 8074}, {837, 8110}, {837, 8183}, - {824, 8840}, {837, 8094}, {775, 7711}, {837, 8130}, {769, 506}, - {769, 7726}, {3031, 2964}, {3158, 3144}, {824, 8931}, {824, 8930}, - {769, 1036}, {776, 1247}, {824, 8821}, {3006, 3019}, {12441, 12489}, - {788, 8172}, {769, 511}, {824, 8941}, {12441, 12487}, {772, 561}, - {837, 8066}, {837, 8102}, {772, 492}, {12441, 12485}, {776, 1261}, - {824, 8802}, {769, 7800}, {837, 8086}, {837, 8108}, {769, 507}, - {775, 7785}, {824, 8876}, {12441, 12482}, {770, 308}, {770, 7897}, - {837, 8091}, {837, 8092}, {12441, 12480}, {837, 8077}, {837, 8078}, - {1620, 1728}, {1620, 1747}, {824, 8877}, {824, 8622}, {12441, 12393}, - {4142, 4134}, {12441, 12478}, {1620, 1730}, {824, 8713}, - {12441, 12391}, {12441, 12476}, {776, 1246}, {12441, 12389}, - {775, 7780}, {774, 7708}, {772, 555}, {12441, 12474}, {769, 510}, - {824, 8939}, {3285, 3275}, {824, 8825}, {775, 7782}, {12441, 12386}, - {12441, 12472}, {837, 8100}, {12441, 12470}, {824, 8928}, - {12441, 12384}, {837, 8084}, {824, 8800}, {837, 8070}, {837, 8106}, - {12441, 12468}, {824, 8655}, {12441, 12382}, {824, 8836}, - {824, 8816}, {824, 8769}, {776, 7803}, {12441, 12380}, {776, 1242}, - {837, 8075}, {837, 8111}, {12441, 12466}, {2364, 2356}, {2364, 2353}, - {1620, 1574}, {776, 1111}, {776, 1273}, {824, 8603}, {783, 1142}, - {824, 8841}, {776, 1260}, {837, 8180}, {12441, 12378}, {12441, 12464}, - {837, 8095}, {824, 8740}, {824, 8879}, {769, 1107}, {12441, 12376}, - {12441, 12462}, {770, 7878}, {12441, 12460}, {772, 480}, - {824, 8716}, {12441, 12374}, {772, 554}, {772, 7736}, {837, 8135}, - {824, 8813}, {776, 1258}, {837, 8098}, {12441, 12372}, {772, 7772}, - {12441, 12370}, {776, 1255}, {824, 8832}, {12441, 12542}, - {837, 8082}, {12441, 12532}, {837, 8067}, {837, 8068}, {837, 8103}, - {3390, 3403}, {772, 493}, {12441, 12368}, {824, 8653}, {769, 7801}, - {837, 8087}, {775, 7710}, {837, 8109}, {12441, 12366}, {769, 7689}, - {824, 8602}, {776, 1272}, {837, 8132}, {12441, 12364}, {837, 8093}, - {837, 8079}, {824, 8708}, {824, 8878}, {772, 478}, {769, 1027}, - {824, 8775}, {3285, 3264}, {12441, 12446}, {12441, 12436}, - {12441, 12538}, {12441, 12537}, {824, 8820}, {775, 7781}, - {12441, 12536}, {774, 7709}, {824, 8940}, {12441, 12535}, - {776, 1254}, {775, 7835}, {780, 495}, {775, 7783}, {772, 560}, - {837, 8101}, {1620, 1572}, {2364, 2345}, {824, 8929}, {776, 1031}, - {837, 8085}, {824, 8815}, {837, 8071}, {837, 8107}, {824, 8654}, - {772, 479}, {775, 7784}, {776, 1269}, {824, 8837} -}; - -static int compSecondList[][2] = { - {3545, 3548}, {3545, 3550}, {3398, 3404}, {2503, 2507}, {2503, 2508}, - {2887, 2891}, {2887, 2888}, {2887, 2892}, {3270, 3274}, {3270, 3272}, - {1575, 1570}, {1575, 1573} -}; - -/* - * Compositions matrix - */ - -static int compBothList[144][37] = { - { - 8179, 8060, 974, 0, 8032, 0, 8033, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 204, 205, 206, 0, 296, 0, 298, 300, 0, 304, 207, 7880, 463, - 520, 522, 7882, 302, 7724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 - }, - { - 8115, 8048, 940, 0, 7936, 0, 7937, 8113, 8112, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 8118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8157, 8158, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7873, 7871, 0, 0, 7877, 0, 0, 0, 0, 0, 0, 7875, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7846, 7844, 0, 0, 7850, 0, 0, 0, 0, 0, 0, 7848, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8131, 8052, 942, 0, 7968, 0, 7969, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8154, 906, 0, 7992, 0, 7993, 8153, 8152, 0, 0, 938, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 - }, - { - 0, 7962, 7964, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 293, 0, 0, 0, 0, 0, 0, 7715, 7719, 0, 543, 0, 0, 7717, - 0, 0, 0, 7721, 7723, 0, 7830, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 - }, - { - 0, 7986, 7988, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7990, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 504, 323, 0, 0, 209, 0, 0, 0, 0, 7748, 0, 0, 327, 0, 0, 7750, - 0, 0, 0, 325, 0, 7754, 7752, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 - }, - { - 0, 8002, 8004, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 1217, 0, 0, 1244, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 505, 324, 0, 0, 241, 0, 0, 0, 0, 7749, 0, 0, 328, 0, 0, 7751, - 0, 0, 0, 326, 0, 7755, 7753, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 - }, - { - 0, 0, 7743, 0, 0, 0, 0, 0, 0, 0, 7745, 0, 0, 0, 0, 0, 7747, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7786, 0, 0, 356, 0, 0, 7788, 0, 0, - 0, 354, 0, 7792, 7790, 0, 538, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7701, 7703, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3402, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 7757, 0, 0, 0, 0, 557, 0, 0, 0, 7759, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8105, 8043, 8045, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 8047, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 347, 349, 0, 0, 0, 0, 0, 0, 7777, 0, 0, 353, 0, 0, 7779, - 0, 0, 0, 351, 0, 0, 0, 0, 537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7922, 221, 374, 0, 7928, 0, 562, 0, 0, 7822, 376, 7926, 0, 0, - 0, 7924, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 - }, - { - 0, 0, 377, 7824, 0, 0, 0, 0, 0, 0, 379, 0, 0, 381, 0, 0, 7826, - 0, 0, 0, 0, 0, 0, 7828, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 7853, 0, 0, 0, 0, 7863, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8188, 8186, 911, 0, 8040, 0, 8041, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8088, 7978, 7980, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7982, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7923, 253, 375, 0, 7929, 0, 563, 0, 0, 7823, 255, 7927, 0, 0, - 0, 7925, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7833, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 - }, - { - 0, 8018, 8020, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8022, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 192, 193, 194, 0, 195, 0, 256, 258, 0, 550, 196, 7842, 461, - 512, 514, 7840, 260, 0, 0, 0, 0, 0, 0, 0, 0, 197, 0, 0, 7680, 0, - 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12499, 12500, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7847, 7845, 0, 0, 7851, 0, 0, 0, 0, 0, 0, 7849, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7915, 7913, 0, 0, 7919, 0, 0, 0, 0, 0, 0, 7917, 0, 0, 0, 7921, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8124, 8122, 902, 0, 7944, 0, 7945, 8121, 8120, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12508, 12509, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7954, 7956, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7760, 7762, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 500, 284, 0, 0, 0, 7712, 286, 0, 288, 0, 0, 486, 0, 0, 0, - 0, 0, 0, 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 979, 0, 0, 0, 0, 0, 0, 0, 0, 980, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8141, 8142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12496, 12497, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7872, 7870, 0, 0, 7876, 0, 0, 0, 0, 0, 0, 7874, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12505, 12506, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 317, 0, 0, 7734, 0, 0, - 0, 315, 0, 7740, 7738, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7995, 7997, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7999, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8097, 8035, 8037, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 8039, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 7729, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 489, 0, 0, 7731, 0, 0, - 0, 311, 0, 0, 7733, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 340, 0, 0, 0, 0, 0, 0, 0, 7768, 0, 0, 344, 528, 530, 7770, - 0, 0, 0, 342, 0, 0, 7774, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12502, 12503, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 7756, 0, 0, 0, 0, 556, 0, 0, 0, 7758, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8056, 972, 0, 8000, 0, 8001, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 1117, 0, 0, 0, 0, 0, 1251, 1081, 0, 0, 1253, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8080, 7970, 7972, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7974, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7808, 7810, 372, 0, 0, 0, 0, 0, 0, 7814, 7812, 0, 0, 0, 0, 7816, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8010, 8012, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8058, 973, 0, 8016, 0, 8017, 8161, 8160, 0, 0, 971, 0, 0, 0, - 0, 0, 0, 0, 8166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12412, 12413, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8072, 7946, 7948, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7950, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 7805, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7807, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12400, 12401, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12409, 12410, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8162, 944, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8167, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 1263, 1118, 0, 0, 1265, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1267, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7683, 0, 0, 0, 0, 0, 7685, 0, 0, - 0, 0, 0, 0, 7687, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7690, 0, 0, 270, 0, 0, 7692, 0, 0, - 0, 7696, 0, 7698, 7694, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 12403, 12404, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 236, 237, 238, 0, 297, 0, 299, 301, 0, 0, 239, 7881, 464, 521, - 523, 7883, 303, 7725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 - }, - { - 0, 210, 211, 212, 0, 213, 0, 332, 334, 0, 558, 214, 7886, 465, - 524, 526, 7884, 490, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 336, 416, - 0, 0, 0, 0, 0 - }, - { - 0, 0, 7764, 0, 0, 0, 0, 0, 0, 0, 7766, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8003, 8005, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 1104, 0, 0, 0, 0, 0, 0, 1239, 0, 0, 1105, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8184, 908, 0, 8008, 0, 8009, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7900, 7898, 0, 0, 7904, 0, 0, 0, 0, 0, 0, 7902, 0, 0, 0, 7906, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8064, 7938, 7940, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7942, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 242, 243, 244, 0, 245, 0, 333, 335, 0, 559, 246, 7887, 466, - 525, 527, 7885, 491, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 337, 417, - 0, 0, 0, 0, 0 - }, - { - 0, 217, 218, 219, 0, 360, 0, 362, 364, 0, 0, 220, 7910, 467, 532, - 534, 7908, 370, 7796, 0, 0, 0, 7798, 0, 0, 0, 366, 0, 0, 0, 368, - 431, 7794, 0, 0, 0, 0 - }, - { - 0, 8170, 910, 0, 0, 0, 8025, 8169, 8168, 0, 0, 939, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7787, 7831, 0, 357, 0, 0, 7789, 0, - 0, 0, 355, 0, 7793, 7791, 0, 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 - }, - { - 0, 476, 472, 0, 0, 0, 0, 470, 0, 0, 0, 0, 0, 474, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8089, 7979, 7981, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7983, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 378, 7825, 0, 0, 0, 0, 0, 0, 380, 0, 0, 382, 0, 0, 7827, - 0, 0, 0, 0, 0, 0, 7829, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8019, 8021, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8023, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7682, 0, 0, 0, 0, 0, 7684, 0, 0, - 0, 0, 0, 0, 7686, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7955, 7957, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7761, 7763, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 292, 0, 0, 0, 0, 0, 0, 7714, 7718, 0, 542, 0, 0, 7716, - 0, 0, 0, 7720, 7722, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 - }, - { - 0, 8050, 941, 0, 7952, 0, 7953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8140, 8138, 905, 0, 7976, 0, 7977, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 1232, 0, 0, 1234, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3018, 3020, 0, 0 - }, - { - 0, 0, 501, 285, 0, 0, 0, 7713, 287, 0, 289, 0, 0, 487, 0, 0, 0, - 0, 0, 0, 291, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 7742, 0, 0, 0, 0, 0, 0, 0, 7744, 0, 0, 0, 0, 0, 7746, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 508, 0, 0, 0, 0, 482, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8173, 901, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8129, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 1024, 0, 0, 0, 0, 0, 0, 1238, 0, 0, 1025, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 314, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 318, 0, 0, 7735, 0, 0, - 0, 316, 0, 7741, 7739, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 346, 348, 0, 0, 0, 0, 0, 0, 7776, 0, 0, 352, 0, 0, 7778, - 0, 0, 0, 350, 0, 0, 0, 0, 536, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7700, 7702, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7891, 7889, 0, 0, 7895, 0, 0, 0, 0, 0, 0, 7893, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8081, 7971, 7973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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7809, 7811, 373, 0, 0, 0, 0, 0, 0, 7815, 7813, 0, 0, 0, 0, 7817, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 7832, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7819, 7821, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7914, 7912, 0, 0, 7918, 0, 0, 0, 0, 0, 0, 7916, 0, 0, 0, 7920, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 263, 265, 0, 0, 0, 0, 0, 0, 267, 0, 0, 269, 0, 0, 0, 0, 0, - 0, 231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 200, 201, 202, 0, 7868, 0, 274, 276, 0, 278, 203, 7866, 282, - 516, 518, 7864, 280, 7706, 0, 552, 0, 7704, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8136, 904, 0, 7960, 0, 7961, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 232, 233, 234, 0, 7869, 0, 275, 277, 0, 279, 235, 7867, 283, - 517, 519, 7865, 281, 7707, 0, 553, 0, 7705, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 7728, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 488, 0, 0, 7730, 0, 0, - 0, 310, 0, 0, 7732, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 8054, 943, 0, 7984, 0, 7985, 8145, 8144, 0, 0, 970, 0, 0, 0, - 0, 0, 0, 0, 8150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 - }, - { - 0, 7994, 7996, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7998, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3271, 0 - }, - { - 8096, 8034, 8036, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 8038, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 309, 0, 0, 0, 0, 0, 0, 0, 0, 0, 496, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7890, 7888, 0, 0, 7894, 0, 0, 0, 0, 0, 0, 7892, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7901, 7899, 0, 0, 7905, 0, 0, 0, 0, 0, 0, 7903, 0, 0, 0, 7907, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 1037, 0, 0, 0, 0, 0, 1250, 1049, 0, 0, 1252, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 1218, 0, 0, 1245, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 8065, 7939, 7941, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7943, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 7765, 0, 0, 0, 0, 0, 0, 0, 7767, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 7804, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7806, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 249, 250, 251, 0, 361, 0, 363, 365, 0, 0, 252, 7911, 468, 533, - 535, 7909, 371, 7797, 0, 0, 0, 7799, 0, 0, 0, 367, 0, 0, 0, 369, - 432, 7795, 0, 0, 0, 0 - }, - { - 0, 8146, 912, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8151, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 1262, 1038, 0, 0, 1264, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1266, 0, 0, 0, 0, 0, 0 - }, - { - 0, 224, 225, 226, 0, 227, 0, 257, 259, 0, 551, 228, 7843, 462, - 513, 515, 7841, 261, 0, 0, 0, 0, 0, 0, 0, 0, 229, 0, 0, 7681, 0, - 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 262, 264, 0, 0, 0, 0, 0, 0, 266, 0, 0, 268, 0, 0, 0, 0, 0, - 0, 199, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 7856, 7854, 0, 0, 7860, 0, 0, 0, 0, 0, 0, 7858, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1571 - }, -}; - - -#define GetUniCharCompInfo(ch) (compGroupMap[(compPageMap[(((int)(ch)) & 0x1fffff) >> COMP_OFFSET_BITS] << COMP_OFFSET_BITS) | ((ch) & ((1 << COMP_OFFSET_BITS)-1))]) - -#define CompSingleMask (1 << 16) -#define CompMask ((1 << 16) - 1) -#define CompSecondMask (1 << 17) - diff --git a/src/stringprep/uni_parse.tcl b/src/stringprep/uni_parse.tcl deleted file mode 100644 index 100631b6b..000000000 --- a/src/stringprep/uni_parse.tcl +++ /dev/null @@ -1,437 +0,0 @@ -# uni_parse.tcl -- -# -# This program parses the UnicodeData file and generates the -# corresponding uni_data.c file with compressed character -# data tables. The input to this program should be rfc3454.txt -# -# Copyright (c) 1998-1999 by Scriptics Corporation. -# All rights reserved. -# -# Modified for ejabberd by Alexey Shchepin -# -# RCS: @(#) $Id$ - - -namespace eval uni { - set shift 8; # number of bits of data within a page - # This value can be adjusted to find the - # best split to minimize table size - - variable pMap; # map from page to page index, each entry is - # an index into the pages table, indexed by - # page number - variable pages; # map from page index to page info, each - # entry is a list of indices into the groups - # table, the list is indexed by the offset - variable groups; # list of character info values, indexed by - # group number, initialized with the - # unassigned character group -} - -proc uni::getValue {i} { - variable casemap - variable casemap2 - variable tablemap - - if {[info exists tablemap($i)]} { - set tables $tablemap($i) - } else { - set tables {} - } - - if {[info exists casemap2($i)]} { - set multicase 1 - set delta $casemap2($i) - } else { - set multicase 0 - if {[info exists casemap($i)]} { - set delta $casemap($i) - } else { - set delta 0 - } - } - - if {abs($delta) > 0xFFFFF} { - puts "delta must be less than 22 bits wide" - exit - } - - set ac 0 - set c11 0 - set c21 0 - set b1 0 - set d1 0 - set d2 0 - set xnp 0 - - foreach tab $tables { - switch -glob -- $tab { - C.1.1 {set c11 1} - C.2.1 {set c21 1} - C.* {set ac 1} - A.1 {set ac 1} - B.1 {set b1 1} - D.1 {set d1 1} - D.2 {set d2 1} - XNP {set xnp 1} - } - } - - set val [expr {($ac << 0) | - ($c11 << 1) | - ($c21 << 2) | - ($b1 << 3) | - ($d1 << 4) | - ($d2 << 5) | - ($xnp << 6) | - ($multicase << 7) | - ($delta << 11)}] - - return $val -} - -proc uni::getGroup {value} { - variable groups - - set gIndex [lsearch -exact $groups $value] - if {$gIndex == -1} { - set gIndex [llength $groups] - lappend groups $value - } - return $gIndex -} - -proc uni::addPage {info} { - variable pMap - variable pages - variable pages_map - - if {[info exists pages_map($info)]} { - lappend pMap $pages_map($info) - } else { - set pIndex [llength $pages] - lappend pages $info - set pages_map($info) $pIndex - lappend pMap $pIndex - } - return -} - - -proc uni::load_tables {data} { - variable casemap - variable casemap2 - variable multicasemap - variable tablemap - - set multicasemap {} - set table "" - - foreach line [split $data \n] { - if {$table == ""} { - if {[regexp { ----- Start Table (.*) -----} $line temp table]} { - #puts "Start table '$table'" - } - } else { - if {[regexp { ----- End Table (.*) -----} $line temp table1]} { - set table "" - } else { - if {$table == "B.1"} { - if {[regexp {^ ([[:xdigit:]]+); ;} $line \ - temp val]} { - scan $val %x val - if {$val <= 0x10ffff} { - lappend tablemap($val) $table - } - } - } elseif {$table == "B.2"} { - if {[regexp {^ ([[:xdigit:]]+); ([[:xdigit:]]+);} $line \ - temp from to]} { - scan $from %x from - scan $to %x to - if {$from <= 0x10ffff && $to <= 0x10ffff} { - set casemap($from) [expr {$to - $from}] - } - } elseif {[regexp {^ ([[:xdigit:]]+); ([[:xdigit:]]+) ([[:xdigit:]]+);} $line \ - temp from to1 to2]} { - scan $from %x from - scan $to1 %x to1 - scan $to2 %x to2 - if {$from <= 0x10ffff && \ - $to1 <= 0x10ffff && $to2 <= 0x10ffff} { - set casemap2($from) [llength $multicasemap] - lappend multicasemap [list $to1 $to2] - } - } elseif {[regexp {^ ([[:xdigit:]]+); ([[:xdigit:]]+) ([[:xdigit:]]+) ([[:xdigit:]]+);} $line \ - temp from to1 to2 to3]} { - scan $from %x from - scan $to1 %x to1 - scan $to2 %x to2 - scan $to3 %x to3 - if {$from <= 0x10ffff && \ - $to1 <= 0x10ffff && $to2 <= 0x10ffff && \ - $to3 <= 0x10ffff} { - set casemap2($from) [llength $multicasemap] - lappend multicasemap [list $to1 $to2 $to3] - } - } else { - #puts "missed: $line" - } - - } elseif {$table != "B.3"} { - if {[regexp {^ ([[:xdigit:]]+)-([[:xdigit:]]+)} $line \ - temp from to]} { - scan $from %x from - scan $to %x to - for {set i $from} {$i <= $to && $i <= 0x10ffff} {incr i} { - lappend tablemap($i) $table - } - } elseif {[regexp {^ ([[:xdigit:]]+)} $line \ - temp val]} { - scan $val %x val - if {$val <= 0x10ffff} { - lappend tablemap($val) $table - } - } - } - } - } - } - - # XMPP nodeprep prohibited - foreach val {22 26 27 2f 3a 3c 3e 40} { - scan $val %x val - lappend tablemap($val) XNP - } -} - -proc uni::buildTables {} { - variable shift - - variable casemap - variable tablemap - - variable pMap {} - variable pages {} - variable groups {} - set info {} ;# temporary page info - - set mask [expr {(1 << $shift) - 1}] - - set next 0 - - for {set i 0} {$i <= 0x10ffff} {incr i} { - set gIndex [getGroup [getValue $i]] - - # Split character index into offset and page number - set offset [expr {$i & $mask}] - set page [expr {($i >> $shift)}] - - # Add the group index to the info for the current page - lappend info $gIndex - - # If this is the last entry in the page, add the page - if {$offset == $mask} { - addPage $info - set info {} - } - } - return -} - -proc uni::main {} { - global argc argv0 argv - variable pMap - variable pages - variable groups - variable shift - variable multicasemap - - if {$argc != 2} { - puts stderr "\nusage: $argv0 \n" - exit 1 - } - set f [open [lindex $argv 0] r] - set data [read $f] - close $f - - load_tables $data - buildTables - puts "X = [llength $pMap] Y= [llength $pages] A= [llength $groups]" - set size [expr {[llength $pMap] + [llength $pages]*(1<<$shift)}] - puts "shift = $shift, space = $size" - - set f [open [file join [lindex $argv 1] uni_data.c] w] - fconfigure $f -translation lf - puts $f "/* - * uni_data.c -- - * - * Declarations of Unicode character information tables. This file is - * automatically generated by the uni_parse.tcl script. Do not - * modify this file by hand. - * - * Copyright (c) 1998 by Scriptics Corporation. - * All rights reserved. - * - * Modified for ejabberd by Alexey Shchepin - * - * RCS: @(#) \$Id\$ - */ - -/* - * A 16-bit Unicode character is split into two parts in order to index - * into the following tables. The lower OFFSET_BITS comprise an offset - * into a page of characters. The upper bits comprise the page number. - */ - -#define OFFSET_BITS $shift - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned char pageMap\[\] = {" - set line " " - set last [expr {[llength $pMap] - 1}] - for {set i 0} {$i <= $last} {incr i} { - append line [lindex $pMap $i] - if {$i != $last} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - puts $f $line - puts $f "}; - -/* - * The groupMap is indexed by combining the alternate page number with - * the page offset and returns a group number that identifies a unique - * set of character attributes. - */ - -static unsigned short int groupMap\[\] = {" - set line " " - set lasti [expr {[llength $pages] - 1}] - for {set i 0} {$i <= $lasti} {incr i} { - set page [lindex $pages $i] - set lastj [expr {[llength $page] - 1}] - for {set j 0} {$j <= $lastj} {incr j} { - append line [lindex $page $j] - if {$j != $lastj || $i != $lasti} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - } - puts $f $line - puts $f "}; - -/* - * Each group represents a unique set of character attributes. The attributes - * are encoded into a 32-bit value as follows: - * - * Bit 0 A.1 | C.1.2 | C.2.2 | C.3 -- C.9 - * - * Bit 1 C.1.1 - * - * Bit 2 C.2.1 - * - * Bit 3 B.1 - * - * Bit 4 D.1 - * - * Bit 5 D.2 - * - * Bit 6 XNP - * - * Bit 7 Case maps to several characters - * - * Bits 8-10 Reserved for future use. - * - * Bits 11-31 Case delta: delta for case conversions. This should be the - * highest field so we can easily sign extend. - */ - -static int groups\[\] = {" - set line " " - set last [expr {[llength $groups] - 1}] - for {set i 0} {$i <= $last} {incr i} { - set val [lindex $groups $i] - - append line [format "%d" $val] - if {$i != $last} { - append line ", " - } - if {[string length $line] > 65} { - puts $f $line - set line " " - } - } - puts $f $line - puts $f "}; - -/* - * Table for characters that lowercased to multiple ones - */ - -static int multiCaseTable\[\]\[4\] = {" - set last [expr {[llength $multicasemap] - 1}] - for {set i 0} {$i <= $last} {incr i} { - set val [lindex $multicasemap $i] - - set line " " - append line [format "{%d, %s}" [llength $val] [join $val ", "]] - if {$i != $last} { - append line ", " - } - puts $f $line - } - puts $f "}; - -/* - * The following constants are used to determine the category of a - * Unicode character. - */ - -#define ACMask (1 << 0) -#define C11Mask (1 << 1) -#define C21Mask (1 << 2) -#define B1Mask (1 << 3) -#define D1Mask (1 << 4) -#define D2Mask (1 << 5) -#define XNPMask (1 << 6) -#define MCMask (1 << 7) - -/* - * The following macros extract the fields of the character info. The - * GetDelta() macro is complicated because we can't rely on the C compiler - * to do sign extension on right shifts. - */ - -#define GetCaseType(info) (((info) & 0xE0) >> 5) -#define GetCategory(info) ((info) & 0x1F) -#define GetDelta(info) (((info) > 0) ? ((info) >> 11) : (~(~((info)) >> 11))) -#define GetMC(info) (multiCaseTable\[GetDelta(info)\]) - -/* - * This macro extracts the information about a character from the - * Unicode character tables. - */ - -#define GetUniCharInfo(ch) (groups\[groupMap\[(pageMap\[(((int)(ch)) & 0x1fffff) >> OFFSET_BITS\] << OFFSET_BITS) | ((ch) & ((1 << OFFSET_BITS)-1))\]\]) -" - - close $f -} - -uni::main - -return diff --git a/src/stringprep/uni_parse2.tcl b/src/stringprep/uni_parse2.tcl deleted file mode 100644 index 950090a09..000000000 --- a/src/stringprep/uni_parse2.tcl +++ /dev/null @@ -1,702 +0,0 @@ -# uni_parse2.tcl -- -# -# This program parses the UnicodeData file and generates the -# corresponding uni_norm.c file with compressed character -# data tables. The input to this program should be -# UnicodeData-3.2.0.txt and CompositionExclusions-3.2.0.txt files from: -# ftp://ftp.unicode.org/Public/UNIDATA/ -# -# Copyright (c) 1998-1999 by Scriptics Corporation. -# All rights reserved. -# -# Modified for ejabberd by Alexey Shchepin -# -# RCS: @(#) $Id$ - - -namespace eval uni { - set cclass_shift 8 - set decomp_shift 8 - set comp_shift 8 - set shift 5; # number of bits of data within a page - # This value can be adjusted to find the - # best split to minimize table size - - variable pMap; # map from page to page index, each entry is - # an index into the pages table, indexed by - # page number - variable pages; # map from page index to page info, each - # entry is a list of indices into the groups - # table, the list is indexed by the offset - variable groups; # list of character info values, indexed by - # group number, initialized with the - # unassigned character group - - variable categories { - Cn Lu Ll Lt Lm Lo Mn Me Mc Nd Nl No Zs Zl Zp - Cc Cf Co Cs Pc Pd Ps Pe Pi Pf Po Sm Sc Sk So - }; # Ordered list of character categories, must - # match the enumeration in the header file. - - variable titleCount 0; # Count of the number of title case - # characters. This value is used in the - # regular expression code to allocate enough - # space for the title case variants. -} - -proc uni::getValue {items index} { - variable categories - variable titleCount - - # Extract character info - - set category [lindex $items 2] - if {[scan [lindex $items 12] %4x toupper] == 1} { - set toupper [expr {$index - $toupper}] - } else { - set toupper {} - } - if {[scan [lindex $items 13] %4x tolower] == 1} { - set tolower [expr {$tolower - $index}] - } else { - set tolower {} - } - if {[scan [lindex $items 14] %4x totitle] == 1} { - set totitle [expr {$index - $totitle}] - } else { - set totitle {} - } - - set categoryIndex [lsearch -exact $categories $category] - if {$categoryIndex < 0} { - puts "Unexpected character category: $index($category)" - set categoryIndex 0 - } elseif {$category == "Lt"} { - incr titleCount - } - - return "$categoryIndex,$toupper,$tolower,$totitle" -} - -proc uni::getGroup {value} { - variable groups - - set gIndex [lsearch -exact $groups $value] - if {$gIndex == -1} { - set gIndex [llength $groups] - lappend groups $value - } - return $gIndex -} - -proc uni::addPage {info} { - variable pMap - variable pages - - set pIndex [lsearch -exact $pages $info] - if {$pIndex == -1} { - set pIndex [llength $pages] - lappend pages $info - } - lappend pMap $pIndex - return -} - -proc uni::addPage {map_var pages_var info} { - variable $map_var - variable $pages_var - - set pIndex [lsearch -exact [set $pages_var] $info] - if {$pIndex == -1} { - set pIndex [llength [set $pages_var]] - lappend $pages_var $info - } - lappend $map_var $pIndex - return -} - -proc uni::load_exclusions {data} { - variable exclusions - - foreach line [split $data \n] { - if {$line == ""} continue - - set items [split $line " "] - - if {[lindex $items 0] == "#"} continue - - scan [lindex $items 0] %x index - - set exclusions($index) "" - } -} - -proc uni::load_tables {data} { - variable cclass_map - variable decomp_map - variable comp_map - variable comp_first - variable comp_second - variable exclusions - - foreach line [split $data \n] { - if {$line == ""} continue - - set items [split $line \;] - - scan [lindex $items 0] %x index - set cclass [lindex $items 3] - set decomp [lindex $items 5] - - set cclass_map($index) $cclass - #set decomp_map($index) $cclass - - if {$decomp != ""} { - if {[string index [lindex $decomp 0] 0] == "<"} { - set decomp1 [lreplace $decomp 0 0] - set decomp {} - foreach ch $decomp1 { - scan $ch %x ch - lappend decomp $ch - } - set decomp_map($index) $decomp - } else { - switch -- [llength $decomp] { - 1 { - scan $decomp %x ch - set decomp_map($index) $ch - } - 2 { - scan $decomp "%x %x" ch1 ch2 - set decomp [list $ch1 $ch2] - set decomp_map($index) $decomp - # hackish - if {(![info exists cclass_map($ch1)] || \ - $cclass_map($ch1) == 0) && \ - ![info exists exclusions($index)]} { - if {[info exists comp_first($ch1)]} { - incr comp_first($ch1) - } else { - set comp_first($ch1) 1 - } - if {[info exists comp_second($ch2)]} { - incr comp_second($ch2) - } else { - set comp_second($ch2) 1 - } - set comp_map($decomp) $index - } else { - puts "Excluded $index" - } - } - default { - puts "Bad canonical decomposition: $line" - } - } - } - - #puts "[format 0x%0.4x $index]\t$cclass\t$decomp_map($index)" - } - } - #puts [array get comp_first] - #puts [array get comp_second] -} - -proc uni::buildTables {} { - variable cclass_shift - variable decomp_shift - variable comp_shift - - variable cclass_map - variable cclass_pmap {} - variable cclass_pages {} - variable decomp_map - variable decomp_pmap {} - variable decomp_pages {} - variable decomp_list {} - variable comp_map - variable comp_pmap {} - variable comp_pages {} - variable comp_first - variable comp_second - variable comp_first_list {} - variable comp_second_list {} - variable comp_x_list {} - variable comp_y_list {} - variable comp_both_map {} - - set cclass_info {} - set decomp_info {} - set comp_info {} - - set cclass_mask [expr {(1 << $cclass_shift) - 1}] - set decomp_mask [expr {(1 << $decomp_shift) - 1}] - set comp_mask [expr {(1 << $comp_shift) - 1}] - - foreach comp [array names comp_map] { - set ch1 [lindex $comp 0] - if {[info exists comp_first($ch1)] && $comp_first($ch1) > 0 && \ - [info exists comp_second($ch1)] && $comp_second($ch1) > 0} { - if {[lsearch -exact $comp_x_list $ch1] < 0} { - set i [llength $comp_x_list] - lappend comp_x_list $ch1 - set comp_info_map($ch1) $i - lappend comp_y_list $ch1 - set comp_info_map($ch1) $i - puts "There should be no symbols which appears on" - puts "both first and second place in composition" - exit - } - } - } - - foreach comp [array names comp_map] { - set ch1 [lindex $comp 0] - set ch2 [lindex $comp 1] - - if {$comp_first($ch1) == 1 && ![info exists comp_second($ch1)]} { - set i [llength $comp_first_list] - lappend comp_first_list [list $ch2 $comp_map($comp)] - set comp_info_map($ch1) [expr {$i | (1 << 16)}] - } elseif {$comp_second($ch2) == 1 && ![info exists comp_first($ch2)]} { - set i [llength $comp_second_list] - lappend comp_second_list [list $ch1 $comp_map($comp)] - set comp_info_map($ch2) [expr {$i | (1 << 16) | (1 << 17)}] - } else { - if {[lsearch -exact $comp_x_list $ch1] < 0} { - set i [llength $comp_x_list] - lappend comp_x_list $ch1 - set comp_info_map($ch1) $i - } - if {[lsearch -exact $comp_y_list $ch2] < 0} { - set i [llength $comp_y_list] - lappend comp_y_list $ch2 - set comp_info_map($ch2) [expr {$i | (1 << 17)}] - } - } - } - - set next 0 - - for {set i 0} {$i <= 0x10ffff} {incr i} { - #set gIndex [getGroup [getValue $i]] - - set cclass_offset [expr {$i & $cclass_mask}] - - if {[info exists cclass_map($i)]} { - set cclass $cclass_map($i) - } else { - set cclass 0 - } - lappend cclass_info $cclass - - if {$cclass_offset == $cclass_mask} { - addPage cclass_pmap cclass_pages $cclass_info - set cclass_info {} - } - - - set decomp_offset [expr {$i & $decomp_mask}] - - if {[info exists decomp_map($i)]} { - set decomp $decomp_map($i) - set b 1 - while {$b} { - set b 0 - for {set j 0} {$j < [llength $decomp]} {incr j} { - if {[info exists \ - decomp_map([set ch1 [lindex $decomp $j]])]} { - #puts -$decomp - set decomp [eval [list lreplace $decomp $j $j] \ - $decomp_map($ch1)] - #puts +$decomp - set b 1 - } - } - } - - if {[info exists decomp_used($decomp)]} { - lappend decomp_info $decomp_used($decomp) - } else { - set val [expr {([llength $decomp] << 16) + \ - [llength $decomp_list]}] - #set val [expr {[llength $decomp_list]}] - lappend decomp_info $val - set decomp_used($decomp) $val - #puts "$val $decomp" - foreach d $decomp { - lappend decomp_list $d - } - } - } else { - lappend decomp_info -1 - } - - if {$decomp_offset == $decomp_mask} { - addPage decomp_pmap decomp_pages $decomp_info - set decomp_info {} - } - - - set comp_offset [expr {$i & $comp_mask}] - - if {[info exists comp_info_map($i)]} { - set comp $comp_info_map($i) - } else { - set comp -1 - } - lappend comp_info $comp - - if {$comp_offset == $comp_mask} { - addPage comp_pmap comp_pages $comp_info - set comp_info {} - } - } - - #puts [array get decomp_map] - #puts $decomp_list - - return -} - -proc uni::main {} { - global argc argv0 argv - variable cclass_shift - variable cclass_pmap - variable cclass_pages - variable decomp_shift - variable decomp_pmap - variable decomp_pages - variable decomp_list - variable comp_shift - variable comp_map - variable comp_pmap - variable comp_pages - variable comp_first_list - variable comp_second_list - variable comp_x_list - variable comp_y_list - variable pages - variable groups {} - variable titleCount - - if {$argc != 3} { - puts stderr "\nusage: $argv0 \n" - exit 1 - } - set f [open [lindex $argv 1] r] - set data [read $f] - close $f - - load_exclusions $data - - set f [open [lindex $argv 0] r] - set data [read $f] - close $f - - load_tables $data - buildTables - #puts "X = [llength $pMap] Y= [llength $pages] A= [llength $groups]" - #set size [expr {[llength $pMap] + [llength $pages]*(1<<$shift)}] - #puts "shift = 6, space = $size" - #puts "title case count = $titleCount" - - set f [open [file join [lindex $argv 2] uni_norm.c] w] - fconfigure $f -translation lf - puts $f "/* - * uni_norm.c -- - * - * Declarations of Unicode character information tables. This file is - * automatically generated by the uni_parse2.tcl script. Do not - * modify this file by hand. - * - * Copyright (c) 1998 by Scriptics Corporation. - * All rights reserved. - * - * Modified for ejabberd by Alexey Shchepin - * - * RCS: @(#) \$Id\$ - */ - -/* - * A 16-bit Unicode character is split into two parts in order to index - * into the following tables. The lower CCLASS_OFFSET_BITS comprise an offset - * into a page of characters. The upper bits comprise the page number. - */ - -#define CCLASS_OFFSET_BITS $cclass_shift - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned char cclassPageMap\[\] = {" - set line " " - set last [expr {[llength $cclass_pmap] - 1}] - for {set i 0} {$i <= $last} {incr i} { - append line [lindex $cclass_pmap $i] - if {$i != $last} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - puts $f $line - puts $f "}; - -/* - * The cclassGroupMap is indexed by combining the alternate page number with - * the page offset and returns a combining class number. - */ - -static unsigned char cclassGroupMap\[\] = {" - set line " " - set lasti [expr {[llength $cclass_pages] - 1}] - for {set i 0} {$i <= $lasti} {incr i} { - set page [lindex $cclass_pages $i] - set lastj [expr {[llength $page] - 1}] - for {set j 0} {$j <= $lastj} {incr j} { - append line [lindex $page $j] - if {$j != $lastj || $i != $lasti} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - } - puts $f $line - puts $f "}; - -#define GetUniCharCClass(ch) (cclassGroupMap\[(cclassPageMap\[(((int)(ch)) & 0x1fffff) >> CCLASS_OFFSET_BITS\] << CCLASS_OFFSET_BITS) | ((ch) & ((1 << CCLASS_OFFSET_BITS)-1))\]) - - -#define DECOMP_OFFSET_BITS $decomp_shift - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned char decompPageMap\[\] = {" - set line " " - set last [expr {[llength $decomp_pmap] - 1}] - for {set i 0} {$i <= $last} {incr i} { - append line [lindex $decomp_pmap $i] - if {$i != $last} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - puts $f $line - puts $f "}; - -/* - * The decompGroupMap is indexed by combining the alternate page number with - * the page offset and returns a group number that identifies a length and - * shift of decomposition sequence in decompList - */ - -static int decompGroupMap\[\] = {" - set line " " - set lasti [expr {[llength $decomp_pages] - 1}] - for {set i 0} {$i <= $lasti} {incr i} { - set page [lindex $decomp_pages $i] - set lastj [expr {[llength $page] - 1}] - for {set j 0} {$j <= $lastj} {incr j} { - append line [lindex $page $j] - if {$j != $lastj || $i != $lasti} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - } - puts $f $line - puts $f "}; - -/* - * List of decomposition sequences - */ - -static int decompList\[\] = {" - set line " " - set last [expr {[llength $decomp_list] - 1}] - for {set i 0} {$i <= $last} {incr i} { - set val [lindex $decomp_list $i] - - append line [format "%d" $val] - if {$i != $last} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - puts $f $line - puts $f "}; - - -/* - * This macro extracts the information about a character from the - * Unicode character tables. - */ - -#define GetUniCharDecompInfo(ch) (decompGroupMap\[(decompPageMap\[(((int)(ch)) & 0x1fffff) >> DECOMP_OFFSET_BITS\] << DECOMP_OFFSET_BITS) | ((ch) & ((1 << DECOMP_OFFSET_BITS)-1))\]) - -#define GetDecompShift(info) ((info) & 0xffff) -#define GetDecompLen(info) ((info) >> 16) - - -#define COMP_OFFSET_BITS $comp_shift - -/* - * The pageMap is indexed by page number and returns an alternate page number - * that identifies a unique page of characters. Many Unicode characters map - * to the same alternate page number. - */ - -static unsigned char compPageMap\[\] = {" - set line " " - set last [expr {[llength $comp_pmap] - 1}] - for {set i 0} {$i <= $last} {incr i} { - append line [lindex $comp_pmap $i] - if {$i != $last} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - puts $f $line - puts $f "}; - -/* - * The groupMap is indexed by combining the alternate page number with - * the page offset and returns a group number that identifies a unique - * set of character attributes. - */ - -static int compGroupMap\[\] = {" - set line " " - set lasti [expr {[llength $comp_pages] - 1}] - for {set i 0} {$i <= $lasti} {incr i} { - set page [lindex $comp_pages $i] - set lastj [expr {[llength $page] - 1}] - for {set j 0} {$j <= $lastj} {incr j} { - append line [lindex $page $j] - if {$j != $lastj || $i != $lasti} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - } - puts $f $line - puts $f "}; - -/* - * Lists of compositions for characters that appears only in one composition - */ - -static int compFirstList\[\]\[2\] = {" - set line " " - set last [expr {[llength $comp_first_list] - 1}] - for {set i 0} {$i <= $last} {incr i} { - set val [lindex $comp_first_list $i] - - append line [format "{%d, %d}" [lindex $val 0] [lindex $val 1]] - if {$i != $last} { - append line ", " - } - if {[string length $line] > 60} { - puts $f $line - set line " " - } - } - puts $f $line - puts $f "}; - -static int compSecondList\[\]\[2\] = {" - set line " " - set last [expr {[llength $comp_second_list] - 1}] - for {set i 0} {$i <= $last} {incr i} { - set val [lindex $comp_second_list $i] - - append line [format "{%d, %d}" [lindex $val 0] [lindex $val 1]] - if {$i != $last} { - append line ", " - } - if {[string length $line] > 60} { - puts $f $line - set line " " - } - } - puts $f $line - puts $f "}; - -/* - * Compositions matrix - */ - -static int compBothList\[[llength $comp_x_list]\]\[[llength $comp_y_list]\] = {" - set lastx [expr {[llength $comp_x_list] - 1}] - set lasty [expr {[llength $comp_y_list] - 1}] - for {set i 0} {$i <= $lastx} {incr i} { - puts $f " \{" - set line " " - for {set j 0} {$j <= $lasty} {incr j} { - set comp [list [lindex $comp_x_list $i] [lindex $comp_y_list $j]] - if {[info exists comp_map($comp)]} { - set val $comp_map($comp) - } else { - set val 0 - } - - append line [format "%d" $val] - if {$j != $lasty} { - append line ", " - } - if {[string length $line] > 70} { - puts $f $line - set line " " - } - } - puts $f $line - if {$j != $lasty} { - puts $f " \}," - } else { - puts $f " \}" - } - } - puts $f "}; - - -#define GetUniCharCompInfo(ch) (compGroupMap\[(compPageMap\[(((int)(ch)) & 0x1fffff) >> COMP_OFFSET_BITS\] << COMP_OFFSET_BITS) | ((ch) & ((1 << COMP_OFFSET_BITS)-1))\]) - -#define CompSingleMask (1 << 16) -#define CompMask ((1 << 16) - 1) -#define CompSecondMask (1 << 17) -" - - close $f -} - -uni::main - -return diff --git a/src/stun/Makefile.in b/src/stun/Makefile.in deleted file mode 100644 index e77da8452..000000000 --- a/src/stun/Makefile.in +++ /dev/null @@ -1,38 +0,0 @@ -# $Id: Makefile.in 1453 2008-07-16 16:58:42Z badlop $ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(BEAMS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -clean: - rm -f $(BEAMS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl - diff --git a/src/stun/Makefile.win32 b/src/stun/Makefile.win32 deleted file mode 100644 index e70aba9f1..000000000 --- a/src/stun/Makefile.win32 +++ /dev/null @@ -1,18 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\stun_codec.beam ..\ejabberd_stun.beam - -ALL : $(BEAMS) - -CLEAN : - -@erase $(BEAMS) - -$(OUTDIR)\stun_codec.beam : stun_codec.erl - erlc -W $(EFLAGS) -o $(OUTDIR) stun_codec.erl - -$(OUTDIR)\ejabberd_stun.beam : ejabberd_stun.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_stun.erl diff --git a/src/stun/ejabberd_stun.erl b/src/stun/ejabberd_stun.erl deleted file mode 100644 index c2b6a7b59..000000000 --- a/src/stun/ejabberd_stun.erl +++ /dev/null @@ -1,230 +0,0 @@ -%%%------------------------------------------------------------------- -%%% File : ejabberd_stun.erl -%%% Author : Evgeniy Khramtsov -%%% Description : RFC5389 implementation. -%%% Currently only Binding usage is supported. -%%% -%%% Created : 8 Aug 2009 by Evgeniy Khramtsov -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%------------------------------------------------------------------- --module(ejabberd_stun). - --behaviour(gen_fsm). - -%% API --export([start_link/2, start/2, socket_type/0, - udp_recv/5]). - -%% gen_fsm callbacks --export([init/1, handle_event/3, handle_sync_event/4, - handle_info/3, terminate/3, code_change/4]). - -%% gen_fsm states --export([wait_for_tls/2, session_established/2]). - --include("ejabberd.hrl"). - --include("stun.hrl"). - --define(MAX_BUF_SIZE, 64 * 1024). - --define(TIMEOUT, 10000). - --record(state, - {sock :: inet:socket() | tls:tls_socket(), - sock_mod = gen_tcp :: gen_udp | gen_tcp | tls, - certfile :: binary(), - peer = {{0,0,0,0}, 0} :: {inet:ip_address(), inet:port_number()}, - tref = make_ref() :: reference(), - buf = <<>> :: binary()}). - -start({gen_tcp, Sock}, Opts) -> - supervisor:start_child(ejabberd_stun_sup, [Sock, Opts]). - -start_link(Sock, Opts) -> - gen_fsm:start_link(?MODULE, [Sock, Opts], []). - -socket_type() -> raw. - -udp_recv(Sock, Addr, Port, Data, _Opts) -> - case stun_codec:decode(Data) of - {ok, Msg, <<>>} -> - ?DEBUG("got:~n~p", [Msg]), - case process(Addr, Port, Msg) of - RespMsg when is_record(RespMsg, stun) -> - ?DEBUG("sent:~n~p", [RespMsg]), - Data1 = stun_codec:encode(RespMsg), - gen_udp:send(Sock, Addr, Port, Data1); - _ -> ok - end; - _ -> ok - end. - -init([Sock, Opts]) -> - case inet:peername(Sock) of - {ok, Addr} -> - inet:setopts(Sock, [{active, once}]), - TRef = erlang:start_timer(?TIMEOUT, self(), stop), - State = #state{sock = Sock, peer = Addr, tref = TRef}, - case proplists:get_value(certfile, Opts) of - undefined -> {ok, session_established, State}; - CertFile -> - {ok, wait_for_tls, State#state{certfile = CertFile}} - end; - Err -> Err - end. - -wait_for_tls(Event, State) -> - ?INFO_MSG("unexpected event in wait_for_tls: ~p", - [Event]), - {next_state, wait_for_tls, State}. - -session_established(Msg, State) - when is_record(Msg, stun) -> - ?DEBUG("got:~n~p", [Msg]), - {Addr, Port} = State#state.peer, - case process(Addr, Port, Msg) of - Resp when is_record(Resp, stun) -> - ?DEBUG("sent:~n~p", [Resp]), - Data = stun_codec:encode(Resp), - (State#state.sock_mod):send(State#state.sock, Data); - _ -> ok - end, - {next_state, session_established, State}; -session_established(Event, State) -> - ?INFO_MSG("unexpected event in session_established: ~p", - [Event]), - {next_state, session_established, State}. - -handle_event(_Event, StateName, State) -> - {next_state, StateName, State}. - -handle_sync_event(_Event, _From, StateName, State) -> - {reply, {error, badarg}, StateName, State}. - -handle_info({tcp, Sock, TLSData}, wait_for_tls, - State) -> - Buf = <<(State#state.buf)/binary, TLSData/binary>>, - case Buf of - _ when byte_size(Buf) < 3 -> - {next_state, wait_for_tls, - update_state(State#state{buf = Buf})}; - <<_:16, 1, _/binary>> -> - TLSOpts = [{certfile, State#state.certfile}], - {ok, TLSSock} = tls:tcp_to_tls(Sock, TLSOpts), - NewState = State#state{sock = TLSSock, buf = <<>>, - sock_mod = tls}, - case tls:recv_data(TLSSock, Buf) of - {ok, Data} -> - process_data(session_established, NewState, Data); - _Err -> {stop, normal, NewState} - end; - _ -> process_data(session_established, State, TLSData) - end; -handle_info({tcp, _Sock, TLSData}, StateName, - #state{sock_mod = tls} = State) -> - case tls:recv_data(State#state.sock, TLSData) of - {ok, Data} -> process_data(StateName, State, Data); - _Err -> {stop, normal, State} - end; -handle_info({tcp, _Sock, Data}, StateName, State) -> - process_data(StateName, State, Data); -handle_info({tcp_closed, _Sock}, _StateName, State) -> - ?DEBUG("connection reset by peer", []), - {stop, normal, State}; -handle_info({tcp_error, _Sock, Reason}, _StateName, - State) -> - ?DEBUG("connection error: ~p", [Reason]), - {stop, normal, State}; -handle_info({timeout, TRef, stop}, _StateName, - #state{tref = TRef} = State) -> - {stop, normal, State}; -handle_info(Info, StateName, State) -> - ?INFO_MSG("unexpected info: ~p", [Info]), - {next_state, StateName, State}. - -terminate(_Reason, _StateName, State) -> - catch (State#state.sock_mod):close(State#state.sock), - ok. - -code_change(_OldVsn, StateName, State, _Extra) -> - {ok, StateName, State}. - -process(Addr, Port, - #stun{class = request, unsupported = []} = Msg) -> - Resp = prepare_response(Msg), - if Msg#stun.method == (?STUN_METHOD_BINDING) -> - case stun_codec:version(Msg) of - old -> - Resp#stun{class = response, - 'MAPPED-ADDRESS' = {Addr, Port}}; - new -> - Resp#stun{class = response, - 'XOR-MAPPED-ADDRESS' = {Addr, Port}} - end; - true -> - Resp#stun{class = error, - 'ERROR-CODE' = {405, <<"Method Not Allowed">>}} - end; -process(_Addr, _Port, #stun{class = request} = Msg) -> - Resp = prepare_response(Msg), - Resp#stun{class = error, - 'UNKNOWN-ATTRIBUTES' = Msg#stun.unsupported, - 'ERROR-CODE' = {420, stun_codec:reason(420)}}; -process(_Addr, _Port, _Msg) -> pass. - -prepare_response(Msg) -> - Version = <<"ejabberd ", (iolist_to_binary(?VERSION))/binary>>, - #stun{method = Msg#stun.method, magic = Msg#stun.magic, - trid = Msg#stun.trid, 'SOFTWARE' = Version}. - -process_data(NextStateName, #state{buf = Buf} = State, - Data) -> - NewBuf = <>, - case stun_codec:decode(NewBuf) of - {ok, Msg, Tail} -> - gen_fsm:send_event(self(), Msg), - process_data(NextStateName, State#state{buf = <<>>}, - Tail); - empty -> - NewState = State#state{buf = <<>>}, - {next_state, NextStateName, update_state(NewState)}; - more when byte_size(NewBuf) < (?MAX_BUF_SIZE) -> - NewState = State#state{buf = NewBuf}, - {next_state, NextStateName, update_state(NewState)}; - _ -> {stop, normal, State} - end. - -update_state(#state{sock = Sock} = State) -> - case State#state.sock_mod of - gen_tcp -> inet:setopts(Sock, [{active, once}]); - SockMod -> SockMod:setopts(Sock, [{active, once}]) - end, - cancel_timer(State#state.tref), - TRef = erlang:start_timer(?TIMEOUT, self(), stop), - State#state{tref = TRef}. - -cancel_timer(TRef) -> - case erlang:cancel_timer(TRef) of - false -> - receive {timeout, TRef, _} -> ok after 0 -> ok end; - _ -> ok - end. diff --git a/src/stun/stun.hrl b/src/stun/stun.hrl deleted file mode 100644 index 1033be264..000000000 --- a/src/stun/stun.hrl +++ /dev/null @@ -1,59 +0,0 @@ --define(STUN_MAGIC, 554869826). - --define(STUN_METHOD(Type), - Type band 15872 bsr 2 bor (Type band 224 bsr 1) bor - Type band 15). - --define(STUN_CLASS(Type), - Type band 256 bsr 7 bor (Type band 16 bsr 4)). - --define(STUN_TYPE(C, M), - M band 3968 bsl 2 bor (M band 112 bsl 1) bor M band 15 - bor (C band 2 bsl 7 bor (C band 1 bsl 4))). - --define(is_required(A), A =< 32767). - --define(STUN_METHOD_BINDING, 1). - --define(STUN_ATTR_MAPPED_ADDRESS, 1). - --define(STUN_ATTR_USERNAME, 6). - --define(STUN_ATTR_MESSAGE_INTEGRITY, 8). - --define(STUN_ATTR_ERROR_CODE, 9). - --define(STUN_ATTR_UNKNOWN_ATTRIBUTES, 10). - --define(STUN_ATTR_REALM, 20). - --define(STUN_ATTR_NONCE, 21). - --define(STUN_ATTR_XOR_MAPPED_ADDRESS, 32). - --define(STUN_ATTR_SOFTWARE, 32802). - --define(STUN_ATTR_ALTERNATE_SERVER, 32803). - --define(STUN_ATTR_FINGERPRINT, 32808). - --record(stun, - {class = request :: request | response | error | indication, - method = ?STUN_METHOD_BINDING :: non_neg_integer(), - magic = ?STUN_MAGIC :: non_neg_integer(), - trid = 0 :: non_neg_integer() , - unsupported = [] :: [non_neg_integer()], - 'SOFTWARE', - 'ALTERNATE-SERVER', - 'MAPPED-ADDRESS', - 'XOR-MAPPED-ADDRESS', - 'USERNAME', - 'REALM', - 'NONCE', - 'MESSAGE-INTEGRITY', - 'ERROR-CODE', - 'UNKNOWN-ATTRIBUTES' = []}). - -%% Workarounds. -%%-define(NO_PADDING, true). - diff --git a/src/stun/stun_codec.erl b/src/stun/stun_codec.erl deleted file mode 100644 index 787310a9f..000000000 --- a/src/stun/stun_codec.erl +++ /dev/null @@ -1,293 +0,0 @@ -%%%------------------------------------------------------------------- -%%% File : stun_codec.erl -%%% Author : Evgeniy Khramtsov -%%% Description : STUN codec -%%% Created : 7 Aug 2009 by Evgeniy Khramtsov -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%------------------------------------------------------------------- --module(stun_codec). - -%% API --export([decode/1, encode/1, version/1, reason/1, - pp/1]). - -%% Tests --export([test_udp/2, test_tcp/2, test_tls/2, - test_public/0]). - --include("stun.hrl"). - -decode(<<0:2, Type:14, Len:16, Magic:32, TrID:96, - Body:Len/binary, Tail/binary>>) -> - case catch decode(Type, Magic, TrID, Body) of - {'EXIT', _} -> {error, unparsed}; - Res -> {ok, Res, Tail} - end; -decode(<<0:2, _/binary>>) -> more; -decode(<<>>) -> empty; -decode(_) -> {error, unparsed}. - -encode(#stun{class = Class, method = Method, - magic = Magic, trid = TrID} = - Msg) -> - ClassCode = case Class of - request -> 0; - indication -> 1; - response -> 2; - error -> 3 - end, - Type = (?STUN_TYPE(ClassCode, Method)), - Attrs = enc_attrs(Msg), - Len = byte_size(Attrs), - <<0:2, Type:14, Len:16, Magic:32, TrID:96, - Attrs/binary>>. - -pp(Term) -> io_lib_pretty:print(Term, fun pp/2). - -version(#stun{magic = ?STUN_MAGIC}) -> new; -version(#stun{}) -> old. - -reason(300) -> <<"Try Alternate">>; -reason(400) -> <<"Bad Request">>; -reason(401) -> <<"Unauthorized">>; -reason(420) -> <<"Unknown Attribute">>; -reason(438) -> <<"Stale Nonce">>; -reason(500) -> <<"Server Error">>; -reason(_) -> <<"Undefined Error">>. - -decode(Type, Magic, TrID, Body) -> - Method = (?STUN_METHOD(Type)), - Class = case ?STUN_CLASS(Type) of - 0 -> request; - 1 -> indication; - 2 -> response; - 3 -> error - end, - dec_attrs(Body, - #stun{class = Class, method = Method, magic = Magic, - trid = TrID}). - -dec_attrs(<>, Msg) -> - PaddLen = padd_len(Len), - <> = Rest, - NewMsg = dec_attr(Type, Val, Msg), - if Type == (?STUN_ATTR_MESSAGE_INTEGRITY) -> NewMsg; - true -> dec_attrs(Tail, NewMsg) - end; -dec_attrs(<<>>, Msg) -> Msg. - -enc_attrs(Msg) -> - iolist_to_binary([enc_attr(?STUN_ATTR_SOFTWARE, - Msg#stun.'SOFTWARE'), - enc_addr(?STUN_ATTR_MAPPED_ADDRESS, - Msg#stun.'MAPPED-ADDRESS'), - enc_xor_addr(?STUN_ATTR_XOR_MAPPED_ADDRESS, - Msg#stun.magic, Msg#stun.trid, - Msg#stun.'XOR-MAPPED-ADDRESS'), - enc_addr(?STUN_ATTR_ALTERNATE_SERVER, - Msg#stun.'ALTERNATE-SERVER'), - enc_attr(?STUN_ATTR_USERNAME, Msg#stun.'USERNAME'), - enc_attr(?STUN_ATTR_REALM, Msg#stun.'REALM'), - enc_attr(?STUN_ATTR_NONCE, Msg#stun.'NONCE'), - enc_error_code(Msg#stun.'ERROR-CODE'), - enc_unknown_attrs(Msg#stun.'UNKNOWN-ATTRIBUTES')]). - -dec_attr(?STUN_ATTR_MAPPED_ADDRESS, Val, Msg) -> - <<_, Family, Port:16, AddrBin/binary>> = Val, - Addr = dec_addr(Family, AddrBin), - Msg#stun{'MAPPED-ADDRESS' = {Addr, Port}}; -dec_attr(?STUN_ATTR_XOR_MAPPED_ADDRESS, Val, Msg) -> - <<_, Family, XPort:16, XAddr/binary>> = Val, - Magic = Msg#stun.magic, - Port = XPort bxor (Magic bsr 16), - Addr = dec_xor_addr(Family, Magic, Msg#stun.trid, - XAddr), - Msg#stun{'XOR-MAPPED-ADDRESS' = {Addr, Port}}; -dec_attr(?STUN_ATTR_SOFTWARE, Val, Msg) -> - Msg#stun{'SOFTWARE' = Val}; -dec_attr(?STUN_ATTR_USERNAME, Val, Msg) -> - Msg#stun{'USERNAME' = Val}; -dec_attr(?STUN_ATTR_REALM, Val, Msg) -> - Msg#stun{'REALM' = Val}; -dec_attr(?STUN_ATTR_NONCE, Val, Msg) -> - Msg#stun{'NONCE' = Val}; -dec_attr(?STUN_ATTR_MESSAGE_INTEGRITY, Val, Msg) -> - Msg#stun{'MESSAGE-INTEGRITY' = Val}; -dec_attr(?STUN_ATTR_ALTERNATE_SERVER, Val, Msg) -> - <<_, Family, Port:16, Address/binary>> = Val, - IP = dec_addr(Family, Address), - Msg#stun{'ALTERNATE-SERVER' = {IP, Port}}; -dec_attr(?STUN_ATTR_ERROR_CODE, Val, Msg) -> - <<_:21, Class:3, Number:8, Reason/binary>> = Val, - if Class >= 3, Class =< 6, Number >= 0, Number =< 99 -> - Code = Class * 100 + Number, - Msg#stun{'ERROR-CODE' = {Code, Reason}} - end; -dec_attr(?STUN_ATTR_UNKNOWN_ATTRIBUTES, Val, Msg) -> - Attrs = dec_unknown_attrs(Val, []), - Msg#stun{'UNKNOWN-ATTRIBUTES' = Attrs}; -dec_attr(Attr, _Val, #stun{unsupported = Attrs} = Msg) - when Attr =< 32767 -> - Msg#stun{unsupported = [Attr | Attrs]}; -dec_attr(_Attr, _Val, Msg) -> Msg. - -dec_addr(1, <>) -> {A1, A2, A3, A4}; -dec_addr(2, - <>) -> - {A1, A2, A3, A4, A5, A6, A7, A8}. - -dec_xor_addr(1, Magic, _TrID, <>) -> - Addr = XAddr bxor Magic, dec_addr(1, <>); -dec_xor_addr(2, Magic, TrID, <>) -> - Addr = XAddr bxor (Magic bsl 96 bor TrID), - dec_addr(2, <>). - -dec_unknown_attrs(<>, Acc) -> - dec_unknown_attrs(Tail, [Attr | Acc]); -dec_unknown_attrs(<<>>, Acc) -> lists:reverse(Acc). - -enc_attr(_Attr, undefined) -> <<>>; -enc_attr(Attr, Val) -> - Len = byte_size(Val), - PaddLen = padd_len(Len), - <>. - -enc_addr(_Type, undefined) -> <<>>; -enc_addr(Type, {{A1, A2, A3, A4}, Port}) -> - enc_attr(Type, <<0, 1, Port:16, A1, A2, A3, A4>>); -enc_addr(Type, - {{A1, A2, A3, A4, A5, A6, A7, A8}, Port}) -> - enc_attr(Type, - <<0, 2, Port:16, A1:16, A2:16, A3:16, A4:16, A5:16, - A6:16, A7:16, A8:16>>). - -enc_xor_addr(_Type, _Magic, _TrID, undefined) -> <<>>; -enc_xor_addr(Type, Magic, _TrID, - {{A1, A2, A3, A4}, Port}) -> - XPort = Port bxor (Magic bsr 16), - <> = <>, - XAddr = Addr bxor Magic, - enc_attr(Type, <<0, 1, XPort:16, XAddr:32>>); -enc_xor_addr(Type, Magic, TrID, - {{A1, A2, A3, A4, A5, A6, A7, A8}, Port}) -> - XPort = Port bxor (Magic bsr 16), - <> = <>, - XAddr = Addr bxor (Magic bsl 96 bor TrID), - enc_attr(Type, <<0, 2, XPort:16, XAddr:128>>). - -enc_error_code(undefined) -> <<>>; -enc_error_code({Code, Reason}) -> - Class = Code div 100, - Number = Code rem 100, - enc_attr(?STUN_ATTR_ERROR_CODE, - <<0:21, Class:3, Number:8, Reason/binary>>). - -enc_unknown_attrs([]) -> <<>>; -enc_unknown_attrs(Attrs) -> - enc_attr(?STUN_ATTR_UNKNOWN_ATTRIBUTES, - iolist_to_binary([<> || Attr <- Attrs])). - -pp(Tag, N) -> try pp1(Tag, N) catch _:_ -> no end. - -pp1(stun, N) -> - N = record_info(size, stun) - 1, - record_info(fields, stun); -pp1(_, _) -> no. - -%% Workaround for stupid clients. --ifdef(NO_PADDING). - -padd_len(_Len) -> 0. - --else. - -padd_len(Len) -> - case Len rem 4 of - 0 -> 0; - N -> 8 * (4 - N) - end. - --endif. - -bind_msg() -> - Msg = #stun{method = ?STUN_METHOD_BINDING, - class = request, trid = random:uniform(1 bsl 96), - 'SOFTWARE' = <<"test">>}, - encode(Msg). - -test_udp(Addr, Port) -> test(Addr, Port, gen_udp). - -test_tcp(Addr, Port) -> test(Addr, Port, gen_tcp). - -test_tls(Addr, Port) -> test(Addr, Port, ssl). - -test(Addr, Port, Mod) -> - Res = case Mod of - gen_udp -> Mod:open(0, [binary, {active, false}]); - _ -> - Mod:connect(Addr, Port, [binary, {active, false}], 1000) - end, - case Res of - {ok, Sock} -> - if Mod == gen_udp -> - Mod:send(Sock, Addr, Port, bind_msg()); - true -> Mod:send(Sock, bind_msg()) - end, - case Mod:recv(Sock, 0, 1000) of - {ok, {_, _, Data}} -> try_dec(Data); - {ok, Data} -> try_dec(Data); - Err -> io:format("err: ~p~n", [Err]) - end, - Mod:close(Sock); - Err -> io:format("err: ~p~n", [Err]) - end. - -try_dec(Data) -> - case decode(Data) of - {ok, Msg, _} -> io:format("got:~n~s~n", [pp(Msg)]); - Err -> io:format("err: ~p~n", [Err]) - end. - -public_servers() -> - [{"stun.ekiga.net", 3478, 3478, 5349}, - {"stun.ideasip.com", 3478, 3478, 5349}, - {"stun.softjoys.com", 3478, 3478, 5349}, - {"stun.voipbuster.com", 3478, 3478, 5349}, - {"stun.voxgratia.org", 3478, 3478, 5349}, - {"stunserver.org", 3478, 3478, 5349}, - {"stun.sipgate.net", 10000, 10000, 5349}, - {"numb.viagenie.ca", 3478, 3478, 5349}, - {"stun.ipshka.com", 3478, 3478, 5349}, - {"localhost", 3478, 5349, 5349}]. - -test_public() -> - ssl:start(), - lists:foreach(fun ({Addr, UDPPort, TCPPort, TLSPort}) -> - io:format("trying ~s:~p on UDP... ", [Addr, UDPPort]), - test_udp(Addr, UDPPort), - io:format("trying ~s:~p on TCP... ", [Addr, TCPPort]), - test_tcp(Addr, TCPPort), - io:format("trying ~s:~p on TLS... ", [Addr, TLSPort]), - test_tls(Addr, TLSPort) - end, - public_servers()). diff --git a/src/tls/Makefile.in b/src/tls/Makefile.in deleted file mode 100644 index 203c88ac9..000000000 --- a/src/tls/Makefile.in +++ /dev/null @@ -1,70 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -SSL_CFLAGS = @SSL_CFLAGS@ -SSL_LIBS = @SSL_LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -# Assume Linux-style dynamic library flags -DYNAMIC_LIB_CFLAGS = -fpic -shared -ifeq ($(shell uname),Darwin) - DYNAMIC_LIB_CFLAGS = -fPIC -bundle -flat_namespace -undefined suppress -endif -ifeq ($(shell uname),SunOs) - DYNAMIC_LIB_CFLAGS = -KPIC -G -z text -endif - -EFLAGS += @ERLANG_SSLVER@ -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -ifeq (@md2@, true) - EFLAGS+=-DHAVE_MD2 - ERLANG_CFLAGS += -DHAVE_MD2 -endif - -ERLSHLIBS = ../tls_drv.so ../sha_drv.so -OUTDIR = .. -SOURCES = $(wildcard *.erl) -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - - -all: $(BEAMS) $(ERLSHLIBS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -#all: $(ERLSHLIBS) -# erl -s make all report "{outdir, \"..\"}" -noinput -s erlang halt - -$(ERLSHLIBS): ../%.so: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ - $(subst ../,,$(subst .so,.c,$@)) \ - $(LIBS) \ - $(SSL_LIBS) \ - $(SSL_CFLAGS) \ - $(ERLANG_LIBS) \ - $(ERLANG_CFLAGS) \ - -o $@ \ - $(DYNAMIC_LIB_CFLAGS) - -clean: - rm -f $(BEAMS) $(ERLSHLIBS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl diff --git a/src/tls/Makefile.win32 b/src/tls/Makefile.win32 deleted file mode 100644 index f5a3dba05..000000000 --- a/src/tls/Makefile.win32 +++ /dev/null @@ -1,38 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\tls.beam - -SOURCE = tls_drv.c sha_drv.c -OBJECT = tls_drv.o sha_drv.o -DLL = $(OUTDIR)\tls_drv.dll $(OUTPUT)\sha_drv.dll - -ALL : $(DLL) $(BEAMS) - -CLEAN : - -@erase $(DLL) - -@erase $(OUTDIR)\tls_drv.exp - -@erase $(OUTDIR)\tls_drv.lib - -@erase $(OUTDIR)\sha_drv.exp - -@erase $(OUTDIR)\sha_drv.lib - -@erase $(OBJECT) - -@erase $(BEAMS) - -$(OUTDIR)\tls.beam : tls.erl - erlc -W $(EFLAGS) -o $(OUTDIR) tls.erl - -CC=cl.exe -CC_FLAGS=-nologo -D__WIN32__ -DWIN32 -DWINDOWS -D_WIN32 -DNT -MD -Ox -I"$(ERLANG_DIR)\usr\include" -I"$(EI_DIR)\include" -I"$(OPENSSL_DIR)\include" -I"." - -LD=link.exe -LD_FLAGS=-release -nologo -incremental:no -dll "$(EI_DIR)\lib\ei_md.lib" "$(EI_DIR)\lib\erl_interface_md.lib" "$(OPENSSL_DIR)\lib\VC\ssleay32MD.lib" "$(OPENSSL_DIR)\lib\VC\libeay32MD.lib" MSVCRT.LIB kernel32.lib advapi32.lib gdi32.lib user32.lib comctl32.lib comdlg32.lib shell32.lib - -$(DLL) : $(OBJECT) - $(LD) $(LD_FLAGS) -out:$@ $< - -$(OBJECT) : $(SOURCE) - $(CC) $(CC_FLAGS) -c -Fo$@ $< - diff --git a/src/tls/sha_drv.c b/src/tls/sha_drv.c deleted file mode 100644 index 3558f790a..000000000 --- a/src/tls/sha_drv.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * ejabberd, Copyright (C) 2002-2013 ProcessOne - * - * 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 - * - */ - -#include -#include -#ifdef HAVE_MD2 -#include -#endif - -/* - * R15B changed several driver callbacks to use ErlDrvSizeT and - * ErlDrvSSizeT typedefs instead of int. - * This provides missing typedefs on older OTP versions. - */ -#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2 -typedef int ErlDrvSizeT; -typedef int ErlDrvSSizeT; -#endif - -static ErlDrvData sha_drv_start(ErlDrvPort port, char *buf) -{ - set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY); - return NULL; -} - -static ErlDrvSSizeT sha_drv_control(ErlDrvData handle, - unsigned int command, - char *buf, ErlDrvSizeT len, - char **rbuf, ErlDrvSizeT rlen) -{ - ErlDrvBinary *b = NULL; - - switch (command) { -#ifdef HAVE_MD2 - case 2: - rlen = MD2_DIGEST_LENGTH; - b = driver_alloc_binary(rlen); - if (b) MD2((unsigned char*)buf, len, (unsigned char*)b->orig_bytes); - break; -#endif - case 224: - rlen = SHA224_DIGEST_LENGTH; - b = driver_alloc_binary(rlen); - if (b) SHA224((unsigned char*)buf, len, (unsigned char*)b->orig_bytes); - break; - case 256: - rlen = SHA256_DIGEST_LENGTH; - b = driver_alloc_binary(rlen); - if (b) SHA256((unsigned char*)buf, len, (unsigned char*)b->orig_bytes); - break; - case 384: - rlen = SHA384_DIGEST_LENGTH; - b = driver_alloc_binary(rlen); - if (b) SHA384((unsigned char*)buf, len, (unsigned char*)b->orig_bytes); - break; - case 512: - rlen = SHA512_DIGEST_LENGTH; - b = driver_alloc_binary(rlen); - if (b) SHA512((unsigned char*)buf, len, (unsigned char*)b->orig_bytes); - break; - }; - - if (b) { - *rbuf = (char *)b; - } else { - *rbuf = NULL; - rlen = 0; - }; - - return rlen; -} - -ErlDrvEntry sha_driver_entry = { - NULL, /* F_PTR init, N/A */ - sha_drv_start, /* L_PTR start, called when port is opened */ - NULL, /* F_PTR stop, called when port is closed */ - NULL, /* F_PTR output, called when erlang has sent */ - NULL, /* F_PTR ready_input, called when input descriptor ready */ - NULL, /* F_PTR ready_output, called when output descriptor ready */ - "sha_drv", /* char *driver_name, the argument to open_port */ - NULL, /* F_PTR finish, called when unloaded */ - NULL, /* handle */ - sha_drv_control, /* F_PTR control, port_command callback */ - NULL, /* F_PTR timeout, reserved */ - NULL, /* F_PTR outputv, reserved */ - /* Added in Erlang/OTP R15B: */ - NULL, /* ready_async */ - NULL, /* flush */ - NULL, /* call */ - NULL, /* event */ - ERL_DRV_EXTENDED_MARKER, /* extended_marker */ - ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */ - ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */ - 0, /* driver_flags */ - NULL, /* handle2 */ - NULL, /* process_exit */ - NULL /* stop_select */ -}; - -DRIVER_INIT(sha_drv) /* must match name in driver_entry */ -{ - return &sha_driver_entry; -} diff --git a/src/tls/stdint.h b/src/tls/stdint.h deleted file mode 100755 index e032ff160..000000000 --- a/src/tls/stdint.h +++ /dev/null @@ -1,232 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. 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. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#if (_MSC_VER < 1300) && defined(__cplusplus) - extern "C++" { -#endif -# include -#if (_MSC_VER < 1300) && defined(__cplusplus) - } -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/src/tls/tls.erl b/src/tls/tls.erl deleted file mode 100644 index 3c10ec7de..000000000 --- a/src/tls/tls.erl +++ /dev/null @@ -1,385 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : tls.erl -%%% Author : Alexey Shchepin -%%% Purpose : Interface to openssl -%%% Created : 24 Jul 2004 by Alexey Shchepin -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(tls). - --author('alexey@process-one.net'). - --behaviour(gen_server). - --export([start/0, start_link/0, tcp_to_tls/2, - tls_to_tcp/1, send/2, recv/2, recv/3, recv_data/2, - setopts/2, sockname/1, peername/1, - controlling_process/2, close/1, get_peer_certificate/1, - get_verify_result/1, get_cert_verify_string/2, test/0]). - -%% Internal exports, call-back functions. --export([init/1, handle_call/3, handle_cast/2, - handle_info/2, code_change/3, terminate/2]). - --include("ejabberd.hrl"). - --define(SET_CERTIFICATE_FILE_ACCEPT, 1). - --define(SET_CERTIFICATE_FILE_CONNECT, 2). - --define(SET_ENCRYPTED_INPUT, 3). - --define(SET_DECRYPTED_OUTPUT, 4). - --define(GET_ENCRYPTED_OUTPUT, 5). - --define(GET_DECRYPTED_INPUT, 6). - --define(GET_PEER_CERTIFICATE, 7). - --define(GET_VERIFY_RESULT, 8). - --define(VERIFY_NONE, 65536). - --record(tlssock, {tcpsock :: inet:socket(), - tlsport :: port()}). - --type tls_socket() :: #tlssock{}. - --type cert() :: any(). %% TODO - --export_type([tls_socket/0]). - -start() -> - gen_server:start({local, ?MODULE}, ?MODULE, [], []). - -start_link() -> - gen_server:start_link({local, ?MODULE}, ?MODULE, [], - []). - -init([]) -> - case erl_ddll:load_driver(ejabberd:get_so_path(), - tls_drv) - of - ok -> ok; - {error, already_loaded} -> ok - end, - Port = open_port({spawn, "tls_drv"}, [binary]), - Res = port_control(Port, ?SET_CERTIFICATE_FILE_ACCEPT, - <<"./ssl.pem", 0>>), - case Res of - <<0>> -> {ok, Port}; - <<1, Error/binary>> -> {error, (Error)} - end. - -%%% -------------------------------------------------------- -%%% The call-back functions. -%%% -------------------------------------------------------- - -handle_call(_, _, State) -> {noreply, State}. - -handle_cast(_, State) -> {noreply, State}. - -handle_info({'EXIT', Port, Reason}, Port) -> - {stop, {port_died, Reason}, Port}; -handle_info({'EXIT', _Pid, _Reason}, Port) -> - {noreply, Port}; -handle_info(_, State) -> {noreply, State}. - -code_change(_OldVsn, State, _Extra) -> {ok, State}. - -terminate(_Reason, Port) -> Port ! {self, close}, ok. - --spec tcp_to_tls(inet:socket(), - [{atom(), any()}]) -> {'error','no_certfile' | binary()} | - {ok, tls_socket()}. - -tcp_to_tls(TCPSocket, Options) -> - case lists:keysearch(certfile, 1, Options) of - {value, {certfile, CertFile}} -> - case erl_ddll:load_driver(ejabberd:get_so_path(), - tls_drv) - of - ok -> ok; - {error, already_loaded} -> ok - end, - Port = open_port({spawn, "tls_drv"}, [binary]), - Flags = case lists:member(verify_none, Options) of - true -> ?VERIFY_NONE; - false -> 0 - end, - Command = case lists:member(connect, Options) of - true -> ?SET_CERTIFICATE_FILE_CONNECT; - false -> ?SET_CERTIFICATE_FILE_ACCEPT - end, - CertFile1 = iolist_to_binary(CertFile), - case port_control(Port, Command bor Flags, - <>) - of - <<0>> -> - {ok, #tlssock{tcpsock = TCPSocket, tlsport = Port}}; - <<1, Error/binary>> -> {error, (Error)} - end; - false -> {error, no_certfile} - end. - --spec tls_to_tcp(tls_socket()) -> inet:socket(). - -tls_to_tcp(#tlssock{tcpsock = TCPSocket, - tlsport = Port}) -> - port_close(Port), TCPSocket. - -recv(Socket, Length) -> recv(Socket, Length, infinity). - --spec recv(tls_socket(), non_neg_integer(), - timeout()) -> {error, inet:posix()} | - {error, binary()} | - {ok, binary()}. - -recv(#tlssock{tcpsock = TCPSocket, tlsport = Port} = - TLSSock, - Length, Timeout) -> - case port_control(Port, ?GET_DECRYPTED_INPUT, - <>) - of - <<0>> -> - case gen_tcp:recv(TCPSocket, 0, Timeout) of - {ok, Packet} -> recv_data(TLSSock, Packet, Length); - {error, _Reason} = Error -> Error - end; - <<0, In/binary>> -> {ok, In}; - <<1, Error/binary>> -> {error, (Error)} - end. - -recv_data(TLSSock, Packet) -> - recv_data(TLSSock, Packet, 0). - --spec recv_data(tls_socket(), binary(), - non_neg_integer()) -> {error, inet:posix() | binary()} | - {ok, binary()}. - -recv_data(TLSSock, Packet, Length) -> - case catch recv_data1(TLSSock, Packet, Length) of - {'EXIT', Reason} -> {error, Reason}; - Res -> Res - end. - -recv_data1(#tlssock{tcpsock = TCPSocket, - tlsport = Port}, - Packet, Length) -> - case port_control(Port, ?SET_ENCRYPTED_INPUT, Packet) of - <<0>> -> - case port_control(Port, ?GET_DECRYPTED_INPUT, - <>) - of - <<0, In/binary>> -> - case port_control(Port, ?GET_ENCRYPTED_OUTPUT, []) of - <<0, Out/binary>> -> - case gen_tcp:send(TCPSocket, Out) of - ok -> {ok, In}; - Error -> Error - end; - <<1, Error/binary>> -> {error, (Error)} - end; - <<1, Error/binary>> -> {error, (Error)} - end; - <<1, Error/binary>> -> {error, (Error)} - end. - --spec send(tls_socket(), binary()) -> ok | {error, inet:posix() | - binary() | timeout}. - -send(#tlssock{tcpsock = TCPSocket, tlsport = Port} = - TLSSock, - Packet) -> - case port_control(Port, ?SET_DECRYPTED_OUTPUT, Packet) - of - <<0>> -> - case port_control(Port, ?GET_ENCRYPTED_OUTPUT, []) of - <<0, Out/binary>> -> gen_tcp:send(TCPSocket, Out); - <<1, Error/binary>> -> {error, (Error)} - end; - <<1, Error/binary>> -> {error, (Error)}; - <<2>> -> % Dirty hack - receive - {timeout, _Timer, _} -> {error, timeout} - after 100 -> send(TLSSock, Packet) - end - end. - --spec setopts(tls_socket(), list()) -> ok | {error, inet:posix()}. - -setopts(#tlssock{tcpsock = TCPSocket}, Opts) -> - inet:setopts(TCPSocket, Opts). - --spec sockname(tls_socket()) -> {ok, {inet:ip_address(), inet:port_number()}} | - {error, inet:posix()}. - -sockname(#tlssock{tcpsock = TCPSocket}) -> - inet:sockname(TCPSocket). - -peername(#tlssock{tcpsock = TCPSocket}) -> - inet:peername(TCPSocket). - -controlling_process(#tlssock{tcpsock = TCPSocket}, - Pid) -> - gen_tcp:controlling_process(TCPSocket, Pid). - -close(#tlssock{tcpsock = TCPSocket, tlsport = Port}) -> - gen_tcp:close(TCPSocket), port_close(Port). - --spec get_peer_certificate(tls_socket()) -> error | {ok, cert()}. - -get_peer_certificate(#tlssock{tlsport = Port}) -> - case port_control(Port, ?GET_PEER_CERTIFICATE, []) of - <<0, BCert/binary>> -> - case catch public_key:pkix_decode_cert(BCert, plain) - of - {ok, Cert} -> {ok, Cert}; - {'Certificate', _, _, _} = Cert -> {ok, Cert}; - _ -> error - end; - <<1>> -> error - end. - --spec get_verify_result(tls_socket()) -> byte(). - -get_verify_result(#tlssock{tlsport = Port}) -> - <> = port_control(Port, ?GET_VERIFY_RESULT, []), - Res. - -test() -> - case erl_ddll:load_driver(ejabberd:get_so_path(), - tls_drv) - of - ok -> ok; - {error, already_loaded} -> ok - end, - Port = open_port({spawn, "tls_drv"}, [binary]), - ?PRINT("open_port: ~p~n", [Port]), - PCRes = port_control(Port, ?SET_CERTIFICATE_FILE_ACCEPT, - <<"./ssl.pem", 0>>), - ?PRINT("port_control: ~p~n", [PCRes]), - {ok, ListenSocket} = gen_tcp:listen(1234, - [binary, {packet, 0}, {active, true}, - {reuseaddr, true}, {nodelay, true}]), - ?PRINT("listen: ~p~n", [ListenSocket]), - {ok, Socket} = gen_tcp:accept(ListenSocket), - ?PRINT("accept: ~p~n", [Socket]), - loop(Port, Socket). - -loop(Port, Socket) -> - receive - {tcp, Socket, Data} -> - Res = port_control(Port, ?SET_ENCRYPTED_INPUT, Data), - ?PRINT("SET_ENCRYPTED_INPUT: ~p~n", [Res]), - DIRes = port_control(Port, ?GET_DECRYPTED_INPUT, Data), - ?PRINT("GET_DECRYPTED_INPUT: ~p~n", [DIRes]), - case DIRes of - <<0, In/binary>> -> ?PRINT("input: ~s~n", [(In)]); - <<1, DIError/binary>> -> - ?PRINT("GET_DECRYPTED_INPUT error: ~p~n", [(DIError)]) - end, - EORes = port_control(Port, ?GET_ENCRYPTED_OUTPUT, Data), - ?PRINT("GET_ENCRYPTED_OUTPUT: ~p~n", [EORes]), - case EORes of - <<0, Out/binary>> -> gen_tcp:send(Socket, Out); - <<1, EOError/binary>> -> - ?PRINT("GET_ENCRYPTED_OUTPUT error: ~p~n", [(EOError)]) - end, - loop(Port, Socket); - Msg -> - ?PRINT("receive: ~p~n", [Msg]), loop(Port, Socket) - end. - --spec get_cert_verify_string(number(), cert()) -> binary(). - -get_cert_verify_string(CertVerifyRes, Cert) -> - BCert = public_key:pkix_encode('Certificate', Cert, - plain), - IsSelfsigned = public_key:pkix_is_self_signed(BCert), - case {CertVerifyRes, IsSelfsigned} of - {21, true} -> <<"self-signed certificate">>; - _ -> cert_verify_code(CertVerifyRes) - end. - -cert_verify_code(0) -> <<"ok">>; -cert_verify_code(2) -> - <<"unable to get issuer certificate">>; -cert_verify_code(3) -> - <<"unable to get certificate CRL">>; -cert_verify_code(4) -> - <<"unable to decrypt certificate's signature">>; -cert_verify_code(5) -> - <<"unable to decrypt CRL's signature">>; -cert_verify_code(6) -> - <<"unable to decode issuer public key">>; -cert_verify_code(7) -> - <<"certificate signature failure">>; -cert_verify_code(8) -> <<"CRL signature failure">>; -cert_verify_code(9) -> - <<"certificate is not yet valid">>; -cert_verify_code(10) -> <<"certificate has expired">>; -cert_verify_code(11) -> <<"CRL is not yet valid">>; -cert_verify_code(12) -> <<"CRL has expired">>; -cert_verify_code(13) -> - <<"format error in certificate's notBefore " - "field">>; -cert_verify_code(14) -> - <<"format error in certificate's notAfter " - "field">>; -cert_verify_code(15) -> - <<"format error in CRL's lastUpdate field">>; -cert_verify_code(16) -> - <<"format error in CRL's nextUpdate field">>; -cert_verify_code(17) -> <<"out of memory">>; -cert_verify_code(18) -> <<"self signed certificate">>; -cert_verify_code(19) -> - <<"self signed certificate in certificate " - "chain">>; -cert_verify_code(20) -> - <<"unable to get local issuer certificate">>; -cert_verify_code(21) -> - <<"unable to verify the first certificate">>; -cert_verify_code(22) -> - <<"certificate chain too long">>; -cert_verify_code(23) -> <<"certificate revoked">>; -cert_verify_code(24) -> <<"invalid CA certificate">>; -cert_verify_code(25) -> - <<"path length constraint exceeded">>; -cert_verify_code(26) -> - <<"unsupported certificate purpose">>; -cert_verify_code(27) -> <<"certificate not trusted">>; -cert_verify_code(28) -> <<"certificate rejected">>; -cert_verify_code(29) -> <<"subject issuer mismatch">>; -cert_verify_code(30) -> - <<"authority and subject key identifier " - "mismatch">>; -cert_verify_code(31) -> - <<"authority and issuer serial number mismatch">>; -cert_verify_code(32) -> - <<"key usage does not include certificate " - "signing">>; -cert_verify_code(50) -> - <<"application verification failure">>; -cert_verify_code(X) -> - <<"Unknown OpenSSL error code: ", (jlib:integer_to_binary(X))/binary>>. diff --git a/src/tls/tls_drv.c b/src/tls/tls_drv.c deleted file mode 100644 index 038943e22..000000000 --- a/src/tls/tls_drv.c +++ /dev/null @@ -1,655 +0,0 @@ -/* - * ejabberd, Copyright (C) 2002-2013 ProcessOne - * - * 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 - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define BUF_SIZE 1024 - -typedef struct { - ErlDrvPort port; - BIO *bio_read; - BIO *bio_write; - SSL *ssl; -} tls_data; - -#ifdef _WIN32 -typedef unsigned __int32 uint32_t; -#endif - -#ifndef SSL_OP_NO_TICKET -#define SSL_OP_NO_TICKET 0 -#endif - -#define CIPHERS "DEFAULT:!EXPORT:!LOW:!SSLv2" - -/* - * R15B changed several driver callbacks to use ErlDrvSizeT and - * ErlDrvSSizeT typedefs instead of int. - * This provides missing typedefs on older OTP versions. - */ -#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2 -typedef int ErlDrvSizeT; -typedef int ErlDrvSSizeT; -#endif - -/* - * str_hash is based on the public domain code from - * http://www.burtleburtle.net/bob/hash/doobs.html - */ -static uint32_t str_hash(char *s) -{ - unsigned char *key = (unsigned char *)s; - uint32_t hash = 0; - size_t i; - - for (i = 0; key[i] != 0; i++) { - hash += key[i]; - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - return hash; -} - -/* Linear hashing */ - -#define MIN_LEVEL 8 -#define MAX_LEVEL 20 - -struct bucket { - uint32_t hash; - char *key_file; - time_t mtime; - SSL_CTX *ssl_ctx; - struct bucket *next; -}; - -struct hash_table { - int split; - int level; - struct bucket **buckets; - int size; -}; - -struct hash_table ht; - -static void init_hash_table() -{ - size_t size = 1 << (MIN_LEVEL + 1); - size_t i; - ht.buckets = (struct bucket **)driver_alloc(sizeof(struct bucket *) * size); - ht.split = 0; - ht.level = MIN_LEVEL; - for (i = 0; i < size; i++) - ht.buckets[i] = NULL; - -} - -static void hash_table_insert(char *key_file, time_t mtime, - SSL_CTX *ssl_ctx) -{ - int level, split; - uint32_t hash = str_hash(key_file); - size_t bucket; - int do_split = 0; - struct bucket *el; - struct bucket *new_bucket_el; - - split = ht.split; - level = ht.level; - - bucket = hash & ((1 << level) - 1); - if (bucket < split) - bucket = hash & ((1 << (level + 1)) - 1); - - el = ht.buckets[bucket]; - while (el != NULL) { - if (el->hash == hash && strcmp(el->key_file, key_file) == 0) { - el->mtime = mtime; - if (el->ssl_ctx != NULL) - SSL_CTX_free(el->ssl_ctx); - el->ssl_ctx = ssl_ctx; - break; - } - el = el->next; - } - - if (el == NULL) { - if (ht.buckets[bucket] != NULL) - do_split = !0; - - new_bucket_el = (struct bucket *)driver_alloc(sizeof(struct bucket)); - new_bucket_el->hash = hash; - new_bucket_el->key_file = (char *)driver_alloc(strlen(key_file) + 1); - strcpy(new_bucket_el->key_file, key_file); - new_bucket_el->mtime = mtime; - new_bucket_el->ssl_ctx = ssl_ctx; - new_bucket_el->next = ht.buckets[bucket]; - ht.buckets[bucket] = new_bucket_el; - } - - if (do_split) { - struct bucket **el_ptr = &ht.buckets[split]; - size_t new_bucket = split + (1 << level); - while (*el_ptr != NULL) { - uint32_t hash = (*el_ptr)->hash; - if ((hash & ((1 << (level + 1)) - 1)) == new_bucket) { - struct bucket *moved_el = *el_ptr; - *el_ptr = (*el_ptr)->next; - moved_el->next = ht.buckets[new_bucket]; - ht.buckets[new_bucket] = moved_el; - } else - el_ptr = &(*el_ptr)->next; - } - split++; - if (split == 1 << level) { - size_t size; - size_t i; - split = 0; - level++; - size = 1 << (level + 1); - ht.split = split; - ht.level = level; - ht.buckets = (struct bucket **) - driver_realloc(ht.buckets, sizeof(struct bucket *) * size); - for (i = 1 << level; i < size; i++) - ht.buckets[i] = NULL; - } else - ht.split = split; - } -} - -static SSL_CTX *hash_table_lookup(char *key_file, time_t *pmtime) -{ - int level, split; - uint32_t hash = str_hash(key_file); - size_t bucket; - struct bucket *el; - - split = ht.split; - level = ht.level; - - bucket = hash & ((1 << level) - 1); - if (bucket < split) - bucket = hash & ((1 << (level + 1)) - 1); - - el = ht.buckets[bucket]; - while (el != NULL) { - if (el->hash == hash && strcmp(el->key_file, key_file) == 0) { - *pmtime = el->mtime; - return el->ssl_ctx; - } - el = el->next; - } - - return NULL; -} - - -static ErlDrvData tls_drv_start(ErlDrvPort port, char *buff) -{ - tls_data *d = (tls_data *)driver_alloc(sizeof(tls_data)); - d->port = port; - d->bio_read = NULL; - d->bio_write = NULL; - d->ssl = NULL; - - set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY); - - return (ErlDrvData)d; -} - -static void tls_drv_stop(ErlDrvData handle) -{ - tls_data *d = (tls_data *)handle; - - if (d->ssl != NULL) - SSL_free(d->ssl); - - driver_free((char *)handle); -} - -static void tls_drv_finish() -{ - int level; - struct bucket *el; - int i; - - level = ht.level; - for (i = 0; i < 1 << (level + 1); i++) { - el = ht.buckets[i]; - while (el != NULL) { - if (el->ssl_ctx != NULL) - SSL_CTX_free(el->ssl_ctx); - driver_free(el->key_file); - el = el->next; - } - } - - driver_free(ht.buckets); -} - -static int is_key_file_modified(char *file, time_t *key_file_mtime) -{ - struct stat file_stat; - - if (stat(file, &file_stat)) - { - *key_file_mtime = 0; - return 1; - } else { - if (*key_file_mtime != file_stat.st_mtime) - { - *key_file_mtime = file_stat.st_mtime; - return 1; - } else - return 0; - } -} - -static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) -{ - return 1; -} - -/* - * ECDHE is enabled only on OpenSSL 1.0.0e and later. - * See http://www.openssl.org/news/secadv_20110906.txt - * for details. - */ -#ifndef OPENSSL_NO_ECDH -static void setup_ecdh(SSL_CTX *ctx) -{ - EC_KEY *ecdh; - - if (SSLeay() < 0x1000005fL) { - return; - } - - ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - SSL_CTX_set_options(ctx, SSL_OP_SINGLE_ECDH_USE); - SSL_CTX_set_tmp_ecdh(ctx, ecdh); - - EC_KEY_free(ecdh); -} -#endif - -#ifndef OPENSSL_NO_DH -/* -1024-bit MODP Group with 160-bit prime order subgroup (RFC5114) ------BEGIN DH PARAMETERS----- -MIIBDAKBgQCxC4+WoIDgHd6S3l6uXVTsUsmfvPsGo8aaap3KUtI7YWBz4oZ1oj0Y -mDjvHi7mUsAT7LSuqQYRIySXXDzUm4O/rMvdfZDEvXCYSI6cIZpzck7/1vrlZEc4 -+qMaT/VbzMChUa9fDci0vUW/N982XBpl5oz9p21NpwjfH7K8LkpDcQKBgQCk0cvV -w/00EmdlpELvuZkF+BBN0lisUH/WQGz/FCZtMSZv6h5cQVZLd35pD1UE8hMWAhe0 -sBuIal6RVH+eJ0n01/vX07mpLuGQnQ0iY/gKdqaiTAh6CR9THb8KAWm2oorWYqTR -jnOvoy13nVkY0IvIhY9Nzvl8KiSFXm7rIrOy5QICAKA= ------END DH PARAMETERS----- - */ -static unsigned char dh1024_p[] = { - 0xB1,0x0B,0x8F,0x96,0xA0,0x80,0xE0,0x1D,0xDE,0x92,0xDE,0x5E, - 0xAE,0x5D,0x54,0xEC,0x52,0xC9,0x9F,0xBC,0xFB,0x06,0xA3,0xC6, - 0x9A,0x6A,0x9D,0xCA,0x52,0xD2,0x3B,0x61,0x60,0x73,0xE2,0x86, - 0x75,0xA2,0x3D,0x18,0x98,0x38,0xEF,0x1E,0x2E,0xE6,0x52,0xC0, - 0x13,0xEC,0xB4,0xAE,0xA9,0x06,0x11,0x23,0x24,0x97,0x5C,0x3C, - 0xD4,0x9B,0x83,0xBF,0xAC,0xCB,0xDD,0x7D,0x90,0xC4,0xBD,0x70, - 0x98,0x48,0x8E,0x9C,0x21,0x9A,0x73,0x72,0x4E,0xFF,0xD6,0xFA, - 0xE5,0x64,0x47,0x38,0xFA,0xA3,0x1A,0x4F,0xF5,0x5B,0xCC,0xC0, - 0xA1,0x51,0xAF,0x5F,0x0D,0xC8,0xB4,0xBD,0x45,0xBF,0x37,0xDF, - 0x36,0x5C,0x1A,0x65,0xE6,0x8C,0xFD,0xA7,0x6D,0x4D,0xA7,0x08, - 0xDF,0x1F,0xB2,0xBC,0x2E,0x4A,0x43,0x71, -}; -static unsigned char dh1024_g[] = { - 0xA4,0xD1,0xCB,0xD5,0xC3,0xFD,0x34,0x12,0x67,0x65,0xA4,0x42, - 0xEF,0xB9,0x99,0x05,0xF8,0x10,0x4D,0xD2,0x58,0xAC,0x50,0x7F, - 0xD6,0x40,0x6C,0xFF,0x14,0x26,0x6D,0x31,0x26,0x6F,0xEA,0x1E, - 0x5C,0x41,0x56,0x4B,0x77,0x7E,0x69,0x0F,0x55,0x04,0xF2,0x13, - 0x16,0x02,0x17,0xB4,0xB0,0x1B,0x88,0x6A,0x5E,0x91,0x54,0x7F, - 0x9E,0x27,0x49,0xF4,0xD7,0xFB,0xD7,0xD3,0xB9,0xA9,0x2E,0xE1, - 0x90,0x9D,0x0D,0x22,0x63,0xF8,0x0A,0x76,0xA6,0xA2,0x4C,0x08, - 0x7A,0x09,0x1F,0x53,0x1D,0xBF,0x0A,0x01,0x69,0xB6,0xA2,0x8A, - 0xD6,0x62,0xA4,0xD1,0x8E,0x73,0xAF,0xA3,0x2D,0x77,0x9D,0x59, - 0x18,0xD0,0x8B,0xC8,0x85,0x8F,0x4D,0xCE,0xF9,0x7C,0x2A,0x24, - 0x85,0x5E,0x6E,0xEB,0x22,0xB3,0xB2,0xE5, -}; - -static void setup_dh(SSL_CTX *ctx) -{ - DH *dh; - - dh = DH_new(); - if (dh == NULL) { - return; - } - - dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL); - dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL); - if (dh->p == NULL || dh->g == NULL) { - DH_free(dh); - return; - } - - SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE); - SSL_CTX_set_tmp_dh(ctx, dh); - - DH_free(dh); -} -#endif - -#define SET_CERTIFICATE_FILE_ACCEPT 1 -#define SET_CERTIFICATE_FILE_CONNECT 2 -#define SET_ENCRYPTED_INPUT 3 -#define SET_DECRYPTED_OUTPUT 4 -#define GET_ENCRYPTED_OUTPUT 5 -#define GET_DECRYPTED_INPUT 6 -#define GET_PEER_CERTIFICATE 7 -#define GET_VERIFY_RESULT 8 -#define VERIFY_NONE 0x10000 - - -#define die_unless(cond, errstr) \ - if (!(cond)) \ - { \ - int errstrlen = strlen(errstr); \ - unsigned long error_code = ERR_get_error(); \ - char *error_string = error_code ? \ - ERR_error_string(error_code, NULL) : \ - NULL; \ - int error_string_length = error_string ? \ - strlen(error_string) : 0; \ - if (error_code) \ - rlen = errstrlen + error_string_length + 3; \ - else \ - rlen = errstrlen + 1; \ - b = driver_alloc_binary(rlen); \ - b->orig_bytes[0] = 1; \ - strncpy(b->orig_bytes + 1, errstr, errstrlen); \ - if (error_code) { \ - strncpy(b->orig_bytes + 1 + errstrlen, \ - ": ", 2); \ - strncpy(b->orig_bytes + 3 + errstrlen, \ - error_string, error_string_length); \ - } \ - *rbuf = (char *)b; \ - return rlen; \ - } - - -static ErlDrvSSizeT tls_drv_control(ErlDrvData handle, - unsigned int command, - char *buf, ErlDrvSizeT len, - char **rbuf, ErlDrvSizeT rlen) -{ - tls_data *d = (tls_data *)handle; - int res; - int size; - ErlDrvBinary *b; - X509 *cert; - unsigned int flags = command; - - command &= 0xffff; - - ERR_clear_error(); - switch (command) - { - case SET_CERTIFICATE_FILE_ACCEPT: - case SET_CERTIFICATE_FILE_CONNECT: { - time_t mtime = 0; - SSL_CTX *ssl_ctx = hash_table_lookup(buf, &mtime); - if (is_key_file_modified(buf, &mtime) || ssl_ctx == NULL) - { - SSL_CTX *ctx; - - hash_table_insert(buf, mtime, NULL); - - ctx = SSL_CTX_new(SSLv23_method()); - die_unless(ctx, "SSL_CTX_new failed"); - - res = SSL_CTX_use_certificate_chain_file(ctx, buf); - die_unless(res > 0, "SSL_CTX_use_certificate_file failed"); - - res = SSL_CTX_use_PrivateKey_file(ctx, buf, SSL_FILETYPE_PEM); - die_unless(res > 0, "SSL_CTX_use_PrivateKey_file failed"); - - res = SSL_CTX_check_private_key(ctx); - die_unless(res > 0, "SSL_CTX_check_private_key failed"); - - SSL_CTX_set_cipher_list(ctx, CIPHERS); - -#ifndef OPENSSL_NO_ECDH - if (command == SET_CERTIFICATE_FILE_ACCEPT) { - setup_ecdh(ctx); - } -#endif -#ifndef OPENSSL_NO_DH - if (command == SET_CERTIFICATE_FILE_ACCEPT) { - setup_dh(ctx); - } -#endif - - SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); - SSL_CTX_set_default_verify_paths(ctx); -#ifdef SSL_MODE_RELEASE_BUFFERS - SSL_CTX_set_mode(ctx, SSL_MODE_RELEASE_BUFFERS); -#endif - /* SSL_CTX_load_verify_locations(ctx, "/etc/ejabberd/ca_certificates.pem", NULL); */ - /* SSL_CTX_load_verify_locations(ctx, NULL, "/etc/ejabberd/ca_certs/"); */ - - /* This IF is commented to allow verification in all cases: */ - /* if (command == SET_CERTIFICATE_FILE_ACCEPT) */ - /* { */ - SSL_CTX_set_verify(ctx, - SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, - verify_callback); - /* } */ - - ssl_ctx = ctx; - hash_table_insert(buf, mtime, ssl_ctx); - } - - d->ssl = SSL_new(ssl_ctx); - die_unless(d->ssl, "SSL_new failed"); - - if (flags & VERIFY_NONE) - SSL_set_verify(d->ssl, SSL_VERIFY_NONE, verify_callback); - - d->bio_read = BIO_new(BIO_s_mem()); - d->bio_write = BIO_new(BIO_s_mem()); - - SSL_set_bio(d->ssl, d->bio_read, d->bio_write); - - if (command == SET_CERTIFICATE_FILE_ACCEPT) { - SSL_set_options(d->ssl, SSL_OP_NO_SSLv2|SSL_OP_NO_TICKET|SSL_OP_ALL); - - SSL_set_accept_state(d->ssl); - } else { - SSL_set_options(d->ssl, SSL_OP_NO_SSLv2|SSL_OP_NO_TICKET); - SSL_set_connect_state(d->ssl); - } - break; - } - case SET_ENCRYPTED_INPUT: - die_unless(d->ssl, "SSL not initialized"); - BIO_write(d->bio_read, buf, len); - break; - case SET_DECRYPTED_OUTPUT: - die_unless(d->ssl, "SSL not initialized"); - - res = SSL_write(d->ssl, buf, len); - if (res <= 0) - { - res = SSL_get_error(d->ssl, res); - if (res == SSL_ERROR_WANT_READ || res == SSL_ERROR_WANT_WRITE) - { - b = driver_alloc_binary(1); - b->orig_bytes[0] = 2; - *rbuf = (char *)b; - return 1; - } else { - die_unless(0, "SSL_write failed"); - } - } - break; - case GET_ENCRYPTED_OUTPUT: - die_unless(d->ssl, "SSL not initialized"); - size = BIO_ctrl_pending(d->bio_write) + 1; - b = driver_alloc_binary(size); - b->orig_bytes[0] = 0; - BIO_read(d->bio_write, b->orig_bytes + 1, size - 1); - *rbuf = (char *)b; - return size; - case GET_DECRYPTED_INPUT: - if (!SSL_is_init_finished(d->ssl)) - { - res = SSL_do_handshake(d->ssl); - if (res <= 0) - die_unless(SSL_get_error(d->ssl, res) == SSL_ERROR_WANT_READ, - "SSL_do_handshake failed"); - } - if (SSL_is_init_finished(d->ssl)) { - size_t req_size = 0; - if (len == 4) - { - unsigned char *b = (unsigned char *)buf; - req_size = - (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]; - } - size = BUF_SIZE + 1; - rlen = 1; - b = driver_alloc_binary(size); - b->orig_bytes[0] = 0; - - res = 0; - - while ((req_size == 0 || rlen < req_size + 1) && - (res = SSL_read(d->ssl, - b->orig_bytes + rlen, - (req_size == 0 || req_size + 1 >= size) ? - size - rlen : req_size + 1 - rlen)) > 0) - { - //printf("%d bytes of decrypted data read from state machine\r\n",res); - rlen += res; - if (size - rlen < BUF_SIZE) { - size *= 2; - b = driver_realloc_binary(b, size); - } - } - - if (res < 0) - { - int err = SSL_get_error(d->ssl, res); - - if (err == SSL_ERROR_WANT_READ) - { - //printf("SSL_read wants more data\r\n"); - //return 0; - } - // TODO - } - b = driver_realloc_binary(b, rlen); - *rbuf = (char *)b; - return rlen; - } - break; - case GET_PEER_CERTIFICATE: - cert = SSL_get_peer_certificate(d->ssl); - if (cert == NULL) - { - b = driver_alloc_binary(1); - b->orig_bytes[0] = 1; - *rbuf = (char *)b; - return 1; - } else { - unsigned char *tmp_buf; - rlen = i2d_X509(cert, NULL); - if (rlen >= 0) - { - rlen++; - b = driver_alloc_binary(rlen); - b->orig_bytes[0] = 0; - tmp_buf = (unsigned char *)&b->orig_bytes[1]; - i2d_X509(cert, &tmp_buf); - X509_free(cert); - *rbuf = (char *)b; - return rlen; - } else - X509_free(cert); - } - break; - case GET_VERIFY_RESULT: - b = driver_alloc_binary(1); - b->orig_bytes[0] = SSL_get_verify_result(d->ssl); - *rbuf = (char *)b; - return 1; - break; - } - - b = driver_alloc_binary(1); - b->orig_bytes[0] = 0; - *rbuf = (char *)b; - return 1; -} - - -ErlDrvEntry tls_driver_entry = { - NULL, /* F_PTR init, N/A */ - tls_drv_start, /* L_PTR start, called when port is opened */ - tls_drv_stop, /* F_PTR stop, called when port is closed */ - NULL, /* F_PTR output, called when erlang has sent */ - NULL, /* F_PTR ready_input, called when input descriptor ready */ - NULL, /* F_PTR ready_output, called when output descriptor ready */ - "tls_drv", /* char *driver_name, the argument to open_port */ - tls_drv_finish, /* F_PTR finish, called when unloaded */ - NULL, /* handle */ - tls_drv_control, /* F_PTR control, port_command callback */ - NULL, /* F_PTR timeout, reserved */ - NULL, /* F_PTR outputv, reserved */ - /* Added in Erlang/OTP R15B: */ - NULL, /* ready_async */ - NULL, /* flush */ - NULL, /* call */ - NULL, /* event */ - ERL_DRV_EXTENDED_MARKER, /* extended_marker */ - ERL_DRV_EXTENDED_MAJOR_VERSION, /* major_version */ - ERL_DRV_EXTENDED_MINOR_VERSION, /* minor_version */ - 0, /* driver_flags */ - NULL, /* handle2 */ - NULL, /* process_exit */ - NULL /* stop_select */ -}; - -DRIVER_INIT(tls_drv) /* must match name in driver_entry */ -{ - OpenSSL_add_ssl_algorithms(); - SSL_load_error_strings(); - init_hash_table(); - return &tls_driver_entry; -} - - diff --git a/src/translate.erl b/src/translate.erl index 3257608f7..fd2ebcc64 100644 --- a/src/translate.erl +++ b/src/translate.erl @@ -32,6 +32,7 @@ translate/2]). -include("ejabberd.hrl"). +-include("logger.hrl"). start() -> ets:new(translations, [named_table, public]), diff --git a/src/url_util.erl b/src/url_util.erl deleted file mode 100644 index 64140321b..000000000 --- a/src/url_util.erl +++ /dev/null @@ -1,65 +0,0 @@ -%% Author: Romuald du Song -%% Created: 9 oct. 2009 -%% Description: -%% Hacked from Joe Armtrong http://www.erlang.org/examples/small_examples/urlget.erl - --module(url_util). - -%% -%% Include files -%% - -%% -%% Exported Functions -%% --export([parse/1]). - -%% -%% API Functions -%% - -%%---------------------------------------------------------------------- -%% parse(URL) -> {http, Site, Port, File} | -%% {file, File} | {error,Why} -%% (primitive) - -parse([$h,$t,$t,$p,$:,$/,$/|T]) -> parse_http(T, http); -parse([$h,$t,$t,$p,$s,$:,$/,$/|T]) -> parse_http(T, https); -parse([$f,$t,$p,$:,$/,$/|_T]) -> {error, no_ftp}; -parse([$f,$i,$l,$e,$:,$/,$/|F]) -> {file, F}; -parse(_X) -> {error, unknown_url_type}. - - -%% -%% Local Functions -%% - -parse_http(X, Protocol) -> - case string:chr(X, $/) of - 0 -> - %% not terminated by "/" (sigh) - %% try again - parse_http(X ++ "/", Protocol); - N -> - %% The Host is up to the first "/" - %% The file is everything else - Host = string:substr(X, 1, N-1), - File = string:substr(X, N, length(X)), - %% Now check to see if the host name contains a colon - %% i.e. there is an explicit port address in the hostname - case string:chr(Host, $:) of - 0 -> - %% no colon - Port = 80, - {Protocol, Host, Port, File}; - M -> - Site = string:substr(Host,1,M-1), - case (catch list_to_integer( - string:substr(Host, M+1, length(Host)))) of - {'EXIT', _} -> - {Protocol, Site, 80, File}; - Port -> - {Protocol, Site, Port, File} - end - end - end. diff --git a/src/web/Makefile.in b/src/web/Makefile.in deleted file mode 100644 index 5ac2fe5e6..000000000 --- a/src/web/Makefile.in +++ /dev/null @@ -1,38 +0,0 @@ -# $Id$ - -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -ERLANG_CFLAGS = @ERLANG_CFLAGS@ -ERLANG_LIBS = @ERLANG_LIBS@ - -EFLAGS += @ERLANG_SSLVER@ -EFLAGS += -I .. -EFLAGS += -pz .. - -# make debug=true to compile Erlang module with debug informations. -ifdef debug - EFLAGS+=+debug_info -endif - -SOURCES = $(wildcard *.erl) -OUTDIR = .. -BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam)) - -all: $(BEAMS) - -$(OUTDIR)/%.beam: %.erl - @ERLC@ -W $(EFLAGS) -o $(OUTDIR) $< - -clean: - rm -f $(BEAMS) - -distclean: clean - rm -f Makefile - -TAGS: - etags *.erl - diff --git a/src/web/Makefile.win32 b/src/web/Makefile.win32 deleted file mode 100644 index 411d57ce8..000000000 --- a/src/web/Makefile.win32 +++ /dev/null @@ -1,33 +0,0 @@ - -include ..\Makefile.inc - -EFLAGS = -I .. -pz .. - -OUTDIR = .. -BEAMS = ..\ejabberd_http.beam ..\ejabberd_http_bind.beam ..\ejabberd_http_poll.beam ..\ejabberd_web.beam ..\ejabberd_web_admin.beam ..\mod_http_bind.beam ..\mod_http_fileserver.beam - -ALL : $(BEAMS) - -CLEAN : - -@erase $(BEAMS) - -$(OUTDIR)\ejabberd_http.beam : ejabberd_http.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_http.erl - -$(OUTDIR)\ejabberd_web.beam : ejabberd_web.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_web.erl - -$(OUTDIR)\ejabberd_web_admin.beam : ejabberd_web_admin.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_web_admin.erl - -$(OUTDIR)\ejabberd_http_bind.beam : ejabberd_http_bind.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_http_bind.erl - -$(OUTDIR)\ejabberd_http_poll.beam : ejabberd_http_poll.erl - erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_http_poll.erl - -$(OUTDIR)\mod_http_bind.beam : mod_http_bind.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_http_bind.erl - -$(OUTDIR)\mod_http_fileserver.beam : mod_http_fileserver.erl - erlc -W $(EFLAGS) -o $(OUTDIR) mod_http_fileserver.erl diff --git a/src/web/websocket_test.erl b/src/websocket_test.erl similarity index 100% rename from src/web/websocket_test.erl rename to src/websocket_test.erl diff --git a/src/win32_dns.erl b/src/win32_dns.erl index a51c4bd21..9f80a08de 100644 --- a/src/win32_dns.erl +++ b/src/win32_dns.erl @@ -28,6 +28,7 @@ -export([get_nameservers/0]). -include("ejabberd.hrl"). +-include("logger.hrl"). -define(IF_KEY, "\\hklm\\system\\CurrentControlSet\\Services\\TcpIp\\Parameters\\Interfaces"). -define(TOP_KEY, "\\hklm\\system\\CurrentControlSet\\Services\\TcpIp\\Parameters"). diff --git a/src/xml.c b/src/xml.c deleted file mode 100644 index 0a600e9f0..000000000 --- a/src/xml.c +++ /dev/null @@ -1,259 +0,0 @@ -#include -#include -#include - -#ifdef SSL40 -#define ENIF_ALLOC(SIZE) enif_alloc(SIZE) -#define ENIF_FREE(PTR) enif_free(PTR) -#define ENIF_REALLOC(PTR, SIZE) enif_realloc(PTR, SIZE) -#define ENIF_ALLOC_BINARY(SIZE, BIN) enif_alloc_binary(SIZE, BIN) -#define ENIF_COMPARE(TERM1, TERM2) enif_compare(TERM1, TERM2) -#else -#define ENIF_ALLOC(SIZE) enif_alloc(env, SIZE) -#define ENIF_FREE(PTR) enif_free(env, PTR) -#define ENIF_REALLOC(PTR, SIZE) enif_realloc(env, PTR, SIZE) -#define ENIF_ALLOC_BINARY(SIZE, BIN) enif_alloc_binary(env, SIZE, BIN) -#define ENIF_COMPARE(TERM1, TERM2) enif_compare(env, TERM1, TERM2) -#endif - -static ERL_NIF_TERM atom_xmlelement; -static ERL_NIF_TERM atom_xmlcdata; - -struct buf { - int limit; - int len; - unsigned char *b; -}; - -static int make_element(ErlNifEnv* env, struct buf *rbuf, ERL_NIF_TERM el); - -static int load(ErlNifEnv* env, void** priv, ERL_NIF_TERM load_info) -{ - atom_xmlelement = enif_make_atom(env, "xmlel"); - atom_xmlcdata = enif_make_atom(env, "xmlcdata"); - return 0; -} - -static struct buf *init_buf(ErlNifEnv* env) -{ - struct buf *rbuf = ENIF_ALLOC(sizeof(struct buf)); - rbuf->limit = 1024; - rbuf->len = 0; - rbuf->b = ENIF_ALLOC(rbuf->limit); - return rbuf; -} - -static void destroy_buf(ErlNifEnv* env, struct buf *rbuf) -{ - if (rbuf) { - if (rbuf->b) { - ENIF_FREE(rbuf->b); - }; - ENIF_FREE(rbuf); - }; -} - -inline void resize_buf(ErlNifEnv* env, struct buf *rbuf, int len_to_add) -{ - int new_len = rbuf->len + len_to_add; - - if (new_len > rbuf->limit) { - while (new_len > rbuf->limit) - rbuf->limit *= 2; - rbuf->b = ENIF_REALLOC(rbuf->b, rbuf->limit); - } -} - -static void buf_add_char(ErlNifEnv* env, struct buf *rbuf, unsigned char c) -{ - resize_buf(env, rbuf, 1); - (rbuf->b)[rbuf->len] = c; - rbuf->len += 1; -} - -static void buf_add_str(ErlNifEnv* env, struct buf *rbuf, char *data, int len) -{ - resize_buf(env, rbuf, len); - memcpy(rbuf->b + rbuf->len, data, len); - rbuf->len += len; -} - -inline void crypt(ErlNifEnv* env, struct buf *rbuf, unsigned char *data, int len) -{ - int i; - - for (i = 0; i < len; i++) { - switch (data[i]) { - case '&': - buf_add_str(env, rbuf, "&", 5); - break; - case '<': - buf_add_str(env, rbuf, "<", 4); - break; - case '>': - buf_add_str(env, rbuf, ">", 4); - break; - case '"': - buf_add_str(env, rbuf, """, 6); - break; - case '\'': - buf_add_str(env, rbuf, "'", 6); - break; - default: - buf_add_char(env, rbuf, data[i]); - break; - }; - }; -} - -static int make_elements(ErlNifEnv* env, struct buf *rbuf, ERL_NIF_TERM els) -{ - ERL_NIF_TERM head, tail; - int ret = 0; - - while (enif_get_list_cell(env, els, &head, &tail)) { - ret = make_element(env, rbuf, head); - if (ret) { - els = tail; - } else { - break; - }; - }; - - return ret; -} - -static int make_attrs(ErlNifEnv* env, struct buf *rbuf, ERL_NIF_TERM attrs) -{ - ErlNifBinary name, data; - ERL_NIF_TERM head, tail; - const ERL_NIF_TERM *tuple; - int arity, ret = 1; - - while (enif_get_list_cell(env, attrs, &head, &tail)) { - if (enif_get_tuple(env, head, &arity, &tuple)) { - if (arity == 2) { - if (enif_inspect_iolist_as_binary(env, tuple[0], &name) && - enif_inspect_iolist_as_binary(env, tuple[1], &data)) { - buf_add_char(env, rbuf, ' '); - buf_add_str(env, rbuf, (char *)name.data, name.size); - buf_add_str(env, rbuf, "='", 2); - crypt(env, rbuf, data.data, data.size); - buf_add_char(env, rbuf, '\''); - attrs = tail; - } else { - ret = 0; - break; - }; - } else { - ret = 0; - break; - }; - } else { - ret = 0; - break; - }; - }; - - return ret; -} - -static int make_element(ErlNifEnv* env, struct buf *rbuf, ERL_NIF_TERM el) -{ - ErlNifBinary cdata, name; - const ERL_NIF_TERM *tuple; - int arity, ret = 0; - - if (enif_get_tuple(env, el, &arity, &tuple)) { - if (arity == 2) { - if (!ENIF_COMPARE(tuple[0], atom_xmlcdata)) { - if (enif_inspect_iolist_as_binary(env, tuple[1], &cdata)) { - crypt(env, rbuf, cdata.data, cdata.size); - ret = 1; - }; - }; - }; - if (arity == 4) { - if (!ENIF_COMPARE(tuple[0], atom_xmlelement)) { - if (enif_inspect_iolist_as_binary(env, tuple[1], &name)) { - buf_add_char(env, rbuf, '<'); - buf_add_str(env, rbuf, (char *)name.data, name.size); - ret = make_attrs(env, rbuf, tuple[2]); - if (ret) { - if (enif_is_empty_list(env, tuple[3])) { - buf_add_str(env, rbuf, "/>", 2); - } else { - buf_add_char(env, rbuf, '>'); - ret = make_elements(env, rbuf, tuple[3]); - if (ret) { - buf_add_str(env, rbuf, "'); - }; - }; - }; - }; - }; - }; - }; - - return ret; -} - -static ERL_NIF_TERM element_to(ErlNifEnv* env, int argc, - const ERL_NIF_TERM argv[], - int as_string) -{ - ErlNifBinary output; - ERL_NIF_TERM result; - struct buf *rbuf; - - if (argc == 1) { - rbuf = init_buf(env); - if (make_element(env, rbuf, argv[0])) { - if (as_string) { - (rbuf->b)[rbuf->len] = 0; - result = enif_make_string(env, (char *) rbuf->b, ERL_NIF_LATIN1); - destroy_buf(env, rbuf); - return result; - } else { - if (ENIF_ALLOC_BINARY(rbuf->len, &output)) { - memcpy(output.data, rbuf->b, rbuf->len); - result = enif_make_binary(env, &output); - destroy_buf(env, rbuf); - return result; - }; - }; - }; - destroy_buf(env, rbuf); - }; - - return enif_make_badarg(env); -} - -#ifdef SSL40 -static ERL_NIF_TERM element_to_string(ErlNifEnv* env, int argc, - const ERL_NIF_TERM argv[]) -{ - return element_to(env, argc, argv, 1); -} -#endif - -static ERL_NIF_TERM element_to_binary(ErlNifEnv* env, int argc, - const ERL_NIF_TERM argv[]) -{ - return element_to(env, argc, argv, 0); -} - -static ErlNifFunc nif_funcs[] = - { - /* Stupid Erlang bug with enif_make_string() is fixed - in R14A only (OTP-8685), so we can't use - element_to_string in Erlang < R14A.*/ -#ifdef SSL40 - {"element_to_string", 1, element_to_string}, -#endif - {"element_to_binary", 1, element_to_binary} - }; - -ERL_NIF_INIT(xml, nif_funcs, load, NULL, NULL, NULL) diff --git a/src/xml.erl b/src/xml.erl deleted file mode 100644 index 68221ed37..000000000 --- a/src/xml.erl +++ /dev/null @@ -1,432 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : xml.erl -%%% Author : Alexey Shchepin -%%% Purpose : XML utils -%%% Created : 20 Nov 2002 by Alexey Shchepin -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(xml). - --author('alexey@process-one.net'). - --export([element_to_binary/1, - crypt/1, make_text_node/1, remove_cdata/1, - remove_subtags/3, get_cdata/1, get_tag_cdata/1, - get_attr/2, get_attr_s/2, get_tag_attr/2, - get_tag_attr_s/2, get_subtag/2, get_subtag_cdata/2, - append_subtags/2, get_path_s/2, start/0, - replace_tag_attr/3, to_xmlel/1]). - --include("jlib.hrl"). --include("ejabberd.hrl"). - -%% Select at compile time how to escape characters in binary text -%% nodes. -%% Can be choosen with ./configure --enable-full-xml --ifdef(FULL_XML_SUPPORT). - --define(ESCAPE_BINARY(CData), make_text_node(CData)). - --else. - --define(ESCAPE_BINARY(CData), crypt(CData)). - --endif. - -%% Replace element_to_binary/1 with NIF -%% Can be choosen with ./configure --enable-nif --ifdef(NIF). - -start() -> - SOPath = filename:join(ejabberd:get_so_path(), "xml"), - case catch erlang:load_nif(SOPath, 0) of - ok -> ok; - Err -> ?WARNING_MSG("unable to load xml NIF: ~p", [Err]) - end. - --else. - -start() -> ok. - --endif. - -%% --spec(element_to_binary/1 :: -( - El :: xmlel() | cdata()) - -> binary() -). - -element_to_binary(El) -> - iolist_to_binary(element_to_string(El)). - -%% --spec(element_to_string/1 :: -( - El :: xmlel() | cdata()) - -> string() -). - -element_to_string(El) -> - case catch element_to_string_nocatch(El) of - {'EXIT', Reason} -> erlang:error({badxml, El, Reason}); - Result -> Result - end. - --spec(element_to_string_nocatch/1 :: -( - El :: xmlel() | cdata()) - -> iolist() -). - -element_to_string_nocatch(El) -> - case El of - #xmlel{name = Name, attrs = Attrs, children = Els} -> - if Els /= [] -> - [$<, Name, attrs_to_list(Attrs), $>, - [element_to_string_nocatch(E) || E <- Els], $<, $/, - Name, $>]; - true -> [$<, Name, attrs_to_list(Attrs), $/, $>] - end; - %% We do not crypt CDATA binary, but we enclose it in XML CDATA - {xmlcdata, CData} -> - ?ESCAPE_BINARY(CData) - end. - -attrs_to_list(Attrs) -> [attr_to_list(A) || A <- Attrs]. - -attr_to_list({Name, Value}) -> - [$\s, Name, $=, $', crypt(Value), $']. - -crypt(S) -> - << <<(case C of - $& -> <<"&">>; - $< -> <<"<">>; - $> -> <<">">>; - $" -> <<""">>; - $' -> <<"'">>; - _ -> <> - end)/binary>> - || <> <= S >>. - -%% --spec(make_text_node/1 :: -( - CData :: binary()) - -> binary() -). - -make_text_node(CData) -> - case cdata_need_escape(CData) of - cdata -> - CDATA1 = <<">, - CDATA2 = <<"]]>">>, - iolist_to_binary([CDATA1, CData, CDATA2]); - none -> CData; - {cdata, EndTokens} -> - EscapedCData = escape_cdata(CData, EndTokens), - iolist_to_binary(EscapedCData) - end. - -cdata_need_escape(CData) -> - cdata_need_escape(CData, 0, false, []). - -cdata_need_escape(<<>>, _, false, _) -> none; -cdata_need_escape(<<>>, _, true, []) -> cdata; -cdata_need_escape(<<>>, _, true, CDataEndTokens) -> - {cdata, lists:reverse(CDataEndTokens)}; -cdata_need_escape(<<$], $], $>, Rest/binary>>, - CurrentPosition, _XMLEscape, CDataEndTokens) -> - NewPosition = CurrentPosition + 3, - cdata_need_escape(Rest, NewPosition, true, - [CurrentPosition + 1 | CDataEndTokens]); -%% Only <, & need to be escaped in XML text node -%% See reference: http://www.w3.org/TR/xml11/#syntax -cdata_need_escape(<<$<, Rest/binary>>, CurrentPosition, - _XMLEscape, CDataEndTokens) -> - cdata_need_escape(Rest, CurrentPosition + 1, true, - CDataEndTokens); -cdata_need_escape(<<$&, Rest/binary>>, CurrentPosition, - _XMLEscape, CDataEndTokens) -> - cdata_need_escape(Rest, CurrentPosition + 1, true, - CDataEndTokens); -cdata_need_escape(<<_:8, Rest/binary>>, CurrentPosition, - XMLEscape, CDataEndTokens) -> - cdata_need_escape(Rest, CurrentPosition + 1, XMLEscape, - CDataEndTokens). - -escape_cdata(CData, EndTokens) -> - escape_cdata(CData, 0, EndTokens, []). - -escape_cdata(<<>>, _CurrentPosition, [], Acc) -> - lists:reverse(Acc); -escape_cdata(Rest, CurrentPosition, [], Acc) -> - CDATA1 = <<">, - CDATA2 = <<"]]>">>, - escape_cdata(<<>>, CurrentPosition, [], - [CDATA2, Rest, CDATA1 | Acc]); -escape_cdata(CData, Index, [Pos | Positions], Acc) -> - CDATA1 = <<">, - CDATA2 = <<"]]>">>, - Split = Pos - Index, - {Part, Rest} = split_binary(CData, Split + 1), - escape_cdata(Rest, Pos + 1, Positions, - [CDATA2, Part, CDATA1 | Acc]). - -%% --spec(remove_cdata_p/1 :: -( - El :: xmlel() | cdata()) - -> boolean() -). - -remove_cdata_p(#xmlel{}) -> true; -remove_cdata_p(_) -> false. - -%% --spec(remove_cdata/1 :: -( - L :: [xmlel() | cdata()]) - -> [xmlel()] -). - -remove_cdata(L) -> [E || E <- L, remove_cdata_p(E)]. - --spec(remove_subtags/3 :: -( - Xmlel :: xmlel(), - Name :: binary(), - Attr :: attr()) - -> Xmlel :: xmlel() -). - -remove_subtags(#xmlel{name = TagName, attrs = TagAttrs, children = Els}, - Name, Attr) -> - #xmlel{name = TagName, attrs = TagAttrs, - children = remove_subtags1(Els, [], Name, Attr)}. - -%% --spec(remove_subtags1/4 :: -( - Els :: [xmlel() | cdata()], - NewEls :: [xmlel()], - Name :: binary(), - Attr :: attr()) - -> NewEls :: [xmlel()] -). - -remove_subtags1([], NewEls, _Name, _Attr) -> - lists:reverse(NewEls); -remove_subtags1([El | Els], NewEls, Name, - {AttrName, AttrValue} = Attr) -> - case El of - #xmlel{name = Name, attrs = Attrs} -> - case get_attr(AttrName, Attrs) of - false -> - remove_subtags1(Els, [El | NewEls], Name, Attr); - {value, AttrValue} -> - remove_subtags1(Els, NewEls, Name, Attr); - _ -> remove_subtags1(Els, [El | NewEls], Name, Attr) - end; - _ -> remove_subtags1(Els, [El | NewEls], Name, Attr) - end. - --spec(get_cdata/1 :: -( - L :: [xmlel() | cdata()]) - -> binary() -). - -get_cdata(L) -> - (iolist_to_binary(get_cdata(L, <<"">>))). - --spec(get_cdata/2 :: -( - L :: [xmlel() | cdata()], - S :: binary() | iolist()) - -> binary() | iolist() -). - -get_cdata([{xmlcdata, CData} | L], S) -> - get_cdata(L, [S, CData]); -get_cdata([_ | L], S) -> get_cdata(L, S); -get_cdata([], S) -> S. - --spec(get_tag_cdata/1 :: -( - Xmlel :: xmlel()) - -> binary() -). - -get_tag_cdata(#xmlel{children = Els}) -> get_cdata(Els). - -%% --spec(get_attr/2 :: -( - AttrName :: binary(), - Attrs :: [attr()]) - -> {value, binary()} - | false -). - -get_attr(AttrName, Attrs) -> - case lists:keysearch(AttrName, 1, Attrs) of - {value, {_, Val}} -> {value, Val}; - _ -> false - end. - -%% --spec(get_attr_s/2 :: -( - AttrName :: binary(), - Attrs :: [attr()]) - -> Val :: binary() -). - -get_attr_s(AttrName, Attrs) -> - case lists:keysearch(AttrName, 1, Attrs) of - {value, {_, Val}} -> Val; - _ -> <<"">> - end. - -%% --spec(get_tag_attr/2 :: -( - AttrName :: binary(), - Xmlel :: xmlel()) - -> {value, binary()} - | false -). - -get_tag_attr(AttrName, #xmlel{attrs = Attrs}) -> - get_attr(AttrName, Attrs). - -%% --spec(get_tag_attr_s/2 :: -( - AttrName :: binary(), - Xmlel :: xmlel()) - -> binary() -). - -get_tag_attr_s(AttrName, #xmlel{attrs = Attrs}) -> - get_attr_s(AttrName, Attrs). - -%% --spec(get_subtag/2 :: -( - Xmlel :: xmlel(), - Name :: binary()) - -> xmlel() | false -). - -get_subtag(#xmlel{children = Els}, Name) -> - get_subtag1(Els, Name). - -%% --spec(get_subtag1/2 :: -( - Els :: [xmlel() | cdata()], - Name :: binary()) - -> xmlel() | false -). - -get_subtag1([El | Els], Name) -> - case El of - #xmlel{name = Name} -> El; - _ -> get_subtag1(Els, Name) - end; -get_subtag1([], _) -> false. - -%% --spec(get_subtag_cdata/2 :: -( - Tag :: xmlel(), - Name :: binary()) - -> binary() -). - -get_subtag_cdata(Tag, Name) -> - case get_subtag(Tag, Name) of - false -> <<"">>; - Subtag -> get_tag_cdata(Subtag) - end. - -%% --spec(append_subtags/2 :: -( - Xmlel :: xmlel(), - SubTags2 :: [xmlel() | cdata()]) - -> Xmlel :: xmlel() -). - -append_subtags(#xmlel{name = Name, attrs = Attrs, children = SubTags1}, SubTags2) -> - #xmlel{name = Name, attrs = Attrs, children = SubTags1 ++ SubTags2}. - -%% --spec(get_path_s/2 :: -( - El :: xmlel(), - Path :: [{elem, Name::binary()} - |{attr, Name::binary()} - |cdata]) - -> xmlel() - | binary() -). - -get_path_s(El, []) -> El; -get_path_s(El, [{elem, Name} | Path]) -> - case get_subtag(El, Name) of - false -> <<"">>; - SubEl -> get_path_s(SubEl, Path) - end; -get_path_s(El, [{attr, Name}]) -> - get_tag_attr_s(Name, El); -get_path_s(El, [cdata]) -> get_tag_cdata(El). - -%% --spec(replace_tag_attr/3 :: -( - Name :: binary(), - Value :: binary(), - Xmlel :: xmlel()) - -> Xmlel :: #xmlel{ - name :: binary(), - attrs :: [attr(),...], - children :: [xmlel() | cdata()] - } -). - -replace_tag_attr(Name, Value, Xmlel) -> - Xmlel#xmlel{ - attrs = [{Name, Value} | lists:keydelete(Name, 1, Xmlel#xmlel.attrs)] - }. - --spec to_xmlel(xmlelement() | xmlel()) -> xmlel(). - -to_xmlel({_, Name, Attrs, Els}) -> - #xmlel{name = iolist_to_binary(Name), - attrs = [{iolist_to_binary(K), iolist_to_binary(V)} - || {K, V} <- Attrs], - children = [to_xmlel(El) || El <- Els]}; -to_xmlel({xmlcdata, CData}) -> - {xmlcdata, iolist_to_binary(CData)}. diff --git a/src/xml_stream.erl b/src/xml_stream.erl deleted file mode 100644 index a743bae86..000000000 --- a/src/xml_stream.erl +++ /dev/null @@ -1,246 +0,0 @@ -%%%---------------------------------------------------------------------- -%%% File : xml_stream.erl -%%% Author : Alexey Shchepin -%%% Purpose : Parse XML streams -%%% Created : 17 Nov 2002 by Alexey Shchepin -%%% -%%% -%%% ejabberd, Copyright (C) 2002-2013 ProcessOne -%%% -%%% 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 -%%% -%%%---------------------------------------------------------------------- - --module(xml_stream). - --author('alexey@process-one.net'). - --export([new/1, new/2, parse/2, close/1, - change_callback_pid/2, parse_element/1]). - --define(XML_START, 0). - --define(XML_END, 1). - --define(XML_CDATA, 2). - --define(XML_ERROR, 3). - --define(PARSE_COMMAND, 0). - --define(PARSE_FINAL_COMMAND, 1). - --record(xml_stream_state, - {callback_pid = self() :: pid(), - port :: port(), - stack = [] :: stack(), - size = 0 :: non_neg_integer(), - maxsize = infinity :: non_neg_integer() | infinity}). - --type xml_stream_el() :: {xmlstreamraw, binary()} | - {xmlstreamcdata, binary()} | - {xmlstreamelement, xmlel()} | - {xmlstreamend, binary()} | - {xmlstreamstart, binary(), [attr()]} | - {xmlstreamerror, binary()}. - --type xml_stream_state() :: #xml_stream_state{}. --type stack() :: [xmlel()]. --type event() :: {?XML_START, {binary(), [attr()]}} | - {?XML_END, binary()} | - {?XML_CDATA, binary()} | - {?XML_ERROR, binary()}. - --export_type([xml_stream_state/0, xml_stream_el/0]). - --include("jlib.hrl"). - -process_data(CallbackPid, Stack, Data) -> - case Data of - {?XML_START, {Name, Attrs}} -> - if - Stack == [] -> - catch gen_fsm:send_event(CallbackPid, - {xmlstreamstart, Name, Attrs}), - %% There is no need to store name or attributes of - %% stream opening element as it is not used - %% anymore. - [xmlstreamstart]; - true -> - [#xmlel{name = Name, attrs = Attrs, children = []} - | Stack] - end; - {?XML_END, EndName} -> - case Stack of - [xmlstreamstart] -> - catch gen_fsm:send_event(CallbackPid, - {xmlstreamend, EndName}), - []; - [#xmlel{name = Name, attrs = Attrs, children = Els}, - xmlstreamstart] -> - NewEl = #xmlel{name = Name, attrs = Attrs, - children = lists:reverse(Els)}, - catch gen_fsm:send_event(CallbackPid, - {xmlstreamelement, NewEl}), - [xmlstreamstart]; - [#xmlel{name = Name, attrs = Attrs, children = Els}, - #xmlel{name = Name1, attrs = Attrs1, children = Els1} - | Tail] -> - NewEl = #xmlel{name = Name, attrs = Attrs, - children = lists:reverse(Els)}, - [{xmlel, Name1, Attrs1, [NewEl | Els1]} | Tail] - end; - {?XML_CDATA, CData} -> - case Stack of - [xmlstreamstart] -> - catch gen_fsm:send_all_state_event(CallbackPid, - {xmlstreamcdata, CData}), - [xmlstreamstart]; - %% Merge CDATA nodes if they are contiguous - %% This does not change the semantic: the split in - %% several CDATA nodes depends on the TCP/IP packet - %% fragmentation - [#xmlel{name = Name, attrs = Attrs, - children = [{xmlcdata, PreviousCData} | Els]} - | Tail] -> - [#xmlel{name = Name, attrs = Attrs, - children = - [{xmlcdata, - iolist_to_binary([PreviousCData, CData])} - | Els]} - | Tail]; - %% No previous CDATA - [#xmlel{name = Name, attrs = Attrs, children = Els} - | Tail] -> - [#xmlel{name = Name, attrs = Attrs, - children = [{xmlcdata, CData} | Els]} - | Tail]; - [] -> [] - end; - {?XML_ERROR, Err} -> - catch gen_fsm:send_event(CallbackPid, - {xmlstreamerror, Err}) - end. - --spec new(pid()) -> xml_stream_state(). - -new(CallbackPid) -> new(CallbackPid, infinity). - --spec new(pid(), non_neg_integer() | infinity) -> xml_stream_state(). - -new(CallbackPid, MaxSize) -> - Port = open_port({spawn, "expat_erl"}, [binary]), - #xml_stream_state{callback_pid = CallbackPid, - port = Port, stack = [], size = 0, maxsize = MaxSize}. - --spec change_callback_pid(xml_stream_state(), pid()) -> xml_stream_state(). - -change_callback_pid(State, CallbackPid) -> - State#xml_stream_state{callback_pid = CallbackPid}. - --spec parse(xml_stream_state(), iodata()) -> xml_stream_state(). - -parse(#xml_stream_state{callback_pid = CallbackPid, - port = Port, stack = Stack, size = Size, - maxsize = MaxSize} = - State, - Str) -> - StrSize = byte_size(Str), - Res = port_control(Port, ?PARSE_COMMAND, Str), - {NewStack, NewSize} = lists:foldl(fun (Data, - {St, Sz}) -> - NewSt = process_data(CallbackPid, - St, Data), - case NewSt of - [_] -> {NewSt, 0}; - _ -> {NewSt, Sz} - end - end, - {Stack, Size + StrSize}, - binary_to_term(Res)), - if NewSize > MaxSize -> - catch gen_fsm:send_event(CallbackPid, - {xmlstreamerror, - <<"XML stanza is too big">>}); - true -> ok - end, - State#xml_stream_state{stack = NewStack, - size = NewSize}. - --spec close(xml_stream_state()) -> true. - -close(#xml_stream_state{port = Port}) -> - port_close(Port). - --spec parse_element(iodata()) -> xmlel() | - {error, parse_error} | - {error, binary()}. - -parse_element(Str) -> - Port = open_port({spawn, "expat_erl"}, [binary]), - Res = port_control(Port, ?PARSE_FINAL_COMMAND, Str), - port_close(Port), - process_element_events(binary_to_term(Res)). - -process_element_events(Events) -> - process_element_events(Events, []). - --spec process_element_events([event()], stack()) -> xmlel() | - {error, parse_error} | - {error, binary()}. - -process_element_events([], _Stack) -> - {error, parse_error}; -process_element_events([Event | Events], Stack) -> - case Event of - {?XML_START, {Name, Attrs}} -> - process_element_events(Events, - [#xmlel{name = Name, attrs = Attrs, - children = []} - | Stack]); - {?XML_END, _EndName} -> - case Stack of - [#xmlel{name = Name, attrs = Attrs, children = Els} - | Tail] -> - NewEl = #xmlel{name = Name, attrs = Attrs, - children = lists:reverse(Els)}, - case Tail of - [] -> - if Events == [] -> NewEl; - true -> {error, parse_error} - end; - [#xmlel{name = Name1, attrs = Attrs1, children = Els1} - | Tail1] -> - process_element_events(Events, - [#xmlel{name = Name1, - attrs = Attrs1, - children = [NewEl | Els1]} - | Tail1]) - end - end; - {?XML_CDATA, CData} -> - case Stack of - [#xmlel{name = Name, attrs = Attrs, children = Els} - | Tail] -> - process_element_events(Events, - [#xmlel{name = Name, attrs = Attrs, - children = - [{xmlcdata, CData} | Els]} - | Tail]); - [] -> process_element_events(Events, []) - end; - {?XML_ERROR, Err} -> {error, Err} - end. diff --git a/src/xmlrpc.app b/src/xmlrpc.app deleted file mode 100644 index 2a3642ca9..000000000 --- a/src/xmlrpc.app +++ /dev/null @@ -1,9 +0,0 @@ -{application,xmlrpc, - [{description,[]}, - {vsn,"80389e7"}, - {registered,[]}, - {applications,[]}, - {env,[]}, - {modules,[beam_util,example_serv,tcp_serv,url_util,xmlrpc, - xmlrpc_decode,xmlrpc_encode,xmlrpc_http, - xmlrpc_util]}]}. diff --git a/src/xmlrpc.app.src b/src/xmlrpc.app.src deleted file mode 100644 index 9af3e4117..000000000 --- a/src/xmlrpc.app.src +++ /dev/null @@ -1,8 +0,0 @@ -{application, xmlrpc, - [ - {description, ""}, - {vsn, git}, - {registered, []}, - {applications, []}, - {env, []} - ]}. diff --git a/src/xmlrpc.erl b/src/xmlrpc.erl deleted file mode 100644 index 8bc35736c..000000000 --- a/src/xmlrpc.erl +++ /dev/null @@ -1,272 +0,0 @@ -%% Hacked by Romuald du Song -%% -%% Copyright (C) 2003 Joakim Grebenö . -%% All rights reserved. -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions -%% are met: -%% -%% 1. Redistributions of source code must retain the above copyright -%% notice, this list of conditions and the following disclaimer. -%% 2. 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. -%% -%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. - --module(xmlrpc). --author('jocke@gleipnir.com'). --export([call/3, call/4, call/5, call/6, call/7, call/8, call2/7]). --export([start_link/1, start_link/5, start_link/6, stop/1]). - --include("log.hrl"). - --include("xmlrpc.hrl"). - -%% Exported: call/{3,4,5,6,7,8} - -call(Socket, URI, Payload) -> - call2(Socket, URI, Payload, false, 60000, "", [{ssl, false}, {header, false}]). - -call(Host, Port, URI, Payload, Options) when is_number(Port) -> - call(Host, Port, URI, Payload, false, 60000, "", Options); - -call(Socket, URI, Payload, KeepAlive, Timeout) -> - call2(Socket, URI, Payload, KeepAlive, Timeout, "", [{ssl, false}, {header, false}]). - -call(Host, Port, URI, Payload) when is_number(Port) -> - call(Host, Port, URI, Payload, false, 60000, "", [{ssl, false}, {header, false}]); - -call(Socket, URI, Payload, Options) -> - call2(Socket, URI, Payload, false, 60000, "", Options). - -call(Host, Port, URI, Payload, KeepAlive, Timeout) when is_number(Port) -> - call(Host, Port, URI, Payload, KeepAlive, Timeout, "", [{ssl, false}, {header, false}]); - -call(Socket, URI, Payload, KeepAlive, Timeout, Options) -> - call2(Socket, URI, Payload, KeepAlive, Timeout, "", Options). - -call(Host, Port, URI, Payload, KeepAlive, Timeout, Options) when is_number(Port) -> - call(Host, Port, URI, Payload, KeepAlive, Timeout, "", Options); - -call(Socket, URI, Payload, KeepAlive, Timeout, ExtraHeader, Options) -> - call2(Socket, URI, Payload, KeepAlive, Timeout, ExtraHeader, Options). - -call(Host, Port, URI, Payload, KeepAlive, Timeout, ExtraHeaders, Options) when is_number(Port) -> - case open_socket(Host, Port, Options) of - {ok, Socket} -> call2(Socket, URI, Payload, KeepAlive, Timeout, ExtraHeaders, Options); - {error, Reason} when KeepAlive == false -> {error, Reason}; - {error, Reason} -> {error, undefined, Reason} - end. - - -open_socket(Host, Port, Options) -> - case fetch_comm_module(Options) of - ssl -> - %% Start ssl application - application:start(ssl), - %% new ssl implementation does not seem to work as of R13B01 - %%{ok, SslSocket} = ssl:connect(Host, Port, [{ssl_imp, new}, {active, false}, {verify, verify_none}]), - ssl:connect(Host, Port, [{verify, 0}, {active, false}]); - _ -> - gen_tcp:connect(Host, Port, [{active, false}]) - end. - - -call2(Socket, URI, Payload, KeepAlive, Timeout, ExtraHeader, Options) -> - ?DEBUG_LOG({decoded_call, Payload}), - case xmlrpc_encode:payload(Payload) of - {ok, EncodedPayload} -> - ?DEBUG_LOG({encoded_call, EncodedPayload}), - case send(Socket, URI, KeepAlive, EncodedPayload, ExtraHeader, Options) of - ok -> - case parse_response(Socket, Timeout, Options) of - {ok, Header} -> - handle_payload(Socket, KeepAlive, Timeout, Options, Header); - {error, Reason} when KeepAlive == false -> - comm_close(Options, Socket), - {error, Reason}; - {error, Reason} -> {error, Socket, Reason} - end; - {error, Reason} when KeepAlive == false -> - comm_close(Options, Socket), - {error, Reason}; - {error, Reason} -> {error, Socket, Reason} - end; - {error, Reason} when KeepAlive == false -> - comm_close(Options, Socket), - {error, Reason}; - {error, Reason} -> {error, Socket, Reason} - end. - -send(Socket, URI, false, Payload, ExtraHeader, SslOption) -> - send(Socket, URI, lists:flatten(["Connection: close\r\n" | ExtraHeader]), Payload, SslOption); -send(Socket, URI, true, Payload, ExtraHeader, SslOption) -> - send(Socket, URI, ExtraHeader, Payload, SslOption). - -send(Socket, URI, Header, Payload, SslOption) -> - Request = - ["POST ", URI, " HTTP/1.1\r\n", - "Content-Length: ", integer_to_list(lists:flatlength(Payload)), - "\r\n", - "User-Agent: Erlang XML-RPC Client 1.13\r\n", - "Content-Type: text/xml\r\n", - Header, "\r\n", - Payload], - M = fetch_comm_module(SslOption), - apply(M, send, [Socket, Request]). - -parse_response(Socket, Timeout, SslOption) -> - M = fetch_comm_module(SslOption), - S = fetch_sets_module(SslOption), - apply(S, setopts, [Socket, [{packet, line}]]), - case apply(M, recv, [Socket, 0, Timeout]) of - {ok, "HTTP/1.1 200 OK\r\n"} -> parse_header(Socket, Timeout, SslOption); - {ok, StatusLine} -> {error, StatusLine}; - {error, Reason} -> {error, Reason} - end. - -fetch_comm_module(Options) -> - case lists:keysearch(ssl, 1, Options) of - {value, {ssl, true}} -> ssl; - _ -> gen_tcp - end. - -has_header_option(Options) -> - case lists:keysearch(header, 1, Options) of - {value, {_, true}} -> true; - _ -> false - end. - -fetch_sets_module(Options) -> - case lists:keysearch(ssl, 1, Options) of - {value, {ssl, true}} -> ssl; - _ -> inet - end. - -comm_close(Options, Socket) -> - M = fetch_comm_module(Options), - apply(M, close, [ Socket ]). - -parse_header(Socket, Timeout, SslOption) -> parse_header(Socket, Timeout, SslOption, #header{}). - -parse_header(Socket, Timeout, SslOption, Header) -> - M = fetch_comm_module(SslOption), - case apply(M, recv, [Socket, 0, Timeout]) of - {ok, "\r\n"} when Header#header.content_length == undefined -> - {error, missing_content_length}; - {ok, "\r\n"} -> {ok, Header}; - {ok, HeaderField} -> - case string:tokens(HeaderField, " \r\n") of - ["Content-Length:", ContentLength] -> - case catch list_to_integer(ContentLength) of - badarg -> - {error, {invalid_content_length, ContentLength}}; - Value -> - parse_header(Socket, Timeout, SslOption, - Header#header{content_length = - Value}) - end; - ["Connection:", "close"] -> - parse_header(Socket, Timeout, SslOption, - Header#header{connection = close}); - ["Authorization:", Authorization] -> - parse_header(Socket, Timeout, SslOption, - Header#header{authorization = Authorization}); - ["Cookie:", Cookie] -> - Cookies = [ Cookie | Header#header.cookies ], - parse_header(Socket, Timeout, SslOption, - Header#header{cookies = Cookies}); - _ -> - parse_header(Socket, Timeout, SslOption, Header) - end; - {error, Reason} -> {error, Reason} - end. - -handle_payload(Socket, KeepAlive, Timeout, Options, Header) -> - case get_payload(Socket, Timeout, Options, Header#header.content_length) of - {ok, Payload} -> - ?DEBUG_LOG({encoded_response, Payload}), - case xmlrpc_decode:payload(Payload) of - {ok, {response, DecodedPayload}} when KeepAlive == false -> - ?DEBUG_LOG({decoded_response, DecodedPayload}), - comm_close(Options, Socket), - case has_header_option(Options) of - true -> - {ok, {response, DecodedPayload, Header}}; - _ -> - {ok, {response, DecodedPayload}} - end; - {ok, {response, DecodedPayload}} when KeepAlive == true, - Header#header.connection == close -> - ?DEBUG_LOG({decoded_response, DecodedPayload}), - comm_close(Options, Socket), - case has_header_option(Options) of - true -> - {ok, Socket, {response, DecodedPayload, Header}}; - _ -> - {ok, Socket, {response, DecodedPayload}} - end; - {ok, {response, DecodedPayload}} -> - ?DEBUG_LOG({decoded_response, DecodedPayload}), - case has_header_option(Options) of - true -> - {ok, Socket, {response, DecodedPayload, Header}}; - _ -> - {ok, Socket, {response, DecodedPayload}} - end; - {error, Reason} when KeepAlive == false -> - comm_close(Options, Socket), - {error, Reason}; - {error, Reason} when KeepAlive == true, - Header#header.connection == close -> - comm_close(Options, Socket), - {error, Socket, Reason}; - {error, Reason} -> - {error, Socket, Reason} - end; - {error, Reason} when KeepAlive == false -> - gen_tcp:close(Socket), - {error, Reason}; - {error, Reason} when KeepAlive == true, - Header#header.connection == close -> - comm_close(Options, Socket), - {error, Socket, Reason}; - {error, Reason} -> {error, Socket, Reason} - end. - -get_payload(Socket, Timeout, SslOption, ContentLength) -> - M = fetch_comm_module(SslOption), - apply(fetch_sets_module(SslOption), setopts, [Socket, [{packet, raw}]]), - apply(M, recv, [Socket, ContentLength, Timeout]). - -%% Exported: start_link/{1,5,6} - -start_link(Handler) -> start_link(4567, 1000, 60000, Handler, undefined). - -start_link(Port, MaxSessions, Timeout, Handler, State) -> - start_link(all, Port, MaxSessions, Timeout, Handler, State). - -start_link(IP, Port, MaxSessions, Timeout, Handler, State) -> - OptionList = [{active, false}, {reuseaddr, true}] ++ ip(IP), - SessionHandler = {xmlrpc_http, handler, [Timeout, Handler, State]}, - tcp_serv:start_link([Port, MaxSessions, OptionList, SessionHandler]). - -ip(all) -> []; -ip(IP) when is_tuple(IP) -> [{ip, IP}]. - -%% Exported: stop/1 - -stop(Pid) -> tcp_serv:stop(Pid). diff --git a/src/xmlrpc.hrl b/src/xmlrpc.hrl deleted file mode 100644 index 3c1f18eb9..000000000 --- a/src/xmlrpc.hrl +++ /dev/null @@ -1,41 +0,0 @@ -%% Copyright (C) 2003 Joakim Grebenö . -%% All rights reserved. -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions -%% are met: -%% -%% 1. Redistributions of source code must retain the above copyright -%% notice, this list of conditions and the following disclaimer. -%% 2. 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. -%% -%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. - --record(header, { - %% int() - content_length, - %% string() - content_type, - %% string() - user_agent, - %% close | undefined - connection, - %% string() - authorization, - %% list() - cookies = [] - }). - diff --git a/src/xmlrpc_decode.erl b/src/xmlrpc_decode.erl deleted file mode 100644 index 344d077aa..000000000 --- a/src/xmlrpc_decode.erl +++ /dev/null @@ -1,224 +0,0 @@ -%% Copyright (C) 2003 Joakim Grebenö . -%% All rights reserved. -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions -%% are met: -%% -%% 1. Redistributions of source code must retain the above copyright -%% notice, this list of conditions and the following disclaimer. -%% 2. 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. -%% -%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. - --module(xmlrpc_decode). --author('jocke@gleipnir.com'). --export([payload/1]). - --include_lib("xmerl/include/xmerl.hrl"). - -payload(Payload) -> - case catch xmerl_scan:string(Payload, [{encoding, latin1}]) of - {'EXIT', Reason} -> {error, Reason}; - {E, _} -> - case catch decode_element(E) of - {'EXIT', Reason} -> {error, Reason}; - Result -> Result - end - end. - -decode_element(#xmlElement{name = methodCall} = MethodCall) - when record(MethodCall, xmlElement) -> - {MethodName, Rest} = - match_element([methodName], MethodCall#xmlElement.content), - TextValue = get_text_value(MethodName#xmlElement.content), - case match_element(normal, [params], Rest) of - {error, {missing_element, _}} -> - {ok, {call, list_to_atom(TextValue), []}}; - {Params, _} -> - DecodedParams = decode_params(Params#xmlElement.content), - {ok, {call, list_to_atom(TextValue), DecodedParams}} - end; -decode_element(#xmlElement{name = methodResponse} = MethodResponse) - when record(MethodResponse, xmlElement) -> - case match_element([fault, params], MethodResponse#xmlElement.content) of - {Fault, _} when Fault#xmlElement.name == fault -> - {Value, _} = match_element([value], Fault#xmlElement.content), - case decode(Value#xmlElement.content) of - {struct, [{faultCode, Code}, - {faultString, String}]} when integer(Code) -> - case xmlrpc_util:is_string(String) of - yes -> {ok, {response, {fault, Code, String}}}; - no -> {error, {bad_string, String}} - end; - {struct, [{faultString, String}, - {faultCode, Code}]} when integer(Code) -> - %% This case has been found in java xmlrpc - case xmlrpc_util:is_string(String) of - yes -> {ok, {response, {fault, Code, String}}}; - no -> {error, {bad_string, String}} - end; - _ -> - {error, {bad_element, MethodResponse}} - end; - {Params, _} -> - case decode_params(Params#xmlElement.content) of - [DecodedParam] -> {ok, {response, [DecodedParam]}}; - DecodedParams -> {error, {to_many_params, DecodedParams}} - end - end; -decode_element(E) -> {error, {bad_element, E}}. - -match_element(NameList, Content) -> match_element(throw, NameList, Content). - -match_element(Type, NameList, []) -> - return(Type, {error, {missing_element, NameList}}); -match_element(Type, NameList, [E|Rest]) when record(E, xmlElement) -> - case lists:member(E#xmlElement.name, NameList) of - true -> {E, Rest}; - false -> return(Type, {error, {unexpected_element, E#xmlElement.name}}) - end; -match_element(Type, NameList, [T|Rest]) when record(T, xmlText) -> - case only_whitespace(T#xmlText.value) of - yes -> match_element(Type, NameList, Rest); - no -> - return(Type, {error, {unexpected_text, T#xmlText.value, NameList}}) - end. - -return(throw, Result) -> throw(Result); -return(normal, Result) -> Result. - -only_whitespace([]) -> yes; -only_whitespace([$ |Rest]) -> only_whitespace(Rest); -only_whitespace([$\n|Rest]) -> only_whitespace(Rest); -only_whitespace([$\t|Rest]) -> only_whitespace(Rest); -only_whitespace(_) -> no. - -get_text_value([]) -> []; -get_text_value([T|Rest]) when record(T, xmlText) -> - T#xmlText.value++get_text_value(Rest); -get_text_value(_) -> throw({error, missing_text}). - -decode_params([]) -> []; -decode_params(Content) -> - case match_element(normal, [param], Content) of - {error, {missing_element, _}} -> []; - {Param, Rest} -> - {Value, _} = match_element([value], Param#xmlElement.content), - [decode(Value#xmlElement.content)|decode_params(Rest)] - end. - -decode(Content) when list(Content) -> - case get_value(Content) of - {text_value, TextValue} -> TextValue; - E -> decode(E) - end; -decode(String) when record(String, xmlText) -> String#xmlText.value; -decode(Struct) when Struct#xmlElement.name == struct -> - {struct, decode_members(Struct#xmlElement.content)}; -decode(Array) when Array#xmlElement.name == array -> - {Data, _} = match_element([data], Array#xmlElement.content), - {array, decode_values(Data#xmlElement.content)}; -decode(Int) when Int#xmlElement.name == int; Int#xmlElement.name == i4 -> - TextValue = get_text_value(Int#xmlElement.content), - make_integer(TextValue); -decode(Boolean) when Boolean#xmlElement.name == boolean -> - case get_text_value(Boolean#xmlElement.content) of - "1" -> true; - "0" -> false; - TextValue -> throw({error, {invalid_boolean, TextValue}}) - end; -decode(String) when String#xmlElement.name == string -> - get_text_value(String#xmlElement.content); -decode(Double) when Double#xmlElement.name == double -> - TextValue = get_text_value(Double#xmlElement.content), - make_double(TextValue); -decode(Date) when Date#xmlElement.name == 'dateTime.iso8601' -> - TextValue = get_text_value(Date#xmlElement.content), -% {date, ensure_iso8601_date(TextValue)}; % FIXME - {date, TextValue}; -decode(Base64) when Base64#xmlElement.name == base64 -> - TextValue = get_text_value(Base64#xmlElement.content), -% {base64, ensure_base64(TextValue)}; % FIXME - {base64, TextValue}; -decode(Value) -> throw({error, {bad_value, Value}}). - -get_value(Content) -> - case any_element(Content) of - false -> {text_value, get_text_value(Content)}; - true -> get_element(Content) - end. - -any_element([]) -> false; -any_element([E|_]) when record(E, xmlElement) -> true; -any_element([_|Rest]) -> any_element(Rest). - -get_element([]) -> throw({error, missing_element}); -get_element([E|_]) when record(E, xmlElement) -> E; -get_element([T|Rest]) when record(T, xmlText) -> - case only_whitespace(T#xmlText.value) of - yes -> get_element(Rest); - no -> throw({error, {unexpected_text, T#xmlText.value}}) - end. - -decode_members(Content) -> - case match_element(normal, [member], Content) of - {error, {missing_element, _}} -> []; - {Member, Rest} -> - {Name, Rest2} = match_element([name], Member#xmlElement.content), - TextValue = get_text_value(Name#xmlElement.content), - {Value, _} = match_element([value], Rest2), - [{list_to_atom(TextValue), - decode(Value#xmlElement.content)}|decode_members(Rest)] - end. - -decode_values([]) -> []; -decode_values(Content) -> - case match_element(normal, [value], Content) of - {error, {missing_element, _}} -> []; - {Value, Rest} -> - [decode(Value#xmlElement.content)|decode_values(Rest)] - end. - -make_integer(Integer) -> - case catch list_to_integer(Integer) of - {'EXIT', _Reason} -> throw({error, {not_integer, Integer}}); - Value -> Value - end. - -make_double(Double) -> - case catch list_to_float(Double) of - {'EXIT', _} -> - case catch list_to_integer(Double) of - {'EXIT', _} -> - throw({error, {not_double, Double}}); - Value -> float(Value) - end; - Value -> Value - end. - -% FIXME -%ensure_iso8601_date(Date) -> -% case xmlrpc_util:is_iso8601_date(Date) of -% no -> throw({error, {not_iso8601_date, Date}}); -% yes -> Date -% end. -% -%ensure_base64(Base64) -> -% case xmlrpc_util:is_base64(Base64) of -% no -> throw({error, {not_base64, Base64}}); -% yes -> Base64 -% end. diff --git a/src/xmlrpc_encode.erl b/src/xmlrpc_encode.erl deleted file mode 100644 index f7d0ff19e..000000000 --- a/src/xmlrpc_encode.erl +++ /dev/null @@ -1,145 +0,0 @@ -%% Copyright (C) 2003 Joakim Grebenö . -%% All rights reserved. -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions -%% are met: -%% -%% 1. Redistributions of source code must retain the above copyright -%% notice, this list of conditions and the following disclaimer. -%% 2. 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. -%% -%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. - --module(xmlrpc_encode). --author('jocke@gleipnir.com'). --export([payload/1]). - -%% Exported: payload/1 - -payload({call, Name, Params}) when atom(Name), list(Params) -> - case encode_params(Params) of - {error, Reason} -> {error, Reason}; - EncodedParams -> - EncodedPayload = - ["", - atom_to_list(Name), "", EncodedParams, - ""], - {ok, EncodedPayload} - end; -payload({response, {fault, Code, String}}) when integer(Code) -> - case xmlrpc_util:is_string(String) of - yes -> - EncodedPayload = - ["" - "faultCode", - integer_to_list(Code), "" - "faultString", escape_string(String), - "", - ""], - {ok, EncodedPayload}; - no -> {error, {bad_string, String}} - end; -payload({response, []} = Payload) -> - {ok, [""]}; -payload({response, [Param]} = Payload) -> - case encode_params([Param]) of - {error, Reason} -> {error, Reason}; - EncodedParam -> - {ok, ["", EncodedParam, - ""]} - end; -payload(Payload) -> {error, {bad_payload, Payload}}. - -encode_params(Params) -> encode_params(Params, []). - -encode_params([], []) -> []; -encode_params([], Acc) -> ["", Acc, ""]; -encode_params([Param|Rest], Acc) -> - case encode(Param) of - {error, Reason} -> {error, Reason}; - EncodedParam -> - NewAcc = Acc++["", EncodedParam, ""], - encode_params(Rest, NewAcc) - end. - -encode({struct, Struct}) -> - case encode_members(Struct) of - {error, Reason} -> {error, Reason}; - Members -> ["", Members, ""] - end; -encode({array, Array}) when list(Array) -> - case encode_values(Array)of - {error, Reason} -> {error, Reason}; - Values -> ["", Values, ""] - end; -encode(Integer) when integer(Integer) -> - ["", integer_to_list(Integer), ""]; -encode(true) -> "1"; % duh! -encode(false) -> "0"; % duh! -encode(Double) when float(Double) -> - ["", io_lib:format("~p", [Double]), ""]; -encode({date, Date}) -> - case xmlrpc_util:is_iso8601_date(Date) of - yes -> ["", Date, ""]; - no -> {error, {bad_date, Date}} - end; -encode({base64, Base64}) -> - case xmlrpc_util:is_base64(Base64) of - yes -> ["", Base64, ""]; - no -> {error, {bad_base64, Base64}} - end; -encode(Value) -> - case xmlrpc_util:is_string(Value) of - yes -> ["", escape_string(Value), ""]; - no -> {error, {bad_value, Value}} - end. - -escape_string([]) -> []; -escape_string([$<|Rest]) -> ["<", escape_string(Rest)]; -escape_string([$>|Rest]) -> [">", escape_string(Rest)]; -escape_string([$&|Rest]) -> ["&", escape_string(Rest)]; -escape_string([C|Rest]) -> [C|escape_string(Rest)]. - -encode_members(Struct) -> encode_members(Struct, []). - -encode_members([], Acc) -> Acc; -encode_members([{Name, Value}|Rest], Acc) when atom(Name) -> - case encode(Value) of - {error, Reason} -> {error, Reason}; - EncodedValue -> - NewAcc = - Acc++["", atom_to_list(Name), "", - EncodedValue, ""], - encode_members(Rest, NewAcc) - end; -encode_members([{Name, Value}|Rest], Acc) -> {error, {invalid_name, Name}}; -encode_members(UnknownMember, Acc) -> - {error, {unknown_member, UnknownMember}}. - -encode_values(Array) -> encode_values(Array, []). - -encode_values([], Acc) -> Acc; -encode_values([Value|Rest], Acc) -> - case encode(Value) of - {error, Reason} -> {error, Reason}; - EncodedValue -> - NewAcc = Acc++["", EncodedValue, ""], - encode_values(Rest, NewAcc) - end; -encode_values([{Name, Value}|Rest], Acc) -> {error, {invalid_name, Name}}; -encode_values(UnknownMember, Acc) -> - {error, {unknown_member, UnknownMember}}. diff --git a/src/xmlrpc_http.erl b/src/xmlrpc_http.erl deleted file mode 100644 index 399e20824..000000000 --- a/src/xmlrpc_http.erl +++ /dev/null @@ -1,230 +0,0 @@ -%% Copyright (C) 2003 Joakim Grebenö . -%% All rights reserved. -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions -%% are met: -%% -%% 1. Redistributions of source code must retain the above copyright -%% notice, this list of conditions and the following disclaimer. -%% 2. 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. -%% -%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. - --module(xmlrpc_http). --author('jocke@gleipnir.com'). --export([handler/4]). - --include("log.hrl"). - --include("xmlrpc.hrl"). - -%% Exported: handler/4 - -handler(Socket, Timeout, Handler, State) -> - case parse_request(Socket, Timeout) of - {ok, Header} -> - ?DEBUG_LOG({header, Header}), - handle_payload(Socket, Timeout, Handler, State, Header); - {status, StatusCode} -> - send(Socket, StatusCode), - handler(Socket, Timeout, Handler, State); - {error, Reason} -> {error, Reason} - end. - -parse_request(Socket, Timeout) -> - inet:setopts(Socket, [list, {packet, line}]), - case gen_tcp:recv(Socket, 0, Timeout) of - {ok, RequestLine} -> - case string:tokens(RequestLine, " \r\n") of - ["POST", _, "HTTP/1.0"] -> - ?DEBUG_LOG({http_version, "1.0"}), - parse_header(Socket, Timeout, #header{connection = close}); - ["POST", _, "HTTP/1.1"] -> - ?DEBUG_LOG({http_version, "1.1"}), - parse_header(Socket, Timeout); - [_Method, _, "HTTP/1.1"] -> {status, 501}; - ["POST", _, _HTTPVersion] -> {status, 505}; - _ -> {status, 400} - end; - {error, Reason} -> {error, Reason} - end. - -parse_header(Socket, Timeout) -> parse_header(Socket, Timeout, #header{}). - -parse_header(Socket, Timeout, Header) -> - case gen_tcp:recv(Socket, 0, Timeout) of - {ok, "\r\n"} when Header#header.content_length == undefined -> - {status, 411}; - {ok, "\r\n"} when Header#header.content_type == undefined -> - {status, 400}; - {ok, "\r\n"} when Header#header.user_agent == undefined -> - {status, 400}; - {ok, "\r\n"} -> {ok, Header}; - {ok, HeaderField} -> - case split_header_field(HeaderField) of - {[$C,$o,$n,$t,$e,$n,$t,$-,_,$e,$n,$g,$t,$h,$:], - ContentLength} -> - case catch list_to_integer(ContentLength) of - N when is_integer(N) -> - parse_header(Socket, Timeout, - Header#header{content_length = N}); - _ -> {status, 400} - end; - {"Content-Type:", "text/xml"} -> - parse_header(Socket, Timeout, - Header#header{content_type = "text/xml"}); - {"Content-Type:", "text/xml; charset=utf-8"} -> - parse_header(Socket, Timeout, - Header#header{content_type = "text/xml; charset=utf-8"}); - {"Content-Type:", _ContentType} -> {status, 415}; - {"User-Agent:", UserAgent} -> - parse_header(Socket, Timeout, - Header#header{user_agent = UserAgent}); - {"Connection:", "close"} -> - parse_header(Socket, Timeout, - Header#header{connection = close}); - {"Connection:", [_,$e,$e,$p,$-,_,$l,$i,$v,$e]} -> - parse_header(Socket, Timeout, - Header#header{connection = undefined}); - {"Authorization:", Authorization} -> - parse_header(Socket, Timeout, - Header#header{authorization = Authorization}); - {"Cookie:", Cookie} -> - Cookies = [ Cookie | Header#header.cookies ], - parse_header(Socket, Timeout, - Header#header{cookies = Cookies}); - _ -> - ?DEBUG_LOG({skipped_header, HeaderField}), - parse_header(Socket, Timeout, Header) - end; - {error, Reason} -> {error, Reason} - end. - -split_header_field(HeaderField) -> split_header_field(HeaderField, []). - -split_header_field([], Name) -> {Name, ""}; -split_header_field([$ |Rest], Name) -> {lists:reverse(Name), Rest -- "\r\n"}; -split_header_field([C|Rest], Name) -> split_header_field(Rest, [C|Name]). - -handle_payload(Socket, Timeout, Handler, State, - #header{connection = Connection} = Header) -> - case get_payload(Socket, Timeout, Header#header.content_length) of - {ok, Payload} -> - ?DEBUG_LOG({encoded_call, Payload}), - case xmlrpc_decode:payload(Payload) of - {ok, DecodedPayload} -> - ?DEBUG_LOG({decoded_call, DecodedPayload}), - eval_payload(Socket, Timeout, Handler, State, Connection, - DecodedPayload, Header); - {error, Reason} when Connection == close -> - ?ERROR_LOG({xmlrpc_decode, payload, Payload, Reason}), - send(Socket, 400); - {error, Reason} -> - ?ERROR_LOG({xmlrpc_decode, payload, Payload, Reason}), - send(Socket, 400), - handler(Socket, Timeout, Handler, State) - end; - {error, Reason} -> {error, Reason} - end. - -get_payload(Socket, Timeout, ContentLength) -> - inet:setopts(Socket, [{packet, raw}]), - gen_tcp:recv(Socket, ContentLength, Timeout). - -%% Check whether module has defined new function -%% M:F(State, Payload, Header) -has_newcall(M, F) -> - erlang:function_exported(M, F, 3). - -%% Handle module call -do_call({M, F} = _Handler, State, Payload, Header) -> - case has_newcall(M, F) of - true -> - M:F(State, Payload, Header); - false -> - M:F(State, Payload) - end. - -eval_payload(Socket, Timeout, {M, F} = Handler, State, Connection, Payload, Header) -> - case catch do_call(Handler, State, Payload, Header) of - {'EXIT', Reason} when Connection == close -> - ?ERROR_LOG({M, F, {'EXIT', Reason}}), - send(Socket, 500, "Connection: close\r\n"); - {'EXIT', Reason} -> - ?ERROR_LOG({M, F, {'EXIT', Reason}}), - send(Socket, 500), - handler(Socket, Timeout, Handler, State); - {error, Reason} when Connection == close -> - ?ERROR_LOG({M, F, Reason}), - send(Socket, 500, "Connection: close\r\n"); - {error, Reason} -> - ?ERROR_LOG({M, F, Reason}), - send(Socket, 500), - handler(Socket, Timeout, Handler, State); - {false, ResponsePayload} -> - encode_send(Socket, 200, "Connection: close\r\n", ResponsePayload); - {false, ResponsePayload, ExtraHeaders} -> - encode_send(Socket, 200, [ExtraHeaders, "Connection: close\r\n"], ResponsePayload); - {true, _NewTimeout, _NewState, ResponsePayload} when - Connection == close -> - encode_send(Socket, 200, "Connection: close\r\n", ResponsePayload); - {true, NewTimeout, NewState, ResponsePayload} -> - encode_send(Socket, 200, "", ResponsePayload), - handler(Socket, NewTimeout, Handler, NewState); - {true, _NewTimeout, _NewState, ResponsePayload, ExtraHeaders} when - Connection == close -> - encode_send(Socket, 200, [ExtraHeaders, "Connection: close\r\n"], ResponsePayload); - {true, NewTimeout, NewState, ResponsePayload, ExtraHeaders} -> - encode_send(Socket, 200, ExtraHeaders, ResponsePayload), - handler(Socket, NewTimeout, Handler, NewState) - end. - -encode_send(Socket, StatusCode, ExtraHeader, Payload) -> - ?DEBUG_LOG({decoded_response, Payload}), - case xmlrpc_encode:payload(Payload) of - {ok, EncodedPayload} -> - ?DEBUG_LOG({encoded_response, lists:flatten(EncodedPayload)}), - send(Socket, StatusCode, ExtraHeader, EncodedPayload); - {error, Reason} -> - ?ERROR_LOG({xmlrpc_encode, payload, Payload, Reason}), - send(Socket, 500) - end. - -send(Socket, StatusCode) -> send(Socket, StatusCode, "", ""). - -send(Socket, StatusCode, ExtraHeader) -> - send(Socket, StatusCode, ExtraHeader, ""). - -send(Socket, StatusCode, ExtraHeader, Payload) -> - Response = - ["HTTP/1.1 ", integer_to_list(StatusCode), " ", - reason_phrase(StatusCode), "\r\n", - "Content-Length: ", integer_to_list(lists:flatlength(Payload)), - "\r\n", - "Server: Erlang/1.13\r\n", - "Content-Type: text/xml\r\n", - ExtraHeader, "\r\n", - Payload], - gen_tcp:send(Socket, Response). - -reason_phrase(200) -> "OK"; -reason_phrase(400) -> "Bad Request"; -reason_phrase(411) -> "Length required"; -reason_phrase(415) -> "Unsupported Media Type"; -reason_phrase(500) -> "Internal Server Error"; -reason_phrase(501) -> "Not Implemented"; -reason_phrase(505) -> "HTTP Version not supported". diff --git a/src/xmlrpc_util.erl b/src/xmlrpc_util.erl deleted file mode 100644 index d46c5c07b..000000000 --- a/src/xmlrpc_util.erl +++ /dev/null @@ -1,37 +0,0 @@ -%% Copyright (C) 2003 Joakim Grebenö . -%% All rights reserved. -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions -%% are met: -%% -%% 1. Redistributions of source code must retain the above copyright -%% notice, this list of conditions and the following disclaimer. -%% 2. 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. -%% -%% THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. - --module(xmlrpc_util). --author('jocke@gleipnir.com'). --export([is_string/1, is_iso8601_date/1, is_base64/1]). - -is_string([C|Rest]) when C >= 0, C =< 255 -> is_string(Rest); -is_string([]) -> yes; -is_string(_) -> no. - -is_iso8601_date(_) -> yes. % FIXME - -is_base64(_) -> yes. % FIXME diff --git a/src/web/xmpp_json.erl b/src/xmpp_json.erl similarity index 100% rename from src/web/xmpp_json.erl rename to src/xmpp_json.erl diff --git a/src/p1_prof.erl b/tools/p1_prof.erl similarity index 83% rename from src/p1_prof.erl rename to tools/p1_prof.erl index d4f4b8856..cec73d506 100644 --- a/src/p1_prof.erl +++ b/tools/p1_prof.erl @@ -34,56 +34,64 @@ reds/0, reds/1, trace/1, help/0, q/0, m/0, r/0, q/1, m/1, r/1]). --define(APPS, [ejabberd, mnesia]). +-define(TRACE_FILE, "/tmp/fprof.trace"). +-define(ANALYSIS_FILE, "/tmp/fprof.analysis"). %%==================================================================== %% API %%==================================================================== eprof_start() -> eprof:start(), - case lists:keyfind(running, 1, application:info()) of - {_, Apps} -> - case get_procs(?APPS, Apps) of - [] -> - {error, no_procs_found}; - Procs -> - eprof:start_profiling(Procs) - end; - _ -> - {error, no_app_info} + case get_procs() of + [] -> + {error, no_procs_found}; + Procs -> + eprof:start_profiling(Procs) end. fprof_start() -> fprof_start(0). fprof_start(Duration) -> - case lists:keyfind(running, 1, application:info()) of - {_, Apps} -> - case get_procs(?APPS, Apps) of - [] -> - {error, no_procs_found}; - Procs -> - fprof:trace([start, {procs, Procs}]), - io:format("Profiling started~n"), - if Duration > 0 -> - timer:sleep(Duration*1000), - fprof:trace([stop]), - fprof:stop(); - true-> - ok - end - end; - _ -> - {error, no_app_info} + case get_procs() of + [] -> + {error, no_procs_found}; + Procs -> + case fprof:trace([start, {procs, Procs}, {file, ?TRACE_FILE}]) of + ok -> + io:format("Profiling started, writing trace data to ~s~n", + [?TRACE_FILE]), + if Duration > 0 -> + timer:sleep(Duration*1000), + fprof:trace([stop]), + fprof:stop(); + true-> + ok + end; + Err -> + io:format("Couldn't start profiling: ~p~n", [Err]), + Err + end end. fprof_stop() -> fprof:trace([stop]), - fprof:profile(), - fprof:analyse([totals, no_details, {sort, own}, - no_callers, {dest, "fprof.analysis"}]), - fprof:stop(), - format_fprof_analyze(). + case fprof:profile([{file, ?TRACE_FILE}]) of + ok -> + case fprof:analyse([totals, no_details, {sort, own}, + no_callers, {dest, ?ANALYSIS_FILE}]) of + ok -> + fprof:stop(), + format_fprof_analyze(); + Err -> + io:format("Couldn't analyze: ~p~n", [Err]), + Err + end; + Err -> + io:format("Couldn't compile a trace into profile data: ~p~n", + [Err]), + Err + end. fprof_analyze() -> fprof_stop(). @@ -175,35 +183,11 @@ trace_loop() -> %%==================================================================== %% Internal functions %%==================================================================== -get_procs(Apps, AppList) -> - io:format("Searching for processes to profile...~n", []), - Procs = lists:flatmap( - fun({App, Leader}) when is_pid(Leader) -> - case lists:member(App, Apps) of - true -> - get_procs(Leader); - false -> - [] - end; - (_) -> - [] - end, AppList), - io:format("Found ~p processes~n", [length(Procs)]), - Procs. - -get_procs(Leader) -> - lists:filter( - fun(Pid) -> - case process_info(Pid, group_leader) of - {_, Leader} -> - true; - _ -> - false - end - end, processes()). +get_procs() -> + processes(). format_fprof_analyze() -> - case file:consult("fprof.analysis") of + case file:consult(?ANALYSIS_FILE) of {ok, [_, [{totals, _, _, TotalOWN}] | Rest]} -> OWNs = lists:flatmap( fun({MFA, _, _, OWN}) -> diff --git a/vars.config.in b/vars.config.in new file mode 100644 index 000000000..f40837076 --- /dev/null +++ b/vars.config.in @@ -0,0 +1,52 @@ +%%%------------------------------------------------------------------- +%%% @author Evgeniy Khramtsov +%%% @copyright (C) 2013, Evgeniy Khramtsov +%%% @doc +%%% +%%% @end +%%% Created : 8 May 2013 by Evgeniy Khramtsov +%%%------------------------------------------------------------------- +%% Macros +{roster_gateway_workaround, @roster_gateway_workaround@}. +{flash_hack, @flash_hack@}. +{transient_supervisors, @transient_supervisors@}. +{full_xml, @full_xml@}. +{nif, @nif@}. +{db_type, @db_type@}. +{debug, @debug@}. +{hipe, @hipe@}. + +%% Ad-hoc directories with source files +{pubsub_ng, @pubsub_ng@}. +{tools, @tools@}. + +%% Dependencies +{mysql, @mysql@}. +{pgsql, @pgsql@}. +{pam, @pam@}. +{zlib, @zlib@}. +{stun, @stun@}. +{riak, @riak@}. +{json, @json@}. +{http, @http@}. +{iconv, @iconv@}. + +%% Version +{vsn, "@PACKAGE_VERSION@"}. + +%% Variables for overlay template files + +%% Platform-specific installation paths +{release, true}. +{release_dir, "${SCRIPT_DIR%/*}"}. +{sysconfdir, "{{release_dir}}/etc"}. +{installuser, "@INSTALLUSER@"}. +{erl, "{{release_dir}}/{{erts_vsn}}/bin/erl"}. +{localstatedir, "{{release_dir}}/var"}. +{libdir, "{{release_dir}}/lib"}. +{docdir, "{{release_dir}}/doc"}. + +%% Local Variables: +%% mode: erlang +%% End: +%% vim: set filetype=erlang tabstop=8: diff --git a/src/win32/CheckReqs.ini b/win32/CheckReqs.ini similarity index 100% rename from src/win32/CheckReqs.ini rename to win32/CheckReqs.ini diff --git a/src/win32/CheckReqs1.ini b/win32/CheckReqs1.ini similarity index 100% rename from src/win32/CheckReqs1.ini rename to win32/CheckReqs1.ini diff --git a/src/win32/CheckReqs1H.ini b/win32/CheckReqs1H.ini similarity index 100% rename from src/win32/CheckReqs1H.ini rename to win32/CheckReqs1H.ini diff --git a/src/win32/CheckService.ini b/win32/CheckService.ini similarity index 100% rename from src/win32/CheckService.ini rename to win32/CheckService.ini diff --git a/src/win32/CheckUser.ini b/win32/CheckUser.ini similarity index 100% rename from src/win32/CheckUser.ini rename to win32/CheckUser.ini diff --git a/src/win32/CheckUserH.ini b/win32/CheckUserH.ini similarity index 100% rename from src/win32/CheckUserH.ini rename to win32/CheckUserH.ini diff --git a/src/win32/ejabberd.cfg b/win32/ejabberd.cfg similarity index 100% rename from src/win32/ejabberd.cfg rename to win32/ejabberd.cfg diff --git a/src/win32/ejabberd.ico b/win32/ejabberd.ico similarity index 100% rename from src/win32/ejabberd.ico rename to win32/ejabberd.ico diff --git a/src/win32/ejabberd.nsi b/win32/ejabberd.nsi similarity index 100% rename from src/win32/ejabberd.nsi rename to win32/ejabberd.nsi diff --git a/src/win32/ejabberd_header.bmp b/win32/ejabberd_header.bmp similarity index 100% rename from src/win32/ejabberd_header.bmp rename to win32/ejabberd_header.bmp diff --git a/src/win32/ejabberd_intro.bmp b/win32/ejabberd_intro.bmp similarity index 100% rename from src/win32/ejabberd_intro.bmp rename to win32/ejabberd_intro.bmp diff --git a/src/win32/inetrc b/win32/inetrc similarity index 100% rename from src/win32/inetrc rename to win32/inetrc