Skip to content

Commit

Permalink
support abi versioning in minor numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
hanumantmk committed Nov 12, 2014
1 parent 8310f4d commit d29f17b
Show file tree
Hide file tree
Showing 4 changed files with 294 additions and 1 deletion.
55 changes: 55 additions & 0 deletions build/autotools/LDVersionScript.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ld-version-script.m4 serial 3
dnl Copyright (C) 2008-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl From Simon Josefsson

# FIXME: The test below returns a false positive for mingw
# cross-compiles, 'local:' statements does not reduce number of
# exported symbols in a DLL. Use --disable-ld-version-script to work
# around the problem.

# gl_LD_VERSION_SCRIPT
# --------------------
# Check if LD supports linker scripts, and define automake conditional
# HAVE_LD_VERSION_SCRIPT if so.
AC_DEFUN([gl_LD_VERSION_SCRIPT],
[
AC_ARG_ENABLE([ld-version-script],
AS_HELP_STRING([--enable-ld-version-script],
[enable linker version script (default is enabled when possible)]),
[have_ld_version_script=$enableval], [])
if test -z "$have_ld_version_script"; then
AC_MSG_CHECKING([if LD -Wl,--version-script works])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
cat > conftest.map <<EOF
foo
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[accepts_syntax_errors=yes], [accepts_syntax_errors=no])
if test "$accepts_syntax_errors" = no; then
cat > conftest.map <<EOF
VERS_1 {
global: sym;
};
VERS_2 {
global: sym;
} VERS_1;
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[have_ld_version_script=yes], [have_ld_version_script=no])
else
have_ld_version_script=no
fi
rm -f conftest.map
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT($have_ld_version_script)
fi
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
])

