Files
kiwix-build/patches/xapian_pkgconfig.patch
Matthieu Gautier 6b85f7d012 Update xapian patch for pkg_config.
AC_SEARCH_LIBS try to compile and use a symbol (timer_create) using
a lib (rt).

But, in fact, it also try to use the symbol but without using the lib.
If it's work, it consider that the libs is found and set the ac_res
variable to "none required".

So, we must check the value of ac_res to know if we must add '-lrt' to
the pkg-config file.
2017-03-13 13:18:14 +01:00

111 lines
3.7 KiB
Diff

diff -ur xapian-core-1.4.0/configure.ac xapian-core-1.4.0-patched/configure.ac
--- xapian-core-1.4.0/configure.ac 2016-06-25 17:36:49.000000000 +0200
+++ xapian-core-1.4.0-patched/configure.ac 2017-02-22 17:45:57.066365636 +0100
@@ -393,22 +393,25 @@
esac
dnl We use timer_create() if available to implement a search time limit.
+use_rt_lib=0
SAVE_LIBS=$LIBS
-AC_SEARCH_LIBS([timer_create], [rt],
- [
+AC_SEARCH_LIBS([timer_create], [rt], [
AC_MSG_CHECKING([for timer_create() usability])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
[[#if defined _AIX || defined __GNU__
#error timer_create known not to work
#endif]])],
- [AC_MSG_RESULT([yes])
- XAPIAN_LIBS="$LIBS $XAPIAN_LIBS"
- AC_DEFINE([HAVE_TIMER_CREATE], [1], [Define to 1 if you have the 'timer_create' function.])]
- ,
- [AC_MSG_RESULT([no])
- ])
+ [AC_MSG_RESULT([yes])
+ XAPIAN_LIBS="$LIBS $XAPIAN_LIBS"
+ AC_DEFINE([HAVE_TIMER_CREATE], [1], [Define to 1 if you have the 'timer_create' function.])
+ AS_IF([test "$ac_res" != "none required"], use_rt_lib=1)
+ ],
+ [AC_MSG_RESULT([no])]
+ )
])
LIBS=$SAVE_LIBS
+AM_CONDITIONAL([USE_RT_LIB], [test "$use_rt_lib" = 1])
dnl Used by tests/soaktest/soaktest.cc
AC_CHECK_FUNCS([srandom random])
diff -ur xapian-core-1.4.0/configure xapian-core-1.4.0-patched/configure
--- xapian-core-1.4.0/configure 2016-06-25 17:39:25.000000000 +0200
+++ xapian-core-1.4.0-patched/configure 2017-02-22 17:45:44.472585524 +0100
@@ -671,6 +671,8 @@
DOCUMENTATION_RULES_FALSE
DOCUMENTATION_RULES_TRUE
PERL
+USE_RT_LIB_FALSE
+USE_RT_LIB_TRUE
ldflags
XAPIAN_LIBS
XAPIAN_LDFLAGS
@@ -18247,6 +18249,7 @@
;;
esac
+use_rt_lib=0
SAVE_LIBS=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing timer_create" >&5
$as_echo_n "checking for library containing timer_create... " >&6; }
@@ -18320,10 +18323,13 @@
if ac_fn_cxx_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- XAPIAN_LIBS="$LIBS $XAPIAN_LIBS"
+ XAPIAN_LIBS="$LIBS $XAPIAN_LIBS"
$as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
+ if test "$ac_res" != "none required"; then :
+ use_rt_lib=1
+fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -18335,6 +18341,14 @@
fi
LIBS=$SAVE_LIBS
+ if test "$use_rt_lib" = 1; then
+ USE_RT_LIB_TRUE=
+ USE_RT_LIB_FALSE='#'
+else
+ USE_RT_LIB_TRUE='#'
+ USE_RT_LIB_FALSE=
+fi
+
for ac_func in srandom random
do :
@@ -20854,6 +20868,10 @@
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${USE_RT_LIB_TRUE}" && test -z "${USE_RT_LIB_FALSE}"; then
+ as_fn_error $? "conditional \"USE_RT_LIB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DOCUMENTATION_RULES_TRUE}" && test -z "${DOCUMENTATION_RULES_FALSE}"; then
as_fn_error $? "conditional \"DOCUMENTATION_RULES\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff -ur xapian-core-1.4.0/pkgconfig/xapian-core.pc.in xapian-core-1.4.0-patched/pkgconfig/xapian-core.pc.in
--- xapian-core-1.4.0/pkgconfig/xapian-core.pc.in 2016-06-25 17:36:49.000000000 +0200
+++ xapian-core-1.4.0-patched/pkgconfig/xapian-core.pc.in 2017-02-22 17:09:12.488793901 +0100
@@ -11,4 +11,6 @@
URL: https://xapian.org/
Version: @VERSION@
Cflags: -I${includedir} @abi_affecting_cxxflags@
-Libs: @ldflags@ -L${libdir} -lxapian@LIBRARY_VERSION_SUFFIX@
+@USE_RT_LIB_TRUE@Libs: @ldflags@ -L${libdir} -lxapian@LIBRARY_VERSION_SUFFIX@ -lrt
+@USE_RT_LIB_FALSE@Libs: @ldflags@ -L${libdir} -lxapian@LIBRARY_VERSION_SUFFIX@
+@USE_WIN32_UUID_API_FALSE@Requires: uuid