From 833ea6944d5abeb05d9fd36cf5176fd6ce1bde7a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 31 Jul 2014 20:35:28 +0200 Subject: [PATCH] build: fix linker error for '--disable-concheck' and add '--with-libsoup' When building with '--disable-concheck' with libsoup installed, configure would set HAVE_LIBSOUP. But without connection checking, we didn't link against libsoup, resulting in a linker error. Add a new configure option '--with-libsoup' / '--without-libsoup' to control whether linking against libsoup. The combination '--without-libsoup --enable-concheck' does not make sense. https://bugzilla.gnome.org/show_bug.cgi?id=734062 Signed-off-by: Thomas Haller --- configure.ac | 18 ++++++++++++------ src/Makefile.am | 2 +- src/dns-manager/nm-dns-manager.c | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 9694d88a49..d13057db4a 100644 --- a/configure.ac +++ b/configure.ac @@ -693,17 +693,23 @@ AC_DEFINE_UNQUOTED(KERNEL_FIRMWARE_DIR, "$KERNEL_FIRMWARE_DIR", [Define to path AC_SUBST(KERNEL_FIRMWARE_DIR) PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26], [have_libsoup=yes],[have_libsoup=no]) -if test "$have_libsoup" = "yes"; then - AC_DEFINE(HAVE_LIBSOUP, 1, [Define if you have libsoup]) +AC_ARG_WITH(libsoup, AS_HELP_STRING([--with-libsoup=yes|no], [Link against libsoup]), [], [with_libsoup=${have_libsoup}]) +if test "$with_libsoup" != "no"; then + if test "$have_libsoup" != "yes"; then + AC_MSG_ERROR(libsoup library not found) + fi + with_libsoup='yes' + AC_DEFINE(WITH_LIBSOUP, 1, [Define if you have libsoup]) else - AC_DEFINE(HAVE_LIBSOUP, 0, [Define if you have libsoup]) + AC_DEFINE(WITH_LIBSOUP, 0, [Define if you have libsoup]) fi +AM_CONDITIONAL(WITH_LIBSOUP, test "$with_libsoup" != "no") AC_ARG_ENABLE(concheck, AS_HELP_STRING([--enable-concheck], [enable connectivity checking support]), - [enable_concheck=${enableval}], [enable_concheck=${have_libsoup}]) + [enable_concheck=${enableval}], [enable_concheck=${with_libsoup}]) if (test "${enable_concheck}" = "yes"); then - if test x"$have_libsoup" = x"no"; then - AC_MSG_ERROR(Connectivity checking requires libsoup development headers) + if test x"$with_libsoup" = x"no"; then + AC_MSG_ERROR(Connectivity checking requires libsoup) fi AC_SUBST(LIBSOUP_CFLAGS) AC_SUBST(LIBSOUP_LIBS) diff --git a/src/Makefile.am b/src/Makefile.am index 681a48f15b..b637ebfc2c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -362,7 +362,7 @@ libNetworkManager_la_LIBADD = \ $(LIBDL) \ $(LIBM) -if WITH_CONCHECK +if WITH_LIBSOUP libNetworkManager_la_LIBADD += $(LIBSOUP_LIBS) endif diff --git a/src/dns-manager/nm-dns-manager.c b/src/dns-manager/nm-dns-manager.c index 4e90068d8d..4471cb8f40 100644 --- a/src/dns-manager/nm-dns-manager.c +++ b/src/dns-manager/nm-dns-manager.c @@ -47,7 +47,7 @@ #include "nm-dns-dnsmasq.h" #include "nm-dns-unbound.h" -#if HAVE_LIBSOUP +#if WITH_LIBSOUP #include #ifdef SOUP_CHECK_VERSION