bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sco5 has dlopen


From: Golubev I. N.
Subject: sco5 has dlopen
Date: Thu, 14 Jun 2001 14:08:29 (GMT)

Version: 1.4

sco5 has dlopen interface, but AC_CHECK_LIB won't detect it, since
`dlopen' is a macro defined by <dlfcn.h>.  AC_TRY_LINK has to be used
instead.  Since I am not aware of systems which have dlopen but not
<dlfcn.h>, perhaps it is reasonable to use AC_TRY_LINK always.  A
starting point is a patch below.

--- libtool.m4  2001/06/13 08:23:27     1.3
+++ libtool.m4  2001/06/14 13:43:06
@@ -590,6 +590,49 @@
 rm -fr conftest*
 ])# _LT_AC_TRY_DLOPEN_SELF
 
+# _LT_AC_FUNC_DLOPEN ()
+AC_DEFUN(_LT_AC_FUNC_DLOPEN,
+[AC_VAR_PUSHDEF([ac_var], [ac_cv_func_dlopen])dnl
+AC_CACHE_CHECK([for dlopen], ac_var,
+[AC_TRY_LINK([#include <dlfcn.h>],[dlopen ("", 0);],
+ [AC_VAR_SET(ac_var, yes) lt_cv_dlopen_libs=],
+ [AC_VAR_SET(ac_var, no)])])
+AC_VAR_POPDEF([ac_var])dnl
+])# _LT_AC_FUNC_DLOPEN
+
+# _LT_AC_LIB_DLOPEN (LIB)
+AC_DEFUN(_LT_AC_LIB_DLOPEN,
+[AC_VAR_PUSHDEF([ac_var], [ac_cv_lib_$1_dlopen])dnl
+AC_CACHE_CHECK([for dlopen in -l$1], ac_var,
+[ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$1 $LIBS"
+AC_TRY_LINK([#include <dlfcn.h>],[dlopen ("", 0);],
+ [AC_VAR_SET(ac_var, yes)],
+ [AC_VAR_SET(ac_var, no)])
+LIBS=$ac_check_lib_save_LIBS])
+AS_IF([test AC_VAR_GET(ac_var) = yes],
+ [lt_cv_dlopen_libs="-l$1"])
+AC_VAR_POPDEF([ac_var])dnl
+])# _LT_AC_LIB_DLOPEN
+
+# _LT_AC_DLOPEN (ACTION-IF-NO-DLOPEN)
+AC_DEFUN(_LT_AC_DLOPEN,
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+AS_IF([test AC_VAR_GET(ac_cv_header_dlfcn_h) = yes],
+ [_LT_AC_LIB_DLOPEN(dl)
+AS_IF([test AC_VAR_GET(ac_cv_lib_dl_dlopen) = yes],
+ [lt_cv_dlopen=dlopen],
+[_LT_AC_FUNC_DLOPEN
+AS_IF([test AC_VAR_GET(ac_cv_func_dlopen) = yes],
+ [lt_cv_dlopen=dlopen],
+[_LT_AC_LIB_DLOPEN(svld)
+AS_IF([test AC_VAR_GET(ac_cv_lib_svld_dlopen) = yes],
+[lt_cv_dlopen=dlopen])
+])
+])
+])
+])# _LT_AC_DLOPEN
+
 # AC_LIBTOOL_DLOPEN_SELF
 # -------------------
 AC_DEFUN(AC_LIBTOOL_DLOPEN_SELF,
@@ -614,17 +657,13 @@
    ;;
 
   *)
-    AC_CHECK_LIB(dl, dlopen,  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
-      [AC_CHECK_FUNC(dlopen, lt_cv_dlopen="dlopen",
-        [AC_CHECK_FUNC(shl_load, lt_cv_dlopen="shl_load",
-          [AC_CHECK_LIB(svld, dlopen,
-           [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
-            [AC_CHECK_LIB(dld, shl_load,
-              [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
-           ])
-          ])
-        ])
+    _LT_AC_DLOPEN
+    if test x"$lt_cv_dlopen" != xdlopen;then
+      AC_CHECK_FUNC(shl_load, lt_cv_dlopen="shl_load",
+       [AC_CHECK_LIB(dld, shl_load,
+         [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
       ])
+    fi
     ;;
   esac
 
--- ltdl.m4     2001/06/14 12:04:28     1.1
+++ ltdl.m4     2001/06/14 14:02:52
@@ -189,19 +189,19 @@
 # -------------
 AC_DEFUN(AC_LTDL_DLLIB,
 [LIBADD_DL=
-AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
-   [Define if you have the libdl library or equivalent. ]) LIBADD_DL="-ldl"],
-[AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
-   [Define if you have the libdl library or equivalent.])],
-[AC_CHECK_LIB(svld, dlopen, [AC_DEFINE(HAVE_LIBDL, 1,
-   [Define if you have the libdl library or equivalent.]) LIBADD_DL="-lsvld"]
-)])])
+_LT_AC_DLOPEN
+if test x"$lt_cv_dlopen" = xdlopen;then
+  AC_DEFINE(HAVE_LIBDL, 1,
+   [Define if you have the libdl library or equivalent. ])
+  LIBADD_DL="$lt_cv_dlopen_libs"
+else
 AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1,
    [Define if you have the shl_load function.])],
 [AC_CHECK_LIB(dld, shl_load,
   [AC_DEFINE(HAVE_SHL_LOAD, 1,
      [Define if you have the shl_load function.])
    LIBADD_DL="$LIBADD_DL -ldld"])
+fi
 ])
 AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1,
   [Define if you have the GNU dld library.])dnl
@@ -211,7 +211,15 @@
 if test "x$ac_cv_func_dlopen" = xyes || test "x$ac_cv_lib_dl_dlopen" = xyes; 
then
  LIBS_SAVE="$LIBS"
  LIBS="$LIBS $LIBADD_DL"
- AC_CHECK_FUNCS(dlerror)
+ AH_TEMPLATE(HAVE_DLERROR,
+  [Define if you have the `dlerror' function.])dnl
+ AC_VAR_PUSHDEF([ac_var], [ac_cv_func_dlerror])dnl
+ AC_CACHE_CHECK([for dlerror], ac_var,
+ [AC_TRY_LINK([#include <dlfcn.h>],[dlerror ();],
+  [AC_VAR_SET(ac_var, yes)],
+  [AC_VAR_SET(ac_var, no)])])
+ AS_IF([test AC_VAR_GET(ac_var) = yes], [AC_DEFINE_UNQUOTED(HAVE_DLERROR)])
+ AC_VAR_POPDEF([ac_var])dnl
  LIBS="$LIBS_SAVE"
 fi
 ])# AC_LTDL_DLLIB



reply via email to

[Prev in Thread] Current Thread [Next in Thread]