diff --git a/configure.in b/configure.in index 498b1cd..d50ed90 100644 --- a/configure.in +++ b/configure.in @@ -33,10 +33,40 @@ dnl Note, on some Sun's, you can link with -rdynamic but the resulting dnl a.out always core dumps. define(S48_RDYNAMIC, [dnl AC_MSG_CHECKING([link with -rdynamic]) - AC_TRY_COMPILE([], -[#if defined(__linux__) && defined(__ELF__) - this must not compile -#endif], + AC_TRY_COMPILE([#include + #include ], +[ +#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(yes) LDFLAGS="$LDFLAGS -rdynamic"]) @@ -318,9 +348,11 @@ esac AC_CHECK_FUNCS(gettimeofday ftime nlist select setitimer sigaction vasprintf) SCSH_SOCKLEN_T 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_LIBOBJ([c/fake/libdl2])])]) + [AC_LIBOBJ([c/fake/libdl2])]) + have_dlopen="no"]) AC_CHECK_FUNCS(socket chroot) AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR, 1, [Define to 1 if you have the strerror function]), @@ -355,7 +387,9 @@ fail AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])) S48_USCORE - S48_RDYNAMIC + if test $have_dlopen = yes; then + S48_RDYNAMIC + fi AC_STRUCT_TIMEZONE AC_CHECK_MEMBER(struct tm.tm_gmtoff, AC_DEFINE(HAVE_GMTOFF, 1, [Define to 1 if struct tm has member tm_gmtoff]))