gl_LD_VERSION_SCRIPT()
232 changes: 232 additions & 0 deletions build/autotools/versions.ldscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
LIBMONGOC_1.0 {
global:
mongoc_bulk_operation_delete;
mongoc_bulk_operation_delete_one;
mongoc_bulk_operation_destroy;
mongoc_bulk_operation_execute;
mongoc_bulk_operation_insert;
mongoc_bulk_operation_new;
mongoc_bulk_operation_remove;
mongoc_bulk_operation_remove_one;
mongoc_bulk_operation_replace_one;
mongoc_bulk_operation_set_client;
mongoc_bulk_operation_set_collection;
mongoc_bulk_operation_set_database;
mongoc_bulk_operation_set_hint;
mongoc_bulk_operation_set_write_concern;
mongoc_bulk_operation_update;
mongoc_bulk_operation_update_one;
mongoc_cleanup;
mongoc_client_command;
mongoc_client_command_simple;
mongoc_client_destroy;
mongoc_client_get_collection;
mongoc_client_get_database;
mongoc_client_get_database_names;
mongoc_client_get_gridfs;
mongoc_client_get_max_bson_size;
mongoc_client_get_max_message_size;
mongoc_client_get_read_prefs;
mongoc_client_get_server_status;
mongoc_client_get_uri;
mongoc_client_get_write_concern;
mongoc_client_new;
mongoc_client_new_from_uri;
mongoc_client_pool_destroy;
mongoc_client_pool_new;
mongoc_client_pool_pop;
mongoc_client_pool_push;
mongoc_client_pool_set_ssl_opts;
mongoc_client_pool_try_pop;
mongoc_client_set_read_prefs;
mongoc_client_set_ssl_opts;
mongoc_client_set_stream_initiator;
mongoc_client_set_write_concern;
mongoc_collection_aggregate;
mongoc_collection_command;
mongoc_collection_command_simple;
mongoc_collection_count;
mongoc_collection_create_bulk_operation;
mongoc_collection_create_index;
mongoc_collection_delete;
mongoc_collection_destroy;
mongoc_collection_drop;
mongoc_collection_drop_index;
mongoc_collection_ensure_index;
mongoc_collection_find;
mongoc_collection_find_and_modify;
mongoc_collection_get_last_error;
mongoc_collection_get_name;
mongoc_collection_get_read_prefs;
mongoc_collection_get_write_concern;
mongoc_collection_insert;
mongoc_collection_insert_bulk;
mongoc_collection_keys_to_index_string;
mongoc_collection_remove;
mongoc_collection_rename;
mongoc_collection_save;
mongoc_collection_set_read_prefs;
mongoc_collection_set_write_concern;
mongoc_collection_stats;
mongoc_collection_update;
mongoc_collection_validate;
mongoc_cursor_clone;
mongoc_cursor_current;
mongoc_cursor_destroy;
mongoc_cursor_error;
mongoc_cursor_get_hint;
mongoc_cursor_get_host;
mongoc_cursor_is_alive;
mongoc_cursor_more;
mongoc_cursor_next;
mongoc_database_add_user;
mongoc_database_command;
mongoc_database_command_simple;
mongoc_database_create_collection;
mongoc_database_destroy;
mongoc_database_drop;
mongoc_database_get_collection;
mongoc_database_get_collection_names;
mongoc_database_get_name;
mongoc_database_get_read_prefs;
mongoc_database_get_write_concern;
mongoc_database_has_collection;
mongoc_database_remove_all_users;
mongoc_database_remove_user;
mongoc_database_set_read_prefs;
mongoc_database_set_write_concern;
mongoc_gridfs_create_file;
mongoc_gridfs_create_file_from_stream;
mongoc_gridfs_destroy;
mongoc_gridfs_drop;
mongoc_gridfs_file_destroy;
mongoc_gridfs_file_error;
mongoc_gridfs_file_get_aliases;
mongoc_gridfs_file_get_chunk_size;
mongoc_gridfs_file_get_content_type;
mongoc_gridfs_file_get_filename;
mongoc_gridfs_file_get_length;
mongoc_gridfs_file_get_md5;
mongoc_gridfs_file_get_metadata;
mongoc_gridfs_file_get_upload_date;
mongoc_gridfs_file_list_destroy;
mongoc_gridfs_file_list_error;
mongoc_gridfs_file_list_next;
mongoc_gridfs_file_readv;
mongoc_gridfs_file_remove;
mongoc_gridfs_file_save;
mongoc_gridfs_file_seek;
mongoc_gridfs_file_set_aliases;
mongoc_gridfs_file_set_content_type;
mongoc_gridfs_file_set_filename;
mongoc_gridfs_file_set_md5;
mongoc_gridfs_file_set_metadata;
mongoc_gridfs_file_tell;
mongoc_gridfs_file_writev;
mongoc_gridfs_find;
mongoc_gridfs_find_one;
mongoc_gridfs_find_one_by_filename;
mongoc_gridfs_get_chunks;
mongoc_gridfs_get_files;
mongoc_gridfs_remove_by_filename;
mongoc_index_opt_get_default;
mongoc_index_opt_init;
mongoc_init;
mongoc_log;
mongoc_log_default_handler;
mongoc_log_level_str;
mongoc_log_set_handler;
mongoc_matcher_destroy;
mongoc_matcher_match;
mongoc_matcher_new;
mongoc_read_prefs_add_tag;
mongoc_read_prefs_copy;
mongoc_read_prefs_destroy;
mongoc_read_prefs_get_mode;
mongoc_read_prefs_get_tags;
mongoc_read_prefs_is_valid;
mongoc_read_prefs_new;
mongoc_read_prefs_set_mode;
mongoc_read_prefs_set_tags;
mongoc_socket_accept;
mongoc_socket_bind;
mongoc_socket_close;
mongoc_socket_connect;
mongoc_socket_destroy;
mongoc_socket_errno;
mongoc_socket_getnameinfo;
mongoc_socket_getsockname;
mongoc_socket_listen;
mongoc_socket_new;
mongoc_socket_recv;
mongoc_socket_send;
mongoc_socket_sendv;
mongoc_socket_setsockopt;
mongoc_ssl_opt_get_default;
mongoc_stream_buffered_new;
mongoc_stream_close;
mongoc_stream_destroy;
mongoc_stream_file_get_fd;
mongoc_stream_file_new;
mongoc_stream_file_new_for_path;
mongoc_stream_flush;
mongoc_stream_get_base_stream;
mongoc_stream_gridfs_new;
mongoc_stream_read;
mongoc_stream_readv;
mongoc_stream_setsockopt;
mongoc_stream_socket_get_socket;
mongoc_stream_socket_new;
mongoc_stream_tls_check_cert;
mongoc_stream_tls_do_handshake;
mongoc_stream_tls_new;
mongoc_stream_writev;
mongoc_uri_copy;
mongoc_uri_destroy;
mongoc_uri_get_auth_mechanism;
mongoc_uri_get_auth_source;
mongoc_uri_get_database;
mongoc_uri_get_hosts;
mongoc_uri_get_options;
mongoc_uri_get_password;
mongoc_uri_get_read_prefs;
mongoc_uri_get_replica_set;
mongoc_uri_get_ssl;
mongoc_uri_get_string;
mongoc_uri_get_username;
mongoc_uri_get_write_concern;
mongoc_uri_new;
mongoc_uri_new_for_host_port;
mongoc_uri_unescape;
mongoc_write_concern_copy;
mongoc_write_concern_destroy;
mongoc_write_concern_get_fsync;
mongoc_write_concern_get_journal;
mongoc_write_concern_get_w;
mongoc_write_concern_get_wmajority;
mongoc_write_concern_get_wtag;
mongoc_write_concern_get_wtimeout;
mongoc_write_concern_new;
mongoc_write_concern_set_fsync;
mongoc_write_concern_set_journal;
mongoc_write_concern_set_w;
mongoc_write_concern_set_wmajority;
mongoc_write_concern_set_wtag;
mongoc_write_concern_set_wtimeout;
local:
*;
};

