From 0f0de64dc63ae4d1fd1c0ad0676f80dbbee00e0e Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sat, 5 Dec 2015 17:09:00 +0100 Subject: [PATCH] mosquitto plugin: fixup flag handling Split build flags in _LDFLAGS and _LIBS Keep existing CPPFLAGS and LDFLAGS set from the command line. This ensures we will pick up libmosquitto when running ./configure CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib", just like we do for other plugins. --- configure.ac | 14 ++++++++------ src/Makefile.am | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 2a9b84a9..0328b3bc 100644 --- a/configure.ac +++ b/configure.ac @@ -2668,13 +2668,13 @@ AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes") # --with-libmosquitto {{{ with_libmosquitto_cppflags="" -with_libmosquitto_libs="-lmosquitto" +with_libmosquitto_ldflags="" AC_ARG_WITH(libmosquitto, [AS_HELP_STRING([--with-libmosquitto@<:@=PREFIX@:>@], [Path to libmosquitto.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then with_libmosquitto_cppflags="-I$withval/include" - with_libmosquitto_libs="-L$withval/lib -lmosquitto" + with_libmosquitto_ldflags="-L$withval/lib" with_libmosquitto="yes" else with_libmosquitto="$withval" @@ -2686,7 +2686,7 @@ AC_ARG_WITH(libmosquitto, [AS_HELP_STRING([--with-libmosquitto@<:@=PREFIX@:>@], if test "x$with_libmosquitto" = "xyes" then SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$with_libmosquitto_cppflags" + CPPFLAGS="$CPPFLAGS $with_libmosquitto_cppflags" AC_CHECK_HEADERS(mosquitto.h, [with_libmosquitto="yes"], [with_libmosquitto="no (mosquitto.h not found)"]) @@ -2696,8 +2696,8 @@ if test "x$with_libmosquitto" = "xyes" then SAVE_LDFLAGS="$LDFLAGS" SAVE_CPPFLAGS="$CPPFLAGS" - LDFLAGS="$with_libmosquitto_libs" - CPPFLAGS="$with_libmosquitto_cppflags" + LDFLAGS="$LDFLAGS $with_libmosquitto_ldflags" + CPPFLAGS="$CPPFLAGS $with_libmosquitto_cppflags" AC_CHECK_LIB(mosquitto, mosquitto_connect, [with_libmosquitto="yes"], [with_libmosquitto="no (libmosquitto not found)"]) @@ -2707,8 +2707,10 @@ fi if test "x$with_libmosquitto" = "xyes" then BUILD_WITH_LIBMOSQUITTO_CPPFLAGS="$with_libmosquitto_cppflags" - BUILD_WITH_LIBMOSQUITTO_LIBS="$with_libmosquitto_libs" + BUILD_WITH_LIBMOSQUITTO_LDFLAGS="$with_libmosquitto_ldflags" + BUILD_WITH_LIBMOSQUITTO_LIBS="-lmosquitto" AC_SUBST(BUILD_WITH_LIBMOSQUITTO_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBMOSQUITTO_LDFLAGS) AC_SUBST(BUILD_WITH_LIBMOSQUITTO_LIBS) fi # }}} diff --git a/src/Makefile.am b/src/Makefile.am index 6267a310..9c1e32fb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -643,8 +643,8 @@ endif if BUILD_PLUGIN_MQTT pkglib_LTLIBRARIES += mqtt.la mqtt_la_SOURCES = mqtt.c -mqtt_la_LDFLAGS = $(PLUGIN_LDFLAGS) mqtt_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBMOSQUITTO_CPPFLAGS) +mqtt_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBMOSQUITTO_LDFLAGS) mqtt_la_LIBADD = $(BUILD_WITH_LIBMOSQUITTO_LIBS) endif -- 2.11.0