diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-08-12 09:09:32 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-08-12 09:09:32 +0000 |
commit | 70523b5014574f15b4edbd78243b6004525f3839 (patch) | |
tree | 8917ce63ab241bf8fb1c5af1ca940b05448555d3 /acinclude.m4 | |
parent | f568d56df2d6a3ad912200b6f760aaed073b0deb (diff) |
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
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 687b25d3aa..e825dc1e93 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -638,6 +638,42 @@ AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK], ]) # +# 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 <dlfcn.h> + +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 # AC_DEFUN([AC_WIRESHARK_ZLIB_CHECK], |