Skip to content

Commit 8b5d114

Browse files
committed
Try a bit harder to detect leveldb.
Some distributions only have static libraries packaged, which requires a bit more effort (explicitly listing libraries it depends on).
1 parent d6c402e commit 8b5d114

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

Makefile.am

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ cpp_server_ct_server_LDADD = \
160160
cpp/libcore.a \
161161
$(json_c_LIBS) \
162162
$(libevent_LIBS) \
163-
-lcrypto -lprotobuf -lsqlite3 -lleveldb -lsnappy
163+
$(leveldb_LIBS) \
164+
-lcrypto -lprotobuf -lsqlite3
164165
cpp_server_ct_server_SOURCES = \
165166
cpp/client/async_log_client.cc \
166167
cpp/proto/serializer.cc \
@@ -282,7 +283,8 @@ cpp_log_cluster_state_controller_test_LDADD = \
282283
cpp/libtest.a \
283284
$(json_c_LIBS) \
284285
$(libevent_LIBS) \
285-
-lprotobuf -lsqlite3 -lcrypto -lleveldb -lsnappy
286+
$(leveldb_LIBS) \
287+
-lprotobuf -lsqlite3 -lcrypto
286288
cpp_log_cluster_state_controller_test_SOURCES = \
287289
cpp/client/async_log_client.cc \
288290
cpp/log/cluster_state_controller_test.cc \
@@ -299,7 +301,8 @@ cpp_log_database_test_LDADD = \
299301
cpp/libcore.a \
300302
cpp/libtest.a \
301303
$(libevent_LIBS) \
302-
-lprotobuf -lsqlite3 -lcrypto -lleveldb -lsnappy
304+
$(leveldb_LIBS) \
305+
-lprotobuf -lsqlite3 -lcrypto
303306
cpp_log_database_test_SOURCES = \
304307
cpp/log/database_test.cc \
305308
cpp/log/test_signer.cc \
@@ -327,7 +330,8 @@ cpp_log_file_storage_test_LDADD = \
327330
cpp/libcore.a \
328331
cpp/libtest.a \
329332
$(libevent_LIBS) \
330-
-lprotobuf -lcrypto -lsqlite3 -lleveldb -lsnappy
333+
$(leveldb_LIBS) \
334+
-lprotobuf -lcrypto -lsqlite3
331335
cpp_log_file_storage_test_SOURCES = \
332336
cpp/log/file_storage.cc \
333337
cpp/log/file_storage_test.cc \
@@ -340,7 +344,8 @@ cpp_log_frontend_signer_test_LDADD = \
340344
cpp/libtest.a \
341345
$(json_c_LIBS) \
342346
$(libevent_LIBS) \
343-
-lprotobuf -lcrypto -lsqlite3 -lleveldb -lsnappy
347+
$(leveldb_LIBS) \
348+
-lprotobuf -lcrypto -lsqlite3
344349
cpp_log_frontend_signer_test_SOURCES = \
345350
cpp/log/frontend_signer_test.cc \
346351
cpp/log/test_signer.cc \
@@ -357,7 +362,8 @@ cpp_log_log_lookup_test_LDADD = \
357362
cpp/libtest.a \
358363
$(json_c_LIBS) \
359364
$(libevent_LIBS) \
360-
-lprotobuf -lcrypto -lsqlite3 -lleveldb -lsnappy
365+
$(leveldb_LIBS) \
366+
-lprotobuf -lcrypto -lsqlite3
361367
cpp_log_log_lookup_test_SOURCES = \
362368
cpp/log/log_lookup_test.cc \
363369
cpp/log/test_signer.cc \
@@ -409,7 +415,8 @@ cpp_log_tree_signer_test_LDADD = \
409415
cpp/libtest.a \
410416
$(json_c_LIBS) \
411417
$(libevent_LIBS) \
412-
-lprotobuf -lcrypto -lsqlite3 -lleveldb -lsnappy
418+
$(leveldb_LIBS) \
419+
-lprotobuf -lcrypto -lsqlite3
413420
cpp_log_tree_signer_test_SOURCES = \
414421
cpp/log/test_signer.cc \
415422
cpp/log/tree_signer_test.cc \
@@ -550,7 +557,8 @@ cpp_util_masterelection_test_LDADD = \
550557
cpp/libtest.a \
551558
$(json_c_LIBS) \
552559
$(libevent_LIBS) \
553-
-lprotobuf -lleveldb -lsnappy
560+
$(leveldb_LIBS) \
561+
-lprotobuf
554562
cpp_util_masterelection_test_SOURCES = \
555563
cpp/util/json_wrapper.cc \
556564
cpp/util/libevent_wrapper.cc \
@@ -645,7 +653,8 @@ cpp_log_database_large_test_LDADD = \
645653
cpp/libcore.a \
646654
cpp/libtest.a \
647655
$(libevent_LIBS) \
648-
-lprotobuf -lcrypto -lsqlite3 -lleveldb -lsnappy
656+
$(leveldb_LIBS) \
657+
-lprotobuf -lcrypto -lsqlite3
649658
cpp_log_database_large_test_SOURCES = \
650659
cpp/log/database_large_test.cc \
651660
cpp/log/test_signer.cc \
@@ -658,7 +667,8 @@ cpp_log_frontend_test_LDADD = \
658667
cpp/libtest.a \
659668
$(json_c_LIBS) \
660669
$(libevent_LIBS) \
661-
-lprotobuf -lcrypto -lsqlite3 -lleveldb -lsnappy
670+
$(leveldb_LIBS) \
671+
-lprotobuf -lcrypto -lsqlite3
662672
cpp_log_frontend_test_SOURCES = \
663673
cpp/log/frontend_test.cc \
664674
cpp/log/test_signer.cc \

configure.ac

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ AC_MSG_RESULT([$have_glog])
7474
AS_IF([test "x$have_glog" = "xno"],
7575
[AC_MSG_ERROR([glog library could not be found])])
7676

77+
save_LIBS="$LIBS"
78+
AS_UNSET([LIBS])
79+
AC_SEARCH_LIBS([snappy_compress], [snappy],,, [$save_LIBS])
80+
AC_SEARCH_LIBS([leveldb_open], [leveldb],, [missing_leveldb=1], [$save_LIBS])
81+
AC_SUBST([leveldb_LIBS], [$LIBS])
82+
AS_IF([test -n "$missing_leveldb"],
83+
[AC_MSG_ERROR([could not find the leveldb/snappy libraries])])
84+
LIBS="$save_LIBS"
85+
7786
save_LIBS="$LIBS"
7887
AS_UNSET([LIBS])
7988
AC_SEARCH_LIBS([event_base_dispatch], [event],, [missing_libevent=1],

0 commit comments

Comments
 (0)