Commit dc6eb3f7 authored by Ondrej Sury's avatar Ondrej Sury

New upstream version 1.2.3

parent b30fb07c
/*
+---------------------------------------------------------------------------+
| PHP Driver for MongoDB |
+---------------------------------------------------------------------------+
| Copyright 2013-2015 MongoDB, Inc. |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+---------------------------------------------------------------------------+
| Copyright (c) 2015 MongoDB, Inc. |
+---------------------------------------------------------------------------+
*/
/* Our Compatability header */
#include "phongo_compat.h"
void phongo_add_exception_prop(const char *prop, int prop_len, zval *value TSRMLS_DC)
{
if (EG(exception)) {
#if PHP_VERSION_ID >= 70000
zval ex;
EXCEPTION_P(EG(exception), ex);
zend_update_property(Z_OBJCE(ex), &ex, prop, prop_len, value);
#else
zval *ex = NULL;
EXCEPTION_P(EG(exception), ex);
zend_update_property(Z_OBJCE_P(ex), ex, prop, prop_len, value TSRMLS_CC);
#endif
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
......@@ -136,7 +136,6 @@ if test "$MONGODB" != "no"; then
MAINTAINER_CFLAGS="-Wextra $_MAINTAINER_CFLAGS -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-missing-field-initializers"
STD_CFLAGS="-g -O0 -Wall"
dnl EXTRA_LDFLAGS="-Wl,--no-undefined"
fi
......@@ -342,10 +341,16 @@ if test "$MONGODB" != "no"; then
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb), $MONGODB_MONGODB_EXCEPTIONS, [$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS], shared_objects_mongodb, yes)
fi
PHP_ARG_WITH(libbson, whether to use system libbson,
[ --with-libbson Use system libbson], no, no)
PHP_ARG_WITH(libbson, whether to use system libbson,
[ --with-libbson Use system libbson], no, no)
PHP_ARG_WITH(libmongoc, whether to use system libmongoc,
[ --with-libmongoc Use system libmongoc], no, no)
if test "$PHP_LIBBSON" != "no"; then
if test "$PHP_LIBMONGOC" == "no"; then
AC_MSG_ERROR(Cannot use system libbson and bundled libmongoc)
fi
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for libbson)
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libbson-1.0; then
......@@ -364,20 +369,20 @@ PHP_ARG_WITH(libbson, whether to use system libbson,
PHP_EVAL_LIBLINE($LIBBSON_LIB, MONGODB_SHARED_LIBADD)
AC_DEFINE(HAVE_SYSTEM_LIBBSON, 1, [Use system libbson])
else
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/yajl], $YAJL_SOURCES, [$STD_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/bson], $BSON_SOURCES, [$STD_CFLAGS], shared_objects_mongodb, yes)
LIBBSON_CFLAGS="-DBSON_COMPILATION"
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/yajl], $YAJL_SOURCES, [$STD_CFLAGS $LIBBSON_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/bson], $BSON_SOURCES, [$STD_CFLAGS $LIBBSON_CFLAGS], shared_objects_mongodb, yes)
fi
dnl libmongoc stuff {{{
AC_MSG_CHECKING(configuring libmongoc)
AC_MSG_RESULT(...)
PHP_ARG_WITH(libmongoc, whether to use system libmongoc,
[ --with-libmongoc Use system libmongoc], no, no)
AC_DEFINE(HAVE_MONGOC, 1, [Kinda useless extension without it..])
if test "$PHP_LIBMONGOC" != "no"; then
if test "$PHP_LIBBSON" == "no"; then
AC_MSG_ERROR(Cannot use system libmongoc and bundled libbson)
fi
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for libmongoc)
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongoc-1.0; then
......@@ -397,15 +402,15 @@ PHP_ARG_WITH(libmongoc, whether to use system libmongoc,
PHP_EVAL_LIBLINE($LIBMONGOC_LIB, MONGODB_SHARED_LIBADD)
AC_DEFINE(HAVE_SYSTEM_LIBMONGOC, 1, [Use system libmongoc])
else
CPPFLAGS="$CPPFLAGS -DBSON_COMPILATION -DMONGOC_COMPILATION -DMONGOC_TRACE"
LIBMONGOC_CFLAGS="-DMONGOC_COMPILATION -DMONGOC_TRACE"
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES, [$STD_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_CRYPTO, [$STD_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SSL, [$STD_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_OPENSSL, [$STD_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SECURE_TRANSPORT, [$STD_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SECURE_CHANNEL, [$STD_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SASL, [$STD_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_CRYPTO, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SSL, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_OPENSSL, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SECURE_TRANSPORT, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SECURE_CHANNEL, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SASL, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
PHP_SETUP_OPENSSL(MONGODB_SHARED_LIBADD)
......@@ -434,26 +439,6 @@ PHP_ARG_WITH(libmongoc, whether to use system libmongoc,
fi
PHP_ARG_WITH(pcre-dir, for pcre-dir install prefix,
[ --with-pcre-dir[=DIR] mongodb: pcre install prefix], auto, yes)
if test "$PHP_PCRE_DIR" != "no"; then
AC_MSG_CHECKING(for pcre)
for i in $PHP_PCRE_DIR /usr /usr/local; do
if test -f $i/include/pcre.h; then
MONGODB_PCRE_DIR=$i/include
AC_MSG_RESULT(found in $i)
break
fi
done
if test -z "$MONGODB_PCRE_DIR"; then
AC_MSG_RESULT(not found)
else
PHP_ADD_INCLUDE($MONGODB_PCRE_DIR)
fi
fi
PHP_ARG_WITH(mongodb-sasl, for Cyrus SASL support,
[ --with-mongodb-sasl[=DIR] mongodb: Include Cyrus SASL support], auto, no)
......@@ -510,9 +495,6 @@ fi
AC_CHECK_FUNCS([shm_open], [SHM_LIB=], [AC_CHECK_LIB([rt], [shm_open], [SHM_LIB=-lrt], [SHM_LIB=])])
MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD $SHM_LIB"
dnl PHP_ADD_LIBRARY_WITH_PATH(bson-1.0, src/libbson/.libs, MONGODB_SHARED_LIBADD)
dnl PHP_ADD_LIBRARY_WITH_PATH(mongoc-priv, src/libmongoc/.libs, MONGODB_SHARED_LIBADD)
EXTRA_CFLAGS="$PTHREAD_CFLAGS $SASL_CFLAGS"
PHP_SUBST(EXTRA_CFLAGS)
PHP_SUBST(EXTRA_LDFLAGS)
......@@ -520,8 +502,6 @@ fi
MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD $PTHREAD_LIBS $SASL_LIBS"
PHP_SUBST(MONGODB_SHARED_LIBADD)
dnl }}}
PHP_NEW_EXTENSION(mongodb, $MONGODB_ROOT, $ext_shared,, [$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS])
PHP_ADD_EXTENSION_DEP(mongodb, date)
PHP_ADD_EXTENSION_DEP(mongodb, json)
......@@ -554,9 +534,6 @@ dnl }}}
PHP_ADD_BUILD_DIR([$ext_builddir/src/libbson/src/bson/])
fi
dnl MONGODB_SHARED_DEPENDENCIES="mongodbdep"
dnl PHP_SUBST(MONGODB_SHARED_DEPENDENCIES)
PHP_BSON_BIGENDIAN
AC_HEADER_STDBOOL
......
......@@ -15,7 +15,7 @@ function mongodb_generate_header(inpath, outpath, replacements)
replacement = replacement.replace(/"/g, '\\"');
}
outdata = outdata.replace("@" + key + "@", replacement);
outdata = outdata.replace(new RegExp('@' + key + '@', 'g'), replacement);
}
var outfile = FSO.CreateTextFile(outpath, true);
......@@ -31,13 +31,14 @@ function mongodb_parse_version_file(inpath, prefix)
var xyz_pre = version.split("-");
var xyz = xyz_pre[0].split(".");
var pre = xyz_pre.length > 1 ? xyz_pre[1] : "";
var replacements = {};
replacements[prefix + "VERSION"] = version;
replacements[prefix + "MAJOR_VERSION"] = xyz[0];
replacements[prefix + "MINOR_VERSION"] = xyz[1];
replacements[prefix + "MICRO_VERSION"] = xyz[2];
replacements[prefix + "PRERELEASE_VERSION"] = xyz_pre[1];
replacements[prefix + "PRERELEASE_VERSION"] = pre;
return replacements;
}
......@@ -46,10 +47,10 @@ ARG_ENABLE("mongodb", "MongoDB support", "no");
ARG_WITH("mongodb-sasl", "MongoDB: Build against Cyrus-SASL", "yes");
if (PHP_MONGODB != "no") {
ADD_EXTENSION_DEP("mongodb", "date", false);
/* Note: ADD_EXTENSION_DEP() cannot be used to declare that we depend on the
* date and standard extensions. Assume that they're always enabled. */
ADD_EXTENSION_DEP("mongodb", "json", false);
ADD_EXTENSION_DEP("mongodb", "spl", false);
ADD_EXTENSION_DEP("mongodb", "standard", false);
/* MongoDB does not actually depend on PHP's OpenSSL extension, but this is in
* place to ensure that later SSL library checks succeed. This can be removed
......@@ -76,8 +77,6 @@ if (PHP_MONGODB != "no") {
ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-secure-channel.c mongoc-stream-tls-secure-channel.c", "mongodb");
ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-sasl.c", "mongodb");
AC_DEFINE("HAVE_MONGOC", 1);
var bson_opts = {
BSON_BYTE_ORDER: 1234,
BSON_OS: 2,
......@@ -148,7 +147,6 @@ if (PHP_MONGODB != "no") {
mongoc_opts.MONGOC_ENABLE_CRYPTO_LIBCRYPTO = 1;
mongoc_opts.MONGOC_ENABLE_SSL = 1;
mongoc_opts.MONGOC_ENABLE_CRYPTO = 1;
mongoc_opts.MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE = 1;
} else {
WARNING("mongodb libopenssl support not enabled, libs not found");
}
......
/*
* Copyright 2015-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Our Compatability header */
#include "phongo_compat.h"
void phongo_add_exception_prop(const char *prop, int prop_len, zval *value TSRMLS_DC)
{
if (EG(exception)) {
#if PHP_VERSION_ID >= 70000
zval ex;
EXCEPTION_P(EG(exception), ex);
zend_update_property(Z_OBJCE(ex), &ex, prop, prop_len, value);
#else
zval *ex = NULL;
EXCEPTION_P(EG(exception), ex);
zend_update_property(Z_OBJCE_P(ex), ex, prop, prop_len, value TSRMLS_CC);
#endif
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
/*
+---------------------------------------------------------------------------+
| PHP Driver for MongoDB |
+---------------------------------------------------------------------------+
| Copyright 2013-2015 MongoDB, Inc. |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+---------------------------------------------------------------------------+
| Copyright (c) 2015 MongoDB, Inc. |
+---------------------------------------------------------------------------+
*/
* Copyright 2015-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PHONGO_COMPAT_H
#define PHONGO_COMPAT_H
......@@ -102,7 +96,7 @@
# define ADD_ASSOC_ZVAL(_zv, _key, _value) add_assoc_zval(_zv, _key, _value);