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. 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([#include <stdio.h> AC_RUN_IFELSE(AC_LANG_PROGRAM([
#include <dlfcn.h>], #include <stdio.h>
#include <dlfcn.h>
int export_test = 0;],
[ [
#ifndef RTLD_LAZY #ifndef RTLD_LAZY
#define RTLD_LAZY 0 #define RTLD_LAZY 0
@ -44,7 +46,6 @@ define(S48_RDYNAMIC, [dnl
#define RTLD_GLOBAL 0 #define RTLD_GLOBAL 0
#endif #endif
int export_test = 0;
void *dlhandle; void *dlhandle;
void *intp; void *intp;
char *err; char *err;
@ -52,21 +53,19 @@ define(S48_RDYNAMIC, [dnl
dlhandle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); dlhandle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
if ((err = dlerror()) != NULL) { if ((err = dlerror()) != NULL) {
printf("dlerror: %s\n", err);
return 1; return 1;
} }
(void *)intp = dlsym(dlhandle, "export_test"); (void *)intp = dlsym(dlhandle, "export_test");
if ((err = dlerror()) != NULL) { if ((err = dlerror()) != NULL) {
printf("dlerror: %s\n", err);
return 1; return 1;
} }
return 0; return 0;
], ]),
[AC_MSG_RESULT(no)], [AC_MSG_RESULT(no)],
[AC_MSG_RESULT(yes) [AC_MSG_RESULT(yes)
LDFLAGS="$LDFLAGS -rdynamic"]) LDFLAGS="$LDFLAGS -rdynamic"])