LIBMONGOC_1.1 {
global:
mongoc_collection_count_with_opts;
mongoc_collection_get_index_info;
mongoc_database_get_collection_info;
mongoc_index_opt_geo_get_default;
mongoc_index_opt_geo_init;
mongoc_rand_seed;
mongoc_rand_add;
mongoc_rand_status;
mongoc_uri_get_credentials;
mongoc_uri_get_mechanism_properties;
} LIBMONGOC_1.0;
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ m4_include([build/autotools/FindDependencies.m4])
m4_include([build/autotools/AutoHarden.m4])
m4_include([build/autotools/MaintainerFlags.m4])
m4_include([build/autotools/Optimizations.m4])
m4_include([build/autotools/LDVersionScript.m4])

# We would put AM_INIT_AUTOMAKE into SetupAutomake.m4, but seems to cause
# autoconf errors.
Expand Down
7 changes: 6 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ libmongoc_1_0_la_LDFLAGS = \
$(MONGOC_LDFLAGS_SHARED) \
$(MONGOC_LT_LDFLAGS) \
-no-undefined \
-export-symbols-regex "^mongoc_" \
-rpath $(libdir)

if HAVE_LD_VERSION_SCRIPT
libmongoc_1_0_la_LDFLAGS += -Wl,--version-script=$(srcdir)/build/autotools/versions.ldscript
else
libmongoc_1_0_la_LDFLAGS += -export-symbols-regex "^mongoc_"
endif

MONGOC_LIBADD_SHARED = \
$(BSON_LIBS) \
Expand All @@ -68,5 +72,6 @@ include src/tools/Makefile.am

EXTRA_DIST += \
src/libmongoc.symbols \
build/autotools/versions.ldscript \
src/libmongoc-1.0.pc.in \
src/libmongoc-ssl-1.0.pc.in

0 comments on commit d29f17b

Please sign in to comment.