Index: ChangeLog
===================================================================
RCS file: /cvsroot/libtool/libtool/ChangeLog,v
retrieving revision 1.873
diff -u -r1.873 ChangeLog
--- ChangeLog	2001/03/16 03:58:50	1.873
+++ ChangeLog	2001/03/30 01:24:01
@@ -1,3 +1,22 @@
+2001-03-29  Edward M. Lee  <tailbert@yahoo.com>
+
+	* libtoolize.in: check configure.ac; prefer configure.ac to
+	configure.in; change recommendation from AM_PROG_LIBTOOL to
+	AC_PROG_LIBTOOL.
+
+	* libtool.m4: generate dll/import libraries for cygwin according
+	to the following: libFOO.a (static lib), libFOO.dll.a (import
+	lib), cygFOO-version.dll (dll).
+
+	Generate installed .la files with dlnames set to 
+	../bin/cygFOO-version.dll for normal dlls. dlls for modules
+	remain with the .la file. Update postinstall_cmds and 
+	postuninstall_cmds to reflect this.
+
+	Check return of open() for < 1, not != 0.
+
+	* libltdl/ltdl.c: use windows paths while calling LoadLibrary.
+
 2001-03-16  Albert Chin  <china@thewrittenword.com>
 
 	* libtool.m4 (save_CPPFLAGS): Fix typo.
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.151
diff -u -r1.151 libtool.m4
--- libtool.m4	2001/03/16 03:58:51	1.151
+++ libtool.m4	2001/03/30 01:24:22
@@ -1,4 +1,4 @@
-## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
+# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
 ## Copyright 1996, 1997, 1998, 1999, 2000, 2001
 ## Free Software Foundation, Inc.
 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
@@ -1238,7 +1238,7 @@
       test -f $output_objdir/impgen.exe || (cd $output_objdir && \
       if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
       else $CC -o impgen impgen.c ; fi)~
-      $output_objdir/impgen $dir/$soname > $output_objdir/$soname-def'
+      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
 
     old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
 
@@ -1296,11 +1296,11 @@
         done;
       fi~
       '"$ltdll_cmds"'
-      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
       $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
-      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags~
-      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
-      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
     ;;
 
   netbsd*)
@@ -1832,7 +1832,14 @@
   need_lib_prefix=no
   case $GCC,$host_os in
   yes,cygwin*)
-    library_names_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll'
+    library_names_spec='$libname.dll.a'
+    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll'
+    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i; echo \$dlname'\''`;
+dldir=$destdir/`dirname \$dlpath`;
+test -d \$dldir || mkdir -p \$dldir;
+$install_prog .libs/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`;
+dlpath=$dir/\$dldll; $rm \$dlpath'
     ;;
   yes,mingw*)
     library_names_spec='${libname}`echo ${release} | [sed -e 's/[.]/-/g']`${versuffix}.dll'
@@ -2648,7 +2655,7 @@
 #     filename = argv[1];
 #
 #     dll = open(filename, O_RDONLY|O_BINARY);
-#     if (!dll)
+#     if (dll < 1)
 # 	return 1;
 #
 #     dll_name = filename;
Index: libtoolize.in
===================================================================
RCS file: /cvsroot/libtool/libtool/libtoolize.in,v
retrieving revision 1.13
diff -u -r1.13 libtoolize.in
--- libtoolize.in	2000/09/07 00:38:04	1.13
+++ libtoolize.in	2001/03/30 01:24:23
@@ -54,6 +54,7 @@
 ltdl=
 ltdl_tar=
 status=0
+configure_ac=
 
 for arg
 do
@@ -134,8 +135,12 @@
   esac
 done
 
-if test ! -f configure.in; then
-  echo "$progname: \`configure.in' does not exist" 1>&2
+if test -f configure.ac; then
+  configure_ac=configure.ac
+elif test -f configure.in; then
+  configure_ac=configure.in
+else
+  echo "$progname: \`configure.ac' does not exist" 1>&2
   echo "$help" 1>&2
   exit 1
 fi
@@ -149,7 +154,7 @@
 files='config.guess config.sub ltmain.sh'
 
 auxdir=.
-auxdirline=`egrep '^AC_CONFIG_AUX_DIR' configure.in 2>/dev/null`
+auxdirline=`egrep '^AC_CONFIG_AUX_DIR' $configure_ac 2>/dev/null`
 if test -n "$auxdirline"; then
   # Handle explicit AC_CONFIG_AUX_DIR settings.
   auxdir=`echo "$auxdirline" | sed 's/^AC_CONFIG_AUX_DIR(\([^)]*\)).*$/\1/'`
@@ -184,13 +189,13 @@
 fi
 
 if test -z "$automake"; then
-  if egrep '^A[MC]_PROG_LIBTOOL' configure.in >/dev/null 2>&1; then :
+  if egrep '^A[MC]_PROG_LIBTOOL' $configure_ac >/dev/null 2>&1; then :
   else
-    echo "Remember to add \`AM_PROG_LIBTOOL' to \`configure.in'."
+    echo "Remember to add \`AC_PROG_LIBTOOL' to \`$configure_ac'."
   fi
 
-  if egrep '^AC_PROG_RANLIB' configure.in >/dev/null 2>&1; then
-    echo "Using \`AC_PROG_RANLIB' is rendered obsolete by \`AM_PROG_LIBTOOL'"
+  if egrep '^AC_PROG_RANLIB' $configure_ac >/dev/null 2>&1; then
+    echo "Using \`AC_PROG_RANLIB' is rendered obsolete by \`AC_PROG_LIBTOOL'"
   fi
 
   if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
@@ -226,7 +231,7 @@
     echo "You should $updatemsg."
   fi
 
-  if grep '^AC_LIB_LTDL' configure.in >/dev/null 2>&1; then
+  if grep '^AC_LIB_LTDL' $configure_ac >/dev/null 2>&1; then
     if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
       updatemsg="update your \`aclocal.m4' by running aclocal"
     else
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.246
diff -u -r1.246 ltmain.in
--- ltmain.in	2001/03/10 02:16:45	1.246
+++ ltmain.in	2001/03/30 01:24:46
@@ -1779,13 +1779,25 @@
 	    realname="$2"
 	    shift; shift
 	    libname=`eval \\$echo \"$libname_spec\"`
-	    if test -n "$soname_spec"; then
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin*)
+		major=`expr $current - $age`
+		versuffix="-$major"
+		;;
+	      esac
 	      eval soname=\"$soname_spec\"
 	    else
 	      soname="$realname"
 	    fi
 
 	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    soname=`echo $soroot | sed -e 's/^.*\///'`
 	    newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
 
 	    # If the library has no export list, then create one now
@@ -2706,6 +2718,9 @@
 	else
 	  soname="$realname"
 	fi
+	if test x$dlname = x; then
+	  dlname=$soname
+	fi
 
 	lib="$output_objdir/$realname"
 	for link
@@ -3012,6 +3027,9 @@
       ;;
 
     prog)
+      case $host in
+        *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
       if test -n "$vinfo"; then
 	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
       fi
@@ -3461,6 +3479,11 @@
 	case $output in
 	  *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
 	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*) exeext=.exe ;;
+	  *) exeext= ;;
+	esac
 	$rm $output
 	trap "$rm $output; exit 1" 1 2 15
 
@@ -3539,7 +3562,7 @@
 
 	if test "$fast_install" = yes; then
 	  echo >> $output "\
-  program=lt-'$outputname'
+  program=lt-'$outputname'$exeext
   progdir=\"\$thisdir/$objdir\"
 
   if test ! -f \"\$progdir/\$program\" || \\
@@ -3815,6 +3838,11 @@
 	    dlprefiles="$newdlprefiles"
 	  fi
 	  $rm $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
 	  $echo > $output "\
 # $outputname - a libtool library file
 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
@@ -3823,7 +3851,7 @@
 # It is necessary for linking the library.
 
 # The name that we can dlopen(3).
-dlname='$dlname'
+dlname='$tdlname'
 
 # Names of this library.
 library_names='$library_names'
@@ -4246,6 +4274,23 @@
 	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 	  fi
 	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another one anyways
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    destfile=`echo $destfile | sed -e 's,.exe$,,'`
+	    ;;
+	  esac
+	  ;;
+	esac
 
 	$show "$install_prog$stripme $file $destfile"
 	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
Index: demo/Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/demo/Makefile.am,v
retrieving revision 1.22
diff -u -r1.22 Makefile.am
--- demo/Makefile.am	1999/04/25 08:35:32	1.22
+++ demo/Makefile.am	2001/03/30 01:24:46
@@ -135,4 +135,4 @@
 
 CLEANFILES += $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS)
 
-deplibs-check: hell0
+deplibs-check: hell0#$(EXEEXT)
Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.126
diff -u -r1.126 ltdl.c
--- libltdl/ltdl.c	2001/02/23 22:58:20	1.126
+++ libltdl/ltdl.c	2001/03/30 01:24:54
@@ -797,8 +797,15 @@
       strcpy (searchname, filename);
       strcat (searchname, ".");
     }
-
+#if defined(__CYGWIN__)
+  {
+    char wpath[MAX_PATH];
+    cygwin_conv_to_full_win32_path(searchname, wpath);
+    module = LoadLibrary(wpath);
+  }
+#else
   module = LoadLibrary (searchname);
+#endif
   LT_DLFREE (searchname);
 
   /* libltdl expects this function to fail if it is unable
