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 <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-07-31 20:35:28 +02:00
parent bf55c668e5
commit 833ea6944d
3 changed files with 14 additions and 8 deletions

View file

@ -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)

View file

@ -362,7 +362,7 @@ libNetworkManager_la_LIBADD = \
$(LIBDL) \
$(LIBM)
if WITH_CONCHECK
if WITH_LIBSOUP
libNetworkManager_la_LIBADD += $(LIBSOUP_LIBS)
endif

View file

@ -47,7 +47,7 @@
#include "nm-dns-dnsmasq.h"
#include "nm-dns-unbound.h"
#if HAVE_LIBSOUP
#if WITH_LIBSOUP
#include <libsoup/soup.h>
#ifdef SOUP_CHECK_VERSION