From 7e495e1d66d225f735836c2863fa3d6748027a23 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 25 Jul 2000 21:01:59 +0000 Subject: [PATCH] Make unicode.o into a separate ELF library so that we can use it from the wineserver too. --- Make.rules.in | 2 +- Makefile.in | 45 +++++++++++++++++++++++++++---------------- configure | 4 ++-- configure.in | 4 ++-- dlls/Makedll.rules.in | 2 +- server/Makefile.in | 2 +- server/atom.c | 2 +- server/registry.c | 1 + server/unicode.c | 1 + server/unicode.h | 39 +------------------------------------ tools/wmc/Makefile.in | 11 ++++++----- unicode/.cvsignore | 1 + unicode/Makefile.in | 36 ++++++++++++++++++++++++++++++++-- 13 files changed, 80 insertions(+), 70 deletions(-) diff --git a/Make.rules.in b/Make.rules.in index 19e9e4989ff..6a279578c55 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -173,7 +173,7 @@ DLLS = \ $(CC) -c -o $*.o $< .mc.rc: - $(WMC) -i -H /dev/null -o $@ $< + LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WMC) -i -H /dev/null -o $@ $< .rc.s: $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $< diff --git a/Makefile.in b/Makefile.in index 58d57e0a380..1f529eb1094 100644 --- a/Makefile.in +++ b/Makefile.in @@ -32,6 +32,10 @@ PROGRAMS = \ LIBPROGRAMS = \ debugger/winedbg +# Libraries (not dlls) to build +LIBRARIES = \ + unicode/libwine_unicode.$(LIBEXT) + # Sub-directories to run make depend/clean into SUBDIRS = \ console \ @@ -75,7 +79,8 @@ INSTALLSUBDIRS = \ documentation \ include \ server \ - tools + tools \ + unicode LIBOBJS = \ controls/controls.o \ @@ -98,7 +103,6 @@ LIBOBJS = \ relay32/relay32.o \ resources/resources.o \ scheduler/scheduler.o \ - unicode/unicode.o \ win32/win32.o \ windows/windows.o @@ -126,20 +130,20 @@ Make.rules: Make.rules.in configure @echo $? is newer than 'Make.rules', please rerun ./configure! @exit 1 -wine: lib$(MODULE).$(LIBEXT) $(DLLDIR) $(EMUOBJS) +wine: libwine.$(LIBEXT) libwine_unicode.$(LIBEXT) dlls $(EMUOBJS) $(CC) -o wine $(EMUOBJS) $(DLL_LINK) $(LIBS) llib-lwine.ln : $(LIBLINTS) $(LINT) $(ALLLINTFLAGS) -owine $(LIBLINTS) -install_so: lib$(MODULE).so.$(SOVERSION) +install_so: libwine.so.$(SOVERSION) [ -d $(libdir) ] || $(MKDIR) $(libdir) - $(INSTALL_PROGRAM) lib$(MODULE).so.$(SOVERSION) $(libdir)/lib$(MODULE).so.$(SOVERSION) - cd $(libdir) && $(RM) lib$(MODULE).so && $(LN_S) lib$(MODULE).so.$(SOVERSION) lib$(MODULE).so + $(INSTALL_PROGRAM) libwine.so.$(SOVERSION) $(libdir)/libwine.so.$(SOVERSION) + cd $(libdir) && $(RM) libwine.so && $(LN_S) libwine.so.$(SOVERSION) libwine.so -install_a: lib$(MODULE).a +install_a: libwine.a [ -d $(libdir) ] || $(MKDIR) $(libdir) - $(INSTALL_DATA) lib$(MODULE).a $(libdir)/lib$(MODULE).a + $(INSTALL_DATA) libwine.a $(libdir)/libwine.a install:: all $(LIBEXT:%=install_%) $(INSTALLSUBDIRS:%=%/__install__) [ -d $(bindir) ] || $(MKDIR) $(bindir) @@ -151,29 +155,36 @@ uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__) cd $(libdir) && $(RM) libwine.a libwine.so libwine.so.$(SOVERSION) cd $(bindir) && $(RM) wine dosmod -lib$(MODULE).so.$(SOVERSION): $(OBJS) Makefile.in Make.rules.in +libwine.so.$(SOVERSION): $(OBJS) Makefile.in Make.rules.in $(LDSHARED) $(OBJS) -o $@ -lib$(MODULE).so: lib$(MODULE).so.$(SOVERSION) - $(RM) $@ && $(LN_S) lib$(MODULE).so.$(SOVERSION) $@ +libwine.so: libwine.so.$(SOVERSION) + $(RM) $@ && $(LN_S) libwine.so.$(SOVERSION) $@ -lib$(MODULE).a: $(OBJS) Makefile.in Make.rules.in +libwine.a: $(OBJS) Makefile.in Make.rules.in $(RM) $@ $(AR) $@ $(OBJS) $(RANLIB) $@ -$(EMUOBJS) $(LIBOBJS) $(DLLOBJS) $(PROGRAMS) $(LIBPROGRAMS): dummy +$(EMUOBJS) $(LIBOBJS) $(DLLOBJS) $(PROGRAMS) $(LIBPROGRAMS) $(LIBRARIES): dummy @cd `dirname $@` && $(MAKE) `basename $@` -$(EMUOBJS) $(LIBOBJS) $(DLLOBJS) $(PROGRAMS) $(DLLDIR): tools +# Dependencies between directories -$(LIBPROGRAMS): tools dlls lib$(MODULE).$(LIBEXT) +$(EMUOBJS) $(LIBOBJS) $(DLLOBJS) $(PROGRAMS) dlls: tools + +$(LIBPROGRAMS): tools dlls libwine.$(LIBEXT) libwine_unicode.$(LIBEXT) + +server tools dlls: libwine_unicode.$(LIBEXT) + +libwine_unicode.$(LIBEXT): unicode/libwine_unicode.$(LIBEXT) + $(RM) $@ && $(LN_S) unicode/libwine_unicode.$(LIBEXT) $@ $(LIBLINTS) $(EMULINTS): dummy @cd `dirname $@` && $(MAKE) lint checklink:: - $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -lwine $(LIBS) && $(RM) checklink + $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -lwine -lwine_unicode $(LIBS) && $(RM) checklink install_programs: dummy @cd programs && $(MAKE) install @@ -196,7 +207,7 @@ htmlpages: for i in $(SUBDIRS); do (cd $$i && $(MAKE) html); done clean:: - $(RM) wine libwine.so.1.0 TAGS + $(RM) wine libwine.so.$(SOVERSION) TAGS distclean: clean $(RM) config.* Make.rules dlls/Makedll.rules include/config.h documentation/wine.man documentation/wine.conf.man diff --git a/configure b/configure index 293d067154f..c182e46b547 100755 --- a/configure +++ b/configure @@ -4553,9 +4553,9 @@ DLLFLAGS="" if test "$LIBEXT" = "so"; then DLLFLAGS="-fPIC" - DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) -L\$(TOPOBJDIR) -lwine" + DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) -L\$(TOPOBJDIR) -lwine -lwine_unicode" else - DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) -L\$(TOPOBJDIR) -lwine \$(X_LIBS) \$(XLIB)" + DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) -L\$(TOPOBJDIR) -lwine -lwine_unicode \$(X_LIBS) \$(XLIB)" echo $ac_n "checking whether the linker supports --[no]-whole-archive (Linux)""... $ac_c" 1>&6 echo "configure:4561: checking whether the linker supports --[no]-whole-archive (Linux)" >&5 if eval "test \"`echo '$''{'ac_cv_c_whole_archive'+set}'`\" = set"; then diff --git a/configure.in b/configure.in index 0b0a53eb9f1..57113e42f08 100644 --- a/configure.in +++ b/configure.in @@ -507,9 +507,9 @@ DLLFLAGS="" if test "$LIBEXT" = "so"; then DLLFLAGS="-fPIC" - DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) -L\$(TOPOBJDIR) -lwine" + DLL_LINK="-L\$(DLLDIR) \$(IMPORTS:%=-l%) -L\$(TOPOBJDIR) -lwine -lwine_unicode" else - DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) -L\$(TOPOBJDIR) -lwine \$(X_LIBS) \$(XLIB)" + DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) -L\$(TOPOBJDIR) -lwine -lwine_unicode \$(X_LIBS) \$(XLIB)" AC_CACHE_CHECK([whether the linker supports --[[no]]-whole-archive (Linux)], ac_cv_c_whole_archive, [saved_cflags=$CFLAGS diff --git a/dlls/Makedll.rules.in b/dlls/Makedll.rules.in index ce995358d0d..0f45318097a 100644 --- a/dlls/Makedll.rules.in +++ b/dlls/Makedll.rules.in @@ -45,7 +45,7 @@ $(ALTNAMES:%=lib%.a): lib$(MODULE).a IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(LIBEXT)) checklink:: lib$(MODULE).$(LIBEXT) $(IMPORTLIBS) - $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) -L$(TOPOBJDIR) -lwine $(EXTRALIBS) $(LIBS) && $(RM) checklink + $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) -L$(TOPOBJDIR) -lwine -lwine_unicode $(EXTRALIBS) $(LIBS) && $(RM) checklink $(IMPORTLIBS): dummy @cd $(DLLDIR) && $(MAKE) `basename $@` diff --git a/server/Makefile.in b/server/Makefile.in index 472e8f14b6a..12fd8de9c9e 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -42,7 +42,7 @@ all: $(PROGRAMS) @MAKE_RULES@ wineserver: $(OBJS) - $(CC) -o $(PROGRAMS) $(OBJS) $(LIBS) + $(CC) -o $(PROGRAMS) $(OBJS) -L$(TOPOBJDIR) -lwine_unicode $(LIBS) install:: $(PROGRAMS) [ -d $(bindir) ] || $(MKDIR) $(bindir) diff --git a/server/atom.c b/server/atom.c index 8dd6f67e32d..1e4652cbe8e 100644 --- a/server/atom.c +++ b/server/atom.c @@ -144,7 +144,7 @@ static int atom_hash( struct atom_table *table, const WCHAR *str ) { int i; WCHAR hash = 0; - for (i = 0; str[i]; i++) hash ^= towupper(str[i]) + i; + for (i = 0; str[i]; i++) hash ^= toupperW(str[i]) + i; return hash % table->entries_count; } diff --git a/server/registry.c b/server/registry.c index f22ab3c0065..bd125320f37 100644 --- a/server/registry.c +++ b/server/registry.c @@ -11,6 +11,7 @@ */ #include +#include #include #include #include diff --git a/server/unicode.c b/server/unicode.c index 3ba4e03224e..892807762fd 100644 --- a/server/unicode.c +++ b/server/unicode.c @@ -4,6 +4,7 @@ * Copyright (C) 1999 Alexandre Julliard */ +#include #include #include "unicode.h" diff --git a/server/unicode.h b/server/unicode.h index 6479761af40..2ef1baedec1 100644 --- a/server/unicode.h +++ b/server/unicode.h @@ -11,47 +11,10 @@ #error This file can only be used in the Wine server #endif -#include "config.h" - -#include -#ifdef HAVE_WCTYPE_H -#include -#endif - #include "windef.h" +#include "wine/unicode.h" #include "object.h" -static inline size_t strlenW( const WCHAR *str ) -{ - const WCHAR *s = str; - while (*s) s++; - return s - str; -} - -static inline int strcmpW( const WCHAR *str1, const WCHAR *str2 ) -{ - while (*str1 && (*str1 == *str2)) { str1++; str2++; } - return *str1 - *str2; -} - -#ifndef HAVE_WCTYPE_H -/* FIXME */ -#define towupper(ch) (HIBYTE(ch) ? ch : (WCHAR)toupper(LOBYTE(ch))) -#endif - -static inline int strcmpiW( const WCHAR *str1, const WCHAR *str2 ) -{ - while (*str1 && (towupper(*str1) == towupper(*str2))) { str1++; str2++; } - return towupper(*str1) - towupper(*str2); -} - -static inline WCHAR *strcpyW( WCHAR *dst, const WCHAR *src ) -{ - const WCHAR *ret = dst; - while ((*dst++ = *src++)); - return (WCHAR *)ret; -} - static inline WCHAR *strdupW( const WCHAR *str ) { size_t len = (strlenW(str) + 1) * sizeof(WCHAR); diff --git a/tools/wmc/Makefile.in b/tools/wmc/Makefile.in index bd75cb84231..9b122b2f5cc 100644 --- a/tools/wmc/Makefile.in +++ b/tools/wmc/Makefile.in @@ -4,6 +4,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ YACCOPT = #-v +LIBEXT = @LIBEXT@ PROGRAMS = wmc MODULE = none @@ -18,17 +19,17 @@ C_SRCS = \ EXTRA_SRCS = mcy.y EXTRA_OBJS = y.tab.o -all: check_unicode $(PROGRAMS) +all: $(PROGRAMS) depend mcl.o: y.tab.h @MAKE_RULES@ -wmc: $(OBJS) $(TOPOBJDIR)/unicode/unicode.o - $(CC) $(CFLAGS) -o wmc $(OBJS) $(TOPOBJDIR)/unicode/unicode.o $(LEXLIB) +wmc: $(OBJS) $(TOPOBJDIR)/libwine_unicode.$(LIBEXT) + $(CC) $(CFLAGS) -o wmc $(OBJS) -L$(TOPOBJDIR) -lwine_unicode $(LEXLIB) -$(TOPOBJDIR)/unicode/unicode.o check_unicode: - cd $(TOPOBJDIR)/unicode && $(MAKE) +$(TOPOBJDIR)/libwine_unicode.$(LIBEXT): + cd $(TOPOBJDIR) && $(MAKE) libwine_unicode.$(LIBEXT) y.tab.c y.tab.h: mcy.y $(YACC) $(YACCOPT) -d -t $(SRCDIR)/mcy.y diff --git a/unicode/.cvsignore b/unicode/.cvsignore index f3c7a7c5da6..da633d49070 100644 --- a/unicode/.cvsignore +++ b/unicode/.cvsignore @@ -1 +1,2 @@ Makefile +libwine_unicode.so.1.0 diff --git a/unicode/Makefile.in b/unicode/Makefile.in index ca840f7e745..10be462cf6d 100644 --- a/unicode/Makefile.in +++ b/unicode/Makefile.in @@ -3,7 +3,11 @@ TOPSRCDIR = @top_srcdir@ TOPOBJDIR = .. SRCDIR = @srcdir@ VPATH = @srcdir@ -MODULE = unicode +LIBEXT = @LIBEXT@ +LDSHARED = @LDSHARED@ +MODULE = none +SOVERSION = 1.0 +SONAME = libwine_unicode.so CODEPAGES = \ 037 \ @@ -69,8 +73,36 @@ C_SRCS = \ wctomb.c \ $(CODEPAGES:%=c_%.c) -all: $(MODULE).o +all: libwine_unicode.$(LIBEXT) @MAKE_RULES@ +libwine_unicode.so.$(SOVERSION): $(OBJS) + $(LDSHARED) $(OBJS) -o $@ + +libwine_unicode.so: libwine_unicode.so.$(SOVERSION) + $(RM) $@ && $(LN_S) libwine_unicode.so.$(SOVERSION) $@ + +libwine_unicode.a: $(OBJS) + $(RM) $@ + $(AR) $@ $(OBJS) + $(RANLIB) $@ + +install_so: libwine_unicode.so.$(SOVERSION) + [ -d $(libdir) ] || $(MKDIR) $(libdir) + $(INSTALL_PROGRAM) libwine_unicode.so.$(SOVERSION) $(libdir)/libwine_unicode.so.$(SOVERSION) + cd $(libdir) && $(RM) libwine_unicode.so && $(LN_S) libwine_unicode.so.$(SOVERSION) libwine_unicode.so + +install_a: libwine_unicode.a + [ -d $(libdir) ] || $(MKDIR) $(libdir) + $(INSTALL_DATA) libwine_unicode.a $(libdir)/libwine_unicode.a + +install:: all $(LIBEXT:%=install_%) + +uninstall:: + cd $(libdir) && $(RM) libwine_unicode.a libwine_unicode.so libwine_unicode.so.$(SOVERSION) + +clean:: + $(RM) libwine_unicode.so.$(SOVERSION) + ### Dependencies: