libtool
[Top][All Lists]
Advanced

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

Re: revised patch for glib compilation on cygwin with POSIX runtime


From: Tor Lillqvist
Subject: Re: revised patch for glib compilation on cygwin with POSIX runtime
Date: Wed, 21 Feb 2001 17:26:05 +0200 (FLE Standard Time)

Here is a suggested patch to libtool.m4. It implements the following:

- If the export_symbols file (which has been passed to libtool with
the -export-symbols command line switch) already is a .def file, use
it as is.

- On Cygwin, set libname_spec to cyg$name instead of the default
lib$name.

- For mingw (and thus gcc), use gcc -print-search-dirs to figure out
where to look for dependent libraries. The mingw gcc prints this list
as Windows pathnames separated by semicolons (like
x:\foo\bar\;Y:\zap\tem\), but this is actually OK. The Cygwin ls that
gets used (in ltmain.sh) to check if a library exists in one of the
path components also accepts Windows pathnames. And the objdump that
then is used to check if the file actually is a library should be the
mingw one, so it wouldn't even work if the path components would have
been converted to cygwin (POSIX) format inbetween.

Index: libtool.m4
===================================================================
RCS file: /cvs/libtool/libtool.m4,v
retrieving revision 1.142
diff -u -2 -r1.142 libtool.m4
--- libtool.m4  2001/01/27 19:19:05     1.142
+++ libtool.m4  2001/02/21 15:02:54
@@ -1272,15 +1272,21 @@
       [sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//"] < 
$output_objdir/$soname-def > $export_symbols'
 
+    # If the export-symbols file already is a .def file (1st line
+    # is EXPORTS), use it as is.
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='echo EXPORTS > $output_objdir/$soname-def~
-      _lt_hint=1;
-      cat $export_symbols | while read symbol; do
-       set dummy \$symbol;
-       case \[$]# in
-         2) echo "     \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
-         *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> 
$output_objdir/$soname-def;;
-       esac;
-       _lt_hint=`expr 1 + \$_lt_hint`;
-      done~
+    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+        cp $export_symbols $output_objdir/$soname-def;
+      else
+        echo EXPORTS > $output_objdir/$soname-def;
+        _lt_hint=1;
+       cat $export_symbols | while read symbol; do
+         set dummy \$symbol;
+         case \[$]# in
+           2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+           *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> 
$output_objdir/$soname-def;;
+         esac;
+         _lt_hint=`expr 1 + \$_lt_hint`;
+       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~
@@ -1804,4 +1810,12 @@
   if test "$GCC" = yes; then
     library_names_spec='${libname}`echo ${release} | [sed -e 
's/[.]/-/g']`${versuffix}.dll'
+    case "$host_os" in
+      cygwin*)
+        libname_spec='cyg$name'
+       ;;
+      mingw*)
+       sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | 
sed -e "s/^libraries://" -e "s/;/ /g"`
+       ;;
+    esac
   else
     library_names_spec='${libname}`echo ${release} | [sed -e 
's/[.]/-/g']`${versuffix}.dll $libname.lib'




reply via email to

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