@@ -170,6 +170,12 @@ if test "$PHP_MONGODB" != "no"; then
170
170
src/MongoDB/Monitoring/functions.c \
171
171
"
172
172
173
+ PHP_ARG_WITH([ mongodb-system-libs] ,
174
+ [ whether to compile against system libraries instead of bundled] ,
175
+ [ AS_HELP_STRING ( [ --with-mongodb-system-libs=@<:@ yes/no@:>@ ] ,
176
+ [ MongoDB: Use system libraries for libbson, libmongoc, and libmongocrypt [ default=no] ] ) ] ,
177
+ [ no] ,
178
+ [ no] )
173
179
PHP_ARG_WITH([ libbson] ,
174
180
[ whether to use system libbson] ,
175
181
[ AS_HELP_STRING ( [ --with-libbson=@<:@ yes/no@:>@ ] ,
@@ -190,10 +196,26 @@ if test "$PHP_MONGODB" != "no"; then
190
196
[ no] )
191
197
192
198
if test "$PHP_LIBBSON" != "no"; then
199
+ AC_MSG_WARN ( Using -- with-libbson is deprecated and will be removed in a future version. Please use -- with-system-libs instead )
200
+
193
201
if test "$PHP_LIBMONGOC" = "no"; then
194
202
AC_MSG_ERROR ( Cannot use system libbson and bundled libmongoc )
195
203
fi
196
204
205
+ PHP_MONGODB_SYSTEM_LIBS="yes"
206
+ fi
207
+
208
+ if test "$PHP_LIBMONGOC" != "no"; then
209
+ AC_MSG_WARN ( Using -- with-libmongoc is deprecated and will be removed in a future version. Please use -- with-system-libs instead )
210
+
211
+ if test "$PHP_LIBBSON" = "no"; then
212
+ AC_MSG_ERROR ( Cannot use system libmongoc and bundled libbson )
213
+ fi
214
+
215
+ PHP_MONGODB_SYSTEM_LIBS="yes"
216
+ fi
217
+
218
+ if test "$PHP_MONGODB_SYSTEM_LIBS" != "no"; then
197
219
AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
198
220
AC_MSG_CHECKING ( for libbson )
199
221
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libbson-1.0; then
@@ -211,12 +233,6 @@ if test "$PHP_MONGODB" != "no"; then
211
233
PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_BSON_CFLAGS"
212
234
PHP_EVAL_LIBLINE($PHP_MONGODB_BSON_LIBS, MONGODB_SHARED_LIBADD)
213
235
AC_DEFINE ( HAVE_SYSTEM_LIBBSON , 1 , [ Use system libbson] )
214
- fi
215
-
216
- if test "$PHP_LIBMONGOC" != "no"; then
217
- if test "$PHP_LIBBSON" = "no"; then
218
- AC_MSG_ERROR ( Cannot use system libmongoc and bundled libbson )
219
- fi
220
236
221
237
AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
222
238
AC_MSG_CHECKING ( for libmongoc )
@@ -235,37 +251,37 @@ if test "$PHP_MONGODB" != "no"; then
235
251
PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOC_CFLAGS"
236
252
PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOC_LIBS, MONGODB_SHARED_LIBADD)
237
253
AC_DEFINE ( HAVE_SYSTEM_LIBMONGOC , 1 , [ Use system libmongoc] )
238
- fi
239
254
240
- if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "no" -a "$PHP_LIBBSON" = "yes"; then
241
- AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
242
- AC_MSG_CHECKING ( for libmongocrypt )
243
-
244
- if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongocrypt-1.0; then
245
- if $PKG_CONFIG libmongocrypt-1.0 --atleast-version 1.0.1; then
246
- PHP_MONGODB_MONGOCRYPT_CFLAGS=`$PKG_CONFIG libmongocrypt-1.0 --cflags`
247
- PHP_MONGODB_MONGOCRYPT_LIBS=`$PKG_CONFIG libmongocrypt-1.0 --libs`
248
- PHP_MONGODB_MONGOCRYPT_VERSION=`$PKG_CONFIG libmongocrypt-1.0 --modversion`
249
- AC_MSG_RESULT ( version $PHP_MONGODB_MONGOCRYPT_VERSION found )
250
-
251
- PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOCRYPT_CFLAGS"
252
- PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOCRYPT_LIBS, MONGODB_SHARED_LIBADD)
253
- AC_DEFINE ( HAVE_SYSTEM_LIBMONGOCRYPT , 1 , [ Use system libmongocrypt] )
254
- elif test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
255
- AC_MSG_ERROR ( system libmongocrypt must be upgraded to version >= 1.0.1 )
256
- else
257
- AC_MSG_RESULT ( found an older version , compiling without client-side encryption )
258
- fi
259
- else
260
- if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
261
- AC_MSG_ERROR ( pkgconfig and libmongocrypt must be installed )
255
+ if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "no"; then
256
+ AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
257
+ AC_MSG_CHECKING ( for libmongocrypt )
258
+
259
+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongocrypt-1.0; then
260
+ if $PKG_CONFIG libmongocrypt-1.0 --atleast-version 1.0.1; then
261
+ PHP_MONGODB_MONGOCRYPT_CFLAGS=`$PKG_CONFIG libmongocrypt-1.0 --cflags`
262
+ PHP_MONGODB_MONGOCRYPT_LIBS=`$PKG_CONFIG libmongocrypt-1.0 --libs`
263
+ PHP_MONGODB_MONGOCRYPT_VERSION=`$PKG_CONFIG libmongocrypt-1.0 --modversion`
264
+ AC_MSG_RESULT ( version $PHP_MONGODB_MONGOCRYPT_VERSION found )
265
+
266
+ PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOCRYPT_CFLAGS"
267
+ PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOCRYPT_LIBS, MONGODB_SHARED_LIBADD)
268
+ AC_DEFINE ( HAVE_SYSTEM_LIBMONGOCRYPT , 1 , [ Use system libmongocrypt] )
269
+ elif test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
270
+ AC_MSG_ERROR ( system libmongocrypt must be upgraded to version >= 1.0.1 )
271
+ else
272
+ AC_MSG_RESULT ( found an older version , compiling without client-side encryption )
273
+ fi
262
274
else
263
- AC_MSG_RESULT ( not found , compiling without client-side encryption )
275
+ if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
276
+ AC_MSG_ERROR ( pkgconfig and libmongocrypt must be installed )
277
+ else
278
+ AC_MSG_RESULT ( not found , compiling without client-side encryption )
279
+ fi
264
280
fi
265
281
fi
266
282
fi
267
283
268
- if test "$PHP_LIBBSON" = "no" -a "$PHP_LIBMONGOC " = "no"; then
284
+ if test "$PHP_MONGODB_SYSTEM_LIBS " = "no"; then
269
285
PHP_MONGODB_BUNDLED_CFLAGS="$STD_CFLAGS -DBSON_COMPILATION -DMONGOC_COMPILATION"
270
286
dnl TODO: MONGOCRYPT-219 makes the -std argument obsolete
271
287
PHP_MONGODB_LIBMONGOCRYPT_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -std=gnu99"
@@ -469,9 +485,9 @@ Build configuration:
469
485
Extra CFLAGS : $STD_CFLAGS $EXTRA_CFLAGS
470
486
Developers flags (slow) : $MAINTAINER_CFLAGS
471
487
Code Coverage flags (extra slow) : $COVERAGE_CFLAGS
472
- System mongoc : $PHP_LIBMONGOC
473
- System libbson : $PHP_LIBBSON
474
- System libmongocrypt : $PHP_LIBBSON
488
+ System libmongoc : $PHP_MONGODB_SYSTEM_LIBS
489
+ System libbson : $PHP_MONGODB_SYSTEM_LIBS
490
+ System libmongocrypt : $PHP_MONGODB_SYSTEM_LIBS
475
491
LDFLAGS : $LDFLAGS
476
492
EXTRA_LDFLAGS : $EXTRA_LDFLAGS
477
493
MONGODB_SHARED_LIBADD : $MONGODB_SHARED_LIBADD
0 commit comments