--- libltdl/ltdl.m4	10 Jul 2002 04:51:21 -0000	1.1.1.2
+++ libltdl/ltdl.m4	22 Jan 2003 02:54:22 -0000	1.4
@@ -103,6 +103,9 @@
 	osf*)
 	  libltdl_cv_sys_dlopen_deplibs=yes
 	  ;;
+	darwin*)
+	  libltdl_cv_sys_dlopen_deplibs=yes
+	  ;;
 	esac
 ])
 if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then
@@ -442,6 +445,8 @@
 if test x"$ac_cv_sys_symbol_underscore" = xyes; then
   if test x"$ac_cv_func_dlopen" = xyes ||
      test x"$ac_cv_lib_dl_dlopen" = xyes ; then
+        ac_save_LIBS="$LIBS"
+        LIBS="$LIBS $LIBADD_DL"
 	AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
 		libltdl_cv_need_uscore, [dnl
 		AC_TRY_RUN([
@@ -495,6 +500,7 @@
 fi
 
 if test x"$libltdl_cv_need_uscore" = xyes; then
+  LIBS="$ac_save_LIBS"
   AC_DEFINE(NEED_USCORE, 1,
     [Define if dlsym() requires a leading underscode in symbol names. ])
 fi
