[Asterisk-code-review] BuildSystem: Enable dladdr on non-Linux platforms like FreeBSD. (asterisk[15])
Alexander Traud
asteriskteam at digium.com
Fri Mar 9 02:46:00 CST 2018
Alexander Traud has uploaded this change for review. ( https://gerrit.asterisk.org/8491
Change subject: BuildSystem: Enable dladdr on non-Linux platforms like FreeBSD.
......................................................................
BuildSystem: Enable dladdr on non-Linux platforms like FreeBSD.
ASTERISK-27641
Change-Id: I587e8ba0123c70fc10cfd8b0ac3299551f61d84b
---
M configure
M configure.ac
2 files changed, 52 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/91/8491/1
diff --git a/configure b/configure
index 2456b0c..4f3e0cc 100755
--- a/configure
+++ b/configure
@@ -19386,6 +19386,41 @@
conftest$ac_exeext conftest.$ac_ext
LIBS=${old_LIBS}
+# re-check without -ldl
+# Non-Linux platforms like FreeBSD and NetBSD do not need a library libdl.so.
+if test "${PBX_DLADDR}" = "0"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dladdr in dlfcn.h without -ldl" >&5
+$as_echo_n "checking for dladdr in dlfcn.h without -ldl... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _GNU_SOURCE 1
+#include <dlfcn.h>
+int
+main ()
+{
+dladdr((void *)0, (void *)0)
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ PBX_DLADDR=1
+
+
+$as_echo "#define HAVE_DLADDR 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+
# PKGCONFIG is used in later tests
diff --git a/configure.ac b/configure.ac
index 571987c..ba2d8dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1437,6 +1437,23 @@
)
LIBS=${old_LIBS}
+# re-check without -ldl
+# Non-Linux platforms like FreeBSD and NetBSD do not need a library libdl.so.
+if test "${PBX_DLADDR}" = "0"; then
+ AC_MSG_CHECKING(for dladdr in dlfcn.h without -ldl)
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([#define _GNU_SOURCE 1
+#include <dlfcn.h>],
+ [dladdr((void *)0, (void *)0)]
+ )],
+ AC_MSG_RESULT(yes)
+ PBX_DLADDR=1
+ AC_SUBST([PBX_DLADDR])
+ AC_DEFINE([HAVE_DLADDR], 1, [Define to 1 if your system has the dladdr() GNU extension]),
+ AC_MSG_RESULT(no)
+ )
+fi
+
# PKGCONFIG is used in later tests
PKG_PROG_PKG_CONFIG()
--
To view, visit https://gerrit.asterisk.org/8491
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I587e8ba0123c70fc10cfd8b0ac3299551f61d84b
Gerrit-Change-Number: 8491
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180309/fd6894de/attachment.html>
More information about the asterisk-code-review
mailing list