Skip to content

PHPC-1188, PHPC-1189, PHPC-1191: Revise maintainer/coverage configure #831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.scripts/before_script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

CONFIGURE_OPTS="--enable-developer-flags --enable-coverage"
CONFIGURE_OPTS="--enable-mongodb-developer-flags --enable-mongodb-coverage"

if [ -n "${SSL_VERSION}" ]; then
CONFIGURE_OPTS="${CONFIGURE_OPTS} --with-mongodb-ssl=${SSL_VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The following script may be used to build the driver:
#!/bin/sh

phpize > /dev/null && \
./configure --enable-developer-flags > /dev/null && \
./configure --enable-mongodb-developer-flags > /dev/null && \
make clean > /dev/null && make all > /dev/null && make install
```

Expand Down
23 changes: 14 additions & 9 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ if test "$PHP_MONGODB" != "no"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 5.5.0 (found $PHP_MONGODB_PHP_VERSION)])
fi

PHP_ARG_ENABLE([developer-flags],
PHP_ARG_ENABLE([mongodb-developer-flags],
[whether to enable developer build flags],
[AC_HELP_STRING([--enable-developer-flags],
[AC_HELP_STRING([--enable-mongodb-developer-flags],
[MongoDB: Enable developer flags [default=no]])],
[no],
[no])

if test "$PHP_DEVELOPER_FLAGS" = "yes"; then
if test "$PHP_MONGODB_DEVELOPER_FLAGS" = "yes"; then
dnl Warn about functions which might be candidates for format attributes
PHP_CHECK_GCC_ARG(-Wmissing-format-attribute, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmissing-format-attribute")
dnl Avoid duplicating values for an enum
Expand Down Expand Up @@ -80,17 +80,22 @@ if test "$PHP_MONGODB" != "no"; then
fi


PHP_ARG_ENABLE([coverage],
PHP_ARG_ENABLE([mongodb-coverage],
[whether to enable code coverage],
[AC_HELP_STRING([--enable-coverage],
[AC_HELP_STRING([--enable-mongodb-coverage],
[MongoDB: Enable developer code coverage information [default=no]])],
[no],
[no])

if test "$PHP_COVERAGE" = "yes"; then
PHP_CHECK_GCC_ARG(-fprofile-arcs, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -fprofile-arcs")
PHP_CHECK_GCC_ARG(-ftest-coverage, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -ftest-coverage")
EXTRA_LDFLAGS="$COVERAGE_CFLAGS"
if test "$PHP_MONGODB_COVERAGE" = "yes"; then
if test "$ext_shared" != "yes"; then
AC_MSG_ERROR(code coverage is not supported for static builds)
fi

COVERAGE_CFLAGS="--coverage -g"
COVERAGE_LDFLAGS="--coverage"

MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD $COVERAGE_LDFLAGS"
fi

PHP_MONGODB_CFLAGS="$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS"
Expand Down