From 1a98e049dc36fc4d385a9a6d02beb73e816a6353 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 9 Oct 2013 17:40:25 -0700 Subject: Try to read the libdivecomputer.la file (created by GNU libtool) Getting dependency information for static libraries requires extra files. Libtool creates .la files, which are "industry standard". qmake has its own .prl files, but it can create .la in a pinch if necessary. This change allows us to get the actual dependency information from libdivecomputer, without having to guess whether it linked to something else or not. If it changes in the future, we shouldn't have to do anything. Signed-off-by: Thiago Macieira Signed-off-by: Dirk Hohndel --- subsurface-configure.pri | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/subsurface-configure.pri b/subsurface-configure.pri index d75af3c86..dc98867a3 100644 --- a/subsurface-configure.pri +++ b/subsurface-configure.pri @@ -42,20 +42,28 @@ PKG_CONFIG_OUT = $$system(pkg-config --version 2> $$NUL) # find it next to our sources INCLUDEPATH += ../libdivecomputer/include LIBS += ../libdivecomputer/src/.libs/libdivecomputer.a + LIBDC_LA = ../libdivecomputer/src/libdivecomputer.la } else:exists(/usr/local/lib/libdivecomputer.a) { LIBS += /usr/local/lib/libdivecomputer.a + LIBDC_LA = /usr/local/lib/libdivecomputer.la } else:exists(/usr/local/lib64/libdivecomputer.a) { LIBS += /usr/local/lib64/libdivecomputer.a + LIBDC_LA = /usr/local/lib64/libdivecomputer.la } else:link_pkgconfig { - # find it via pkg-config - PKGCONFIG += libdivecomputer + # find it via pkg-config, but we need to pass the --static flag, + # so we can't use the PKGCONFIG variable. + LIBS += $$system("pkg-config --static --libs libdivecomputer") + LIBDC_CFLAGS = $$system("pkg-config --static --cflags libdivecomputer") + QMAKE_CFLAGS += $$LIBDC_CFLAGS + QMAKE_CXXFLAGS += $$LIBDC_CFLAGS + unset(LIBDC_CFLAGS) } -# Libusb-1.0 is only required if libdivecomputer was built with it. -# And libdivecomputer is only built with it if libusb-1.0 is -# installed. So get libusb if it exists, but don't complain -# about it if it doesn't. -link_pkgconfig: packagesExist(libusb-1.0): PKGCONFIG += libusb-1.0 +!isEmpty(LIBDC_LA):exists($$LIBDC_LA) { + # Source the libtool .la file to get the dependent libs + LIBS += $$system(". $$LIBDC_LA && echo \$dependency_libs") + unset(LIBDC_LA) +} # # Find libxml2 and libxslt -- cgit v1.2.3-70-g09d2