@@ -5,35 +5,7 @@ PHP_ARG_WITH(openssl-dir, OpenSSL dir for phongo,
5
5
[ --with-openssl-dir[ =DIR] openssl install prefix] , yes, no)
6
6
7
7
8
- AC_DEFUN ( [ MONGOC_DEFINE_FLUSH] ,[
9
- [ echo "#endif" >> $srcdir/src/libmongoc/src/mongoc/mongoc-config.h]
10
- ] )
11
- AC_DEFUN ( [ BSON_DEFINE_FLUSH] ,[
12
- [ echo "#endif" >> $srcdir/src/libbson/src/bson/bson-config.h]
13
- ] )
14
-
15
-
16
- AC_DEFUN ( [ MONGOC_DEFINE_RESET] ,[
17
- [ echo "/* Generated by phongo */
18
- #ifndef MONGOC_CONFIG_H
19
- #define MONGOC_CONFIG_H
20
-
21
- " > $srcdir/src/libmongoc/src/mongoc/mongoc-config.h]
22
- ] )
23
- AC_DEFUN ( [ BSON_DEFINE_RESET] ,[
24
- [ echo "/* Generated by phongo */
25
- #ifndef BSON_CONFIG_H
26
- #define BSON_CONFIG_H
27
8
28
- " > $srcdir/src/libbson/src/bson/bson-config.h]
29
- ] )
30
- dnl borrowed from PHP acinclude.m4
31
- AC_DEFUN ( [ BSON_DEFINE] ,[
32
- [ echo "#define ] $1 [ ] ifelse ( [ $2 ] ,,[ 1] ,[ $2 ] ) [ " >> $srcdir/src/libbson/src/bson/bson-config.h]
33
- ] )
34
- AC_DEFUN ( [ MONGOC_DEFINE] ,[
35
- [ echo "#define ] $1 [ ] ifelse ( [ $2 ] ,,[ 1] ,[ $2 ] ) [ " >> $srcdir/src/libmongoc/src/mongoc/mongoc-config.h]
36
- ] )
37
9
dnl borrowed from PHP acinclude.m4
38
10
AC_DEFUN ( [ PHP_BSON_BIGENDIAN] ,
39
11
[ AC_CACHE_CHECK ( [ whether byte ordering is bigendian] , ac_cv_c_bigendian_php ,
@@ -55,10 +27,11 @@ int main(void)
55
27
] , [ ac_cv_c_bigendian_php=yes] , [ ac_cv_c_bigendian_php=no] , [ ac_cv_c_bigendian_php=unknown] )
56
28
] )
57
29
if test $ac_cv_c_bigendian_php = yes; then
58
- BSON_DEFINE( [ BSON_BYTE_ORDER] , 4321)
30
+ BSON_BYTE_ORDER= 4321
59
31
else
60
- BSON_DEFINE( [ BSON_BYTE_ORDER] , 1234)
32
+ BSON_BYTE_ORDER= 1234
61
33
fi
34
+ AC_SUBST ( BSON_BYTE_ORDER )
62
35
] )
63
36
dnl Borrowed from sapi/fpm/config.m4
64
37
AC_DEFUN ( [ PHP_BSON_CLOCK] ,
@@ -90,7 +63,8 @@ AC_DEFUN([PHP_BSON_CLOCK],
90
63
fi
91
64
92
65
if test "$have_clock_gettime" = "yes"; then
93
- BSON_DEFINE([ BSON_HAVE_CLOCK_GETTIME] , 1)
66
+ BSON_HAVE_CLOCK_GETTIME=1
67
+ AC_SUBST ( BSON_HAVE_CLOCK_GETTIME )
94
68
fi
95
69
] )
96
70
@@ -319,9 +293,9 @@ dnl libmongoc stuff {{{
319
293
PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[ src/libmongoc/src/mongoc] , $MONGOC_SOURCES_SSL, [ $STD_CFLAGS] , shared_objects_phongo, yes)
320
294
321
295
322
- MONGOC_DEFINE_RESET
323
296
PHP_SETUP_OPENSSL(PHONGO_SHARED_LIBADD)
324
- MONGOC_DEFINE([ MONGOC_ENABLE_SSL] , 1)
297
+ MONGOC_ENABLE_SSL=1
298
+ AC_SUBST ( MONGOC_ENABLE_SSL )
325
299
326
300
327
301
PHP_ARG_WITH(phongo-sasl, Build with Cyrus SASL support,
@@ -348,7 +322,8 @@ if test "$PHP_PHONGO_SASL" != "no"; then
348
322
[
349
323
PHP_ADD_INCLUDE($PHONGO_SASL_DIR)
350
324
PHP_ADD_LIBRARY_WITH_PATH(sasl2, $PHONGO_SASL_DIR/$PHP_LIBDIR, PHONGO_SHARED_LIBADD)
351
- MONGOC_DEFINE(MONGOC_ENABLE_SASL, 1, [ MONGO SASL support] )
325
+ MONGOC_ENABLE_SASL=1
326
+ AC_SUBST ( MONGOC_ENABLE_SASL )
352
327
] , [
353
328
if test "$PHONGO_SASL" != "auto"; then
354
329
AC_MSG_ERROR ( [ MONGO SASL check failed. Please check config.log for more information.] )
@@ -398,31 +373,57 @@ dnl }}}
398
373
dnl PHONGO_SHARED_DEPENDENCIES="phongodep"
399
374
dnl PHP_SUBST(PHONGO_SHARED_DEPENDENCIES)
400
375
401
- BSON_DEFINE_RESET
402
-
403
376
PHP_BSON_BIGENDIAN
404
377
AC_HEADER_STDBOOL
405
378
406
379
if test "$ac_cv_header_stdbool_h" = "yes"; then
407
- BSON_DEFINE( [ BSON_HAVE_STDBOOL_H] , 1)
380
+ BSON_HAVE_STDBOOL_H=1
408
381
else
409
- BSON_DEFINE( [ BSON_HAVE_STDBOOL_H] , 0)
382
+ BSON_HAVE_STDBOOL_H=0
410
383
fi
384
+ AC_SUBST ( HAVE_STDBOOL_H )
411
385
412
- BSON_DEFINE([ BSON_OS] , 1)
386
+ BSON_OS=1
387
+ AC_SUBST ( BSON_OS )
413
388
414
389
PHP_BSON_CLOCK
415
390
AC_CHECK_FUNC ( strnlen ,ac_cv_func_strnlen=yes ,ac_cv_func_strnlen=no )
416
391
if test "$ac_cv_func_strnlen" = "yes"; then
417
- BSON_DEFINE( [ BSON_HAVE_STRNLEN] , 1)
392
+ BSON_HAVE_STRNLEN=1
418
393
fi
394
+ AC_SUBST ( BSON_HAVE_STRNLEN )
419
395
AC_CHECK_FUNC ( snprintf ,ac_cv_func_snprintf=yes ,ac_cv_func_snprintf=no )
420
396
if test "$ac_cv_func_snprintf" = "yes"; then
421
- BSON_DEFINE( [ BSON_HAVE_SNPRINTF] , 1)
397
+ BSON_HAVE_SNPRINTF=1
422
398
fi
423
-
424
- MONGOC_DEFINE_FLUSH()
425
- BSON_DEFINE_FLUSH()
399
+ AC_SUBST ( BSON_HAVE_SNPRINTF )
400
+
401
+ m4_include ( src/libmongoc/build/autotools/Versions.m4 )
402
+ m4_include ( src/libbson/build/autotools/Versions.m4 )
403
+ MONGOC_MAJOR_VERSION=mongoc_major_version
404
+ MONGOC_MINOR_VERSION=mongoc_minor_version
405
+ MONGOC_MICRO_VERSION=mongoc_micro_version
406
+ MONGOC_API_VERSION=1.0
407
+ MONGOC_VERSION=mongoc_version
408
+ AC_SUBST ( MONGOC_MAJOR_VERSION )
409
+ AC_SUBST ( MONGOC_MINOR_VERSION )
410
+ AC_SUBST ( MONGOC_MICRO_VERSION )
411
+ AC_SUBST ( MONGOC_API_VERSION )
412
+ AC_SUBST ( MONGOC_VERSION )
413
+ BSON_MAJOR_VERSION=bson_major_version
414
+ BSON_MINOR_VERSION=bson_minor_version
415
+ BSON_MICRO_VERSION=bson_micro_version
416
+ BSON_API_VERSION=1.0
417
+ BSON_VERSION=bson_version
418
+ AC_SUBST ( BSON_MAJOR_VERSION )
419
+ AC_SUBST ( BSON_MINOR_VERSION )
420
+ AC_SUBST ( BSON_MICRO_VERSION )
421
+ AC_SUBST ( BSON_API_VERSION )
422
+ AC_SUBST ( BSON_VERSION )
423
+ AC_OUTPUT ($srcdir/src/libmongoc/src/mongoc/mongoc-config.h)
424
+ AC_OUTPUT ($srcdir/src/libmongoc/src/mongoc/mongoc-version.h)
425
+ AC_OUTPUT ($srcdir/src/libbson/src/bson/bson-config.h)
426
+ AC_OUTPUT ($srcdir/src/libbson/src/bson/bson-version.h)
426
427
427
428
dnl This must come after PHP_NEW_EXTENSION, otherwise the srcdir won't be set
428
429
PHP_ADD_MAKEFILE_FRAGMENT
0 commit comments