libtool/mail/cygwin32

313 lines
11 KiB
Plaintext
Raw Normal View History

1998-10-28 00:30:31 +08:00
From nobody Wed Oct 14 16:45:23 1998
X-From-Line: gord@gnu.org Fri Apr 17 23:33:23 1998
Return-Path: <gord@gnu.org>
Delivered-To: gord@trick.profitpress.com
Received: (qmail 23433 invoked from network); 17 Apr 1998 23:33:18 -0000
Received: from unknown (HELO bambam.m-tech.ab.ca) (127.0.0.1)
by 127.0.0.1 with SMTP; 17 Apr 1998 23:33:18 -0000
Received: from mescaline.gnu.org (gateway.m-tech.ab.ca [10.0.0.1]) by bambam.m-tech.ab.ca (8.8.5/8.6.9) with ESMTP id OAA06968 for <gord@m-tech.ab.ca>; Fri, 17 Apr 1998 14:24:44 -0600
Received: from tweedledumb.cygnus.com by mescaline.gnu.org (8.8.5/8.6.12GNU) with ESMTP id QAA24530 for <bug-libtool@gnu.org>; Fri, 17 Apr 1998 16:28:50 -0400
Received: from subrogation.cygnus.com (subrogation.cygnus.com [192.80.44.76])
by tweedledumb.cygnus.com (8.8.5/8.8.5) with ESMTP id QAA18910
for <bug-libtool@gnu.org>; Fri, 17 Apr 1998 16:28:46 -0400 (EDT)
Received: (ian@localhost) by subrogation.cygnus.com (950413.SGI.8.6.12/8.6.4) id QAA08423; Fri, 17 Apr 1998 16:28:45 -0400
Date: Fri, 17 Apr 1998 16:28:45 -0400
Message-Id: <199804172028.QAA08423@subrogation.cygnus.com>
From: Ian Lance Taylor <ian@cygnus.com>
To: bug-libtool@gnu.org
Subject: cygwin32 support in libtool
Xref: trick.profitpress.com mail.libtool:1336
1998-11-03 03:30:15 +08:00
Lines: 290
X-Gnus-Article-Number: 1 Mon Nov 2 17:17:26 1998
1998-10-28 00:30:31 +08:00
Here are the libtool patches I've worked up for cygwin32 support.
These should be relative to the 1.2 release.
These patches have some bogosities.
I needed to build a C file to compile when building the DLL. That C
file naturally includes semicolons. I could not figure out how to get
a semicolon into archive_cmds; the various approaches I tried all
failed, because ltmain splits archive_cmds at semicolons. So I wound
up just creating libtool.c in ltconfig. This libtool.c file never
gets deleted.
Both archive_cmds and old_archive_from_new_cmds need to use the same
definitions file. I created it in archive_cmds and deleted it in
old_archive_from_new_cmds.
Ian
Index: ltconfig.in
===================================================================
RCS file: /cvs/cvsfiles/devo/libtool/ltconfig.in,v
retrieving revision 1.6
retrieving revision 1.8
diff -p -r1.6 -r1.8
*** ltconfig.in 1998/03/23 18:28:53 1.6
--- ltconfig.in 1998/04/17 20:20:13 1.8
*************** old_LD="$LD"
*** 97,102 ****
--- 97,104 ----
old_LN_S="$LN_S"
old_NM="$NM"
old_RANLIB="$RANLIB"
+ old_DLLTOOL="$DLLTOOL"
+ old_AS="$AS"
# Parse the command line options.
args=
*************** if test -n "$RANLIB"; then
*** 351,356 ****
--- 353,362 ----
old_postinstall_cmds="\$RANLIB \$oldlib;$old_postinstall_cmds"
fi
+ # Set sane defaults for `DLLTOOL' and `AS', used on cygwin32.
+ test -z "$DLLTOOL" && DLLTOOL=dlltool
+ test -z "$AS" && AS=as
+
# Check to see if we are using GCC.
if test "$with_gcc" != yes || test -z "$CC"; then
# If CC is not set, then try to find GCC or a usable CC.
*************** if test "$with_gcc" = yes; then
*** 456,462 ****
aix3* | aix4* | irix5* | irix6* | osf3* | osf4*)
# PIC is the default for these OSes.
;;
! os2*)
# We can build DLLs from non-PIC.
;;
amigaos*)
--- 462,468 ----
aix3* | aix4* | irix5* | irix6* | osf3* | osf4*)
# PIC is the default for these OSes.
;;
! cygwin32* | os2*)
# We can build DLLs from non-PIC.
;;
amigaos*)
*************** else
*** 490,496 ****
# PIC (with -KPIC) is the default.
;;
! os2*)
# We can build DLLs from non-PIC.
;;
--- 496,502 ----
# PIC (with -KPIC) is the default.
;;
! cygwin32* | os2*)
# We can build DLLs from non-PIC.
;;
*************** hardcode_shlibpath_var=unsupported
*** 702,708 ****
runpath_var=
case "$host_os" in
! amigaos* | sunos4*)
# On these operating systems, we should treat GNU ld like the system ld.
gnu_ld_acts_native=yes
;;
--- 708,714 ----
runpath_var=
case "$host_os" in
! amigaos* | sunos4* | cygwin32*)
# On these operating systems, we should treat GNU ld like the system ld.
gnu_ld_acts_native=yes
;;
*************** else
*** 756,761 ****
--- 762,788 ----
hardcode_minus_L=yes
;;
+ cygwin32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ # Very, very bogus.
+ echo '
+ #include <windows.h>
+
+ struct _reent *_impure_ptr;
+ extern struct _reent *__imp_reent_data;
+ BOOL APIENTRY
+ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
+ {
+ _impure_ptr = __imp_reent_data;
+ }
+ ' > libtool.c
+ archive_cmds='$CC -c libtool.c;echo EXPORTS > $soname-def;$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' >> $soname-def;$LD -s --base-file $soname-base --dll -e ___dll_entry@12 -o $lib libtool.o$libobjs$deplibs;$DLLTOOL --as=$AS --dllname $soname --def $soname-def --base-file $soname-base --output-exp $soname-exp;$LD -s --base-file $soname-base $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.o$libobjs$deplibs;$DLLTOOL --as=$AS --dllname $soname --def $soname-def --base-file $soname-base --output-exp $soname-exp;$LD $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.o$libobjs$deplibs;$rm libtool.o $soname-base $soname-exp'
+ old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $soname-def --output-lib $objdir/$libname.a;$rm $soname-def'
+ ;;
+
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
*************** case "$host_os" in
*** 936,941 ****
--- 963,972 ----
aix*)
symcode='[BCDTU]'
;;
+ cygwin32*)
+ sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'
+ symxfrm='_\1 \1'
+ ;;
irix*)
# Cannot use undefined symbols on IRIX because inlined functions mess us up.
symcode='[BCDEGRST]'
*************** if $NM -V 2>&1 | egrep '(GNU|with BFD)'
*** 950,955 ****
--- 981,994 ----
symcode='[ABCDGISTUW]'
fi
+ case "$host_os" in
+ cygwin32*)
+ # We do not want undefined symbols on cygwin32. The user must
+ # arrange to define them via -l arguments.
+ symcode='[ABCDGISTW]'
+ ;;
+ esac
+
# Write the raw and C identifiers.
global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'"
*************** amigaos*)
*** 1123,1128 ****
--- 1162,1174 ----
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
;;
+ cygwin32*)
+ version_type=windows
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
+ dynamic_linker='Win32 ld.exe'
+ shlibpath_var=PATH
+ ;;
+
freebsd2* | freebsd3*)
version_type=sunos
library_names_spec='${libname}${release}.so.$versuffix $libname.so'
*************** ltecho="$echo"
*** 1285,1293 ****
# Now quote all the things that may contain metacharacters.
for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
! old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \
! link_static_flag no_builtin_flag export_dynamic_flag_spec \
! libname_spec library_names_spec soname_spec RANLIB \
old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \
allow_undefined_flag no_undefined_flag \
--- 1331,1339 ----
# Now quote all the things that may contain metacharacters.
for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
! old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM DLLTOOL AS reload_flag \
! reload_cmds wl pic_flag link_static_flag no_builtin_flag \
! export_dynamic_flag_spec libname_spec library_names_spec soname_spec RANLIB \
old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \
allow_undefined_flag no_undefined_flag \
*************** cat <<EOF > $ofile
*** 1345,1350 ****
--- 1391,1397 ----
#
# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\
# LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
+ # DLLTOOL="$old_DLLTOOL" AS="$old_AS" \\
# $0$ltconfig_args
#
# Compiler and other test output produced by $progname, useful for
*************** LN_S="$LN_S"
*** 1390,1395 ****
--- 1437,1448 ----
# A BSD-compatible nm program.
NM="$NM"
+
+ # Used on cygwin32: DLL creation program.
+ DLLTOOL="$DLLTOOL"
+
+ # Used on cygwin32: assembler.
+ AS="$AS"
# The name of the directory that contains temporary libtool files.
objdir="$objdir"
Index: ltmain.in
===================================================================
RCS file: /cvs/cvsfiles/devo/libtool/ltmain.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -p -r1.3 -r1.4
*** ltmain.in 1998/03/20 23:35:33 1.3
--- ltmain.in 1998/04/17 20:20:14 1.4
*************** if test -z "$show_help"; then
*** 967,972 ****
--- 967,980 ----
versuffix="$current.$revision"
;;
+ windows)
+ # Like Linux, but with '-' rather than '.', and with a leading
+ # '-', since we only want one extension on Windows 95.
+ version_vars="$version_vars major versuffix"
+ major=`expr $current - $age`
+ versuffix="-$major-$age-$revision"
+ ;;
+
*)
$echo "$modename: unknown library version type \`$version_type'" 1>&2
echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
Index: libtool.m4
===================================================================
RCS file: /cvs/cvsfiles/devo/libtool/libtool.m4,v
retrieving revision 1.11
retrieving revision 1.12
diff -p -r1.11 -r1.12
*** libtool.m4 1998/04/13 16:09:14 1.11
--- libtool.m4 1998/04/13 20:44:46 1.12
*************** case "$host" in
*** 70,80 ****
--- 70,86 ----
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
CFLAGS="$CFLAGS -belf"
;;
+
+ *-*-cygwin32*)
+ AM_SYS_LIBTOOL_CYGWIN32
+ ;;
+
esac
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
+ DLLTOOL="$DLLTOOL" AS="$AS" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| AC_MSG_ERROR([libtool configure failed])
*************** fi])
*** 255,258 ****
--- 261,270 ----
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
AC_SUBST(NM)
+ ])
+
+ # AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
+ AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,
+ [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
])