[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-recutils] Use pkg-config to find check
From: |
Michał Masłowski |
Subject: |
[bug-recutils] Use pkg-config to find check |
Date: |
Fri, 10 Oct 2014 16:13:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hello. The following patch, at branch check-pkg-config of
git://git.mtjm.eu/mtjm-recutils.git, makes configure use pkg-config to
find check instead of passing only -lcheck to the compiler.
Current version fails to detect check as included in Debian Sid
(0.9.10-6.1), with the following errors in config.log:
configure:44859: checking for suite_create in -lcheck
configure:44884: gcc -std=gnu99 -std=gnu99 -o conftest -O2 -pipe -march=native
-Wall -W conftest.c -lcheck >&5
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libcheck.a(check.o):
In function `tcase_create':
(.text+0x194): undefined reference to `floor'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libcheck.a(check.o):
In function `tcase_create':
(.text+0x1a8): undefined reference to `floor'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libcheck.a(check.o):
In function `tcase_set_timeout':
(.text+0x435): undefined reference to `floor'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libcheck.a(check.o):
In function `tcase_set_timeout':
(.text+0x449): undefined reference to `floor'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libcheck.a(check_pack.o):
In function `ppack':
(.text+0x4dd): undefined reference to `__pthread_register_cancel'
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libcheck.a(check_pack.o):
In function `ppack':
(.text+0x511): undefined reference to `__pthread_unregister_cancel'
collect2: error: ld returned 1 exit status
This results from libcheck.a requiring additional options for linking.
Since check.pc specifies these options, we can use pkg-config to add
them.
I don't know which version it should depend on (README-dev stated that
the svn version was needed in 2011, this suggests 0.9.9 being possibly
the first supported version, while I haven't checked it), so it accepts
any version.
From e02f58116184ff13ecd6b7233ede8354aa617e2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= <address@hidden>
Date: Fri, 10 Oct 2014 15:27:12 +0200
Subject: [PATCH] Use pkg-config to find check.
This allows using check as packaged in Debian Sid where it requires
additional compilation and linking options.
---
ChangeLog | 8 ++++++++
configure.ac | 7 ++-----
torture/Makefile.am | 3 ++-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 75290bf..3dbcc64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-10-10 Michał Masłowski <address@hidden>
+
+ Fix detection of check on systems where it needs extra CFLAGS or
+ libraries.
+ * configure.ac: Use PKG_CHECK_MODULES to detect check.
+ * torture/Makefile.am (runtests_CFLAGS, runtests_LDADD): Pass
+ CFLAGS and LIBS that pkg-config specifies for check.
+
2014-04-20 Jose E. Marchesi <address@hidden>
src,torture: fix evaluation of sexes containing #NAME expressions.
diff --git a/configure.ac b/configure.ac
index b31039f..c5cb6d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,12 +78,9 @@ AC_FUNC_FSEEKO
dnl Search for required libraries
have_check=no
-AC_CHECK_LIB([check],[suite_create],[have_check=yes],)
+PKG_CHECK_MODULES([CHECK], [check],
+ [have_check=yes], [have_check=no])
AM_CONDITIONAL([CHECK], [test "x$have_check" != "xno"])
-if test "x$have_check" = "xyes"; then
- CHECKLIBS=-lcheck
-fi
-AC_SUBST([CHECKLIBS])
have_curl=no
AC_CHECK_LIB([curl],[curl_global_init],[have_curl=yes],)
diff --git a/torture/Makefile.am b/torture/Makefile.am
index 38e4e77..6291a9e 100644
--- a/torture/Makefile.am
+++ b/torture/Makefile.am
@@ -152,7 +152,8 @@ runtests_SOURCES = runtests.c \
AM_CPPFLAGS = -I$(top_srcdir)/src \
-I$(top_srcdir)/torture
-runtests_LDADD = $(CHECKLIBS) ../src/librec.la
+runtests_CFLAGS = $(CHECK_CFLAGS)
+runtests_LDADD = $(CHECK_LIBS) ../src/librec.la
clean-local:
-rm -f tests.log
--
2.1.1
pgpAhYB1komOm.pgp
Description: PGP signature
- [bug-recutils] Use pkg-config to find check,
Michał Masłowski <=