Skip to content

Commit d0c7968

Browse files
committed
PHP-1175: Compile against OpenSSL
OpenSSL is now a required dependency (needed for SCRAM-SHA-1 by libmongoc).
1 parent 6283fe2 commit d0c7968

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

config.m4

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
dnl config.m4 for extension phongo
22
PHP_ARG_ENABLE(phongo, whether to enable phongo support,
33
[ --enable-phongo Enable phongo support])
4+
PHP_ARG_WITH(openssl-dir, OpenSSL dir for phongo,
5+
[ --with-openssl-dir[=DIR] openssl install prefix], yes, no)
46

57

68
AC_DEFUN([MONGOC_DEFINE_RESET],[
@@ -13,6 +15,9 @@ dnl borrowed from PHP acinclude.m4
1315
AC_DEFUN([BSON_DEFINE],[
1416
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" >> $srcdir/src/libbson/src/bson/bson-config.h]
1517
])
18+
AC_DEFUN([MONGOC_DEFINE],[
19+
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" >> $srcdir/src/libmongoc/src/mongoc/mongoc-config.h]
20+
])
1621
dnl borrowed from PHP acinclude.m4
1722
AC_DEFUN([PHP_BSON_BIGENDIAN],
1823
[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
@@ -76,11 +81,6 @@ AC_DEFUN([PHP_BSON_CLOCK],
7681
MONGOC_SYMBOL_SUFFIX="priv"
7782

7883
if test "$PHONGO" != "no"; then
79-
AC_MSG_CHECKING(configuring libmongoc)
80-
AC_MSG_RESULT(...)
81-
82-
AC_DEFINE(HAVE_MONGOC, 1, [Kinda useless extension without it..])
83-
8484
PHP_ARG_ENABLE(developer-flags, whether to enable developer build flags,
8585
[ --enable-developer-flags Enable developer flags],, no)
8686

@@ -273,15 +273,18 @@ dnl endif
273273
fi
274274

275275
dnl libmongoc stuff {{{
276-
CPPFLAGS="$CPPFLAGS -DBSON_COMPILATION -DMONGOC_COMPILATION"
276+
AC_MSG_CHECKING(configuring libmongoc)
277+
AC_MSG_RESULT(...)
277278

278-
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[src/libbson/src/yajl], $YAJL_SOURCES, [$STD_CFLAGS], shared_objects_phongo, yes)
279-
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[src/libbson/src/bson], $BSON_SOURCES, [$STD_CFLAGS], shared_objects_phongo, yes)
280-
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[src/libmongoc/src/mongoc], $MONGOC_SOURCES, [$STD_CFLAGS], shared_objects_phongo, yes)
279+
AC_DEFINE(HAVE_MONGOC, 1, [Kinda useless extension without it..])
281280

281+
CPPFLAGS="$CPPFLAGS -DBSON_COMPILATION -DMONGOC_COMPILATION"
282282

283+
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[src/libbson/src/yajl], $YAJL_SOURCES, [$STD_CFLAGS], shared_objects_phongo, yes)
284+
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[src/libbson/src/bson], $BSON_SOURCES, [$STD_CFLAGS], shared_objects_phongo, yes)
285+
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[src/libmongoc/src/mongoc], $MONGOC_SOURCES, [$STD_CFLAGS], shared_objects_phongo, yes)
286+
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SSL, [$STD_CFLAGS], shared_objects_phongo, yes)
283287

284-
AC_DEFINE(HAVE_MONGOC, 1, [Kinda useless extension without it..])
285288

286289

287290
dnl PHP_ADD_LIBRARY_WITH_PATH(bson-1.0, src/libbson/.libs, PHONGO_SHARED_LIBADD)
@@ -321,16 +324,22 @@ dnl }}}
321324
dnl PHP_SUBST(PHONGO_SHARED_DEPENDENCIES)
322325

323326
MONGOC_DEFINE_RESET
327+
PHP_SETUP_OPENSSL(PHONGO_SHARED_LIBADD)
328+
MONGOC_DEFINE([MONGOC_ENABLE_SSL], 1)
329+
324330
BSON_DEFINE_RESET
331+
325332
PHP_BSON_BIGENDIAN
326333
AC_HEADER_STDBOOL
334+
327335
if test "$ac_cv_header_stdbool_h" = "yes"; then
328336
BSON_DEFINE([BSON_HAVE_STDBOOL_H], 1)
329337
else
330338
BSON_DEFINE([BSON_HAVE_STDBOOL_H], 0)
331339
fi
332340

333341
BSON_DEFINE([BSON_OS], 1)
342+
334343
PHP_BSON_CLOCK
335344
AC_CHECK_FUNC(strnlen,ac_cv_func_strnlen=yes,ac_cv_func_strnlen=no)
336345
if test "$ac_cv_func_strnlen" = "yes"; then
@@ -354,6 +363,7 @@ Build configuration:
354363
Code Coverage flags (extra slow) : $COVERAGE_CFLAGS
355364
LDFLAGS : $LDFLAGS
356365
EXTRA_LDFLAGS : $EXTRA_LDFLAGS
366+
PHONGO_SHARED_LIBADD : $PHONGO_SHARED_LIBADD
357367
358368
Please submit bugreports at:
359369
https://jira.mongodb.org/browse/PHP

0 commit comments

Comments
 (0)