Skip to content

Commit

Permalink
Add --with-static-snappy configure option which uses static version…
Browse files Browse the repository at this point in the history
… of snappy library.
  • Loading branch information
kubo committed Oct 23, 2018
1 parent 33c5942 commit 809c6f2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ the location by `--with-snappy` as follows.
make
make install

When both dynamic and static snappy libraries are available, the former
is used by default. The compiled `snzip` depends on `libsnappy.so`.
When `--with-static-snappy` is passed as a configure option, the latter
is used. The compiled `snzip` includes snappy library.

Note: `--with-static-snappy` isn't available on some platforms.

You can use `--with-default-format` to change the default compression format.

./configure --with-default-format=snzip
Expand Down
15 changes: 14 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,23 @@ AC_ARG_WITH([snappy],
],
[])

AC_LANG_PUSH(C++)
saved_LIBS="$LIBS"
AC_CHECK_LIB([snappy], [snappy_compress], [],
[AC_MSG_ERROR([Snappy library is not found.])])

AC_LANG_PUSH(C++)
AC_ARG_WITH([static-snappy],
[AS_HELP_STRING([--with-static-snappy],
[use static version of snappy library])],
[
AC_MSG_CHECKING([whether -Bstatic and -Bdynamic are available])
LIBS="-Wl,-Bstatic -lsnappy -Wl,-Bdynamic $saved_LIBS"
AC_TRY_LINK([], [],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no); AC_MSG_ERROR([--with-static-snappy isn't available on this platform])])
],
[])

AC_MSG_CHECKING([snappy::Uncompress(snappy::Source*, snappy::Sink*)])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <snappy.h>],
Expand Down

0 comments on commit 809c6f2

Please sign in to comment.