From 70523b5014574f15b4edbd78243b6004525f3839 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 12 Aug 2013 09:09:32 +0000 Subject: On some platforms, to get dladdr() you need to link with -ldl. First try it without -ldl (in case the OS doesn't have it - not a good idea, as it complicates the build process for cross-platform tools that might require it on other platforms, but "not a good idea" never stopped UN*X vendors in the past) and, if that fails, try it with -ldl. svn path=/trunk/; revision=51309 --- acinclude.m4 | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 687b25d3aa..e825dc1e93 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -637,6 +637,42 @@ AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK], LIBS="$ac_save_LIBS" ]) +# +# AC_WIRESHARK_CHECK_DLADDR +# +AC_DEFUN([AC_WIRESHARK_CHECK_DLADDR], +[ + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS $1" + AC_TRY_RUN( +[ +#define _GNU_SOURCE /* required on Linux, sigh */ +#include + +int +main(void) +{ + Dl_info info; + + if (!dladdr((void *)main, &info)) + return 1; /* failure */ + return 0; /* assume success */ +} +], + ac_cv_dladdr_finds_executable_path=yes, + ac_cv_dladdr_finds_executable_path=no, + [echo $ac_n "cross compiling; assumed OK... $ac_c" + ac_cv_dladdr_finds_executable_path=yes]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + if test x$ac_cv_dladdr_finds_executable_path = xyes + then + AC_DEFINE(DLADDR_FINDS_EXECUTABLE_PATH, 1, [Define if dladdr can be used to find the path of the executable]) + fi +]) + # # AC_WIRESHARK_ZLIB_CHECK # -- cgit v1.2.1