Fixed check for rdynamic, provided by Stephen Ma

This commit is contained in:
mainzelm 2004-01-27 10:38:36 +00:00
parent e8a662ea1b
commit ba76b7a3cc
1 changed files with 5 additions and 6 deletions

View File

@ -33,8 +33,10 @@ 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([#include <stdio.h>
#include <dlfcn.h>],
AC_RUN_IFELSE(AC_LANG_PROGRAM([
#include <stdio.h>
#include <dlfcn.h>
int export_test = 0;],
[
#ifndef RTLD_LAZY
#define RTLD_LAZY 0
@ -44,7 +46,6 @@ define(S48_RDYNAMIC, [dnl
#define RTLD_GLOBAL 0
#endif
int export_test = 0;
void *dlhandle;
void *intp;
char *err;
@ -52,21 +53,19 @@ define(S48_RDYNAMIC, [dnl
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"])