From f8cecf10d4f3466fe59949554ab368ae4dd0d225 Mon Sep 17 00:00:00 2001 From: ciomaire Date: Fri, 8 May 2015 07:48:54 -0700 Subject: [PATCH] when --with-librdkafka arg is not a path searched by linker --- configure.ac | 11 ++++++++++- src/Makefile.am | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6a48b726..e6b36937 100644 --- a/configure.ac +++ b/configure.ac @@ -3722,6 +3722,7 @@ AC_ARG_WITH(librdkafka, [AS_HELP_STRING([--with-librdkafka@<:@=PREFIX@:>@], [Pat then with_librdkafka_cppflags="-I$withval/include" with_librdkafka_ldflags="-L$withval/lib" + with_librdkafka_rpath="$withval/lib" with_librdkafka="yes" else with_librdkafka="$withval" @@ -3733,6 +3734,9 @@ AC_ARG_WITH(librdkafka, [AS_HELP_STRING([--with-librdkafka@<:@=PREFIX@:>@], [Pat SAVE_CPPFLAGS="$CPPFLAGS" SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS $with_librdkafka_cppflags" +LDFLAGS="$LDFLAGS $with_librdkafka_ldflags" + if test "x$with_librdkafka" = "xyes" then AC_CHECK_HEADERS(librdkafka/rdkafka.h, [with_librdkafka="yes"], [with_librdkafka="no (librdkafka/rdkafka.h not found)"]) @@ -3748,7 +3752,12 @@ if test "x$with_librdkafka" = "xyes" then BUILD_WITH_LIBRDKAFKA_CPPFLAGS="$with_librdkafka_cppflags" BUILD_WITH_LIBRDKAFKA_LDFLAGS="$with_librdkafka_ldflags" - BUILD_WITH_LIBRDKAFKA_LIBS="-lrdkafka" + if test "x$with_librdkafka_rpath" != "x" + then + BUILD_WITH_LIBRDKAFKA_LIBS="-Wl,-rpath,$with_librdkafka_rpath -lrdkafka" + else + BUILD_WITH_LIBRDKAFKA_LIBS="-lrdkafka" + fi AC_SUBST(BUILD_WITH_LIBRDKAFKA_CPPFLAGS) AC_SUBST(BUILD_WITH_LIBRDKAFKA_LDFLAGS) AC_SUBST(BUILD_WITH_LIBRDKAFKA_LIBS) diff --git a/src/Makefile.am b/src/Makefile.am index 5303c8a9..8bc7909b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1188,6 +1188,7 @@ write_kafka_la_SOURCES = write_kafka.c \ utils_format_json.c utils_format_json.h \ utils_cmd_putval.c utils_cmd_putval.h \ utils_crc32.c utils_crc32.h +write_kafka_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBRDKAFKA_CPPFLAGS) write_kafka_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBRDKAFKA_LDFLAGS) write_kafka_la_LIBADD = $(BUILD_WITH_LIBRDKAFKA_LIBS) endif -- 2.11.0