Better test for -rdynamic by Stephen Ma.

This commit is contained in:
mainzelm 2003-12-19 13:44:25 +00:00
parent 6b5e75bd3f
commit bcf88c05d0
1 changed files with 41 additions and 7 deletions

View File

@ -33,10 +33,40 @@ dnl Note, on some Sun's, you can link with -rdynamic but the resulting
dnl a.out always core dumps. dnl a.out always core dumps.
define(S48_RDYNAMIC, [dnl define(S48_RDYNAMIC, [dnl
AC_MSG_CHECKING([link with -rdynamic]) AC_MSG_CHECKING([link with -rdynamic])
AC_TRY_COMPILE([], AC_TRY_COMPILE([#include <stdio.h>
[#if defined(__linux__) && defined(__ELF__) #include <dlfcn.h>],
this must not compile [
#endif], #ifndef RTLD_LAZY
#define RTLD_LAZY 0
#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
int export_test = 0;
void *dlhandle;
void *intp;
char *err;
dlhandle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
if ((err = dlerror()) != NULL) {
printf("dlerror: %s\n", err);
return 1;
}
(void *)intp = dlsym(dlhandle, "export_test");
if ((err = dlerror()) != NULL) {
printf("dlerror: %s\n", err);
return 1;
}
return 0;
],
[AC_MSG_RESULT(no)], [AC_MSG_RESULT(no)],
[AC_MSG_RESULT(yes) [AC_MSG_RESULT(yes)
LDFLAGS="$LDFLAGS -rdynamic"]) LDFLAGS="$LDFLAGS -rdynamic"])
@ -318,9 +348,11 @@ esac
AC_CHECK_FUNCS(gettimeofday ftime nlist select setitimer sigaction vasprintf) AC_CHECK_FUNCS(gettimeofday ftime nlist select setitimer sigaction vasprintf)
SCSH_SOCKLEN_T SCSH_SOCKLEN_T
AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_DLOPEN, AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_DLOPEN,
1, [Define to 1 if the interface to the dynamic linker exists])], 1, [Define to 1 if the interface to the dynamic linker exists])
have_dlopen="yes"],
[AC_CHECK_FUNC(nlist, [AC_LIBOBJ([c/fake/libdl1])], [AC_CHECK_FUNC(nlist, [AC_LIBOBJ([c/fake/libdl1])],
[AC_LIBOBJ([c/fake/libdl2])])]) [AC_LIBOBJ([c/fake/libdl2])])
have_dlopen="no"])
AC_CHECK_FUNCS(socket chroot) AC_CHECK_FUNCS(socket chroot)
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR, AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR,
1, [Define to 1 if you have the strerror function]), 1, [Define to 1 if you have the strerror function]),
@ -355,7 +387,9 @@ fail
AC_MSG_RESULT([yes]), AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])) AC_MSG_RESULT([no]))
S48_USCORE S48_USCORE
S48_RDYNAMIC if test $have_dlopen = yes; then
S48_RDYNAMIC
fi
AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE
AC_CHECK_MEMBER(struct tm.tm_gmtoff, AC_CHECK_MEMBER(struct tm.tm_gmtoff,
AC_DEFINE(HAVE_GMTOFF, 1, [Define to 1 if struct tm has member tm_gmtoff])) AC_DEFINE(HAVE_GMTOFF, 1, [Define to 1 if struct tm has member tm_gmtoff]))