package/asterisk: enable for uclibc toolchains
authorBernd Kuhls <bernd.kuhls@t-online.de>
Sun, 14 Oct 2018 09:01:56 +0000 (11:01 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sun, 9 Dec 2018 21:23:08 +0000 (22:23 +0100)
This patch extends the configure checks for re-entrant resolver
functions to fix uclibc builds.

Quoting Yann:
http://lists.busybox.net/pipermail/buildroot/2017-September/203004.html

"As a final stroke of genius, asterisk checks for the re-entrant variant
of res_ninit(), and concludes that all such functions are available,
including res_nsearch(). Uclibc-ng has the former but not the latter, so
the build fails. Since there is no cache variable for that check, we
can't pre-feed that result to configure, and fixing it is a bigger
endeavour. So we make asterisk depend on glibc for now, until someone
is brave enough to fix it."

Musl builds are still broken:

output/build/asterisk-16.0.0/include/asterisk/astmm.h:165:35:
 error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘->’ token
  Do_not_use_calloc__use_ast_calloc->fail(a, b)

output/build/asterisk-16.0.0/include/asterisk/astmm.h:169:77:
 error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘->’ token
  Do_not_use_free__use_ast_free_or_ast_std_free_for_remotely_allocated_memory->fail(a)

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/asterisk/0005-configure-fix-detection-of-re-entrant-resolver-funct.patch [new file with mode: 0644]
package/asterisk/Config.in
package/asterisk/asterisk.mk

diff --git a/package/asterisk/0005-configure-fix-detection-of-re-entrant-resolver-funct.patch b/package/asterisk/0005-configure-fix-detection-of-re-entrant-resolver-funct.patch
new file mode 100644 (file)
index 0000000..bee8fdb
--- /dev/null
@@ -0,0 +1,38 @@
+From 9b4070944578336506cd0a76de6f733c72d0ca74 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <yann.morin.1998@free.fr>
+Date: Sat, 13 Oct 2018 11:11:15 +0200
+Subject: [PATCH] configure: fix detection of re-entrant resolver functions
+
+Fixes https://issues.asterisk.org/jira/browse/ASTERISK-21795
+
+uClibc does not provide res_nsearch:
+asterisk-16.0.0/main/dns.c:506: undefined reference to `res_nsearch'
+
+Patch coded by Yann E. MORIN:
+http://lists.busybox.net/pipermail/buildroot/2018-October/232630.html
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ configure.ac | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index dd0c8edd13..ee1ca9ceb6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1388,7 +1388,11 @@ AC_LINK_IFELSE(
+                       #include <arpa/nameser.h>
+                       #endif
+                       #include <resolv.h>],
+-                      [int foo = res_ninit(NULL);])],
++                      [
++                              int foo;
++                              foo = res_ninit(NULL);
++                              foo = res_nsearch(NULL, NULL, 0, 0, NULL, 0);
++                      ])],
+       AC_MSG_RESULT(yes)
+       AC_DEFINE([HAVE_RES_NINIT], 1, [Define to 1 if your system has the re-entrant resolver functions.])
+       AC_SEARCH_LIBS(res_9_ndestroy, resolv)
+-- 
+2.19.1
+
index cfea18102696d6deaccde4869f242eb68f700e11..b55bc0174d54d886e35ebde05b47d776fbb2eee9 100644 (file)
@@ -1,9 +1,8 @@
 config BR2_PACKAGE_ASTERISK
        bool "asterisk"
-       # Uses glibc resolver function res_nsearch()
-       depends on BR2_TOOLCHAIN_USES_GLIBC
        depends on BR2_INSTALL_LIBSTDCPP
        depends on !BR2_STATIC_LIBS # dlfcn.h
+       depends on !BR2_TOOLCHAIN_USES_MUSL
        depends on BR2_USE_MMU # libedit
        depends on BR2_USE_WCHAR # libedit
        select BR2_PACKAGE_JANSSON
@@ -25,7 +24,7 @@ config BR2_PACKAGE_ASTERISK
 
          http://www.asterisk.org/
 
-comment "asterisk needs a glibc toolchain w/ C++, dynamic library, wchar"
+comment "asterisk needs a glibc or uClibc toolchain w/ C++, dynamic library, wchar"
        depends on BR2_USE_MMU
-       depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP \
+       depends on BR2_TOOLCHAIN_USES_MUSL || !BR2_INSTALL_LIBSTDCPP \
                || BR2_STATIC_LIBS || !BR2_USE_WCHAR
index eb663a75bfad23e75a67f0e5d659649e79289bc2..8a46438f923c346bd2a4fdb489bfbe14d53a8d47 100644 (file)
@@ -21,7 +21,7 @@ ASTERISK_LICENSE_FILES = \
        codecs/speex/speex_resampler.h \
        utils/db1-ast/include/db.h
 
-# For patches 0002 and 0003
+# For patches 0002, 0003 and 0005
 ASTERISK_AUTORECONF = YES
 ASTERISK_AUTORECONF_OPTS = -Iautoconf -Ithird-party -Ithird-party/pjproject