Skip to content

Commit eb4a318

Browse files
committed
CDRIVER-2204 Rename --enable-[snappy|zlib] to --with-[snappy|zlib]
1 parent 2a4ace5 commit eb4a318

File tree

10 files changed

+91
-63
lines changed

10 files changed

+91
-63
lines changed

.evergreen/compile-unix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ case "$MARCH" in
182182
i386)
183183
CFLAGS="$CFLAGS -m32 -march=i386"
184184
# We don't have the 32bit versions of these libs
185-
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --disable-snappy --disable-zlib"
185+
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --without-snappy --without-zlib"
186186
;;
187187
s390x)
188188
CFLAGS="$CFLAGS -march=z196 -mtune=zEC12"

.evergreen/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ tasks:
439439
script: |
440440
set -o errexit
441441
set -o xtrace
442-
DEBUG=yes CC='${CC}' MARCH='${MARCH}' EXTRA_CONFIGURE_FLAGS="--enable-snappy=no --enable-zlib=yes" sh .evergreen/compile.sh
442+
DEBUG=yes CC='${CC}' MARCH='${MARCH}' EXTRA_CONFIGURE_FLAGS="--with-snappy=no --with-zlib" sh .evergreen/compile.sh
443443
- func: "upload build"
444444

445445
- name: debug-compile-snappy
@@ -452,7 +452,7 @@ tasks:
452452
script: |
453453
set -o errexit
454454
set -o xtrace
455-
DEBUG=yes CC='${CC}' MARCH='${MARCH}' EXTRA_CONFIGURE_FLAGS="--enable-snappy=yes --enable-zlib=no" sh .evergreen/compile.sh
455+
DEBUG=yes CC='${CC}' MARCH='${MARCH}' EXTRA_CONFIGURE_FLAGS="--with-snappy --with-zlib=no" sh .evergreen/compile.sh
456456
- func: "upload build"
457457

458458
- name: debug-compile-compression
@@ -465,7 +465,7 @@ tasks:
465465
script: |
466466
set -o errexit
467467
set -o xtrace
468-
DEBUG=yes CC='${CC}' MARCH='${MARCH}' EXTRA_CONFIGURE_FLAGS="--enable-snappy=yes --enable-zlib=yes" sh .evergreen/compile.sh
468+
DEBUG=yes CC='${CC}' MARCH='${MARCH}' EXTRA_CONFIGURE_FLAGS="--with-snappy --with-zlib" sh .evergreen/compile.sh
469469
- func: "upload build"
470470

471471
- name: test-latest-server-zlib

Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ lib_LTLIBRARIES =
88
noinst_LTLIBRARIES =
99
noinst_PROGRAMS =
1010

11+
SUBDIRS =
12+
1113
if WITH_LIBBSON
12-
SUBDIRS = src/libbson
14+
SUBDIRS += src/libbson
1315
endif
1416

1517
AM_CTAGSFLAGS = --fields=+l --languages=c

NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mongo-c-driver 1.7.0
1212
* Support for snappy and zlib. MongoDB 3.4 only supports snappy, while zlib
1313
support is expected in MongoDB 3.6.
1414
The enable, configure mongoc like so:
15-
./configure --enable-snappy --enable-zlib
15+
./configure --with-snappy --with-zlib
1616
* New functions: mongoc_uri_get_compressors & mongoc_uri_set_compressors, to
1717
get and set compressor configuration on mongoc_uri_t
1818
* Added support for comma seperated "compressors" connection string option (e.g.

build/autotools/CheckSnappy.m4

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
1-
have_snappy=no
2-
AC_MSG_CHECKING([whether to enable snappy])
3-
AC_ARG_ENABLE([snappy],
4-
[AS_HELP_STRING([--enable-snappy=@<:@auto/yes/no@:>@],
5-
[Enable wire protocol compression through snappy])],
6-
[],
7-
[enable_snappy=auto])
8-
AC_MSG_RESULT([$enable_snappy])
1+
# If --with-snappy=auto, determine if there is a system installed snappy
2+
# greater than our required version.
3+
AS_IF([test "x${with_snappy}" = xauto], [
4+
PKG_CHECK_MODULES(SNAPPY, [snappy],
5+
[with_snappy=system],
6+
[
7+
# If we didn't find snappy with pkgconfig
8+
with_snappy=no
9+
AC_CHECK_LIB([snappy],[snappy_uncompress],
10+
[AC_CHECK_HEADER([snappy-c.h],
11+
[
12+
with_snappy=system
13+
SNAPPY_LIBS=-lsnappy
14+
],
15+
[]
16+
)],
17+
[]
18+
)
19+
]
20+
)
21+
]
22+
)
923

10-
AS_IF([test "x$enable_snappy" != "xno"],[
11-
PKG_CHECK_MODULES(SNAPPY, [snappy], [have_snappy=yes], [
12-
AC_CHECK_LIB([snappy],[snappy_uncompress],[
13-
AC_CHECK_HEADER([snappy-c.h], [
14-
have_snappy=yes
15-
SNAPPY_LIBS=-lsnappy
16-
], [have_snappy=no])
17-
],[have_snappy=no])
18-
])
24+
AS_IF([test "x${SNAPPY_LIBS}" = "x" -a "x$with_snappy" = "xsystem"],
25+
[AC_MSG_ERROR([Cannot find system installed snappy. try --with-snappy=bundled])])
1926

20-
AC_MSG_CHECKING([snappy is available])
21-
if test "$enable_snappy" = "yes" -a "$have_snappy" = "no" ; then
22-
AC_MSG_ERROR([You must install the snappy development headers to enable snappy support.])
23-
else
24-
AC_MSG_RESULT([$have_snappy])
25-
fi
27+
# If we are using the bundled snappy, recurse into its configure.
28+
AS_IF([test "x${with_snappy}" = xbundled],[
29+
AC_MSG_CHECKING(whether to enable bundled snappy)
30+
AC_ERROR(bundled snappy is not currently supported)
2631
])
2732

28-
if test "x$have_snappy" = "xyes"; then
33+
if test "x$with_snappy" != "xno"; then
2934
AC_SUBST(MONGOC_ENABLE_COMPRESSION_SNAPPY, 1)
30-
enable_snappy=yes
3135
else
3236
AC_SUBST(MONGOC_ENABLE_COMPRESSION_SNAPPY, 0)
33-
enable_snappy=no
3437
fi
3538
AC_SUBST(SNAPPY_LIBS)
3639
AC_SUBST(SNAPPY_CFLAGS)
3740

38-

build/autotools/CheckZlib.m4

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
have_zlib=no
2-
AC_MSG_CHECKING([whether to enable zlib])
3-
AC_ARG_ENABLE([zlib],
4-
[AS_HELP_STRING([--enable-zlib=@<:@auto/yes/no@:>@],
5-
[Enable wire protocol compression through zlib])],
6-
[],
7-
[enable_zlib=auto])
8-
AC_MSG_RESULT([$enable_zlib])
1+
# If --with-zlib=auto, determine if there is a system installed zlib
2+
AS_IF([test "x${with_zlib}" = xauto], [
3+
PKG_CHECK_MODULES(ZLIB, [zlib],
4+
[with_zlib=system],
5+
[
6+
# If we didn't find zlib with pkgconfig
7+
with_zlib=no
8+
AC_CHECK_LIB([zlib],[compress2],
9+
[AC_CHECK_HEADER([zlib-c.h],
10+
[
11+
with_zlib=system
12+
ZLIB_LIBS=-lz
13+
],
14+
[]
15+
)],
16+
[]
17+
)
18+
]
19+
)
20+
]
21+
)
922

10-
AS_IF([test "x$enable_zlib" != "xno"],[
11-
PKG_CHECK_MODULES(ZLIB, [zlib], [have_zlib=yes], [
12-
AC_CHECK_LIB([zlib],[compress],[
13-
AC_CHECK_HEADER([zlib-c.h], [
14-
have_zlib=yes
15-
ZLIB_LIBS=-lz
16-
], [have_zlib=no])
17-
],[have_zlib=no])
18-
])
23+
AS_IF([test "x${ZLIB_LIBS}" = "x" -a "x$with_zlib" = "xsystem"],
24+
[AC_MSG_ERROR([Cannot find system installed zlib. try --with-zlib=bundled])])
1925

20-
AC_MSG_CHECKING([zlib is available])
21-
if test "$enable_zlib" = "yes" -a "$have_zlib" = "no" ; then
22-
AC_MSG_ERROR([You must install the zlib development headers to enable zlib support.])
23-
else
24-
AC_MSG_RESULT([$have_zlib])
25-
fi
26+
# If we are using the bundled zlib, recurse into its configure.
27+
AS_IF([test "x${with_zlib}" = xbundled],[
28+
AC_MSG_CHECKING(whether to enable bundled zlib)
29+
AC_ERROR(bundled zlib is not currently supported)
2630
])
2731

28-
if test "x$have_zlib" = "xyes"; then
32+
if test "x$with_zlib" != "xno"; then
2933
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZLIB, 1)
30-
enable_zlib=yes
3134
else
3235
AC_SUBST(MONGOC_ENABLE_COMPRESSION_ZLIB, 0)
33-
enable_zlib=no
3436
fi
3537
AC_SUBST(ZLIB_LIBS)
3638
AC_SUBST(ZLIB_CFLAGS)
3739

38-

build/autotools/PrintBuildConfiguration.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ Build configuration:
4646
Shared memory performance counters : ${enable_shm_counters}
4747
SASL : ${sasl_mode}
4848
SSL : ${enable_ssl}
49-
Snappy Compression : ${enable_snappy}
50-
Zlib Compression : ${enable_zlib}${experimental_features}
49+
Snappy Compression : ${with_snappy}
50+
Zlib Compression : ${with_zlib}
5151
Libbson : ${with_libbson}
52+
${experimental_features}
5253

5354
Documentation:
5455
man : ${enable_man_pages}

build/autotools/ReadCommandLineArguments.m4

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ AC_ARG_WITH(libbson,
8989
AS_IF([test "x$with_libbson" != xbundled && test "x$with_libbson" != xsystem],
9090
[with_libbson=auto])
9191

92+
AC_ARG_WITH(snappy,
93+
AC_HELP_STRING([--with-snappy=@<:@auto/system/bundled/no@:>@],
94+
[use system installed snappy or bundled snappy. default=auto]),
95+
[],
96+
[with_snappy=auto])
97+
AS_IF([test "x$with_snappy" != xbundled && test "x$with_snappy" != xsystem && test "x$with_snappy" != xno],
98+
[with_snappy=auto])
99+
100+
AC_ARG_WITH(zlib,
101+
AC_HELP_STRING([--with-zlib=@<:@auto/system/bundled/no@:>@],
102+
[use system installed zlib or bundled zlib. default=auto]),
103+
[],
104+
[with_zlib=auto])
105+
AS_IF([test "x$with_zlib" != xbundled && test "x$with_zlib" != xsystem && test "x$with_zlib" != xno],
106+
[with_zlib=auto])
107+
92108
AC_ARG_ENABLE([html-docs],
93109
[AS_HELP_STRING([--enable-html-docs=@<:@yes/no@:>@],
94110
[build HTML documentation @<:@default=no@:>@])],

build/autotools/SetupAutomake.m4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ AM_CONDITIONAL([ENABLE_PTHREADS],[test "$enable_pthreads" = "yes"])
2727
# Should we compile the bundled libbson
2828
AM_CONDITIONAL([WITH_LIBBSON],[test "$with_libbson" = "bundled"])
2929

30+
# Should we compile the bundled snappy
31+
AM_CONDITIONAL([WITH_SNAPPY],[test "$with_snappy" = "bundled"])
32+
33+
# Should we compile the bundled zlib
34+
AM_CONDITIONAL([WITH_ZLIB],[test "$with_zlib" = "bundled"])
35+
3036
# Should we avoid extra BSON_LIBS when linking (SunStudio)
3137
AM_CONDITIONAL([EXPLICIT_LIBS],[test "$with_gnu_ld" = "yes"])
3238

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ m4_include([build/autotools/CheckSasl.m4])
4646
m4_include([build/autotools/CheckSnappy.m4])
4747
m4_include([build/autotools/CheckZlib.m4])
4848

49-
if test "x$have_zlib" = "xyes" -o "x$have_snappy" = "xyes"; then
49+
if test "x$with_zlib" != "xno" -o "x$with_snappy" != "xno"; then
5050
AC_SUBST(MONGOC_ENABLE_COMPRESSION, 1)
5151
else
5252
AC_SUBST(MONGOC_ENABLE_COMPRESSION, 0)

0 commit comments

Comments
 (0)