]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* NEWS: Note new user visible changes.
authorOlly Betts <olly@muscat.co.uk>
Fri, 23 Jul 1999 16:09:49 +0000 (16:09 +0000)
committerGary V. Vaughan <gary@gnu.org>
Fri, 23 Jul 1999 16:09:49 +0000 (16:09 +0000)
* libtool.m4 (mingw32, AC_LIBTOOL_SETUP): probe for -mdll vs -dll
under cygwin/mingw.
probe whether the cygwin/mingw library supplies a stub DllMain
(but this information isn't yet used).
* ltconfig.in (mingw32, extract_expsyms_cmds): if HOST_CC is set,
use that to build impgen so we can use it when cross-compiling.
use correct entry points for mingw so static C++ constructors get
called for code in the DLL.
* ltmain.in (impgen.c): define O_BINARY to 0 if it is not in the
system headers.

ChangeLog
NEWS
libtool.m4
ltconfig.in
ltmain.in

index 6f737a0549b9fdfa80bcd3b9f3c4ead87c74f5d9..1ae9adcb093619ea87ede04d33eb049d36c55f8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+1999-07-24  Olly Betts  <olly@muscat.co.uk>
+
+       * NEWS: Note new user visible changes.
+       * libtool.m4 (mingw32, AC_LIBTOOL_SETUP): probe for -mdll vs -dll
+       under cygwin/mingw.
+       probe whether the cygwin/mingw library supplies a stub DllMain
+       (but this information isn't yet used).
+       * ltconfig.in (mingw32, extract_expsyms_cmds): if HOST_CC is set,
+       use that to build impgen so we can use it when cross-compiling.
+       use correct entry points for mingw so static C++ constructors get
+       called for code in the DLL.
+       * ltmain.in (impgen.c): define O_BINARY to 0 if it is not in the
+       system headers.
+       
 1999-07-24  Bert Driehuis <bert_driehuis@compuware.com>
 
        * ltconfig.in:  Updated bsdi4 soname specs to be more like
diff --git a/NEWS b/NEWS
index 7680ea61f680b42c6433ea06557c2a6d89176564..d60136429714a39df43c55198059726c76f8d612 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 NEWS - list of user-visible changes between releases of GNU Libtool
 
 New in 1.3d: 1999-??-??; CVS version 1.3c, Libtool team:
+* Start of support code for cross-compiling to win32.
+* Improved support for mingw32.
 * New --with-pic flag to control the generation of PIC/non-PIC code.
 * New --build flag to ltconfig to help with build cross compilation
   environments is inherited from --build flag passed to configure.
index 0fb19502c2e926c71392002625c5a0d33146c44d..3e3d533bde0d877e87f79c27af9fd791abc96b2d 100644 (file)
@@ -128,6 +128,29 @@ ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+  # recent cygwin and mingw systems supply a stub DllMain which the user
+  # can override, but on older systems we have to supply one
+  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+    [AC_TRY_LINK([DllMain (0, 0, 0);],
+      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);],
+      [lt_cv_need_dllmain=yes],[lt_cv_need_dllmain=no])])
+
+  # old mingw systems require "-dll" to link a DLL, while more recent ones
+  # require "-mdll"
+  lt_nostartfiles=
+  case $host in
+  *-*-cygwin)
+    # on cygwin we must also not link crt.o, or else the dll will need
+    # a WinMain@16 definition.
+    lt_nostartfiles=" -nostartfiles" ;;
+  esac
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mdll$lt_nostartfiles"
+  AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+    [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+  lt_cv_cc_dll_switch="$lt_cv_cc_dll_switch$lt_nostartfiles"
+  CFLAGS="$SAVE_CFLAGS"
   ;;
 ])
 esac
index 6bf2500916d8bc0f6ca3bbd939c9a1f21aaee071..e62439b6606fbf0a3dfa96bc5d4a9e42c25707b6 100755 (executable)
@@ -462,7 +462,7 @@ if test "$verify_host" = yes; then
     esac ;;
   esac
 
-  build=`SHELL $ac_config_sub $build_alias`
+  build=`$SHELL $ac_config_sub $build_alias`
   build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
   build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
   build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
@@ -1346,18 +1346,36 @@ EOF
 
     extract_expsyms_cmds='test -f $objdir/impgen.c || \
       sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/impgen.c~
-      test -f $objdir/impgen.exe || (cd $objdir && $CC -o impgen impgen.c)~
+      test -f $objdir/impgen.exe || (cd $objdir && \
+      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+      else $CC -o impgen impgen.c ; fi)~
       $objdir/impgen $dir/$soname > $objdir/$soname-def'
 
     old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$newlib'
 
+    # cygwin and mingw dlls have different entry points and sets of symbols
+    # to exclude.
+    # FIXME: what about values for MSVC?
+    dll_entry=__cygwin_dll_entry@12
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+    case "$host_os" in
+    mingw*)
+      # mingw values
+      dll_entry=_DllMainCRTStartup@12
+      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+      ;;
+    esac
+
+    # mingw and cygwin differ, and it's simplest to just exclude the union
+    # of the two symbol sets.
+    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
     # Extract the symbol export list from an `--export-all' def file,
     # then regenerate the def file from the symbol export list, so that
     # the compiled dll only exports the symbol export list.
     export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
       test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
-      $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs $convenience~
-      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ;.*//" < $objdir/$soname-def > $export_symbols'
+     $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $objdir/$soname-def  $objdir/$soname-ltdll.$objext $libobjs $convenience~      sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ;.*//" < $objdir/$soname-def > $export_symbols'
 
     archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
       _lt_hint=1;
@@ -1367,11 +1385,11 @@ EOF
       done~
       test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
       test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~
-      $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $compiler_flags~
-      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
-      $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $compiler_flags~
-      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
-      $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $compiler_flags'
+     $CC -Wl,--base-file,$objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+      $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $compiler_flags~
+      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
+      $CC $objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $compiler_flags'
     ;;
 
   netbsd*)
index 33575ce5ab5b4c1a82568f2e79b2fe05945c3be9..95ae118916925780ea4f0f7b76263144295ea76f 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -705,6 +705,11 @@ compiler."
 #  #include <fcntl.h>          /* for O_RDONLY, O_BINARY */
 #  #include <string.h>         /* for strdup() */
 # 
+#  /* O_BINARY isn't required (or even defined sometimes) under Unix */
+#  #ifndef O_BINARY
+#  #define O_BINARY 0
+#  #endif
+#
 #  static unsigned int
 #  pe_get16 (fd, offset)
 #       int fd;