@@ -5,35 +5,7 @@ PHP_ARG_WITH(openssl-dir, OpenSSL dir for phongo,
55[ --with-openssl-dir[ =DIR] openssl install prefix] , yes, no)
66
77
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
278
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- ] )
379dnl borrowed from PHP acinclude.m4
3810AC_DEFUN ( [ PHP_BSON_BIGENDIAN] ,
3911[ AC_CACHE_CHECK ( [ whether byte ordering is bigendian] , ac_cv_c_bigendian_php ,
@@ -55,10 +27,11 @@ int main(void)
5527 ] , [ ac_cv_c_bigendian_php=yes] , [ ac_cv_c_bigendian_php=no] , [ ac_cv_c_bigendian_php=unknown] )
5628 ] )
5729 if test $ac_cv_c_bigendian_php = yes; then
58- BSON_DEFINE( [ BSON_BYTE_ORDER] , 4321)
30+ BSON_BYTE_ORDER= 4321
5931 else
60- BSON_DEFINE( [ BSON_BYTE_ORDER] , 1234)
32+ BSON_BYTE_ORDER= 1234
6133 fi
34+ AC_SUBST ( BSON_BYTE_ORDER )
6235] )
6336dnl Borrowed from sapi/fpm/config.m4
6437AC_DEFUN ( [ PHP_BSON_CLOCK] ,
@@ -90,7 +63,8 @@ AC_DEFUN([PHP_BSON_CLOCK],
9063 fi
9164
9265 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 )
9468 fi
9569] )
9670
@@ -319,9 +293,9 @@ dnl libmongoc stuff {{{
319293 PHP_ADD_SOURCES_X(PHP_EXT_DIR(phongo)[ src/libmongoc/src/mongoc] , $MONGOC_SOURCES_SSL, [ $STD_CFLAGS] , shared_objects_phongo, yes)
320294
321295
322- MONGOC_DEFINE_RESET
323296 PHP_SETUP_OPENSSL(PHONGO_SHARED_LIBADD)
324- MONGOC_DEFINE([ MONGOC_ENABLE_SSL] , 1)
297+ MONGOC_ENABLE_SSL=1
298+ AC_SUBST ( MONGOC_ENABLE_SSL )
325299
326300
327301PHP_ARG_WITH(phongo-sasl, Build with Cyrus SASL support,
@@ -348,7 +322,8 @@ if test "$PHP_PHONGO_SASL" != "no"; then
348322 [
349323 PHP_ADD_INCLUDE($PHONGO_SASL_DIR)
350324 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 )
352327 ] , [
353328 if test "$PHONGO_SASL" != "auto"; then
354329 AC_MSG_ERROR ( [ MONGO SASL check failed. Please check config.log for more information.] )
@@ -398,31 +373,57 @@ dnl }}}
398373 dnl PHONGO_SHARED_DEPENDENCIES="phongodep"
399374 dnl PHP_SUBST(PHONGO_SHARED_DEPENDENCIES)
400375
401- BSON_DEFINE_RESET
402-
403376 PHP_BSON_BIGENDIAN
404377 AC_HEADER_STDBOOL
405378
406379 if test "$ac_cv_header_stdbool_h" = "yes"; then
407- BSON_DEFINE( [ BSON_HAVE_STDBOOL_H] , 1)
380+ BSON_HAVE_STDBOOL_H=1
408381 else
409- BSON_DEFINE( [ BSON_HAVE_STDBOOL_H] , 0)
382+ BSON_HAVE_STDBOOL_H=0
410383 fi
384+ AC_SUBST ( HAVE_STDBOOL_H )
411385
412- BSON_DEFINE([ BSON_OS] , 1)
386+ BSON_OS=1
387+ AC_SUBST ( BSON_OS )
413388
414389 PHP_BSON_CLOCK
415390 AC_CHECK_FUNC ( strnlen ,ac_cv_func_strnlen=yes ,ac_cv_func_strnlen=no )
416391 if test "$ac_cv_func_strnlen" = "yes"; then
417- BSON_DEFINE( [ BSON_HAVE_STRNLEN] , 1)
392+ BSON_HAVE_STRNLEN=1
418393 fi
394+ AC_SUBST ( BSON_HAVE_STRNLEN )
419395 AC_CHECK_FUNC ( snprintf ,ac_cv_func_snprintf=yes ,ac_cv_func_snprintf=no )
420396 if test "$ac_cv_func_snprintf" = "yes"; then
421- BSON_DEFINE( [ BSON_HAVE_SNPRINTF] , 1)
397+ BSON_HAVE_SNPRINTF=1
422398 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)
426427
427428 dnl This must come after PHP_NEW_EXTENSION, otherwise the srcdir won't be set
428429 PHP_ADD_MAKEFILE_FRAGMENT
0 commit comments