cygwin 1.5.20 introduced a static-only stub libdl.a so that users porting code that linked against -ldl would not have to change their compilation. But dlopen () was already available in cygwin1.dll, without ever having to fall back on the crutch of -ldl. However, libtool was assuming that if libdl existed, dlopen () must come from -ldl, and that if libdl.a is static-only, then shared libraries could no longer be build if they depended on dlopen(). This assumption basically breaks libltdl on cygwin: http://lists.gnu.org/archive/html/libtool/2006-07/msg00059.html
This fixed things for me (at least, by installing this patch, then bootstrapping m4 on cygwin, I was once again able to pass the testsuite where it had been failing ever since I upgraded cygwin from 1.5.19). Okay to apply? 2006-07-18 Eric Blake <[EMAIL PROTECTED]> * libltdl/m4/ltdl.m4 (LT_LIB_DLLOAD): Search for dlopen without depending on -ldl, required by cygwin 1.5.20. Index: libltdl/m4/ltdl.m4 =================================================================== RCS file: /sources/libtool/libtool/libltdl/m4/ltdl.m4,v retrieving revision 1.27 diff -u -b -r1.27 ltdl.m4 --- libltdl/m4/ltdl.m4 17 May 2006 20:11:03 -0000 1.27 +++ libltdl/m4/ltdl.m4 18 Jul 2006 21:32:20 -0000 @@ -1,5 +1,5 @@ # ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- -# Copyright (C) 1999-2005 Free Software Foundation, Inc. +# Copyright (C) 1999-2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without @@ -108,7 +108,7 @@ dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl -AC_CHECK_LIB(ltdl, lt_dlinit, +AC_CHECK_LIB([ltdl], [lt_dlinit], [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) @@ -515,10 +515,13 @@ AC_LANG_PUSH([C]) LIBADD_DLOPEN= -AC_CHECK_LIB([dl], [dlopen], +AC_SEARCH_LIBS([dlopen], [dl], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) - LIBADD_DLOPEN="-ldl" libltdl_cv_lib_dl_dlopen="yes" + if test "$ac_cv_search_dlopen" != "none required" ; then + LIBADD_DLOPEN="-ldl" + fi + libltdl_cv_lib_dl_dlopen="yes" LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H # include <dlfcn.h>