Commit d48ca948 authored by Hidenori Takeshima's avatar Hidenori Takeshima Committed by Alexandre Julliard

Use dllwrap for building shared libraries in cygwin.

parent 63411dbd
......@@ -36,6 +36,8 @@ LEX = @LEX@
LEXLIB = @LEXLIB@
LIBEXT = @LIBEXT@
LDSHARED = @LDSHARED@
DLLWRAP = @DLLWRAP@
DLLWRAPFLAGS = --add-stdcall-alias
RANLIB = @RANLIB@
LN_S = @LN_S@
DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
......@@ -60,7 +62,7 @@ WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOPOBJDIR)/tools/makedep
WRC = $(TOPOBJDIR)/tools/wrc/wrc
WMC = $(TOPOBJDIR)/tools/wmc/wmc
LDPATH = LD_LIBRARY_PATH="$(TOPOBJDIR)/unicode:$$LD_LIBRARY_PATH"
LDPATH = @LDPATH@
DLLDIR = $(TOPOBJDIR)/dlls
LIBWINE = -L$(TOPOBJDIR)/library -lwine
LIBTSX11 = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
......
......@@ -69,6 +69,7 @@ AC_PROG_LN_S
AC_CHECK_PROG(C2MAN,c2man,c2man,\$(TOPSRCDIR)/tools/c2man.pl)
AC_PATH_PROG(LDCONFIG, ldconfig, true, /sbin:/usr/sbin:$PATH)
AC_CYGWIN
AC_CHECK_PROG(DLLWRAP,dllwrap,dllwrap,false)
dnl Check for lint
AC_CHECK_PROGS(LINT, lclint lint)
......@@ -576,19 +577,36 @@ then
fi
if test "$ac_cv_c_dll_linux" = "no" -a "$ac_cv_c_dll_unixware" = "no" -a "$ac_cv_c_dll_netbsd" = "no"
then
echo "*** It is currently not possible to build WINE without shared"
echo "*** library (.so) support to allow transparent switch between .so"
echo "*** and .dll files."
echo "*** If you are using Linux, you will need a newer binutils."
exit 1
LIBEXT="a"
if test "$DLLWRAP" = "dllwrap"; then
dnl FIXME - check whether dllwrap works correctly...
if test "$CYGWIN" = "yes"; then
echo "*** use dllwrap for building shared library."
LIBEXT="dll"
fi
fi
fi
fi
if test "$LIBEXT" = "a"; then
echo "*** It is currently not possible to build WINE without shared"
echo "*** library (.so) support to allow transparent switch between .so"
echo "*** and .dll files."
echo "*** If you are using Linux, you will need a newer binutils."
exit 1
fi
DLLFLAGS=""
LDPATH=""
if test "$LIBEXT" = "so"; then
DLLFLAGS="-fPIC"
DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) \$(LIBWINE) \$(LIBUNICODE)"
LDPATH="LD_LIBRARY_PATH=\"\$(TOPOBJDIR)/unicode:\$\$LD_LIBRARY_PATH\""
elif test "$LIBEXT" = "dll"; then
#DLLFLAGS="-fPIC" # -fPIC doesn't work(at least in cygwin-b20) - FIXME
DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) \$(LIBWINE) \$(LIBUNICODE)"
LDPATH="PATH=\"\$(TOPOBJDIR)/unicode:\$\$PATH\""
else
DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) \$(LIBWINE) \$(LIBUNICODE) \$(X_LIBS) \$(XLIB)"
AC_CACHE_CHECK([whether the linker supports --[[no]]-whole-archive (Linux)],
......@@ -621,6 +639,7 @@ AC_SUBST(DLLFLAGS)
AC_SUBST(LDSHARED)
AC_SUBST(LDDLLFLAGS)
AC_SUBST(LIBEXT)
AC_SUBST(LDPATH)
dnl **** Check for reentrant libc ****
dnl
......
......@@ -37,6 +37,10 @@ lib$(MODULE).a: $(ALL_OBJS) Makefile.in
$(AR) $@ $(ALL_OBJS)
$(RANLIB) $@
# Rules for .dll files
lib$(MODULE).dll: $(ALL_OBJS) Makefile.in
$(DLLWRAP) $(DLLWRAPFLAGS) --implib lib$(MODULE).a -o lib$(MODULE).dll $(ALL_OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
# Rules for checking that no imports are missing
checklink:: lib$(MODULE).$(LIBEXT)
......
......@@ -29,6 +29,9 @@ libwine.a: $(OBJS)
$(AR) $@ $(OBJS)
$(RANLIB) $@
libwine.dll: $(OBJS)
$(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine.a -o libwine.dll $(OBJS)
install_so: libwine.so.$(SOVERSION)
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(INSTALL_PROGRAM) libwine.so.$(SOVERSION) $(libdir)/libwine.so.$(SOVERSION)
......
......@@ -37,6 +37,9 @@ libwine_tsx11.a: $(OBJS)
$(AR) $@ $(OBJS)
$(RANLIB) $@
libwine_tsx11.dll: $(OBJS)
$(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine_tsx11.a -o libwine_tsx11.dll $(OBJS)
install_so: libwine_tsx11.so.$(SOVERSION)
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(INSTALL_PROGRAM) libwine_tsx11.so.$(SOVERSION) $(libdir)/libwine_tsx11.so.$(SOVERSION)
......
......@@ -93,6 +93,10 @@ libwine_unicode.a: $(OBJS)
$(AR) $@ $(OBJS)
$(RANLIB) $@
# --export-all don't work correctly because of dllwrap's bug
libwine_unicode.dll: $(OBJS) wine_unicode.def
$(DLLWRAP) $(DLLWRAPFLAGS) --def wine_unicode.def --implib libwine_unicode.a -o libwine_unicode.dll $(OBJS)
install_so: libwine_unicode.so.$(SOVERSION)
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(INSTALL_PROGRAM) libwine_unicode.so.$(SOVERSION) $(libdir)/libwine_unicode.so.$(SOVERSION)
......
EXPORTS
cp_mbstowcs
cp_wcstombs
utf8_wcstombs
utf8_mbstowcs
cp_get_table
cp_enum_table
strcmpiW
strncmpiW
strstrW
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment