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 index 0977e93a8..6f6716790 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -REBAR = @REBAR@ +REBAR = rebar INSTALL = @INSTALL@ SED = @SED@ ERL = @ERL@ @@ -94,16 +94,25 @@ edoc: 'case edoc:application(ejabberd, ".", []) of ok -> halt(0); error -> halt(1) end.' clean: - rebar clean + $(REBAR) clean distclean: clean rm -f config.status rm -f config.log rm -f rebar.config - rm -rf deps/* + rm -rf deps rm -f Makefile + rm -rf rel/files + rm -rf rel/ejabberd + rm -f rel/reltool.config + rm -f src/ejabberd.app.src [ ! -f ../ChangeLog ] || rm -f ../ChangeLog +rel: + mkdir -p rel ; cd rel ; rm -rf files ejabberd ; \ + $(REBAR) create-node nodeid=ejabberd || exit 1; \ + $(REBAR) generate + TAGS: etags *.erl @@ -112,4 +121,4 @@ Makefile: Makefile.in dialyzer: $(BEAMS) @dialyzer -c . -.PHONY: src doc edoc dialyzer Makefile TAGS clean distclean +.PHONY: src doc edoc dialyzer Makefile TAGS clean distclean rel diff --git a/c_src/expat_erl.c b/c_src/expat_erl.c deleted file mode 100644 index 94f5446b5..000000000 --- a/c_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/c_src/sha_drv.c b/c_src/sha_drv.c deleted file mode 100644 index 3558f790a..000000000 --- a/c_src/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/c_src/xml.c b/c_src/xml.c deleted file mode 100644 index 053694514..000000000 --- a/c_src/xml.c +++ /dev/null @@ -1,261 +0,0 @@ -#include -#include -#include - -#define SSL40 - -#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/configure b/configure index 245fadd68..52268fbb1 100755 --- a/configure +++ b/configure @@ -557,6 +557,7 @@ PACKAGE_STRING='ejabberd 3.0.0' PACKAGE_BUGREPORT='ejabberd@process-one.net' PACKAGE_URL='' +ac_default_prefix=/ # Factoring default headers for most tests. ac_includes_default="\ #include @@ -593,8 +594,8 @@ ac_includes_default="\ # include #endif" -ac_default_prefix=/ ac_subst_vars='LTLIBOBJS +LIBOBJS target_os target_vendor target_cpu @@ -608,9 +609,17 @@ build_vendor build_cpu build md2 +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC INSTALLUSER -SSL_CFLAGS -SSL_LIBS nif full_xml transient_supervisors @@ -618,21 +627,8 @@ db_type flash_hack roster_gateway_workaround hipe -PAM_LIBS -PAM_CFLAGS -make_pam -pam -ZLIB_LIBS -ZLIB_CFLAGS -LIBOBJS -EXPAT_LIBS -EXPAT_CFLAGS -EGREP -GREP -CPP -LIBICONV MAKE -REBAR +ESCRIPT ERLANG_LIB_DIR ERLANG_ROOT_DIR ERLCFLAGS @@ -643,13 +639,6 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM SET_MAKE -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC target_alias host_alias build_alias @@ -691,11 +680,6 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -with_libiconv_prefix -with_expat -with_zlib -enable_pam -with_pam enable_hipe enable_roster_gateway_workaround enable_flash_hack @@ -703,20 +687,19 @@ enable_mssql enable_transient_supervisors enable_full_xml enable_nif -with_openssl enable_user ' ac_precious_vars='build_alias host_alias target_alias +ERL +ERLC +ERLCFLAGS CC CFLAGS LDFLAGS LIBS CPPFLAGS -ERL -ERLC -ERLCFLAGS CPP' @@ -1334,7 +1317,6 @@ 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-pam enable pam (default: no) --enable-hipe compile natively with HiPE, not recommended (default: no) --enable-roster-gateway-workaround @@ -1354,17 +1336,10 @@ Optional Features: 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-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: + ERL Erlang/OTP interpreter command [autodetected] + ERLC Erlang/OTP compiler command [autodetected] + ERLCFLAGS Erlang/OTP compiler flags [none] CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a @@ -1372,9 +1347,6 @@ Some influential environment variables: 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 - ERL Erlang/OTP interpreter command [autodetected] - ERLC Erlang/OTP compiler command [autodetected] - ERLCFLAGS Erlang/OTP compiler flags [none] CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -1457,44 +1429,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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - # ac_fn_erl_try_run LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes @@ -1537,21 +1471,21 @@ fi } # ac_fn_erl_try_run -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () +# 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 conftest$ac_exeext - if { { ac_try="$ac_link" + 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_link") 2>conftest.err + (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -1562,10 +1496,7 @@ $as_echo "$ac_try_echo"; } >&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 : + } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 @@ -1573,15 +1504,10 @@ 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; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval -} # ac_fn_c_try_link +} # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- @@ -2137,6 +2063,763 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Checks for programs. +{ $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 "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$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 + +# 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 + 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 test "${ac_cv_path_ERL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_ERL="$ERL" # 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_ERL="$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 +ERL=$ac_cv_path_ERL +if test -n "$ERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ERL" >&5 +$as_echo "$ERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_ERL"; then + ac_pt_ERL=$ERL + # Extract the first word of "erl", so it can be a program name with args. +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 test "${ac_cv_path_ac_pt_ERL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_ERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_ERL="$ac_pt_ERL" # 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_ac_pt_ERL="$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_ERL=$ac_cv_path_ac_pt_ERL +if test -n "$ac_pt_ERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ERL" >&5 +$as_echo "$ac_pt_ERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_ERL" = x; then + ERL="not found" + 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 + ERL=$ac_pt_ERL + fi +else + ERL="$ac_cv_path_ERL" +fi +fi + +if test "$ERL" = "not found"; then + as_fn_error $? "Erlang/OTP interpreter (erl) not found but required" "$LINENO" 5 +fi + +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 +$as_echo "$ERLC" >&6; } +else + 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 test "${ac_cv_path_ERLC+set}" = set; then : + $as_echo_n "(cached) " >&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 +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_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 test "${ac_cv_path_ac_pt_ERLC+set}" = set; 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 +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_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="not found" + 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 + +fi + +if test "$ERLC" = "not found"; then + as_fn_error $? "Erlang/OTP compiler (erlc) not found but required" "$LINENO" 5 +fi + + +# Checks and sets ERLANG_ROOT_DIR and ERLANG_LIB_DIR variable + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP root directory" >&5 +$as_echo_n "checking for Erlang/OTP root directory... " >&6; } +if test "${ac_cv_erlang_root_dir+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() -> + RootDir = code:root_dir(), + file:write_file("conftest.out", RootDir), + ReturnValue = 0, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_root_dir=`cat conftest.out` + rm -f conftest.out +else + rm -f conftest.out + { { $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 ; } +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_root_dir" >&5 +$as_echo "$ac_cv_erlang_root_dir" >&6; } +ERLANG_ROOT_DIR=$ac_cv_erlang_root_dir + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP library base directory" >&5 +$as_echo_n "checking for Erlang/OTP library base directory... " >&6; } +if test "${ac_cv_erlang_lib_dir+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() -> + LibDir = code:lib_dir(), + file:write_file("conftest.out", LibDir), + ReturnValue = 0, + halt(ReturnValue) +. + +_ACEOF +if ac_fn_erl_try_run "$LINENO"; then : + ac_cv_erlang_lib_dir=`cat conftest.out` + rm -f conftest.out +else + rm -f conftest.out + { { $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 ; } +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" >&5 +$as_echo "$ac_cv_erlang_lib_dir" >&6; } +ERLANG_LIB_DIR=$ac_cv_erlang_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 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-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 rebar.config src/ejabberd.app.src rel/reltool.config" + + +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_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2927,815 +3610,7 @@ 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 "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$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 - -# 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 - 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 test "${ac_cv_path_ERL+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - case $ERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_ERL="$ERL" # 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_ERL="$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 -ERL=$ac_cv_path_ERL -if test -n "$ERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ERL" >&5 -$as_echo "$ERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_ERL"; then - ac_pt_ERL=$ERL - # Extract the first word of "erl", so it can be a program name with args. -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 test "${ac_cv_path_ac_pt_ERL+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_ERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_ERL="$ac_pt_ERL" # 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_ac_pt_ERL="$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_ERL=$ac_cv_path_ac_pt_ERL -if test -n "$ac_pt_ERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ERL" >&5 -$as_echo "$ac_pt_ERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_ERL" = x; then - ERL="not found" - 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 - ERL=$ac_pt_ERL - fi -else - ERL="$ac_cv_path_ERL" -fi -fi - -if test "$ERL" = "not found"; then - as_fn_error $? "Erlang/OTP interpreter (erl) not found but required" "$LINENO" 5 -fi - -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 -$as_echo "$ERLC" >&6; } -else - 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 test "${ac_cv_path_ERLC+set}" = set; then : - $as_echo_n "(cached) " >&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 -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_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 test "${ac_cv_path_ac_pt_ERLC+set}" = set; 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 -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_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="not found" - 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 - -fi - -if test "$ERLC" = "not found"; then - as_fn_error $? "Erlang/OTP compiler (erlc) not found but required" "$LINENO" 5 -fi - - -# Checks and sets ERLANG_ROOT_DIR and ERLANG_LIB_DIR variable - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP root directory" >&5 -$as_echo_n "checking for Erlang/OTP root directory... " >&6; } -if test "${ac_cv_erlang_root_dir+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() -> - RootDir = code:root_dir(), - file:write_file("conftest.out", RootDir), - ReturnValue = 0, - halt(ReturnValue) -. - -_ACEOF -if ac_fn_erl_try_run "$LINENO"; then : - ac_cv_erlang_root_dir=`cat conftest.out` - rm -f conftest.out -else - rm -f conftest.out - { { $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 ; } -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_root_dir" >&5 -$as_echo "$ac_cv_erlang_root_dir" >&6; } -ERLANG_ROOT_DIR=$ac_cv_erlang_root_dir - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Erlang/OTP library base directory" >&5 -$as_echo_n "checking for Erlang/OTP library base directory... " >&6; } -if test "${ac_cv_erlang_lib_dir+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() -> - LibDir = code:lib_dir(), - file:write_file("conftest.out", LibDir), - ReturnValue = 0, - halt(ReturnValue) -. - -_ACEOF -if ac_fn_erl_try_run "$LINENO"; then : - ac_cv_erlang_lib_dir=`cat conftest.out` - rm -f conftest.out -else - rm -f conftest.out - { { $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 ; } -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" >&5 -$as_echo "$ac_cv_erlang_lib_dir" >&6; } -ERLANG_LIB_DIR=$ac_cv_erlang_lib_dir - - - -#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 - - ;; -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$REBAR" = "x"; then - as_fn_error $? "'rebar' was not found" "$LINENO" 5 -fi - -if test "x$MAKE" = "x"; then - as_fn_error $? "'make' was not found" "$LINENO" 5 -fi - -#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 test "${am_cv_func_iconv+set}" = set; 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 -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 test "${am_cv_proto_iconv+set}" = set; 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' @@ -4133,791 +4008,6 @@ 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 test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; 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" = x""yes; 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" = x""yes; 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 test "${ac_cv_c_const+set}" = set; 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" = x""yes; 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 test "${ac_cv_func_malloc_0_nonnull+set}" = set; 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 test "${ac_cv_header_stdc+set}" = set; 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 - - -#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 test "${ac_cv_lib_z_gzgets+set}" = set; 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" = x""yes; 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" = x""yes; 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 test "${ac_cv_lib_pam_pam_start+set}" = set; 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" = x""yes; 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" = x""yes; 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 rebar.config" - - -#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 test "${ac_cv_lib_ssl_SSL_new+set}" = set; 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" = x""yes; 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" = x""yes; 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" = x""yes; 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" = x""yes; then : md2=true @@ -5797,6 +4887,8 @@ do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "rebar.config") CONFIG_FILES="$CONFIG_FILES rebar.config" ;; + "src/ejabberd.app.src") CONFIG_FILES="$CONFIG_FILES src/ejabberd.app.src" ;; + "rel/reltool.config") CONFIG_FILES="$CONFIG_FILES rel/reltool.config" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac diff --git a/configure.ac b/configure.ac index 5b6e1de05..be1004945 100644 --- a/configure.ac +++ b/configure.ac @@ -2,10 +2,10 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.53) -AC_INIT(ejabberd, m4_esyscmd([grep -o -E "\{vsn,.\".*\"\}" src/ejabberd.app.src | cut -d \" -f 2 | tr -d '\n']), [ejabberd@process-one.net], [ejabberd]) +AC_PACKAGE_VERSION(3.0.0) +AC_INIT(ejabberd, 3.0.0, [ejabberd@process-one.net], [ejabberd]) # Checks for programs. -AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL AC_PROG_SED @@ -22,44 +22,23 @@ AC_ERLANG_NEED_ERLC AC_ERLANG_SUBST_ROOT_DIR AC_ERLANG_SUBST_LIB_DIR -#locating rebar -AC_PATH_PROG([REBAR], [rebar], []) +#locating escript +AC_PATH_PROG([ESCRIPT], [escript], []) + #locating make AC_CHECK_PROG([MAKE], [make], [make], []) -if test "x$REBAR" = "x"; then - AC_MSG_ERROR(['rebar' was not found]) +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 -#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 - -#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 @@ -124,25 +103,9 @@ esac],[nif=false]) AC_SUBST(nif) AC_CONFIG_FILES([Makefile - rebar.config]) - -#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,,) + rebar.config + src/ejabberd.app.src + rel/reltool.config]) ENABLEUSER="" AC_ARG_ENABLE(user, diff --git a/include/ejabberd.hrl b/include/ejabberd.hrl index e36139a0c..4a2d25cd1 100644 --- a/include/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">>). diff --git a/include/jlib.hrl b/include/jlib.hrl index fe4dbbf02..271c32a8d 100644 --- a/include/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/rebar b/rebar new file mode 100755 index 000000000..cacba57df Binary files /dev/null and b/rebar differ diff --git a/rebar.config.in b/rebar.config.in index 7b64741ca..bf7cbfeb2 100644 --- a/rebar.config.in +++ b/rebar.config.in @@ -1,8 +1,13 @@ -{erl_opts, [debug_info, {i, "include"}, {i, "deps/logger/include"}]}. +{erl_opts, [debug_info, + {i, "include"}, + {i, "deps/logger/include"}, + {i, "deps/xml/include"}]}. %%{src_dirs, [asn1, src, mod_pubsub_ng]}. {src_dirs, [asn1, src]}. +{sub_dirs, ["rel"]}. + {deps, [{mysql, ".*", {git, "git://github.com/processone/mysql"}}, {pgsql, ".*", {git, "git://github.com/processone/pgsql"}}, {iconv, ".*", {git, "git://github.com/processone/eiconv"}}, @@ -11,14 +16,14 @@ {tls, ".*", {git, "git://github.com/processone/tls"}}, {ezlib, ".*", {git, "git://github.com/processone/zlib"}}, {stun, ".*", {git, "git://github.com/processone/stun"}}, + {stringprep, ".*", {git, "git://github.com/processone/stringprep"}}, + {riakc, ".*", {git, "git://github.com/basho/riak-erlang-client"}}, + {jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}, + {ibrowse, ".*", {git, "git://github.com/cmullaparthi/ibrowse"}}, + {lhttpc, ".*", {git, "git://github.com/esl/lhttpc"}}, + %%{xml, ".*", {git, "git://github.com/processone/xml"}}, {xmlrpc, ".*", {git, "git://github.com/etnt/xmlrpc"}}]}. -{port_env, [{"CFLAGS", "-g -O2 -Wall"}]}. - -{port_specs, [{"priv/lib/sha_drv.so", ["c_src/sha_drv.c"]}, - {"priv/lib/expat_erl.so", ["c_src/expat_erl.c"]}, - {"priv/lib/xml.so", ["c_src/xml.c"]}]}. - %% Local Variables: %% mode: erlang %% End: diff --git a/rel/reltool.config.in b/rel/reltool.config.in new file mode 100644 index 000000000..b058b92bd --- /dev/null +++ b/rel/reltool.config.in @@ -0,0 +1,47 @@ +{sys, [ + {lib_dirs, []}, + {erts, [{mod_cond, derived}, {app_file, strip}]}, + {app_file, strip}, + {rel, "@PACKAGE_NAME@", "@PACKAGE_VERSION@", + [ + kernel, + stdlib, + sasl, + ejabberd + ]}, + {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, sasl, [{incl_cond, include}]}, + {app, stdlib, [{incl_cond, include}]}, + {app, kernel, [{incl_cond, include}]}, + {app, ejabberd, [{incl_cond, include}, {lib_dir, ".."}]} + ]}. + +{target_dir, "ejabberd"}. + +{overlay, [ + {mkdir, "log/sasl"}, + {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"}, + {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"}, + {copy, "files/ejabberd", "bin/ejabberd"}, + {copy, "files/ejabberd.cmd", "bin/ejabberd.cmd"}, + {copy, "files/start_erl.cmd", "bin/start_erl.cmd"}, + {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"}, + {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"}, + {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"} + ]}. + +%%% Local Variables: +%%% mode: erlang +%%% End: +%%% vim: set filetype=erlang tabstop=8 foldmarker=%%%',%%%. foldmethod=marker: diff --git a/src/ejabberd.app.src b/src/ejabberd.app.src deleted file mode 100644 index 06077042c..000000000 --- a/src/ejabberd.app.src +++ /dev/null @@ -1,37 +0,0 @@ -%% $Id$ - -{application, ejabberd, - [{description, "ejabberd"}, - {vsn, "3.0.0"}, - {modules, []}, - {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..02b24e5a2 100644 --- a/src/ejabberd.erl +++ b/src/ejabberd.erl @@ -28,8 +28,9 @@ -author('alexey@process-one.net'). -export([start/0, stop/0, - get_pid_file/0, - get_so_path/0, get_bin_path/0]). + 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 diff --git a/src/ejabberd_admin.erl b/src/ejabberd_admin.erl index b95afd7d2..c58bbb3b6 100644 --- a/src/ejabberd_admin.erl +++ b/src/ejabberd_admin.erl @@ -110,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 = loglevel, function = get, args = [], result = {leveltuple, {tuple, [{levelnumber, integer}, {levelatom, atom}, diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl index 167a9874c..182d55322 100644 --- a/src/ejabberd_app.erl +++ b/src/ejabberd_app.erl @@ -34,20 +34,16 @@ -include("ejabberd.hrl"). -include("logger.hrl"). - %%% %%% Application API %%% start(normal, _Args) -> - ejabberd_loglevel:set(4), + loglevel: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(), @@ -109,19 +105,12 @@ init() -> %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). + loop(). - -loop(Port) -> +loop() -> receive _ -> - loop(Port) + loop() end. db_init() -> @@ -250,3 +239,11 @@ delete_pid_file() -> PidFilename -> file:delete(PidFilename) end. + +start_apps() -> + application:start(sasl), + application:start(ssl), + application:start(tls), + application:start(xml), + application:start(stringprep), + application:start(ezlib). diff --git a/src/ejabberd_auth_pam.erl b/src/ejabberd_auth_pam.erl index 092728136..af3bb17f2 100644 --- a/src/ejabberd_auth_pam.erl +++ b/src/ejabberd_auth_pam.erl @@ -40,7 +40,7 @@ plain_password_required/0]). start(_Host) -> - case epam:start() of + case application:start(epam) of {ok, _} -> ok; {error, {already_started, _}} -> ok; Err -> Err diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index 71f5fba0c..c973c19b2 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -453,7 +453,7 @@ process_term(Term, State) -> {ejabberdctl_access_commands, ACs} -> add_option(ejabberdctl_access_commands, ACs, State); {loglevel, Loglevel} -> - ejabberd_loglevel:set(Loglevel), + loglevel:set(Loglevel), State; {max_fsm_queue, N} -> add_option(max_fsm_queue, N, State); 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_receiver.erl b/src/ejabberd_receiver.erl index 2fc542b39..99fcecf68 100644 --- a/src/ejabberd_receiver.erl +++ b/src/ejabberd_receiver.erl @@ -44,8 +44,8 @@ -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, @@ -99,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}). @@ -171,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 @@ -180,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}; @@ -250,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_socket.erl b/src/ejabberd_socket.erl index 1fe17aaa4..096bc46a9 100644 --- a/src/ejabberd_socket.erl +++ b/src/ejabberd_socket.erl @@ -43,11 +43,11 @@ -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(). @@ -152,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) -> @@ -255,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/eldap.erl b/src/eldap.erl index d894b55e1..dbfdb3adc 100644 --- a/src/eldap.erl +++ b/src/eldap.erl @@ -430,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/http_p1.erl b/src/http_p1.erl index 38a8cb716..497375581 100644 --- a/src/http_p1.erl +++ b/src/http_p1.erl @@ -39,11 +39,10 @@ -ifdef(USE_IBROWSE). start() -> - ibrowse:start(), - ssl:start(). + application:start(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(). + application:start(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(). + application:start(inets). stop() -> - inets:stop(), - ssl:stop(). + application:start(inets). to_list(Str) when is_binary(Str) -> binary_to_list(Str); diff --git a/src/mod_applepush_service.erl b/src/mod_applepush_service.erl index 698f87c2b..437b6f552 100644 --- a/src/mod_applepush_service.erl +++ b/src/mod_applepush_service.erl @@ -66,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_ip_blacklist.erl b/src/mod_ip_blacklist.erl index 9477451c0..3e8e2d2e3 100644 --- a/src/mod_ip_blacklist.erl +++ b/src/mod_ip_blacklist.erl @@ -69,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.erl b/src/mod_irc.erl index dbaeff9d0..1773a3934 100644 --- a/src/mod_irc.erl +++ b/src/mod_irc.erl @@ -99,7 +99,7 @@ stop(Host) -> %%==================================================================== init([Host, Opts]) -> - iconv:start(), + application:start(iconv), MyHost = gen_mod:get_opt_host(Host, Opts, <<"irc.@HOST@">>), case gen_mod:db_type(Opts) of diff --git a/src/sha.erl b/src/sha.erl deleted file mode 100644 index ebe9cfce9..000000000 --- a/src/sha.erl +++ /dev/null @@ -1,114 +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"). --include("logger.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/xml.erl b/src/xml.erl deleted file mode 100644 index 598362fc1..000000000 --- a/src/xml.erl +++ /dev/null @@ -1,433 +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"). --include("logger.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.