Code

when --with-librdkafka arg is not a path searched by linker
authorciomaire <cmacaniomaire@gmail.com>
Fri, 8 May 2015 14:48:54 +0000 (07:48 -0700)
committerciomaire <cmacaniomaire@gmail.com>
Fri, 8 May 2015 14:48:54 +0000 (07:48 -0700)
configure.ac
src/Makefile.am

index 6a48b72642a358367e40907c51582f1ebbce8c0c..e6b369376682816cc30e4b9dd9e98e6d91209bac 100644 (file)
@@ -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)
index 5303c8a99d80b88dc88a005354bf10ed69182297..8bc7909baf6cd15c96c22c9a24924932492246f7 100644 (file)
@@ -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