xdelta-1.1.3/0000777006517700017500000000000007353555420006567 5xdelta-1.1.3/Makefile.in0000644006517700007640000004563107353555417010573 # Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ AS = @AS@ CC = @CC@ CPP = @CPP@ DLLTOOL = @DLLTOOL@ EMACS = @EMACS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ LD = @LD@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NM = @NM@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ top_srcdir_absolute = @top_srcdir_absolute@ INCLUDES = -I$(top_srcdir)/libedsio $(GLIB_CFLAGS) bin_PROGRAMS = xdelta bin_SCRIPTS = xdelta-config xdelta_SOURCES = xdmain.c getopt.c getopt1.c xdelta_LDADD = libxdelta.la $(top_srcdir)/libedsio/libedsio.la $(GLIB_LIBS) -lz include_HEADERS = xdelta.h xd_edsio.h noinst_HEADERS = xdeltapriv.h getopt.h lib_LTLIBRARIES = libxdelta.la libxdelta_la_SOURCES = xdelta.c xdapply.c $(SER_SOURCES) libxdelta_la_LIBADD = $(GLIB_LIBS) EXTRA_DIST = xd.ser $(SER_OUT) xdelta.magic xdelta.prj xdelta.m4 autogen.sh xdelta.dsp xdelta.dsw stamp-ser xdrsync.c SUBDIRS = libedsio . test doc djgpp m4datadir = $(datadir)/aclocal m4data_DATA = xdelta.m4 libxdelta_la_LDFLAGS = -version-info 2:0:0 SER_OUT = xd_edsio.h xd_edsio.c SER_SOURCES = xd_edsio.c BUILT_SOURCES = $(SER_SOURCES) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = xdelta-config LTLIBRARIES = $(lib_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) -I. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ libxdelta_la_DEPENDENCIES = libxdelta_la_OBJECTS = xdelta.lo xdapply.lo xd_edsio.lo PROGRAMS = $(bin_PROGRAMS) xdelta_OBJECTS = xdmain.o getopt.o getopt1.o xdelta_DEPENDENCIES = libxdelta.la $(top_srcdir)/libedsio/libedsio.la xdelta_LDFLAGS = SCRIPTS = $(bin_SCRIPTS) CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ DATA = $(m4data_DATA) HEADERS = $(include_HEADERS) $(noinst_HEADERS) DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ Makefile.am Makefile.in NEWS aclocal.m4 config.guess config.h.in \ config.sub configure configure.in install-sh ltconfig ltmain.sh missing \ mkinstalldirs xdelta-config.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(libxdelta_la_SOURCES) $(xdelta_SOURCES) OBJECTS = $(libxdelta_la_OBJECTS) $(xdelta_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .lo .o .s $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in cd $(srcdir) && $(ACLOCAL) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) config.h: stamp-h @if test ! -f $@; then \ rm -f stamp-h; \ $(MAKE) stamp-h; \ else :; fi stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=config.h \ $(SHELL) ./config.status @echo timestamp > stamp-h 2> /dev/null $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/stamp-h.in @if test ! -f $@; then \ rm -f $(srcdir)/stamp-h.in; \ $(MAKE) $(srcdir)/stamp-h.in; \ else :; fi $(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null mostlyclean-hdr: clean-hdr: distclean-hdr: -rm -f config.h maintainer-clean-hdr: xdelta-config: $(top_builddir)/config.status xdelta-config.in cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-libLTLIBRARIES: clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) distclean-libLTLIBRARIES: maintainer-clean-libLTLIBRARIES: install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) list='$(lib_LTLIBRARIES)'; for p in $$list; do \ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ done .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: .c.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .s.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .S.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: maintainer-clean-libtool: libxdelta.la: $(libxdelta_la_OBJECTS) $(libxdelta_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libxdelta_la_LDFLAGS) $(libxdelta_la_OBJECTS) $(libxdelta_la_LIBADD) $(LIBS) mostlyclean-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done xdelta: $(xdelta_OBJECTS) $(xdelta_DEPENDENCIES) @rm -f xdelta $(LINK) $(xdelta_LDFLAGS) $(xdelta_OBJECTS) $(xdelta_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_SCRIPTS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ else if test -f $(srcdir)/$$p; then \ echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ else :; fi; fi; \ done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) list='$(bin_SCRIPTS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ done install-m4dataDATA: $(m4data_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(m4datadir) @list='$(m4data_DATA)'; for p in $$list; do \ if test -f $(srcdir)/$$p; then \ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(m4datadir)/$$p"; \ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(m4datadir)/$$p; \ else if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(m4datadir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(m4datadir)/$$p; \ fi; fi; \ done uninstall-m4dataDATA: @$(NORMAL_UNINSTALL) list='$(m4data_DATA)'; for p in $$list; do \ rm -f $(DESTDIR)$(m4datadir)/$$p; \ done install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(includedir) @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) list='$(include_HEADERS)'; for p in $$list; do \ rm -f $(DESTDIR)$(includedir)/$$p; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. @SET_MAKE@ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $(MAKEFLAGS); amf=$$2; \ dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ test "$$subdir" = "." && dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist -rm -rf $(distdir) GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \ cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) dist -rm -rf $(distdir) @banner="$(distdir).tar.gz is ready for distribution"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ echo "$$dashes" dist: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) distdir: $(DISTFILES) -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done for subdir in $(SUBDIRS); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ chmod 777 $(distdir)/$$subdir; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ fi; \ done getopt.o: getopt.c config.h getopt1.o: getopt1.c config.h getopt.h xd_edsio.lo xd_edsio.o : xd_edsio.c xdelta.h xd_edsio.h libedsio/edsio.h \ config.h libedsio/edsio_edsio.h xdapply.lo xdapply.o : xdapply.c xdelta.h xd_edsio.h libedsio/edsio.h \ config.h libedsio/edsio_edsio.h xdeltapriv.h xdelta.lo xdelta.o : xdelta.c xdelta.h xd_edsio.h libedsio/edsio.h \ config.h libedsio/edsio_edsio.h xdeltapriv.h xdmain.o: xdmain.c getopt.h xdelta.h xd_edsio.h libedsio/edsio.h \ config.h libedsio/edsio_edsio.h info-am: info: info-recursive dvi-am: dvi: dvi-recursive check-am: all-am check: check-recursive installcheck-am: installcheck: installcheck-recursive all-recursive-am: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive install-exec-am: install-libLTLIBRARIES install-binPROGRAMS \ install-binSCRIPTS install-exec: install-exec-recursive install-data-am: install-m4dataDATA install-includeHEADERS install-data: install-data-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-recursive uninstall-am: uninstall-libLTLIBRARIES uninstall-binPROGRAMS \ uninstall-binSCRIPTS uninstall-m4dataDATA \ uninstall-includeHEADERS uninstall: uninstall-recursive all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \ $(HEADERS) config.h all-redirect: all-recursive-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: installdirs-recursive installdirs-am: $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) \ $(DESTDIR)$(bindir) $(DESTDIR)$(m4datadir) \ $(DESTDIR)$(includedir) mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean-am: mostlyclean-hdr mostlyclean-libLTLIBRARIES \ mostlyclean-compile mostlyclean-libtool \ mostlyclean-binPROGRAMS mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-recursive clean-am: clean-hdr clean-libLTLIBRARIES clean-compile clean-libtool \ clean-binPROGRAMS clean-tags clean-generic \ mostlyclean-am clean: clean-recursive distclean-am: distclean-hdr distclean-libLTLIBRARIES distclean-compile \ distclean-libtool distclean-binPROGRAMS distclean-tags \ distclean-generic clean-am -rm -f libtool distclean: distclean-recursive -rm -f config.status maintainer-clean-am: maintainer-clean-hdr \ maintainer-clean-libLTLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ maintainer-clean-binPROGRAMS maintainer-clean-tags \ maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-recursive -rm -f config.status .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ distclean-compile clean-compile maintainer-clean-compile \ mostlyclean-libtool distclean-libtool clean-libtool \ maintainer-clean-libtool mostlyclean-binPROGRAMS distclean-binPROGRAMS \ clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ install-binPROGRAMS uninstall-binSCRIPTS install-binSCRIPTS \ uninstall-m4dataDATA install-m4dataDATA uninstall-includeHEADERS \ install-includeHEADERS install-data-recursive uninstall-data-recursive \ install-exec-recursive uninstall-exec-recursive installdirs-recursive \ uninstalldirs-recursive all-recursive check-recursive \ installcheck-recursive info-recursive dvi-recursive \ mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ install-exec-am install-exec install-data-am install-data install-am \ install uninstall-am uninstall all-redirect all-am all installdirs-am \ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # # Rules for the generated code # stamp-ser: $(top_srcdir)/libedsio/edsio.el xd.ser $(top_srcdir)/libedsio/edsio-comp xd.ser touch stamp-ser $(SER_OUT): stamp-ser # # # # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xdelta-1.1.3/README0000644006517700017500000001555007317065460007371 -*- Text -*- Xdelta -- A binary delta generator Announcing version 1.1.2 of Xdelta. Xdelta is an application program designed to compute changes between files. These changes (deltas) are similar to the output of the "diff" program in that they may be used to store and transmit only the changes between files. However, unlike diff, the output of Xdelta is not expressed in a human-readable format--Xdelta can also also apply these deltas to a copy of the original file. Xdelta uses a fast, linear algorithm and performs well on both binary and text files. Xdelta 1.1.2 is a stable, maintenence release. New, ongoing work on Xdelta has focused on a new storage system with features similar to the RCS command set. For more information on new development, see the Xdelta-2.0 release series at http://xdelta.sourceforge.net. Xdelta was designed and implemented by Joshua MacDonald. The delta algorithm is based on the Rsync algorithm, though implementation and interface considerations leave the two programs quite distinct. The Rsync algorithm is due to Andrew Tridgell and Paul Mackerras. To compile and install Xdelta, read the instructions in the INSTALL file. Once you have done this, you should at least read the first few sections of the documentation. It is available in info format. All documentation is located in the doc/ subdirectory. This release, version 1.1.2, and future releases of Xdelta can be found at http://xdelta.sourceforge.net. Xdelta is released under the GNU Library Public License (GPL), see the file COPYING for details. There is mailing list for announcements: xdelta-announce@lists.sourceforge.net you can subscribe to the mailing list or file bug reports through Sourceforge at: http://sourceforge.net/projects/xdelta/ Comments about Xdelta can be addressed to the following addresses: jmacd@cs.berkeley.edu The man page describes how to use Xdelta in more detail: NAME xdelta - Invoke Xdelta SYNOPSIS xdelta subcommand [ option... ] [ operand... ] DESCRIPTION Xdelta provides the ability to generate deltas between a pair of files and later apply those deltas. It operates similar to the diff and patch commands, but works on binary files and does not produce a human readable output. Xdelta has three subcommands, delta, patch, and info. Delta accepts two file versions and produces a delta, while patch accepts the original file version and delta and produces the second version. The info command prints useful information about a delta. Each subcommand will be detailed seperately. Gzip processing Attempting to compute a delta between compressed input files usually results in poor compression. This is because small differences between the original contents causes changes in the compression of whole blocks of data. To simplify things, Xdelta implements a special case for gzip(1) compressed files. If any version input to the delta command is recognized as having gzip compression, it will be automatically decompressed into a temporary location prior to comparison. This temporary location is either the value of the TMPDIR environment variable, if set, otherwise "/tmp". The Xdelta patch header contains a flag indicating that the reconstructed version should be recompressed after applying the patch. In general, this allows Xdelta to operate transparently on gzip compressed inputs. There is one potential problem when automatically processing gzip compressed files, which is that the recompressed content does not always match byte-for-byte with the original compressed content. The uncompressed content still matches, but if there is an external integrity check such as cryptographic signature verification, it may fail. To prevent this from happening, the --pristine option disables automatic gzip processing. MD5 integrity check By default, Xdelta always verifies the MD5 checksum of the files it reconstructs. This prevents you from supplying an incorrect input during patch, which would result in corrupt output. Because of this feature, you can feel confident that patch has produced valid results. The --noverify option disables MD5 verification, but this is only recommended for performance testing. Compressed patch format Xdelta uses a fairly simple encoding for its delta, then applies zlib compression to the result. You should not have to post-compress an Xdelta delta. Delta The delta subcommand has the following synopsis: xdelta delta [ option... ] fromfile tofile patchout Computes a delta from fromfile to tofile and writes it to patchout Patch The patch subcommand has the following synopsis: xdelta patch [ option... ] patchin [ fromfile [ tofile ]] Applies patchin to fromfile and produces a reconstructed version of tofile. If fromfile was omitted, Xdelta attempts to use the original fromfile name, which is stored in the delta. The from file must be identical to the one used to create the delta. If its length or MD5 checksum differs, patch will abort with an error message. If tofile was omitted, Xdelta attempts to use the original tofile name, which is also stored in the delta. If the original tofile name already exists, a unique filename extension will be added to avoid destroying any existing data. Info The info subcommand has the following synopsis: xdelta info patchinfo Prints information about patchinfo and the version it reconstructs, including file names, lengths, and MD5 checksums. Options -0..9 Set the zlib compression level. Zero indicates no compression. Nine indicates maximum compression. -h, --help Print a short help message and exit. -q, --quiet Quiet. Surpresses several warning messages. -v, --version Print the Xdelta version number and exit. -V, --verbose Verbose. Prints a bit of extra information. -n, --noverify No verify. Turns off MD5 checksum verification of the input and output files. -m=SIZE, --maxmem=SIZE Set an upper bound on the size of an in-memory page cache. For example, --maxmem=32M will use a 32 megabyte page cache. -s=BLOCK_SIZE Set the block size, unless it was hard coded (20% speed improvement). Should be a power of 2. -p, --pristine Disable the automatic decompression of gzipped inputs, to prevent unexpected differences in the re-compressed content. xdelta-1.1.3/stamp-h.in0000644006517700017500000000001207353554715010403 timestamp xdelta-1.1.3/AUTHORS0000644006517700017500000000024607315313177007554 The author is Joshua MacDonald, . The Rsync algorithm, which inspired the core delta algorithm, is due to Andrew Tridgell and Paul Mackerras. xdelta-1.1.3/COPYING0000644006517700017500000004307607311304625007541 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xdelta-1.1.3/ChangeLog0000644006517700017500000000000007315313264010237 xdelta-1.1.3/INSTALL0000644006517700017500000002040307315273635007536 -*- Text -*- XDelta depends on glib 1.2.8 or later zlib 1.1.3 or later You can get glib from ftp://ftp.gtk.org/pub/gtk/v1.2 You can get zlib from ftp://ftp.cdrom.com/pub/infozip/zlib To install, make sure these packages are installed and your compiler and linker either locates zlib by default or that the CFLAGS environment variable contains an appropriate include directive and the LDFLAGS environment variable contains a suitable linker directive. Then run ./configure Then run make Then run make install Below follows the standard GNU INSTALL file, which contains general troubleshooting tips. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. xdelta-1.1.3/Makefile.am0000644006517700017500000000207207315313424010532 INCLUDES = -I$(top_srcdir)/libedsio $(GLIB_CFLAGS) bin_PROGRAMS = xdelta bin_SCRIPTS = xdelta-config xdelta_SOURCES = xdmain.c getopt.c getopt1.c xdelta_LDADD = libxdelta.la \ $(top_srcdir)/libedsio/libedsio.la \ $(GLIB_LIBS) \ -lz include_HEADERS = xdelta.h xd_edsio.h noinst_HEADERS = xdeltapriv.h getopt.h lib_LTLIBRARIES = libxdelta.la libxdelta_la_SOURCES = xdelta.c xdapply.c $(SER_SOURCES) libxdelta_la_LIBADD = $(GLIB_LIBS) EXTRA_DIST = xd.ser $(SER_OUT) xdelta.magic xdelta.prj xdelta.m4 \ autogen.sh xdelta.dsp xdelta.dsw stamp-ser xdrsync.c SUBDIRS = libedsio . test doc djgpp m4datadir = $(datadir)/aclocal m4data_DATA = xdelta.m4 ## $Format: "libxdelta_la_LDFLAGS = -version-info $LibCurrent$:$LibRevision$:$LibAge$" $ libxdelta_la_LDFLAGS = -version-info 2:0:0 # # Rules for the generated code # stamp-ser: $(top_srcdir)/libedsio/edsio.el xd.ser $(top_srcdir)/libedsio/edsio-comp xd.ser touch stamp-ser SER_OUT = xd_edsio.h xd_edsio.c $(SER_OUT): stamp-ser SER_SOURCES = xd_edsio.c BUILT_SOURCES = $(SER_SOURCES) # # # xdelta-1.1.3/NEWS0000644006517700017500000001775407353555316007224 XDelta NEWS -- history of user-visible changes. -*- Text -*- $Date: Fri, 29 Jun 2001 06:01:08 -0700 $ $ReleaseVersion: 1.1.3 $ Please send bug reports to xdelta-bugs@XCF.Berkeley.EDU. See the file `README' for a description of how to report bugs. ** Changes since version 1.1.2 * Correct error message format for the case when gzread fails trying to automatically decompress a corrupted GZIP file. The situation itself--corrupt GZIP files--should be dealt with the -p (--pristine) option, which disables GZIP file recognition. Reported by Ben Escoto. * Apply a patch from Klaus Dittrich for building on HPUX with the native compiler. There is now a script called "contrib/build_hpux". ** Changes since version 1.1.1 * This code release is a distant fork of the 2.0 release. It will hopefully be replaced. * When 'patch' supplies its default TO file name recorded in the delta, it still generates a unique file name to avoid overwriting an existing copy. Use the 'xdelta info' command to see what file names are contained in the delta. * The code for writing patches to stdout was broken in the case where gzip compression is used. Writing patches to stdout has therefore been disabled. The problem is a limitation in the gzdopen/gzwrite functions provided by zlib--you cannot determine how many bytes have been written to the file descriptor without dup-ing the FD beforehand and then lseek-ing afterwards, which does not work correctly if the output file is not seekable. * By default, Xdelta uses a hard-coded 16 byte block size. If you're working with large files, try #undef XDELTA_HARDCODE_SIZE in xdelta.h then use -s BLOCKSIZE (--blocksize=BLOCKSIZE), which should be a power of 2. * New test program in the 'test' subdirectory, which runs comparisons against "diff --rcs -a" and also verifies the "xdelta patch" command. * Incorporate DJGPP patches from Richard Dawe . You can find his versions directly at: ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2apps/xdlt112b.zip ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2apps/xdlt112s.zip * Updated xdelta(1) man page. * Updated autoconf (2.50), automake (1.4-p4), libtool (1.4) scripts, which includes updated config.guess and config.sub scripts. * Correct some backward compatibility issues: strcmp() was not being tested == 0 for formats older than 1.0.4. * Update GLIB version requirement, now 1.2.8. * We really need support for 64bit file sizes... perhaps the next version? ** Changes since version 1.1.0 * No one was were able to build the 1.1.0 release because it depended on a version of glib which will not be distributed for some time. This version backs out those dependencies and now requires glib-1.2.1. ** Changes since version 1.0.6 * The 64M limit on file sizes has been lifted. File lengths are now limited by the size of a 32-bit integer. * The internal data structures were changed and some of the experimental bits of the interface have been moved out of libxdelta, resulting in a simpler interface. Old patch files are still supported. ** Changes since version 1.0.5 * There are 8 bytes of space in the patch format's header that are reserved for future use. They are not currently used, but were also not being initialized, making it possible for two deltas produced in the same manner to differ. This was exposed by comparing deltas produced between the same files on Windows and Linux. With this patch, the results should be identical. ** Changes since version 1.0.4 * The code now compiles natively under Windows. I used MS VC++ 5.0. It depends on glib and zlib, but I don't feel like documenting the build process yet. I have had some trouble with the zlib DLLs and had to build my own, so you can't build it yourself yet. There is a pre-built version at ftp://ftp.xcf.berkeley.edu/pub/xdelta/xdelta-1.0.5.win32.zip * Many changes required to keep Xdelta working with PRCS 2. Mostly this involved keeping up to date with some code that is shared between the two. All the shared code is now in the "libedsio" subdirectory, which stands for "Error Delivery and Serialized IO". ** Changes since version 1.0.3 * Slight change in file format to improve detection of and error messages regarding corrupt deltas (specifically, those left behing when an xdelta process is killed while computing a delta). This means 1.0.0-1.0.3 will not read these new deltas, they will report a bad magic number. * Improve several error messages related to corrupt deltas. ** Changes since version 1.0.2 * Fix a few bugs, especially one related to the implementation of -m, and a couple more which were shaken out by testing on a pair of emacs releases (~55M each). These changes only affect the xdelta application, the library is unchanged. * Add a new command `xdelta info' that lists information about a delta, for example: $ xdelta info some.patch xdelta: version 1.0.3 found patch version 1.0 in some.patch xdelta: patch contents are compressed xdelta: patch from: from xdelta: patch from length: 53309440 xdelta: patch from md5: c0ddcb6904d40da7cf1eae5e6bdbbc01 xdelta: patch to: to xdelta: patch to length: 55377920 xdelta: patch to md5: 00b3dd4d1a9b450bc5b8991b183013fb xdelta: patch insert length: 2436426 xdelta: patch inst count: 253649 ** Changes since version 1.0.1 * Fix minor typos, and build improvements. There is now a gtk-style 'xdelta-config' program and autoconf macro to locate the library. ** Changes since version 1.0.0 * Fix incorrect usage report in --help output for the patch command. * Abort when directories are specified, there is no recursive mode. * Now requires glib-1.1.5. * The new ``pristine'' option (-p, --pristine) disables automatic uncompression of compressed input data, and is for use when data integrity is being externally verified. This enables a tool written by Manish Singh (yosh@gimp.org) to compute deltas between the Debian dpkg utility's .deb format. * A draft paper describing its algorithms, rational, advanced features, and future work is now available at ftp://ftp.xcf.berkeley.edu/pub/xdelta/xdelta.ps. ** Changes since version 0.24 * This version is a complete rewrite, and removes some of the features available in version 0. Featuring: - A completely new and much improved library interface. This code is a complete rewrite. - An optimized implementation of the XDelta algorithm. - A drastic memory reduction. - The library stream-processes files where possible and uses a page- based interface when seeking is required (allowing the application to run in bounded memory on large files). - There is now a little documentation. A man page and the beginnings of texinfo documentation. - Includes several advanced features used by PRCS version 2, see the documentation for more information. - Includes a minimal implementation of the Rsync algorithm, also used by PRCS version 2. - Uses an abstract file handle interface, the library has very few system dependencies. This allows the library client to compute MD5 checksums in a single-pass as XDelta reads files, use pre- computed checksums, or disable checksum verification entirely. - Compression and file-unarchival have been removed from the library, these features are orthogonal. At the application level: - GDBM archive experiment has been removed. This functionality is implemented directly in PRCS version 2 using the present library interface. - Base 64 encoding support has been removed for technical reasons. - Can no longer accept patches from stdin, due to the same technical reasons (the patch instruction index is stored at the end of the file, requiring seeking). - Automatic detection and un-archival of RPM and dpkg file formats has been removed. Automatic uncompression of gzipped files is still supported. - The GIMP plugin is no longer supported. xdelta-1.1.3/aclocal.m40000644006517700017500000006520507353554707010362 dnl aclocal.m4 generated automatically by aclocal 1.4 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. # Like AC_CONFIG_HEADER, but automatically create stamp file. AC_DEFUN(AM_CONFIG_HEADER, [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. dnl This file resides in the same directory as the config header dnl that is generated. We must strip everything past the first ":", dnl and everything past the last "/". AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, <>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, <>; do case " <<$>>CONFIG_HEADERS " in *" <<$>>am_file "*<<)>> echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ;; esac am_indx=`expr "<<$>>am_indx" + 1` done<<>>dnl>>) changequote([,]))]) # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 1 dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN(AM_INIT_AUTOMAKE, [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] AC_SUBST(VERSION) dnl test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) # # Check to make sure that the build environment is sane. # AC_DEFUN(AM_SANITY_CHECK, [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "[$]2" = conftestfile ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi rm -f conftest* AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. AC_DEFUN(AM_MISSING_PROG, [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found) else $1="$3/missing $2" AC_MSG_RESULT(missing) fi AC_SUBST($1)]) # Add --enable-maintainer-mode option to configure. # From Jim Meyering # serial 1 AC_DEFUN(AM_MAINTAINER_MODE, [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT($USE_MAINTAINER_MODE) AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) # Define a conditional. AC_DEFUN(AM_CONDITIONAL, [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi]) # serial 40 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl # Save cache, so that ltconfig can load it AC_CACHE_SAVE # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig AC_CACHE_LOAD # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log ]) AC_DEFUN(AC_LIBTOOL_SETUP, [AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], [libtool_flags="$libtool_flags --enable-dlopen"]) ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [libtool_flags="$libtool_flags --enable-win32-dll"]) AC_ARG_ENABLE(libtool-lock, [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$host" in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_SAVE AC_LANG_C AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_RESTORE]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; ]) esac ]) # AC_LIBTOOL_DLOPEN - enable checks for dlopen support AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_SHARED, [dnl define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac], enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) # AC_DISABLE_SHARED - set the default shared flag to --disable-shared AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_SHARED(no)]) # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_STATIC, [dnl define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac], enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) # AC_DISABLE_STATIC - set the default static flag to --disable-static AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_STATIC(no)]) # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], changequote([, ])dnl [p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_ENABLE_FAST_INSTALL(no)]) # AC_PROG_LD - find the path to the GNU or non-GNU linker AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. changequote(,)dnl [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' changequote([,])dnl # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi]) LD="$ac_cv_path_LD" if test -n "$LD"; then AC_MSG_RESULT($LD) else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_SUBST(LD) AC_PROG_LD_GNU ]) AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) ]) # AC_PROG_NM - find the path to a BSD-compatible name lister AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) AC_SUBST(NM) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case "$host" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, main, LIBM="-lm") ;; esac ]) # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library, adds --enable-ltdl-convenience to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl case "$enable_ltdl_convenience" in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library, and adds --enable-ltdl-install to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl AC_CHECK_LIB(ltdl, main, [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], [if test x"$enable_ltdl_install" = xno; then AC_MSG_WARN([libltdl not installed, but installation disabled]) else enable_ltdl_install=yes fi ]) if test x"$enable_ltdl_install" = x"yes"; then ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" INCLTDL= fi ]) dnl old names AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl dnl This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL])dnl # Configure paths for GLIB # Owen Taylor 97-11-3 dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or dnl gthread is specified in MODULES, pass to glib-config dnl AC_DEFUN(AM_PATH_GLIB, [dnl dnl Get the cflags and libraries from the glib-config script dnl AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)], glib_config_prefix="$withval", glib_config_prefix="") AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)], glib_config_exec_prefix="$withval", glib_config_exec_prefix="") AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program], , enable_glibtest=yes) if test x$glib_config_exec_prefix != x ; then glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix" if test x${GLIB_CONFIG+set} != xset ; then GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config fi fi if test x$glib_config_prefix != x ; then glib_config_args="$glib_config_args --prefix=$glib_config_prefix" if test x${GLIB_CONFIG+set} != xset ; then GLIB_CONFIG=$glib_config_prefix/bin/glib-config fi fi for module in . $4 do case "$module" in gmodule) glib_config_args="$glib_config_args gmodule" ;; gthread) glib_config_args="$glib_config_args gthread" ;; esac done AC_PATH_PROG(GLIB_CONFIG, glib-config, no) min_glib_version=ifelse([$1], ,0.99.7,$1) AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) no_glib="" if test "$GLIB_CONFIG" = "no" ; then no_glib=yes else GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags` GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs` glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_glibtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$GLIB_LIBS $LIBS" dnl dnl Now check if the installed GLIB is sufficiently new. (Also sanity dnl checks the results of glib-config to some extent dnl rm -f conf.glibtest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.glibtest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_glib_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_glib_version"); exit(1); } if ((glib_major_version != $glib_config_major_version) || (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If glib-config was correct, then it is best\n"); printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n"); printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || (glib_micro_version != GLIB_MICRO_VERSION)) { printf("*** GLIB header files (version %d.%d.%d) do not match\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", glib_major_version, glib_minor_version, glib_micro_version); } else { if ((glib_major_version > major) || ((glib_major_version == major) && (glib_minor_version > minor)) || ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", glib_major_version, glib_minor_version, glib_micro_version); printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the glib-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n"); printf("*** correct copy of glib-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_glib" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$GLIB_CONFIG" = "no" ; then echo "*** The glib-config script installed by GLIB could not be found" echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GLIB_CONFIG environment variable to the" echo "*** full path to glib-config." else if test -f conf.glibtest ; then : else echo "*** Could not run GLIB test program, checking why..." CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" AC_TRY_LINK([ #include #include ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GLIB was incorrectly installed" echo "*** or that you have moved GLIB since it was installed. In the latter case, you" echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GLIB_CFLAGS="" GLIB_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) rm -f conf.glibtest ]) xdelta-1.1.3/config.guess0000755006517700017500000007477407353236517011051 #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 # Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # The master version of this file is at the FSF in /home/gd/gnu/lib. # Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit system type (host/target name). # # Only a few systems have been added to this list; please add others # (but try to keep the structure clean). # # Use $HOST_CC if defined. $CC may point to a cross-compiler if test x"$CC_FOR_BUILD" = x; then if test x"$HOST_CC" != x; then CC_FOR_BUILD="$HOST_CC" else if test x"$CC" != x; then CC_FOR_BUILD="$CC" else CC_FOR_BUILD=cc fi fi fi # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-cbm-sysv4 exit 0;; amiga:NetBSD:*:*) echo m68k-cbm-netbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; arm32:NetBSD:*:*) echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; atari*:NetBSD:*:*) echo m68k-atari-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:NetBSD:*:*) echo m68k-apple-netbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; macppc:NetBSD:*:*) echo powerpc-apple-netbsd${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:4) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=4.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) sed 's/^ //' << EOF >$dummy.c #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` rm -f $dummy.c $dummy esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i?86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; hppa*:OpenBSD:*:*) echo hppa-unknown-openbsd exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*T3E:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F300:UNIX_System_V:*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; F301:UNIX_System_V:*:*) echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` exit 0 ;; hp3[0-9][05]:NetBSD:*:*) echo m68k-hp-netbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; i?86:BSD/386:*:* | i?86:BSD/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) if test -x /usr/bin/objformat; then if test "elf" = "`/usr/bin/objformat`"; then echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` exit 0 fi fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_help_string=`cd /; ld --help 2>&1` ld_supported_emulations=`echo $ld_help_string \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g s/.*supported emulations: *// s/ .*// p'` case "$ld_supported_emulations" in *ia64) echo "${UNAME_MACHINE}-unknown-linux" exit 0 ;; i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; elf32arm*) echo "${UNAME_MACHINE}-unknown-linux-gnu" exit 0 ;; armelf_linux*) echo "${UNAME_MACHINE}-unknown-linux-gnu" exit 0 ;; m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; elf32ppc) # Determine Lib Version cat >$dummy.c < #if defined(__GLIBC__) extern char __libc_version[]; extern char __libc_release[]; #endif main(argc, argv) int argc; char *argv[]; { #if defined(__GLIBC__) printf("%s %s\n", __libc_version, __libc_release); #else printf("unkown\n"); #endif return 0; } EOF LIBC="" $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy | grep 1\.99 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f $dummy.c $dummy echo powerpc-unknown-linux-gnu${LIBC} exit 0 ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then sed 's/^ //' <$dummy.s .globl main .ent main main: .frame \$30,0,\$26,0 .prologue 0 .long 0x47e03d80 # implver $0 lda \$2,259 .long 0x47e20c21 # amask $2,$1 srl \$1,8,\$2 sll \$2,2,\$2 sll \$0,3,\$0 addl \$1,\$0,\$0 addl \$2,\$0,\$0 ret \$31,(\$26),1 .end main EOF LIBC="" $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" ;; 15) UNAME_MACHINE="alphaev5" ;; 14) UNAME_MACHINE="alphaev56" ;; 10) UNAME_MACHINE="alphapca56" ;; 16) UNAME_MACHINE="alphaev6" ;; esac objdump --private-headers $dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. # If ld does not provide *any* "supported emulations:" # that means it is gnuoldld. echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 case "${UNAME_MACHINE}" in i?86) VENDOR=pc; ;; *) VENDOR=unknown; ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c < #ifdef __cplusplus int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; i?86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i?86:*:5:7*) # Fixed at (any) Pentium or better UNAME_MACHINE=i586 if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; i?86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:*:6*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-qnx-qnx${UNAME_VERSION} exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) printf ("vax-dec-bsd\n"); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi #echo '(Unable to guess system type)' 1>&2 exit 1 xdelta-1.1.3/config.h.in0000644006517700017500000000051007353236477010532 /* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY xdelta-1.1.3/config.sub0000755006517700017500000005772707353236517010513 #! /bin/sh # Configuration validation subroutine script, version 1.1. # Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. if [ x$1 = x ] then echo Configuration name missing. 1>&2 echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 echo "or $0 ALIAS" 1>&2 echo where ALIAS is a recognized configuration type. 1>&2 exit 1 fi # First pass through any local machine types. case $1 in *local*) echo $1 exit 0 ;; *) ;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in linux-gnu*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | miprs64vr5000el | mcore \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ | thumb | d10v | fr30) basic_machine=$basic_machine-unknown ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i[34567]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ | f301-* | armv*-* | t3e-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* ) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-cbm ;; amigaos | amigados) basic_machine=m68k-cbm os=-amigaos ;; amigaunix | amix) basic_machine=m68k-cbm os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [ctj]90-cray) basic_machine=c90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i[34567]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i[34567]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; i386-go32 | go32) basic_machine=i386-unknown os=-go32 ;; i386-mingw32 | mingw32) basic_machine=i386-unknown os=-mingw32 ;; i386-qnx | qnx) basic_machine=i386-qnx ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) basic_machine=i386-unknown os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; np1) basic_machine=np1-gould ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=rs6000-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sparc | sparcv9) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -qnx) os=-qnx4 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -*MiNT) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f301-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -*MiNT) vendor=atari ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os xdelta-1.1.3/configure0000755006517700017500000025260207353554710010422 #! /bin/sh # From configure.in configure.in,v 1.2 1998/10/03 00:17:50 jmacd Exp # Like AC_CONFIG_HEADER, but automatically create stamp file. # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 1 # # Check to make sure that the build environment is sane. # # Add --enable-maintainer-mode option to configure. # From Jim Meyering # serial 1 # Define a conditional. # serial 40 AC_PROG_LIBTOOL # AC_LIBTOOL_DLOPEN - enable checks for dlopen support # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. # AC_DISABLE_SHARED - set the default shared flag to --disable-shared # AC_ENABLE_STATIC - implement the --enable-static flag # Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. # AC_DISABLE_STATIC - set the default static flag to --disable-static # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install # AC_PROG_LD - find the path to the GNU or non-GNU linker # AC_PROG_NM - find the path to a BSD-compatible name lister # AC_CHECK_LIBM - check for math library # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for # the libltdl convenience library, adds --enable-ltdl-convenience to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for # the libltdl installable library, and adds --enable-ltdl-install to # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed # to be `${top_builddir}/libltdl'. Make sure you start DIR with # '${top_builddir}/' (note the single quotes!) if your package is not # flat, and, if you're not using automake, define top_builddir as # appropriate in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. # Configure paths for GLIB # Owen Taylor 97-11-3 # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" ac_help="$ac_help --enable-debug turn on debugging [default=no]" ac_help="$ac_help --enable-profile turn on profiling [default=no]" ac_help="$ac_help --enable-shared[=PKGS] build shared libraries [default=yes]" ac_help="$ac_help --enable-static[=PKGS] build static libraries [default=yes]" ac_help="$ac_help --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" ac_help="$ac_help --with-gnu-ld assume the C compiler uses GNU ld [default=no]" ac_help="$ac_help --disable-libtool-lock avoid locking (might break parallel builds)" ac_help="$ac_help --with-glib-prefix=PFX Prefix where GLIB is installed (optional)" ac_help="$ac_help --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)" ac_help="$ac_help --disable-glibtest Do not try to compile and run a test GLIB program" # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=xdelta.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:697: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 echo "configure:750: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "$*" != "X $srcdir/configure conftestfile" \ && test "$*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { echo "configure: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" 1>&2; exit 1; } fi test "$2" = conftestfile ) then # Ok. : else { echo "configure: error: newly created file is older than distributed files! Check your system clock" 1>&2; exit 1; } fi rm -f conftest* echo "$ac_t""yes" 1>&6 if test "$program_transform_name" = s,x,x,; then program_transform_name= else # Double any \ or $. echo might interpret backslashes. cat <<\EOF_SED > conftestsed s,\\,\\\\,g; s,\$,$$,g EOF_SED program_transform_name="`echo $program_transform_name|sed -f conftestsed`" rm -f conftestsed fi test "$program_prefix" != NONE && program_transform_name="s,^,${program_prefix},; $program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" # sed with no file args requires a program. test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo "configure:807: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftestmake <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftestmake fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$ac_t""yes" 1>&6 SET_MAKE= else echo "$ac_t""no" 1>&6 SET_MAKE="MAKE=${MAKE-make}" fi PACKAGE=xdelta VERSION=1.1.3 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } fi missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 echo "configure:846: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (aclocal --version) < /dev/null > /dev/null 2>&1; then ACLOCAL=aclocal echo "$ac_t""found" 1>&6 else ACLOCAL="$missing_dir/missing aclocal" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 echo "configure:859: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoconf --version) < /dev/null > /dev/null 2>&1; then AUTOCONF=autoconf echo "$ac_t""found" 1>&6 else AUTOCONF="$missing_dir/missing autoconf" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 echo "configure:872: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (automake --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake echo "$ac_t""found" 1>&6 else AUTOMAKE="$missing_dir/missing automake" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 echo "configure:885: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoheader --version) < /dev/null > /dev/null 2>&1; then AUTOHEADER=autoheader echo "$ac_t""found" 1>&6 else AUTOHEADER="$missing_dir/missing autoheader" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 echo "configure:898: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (makeinfo --version) < /dev/null > /dev/null 2>&1; then MAKEINFO=makeinfo echo "$ac_t""found" 1>&6 else MAKEINFO="$missing_dir/missing makeinfo" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 echo "configure:913: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE DEBUGFLAG= PROFILEFLAG= # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" : fi # Check whether --enable-profile or --disable-profile was given. if test "${enable_profile+set}" = set; then enableval="$enable_profile" : fi TMPCFLAGS="$CFLAGS" CFLAGS= # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:958: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:988: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1039: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:1071: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 1082 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:1087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:1113: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:1118: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:1146: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:1178: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1199: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1216: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1233: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 CFLAGS=$TMPCFLAGS if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[\ \ ]-Wall[\ \ ]*) ;; *) CFLAGS="$CFLAGS -Wall" ;; esac if test "x$enable_debug" = "xyes"; then DEBUGFLAG="-g" fi if test "x$enable_profile" = "xyes"; then PROFILEFLAG="-pg" fi if test -n "$DEBUGFLAG"; then case " $CFLAGS " in *[\ \ ]$DEBUGFLAG[\ \ ]*) ;; *) CFLAGS="$DEBUGFLAG $CFLAGS" ;; esac else case " $CFLAGS " in *[\ \ ]-O[0-9\ \ ]*) ;; *) CFLAGS="$CFLAGS -O3" ;; esac fi if test -n "$PROFILEFLAG"; then case " $CFLAGS " in *[\ \ ]$PROFILEFLAG[\ \ ]*) ;; *) CFLAGS="$PROFILEFLAG $CFLAGS" ;; esac fi fi # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$ac_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$ac_save_ifs" ;; esac else enable_static=yes fi # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" p=${PACKAGE-default} case "$enableval" in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," for pkg in $enableval; do if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$ac_save_ifs" ;; esac else enable_fast_install=yes fi # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 echo "configure:1370: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 echo "configure:1391: checking build system type" >&5 build_alias=$build case "$build_alias" in NONE) case $nonopt in NONE) build_alias=$host_alias ;; *) build_alias=$nonopt ;; esac ;; esac build=`${CONFIG_SHELL-/bin/sh} $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/'` echo "$ac_t""$build" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1411: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" fi fi RANLIB="$ac_cv_prog_RANLIB" if test -n "$RANLIB"; then echo "$ac_t""$RANLIB" 1>&6 else echo "$ac_t""no" 1>&6 fi # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 echo "configure:1450: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 echo "configure:1474: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 echo "configure:1477: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" else ac_cv_path_LD="$LD" # Let the user override the test with a path. fi fi LD="$ac_cv_path_LD" if test -n "$LD"; then echo "$ac_t""$LD" 1>&6 else echo "$ac_t""no" 1>&6 fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 echo "configure:1513: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi fi echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 echo "configure:1529: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$NM"; then # Let the user override the test. ac_cv_path_NM="$NM" else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then ac_cv_path_NM="$ac_dir/nm -p" break else ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi fi NM="$ac_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 echo "configure:1566: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftestdata if ln -s X conftestdata 2>/dev/null then rm -f conftestdata ac_cv_prog_LN_S="ln -s" else ac_cv_prog_LN_S=ln fi fi LN_S="$ac_cv_prog_LN_S" if test "$ac_cv_prog_LN_S" = "ln -s"; then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" : fi test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. case "$host" in *-*-irix6*) # Find out which ABI we are using. echo '#line 1610 "configure"' > conftest.$ac_ext if { (eval echo configure:1611: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 echo "configure:1632: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* lt_cv_cc_needs_belf=no fi rm -f conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross fi echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; esac # Save cache, so that ltconfig can load it cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache # Actually configure libtool. ac_aux_dir is where install-sh is found. CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ || { echo "configure: error: libtool configure failed" 1>&2; exit 1; } # Reload cache, that may have been modified by ltconfig if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Redirect the config.log output again, so that the ltconfig log is not # clobbered by the next message. exec 5>>./config.log echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:1761: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1774: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:1841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo "configure:1865: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftestmake <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftestmake fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$ac_t""yes" 1>&6 SET_MAKE= else echo "$ac_t""no" 1>&6 SET_MAKE="MAKE=${MAKE-make}" fi for ac_func in gettimeofday do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1895: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 echo "configure:1948: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include int main() { struct tm *tp; ; return 0; } EOF if { (eval echo configure:1962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_time=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_time" 1>&6 if test $ac_cv_header_time = yes; then cat >> confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi for ac_prog in emacs xemacs do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1988: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_EMACS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$EMACS" in /*) ac_cv_path_EMACS="$EMACS" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_EMACS="$EMACS" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_EMACS="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" ;; esac fi EMACS="$ac_cv_path_EMACS" if test -n "$EMACS"; then echo "$ac_t""$EMACS" 1>&6 else echo "$ac_t""no" 1>&6 fi test -n "$EMACS" && break done test -n "$EMACS" || EMACS="emacs" top_srcdir_absolute=`cd $srcdir; pwd` # Check whether --with-glib-prefix or --without-glib-prefix was given. if test "${with_glib_prefix+set}" = set; then withval="$with_glib_prefix" glib_config_prefix="$withval" else glib_config_prefix="" fi # Check whether --with-glib-exec-prefix or --without-glib-exec-prefix was given. if test "${with_glib_exec_prefix+set}" = set; then withval="$with_glib_exec_prefix" glib_config_exec_prefix="$withval" else glib_config_exec_prefix="" fi # Check whether --enable-glibtest or --disable-glibtest was given. if test "${enable_glibtest+set}" = set; then enableval="$enable_glibtest" : else enable_glibtest=yes fi if test x$glib_config_exec_prefix != x ; then glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix" if test x${GLIB_CONFIG+set} != xset ; then GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config fi fi if test x$glib_config_prefix != x ; then glib_config_args="$glib_config_args --prefix=$glib_config_prefix" if test x${GLIB_CONFIG+set} != xset ; then GLIB_CONFIG=$glib_config_prefix/bin/glib-config fi fi for module in . do case "$module" in gmodule) glib_config_args="$glib_config_args gmodule" ;; gthread) glib_config_args="$glib_config_args gthread" ;; esac done # Extract the first word of "glib-config", so it can be a program name with args. set dummy glib-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:2081: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$GLIB_CONFIG" in /*) ac_cv_path_GLIB_CONFIG="$GLIB_CONFIG" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_GLIB_CONFIG="$GLIB_CONFIG" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_GLIB_CONFIG="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_GLIB_CONFIG" && ac_cv_path_GLIB_CONFIG="no" ;; esac fi GLIB_CONFIG="$ac_cv_path_GLIB_CONFIG" if test -n "$GLIB_CONFIG"; then echo "$ac_t""$GLIB_CONFIG" 1>&6 else echo "$ac_t""no" 1>&6 fi min_glib_version=1.2.8 echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6 echo "configure:2116: checking for GLIB - version >= $min_glib_version" >&5 no_glib="" if test "$GLIB_CONFIG" = "no" ; then no_glib=yes else GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags` GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs` glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_glibtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$GLIB_LIBS $LIBS" rm -f conf.glibtest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.glibtest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_glib_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_glib_version"); exit(1); } if ((glib_major_version != $glib_config_major_version) || (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If glib-config was correct, then it is best\n"); printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n"); printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || (glib_micro_version != GLIB_MICRO_VERSION)) { printf("*** GLIB header files (version %d.%d.%d) do not match\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", glib_major_version, glib_minor_version, glib_micro_version); } else { if ((glib_major_version > major) || ((glib_major_version == major) && (glib_minor_version > minor)) || ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", glib_major_version, glib_minor_version, glib_micro_version); printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the glib-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n"); printf("*** correct copy of glib-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } EOF if { (eval echo configure:2215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* no_glib=yes fi rm -fr conftest* fi CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_glib" = x ; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 if test "$GLIB_CONFIG" = "no" ; then echo "*** The glib-config script installed by GLIB could not be found" echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GLIB_CONFIG environment variable to the" echo "*** full path to glib-config." else if test -f conf.glibtest ; then : else echo "*** Could not run GLIB test program, checking why..." CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" cat > conftest.$ac_ext < #include int main() { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } EOF if { (eval echo configure:2259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GLIB was incorrectly installed" echo "*** or that you have moved GLIB since it was installed. In the latter case, you" echo "*** may want to edit the glib-config script: $GLIB_CONFIG" fi rm -f conftest* CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GLIB_CFLAGS="" GLIB_LIBS="" { echo "configure: error: Test for GLIB failed. Download it from ftp://ftp.gtk.org/pub/gtk/v1.2/" 1>&2; exit 1; } fi rm -f conf.glibtest echo $ac_n "checking for gzsetparams in -lz""... $ac_c" 1>&6 echo "configure:2299: checking for gzsetparams in -lz" >&5 ac_lib_var=`echo z'_'gzsetparams | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for zlib.h""... $ac_c" 1>&6 echo "configure:2335: checking for zlib.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:2345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: ZLIB headers not found" 1>&2; exit 1; } fi else echo "$ac_t""no" 1>&6 { echo "configure: error: ZLIB library not found" 1>&2; exit 1; } fi trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile doc/Makefile test/Makefile djgpp/Makefile xdelta-config libedsio/Makefile libedsio/edsio-comp config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@PACKAGE@%$PACKAGE%g s%@VERSION@%$VERSION%g s%@ACLOCAL@%$ACLOCAL%g s%@AUTOCONF@%$AUTOCONF%g s%@AUTOMAKE@%$AUTOMAKE%g s%@AUTOHEADER@%$AUTOHEADER%g s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g s%@MAINT@%$MAINT%g s%@CC@%$CC%g s%@CPP@%$CPP%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g s%@build@%$build%g s%@build_alias@%$build_alias%g s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g s%@RANLIB@%$RANLIB%g s%@LD@%$LD%g s%@NM@%$NM%g s%@LN_S@%$LN_S%g s%@LIBTOOL@%$LIBTOOL%g s%@EMACS@%$EMACS%g s%@top_srcdir_absolute@%$top_srcdir_absolute%g s%@GLIB_CONFIG@%$GLIB_CONFIG%g s%@GLIB_CFLAGS@%$GLIB_CFLAGS%g s%@GLIB_LIBS@%$GLIB_LIBS%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h chmod +x libedsio/edsio-comp xdelta-config exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 xdelta-1.1.3/configure.in0000644006517700017500000000364707353554705011033 dnl -*-Mode: C; comment-start: "dnl "-*- dnl Process this file with autoconf to produce a configure script. AC_REVISION([configure.in,v 1.2 1998/10/03 00:17:50 jmacd Exp])dnl AC_INIT(xdelta.c) AM_CONFIG_HEADER(config.h) dnl $Format: "AM_INIT_AUTOMAKE(xdelta, $ReleaseVersion$, no-define)" $ AM_INIT_AUTOMAKE(xdelta, 1.1.3, no-define) AM_MAINTAINER_MODE DEBUGFLAG= PROFILEFLAG= AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]]) AC_ARG_ENABLE(profile, [ --enable-profile turn on profiling [default=no]]) TMPCFLAGS="$CFLAGS" CFLAGS= AC_PROG_CC AC_PROG_CPP CFLAGS=$TMPCFLAGS changequote(,)dnl if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[\ \ ]-Wall[\ \ ]*) ;; *) CFLAGS="$CFLAGS -Wall" ;; esac if test "x$enable_debug" = "xyes"; then DEBUGFLAG="-g" fi if test "x$enable_profile" = "xyes"; then PROFILEFLAG="-pg" fi if test -n "$DEBUGFLAG"; then case " $CFLAGS " in *[\ \ ]$DEBUGFLAG[\ \ ]*) ;; *) CFLAGS="$DEBUGFLAG $CFLAGS" ;; esac else case " $CFLAGS " in *[\ \ ]-O[0-9\ \ ]*) ;; *) CFLAGS="$CFLAGS -O3" ;; esac fi if test -n "$PROFILEFLAG"; then case " $CFLAGS " in *[\ \ ]$PROFILEFLAG[\ \ ]*) ;; *) CFLAGS="$PROFILEFLAG $CFLAGS" ;; esac fi fi changequote([,])dnl AM_PROG_LIBTOOL AC_HEADER_STDC AC_PROG_MAKE_SET AC_CHECK_FUNCS(gettimeofday) AC_HEADER_TIME AC_PATH_PROGS(EMACS, emacs xemacs, emacs) top_srcdir_absolute=`cd $srcdir; pwd` AC_SUBST(top_srcdir_absolute) AM_PATH_GLIB(1.2.8,, AC_MSG_ERROR(Test for GLIB failed. Download it from ftp://ftp.gtk.org/pub/gtk/v1.2/)) AC_CHECK_LIB(z, gzsetparams, AC_CHECK_HEADER(zlib.h,, AC_MSG_ERROR(ZLIB headers not found)), AC_MSG_ERROR(ZLIB library not found)) AC_OUTPUT(Makefile doc/Makefile test/Makefile djgpp/Makefile xdelta-config libedsio/Makefile libedsio/edsio-comp, chmod +x libedsio/edsio-comp xdelta-config ) xdelta-1.1.3/install-sh0000755000000000000000000001273607062410422010436 #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 xdelta-1.1.3/ltconfig0000755006517700017500000026776507353236517010270 #! /bin/sh # ltconfig - Create a system-specific libtool. # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A lot of this script is taken from autoconf-2.10. # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} echo=echo if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell. exec "$SHELL" "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`} case X$UNAME in *-DOS) PATH_SEPARATOR=';' ;; *) PATH_SEPARATOR=':' ;; esac fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi if test "X${echo_test_string+set}" != "Xset"; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string="`eval $cmd`") 2>/dev/null && echo_test_string="`eval $cmd`" && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then break fi done fi if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH /usr/ucb; do if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then echo="$dir/echo" break fi done IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running ltconfig again with it. ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf "%s\n"' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # Cool, printf works : elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # The name of this program. progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` # Constants: PROGRAM=ltconfig PACKAGE=libtool VERSION=1.3.3 TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)" ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' rm="rm -f" help="Try \`$progname --help' for more information." # Global variables: default_ofile=libtool can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). enable_static=yes enable_fast_install=yes enable_dlopen=unknown enable_win32_dll=no ltmain= silent= srcdir= ac_config_guess= ac_config_sub= host= nonopt= ofile="$default_ofile" verify_host=yes with_gcc=no with_gnu_ld=no need_locks=yes ac_ext=c objext=o libext=a exeext= cache_file= old_AR="$AR" old_CC="$CC" old_CFLAGS="$CFLAGS" old_CPPFLAGS="$CPPFLAGS" old_LDFLAGS="$LDFLAGS" old_LD="$LD" old_LN_S="$LN_S" old_LIBS="$LIBS" old_NM="$NM" old_RANLIB="$RANLIB" old_DLLTOOL="$DLLTOOL" old_OBJDUMP="$OBJDUMP" old_AS="$AS" # Parse the command line options. args= prev= for option do case "$option" in -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then eval "$prev=\$option" prev= continue fi case "$option" in --help) cat <&2 echo "$help" 1>&2 exit 1 ;; *) if test -z "$ltmain"; then ltmain="$option" elif test -z "$host"; then # This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 # if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then # echo "$progname: warning \`$option' is not a valid host type" 1>&2 # fi host="$option" else echo "$progname: too many arguments" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac done if test -z "$ltmain"; then echo "$progname: you must specify a LTMAIN file" 1>&2 echo "$help" 1>&2 exit 1 fi if test ! -f "$ltmain"; then echo "$progname: \`$ltmain' does not exist" 1>&2 echo "$help" 1>&2 exit 1 fi # Quote any args containing shell metacharacters. ltconfig_args= for arg do case "$arg" in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ltconfig_args="$ltconfig_args '$arg'" ;; *) ltconfig_args="$ltconfig_args $arg" ;; esac done # A relevant subset of AC_INIT. # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 5 compiler messages saved in config.log # 6 checking for... messages and results if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>>./config.log # NLS nuisances. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test -n "$cache_file" && test -r "$cache_file"; then echo "loading cache $cache_file within ltconfig" . $cache_file fi if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi if test -z "$srcdir"; then # Assume the source directory is the same one as the path to LTMAIN. srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` test "$srcdir" = "$ltmain" && srcdir=. fi trap "$rm conftest*; exit 1" 1 2 15 if test "$verify_host" = yes; then # Check for config.guess and config.sub. ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/config.guess; then ac_aux_dir=$ac_dir break fi done if test -z "$ac_aux_dir"; then echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 echo "$help" 1>&2 exit 1 fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub # Make sure we can run config.sub. if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : else echo "$progname: cannot run $ac_config_sub" 1>&2 echo "$help" 1>&2 exit 1 fi echo $ac_n "checking host system type""... $ac_c" 1>&6 host_alias=$host case "$host_alias" in "") if host_alias=`$SHELL $ac_config_guess`; then : else echo "$progname: cannot guess host type; you must specify one" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac host=`$SHELL $ac_config_sub $host_alias` echo "$ac_t$host" 1>&6 # Make sure the host verified. test -z "$host" && exit 1 elif test -z "$host"; then echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 echo "$help" 1>&2 exit 1 else host_alias=$host fi # Transform linux* to *-*-linux-gnu*, to support old configure scripts. case "$host_os" in linux-gnu*) ;; linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` esac host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` case "$host_os" in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "${COLLECT_NAMES+set}" != set; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Determine commands to create old-style static archives. old_archive_cmds='$AR cru $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= # Set a sane default for `AR'. test -z "$AR" && AR=ar # Set a sane default for `OBJDUMP'. test -z "$OBJDUMP" && OBJDUMP=objdump # If RANLIB is not set, then run the test. if test "${RANLIB+set}" != "set"; then result=no echo $ac_n "checking for ranlib... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then RANLIB="ranlib" result="ranlib" break fi done IFS="$save_ifs" echo "$ac_t$result" 1>&6 fi if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" fi # Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump 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 -z "$CC"; then echo $ac_n "checking for gcc... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then CC="gcc" break fi done IFS="$save_ifs" if test -n "$CC"; then echo "$ac_t$CC" 1>&6 else echo "$ac_t"no 1>&6 fi fi # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". if test -z "$CC"; then echo $ac_n "checking for cc... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" cc_rejected=no for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/cc || test -f $dir/cc$ac_exeext; then if test "$dir/cc" = "/usr/ucb/cc"; then cc_rejected=yes continue fi CC="cc" break fi done IFS="$save_ifs" if test $cc_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same name, so the bogon will be chosen # first if we set CC to just the name; use the full file name. shift set dummy "$dir/cc" "$@" shift CC="$@" fi fi if test -n "$CC"; then echo "$ac_t$CC" 1>&6 else echo "$ac_t"no 1>&6 fi if test -z "$CC"; then echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 exit 1 fi fi # Now see if the compiler is really GCC. with_gcc=no echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 echo "$progname:581: checking whether we are using GNU C" >&5 $rm conftest.c cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes fi $rm conftest.c echo "$ac_t$with_gcc" 1>&6 fi # Allow CC to be a program name with arguments. set dummy $CC compiler="$2" echo $ac_n "checking for object suffix... $ac_c" 1>&6 $rm conftest* echo 'int i = 1;' > conftest.c echo "$progname:603: checking for object suffix" >& 5 if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 for ac_file in conftest.*; do case $ac_file in *.c) ;; *) objext=`echo $ac_file | sed -e s/conftest.//` ;; esac done else cat conftest.err 1>&5 echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* echo "$ac_t$objext" 1>&6 echo $ac_n "checking for executable suffix... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_exeext="no" $rm conftest* echo 'main () { return 0; }' > conftest.c echo "$progname:629: checking for executable suffix" >& 5 if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 for ac_file in conftest.*; do case $ac_file in *.c | *.err | *.$objext ) ;; *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; esac done else cat conftest.err 1>&5 echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* fi if test "X$ac_cv_exeext" = Xno; then exeext="" else exeext="$ac_cv_exeext" fi echo "$ac_t$ac_cv_exeext" 1>&6 echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 pic_flag= special_shlib_compile_flags= wl= link_static_flag= no_builtin_flag= if test "$with_gcc" = yes; then wl='-Wl,' link_static_flag='-static' case "$host_os" in beos* | irix5* | irix6* | osf3* | osf4*) # PIC is the default for these OSes. ;; aix*) # Below there is a dirty hack to force normal static linking with -ldl # The problem is because libdl dynamically linked with both libc and # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but # we not sure about C++ programs. link_static_flag="$link_static_flag ${wl}-lC" ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. pic_flag='-m68020 -resident32 -malways-restore-a4' ;; sysv4*MP*) if test -d /usr/nec; then pic_flag=-Kconform_pic fi ;; *) pic_flag='-fPIC' ;; esac else # PORTME Check for PIC flags for the system compiler. case "$host_os" in aix3* | aix4*) # All AIX code is PIC. link_static_flag='-bnso -bI:/lib/syscalls.exp' ;; hpux9* | hpux10* | hpux11*) # Is there a better link_static_flag that works with the bundled CC? wl='-Wl,' link_static_flag="${wl}-a ${wl}archive" pic_flag='+Z' ;; irix5* | irix6*) wl='-Wl,' link_static_flag='-non_shared' # PIC (with -KPIC) is the default. ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; osf3* | osf4*) # All OSF/1 code is PIC. wl='-Wl,' link_static_flag='-non_shared' ;; sco3.2v5*) pic_flag='-Kpic' link_static_flag='-dn' special_shlib_compile_flags='-belf' ;; solaris*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' ;; sunos4*) pic_flag='-PIC' link_static_flag='-Bstatic' wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' ;; uts4*) pic_flag='-pic' link_static_flag='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then pic_flag='-Kconform_pic' link_static_flag='-Bstatic' fi ;; *) can_build_shared=no ;; esac fi if test -n "$pic_flag"; then echo "$ac_t$pic_flag" 1>&6 # Check to make sure the pic_flag actually works. echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $pic_flag -DPIC" echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then # Append any warnings to the config.log. cat conftest.err 1>&5 case "$host_os" in hpux9* | hpux10* | hpux11*) # On HP-UX, both CC and GCC only warn that PIC is supported... then they # create non-PIC objects. So, if there were any warnings, we assume that # PIC is not supported. if test -s conftest.err; then echo "$ac_t"no 1>&6 can_build_shared=no pic_flag= else echo "$ac_t"yes 1>&6 pic_flag=" $pic_flag" fi ;; *) echo "$ac_t"yes 1>&6 pic_flag=" $pic_flag" ;; esac else # Append any errors to the config.log. cat conftest.err 1>&5 can_build_shared=no pic_flag= echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* else echo "$ac_t"none 1>&6 fi # Check to see if options -o and -c are simultaneously supported by compiler echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 $rm -r conftest 2>/dev/null mkdir conftest cd conftest $rm conftest* echo "int some_variable = 0;" > conftest.c mkdir out # According to Tom Tromey, Ian Lance Taylor reported there are C compilers # that will create temporary files in the current directory regardless of # the output directory. Thus, making CWD read-only will cause this test # to fail, enabling locking or at least warning the user not to do parallel # builds. chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.o" echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then echo "$ac_t"no 1>&6 compiler_c_o=no else echo "$ac_t"yes 1>&6 compiler_c_o=yes fi else # Append any errors to the config.log. cat out/conftest.err 1>&5 compiler_c_o=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" chmod u+w . $rm conftest* out/* rmdir out cd .. rmdir conftest $rm -r conftest 2>/dev/null if test x"$compiler_c_o" = x"yes"; then # Check to see if we can write to a .lo echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -c -o conftest.lo" echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_o_lo=no else echo "$ac_t"yes 1>&6 compiler_o_lo=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_o_lo=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* else compiler_o_lo=no fi # Check to see if we can do hard links to lock some files if needed hard_links="nottested" if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$ac_t$hard_links" 1>&6 $rm conftest* if test "$hard_links" = no; then echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 need_locks=warn fi else need_locks=no fi if test "$with_gcc" = yes; then # Check to see if options -fno-rtti -fno-exceptions are supported by compiler echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_rtti_exceptions=no else echo "$ac_t"yes 1>&6 compiler_rtti_exceptions=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_rtti_exceptions=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* if test "$compiler_rtti_exceptions" = "yes"; then no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' else no_builtin_flag=' -fno-builtin' fi fi # Check for any special shared library compilation flags. if test -n "$special_shlib_compile_flags"; then echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : else echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 can_build_shared=no fi fi echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 $rm conftest* echo 'main(){return(0);}' > conftest.c save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $link_static_flag" echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then echo "$ac_t$link_static_flag" 1>&6 else echo "$ac_t"none 1>&6 link_static_flag= fi LDFLAGS="$save_LDFLAGS" $rm conftest* if test -z "$LN_S"; then # Check to see if we can use ln -s, or we need hard links. echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 $rm conftest.dat if ln -s X conftest.dat 2>/dev/null; then $rm conftest.dat LN_S="ln -s" else LN_S=ln fi if test "$LN_S" = "ln -s"; then echo "$ac_t"yes 1>&6 else echo "$ac_t"no 1>&6 fi fi # Make sure LD is an absolute path. if test -z "$LD"; then ac_prog=ld if test "$with_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 echo "$progname:991: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we are not using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld... $ac_c" 1>&6 echo "$progname:1015: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 echo "$progname:1018: checking for non-GNU ld" >&5 fi if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" fi if test -n "$LD"; then echo "$ac_t$LD" 1>&6 else echo "$ac_t"no 1>&6 fi if test -z "$LD"; then echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 exit 1 fi fi # Check to see if it really is or is not GNU ld. echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then with_gnu_ld=yes else with_gnu_ld=no fi echo "$ac_t$with_gnu_ld" 1>&6 # See if the linker supports building shared libraries. echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 allow_undefined_flag= no_undefined_flag= need_lib_prefix=unknown need_version=unknown # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments archive_cmds= archive_expsym_cmds= old_archive_from_new_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported runpath_var= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an egrep regular expression of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. case "$host_os" in cygwin* | mingw*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$with_gcc" != yes; then with_gnu_ld=no fi ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case "$host_os" in aix3* | aix4*) # On AIX, the GNU linker is very broken ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF ;; amigaos*) archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw*) # 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 always_export_symbols=yes # 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' archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ _lt_hint=1; for symbol in `cat $export_symbols`; do echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def; _lt_hint=`expr 1 + \$_lt_hint`; 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 $linkopts~ $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 $linkopts~ $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 $linkopts' old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' ;; netbsd*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' # can we support soname and/or expsyms with a.out? -oliva fi ;; solaris*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' case $host_os in cygwin* | mingw*) # dlltool doesn't understand --whole-archive et. al. whole_archive_flag_spec= ;; *) whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' ;; esac fi else # PORTME fill in a description of your system's linker (not GNU ld) case "$host_os" in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$with_gcc" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4*) hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' hardcode_libdir_separator=':' if test "$with_gcc" = yes; then collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi shared_flag='-shared' else shared_flag='${wl}-bM:SRE' hardcode_direct=yes fi allow_undefined_flag=' ${wl}-berok' archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' case "$host_os" in aix4.[01]|aix4.[01].*) # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on always_export_symbols=yes ;; esac ;; amigaos*) archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; cygwin* | mingw*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs' fix_srcfile_path='`cygpath -w $srcfile`' ;; freebsd1*) ld_shlibs=no ;; # 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 # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9* | hpux10* | hpux11*) case "$host_os" in hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; esac hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. export_dynamic_flag_spec='${wl}-E' ;; irix5* | irix6*) if test "$with_gcc" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF fi hardcode_libdir_flag_spec='${wl}-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; openbsd*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' ;; osf3* | osf4*) if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case "$host_os" in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; sysv4*MP*) if test -d /usr/nec ;then # archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; *) ld_shlibs=no ;; esac fi echo "$ac_t$ld_shlibs" 1>&6 test "$ld_shlibs" = no && can_build_shared=no if test -z "$NM"; then echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 case "$NM" in [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then NM="$ac_dir/nm -p" break else NM=${NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$NM" && NM=nm ;; esac echo "$ac_t$NM" 1>&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform the above into a raw symbol and a C symbol. symxfrm='\1 \2\3 \3' # Transform an extracted symbol line into a proper C declaration global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" # Define system-specific variables. case "$host_os" in aix*) symcode='[BCDT]' ;; cygwin* | mingw*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" ;; irix*) symcode='[BCDEGRST]' ;; solaris*) symcode='[BDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then symcode='[ABCDGISTW]' fi # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Write the raw and C identifiers. global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no $rm conftest* cat > conftest.c <&5 if { (eval echo $progname:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then # Now try to grab the symbols. nlist=conftest.nm if { echo "$progname:1596: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if egrep ' nm_test_var$' "$nlist" >/dev/null; then if egrep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.c #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' cat <> conftest.c #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c cat <<\EOF >> conftest.c {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$objext conftstm.$objext save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="conftstm.$objext" CFLAGS="$CFLAGS$no_builtin_flag" if { (eval echo $progname:1648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then pipe_works=yes else echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi LIBS="$save_LIBS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else global_symbol_pipe= fi done if test "$pipe_works" = yes; then echo "${ac_t}ok" 1>&6 else echo "${ac_t}failed" 1>&6 fi if test -z "$global_symbol_pipe"; then global_symbol_to_cdecl= fi # Check hardcoding attributes. echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var"; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$hardcode_shlibpath_var" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$ac_t$hardcode_action" 1>&6 reload_flag= reload_cmds='$LD$reload_flag -o $output$reload_objs' echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 # PORTME Some linkers may need a different reload flag. reload_flag='-r' echo "$ac_t$reload_flag" 1>&6 test -n "$reload_flag" && reload_flag=" $reload_flag" # PORTME Fill in your ld.so characteristics library_names_spec= libname_spec='lib$name' soname_spec= postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" file_magic_cmd= file_magic_test_file= deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 case "$host_os" in aix3*) version_type=linux library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH # AIX has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}.so$major' ;; aix4*) version_type=linux # AIX has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. # We preserve .a as extension for shared libraries though AIX4.2 # and later linker supports .so library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' shlibpath_var=LIBPATH deplibs_check_method=pass_all ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. 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' ;; beos*) library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH deplibs_check_method=pass_all lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; bsdi4*) version_type=linux library_names_spec='${libname}.so$major ${libname}.so' soname_spec='${libname}.so' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' file_magic_cmd=/usr/bin/file file_magic_test_file=/shlib/libc.so sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw*) version_type=windows need_version=no need_lib_prefix=no if test "$with_gcc" = yes; then library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' else library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' fi dynamic_linker='Win32 ld.exe' deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' file_magic_cmd='${OBJDUMP} -f' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; freebsd1*) dynamic_linker=no ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case "$version_type" in freebsd-elf*) deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so*` library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) deplibs_check_method=unknown library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac finish_cmds='PATH="\$PATH:/sbin" OBJFORMAT="'"$objformat"'" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH case "$host_os" in freebsd2* | freebsd3.[01]*) shlibpath_overrides_runpath=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6*) version_type=irix need_lib_prefix=no need_version=no soname_spec='${libname}${release}.so.$major' library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' case "$host_os" in irix5*) libsuff= shlibsuff= # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case "$LD" in # libtool.m4 will add one of these switches to LD *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /lib${libsuff}/libc.so*` deplibs_check_method='pass_all' ;; # No shared lib support for Linux oldld, aout, or coff. linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. linux-gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` if test -f /lib/ld.so.1; then dynamic_linker='GNU ld.so' else # Only the GNU ld.so supports shared libraries on MkLinux. case "$host_cpu" in powerpc*) dynamic_linker=no ;; *) dynamic_linker='Linux ld.so' ;; esac fi ;; netbsd*) version_type=sunos if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH ;; openbsd*) version_type=sunos if test "$with_gnu_ld" = yes; then need_lib_prefix=no need_version=no fi library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' need_lib_prefix=no library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4*) version_type=osf need_version=no soname_spec='${libname}${release}.so' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' shlibpath_var=LD_LIBRARY_PATH # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method='file_magic COFF format alpha shared library' file_magic_cmd=/usr/bin/file file_magic_test_file=/shlib/libc.so deplibs_check_method='pass_all' sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}.so$major' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" file_magic_cmd=/usr/bin/file file_magic_test_file=/lib/libc.so ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case "$host_vendor" in ncr) deplibs_check_method='pass_all' ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; uts4*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; *) dynamic_linker=no ;; esac echo "$ac_t$dynamic_linker" 1>&6 test "$dynamic_linker" = no && can_build_shared=no # Report the final consequences. echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 # Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in # configure.in, otherwise build static only libraries. case "$host_os" in cygwin* | mingw* | os2*) if test x$can_build_shared = xyes; then test x$enable_win32_dll = xno && can_build_shared=no echo "checking if package supports dlls... $can_build_shared" 1>&6 fi ;; esac if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then case "$deplibs_check_method" in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case "$host_os" in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4*) test "$enable_shared" = yes && enable_static=no ;; esac echo "$ac_t$enable_shared" 1>&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "checking whether to build static libraries... $enable_static" 1>&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi echo $ac_n "checking for objdir... $ac_c" 1>&6 rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. objdir=_libs fi rmdir .libs 2>/dev/null echo "$ac_t$objdir" 1>&6 if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then lt_cv_dlopen=no lt_cv_dlopen_libs= echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 echo "$progname:2170: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen""... $ac_c" 1>&6 echo "$progname:2207: checking for dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else dlopen(); #endif ; return 0; } EOF if { (eval echo $progname:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlopen=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_dlopen=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 echo "$progname:2251: checking for dld_link in -ldld" >&5 ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load""... $ac_c" 1>&6 echo "$progname:2288: checking for shl_load" >&5 if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shl_load(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else shl_load(); #endif ; return 0; } EOF if { (eval echo $progname:2315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shl_load=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_shl_load=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 echo "$progname:2333: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 fi fi fi fi fi fi if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes fi case "$lt_cv_dlopen" in dlopen) for ac_hdr in dlfcn.h; do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "$progname:2395: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int fnord = 0; EOF ac_try="$ac_compile conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo $progname:2405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi done if test "x$ac_cv_header_dlfcn_h" = xyes; then CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" fi eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" LIBS="$lt_cv_dlopen_libs $LIBS" echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 echo "$progname:2433: checking whether a program can dlopen itself" >&5 if test "${lt_cv_dlopen_self+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self=cross else cat > conftest.c < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif fnord() { int i=42;} main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } EOF if { (eval echo $progname:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self" 1>&6 if test "$lt_cv_dlopen_self" = yes; then LDFLAGS="$LDFLAGS $link_static_flag" echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 echo "$progname:2506: checking whether a statically linked program can dlopen itself" >&5 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self_static=cross else cat > conftest.c < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif fnord() { int i=42;} main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } EOF if { (eval echo $progname:2560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self_static=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self_static=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 fi ;; esac case "$lt_cv_dlopen_self" in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case "$lt_cv_dlopen_self_static" in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Copy echo and quote the copy, instead of the original, because it is # used later. ltecho="$echo" if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then ltecho="$CONFIG_SHELL \$0 --fallback-echo" fi LTSHELL="$SHELL" LTCONFIG_VERSION="$VERSION" # Only quote variables if we're using ltmain.sh. case "$ltmain" in *.sh) # Now quote all the things that may contain metacharacters. for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ old_LD old_LDFLAGS old_LIBS \ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ reload_flag reload_cmds wl \ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ thread_safe_flag_spec whole_archive_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 archive_expsym_cmds postinstall_cmds postuninstall_cmds \ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case "$var" in reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ postinstall_cmds | postuninstall_cmds | \ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case "$ltecho" in *'\$0 --fallback-echo"') ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac trap "$rm \"$ofile\"; exit 1" 1 2 15 echo "creating $ofile" $rm "$ofile" cat < "$ofile" #! $SHELL # `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. # # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="sed -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi ### BEGIN LIBTOOL CONFIG EOF cfgfile="$ofile" ;; *) # Double-quote the variables that need it (for aesthetics). for var in old_CC old_CFLAGS old_CPPFLAGS \ old_LD old_LDFLAGS old_LIBS \ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do eval "$var=\\\"\$var\\\"" done # Just create a config file. cfgfile="$ofile.cfg" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 echo "creating $cfgfile" $rm "$cfgfile" cat < "$cfgfile" # `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) EOF ;; esac cat <> "$cfgfile" # Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # # CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ # LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ # NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ # DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ # $0$ltconfig_args # # Compiler and other test output produced by $progname, useful for # debugging $progname, is in ./config.log if it exists. # The version of $progname that generated this script. LTCONFIG_VERSION=$LTCONFIG_VERSION # Shell to use when invoking shell scripts. SHELL=$LTSHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$ltecho # The archiver. AR=$AR # The default C compiler. CC=$CC # The linker used to build libraries. LD=$LD # Whether we need hard or soft links. LN_S=$LN_S # A BSD-compatible nm program. NM=$NM # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$reload_flag reload_cmds=$reload_cmds # How to pass a linker flag through the compiler. wl=$wl # Object file suffix (normally "o"). objext="$objext" # Old archive suffix (normally "a"). libext="$libext" # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$pic_flag # Does compiler simultaneously support -c and -o options? compiler_c_o=$compiler_c_o # Can we write directly to a .lo ? compiler_o_lo=$compiler_o_lo # Must we lock files when doing compilation ? need_locks=$need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$link_static_flag # Compiler flag to turn off builtin functions. no_builtin_flag=$no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$library_names_spec # The coded name of the library, if different from the real name. soname_spec=$soname_spec # Commands used to build and install an old-style archive. RANLIB=$RANLIB old_archive_cmds=$old_archive_cmds old_postinstall_cmds=$old_postinstall_cmds old_postuninstall_cmds=$old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$old_archive_from_new_cmds # Commands used to build and install a shared archive. archive_cmds=$archive_cmds archive_expsym_cmds=$archive_expsym_cmds postinstall_cmds=$postinstall_cmds postuninstall_cmds=$postuninstall_cmds # Method to check whether dependent libraries are shared objects. deplibs_check_method=$deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$global_symbol_to_cdecl # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$hardcode_libdir_separator # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Compile-time system search path for libraries sys_lib_search_path_spec=$sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$exclude_expsyms # Symbols that must always be exported. include_expsyms=$include_expsyms EOF case "$ltmain" in *.sh) echo '### END LIBTOOL CONFIG' >> "$ofile" echo >> "$ofile" case "$host_os" in aix3*) cat <<\EOF >> "$ofile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "${COLLECT_NAMES+set}" != set; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # Append the ltmain.sh script. sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) chmod +x "$ofile" ;; *) # Compile the libtool program. echo "FIXME: would compile $ltmain" ;; esac test -n "$cache_file" || exit 0 # AC_CACHE_SAVE trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: xdelta-1.1.3/ltmain.sh0000644006517700017500000032554307353236517010342 # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun ltconfig. # # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then echo "$modename: not configured to build any kind of library" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" # Parse our command line options once, thoroughly. while test $# -gt 0 do arg="$1" shift case "$arg" in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in execute_dlfiles) eval "$prev=\"\$$prev \$arg\"" ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case "$arg" in --help) show_help=yes ;; --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" exit 0 ;; --config) sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 exit 0 ;; --debug) echo "$progname: enabling shell trace mode" set -x ;; --dry-run | -n) run=: ;; --features) echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit 0 ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --quiet | --silent) show=: ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit 1 ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case "$nonopt" in *cc | *++ | gcc* | *-gcc*) mode=link for arg do case "$arg" in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit 1 fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case "$mode" in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= lastarg= srcfile="$nonopt" suppress_output= user_target=no for arg do # Accept any command-line options. case "$arg" in -o) if test "$user_target" != "no"; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit 1 fi user_target=next ;; -static) build_old_libs=yes continue ;; esac case "$user_target" in next) # The next one is the -o target name user_target=yes continue ;; yes) # We got the output file user_target=set libobj="$arg" continue ;; esac # Accept the current argument as the source file. lastarg="$srcfile" srcfile="$arg" # Aesthetically quote the previous argument. # Backslashify any backslashes, double quotes, and dollar signs. # These are the only characters that are still specially # interpreted inside of double-quoted scrings. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly in scan # sets, so we specify it separately. case "$lastarg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) lastarg="\"$lastarg\"" ;; esac # Add the previous argument to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else base_compile="$base_compile $lastarg" fi done case "$user_target" in set) ;; no) # Get the name of the library object. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; *) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSfmso]' case "$libobj" in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case "$libobj" in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit 1 ;; esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $libobj" else removelist="$libobj" fi $run $rm $removelist trap "$run $rm $removelist; exit 1" 1 2 15 # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile # All platforms use -DPIC, to notify preprocessed assembler code. command="$base_compile $pic_flag -DPIC $srcfile" if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$libobj"; then dir="$objdir" else dir="$dir/$objdir" fi libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` if test -d "$dir"; then $show "$rm $libobj" $run $rm $libobj else $show "$mkdir $dir" $run $mkdir $dir status=$? if test $status -ne 0 && test ! -d $dir; then exit $status fi fi fi if test "$compiler_o_lo" = yes; then output_obj="$libobj" command="$command -o $output_obj" elif test "$compiler_c_o" = yes; then output_obj="$obj" command="$command -o $output_obj" fi $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else test -n "$output_obj" && $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed, then go on to compile the next one if test x"$output_obj" != x"$libobj"; then $show "$mv $output_obj $libobj" if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist exit $error fi fi # If we have no pic_flag, then copy the object into place and finish. if test -z "$pic_flag" && test "$build_old_libs" = yes; then # Rename the .lo from within objdir to obj if test -f $obj; then $show $rm $obj $run $rm $obj fi $show "$mv $libobj $obj" if $run $mv $libobj $obj; then : else error=$? $run $rm $removelist exit $error fi # Now arrange that obj and lo_libobj become the same file $show "$LN_S $obj $lo_libobj" if $run $LN_S $obj $lo_libobj; then exit 0 else error=$? $run $rm $removelist exit $error fi fi # Allow error messages only from the first compilation. suppress_output=' >/dev/null 2>&1' fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then command="$base_compile $srcfile" if test "$compiler_c_o" = yes; then command="$command -o $obj" output_obj="$obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else $run $rm $removelist exit 1 fi if test "$need_locks" = warn && test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit 1 fi # Just move the object if needed if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Create an invalid libtool object if no PIC, so that we do not # accidentally link it into a program. if test "$build_libtool_libs" != yes; then $show "echo timestamp > $libobj" $run eval "echo timestamp > \$libobj" || exit $? else # Move the .lo from within objdir $show "$mv $libobj $lo_libobj" if $run $mv $libobj $lo_libobj; then : else error=$? $run $rm $removelist exit $error fi fi fi # Unlock the critical section if it was locked if test "$need_locks" != no; then $rm "$lockfile" fi exit 0 ;; # libtool link mode link) modename="$modename: link" C_compiler="$CC" # save it, to compile generated C sources CC="$nonopt" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes # This is a source program that is used to create dlls on Windows # Don't remove nor modify the starting and closing comments # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include # #undef WIN32_LEAN_AND_MEAN # #include # # #ifndef __CYGWIN__ # # ifdef __CYGWIN32__ # # define __CYGWIN__ __CYGWIN32__ # # endif # #endif # # #ifdef __cplusplus # extern "C" { # #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); # #ifdef __cplusplus # } # #endif # # #ifdef __CYGWIN__ # #include # DECLARE_CYGWIN_DLL( DllMain ); # #endif # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) # { # __hDllInstance_base = hInst; # return TRUE; # } # /* ltdll.c ends here */ # This is a source program that is used to create import libraries # on Windows for dlls which lack them. Don't remove nor modify the # starting and closing comments # /* impgen.c starts here */ # /* Copyright (C) 1999 Free Software Foundation, Inc. # # This file is part of GNU libtool. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # */ # # #include /* for printf() */ # #include /* for open(), lseek(), read() */ # #include /* for O_RDONLY, O_BINARY */ # #include /* for strdup() */ # # static unsigned int # pe_get16 (fd, offset) # int fd; # int offset; # { # unsigned char b[2]; # lseek (fd, offset, SEEK_SET); # read (fd, b, 2); # return b[0] + (b[1]<<8); # } # # static unsigned int # pe_get32 (fd, offset) # int fd; # int offset; # { # unsigned char b[4]; # lseek (fd, offset, SEEK_SET); # read (fd, b, 4); # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); # } # # static unsigned int # pe_as32 (ptr) # void *ptr; # { # unsigned char *b = ptr; # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); # } # # int # main (argc, argv) # int argc; # char *argv[]; # { # int dll; # unsigned long pe_header_offset, opthdr_ofs, num_entries, i; # unsigned long export_rva, export_size, nsections, secptr, expptr; # unsigned long name_rvas, nexp; # unsigned char *expdata, *erva; # char *filename, *dll_name; # # filename = argv[1]; # # dll = open(filename, O_RDONLY|O_BINARY); # if (!dll) # return 1; # # dll_name = filename; # # for (i=0; filename[i]; i++) # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') # dll_name = filename + i +1; # # pe_header_offset = pe_get32 (dll, 0x3c); # opthdr_ofs = pe_header_offset + 4 + 20; # num_entries = pe_get32 (dll, opthdr_ofs + 92); # # if (num_entries < 1) /* no exports */ # return 1; # # export_rva = pe_get32 (dll, opthdr_ofs + 96); # export_size = pe_get32 (dll, opthdr_ofs + 100); # nsections = pe_get16 (dll, pe_header_offset + 4 +2); # secptr = (pe_header_offset + 4 + 20 + # pe_get16 (dll, pe_header_offset + 4 + 16)); # # expptr = 0; # for (i = 0; i < nsections; i++) # { # char sname[8]; # unsigned long secptr1 = secptr + 40 * i; # unsigned long vaddr = pe_get32 (dll, secptr1 + 12); # unsigned long vsize = pe_get32 (dll, secptr1 + 16); # unsigned long fptr = pe_get32 (dll, secptr1 + 20); # lseek(dll, secptr1, SEEK_SET); # read(dll, sname, 8); # if (vaddr <= export_rva && vaddr+vsize > export_rva) # { # expptr = fptr + (export_rva - vaddr); # if (export_rva + export_size > vaddr + vsize) # export_size = vsize - (export_rva - vaddr); # break; # } # } # # expdata = (unsigned char*)malloc(export_size); # lseek (dll, expptr, SEEK_SET); # read (dll, expdata, export_size); # erva = expdata - export_rva; # # nexp = pe_as32 (expdata+24); # name_rvas = pe_as32 (expdata+32); # # printf ("EXPORTS\n"); # for (i = 0; i&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test $# -gt 0; do arg="$1" shift # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case "$prev" in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case "$arg" in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case "$arg" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi prevarg="$arg" case "$arg" in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: not more than one -exported-symbols argument allowed" exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 absdir="$dir" fi dir="$absdir" ;; esac case " $deplibs " in *" $arg "*) ;; *) deplibs="$deplibs $arg";; esac case " $lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir";; esac case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) dllsearchdir=`cd "$dir" && pwd || echo "$dir"` case ":$dllsearchpath:" in ::) dllsearchpath="$dllsearchdir";; *":$dllsearchdir:"*) ;; *) dllsearchpath="$dllsearchpath:$dllsearchdir";; esac ;; esac ;; -l*) if test "$arg" = "-lc"; then case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) # These systems don't actually have c library (as such) continue ;; esac elif test "$arg" = "-lm"; then case "$host" in *-*-cygwin* | *-*-beos*) # These systems don't actually have math library (as such) continue ;; esac fi deplibs="$deplibs $arg" ;; -module) module=yes continue ;; -no-undefined) allow_undefined=no continue ;; -o) prev=output ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit 1 ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # If we have no pic_flag, then this is the same as -all-static. if test -z "$pic_flag" && test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac ;; *.o | *.obj | *.a | *.lib) # A standard object. objs="$objs $arg" ;; *.lo) # A library object. if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` prev= fi libobjs="$libobjs $arg" ;; *.la) # A libtool-controlled library. dlname= libdir= library_names= old_library= # Check to see that this really is a libtool archive. if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 exit 1 fi # If the library was installed with an old release of libtool, # it will not redefine variable installed. installed=yes # Read the .la file # If there is no directory component, then add one. case "$arg" in */* | *\\*) . $arg ;; *) . ./$arg ;; esac # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 exit 1 fi # Find the relevant object directory and library name. name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` if test "X$installed" = Xyes; then dir="$libdir" else dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$arg"; then dir="$objdir" else dir="$dir/$objdir" fi fi if test -n "$dependency_libs"; then # Extract -R and -L from dependency_libs temp_deplibs= for deplib in $dependency_libs; do case "$deplib" in -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` case " $rpath $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; -L*) case "$compile_command $temp_deplibs " in *" $deplib "*) ;; *) temp_deplibs="$temp_deplibs $deplib";; esac temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` case " $lib_search_path " in *" $temp_dir "*) ;; *) lib_search_path="$lib_search_path $temp_dir";; esac ;; *) temp_deplibs="$temp_deplibs $deplib";; esac done dependency_libs="$temp_deplibs" fi if test -z "$libdir"; then # It is a libtool convenience library, so add in its objects. convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$deplibs$dependency_libs" compile_command="$compile_command $dir/$old_library$dependency_libs" finalize_command="$finalize_command $dir/$old_library$dependency_libs" continue fi # This library was specified with -dlopen. if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking statically, # we need to preload. prev=dlprefiles else # We should not create a dependency on this library, but we # may need any libraries it requires. compile_command="$compile_command$dependency_libs" finalize_command="$finalize_command$dependency_libs" prev= continue fi fi # The library was specified with -dlpreopen. if test "$prev" = dlprefiles; then # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then dlprefiles="$dlprefiles $dir/$old_library" else dlprefiles="$dlprefiles $dir/$linklib" fi prev= fi if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then link_against_libtool_libs="$link_against_libtool_libs $arg" if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # We need an absolute path. case "$dir" in [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 absdir="$dir" fi ;; esac # This is the magic to use -rpath. # Skip directories that are in the system default run-time # search path, unless they have been requested with -R. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac lib_linked=yes case "$hardcode_action" in immediate | unsupported) if test "$hardcode_direct" = no; then compile_command="$compile_command $dir/$linklib" deplibs="$deplibs $dir/$linklib" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) dllsearchdir=`cd "$dir" && pwd || echo "$dir"` if test -n "$dllsearchpath"; then dllsearchpath="$dllsearchpath:$dllsearchdir" else dllsearchpath="$dllsearchdir" fi ;; esac elif test "$hardcode_minus_L" = no; then case "$host" in *-*-sunos*) compile_shlibpath="$compile_shlibpath$dir:" ;; esac case "$compile_command " in *" -L$dir "*) ;; *) compile_command="$compile_command -L$dir";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -L$dir -l$name" elif test "$hardcode_shlibpath_var" = no; then case ":$compile_shlibpath:" in *":$dir:"*) ;; *) compile_shlibpath="$compile_shlibpath$dir:";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then compile_command="$compile_command $absdir/$linklib" deplibs="$deplibs $absdir/$linklib" elif test "$hardcode_minus_L" = yes; then case "$compile_command " in *" -L$absdir "*) ;; *) compile_command="$compile_command -L$absdir";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -L$absdir -l$name" elif test "$hardcode_shlibpath_var" = yes; then case ":$compile_shlibpath:" in *":$absdir:"*) ;; *) compile_shlibpath="$compile_shlibpath$absdir:";; esac compile_command="$compile_command -l$name" deplibs="$deplibs -l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit 1 fi # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then finalize_command="$finalize_command $libdir/$linklib" elif test "$hardcode_minus_L" = yes; then case "$finalize_command " in *" -L$libdir "*) ;; *) finalize_command="$finalize_command -L$libdir";; esac finalize_command="$finalize_command -l$name" elif test "$hardcode_shlibpath_var" = yes; then case ":$finalize_shlibpath:" in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:";; esac finalize_command="$finalize_command -l$name" else # We cannot seem to hardcode it, guess we'll fake it. case "$finalize_command " in *" -L$dir "*) ;; *) finalize_command="$finalize_command -L$libdir";; esac finalize_command="$finalize_command -l$name" fi else # Transform directly to old archives if we don't build new libraries. if test -n "$pic_flag" && test -z "$old_library"; then $echo "$modename: cannot find static library for \`$arg'" 1>&2 exit 1 fi # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_command="$compile_command $dir/$linklib" finalize_command="$finalize_command $dir/$linklib" else case "$compile_command " in *" -L$dir "*) ;; *) compile_command="$compile_command -L$dir";; esac compile_command="$compile_command -l$name" case "$finalize_command " in *" -L$dir "*) ;; *) finalize_command="$finalize_command -L$dir";; esac finalize_command="$finalize_command -l$name" fi fi # Add in any libraries that this one depends upon. compile_command="$compile_command$dependency_libs" finalize_command="$finalize_command$dependency_libs" continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac ;; esac # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" case "$output" in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit 1 ;; *.a | *.lib) if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 exit 1 fi if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" ;; *.la) # Make sure we only generate libraries of the form `libNAME.la'. case "$outputname" in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi if test -n "$objs"; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 exit 1 fi # How the heck are we supposed to write a wrapper for a shared library? if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 exit 1 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi dependency_libs="$deplibs" if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit 1 fi current="$2" revision="$3" age="$4" # Check that each of the things are valid numbers. case "$current" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case "$revision" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac case "$age" in 0 | [1-9] | [1-9][0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 ;; esac if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 fi # Calculate the version variables. major= versuffix= verstring= case "$version_type" in none) ;; irix) major=`expr $current - $age + 1` versuffix="$major.$revision" verstring="sgi$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="sgi$major.$iface:$verstring" done ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; windows) # Like Linux, but with '-' rather than '.', since we only # want one extension on Windows 95. 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 exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi dependency_libs="$deplibs" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *) # Add libc to deplibs on all other systems. deplibs="$deplibs -lc" ;; esac fi # Create the output directory, or remove our outputs if we need to. if test -d $output_objdir; then $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* else $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi if test "$build_libtool_libs" = yes; then # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case "$deplibs_check_method" in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | sed 's/.* -> //'` case "$potliblink" in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | sed 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done if test -n "$a_deplib" ; then droppeddeps=yes echo echo "*** Warning: This library needs some functionality provided by $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | grep . >/dev/null; then echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" echo "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Ensure that we have .o objects for linkers which dislike .lo # (e.g. aix) incase we are running --disable-static for obj in $libobjs; do oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"` if test ! -f $oldobj; then $show "${LN_S} $obj $oldobj" $run ${LN_S} $obj $oldobj || exit $? fi done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case "$xlib" in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linkopts="$linkopts $flag" fi # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else eval cmds=\"$archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; *.lo | *.o | *.obj) if test -n "$link_against_libtool_libs"; then $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 exit 1 fi if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case "$output" in *.lo) if test -n "$objs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" for xlib in $convenience; do # Extract the objects. case "$xlib" in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi # Create the old-style object. reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" output="$obj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. $show "echo timestamp > $libobj" $run eval "echo timestamp > $libobj" || exit $? exit 0 fi if test -n "$pic_flag"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" else # Just create a symlink. $show $rm $libobj $run $rm $libobj $show "$LN_S $obj $libobj" $run $LN_S $obj $libobj || exit $? fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit 0 ;; # Anything else should be a program. *) if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$compile_rpath " in *" $libdir "*) ;; *) compile_rpath="$compile_rpath $libdir" ;; esac case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the binary in the object directory, then wrap it. if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case "$dlsyms" in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`echo "$arg" | sed -e 's%^.*/%%'` $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = {\ " sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr_t) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case "$host" in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit 1 ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case "$dir" in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case "$0" in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`echo $output|sed 's,.exe$,,'` ;; esac $rm $output trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: link_against_libtool_libs='$link_against_libtool_libs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then echo >> $output "\ program=lt-'$outputname' progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if (cd \"\$thisdir\" && eval \$relink_command); then : else $rm \"\$progdir/\$file\" exit 1 fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else echo >> $output "\ program='$outputname$exeext' progdir=\"\$thisdir/$objdir\" " fi echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in *-*-cygwin* | *-*-mingw | *-*-os2*) # win32 systems need to use the prog path for dll # lookup to work $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ # Export the path to the program. PATH=\"\$progdir:\$PATH\" export PATH exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " chmod +x $output fi exit 0 ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "mkdir $gentop" $run mkdir "$gentop" status=$? if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" # Add in members from convenience archives. for xlib in $addlibs; do # Extract the objects. case "$xlib" in [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; *) xabs=`pwd`"/$xlib" ;; esac xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` xdir="$gentop/$xlib" $show "${rm}r $xdir" $run ${rm}r "$xdir" $show "mkdir $xdir" $run mkdir "$xdir" status=$? if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else # Ensure that we have .o objects in place incase we decided # not to build a shared library, and have fallen back to building # static libs even though --disable-static was passed! for oldobj in $oldobjs; do if test ! -f $oldobj; then obj=`$echo "X$oldobj" | $Xsed -e "$o2lo"` $show "${LN_S} $obj $oldobj" $run ${LN_S} $obj $oldobj || exit $? fi done eval cmds=\"$old_archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case "$output" in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" if test -n "$xrpath"; then temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" done dependency_libs="$temp_xrpath $dependency_libs" fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i fi $rm $output $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$dlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Directory that this library needs to be installed in: libdir='$install_libdir'\ " done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? ;; esac exit 0 ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case "$arg" in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 fi fi case "$destdir" in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case "$file" in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case "$file" in *.a | *.lib) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi library_names= old_library= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" test "X$dir" = "X$file/" && dir= dir="$dir$objdir" # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift # Install the shared library and build the symlinks. $show "$install_prog$stripme $dir/$realname $destdir/$realname" $run eval "$install_prog$stripme $dir/$realname $destdir/$realname" || exit $? if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case "$destfile" in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.o | *.obj) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit 0 ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then link_against_libtool_libs= relink_command= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Check the variables that should have been set. if test -z "$link_against_libtool_libs"; then $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi finalize=yes for lib in $link_against_libtool_libs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case "$lib" in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec $SHELL $0 --finish$current_libdirs exit 1 fi exit 0 ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit 0 echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do echo " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" echo "more information, such as the ld(1) and ld.so(8) manual pages." echo "----------------------------------------------------------------------" exit 0 ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit 1 fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit 1 fi dir= case "$file" in *.la) # Check to see that this really is a libtool archive. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit 1 fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit 1 fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case "$file" in -*) ;; *) # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then # Export the shlibpath_var. eval "export $shlibpath_var" # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now actually exec the command. eval "exec \$cmd$args" $echo "$modename: cannot exec \$cmd$args" exit 1 else # Display what would be done. eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" $echo "$cmd$args" exit 0 fi ;; # libtool uninstall mode uninstall) modename="$modename: uninstall" rm="$nonopt" files= for arg do case "$arg" in -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit 1 fi for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` rmfiles="$file" case "$name" in *.la) # Possibly a libtool archive, so verify it. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $dir/$n" done test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" $show "$rm $rmfiles" $run $rm $rmfiles if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi ;; *.lo) if test "$build_old_libs" = yes; then oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` rmfiles="$rmfiles $dir/$oldobj" fi $show "$rm $rmfiles" $run $rm $rmfiles ;; *) $show "$rm $rmfiles" $run $rm $rmfiles ;; esac done exit 0 ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit 1 ;; esac $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit 1 fi # test -z "$show_help" # We need to display help for each of the modes. case "$mode" in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --version print version information MODE must be one of the following: compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE." exit 0 ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit 1 ;; esac echo $echo "Try \`$modename --help' for more information about other modes." exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: xdelta-1.1.3/missing0000755000000000000000000001421307062410422010021 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Franc,ois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing - GNU libit 0.0" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 xdelta-1.1.3/mkinstalldirs0000755000000000000000000000132207062410422011225 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here xdelta-1.1.3/xdelta-config.in0000644006517700017500000000350507353554705011567 #!/bin/sh glib_libs="@GLIB_LIBS@" glib_cflags="@GLIB_CFLAGS@" prefix=@prefix@ exec_prefix=@exec_prefix@ exec_prefix_set=no usage() { cat <&2 fi lib_xdelta=yes while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --prefix=*) prefix=$optarg if test $exec_prefix_set = no ; then exec_prefix=$optarg fi ;; --prefix) echo_prefix=yes ;; --exec-prefix=*) exec_prefix=$optarg exec_prefix_set=yes ;; --exec-prefix) echo_exec_prefix=yes ;; --version) # $Format: " echo $ReleaseVersion$" $ */ echo 1.1.3 exit 0 ;; --cflags) echo_cflags=yes ;; --libs) echo_libs=yes ;; xdelta) lib_xdelta=yes ;; *) usage 1 1>&2 ;; esac shift done if test "$echo_prefix" = "yes"; then echo $prefix fi if test "$echo_exec_prefix" = "yes"; then echo $exec_prefix fi if test "$echo_cflags" = "yes"; then if test @includedir@ != /usr/include ; then includes=-I@includedir@ for i in $glib_cflags ; do if test $i = -I@includedir@ ; then includes="" fi done fi echo $includes $glib_cflags fi if test "$echo_libs" = "yes"; then libdirs=-L@libdir@ libsp="" if test "$lib_xdelta" = "yes"; then my_glib_libs= for i in $glib_libs ; do if test $i != -L@libdir@ ; then if test -z "$my_glib_libs" ; then my_glib_libs="$i" else my_glib_libs="$my_glib_libs $i" fi fi done libsp="$libsp -lxdelta -ledsio $my_glib_libs" fi echo $libdirs $libsp fi xdelta-1.1.3/xdelta.c0000644006517700017500000010527207353554705010144 /* -*- Mode: C;-*- * * This file is part of XDelta - A binary delta generator. * * Copyright (C) 1997, 1998, 1999, 2001 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * $Id: xdelta.c 1.4.1.50.1.2 Fri, 29 Jun 2001 06:01:08 -0700 jmacd $ */ #define G_DISABLE_ASSERT #include #include #include #include "xdelta.h" #include "xdeltapriv.h" /* $Format: "const guint xdelta_major_version = $ReleaseMajorVersion$;" $ */ const guint xdelta_major_version = 1; /* $Format: "const guint xdelta_minor_version = $ReleaseMinorVersion$;" $ */ const guint xdelta_minor_version = 1; /* $Format: "const guint xdelta_micro_version = $ReleaseMicroVersion$;" $ */ const guint xdelta_micro_version = 3; /* Control functions. */ static XdeltaControl* control_version_0 (SerialVersion0Control* cont) ; static void control_copy (XdeltaControl* cont, XdeltaSource* src, guint from, guint to); static gboolean control_add_info (XdeltaControl* cont, XdeltaSource* src, const guint8* md5, guint len); #ifndef XDELTA_HARDCODE_SIZE int QUERY_SIZE = 0; int QUERY_SIZE_POW = 0; int QUERY_SIZE_MASK = 0; #endif int xdp_set_query_size_pow (int size_pow) { #ifdef XDELTA_HARDCODE_SIZE return XDP_QUERY_HARDCODED; #else int x = 1; int size_log = 0; for (; x != 0; x <<= 1, size_log += 1) { if (x == size_pow) goto good; } return XDP_QUERY_POW2; good: QUERY_SIZE = size_log; QUERY_SIZE_POW = size_pow; QUERY_SIZE_MASK = size_pow-1; return 0; #endif } int xdp_blocksize () { if (QUERY_SIZE == 0) { xdp_set_query_size_pow (1<low = low; cksum->high = high; } /* Generate checksums */ static gboolean generate_checksums (XdeltaStream *stream, XdeltaSource *source) { gint total_checksums = handle_length (stream) / QUERY_SIZE_POW; gint checksum_index = 0; XdeltaChecksum cksum; XdeltaChecksum *result; const guint8* segment = NULL, *segment_pointer; gint segment_len, orig_segment_len; guint segment_page = 0; guint pages; #ifdef DEBUG_CKSUM g_print ("Total base checksums: %d\n", total_checksums); #endif source->ck_count = total_checksums; if (total_checksums == 0) return TRUE; /* This is the in-core FROM checksum table. */ result = g_new (XdeltaChecksum, total_checksums); source->cksums = result; for (pages = handle_pages (stream); segment_page <= pages; segment_page += 1) { segment_len = handle_map_page (stream, segment_page, &segment); if (segment_len < 0) return FALSE; orig_segment_len = segment_len; segment_len >>= QUERY_SIZE; for (segment_pointer = segment; segment_len != 0; segment_len -= 1, segment_pointer += QUERY_SIZE_POW) { /* note: cheating at the boundaries */ init_query_checksum (segment_pointer, &cksum); #ifdef DEBUG_CKSUM g_print ("New cksum %04x %04x indices %d-%d\n", cksum.low, cksum.high, checksum_index * QUERY_SIZE_POW, (checksum_index * QUERY_SIZE_POW) + QUERY_SIZE_POW - 1); #endif result[checksum_index++] = cksum; } if (! handle_unmap_page (stream, segment_page, &segment)) return FALSE; } return TRUE; } /* $Format: "#define XDELTA_REQUIRED_VERSION \"$ReleaseMajorVersion$.$ReleaseMinorVersion$.\"" $ */ #define XDELTA_REQUIRED_VERSION "1.1." XdeltaGenerator* __xdp_generator_new (const char* version) { XdeltaGenerator* xg; if (strncmp (version, XDELTA_REQUIRED_VERSION, strlen (XDELTA_REQUIRED_VERSION)) != 0) g_error ("XDelta library version mismatched, compiled for %s, running %s\n", version, XDELTA_VERSION); xg = g_new0 (XdeltaGenerator, 1); xg->sources = g_ptr_array_new (); xg->data_source = g_new0 (XdeltaSource, 1); xg->data_source->name = "(patch data)"; g_ptr_array_add (xg->sources, xg->data_source); return xg; } void init_pos (XdeltaStream* str, XdeltaPos* pos) { g_assert (str); memset (pos, 0, sizeof (*pos)); pos->page_size = handle_pagesize (str); } gboolean check_stream_integrity (XdeltaStream* str, const guint8* md5, guint len) { const guint8* act_md5; if (len != handle_length (str)) { xd_generate_handleintint_event (EC_XdStreamLengthFailed, str, len, handle_length (str)); return FALSE; } act_md5 = handle_checksum_md5 (str); if (! act_md5) return FALSE; if (memcmp (md5, act_md5, 16) != 0) { char exp[33], rec[33]; edsio_md5_to_string (md5, exp); edsio_md5_to_string (act_md5, rec); xd_generate_handlestringstring_event (EC_XdStreamChecksumFailed, str, exp, rec); g_free ((void*) act_md5); return FALSE; } g_free ((void*) act_md5); return TRUE; } static gboolean xdp_source_index_read (XdeltaSource *xs, XdeltaStream *index_in) { SerialSource *ss = handle_source (index_in); XdeltaIndex *index; if (! ss) return FALSE; if (! unserialize_xdeltaindex (ss, &index)) return FALSE; if (! check_stream_integrity (xs->source_in, index->file_md5, index->file_len)) return FALSE; xs->ck_count = index->index_len; xs->cksums = index->index; /* @@@ how to free this? */ return TRUE; } static gboolean xdp_source_index_internal (XdeltaSource *init, XdeltaStream *source_in, XdeltaOutStream *index_out) { if (! generate_checksums (source_in, init)) return FALSE; if (index_out) { const guint8* source_in_md5; SerialSink* sink = handle_sink (index_out, NULL, NULL, NULL, NULL); if (! sink) return FALSE; if (! (source_in_md5 = handle_checksum_md5 (source_in))) return FALSE; if (! serialize_xdeltaindex (sink, handle_length (source_in), source_in_md5, init->ck_count, init->cksums)) { g_free ((void*) source_in_md5); return FALSE; } g_free ((void*) source_in_md5); if (! handle_close (index_out, 0)) return FALSE; } return TRUE; } gboolean xdp_source_index (XdeltaStream *source_in, XdeltaOutStream *index_out) { XdeltaSource* xs = xdp_source_new ("(ignored)", source_in, NULL, index_out); if (xs) { xdp_source_free (xs); return TRUE; } return FALSE; } XdeltaSource* xdp_source_new (const char *name, XdeltaStream *source_in, XdeltaStream *index_in, XdeltaOutStream *index_out) { XdeltaSource* xs = g_new0 (XdeltaSource, 1); xs->source_in = source_in; xs->name = name; g_return_val_if_fail (source_in, NULL); g_return_val_if_fail (index_in ? ! index_out : TRUE, NULL); xs->index_in = index_in; xs->index_out = index_out; xs->source_pos.page_size = handle_pagesize (source_in); return xs; } static gboolean xdp_source_check_index (XdeltaSource *xs) { if (xs->source_index == 0) return TRUE; if (! xs->index_in) return xdp_source_index_internal (xs, xs->source_in, xs->index_out); else return xdp_source_index_read (xs, xs->index_in); } void xdp_source_free (XdeltaSource* xs) { if (xs) { /* if (xs->ckarray) @@@ this is troublesome now g_free (xs->ckarray);*/ g_free (xs); } } void xdp_source_add (XdeltaGenerator *gen, XdeltaSource *src) { if (gen->table) { g_free ((gpointer)gen->table); gen->table = NULL; } g_ptr_array_add (gen->sources, src); } guint c_hash (const XdeltaChecksum* c) { const guint high = c->high; const guint low = c->low; const guint it = (high >> 2) + (low << 3) + (high << 16); return (it ^ high ^ low); } static gboolean region_insert (XdeltaGenerator* gen, const XdeltaPos *xpos, guint len) { /* This is a little bit cryptic: the xpos.mem + EXPR expression * computes the offset into the current page, which is guaranteed * to be correct since map_page has not occured yet. */ const guint8* buf = xpos->mem + (gen->to_output_pos % xpos->page_size); if (len == 0) return TRUE; #ifdef DEBUG_INST g_print ("insert %d at %d\n", len, gen->to_output_pos); #endif if (! handle_write (gen->data_out, buf, len)) return FALSE; control_copy (gen->control, gen->data_source, gen->data_output_pos, gen->data_output_pos + len); gen->to_output_pos += len; gen->data_output_pos += len; return TRUE; } static gboolean region_copy (XdeltaGenerator* gen, XdeltaSource* src, guint from, guint to) { #ifdef DEBUG_INST g_print ("copy %d - %d (%d) to %d\n", from, to, to-from, gen->to_output_pos); #endif control_copy (gen->control, src, from, to); gen->to_output_pos += (to-from); return TRUE; } gboolean unmap_page (XdeltaStream* stream, XdeltaPos* pos) { if (! pos->mem) return TRUE; if (handle_unmap_page (stream, pos->mem_page, &pos->mem)) { pos->mem = NULL; return TRUE; } return FALSE; } gboolean map_page (XdeltaStream* stream, XdeltaPos* pos) { gint on_page; if (pos->mem && pos->mem_page == pos->page) return TRUE; if (pos->mem) { if (! handle_unmap_page (stream, pos->mem_page, &pos->mem)) return FALSE; pos->mem = NULL; } pos->mem_page = pos->page; on_page = handle_map_page (stream, pos->mem_page, &pos->mem); if (on_page >= 0) { pos->mem_rem = on_page; return TRUE; } return FALSE; } static gboolean try_match (XdeltaGenerator *gen, XdeltaStream *in, XdeltaPos *xpos_ptr, XdeltaSource *src, guint src_offset, gboolean *found) { XdeltaPos xpos = *xpos_ptr; XdeltaPos ypos = src->source_pos; gint rem, remsave; gint match_forward = 0; gint match_backward = 0; gint match_forward_max; gint match_backward_max; guint to_offset = XPOS (xpos); gboolean one_insert = FALSE; *found = FALSE; ypos.page = src_offset / ypos.page_size; ypos.off = src_offset % ypos.page_size; match_forward_max = MIN (handle_length (in) - to_offset, handle_length (src->source_in) - src_offset); match_backward_max = MIN (src_offset, to_offset - gen->to_output_pos); /* Don't allow backward paging */ match_backward_max = MIN (match_backward_max, xpos.off); /* We're testing against the negative below. */ match_backward_max = - match_backward_max; for (; match_backward > match_backward_max; ) { g_assert (xpos.off != 0); if (ypos.off == 0) { ypos.off = ypos.page_size; ypos.page -= 1; } if (! map_page (src->source_in, &ypos)) goto bail; rem = MIN (xpos.off, ypos.off); rem = MIN (match_backward - match_backward_max, rem); for (; rem > 0; rem -= 1, match_backward -= 1) { if (xpos.mem[xpos.off-1] != ypos.mem[ypos.off-1]) goto doneback; xpos.off -= 1; ypos.off -= 1; } } doneback: xpos.page = to_offset / xpos.page_size; xpos.off = to_offset % xpos.page_size; ypos.page = src_offset / ypos.page_size; ypos.off = src_offset % ypos.page_size; for (; match_forward < match_forward_max; ) { if (! map_page (src->source_in, &ypos)) goto bail; /* Fortunately, if this map happens it means that the match must * be long enough to succeed below, therefore it is safe to write * the insert out now. */ if (! one_insert && xpos.page != xpos.mem_page) { one_insert = TRUE; if (! region_insert (gen, &xpos, (to_offset + match_backward) - gen->to_output_pos)) goto bail; } if (! map_page (in, &xpos)) goto bail; rem = MIN (xpos.mem_rem - xpos.off, ypos.mem_rem - ypos.off); rem = MIN (match_forward_max - match_forward, rem); /* Do a int-wise comparison if the regions are aligned. */ if (rem > (4*sizeof(int)) && (xpos.off % sizeof (int)) == (ypos.off % sizeof(int))) { gint is; const int *xi, *yi; for (; xpos.off % sizeof(int); rem -= 1, match_forward += 1) { if (xpos.mem[xpos.off] != ypos.mem[ypos.off]) goto done; xpos.off += 1; ypos.off += 1; } remsave = rem; rem /= sizeof(int); xi = (const int*) (xpos.mem + xpos.off); yi = (const int*) (ypos.mem + ypos.off); is = rem; for (; rem > 0 && *xi == *yi; ) { rem -= 1; xi += 1; yi += 1; } is -= rem; match_forward += is * sizeof(int); xpos.off += is * sizeof(int); ypos.off += is * sizeof(int); rem = (rem * sizeof(int)) + (remsave % sizeof(int)); } for (; rem > 0; rem -= 1, match_forward += 1) { if (xpos.mem[xpos.off] != ypos.mem[ypos.off]) goto done; xpos.off += 1; ypos.off += 1; } FLIP_FORWARD (xpos); FLIP_FORWARD (ypos); } done: if (match_forward - match_backward >= QUERY_SIZE_POW) { *found = TRUE; if (! one_insert) { if (! region_insert (gen, &xpos, (to_offset + match_backward) - gen->to_output_pos)) goto bail; } if (! region_copy (gen, src, src_offset + match_backward, src_offset + match_forward)) goto bail; } else { g_assert (! one_insert); } *xpos_ptr = xpos; src->source_pos = ypos; return TRUE; bail: *xpos_ptr = xpos; src->source_pos = ypos; return FALSE; } static gboolean compute_copies (XdeltaGenerator* gen, XdeltaStream* stream) { XdeltaChecksum cksum; const XdeltaChecksum *source_cksum; const guint8 *segment_pointer; guint source_offset, segment_index, index, prime = gen->table_size; guint source_index; const guint32* table = gen->table; guint16 old_c, new_c; guint save_page, save_off; #ifdef DEBUG_MATCH_PRINT guint i; #endif XdeltaPos xpos; gboolean found; gboolean ret = TRUE; if (handle_length (stream) < QUERY_SIZE_POW) return TRUE; init_pos (stream, &xpos); while (XPOS (xpos) <= (handle_length (stream) - QUERY_SIZE_POW)) { if (!map_page (stream, &xpos)) return FALSE; g_assert (xpos.mem_rem > xpos.off); segment_index = (xpos.mem_rem - xpos.off); if (segment_index < QUERY_SIZE_POW) goto nextpage; segment_index -= QUERY_SIZE_POW; segment_pointer = xpos.mem + xpos.off; init_query_checksum (segment_pointer, &cksum); for (; ; segment_pointer += 1) { #ifdef DEBUG_CKSUM_UPDATE XdeltaChecksum cktest; init_query_checksum (segment_pointer, &cktest); if (cktest.high != cksum.high || cktest.low != cktest.low) abort (); #endif index = c_hash (&cksum) % prime; #ifdef DEBUG_MATCH_PRINT g_print ("%d: searching for match \"", XPOS(xpos)); for (i = 0; i < QUERY_SIZE_POW; i += 1) { if (isprint (segment_pointer[i])) g_print ("%c", segment_pointer[i]); else g_print ("\\0%o", segment_pointer[i]); } g_print ("\"... %s\n", table[index] ? "found" : "notfound"); #endif if (table[index]) { source_index = (table[index] & QUERY_SIZE_MASK) - 1; source_offset = (table[index] >> QUERY_SIZE); source_cksum = ((XdeltaSource*)gen->sources->pdata[source_index])->cksums + source_offset; if (cksum.high == source_cksum->high && cksum.low == source_cksum->low) { save_page = xpos.page; save_off = xpos.off; if (! try_match (gen, stream, &xpos, gen->sources->pdata[source_index], source_offset << QUERY_SIZE, &found)) { ret = FALSE; goto bail; } if (found) { g_assert (xpos.page*xpos.page_size+xpos.off == gen->to_output_pos); goto reenter; } else { xpos.page = save_page; xpos.off = save_off; } } } if (segment_index == 0) goto nextpage; segment_index -= 1; xpos.off += 1; old_c = CHEW(segment_pointer[0]); new_c = CHEW(segment_pointer[QUERY_SIZE_POW]); cksum.low -= old_c; cksum.low += new_c; cksum.high -= old_c << QUERY_SIZE; cksum.high += cksum.low; } nextpage: if (xpos.mem_rem < xpos.page_size) break; xpos.page += 1; xpos.off = 0; if (xpos.page != xpos.mem_page) { if (! region_insert (gen, &xpos, XPOS (xpos) - gen->to_output_pos)) return FALSE; } reenter: (void) 0; } xpos.off = gen->to_output_pos % handle_pagesize (stream); while (gen->to_output_pos < handle_length (stream)) { if (! map_page (stream, &xpos)) return FALSE; if (! region_insert (gen, &xpos, xpos.mem_rem - xpos.off)) ret = FALSE; xpos.off = 0; xpos.page += 1; } bail: if (! unmap_page (stream, &xpos)) return FALSE; return ret; } static gboolean just_output (XdeltaGenerator *gen, XdeltaStream *in) { XdeltaPos pos; init_pos (in, &pos); while (gen->to_output_pos < handle_length (in)) { if (! map_page (in, &pos)) return FALSE; if (! region_insert (gen, &pos, pos.mem_rem - pos.off)) return FALSE; pos.off = 0; pos.page += 1; } if (! unmap_page (in, &pos)) return FALSE; return TRUE; } /* Clobbering decision (see below): * * Algorithm A: Clobber it always (its fast!). The problem * is that this prefers matches at the front of * the file and leads to poor matches at the back * of the file (assuming I insert going backwards). * * Algorithm B: Keep a table of how many times there has * been a clobber at each index i, C[i]. * With probability 1/(C[i]+1), replace the * previous entry. This gives a uniform * probability of each entry surviving. * The problem (supposed) with this * algorithm is that the probabilities * should not be uniform (though uniform is * better than A) because there are more * chances to match a segment at the end of * the file than at the beginning. * * Algorithm C: Give a linear weight to each match * according to it's position in the file * -- number the segments from N down to 1 * starting at the beginning. Same as the * above but with a different weight. The * weight for segment i, match at checksum * offset k, follows. The total number of * checksums in the segment is C_i, * therefore the total checksum count is * C = sum_i (C_i). * Now the interior weight is the (C_i-k) * (the linear assumption) and the total * interior weight is sum_{j=1}^{N}{j}=(N)(N+1)/2 * so the kth segment has interior weight * * [2 (C_i - k)] / [(C_i) (C_i + 1)] * * add in the exterior weight (after * cancelling a C_i): * * w(i,k) = [2 (C_i - k)] / [(C_i + 1) (C)] * * Now, as above, we will compute whether to * keep or replace the current value at the j-th * decision. Let R_j be the running sum of * weights considered so far. R_0 = 0. At the * j-th decision, * * P_ikj(use new value) = w(i,k)/R_{j+1} * R_{j+1} = R_j + w(i,k) */ static gboolean xdp_generate_delta_int (XdeltaGenerator *gen, XdeltaStream *in, XdeltaOutStream *control_out, XdeltaOutStream *data_out) { gint i, j, total_from_ck_count = 0, prime = 0, index = 0; gint total_from_len = 0; guint32* table = NULL; if (QUERY_SIZE == 0) { xdp_set_query_size_pow (1<sources->len == 0) { xd_generate_void_event (EC_XdTooFewSources); return FALSE; } for (i = 0; i < gen->sources->len; i += 1) { XdeltaSource* src = gen->sources->pdata[i]; src->used = FALSE; src->sequential = TRUE; src->position = 0; src->source_index = i; if (src->source_index != 0) total_from_len += handle_length (src->source_in); } /* QUERY_SIZE_POW is the number of elements freed in the cksum hash * table for storing segment number + (offset/QUERY_SIZE_POW) in. 1 * for the zero + 1 for the data segment */ if (gen->sources->len > (QUERY_SIZE_POW-2)) { xd_generate_void_event (EC_XdTooManySources); return FALSE; } if (handle_length (in) < QUERY_SIZE_POW || total_from_len < QUERY_SIZE_POW) { if (! just_output (gen, in)) return FALSE; } else { for (i = 0; i < gen->sources->len; i += 1) { XdeltaSource* xs = (XdeltaSource*)gen->sources->pdata[i]; if (! xdp_source_check_index (xs)) return FALSE; total_from_ck_count += xs->ck_count; } prime = g_spaced_primes_closest (total_from_ck_count); gen->table = table = g_new0 (guint32, prime); gen->table_size = prime; for (i = 0; i < gen->sources->len; i += 1) { XdeltaSource* xs = (XdeltaSource*)gen->sources->pdata[i]; for (j = xs->ck_count-1; j >= 0; j -= 1) { index = c_hash (xs->cksums + j) % prime; #ifdef DEBUG_HASH gen->hash_entries += 1; if (table[index]) { gen->hash_conflicts += 1; /*regions_similar (gen, i, j, (table[index] & QUERY_SIZE_MASK) - 1, table[index] >> QUERY_SIZE);*/ } #endif /* This is the real code */ table[index] = (j << QUERY_SIZE) + 1 + i; } } #ifdef DEBUG_HASH for (i = 0; i < prime; i += 1) { if (gen->table[i]) gen->hash_fill += 1; } g_print ("*** Hash stats:\n"); g_print ("Hash conflicts: %d\n", gen->hash_conflicts); g_print ("Hash real conflicts: %d\n", gen->hash_real_conflicts); g_print ("Hash real real conflicts: %d\n", gen->hash_real_real_conflicts); g_print ("Hash fill: %d\n", gen->hash_fill); g_print ("Hash size: %d\n", gen->table_size); g_print ("Hash entries: %d\n", gen->hash_entries); g_print ("Hash fill/entries: %f\n", (float)gen->hash_fill/(float)gen->hash_entries); #endif if (! compute_copies (gen, in)) return FALSE; } return TRUE; } XdeltaControl* xdp_generate_delta (XdeltaGenerator *gen, XdeltaStream *in, XdeltaOutStream *control_out, XdeltaOutStream *data_out) { gint i; const guint8* in_md5; const guint8* data_out_md5; gen->data_out = data_out; gen->control_out = control_out; gen->control = control_new (); if (! xdp_generate_delta_int (gen, in, control_out, data_out)) return NULL; if (! handle_close (data_out, 0)) return NULL; if (! (in_md5 = handle_checksum_md5 (in))) return FALSE; if (! (data_out_md5 = handle_checksum_md5 (data_out))) return FALSE; gen->control->has_data = gen->data_source->used; gen->control->inst = &g_array_index (gen->control->inst_array, XdeltaInstruction, 0); gen->control->inst_len = gen->control->inst_array->len; gen->control->to_len = handle_length (in); memcpy (gen->control->to_md5, in_md5, 16); for (i = 0; i < gen->sources->len; i += 1) { XdeltaSource* src = gen->sources->pdata[i]; const guint8* md5; guint len; if (src->source_in) { if (! (md5 = handle_checksum_md5 (src->source_in))) return FALSE; len = handle_length (src->source_in); } else { len = handle_length (data_out); md5 = data_out_md5; } if (! control_add_info (gen->control, src, md5, len)) return NULL; } gen->control->source_info = (XdeltaSourceInfo**) gen->control->source_info_array->pdata; gen->control->source_info_len = gen->control->source_info_array->len; if (control_out && ! xdp_control_write (gen->control, control_out)) return NULL; return gen->control; } /* Below here boring details mostly to do with reading and writing * control. */ XdeltaControl* control_new (void) { XdeltaControl* it = g_new0 (XdeltaControl, 1); it->inst_array = g_array_new (FALSE, FALSE, sizeof (XdeltaInstruction)); it->source_info_array = g_ptr_array_new (); return it; } static void control_reindex (XdeltaControl* cont, XdeltaSource* src) { gint i; gint new_index = cont->source_info_array->len; for (i = 0; i < cont->inst_len; i += 1) { XdeltaInstruction* inst = cont->inst + i; if (inst->index == src->source_index) inst->index = new_index; } } gboolean control_add_info (XdeltaControl* cont, XdeltaSource* src, const guint8* md5, guint len) { XdeltaSourceInfo* si; if (! src->used) return TRUE; si = g_new0 (XdeltaSourceInfo, 1); si->name = src->name; si->sequential = src->sequential; si->len = len; si->isdata = (src->source_index == 0); memcpy (si->md5, md5, 16); control_reindex (cont, src); g_ptr_array_add (cont->source_info_array, si); return TRUE; } void xdp_control_free (XdeltaControl* cont) { if (cont->source_info_array) g_ptr_array_free (cont->source_info_array, TRUE); if (cont->inst_array) g_array_free (cont->inst_array, TRUE); g_free (cont); } void control_copy (XdeltaControl* cont, XdeltaSource* src, guint from, guint to) { XdeltaInstruction i; if (cont->inst_array->len > 0) { XdeltaInstruction* oi = & g_array_index (cont->inst_array, XdeltaInstruction, cont->inst_array->len-1); if (oi->index == src->source_index && (oi->offset + oi->length) == from) { oi->length += (to - from); return; } } i.index = src->source_index; i.offset = from; i.length = to - from; src->used = TRUE; if (src->position != from) src->sequential = FALSE; src->position = to; g_array_append_val (cont->inst_array, i); } #ifdef DEBUG_CONT static void print_info (XdeltaSourceInfo* si) { char md5str[33]; edsio_md5_to_string (si->md5, md5str); g_print (" ** info\n"); g_print (" md5: %s\n", md5str); g_print (" len: %d\n", si->length); } static void print_inst (XdeltaInstruction* i) { switch (i->type) { case INST_TYPE_COPY: g_print (" copy (%c) %d-%d (%d) from %d\n", i->type, i->offset, i->offset + i->length, i->length, i->index); break; case INST_TYPE_INSERT: g_print (" insert %d\n", i->length); break; } } static void xdp_print_control (XdeltaControl *cont) { gint i; g_print ("*** control\n"); g_print (" data len: %d\n", cont->data_len); print_info (&cont->to_info); g_print (" source info len: %d\n", cont->source_info_len); for (i = 0; i < cont->source_info_len; i += 1) print_info (cont->source_info[i]); g_print (" inst len: %d\n", cont->inst_len); for (i = 0; i < cont->inst_len; i += 1) print_inst (cont->inst + i); } #endif #ifdef DEBUG_CHECK_CONTROL void check_control (XdeltaControl* cont) { gint i; for (i = 0; i < cont->inst_len; i += 1) { switch (cont->inst[i].type) { case INST_TYPE_NCOPY: case INST_TYPE_COPY: if (cont->inst[i].index >= cont->source_info_len) g_error ("control has a too high instruction index\n"); } } } #endif static gboolean unpack_instructions (XdeltaControl* cont) { gint i; guint output_pos = 0; for (i = 0; i < cont->source_info_len; i += 1) { XdeltaSourceInfo* info = cont->source_info[i]; info->position = 0; info->copies = 0; info->copy_length = 0; } for (i = 0; i < cont->inst_len; i += 1) { XdeltaSourceInfo* info; XdeltaInstruction *inst = cont->inst + i; if (inst->index >= cont->source_info_len) { xd_generate_int_event (EC_XdOutOfRangeSourceIndex, inst->index); return FALSE; } info = cont->source_info[inst->index]; if (info->sequential) { inst->offset = info->position; info->position = inst->offset + inst->length; } inst->output_start = output_pos; output_pos += inst->length; info->copies += 1; info->copy_length += inst->length; } return TRUE; } static gboolean pack_instructions (XdeltaControl* cont) { gint i; for (i = 0; i < cont->source_info_len; i += 1) { XdeltaSourceInfo* info = cont->source_info[i]; info->position = 0; info->copies = 0; info->copy_length = 0; } for (i = 0; i < cont->inst_len; i += 1) { XdeltaSourceInfo* info; XdeltaInstruction *inst = cont->inst + i; if (inst->index >= cont->source_info_len) { xd_generate_int_event (EC_XdOutOfRangeSourceIndex, inst->index); return FALSE; } info = cont->source_info[inst->index]; if (info->sequential) { g_assert (info->position == inst->offset); info->position += inst->length; inst->offset = 0; } info->copies += 1; info->copy_length += inst->length; } return TRUE; } gboolean xdp_control_write (XdeltaControl *cont, XdeltaOutStream *cont_out) { SerialSink* sink = handle_sink (cont_out, NULL, NULL, NULL, NULL); #ifdef DEBUG_CONT xdp_print_control (cont); #endif #ifdef DEBUG_CHECK_CONTROL check_control (cont); #endif if (! sink) return FALSE; if (! pack_instructions (cont)) return FALSE; /* @@@ think about how the count function overcounts on the instruction * array by a factor of 2 or more. */ if (! serialize_xdeltacontrol_obj (sink, cont)) return FALSE; if (! handle_close (cont_out, 0)) return FALSE; return TRUE; } XdeltaControl* xdp_control_read (XdeltaStream *cont_in) { SerialSource* src = handle_source (cont_in); XdeltaControl* cont; SerialType type; if (! src) return NULL; if (! serializeio_unserialize_generic_acceptable (src, ST_XdeltaControl | ST_Version0Control, & type, (void**) & cont)) return NULL; if (type == ST_Version0Control) { SerialVersion0Control *ocont = (SerialVersion0Control*) cont; xd_generate_string_event (EC_XdBackwardCompatibilityMode, "1.0"); cont = control_version_0 (ocont); g_free (ocont); } if (! unpack_instructions (cont)) return NULL; #ifdef DEBUG_CHECK_CONTROL check_control (cont); #endif return cont; } XdeltaControl* control_version_0 (SerialVersion0Control* ocont) { XdeltaControl* cont = g_new0 (XdeltaControl, 1); gint i; XdeltaSourceInfo* dinfo; g_assert (! ocont->normalized); memcpy (cont->to_md5, ocont->to_info.real_md5, 16); cont->to_len = ocont->to_info.length; cont->has_data = TRUE; cont->source_info_len = ocont->source_info_len + 1; cont->source_info = g_new (XdeltaSourceInfo*, cont->source_info_len); cont->source_info[0] = dinfo = g_new0 (XdeltaSourceInfo, 1); dinfo->name = "(patch data)"; memcpy (dinfo->md5, ocont->to_info.md5, 15); dinfo->len = ocont->data_len; dinfo->isdata = TRUE; dinfo->sequential = FALSE; for (i = 0; i < ocont->source_info_len; i += 1) { XdeltaSourceInfo* info = g_new0 (XdeltaSourceInfo, 1); SerialVersion0SourceInfo* oinfo = ocont->source_info[i]; cont->source_info[i+1] = info; info->name = "unnamed"; memcpy (info->md5, oinfo->md5, 16); info->len = oinfo->length; info->isdata = FALSE; info->sequential = FALSE; } /* The old unpack */ #define OLD_QUERY_SIZE 4 for (i = 0; i < ocont->inst_len; i += 1) { switch (ocont->inst[i].length & 3) { case 0: ocont->inst[i].type = 'N'; break; case 1: ocont->inst[i].type = 'E'; break; case 2: ocont->inst[i].type = 'C'; break; case 3: ocont->inst[i].type = 'I'; break; } ocont->inst[i].length >>= 2; ocont->inst[i].index = ocont->inst[i].length & OLD_QUERY_SIZE; ocont->inst[i].length >>= OLD_QUERY_SIZE; } cont->inst_len = ocont->inst_len; cont->inst = g_new (XdeltaInstruction, cont->inst_len); for (i = 0; i < cont->inst_len; i += 1) { cont->inst[i].length = ocont->inst[i].length; cont->inst[i].offset = ocont->inst[i].offset; switch (ocont->inst[i].type) { case 'N': case 'E': abort (); break; case 'C': g_assert (ocont->inst[i].index == 0); cont->inst[i].index = 1; break; case 'I': cont->inst[i].index = 0; break; } } return cont; } xdelta-1.1.3/xdapply.c0000644006517700017500000000460307311304625010324 /* -*- Mode: C;-*- * * This file is part of XDelta - A binary delta generator. * * Copyright (C) 1997, 1998, 1999 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * $Id: xdapply.c 1.1 Thu, 01 Apr 1999 23:29:11 -0800 jmacd $ */ #include #include #include "xdelta.h" #include "xdeltapriv.h" /* This code used to be more general, but implemented a very * inefficient algorithm. It is sufficient (and efficient) for the * special case below, though, so I'm leaving it. */ static gboolean xdp_copy_delta_region (XdeltaControl *cont, XdeltaOutStream *output_stream) { gint i, l = cont->inst_len; guint save_written = 0; for (i = 0; i < l; i += 1) { const XdeltaInstruction *inst = cont->inst + i; XdeltaSourceInfo* info; if (inst->index >= cont->source_info_len) { xd_generate_int_event (EC_XdOutOfRangeSourceIndex, inst->index); return FALSE; } info = cont->source_info[inst->index]; if (! handle_copy (info->in, output_stream, inst->offset, inst->length)) return FALSE; save_written += inst->length; } return TRUE; } gboolean xdp_apply_delta (XdeltaControl *cont, XdeltaOutStream *res) { if (! xdp_copy_delta_region (cont, res)) return FALSE; if (! handle_close (res, 0)) return FALSE; if (! check_stream_integrity (res, cont->to_md5, cont->to_len)) { int i; /* to better report errors, check if the inputs were invalid now */ for (i = 0; i < cont->source_info_len; i += 1) { check_stream_integrity (cont->source_info[i]->in, cont->source_info[i]->md5, cont->source_info[i]->len); } return FALSE; } return TRUE; } xdelta-1.1.3/xd_edsio.c0000644006517700007640000014371707353553524010471 /* -*-Mode: C;-*- * Copyright (C) 1997, 1998, 1999 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * This file was AUTOMATICALLY GENERATED using: * * $Id: edsio.el 1.16 Tue, 06 Apr 1999 23:40:10 -0700 jmacd $ */ #include "xdelta.h" #include /* Declarations. */ static const char* Xd_String_event_field_to_string (GenericEvent* ev, gint field); static const char* Xd_HandleIntInt_event_field_to_string (GenericEvent* ev, gint field); static const char* Xd_HandleStringString_event_field_to_string (GenericEvent* ev, gint field); static const char* Xd_Int_event_field_to_string (GenericEvent* ev, gint field); static void print_spaces (guint n) { int i; for (i = 0; i < n; i += 1) g_print (" "); } /* initialize this library. */ gboolean xd_edsio_init (void) { static gboolean once = FALSE; static gboolean result = FALSE; if (once) return result; once = TRUE; eventdelivery_initialize_event_def (EC_XdBackwardCompatibilityModeValue, EL_Information, EF_None, "BackwardCompatibilityMode", "Reading a version ${0} delta control", & Xd_String_event_field_to_string); eventdelivery_initialize_event_def (EC_XdStreamLengthFailedValue, EL_Error, EF_None, "StreamLengthFailed", "${0}: Length validation failed, expected: ${1}, received: ${2}", & Xd_HandleIntInt_event_field_to_string); eventdelivery_initialize_event_def (EC_XdStreamChecksumFailedValue, EL_Error, EF_None, "StreamChecksumFailed", "${0}: Checksum validation failed, expected: ${1}, received: ${2}", & Xd_HandleStringString_event_field_to_string); eventdelivery_initialize_event_def (EC_XdIncompatibleDeltaValue, EL_Error, EF_None, "IncompatibleDelta", "The delta was not produced according by the `xdelta delta' command", NULL); eventdelivery_initialize_event_def (EC_XdInvalidRsyncCacheValue, EL_Error, EF_None, "InvalidRsyncCache", "The rsync checksum cache is corrupt", NULL); eventdelivery_initialize_event_def (EC_XdInvalidControlValue, EL_Error, EF_None, "InvalidControl", "Delta control is corrupt", NULL); eventdelivery_initialize_event_def (EC_XdOutOfRangeSourceIndexValue, EL_Error, EF_None, "OutOfRangeSourceIndex", "Instruction references out-of-range source index: ${0}", & Xd_Int_event_field_to_string); eventdelivery_initialize_event_def (EC_XdTooManySourcesValue, EL_Error, EF_None, "TooManySources", "Too many input sources", NULL); eventdelivery_initialize_event_def (EC_XdTooFewSourcesValue, EL_Error, EF_None, "TooFewSources", "Too few input sources", NULL); serializeio_initialize_type ("ST_Version0Instruction", ST_Version0Instruction, &unserialize_version0instruction_internal, &serialize_version0instruction_obj_internal, &serializeio_count_version0instruction_obj, &serializeio_print_version0instruction_obj); serializeio_initialize_type ("ST_Version0Control", ST_Version0Control, &unserialize_version0control_internal, &serialize_version0control_obj_internal, &serializeio_count_version0control_obj, &serializeio_print_version0control_obj); serializeio_initialize_type ("ST_Version0SourceInfo", ST_Version0SourceInfo, &unserialize_version0sourceinfo_internal, &serialize_version0sourceinfo_obj_internal, &serializeio_count_version0sourceinfo_obj, &serializeio_print_version0sourceinfo_obj); serializeio_initialize_type ("ST_RsyncIndex", ST_RsyncIndex, &unserialize_rsyncindex_internal, &serialize_rsyncindex_obj_internal, &serializeio_count_rsyncindex_obj, &serializeio_print_rsyncindex_obj); serializeio_initialize_type ("ST_RsyncIndexElt", ST_RsyncIndexElt, &unserialize_rsyncindexelt_internal, &serialize_rsyncindexelt_obj_internal, &serializeio_count_rsyncindexelt_obj, &serializeio_print_rsyncindexelt_obj); serializeio_initialize_type ("ST_XdeltaInstruction", ST_XdeltaInstruction, &unserialize_xdeltainstruction_internal, &serialize_xdeltainstruction_obj_internal, &serializeio_count_xdeltainstruction_obj, &serializeio_print_xdeltainstruction_obj); serializeio_initialize_type ("ST_XdeltaControl", ST_XdeltaControl, &unserialize_xdeltacontrol_internal, &serialize_xdeltacontrol_obj_internal, &serializeio_count_xdeltacontrol_obj, &serializeio_print_xdeltacontrol_obj); serializeio_initialize_type ("ST_XdeltaSourceInfo", ST_XdeltaSourceInfo, &unserialize_xdeltasourceinfo_internal, &serialize_xdeltasourceinfo_obj_internal, &serializeio_count_xdeltasourceinfo_obj, &serializeio_print_xdeltasourceinfo_obj); serializeio_initialize_type ("ST_XdeltaIndex", ST_XdeltaIndex, &unserialize_xdeltaindex_internal, &serialize_xdeltaindex_obj_internal, &serializeio_count_xdeltaindex_obj, &serializeio_print_xdeltaindex_obj); serializeio_initialize_type ("ST_XdeltaChecksum", ST_XdeltaChecksum, &unserialize_xdeltachecksum_internal, &serialize_xdeltachecksum_obj_internal, &serializeio_count_xdeltachecksum_obj, &serializeio_print_xdeltachecksum_obj); edsio_library_register (3, "xd"); result = TRUE; return TRUE; } /* XdeltaChecksum Count */ guint serializeio_count_xdeltachecksum (guint16 high, guint16 low) { guint size = sizeof (SerialXdeltaChecksum); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); return size; } guint serializeio_count_xdeltachecksum_obj (SerialXdeltaChecksum const* obj) { return serializeio_count_xdeltachecksum (obj->high, obj->low); } /* XdeltaChecksum Print */ void serializeio_print_xdeltachecksum_obj (SerialXdeltaChecksum* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_XdeltaChecksum]\n"); print_spaces (indent_spaces); g_print ("high = "); g_print ("%d\n", obj->high); print_spaces (indent_spaces); g_print ("low = "); g_print ("%d\n", obj->low); } /* XdeltaChecksum Serialize */ gboolean serialize_xdeltachecksum_internal (SerialSink *sink, guint16 high, guint16 low) { if (! (* sink->next_uint16) (sink, high)) goto bail; if (! (* sink->next_uint16) (sink, low)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_xdeltachecksum_obj_internal (SerialSink *sink, SerialXdeltaChecksum* obj) { return serialize_xdeltachecksum_internal (sink, obj->high, obj->low); } gboolean serialize_xdeltachecksum (SerialSink *sink, guint16 high, guint16 low) { if (! (* sink->sink_type) (sink, ST_XdeltaChecksum, serializeio_count_xdeltachecksum (high, low), TRUE)) goto bail; if (! serialize_xdeltachecksum_internal (sink, high, low)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_xdeltachecksum_obj (SerialSink *sink, const SerialXdeltaChecksum* obj) { return serialize_xdeltachecksum (sink, obj->high, obj->low); } /* XdeltaChecksum Unserialize */ gboolean unserialize_xdeltachecksum_internal_noalloc (SerialSource *source, SerialXdeltaChecksum* result) { if (! (* source->next_uint16) (source, &result->high)) goto bail; if (! (* source->next_uint16) (source, &result->low)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_xdeltachecksum_internal (SerialSource *source, SerialXdeltaChecksum** result) { SerialXdeltaChecksum* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialXdeltaChecksum)); if (! unser) goto bail; if (! unserialize_xdeltachecksum_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_xdeltachecksum (SerialSource *source, SerialXdeltaChecksum** result) { if ( (* source->source_type) (source, TRUE) != ST_XdeltaChecksum) goto bail; if (! unserialize_xdeltachecksum_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* XdeltaIndex Count */ guint serializeio_count_xdeltaindex (guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialXdeltaChecksum const* index) { guint size = sizeof (SerialXdeltaIndex); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); { gint i; for (i = 0; i < index_len; i += 1) { size += serializeio_count_xdeltachecksum_obj (& (index[i])); } } ALIGN_8 (size); return size; } guint serializeio_count_xdeltaindex_obj (SerialXdeltaIndex const* obj) { return serializeio_count_xdeltaindex (obj->file_len, obj->file_md5, obj->index_len, obj->index); } /* XdeltaIndex Print */ void serializeio_print_xdeltaindex_obj (SerialXdeltaIndex* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_XdeltaIndex]\n"); print_spaces (indent_spaces); g_print ("file_len = "); g_print ("%d\n", obj->file_len); print_spaces (indent_spaces); g_print ("file_md5 = "); serializeio_print_bytes (obj->file_md5, 16); print_spaces (indent_spaces); g_print ("index = "); g_print ("{\n"); { gint i; for (i = 0; i < obj->index_len; i += 1) { print_spaces (indent_spaces); g_print ("%d: ", i); print_spaces (indent_spaces); serializeio_print_xdeltachecksum_obj (& (obj->index[i]), indent_spaces + 2); print_spaces (indent_spaces); ; } } g_print ("}\n"); } /* XdeltaIndex Serialize */ gboolean serialize_xdeltaindex_internal (SerialSink *sink, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialXdeltaChecksum const* index) { if (! (* sink->next_uint) (sink, file_len)) goto bail; if (! (* sink->next_bytes_known) (sink, file_md5, 16)) goto bail; { gint i; if (! (* sink->next_uint) (sink, index_len)) goto bail; for (i = 0; i < index_len; i += 1) { if (! serialize_xdeltachecksum_internal (sink, (index[i]).high, (index[i]).low)) goto bail; } } return TRUE; bail: return FALSE; } gboolean serialize_xdeltaindex_obj_internal (SerialSink *sink, SerialXdeltaIndex* obj) { return serialize_xdeltaindex_internal (sink, obj->file_len, obj->file_md5, obj->index_len, obj->index); } gboolean serialize_xdeltaindex (SerialSink *sink, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialXdeltaChecksum const* index) { if (! (* sink->sink_type) (sink, ST_XdeltaIndex, serializeio_count_xdeltaindex (file_len, file_md5, index_len, index), TRUE)) goto bail; if (! serialize_xdeltaindex_internal (sink, file_len, file_md5, index_len, index)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_xdeltaindex_obj (SerialSink *sink, const SerialXdeltaIndex* obj) { return serialize_xdeltaindex (sink, obj->file_len, obj->file_md5, obj->index_len, obj->index); } /* XdeltaIndex Unserialize */ gboolean unserialize_xdeltaindex_internal_noalloc (SerialSource *source, SerialXdeltaIndex* result) { if (! (* source->next_uint) (source, &result->file_len)) goto bail; if (! (* source->next_bytes_known) (source, result->file_md5, 16)) goto bail; { gint i; if (! (* source->next_uint) (source, &result->index_len)) goto bail; if (! (result->index = serializeio_source_alloc (source, sizeof (SerialXdeltaChecksum) * result->index_len))) goto bail; for (i = 0; i < result->index_len; i += 1) { if (! unserialize_xdeltachecksum_internal_noalloc (source, &(result->index[i]))) goto bail; } } return TRUE; bail: return FALSE; } gboolean unserialize_xdeltaindex_internal (SerialSource *source, SerialXdeltaIndex** result) { SerialXdeltaIndex* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialXdeltaIndex)); if (! unser) goto bail; if (! unserialize_xdeltaindex_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_xdeltaindex (SerialSource *source, SerialXdeltaIndex** result) { if ( (* source->source_type) (source, TRUE) != ST_XdeltaIndex) goto bail; if (! unserialize_xdeltaindex_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* XdeltaSourceInfo Count */ guint serializeio_count_xdeltasourceinfo (const gchar* name, const guint8 md5[16], guint32 len, gboolean isdata, gboolean sequential) { guint size = sizeof (SerialXdeltaSourceInfo); ALIGN_8 (size); size += strlen (name) + 1; ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); return size; } guint serializeio_count_xdeltasourceinfo_obj (SerialXdeltaSourceInfo const* obj) { return serializeio_count_xdeltasourceinfo (obj->name, obj->md5, obj->len, obj->isdata, obj->sequential); } /* XdeltaSourceInfo Print */ void serializeio_print_xdeltasourceinfo_obj (SerialXdeltaSourceInfo* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_XdeltaSourceInfo]\n"); print_spaces (indent_spaces); g_print ("name = "); g_print ("%s\n", obj->name); print_spaces (indent_spaces); g_print ("md5 = "); serializeio_print_bytes (obj->md5, 16); print_spaces (indent_spaces); g_print ("len = "); g_print ("%d\n", obj->len); print_spaces (indent_spaces); g_print ("isdata = "); g_print ("%s\n", obj->isdata ? "true" : "false"); print_spaces (indent_spaces); g_print ("sequential = "); g_print ("%s\n", obj->sequential ? "true" : "false"); } /* XdeltaSourceInfo Serialize */ gboolean serialize_xdeltasourceinfo_internal (SerialSink *sink, const gchar* name, const guint8 md5[16], guint32 len, gboolean isdata, gboolean sequential) { if (! (* sink->next_string) (sink, name)) goto bail; if (! (* sink->next_bytes_known) (sink, md5, 16)) goto bail; if (! (* sink->next_uint) (sink, len)) goto bail; if (! (* sink->next_bool) (sink, isdata)) goto bail; if (! (* sink->next_bool) (sink, sequential)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_xdeltasourceinfo_obj_internal (SerialSink *sink, SerialXdeltaSourceInfo* obj) { return serialize_xdeltasourceinfo_internal (sink, obj->name, obj->md5, obj->len, obj->isdata, obj->sequential); } gboolean serialize_xdeltasourceinfo (SerialSink *sink, const gchar* name, const guint8 md5[16], guint32 len, gboolean isdata, gboolean sequential) { if (! (* sink->sink_type) (sink, ST_XdeltaSourceInfo, serializeio_count_xdeltasourceinfo (name, md5, len, isdata, sequential), TRUE)) goto bail; if (! serialize_xdeltasourceinfo_internal (sink, name, md5, len, isdata, sequential)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_xdeltasourceinfo_obj (SerialSink *sink, const SerialXdeltaSourceInfo* obj) { return serialize_xdeltasourceinfo (sink, obj->name, obj->md5, obj->len, obj->isdata, obj->sequential); } /* XdeltaSourceInfo Unserialize */ gboolean unserialize_xdeltasourceinfo_internal_noalloc (SerialSource *source, SerialXdeltaSourceInfo* result) { if (! (* source->next_string) (source, &result->name)) goto bail; if (! (* source->next_bytes_known) (source, result->md5, 16)) goto bail; if (! (* source->next_uint) (source, &result->len)) goto bail; if (! (* source->next_bool) (source, &result->isdata)) goto bail; if (! (* source->next_bool) (source, &result->sequential)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_xdeltasourceinfo_internal (SerialSource *source, SerialXdeltaSourceInfo** result) { SerialXdeltaSourceInfo* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialXdeltaSourceInfo)); if (! unser) goto bail; if (! unserialize_xdeltasourceinfo_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_xdeltasourceinfo (SerialSource *source, SerialXdeltaSourceInfo** result) { if ( (* source->source_type) (source, TRUE) != ST_XdeltaSourceInfo) goto bail; if (! unserialize_xdeltasourceinfo_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* XdeltaControl Count */ guint serializeio_count_xdeltacontrol (const guint8 to_md5[16], guint32 to_len, gboolean has_data, guint32 source_info_len, SerialXdeltaSourceInfo* const* source_info, guint32 inst_len, SerialXdeltaInstruction const* inst) { guint size = sizeof (SerialXdeltaControl); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); { gint i; for (i = 0; i < source_info_len; i += 1) { size += serializeio_count_xdeltasourceinfo_obj ((source_info[i])) + sizeof (void*); } } ALIGN_8 (size); { gint i; for (i = 0; i < inst_len; i += 1) { size += serializeio_count_xdeltainstruction_obj (& (inst[i])); } } ALIGN_8 (size); return size; } guint serializeio_count_xdeltacontrol_obj (SerialXdeltaControl const* obj) { return serializeio_count_xdeltacontrol (obj->to_md5, obj->to_len, obj->has_data, obj->source_info_len, obj->source_info, obj->inst_len, obj->inst); } /* XdeltaControl Print */ void serializeio_print_xdeltacontrol_obj (SerialXdeltaControl* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_XdeltaControl]\n"); print_spaces (indent_spaces); g_print ("to_md5 = "); serializeio_print_bytes (obj->to_md5, 16); print_spaces (indent_spaces); g_print ("to_len = "); g_print ("%d\n", obj->to_len); print_spaces (indent_spaces); g_print ("has_data = "); g_print ("%s\n", obj->has_data ? "true" : "false"); print_spaces (indent_spaces); g_print ("source_info = "); g_print ("{\n"); { gint i; for (i = 0; i < obj->source_info_len; i += 1) { print_spaces (indent_spaces); g_print ("%d: ", i); print_spaces (indent_spaces); serializeio_print_xdeltasourceinfo_obj ((obj->source_info[i]), indent_spaces + 2); print_spaces (indent_spaces); ; } } g_print ("}\n"); print_spaces (indent_spaces); g_print ("inst = "); g_print ("{\n"); { gint i; for (i = 0; i < obj->inst_len; i += 1) { print_spaces (indent_spaces); g_print ("%d: ", i); print_spaces (indent_spaces); serializeio_print_xdeltainstruction_obj (& (obj->inst[i]), indent_spaces + 2); print_spaces (indent_spaces); ; } } g_print ("}\n"); } /* XdeltaControl Serialize */ gboolean serialize_xdeltacontrol_internal (SerialSink *sink, const guint8 to_md5[16], guint32 to_len, gboolean has_data, guint32 source_info_len, SerialXdeltaSourceInfo* const* source_info, guint32 inst_len, SerialXdeltaInstruction const* inst) { if (! (* sink->next_bytes_known) (sink, to_md5, 16)) goto bail; if (! (* sink->next_uint) (sink, to_len)) goto bail; if (! (* sink->next_bool) (sink, has_data)) goto bail; { gint i; if (! (* sink->next_uint) (sink, source_info_len)) goto bail; for (i = 0; i < source_info_len; i += 1) { if (! serialize_xdeltasourceinfo_internal (sink, (source_info[i])->name, (source_info[i])->md5, (source_info[i])->len, (source_info[i])->isdata, (source_info[i])->sequential)) goto bail; } } { gint i; if (! (* sink->next_uint) (sink, inst_len)) goto bail; for (i = 0; i < inst_len; i += 1) { if (! serialize_xdeltainstruction_internal (sink, (inst[i]).index, (inst[i]).offset, (inst[i]).length)) goto bail; } } return TRUE; bail: return FALSE; } gboolean serialize_xdeltacontrol_obj_internal (SerialSink *sink, SerialXdeltaControl* obj) { return serialize_xdeltacontrol_internal (sink, obj->to_md5, obj->to_len, obj->has_data, obj->source_info_len, obj->source_info, obj->inst_len, obj->inst); } gboolean serialize_xdeltacontrol (SerialSink *sink, const guint8 to_md5[16], guint32 to_len, gboolean has_data, guint32 source_info_len, SerialXdeltaSourceInfo* const* source_info, guint32 inst_len, SerialXdeltaInstruction const* inst) { if (! (* sink->sink_type) (sink, ST_XdeltaControl, serializeio_count_xdeltacontrol (to_md5, to_len, has_data, source_info_len, source_info, inst_len, inst), TRUE)) goto bail; if (! serialize_xdeltacontrol_internal (sink, to_md5, to_len, has_data, source_info_len, source_info, inst_len, inst)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_xdeltacontrol_obj (SerialSink *sink, const SerialXdeltaControl* obj) { return serialize_xdeltacontrol (sink, obj->to_md5, obj->to_len, obj->has_data, obj->source_info_len, obj->source_info, obj->inst_len, obj->inst); } /* XdeltaControl Unserialize */ gboolean unserialize_xdeltacontrol_internal_noalloc (SerialSource *source, SerialXdeltaControl* result) { if (! (* source->next_bytes_known) (source, result->to_md5, 16)) goto bail; if (! (* source->next_uint) (source, &result->to_len)) goto bail; if (! (* source->next_bool) (source, &result->has_data)) goto bail; { gint i; if (! (* source->next_uint) (source, &result->source_info_len)) goto bail; if (! (result->source_info = serializeio_source_alloc (source, sizeof (SerialXdeltaSourceInfo*) * result->source_info_len))) goto bail; for (i = 0; i < result->source_info_len; i += 1) { if (! unserialize_xdeltasourceinfo_internal (source, &(result->source_info[i]))) goto bail; } } { gint i; if (! (* source->next_uint) (source, &result->inst_len)) goto bail; if (! (result->inst = serializeio_source_alloc (source, sizeof (SerialXdeltaInstruction) * result->inst_len))) goto bail; for (i = 0; i < result->inst_len; i += 1) { if (! unserialize_xdeltainstruction_internal_noalloc (source, &(result->inst[i]))) goto bail; } } return TRUE; bail: return FALSE; } gboolean unserialize_xdeltacontrol_internal (SerialSource *source, SerialXdeltaControl** result) { SerialXdeltaControl* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialXdeltaControl)); if (! unser) goto bail; if (! unserialize_xdeltacontrol_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_xdeltacontrol (SerialSource *source, SerialXdeltaControl** result) { if ( (* source->source_type) (source, TRUE) != ST_XdeltaControl) goto bail; if (! unserialize_xdeltacontrol_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* XdeltaInstruction Count */ guint serializeio_count_xdeltainstruction (guint32 index, guint32 offset, guint32 length) { guint size = sizeof (SerialXdeltaInstruction); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); return size; } guint serializeio_count_xdeltainstruction_obj (SerialXdeltaInstruction const* obj) { return serializeio_count_xdeltainstruction (obj->index, obj->offset, obj->length); } /* XdeltaInstruction Print */ void serializeio_print_xdeltainstruction_obj (SerialXdeltaInstruction* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_XdeltaInstruction]\n"); print_spaces (indent_spaces); g_print ("index = "); g_print ("%d\n", obj->index); print_spaces (indent_spaces); g_print ("offset = "); g_print ("%d\n", obj->offset); print_spaces (indent_spaces); g_print ("length = "); g_print ("%d\n", obj->length); } /* XdeltaInstruction Serialize */ gboolean serialize_xdeltainstruction_internal (SerialSink *sink, guint32 index, guint32 offset, guint32 length) { if (! (* sink->next_uint) (sink, index)) goto bail; if (! (* sink->next_uint) (sink, offset)) goto bail; if (! (* sink->next_uint) (sink, length)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_xdeltainstruction_obj_internal (SerialSink *sink, SerialXdeltaInstruction* obj) { return serialize_xdeltainstruction_internal (sink, obj->index, obj->offset, obj->length); } gboolean serialize_xdeltainstruction (SerialSink *sink, guint32 index, guint32 offset, guint32 length) { if (! (* sink->sink_type) (sink, ST_XdeltaInstruction, serializeio_count_xdeltainstruction (index, offset, length), TRUE)) goto bail; if (! serialize_xdeltainstruction_internal (sink, index, offset, length)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_xdeltainstruction_obj (SerialSink *sink, const SerialXdeltaInstruction* obj) { return serialize_xdeltainstruction (sink, obj->index, obj->offset, obj->length); } /* XdeltaInstruction Unserialize */ gboolean unserialize_xdeltainstruction_internal_noalloc (SerialSource *source, SerialXdeltaInstruction* result) { if (! (* source->next_uint) (source, &result->index)) goto bail; if (! (* source->next_uint) (source, &result->offset)) goto bail; if (! (* source->next_uint) (source, &result->length)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_xdeltainstruction_internal (SerialSource *source, SerialXdeltaInstruction** result) { SerialXdeltaInstruction* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialXdeltaInstruction)); if (! unser) goto bail; if (! unserialize_xdeltainstruction_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_xdeltainstruction (SerialSource *source, SerialXdeltaInstruction** result) { if ( (* source->source_type) (source, TRUE) != ST_XdeltaInstruction) goto bail; if (! unserialize_xdeltainstruction_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* RsyncIndexElt Count */ guint serializeio_count_rsyncindexelt (const guint8 md5[16], SerialXdeltaChecksum const* cksum) { guint size = sizeof (SerialRsyncIndexElt); ALIGN_8 (size); ALIGN_8 (size); size += serializeio_count_xdeltachecksum_obj (cksum) - sizeof (SerialXdeltaChecksum); ALIGN_8 (size); return size; } guint serializeio_count_rsyncindexelt_obj (SerialRsyncIndexElt const* obj) { return serializeio_count_rsyncindexelt (obj->md5, &obj->cksum); } /* RsyncIndexElt Print */ void serializeio_print_rsyncindexelt_obj (SerialRsyncIndexElt* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_RsyncIndexElt]\n"); print_spaces (indent_spaces); g_print ("md5 = "); serializeio_print_bytes (obj->md5, 16); print_spaces (indent_spaces); g_print ("cksum = "); g_print ("{\n"); serializeio_print_xdeltachecksum_obj (& obj->cksum, indent_spaces + 2); print_spaces (indent_spaces); ; g_print ("}\n"); } /* RsyncIndexElt Serialize */ gboolean serialize_rsyncindexelt_internal (SerialSink *sink, const guint8 md5[16], SerialXdeltaChecksum const* cksum) { if (! (* sink->next_bytes_known) (sink, md5, 16)) goto bail; if (! serialize_xdeltachecksum_internal (sink, cksum->high, cksum->low)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_rsyncindexelt_obj_internal (SerialSink *sink, SerialRsyncIndexElt* obj) { return serialize_rsyncindexelt_internal (sink, obj->md5, &obj->cksum); } gboolean serialize_rsyncindexelt (SerialSink *sink, const guint8 md5[16], SerialXdeltaChecksum const* cksum) { if (! (* sink->sink_type) (sink, ST_RsyncIndexElt, serializeio_count_rsyncindexelt (md5, cksum), TRUE)) goto bail; if (! serialize_rsyncindexelt_internal (sink, md5, cksum)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_rsyncindexelt_obj (SerialSink *sink, const SerialRsyncIndexElt* obj) { return serialize_rsyncindexelt (sink, obj->md5, &obj->cksum); } /* RsyncIndexElt Unserialize */ gboolean unserialize_rsyncindexelt_internal_noalloc (SerialSource *source, SerialRsyncIndexElt* result) { if (! (* source->next_bytes_known) (source, result->md5, 16)) goto bail; if (! unserialize_xdeltachecksum_internal_noalloc (source, &result->cksum)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_rsyncindexelt_internal (SerialSource *source, SerialRsyncIndexElt** result) { SerialRsyncIndexElt* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialRsyncIndexElt)); if (! unser) goto bail; if (! unserialize_rsyncindexelt_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_rsyncindexelt (SerialSource *source, SerialRsyncIndexElt** result) { if ( (* source->source_type) (source, TRUE) != ST_RsyncIndexElt) goto bail; if (! unserialize_rsyncindexelt_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* RsyncIndex Count */ guint serializeio_count_rsyncindex (guint32 seg_len, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialRsyncIndexElt const* index) { guint size = sizeof (SerialRsyncIndex); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); { gint i; for (i = 0; i < index_len; i += 1) { size += serializeio_count_rsyncindexelt_obj (& (index[i])); } } ALIGN_8 (size); return size; } guint serializeio_count_rsyncindex_obj (SerialRsyncIndex const* obj) { return serializeio_count_rsyncindex (obj->seg_len, obj->file_len, obj->file_md5, obj->index_len, obj->index); } /* RsyncIndex Print */ void serializeio_print_rsyncindex_obj (SerialRsyncIndex* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_RsyncIndex]\n"); print_spaces (indent_spaces); g_print ("seg_len = "); g_print ("%d\n", obj->seg_len); print_spaces (indent_spaces); g_print ("file_len = "); g_print ("%d\n", obj->file_len); print_spaces (indent_spaces); g_print ("file_md5 = "); serializeio_print_bytes (obj->file_md5, 16); print_spaces (indent_spaces); g_print ("index = "); g_print ("{\n"); { gint i; for (i = 0; i < obj->index_len; i += 1) { print_spaces (indent_spaces); g_print ("%d: ", i); print_spaces (indent_spaces); serializeio_print_rsyncindexelt_obj (& (obj->index[i]), indent_spaces + 2); print_spaces (indent_spaces); ; } } g_print ("}\n"); } /* RsyncIndex Serialize */ gboolean serialize_rsyncindex_internal (SerialSink *sink, guint32 seg_len, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialRsyncIndexElt const* index) { if (! (* sink->next_uint) (sink, seg_len)) goto bail; if (! (* sink->next_uint) (sink, file_len)) goto bail; if (! (* sink->next_bytes_known) (sink, file_md5, 16)) goto bail; { gint i; if (! (* sink->next_uint) (sink, index_len)) goto bail; for (i = 0; i < index_len; i += 1) { if (! serialize_rsyncindexelt_internal (sink, (index[i]).md5, &(index[i]).cksum)) goto bail; } } return TRUE; bail: return FALSE; } gboolean serialize_rsyncindex_obj_internal (SerialSink *sink, SerialRsyncIndex* obj) { return serialize_rsyncindex_internal (sink, obj->seg_len, obj->file_len, obj->file_md5, obj->index_len, obj->index); } gboolean serialize_rsyncindex (SerialSink *sink, guint32 seg_len, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialRsyncIndexElt const* index) { if (! (* sink->sink_type) (sink, ST_RsyncIndex, serializeio_count_rsyncindex (seg_len, file_len, file_md5, index_len, index), TRUE)) goto bail; if (! serialize_rsyncindex_internal (sink, seg_len, file_len, file_md5, index_len, index)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_rsyncindex_obj (SerialSink *sink, const SerialRsyncIndex* obj) { return serialize_rsyncindex (sink, obj->seg_len, obj->file_len, obj->file_md5, obj->index_len, obj->index); } /* RsyncIndex Unserialize */ gboolean unserialize_rsyncindex_internal_noalloc (SerialSource *source, SerialRsyncIndex* result) { if (! (* source->next_uint) (source, &result->seg_len)) goto bail; if (! (* source->next_uint) (source, &result->file_len)) goto bail; if (! (* source->next_bytes_known) (source, result->file_md5, 16)) goto bail; { gint i; if (! (* source->next_uint) (source, &result->index_len)) goto bail; if (! (result->index = serializeio_source_alloc (source, sizeof (SerialRsyncIndexElt) * result->index_len))) goto bail; for (i = 0; i < result->index_len; i += 1) { if (! unserialize_rsyncindexelt_internal_noalloc (source, &(result->index[i]))) goto bail; } } return TRUE; bail: return FALSE; } gboolean unserialize_rsyncindex_internal (SerialSource *source, SerialRsyncIndex** result) { SerialRsyncIndex* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialRsyncIndex)); if (! unser) goto bail; if (! unserialize_rsyncindex_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_rsyncindex (SerialSource *source, SerialRsyncIndex** result) { if ( (* source->source_type) (source, TRUE) != ST_RsyncIndex) goto bail; if (! unserialize_rsyncindex_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* Version0SourceInfo Count */ guint serializeio_count_version0sourceinfo (const guint8 md5[16], const guint8 real_md5[16], guint32 length) { guint size = sizeof (SerialVersion0SourceInfo); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); return size; } guint serializeio_count_version0sourceinfo_obj (SerialVersion0SourceInfo const* obj) { return serializeio_count_version0sourceinfo (obj->md5, obj->real_md5, obj->length); } /* Version0SourceInfo Print */ void serializeio_print_version0sourceinfo_obj (SerialVersion0SourceInfo* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_Version0SourceInfo]\n"); print_spaces (indent_spaces); g_print ("md5 = "); serializeio_print_bytes (obj->md5, 16); print_spaces (indent_spaces); g_print ("real_md5 = "); serializeio_print_bytes (obj->real_md5, 16); print_spaces (indent_spaces); g_print ("length = "); g_print ("%d\n", obj->length); } /* Version0SourceInfo Serialize */ gboolean serialize_version0sourceinfo_internal (SerialSink *sink, const guint8 md5[16], const guint8 real_md5[16], guint32 length) { if (! (* sink->next_bytes_known) (sink, md5, 16)) goto bail; if (! (* sink->next_bytes_known) (sink, real_md5, 16)) goto bail; if (! (* sink->next_uint) (sink, length)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_version0sourceinfo_obj_internal (SerialSink *sink, SerialVersion0SourceInfo* obj) { return serialize_version0sourceinfo_internal (sink, obj->md5, obj->real_md5, obj->length); } gboolean serialize_version0sourceinfo (SerialSink *sink, const guint8 md5[16], const guint8 real_md5[16], guint32 length) { if (! (* sink->sink_type) (sink, ST_Version0SourceInfo, serializeio_count_version0sourceinfo (md5, real_md5, length), TRUE)) goto bail; if (! serialize_version0sourceinfo_internal (sink, md5, real_md5, length)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_version0sourceinfo_obj (SerialSink *sink, const SerialVersion0SourceInfo* obj) { return serialize_version0sourceinfo (sink, obj->md5, obj->real_md5, obj->length); } /* Version0SourceInfo Unserialize */ gboolean unserialize_version0sourceinfo_internal_noalloc (SerialSource *source, SerialVersion0SourceInfo* result) { if (! (* source->next_bytes_known) (source, result->md5, 16)) goto bail; if (! (* source->next_bytes_known) (source, result->real_md5, 16)) goto bail; if (! (* source->next_uint) (source, &result->length)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_version0sourceinfo_internal (SerialSource *source, SerialVersion0SourceInfo** result) { SerialVersion0SourceInfo* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialVersion0SourceInfo)); if (! unser) goto bail; if (! unserialize_version0sourceinfo_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_version0sourceinfo (SerialSource *source, SerialVersion0SourceInfo** result) { if ( (* source->source_type) (source, TRUE) != ST_Version0SourceInfo) goto bail; if (! unserialize_version0sourceinfo_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* Version0Control Count */ guint serializeio_count_version0control (gboolean normalized, guint32 data_len, SerialVersion0SourceInfo const* to_info, guint32 source_info_len, SerialVersion0SourceInfo* const* source_info, guint32 inst_len, SerialVersion0Instruction const* inst) { guint size = sizeof (SerialVersion0Control); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); size += serializeio_count_version0sourceinfo_obj (to_info) - sizeof (SerialVersion0SourceInfo); ALIGN_8 (size); { gint i; for (i = 0; i < source_info_len; i += 1) { size += serializeio_count_version0sourceinfo_obj ((source_info[i])) + sizeof (void*); } } ALIGN_8 (size); { gint i; for (i = 0; i < inst_len; i += 1) { size += serializeio_count_version0instruction_obj (& (inst[i])); } } ALIGN_8 (size); return size; } guint serializeio_count_version0control_obj (SerialVersion0Control const* obj) { return serializeio_count_version0control (obj->normalized, obj->data_len, &obj->to_info, obj->source_info_len, obj->source_info, obj->inst_len, obj->inst); } /* Version0Control Print */ void serializeio_print_version0control_obj (SerialVersion0Control* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_Version0Control]\n"); print_spaces (indent_spaces); g_print ("normalized = "); g_print ("%s\n", obj->normalized ? "true" : "false"); print_spaces (indent_spaces); g_print ("data_len = "); g_print ("%d\n", obj->data_len); print_spaces (indent_spaces); g_print ("to_info = "); g_print ("{\n"); serializeio_print_version0sourceinfo_obj (& obj->to_info, indent_spaces + 2); print_spaces (indent_spaces); ; g_print ("}\n"); print_spaces (indent_spaces); g_print ("source_info = "); g_print ("{\n"); { gint i; for (i = 0; i < obj->source_info_len; i += 1) { print_spaces (indent_spaces); g_print ("%d: ", i); print_spaces (indent_spaces); serializeio_print_version0sourceinfo_obj ((obj->source_info[i]), indent_spaces + 2); print_spaces (indent_spaces); ; } } g_print ("}\n"); print_spaces (indent_spaces); g_print ("inst = "); g_print ("{\n"); { gint i; for (i = 0; i < obj->inst_len; i += 1) { print_spaces (indent_spaces); g_print ("%d: ", i); print_spaces (indent_spaces); serializeio_print_version0instruction_obj (& (obj->inst[i]), indent_spaces + 2); print_spaces (indent_spaces); ; } } g_print ("}\n"); } /* Version0Control Serialize */ gboolean serialize_version0control_internal (SerialSink *sink, gboolean normalized, guint32 data_len, SerialVersion0SourceInfo const* to_info, guint32 source_info_len, SerialVersion0SourceInfo* const* source_info, guint32 inst_len, SerialVersion0Instruction const* inst) { if (! (* sink->next_bool) (sink, normalized)) goto bail; if (! (* sink->next_uint) (sink, data_len)) goto bail; if (! serialize_version0sourceinfo_internal (sink, to_info->md5, to_info->real_md5, to_info->length)) goto bail; { gint i; if (! (* sink->next_uint) (sink, source_info_len)) goto bail; for (i = 0; i < source_info_len; i += 1) { if (! serialize_version0sourceinfo_internal (sink, (source_info[i])->md5, (source_info[i])->real_md5, (source_info[i])->length)) goto bail; } } { gint i; if (! (* sink->next_uint) (sink, inst_len)) goto bail; for (i = 0; i < inst_len; i += 1) { if (! serialize_version0instruction_internal (sink, (inst[i]).offset, (inst[i]).length)) goto bail; } } return TRUE; bail: return FALSE; } gboolean serialize_version0control_obj_internal (SerialSink *sink, SerialVersion0Control* obj) { return serialize_version0control_internal (sink, obj->normalized, obj->data_len, &obj->to_info, obj->source_info_len, obj->source_info, obj->inst_len, obj->inst); } gboolean serialize_version0control (SerialSink *sink, gboolean normalized, guint32 data_len, SerialVersion0SourceInfo const* to_info, guint32 source_info_len, SerialVersion0SourceInfo* const* source_info, guint32 inst_len, SerialVersion0Instruction const* inst) { if (! (* sink->sink_type) (sink, ST_Version0Control, serializeio_count_version0control (normalized, data_len, to_info, source_info_len, source_info, inst_len, inst), TRUE)) goto bail; if (! serialize_version0control_internal (sink, normalized, data_len, to_info, source_info_len, source_info, inst_len, inst)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_version0control_obj (SerialSink *sink, const SerialVersion0Control* obj) { return serialize_version0control (sink, obj->normalized, obj->data_len, &obj->to_info, obj->source_info_len, obj->source_info, obj->inst_len, obj->inst); } /* Version0Control Unserialize */ gboolean unserialize_version0control_internal_noalloc (SerialSource *source, SerialVersion0Control* result) { if (! (* source->next_bool) (source, &result->normalized)) goto bail; if (! (* source->next_uint) (source, &result->data_len)) goto bail; if (! unserialize_version0sourceinfo_internal_noalloc (source, &result->to_info)) goto bail; { gint i; if (! (* source->next_uint) (source, &result->source_info_len)) goto bail; if (! (result->source_info = serializeio_source_alloc (source, sizeof (SerialVersion0SourceInfo*) * result->source_info_len))) goto bail; for (i = 0; i < result->source_info_len; i += 1) { if (! unserialize_version0sourceinfo_internal (source, &(result->source_info[i]))) goto bail; } } { gint i; if (! (* source->next_uint) (source, &result->inst_len)) goto bail; if (! (result->inst = serializeio_source_alloc (source, sizeof (SerialVersion0Instruction) * result->inst_len))) goto bail; for (i = 0; i < result->inst_len; i += 1) { if (! unserialize_version0instruction_internal_noalloc (source, &(result->inst[i]))) goto bail; } } return TRUE; bail: return FALSE; } gboolean unserialize_version0control_internal (SerialSource *source, SerialVersion0Control** result) { SerialVersion0Control* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialVersion0Control)); if (! unser) goto bail; if (! unserialize_version0control_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_version0control (SerialSource *source, SerialVersion0Control** result) { if ( (* source->source_type) (source, TRUE) != ST_Version0Control) goto bail; if (! unserialize_version0control_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* Version0Instruction Count */ guint serializeio_count_version0instruction (guint32 offset, guint32 length) { guint size = sizeof (SerialVersion0Instruction); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); return size; } guint serializeio_count_version0instruction_obj (SerialVersion0Instruction const* obj) { return serializeio_count_version0instruction (obj->offset, obj->length); } /* Version0Instruction Print */ void serializeio_print_version0instruction_obj (SerialVersion0Instruction* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_Version0Instruction]\n"); print_spaces (indent_spaces); g_print ("offset = "); g_print ("%d\n", obj->offset); print_spaces (indent_spaces); g_print ("length = "); g_print ("%d\n", obj->length); } /* Version0Instruction Serialize */ gboolean serialize_version0instruction_internal (SerialSink *sink, guint32 offset, guint32 length) { if (! (* sink->next_uint) (sink, offset)) goto bail; if (! (* sink->next_uint) (sink, length)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_version0instruction_obj_internal (SerialSink *sink, SerialVersion0Instruction* obj) { return serialize_version0instruction_internal (sink, obj->offset, obj->length); } gboolean serialize_version0instruction (SerialSink *sink, guint32 offset, guint32 length) { if (! (* sink->sink_type) (sink, ST_Version0Instruction, serializeio_count_version0instruction (offset, length), TRUE)) goto bail; if (! serialize_version0instruction_internal (sink, offset, length)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_version0instruction_obj (SerialSink *sink, const SerialVersion0Instruction* obj) { return serialize_version0instruction (sink, obj->offset, obj->length); } /* Version0Instruction Unserialize */ gboolean unserialize_version0instruction_internal_noalloc (SerialSource *source, SerialVersion0Instruction* result) { if (! (* source->next_uint) (source, &result->offset)) goto bail; if (! (* source->next_uint) (source, &result->length)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_version0instruction_internal (SerialSource *source, SerialVersion0Instruction** result) { SerialVersion0Instruction* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialVersion0Instruction)); if (! unser) goto bail; if (! unserialize_version0instruction_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_version0instruction (SerialSource *source, SerialVersion0Instruction** result) { if ( (* source->source_type) (source, TRUE) != ST_Version0Instruction) goto bail; if (! unserialize_version0instruction_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } void xd_generate_void_event_internal (XdVoidEventCode _code, const char* _srcfile, gint _srcline) { XdVoidEvent *_e = g_new0 (XdVoidEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; eventdelivery_event_deliver ((GenericEvent*) _e); } const XdVoidEventCode EC_XdTooFewSources = { EC_XdTooFewSourcesValue }; const XdVoidEventCode EC_XdTooManySources = { EC_XdTooManySourcesValue }; void xd_generate_int_event_internal (XdIntEventCode _code, const char* _srcfile, gint _srcline, int index) { XdIntEvent *_e = g_new0 (XdIntEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->index = index; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Xd_Int_event_field_to_string (GenericEvent* ev, gint field) { XdIntEvent* it = (XdIntEvent*) ev; switch (field) { case 0: return eventdelivery_int_to_string (it->index); default: abort (); } } const XdIntEventCode EC_XdOutOfRangeSourceIndex = { EC_XdOutOfRangeSourceIndexValue }; const XdVoidEventCode EC_XdInvalidControl = { EC_XdInvalidControlValue }; const XdVoidEventCode EC_XdInvalidRsyncCache = { EC_XdInvalidRsyncCacheValue }; const XdVoidEventCode EC_XdIncompatibleDelta = { EC_XdIncompatibleDeltaValue }; void xd_generate_handlestringstring_event_internal (XdHandleStringStringEventCode _code, const char* _srcfile, gint _srcline, FileHandle* stream, const char* expected, const char* received) { XdHandleStringStringEvent *_e = g_new0 (XdHandleStringStringEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->stream = stream; _e->expected = expected; _e->received = received; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Xd_HandleStringString_event_field_to_string (GenericEvent* ev, gint field) { XdHandleStringStringEvent* it = (XdHandleStringStringEvent*) ev; switch (field) { case 0: return eventdelivery_handle_to_string (it->stream); case 1: return eventdelivery_string_to_string (it->expected); case 2: return eventdelivery_string_to_string (it->received); default: abort (); } } const XdHandleStringStringEventCode EC_XdStreamChecksumFailed = { EC_XdStreamChecksumFailedValue }; void xd_generate_handleintint_event_internal (XdHandleIntIntEventCode _code, const char* _srcfile, gint _srcline, FileHandle* stream, int expected, int received) { XdHandleIntIntEvent *_e = g_new0 (XdHandleIntIntEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->stream = stream; _e->expected = expected; _e->received = received; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Xd_HandleIntInt_event_field_to_string (GenericEvent* ev, gint field) { XdHandleIntIntEvent* it = (XdHandleIntIntEvent*) ev; switch (field) { case 0: return eventdelivery_handle_to_string (it->stream); case 1: return eventdelivery_int_to_string (it->expected); case 2: return eventdelivery_int_to_string (it->received); default: abort (); } } const XdHandleIntIntEventCode EC_XdStreamLengthFailed = { EC_XdStreamLengthFailedValue }; void xd_generate_string_event_internal (XdStringEventCode _code, const char* _srcfile, gint _srcline, const char* version) { XdStringEvent *_e = g_new0 (XdStringEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->version = version; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Xd_String_event_field_to_string (GenericEvent* ev, gint field) { XdStringEvent* it = (XdStringEvent*) ev; switch (field) { case 0: return eventdelivery_string_to_string (it->version); default: abort (); } } const XdStringEventCode EC_XdBackwardCompatibilityMode = { EC_XdBackwardCompatibilityModeValue }; xdelta-1.1.3/xdmain.c0000644006517700017500000012325107353554706010141 /* -*- Mode: C;-*- * * This file is part of XDelta - A binary delta generator. * * Copyright (C) 1997, 1998, 1999, 2001 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * $Id: xdmain.c 1.22.1.5 Fri, 29 Jun 2001 06:01:08 -0700 jmacd $ */ #include #include #include #include #include #include #include #if defined(_WIN32) || defined(__DJGPP__) #define WINHACK #endif #ifndef WINHACK #include #include #define O_BINARY 0 #else /* WINHACK */ #include #include #ifdef __DJGPP__ #include #include #endif #define STDOUT_FILENO 1 #define lstat stat #ifndef __DJGPP__ #define S_IFMT _S_IFMT #define S_IFREG _S_IFREG #endif /* !__DJGPP__ */ #endif /* !WINHACK_ */ #include #include "xdelta.h" extern HandleFuncTable xd_handle_table; #define XD_PAGE_SIZE (1<<20) #define XDELTA_110_PREFIX "%XDZ004%" #define XDELTA_104_PREFIX "%XDZ003%" #define XDELTA_100_PREFIX "%XDZ002%" #define XDELTA_020_PREFIX "%XDZ001%" #define XDELTA_018_PREFIX "%XDZ000%" #define XDELTA_014_PREFIX "%XDELTA%" #define XDELTA_PREFIX XDELTA_110_PREFIX #define XDELTA_PREFIX_LEN 8 #define HEADER_WORDS (6) #define HEADER_SPACE (HEADER_WORDS*4) /* The header is composed of 4-byte words (network byte order) as follows: * word 1: flags * word 2: (from name length) << 16 | (to name length) * word 3: (reserved) * word 4: (reserved) * word 5: (reserved) * word 6: (reserved) * flags are: */ #define FLAG_NO_VERIFY 1 #define FLAG_FROM_COMPRESSED 2 #define FLAG_TO_COMPRESSED 4 #define FLAG_PATCH_COMPRESSED 8 /* and, the header is follwed by the from file name, then the to file * name, then the data. */ #ifdef WINHACK #define FOPEN_READ_ARG "rb" #define FOPEN_WRITE_ARG "wb" #define FILE_SEPARATOR '\\' #else #define FOPEN_READ_ARG "r" #define FOPEN_WRITE_ARG "w" #define FILE_SEPARATOR '/' #endif /* WINHACK */ #include "getopt.h" typedef struct _LRU LRU; struct _LRU { LRU *next; LRU *prev; gint refs; guint page; guint8* buffer; }; typedef struct _XdFileHandle XdFileHandle; typedef struct { gboolean patch_is_compressed; const gchar* patch_name; guint patch_flags; const gchar* patch_version; gboolean has_trailer; XdeltaSourceInfo* data_source; XdeltaSourceInfo* from_source; gchar *from_name; gchar *to_name; guint control_offset; guint header_offset; gint16 from_name_len; gint16 to_name_len; guint32 header_space[HEADER_WORDS]; guint8 magic_buf[XDELTA_PREFIX_LEN]; XdFileHandle *patch_in; XdeltaControl *cont; } XdeltaPatch; struct _XdFileHandle { FileHandle fh; guint length; guint real_length; gint type; const char* name; const char* cleanup; guint8 md5[16]; EdsioMD5Ctx ctx; /* for write */ int out_fd; void* out; gboolean (* out_write) (XdFileHandle* handle, const void* buf, gint nbyte); gboolean (* out_close) (XdFileHandle* handle); /* for read */ GPtrArray *lru_table; LRU *lru_head; /* most recently used. */ LRU *lru_tail; /* least recently used. */ GMemChunk *lru_chunk; guint lru_count; guint lru_outstanding_refs; guint narrow_low; guint narrow_high; guint current_pos; FILE* in; gboolean (* in_read) (XdFileHandle* handle, void* buf, gint nbyte); gboolean (* in_close) (XdFileHandle* handle); gboolean in_compressed; const guint8* copy_page; guint copy_pgno; gboolean md5_good; gboolean reset_length_next_write; gint md5_page; gint fd; }; /* $Format: "static const char xdelta_version[] = \"$ReleaseVersion$\"; " $ */ static const char xdelta_version[] = "1.1.3"; typedef struct _Command Command; struct _Command { gchar* name; gint (* func) (gint argc, gchar** argv); gint nargs; }; static gint delta_command (gint argc, gchar** argv); static gint patch_command (gint argc, gchar** argv); static gint info_command (gint argc, gchar** argv); static const Command commands[] = { { "delta", delta_command, -1 }, { "patch", patch_command, -1 }, { "info", info_command, 1 }, { NULL, NULL, 0 } }; static struct option const long_options[] = { {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {"verbose", no_argument, 0, 'V'}, {"noverify", no_argument, 0, 'n'}, {"pristine", no_argument, 0, 'p'}, {"quiet", no_argument, 0, 'q'}, {"maxmem", required_argument, 0, 'm'}, {"blocksize", required_argument, 0, 's'}, {0,0,0,0} }; static const gchar* program_name; static gint compress_level = Z_DEFAULT_COMPRESSION; static gint no_verify = FALSE; static gint pristine = FALSE; static gint verbose = FALSE; static gint max_mapped_pages = G_MAXINT; static gint quiet = FALSE; #define xd_error g_warning static void usage () { xd_error ("usage: %s COMMAND [OPTIONS] [ARG1 ...]\n", program_name); xd_error ("use --help for more help\n"); exit (2); } static void help () { xd_error ("usage: %s COMMAND [OPTIONS] [ARG1 ...]\n", program_name); xd_error ("COMMAND is one of:\n"); xd_error (" delta Produce a delta from ARG1 to ARG2 producing ARG3\n"); xd_error (" info List details about delta ARG1\n"); xd_error (" patch Apply patch ARG1 using file ARG2 producing ARG3\n"); xd_error ("OPTIONS are:\n"); xd_error (" -v, --version Print version information\n"); xd_error (" -V, --verbose Print verbose error messages\n"); xd_error (" -h, --help Print this summary\n"); xd_error (" -n, --noverify Disable automatic MD5 verification\n"); xd_error (" -p, --pristine Disable automatic GZIP decompression\n"); xd_error (" -m, --maxmem=SIZE Set the buffer size limit, e.g. 640K, 16M\n"); xd_error (" -[0-9] ZLIB compress level: 0=none, 1=fast, 6=default, 9=best\n"); xd_error (" -s=BLOCK_SIZE Sets block size (power of 2), minimum match length\n"); xd_error (" In-core memory requirement is (FROM_LEN * 8) / BLOCK_SIZE\n"); exit (2); } static void version () { xd_error ("version %s\n", xdelta_version); exit (2); } static FILE* xd_error_file = NULL; static void xd_error_func (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { if (! xd_error_file) xd_error_file = stderr; fprintf (xd_error_file, "%s: %s", program_name, message); } static gboolean event_devel (void) { static gboolean once = FALSE; static gboolean devel = FALSE; if (! once) { devel = g_getenv ("EDSIO_DEVEL") != NULL; once = TRUE; } return devel; } static gboolean event_watch (GenericEvent* ev, GenericEventDef* def, const char* message) { if (quiet && def->level <= EL_Warning) return TRUE; if (event_devel ()) fprintf (stderr, "%s:%d: %s\n", ev->srcfile, ev->srcline, message); else fprintf (stderr, "%s: %s\n", program_name, message); return TRUE; } gint main (gint argc, gchar** argv) { const Command *cmd = NULL; gint c; gint longind; eventdelivery_event_watch_all (event_watch); if (! xd_edsio_init ()) return 2; #ifdef __DJGPP__ /* * (richdawe@bigfoot.com): Limit maximum memory usage to 87.5% of available * physical memory for DJGPP. Otherwise the replacement for mmap() will * exhaust memory and XDelta will fail. */ { unsigned long phys_free = _go32_dpmi_remaining_physical_memory(); max_mapped_pages = phys_free / XD_PAGE_SIZE; max_mapped_pages %= 8; max_mapped_pages *= 7; } #endif /* DJGPP */ program_name = g_basename (argv[0]); g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, xd_error_func, NULL); if (argc < 2) usage (); for (cmd = commands; cmd->name; cmd += 1) if (strcmp (cmd->name, argv[1]) == 0) break; if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) help (); if (strcmp (argv[1], "-v") == 0 || strcmp (argv[1], "--version") == 0) version (); if (!cmd->name) { xd_error ("unrecognized command\n"); help (); } argc -= 1; argv += 1; while ((c = getopt_long(argc, argv, "+nqphvVs:m:0123456789", long_options, &longind)) != EOF) { switch (c) { case 'q': quiet = TRUE; break; case 'n': no_verify = TRUE; break; case 'p': pristine = TRUE; break; case 'V': verbose = TRUE; break; case 's': { int ret; int s = atoi (optarg); if ((ret = xdp_set_query_size_pow (s)) && ! quiet) { xd_error ("illegal query size: %s\n", xdp_errno (ret)); } } break; case 'm': { gchar* end = NULL; glong l = strtol (optarg, &end, 0); if (end && g_strcasecmp (end, "M") == 0) l <<= 20; else if (end && g_strcasecmp (end, "K") == 0) l <<= 10; else if (end || l < 0) { xd_error ("illegal maxmem argument %s\n", optarg); return 2; } #ifdef __DJGPP__ /* * (richdawe@bigfoot.com): Old MS-DOS systems may have a maximum * of 8MB memory == XD_PAGE_SIZE * 8. Therefore, do what the user * asks for on MS-DOS. */ #else /* !__DJGPP__ */ l = MAX (l, XD_PAGE_SIZE * 8); #endif /* __DJGPP__ */ max_mapped_pages = l / XD_PAGE_SIZE; } break; case 'h': help (); break; case 'v': version (); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': compress_level = c - '0'; break; case '?': default: xd_error ("illegal argument, use --help for help\n"); return 2; } } if (verbose && max_mapped_pages < G_MAXINT) xd_error ("using %d kilobytes of buffer space\n", (max_mapped_pages * XD_PAGE_SIZE) >> 10); argc -= optind; argv += optind; if (cmd->nargs >= 0 && argc != cmd->nargs) { xd_error ("wrong number of arguments\n"); help (); return 2; } return (* cmd->func) (argc, argv); } /* Commands */ #define READ_TYPE 1 #define READ_NOSEEK_TYPE 1 #define READ_SEEK_TYPE 3 #define WRITE_TYPE 4 /* Note to the casual reader: the filehandle implemented here is * highly aware of the calling patterns of the Xdelta library. It * also plays games with narrowing to implement several files in the * same handle. So, if you try to modify or use this code, BEWARE. * See the repository package for a complete implementation. * In fact, its really quite a hack. */ static gssize xd_handle_map_page (XdFileHandle *fh, guint pgno, const guint8** mem); static gboolean xd_handle_unmap_page (XdFileHandle *fh, guint pgno, const guint8** mem); static gboolean xd_fwrite (XdFileHandle* fh, const void* buf, gint nbyte) { return fwrite (buf, nbyte, 1, fh->out) == 1; } static gboolean xd_fread (XdFileHandle* fh, void* buf, gint nbyte) { return fread (buf, nbyte, 1, fh->in) == 1; } static gboolean xd_fclose (XdFileHandle* fh) { return fclose (fh->out) == 0; } static gboolean xd_frclose (XdFileHandle* fh) { return fclose (fh->in) == 0; } static gboolean xd_gzwrite (XdFileHandle* fh, const void* buf, gint nbyte) { return gzwrite (fh->out, (void*) buf, nbyte) == nbyte; } static gboolean xd_gzread (XdFileHandle* fh, void* buf, gint nbyte) { return gzread (fh->in, buf, nbyte) == nbyte; } static gboolean xd_gzclose (XdFileHandle* fh) { return gzclose (fh->out) == Z_OK; } static gboolean xd_gzrclose (XdFileHandle* fh) { return gzclose (fh->in) == Z_OK; } static void init_table (XdFileHandle* fh) { fh->lru_table = g_ptr_array_new (); fh->lru_chunk = g_mem_chunk_create(LRU, 1<<9, G_ALLOC_ONLY); fh->lru_head = NULL; fh->lru_tail = NULL; } static XdFileHandle* open_common (const char* name, const char* real_name) { XdFileHandle* fh; gint fd; struct stat buf; if ((fd = open (name, O_RDONLY | O_BINARY, 0)) < 0) { xd_error ("open %s failed: %s\n", name, g_strerror (errno)); return NULL; } if (stat (name, &buf) < 0) { xd_error ("stat %s failed: %s\n", name, g_strerror (errno)); return NULL; } /* S_ISREG() is not on Windows */ if ((buf.st_mode & S_IFMT) != S_IFREG) { xd_error ("%s is not a regular file\n", name); return NULL; } fh = g_new0 (XdFileHandle, 1); fh->fh.table = & xd_handle_table; fh->name = real_name; fh->fd = fd; fh->length = buf.st_size; fh->narrow_high = buf.st_size; return fh; } static gboolean file_gzipped (const char* name, gboolean *is_compressed) { FILE* f = fopen (name, FOPEN_READ_ARG); guint8 buf[2]; (*is_compressed) = FALSE; if (! f) { xd_error ("open %s failed: %s\n", name, g_strerror (errno)); return FALSE; } if (fread (buf, 2, 1, f) != 1) return TRUE; #define GZIP_MAGIC1 037 #define GZIP_MAGIC2 0213 if (buf[0] == GZIP_MAGIC1 && buf[1] == GZIP_MAGIC2) (* is_compressed) = TRUE; return TRUE; } static const char* xd_tmpname (void) { const char* tmpdir = g_get_tmp_dir (); GString* s; gint x = getpid (); static gint seq = 0; struct stat buf; s = g_string_new (NULL); do { /* * (richdawe@bigfoot.com): Limit temporary filenames to * the MS-DOS 8+3 convention for DJGPP. */ g_string_sprintf (s, "%s/xd-%05d.%03d", tmpdir, x, seq++); } while (lstat (s->str, &buf) == 0); return s->str; } static const char* file_gunzip (const char* name) { const char* new_name = xd_tmpname (); FILE* out = fopen (new_name, FOPEN_WRITE_ARG); gzFile in = gzopen (name, "rb"); guint8 buf[1024]; int nread; while ((nread = gzread (in, buf, 1024)) > 0) { if (fwrite (buf, nread, 1, out) != 1) { xd_error ("write %s failed (during uncompression): %s\n", new_name, g_strerror (errno)); return NULL; } } if (nread < 0) { xd_error ("gzread %s failed\n", name); return NULL; } gzclose (in); if (fclose (out)) { xd_error ("close %s failed (during uncompression): %s\n", new_name, g_strerror (errno)); return NULL; } return new_name; } static XdFileHandle* open_read_noseek_handle (const char* name, gboolean* is_compressed, gboolean will_read, gboolean honor_pristine) { XdFileHandle* fh; const char* name0 = name; /* we _could_ stream-read this file if compressed, but it adds a * lot of complexity. the library can handle it, just set the * length to (XDELTA_MAX_FILE_LEN-1) and make sure that the end * of file condition is set when on the last page. However, I * don't feel like it. */ if (honor_pristine && pristine) *is_compressed = FALSE; else { if (! file_gzipped (name, is_compressed)) return NULL; } if ((* is_compressed) && ! (name = file_gunzip (name))) return NULL; if (! (fh = open_common (name, name0))) return NULL; fh->type = READ_NOSEEK_TYPE; edsio_md5_init (&fh->ctx); if (*is_compressed) fh->cleanup = name; if (will_read) { g_assert (fh->fd >= 0); if (! (fh->in = fdopen (dup (fh->fd), FOPEN_READ_ARG))) { xd_error ("fdopen: %s\n", g_strerror (errno)); return NULL; } fh->in_read = &xd_fread; fh->in_close = &xd_frclose; } else { init_table (fh); } return fh; } static void xd_read_close (XdFileHandle* fh) { /* * (richdawe@bigfoot.com): On Unix you can unlink a file while it is * still open. On MS-DOS this can lead to filesystem corruption. Close * the file before unlinking it. */ close (fh->fd); if (fh->cleanup) unlink (fh->cleanup); if (fh->in) (*fh->in_close) (fh); } static XdFileHandle* open_read_seek_handle (const char* name, gboolean* is_compressed, gboolean honor_pristine) { XdFileHandle* fh; const char* name0 = name; if (honor_pristine && pristine) *is_compressed = FALSE; else { if (! file_gzipped (name, is_compressed)) return NULL; } if ((* is_compressed) && ! (name = file_gunzip (name))) return NULL; if (! (fh = open_common (name, name0))) return NULL; fh->type = READ_SEEK_TYPE; if (*is_compressed) fh->cleanup = name; init_table (fh); edsio_md5_init (&fh->ctx); return fh; } static XdFileHandle* open_write_handle (int fd, const char* name) { XdFileHandle* fh = g_new0 (XdFileHandle, 1); int nfd; fh->fh.table = & xd_handle_table; fh->out_fd = fd; fh->out_write = &xd_fwrite; fh->out_close = &xd_fclose; g_assert (fh->out_fd >= 0); nfd = dup (fh->out_fd); if (! (fh->out = fdopen (nfd, FOPEN_WRITE_ARG))) { xd_error ("fdopen %s failed: %s\n", name, g_strerror (errno)); return NULL; } fh->type = WRITE_TYPE; fh->name = name; edsio_md5_init (&fh->ctx); return fh; } static gint xd_begin_compression (XdFileHandle* fh) { gint filepos, nfd; if (compress_level == 0) return fh->real_length; if (! (fh->out_close) (fh)) { xd_error ("fclose failed: %s\n", g_strerror (errno)); return -1; } filepos = lseek (fh->out_fd, 0, SEEK_END); if (filepos < 0) { xd_error ("lseek failed: %s\n", g_strerror (errno)); return -1; } g_assert (fh->out_fd >= 0); nfd = dup (fh->out_fd); fh->out = gzdopen (nfd, "wb"); fh->out_write = &xd_gzwrite; fh->out_close = &xd_gzclose; if (! fh->out) { xd_error ("gzdopen failed: %s\n", g_strerror (errno)); return -1; } if (gzsetparams(fh->out, compress_level, Z_DEFAULT_STRATEGY) != Z_OK) { int foo; xd_error ("gzsetparams failed: %s\n", gzerror (fh->out, &foo)); return -1; } return filepos; } static gboolean xd_end_compression (XdFileHandle* fh) { if (compress_level == 0) return TRUE; if (! (fh->out_close) (fh)) { xd_error ("fdclose failed: %s\n", g_strerror (errno)); return FALSE; } if (lseek (fh->out_fd, 0, SEEK_END) < 0) { xd_error ("lseek failed: %s\n", g_strerror (errno)); return FALSE; } g_assert (fh->out_fd >= 0); fh->out = fdopen (dup (fh->out_fd), FOPEN_WRITE_ARG); fh->out_write = &xd_fwrite; fh->out_close = &xd_fclose; if (! fh->out) { xd_error ("fdopen failed: %s\n", g_strerror (errno)); return FALSE; } return TRUE; } static gssize xd_handle_length (XdFileHandle *fh) { if (fh->in_compressed) return fh->current_pos; else return fh->narrow_high - fh->narrow_low; } static gssize xd_handle_pages (XdFileHandle *fh) { g_assert (fh->type & READ_TYPE); return xd_handle_length (fh) / XD_PAGE_SIZE; } static gssize xd_handle_pagesize (XdFileHandle *fh) { g_assert (fh->type & READ_TYPE); return XD_PAGE_SIZE; } static gint on_page (XdFileHandle* fh, guint pgno) { if (pgno > xd_handle_pages (fh)) return -1; if (pgno == xd_handle_pages (fh)) return xd_handle_length (fh) % XD_PAGE_SIZE; return XD_PAGE_SIZE; } static gboolean xd_handle_close (XdFileHandle *fh, gint ignore) { /* this is really a reset for writable files */ if (fh->type == WRITE_TYPE) { if (fh->reset_length_next_write) { fh->reset_length_next_write = FALSE; fh->length = 0; fh->narrow_high = 0; } fh->reset_length_next_write = TRUE; edsio_md5_final (fh->md5, &fh->ctx); edsio_md5_init (&fh->ctx); } else if (fh->in) { edsio_md5_final (fh->md5, &fh->ctx); edsio_md5_init (&fh->ctx); fh->md5_good = FALSE; } return TRUE; } static const guint8* xd_handle_checksum_md5 (XdFileHandle *fh) { if (fh->in && ! fh->md5_good) { edsio_md5_final (fh->md5, &fh->ctx); fh->md5_good = TRUE; } else if (fh->type != WRITE_TYPE && !fh->in) { const guint8* page; while (fh->md5_page <= xd_handle_pages (fh)) { gint pgno = fh->md5_page; gint onpage; if ((onpage = xd_handle_map_page (fh, pgno, &page)) < 0) return NULL; if (pgno == fh->md5_page) { fh->md5_page += 1; edsio_md5_update (&fh->ctx, page, onpage); if (fh->md5_page > xd_handle_pages (fh)) edsio_md5_final (fh->md5, &fh->ctx); } if (! xd_handle_unmap_page (fh, pgno, &page)) return NULL; } } return g_memdup (fh->md5, 16); } static gboolean xd_handle_set_pos (XdFileHandle *fh, guint pos) { if (fh->current_pos == pos + fh->narrow_low) return TRUE; if (pos + fh->narrow_low > fh->narrow_high) { xd_error ("unexpected EOF in %s\n", fh->name); return FALSE; } fh->current_pos = pos + fh->narrow_low; if (fseek (fh->in, fh->current_pos, SEEK_SET)) { xd_error ("fseek failed: %s\n", g_strerror (errno)); return FALSE; } return TRUE; } static gboolean xd_handle_narrow (XdFileHandle* fh, guint low, guint high, gboolean compressed) { if (high > fh->length) { xd_error ("%s: corrupt or truncated delta\n", fh->name); return FALSE; } fh->narrow_low = low; fh->narrow_high = high; edsio_md5_init (&fh->ctx); if (compressed) { (* fh->in_close) (fh); if (lseek (fh->fd, low, SEEK_SET) < 0) { xd_error ("%s: corrupt or truncated delta: cannot seek to %d: %s\n", fh->name, low, g_strerror (errno)); return FALSE; } g_assert (fh->fd >= 0); fh->in = gzdopen (dup (fh->fd), "rb"); fh->in_read = &xd_gzread; fh->in_close = &xd_gzrclose; fh->in_compressed = TRUE; fh->current_pos = 0; if (! fh->in) { xd_error ("gzdopen failed: %s\n", g_strerror (errno)); return -1; } } else { if (! xd_handle_set_pos (fh, 0)) return FALSE; } return TRUE; } static guint xd_handle_get_pos (XdFileHandle* fh) { return fh->current_pos - fh->narrow_low; } static const gchar* xd_handle_name (XdFileHandle *fh) { return g_strdup (fh->name); } static gssize xd_handle_read (XdFileHandle *fh, guint8 *buf, gsize nbyte) { if (nbyte == 0) return 0; if (! (fh->in_read) (fh, buf, nbyte)) /* This is suspicious */ { xd_error ("read failed: %s\n", g_strerror (errno)); return -1; } if (!no_verify) edsio_md5_update (&fh->ctx, buf, nbyte); fh->current_pos += nbyte; return nbyte; } static gboolean xd_handle_write (XdFileHandle *fh, const guint8 *buf, gsize nbyte) { g_assert (fh->type == WRITE_TYPE); if (fh->reset_length_next_write) { fh->reset_length_next_write = FALSE; fh->length = 0; fh->narrow_high = 0; } if (! no_verify) edsio_md5_update (&fh->ctx, buf, nbyte); if (! (*fh->out_write) (fh, buf, nbyte)) { xd_error ("write failed: %s\n", g_strerror (errno)); return FALSE; } fh->length += nbyte; fh->real_length += nbyte; fh->narrow_high += nbyte; return TRUE; } static gboolean xd_handle_really_close (XdFileHandle *fh) { g_assert (fh->type == WRITE_TYPE); if (! (* fh->out_close) (fh) || close (fh->out_fd) < 0) { xd_error ("write failed: %s\n", g_strerror (errno)); return FALSE; } return TRUE; } static LRU* pull_lru (XdFileHandle* fh, LRU* lru) { if (lru->next && lru->prev) { lru->next->prev = lru->prev; lru->prev->next = lru->next; } else if (lru->next) { fh->lru_tail = lru->next; lru->next->prev = NULL; } else if (lru->prev) { fh->lru_head = lru->prev; lru->prev->next = NULL; } else { fh->lru_head = NULL; fh->lru_tail = NULL; } lru->next = NULL; lru->prev = NULL; return lru; } static gboolean really_free_one_page (XdFileHandle* fh) { LRU *lru = fh->lru_tail; for (; lru; lru = lru->prev) { gint to_unmap; LRU *lru_dead; if (lru->refs > 0) continue; lru_dead = pull_lru (fh, lru); g_assert (lru_dead->buffer); to_unmap = on_page (fh, lru_dead->page); fh->lru_count -= 1; if (to_unmap > 0) { #ifdef WINHACK g_free (lru_dead->buffer); #else if (munmap (lru_dead->buffer, to_unmap)) { xd_error ("munmap failed: %s\n", g_strerror (errno)); return FALSE; } #endif /* WINHACK */ } lru_dead->buffer = NULL; return TRUE; } return TRUE; } #if 0 static void print_lru (XdFileHandle* fh) { LRU* lru = fh->lru_head; for (; lru; lru = lru->prev) { g_print ("page %d buffer %p\n", lru->page, lru->buffer); if (! lru->prev && lru != fh->lru_tail) g_print ("incorrect lru_tail\n"); } } #endif static gboolean make_lru_room (XdFileHandle* fh) { if (fh->lru_count == max_mapped_pages) { if (! really_free_one_page (fh)) return FALSE; } g_assert (fh->lru_count < max_mapped_pages); return TRUE; } /*#define DEBUG_MAP*/ static gssize xd_handle_map_page (XdFileHandle *fh, guint pgno, const guint8** mem) { LRU* lru; guint to_map; #ifdef DEBUG_MAP g_print ("map %p:%d\n", fh, pgno); #endif g_assert (fh->type & READ_TYPE); if (fh->lru_table->len < (pgno + 1)) { gint olen = fh->lru_table->len; g_ptr_array_set_size (fh->lru_table, pgno + 1); while (olen <= pgno) fh->lru_table->pdata[olen++] = NULL; } lru = fh->lru_table->pdata[pgno]; if (! lru) { lru = g_chunk_new0 (LRU, fh->lru_chunk); fh->lru_table->pdata[pgno] = lru; lru->page = pgno; } else if (lru->buffer) { pull_lru (fh, lru); } lru->prev = fh->lru_head; lru->next = NULL; fh->lru_head = lru; if (lru->prev) lru->prev->next = lru; if (! fh->lru_tail) fh->lru_tail = lru; to_map = on_page (fh, pgno); if (to_map < 0) { xd_error ("unexpected EOF in %s\n", fh->name); return -1; } if (! lru->buffer) { if (! make_lru_room (fh)) return -1; fh->lru_count += 1; if (to_map > 0) { #ifdef WINHACK lru->buffer = g_malloc (to_map); if (lseek (fh->fd, pgno * XD_PAGE_SIZE, SEEK_SET) < 0) { xd_error ("lseek failed: %s\n", g_strerror (errno)); return -1; } if (read (fh->fd, lru->buffer, to_map) != to_map) { xd_error ("read failed: %s\n", g_strerror (errno)); return -1; } #else if (! (lru->buffer = mmap (NULL, to_map, PROT_READ, MAP_PRIVATE, fh->fd, pgno * XD_PAGE_SIZE))) { xd_error ("mmap failed: %s\n", g_strerror (errno)); return -1; } #endif } else { lru->buffer = (void*) -1; } if (pgno == fh->md5_page) { if (! no_verify) edsio_md5_update (&fh->ctx, lru->buffer, to_map); fh->md5_page += 1; if (fh->md5_page > xd_handle_pages (fh)) edsio_md5_final (fh->md5, &fh->ctx); } } (*mem) = lru->buffer; lru->refs += 1; fh->lru_outstanding_refs += 1; return to_map; } static gboolean xd_handle_unmap_page (XdFileHandle *fh, guint pgno, const guint8** mem) { LRU* lru; #ifdef DEBUG_MAP g_print ("unmap %p:%d\n", fh, pgno); #endif g_assert (fh->type & READ_TYPE); g_assert (pgno < fh->lru_table->len); lru = fh->lru_table->pdata[pgno]; g_assert (lru && lru->refs > 0); g_assert (lru->buffer == (*mem)); (*mem) = NULL; lru->refs -= 1; fh->lru_outstanding_refs += 1; if (lru->refs == 0 && fh->type == READ_NOSEEK_TYPE) { pull_lru (fh, lru); lru->next = fh->lru_tail; if (lru->next) lru->next->prev = lru; lru->prev = NULL; fh->lru_tail = lru; if (! really_free_one_page (fh)) return FALSE; } return TRUE; } static gboolean xd_handle_copy (XdFileHandle *from, XdFileHandle *to, guint off, guint len) { if (from->in) { guint8 buf[1024]; /*if (! xd_handle_set_pos (from, off)) return FALSE;*/ while (len > 0) { guint r = MIN (1024, len); if (xd_handle_read (from, buf, r) != r) return FALSE; if (! xd_handle_write (to, buf, r)) return FALSE; len -= r; } } else { while (len > 0) { guint off_page = off / XD_PAGE_SIZE; guint off_off = off % XD_PAGE_SIZE; gint on = on_page (from, off_page); guint rem; guint copy; if (on <= 0) { xd_error ("unexpected EOF in %s\n", from->name); return FALSE; } rem = on - off_off; copy = MIN (len, rem); if (from->copy_pgno != off_page && from->copy_page && ! xd_handle_unmap_page (from, from->copy_pgno, &from->copy_page)) return FALSE; from->copy_pgno = off_page; if (xd_handle_map_page (from, off_page, &from->copy_page) < 0) return FALSE; if (! xd_handle_write (to, from->copy_page + off_off, copy)) return FALSE; if (! xd_handle_unmap_page (from, off_page, &from->copy_page)) return FALSE; len -= copy; off += copy; } } return TRUE; } static gboolean xd_handle_putui (XdFileHandle *fh, guint32 i) { guint32 hi = g_htonl (i); return xd_handle_write (fh, (guint8*)&hi, 4); } static gboolean xd_handle_getui (XdFileHandle *fh, guint32* i) { if (xd_handle_read (fh, (guint8*)i, 4) != 4) return FALSE; *i = g_ntohl (*i); return TRUE; } static HandleFuncTable xd_handle_table = { (gssize (*) (FileHandle *fh)) xd_handle_length, (gssize (*) (FileHandle *fh)) xd_handle_pages, (gssize (*) (FileHandle *fh)) xd_handle_pagesize, (gssize (*) (FileHandle *fh, guint pgno, const guint8** mem)) xd_handle_map_page, (gboolean (*) (FileHandle *fh, guint pgno, const guint8** mem)) xd_handle_unmap_page, (const guint8* (*) (FileHandle *fh)) xd_handle_checksum_md5, (gboolean (*) (FileHandle *fh, gint flags)) xd_handle_close, (gboolean (*) (FileHandle *fh, const guint8 *buf, gsize nbyte)) xd_handle_write, (gboolean (*) (FileHandle *from, FileHandle *to, guint off, guint len)) xd_handle_copy, (gboolean (*) (FileHandle *fh, guint32* i)) xd_handle_getui, (gboolean (*) (FileHandle *fh, guint32 i)) xd_handle_putui, (gssize (*) (FileHandle *fh, guint8 *buf, gsize nbyte)) xd_handle_read, (const gchar* (*) (FileHandle *fh)) xd_handle_name, }; static void htonl_array (guint32* array, gint len) { gint i; for (i = 0; i < len; i += 1) array[i] = g_htonl(array[i]); } static void ntohl_array (guint32* array, gint len) { gint i; for (i = 0; i < len; i += 1) array[i] = g_ntohl(array[i]); } static gint delta_command (gint argc, gchar** argv) { gint patch_out_fd; const char* patch_out_name; XdFileHandle *from, *to, *out; XdeltaGenerator* gen; XdeltaSource* src; XdeltaControl* cont; gboolean from_is_compressed = FALSE, to_is_compressed = FALSE; guint32 control_offset, header_offset; const char* from_name, *to_name; guint32 header_space[HEADER_WORDS]; int fd; memset (header_space, 0, sizeof (header_space)); if (argc != 3) { xd_error ("usage: %s delta fromfile tofile patchfile\n", program_name); return 2; } if (verbose) { xd_error ("using block size: %d bytes\n", xdp_blocksize ()); } if (! (from = open_read_seek_handle (argv[0], &from_is_compressed, TRUE))) return 2; if (! (to = open_read_noseek_handle (argv[1], &to_is_compressed, FALSE, TRUE))) return 2; // Note: I tried support to patches to stdout, but it broke when // compression was added. Sigh fd = open (argv[2], O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); if (fd < 0) { xd_error ("open %s failed: %s\n", argv[2], g_strerror (errno)); return 2; } patch_out_fd = fd; patch_out_name = argv[2]; from_name = g_basename (argv[0]); to_name = g_basename (argv[1]); if (! (out = open_write_handle (patch_out_fd, patch_out_name))) return 2; if (! (gen = xdp_generator_new ())) return 2; if (! (src = xdp_source_new (from_name, (FileHandle*) from, NULL, NULL))) return 2; xdp_source_add (gen, src); if (! xd_handle_write (out, XDELTA_PREFIX, XDELTA_PREFIX_LEN)) return 2; /* compute the header */ header_space[0] = 0; if (no_verify) header_space[0] |= FLAG_NO_VERIFY; if (from_is_compressed) header_space[0] |= FLAG_FROM_COMPRESSED; if (to_is_compressed) header_space[0] |= FLAG_TO_COMPRESSED; if (compress_level != 0) header_space[0] |= FLAG_PATCH_COMPRESSED; header_space[1] = strlen (from_name) << 16 | strlen (to_name); /* end compute the header */ htonl_array (header_space, HEADER_WORDS); if (! xd_handle_write (out, (guint8*) header_space, HEADER_SPACE)) return 2; if (! xd_handle_write (out, from_name, strlen (from_name))) return 2; if (! xd_handle_write (out, to_name, strlen (to_name))) return 2; if (! xd_handle_close (out, 0)) return 2; if ((header_offset = xd_begin_compression (out)) < 0) return 2; if (! (cont = xdp_generate_delta (gen, (FileHandle*) to, NULL, (FileHandle*) out))) return 2; #if 0 serializeio_print_xdeltacontrol_obj (cont, 0); #endif if (cont->has_data && cont->has_data == cont->source_info_len) { if (! quiet) xd_error ("warning: no matches found in from file, patch will apply without it\n"); } if (! xd_handle_close (out, 0)) return 2; if ((control_offset = xd_begin_compression (out)) < 0) return 2; if (! xdp_control_write (cont, (FileHandle*) out)) return 2; if (! xd_end_compression (out)) return 2; if (! xd_handle_putui (out, control_offset)) return 2; if (! xd_handle_write (out, XDELTA_PREFIX, XDELTA_PREFIX_LEN)) return 2; xd_read_close (from); xd_read_close (to); if (! xd_handle_really_close (out)) return 2; return control_offset != header_offset; } static XdeltaPatch* process_patch (const char* name) { XdeltaPatch* patch; guint total_trailer; patch = g_new0 (XdeltaPatch, 1); patch->patch_name = name; /* Strictly speaking, I'm violating the intended semantics of noseek here. * It will seek the file, which is not in fact checked in the map/unmap * logic above. This only means that it will not cache pages of this file * since it will be read piecewise sequentially. */ if (! (patch->patch_in = open_read_noseek_handle (name, &patch->patch_is_compressed, TRUE, TRUE))) return NULL; if (xd_handle_read (patch->patch_in, patch->magic_buf, XDELTA_PREFIX_LEN) != XDELTA_PREFIX_LEN) return NULL; if (xd_handle_read (patch->patch_in, (guint8*) patch->header_space, HEADER_SPACE) != HEADER_SPACE) return NULL; ntohl_array (patch->header_space, HEADER_WORDS); if (strncmp (patch->magic_buf, XDELTA_110_PREFIX, XDELTA_PREFIX_LEN) == 0) { patch->has_trailer = TRUE; patch->patch_version = "1.1"; } else if (strncmp (patch->magic_buf, XDELTA_104_PREFIX, XDELTA_PREFIX_LEN) == 0) { patch->has_trailer = TRUE; patch->patch_version = "1.0.4"; } else if (strncmp (patch->magic_buf, XDELTA_100_PREFIX, XDELTA_PREFIX_LEN) == 0) { patch->patch_version = "1.0"; } else if (strncmp (patch->magic_buf, XDELTA_020_PREFIX, XDELTA_PREFIX_LEN) == 0) goto nosupport; else if (strncmp (patch->magic_buf, XDELTA_018_PREFIX, XDELTA_PREFIX_LEN) == 0) goto nosupport; else if (strncmp (patch->magic_buf, XDELTA_014_PREFIX, XDELTA_PREFIX_LEN) == 0) goto nosupport; else { xd_error ("%s: bad magic number: not a valid delta\n", name); return NULL; } patch->patch_flags = patch->header_space[0]; if (no_verify) xd_error ("--noverify is only accepted when creating a delta\n"); if (patch->patch_flags & FLAG_NO_VERIFY) no_verify = TRUE; else no_verify = FALSE; patch->from_name_len = patch->header_space[1] >> 16; patch->to_name_len = patch->header_space[1] & 0xffff; patch->from_name = g_malloc (patch->from_name_len+1); patch->to_name = g_malloc (patch->to_name_len+1); patch->from_name[patch->from_name_len] = 0; patch->to_name[patch->to_name_len] = 0; if (xd_handle_read (patch->patch_in, patch->from_name, patch->from_name_len) != patch->from_name_len) return NULL; if (xd_handle_read (patch->patch_in, patch->to_name, patch->to_name_len) != patch->to_name_len) return NULL; patch->header_offset = xd_handle_get_pos (patch->patch_in); total_trailer = 4 + (patch->has_trailer ? XDELTA_PREFIX_LEN : 0); if (! xd_handle_set_pos (patch->patch_in, xd_handle_length (patch->patch_in) - total_trailer)) return NULL; if (! xd_handle_getui (patch->patch_in, &patch->control_offset)) return NULL; if (patch->has_trailer) { guint8 trailer_buf[XDELTA_PREFIX_LEN]; if (xd_handle_read (patch->patch_in, trailer_buf, XDELTA_PREFIX_LEN) != XDELTA_PREFIX_LEN) return NULL; if (strncmp (trailer_buf, patch->magic_buf, XDELTA_PREFIX_LEN) != 0) { xd_error ("%s: bad trailing magic number, delta is corrupt\n", name); return NULL; } } if (! xd_handle_narrow (patch->patch_in, patch->control_offset, xd_handle_length (patch->patch_in) - total_trailer, patch->patch_flags & FLAG_PATCH_COMPRESSED)) return NULL; if (! (patch->cont = xdp_control_read ((FileHandle*) patch->patch_in))) return NULL; if (patch->cont->source_info_len > 0) { XdeltaSourceInfo* info = patch->cont->source_info[0]; if (info->isdata) patch->data_source = info; else { patch->from_source = info; if (patch->cont->source_info_len > 1) { xd_generate_void_event (EC_XdIncompatibleDelta); return NULL; } } } if (patch->cont->source_info_len > 1) { patch->from_source = patch->cont->source_info[1]; } if (patch->cont->source_info_len > 2) { xd_generate_void_event (EC_XdIncompatibleDelta); return NULL; } if (! xd_handle_narrow (patch->patch_in, patch->header_offset, patch->control_offset, patch->patch_flags & FLAG_PATCH_COMPRESSED)) return NULL; return patch; nosupport: xd_error ("delta format is unsupported (too old)\n"); return NULL; } static gint info_command (gint argc, gchar** argv) { XdeltaPatch* patch; char buf[33]; int i; XdeltaSourceInfo* si; if (! (patch = process_patch (argv[0]))) return 2; xd_error_file = stdout; xd_error ("version %s found patch version %s in %s%s\n", xdelta_version, patch->patch_version, patch->patch_name, patch->patch_flags & FLAG_PATCH_COMPRESSED ? " (compressed)" : ""); if (patch->patch_flags & FLAG_NO_VERIFY) xd_error ("generated with --noverify\n"); if (patch->patch_flags & FLAG_FROM_COMPRESSED) xd_error ("generated with a gzipped FROM file\n"); if (patch->patch_flags & FLAG_TO_COMPRESSED) xd_error ("generated with a gzipped TO file\n"); edsio_md5_to_string (patch->cont->to_md5, buf); xd_error ("output name: %s\n", patch->to_name); xd_error ("output length: %d\n", patch->cont->to_len); xd_error ("output md5: %s\n", buf); xd_error ("patch from segments: %d\n", patch->cont->source_info_len); xd_error ("MD5\t\t\t\t\tLength\tCopies\tUsed\tSeq?\tName\n"); for (i = 0; i < patch->cont->source_info_len; i += 1) { si = patch->cont->source_info[i]; edsio_md5_to_string (si->md5, buf); xd_error ("%s\t%d\t%d\t%d\t%s\t%s\n", buf, si->len, si->copies, si->copy_length, si->sequential ? "yes" : "no", si->name); } return 0; } static gint patch_command (gint argc, gchar** argv) { XdFileHandle* to_out; XdeltaPatch* patch; gint to_out_fd; int count = 1; int ret; if (argc < 1 || argc > 3) { xd_error ("usage: %s patch patchfile [fromfile [tofile]]\n", program_name); return 2; } if (! (patch = process_patch (argv[0]))) return 2; if (argc > 1) patch->from_name = argv[1]; else if (verbose) xd_error ("using from file name: %s\n", patch->from_name); if (argc > 2) patch->to_name = argv[2]; else { struct stat sbuf; gchar *defname = g_strdup (patch->to_name); while ((ret = stat (patch->to_name, & sbuf)) == 0) { if (verbose) xd_error ("to file exists: %s\n", patch->to_name); patch->to_name = g_strdup_printf ("%s.xdp%d", defname, count++); } if (verbose || strcmp (defname, patch->to_name) != 0) xd_error ("using to file name: %s\n", patch->to_name); } if (strcmp (patch->to_name, "-") == 0) { to_out_fd = STDOUT_FILENO; patch->to_name = "standard output"; } else { to_out_fd = open (patch->to_name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); if (to_out_fd < 0) { xd_error ("open %s failed: %s\n", patch->to_name, g_strerror (errno)); return 2; } } to_out = open_write_handle (to_out_fd, patch->to_name); if ((patch->patch_flags & FLAG_TO_COMPRESSED) && (xd_begin_compression (to_out) < 0)) return 2; if (patch->from_source) { XdFileHandle* from_in; gboolean from_is_compressed = FALSE; if (! (from_in = open_read_seek_handle (patch->from_name, &from_is_compressed, TRUE))) return 2; if (from_is_compressed != ((patch->patch_flags & FLAG_FROM_COMPRESSED) && 1)) xd_error ("warning: expected %scompressed from file (%s)\n", (patch->patch_flags & FLAG_FROM_COMPRESSED) ? "" : "un", patch->from_name); if (xd_handle_length (from_in) != patch->from_source->len) { xd_error ("expected from file (%s) of %slength %d bytes\n", patch->from_name, from_is_compressed ? "uncompressed " : "", patch->from_source->len); return 2; } patch->from_source->in = (XdeltaStream*) from_in; } if (patch->data_source) patch->data_source->in = (XdeltaStream*) patch->patch_in; if (! xdp_apply_delta (patch->cont, (FileHandle*) to_out)) return 2; if (patch->from_source) xd_read_close ((XdFileHandle*) patch->from_source->in); xd_read_close (patch->patch_in); if (! xd_handle_really_close (to_out)) return 2; return 0; } xdelta-1.1.3/getopt.c0000644006517700017500000005235707311304625010156 /* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO #define _NO_PROTO #endif #ifndef __STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #ifdef HAVE_CONFIG_H #include #endif #include #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include #endif /* GNU C library. */ /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* XXX 1003.2 says this must be 1 before any call. */ int optind = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return EOF with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ #include #define my_index strchr #else /* Avoid depending on library functions or files whose names are inconsistent. */ char *getenv (); static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ #ifndef __STDC__ /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); #endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ static const char * _getopt_initialize (optstring) const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind = 1; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns `EOF'. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { optarg = NULL; if (optind == 0) optstring = _getopt_initialize (optstring); if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && (argv[optind][0] != '-' || argv[optind][1] == '\0')) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return EOF; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if ((argv[optind][0] != '-' || argv[optind][1] == '\0')) { if (ordering == REQUIRE_ORDER) return EOF; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if (nameend - nextchar == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, "%s: unrecognized option `--%s'\n", argv[0], nextchar); else /* +option or -option */ fprintf (stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); else fprintf (stderr, "%s: invalid option -- %c\n", argv[0], c); } optopt = c; return '?'; } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: option requires an argument -- %c\n", argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == EOF) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ xdelta-1.1.3/getopt1.c0000644006517700017500000001020407311304625010220 /* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include "getopt.h" #ifndef __STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #else char *getenv (); #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == EOF) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ xdelta-1.1.3/xdelta.h0000644006517700017500000001571107353554705010147 /* -*- Mode: C;-*- * * This file is part of XDelta - A binary delta generator. * * Copyright (C) 1997, 1998, 2001 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * $Id: xdelta.h 1.4.1.8.1.50.1.3 Fri, 29 Jun 2001 06:01:08 -0700 jmacd $ */ #ifndef _XDELTA_H_ #define _XDELTA_H_ #include "xd_edsio.h" typedef SerialRsyncIndex XdeltaRsync; typedef SerialRsyncIndexElt XdeltaRsyncElt; typedef SerialXdeltaChecksum XdeltaChecksum; typedef SerialXdeltaIndex XdeltaIndex; typedef SerialXdeltaSourceInfo XdeltaSourceInfo; typedef SerialXdeltaControl XdeltaControl; typedef SerialXdeltaInstruction XdeltaInstruction; typedef struct _XdeltaGenerator XdeltaGenerator; typedef struct _XdeltaSource XdeltaSource; typedef FileHandle XdeltaStream; typedef FileHandle XdeltaOutStream; /* Note: FileHandle is an opaque type, you must define it * to use this library. See how its done in xdmain.c. */ /* $Format: "#define XDELTA_VERSION \"$ReleaseVersion$\"" $ */ #define XDELTA_VERSION "1.1.3" /* $Format: "#define XDELTA_MAJOR_VERSION $ReleaseMajorVersion$" $ */ #define XDELTA_MAJOR_VERSION 1 /* $Format: "#define XDELTA_MINOR_VERSION $ReleaseMinorVersion$" $ */ #define XDELTA_MINOR_VERSION 1 /* $Format: "#define XDELTA_MICRO_VERSION $ReleaseMicroVersion$" $ */ #define XDELTA_MICRO_VERSION 3 extern const guint xdelta_major_version; extern const guint xdelta_minor_version; extern const guint xdelta_micro_version; /* copy segments are of length 1< * * This file was AUTOMATICALLY GENERATED using: * * $Id: edsio.el 1.16 Tue, 06 Apr 1999 23:40:10 -0700 jmacd $ */ #include "edsio.h" #include "xdelta.h" #ifndef _XD_EDSIO_H_ #define _XD_EDSIO_H_ #ifdef __cplusplus extern "C" { #endif #include "edsio_edsio.h" /* Initialize this library. */ gboolean xd_edsio_init (void); /* Types defined here. */ /* XdStringEventCode. */ typedef struct _XdStringEventCode XdStringEventCode; struct _XdStringEventCode { gint code; }; typedef struct _XdStringEvent XdStringEvent; struct _XdStringEvent { gint code; const char* srcfile; guint srcline; const char* version; }; /* XdHandleIntIntEventCode. */ typedef struct _XdHandleIntIntEventCode XdHandleIntIntEventCode; struct _XdHandleIntIntEventCode { gint code; }; typedef struct _XdHandleIntIntEvent XdHandleIntIntEvent; struct _XdHandleIntIntEvent { gint code; const char* srcfile; guint srcline; FileHandle* stream; int expected; int received; }; /* XdHandleStringStringEventCode. */ typedef struct _XdHandleStringStringEventCode XdHandleStringStringEventCode; struct _XdHandleStringStringEventCode { gint code; }; typedef struct _XdHandleStringStringEvent XdHandleStringStringEvent; struct _XdHandleStringStringEvent { gint code; const char* srcfile; guint srcline; FileHandle* stream; const char* expected; const char* received; }; /* XdIntEventCode. */ typedef struct _XdIntEventCode XdIntEventCode; struct _XdIntEventCode { gint code; }; typedef struct _XdIntEvent XdIntEvent; struct _XdIntEvent { gint code; const char* srcfile; guint srcline; int index; }; /* XdVoidEventCode. */ typedef struct _XdVoidEventCode XdVoidEventCode; struct _XdVoidEventCode { gint code; }; typedef struct _XdVoidEvent XdVoidEvent; struct _XdVoidEvent { gint code; const char* srcfile; guint srcline; }; typedef struct _SerialVersion0Instruction SerialVersion0Instruction; typedef struct _SerialVersion0Control SerialVersion0Control; typedef struct _SerialVersion0SourceInfo SerialVersion0SourceInfo; typedef struct _SerialRsyncIndex SerialRsyncIndex; typedef struct _SerialRsyncIndexElt SerialRsyncIndexElt; typedef struct _SerialXdeltaInstruction SerialXdeltaInstruction; typedef struct _SerialXdeltaControl SerialXdeltaControl; typedef struct _SerialXdeltaSourceInfo SerialXdeltaSourceInfo; typedef struct _SerialXdeltaIndex SerialXdeltaIndex; typedef struct _SerialXdeltaChecksum SerialXdeltaChecksum; /* Functions declared here. */ /* Serial Types */ enum _SerialXdType { ST_XdeltaChecksum = (1<<(1+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_XdeltaIndex = (1<<(2+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_XdeltaSourceInfo = (1<<(3+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_XdeltaControl = (1<<(7+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_XdeltaInstruction = (1<<(8+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_RsyncIndexElt = (1<<(9+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_RsyncIndex = (1<<(10+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_Version0SourceInfo = (1<<(4+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_Version0Control = (1<<(5+EDSIO_LIBRARY_OFFSET_BITS))+3, ST_Version0Instruction = (1<<(6+EDSIO_LIBRARY_OFFSET_BITS))+3 }; /* XdeltaChecksum Structure */ struct _SerialXdeltaChecksum { guint16 high; guint16 low; }; void serializeio_print_xdeltachecksum_obj (SerialXdeltaChecksum* obj, guint indent_spaces); gboolean unserialize_xdeltachecksum (SerialSource *source, SerialXdeltaChecksum**); gboolean unserialize_xdeltachecksum_internal (SerialSource *source, SerialXdeltaChecksum** ); gboolean unserialize_xdeltachecksum_internal_noalloc (SerialSource *source, SerialXdeltaChecksum* ); gboolean serialize_xdeltachecksum (SerialSink *sink, guint16 high, guint16 low); gboolean serialize_xdeltachecksum_obj (SerialSink *sink, const SerialXdeltaChecksum* obj); gboolean serialize_xdeltachecksum_internal (SerialSink *sink, guint16 high, guint16 low); gboolean serialize_xdeltachecksum_obj_internal (SerialSink *sink, SerialXdeltaChecksum* obj); guint serializeio_count_xdeltachecksum (guint16 high, guint16 low); guint serializeio_count_xdeltachecksum_obj (SerialXdeltaChecksum const* obj); /* XdeltaIndex Structure */ struct _SerialXdeltaIndex { guint32 file_len; guint8 file_md5[16]; guint32 index_len; SerialXdeltaChecksum* index; }; void serializeio_print_xdeltaindex_obj (SerialXdeltaIndex* obj, guint indent_spaces); gboolean unserialize_xdeltaindex (SerialSource *source, SerialXdeltaIndex**); gboolean unserialize_xdeltaindex_internal (SerialSource *source, SerialXdeltaIndex** ); gboolean unserialize_xdeltaindex_internal_noalloc (SerialSource *source, SerialXdeltaIndex* ); gboolean serialize_xdeltaindex (SerialSink *sink, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialXdeltaChecksum const* index); gboolean serialize_xdeltaindex_obj (SerialSink *sink, const SerialXdeltaIndex* obj); gboolean serialize_xdeltaindex_internal (SerialSink *sink, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialXdeltaChecksum const* index); gboolean serialize_xdeltaindex_obj_internal (SerialSink *sink, SerialXdeltaIndex* obj); guint serializeio_count_xdeltaindex (guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialXdeltaChecksum const* index); guint serializeio_count_xdeltaindex_obj (SerialXdeltaIndex const* obj); /* XdeltaSourceInfo Structure */ struct _SerialXdeltaSourceInfo { const gchar* name; guint8 md5[16]; guint32 len; gboolean isdata; gboolean sequential; guint32 position; guint32 copies; guint32 copy_length; FileHandle *in; }; void serializeio_print_xdeltasourceinfo_obj (SerialXdeltaSourceInfo* obj, guint indent_spaces); gboolean unserialize_xdeltasourceinfo (SerialSource *source, SerialXdeltaSourceInfo**); gboolean unserialize_xdeltasourceinfo_internal (SerialSource *source, SerialXdeltaSourceInfo** ); gboolean unserialize_xdeltasourceinfo_internal_noalloc (SerialSource *source, SerialXdeltaSourceInfo* ); gboolean serialize_xdeltasourceinfo (SerialSink *sink, const gchar* name, const guint8 md5[16], guint32 len, gboolean isdata, gboolean sequential); gboolean serialize_xdeltasourceinfo_obj (SerialSink *sink, const SerialXdeltaSourceInfo* obj); gboolean serialize_xdeltasourceinfo_internal (SerialSink *sink, const gchar* name, const guint8 md5[16], guint32 len, gboolean isdata, gboolean sequential); gboolean serialize_xdeltasourceinfo_obj_internal (SerialSink *sink, SerialXdeltaSourceInfo* obj); guint serializeio_count_xdeltasourceinfo (const gchar* name, const guint8 md5[16], guint32 len, gboolean isdata, gboolean sequential); guint serializeio_count_xdeltasourceinfo_obj (SerialXdeltaSourceInfo const* obj); /* XdeltaControl Structure */ struct _SerialXdeltaControl { guint8 to_md5[16]; guint32 to_len; gboolean has_data; guint32 source_info_len; SerialXdeltaSourceInfo** source_info; guint32 inst_len; SerialXdeltaInstruction* inst; GArray *inst_array; GPtrArray *source_info_array; }; void serializeio_print_xdeltacontrol_obj (SerialXdeltaControl* obj, guint indent_spaces); gboolean unserialize_xdeltacontrol (SerialSource *source, SerialXdeltaControl**); gboolean unserialize_xdeltacontrol_internal (SerialSource *source, SerialXdeltaControl** ); gboolean unserialize_xdeltacontrol_internal_noalloc (SerialSource *source, SerialXdeltaControl* ); gboolean serialize_xdeltacontrol (SerialSink *sink, const guint8 to_md5[16], guint32 to_len, gboolean has_data, guint32 source_info_len, SerialXdeltaSourceInfo* const* source_info, guint32 inst_len, SerialXdeltaInstruction const* inst); gboolean serialize_xdeltacontrol_obj (SerialSink *sink, const SerialXdeltaControl* obj); gboolean serialize_xdeltacontrol_internal (SerialSink *sink, const guint8 to_md5[16], guint32 to_len, gboolean has_data, guint32 source_info_len, SerialXdeltaSourceInfo* const* source_info, guint32 inst_len, SerialXdeltaInstruction const* inst); gboolean serialize_xdeltacontrol_obj_internal (SerialSink *sink, SerialXdeltaControl* obj); guint serializeio_count_xdeltacontrol (const guint8 to_md5[16], guint32 to_len, gboolean has_data, guint32 source_info_len, SerialXdeltaSourceInfo* const* source_info, guint32 inst_len, SerialXdeltaInstruction const* inst); guint serializeio_count_xdeltacontrol_obj (SerialXdeltaControl const* obj); /* XdeltaInstruction Structure */ struct _SerialXdeltaInstruction { guint32 index; guint32 offset; guint32 length; guint32 output_start; }; void serializeio_print_xdeltainstruction_obj (SerialXdeltaInstruction* obj, guint indent_spaces); gboolean unserialize_xdeltainstruction (SerialSource *source, SerialXdeltaInstruction**); gboolean unserialize_xdeltainstruction_internal (SerialSource *source, SerialXdeltaInstruction** ); gboolean unserialize_xdeltainstruction_internal_noalloc (SerialSource *source, SerialXdeltaInstruction* ); gboolean serialize_xdeltainstruction (SerialSink *sink, guint32 index, guint32 offset, guint32 length); gboolean serialize_xdeltainstruction_obj (SerialSink *sink, const SerialXdeltaInstruction* obj); gboolean serialize_xdeltainstruction_internal (SerialSink *sink, guint32 index, guint32 offset, guint32 length); gboolean serialize_xdeltainstruction_obj_internal (SerialSink *sink, SerialXdeltaInstruction* obj); guint serializeio_count_xdeltainstruction (guint32 index, guint32 offset, guint32 length); guint serializeio_count_xdeltainstruction_obj (SerialXdeltaInstruction const* obj); /* RsyncIndexElt Structure */ struct _SerialRsyncIndexElt { guint8 md5[16]; SerialXdeltaChecksum cksum; SerialRsyncIndexElt* next; gint match_offset; }; void serializeio_print_rsyncindexelt_obj (SerialRsyncIndexElt* obj, guint indent_spaces); gboolean unserialize_rsyncindexelt (SerialSource *source, SerialRsyncIndexElt**); gboolean unserialize_rsyncindexelt_internal (SerialSource *source, SerialRsyncIndexElt** ); gboolean unserialize_rsyncindexelt_internal_noalloc (SerialSource *source, SerialRsyncIndexElt* ); gboolean serialize_rsyncindexelt (SerialSink *sink, const guint8 md5[16], SerialXdeltaChecksum const* cksum); gboolean serialize_rsyncindexelt_obj (SerialSink *sink, const SerialRsyncIndexElt* obj); gboolean serialize_rsyncindexelt_internal (SerialSink *sink, const guint8 md5[16], SerialXdeltaChecksum const* cksum); gboolean serialize_rsyncindexelt_obj_internal (SerialSink *sink, SerialRsyncIndexElt* obj); guint serializeio_count_rsyncindexelt (const guint8 md5[16], SerialXdeltaChecksum const* cksum); guint serializeio_count_rsyncindexelt_obj (SerialRsyncIndexElt const* obj); /* RsyncIndex Structure */ struct _SerialRsyncIndex { guint32 seg_len; guint32 file_len; guint8 file_md5[16]; guint32 index_len; SerialRsyncIndexElt* index; SerialRsyncIndexElt** table; guint table_size; }; void serializeio_print_rsyncindex_obj (SerialRsyncIndex* obj, guint indent_spaces); gboolean unserialize_rsyncindex (SerialSource *source, SerialRsyncIndex**); gboolean unserialize_rsyncindex_internal (SerialSource *source, SerialRsyncIndex** ); gboolean unserialize_rsyncindex_internal_noalloc (SerialSource *source, SerialRsyncIndex* ); gboolean serialize_rsyncindex (SerialSink *sink, guint32 seg_len, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialRsyncIndexElt const* index); gboolean serialize_rsyncindex_obj (SerialSink *sink, const SerialRsyncIndex* obj); gboolean serialize_rsyncindex_internal (SerialSink *sink, guint32 seg_len, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialRsyncIndexElt const* index); gboolean serialize_rsyncindex_obj_internal (SerialSink *sink, SerialRsyncIndex* obj); guint serializeio_count_rsyncindex (guint32 seg_len, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialRsyncIndexElt const* index); guint serializeio_count_rsyncindex_obj (SerialRsyncIndex const* obj); /* Version0SourceInfo Structure */ struct _SerialVersion0SourceInfo { guint8 md5[16]; guint8 real_md5[16]; guint32 length; }; void serializeio_print_version0sourceinfo_obj (SerialVersion0SourceInfo* obj, guint indent_spaces); gboolean unserialize_version0sourceinfo (SerialSource *source, SerialVersion0SourceInfo**); gboolean unserialize_version0sourceinfo_internal (SerialSource *source, SerialVersion0SourceInfo** ); gboolean unserialize_version0sourceinfo_internal_noalloc (SerialSource *source, SerialVersion0SourceInfo* ); gboolean serialize_version0sourceinfo (SerialSink *sink, const guint8 md5[16], const guint8 real_md5[16], guint32 length); gboolean serialize_version0sourceinfo_obj (SerialSink *sink, const SerialVersion0SourceInfo* obj); gboolean serialize_version0sourceinfo_internal (SerialSink *sink, const guint8 md5[16], const guint8 real_md5[16], guint32 length); gboolean serialize_version0sourceinfo_obj_internal (SerialSink *sink, SerialVersion0SourceInfo* obj); guint serializeio_count_version0sourceinfo (const guint8 md5[16], const guint8 real_md5[16], guint32 length); guint serializeio_count_version0sourceinfo_obj (SerialVersion0SourceInfo const* obj); /* Version0Control Structure */ struct _SerialVersion0Control { gboolean normalized; guint32 data_len; SerialVersion0SourceInfo to_info; guint32 source_info_len; SerialVersion0SourceInfo** source_info; guint32 inst_len; SerialVersion0Instruction* inst; GArray *inst_array; GPtrArray *source_info_array; }; void serializeio_print_version0control_obj (SerialVersion0Control* obj, guint indent_spaces); gboolean unserialize_version0control (SerialSource *source, SerialVersion0Control**); gboolean unserialize_version0control_internal (SerialSource *source, SerialVersion0Control** ); gboolean unserialize_version0control_internal_noalloc (SerialSource *source, SerialVersion0Control* ); gboolean serialize_version0control (SerialSink *sink, gboolean normalized, guint32 data_len, SerialVersion0SourceInfo const* to_info, guint32 source_info_len, SerialVersion0SourceInfo* const* source_info, guint32 inst_len, SerialVersion0Instruction const* inst); gboolean serialize_version0control_obj (SerialSink *sink, const SerialVersion0Control* obj); gboolean serialize_version0control_internal (SerialSink *sink, gboolean normalized, guint32 data_len, SerialVersion0SourceInfo const* to_info, guint32 source_info_len, SerialVersion0SourceInfo* const* source_info, guint32 inst_len, SerialVersion0Instruction const* inst); gboolean serialize_version0control_obj_internal (SerialSink *sink, SerialVersion0Control* obj); guint serializeio_count_version0control (gboolean normalized, guint32 data_len, SerialVersion0SourceInfo const* to_info, guint32 source_info_len, SerialVersion0SourceInfo* const* source_info, guint32 inst_len, SerialVersion0Instruction const* inst); guint serializeio_count_version0control_obj (SerialVersion0Control const* obj); /* Version0Instruction Structure */ struct _SerialVersion0Instruction { guint32 offset; guint32 length; guint8 type; guint8 index; }; void serializeio_print_version0instruction_obj (SerialVersion0Instruction* obj, guint indent_spaces); gboolean unserialize_version0instruction (SerialSource *source, SerialVersion0Instruction**); gboolean unserialize_version0instruction_internal (SerialSource *source, SerialVersion0Instruction** ); gboolean unserialize_version0instruction_internal_noalloc (SerialSource *source, SerialVersion0Instruction* ); gboolean serialize_version0instruction (SerialSink *sink, guint32 offset, guint32 length); gboolean serialize_version0instruction_obj (SerialSink *sink, const SerialVersion0Instruction* obj); gboolean serialize_version0instruction_internal (SerialSink *sink, guint32 offset, guint32 length); gboolean serialize_version0instruction_obj_internal (SerialSink *sink, SerialVersion0Instruction* obj); guint serializeio_count_version0instruction (guint32 offset, guint32 length); guint serializeio_count_version0instruction_obj (SerialVersion0Instruction const* obj); void xd_generate_void_event_internal (XdVoidEventCode code, const char* srcfile, gint srcline); #define xd_generate_void_event(ecode) xd_generate_void_event_internal((ecode),__FILE__,__LINE__) extern const XdVoidEventCode EC_XdTooFewSources; #define EC_XdTooFewSourcesValue ((0< * * $Id: xdeltapriv.h 1.29 Sat, 03 Apr 1999 20:09:14 -0800 jmacd $ */ #ifndef _XDELTAPRIV_H_ #define _XDELTAPRIV_H_ #if 0 #define DEBUG_CKSUM_UPDATE #define DEBUG_MATCH_PRINT #define DEBUG_CKSUM #define DEBUG_HASH #define DEBUG_INST #define CLOBBER_ALGORITHM_C #define DEBUG_MD5 #define DEBUG_CONT #define DEBUG_COPY #define DEBUG_FIND #define DEBUG_RSYNC_REQUEST #define DEBUG_CONT #define DEBUG_CONT2 #define DEBUG_CHECK_CONTROL #endif typedef struct _XdeltaPos XdeltaPos; typedef struct _RsyncHash RsyncHash; #define XPOS(p) (((p).page * (p).page_size) + (p).off) struct _XdeltaPos { guint page; guint page_size; guint off; const guint8* mem; guint mem_page; guint mem_rem; }; #define handle_length(x) ((* (x)->table->table_handle_length) (x)) #define handle_pages(x) ((* (x)->table->table_handle_pages) (x)) #define handle_pagesize(x) ((* (x)->table->table_handle_pagesize) (x)) #define handle_map_page(x,y,z) ((* (x)->table->table_handle_map_page) ((x),(y),(z))) #define handle_unmap_page(x,y,z) ((* (x)->table->table_handle_unmap_page) ((x),(y),(z))) #define handle_checksum_md5(x) ((* (x)->table->table_handle_checksum_md5) (x)) #define handle_close(x,y) ((* (x)->table->table_handle_close) ((x), (y))) #define handle_write(x,y,z) ((* (x)->table->table_handle_write) ((x),(y),(z))) #define handle_copy(x,y,z,a) ((* (x)->table->table_handle_copy) ((x),(y),(z),(a))) struct _XdeltaGenerator { GPtrArray *sources; const guint32 *table; guint table_size; guint to_output_pos; guint data_output_pos; XdeltaOutStream *data_out; XdeltaOutStream *control_out; XdeltaControl *control; XdeltaSource *data_source; #ifdef DEBUG_HASH gint hash_conflicts; /* bucket already used. */ gint hash_real_conflicts; /* bucket had different checksum. */ gint hash_real_real_conflicts; /* bucket had same checksum, different region */ gint hash_fill; gint hash_entries; #endif EdsioMD5Ctx ctx; }; struct _XdeltaSource { XdeltaStream *source_in; XdeltaPos source_pos; gint ck_count; /* number of elts in cksums. */ const XdeltaChecksum *cksums; /* array of cksums. */ const char *name; XdeltaStream *index_in; XdeltaOutStream *index_out; gint source_index; gboolean used; gboolean sequential; guint32 position; }; #define CHEW(x) (single_hash[(guint)x]) #define FLIP_FORWARD(p) if ((p).off == (p).page_size) { (p).page += 1; (p).off = 0; } extern const guint16 single_hash[256]; void init_pos (XdeltaStream* str, XdeltaPos* pos); gboolean unmap_page (XdeltaStream* stream, XdeltaPos* pos); gboolean map_page (XdeltaStream* stream, XdeltaPos* pos); gboolean check_stream_integrity (XdeltaStream* str, const guint8* md5, guint len); XdeltaControl* control_new (void); guint c_hash (const XdeltaChecksum* c); #endif /* _XDELTAPRIV_H_ */ xdelta-1.1.3/getopt.h0000644006517700017500000001047407311304625010155 /* Declarations for getopt. Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { #if __STDC__ const char *name; #else char *name; #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 #if __STDC__ #if defined(__GNU_LIBRARY__) /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ extern int getopt (); #endif /* not __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only); #else /* not __STDC__ */ extern int getopt (); extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); #endif /* not __STDC__ */ #ifdef __cplusplus } #endif #endif /* _GETOPT_H */ xdelta-1.1.3/xd.ser0000644006517700017500000000617507311304625007633 ;; -*- Emacs-Lisp -*- (defmodule xd 3 "xdelta.h" nil) (defimport "libedsio/edsio.ser") (defsertype XdeltaChecksum 1 ((high uint16) (low uint16) ) () ) (defsertype XdeltaIndex 2 ((file_len uint) (file_md5 (bytes 16)) (index (array XdeltaChecksum)) ) () ) (defsertype XdeltaSourceInfo 3 ((name string) (md5 (bytes 16)) (len uint) (isdata boolean) ;;; if true, then its source index is 0 and it is the data segment (sequential boolean) ;;; if true, then offset field is not persistent, but instead ;;; recomputed when loaded as the sum of ;;; previous instruction's length fields, to ;;; indicate a sequential read ) ("guint32 position" "guint32 copies" "guint32 copy_length" "FileHandle *in") ) (defsertype XdeltaControl 7 ((to_md5 (bytes 16)) (to_len uint) (has_data boolean) (source_info (array (ptr XdeltaSourceInfo))) (inst (array XdeltaInstruction)) ) ("GArray *inst_array" "GPtrArray *source_info_array" ) ) (defsertype XdeltaInstruction 8 ((index uint) (offset uint) (length uint) ) ("guint32 output_start") ) ;; rsync stuff (defsertype RsyncIndexElt 9 ((md5 (bytes 16)) (cksum XdeltaChecksum) ) ("SerialRsyncIndexElt* next" "gint match_offset") ) (defsertype RsyncIndex 10 ((seg_len uint) (file_len uint) (file_md5 (bytes 16)) (index (array RsyncIndexElt)) ) ("SerialRsyncIndexElt** table" "guint table_size") ) ;; backward compat, these are the 1.0 defs (defsertype Version0SourceInfo 4 ((md5 (bytes 16)) (real_md5 (bytes 16)) (length uint) ) () ) (defsertype Version0Control 5 ((normalized boolean) (data_len uint) (to_info Version0SourceInfo) (source_info (array (ptr Version0SourceInfo))) (inst (array Version0Instruction)) ) ("GArray *inst_array" "GPtrArray *source_info_array" ) ) (defsertype Version0Instruction 6 ((offset uint) (length uint) ) ("guint8 type" ;; these two fields get packed into length "guint8 index" ) ) ;; events (defetype handle "FileHandle*") (defevent TooFewSources Error () () "Too few input sources") (defevent TooManySources Error () () "Too many input sources") (defevent OutOfRangeSourceIndex Error ((index int)) () "Instruction references out-of-range source index: ${INDEX}") (defevent InvalidControl Error () () "Delta control is corrupt") (defevent InvalidRsyncCache Error () () "The rsync checksum cache is corrupt") (defevent IncompatibleDelta Error () () "The delta was not produced according by the `xdelta delta' command") (defevent StreamChecksumFailed Error ((stream handle) (expected string) (received string)) () "${STREAM}: Checksum validation failed, expected: ${EXPECTED}, received: ${RECEIVED}") (defevent StreamLengthFailed Error ((stream handle) (expected int) (received int)) () "${STREAM}: Length validation failed, expected: ${EXPECTED}, received: ${RECEIVED}") (defevent BackwardCompatibilityMode Information ((version string)) () "Reading a version ${VERSION} delta control") xdelta-1.1.3/xdelta.magic0000644006517700017500000000062407311304625010761 #------------------------------------------------------------------------------ # file(1) magic(5) data for xdelta # 0 string %XDELTA% XDelta binary patch file 0.14 0 string %XDZ000% XDelta binary patch file 0.18 0 string %XDZ001% XDelta binary patch file 0.20 0 string %XDZ002% XDelta binary patch file 1.0 0 string %XDZ003% XDelta binary patch file 1.0.4 0 string %XDZ004% XDelta binary patch file 1.1 xdelta-1.1.3/xdelta.prj0000644006517700017500000000527307353554072010512 ;; -*- PRCS -*- (Created-By-Prcs-Version 1 2 16) (Project-Description "") (Project-Version xdelta 1.1-maint 7) (Parent-Version xdelta 1.1-maint 6) (Version-Log "") (New-Version-Log "") (Checkin-Time "Fri, 29 Jun 2001 06:01:08 -0700") (Checkin-Login jmacd) (Populate-Ignore ("\\.o$" "\\.deps" "\\.lo$" ".libs/" "^\\.#" "\\.la$" "stamp-" "libedsio" "mkinstalldirs" "missing" "ltmain\\.sh" "ltconfig" "install-sh" "xdser\\.h" "xdser\\.c" "config\\." "aclocal\\.m4" "CVS/" "Makefile\\.in$" "Makefile$" ".cvsignore" "configure$" "xdelta$" "libtool" "doc/xdelta.info" )) (Project-Keywords (ReleaseMajorVersion 1) (ReleaseMinorVersion 1) (ReleaseMicroVersion 3) (LibCurrent 2) (LibRevision 0) (LibAge 0) (ReleaseVersion "$ReleaseMajorVersion$.$ReleaseMinorVersion$.$ReleaseMicroVersion$") ) (Files ;; Config (configure.in (xdelta/1_configure. 1.10.1.37 664)) (Makefile.am (xdelta/2_Makefile.a 1.19.1.40.1.4 664)) (ChangeLog (xdelta/d/9_ChangeLog 1.6 664)) (runtest (xdelta/d/5_runtest 1.7 755)) (README (xdelta/d/6_README 1.5 664)) (INSTALL (xdelta/d/10_INSTALL 1.3 664)) (COPYING (xdelta/d/11_COPYING 1.2 664)) (AUTHORS (xdelta/d/12_AUTHORS 1.2 664)) (NEWS (xdelta/d/13_NEWS 1.15.1.6 664)) (xdelta.magic (xdelta/d/20_xdelta.mag 1.2 664)) (xdelta-config.in (xdelta/d/33_xdelta-con 1.4 664)) (autogen.sh (xdelta/d/34_autogen.sh 1.1 775)) (xdelta.m4 (xdelta/d/35_xdelta.m4 1.5 664)) ;; Library (xdelta.h (xdelta/b/8_xdelta.h 1.4.1.8.1.50.1.3 664)) (xdeltapriv.h (xdelta/c/42_xdeltapriv 1.29 664)) (xdelta.c (xdelta/b/14_xdelta.c 1.4.1.50.1.2 664)) (xd.ser (xdelta/d/7_xd.ser 1.12 664)) (xdrsync.c (xdelta/d/44_xdrsync.c 1.2 664)) (xdapply.c (xdelta/e/37_xdapply.c 1.1 664)) ;; Application (xdmain.c (xdelta/d/15_xdmain.c 1.22.1.5 644)) (getopt1.c (xdelta/d/17_getopt1.c 1.1 664)) (getopt.h (xdelta/d/18_getopt.h 1.1 664)) (getopt.c (xdelta/d/19_getopt.c 1.1 664)) ;; Windows project files (xdelta.dsp (xdelta/d/36_xdelta.dsp 1.2 664) :no-keywords) (xdelta.dsw (xdelta/d/37_xdelta.dsw 1.2 664) :no-keywords) ;; Testing (test/Makefile.am (xdelta/e/39_Makefile.a 1.1.1.3 664)) (test/xdeltatest.c (xdelta/e/38_xdeltatest 1.6 664)) (test/README.test (xdelta/21_README.tes 1.2 664)) ;; Not much docs (doc/Makefile.am (xdelta/d/21_Makefile.a 1.4 664)) (doc/xdelta.1 (xdelta/d/23_xdelta.1 1.5 664)) (doc/xdelta.cat (xdelta/22_xdelta.cat 1.2 664)) ;; DJGPP contrib (djgpp/readme.djg (xdelta/18_readme.djg 1.1 664)) (djgpp/announce.djg (xdelta/19_announce.d 1.1 664)) (djgpp/Makefile.am (xdelta/20_Makefile.a 1.1 664)) ) (Merge-Parents) (New-Merge-Parents) xdelta-1.1.3/xdelta.m40000644006517700017500000002034307311304625010221 # Configure paths for XDELTA # Owen Taylor 97-11-3 dnl AM_PATH_XDELTA([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for XDELTA, and define XDELTA_CFLAGS and XDELTA_LIBS, if "gmodule" or dnl AC_DEFUN(AM_PATH_XDELTA, [dnl dnl Get the cflags and libraries from the xdelta-config script dnl AC_ARG_WITH(xdelta-prefix,[ --with-xdelta-prefix=PFX Prefix where XDELTA is installed (optional)], xdelta_config_prefix="$withval", xdelta_config_prefix="") AC_ARG_WITH(xdelta-exec-prefix,[ --with-xdelta-exec-prefix=PFX Exec prefix where XDELTA is installed (optional)], xdelta_config_exec_prefix="$withval", xdelta_config_exec_prefix="") AC_ARG_ENABLE(xdeltatest, [ --disable-xdeltatest Do not try to compile and run a test XDELTA program], , enable_xdeltatest=yes) if test x$xdelta_config_exec_prefix != x ; then xdelta_config_args="$xdelta_config_args --exec-prefix=$xdelta_config_exec_prefix" if test x${XDELTA_CONFIG+set} != xset ; then XDELTA_CONFIG=$xdelta_config_exec_prefix/bin/xdelta-config fi fi if test x$xdelta_config_prefix != x ; then xdelta_config_args="$xdelta_config_args --prefix=$xdelta_config_prefix" if test x${XDELTA_CONFIG+set} != xset ; then XDELTA_CONFIG=$xdelta_config_prefix/bin/xdelta-config fi fi AC_PATH_PROG(XDELTA_CONFIG, xdelta-config, no) min_xdelta_version=ifelse([$1], ,1.0.0,$1) AC_MSG_CHECKING(for XDELTA - version >= $min_xdelta_version) no_xdelta="" if test "$XDELTA_CONFIG" = "no" ; then no_xdelta=yes else XDELTA_CFLAGS=`$XDELTA_CONFIG $xdelta_config_args --cflags` XDELTA_LIBS=`$XDELTA_CONFIG $xdelta_config_args --libs` xdelta_config_major_version=`$XDELTA_CONFIG $xdelta_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` xdelta_config_minor_version=`$XDELTA_CONFIG $xdelta_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` xdelta_config_micro_version=`$XDELTA_CONFIG $xdelta_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_xdeltatest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $XDELTA_CFLAGS" LIBS="$LIBS $XDELTA_LIBS" dnl dnl Now check if the installed XDELTA is sufficiently new. (Also sanity dnl checks the results of xdelta-config to some extent dnl rm -f conf.xdeltatest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.xdeltatest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_xdelta_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_xdelta_version"); exit(1); } if ((xdelta_major_version != $xdelta_config_major_version) || (xdelta_minor_version != $xdelta_config_minor_version) || (xdelta_micro_version != $xdelta_config_micro_version)) { printf("\n*** 'xdelta-config --version' returned %d.%d.%d, but XDELTA (%d.%d.%d)\n", $xdelta_config_major_version, $xdelta_config_minor_version, $xdelta_config_micro_version, xdelta_major_version, xdelta_minor_version, xdelta_micro_version); printf ("*** was found! If xdelta-config was correct, then it is best\n"); printf ("*** to remove the old version of XDELTA. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If xdelta-config was wrong, set the environment variable XDELTA_CONFIG\n"); printf("*** to point to the correct copy of xdelta-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } else if ((xdelta_major_version != XDELTA_MAJOR_VERSION) || (xdelta_minor_version != XDELTA_MINOR_VERSION) || (xdelta_micro_version != XDELTA_MICRO_VERSION)) { printf("*** XDELTA header files (version %d.%d.%d) do not match\n", XDELTA_MAJOR_VERSION, XDELTA_MINOR_VERSION, XDELTA_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", xdelta_major_version, xdelta_minor_version, xdelta_micro_version); } else { if ((xdelta_major_version > major) || ((xdelta_major_version == major) && (xdelta_minor_version > minor)) || ((xdelta_major_version == major) && (xdelta_minor_version == minor) && (xdelta_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of XDELTA (%d.%d.%d) was found.\n", xdelta_major_version, xdelta_minor_version, xdelta_micro_version); printf("*** You need a version of XDELTA newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** XDELTA is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the xdelta-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of XDELTA, but you can also set the XDELTA_CONFIG environment to point to the\n"); printf("*** correct copy of xdelta-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_xdelta=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_xdelta" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$XDELTA_CONFIG" = "no" ; then echo "*** The xdelta-config script installed by XDELTA could not be found" echo "*** If XDELTA was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the XDELTA_CONFIG environment variable to the" echo "*** full path to xdelta-config." else if test -f conf.xdeltatest ; then : else echo "*** Could not run XDELTA test program, checking why..." CFLAGS="$CFLAGS $XDELTA_CFLAGS" LIBS="$LIBS $XDELTA_LIBS" AC_TRY_LINK([ #include #include ], [ return ((xdelta_major_version) || (xdelta_minor_version) || (xdelta_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding XDELTA or finding the wrong" echo "*** version of XDELTA. If it is not finding XDELTA, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means XDELTA was incorrectly installed" echo "*** or that you have moved XDELTA since it was installed. In the latter case, you" echo "*** may want to edit the xdelta-config script: $XDELTA_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi XDELTA_CFLAGS="" XDELTA_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(XDELTA_CFLAGS) AC_SUBST(XDELTA_LIBS) rm -f conf.xdeltatest ]) xdelta-1.1.3/autogen.sh0000755006517700017500000000267207311304625010504 #!/bin/sh # Run this to generate all the initial makefiles, etc. DIE=0 (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have autoconf installed to compile xdelta." echo "Download the appropriate package for your distribution," echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" DIE=1 } (libtool --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have libtool installed to compile xdelta." echo "Get ftp://alpha.gnu.org/gnu/libtool-1.2d.tar.gz" echo "(or a newer version if it is available)" DIE=1 } (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have automake installed to compile xdelta." echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.4.tar.gz" echo "(or a newer version if it is available)" DIE=1 } if test "$DIE" -eq 1; then exit 1 fi (test -f xdelta.c) || { echo "You must run this script in the top-level xdelta directory" exit 1 } if test -z "$*"; then echo "I am going to run ./configure with no arguments - if you wish " echo "to pass any to it, please specify them on the $0 command line." fi for i in . do echo processing $i (cd $i; \ libtoolize --copy --force; \ aclocal $ACLOCAL_FLAGS; autoheader; \ automake --add-missing; \ autoheader; \ autoconf) done echo "Running ./configure --enable-maintainer-mode" "$@" ./configure --enable-maintainer-mode "$@" echo echo "Now type 'make' to compile xdelta." xdelta-1.1.3/xdelta.dsp0000644006517700017500000000765207311304625010477 # Microsoft Developer Studio Project File - Name="xdelta" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 5.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=xdelta - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "xdelta.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "xdelta.mak" CFG="xdelta - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "xdelta - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "xdelta - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "xdelta - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib zlibs.lib glib-1.2.lib /nologo /subsystem:console /machine:I386 !ELSEIF "$(CFG)" == "xdelta - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "XDELTA_COMPILATION" /FR /YX /FD /ZI /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib zlibs.lib glib-1.2.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept !ENDIF # Begin Target # Name "xdelta - Win32 Release" # Name "xdelta - Win32 Debug" # Begin Source File SOURCE=.\libedsio\edsio.c # End Source File # Begin Source File SOURCE=.\libedsio\edsio_edsio.c # End Source File # Begin Source File SOURCE=.\getopt.c # End Source File # Begin Source File SOURCE=.\getopt1.c # End Source File # Begin Source File SOURCE=.\libedsio\md5c.c # End Source File # Begin Source File SOURCE=.\libedsio\sha.c # End Source File # Begin Source File SOURCE=.\xd_edsio.c # End Source File # Begin Source File SOURCE=.\xdelta.c # End Source File # Begin Source File SOURCE=.\xdmain.c # End Source File # End Target # End Project xdelta-1.1.3/xdelta.dsw0000644006517700017500000000103107311304625010467 Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "xdelta"=".\xdelta.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### xdelta-1.1.3/stamp-ser0000644006517700017500000000000007311305141010312 xdelta-1.1.3/xdrsync.c0000644006517700017500000002137307311304625010340 /* -*- Mode: C;-*- * * This file is part of XDelta - A binary delta generator. * * Copyright (C) 1997, 1998, 1999 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * $Id: xdrsync.c 1.2 Thu, 01 Apr 1999 23:29:11 -0800 jmacd $ */ #include #include #include "xdelta.h" #include "xdeltapriv.h" /* Rsync */ static void init_long_checksum (const guint8 *buf, guint len, XdeltaChecksum *cksum) { guint16 low = cksum->low; guint16 high = cksum->high; /* @@@ unroll me? */ for (; len > 0; len -= 1) { low += CHEW(*buf++); high += low; } cksum->low = low; cksum->high = high; } static XdeltaRsync* xdp_rsync_index_int (XdeltaStream *str, guint seg_len) { guint to_index = seg_len; XdeltaPos pos; XdeltaChecksum cksum; GArray *index; EdsioMD5Ctx ctx; index = g_array_new (FALSE, FALSE, sizeof (XdeltaRsyncElt)); init_pos (str, &pos); memset (&cksum, 0, sizeof (cksum)); edsio_md5_init (& ctx); for (;;) { gint consume; if (! map_page (str, &pos)) return NULL; consume = MIN (to_index, pos.mem_rem - pos.off); if (consume == 0) break; to_index -= consume; edsio_md5_update (& ctx, pos.mem + pos.off, consume); init_long_checksum (pos.mem + pos.off, consume, &cksum); if (to_index == 0) { XdeltaRsyncElt elt; edsio_md5_final (elt.md5, &ctx); elt.cksum = cksum; g_array_append_val (index, elt); edsio_md5_init (& ctx); memset (&cksum, 0, sizeof (cksum)); to_index = seg_len; } pos.off += consume; FLIP_FORWARD (pos); } if (! unmap_page (str, &pos)) return NULL; { XdeltaRsync* rsync = g_new (XdeltaRsync, 1); rsync->seg_len = seg_len; rsync->file_len = handle_length (str); memcpy (rsync->file_md5, handle_checksum_md5 (str), 16); rsync->index = &g_array_index (index, XdeltaRsyncElt, 0); rsync->index_len = index->len; return rsync; } } static XdeltaRsync* xdp_rsync_read_index (XdeltaStream* cache_in) { SerialSource* src = handle_source (cache_in); XdeltaRsync* rsync; if (! src) return NULL; if (! unserialize_rsyncindex (src, &rsync)) return NULL; return rsync; } static gboolean xdp_rsync_write_index (XdeltaRsync* rsync, XdeltaOutStream* cache_out) { SerialSink* sink = handle_sink (cache_out, NULL, NULL, NULL, NULL); if (! sink) return FALSE; if (! serialize_rsyncindex_obj (sink, rsync)) return FALSE; if (! handle_close (cache_out, 0)) return FALSE; return TRUE; } XdeltaRsync* xdp_rsync_index (XdeltaStream *str, guint seg_len, XdeltaStream *cache_in, XdeltaOutStream *cache_out) { XdeltaRsync* rsync; if (cache_in) { if (! (rsync = xdp_rsync_read_index (cache_in))) return NULL; if (seg_len != rsync->seg_len || (str && ! check_stream_integrity (str, rsync->file_md5, rsync->file_len))) { xd_generate_void_event (EC_XdInvalidRsyncCache); goto bail; } return rsync; } else { if (! (rsync = xdp_rsync_index_int (str, seg_len))) return NULL; if (cache_out) { if (! xdp_rsync_write_index (rsync, cache_out)) goto bail; } return rsync; } bail: xdp_rsync_index_free (rsync); return NULL; } void xdp_rsync_index_free (XdeltaRsync *rsync) { /* ??? */ } static gboolean xdp_rsync_hash (XdeltaRsync* rsync) { guint i, index, prime = 0; gboolean already_hashed = rsync->table != NULL; SerialRsyncIndexElt** table = NULL; if (! already_hashed) { prime = rsync->table_size = g_spaced_primes_closest (rsync->index_len); table = rsync->table = g_new0 (SerialRsyncIndexElt*, prime); } for (i = 0; i < rsync->index_len; i += 1) { SerialRsyncIndexElt* elt = rsync->index + i; elt->match_offset = -1; if (! already_hashed) { index = c_hash (& elt->cksum) % prime; elt->next = table[index]; table[index] = elt; } } return TRUE; } static void incr_by (XdeltaPos* pos, gint incr) { do { gint rem = MIN (incr, pos->mem_rem - pos->off); pos->off += incr; incr -= rem; FLIP_FORWARD (*pos); } while (incr > 0 && pos->mem_rem != pos->page_size); } GArray* xdp_rsync_request (XdeltaStream *file, XdeltaRsync *rsync) { XdeltaPos opos, npos; XdeltaChecksum cksum; guint max_buffer_index = handle_length (file); GArray *request = g_array_new (FALSE, FALSE, sizeof (guint)); const guint8* n_pointer, *o_pointer; guint thistime; guint prime, index; SerialRsyncIndexElt **table; guint i; guint matched = 0; guint16 old_c, new_c; if (max_buffer_index < rsync->seg_len) return request; max_buffer_index -= rsync->seg_len; if (! xdp_rsync_hash (rsync)) return NULL; g_assert (rsync->seg_len < handle_pagesize (file)); init_pos (file, &opos); init_pos (file, &npos); memset (&cksum, 0, sizeof (cksum)); prime = rsync->table_size; table = rsync->table; if (!map_page (file, &opos)) return NULL; init_long_checksum (opos.mem, rsync->seg_len, &cksum); npos.off += rsync->seg_len; for (; XPOS (opos) < max_buffer_index; ) { if (!map_page (file, &opos)) return FALSE; if (!map_page (file, &npos)) return FALSE; if (matched == rsync->index_len) break; thistime = MIN (opos.mem_rem - opos.off, npos.mem_rem - npos.off); o_pointer = opos.mem + opos.off; n_pointer = npos.mem + npos.off; for (; ; o_pointer += 1, n_pointer += 1) { index = c_hash (&cksum) % prime; if (table[index]) { gboolean md5_computed = FALSE; gboolean found = FALSE; guint8 md5[16]; SerialRsyncIndexElt* elt; for (elt = table[index]; elt; elt = elt->next) { if (elt->match_offset >= 0) continue; if (elt->cksum.high != cksum.high || elt->cksum.low != cksum.low) continue; if (! md5_computed) { EdsioMD5Ctx ctx; edsio_md5_init (& ctx); if (opos.page == npos.page) edsio_md5_update (& ctx, opos.mem + opos.off, rsync->seg_len); else { edsio_md5_update (& ctx, opos.mem + opos.off, opos.mem_rem - opos.off); edsio_md5_update (& ctx, npos.mem, rsync->seg_len - (opos.mem_rem - opos.off)); } edsio_md5_final (md5, & ctx); md5_computed = TRUE; } if (memcmp (md5, elt->md5, 16) == 0) { matched += 1; found = TRUE; elt->match_offset = XPOS (opos); } } if (found) { incr_by (&opos, rsync->seg_len); incr_by (&npos, rsync->seg_len); goto reenter; } } if (thistime == 0) goto nextpage; thistime -= 1; opos.off += 1; npos.off += 1; old_c = CHEW(*o_pointer); new_c = CHEW(*n_pointer); cksum.low -= old_c; cksum.low += new_c; cksum.high -= old_c * rsync->seg_len; cksum.high += cksum.low; } nextpage: FLIP_FORWARD (opos); FLIP_FORWARD (npos); reenter: (void) 0; } for (i = 0; i < rsync->index_len; i += 1) { SerialRsyncIndexElt* elt = rsync->index + i; if (elt->match_offset < 0) { #ifdef DEBUG_RSYNC_REQUEST g_print ("request segment %d\n", i); #endif g_array_append_val (request, i); } } return request; } gboolean xdp_apply_rsync_reply (XdeltaRsync *rsync, XdeltaStream *from, XdeltaStream *reply, XdeltaStream *out) { gint i; guint reply_offset = 0; for (i = 0; i < rsync->index_len; i += 1) { SerialRsyncIndexElt* elt = rsync->index + i; if (elt->match_offset >= 0) { if (! handle_copy (from, out, elt->match_offset, rsync->seg_len)) return FALSE; } else { if (! handle_copy (reply, out, reply_offset, rsync->seg_len)) return FALSE; reply_offset += rsync->seg_len; } } if (! handle_copy (reply, out, reply_offset, rsync->file_len % rsync->seg_len)) return FALSE; if (! handle_close (out, 0)) return FALSE; if (! check_stream_integrity (out, rsync->file_md5, rsync->file_len)) return FALSE; return TRUE; } xdelta-1.1.3/libedsio/0000777006517700007640000000000007353555417010373 5xdelta-1.1.3/libedsio/Makefile.in0000644006517700007640000002633307353555417012363 # Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ AS = @AS@ CC = @CC@ CPP = @CPP@ DLLTOOL = @DLLTOOL@ EMACS = @EMACS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ LD = @LD@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NM = @NM@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ top_srcdir_absolute = @top_srcdir_absolute@ INCLUDES = $(GLIB_CFLAGS) noinst_SCRIPTS = edsio-comp lib_LTLIBRARIES = libedsio.la noinst_PROGRAMS = edsiotest edsiotest_SOURCES = edsiotest.c edsiotest_LDADD = libedsio.la $(GLIB_LIBS) noinst_HEADERS = maketime.h partime.h include_HEADERS = edsio.h edsio_edsio.h libedsio_la_LIBADD = $(GLIB_LIBS) libedsio_la_SOURCES = library.c simple.c edsio.c edsio_edsio.c sha.c md5c.c fh.c generic.c default.c base64.c maketime.c partime.c EXTRA_DIST = edsio.el edsio.ser $(SER_OUT1) edsio-comp.in edsio.prj stamp-ser1 SER_OUT1 = edsio_edsio.c edsio_edsio.h BUILT_SOURCES = edsio_edsio.c mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = edsio-comp LTLIBRARIES = $(lib_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) -I.. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ libedsio_la_LDFLAGS = libedsio_la_DEPENDENCIES = libedsio_la_OBJECTS = library.lo simple.lo edsio.lo edsio_edsio.lo \ sha.lo md5c.lo fh.lo generic.lo default.lo base64.lo maketime.lo \ partime.lo PROGRAMS = $(noinst_PROGRAMS) edsiotest_OBJECTS = edsiotest.o edsiotest_DEPENDENCIES = libedsio.la edsiotest_LDFLAGS = SCRIPTS = $(noinst_SCRIPTS) CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ HEADERS = $(include_HEADERS) $(noinst_HEADERS) DIST_COMMON = Makefile.am Makefile.in edsio-comp.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(libedsio_la_SOURCES) $(edsiotest_SOURCES) OBJECTS = $(libedsio_la_OBJECTS) $(edsiotest_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .lo .o .s $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps libedsio/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status edsio-comp: $(top_builddir)/config.status edsio-comp.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-libLTLIBRARIES: clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) distclean-libLTLIBRARIES: maintainer-clean-libLTLIBRARIES: install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) list='$(lib_LTLIBRARIES)'; for p in $$list; do \ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ done .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: .c.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .s.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .S.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: maintainer-clean-libtool: libedsio.la: $(libedsio_la_OBJECTS) $(libedsio_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libedsio_la_LDFLAGS) $(libedsio_la_OBJECTS) $(libedsio_la_LIBADD) $(LIBS) mostlyclean-noinstPROGRAMS: clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) distclean-noinstPROGRAMS: maintainer-clean-noinstPROGRAMS: edsiotest: $(edsiotest_OBJECTS) $(edsiotest_DEPENDENCIES) @rm -f edsiotest $(LINK) $(edsiotest_LDFLAGS) $(edsiotest_OBJECTS) $(edsiotest_LDADD) $(LIBS) install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(includedir) @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) list='$(include_HEADERS)'; for p in $$list; do \ rm -f $(DESTDIR)$(includedir)/$$p; \ done tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = libedsio distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done base64.lo base64.o : base64.c edsio.h ../config.h edsio_edsio.h default.lo default.o : default.c edsio.h ../config.h edsio_edsio.h edsio.lo edsio.o : edsio.c edsio.h ../config.h edsio_edsio.h maketime.h edsio_edsio.lo edsio_edsio.o : edsio_edsio.c edsio.h ../config.h \ edsio_edsio.h edsiotest.o: edsiotest.c edsio.h ../config.h edsio_edsio.h fh.lo fh.o : fh.c edsio.h ../config.h edsio_edsio.h generic.lo generic.o : generic.c edsio.h ../config.h edsio_edsio.h library.lo library.o : library.c edsio.h ../config.h edsio_edsio.h maketime.lo maketime.o : maketime.c ../config.h partime.h maketime.h md5c.lo md5c.o : md5c.c edsio.h ../config.h edsio_edsio.h partime.lo partime.o : partime.c ../config.h partime.h sha.lo sha.o : sha.c edsio.h ../config.h edsio_edsio.h simple.lo simple.o : simple.c edsio.h ../config.h edsio_edsio.h info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-libLTLIBRARIES install-exec: install-exec-am install-data-am: install-includeHEADERS install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall-libLTLIBRARIES uninstall-includeHEADERS uninstall: uninstall-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ mostlyclean-libtool mostlyclean-noinstPROGRAMS \ mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-libLTLIBRARIES clean-compile clean-libtool \ clean-noinstPROGRAMS clean-tags clean-generic \ mostlyclean-am clean: clean-am distclean-am: distclean-libLTLIBRARIES distclean-compile \ distclean-libtool distclean-noinstPROGRAMS \ distclean-tags distclean-generic clean-am -rm -f libtool distclean: distclean-am maintainer-clean-am: maintainer-clean-libLTLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ maintainer-clean-noinstPROGRAMS maintainer-clean-tags \ maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ distclean-compile clean-compile maintainer-clean-compile \ mostlyclean-libtool distclean-libtool clean-libtool \ maintainer-clean-libtool mostlyclean-noinstPROGRAMS \ distclean-noinstPROGRAMS clean-noinstPROGRAMS \ maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \ install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ installcheck-am installcheck install-exec-am install-exec \ install-data-am install-data install-am install uninstall-am uninstall \ all-redirect all-am all installdirs mostlyclean-generic \ distclean-generic clean-generic maintainer-clean-generic clean \ mostlyclean distclean maintainer-clean # # Rules for the generated code # stamp-ser1: $(top_srcdir)/libedsio/edsio.el edsio.ser $(top_srcdir)/libedsio/edsio-comp edsio.ser touch stamp-ser1 $(SER_OUT1): stamp-ser1 # # # # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xdelta-1.1.3/libedsio/Makefile.am0000644006517700017500000000152507315315133012325 INCLUDES = $(GLIB_CFLAGS) noinst_SCRIPTS = edsio-comp lib_LTLIBRARIES = libedsio.la noinst_PROGRAMS = edsiotest edsiotest_SOURCES = edsiotest.c edsiotest_LDADD = libedsio.la $(GLIB_LIBS) noinst_HEADERS = maketime.h partime.h include_HEADERS = edsio.h edsio_edsio.h libedsio_la_LIBADD = $(GLIB_LIBS) libedsio_la_SOURCES = \ library.c \ simple.c \ edsio.c \ edsio_edsio.c \ sha.c \ md5c.c \ fh.c \ generic.c \ default.c \ base64.c \ maketime.c \ partime.c EXTRA_DIST = edsio.el edsio.ser $(SER_OUT1) edsio-comp.in edsio.prj stamp-ser1 # # Rules for the generated code # stamp-ser1: $(top_srcdir)/libedsio/edsio.el edsio.ser $(top_srcdir)/libedsio/edsio-comp edsio.ser touch stamp-ser1 SER_OUT1 = edsio_edsio.c edsio_edsio.h $(SER_OUT1): stamp-ser1 BUILT_SOURCES = edsio_edsio.c # # # xdelta-1.1.3/libedsio/edsio-comp.in0000644006517700017500000000255707317051224012666 #!/bin/sh # Derived from: # Copyright (C) 1995 Free Software Foundation, Inc. # François Pinard , 1995. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. EMACS=@EMACS@ TOP_SRCDIR=@top_srcdir_absolute@/libedsio SCRIPT=$TMPDIR/script.$$ trap "rm -f $SCRIPT" 0 if test $# != 1; then echo 1>&2 "usage: $0 INPUT" exit 1 else if test -z "$EMACS" || test "$EMACS" = "t"; then # Value of "t" means we are running in a shell under Emacs. # Just assume Emacs is called "emacs". EMACS=emacs fi INPUT=$1 INPUT_PREF=`echo $INPUT | sed 's/\.[^\.]*$//'` echo "(load-file \"$TOP_SRCDIR/edsio.el\") " \ "(generate-ser \"$INPUT\" \"$INPUT_PREF\")" > $SCRIPT $EMACS --batch -l $SCRIPT fi xdelta-1.1.3/libedsio/library.c0000644006517700017500000000444707311304631012104 /* -*-Mode: C;-*- * $Id: library.c 1.1 Tue, 06 Apr 1999 23:40:43 -0700 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #include "edsio.h" #include typedef struct _Library Library; struct _Library { const char* name; const char* libname; gint index; gboolean loaded; }; static Library known_libraries[] = { { "xd", "xdelta", 3 }, { "edsio", "edsio", 6 }, }; static GHashTable* loaded_libraries; static void edsio_library_init () { if (! loaded_libraries) { gint i; gint n = sizeof (known_libraries) / sizeof (Library);; loaded_libraries = g_hash_table_new (g_int_hash, g_int_equal); for (i = 0; i < n; i += 1) { Library* lib = known_libraries + i; g_hash_table_insert (loaded_libraries, & lib->index, lib); } } } void edsio_library_register (guint32 number, const char* name) { Library* lib; edsio_library_init (); lib = g_hash_table_lookup (loaded_libraries, & number); if (lib) { lib->loaded = TRUE; return; } lib = g_new0 (Library, 1); lib->index = number; lib->name = name; lib->loaded = TRUE; g_hash_table_insert (loaded_libraries, & lib->index, lib); } gboolean edsio_library_check (guint32 number) { Library* lib; edsio_library_init (); lib = g_hash_table_lookup (loaded_libraries, & number); if (lib) { lib->loaded = TRUE; return TRUE; } #if 0 if (lib->libname && g_module_supported ()) { GModule *module; GString *module_name = g_string_new (NULL); GString *symbol_name = g_string_new (NULL); gboolean (* init) (void); if (! (module = g_module_open (module_name->str, 0))) { edsio_generate_stringstring_event (EC_EdsioGModuleError, module_name->str, g_module_error ()); return FALSE; } if (! g_module_symbol (module, symbol_name->str, (void**) & init)) { edsio_generate_stringstring_event (EC_EdsioGModuleError, g_module_name (module), g_module_error ()); return FALSE; } g_module_make_resident (module); g_module_close (module); lib->loaded = TRUE; return (* init) (); } #endif edsio_generate_int_event (EC_EdsioUnregisteredLibrary, number); return FALSE; } xdelta-1.1.3/libedsio/simple.c0000644006517700017500000000730107311304631011721 /* -*-Mode: C;-*- * $Id: simple.c 1.6 Wed, 31 Mar 1999 17:39:58 -0800 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #include "edsio.h" /* Simple Source */ typedef struct _ByteArraySource ByteArraySource; struct _ByteArraySource { SerialSource source; const guint8* in_data; guint in_len; guint read_pos; guint flags; }; static gboolean byte_array_source_close (SerialSource* source); static gboolean byte_array_source_read (SerialSource* source, guint8 *ptr, guint32 len); static void byte_array_source_free (SerialSource* source); SerialSource* edsio_simple_source (const guint8* data, guint len, guint flags) { ByteArraySource* it = g_new0 (ByteArraySource, 1); SerialSource* src = (SerialSource*) it; serializeio_source_init (& it->source, NULL, byte_array_source_close, byte_array_source_read, byte_array_source_free, NULL, NULL); it->in_data = data; it->in_len = len; it->flags = flags; if (flags & SBF_Base64) src = serializeio_base64_source (src); if (flags & SBF_Checksum) src = serializeio_checksum_source (src); if (flags & SBF_Compress) src = serializeio_gzip_source (src); return src; } gboolean byte_array_source_close (SerialSource* source) { return TRUE; } gboolean byte_array_source_read (SerialSource* source, guint8 *buf, guint32 len) { ByteArraySource* ssource = (ByteArraySource*) source; if (len + ssource->read_pos > ssource->in_len) { edsio_generate_source_event (EC_EdsioSourceEof, source); return FALSE; } memcpy (buf, ssource->in_data + ssource->read_pos, len); ssource->read_pos += len; return TRUE; } void byte_array_source_free (SerialSource* source) { g_free (source); } /* BASE64 Sink */ typedef struct _ByteArraySink ByteArraySink; struct _ByteArraySink { SerialSink sink; GByteArray* out; gpointer data; guint flags; gboolean free_result; void (* success) (gpointer data, GByteArray* result); }; static gboolean byte_array_sink_close (SerialSink* sink); static gboolean byte_array_sink_write (SerialSink* sink, const guint8 *ptr, guint32 len); static void byte_array_sink_free (SerialSink* sink); SerialSink* edsio_simple_sink (gpointer data, guint flags, gboolean free_result, void (* success) (gpointer data, GByteArray* result), GByteArray **result) { ByteArraySink* it = g_new0 (ByteArraySink, 1); SerialSink* sink = (SerialSink*) it; serializeio_sink_init (&it->sink, NULL, byte_array_sink_close, byte_array_sink_write, byte_array_sink_free, NULL); it->data = data; it->out = g_byte_array_new (); it->flags = flags; it->free_result = free_result; it->success = success; if (result) (*result) = it->out; if (flags & SBF_Base64) sink = serializeio_base64_sink (sink); if (flags & SBF_Checksum) sink = serializeio_checksum_sink (sink); if (flags & SBF_Compress) sink = serializeio_gzip_sink (sink); return sink; } gboolean byte_array_sink_close (SerialSink* sink) { ByteArraySink* ssink = (ByteArraySink*) sink; if (ssink->success) ssink->success (ssink->data, ssink->out); return TRUE; } gboolean byte_array_sink_write (SerialSink* sink, const guint8 *ptr, guint32 len) { ByteArraySink* ssink = (ByteArraySink*) sink; g_byte_array_append (ssink->out, ptr, len); return TRUE; } void byte_array_sink_free (SerialSink* sink) { ByteArraySink* ssink = (ByteArraySink*) sink; if (ssink->out && ssink->free_result) g_byte_array_free (ssink->out, TRUE); g_free (sink); } xdelta-1.1.3/libedsio/edsio.c0000644006517700007640000007265307353553524011570 /* -*-Mode: C;-*- * $Id: edsio.c 1.24.1.1 Mon, 11 Jun 2001 01:56:01 -0700 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #include "edsio.h" #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include "maketime.h" /*#define DEBUG_PROPS*/ /* Event delivery */ static GHashTable* all_event_defs = NULL; static GPtrArray* all_event_watchers = NULL; typedef struct _ErrorDeliveryWatcher ErrorDeliveryWatcher; typedef struct _DelayedEvent DelayedEvent; struct _ErrorDeliveryWatcher { ErrorDeliveryFunc deliver; }; struct _DelayedEvent { GenericEvent ev; GenericEventDef *def; const char *msg; }; void eventdelivery_initialize_event_def (gint code, gint level, gint flags, const char* name, const char* oneline, const char * (* field_to_string) (GenericEvent* ev, gint field)) { GenericEventDef* def = g_new0 (GenericEventDef, 1); if (! all_event_defs) all_event_defs = g_hash_table_new (g_int_hash, g_int_equal); def->code = code; def->level = level; def->flags = flags; def->name = name; def->oneline = oneline; def->field_to_string = field_to_string; g_hash_table_insert (all_event_defs, & def->code, def); } void eventdelivery_event_watch_all (ErrorDeliveryFunc func) { ErrorDeliveryWatcher* w = g_new0 (ErrorDeliveryWatcher, 1); w->deliver = func; if (! all_event_watchers) all_event_watchers = g_ptr_array_new (); g_ptr_array_add (all_event_watchers, w); } GenericEventDef* eventdelivery_event_lookup (gint code) { return g_hash_table_lookup (all_event_defs, & code); } void eventdelivery_event_deliver (GenericEvent* e) { static gint in_call = FALSE; static GQueue* queued = NULL; static GPtrArray* free_strings = NULL; if (! queued) { queued = g_queue_new (); free_strings = g_ptr_array_new (); } in_call += 1; g_assert (e); edsio_edsio_init (); if (all_event_defs) { GenericEventDef* def = g_hash_table_lookup (all_event_defs, & e->code); if (def) { GString* out; const char* oneline = def->oneline; char c; out = g_string_new (NULL); while ((c = *oneline++)) { switch (c) { case '$': { const char* field; char *end; int f; if ((*oneline++) != '{') goto badevent; f = strtol (oneline, &end, 10); if (f < 0 || !end || end[0] != '}') goto badevent; oneline = end+1; g_assert (def->field_to_string); field = def->field_to_string (e, f); if (field) { g_string_append (out, field); g_free ((void*) field); } else goto badevent; } break; default: g_string_append_c (out, c); } } if (! all_event_watchers) { fprintf (stderr, "%s:%d: %s\n", e->srcfile, e->srcline, out->str); g_string_free (out, TRUE); } else if (in_call == 1) { gint i; for (i = 0; i < all_event_watchers->len; i += 1) { ErrorDeliveryWatcher* w = all_event_watchers->pdata[i]; if (! w->deliver (e, def, out->str)) { g_warning ("%s:%d: An error delivery routine failed: %s\n", e->srcfile, e->srcline, out->str); in_call = 0; return; } } while (g_queue_get_size (queued) > 0) { DelayedEvent* de = g_queue_pop (queued); for (i = 0; i < all_event_watchers->len; i += 1) { ErrorDeliveryWatcher* w = all_event_watchers->pdata[i]; if (! w->deliver (& de->ev, de->def, de->msg)) { g_warning ("%s:%d: An error delivery routine failed: %s\n", e->srcfile, e->srcline, out->str); in_call = 0; return; } } } for (i = 0; i < free_strings->len; i += 1) g_string_free (free_strings->pdata[i], TRUE); g_ptr_array_set_size (free_strings, 0); g_string_free (out, TRUE); } else { DelayedEvent* de = g_new (DelayedEvent, 1); de->ev = *e; de->def = def; de->msg = out->str; g_queue_push (queued, de); g_ptr_array_add (free_strings, out); } in_call -= 1; return; } } g_warning ("%s:%d: Unrecognized event delivered (code=%d)\n", e->srcfile, e->srcline, e->code); in_call -= 1; return; badevent: g_warning ("%s:%d: An malformed error could not print here (code=%d)\n", e->srcfile, e->srcline, e->code); in_call -= 1; return; } const char* eventdelivery_int_to_string (int x) { return g_strdup_printf ("%d", x); } const char* eventdelivery_string_to_string (const char* x) { return g_strdup (x); } const char* eventdelivery_source_to_string (SerialSource* x) { return g_strdup ("@@@SerialSource"); } const char* eventdelivery_sink_to_string (SerialSink* x) { return g_strdup ("@@@SerialSink"); } const char* eventdelivery_handle_to_string (FileHandle* x) { g_return_val_if_fail (x, g_strdup ("*error*")); return x->table->table_handle_name (x); } /* Misc crap. */ gboolean edsio_time_of_day (SerialGenericTime* setme) { #if HAVE_GETTIMEOFDAY struct timeval tv; if (gettimeofday (& tv, NULL)) { edsio_generate_errno_event (EC_EdsioGetTimeOfDayFailure); goto bail; } if (setme) { setme->nanos = tv.tv_usec * 1000; setme->seconds = tv.tv_sec; } #else struct timeval tv; time_t t = time (NULL); if (t < 0) { edsio_generate_errno_event (EC_EdsioTimeFailure); goto bail; } if (setme) { setme->nanos = 0; setme->seconds = tv.tv_sec; } #endif return TRUE; bail: setme->nanos = 0; setme->seconds = 10; return FALSE; } gchar* edsio_time_to_iso8601 (SerialGenericTime *tp) { return edsio_time_t_to_iso8601 (tp->seconds); } gchar* edsio_time_t_to_iso8601 (GTime t0) { static char timebuf[64]; time_t t = t0; struct tm lt = *localtime(&t); int utc_offset = difftm(<, gmtime(&t)); char sign = utc_offset < 0 ? '-' : '+'; int minutes = abs (utc_offset) / 60; int hours = minutes / 60; sprintf(timebuf, "%d-%02d-%02d %02d:%02d:%02d%c%02d%02d", lt.tm_year + 1900, lt.tm_mon + 1, lt.tm_mday, lt.tm_hour, lt.tm_min, lt.tm_sec, sign, hours, minutes % 60); return timebuf; } static gboolean strtosl_checked (const char* str, long* l, const char* errmsg) { char* end; (*l) = strtol (str, &end, 10); if (!end || end[0]) { if (errmsg) edsio_generate_stringstring_event (EC_EdsioInvalidIntegerString, errmsg, str); (*l) = 0; return FALSE; } return TRUE; } gboolean strtosi_checked (const char* str, gint32* i, const char* errmsg) { long l; if (! strtosl_checked (str, &l, errmsg)) { (*i) = 0; return FALSE; } if (l > G_MAXINT || l < G_MININT) { if (errmsg) edsio_generate_stringstring_event (EC_EdsioIntegerOutOfRange, errmsg, str); (*i) = 0; return FALSE; } (*i) = l; return TRUE; } gboolean strtoss_checked (const char* str, gint16* i, const char* errmsg) { long l; if (! strtosl_checked (str, &l, errmsg)) { (*i) = 0; return FALSE; } if (l > G_MAXSHORT || l < G_MINSHORT) { if (errmsg) edsio_generate_stringstring_event (EC_EdsioIntegerOutOfRange, errmsg, str); (*i) = 0; return FALSE; } (*i) = l; return TRUE; } gboolean strtoui_checked (const char* str, guint32* i, const char* errmsg) { long l; if (! strtosl_checked (str, &l, errmsg)) { (*i) = 0; return FALSE; } if (l < 0) { if (errmsg) edsio_generate_stringstring_event (EC_EdsioInvalidIntegerSign, errmsg, str); (*i) = 0; return FALSE; } (*i) = l; if (l != (*i)) { if (errmsg) edsio_generate_stringstring_event (EC_EdsioIntegerOutOfRange, errmsg, str); (*i) = 0; return FALSE; } return TRUE; } gboolean strtous_checked (const char* str, guint16* i, const char* errmsg) { long l; if (! strtosl_checked (str, &l, errmsg)) { (*i) = 0; return FALSE; } if (l < 0) { if (errmsg) edsio_generate_stringstring_event (EC_EdsioInvalidIntegerSign, errmsg, str); (*i) = 0; return FALSE; } (*i) = l; if (l != (*i)) { if (errmsg) edsio_generate_stringstring_event (EC_EdsioIntegerOutOfRange, errmsg, str); (*i) = 0; return FALSE; } return TRUE; } gint edsio_md5_equal (gconstpointer v, gconstpointer v2) { return memcmp (v, v2, 16) == 0; } guint edsio_md5_hash (gconstpointer v) { guint8* md5 = (guint8*) v; guint x = 0; gint i, j; for (i = 0, j = 0; i < 16; i += 1, j += 1, j %= sizeof (guint)) x ^= md5[i] << (8*j); return x; } void serializeio_print_bytes (const guint8* bytes, guint len0) { char buf[100]; int i; guint len; len = MIN (len0, 32); for (i = 0; i < len; i += 1) sprintf (buf + 2*i, "%02x", bytes[i]); if (len0 > len) strcat (buf, "..."); g_print ("%s\n", buf); } void edsio_md5_to_string (const guint8* md5, char buf[33]) { gint i; for (i = 0; i < 16; i += 1) sprintf (buf + 2*i, "%02x", md5[i]); } static gboolean from_hex (char c, int* x, const char* ctx) { char buf[2]; if (c >= '0' && c <= '9') { (*x) = c - '0'; return TRUE; } else if (c >= 'A' && c <= 'F') { (*x) = c - 'A' + 10; return TRUE; } else if (c >= 'a' && c <= 'f') { (*x) = c - 'a' + 10; return TRUE; } buf[0] = c; buf[1] = 0; edsio_generate_stringstring_event (EC_EdsioInvalidHexDigit, buf, ctx); return FALSE; } gboolean edsio_md5_from_string (guint8* md5, const char buf[33]) { gint i; gint l = strlen (buf); if (l < 32) { edsio_generate_string_event (EC_EdsioMD5StringShort, buf); return FALSE; } else if (l > 32) { edsio_generate_string_event (EC_EdsioMD5StringLong, buf); return FALSE; } for (i = 0; i < 16; i += 1) { char c1 = buf[(2*i)]; char c2 = buf[(2*i)+1]; int x1, x2; if (! from_hex (c1, &x1, buf)) return FALSE; if (! from_hex (c2, &x2, buf)) return FALSE; md5[i] = (x1 << 4) | x2; } return TRUE; } /* Strings */ const char* edsio_intern_string (const char* str) { static GStringChunk* chunk = NULL; if (! chunk) chunk = g_string_chunk_new (256); return g_string_chunk_insert_const (chunk, str); } /* Properties */ typedef struct _EdsioHostType EdsioHostType; typedef struct _EdsioPropertyType EdsioPropertyType; struct _EdsioPropertyType { const char *type_name; PropFreeFunc freer; PropGSFunc getter; PropGSFunc setter; PropSerialize serialize; PropUnserialize unserialize; }; struct _EdsioHostType { const char *host_name; PropertyTableFunc ptable; PersistSourceFunc source; PersistSinkFunc sink; PersistIssetFunc isset; PersistUnsetFunc unset; }; struct _EdsioProperty { guint32 prop_code; const char *prop_name; guint32 prop_flags; EdsioPropertyType *type; EdsioHostType *host; }; union _EdsioPropertyEntry { guint32 as_uint32; SerialEdsioBytes as_bytes; gpointer as_vptr; const char* as_string; }; struct _EdsioGenericProperty { guint32 code; }; static GHashTable* all_property_types = NULL; static GHashTable* all_host_types = NULL; static GHashTable* all_properties = NULL; static GHashTable* all_property_codes = NULL; static guint32 property_code_sequence = 0; void edsio_initialize_property_type (const char* t, PropFreeFunc freer, PropGSFunc getter, PropGSFunc setter, PropSerialize ser, PropUnserialize unser) { EdsioPropertyType* type; t = edsio_intern_string (t); if (! all_property_types) all_property_types = g_hash_table_new (g_direct_hash, g_direct_equal); if ((type = g_hash_table_lookup (all_property_types, t)) != NULL) { if (getter != type->getter || setter != type->setter || ser != type->serialize || unser != type->unserialize) edsio_generate_string_event (EC_EdsioDuplicatePropertyTypeRegistered, t); return; } type = g_new0 (EdsioPropertyType, 1); type->type_name = t; type->freer = freer; type->getter = getter; type->setter = setter; type->serialize = ser; type->unserialize = unser; g_hash_table_insert (all_property_types, (gpointer) t, type); } void edsio_initialize_host_type (const char* ph, PropertyTableFunc ptable, PersistSourceFunc source, PersistSinkFunc sink, PersistIssetFunc isset, PersistUnsetFunc unset) { EdsioHostType* host; ph = edsio_intern_string (ph); if (! all_host_types) all_host_types = g_hash_table_new (g_direct_hash, g_direct_equal); if (g_hash_table_lookup (all_host_types, ph)) { edsio_generate_string_event (EC_EdsioDuplicateHostTypeRegistered, ph); return; } host = g_new0 (EdsioHostType, 1); host->host_name = ph; host->ptable = ptable; host->source = source; host->sink = sink; host->isset = isset; host->unset = unset; g_hash_table_insert (all_host_types, (gpointer) ph, host); } gboolean edsio_new_property (const char* name, const char* ph, const char* t, guint32 flags, EdsioGenericProperty *ret_prop) { EdsioProperty* prop; EdsioPropertyType* type; EdsioHostType* host; name = edsio_intern_string (name); ph = edsio_intern_string (ph); t = edsio_intern_string (t); g_assert (all_property_types); if (! all_properties) { all_properties = g_hash_table_new (g_direct_hash, g_direct_equal); all_property_codes = g_hash_table_new (g_int_hash, g_int_equal); } if ((prop = g_hash_table_lookup (all_properties, name)) != NULL) { edsio_generate_string_event (EC_EdsioDuplicatePropertyNameRegistered, name); ret_prop->code = prop->prop_code; return TRUE; } if ((type = g_hash_table_lookup (all_property_types, t)) == NULL) { edsio_generate_string_event (EC_EdsioNoSuchPropertyType, t); return FALSE; } if ((host = g_hash_table_lookup (all_host_types, ph)) == NULL) { edsio_generate_string_event (EC_EdsioNoSuchHostType, ph); return FALSE; } if (flags & PF_Persistent && ! host->isset) { edsio_generate_stringstring_event (EC_EdsioPersistenceUnavailable, name, ph); return FALSE; } prop = g_new0 (EdsioProperty, 1); prop->prop_code = ++property_code_sequence; prop->prop_name = name; prop->prop_flags = flags; prop->type = type; prop->host = host; g_hash_table_insert (all_properties, (gpointer) name, prop); g_hash_table_insert (all_property_codes, & prop->prop_code, prop); ret_prop->code = prop->prop_code; return TRUE; } static EdsioProperty* edsio_property_find (const char* ph, const char* t, guint32 code) { EdsioProperty* prop; ph = edsio_intern_string (ph); t = edsio_intern_string (t); if (code <= 0 || code > property_code_sequence) { edsio_generate_int_event (EC_EdsioNoSuchProperty, code); return NULL; } if (! (prop = g_hash_table_lookup (all_property_codes, & code))) { edsio_generate_int_event (EC_EdsioNoSuchProperty, code); return NULL; } if (prop->host->host_name != ph) { edsio_generate_stringstringstring_event (EC_EdsioWrongHostType, prop->prop_name, ph, prop->host->host_name); return NULL; } if (prop->type->type_name != t) { edsio_generate_stringstringstring_event (EC_EdsioWrongDataType, prop->prop_name, t, prop->type->type_name); return NULL; } return prop; } EdsioPropertyEntry* edsio_property_get (gpointer obj, EdsioProperty* prop) { EdsioPropertyEntry* ent; GHashTable* table = * prop->host->ptable (obj); gboolean persist = prop->prop_flags & PF_Persistent; #ifdef DEBUG_PROPS g_print ("get %p.%s\n", obj, prop->prop_name); #endif if (table && (ent = g_hash_table_lookup (table, & prop->prop_code)) != NULL) return ent; if (persist) { SerialSource* src; if (! (src = prop->host->source (obj, prop->prop_name))) return NULL; g_assert (prop->type->unserialize); if (! prop->type->unserialize (src, & ent)) return NULL; g_assert (ent); if (! src->source_close (src)) return NULL; src->source_free (src); if (! table) table = (* prop->host->ptable (obj)) = g_hash_table_new (g_int_hash, g_int_equal); g_hash_table_insert (table, & prop->prop_code, ent); return ent; } edsio_generate_string_event (EC_EdsioPropertyNotSet, prop->prop_name); return NULL; } gboolean edsio_property_set (gpointer obj, EdsioProperty* prop, EdsioPropertyEntry* set) { EdsioPropertyEntry* ent; gboolean persist = prop->prop_flags & PF_Persistent; GHashTable* table = * prop->host->ptable (obj); #ifdef DEBUG_PROPS g_print ("set %p.%s\n", obj, prop->prop_name); #endif if (! table) table = (* prop->host->ptable (obj)) = g_hash_table_new (g_int_hash, g_int_equal); ent = g_hash_table_lookup (table, & prop->prop_code); if (ent) { g_hash_table_remove (table, & prop->prop_code); prop->type->freer (ent); } g_hash_table_insert (table, & prop->prop_code, set); if (persist) { SerialSink* sink; if (! (sink = prop->host->sink (obj, prop->prop_name))) return FALSE; g_assert (prop->type->serialize); if (! prop->type->serialize (sink, set)) return FALSE; if (! sink->sink_close (sink)) return FALSE; sink->sink_free (sink); } return TRUE; } gboolean edsio_property_isset (const char* ph, const char* t, guint32 code, gpointer obj) { EdsioProperty* prop; GHashTable* table; gboolean persist; gboolean result = FALSE; if (! (prop = edsio_property_find (ph, t, code))) goto done; persist = prop->prop_flags & PF_Persistent; table = * prop->host->ptable (obj); if (persist) { PersistIssetFunc issetfunc = prop->host->isset; if (issetfunc(obj, prop->prop_name)) { if (! edsio_property_get (obj, prop)) goto done; table = * prop->host->ptable (obj); } } if (! table) goto done; result = (g_hash_table_lookup (table, & code) != NULL); done: #ifdef DEBUG_PROPS g_print ("isset %p.%s = %s\n", obj, prop->prop_name, result ? "true" : "false"); #endif return result; } gboolean edsio_property_unset (const char* ph, const char* t, guint32 code, gpointer obj) { EdsioProperty* prop; gboolean persist; GHashTable* table; if (! (prop = edsio_property_find (ph, t, code))) return FALSE; #ifdef DEBUG_PROPS g_print ("unset %p.%s\n", obj, prop->prop_name); #endif persist = prop->prop_flags & PF_Persistent; table = * prop->host->ptable (obj); if (table) { EdsioPropertyEntry* ent; ent = g_hash_table_lookup (table, & code); g_hash_table_remove (table, & code); if (g_hash_table_size (table) == 0) { g_hash_table_destroy (table); table = (* prop->host->ptable (obj)) = NULL; } /*g_free (ent);*/ } if (persist) { if (! prop->host->unset (obj, prop->prop_name)) return FALSE; } return TRUE; } static gboolean edsio_false () { return FALSE; } PropGSFunc edsio_property_getter (const char* ph, const char* t, guint32 code, EdsioProperty** ep) { if (! ((*ep) = edsio_property_find (ph, t, code))) return & edsio_false; return (* ep)->type->getter; } PropGSFunc edsio_property_setter (const char* ph, const char* t, guint32 code, EdsioProperty** ep) { if (! ((* ep) = edsio_property_find (ph, t, code))) return & edsio_false; return (* ep)->type->setter; } /* Primitive type serializers */ /* integer */ gboolean edsio_property_uint_getter (gpointer obj, EdsioProperty* prop, guint32* get) { EdsioPropertyEntry *ent; if (! (ent = edsio_property_get (obj, prop))) return FALSE; (*get) = ent->as_uint32; return TRUE; } gboolean edsio_property_uint_setter (gpointer obj, EdsioProperty* prop, guint32 set) { EdsioPropertyEntry *ent = g_new (EdsioPropertyEntry, 1); ent->as_uint32 = set; return edsio_property_set (obj, prop, ent); } void edsio_property_uint_free (gpointer obj) { g_free (obj); } gboolean unserialize_uint (SerialSource *source, guint32** x) { SerialEdsioUint *s; guint32 *n; if (! unserialize_edsiouint (source, & s)) return FALSE; n = g_new (guint32, 1); (* x) = n; (* n) = s->val; g_free (s); return TRUE; } gboolean serialize_uint_obj (SerialSink *sink, guint32* x) { return serialize_edsiouint (sink, *x); } /* String */ void edsio_property_string_free (gpointer obj) { g_free (obj); } gboolean edsio_property_string_getter (gpointer obj, EdsioProperty* prop, const char** get) { if (! ((*get) = (const char*) edsio_property_get (obj, prop))) return FALSE; return TRUE; } gboolean edsio_property_string_setter (gpointer obj, EdsioProperty* prop, const char* set) { return edsio_property_set (obj, prop, (EdsioPropertyEntry*) set); } gboolean unserialize_string (SerialSource *source, const char** x) { SerialEdsioString *s; if (! unserialize_edsiostring (source, & s)) return FALSE; (*x) = g_strdup (s->val); g_free (s); return TRUE; } gboolean serialize_string_obj (SerialSink *sink, const char* x) { return serialize_edsiostring (sink, x); } /* Bytes */ gboolean unserialize_bytes (SerialSource *source, SerialEdsioBytes** x) { return unserialize_edsiobytes (source, x); } gboolean serialize_bytes_obj (SerialSink *sink, SerialEdsioBytes *x) { return serialize_edsiobytes_obj (sink, x); } gboolean edsio_property_bytes_getter (gpointer obj, EdsioProperty* prop, guint8** get, guint32* get_len) { EdsioPropertyEntry *ent; if (! (ent = edsio_property_get (obj, prop))) return FALSE; (* get) = (gpointer) ent->as_bytes.val; (* get_len) = ent->as_bytes.val_len; return TRUE; } gboolean edsio_property_bytes_setter (gpointer obj, EdsioProperty* prop, guint8* set, guint32 set_len) { EdsioPropertyEntry *ent = g_new (EdsioPropertyEntry, 1); ent->as_bytes.val = set; ent->as_bytes.val_len = set_len; return edsio_property_set (obj, prop, ent); } void edsio_property_bytes_free (gpointer obj) { g_free (obj); } /* Vptr */ gboolean edsio_property_vptr_getter (gpointer obj, EdsioProperty* prop, void** get) { if (! ((*get) = edsio_property_get (obj, prop))) return FALSE; return TRUE; } gboolean edsio_property_vptr_setter (gpointer obj, EdsioProperty* prop, void* set) { return edsio_property_set (obj, prop, (EdsioPropertyEntry*) set); } void edsio_property_vptr_free (gpointer obj) { /* nothing */ } /* Testing */ #ifdef DEBUG_LIBEDSIO GHashTable** edsio_proptest_property_table (PropTest *pt) { return & pt->_edsio_property_table; } SerialSource* edsio_persist_proptest_source (PropTest *pt, const char* prop_name) { GByteArray* array; if (! pt->ptable) { g_warning ("can't get persist property, no table\n"); return NULL; } if (! (array = g_hash_table_lookup (pt->ptable, prop_name))) { g_warning ("can't lookup persist property\n"); return NULL; } return edsio_simple_source (array->data, array->len, SBF_None); } static void pt_success (gpointer data, GByteArray* result) { PropTest* pt = data; GByteArray* old; if (! pt->ptable) pt->ptable = g_hash_table_new (g_str_hash, g_str_equal); old = g_hash_table_lookup (pt->ptable, (gpointer) pt->kludge); if (old) g_byte_array_free (old, TRUE); g_hash_table_insert (pt->ptable, (gpointer) pt->kludge, result); } SerialSink* edsio_persist_proptest_sink (PropTest *pt, const char* prop_name) { pt->kludge = prop_name; return edsio_simple_sink (pt, SBF_None, FALSE, pt_success, NULL); } gboolean edsio_persist_proptest_isset (PropTest *pt, const char* prop_name) { if (! pt->ptable) return FALSE; return g_hash_table_lookup (pt->ptable, prop_name) != NULL; } gboolean edsio_persist_proptest_unset (PropTest *pt, const char* prop_name) { GByteArray* old; if (! pt->ptable) return FALSE; old = g_hash_table_lookup (pt->ptable, prop_name); if (old) { g_byte_array_free (old, TRUE); g_hash_table_remove (pt->ptable, prop_name); return TRUE; } return FALSE; } #endif /* Misc source/sink stuff */ SerialSink* serializeio_gzip_sink (SerialSink* sink) { /* @@@ not implemented */ return sink; } SerialSource* serializeio_gzip_source (SerialSource* source) { /* @@@ not implemented */ return source; } /* Checksum sink */ typedef struct _ChecksumSink ChecksumSink; static gboolean checksum_sink_close (SerialSink* sink); static gboolean checksum_sink_write (SerialSink* sink, const guint8 *ptr, guint32 len); static void checksum_sink_free (SerialSink* sink); static gboolean checksum_sink_quantum (SerialSink* sink); struct _ChecksumSink { SerialSink sink; SerialSink* out; EdsioMD5Ctx ctx; guint8 md5[16]; gboolean md5_done; gboolean md5_written; }; SerialSink* serializeio_checksum_sink (SerialSink* out) { ChecksumSink* it = g_new0 (ChecksumSink, 1); SerialSink* sink = (SerialSink*) it; serializeio_sink_init (sink, NULL, checksum_sink_close, checksum_sink_write, checksum_sink_free, checksum_sink_quantum); it->out = out; edsio_md5_init (& it->ctx); return sink; } gboolean checksum_sink_write (SerialSink* fsink, const guint8 *ptr, guint32 len) { ChecksumSink* sink = (ChecksumSink*) fsink; if (! sink->out->sink_write (sink->out, ptr, len)) return FALSE; edsio_md5_update (& sink->ctx, ptr, len); return TRUE; } gboolean checksum_sink_close (SerialSink* fsink) { ChecksumSink* sink = (ChecksumSink*) fsink; if (! sink->md5_done) { edsio_md5_final (sink->md5, & sink->ctx); sink->md5_done = TRUE; } if (! sink->out->sink_write (sink->out, sink->md5, 16)) return FALSE; if (! sink->out->sink_close (sink->out)) return FALSE; return TRUE; } void checksum_sink_free (SerialSink* fsink) { ChecksumSink* sink = (ChecksumSink*) fsink; sink->out->sink_free (sink->out); g_free (sink); } gboolean checksum_sink_quantum (SerialSink* fsink) { ChecksumSink* sink = (ChecksumSink*) fsink; if (sink->out->sink_quantum) return sink->out->sink_quantum (sink->out); return TRUE; } /* Checksum source */ typedef struct _ChecksumSource ChecksumSource; struct _ChecksumSource { SerialSource source; SerialSource *in; EdsioMD5Ctx ctx; }; static gboolean checksum_source_close (SerialSource* source); static gboolean checksum_source_read (SerialSource* source, guint8 *ptr, guint32 len); static void checksum_source_free (SerialSource* source); SerialSource* serializeio_checksum_source (SerialSource* in0) { ChecksumSource* it = g_new0 (ChecksumSource, 1); SerialSource* source = (SerialSource*) it; serializeio_source_init (source, NULL, checksum_source_close, checksum_source_read, checksum_source_free, NULL, NULL); it->in = in0; edsio_md5_init (& it->ctx); return source; } gboolean checksum_source_close (SerialSource* fsource) { ChecksumSource* source = (ChecksumSource*) fsource; guint8 buf1[16]; guint8 buf2[16]; if (! source->in->source_read (source->in, buf1, 16)) return FALSE; edsio_md5_final (buf2, & source->ctx); if (memcmp (buf1, buf2, 16) != 0) { edsio_generate_void_event (EC_EdsioInvalidStreamChecksum); return FALSE; } if (! source->in->source_close (source->in)) return FALSE; return TRUE; } gboolean checksum_source_read (SerialSource* fsource, guint8 *ptr, guint32 len) { ChecksumSource* source = (ChecksumSource*) fsource; if (! source->in->source_read (source->in, ptr, len)) return FALSE; edsio_md5_update (& source->ctx, ptr, len); return TRUE; } void checksum_source_free (SerialSource* fsource) { ChecksumSource* source = (ChecksumSource*) fsource; source->in->source_free (source->in); g_free (source); } /* Missing glib stuff */ GQueue * g_queue_new (void) { GQueue *q = g_new (GQueue, 1); q->list = q->list_end = NULL; q->list_size = 0; return q; } void g_queue_free (GQueue *q) { if (q) { if (q->list) g_list_free (q->list); g_free (q); } } guint g_queue_get_size (GQueue *q) { return (q == NULL) ? 0 : q->list_size; } void g_queue_push_front (GQueue *q, gpointer data) { if (q) { q->list = g_list_prepend (q->list, data); if (q->list_end == NULL) q->list_end = q->list; q->list_size++; } } void g_queue_push_back (GQueue *q, gpointer data) { if (q) { q->list_end = g_list_append (q->list_end, data); if (! q->list) q->list = q->list_end; else q->list_end = q->list_end->next; q->list_size++; } } gpointer g_queue_pop_front (GQueue *q) { gpointer data = NULL; if ((q) && (q->list)) { GList *node; node = q->list; data = node->data; if (! node->next) { q->list = q->list_end = NULL; q->list_size = 0; } else { q->list = node->next; q->list->prev = NULL; q->list_size--; } g_list_free_1 (node); } return data; } gpointer g_queue_pop_back (GQueue *q) { gpointer data = NULL; if ((q) && (q->list)) { GList *node; node = q->list_end; data = node->data; if (! node->prev) { q->list = q->list_end = NULL; q->list_size = 0; } else { q->list_end = node->prev; q->list_end->next = NULL; q->list_size--; } g_list_free_1 (node); } return data; } xdelta-1.1.3/libedsio/edsio_edsio.c0000644006517700017500000007505507311305144012731 /* -*-Mode: C;-*- * Copyright (C) 1997, 1998, 1999 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * This file was AUTOMATICALLY GENERATED using: * * $Id: edsio.el 1.16 Tue, 06 Apr 1999 23:40:10 -0700 jmacd $ */ #include "edsio.h" #include /* Declarations. */ static const char* Edsio_StringStringString_event_field_to_string (GenericEvent* ev, gint field); static const char* Edsio_Int_event_field_to_string (GenericEvent* ev, gint field); static const char* Edsio_String_event_field_to_string (GenericEvent* ev, gint field); static const char* Edsio_StringString_event_field_to_string (GenericEvent* ev, gint field); static const char* Edsio_Source_event_field_to_string (GenericEvent* ev, gint field); static const char* Edsio_IntInt_event_field_to_string (GenericEvent* ev, gint field); static const char* Edsio_Errno_event_field_to_string (GenericEvent* ev, gint field); static void print_spaces (guint n) { int i; for (i = 0; i < n; i += 1) g_print (" "); } /* initialize this library. */ gboolean edsio_edsio_init (void) { static gboolean once = FALSE; static gboolean result = FALSE; if (once) return result; once = TRUE; eventdelivery_initialize_event_def (EC_EdsioGModuleErrorValue, EL_Error, EF_None, "GModuleError", "GModule: ${0}: ${1}", & Edsio_StringString_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioUnregisteredLibraryValue, EL_Error, EF_None, "UnregisteredLibrary", "Unregistered library: ${0}", & Edsio_Int_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioMD5StringLongValue, EL_Error, EF_None, "MD5StringLong", "MD5 string too long: ${0}", & Edsio_String_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioMD5StringShortValue, EL_Error, EF_None, "MD5StringShort", "MD5 string too short: ${0}", & Edsio_String_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioInvalidHexDigitValue, EL_Error, EF_None, "InvalidHexDigit", "Invalid hex digit ${0} in context: ${1}", & Edsio_StringString_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioInvalidStreamChecksumValue, EL_Error, EF_None, "InvalidStreamChecksum", "Incorrect stream checksum", NULL); eventdelivery_initialize_event_def (EC_EdsioPersistenceUnavailableValue, EL_Error, EF_None, "PersistenceUnavailable", "Persistence is unavailable in host ${1} for property ${0}", & Edsio_StringString_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioPropertyNotSetValue, EL_Error, EF_None, "PropertyNotSet", "${0} property not set", & Edsio_String_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioWrongDataTypeValue, EL_Error, EF_None, "WrongDataType", "Wrong property data type: received ${1}, expected ${2}", & Edsio_StringStringString_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioWrongHostTypeValue, EL_Error, EF_None, "WrongHostType", "Wrong property host type: received ${1}, expected ${2}", & Edsio_StringStringString_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioNoSuchHostTypeValue, EL_Error, EF_None, "NoSuchHostType", "Unregistered host type: ${0}", & Edsio_String_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioNoSuchPropertyTypeValue, EL_Error, EF_None, "NoSuchPropertyType", "Unregistered property type: ${0}", & Edsio_String_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioNoSuchPropertyValue, EL_Error, EF_None, "NoSuchProperty", "Unregistered property: ${0}", & Edsio_Int_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioDuplicatePropertyNameRegisteredValue, EL_Warning, EF_None, "DuplicatePropertyNameRegistered", "Property name registered twice (ignored): ${0}", & Edsio_String_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioDuplicateHostTypeRegisteredValue, EL_Error, EF_None, "DuplicateHostTypeRegistered", "Property host registered twice: ${0}", & Edsio_String_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioDuplicatePropertyTypeRegisteredValue, EL_Error, EF_None, "DuplicatePropertyTypeRegistered", "Property type registered twice: ${0}", & Edsio_String_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioInvalidIntegerSignValue, EL_Error, EF_None, "InvalidIntegerSign", "${0}: expected an unsigned integer: ${1}", & Edsio_StringString_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioIntegerOutOfRangeValue, EL_Error, EF_None, "IntegerOutOfRange", "${0}: integer out of range: ${1}", & Edsio_StringString_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioInvalidIntegerStringValue, EL_Error, EF_None, "InvalidIntegerString", "${0}: not an integer: ${1}", & Edsio_StringString_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioIncorrectAllocationValue, EL_Error, EF_None, "IncorrectAllocation", "${0}: Incorrect allocation", & Edsio_Source_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioSourceEofValue, EL_Error, EF_None, "SourceEof", "${0}: Unexpected EOF", & Edsio_Source_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioInvalidChecksumValue, EL_Error, EF_None, "InvalidChecksum", "Checksum verification failed", NULL); eventdelivery_initialize_event_def (EC_EdsioMissingChecksumValue, EL_Error, EF_None, "MissingChecksum", "Missing embedded checksum in base64 encoding", NULL); eventdelivery_initialize_event_def (EC_EdsioInvalidBase64EncodingValue, EL_Error, EF_None, "InvalidBase64Encoding", "Invalid base64 encoding", NULL); eventdelivery_initialize_event_def (EC_EdsioOutputBufferShortValue, EL_Error, EF_None, "OutputBufferShort", "Output buffer is too short", NULL); eventdelivery_initialize_event_def (EC_EdsioUnexpectedTypeValue, EL_Error, EF_None, "UnexpectedType", "Unexpected serial type", NULL); eventdelivery_initialize_event_def (EC_EdsioUnexpectedLibraryTypeValue, EL_Error, EF_None, "UnexpectedLibraryType", "Unexpected serial library type: expected ${0}, received ${1}", & Edsio_IntInt_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioUnregisteredTypeValue, EL_Error, EF_None, "UnregisteredType", "Unregistered serial type: library=${0} number=${1}", & Edsio_IntInt_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioTimeFailureValue, EL_Error, EF_None, "TimeFailure", "Time failed: ${0}", & Edsio_Errno_event_field_to_string); eventdelivery_initialize_event_def (EC_EdsioGetTimeOfDayFailureValue, EL_Error, EF_None, "GetTimeOfDayFailure", "Gettimeofday failed: ${0}", & Edsio_Errno_event_field_to_string); serializeio_initialize_type ("ST_GenericTime", ST_GenericTime, &unserialize_generictime_internal, &serialize_generictime_obj_internal, &serializeio_count_generictime_obj, &serializeio_print_generictime_obj); serializeio_initialize_type ("ST_EdsioString", ST_EdsioString, &unserialize_edsiostring_internal, &serialize_edsiostring_obj_internal, &serializeio_count_edsiostring_obj, &serializeio_print_edsiostring_obj); serializeio_initialize_type ("ST_EdsioBytes", ST_EdsioBytes, &unserialize_edsiobytes_internal, &serialize_edsiobytes_obj_internal, &serializeio_count_edsiobytes_obj, &serializeio_print_edsiobytes_obj); serializeio_initialize_type ("ST_EdsioUint", ST_EdsioUint, &unserialize_edsiouint_internal, &serialize_edsiouint_obj_internal, &serializeio_count_edsiouint_obj, &serializeio_print_edsiouint_obj); edsio_initialize_host_type ("PropTest", (PropertyTableFunc) & edsio_proptest_property_table, (PersistSourceFunc) & edsio_persist_proptest_source, (PersistSinkFunc) & edsio_persist_proptest_sink, (PersistIssetFunc) & edsio_persist_proptest_isset, (PersistUnsetFunc) & edsio_persist_proptest_unset); edsio_initialize_property_type ("EdsioUint", & edsio_property_vptr_free, & edsio_property_vptr_getter, & edsio_property_vptr_setter, serialize_edsiouint_obj, unserialize_edsiouint); edsio_initialize_property_type ("string", & edsio_property_string_free, & edsio_property_string_getter, & edsio_property_string_setter, serialize_string_obj, unserialize_string); edsio_initialize_property_type ("bytes", & edsio_property_bytes_free, & edsio_property_bytes_getter, & edsio_property_bytes_setter, serialize_bytes_obj, unserialize_bytes); edsio_initialize_property_type ("uint", & edsio_property_uint_free, & edsio_property_uint_getter, & edsio_property_uint_setter, serialize_uint_obj, unserialize_uint); edsio_library_register (6, "edsio"); result = TRUE; return TRUE; }; gboolean edsio_new_proptest_edsiouint_property (const char* name, guint32 flags, EdsioPropTestEdsioUintProperty* prop) { return edsio_new_property (name, "PropTest", "EdsioUint", flags, (EdsioGenericProperty*) prop); } gboolean proptest_get_edsiouint (PropTest* obj, EdsioPropTestEdsioUintProperty prop, SerialEdsioUint** arg) { EdsioProperty* ep; g_return_val_if_fail (obj, FALSE); return (* edsio_property_getter ("PropTest", "EdsioUint", prop.code, & ep)) (obj, ep, arg); } gboolean proptest_set_edsiouint (PropTest* obj, EdsioPropTestEdsioUintProperty prop, SerialEdsioUint* arg) { EdsioProperty* ep; g_return_val_if_fail (obj, FALSE); return (* edsio_property_setter ("PropTest", "EdsioUint", prop.code, & ep)) (obj, ep, arg); } gboolean proptest_unset_edsiouint (PropTest* obj, EdsioPropTestEdsioUintProperty prop) { g_return_val_if_fail (obj, FALSE); return edsio_property_unset ("PropTest", "EdsioUint", prop.code, obj); } gboolean proptest_isset_edsiouint (PropTest* obj, EdsioPropTestEdsioUintProperty prop) { g_return_val_if_fail (obj, FALSE); return edsio_property_isset ("PropTest", "EdsioUint", prop.code, obj); } gboolean edsio_new_proptest_string_property (const char* name, guint32 flags, EdsioPropTestStringProperty* prop) { return edsio_new_property (name, "PropTest", "string", flags, (EdsioGenericProperty*) prop); } gboolean proptest_get_string (PropTest* obj, EdsioPropTestStringProperty prop, const gchar** arg) { EdsioProperty* ep; g_return_val_if_fail (obj, FALSE); return (* edsio_property_getter ("PropTest", "string", prop.code, & ep)) (obj, ep, arg); } gboolean proptest_set_string (PropTest* obj, EdsioPropTestStringProperty prop, const gchar* arg) { EdsioProperty* ep; g_return_val_if_fail (obj, FALSE); return (* edsio_property_setter ("PropTest", "string", prop.code, & ep)) (obj, ep, arg); } gboolean proptest_unset_string (PropTest* obj, EdsioPropTestStringProperty prop) { g_return_val_if_fail (obj, FALSE); return edsio_property_unset ("PropTest", "string", prop.code, obj); } gboolean proptest_isset_string (PropTest* obj, EdsioPropTestStringProperty prop) { g_return_val_if_fail (obj, FALSE); return edsio_property_isset ("PropTest", "string", prop.code, obj); } gboolean edsio_new_proptest_bytes_property (const char* name, guint32 flags, EdsioPropTestBytesProperty* prop) { return edsio_new_property (name, "PropTest", "bytes", flags, (EdsioGenericProperty*) prop); } gboolean proptest_get_bytes (PropTest* obj, EdsioPropTestBytesProperty prop, const guint8** arg, guint32* arg_len) { EdsioProperty* ep; g_return_val_if_fail (obj, FALSE); return (* edsio_property_getter ("PropTest", "bytes", prop.code, & ep)) (obj, ep, arg, arg_len); } gboolean proptest_set_bytes (PropTest* obj, EdsioPropTestBytesProperty prop, const guint8* arg, guint32 arg_len) { EdsioProperty* ep; g_return_val_if_fail (obj, FALSE); return (* edsio_property_setter ("PropTest", "bytes", prop.code, & ep)) (obj, ep, arg, arg_len); } gboolean proptest_unset_bytes (PropTest* obj, EdsioPropTestBytesProperty prop) { g_return_val_if_fail (obj, FALSE); return edsio_property_unset ("PropTest", "bytes", prop.code, obj); } gboolean proptest_isset_bytes (PropTest* obj, EdsioPropTestBytesProperty prop) { g_return_val_if_fail (obj, FALSE); return edsio_property_isset ("PropTest", "bytes", prop.code, obj); } gboolean edsio_new_proptest_uint_property (const char* name, guint32 flags, EdsioPropTestUintProperty* prop) { return edsio_new_property (name, "PropTest", "uint", flags, (EdsioGenericProperty*) prop); } gboolean proptest_get_uint (PropTest* obj, EdsioPropTestUintProperty prop, guint32* arg) { EdsioProperty* ep; g_return_val_if_fail (obj, FALSE); return (* edsio_property_getter ("PropTest", "uint", prop.code, & ep)) (obj, ep, arg); } gboolean proptest_set_uint (PropTest* obj, EdsioPropTestUintProperty prop, guint32 arg) { EdsioProperty* ep; g_return_val_if_fail (obj, FALSE); return (* edsio_property_setter ("PropTest", "uint", prop.code, & ep)) (obj, ep, arg); } gboolean proptest_unset_uint (PropTest* obj, EdsioPropTestUintProperty prop) { g_return_val_if_fail (obj, FALSE); return edsio_property_unset ("PropTest", "uint", prop.code, obj); } gboolean proptest_isset_uint (PropTest* obj, EdsioPropTestUintProperty prop) { g_return_val_if_fail (obj, FALSE); return edsio_property_isset ("PropTest", "uint", prop.code, obj); } /* EdsioUint Count */ guint serializeio_count_edsiouint (guint32 val) { guint size = sizeof (SerialEdsioUint); ALIGN_8 (size); ALIGN_8 (size); return size; } guint serializeio_count_edsiouint_obj (SerialEdsioUint const* obj) { return serializeio_count_edsiouint (obj->val); } /* EdsioUint Print */ void serializeio_print_edsiouint_obj (SerialEdsioUint* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_EdsioUint]\n"); print_spaces (indent_spaces); g_print ("val = "); g_print ("%d\n", obj->val); } /* EdsioUint Serialize */ gboolean serialize_edsiouint_internal (SerialSink *sink, guint32 val) { if (! (* sink->next_uint) (sink, val)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_edsiouint_obj_internal (SerialSink *sink, SerialEdsioUint* obj) { return serialize_edsiouint_internal (sink, obj->val); } gboolean serialize_edsiouint (SerialSink *sink, guint32 val) { if (! (* sink->sink_type) (sink, ST_EdsioUint, serializeio_count_edsiouint (val), TRUE)) goto bail; if (! serialize_edsiouint_internal (sink, val)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_edsiouint_obj (SerialSink *sink, const SerialEdsioUint* obj) { return serialize_edsiouint (sink, obj->val); } /* EdsioUint Unserialize */ gboolean unserialize_edsiouint_internal_noalloc (SerialSource *source, SerialEdsioUint* result) { if (! (* source->next_uint) (source, &result->val)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_edsiouint_internal (SerialSource *source, SerialEdsioUint** result) { SerialEdsioUint* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialEdsioUint)); if (! unser) goto bail; if (! unserialize_edsiouint_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_edsiouint (SerialSource *source, SerialEdsioUint** result) { if ( (* source->source_type) (source, TRUE) != ST_EdsioUint) goto bail; if (! unserialize_edsiouint_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* EdsioBytes Count */ guint serializeio_count_edsiobytes (guint32 val_len, const guint8* val) { guint size = sizeof (SerialEdsioBytes); ALIGN_8 (size); size += val_len; ALIGN_8 (size); return size; } guint serializeio_count_edsiobytes_obj (SerialEdsioBytes const* obj) { return serializeio_count_edsiobytes (obj->val_len, obj->val); } /* EdsioBytes Print */ void serializeio_print_edsiobytes_obj (SerialEdsioBytes* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_EdsioBytes]\n"); print_spaces (indent_spaces); g_print ("val = "); serializeio_print_bytes (obj->val, obj->val_len); } /* EdsioBytes Serialize */ gboolean serialize_edsiobytes_internal (SerialSink *sink, guint32 val_len, const guint8* val) { if (! (* sink->next_bytes) (sink, val, val_len)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_edsiobytes_obj_internal (SerialSink *sink, SerialEdsioBytes* obj) { return serialize_edsiobytes_internal (sink, obj->val_len, obj->val); } gboolean serialize_edsiobytes (SerialSink *sink, guint32 val_len, const guint8* val) { if (! (* sink->sink_type) (sink, ST_EdsioBytes, serializeio_count_edsiobytes (val_len, val), TRUE)) goto bail; if (! serialize_edsiobytes_internal (sink, val_len, val)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_edsiobytes_obj (SerialSink *sink, const SerialEdsioBytes* obj) { return serialize_edsiobytes (sink, obj->val_len, obj->val); } /* EdsioBytes Unserialize */ gboolean unserialize_edsiobytes_internal_noalloc (SerialSource *source, SerialEdsioBytes* result) { if (! (* source->next_bytes) (source, &result->val, &result->val_len)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_edsiobytes_internal (SerialSource *source, SerialEdsioBytes** result) { SerialEdsioBytes* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialEdsioBytes)); if (! unser) goto bail; if (! unserialize_edsiobytes_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_edsiobytes (SerialSource *source, SerialEdsioBytes** result) { if ( (* source->source_type) (source, TRUE) != ST_EdsioBytes) goto bail; if (! unserialize_edsiobytes_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* EdsioString Count */ guint serializeio_count_edsiostring (const gchar* val) { guint size = sizeof (SerialEdsioString); ALIGN_8 (size); size += strlen (val) + 1; ALIGN_8 (size); return size; } guint serializeio_count_edsiostring_obj (SerialEdsioString const* obj) { return serializeio_count_edsiostring (obj->val); } /* EdsioString Print */ void serializeio_print_edsiostring_obj (SerialEdsioString* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_EdsioString]\n"); print_spaces (indent_spaces); g_print ("val = "); g_print ("%s\n", obj->val); } /* EdsioString Serialize */ gboolean serialize_edsiostring_internal (SerialSink *sink, const gchar* val) { if (! (* sink->next_string) (sink, val)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_edsiostring_obj_internal (SerialSink *sink, SerialEdsioString* obj) { return serialize_edsiostring_internal (sink, obj->val); } gboolean serialize_edsiostring (SerialSink *sink, const gchar* val) { if (! (* sink->sink_type) (sink, ST_EdsioString, serializeio_count_edsiostring (val), TRUE)) goto bail; if (! serialize_edsiostring_internal (sink, val)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_edsiostring_obj (SerialSink *sink, const SerialEdsioString* obj) { return serialize_edsiostring (sink, obj->val); } /* EdsioString Unserialize */ gboolean unserialize_edsiostring_internal_noalloc (SerialSource *source, SerialEdsioString* result) { if (! (* source->next_string) (source, &result->val)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_edsiostring_internal (SerialSource *source, SerialEdsioString** result) { SerialEdsioString* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialEdsioString)); if (! unser) goto bail; if (! unserialize_edsiostring_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_edsiostring (SerialSource *source, SerialEdsioString** result) { if ( (* source->source_type) (source, TRUE) != ST_EdsioString) goto bail; if (! unserialize_edsiostring_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } /* GenericTime Count */ guint serializeio_count_generictime (guint32 seconds, guint32 nanos) { guint size = sizeof (SerialGenericTime); ALIGN_8 (size); ALIGN_8 (size); ALIGN_8 (size); return size; } guint serializeio_count_generictime_obj (SerialGenericTime const* obj) { return serializeio_count_generictime (obj->seconds, obj->nanos); } /* GenericTime Print */ void serializeio_print_generictime_obj (SerialGenericTime* obj, guint indent_spaces) { print_spaces (indent_spaces); g_print ("[ST_GenericTime]\n"); print_spaces (indent_spaces); g_print ("seconds = "); g_print ("%d\n", obj->seconds); print_spaces (indent_spaces); g_print ("nanos = "); g_print ("%d\n", obj->nanos); } /* GenericTime Serialize */ gboolean serialize_generictime_internal (SerialSink *sink, guint32 seconds, guint32 nanos) { if (! (* sink->next_uint) (sink, seconds)) goto bail; if (! (* sink->next_uint) (sink, nanos)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_generictime_obj_internal (SerialSink *sink, SerialGenericTime* obj) { return serialize_generictime_internal (sink, obj->seconds, obj->nanos); } gboolean serialize_generictime (SerialSink *sink, guint32 seconds, guint32 nanos) { if (! (* sink->sink_type) (sink, ST_GenericTime, serializeio_count_generictime (seconds, nanos), TRUE)) goto bail; if (! serialize_generictime_internal (sink, seconds, nanos)) goto bail; if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail; return TRUE; bail: return FALSE; } gboolean serialize_generictime_obj (SerialSink *sink, const SerialGenericTime* obj) { return serialize_generictime (sink, obj->seconds, obj->nanos); } /* GenericTime Unserialize */ gboolean unserialize_generictime_internal_noalloc (SerialSource *source, SerialGenericTime* result) { if (! (* source->next_uint) (source, &result->seconds)) goto bail; if (! (* source->next_uint) (source, &result->nanos)) goto bail; return TRUE; bail: return FALSE; } gboolean unserialize_generictime_internal (SerialSource *source, SerialGenericTime** result) { SerialGenericTime* unser; (*result) = NULL; unser = serializeio_source_alloc (source, sizeof (SerialGenericTime)); if (! unser) goto bail; if (! unserialize_generictime_internal_noalloc (source, unser)) goto bail; (*result) = unser; return TRUE; bail: return FALSE; } gboolean unserialize_generictime (SerialSource *source, SerialGenericTime** result) { if ( (* source->source_type) (source, TRUE) != ST_GenericTime) goto bail; if (! unserialize_generictime_internal (source, result)) goto bail; if (! serializeio_source_object_received (source)) goto bail; return TRUE; bail: return FALSE; } void edsio_generate_errno_event_internal (EdsioErrnoEventCode _code, const char* _srcfile, gint _srcline) { EdsioErrnoEvent *_e = g_new0 (EdsioErrnoEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->ev_errno = errno; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Edsio_Errno_event_field_to_string (GenericEvent* ev, gint field) { EdsioErrnoEvent* it = (EdsioErrnoEvent*) ev; switch (field) { case 0: return g_strdup (g_strerror (it->ev_errno)); default: abort (); } } const EdsioErrnoEventCode EC_EdsioGetTimeOfDayFailure = { EC_EdsioGetTimeOfDayFailureValue }; const EdsioErrnoEventCode EC_EdsioTimeFailure = { EC_EdsioTimeFailureValue }; void edsio_generate_intint_event_internal (EdsioIntIntEventCode _code, const char* _srcfile, gint _srcline, int library, int number) { EdsioIntIntEvent *_e = g_new0 (EdsioIntIntEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->library = library; _e->number = number; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Edsio_IntInt_event_field_to_string (GenericEvent* ev, gint field) { EdsioIntIntEvent* it = (EdsioIntIntEvent*) ev; switch (field) { case 0: return eventdelivery_int_to_string (it->library); case 1: return eventdelivery_int_to_string (it->number); default: abort (); } } const EdsioIntIntEventCode EC_EdsioUnregisteredType = { EC_EdsioUnregisteredTypeValue }; const EdsioIntIntEventCode EC_EdsioUnexpectedLibraryType = { EC_EdsioUnexpectedLibraryTypeValue }; void edsio_generate_void_event_internal (EdsioVoidEventCode _code, const char* _srcfile, gint _srcline) { EdsioVoidEvent *_e = g_new0 (EdsioVoidEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; eventdelivery_event_deliver ((GenericEvent*) _e); } const EdsioVoidEventCode EC_EdsioUnexpectedType = { EC_EdsioUnexpectedTypeValue }; const EdsioVoidEventCode EC_EdsioOutputBufferShort = { EC_EdsioOutputBufferShortValue }; const EdsioVoidEventCode EC_EdsioInvalidBase64Encoding = { EC_EdsioInvalidBase64EncodingValue }; const EdsioVoidEventCode EC_EdsioMissingChecksum = { EC_EdsioMissingChecksumValue }; const EdsioVoidEventCode EC_EdsioInvalidChecksum = { EC_EdsioInvalidChecksumValue }; void edsio_generate_source_event_internal (EdsioSourceEventCode _code, const char* _srcfile, gint _srcline, SerialSource* source) { EdsioSourceEvent *_e = g_new0 (EdsioSourceEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->source = source; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Edsio_Source_event_field_to_string (GenericEvent* ev, gint field) { EdsioSourceEvent* it = (EdsioSourceEvent*) ev; switch (field) { case 0: return eventdelivery_source_to_string (it->source); default: abort (); } } const EdsioSourceEventCode EC_EdsioSourceEof = { EC_EdsioSourceEofValue }; const EdsioSourceEventCode EC_EdsioIncorrectAllocation = { EC_EdsioIncorrectAllocationValue }; void edsio_generate_stringstring_event_internal (EdsioStringStringEventCode _code, const char* _srcfile, gint _srcline, const char* msg, const char* arg) { EdsioStringStringEvent *_e = g_new0 (EdsioStringStringEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->msg = msg; _e->arg = arg; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Edsio_StringString_event_field_to_string (GenericEvent* ev, gint field) { EdsioStringStringEvent* it = (EdsioStringStringEvent*) ev; switch (field) { case 0: return eventdelivery_string_to_string (it->msg); case 1: return eventdelivery_string_to_string (it->arg); default: abort (); } } const EdsioStringStringEventCode EC_EdsioInvalidIntegerString = { EC_EdsioInvalidIntegerStringValue }; const EdsioStringStringEventCode EC_EdsioIntegerOutOfRange = { EC_EdsioIntegerOutOfRangeValue }; const EdsioStringStringEventCode EC_EdsioInvalidIntegerSign = { EC_EdsioInvalidIntegerSignValue }; void edsio_generate_string_event_internal (EdsioStringEventCode _code, const char* _srcfile, gint _srcline, const char* name) { EdsioStringEvent *_e = g_new0 (EdsioStringEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->name = name; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Edsio_String_event_field_to_string (GenericEvent* ev, gint field) { EdsioStringEvent* it = (EdsioStringEvent*) ev; switch (field) { case 0: return eventdelivery_string_to_string (it->name); default: abort (); } } const EdsioStringEventCode EC_EdsioDuplicatePropertyTypeRegistered = { EC_EdsioDuplicatePropertyTypeRegisteredValue }; const EdsioStringEventCode EC_EdsioDuplicateHostTypeRegistered = { EC_EdsioDuplicateHostTypeRegisteredValue }; const EdsioStringEventCode EC_EdsioDuplicatePropertyNameRegistered = { EC_EdsioDuplicatePropertyNameRegisteredValue }; void edsio_generate_int_event_internal (EdsioIntEventCode _code, const char* _srcfile, gint _srcline, int num) { EdsioIntEvent *_e = g_new0 (EdsioIntEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->num = num; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Edsio_Int_event_field_to_string (GenericEvent* ev, gint field) { EdsioIntEvent* it = (EdsioIntEvent*) ev; switch (field) { case 0: return eventdelivery_int_to_string (it->num); default: abort (); } } const EdsioIntEventCode EC_EdsioNoSuchProperty = { EC_EdsioNoSuchPropertyValue }; const EdsioStringEventCode EC_EdsioNoSuchPropertyType = { EC_EdsioNoSuchPropertyTypeValue }; const EdsioStringEventCode EC_EdsioNoSuchHostType = { EC_EdsioNoSuchHostTypeValue }; void edsio_generate_stringstringstring_event_internal (EdsioStringStringStringEventCode _code, const char* _srcfile, gint _srcline, const char* name, const char* recv, const char* expect) { EdsioStringStringStringEvent *_e = g_new0 (EdsioStringStringStringEvent, 1); _e->code = _code.code; _e->srcline = _srcline; _e->srcfile = _srcfile; _e->name = name; _e->recv = recv; _e->expect = expect; eventdelivery_event_deliver ((GenericEvent*) _e); } const char* Edsio_StringStringString_event_field_to_string (GenericEvent* ev, gint field) { EdsioStringStringStringEvent* it = (EdsioStringStringStringEvent*) ev; switch (field) { case 0: return eventdelivery_string_to_string (it->name); case 1: return eventdelivery_string_to_string (it->recv); case 2: return eventdelivery_string_to_string (it->expect); default: abort (); } } const EdsioStringStringStringEventCode EC_EdsioWrongHostType = { EC_EdsioWrongHostTypeValue }; const EdsioStringStringStringEventCode EC_EdsioWrongDataType = { EC_EdsioWrongDataTypeValue }; const EdsioStringEventCode EC_EdsioPropertyNotSet = { EC_EdsioPropertyNotSetValue }; const EdsioStringStringEventCode EC_EdsioPersistenceUnavailable = { EC_EdsioPersistenceUnavailableValue }; const EdsioVoidEventCode EC_EdsioInvalidStreamChecksum = { EC_EdsioInvalidStreamChecksumValue }; const EdsioStringStringEventCode EC_EdsioInvalidHexDigit = { EC_EdsioInvalidHexDigitValue }; const EdsioStringEventCode EC_EdsioMD5StringShort = { EC_EdsioMD5StringShortValue }; const EdsioStringEventCode EC_EdsioMD5StringLong = { EC_EdsioMD5StringLongValue }; const EdsioIntEventCode EC_EdsioUnregisteredLibrary = { EC_EdsioUnregisteredLibraryValue }; const EdsioStringStringEventCode EC_EdsioGModuleError = { EC_EdsioGModuleErrorValue }; xdelta-1.1.3/libedsio/sha.c0000644006517700017500000001615107311304631011206 /* NIST Secure Hash Algorithm */ /* heavily modified by Uwe Hollerbach */ /* from Peter C. Gutmann's implementation as found in */ /* Applied Cryptography by Bruce Schneier */ /* Further modifications to include the "UNRAVEL" stuff, below */ /* This code is in the public domain */ #include "edsio.h" #include #define SHA_BLOCKSIZE 64 #define SHA_DIGESTSIZE 20 /* UNRAVEL should be fastest & biggest */ /* UNROLL_LOOPS should be just as big, but slightly slower */ /* both undefined should be smallest and slowest */ #define UNRAVEL /* #define UNROLL_LOOPS */ /* by default, compile for little-endian machines (Intel, Vax) */ /* change for big-endian machines; for machines which are neither, */ /* you will need to change the definition of maybe_byte_reverse */ #ifndef WORDS_BIGENDIAN /* from config.h */ #define SHA_LITTLE_ENDIAN #endif /* NIST's proposed modification to SHA of 7/11/94 may be */ /* activated by defining USE_MODIFIED_SHA; leave it off for now */ #undef USE_MODIFIED_SHA /* SHA f()-functions */ #define f1(x,y,z) ((x & y) | (~x & z)) #define f2(x,y,z) (x ^ y ^ z) #define f3(x,y,z) ((x & y) | (x & z) | (y & z)) #define f4(x,y,z) (x ^ y ^ z) /* SHA constants */ #define CONST1 0x5a827999L #define CONST2 0x6ed9eba1L #define CONST3 0x8f1bbcdcL #define CONST4 0xca62c1d6L /* 32-bit rotate */ #define ROT32(x,n) ((x << n) | (x >> (32 - n))) /* the generic case, for when the overall rotation is not unraveled */ #define FG(n) \ T = ROT32(A,5) + f##n(B,C,D) + E + *WP++ + CONST##n; \ E = D; D = C; C = ROT32(B,30); B = A; A = T /* specific cases, for when the overall rotation is unraveled */ #define FA(n) \ T = ROT32(A,5) + f##n(B,C,D) + E + *WP++ + CONST##n; B = ROT32(B,30) #define FB(n) \ E = ROT32(T,5) + f##n(A,B,C) + D + *WP++ + CONST##n; A = ROT32(A,30) #define FC(n) \ D = ROT32(E,5) + f##n(T,A,B) + C + *WP++ + CONST##n; T = ROT32(T,30) #define FD(n) \ C = ROT32(D,5) + f##n(E,T,A) + B + *WP++ + CONST##n; E = ROT32(E,30) #define FE(n) \ B = ROT32(C,5) + f##n(D,E,T) + A + *WP++ + CONST##n; D = ROT32(D,30) #define FT(n) \ A = ROT32(B,5) + f##n(C,D,E) + T + *WP++ + CONST##n; C = ROT32(C,30) /* do SHA transformation */ static void sha_transform(EdsioSHACtx *ctx) { int i; guint32 T, A, B, C, D, E, W[80], *WP; for (i = 0; i < 16; ++i) { W[i] = ctx->data[i]; } for (i = 16; i < 80; ++i) { W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]; #ifdef USE_MODIFIED_SHA W[i] = ROT32(W[i], 1); #endif /* USE_MODIFIED_SHA */ } A = ctx->digest[0]; B = ctx->digest[1]; C = ctx->digest[2]; D = ctx->digest[3]; E = ctx->digest[4]; WP = W; #ifdef UNRAVEL FA(1); FB(1); FC(1); FD(1); FE(1); FT(1); FA(1); FB(1); FC(1); FD(1); FE(1); FT(1); FA(1); FB(1); FC(1); FD(1); FE(1); FT(1); FA(1); FB(1); FC(2); FD(2); FE(2); FT(2); FA(2); FB(2); FC(2); FD(2); FE(2); FT(2); FA(2); FB(2); FC(2); FD(2); FE(2); FT(2); FA(2); FB(2); FC(2); FD(2); FE(3); FT(3); FA(3); FB(3); FC(3); FD(3); FE(3); FT(3); FA(3); FB(3); FC(3); FD(3); FE(3); FT(3); FA(3); FB(3); FC(3); FD(3); FE(3); FT(3); FA(4); FB(4); FC(4); FD(4); FE(4); FT(4); FA(4); FB(4); FC(4); FD(4); FE(4); FT(4); FA(4); FB(4); FC(4); FD(4); FE(4); FT(4); FA(4); FB(4); ctx->digest[0] += E; ctx->digest[1] += T; ctx->digest[2] += A; ctx->digest[3] += B; ctx->digest[4] += C; #else /* !UNRAVEL */ #ifdef UNROLL_LOOPS FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); #else /* !UNROLL_LOOPS */ for (i = 0; i < 20; ++i) { FG(1); } for (i = 20; i < 40; ++i) { FG(2); } for (i = 40; i < 60; ++i) { FG(3); } for (i = 60; i < 80; ++i) { FG(4); } #endif /* !UNROLL_LOOPS */ ctx->digest[0] += A; ctx->digest[1] += B; ctx->digest[2] += C; ctx->digest[3] += D; ctx->digest[4] += E; #endif /* !UNRAVEL */ } #ifdef SHA_LITTLE_ENDIAN /* change endianness of data */ static void maybe_byte_reverse(guint32 *buffer, int count) { int i; guint32 in; count /= sizeof(guint32); for (i = 0; i < count; ++i) { in = *buffer; *buffer++ = ((in << 24) & 0xff000000) | ((in << 8) & 0x00ff0000) | ((in >> 8) & 0x0000ff00) | ((in >> 24) & 0x000000ff); } } #else /* !SHA_LITTLE_ENDIAN */ #define maybe_byte_reverse(a,b) /* do nothing */ #endif /* SHA_LITTLE_ENDIAN */ /* initialize the SHA digest */ void edsio_sha_init(EdsioSHACtx *ctx) { ctx->digest[0] = 0x67452301L; ctx->digest[1] = 0xefcdab89L; ctx->digest[2] = 0x98badcfeL; ctx->digest[3] = 0x10325476L; ctx->digest[4] = 0xc3d2e1f0L; ctx->count_lo = 0L; ctx->count_hi = 0L; ctx->local = 0; } /* update the SHA digest */ void edsio_sha_update(EdsioSHACtx *ctx, const guint8 *buffer, guint count) { int i; if ((ctx->count_lo + ((guint32) count << 3)) < ctx->count_lo) { ++ctx->count_hi; } ctx->count_lo += (guint32) count << 3; ctx->count_hi += (guint32) count >> 29; if (ctx->local) { i = SHA_BLOCKSIZE - ctx->local; if (i > count) { i = count; } memcpy(((guint8 *) ctx->data) + ctx->local, buffer, i); count -= i; buffer += i; ctx->local += i; if (ctx->local == SHA_BLOCKSIZE) { maybe_byte_reverse(ctx->data, SHA_BLOCKSIZE); sha_transform(ctx); } else { return; } } while (count >= SHA_BLOCKSIZE) { memcpy(ctx->data, buffer, SHA_BLOCKSIZE); buffer += SHA_BLOCKSIZE; count -= SHA_BLOCKSIZE; maybe_byte_reverse(ctx->data, SHA_BLOCKSIZE); sha_transform(ctx); } memcpy(ctx->data, buffer, count); ctx->local = count; } /* finish computing the SHA digest */ void edsio_sha_final(guint8* digest, EdsioSHACtx *ctx) { int count; guint32 lo_bit_count, hi_bit_count; lo_bit_count = ctx->count_lo; hi_bit_count = ctx->count_hi; count = (int) ((lo_bit_count >> 3) & 0x3f); ((guint8 *) ctx->data)[count++] = 0x80; if (count > SHA_BLOCKSIZE - 8) { memset(((guint8 *) ctx->data) + count, 0, SHA_BLOCKSIZE - count); maybe_byte_reverse(ctx->data, SHA_BLOCKSIZE); sha_transform(ctx); memset((guint8 *) ctx->data, 0, SHA_BLOCKSIZE - 8); } else { memset(((guint8 *) ctx->data) + count, 0, SHA_BLOCKSIZE - 8 - count); } maybe_byte_reverse(ctx->data, SHA_BLOCKSIZE); ctx->data[14] = hi_bit_count; ctx->data[15] = lo_bit_count; sha_transform(ctx); memcpy (digest, ctx->digest, 20); } xdelta-1.1.3/libedsio/md5c.c0000644006517700017500000002331507311304631011263 /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #include "edsio.h" #include /* Constants for MD5Transform routine. */ #define S11 7 #define S12 12 #define S13 17 #define S14 22 #define S21 5 #define S22 9 #define S23 14 #define S24 20 #define S31 4 #define S32 11 #define S33 16 #define S34 23 #define S41 6 #define S42 10 #define S43 15 #define S44 21 static void MD5Transform (guint32 [4], unsigned const char [64]); static void Encode (unsigned char *, guint32 *, unsigned int); static void Decode (guint32 *, unsigned const char *, unsigned int); #define MD5_memcpy memcpy #define MD5_memset memset static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* F, G, H and I are basic MD5 functions. */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define I(x, y, z) ((y) ^ ((x) | (~z))) /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ (a) += F ((b), (c), (d)) + (x) + (guint32)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ (a) += G ((b), (c), (d)) + (x) + (guint32)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ (a) += H ((b), (c), (d)) + (x) + (guint32)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ (a) += I ((b), (c), (d)) + (x) + (guint32)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } /* MD5 initialization. Begins an MD5 operation, writing a new context. */ void edsio_md5_init (EdsioMD5Ctx *context) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301; context->state[1] = 0xefcdab89; context->state[2] = 0x98badcfe; context->state[3] = 0x10325476; } /* MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. */ void edsio_md5_update (EdsioMD5Ctx *context, const guint8* input, guint inputLen) { unsigned int i, index, partLen; /* Compute number of bytes mod 64 */ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((context->count[0] += ((guint32)inputLen << 3)) < ((guint32)inputLen << 3)) context->count[1]++; context->count[1] += ((guint32)inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ if (inputLen >= partLen) { MD5_memcpy ((guint8*)&context->buffer[index], (guint8*)input, partLen); MD5Transform (context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) MD5Transform (context->state, &input[i]); index = 0; } else i = 0; /* Buffer remaining input */ MD5_memcpy ((guint8*)&context->buffer[index], (guint8*)&input[i], inputLen-i); } /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ void edsio_md5_final (guint8* digest, EdsioMD5Ctx* context) { unsigned char bits[8]; unsigned int index, padLen; /* Save number of bits */ Encode (bits, context->count, 8); /* Pad out to 56 mod 64. */ index = (unsigned int)((context->count[0] >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); edsio_md5_update (context, PADDING, padLen); /* Append length (before padding) */ edsio_md5_update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); /* Zeroize sensitive information. */ MD5_memset ((guint8*)context, 0, sizeof (*context)); } /* MD5 basic transformation. Transforms state based on block. */ static void MD5Transform (guint32 state[4], const guint8 block[64]) { guint32 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); /* Round 1 */ FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ /* Round 2 */ GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ /* Round 4 */ II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; /* Zeroize sensitive information. */ MD5_memset ((guint8*)x, 0, sizeof (x)); } /* Encodes input (guint32) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode (output, input, len) unsigned char *output; guint32 *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (unsigned char)(input[i] & 0xff); output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } /* Decodes input (unsigned char) into output (guint32). Assumes len is a multiple of 4. */ static void Decode (output, input, len) guint32 *output; unsigned const char *input; unsigned int len; { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((guint32)input[j]) | (((guint32)input[j+1]) << 8) | (((guint32)input[j+2]) << 16) | (((guint32)input[j+3]) << 24); } xdelta-1.1.3/libedsio/fh.c0000644006517700017500000000761207311304631011032 /* -*-Mode: C;-*- * $Id: fh.c 1.3 Wed, 31 Mar 1999 17:39:58 -0800 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #include "edsio.h" /* Handle source/sink impls */ typedef struct _HandleSerialSource HandleSerialSource; typedef struct _HandleSerialSink HandleSerialSink; struct _HandleSerialSource { SerialSource source; FileHandle* fh; }; struct _HandleSerialSink { SerialSink sink; FileHandle* fh; gpointer data1; gpointer data2; gpointer data3; gboolean (* cont_onclose) (gpointer data1, gpointer data2, gpointer data3); }; static SerialType handle_source_type (SerialSource* source, gboolean set_allocation); static gboolean handle_source_close (SerialSource* source); static gboolean handle_source_read (SerialSource* source, guint8 *ptr, guint32 len); static void handle_source_free (SerialSource* source); static gboolean handle_sink_type (SerialSink* sink, SerialType type, guint len, gboolean set_allocation); static gboolean handle_sink_close (SerialSink* sink); static gboolean handle_sink_write (SerialSink* sink, const guint8 *ptr, guint32 len); static void handle_sink_free (SerialSink* sink); SerialSource* handle_source (FileHandle* fh) { HandleSerialSource* it = g_new0 (HandleSerialSource, 1); serializeio_source_init (&it->source, handle_source_type, handle_source_close, handle_source_read, handle_source_free, NULL, NULL); it->fh = fh; return &it->source; } SerialSink* handle_sink (FileHandle* fh, gpointer data1, gpointer data2, gpointer data3, gboolean (* cont_onclose) (gpointer data1, gpointer data2, gpointer data3)) { HandleSerialSink* it = g_new0 (HandleSerialSink, 1); serializeio_sink_init (&it->sink, handle_sink_type, handle_sink_close, handle_sink_write, handle_sink_free, NULL); it->fh = fh; it->data1 = data1; it->data2 = data2; it->data3 = data3; it->cont_onclose = cont_onclose; return &it->sink; } SerialType handle_source_type (SerialSource* source, gboolean set_allocation) { HandleSerialSource* ssource = (HandleSerialSource*) source; guint32 x; if (! ssource->fh->table->table_handle_getui (ssource->fh, &x)) return ST_Error; if (set_allocation) { if (! ssource->fh->table->table_handle_getui (ssource->fh, &source->alloc_total)) return ST_Error; } return x; } gboolean handle_source_close (SerialSource* source) { HandleSerialSource* ssource = (HandleSerialSource*) source; return ssource->fh->table->table_handle_close (ssource->fh, 0); } gboolean handle_source_read (SerialSource* source, guint8 *ptr, guint32 len) { HandleSerialSource* ssource = (HandleSerialSource*) source; return ssource->fh->table->table_handle_read (ssource->fh, ptr, len) == len; } void handle_source_free (SerialSource* source) { g_free (source); } gboolean handle_sink_type (SerialSink* sink, SerialType type, guint len, gboolean set_allocation) { HandleSerialSink* ssink = (HandleSerialSink*) sink; if (! ssink->fh->table->table_handle_putui (ssink->fh, type)) return FALSE; if (set_allocation && ! ssink->fh->table->table_handle_putui (ssink->fh, len)) return FALSE; return TRUE; } gboolean handle_sink_close (SerialSink* sink) { HandleSerialSink* ssink = (HandleSerialSink*) sink; if (ssink->fh->table->table_handle_close (ssink->fh, 0)) { if (ssink->cont_onclose) return ssink->cont_onclose (ssink->data1, ssink->data2, ssink->data3); return TRUE; } return FALSE; } gboolean handle_sink_write (SerialSink* sink, const guint8 *ptr, guint32 len) { HandleSerialSink* ssink = (HandleSerialSink*) sink; return ssink->fh->table->table_handle_write (ssink->fh, ptr, len); } void handle_sink_free (SerialSink* sink) { g_free (sink); } xdelta-1.1.3/libedsio/generic.c0000644006517700017500000001254407311304631012051 /* -*-Mode: C;-*- * $Id: generic.c 1.3 Tue, 06 Apr 1999 23:40:10 -0700 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #include "edsio.h" /* Type-based selectors for unknown types */ typedef struct { const char* name; gboolean (*unserialize_func) (); gboolean (*serialize_func) (); guint (*count_func) (); void (*print_func) (); guint32 val; } SerEntry; static GArray *ser_array; static gboolean ser_array_sorted; void serializeio_source_reset_allocation (SerialSource* source); void serializeio_initialize_type (const char* name, guint32 val, gboolean (*unserialize_func) (), gboolean (*serialize_func) (), guint (*count_func) (), void (*print_func) ()) { SerEntry it; it.name = name; it.val = val; it.unserialize_func = unserialize_func; it.serialize_func = serialize_func; it.count_func = count_func; it.print_func = print_func; if (ser_array == NULL) ser_array = g_array_new (FALSE, TRUE, sizeof (SerEntry)); g_array_append_val (ser_array, it); ser_array_sorted = FALSE; } static int ser_entry_compare (const void* va, const void* vb) { SerEntry* a = (SerEntry*) va; SerEntry* b = (SerEntry*) vb; return a->val - b->val; } static SerEntry* serializeio_find_entry (SerialType type) { if (! edsio_library_check (type & EDSIO_LIBRARY_OFFSET_MASK)) return NULL; if (ser_array) { gint high_index = ser_array->len; gint low_index = 0; gint index; gint this_val; if (! ser_array_sorted) { ser_array_sorted = TRUE; qsort (ser_array->data, ser_array->len, sizeof (SerEntry), ser_entry_compare); } again: index = (low_index + high_index) / 2; this_val = g_array_index (ser_array, SerEntry, index).val; if (this_val < type) { low_index = index + 1; goto again; } else if (this_val > type) { high_index = index - 1; goto again; } else { return & g_array_index (ser_array, SerEntry, index); } } edsio_generate_intint_event (EC_EdsioUnregisteredType, type & EDSIO_LIBRARY_OFFSET_MASK, type >> EDSIO_LIBRARY_OFFSET_BITS); return NULL; } gboolean serializeio_unserialize_generic_internal (SerialSource *source, SerialType *object_type, void **object, gboolean set_allocation) { SerialType type = (* source->source_type) (source, set_allocation); SerEntry* ent; gboolean res = FALSE; if (type < 0) return FALSE; ent = serializeio_find_entry (type); (*object_type) = type; if (ent) { res = ent->unserialize_func (source, object); if (set_allocation && res) { if (! serializeio_source_object_received (source)) return FALSE; } } if (set_allocation) serializeio_source_reset_allocation (source); return res; } gboolean serializeio_unserialize_generic (SerialSource *source, SerialType *object_type, void **object) { return serializeio_unserialize_generic_internal (source, object_type, object, TRUE); } gboolean serializeio_serialize_generic (SerialSink *sink, SerialType object_type, void *object) { return serializeio_serialize_generic_internal (sink, object_type, object, TRUE); } gboolean serializeio_serialize_generic_internal (SerialSink *sink, SerialType object_type, void *object, gboolean set_allocation) { SerEntry* ent; gboolean res = FALSE; if (! (* sink->sink_type) (sink, object_type, set_allocation ? serializeio_generic_count (object_type, object) : 0, set_allocation)) return FALSE; ent = serializeio_find_entry (object_type); if (ent) res = ent->serialize_func (sink, object); return res; } const char* serializeio_generic_type_to_string (SerialType type) { SerEntry* ent; const char* res = "*Unknown*"; ent = serializeio_find_entry (type); if (ent) res = ent->name; return res; } guint serializeio_generic_count (SerialType object_type, void *object) { SerEntry* ent; gboolean res = FALSE; ent = serializeio_find_entry (object_type); if (ent) res = ent->count_func (object); return res; } void serializeio_generic_print (SerialType type, void* object, guint indent_spaces) { SerEntry* ent; ent = serializeio_find_entry (type); if (ent) ent->print_func (object, indent_spaces); else { int i = 0; for (; i < indent_spaces; i += 1) g_print (" "); g_print ("*Type Not Registered*\n"); } } gboolean serializeio_unserialize_generic_acceptable (SerialSource *source, guint32 accept, SerialType *object_type, void **object) { gboolean s; s = serializeio_unserialize_generic (source, object_type, object); if (s) { if (accept != -1) { if ((*object_type & EDSIO_LIBRARY_OFFSET_MASK) != (accept & EDSIO_LIBRARY_OFFSET_MASK)) { edsio_generate_intint_event (EC_EdsioUnexpectedLibraryType, accept & EDSIO_LIBRARY_OFFSET_MASK, *object_type & EDSIO_LIBRARY_OFFSET_MASK); return FALSE; } if (! ((*object_type & ~EDSIO_LIBRARY_OFFSET_MASK) | (accept & ~EDSIO_LIBRARY_OFFSET_MASK))) { edsio_generate_void_event (EC_EdsioUnexpectedType); return FALSE; } } } return s; } xdelta-1.1.3/libedsio/default.c0000644006517700007640000001766507353553524012113 /* -*-Mode: C;-*- * $Id: default.c 1.5 Wed, 31 Mar 1999 17:39:58 -0800 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #include "edsio.h" /* Default Sink methods */ static gboolean sink_type_default (SerialSink* sink, SerialType type, guint len, gboolean set_allocation) { if (! sink->next_uint32 (sink, type)) return FALSE; if (set_allocation && !sink->next_uint32 (sink, len)) return FALSE; return TRUE; } static gboolean sink_next_uint16 (SerialSink* sink, guint16 num) { num = g_htons (num); return sink->sink_write (sink, (guint8*) &num, sizeof (num)); } static gboolean sink_next_uint32 (SerialSink* sink, guint32 num) { num = g_htonl (num); return sink->sink_write (sink, (guint8*) &num, sizeof (num)); } static gboolean sink_next_uint (SerialSink* sink, guint32 num) { /* This is mostly because I dislike endian, and less to save space * on small ints. However, the uint32 and uint16 functions are used * when the number is expected to be large, in which case this * format can expand the number. */ guint8 sink_buf[16]; /* this is enough room for a 12-byte int */ guint sink_count = 0; do { guint left = num & 0x7f; guint outnum; num >>= 7; outnum = left | (num ? 0x80 : 0); sink_buf[sink_count++] = outnum; } while (num); return sink->sink_write (sink, sink_buf, sink_count); } static gboolean sink_next_uint8 (SerialSink* sink, guint8 val) { return sink->sink_write (sink, &val, 1); } static gboolean sink_next_bool (SerialSink* sink, gboolean val) { guint8 sink_buf[1]; sink_buf[0] = val; return sink->sink_write (sink, sink_buf, 1); } static gboolean sink_next_string (SerialSink* sink, const char *ptr) { return sink->next_bytes (sink, ptr, strlen (ptr)); } static gboolean sink_next_bytes (SerialSink* sink, const guint8 *ptr, guint32 len) { return sink->next_uint (sink, len) && sink->sink_write (sink, ptr, len); } static gboolean sink_next_bytes_known (SerialSink* sink, const guint8 *ptr, guint32 len) { return sink->sink_write (sink, ptr, len); } void serializeio_sink_init (SerialSink* it, gboolean (* sink_type) (SerialSink* sink, SerialType type, guint mem_size, gboolean set_allocation), gboolean (* sink_close) (SerialSink* sink), gboolean (* sink_write) (SerialSink* sink, const guint8 *ptr, guint32 len), void (* sink_free) (SerialSink* sink), gboolean (* sink_quantum) (SerialSink* sink)) { it->next_bytes_known = sink_next_bytes_known; it->next_bytes = sink_next_bytes; it->next_uint = sink_next_uint; it->next_uint32 = sink_next_uint32; it->next_uint16 = sink_next_uint16; it->next_uint8 = sink_next_uint8; it->next_bool = sink_next_bool; it->next_string = sink_next_string; if (sink_type) it->sink_type = sink_type; else it->sink_type = sink_type_default; it->sink_close = sink_close; it->sink_write = sink_write; it->sink_free = sink_free; it->sink_quantum = sink_quantum; } /* Default Source methods */ static SerialType source_type_default (SerialSource* source, gboolean set_allocation) { guint32 x; if (! source->next_uint32 (source, & x)) return ST_Error; if (set_allocation) { if (! source->next_uint32 (source, &source->alloc_total)) return ST_Error; } return x; } static gboolean source_next_uint32 (SerialSource* source, guint32 *ptr) { guint32 x; if (! source->source_read (source, (guint8*) &x, sizeof (x))) return FALSE; (*ptr) = g_ntohl (x); return TRUE; } static gboolean source_next_uint16 (SerialSource* source, guint16 *ptr) { guint16 x; if (! source->source_read (source, (guint8*) &x, sizeof (x))) return FALSE; (*ptr) = g_ntohs (x); return TRUE; } static gboolean source_next_uint (SerialSource* source, guint32 *ptr) { /* This is mostly because I dislike endian, and less to save space * on small ints */ guint8 c; guint8 arr[16]; gint i = 0; gint donebit = 1; gint bits; while (source->next_uint8 (source, &c)) { donebit = c & 0x80; bits = c & 0x7f; arr[i++] = bits; if (!donebit) break; } if (donebit) return FALSE; *ptr = 0; for (i -= 1; i >= 0; i -= 1) { *ptr <<= 7; *ptr |= arr[i]; } return TRUE; } static gboolean source_next_uint8 (SerialSource* source, guint8 *ptr) { return source->source_read (source, ptr, 1); } static gboolean source_next_bool (SerialSource* source, gboolean *ptr) { guint8 sink_buf[1]; if (! source->source_read (source, sink_buf, 1)) return FALSE; if (sink_buf[0]) *ptr = TRUE; else *ptr = FALSE; return TRUE; } static gboolean source_next_string (SerialSource* source, const char **ptr) { guint32 len; guint8* buf; if (! source->next_uint (source, &len)) return FALSE; if (! (buf = serializeio_source_alloc (source, len+1))) return FALSE; buf[len] = 0; (*ptr) = buf; return source->source_read (source, buf, len); } static gboolean source_next_bytes (SerialSource* source, const guint8 **ptr, guint32 *len_ptr) { guint32 len; guint8* buf; if (! source->next_uint (source, &len)) return FALSE; if (! (buf = serializeio_source_alloc (source, len))) return FALSE; (*len_ptr) = len; (*ptr) = buf; return source->source_read (source, buf, len); } static gboolean source_next_bytes_known (SerialSource* source, guint8 *ptr, guint32 len) { return source->source_read (source, ptr, len); } void* serializeio_source_alloc (SerialSource* source, guint32 len) { void* ret; if (! source->alloc_buf) { if (source->salloc_func) source->alloc_buf_orig = source->salloc_func (source, source->alloc_total + 8); else source->alloc_buf_orig = g_malloc0 (source->alloc_total + 8); source->alloc_buf = source->alloc_buf_orig; { long x = source->alloc_buf; ALIGN_8 (x); source->alloc_buf = x; } } if (len+source->alloc_pos > source->alloc_total) { edsio_generate_source_event (EC_EdsioIncorrectAllocation, source); return NULL; } ret = ((guint8*)source->alloc_buf) + source->alloc_pos; source->alloc_pos += len; ALIGN_8 (source->alloc_pos); g_assert (((long)ret) % 8 == 0); g_assert (source->alloc_pos % 8 == 0); return ret; } gboolean serializeio_source_object_received (SerialSource* source) { source->alloc_pos = 0; source->alloc_total = 0; source->alloc_buf_orig = NULL; source->alloc_buf = NULL; return TRUE; } void serializeio_source_reset_allocation (SerialSource* source) { source->alloc_pos = 0; source->alloc_total = 0; source->alloc_buf = NULL; if (source->alloc_buf_orig) { if (source->sfree_func) source->sfree_func (source, source->alloc_buf_orig); else g_free (source->alloc_buf_orig); } } void serializeio_source_init (SerialSource* it, SerialType (* source_type) (SerialSource* source, gboolean set_allocation), gboolean (* source_close) (SerialSource* source), gboolean (* source_read) (SerialSource* source, guint8 *ptr, guint32 len), void (* source_free) (SerialSource* source), void* (* salloc_func) (SerialSource* source, guint32 len), void (* sfree_func) (SerialSource* source, void* ptr)) { it->next_bytes_known = source_next_bytes_known; it->next_bytes = source_next_bytes; it->next_uint = source_next_uint; it->next_uint32 = source_next_uint32; it->next_uint16 = source_next_uint16; it->next_uint8 = source_next_uint8; it->next_bool = source_next_bool; it->next_string = source_next_string; if (source_type != NULL) it->source_type = source_type; else it->source_type = source_type_default; it->source_close = source_close; it->source_read = source_read; it->source_free = source_free; it->salloc_func = salloc_func; it->sfree_func = sfree_func; } xdelta-1.1.3/libedsio/base64.c0000644006517700017500000002425307311304630011520 /* -*-Mode: C;-*- * $Id: base64.c 1.14 Wed, 31 Mar 1999 17:39:58 -0800 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #include "edsio.h" /* BASE64 Encoding */ static const unsigned char base64_table[64] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; static gint16 base64_inverse_table[128]; static void init_inverse_table (void) { static int i = 0; static int j = 0; for (; j < 128; j += 1) base64_inverse_table[j] = -1; for (; i < 64; i += 1) base64_inverse_table[base64_table[i]] = i; base64_inverse_table['='] = 0; } GByteArray* edsio_base64_encode_region (const guint8* data, guint len) { GByteArray* out = g_byte_array_new (); guint real_len; g_byte_array_set_size (out, (len+2)*4/3); real_len = out->len; if (! edsio_base64_encode_region_into (data, len, out->data, &real_len)) { g_byte_array_free (out, TRUE); return NULL; } g_byte_array_set_size (out, real_len); return out; } gboolean edsio_base64_encode_region_into (const guint8* data, guint len, guint8* out, guint *out_len) { gint i; guint32 word = 0, count = 0; if ((*out_len) < (len + 2) * 4/3) { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } *out_len = 0; for (i = 0; i < len; i += 1) { word |= data[i] << (8*(2-(count++))); if (count == 3) { out[(*out_len)++] = base64_table[(word>>18) & 0x3f]; out[(*out_len)++] = base64_table[(word>>12) & 0x3f]; out[(*out_len)++] = base64_table[(word>> 6) & 0x3f]; out[(*out_len)++] = base64_table[(word ) & 0x3f]; count = 0; word = 0; } } if (count > 0) { out[(*out_len)++] = base64_table[(word>>18) & 0x3f]; out[(*out_len)++] = base64_table[(word>>12) & 0x3f]; out[(*out_len)++] = (count > 1) ? base64_table[(word>>6) & 0x3f] : '='; out[(*out_len)++] = '='; } return TRUE; } GByteArray* edsio_base64_decode_region (const guint8* data, guint data_len) { GByteArray* it = g_byte_array_new (); guint real_len; g_byte_array_set_size (it, data_len*3/4); real_len = it->len; if (! edsio_base64_decode_region_into (data, data_len, it->data, &real_len)) { g_byte_array_free (it, TRUE); return NULL; } g_byte_array_set_size (it, real_len); return it; } gboolean edsio_base64_decode_region_into (const guint8* data, guint len, guint8* out, guint *out_len) { guint32 pos = 0; gboolean found_end = FALSE; gint found_end_at = 0; init_inverse_table (); if ((*out_len) < (len*3/4)) { edsio_generate_void_event (EC_EdsioOutputBufferShort); return FALSE; } (*out_len) = 0; while (pos < len) { gint i, x; gint word = 0, junk = 0; if (len - pos < 4) { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } for (i = 0; i < 4; i += 1) { x = data[pos++]; if (x > 127 || base64_inverse_table[x] < 0) { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } if (x == '=') { if (! found_end) found_end_at = i; found_end = TRUE; } else { if (found_end) { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } word |= base64_inverse_table[x] << (6*(3-i)); } } if (found_end) { if (found_end_at < 2) { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } if (found_end_at == 2) junk = 2; else if (found_end_at == 3) junk = 1; } else junk = 0; out[(*out_len)++] = (word >> 16) & 0xff; if (junk < 2) out[(*out_len)++] = (word >> 8) & 0xff; if (junk < 1) out[(*out_len)++] = (word >> 0) & 0xff; } return TRUE; } /* Base64 sink */ typedef struct _Base64Sink Base64Sink; static gboolean base64_sink_close (SerialSink* sink); static gboolean base64_sink_write (SerialSink* sink, const guint8 *ptr, guint32 len); static void base64_sink_free (SerialSink* sink); static gboolean base64_sink_quantum (SerialSink* sink); struct _Base64Sink { SerialSink sink; SerialSink* out; guint32 word; guint32 count; }; SerialSink* serializeio_base64_sink (SerialSink* out) { Base64Sink* it = g_new0 (Base64Sink, 1); SerialSink* sink = (SerialSink*) it; serializeio_sink_init (sink, NULL, base64_sink_close, base64_sink_write, base64_sink_free, base64_sink_quantum); it->out = out; return sink; } gboolean base64_sink_write (SerialSink* fsink, const guint8 *ptr, guint32 len) { guint32 i; Base64Sink* sink = (Base64Sink*) fsink; for (i = 0; i < len; ) { if (sink->count == 3) { guint8 out[4]; out[0] = base64_table[(sink->word>>18) & 0x3f]; out[1] = base64_table[(sink->word>>12) & 0x3f]; out[2] = base64_table[(sink->word>> 6) & 0x3f]; out[3] = base64_table[(sink->word ) & 0x3f]; #if 0 g_print ("%02x %02x %02x -> %c%c%c%c (3)\n", (sink->word>>16) & 0xff, (sink->word>>8) & 0xff, (sink->word>>0) & 0xff, out[0], out[1], out[2], out[3]); #endif if (! sink->out->sink_write (sink->out, out, 4)) return FALSE; sink->count = 0; sink->word = 0; } while (sink->count < 3 && i < len) sink->word |= ptr[i++] << (8*(2-(sink->count++))); } return TRUE; } gboolean base64_sink_close (SerialSink* fsink) { Base64Sink* sink = (Base64Sink*) fsink; if (sink->count == 3) { guint8 out[4]; out[0] = base64_table[(sink->word>>18) & 0x3f]; out[1] = base64_table[(sink->word>>12) & 0x3f]; out[2] = base64_table[(sink->word>> 6) & 0x3f]; out[3] = base64_table[(sink->word ) & 0x3f]; #if 0 g_print ("%02x %02x %02x -> %c%c%c%c (3)\n", (sink->word>>16) & 0xff, (sink->word>>8) & 0xff, (sink->word>>0) & 0xff, out[0], out[1], out[2], out[3]); #endif if (! sink->out->sink_write (sink->out, out, 4)) return FALSE; sink->count = 0; sink->word = 0; } if (sink->count > 0) { guint8 out[4]; out[0] = base64_table[(sink->word>>18) & 0x3f]; out[1] = base64_table[(sink->word>>12) & 0x3f]; out[2] = (sink->count > 1) ? base64_table[(sink->word>>6) & 0x3f] : '='; out[3] = '='; #if 0 g_print ("%02x %02x %02x -> %c%c%c%c (%d)\n", (sink->word>>16) & 0xff, (sink->word>>8) & 0xff, (sink->word>>0) & 0xff, out[0], out[1], out[2], out[3], sink->count); #endif if (! sink->out->sink_write (sink->out, out, 4)) return FALSE; sink->count = 0; sink->word = 0; } return sink->out->sink_close (sink->out); } void base64_sink_free (SerialSink* fsink) { Base64Sink* sink = (Base64Sink*) fsink; sink->out->sink_free (sink->out); g_free (sink); } gboolean base64_sink_quantum (SerialSink* fsink) { Base64Sink* sink = (Base64Sink*) fsink; if (sink->out->sink_quantum) return sink->out->sink_quantum (sink->out); return TRUE; } /* Base64 source */ typedef struct _Base64Source Base64Source; struct _Base64Source { SerialSource source; SerialSource *in; guint32 avail; guint32 count; gboolean found_end; gint found_end_at; guint8 buf[3]; }; static gboolean base64_source_close (SerialSource* source); static gboolean base64_source_read (SerialSource* source, guint8 *ptr, guint32 len); static void base64_source_free (SerialSource* source); SerialSource* serializeio_base64_source (SerialSource* in0) { Base64Source* it = g_new0 (Base64Source, 1); SerialSource* source = (SerialSource*) it; serializeio_source_init (source, NULL, base64_source_close, base64_source_read, base64_source_free, NULL, NULL); it->in = in0; return source; } gboolean base64_source_close (SerialSource* fsource) { Base64Source* source = (Base64Source*) fsource; if (! source->in->source_close (source->in)) return FALSE; return TRUE; } gboolean base64_source_read (SerialSource* fsource, guint8 *ptr, guint32 len) { guint32 pos; Base64Source* source = (Base64Source*) fsource; init_inverse_table (); for (pos = 0; pos < len; ) { if (source->count == 0) { guint8 buf[4]; guint32 i, word = 0, junk; if (source->found_end) { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } if (! source->in->source_read (source->in, buf, 4)) return FALSE; for (i = 0; i < 4; i += 1) { gint x = buf[i]; if (x > 127 || base64_inverse_table[x] < 0) { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } if (x == '=') { if (! source->found_end) source->found_end_at = i; source->found_end = TRUE; } else { if (source->found_end) { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } word |= base64_inverse_table[x] << (6*(3-i)); } } if (source->found_end) { if (source->found_end_at == 2) junk = 2; else if (source->found_end_at == 3) junk = 1; else { edsio_generate_void_event (EC_EdsioInvalidBase64Encoding); return FALSE; } } else junk = 0; source->avail = source->count = 3 - junk; source->buf[0] = (word >> 16) & 0xff; source->buf[1] = (word >> 8) & 0xff; source->buf[2] = (word >> 0) & 0xff; #if 0 g_print ("%c%c%c%c -> %02x %02x %02x (%d)\n", buf[0], buf[1], buf[2], buf[3], (word>>16) & 0xff, (word>>8) & 0xff, (word>>0) & 0xff, 3-junk); #endif } ptr[pos++] = source->buf[source->avail-(source->count--)]; } return TRUE; } void base64_source_free (SerialSource* fsource) { Base64Source* source = (Base64Source*) fsource; source->in->source_free (source->in); g_free (source); } xdelta-1.1.3/libedsio/maketime.c0000644006517700017500000002426307311304631012232 /* Convert struct partime into time_t. */ /* Copyright 1992, 1993, 1994, 1995, 1997 Paul Eggert Distributed under license by the Free Software Foundation, Inc. This file is part of RCS. RCS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. RCS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with RCS; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Report problems and direct all questions to: rcs-bugs@cs.purdue.edu */ #if has_conf_h # include #else # if HAVE_CONFIG_H # include # else # ifndef __STDC__ # define const # endif # endif /* MIPS RISCOS4.52 defines time_t in not . */ # include # if HAVE_LIMITS_H # include # endif # ifndef LONG_MIN # define LONG_MIN (-1-2147483647L) # endif # if STDC_HEADERS # include # endif # include # ifdef __STDC__ # define P(x) x # else # define P(x) () # endif #endif #include #include char const maketId[] = "$Id: maketime.c 1.1 Mon, 22 Mar 1999 04:56:01 -0800 jmacd $"; static int isleap P ((int)); static int month_days P ((struct tm const *)); static time_t maketime P ((struct partime const *, time_t)); /* For maximum portability, use only localtime and gmtime. Make no assumptions about the time_t epoch or the range of time_t values. Avoid mktime because it's not universal and because there's no easy, portable way for mktime to yield the inverse of gmtime. */ #define TM_YEAR_ORIGIN 1900 static int isleap (y) int y; { return (y & 3) == 0 && (y % 100 != 0 || y % 400 == 0); } /* days in year before start of months 0-12 */ static int const month_yday[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; /* Yield the number of days in TM's month. */ static int month_days (tm) struct tm const *tm; { int m = tm->tm_mon; return (month_yday[m + 1] - month_yday[m] + (m == 1 && isleap (tm->tm_year + TM_YEAR_ORIGIN))); } /* Convert UNIXTIME to struct tm form. Use gmtime if available and if !LOCALZONE, localtime otherwise. */ struct tm * time2tm (unixtime, localzone) time_t unixtime; int localzone; { struct tm *tm; #ifdef TZ_is_unset static char const *TZ; if (!TZ && !(TZ = getenv ("TZ"))) TZ_is_unset ("The TZ environment variable is not set; please set it to your timezone"); #endif if (localzone || !(tm = gmtime (&unixtime))) tm = localtime (&unixtime); return tm; } /* Yield A - B, measured in seconds. */ time_t difftm (a, b) struct tm const *a; struct tm const *b; { int ay = a->tm_year + (TM_YEAR_ORIGIN - 1); int by = b->tm_year + (TM_YEAR_ORIGIN - 1); int ac = ay / 100 - (ay % 100 < 0); int bc = by / 100 - (by % 100 < 0); int difference_in_day_of_year = a->tm_yday - b->tm_yday; int intervening_leap_days = (((ay >> 2) - (by >> 2)) - (ac - bc) + ((ac >> 2) - (bc >> 2))); time_t difference_in_years = ay - by; time_t difference_in_days = (difference_in_years * 365 + (intervening_leap_days + difference_in_day_of_year)); return (((((difference_in_days * 24 + (a->tm_hour - b->tm_hour)) * 60) + (a->tm_min - b->tm_min)) * 60) + (a->tm_sec - b->tm_sec)); } /* * Adjust time T by adding SECONDS. SECONDS must be at most 24 hours' worth. * Adjust only T's year, mon, mday, hour, min and sec members; * plus adjust wday if it is defined. */ void adjzone (t, seconds) register struct tm *t; long seconds; { /* * This code can be off by a second if SECONDS is not a multiple of 60, * if T is local time, and if a leap second happens during this minute. * But this bug has never occurred, and most likely will not ever occur. * Liberia, the last country for which SECONDS % 60 was nonzero, * switched to UTC in May 1972; the first leap second was in June 1972. */ int leap_second = t->tm_sec == 60; long sec = seconds + (t->tm_sec - leap_second); if (sec < 0) { if ((t->tm_min -= (59 - sec) / 60) < 0) { if ((t->tm_hour -= (59 - t->tm_min) / 60) < 0) { t->tm_hour += 24; if (TM_DEFINED (t->tm_wday) && --t->tm_wday < 0) t->tm_wday = 6; if (--t->tm_mday <= 0) { if (--t->tm_mon < 0) { --t->tm_year; t->tm_mon = 11; } t->tm_mday = month_days (t); } } t->tm_min += 24 * 60; } sec += 24L * 60 * 60; } else if (60 <= (t->tm_min += sec / 60)) if (24 <= (t->tm_hour += t->tm_min / 60)) { t->tm_hour -= 24; if (TM_DEFINED (t->tm_wday) && ++t->tm_wday == 7) t->tm_wday = 0; if (month_days (t) < ++t->tm_mday) { if (11 < ++t->tm_mon) { ++t->tm_year; t->tm_mon = 0; } t->tm_mday = 1; } } t->tm_min %= 60; t->tm_sec = (int) (sec % 60) + leap_second; } /* * Convert TM to time_t, using localtime if LOCALZONE and gmtime otherwise. * Use only TM's year, mon, mday, hour, min, and sec members. * Ignore TM's old tm_yday and tm_wday, but fill in their correct values. * Yield -1 on failure (e.g. a member out of range). * Posix 1003.1-1990 doesn't allow leap seconds, but some implementations * have them anyway, so allow them if localtime/gmtime does. */ time_t tm2time (tm, localzone) struct tm *tm; int localzone; { /* Cache the most recent t,tm pairs; 1 for gmtime, 1 for localtime. */ static time_t t_cache[2]; static struct tm tm_cache[2]; time_t d, gt; struct tm const *gtm; /* * The maximum number of iterations should be enough to handle any * combinations of leap seconds, time zone rule changes, and solar time. * 4 is probably enough; we use a bigger number just to be safe. */ int remaining_tries = 8; /* Avoid subscript errors. */ if (12 <= (unsigned) tm->tm_mon) return -1; tm->tm_yday = month_yday[tm->tm_mon] + tm->tm_mday - (tm->tm_mon < 2 || !isleap (tm->tm_year + TM_YEAR_ORIGIN)); /* Make a first guess. */ gt = t_cache[localzone]; gtm = gt ? &tm_cache[localzone] : time2tm (gt, localzone); /* Repeatedly use the error from the guess to improve the guess. */ while ((d = difftm (tm, gtm)) != 0) { if (--remaining_tries == 0) return -1; gt += d; gtm = time2tm (gt, localzone); } /* * Check that the guess actually matches; * overflow can cause difftm to yield 0 even on differing times, * or tm may have members out of range (e.g. bad leap seconds). */ #define TM_DIFFER(a,b) \ ( \ ((a)->tm_year ^ (b)->tm_year) | \ ((a)->tm_mon ^ (b)->tm_mon) | \ ((a)->tm_mday ^ (b)->tm_mday) | \ ((a)->tm_hour ^ (b)->tm_hour) | \ ((a)->tm_min ^ (b)->tm_min) | \ ((a)->tm_sec ^ (b)->tm_sec) \ ) if (TM_DIFFER (tm, gtm)) { /* * If gt is a leap second, try gt+1; if it is one greater than * a leap second, try gt-1; otherwise, it doesn't matter. * Leap seconds always fall at month end. */ int yd = tm->tm_year - gtm->tm_year; gt += yd + (yd ? 0 : tm->tm_mon - gtm->tm_mon); gtm = time2tm (gt, localzone); if (TM_DIFFER (tm, gtm)) return -1; } t_cache[localzone] = gt; tm_cache[localzone] = *gtm; tm->tm_wday = gtm->tm_wday; return gt; } /* * Check *PT and convert it to time_t. * If it is incompletely specified, use DEFAULT_TIME to fill it out. * Use localtime if PT->zone is the special value TM_LOCAL_ZONE. * Yield -1 on failure. * ISO 8601 day-of-year and week numbers are not yet supported. */ static time_t maketime (pt, default_time) struct partime const *pt; time_t default_time; { int localzone, wday; struct tm tm; struct tm *tm0 = 0; time_t r; tm0 = 0; /* Keep gcc -Wall happy. */ localzone = pt->zone == TM_LOCAL_ZONE; tm = pt->tm; if (TM_DEFINED (pt->ymodulus) || !TM_DEFINED (tm.tm_year)) { /* Get tm corresponding to default time. */ tm0 = time2tm (default_time, localzone); if (!localzone) adjzone (tm0, pt->zone); } if (TM_DEFINED (pt->ymodulus)) tm.tm_year += (tm0->tm_year + TM_YEAR_ORIGIN) / pt->ymodulus * pt->ymodulus; else if (!TM_DEFINED (tm.tm_year)) { /* Set default year, month, day from current time. */ tm.tm_year = tm0->tm_year + TM_YEAR_ORIGIN; if (!TM_DEFINED (tm.tm_mon)) { tm.tm_mon = tm0->tm_mon; if (!TM_DEFINED (tm.tm_mday)) tm.tm_mday = tm0->tm_mday; } } /* Convert from partime year (Gregorian) to Posix year. */ tm.tm_year -= TM_YEAR_ORIGIN; /* Set remaining default fields to be their minimum values. */ if (!TM_DEFINED (tm.tm_mon)) tm.tm_mon = 0; if (!TM_DEFINED (tm.tm_mday)) tm.tm_mday = 1; if (!TM_DEFINED (tm.tm_hour)) tm.tm_hour = 0; if (!TM_DEFINED (tm.tm_min)) tm.tm_min = 0; if (!TM_DEFINED (tm.tm_sec)) tm.tm_sec = 0; if (!localzone) adjzone (&tm, -pt->zone); wday = tm.tm_wday; /* Convert and fill in the rest of the tm. */ r = tm2time (&tm, localzone); /* Check weekday. */ if (r != -1 && TM_DEFINED (wday) && wday != tm.tm_wday) return -1; return r; } /* Parse a free-format date in SOURCE, yielding a Unix format time. */ time_t str2time (source, default_time, default_zone) char const *source; time_t default_time; long default_zone; { struct partime pt; if (*partime (source, &pt)) return -1; if (pt.zone == TM_UNDEFINED_ZONE) pt.zone = default_zone; return maketime (&pt, default_time); } #if TEST #include int main (argc, argv) int argc; char **argv; { time_t default_time = time ((time_t *) 0); long default_zone = argv[1] ? atol (argv[1]) : 0; char buf[1000]; while (fgets (buf, sizeof (buf), stdin)) { time_t t = str2time (buf, default_time, default_zone); printf ("%s", asctime (gmtime (&t))); } return 0; } #endif xdelta-1.1.3/libedsio/partime.c0000644006517700017500000004477307311304631012107 /* Parse a string, yielding a struct partime that describes it. */ /* Copyright 1993, 1994, 1995, 1997 Paul Eggert Distributed under license by the Free Software Foundation, Inc. This file is part of RCS. RCS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. RCS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with RCS; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Report problems and direct all questions to: rcs-bugs@cs.purdue.edu */ #if has_conf_h # include #else # if HAVE_CONFIG_H # include # else # ifndef __STDC__ # define const # endif # endif # if HAVE_LIMITS_H # include # endif # ifndef LONG_MIN # define LONG_MIN (-1-2147483647L) # endif # if STDC_HEADERS # include # endif # include # ifdef __STDC__ # define P(x) x # else # define P(x) () # endif #endif #include #if STDC_HEADERS # define CTYPE_DOMAIN(c) 1 #else # define CTYPE_DOMAIN(c) ((unsigned) (c) <= 0177) #endif #define ISALNUM(c) (CTYPE_DOMAIN (c) && isalnum (c)) #define ISALPHA(c) (CTYPE_DOMAIN (c) && isalpha (c)) #define ISSPACE(c) (CTYPE_DOMAIN (c) && isspace (c)) #define ISUPPER(c) (CTYPE_DOMAIN (c) && isupper (c)) #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9) #include char const partimeId[] = "$Id: partime.c 1.1 Mon, 22 Mar 1999 04:56:01 -0800 jmacd $"; /* Lookup tables for names of months, weekdays, time zones. */ #define NAME_LENGTH_MAXIMUM 4 struct name_val { char name[NAME_LENGTH_MAXIMUM]; int val; }; static char const *parse_decimal P ((char const *, int, int, int, int, int *, int *)); static char const *parse_fixed P ((char const *, int, int *)); static char const *parse_pattern_letter P ((char const *, int, struct partime *)); static char const *parse_prefix P ((char const *, struct partime *, int *)); static char const *parse_ranged P ((char const *, int, int, int, int *)); static int lookup P ((char const *, struct name_val const[])); static int merge_partime P ((struct partime *, struct partime const *)); static void undefine P ((struct partime *)); static struct name_val const month_names[] = { {"jan", 0}, {"feb", 1}, {"mar", 2}, {"apr", 3}, {"may", 4}, {"jun", 5}, {"jul", 6}, {"aug", 7}, {"sep", 8}, {"oct", 9}, {"nov", 10}, {"dec", 11}, {"", TM_UNDEFINED} }; static struct name_val const weekday_names[] = { {"sun", 0}, {"mon", 1}, {"tue", 2}, {"wed", 3}, {"thu", 4}, {"fri", 5}, {"sat", 6}, {"", TM_UNDEFINED} }; #define hr60nonnegative(t) ((t)/100 * 60 + (t)%100) #define hr60(t) ((t)<0 ? -hr60nonnegative(-(t)) : hr60nonnegative(t)) #define zs(t,s) {s, hr60(t)} #define zd(t,s,d) zs(t, s), zs((t)+100, d) static struct name_val const zone_names[] = { zs (-1000, "hst"), /* Hawaii */ zd (-1000, "hast", "hadt"), /* Hawaii-Aleutian */ zd (- 900, "akst", "akdt"), /* Alaska */ zd (- 800, "pst" , "pdt" ), /* Pacific */ zd (- 700, "mst" , "mdt" ), /* Mountain */ zd (- 600, "cst" , "cdt" ), /* Central */ zd (- 500, "est" , "edt" ), /* Eastern */ zd (- 400, "ast" , "adt" ), /* Atlantic */ zd (- 330, "nst" , "ndt" ), /* Newfoundland */ zs ( 000, "utc" ), /* Coordinated Universal */ zs ( 000, "uct" ), /* " */ zs ( 000, "cut" ), /* " */ zs ( 000, "ut"), /* Universal */ zs ( 000, "z"), /* Zulu (required by ISO 8601) */ zd ( 000, "gmt" , "bst" ), /* Greenwich Mean, British Summer */ zd ( 000, "wet" , "west"), /* Western European */ zd ( 100, "cet" , "cest"), /* Central European */ zd ( 100, "met" , "mest"), /* Middle European (bug in old tz versions) */ zd ( 100, "mez" , "mesz"), /* Mittel-Europaeische Zeit */ zd ( 200, "eet" , "eest"), /* Eastern European */ zs ( 530, "ist" ), /* India */ zd ( 900, "jst" , "jdt" ), /* Japan */ zd ( 900, "kst" , "kdt" ), /* Korea */ zd ( 1200, "nzst", "nzdt"), /* New Zealand */ {"lt", 1}, #if 0 /* The following names are duplicates or are not well attested. There are lots more where these came from. */ zs (-1100, "sst" ), /* Samoan */ zd (- 900, "yst" , "ydt" ), /* Yukon - name is no longer used */ zd (- 500, "ast" , "adt" ), /* Acre */ zd (- 400, "wst" , "wdt" ), /* Western Brazil */ zd (- 400, "cst" , "cdt" ), /* Chile */ zd (- 200, "fst" , "fdt" ), /* Fernando de Noronha */ zs ( 000, "wat" ), /* West African */ zs ( 100, "cat" ), /* Central African */ zs ( 200, "sat" ), /* South African */ zd ( 200, "ist" , "idt" ), /* Israel */ zs ( 300, "eat" ), /* East African */ zd ( 300, "msk" , "msd" ), /* Moscow */ zd ( 330, "ist" , "idt" ), /* Iran */ zs ( 800, "hkt" ), /* Hong Kong */ zs ( 800, "sgt" ), /* Singapore */ zd ( 800, "cst" , "cdt" ), /* China */ zd ( 800, "wst" , "wst" ), /* Western Australia */ zd ( 930, "cst" , "cst" ), /* Central Australia */ zs ( 1000, "gst" ), /* Guam */ zd ( 1000, "est" , "est" ), /* Eastern Australia */ #endif {"", -1} }; /* Look for a prefix of S in TABLE, returning val for first matching entry. */ static int lookup (s, table) char const *s; struct name_val const table[]; { int j; char buf[NAME_LENGTH_MAXIMUM]; for (j = 0; j < NAME_LENGTH_MAXIMUM; j++) { unsigned char c = *s++; if (! ISALPHA (c)) { buf[j] = '\0'; break; } buf[j] = ISUPPER (c) ? tolower (c) : c; } for (;; table++) for (j = 0; ; j++) if (j == NAME_LENGTH_MAXIMUM || ! table[0].name[j]) return table[0].val; else if (buf[j] != table[0].name[j]) break; } /* Set *T to ``undefined'' values. */ static void undefine (t) struct partime *t; { t->tm.tm_sec = t->tm.tm_min = t->tm.tm_hour = t->tm.tm_mday = t->tm.tm_mon = t->tm.tm_year = t->tm.tm_wday = t->tm.tm_yday = t->ymodulus = t->yweek = TM_UNDEFINED; t->zone = TM_UNDEFINED_ZONE; } /* Array of patterns to look for in a date string. Order is important: we look for the first matching pattern whose values do not contradict values that we already know about. See `parse_pattern_letter' below for the meaning of the pattern codes. */ static char const *const patterns[] = { /* These traditional patterns must come first, to prevent an ISO 8601 format from misinterpreting their prefixes. */ "E_n_y", "x", /* RFC 822 */ "E_n", "n_E", "n", "t:m:s_A", "t:m_A", "t_A", /* traditional */ "y/N/D$", /* traditional RCS */ /* ISO 8601:1988 formats, generalized a bit. */ "y-N-D$", "4ND$", "Y-N$", "RND$", "-R=N$", "-R$", "--N=D$", "N=DT", "--N$", "---D$", "DT", "Y-d$", "4d$", "R=d$", "-d$", "dT", "y-W-X", "yWX", "y=W", "-r-W-X", "r-W-XT", "-rWX", "rWXT", "-W=X", "W=XT", "-W", "-w-X", "w-XT", "---X$", "XT", "4$", "T", "h:m:s$", "hms$", "h:m$", "hm$", "h$", "-m:s$", "-ms$", "-m$", "--s$", "Y", "Z", 0 }; /* Parse an initial prefix of STR, setting *T accordingly. Return the first character after the prefix, or 0 if it couldn't be parsed. Start with pattern *PI; if success, set *PI to the next pattern to try. Set *PI to -1 if we know there are no more patterns to try; if *PI is initially negative, give up immediately. */ static char const * parse_prefix (str, t, pi) char const *str; struct partime *t; int *pi; { int i = *pi; char const *pat; unsigned char c; if (i < 0) return 0; /* Remove initial noise. */ while (! ISALNUM (c = *str) && c != '-' && c != '+') { if (! c) { undefine (t); *pi = -1; return str; } str++; } /* Try a pattern until one succeeds. */ while ((pat = patterns[i++]) != 0) { char const *s = str; undefine (t); do { if (! (c = *pat++)) { *pi = i; return s; } } while ((s = parse_pattern_letter (s, c, t)) != 0); } return 0; } /* Parse an initial prefix of S of length DIGITS; it must be a number. Store the parsed number into *RES. Return the first character after the prefix, or 0 if it wasn't parsed. */ static char const * parse_fixed (s, digits, res) char const *s; int digits, *res; { int n = 0; char const *lim = s + digits; while (s < lim) { unsigned d = *s++ - '0'; if (9 < d) return 0; n = 10 * n + d; } *res = n; return s; } /* Parse an initial prefix of S of length DIGITS; it must be a number in the range LO through HI. Store the parsed number into *RES. Return the first character after the prefix, or 0 if it wasn't parsed. */ static char const * parse_ranged (s, digits, lo, hi, res) char const *s; int digits, lo, hi, *res; { s = parse_fixed (s, digits, res); return s && lo <= *res && *res <= hi ? s : 0; } /* Parse an initial prefix of S of length DIGITS; it must be a number in the range LO through HI and it may be followed by a fraction to be computed using RESOLUTION. Store the parsed number into *RES; store the fraction times RESOLUTION, rounded to the nearest integer, into *FRES. Return the first character after the prefix, or 0 if it wasn't parsed. */ static char const * parse_decimal (s, digits, lo, hi, resolution, res, fres) char const *s; int digits, lo, hi, resolution, *res, *fres; { s = parse_fixed (s, digits, res); if (s && lo <= *res && *res <= hi) { int f = 0; if ((s[0] == ',' || s[0] == '.') && ISDIGIT (s[1])) { char const *s1 = ++s; int num10 = 0, denom10 = 10, product; while (ISDIGIT (*++s)) { int d = denom10 * 10; if (d / 10 != denom10) return 0; /* overflow */ denom10 = d; } s = parse_fixed (s1, (int) (s - s1), &num10); product = num10 * resolution; f = (product + (denom10 >> 1)) / denom10; f -= f & (product % denom10 == denom10 >> 1); /* round to even */ if (f < 0 || product/resolution != num10) return 0; /* overflow */ } *fres = f; return s; } return 0; } /* Parse an initial prefix of S; it must denote a time zone. Set *ZONE to the number of seconds east of GMT, or to TM_LOCAL_ZONE if it is the local time zone. Return the first character after the prefix, or 0 if it wasn't parsed. */ char * parzone (s, zone) char const *s; long *zone; { char sign; int hh, mm, ss; int minutesEastOfUTC; long offset, z; /* The formats are LT, n, n DST, nDST, no, o where n is a time zone name and o is a time zone offset of the form [-+]hh[:mm[:ss]]. */ switch (*s) { case '-': case '+': z = 0; break; default: minutesEastOfUTC = lookup (s, zone_names); if (minutesEastOfUTC == -1) return 0; /* Don't bother to check rest of spelling. */ while (ISALPHA ((unsigned char) *s)) s++; /* Don't modify LT. */ if (minutesEastOfUTC == 1) { *zone = TM_LOCAL_ZONE; return (char *) s; } z = minutesEastOfUTC * 60L; /* Look for trailing " DST". */ if ((s[-1] == 'T' || s[-1] == 't') && (s[-2] == 'S' || s[-2] == 's') && (s[-3] == 'D' || s[-3] == 'd')) goto trailing_dst; while (ISSPACE ((unsigned char) *s)) s++; if ((s[0] == 'D' || s[0] == 'd') && (s[1] == 'S' || s[1] == 's') && (s[2] == 'T' || s[2] == 't')) { s += 3; trailing_dst: *zone = z + 60*60; return (char *) s; } switch (*s) { case '-': case '+': break; default: *zone = z; return (char *) s; } break; } sign = *s++; if (! (s = parse_ranged (s, 2, 0, 23, &hh))) return 0; mm = ss = 0; if (*s == ':') s++; if (ISDIGIT (*s)) { if (! (s = parse_ranged (s, 2, 0, 59, &mm))) return 0; if (*s == ':' && s[-3] == ':' && ISDIGIT (s[1]) && ! (s = parse_ranged (s + 1, 2, 0, 59, &ss))) return 0; } if (ISDIGIT (*s)) return 0; offset = (hh * 60 + mm) * 60L + ss; *zone = z + (sign == '-' ? -offset : offset); /* ?? Are fractions allowed here? If so, they're not implemented. */ return (char *) s; } /* Parse an initial prefix of S, matching the pattern whose code is C. Set *T accordingly. Return the first character after the prefix, or 0 if it wasn't parsed. */ static char const * parse_pattern_letter (s, c, t) char const *s; int c; struct partime *t; { switch (c) { case '$': /* The next character must be a non-digit. */ if (ISDIGIT (*s)) return 0; break; case '-': case '/': case ':': /* These characters stand for themselves. */ if (*s++ != c) return 0; break; case '4': /* 4-digit year */ s = parse_fixed (s, 4, &t->tm.tm_year); break; case '=': /* optional '-' */ s += *s == '-'; break; case 'A': /* AM or PM */ /* This matches the regular expression [AaPp][Mm]?. It must not be followed by a letter or digit; otherwise it would match prefixes of strings like "PST". */ switch (*s++) { case 'A': case 'a': if (t->tm.tm_hour == 12) t->tm.tm_hour = 0; break; case 'P': case 'p': if (t->tm.tm_hour != 12) t->tm.tm_hour += 12; break; default: return 0; } switch (*s) { case 'M': case 'm': s++; break; } if (ISALNUM ((unsigned char) *s)) return 0; break; case 'D': /* day of month [01-31] */ s = parse_ranged (s, 2, 1, 31, &t->tm.tm_mday); break; case 'd': /* day of year [001-366] */ s = parse_ranged (s, 3, 1, 366, &t->tm.tm_yday); t->tm.tm_yday--; break; case 'E': /* extended day of month [1-9, 01-31] */ s = parse_ranged (s, (ISDIGIT (s[0]) && ISDIGIT (s[1])) + 1, 1, 31, &t->tm.tm_mday); break; case 'h': /* hour [00-23 followed by optional fraction] */ { int frac; s = parse_decimal (s, 2, 0, 23, 60 * 60, &t->tm.tm_hour, &frac); t->tm.tm_min = frac / 60; t->tm.tm_sec = frac % 60; } break; case 'm': /* minute [00-59 followed by optional fraction] */ s = parse_decimal (s, 2, 0, 59, 60, &t->tm.tm_min, &t->tm.tm_sec); break; case 'n': /* month name [e.g. "Jan"] */ if (! TM_DEFINED (t->tm.tm_mon = lookup (s, month_names))) return 0; /* Don't bother to check rest of spelling. */ while (ISALPHA ((unsigned char) *s)) s++; break; case 'N': /* month [01-12] */ s = parse_ranged (s, 2, 1, 12, &t->tm.tm_mon); t->tm.tm_mon--; break; case 'r': /* year % 10 (remainder in origin-0 decade) [0-9] */ s = parse_fixed (s, 1, &t->tm.tm_year); t->ymodulus = 10; break; case_R: case 'R': /* year % 100 (remainder in origin-0 century) [00-99] */ s = parse_fixed (s, 2, &t->tm.tm_year); t->ymodulus = 100; break; case 's': /* second [00-60 followed by optional fraction] */ { int frac; s = parse_decimal (s, 2, 0, 60, 1, &t->tm.tm_sec, &frac); t->tm.tm_sec += frac; } break; case 'T': /* 'T' or 't' */ switch (*s++) { case 'T': case 't': break; default: return 0; } break; case 't': /* traditional hour [1-9 or 01-12] */ s = parse_ranged (s, (ISDIGIT (s[0]) && ISDIGIT (s[1])) + 1, 1, 12, &t->tm.tm_hour); break; case 'w': /* 'W' or 'w' only (stands for current week) */ switch (*s++) { case 'W': case 'w': break; default: return 0; } break; case 'W': /* 'W' or 'w', followed by a week of year [00-53] */ switch (*s++) { case 'W': case 'w': break; default: return 0; } s = parse_ranged (s, 2, 0, 53, &t->yweek); break; case 'X': /* weekday (1=Mon ... 7=Sun) [1-7] */ s = parse_ranged (s, 1, 1, 7, &t->tm.tm_wday); t->tm.tm_wday--; break; case 'x': /* weekday name [e.g. "Sun"] */ if (! TM_DEFINED (t->tm.tm_wday = lookup (s, weekday_names))) return 0; /* Don't bother to check rest of spelling. */ while (ISALPHA ((unsigned char) *s)) s++; break; case 'y': /* either R or Y */ if (ISDIGIT (s[0]) && ISDIGIT (s[1]) && ! ISDIGIT (s[2])) goto case_R; /* fall into */ case 'Y': /* year in full [4 or more digits] */ { int len = 0; while (ISDIGIT (s[len])) len++; if (len < 4) return 0; s = parse_fixed (s, len, &t->tm.tm_year); } break; case 'Z': /* time zone */ s = parzone (s, &t->zone); break; case '_': /* possibly empty sequence of non-alphanumerics */ while (! ISALNUM ((unsigned char) *s) && *s) s++; break; default: /* bad pattern */ return 0; } return s; } /* If there is no conflict, merge into *T the additional information in *U and return 0. Otherwise do nothing and return -1. */ static int merge_partime (t, u) struct partime *t; struct partime const *u; { # define conflict(a,b) ((a) != (b) && TM_DEFINED (a) && TM_DEFINED (b)) if (conflict (t->tm.tm_sec, u->tm.tm_sec) || conflict (t->tm.tm_min, u->tm.tm_min) || conflict (t->tm.tm_hour, u->tm.tm_hour) || conflict (t->tm.tm_mday, u->tm.tm_mday) || conflict (t->tm.tm_mon, u->tm.tm_mon) || conflict (t->tm.tm_year, u->tm.tm_year) || conflict (t->tm.tm_wday, u->tm.tm_yday) || conflict (t->ymodulus, u->ymodulus) || conflict (t->yweek, u->yweek) || (t->zone != u->zone && t->zone != TM_UNDEFINED_ZONE && u->zone != TM_UNDEFINED_ZONE)) return -1; # undef conflict # define merge_(a,b) if (TM_DEFINED (b)) (a) = (b); merge_ (t->tm.tm_sec, u->tm.tm_sec) merge_ (t->tm.tm_min, u->tm.tm_min) merge_ (t->tm.tm_hour, u->tm.tm_hour) merge_ (t->tm.tm_mday, u->tm.tm_mday) merge_ (t->tm.tm_mon, u->tm.tm_mon) merge_ (t->tm.tm_year, u->tm.tm_year) merge_ (t->tm.tm_wday, u->tm.tm_yday) merge_ (t->ymodulus, u->ymodulus) merge_ (t->yweek, u->yweek) # undef merge_ if (u->zone != TM_UNDEFINED_ZONE) t->zone = u->zone; return 0; } /* Parse a date/time prefix of S, putting the parsed result into *T. Return the first character after the prefix. The prefix may contain no useful information; in that case, *T will contain only undefined values. */ char * partime (s, t) char const *s; struct partime *t; { struct partime p; undefine (t); while (*s) { int i = 0; char const *s1; do { if (! (s1 = parse_prefix (s, &p, &i))) return (char *) s; } while (merge_partime (t, &p) != 0); s = s1; } return (char *) s; } xdelta-1.1.3/libedsio/edsiotest.c0000644006517700017500000001164507311304631012441 /* -*-Mode: C;-*- * $Id: edsiotest.c 1.6 Sat, 03 Apr 1999 03:23:54 -0800 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #include "edsio.h" void test1 () { guint32 x = 0; PropTest *pt = g_new0 (PropTest, 1); EdsioPropTestUintProperty prop; g_assert (edsio_edsio_init ()); g_assert (edsio_new_proptest_uint_property ("Just testing (1)...", PF_Persistent, & prop)); g_assert (! proptest_isset_uint (pt, prop)); g_assert (proptest_set_uint (pt, prop, 42)); g_assert (proptest_isset_uint (pt, prop)); g_assert (proptest_get_uint (pt, prop, & x) && x == 42); /* kill the cache, to test persistence. */ pt->_edsio_property_table = NULL; g_assert (proptest_get_uint (pt, prop, & x) && x == 42); g_assert (proptest_unset_uint (pt, prop)); g_assert (! proptest_isset_uint (pt, prop)); g_assert (! pt->_edsio_property_table); } void test2 () { const char* str = "hello there"; const char* str2; guint32 str2_len; PropTest *pt = g_new0 (PropTest, 1); EdsioPropTestBytesProperty prop; g_assert (edsio_edsio_init ()); g_assert (edsio_new_proptest_bytes_property ("Just testing (2)...", PF_Persistent, & prop)); g_assert (! proptest_isset_bytes (pt, prop)); g_assert (proptest_set_bytes (pt, prop, (guint8*) str, strlen (str) + 1)); g_assert (proptest_isset_bytes (pt, prop)); g_assert (proptest_get_bytes (pt, prop, (const guint8**) & str2, & str2_len) && str2_len == (strlen (str) + 1) && strcmp (str, str2) == 0); /* kill the cache, to test persistence. */ pt->_edsio_property_table = NULL; g_assert (proptest_get_bytes (pt, prop, (const guint8**) & str2, & str2_len) && str2_len == (strlen (str) + 1) && strcmp (str, str2) == 0); g_assert (proptest_unset_bytes (pt, prop)); g_assert (! proptest_isset_bytes (pt, prop)); g_assert (! pt->_edsio_property_table); } void test3 () { SerialEdsioUint x; SerialEdsioUint *p; EdsioPropTestEdsioUintProperty prop; PropTest *pt = g_new0 (PropTest, 1); x.val = 42; g_assert (edsio_edsio_init ()); g_assert (edsio_new_proptest_edsiouint_property ("Just testing (3)...", PF_Persistent, & prop)); g_assert (! proptest_isset_edsiouint (pt, prop)); g_assert (proptest_set_edsiouint (pt, prop, & x)); g_assert (proptest_isset_edsiouint (pt, prop)); g_assert (proptest_get_edsiouint (pt, prop, & p) && x.val == p->val); /* kill the cache, to test persistence. */ pt->_edsio_property_table = NULL; g_assert (proptest_get_edsiouint (pt, prop, & p) && x.val == p->val); g_assert (proptest_unset_edsiouint (pt, prop)); g_assert (! proptest_isset_edsiouint (pt, prop)); g_assert (! pt->_edsio_property_table); } void test4 () { const char* str = "hello there"; const char* str2; PropTest *pt = g_new0 (PropTest, 1); EdsioPropTestStringProperty prop; g_assert (edsio_edsio_init ()); g_assert (edsio_new_proptest_string_property ("Just testing (4)...", PF_Persistent, & prop)); g_assert (! proptest_isset_string (pt, prop)); g_assert (proptest_set_string (pt, prop, str)); g_assert (proptest_isset_string (pt, prop)); g_assert (proptest_get_string (pt, prop, & str2) && strcmp (str, str2) == 0); /* kill the cache, to test persistence. */ pt->_edsio_property_table = NULL; g_assert (proptest_get_string (pt, prop, & str2) && strcmp (str, str2) == 0); g_assert (proptest_unset_string (pt, prop)); g_assert (! proptest_isset_string (pt, prop)); g_assert (! pt->_edsio_property_table); } void test5 () { GByteArray* sink_result; SerialSink* sink = edsio_simple_sink (NULL, SBF_Checksum | SBF_Base64 | SBF_Compress, FALSE, NULL, & sink_result); SerialSource* src; const char* input = "hello there!!!!!!!!"; SerialEdsioString *output; guint8 zero[1]; zero[0] = 0; g_assert (serialize_edsiostring (sink, input)); g_assert (sink->sink_close (sink)); g_byte_array_append (sink_result, zero, 1); g_print ("%s -> %s\n", input, sink_result->data); src = edsio_simple_source (sink_result->data, sink_result->len - 1, SBF_Checksum | SBF_Base64 | SBF_Compress); g_assert (unserialize_edsiostring (src, & output)); g_assert (src->source_close (src)); g_assert (strcmp (output->val, input) == 0); } void test6 () { const char* md5str = "aed3918c4ccb89f2dcf74d5dcab22989"; const char* md5strbad1 = "aed3918c4cXb89f2dcf74d5dcab22989"; const char* md5strbad2 = "aed3918c4cab89f2dcf74d5dcab22989X"; const char* md5strbad3 = "aed3918c4cab89f2dcf74d5dcab2298"; char md5str2[33]; guint8 md5[16]; g_assert (! edsio_md5_from_string (md5, md5strbad1)); g_assert (! edsio_md5_from_string (md5, md5strbad2)); g_assert (! edsio_md5_from_string (md5, md5strbad3)); g_assert (edsio_md5_from_string (md5, md5str)); edsio_md5_to_string (md5, md5str2); g_assert (strcmp (md5str, md5str2) == 0); } int main () { test1 (); test2 (); test3 (); test4 (); test5 (); test6 (); return 0; } xdelta-1.1.3/libedsio/edsio.h0000644006517700017500000004645607311304631011556 /* -*-Mode: C;-*- * $Id: edsio.h 1.15.1.1 Mon, 11 Jun 2001 01:56:01 -0700 jmacd $ * * Copyright (C) 1998, 1999, Josh MacDonald. * All Rights Reserved. * * Author: Josh MacDonald */ #ifndef _EDSIO_H_ #define _EDSIO_H_ #ifdef __cplusplus extern "C" { #endif #ifdef HAVE_CONFIG_H #include #endif #include #include #include typedef struct _SerialSource SerialSource; typedef struct _SerialSink SerialSink; typedef gint32 SerialType; typedef struct _HandleFuncTable HandleFuncTable; typedef struct _PropTest PropTest; typedef struct _FileHandle FileHandle; struct _FileHandle { const HandleFuncTable* table; /* This is an opaque type, feel free to define your own, just make * sure that the first field of yours is one of these, and that you * supply a table. */ }; #define EDSIO_LIBRARY_OFFSET_BITS 8 #define EDSIO_LIBRARY_OFFSET_MASK 0xff #include "edsio_edsio.h" #define ST_Error -1 #define ST_IncorrectType -2 #define ST_NotFound -3 #define ALIGN_8(v) if (((v) % 8) != 0) { (v) += 8; (v) &= ~7; } /* This serves as a virtual table for I/O to the FileHandle */ struct _HandleFuncTable { gssize (* table_handle_length) (FileHandle *fh); gssize (* table_handle_pages) (FileHandle *fh); gssize (* table_handle_pagesize) (FileHandle *fh); gssize (* table_handle_map_page) (FileHandle *fh, guint pgno, const guint8** mem); gboolean (* table_handle_unmap_page) (FileHandle *fh, guint pgno, const guint8** mem); const guint8* (* table_handle_checksum_md5) (FileHandle *fh); gboolean (* table_handle_close) (FileHandle *fh, gint flags); gboolean (* table_handle_write) (FileHandle *fh, const guint8 *buf, gsize nbyte); gboolean (* table_handle_copy) (FileHandle *from, FileHandle *to, guint off, guint len); gboolean (* table_handle_getui) (FileHandle *fh, guint32* i); gboolean (* table_handle_putui) (FileHandle *fh, guint32 i); gssize (* table_handle_read) (FileHandle *fh, guint8 *buf, gsize nbyte); const gchar* (* table_handle_name) (FileHandle *fh); /* user must free */ }; struct _SerialSource { /* Internal variables: don't touch. */ guint32 alloc_total; guint32 alloc_pos; void *alloc_buf; void *alloc_buf_orig; /* These are setup by init. */ SerialType (* source_type) (SerialSource* source, gboolean set_allocation); gboolean (* source_close) (SerialSource* source); gboolean (* source_read) (SerialSource* source, guint8 *ptr, guint32 len); void (* source_free) (SerialSource* source); /* These may be NULL */ void* (* salloc_func) (SerialSource* source, guint32 len); void (* sfree_func) (SerialSource* source, void* ptr); /* Public functions, defaulted, but may be over-ridden * before calls to unserialize. */ gboolean (* next_bytes_known) (SerialSource* source, guint8 *ptr, guint32 len); gboolean (* next_bytes) (SerialSource* source, const guint8 **ptr, guint32 *len); gboolean (* next_uint) (SerialSource* source, guint32 *ptr); gboolean (* next_uint32) (SerialSource* source, guint32 *ptr); gboolean (* next_uint16) (SerialSource* source, guint16 *ptr); gboolean (* next_uint8) (SerialSource* source, guint8 *ptr); gboolean (* next_bool) (SerialSource* source, gboolean *ptr); gboolean (* next_string) (SerialSource* source, const char **ptr); }; struct _SerialSink { /* These are setup by init. */ gboolean (* sink_type) (SerialSink* sink, SerialType type, guint mem_size, gboolean set_allocation); gboolean (* sink_close) (SerialSink* sink); gboolean (* sink_write) (SerialSink* sink, const guint8 *ptr, guint32 len); void (* sink_free) (SerialSink* sink); /* This may be null, called after each object is serialized. */ gboolean (* sink_quantum) (SerialSink* sink); /* Public functions, defaulted, but may be over-ridden * before calls to serialize. */ gboolean (* next_bytes_known) (SerialSink* sink, const guint8 *ptr, guint32 len); gboolean (* next_bytes) (SerialSink* sink, const guint8 *ptr, guint32 len); gboolean (* next_uint) (SerialSink* sink, guint32 ptr); gboolean (* next_uint32) (SerialSink* sink, guint32 ptr); gboolean (* next_uint16) (SerialSink* sink, guint16 ptr); gboolean (* next_uint8) (SerialSink* sink, guint8 ptr); gboolean (* next_bool) (SerialSink* sink, gboolean ptr); gboolean (* next_string) (SerialSink* sink, const char *ptr); }; void serializeio_initialize_type (const char* name, guint32 val, gboolean (*unserialize_func) (), gboolean (*serialize_func) (), guint (*count_func) (), void (*print_func) ()); const char* serializeio_generic_type_to_string (SerialType type); void serializeio_generic_print (SerialType type, void* object, guint indent_spaces); gboolean serializeio_serialize_generic (SerialSink *sink, SerialType object_type, void *object); gboolean serializeio_serialize_generic_internal (SerialSink *sink, SerialType object_type, void *object, gboolean set_allocation); guint serializeio_generic_count (SerialType object_type, void *object); gboolean serializeio_unserialize_generic (SerialSource *source, SerialType *object_type, void **object); gboolean serializeio_unserialize_generic_internal (SerialSource *source, SerialType *object_type, void **object, gboolean set_allocation); gboolean serializeio_unserialize_generic_acceptable (SerialSource* source, guint32 acceptable, SerialType *object_type, void **object); void serializeio_sink_init (SerialSink* sink, gboolean (* sink_type) (SerialSink* sink, SerialType type, guint mem_size, gboolean set_allocation), gboolean (* sink_close) (SerialSink* sink), gboolean (* sink_write) (SerialSink* sink, const guint8 *ptr, guint32 len), void (* sink_free) (SerialSink* sink), gboolean (* sink_quantum) (SerialSink* sink)); void serializeio_source_init (SerialSource* source, SerialType (* source_type) (SerialSource* source, gboolean set_allocation), gboolean (* source_close) (SerialSource* source), gboolean (* source_read) (SerialSource* source, guint8 *ptr, guint32 len), void (* source_free) (SerialSource* source), void* (* salloc_func) (SerialSource* source, guint32 len), void (* sfree_func) (SerialSource* source, void* ptr)); /* These two functions are internal, don't use. */ gboolean serializeio_source_object_received (SerialSource* source); void* serializeio_source_alloc (SerialSource* source, guint32 len); SerialSink* serializeio_gzip_sink (SerialSink* sink); SerialSource* serializeio_gzip_source (SerialSource* source); SerialSink* serializeio_checksum_sink (SerialSink* sink); SerialSource* serializeio_checksum_source (SerialSource* source); SerialSink* serializeio_base64_sink (SerialSink* sink); SerialSource* serializeio_base64_source (SerialSource* source); SerialSource* handle_source (FileHandle *fh); SerialSink* handle_sink (FileHandle *fh, gpointer data1, gpointer data2, gpointer data3, gboolean (* cont_onclose) (gpointer data1, gpointer data2, gpointer data3)); gboolean unserialize_uint (SerialSource *source, guint32** x); gboolean serialize_uint_obj (SerialSink *sink, guint32* x); gboolean unserialize_string (SerialSource *source, const char** x); gboolean serialize_string_obj (SerialSink *sink, const char* x); /* These are a bit odd, and edsio_property_bytes_{g,s}etter account for it. * Try not to use yourself. */ gboolean unserialize_bytes (SerialSource *source, SerialEdsioBytes** x); gboolean serialize_bytes_obj (SerialSink *sink, SerialEdsioBytes *x); /* Event delivery */ enum _EventLevel { EL_Information = 1<<0, EL_Warning = 1<<5, EL_Error = 1<<10, EL_InternalError = 1<<15, EL_FatalError = 1<<20 }; typedef enum _EventLevel EventLevel; enum _EventFlags { EF_None = 1<<0, EF_OpenSSL = 1<<1 }; typedef enum _EventFlags EventFlags; const char* eventdelivery_int_to_string (int x); const char* eventdelivery_string_to_string (const char* x); const char* eventdelivery_source_to_string (SerialSource* x); const char* eventdelivery_sink_to_string (SerialSink* x); const char* eventdelivery_handle_to_string (FileHandle* x); void serializeio_print_bytes (const guint8* buf, guint len); /* Event delivery privates */ typedef struct _GenericEventDef GenericEventDef; typedef struct _GenericEvent GenericEvent; struct _GenericEvent { gint code; const char* srcfile; guint srcline; }; GenericEventDef* eventdelivery_event_lookup (gint code); void eventdelivery_event_deliver (GenericEvent* e); typedef gboolean (* ErrorDeliveryFunc) (GenericEvent* ev, GenericEventDef* def, const char* message); void eventdelivery_event_watch_all (ErrorDeliveryFunc func); void eventdelivery_initialize_event_def (gint code, gint level, gint flags, const char* name, const char* oneline, const char * (* field_to_string) (GenericEvent* ev, gint field)); const char* eventdelivery_ssl_errors_to_string (void); struct _GenericEventDef { gint code; gint level; gint flags; const char *name; const char *oneline; const char * (* field_to_string) (GenericEvent* ev, gint field); }; /* MD5.H - header file for MD5C.C */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ /* MD5 context. */ typedef struct { guint32 state[4]; /* state (ABCD) */ guint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ guint8 buffer[64]; /* input buffer */ } EdsioMD5Ctx; void edsio_md5_init (EdsioMD5Ctx *); void edsio_md5_update (EdsioMD5Ctx *, const guint8 *, guint); void edsio_md5_final (guint8*, EdsioMD5Ctx *); gint edsio_md5_equal (gconstpointer v, gconstpointer v2); guint edsio_md5_hash (gconstpointer v); void edsio_md5_to_string (const guint8* md5, char buf[33]); gboolean edsio_md5_from_string (guint8* md5, const char buf[33]); /* NIST Secure Hash Algorithm */ /* heavily modified from Peter C. Gutmann's implementation */ /* then taken from from Uwe Hollerbach, */ /* and then modified a little by Josh MacDonald. */ /* This code is in the public domain */ typedef struct { guint32 digest[5]; /* message digest */ guint32 count_lo, count_hi; /* 64-bit bit count */ guint32 data[16]; /* SHA data buffer */ int local; /* unprocessed amount in data */ } EdsioSHACtx; void edsio_sha_init (EdsioSHACtx *); void edsio_sha_update (EdsioSHACtx *, const guint8 *, guint); void edsio_sha_final (guint8 *, EdsioSHACtx *); gint edsio_sha_equal (gconstpointer v, gconstpointer v2); guint edsio_sha_hash (gconstpointer v); /* Misc stuff. */ /* These raise an error if errmsg is non-null. The errmsg should * be something like "Invalid port number". See edsio.ser for the * format. */ gboolean strtosi_checked (const char* str, gint32* i, const char* errmsg); gboolean strtoss_checked (const char* str, gint16* s, const char* errmsg); gboolean strtoui_checked (const char* str, guint32* i, const char* errmsg); gboolean strtous_checked (const char* str, guint16* i, const char* errmsg); const char* edsio_intern_string (const char* str); GByteArray* edsio_base64_encode_region (const guint8* data, guint data_len); GByteArray* edsio_base64_decode_region (const guint8* data, guint data_len); gboolean edsio_base64_encode_region_into (const guint8* data, guint data_len, guint8* out, guint *out_len); gboolean edsio_base64_decode_region_into (const guint8* data, guint data_len, guint8* out, guint *out_len); gchar* edsio_time_to_iso8601 (SerialGenericTime* time); gchar* edsio_time_t_to_iso8601 (GTime time); gboolean edsio_time_of_day (SerialGenericTime* time); enum _SimpleBufferFlags { SBF_None = 0, SBF_Compress = 1 << 0, SBF_Checksum = 1 << 1, SBF_Base64 = 1 << 2 }; typedef enum _SimpleBufferFlags SimpleBufferFlags; SerialSource* edsio_simple_source (const guint8* data, guint len, guint flags); SerialSink* edsio_simple_sink (gpointer data, guint flags, gboolean free_result, void (* success) (gpointer data, GByteArray* result), GByteArray **result); gboolean edsio_library_check (guint32 number); void edsio_library_register (guint32 number, const char*name); /* (Persistent) Property stuff. */ enum _PropertyFlags { PF_None = 0, PF_Persistent = 1 }; typedef enum _PropertyFlags PropertyFlags; typedef struct _EdsioProperty EdsioProperty; typedef union _EdsioPropertyEntry EdsioPropertyEntry; typedef struct _EdsioGenericProperty EdsioGenericProperty; typedef void (* PropFreeFunc) (gpointer obj); typedef gboolean (* PropGSFunc) (/*gpointer obj, GHashTable** obj_table, EdsioProperty* prop, ... */); typedef gboolean (* PropSerialize) (/*SerialSink* sink, ... */); typedef gboolean (* PropUnserialize) (/*SerialSource* source, ... */); typedef GHashTable** (* PropertyTableFunc) (gpointer obj); typedef SerialSource* (* PersistSourceFunc) (gpointer obj, const char* prop_name); typedef SerialSink* (* PersistSinkFunc) (gpointer obj, const char* prop_name); typedef gboolean (* PersistIssetFunc) (gpointer obj, const char* prop_name); typedef gboolean (* PersistUnsetFunc) (gpointer obj, const char* prop_name); void edsio_initialize_property_type (const char* t, PropFreeFunc freer, PropGSFunc getter, PropGSFunc setter, PropSerialize ser, PropUnserialize unser); void edsio_initialize_host_type (const char* ph, PropertyTableFunc ptable, PersistSourceFunc source, PersistSinkFunc sink, PersistIssetFunc isset, PersistUnsetFunc unset); gboolean edsio_property_isset (const char* ph, const char* t, guint32 code, gpointer obj); gboolean edsio_property_unset (const char* ph, const char* t, guint32 code, gpointer obj); PropGSFunc edsio_property_getter (const char* ph, const char* t, guint32 code, EdsioProperty** prop); PropGSFunc edsio_property_setter (const char* ph, const char* t, guint32 code, EdsioProperty** prop); void edsio_property_uint_free (gpointer obj); gboolean edsio_property_uint_getter (gpointer obj, EdsioProperty* ep, guint32* get); gboolean edsio_property_uint_setter (gpointer obj, EdsioProperty* ep, guint32 set); void edsio_property_string_free (gpointer obj); gboolean edsio_property_string_getter (gpointer obj, EdsioProperty* ep, const char** get); gboolean edsio_property_string_setter (gpointer obj, EdsioProperty* ep, const char* set); void edsio_property_bytes_free (gpointer obj); gboolean edsio_property_bytes_getter (gpointer obj, EdsioProperty* ep, guint8** get, guint32 *get_len); gboolean edsio_property_bytes_setter (gpointer obj, EdsioProperty* ep, guint8* set, guint32 set_len); void edsio_property_vptr_free (gpointer obj); gboolean edsio_property_vptr_getter (gpointer obj, EdsioProperty* ep, void** get); gboolean edsio_property_vptr_setter (gpointer obj, EdsioProperty* ep, void* set); EdsioPropertyEntry* edsio_property_get (gpointer obj, EdsioProperty* ep); gboolean edsio_property_set (gpointer obj, EdsioProperty* ep, EdsioPropertyEntry* set); gboolean edsio_new_property (const char* name, const char* ph, const char* t, guint32 flags, EdsioGenericProperty* prop); /* Testing... */ #define DEBUG_LIBEDSIO #ifdef DEBUG_LIBEDSIO struct _PropTest { GHashTable* _edsio_property_table; GHashTable* ptable; const char* kludge; }; GHashTable** edsio_proptest_property_table (PropTest *pt); SerialSource* edsio_persist_proptest_source (PropTest *pt, const char* prop_name); SerialSink* edsio_persist_proptest_sink (PropTest *pt, const char* prop_name); gboolean edsio_persist_proptest_isset (PropTest *pt, const char* prop_name); gboolean edsio_persist_proptest_unset (PropTest *pt, const char* prop_name); #endif /* Missing glib stuff */ typedef struct _GQueue GQueue; struct _GQueue { GList *list; GList *list_end; guint list_size; }; /* Queues */ GQueue * g_queue_new (void); void g_queue_free (GQueue *q); guint g_queue_get_size (GQueue *q); void g_queue_push_front (GQueue *q, gpointer data); void g_queue_push_back (GQueue *q, gpointer data); gpointer g_queue_pop_front (GQueue *q); gpointer g_queue_pop_back (GQueue *q); #define g_queue_empty(queue) \ ((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? FALSE : TRUE) #define g_queue_peek_front(queue) \ ((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? \ ((GQueue *)(queue))->list->data : NULL) #define g_queue_peek_back(queue) \ ((((GQueue *)(queue)) && ((GQueue *)(queue))->list_end) ? \ ((GQueue *)(queue))->list_end->data : NULL) #define g_queue_index(queue,ptr) \ ((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? \ g_list_index (((GQueue *)(queue))->list, (ptr)) : -1) #define g_queue_push g_queue_push_back #define g_queue_pop g_queue_pop_front #define g_queue_peek g_queue_peek_front #ifdef __cplusplus } #endif #endif /* _EDSIO_H_ */ xdelta-1.1.3/libedsio/edsio_edsio.h0000644006517700017500000004115707311305144012732 /* -*-Mode: C;-*- * Copyright (C) 1997, 1998, 1999 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * This file was AUTOMATICALLY GENERATED using: * * $Id: edsio.el 1.16 Tue, 06 Apr 1999 23:40:10 -0700 jmacd $ */ #include "edsio.h" #include "edsio.h" #ifndef _EDSIO_EDSIO_H_ #define _EDSIO_EDSIO_H_ #ifdef __cplusplus extern "C" { #endif /* Initialize this library. */ gboolean edsio_edsio_init (void); /* Types defined here. */ /* EdsioStringStringStringEventCode. */ typedef struct _EdsioStringStringStringEventCode EdsioStringStringStringEventCode; struct _EdsioStringStringStringEventCode { gint code; }; typedef struct _EdsioStringStringStringEvent EdsioStringStringStringEvent; struct _EdsioStringStringStringEvent { gint code; const char* srcfile; guint srcline; const char* name; const char* recv; const char* expect; }; /* EdsioIntEventCode. */ typedef struct _EdsioIntEventCode EdsioIntEventCode; struct _EdsioIntEventCode { gint code; }; typedef struct _EdsioIntEvent EdsioIntEvent; struct _EdsioIntEvent { gint code; const char* srcfile; guint srcline; int num; }; /* EdsioStringEventCode. */ typedef struct _EdsioStringEventCode EdsioStringEventCode; struct _EdsioStringEventCode { gint code; }; typedef struct _EdsioStringEvent EdsioStringEvent; struct _EdsioStringEvent { gint code; const char* srcfile; guint srcline; const char* name; }; /* EdsioStringStringEventCode. */ typedef struct _EdsioStringStringEventCode EdsioStringStringEventCode; struct _EdsioStringStringEventCode { gint code; }; typedef struct _EdsioStringStringEvent EdsioStringStringEvent; struct _EdsioStringStringEvent { gint code; const char* srcfile; guint srcline; const char* msg; const char* arg; }; /* EdsioSourceEventCode. */ typedef struct _EdsioSourceEventCode EdsioSourceEventCode; struct _EdsioSourceEventCode { gint code; }; typedef struct _EdsioSourceEvent EdsioSourceEvent; struct _EdsioSourceEvent { gint code; const char* srcfile; guint srcline; SerialSource* source; }; /* EdsioVoidEventCode. */ typedef struct _EdsioVoidEventCode EdsioVoidEventCode; struct _EdsioVoidEventCode { gint code; }; typedef struct _EdsioVoidEvent EdsioVoidEvent; struct _EdsioVoidEvent { gint code; const char* srcfile; guint srcline; }; /* EdsioIntIntEventCode. */ typedef struct _EdsioIntIntEventCode EdsioIntIntEventCode; struct _EdsioIntIntEventCode { gint code; }; typedef struct _EdsioIntIntEvent EdsioIntIntEvent; struct _EdsioIntIntEvent { gint code; const char* srcfile; guint srcline; int library; int number; }; /* EdsioErrnoEventCode. */ typedef struct _EdsioErrnoEventCode EdsioErrnoEventCode; struct _EdsioErrnoEventCode { gint code; }; typedef struct _EdsioErrnoEvent EdsioErrnoEvent; struct _EdsioErrnoEvent { gint code; const char* srcfile; guint srcline; gint ev_errno; }; typedef struct _SerialGenericTime SerialGenericTime; typedef struct _SerialEdsioString SerialEdsioString; typedef struct _SerialEdsioBytes SerialEdsioBytes; typedef struct _SerialEdsioUint SerialEdsioUint; /* Functions declared here. */ /* Property definitions */ /* Property get/set for PropTest/EdsioUint */ typedef struct _EdsioPropTestEdsioUintProperty EdsioPropTestEdsioUintProperty; struct _EdsioPropTestEdsioUintProperty { guint32 code; }; gboolean edsio_new_proptest_edsiouint_property (const char* name, guint32 flags, EdsioPropTestEdsioUintProperty* prop); gboolean proptest_get_edsiouint (PropTest* obj, EdsioPropTestEdsioUintProperty prop, SerialEdsioUint** arg); gboolean proptest_set_edsiouint (PropTest* obj, EdsioPropTestEdsioUintProperty prop, SerialEdsioUint* arg); gboolean proptest_unset_edsiouint (PropTest* obj, EdsioPropTestEdsioUintProperty prop); gboolean proptest_isset_edsiouint (PropTest* obj, EdsioPropTestEdsioUintProperty prop); /* Property get/set for PropTest/string */ typedef struct _EdsioPropTestStringProperty EdsioPropTestStringProperty; struct _EdsioPropTestStringProperty { guint32 code; }; gboolean edsio_new_proptest_string_property (const char* name, guint32 flags, EdsioPropTestStringProperty* prop); gboolean proptest_get_string (PropTest* obj, EdsioPropTestStringProperty prop, const gchar** arg); gboolean proptest_set_string (PropTest* obj, EdsioPropTestStringProperty prop, const gchar* arg); gboolean proptest_unset_string (PropTest* obj, EdsioPropTestStringProperty prop); gboolean proptest_isset_string (PropTest* obj, EdsioPropTestStringProperty prop); /* Property get/set for PropTest/bytes */ typedef struct _EdsioPropTestBytesProperty EdsioPropTestBytesProperty; struct _EdsioPropTestBytesProperty { guint32 code; }; gboolean edsio_new_proptest_bytes_property (const char* name, guint32 flags, EdsioPropTestBytesProperty* prop); gboolean proptest_get_bytes (PropTest* obj, EdsioPropTestBytesProperty prop, const guint8** arg, guint32* arg_len); gboolean proptest_set_bytes (PropTest* obj, EdsioPropTestBytesProperty prop, const guint8* arg, guint32 arg_len); gboolean proptest_unset_bytes (PropTest* obj, EdsioPropTestBytesProperty prop); gboolean proptest_isset_bytes (PropTest* obj, EdsioPropTestBytesProperty prop); /* Property get/set for PropTest/uint */ typedef struct _EdsioPropTestUintProperty EdsioPropTestUintProperty; struct _EdsioPropTestUintProperty { guint32 code; }; gboolean edsio_new_proptest_uint_property (const char* name, guint32 flags, EdsioPropTestUintProperty* prop); gboolean proptest_get_uint (PropTest* obj, EdsioPropTestUintProperty prop, guint32* arg); gboolean proptest_set_uint (PropTest* obj, EdsioPropTestUintProperty prop, guint32 arg); gboolean proptest_unset_uint (PropTest* obj, EdsioPropTestUintProperty prop); gboolean proptest_isset_uint (PropTest* obj, EdsioPropTestUintProperty prop); /* Serial Types */ enum _SerialEdsioType { ST_EdsioUint = (1<<(1+EDSIO_LIBRARY_OFFSET_BITS))+6, ST_EdsioBytes = (1<<(2+EDSIO_LIBRARY_OFFSET_BITS))+6, ST_EdsioString = (1<<(3+EDSIO_LIBRARY_OFFSET_BITS))+6, ST_GenericTime = (1<<(4+EDSIO_LIBRARY_OFFSET_BITS))+6 }; /* EdsioUint Structure */ struct _SerialEdsioUint { guint32 val; }; void serializeio_print_edsiouint_obj (SerialEdsioUint* obj, guint indent_spaces); gboolean unserialize_edsiouint (SerialSource *source, SerialEdsioUint**); gboolean unserialize_edsiouint_internal (SerialSource *source, SerialEdsioUint** ); gboolean unserialize_edsiouint_internal_noalloc (SerialSource *source, SerialEdsioUint* ); gboolean serialize_edsiouint (SerialSink *sink, guint32 val); gboolean serialize_edsiouint_obj (SerialSink *sink, const SerialEdsioUint* obj); gboolean serialize_edsiouint_internal (SerialSink *sink, guint32 val); gboolean serialize_edsiouint_obj_internal (SerialSink *sink, SerialEdsioUint* obj); guint serializeio_count_edsiouint (guint32 val); guint serializeio_count_edsiouint_obj (SerialEdsioUint const* obj); /* EdsioBytes Structure */ struct _SerialEdsioBytes { guint32 val_len; const guint8* val; }; void serializeio_print_edsiobytes_obj (SerialEdsioBytes* obj, guint indent_spaces); gboolean unserialize_edsiobytes (SerialSource *source, SerialEdsioBytes**); gboolean unserialize_edsiobytes_internal (SerialSource *source, SerialEdsioBytes** ); gboolean unserialize_edsiobytes_internal_noalloc (SerialSource *source, SerialEdsioBytes* ); gboolean serialize_edsiobytes (SerialSink *sink, guint32 val_len, const guint8* val); gboolean serialize_edsiobytes_obj (SerialSink *sink, const SerialEdsioBytes* obj); gboolean serialize_edsiobytes_internal (SerialSink *sink, guint32 val_len, const guint8* val); gboolean serialize_edsiobytes_obj_internal (SerialSink *sink, SerialEdsioBytes* obj); guint serializeio_count_edsiobytes (guint32 val_len, const guint8* val); guint serializeio_count_edsiobytes_obj (SerialEdsioBytes const* obj); /* EdsioString Structure */ struct _SerialEdsioString { const gchar* val; }; void serializeio_print_edsiostring_obj (SerialEdsioString* obj, guint indent_spaces); gboolean unserialize_edsiostring (SerialSource *source, SerialEdsioString**); gboolean unserialize_edsiostring_internal (SerialSource *source, SerialEdsioString** ); gboolean unserialize_edsiostring_internal_noalloc (SerialSource *source, SerialEdsioString* ); gboolean serialize_edsiostring (SerialSink *sink, const gchar* val); gboolean serialize_edsiostring_obj (SerialSink *sink, const SerialEdsioString* obj); gboolean serialize_edsiostring_internal (SerialSink *sink, const gchar* val); gboolean serialize_edsiostring_obj_internal (SerialSink *sink, SerialEdsioString* obj); guint serializeio_count_edsiostring (const gchar* val); guint serializeio_count_edsiostring_obj (SerialEdsioString const* obj); /* GenericTime Structure */ struct _SerialGenericTime { guint32 seconds; guint32 nanos; }; void serializeio_print_generictime_obj (SerialGenericTime* obj, guint indent_spaces); gboolean unserialize_generictime (SerialSource *source, SerialGenericTime**); gboolean unserialize_generictime_internal (SerialSource *source, SerialGenericTime** ); gboolean unserialize_generictime_internal_noalloc (SerialSource *source, SerialGenericTime* ); gboolean serialize_generictime (SerialSink *sink, guint32 seconds, guint32 nanos); gboolean serialize_generictime_obj (SerialSink *sink, const SerialGenericTime* obj); gboolean serialize_generictime_internal (SerialSink *sink, guint32 seconds, guint32 nanos); gboolean serialize_generictime_obj_internal (SerialSink *sink, SerialGenericTime* obj); guint serializeio_count_generictime (guint32 seconds, guint32 nanos); guint serializeio_count_generictime_obj (SerialGenericTime const* obj); void edsio_generate_errno_event_internal (EdsioErrnoEventCode code, const char* srcfile, gint srcline); #define edsio_generate_errno_event(ecode) edsio_generate_errno_event_internal((ecode),__FILE__,__LINE__) extern const EdsioErrnoEventCode EC_EdsioGetTimeOfDayFailure; #define EC_EdsioGetTimeOfDayFailureValue ((0< if you want to use these symbols. */ #define TM_LOCAL_ZONE LONG_MIN #define TM_UNDEFINED_ZONE (LONG_MIN + 1) struct partime { /* This structure describes the parsed time. Only the following tm_* values in it are used: sec, min, hour, mday, mon, year, wday, yday. If TM_UNDEFINED (value), the parser never found the value. The tm_year field is the actual year, not the year - 1900; but see ymodulus below. */ struct tm tm; /* If !TM_UNDEFINED (ymodulus), then tm.tm_year is actually modulo ymodulus. */ int ymodulus; /* Week of year, ISO 8601 style. If TM_UNDEFINED (yweek), the parser never found yweek. Weeks start on Mondays. Week 1 includes Jan 4. */ int yweek; /* Seconds east of UTC; or TM_LOCAL_ZONE or TM_UNDEFINED_ZONE. */ long zone; }; #if defined __STDC__ || has_prototypes # define __PARTIME_P(x) x #else # define __PARTIME_P(x) () #endif char *partime __PARTIME_P ((char const *, struct partime *)); char *parzone __PARTIME_P ((char const *, long *)); xdelta-1.1.3/libedsio/edsio.el0000644006517700017500000015676007311304631011727 ;; -*- Emacs-Lisp -*- (require 'cl) (require 'pp) (eval-and-compile (setq load-path (cons ".." (cons "." load-path)))) (provide 'edsio) (eval-and-compile (setq load-path (cdr (cdr load-path)))) ;; Turn of assertions in compiled code. (eval-and-compile (setq cl-optimize-speed 3) (setq cl-optimize-safety 1) ) ;; Begin (defconst *definition-state* nil "List of all the names of variables containing state from the definition file so that operations may be performed on everything in the definition file.") (defconst *definition-attrs* nil "List of attributes for sharing indices.") (defconst *all-objects* nil) (defconst *output-files* nil "List of lists (NAME BUFFER) used during output of headers.") (defconst *output-prefix* nil "Prefix used for outputing header files.") (defconst *cpp-extension* "c") ;; This defines several functions and one macro. The indirection makes ;; it a little bit confusing to read. It defines the macro DEFDNAME, ;; a function DEFDNAME*, MAKE-DNAME, and a setter and getter for each arg. (eval-and-compile (defmacro attr-index (attr) `(- (length *definition-attrs*) (length (memq ,attr *definition-attrs*)))) (defmacro defastmacro(dtype args attrs) "Defines a macro named DEFDTYPE for defining various AST properties." (let ((def-macr (intern (format "def%s" dtype))) (def-func (intern (format "def%s*" dtype))) (make-func (intern (format "make-%s" dtype))) (state (intern (format "*%s-defs*" dtype))) (exprs nil)) (if (not *definition-attrs*) (setq *definition-attrs* '(menunode menuline))) (let ((fields (append args attrs))) (while fields (if (not (memq (car fields) *definition-attrs*)) (setq *definition-attrs* (append *definition-attrs* (list (car fields))))) (setq fields (cdr fields)) ) ) ;; Add it to *definition-state* (setq *definition-state* (cons state *definition-state*)) ;; DEFCONST it (setq exprs (cons (list 'defconst state (quote nil)) exprs)) ;; DEFMACRO DEFDTYPE (setq exprs (cons (list 'defmacro def-macr args (append (list 'list (list 'quote def-func)) (mapcar (function (lambda (x) (list 'list (list 'quote 'quote) x) ) ) args) ) ) exprs ) ) ;; DEFUN DEFDTYPE* (setq exprs (cons (list 'defun def-func args (list 'setq state (list 'cons (cons make-func args) state ) ) ) exprs ) ) ;; MAKE-DTYPE (setq exprs (cons (list 'defun make-func args (list 'let (list (list 'it (list 'make-vector (length *definition-attrs*) nil))) (if args (cons 'progn (mapcar (function (lambda (x) (list 'aset 'it (attr-index x) x) ) ) args ) ) ) (if attrs (cons 'progn (mapcar (function (lambda (x) (list 'aset 'it (attr-index x) nil) ) ) attrs ) ) ) (if (memq 'menu args) (list 'progn (list 'aset 'it (attr-index 'menunode) (list 'function (intern (format "%s-menunode" dtype)))) (list 'aset 'it (attr-index 'menuline) (list 'function (intern (format "%s-menuline" dtype)))) ) ) (list 'cons (list 'quote dtype) 'it) ) ) exprs ) ) ;; Add the fake arguments: (if (memq 'menu args) (setq attrs (append (list 'menunode 'menuline) attrs))) (setq args (append args attrs)) (while args (let* ((thearg (car args)) (arg-set (intern (format "%s-%s-set" dtype thearg))) (arg-get (intern (format "%s-%s-get" dtype thearg)))) ;; DTYPE-ARG-GET (setq exprs (cons (list 'defmacro (intern (format "%s-%s-get" dtype thearg)) '(obj) (list 'list (list 'quote 'aref) (list 'list (list 'quote 'cdr) 'obj) (attr-index thearg)) ) exprs ) ) ;; DTYPE-ARG-SET (setq exprs (cons (list 'defmacro (intern (format "%s-%s-set" dtype thearg)) '(obj val) (list 'list (list 'quote 'aset) (list 'list (list 'quote 'cdr) 'obj) (attr-index thearg) 'val) ) exprs ) ) ) (setq args (cdr args)) ) ;; To see what it's generating uncomment the next 2 lines. ;;(setq message-log-max t) ;;(mapcar (function pp) exprs) (cons 'progn exprs) ) ) ;; This is, as the name suggests, really bogus. Basically, each DEFASTMACRO ;; call adds to the list *definition-state*. To compile it, however, it has ;; to be done at compile time, so this macro gets evaluated when being compiled ;; and clears the list. Then the DEFASTMACRO calls are made, and then DEFCDS ;; is called to define CLEAR-DEFINITION-STATE which resets the list to the ;; compile-time computed value of *definition-state*, it would otherwise be ;; empty when running compiled code. (defmacro bogus () (setq *definition-state* nil) (setq *definition-attrs* nil) ) (bogus) ;; Each DEFASTMACRO statement defines a directive for the definition ;; file along with it's argument names. (defastmacro sertype (name number fields transients) ()) (defastmacro module (name id header pheader) ()) (defastmacro import (name) (prefix)) (defastmacro event (name level uargs sargs desc) ()) (defastmacro etype (name ctype) ()) (defastmacro prophost (name letter ctype persist) (proptypes)) (defastmacro prophosttype (host type) ()) (defmacro defcds () (let ((exprs nil)) (setq exprs (list (list 'defun 'clear-definition-state nil '(setq *all-objects* nil) (list 'setq '*definition-state* (list 'quote *definition-state*)) (list 'setq '*definition-attrs* (list 'quote *definition-attrs*)) '(mapcar (function (lambda (x) (set x nil))) *definition-state*) ) ) ) (mapcar (function (lambda (x) (setq exprs (cons (list 'defmacro (intern (format "obj-%s-get" x)) '(obj) (list 'list (list 'quote 'aref) (list 'list (list 'quote 'cdr) 'obj) (attr-index x)) ) exprs ) ) (setq exprs (cons (list 'defmacro (intern (format "obj-%s-set" x)) '(obj val) (list 'list (list 'quote 'aset) (list 'list (list 'quote 'cdr) 'obj) (attr-index x) 'val) ) exprs ) ) (let ((get (intern (format "obj-%s-get" x)))) (setq exprs (cons (list 'defun (intern (format "obj-%s-eq" x)) '(val olist) `(let ((ret nil)) (while (and (not ret) olist) (if (eq val (,get (car olist))) (setq ret (car olist)) ) (setq olist (cdr olist)) ) ret ) ) exprs ) ) ) ) ) *definition-attrs* ) ;;(setq message-log-max t) ;;(mapcar (function pp) exprs) (cons 'progn exprs) ) ) (defcds) ) ;; Entry Points (defun generate-ser-noargs () (interactive) (generate-ser "edsio.ser" "edsio") ) (defun generate-ser (input-file output-prefix) ;(interactive "finput: \nsoutput: \nsid: ") (let ((make-backup-files nil) (executing-kbd-macro t)) (clear-definition-state) (do-it input-file output-prefix) ) ) (defconst *library-id* nil "Identifier of this library.") (defconst *library-header* nil "Header of this library.") (defconst *library-pheader* nil "Header of this library.") (defconst *prefix-with-library-header* t) (defun load-defs(file) (load-file file) (setq *import-defs* (reverse *import-defs*)) (setq *module-defs* (reverse *module-defs*)) (setq *sertype-defs* (reverse *sertype-defs*)) (setq *event-defs* (reverse *event-defs*)) (setq *etype-defs* (reverse *etype-defs*)) (setq *prophost-defs* (reverse *prophost-defs*)) (setq *prophosttype-defs* (reverse *prophosttype-defs*)) ) (defconst *header-typedef-marker* nil) (defconst *source-init-marker* nil) (defconst *source-top-marker* nil) (defun do-it (input-file output-prefix) (setq *output-files* nil) (setq *output-prefix* output-prefix) (load-defs input-file) (if (not *module-defs*) (error "no defmodule in %s" input-file)) (if (> (length *module-defs*) 1) (error "too many defmodules in %s" input-file)) (setq *library-id* (module-id-get (car *module-defs*))) (setq *library-header* (module-header-get (car *module-defs*))) (setq *library-pheader* (module-pheader-get (car *module-defs*))) (when (not *library-header*) (setq *prefix-with-library-header* nil) (setq *library-header* (format "%s_edsio.h" *output-prefix*)) ) (if (or (<= *library-id* 0) (>= *library-id* 256)) (error "Library-id is out of range")) (if (> (length *sertype-defs*) 24) (error "no more than 24 types")) (unwind-protect (progn (output-header-file "_edsio") (read-imports) (insert "/* Initialize this library. */\n\n") (insert "gboolean " *output-prefix* "_edsio_init (void);\n\n") (insert "/* Types defined here. */\n\n") (setq *header-typedef-marker* (point-marker)) (insert "/* Functions declared here. */\n\n") (output-source-file "_edsio") (insert "#include \"" *library-header* "\"\n\n") (insert "#include \n\n") (if *library-pheader* (insert "#include \"" *library-pheader* "\"\n\n")) (insert "/* Declarations. */\n\n") (setq *source-top-marker* (point-marker)) (insert "\n") (insert "/* initialize this library. */\n\n") (insert "gboolean\n" *output-prefix* "_edsio_init (void)\n{\n") (insert " static gboolean once = FALSE;\n") (insert " static gboolean result = FALSE;\n") (insert " if (once) return result;\n") (insert " once = TRUE;\n") (setq *source-init-marker* (point-marker)) (insert (format " edsio_library_register (%d, \"%s\");\n" *library-id* *output-prefix*)) (insert " result = TRUE;\n") (insert " return TRUE;\n") (insert "};\n\n") (if *prophosttype-defs* (generate-properties)) (if *sertype-defs* (generate-code)) (if *event-defs* (generate-events)) ; (message "source file:\n%s" (buffer-string)) (mapcar (function (lambda (x) (output-finish-file x))) *output-files*) ) (mapcar (function (lambda (x) (kill-buffer (cadr x)))) *output-files*) ) ) (defvar *all-sertype-defs* nil) (defvar *all-prophost-defs* nil) (defvar *all-etype-defs* nil) (defun read-imports () (setq *all-sertype-defs* *sertype-defs*) (setq *all-etype-defs* *etype-defs*) (setq *all-prophost-defs* *prophost-defs*) (let ((mods *module-defs*) (imps0 *import-defs*) (imps *import-defs*) (types *sertype-defs*) (events *event-defs*) (etypes *etype-defs*) (phosts *prophost-defs*) (phts *prophosttype-defs*) ) (while imps (clear-definition-state) (load-defs (import-name-get (car imps))) (setq *all-sertype-defs* (append *all-sertype-defs* *sertype-defs*)) (setq *all-etype-defs* (append *all-etype-defs* *etype-defs*)) (setq *all-prophost-defs* (append *all-prophost-defs* *prophost-defs*)) (import-prefix-set (car imps) (module-name-get (car *module-defs*))) (when (or *sertype-defs* *event-defs*) (output-header-file "_edsio") (insert (format "#include \"%s_edsio.h\"\n\n" (import-prefix-get (car imps)))) ) (setq imps (cdr imps)) ) (setq *module-defs* mods) (setq *import-defs* imps0) (setq *sertype-defs* types) (setq *event-defs* events) (setq *etype-defs* etypes) (setq *prophost-defs* phosts) (setq *prophosttype-defs* phts) ) ) (defun output-header-file (name) (output-file (format "%s.h" name) 'c-header *output-prefix*)) (defun output-source-file (name) (output-file (format "%s.%s" name *cpp-extension*) 'c *output-prefix*)) (defun output-source-include-file (name) (output-file (format "%s.%si" name *cpp-extension*) 'c *output-prefix*)) (defun output-plain-file (name) (output-file (format "%s" name) 'plain "")) (defun output-file (name type prefix) (let* ((name (format "%s%s" prefix name)) (it (assoc name *output-files*))) (if it (set-buffer (cadr it)) (let ((nbuf (get-buffer-create (generate-new-buffer-name name)))) (setq *output-files* (cons (list name nbuf type) *output-files*)) (set-buffer nbuf) ) ) ) ) (defun output-finish-file (file) (let ((name (car file)) (buf (cadr file)) (type (caddr file))) (set-buffer buf) ;(message "printing %s: %s" file (buffer-string)) (cond ((eq type 'c) (output-to-c name nil)) ((eq type 'c-header) (output-to-c name t)) ) (write-file-if-different buf name) ) ) (defun output-to-c (name is-header) (goto-char (point-min)) (insert "/* -*-Mode: C;-*- * Copyright (C) 1997, 1998, 1999 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * This file was AUTOMATICALLY GENERATED using: * * $Id: edsio.el 1.16 Tue, 06 Apr 1999 23:40:10 -0700 jmacd $ */ ") (if is-header (let ((cppname (string-replace-regexp (upcase name) "[-./]" "_"))) (insert "#include \"edsio.h\"\n\n") (if *prefix-with-library-header* (insert "#include \"" *library-header* "\"\n\n")) (insert "#ifndef _" cppname "_\n") (insert "#define _" cppname "_\n\n") (insert "#ifdef __cplusplus\n") (insert "extern \"C\" {\n") (insert "#endif\n\n") (goto-char (point-max)) (insert "#ifdef __cplusplus\n") (insert "}\n") (insert "#endif\n") (insert "\n#endif /* _" cppname "_ */\n\n") ) ) ) (defun string-replace-regexp (str regexp to-string) "Result of replacing all occurrences in STR of REGEXP by TO-STRING. The replacement is as for replace-regexp." (let ((work (get-buffer-create "*string-tmp*"))) (save-excursion (set-buffer work) (erase-buffer) (insert str) (beginning-of-buffer) (while (re-search-forward regexp nil t) (replace-match to-string nil nil)) (buffer-string)))) (defun write-file-if-different (buf filename) (save-excursion (if (not (file-exists-p filename)) (write-file filename) (set-buffer buf) (let ((old (get-buffer-create (generate-new-buffer-name filename))) (bmin (point-min)) (bmax (point-max))) (unwind-protect (progn (set-buffer old) (insert-file filename) (let ((omin (point-min)) (omax (point-max)) (case-fold-search nil)) (if (= 0 (compare-buffer-substrings old omin omax buf bmin bmax)) (message "Output file %s is unchanged." filename) (set-buffer buf) (write-file filename) ) ) ) (kill-buffer old) ) ) ) ) ) (defun format-comlist (func l) (let ((x "")) (while l (setq x (concat x (funcall func (car l)))) (if (cdr l) (setq x (concat x ", "))) (setq l (cdr l)) ) x ) ) (defun format-semilist (func l) (let ((x "")) (while l (setq x (concat x (funcall func (car l)))) (if (cdr l) (setq x (concat x "; "))) (setq l (cdr l)) ) x ) ) (defun format-numbered-comlist (func l) (let ((x "") (n 0)) (while l (setq x (concat x (funcall func (car l) n))) (setq n (+ n 1)) (if (cdr l) (setq x (concat x ", "))) (setq l (cdr l)) ) x ) ) (defun capitalize1(s) (let ((work (get-buffer-create "*string-tmp*"))) (save-excursion (set-buffer work) (erase-buffer) (insert (format "%s" s)) (upcase-region (point-min) (+ (point-min) 1)) (buffer-substring-no-properties (point-min) (point-max)) ) ) ) (defun upcase-string (s) (let ((work (get-buffer-create "*string-tmp*"))) (save-excursion (set-buffer work) (erase-buffer) (insert (format "%s" s)) (upcase-region (point-min) (point-max)) (buffer-substring-no-properties (point-min) (point-max)) ) ) ) (defun downcase-string (s) (let ((work (get-buffer-create "*string-tmp*"))) (save-excursion (set-buffer work) (erase-buffer) (insert (format "%s" s)) (downcase-region (point-min) (point-max)) (buffer-substring-no-properties (point-min) (point-max)) ) ) ) ;; HERE IT IS (defun generate-code () (let ((all-codes nil)) (mapcar (function (lambda (st) (let ((x (sertype-number-get st))) (cond ((member x all-codes) (error "serial type number %d defined twice" x)) ((> x 24) (error "serial type value %d too high" x)) ((< x 0) (error "serial type value %d too low" x)) (t (setq all-codes (cons x all-codes)))))) ) *sertype-defs*) ) (output-header-file "_edsio") (insert "/* Serial Types */\n\n") (insert (format "enum _Serial%sType {\n" (capitalize1 *output-prefix*))) (insert (format-comlist (function (lambda (x) (format "\n ST_%s = (1<<(%d+EDSIO_LIBRARY_OFFSET_BITS))+%d" (sertype-name-get x) (sertype-number-get x) *library-id*))) *sertype-defs*)) (insert "\n};\n\n") (insert "\n\n") (output-source-file "_edsio") (save-excursion (goto-char *source-top-marker*) (insert "static void print_spaces (guint n) { int i; for (i = 0; i < n; i += 1) g_print (\" \"); }\n\n") ) (mapcar (function generate-code-entry) *sertype-defs*) ) (defun generate-code-entry (entry) (let ((ent-upcase (sertype-name-get entry)) (ent-downcase (downcase-string (sertype-name-get entry)))) (output-header-file "_edsio") ;; The typedef, structure, and declarations. (save-excursion (goto-char *header-typedef-marker*) (insert (format "typedef struct _Serial%s Serial%s;\n" ent-upcase ent-upcase)) ) (insert (format "/* %s Structure\n */\n\n" ent-upcase)) (insert (format "struct _Serial%s {\n" ent-upcase)) (apply (function insert) (mapcar (function (lambda (x) (format " %s;\n" x))) (entry-typename-pairs entry nil))) (apply (function insert) (mapcar (function (lambda (x) (format " %s;\n" x))) (sertype-transients-get entry))) (insert "};\n\n") (insert (format "void serializeio_print_%s_obj (Serial%s* obj, guint indent_spaces);\n\n" ent-downcase ent-upcase)) (insert (format "gboolean unserialize_%s (SerialSource *source, Serial%s**);\n" ent-downcase ent-upcase)) (insert (format "gboolean unserialize_%s_internal (SerialSource *source, Serial%s** );\n" ent-downcase ent-upcase)) (insert (format "gboolean unserialize_%s_internal_noalloc (SerialSource *source, Serial%s* );\n" ent-downcase ent-upcase)) (insert (format "gboolean serialize_%s (SerialSink *sink%s);\n" ent-downcase (entry-arglist t entry))) (insert (format "gboolean serialize_%s_obj (SerialSink *sink, const Serial%s* obj);\n" ent-downcase ent-upcase)) (insert (format "gboolean serialize_%s_internal (SerialSink *sink%s);\n" ent-downcase (entry-arglist t entry))) (insert (format "gboolean serialize_%s_obj_internal (SerialSink *sink, Serial%s* obj);\n" ent-downcase ent-upcase)) (insert (format "guint serializeio_count_%s (%s);\n" ent-downcase (entry-arglist nil entry))) (insert (format "guint serializeio_count_%s_obj (Serial%s const* obj);\n" ent-downcase ent-upcase)) (insert (format "\n")) (output-source-file "_edsio") ;; The init entry (save-excursion (goto-char *source-init-marker*) (insert (format " serializeio_initialize_type (\"ST_%s\", ST_%s, &unserialize_%s_internal, &serialize_%s_obj_internal, &serializeio_count_%s_obj, &serializeio_print_%s_obj);\n" ent-upcase ent-upcase ent-downcase ent-downcase ent-downcase ent-downcase)) ) ;; Count code (insert (format "/* %s Count\n */\n\n" ent-upcase)) (insert (format "guint\nserializeio_count_%s (%s) {\n" ent-downcase (entry-arglist nil entry))) (insert (format " guint size = sizeof (Serial%s);\n" ent-upcase)) (apply (function insert) (mapcar (function (lambda (x) (concat (format " ALIGN_8 (size);\n") (entry-count-field entry x (format "%s" (car x)) " " t)))) (sertype-fields-get entry))) (insert (format " ALIGN_8 (size);\n")) (insert (format " return size;\n")) (insert (format "}\n\n")) ;; Count Object code (insert (format "guint\nserializeio_count_%s_obj (Serial%s const* obj) {\n" ent-downcase ent-upcase)) (insert (format " return serializeio_count_%s (%s);\n" ent-downcase (entry-plist t nil "obj->" entry))) (insert (format "}\n\n")) ;; Print object code (insert (format "/* %s Print\n */\n\n" ent-upcase)) (insert (format "void\nserializeio_print_%s_obj (Serial%s* obj, guint indent_spaces) {\n" ent-downcase ent-upcase)) (insert (format " print_spaces (indent_spaces);\n")) (insert (format " g_print (\"[ST_%s]\\n\");\n" ent-upcase)) (apply (function insert) (mapcar (function (lambda (x) (entry-print-field entry x (format "obj->%s" (car x)) " " t))) (sertype-fields-get entry))) (insert (format "}\n\n")) ;; Print internal code ;; Serialize code (insert (format "/* %s Serialize\n */\n\n" ent-upcase)) (insert (format "gboolean\nserialize_%s_internal (SerialSink *sink%s)\n" ent-downcase (entry-arglist t entry))) (insert (format "{\n")) (apply (function insert) (mapcar (function (lambda (x) (entry-serialize-field entry x (format "%s" (car x)) " " t))) (sertype-fields-get entry))) (insert (format " return TRUE;\n")) (if (sertype-fields-get entry) (insert (format "bail:\n return FALSE;\n"))) (insert (format "}\n\n")) ;; Internal Serialize Object code (insert (format "gboolean\nserialize_%s_obj_internal (SerialSink *sink, Serial%s* obj)\n" ent-downcase ent-upcase)) (insert (format "{\n")) (insert (format " return serialize_%s_internal (sink%s);\n" ent-downcase (entry-plist t t "obj->" entry))) (insert (format "}\n\n")) ;; External Serialize code (insert (format "gboolean\nserialize_%s (SerialSink *sink%s)\n" ent-downcase (entry-arglist t entry))) (insert (format "{\n")) (insert (format " if (! (* sink->sink_type) (sink, ST_%s, serializeio_count_%s (%s), TRUE)) goto bail;\n" ent-upcase ent-downcase (entry-plist nil nil "" entry))) (insert (format " if (! serialize_%s_internal (sink%s)) goto bail;\n" ent-downcase (entry-plist nil t "" entry))) (insert (format " if (sink->sink_quantum && ! sink->sink_quantum (sink)) goto bail;\n")) (insert (format " return TRUE;\n")) (insert (format "bail:\n")) (insert (format " return FALSE;\n")) (insert (format "}\n\n")) ;; External serialize_obj (insert (format "gboolean\nserialize_%s_obj (SerialSink *sink, const Serial%s* obj) {\n\n" ent-downcase ent-upcase)) (insert (format " return serialize_%s (sink%s);\n" ent-downcase (entry-plist t t "obj->" entry))) (insert (format "}\n\n")) ;; Unserialize code (insert (format "/* %s Unserialize\n */\n\n" ent-upcase)) (insert (format "gboolean\nunserialize_%s_internal_noalloc (SerialSource *source, Serial%s* result)\n" ent-downcase ent-upcase)) (insert (format "{\n")) (apply (function insert) (mapcar (function (lambda (x) (entry-unserialize-field entry x (format "result->%s" (car x)) " "))) (sertype-fields-get entry))) (insert (format " return TRUE;\n")) (if (sertype-fields-get entry) (insert (format "bail:\n return FALSE;\n"))) (insert (format "}\n\n")) (insert (format "gboolean\nunserialize_%s_internal (SerialSource *source, Serial%s** result)\n" ent-downcase ent-upcase)) (insert (format "{\n")) (insert (format " Serial%s* unser;\n" ent-upcase)) (insert (format " (*result) = NULL;\n")) (insert (format " unser = serializeio_source_alloc (source, sizeof (Serial%s));\n" ent-upcase)) (insert (format " if (! unser) goto bail;\n")) (insert (format " if (! unserialize_%s_internal_noalloc (source, unser)) goto bail;\n" ent-downcase)) (insert (format " (*result) = unser;\n")) (insert (format " return TRUE;\n")) (insert (format "bail:\n")) (insert (format " return FALSE;\n")) (insert (format "}\n\n")) ;; External unserialize (insert (format "gboolean\nunserialize_%s (SerialSource *source, Serial%s** result)\n" ent-downcase ent-upcase)) (insert (format "{\n")) (insert (format " if ( (* source->source_type) (source, TRUE) != ST_%s) goto bail;\n" ent-upcase)) (insert (format " if (! unserialize_%s_internal (source, result)) goto bail;\n" ent-downcase)) (insert (format " if (! serializeio_source_object_received (source)) goto bail;\n")) (insert (format " return TRUE;\n")) (insert (format "bail:\n")) (insert (format " return FALSE;\n")) (insert (format "}\n\n")) ) ) (defun entry-typename-pairs (entry is-param) (let ((pairs nil) (fields (sertype-fields-get entry))) (while fields (let ((field (car fields))) (when (or (equal (cadr field) 'bytes) (and (consp (cadr field)) (equal (caadr field) 'array))) (setq pairs (cons (format "guint32 %s_len" (car field)) pairs)) ) (when (equal (cadr field) 'object) (setq pairs (cons (format "guint32 %s_type" (car field)) pairs)) ) (setq pairs (cons (field-decl field is-param) pairs)) ) (setq fields (cdr fields)) ) (nreverse pairs) ) ) (defun entry-param-names (prefix entry need_pbr) (let ((pairs nil) (fields (sertype-fields-get entry))) (while fields (let ((field (car fields))) (when (or (equal (cadr field) 'bytes) (and (consp (cadr field)) (equal (caadr field) 'array))) (setq pairs (cons (format "%s%s_len" prefix (car field)) pairs)) ) (when (equal (cadr field) 'object) (setq pairs (cons (format "%s%s_type" prefix (car field)) pairs)) ) (setq pairs (cons (format "%s%s%s" (if (and need_pbr (needs-ref field)) "&" "") prefix (car field)) pairs)) ) (setq fields (cdr fields)) ) (nreverse pairs) ) ) (defun field-ctype (field) (cond ((equal (cadr field) 'string) "const gchar*") ((equal (cadr field) 'uint) "guint32") ((equal (cadr field) 'uint32) "guint32") ((equal (cadr field) 'uint16) "guint16") ((equal (cadr field) 'uint8) "guint8") ((equal (cadr field) 'boolean) "gboolean") ((equal (cadr field) 'bytes) "const guint8*") ((equal (cadr field) 'object) "void*") ((member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (format "Serial%s" (cadr field))) ((equal (car (cadr field)) 'bytes) "const guint8*") ((member (car (cadr field)) '(array ptr)) (concat (field-ctype (cadr field)) "*")) (t (error "unrecognized field type: %s" (cadr field)))) ) (defun field-decl (field is-param) (if (and (consp (cadr field)) (equal (car (cadr field)) 'bytes)) (format "%sguint8 %s[%d]" (if is-param "const " "") (car field) (cadr (cadr field))) ;(message "foo %s %s" field (member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*))) (format "%s %s" (cond ((member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (format "Serial%s%s" (cadr field) (if is-param " const*" ""))) ((equal (cadr field) 'string) "const gchar*") ((equal (cadr field) 'uint) "guint32") ((equal (cadr field) 'uint32) "guint32") ((equal (cadr field) 'uint16) "guint16") ((equal (cadr field) 'uint8) "guint8") ((equal (cadr field) 'boolean) "gboolean") ((equal (cadr field) 'bytes) "const guint8*") ((equal (cadr field) 'object) "void*") ((member (car (cadr field)) '(array ptr)) (concat (field-ctype (cadr field)) (if is-param " const*" "*"))) (t (error "unrecognized field type: %s" (cadr field)))) (car field))) ) (defun entry-arglist (need_first entry) (concat (if (and need_first (sertype-fields-get entry)) ", " "") (format-comlist (function (lambda (x) x)) (entry-typename-pairs entry t)))) (defun needs-ref (field) (member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) ) (defun entry-plist (need_pbr need_first prefix entry) (concat (if (and need_first (sertype-fields-get entry)) ", " "") (format-comlist (function (lambda (x) (format "%s" x))) (entry-param-names prefix entry need_pbr)))) (defun entry-unserialize-field (entry field name prefix) (cond ((equal (cadr field) 'uint) (format "%sif (! (* source->next_uint) (source, &%s)) goto bail;\n" prefix name)) ((equal (cadr field) 'uint32) (format "%sif (! (* source->next_uint32) (source, &%s)) goto bail;\n" prefix name)) ((equal (cadr field) 'uint16) (format "%sif (! (* source->next_uint16) (source, &%s)) goto bail;\n" prefix name)) ((equal (cadr field) 'uint8) (format "%sif (! (* source->next_uint8) (source, &%s)) goto bail;\n" prefix name)) ((equal (cadr field) 'boolean) (format "%sif (! (* source->next_bool) (source, &%s)) goto bail;\n" prefix name)) ((equal (cadr field) 'string) (format "%sif (! (* source->next_string) (source, &%s)) goto bail;\n" prefix name)) ((equal (cadr field) 'bytes) (format "%sif (! (* source->next_bytes) (source, &%s, &%s_len)) goto bail;\n" prefix name name)) ((equal (cadr field) 'object) (format "%sif (! serializeio_unserialize_generic_internal (source, &%s_type, &%s, FALSE)) goto bail;\n" prefix name name)) ((member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (format "%sif (! unserialize_%s_internal_noalloc (source, &%s)) goto bail;\n" prefix (downcase-string (cadr field)) name)) ((and (equal (car (cadr field)) 'ptr) (member (cadr (cadr field)) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*))) (format "%sif (! unserialize_%s_internal (source, &%s)) goto bail;\n" prefix (downcase-string (cadr (cadr field))) name)) ((equal (car (cadr field)) 'bytes) (format "%sif (! (* source->next_bytes_known) (source, %s, %d)) goto bail;\n" prefix name (cadr (cadr field)))) ((equal (car (cadr field)) 'array) (format "%s{ %s gint i; %s if (! (* source->next_uint) (source, &%s_len)) goto bail; %s if (! (%s = serializeio_source_alloc (source, sizeof (%s) * %s_len))) goto bail; %s for (i = 0; i < %s_len; i += 1) %s { %s%s } %s} " prefix prefix prefix name prefix name (field-ctype (cadr field)) name prefix name prefix prefix (entry-unserialize-field entry (cadr field) (concat "(" name "[i])") (concat prefix " ")) prefix )) (t (error "unrecognized field type: %s" (cadr field))))) (defun entry-serialize-field (entry field name prefix is-param) (cond ((equal (cadr field) 'uint) (format "%sif (! (* sink->next_uint) (sink, %s)) goto bail;\n" prefix name)) ((equal (cadr field) 'uint16) (format "%sif (! (* sink->next_uint16) (sink, %s)) goto bail;\n" prefix name)) ((equal (cadr field) 'uint8) (format "%sif (! (* sink->next_uint8) (sink, %s)) goto bail;\n" prefix name)) ((equal (cadr field) 'uint32) (format "%sif (! (* sink->next_uint32) (sink, %s)) goto bail;\n" prefix name)) ((equal (cadr field) 'boolean) (format "%sif (! (* sink->next_bool) (sink, %s)) goto bail;\n" prefix name)) ((equal (cadr field) 'string) (format "%sif (! (* sink->next_string) (sink, %s)) goto bail;\n" prefix name)) ((equal (cadr field) 'bytes) (format "%sif (! (* sink->next_bytes) (sink, %s, %s_len)) goto bail;\n" prefix name name)) ((equal (cadr field) 'object) (format "%sif (! serializeio_serialize_generic_internal (sink, %s_type, %s, FALSE)) goto bail;\n" prefix name name)) ((member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (format "%sif (! serialize_%s_internal (sink%s)) goto bail;\n" prefix (downcase-string (cadr field)) (entry-plist t t (concat name (if is-param "->" ".")) (obj-name-eq (cadr field) *all-sertype-defs*)))) ((and (equal (car (cadr field)) 'ptr) (member (cadr (cadr field)) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*))) (format "%sif (! serialize_%s_internal (sink%s)) goto bail;\n" prefix (downcase-string (cadr (cadr field))) (entry-plist t t (concat name "->") (obj-name-eq (cadr (cadr field)) *all-sertype-defs*)))) ((equal (car (cadr field)) 'bytes) (format "%sif (! (* sink->next_bytes_known) (sink, %s, %d)) goto bail;\n" prefix name (cadr (cadr field)))) ((equal (car (cadr field)) 'array) (format "%s{ %s gint i; %s if (! (* sink->next_uint) (sink, %s_len)) goto bail; %s for (i = 0; i < %s_len; i += 1) %s { %s%s } %s} " prefix prefix prefix name prefix name prefix prefix (entry-serialize-field entry (cadr field) (array-index name (cadr field)) (concat prefix " ") nil) prefix )) (t (error "unrecognized field type: %s" (cadr field))))) (defun array-index (name field) ;(concat "(" (if (needs-ref field) "&" "") name "[i])") (concat "(" name "[i])") ) (defun entry-count-field (entry field name prefix is-param) (cond ((equal (cadr field) 'uint) ;(format "%ssize += sizeof (guint32);\n" prefix) "" ) ((equal (cadr field) 'uint32) ;(format "%ssize += sizeof (guint32);\n" prefix) "" ) ((equal (cadr field) 'uint16) ;(format "%ssize += sizeof (guint16);\n" prefix) "" ) ((equal (cadr field) 'uint8) ;(format "%ssize += sizeof (guint8);\n" prefix) "" ) ((equal (cadr field) 'boolean) ;(format "%ssize += sizeof (gboolean);\n" prefix) "" ) ((equal (cadr field) 'string) (format "%ssize += strlen (%s) + 1;\n" prefix name) ) ((equal (cadr field) 'bytes) (format "%ssize += %s_len;\n" prefix name) ) ((equal (cadr field) 'object) (format "%ssize += serializeio_generic_count (%s_type, %s);\n" prefix name name) ) ((member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (format "%ssize += serializeio_count_%s_obj (%s%s) - sizeof (Serial%s);\n" prefix (downcase-string (cadr field)) (if is-param "" "& ") name (cadr field) ) ) ((and (equal (car (cadr field)) 'ptr) (member (cadr (cadr field)) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*))) (format "%ssize += serializeio_count_%s_obj (%s);\n" prefix (downcase-string (cadr (cadr field))) name) ) ((equal (car (cadr field)) 'bytes) ;(format "%ssize += 0;\n" prefix (cadr (cadr field))) "" ) ((equal (car (cadr field)) 'array) (format "%s{ %s gint i; %s for (i = 0; i < %s_len; i += 1) %s { %s%s } %s} " prefix prefix prefix name prefix prefix (entry-count-array-field entry (cadr field) (array-index name (cadr field)) (concat prefix " ") nil) prefix )) (t (error "unrecognized field type: %s" (cadr field))))) (defun entry-count-array-field (entry field name prefix is-param) (cond ((equal (cadr field) 'uint) (format "%ssize += sizeof (guint32);\n" prefix) ) ((equal (cadr field) 'uint32) (format "%ssize += sizeof (guint32);\n" prefix) ) ((equal (cadr field) 'uint16) (format "%ssize += sizeof (guint16);\n" prefix) ) ((equal (cadr field) 'uint8) (format "%ssize += sizeof (guint8);\n" prefix) ) ((equal (cadr field) 'boolean) (format "%ssize += sizeof (gboolean);\n" prefix) ) ((equal (cadr field) 'string) (format "%ssize += strlen (%s) + 1 + sizeof (void*);\n" prefix name) ) ((equal (cadr field) 'bytes) (error "can't do that: bytes1") ) ((equal (cadr field) 'object) (error "can't do that: object") ) ((member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (format "%ssize += serializeio_count_%s_obj (%s%s);\n" prefix (downcase-string (cadr field)) (if is-param "" "& ") name (cadr field) ) ) ((and (equal (car (cadr field)) 'ptr) (member (cadr (cadr field)) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*))) (format "%ssize += serializeio_count_%s_obj (%s) + sizeof (void*);\n" prefix (downcase-string (cadr (cadr field))) name) ) ((equal (car (cadr field)) 'bytes) (error "can't do that: bytes2") ) ((equal (car (cadr field)) 'array) (error "can't do that: array") ) (t (error "unrecognized field type: %s" (cadr field))))) (defun entry-print-field (entry field name prefix is-param) (concat (format "%sprint_spaces (indent_spaces);\n" prefix) (if is-param (format "%sg_print (\"%s = \");\n" prefix (car field)) "") (cond ((equal (cadr field) 'uint) (format "%sg_print (\"%%d\\n\", %s);\n" prefix name)) ((equal (cadr field) 'uint32) (format "%sg_print (\"%%d\\n\", %s);\n" prefix name)) ((equal (cadr field) 'uint16) (format "%sg_print (\"%%d\\n\", %s);\n" prefix name)) ((equal (cadr field) 'uint8) (format "%sg_print (\"%%d\\n\", %s);\n" prefix name)) ((equal (cadr field) 'boolean) (format "%sg_print (\"%%s\\n\", %s ? \"true\" : \"false\");\n" prefix name)) ((equal (cadr field) 'string) (format "%sg_print (\"%%s\\n\", %s);\n" prefix name)) ((equal (cadr field) 'bytes) (format "%sserializeio_print_bytes (%s, %s_len);\n" prefix name name)) ((equal (cadr field) 'object) (concat (if is-param (format "%sg_print (\"{\\n\");\n" prefix) "") (format "%sserializeio_generic_print (%s_type, %s, indent_spaces + 2);\n" prefix name name) (format "%sprint_spaces (indent_spaces);\n;\n" prefix) (if is-param (format "%sg_print (\"}\\n\");\n" prefix) "") ) ) ((member (cadr field) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (concat (if is-param (format "%sg_print (\"{\\n\");\n" prefix) "") (format "%sserializeio_print_%s_obj (& %s, indent_spaces + 2);\n" prefix (downcase-string (cadr field)) name name) (format "%sprint_spaces (indent_spaces);\n;\n" prefix) (if is-param (format "%sg_print (\"}\\n\");\n" prefix) "") ) ) ((and (equal (car (cadr field)) 'ptr) (member (cadr (cadr field)) (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*))) (concat (if is-param (format "%sg_print (\"{\\n\");\n" prefix) "") (format "%sserializeio_print_%s_obj (%s, indent_spaces + 2);\n" prefix (downcase-string (cadr (cadr field))) name name) (format "%sprint_spaces (indent_spaces);\n;\n" prefix) (if is-param (format "%sg_print (\"}\\n\");\n" prefix) "") ) ) ((equal (car (cadr field)) 'bytes) (format "%sserializeio_print_bytes (%s, %d);\n" prefix name (cadr (cadr field)))) ((equal (car (cadr field)) 'array) (concat (if is-param (format "%sg_print (\"{\\n\");\n" prefix) "") (format "%s{ %s gint i; %s for (i = 0; i < %s_len; i += 1) %s { %s print_spaces (indent_spaces); %s g_print (\"%%d:\n\", i); %s%s } %s} " prefix prefix prefix name prefix prefix prefix prefix (entry-print-field entry (cadr field) (array-index name (cadr field)) (concat prefix " ") nil) prefix ) (if is-param (format "%sg_print (\"}\\n\");\n" prefix) ""))) (t (error "unrecognized field type: %s" (cadr field))))) ) (defconst *event-id* 0) (defconst *event-types* nil) (defun generate-events () (let ((events *event-defs*)) (while events (let* ((event (car events)) (uargs (event-uargs-get event)) (sargs (event-sargs-get event)) (type-prefix (intern (apply (function concat) (append (mapcar (function (lambda (x) (capitalize1 (cadr x)))) uargs) (mapcar (function (lambda (x) (capitalize1 x))) sargs))))) (capprefix (capitalize1 *output-prefix*))) (if (and (not uargs) (not sargs)) (setq type-prefix "Void")) (when (not (member type-prefix *event-types*)) (setq *event-types* (cons type-prefix *event-types*)) (output-header-file "_edsio") (save-excursion (goto-char *header-typedef-marker*) (insert (format "/* %s%sEventCode.\n */\n\n" capprefix type-prefix)) (insert (format "typedef struct _%s%sEventCode %s%sEventCode;\n" capprefix type-prefix capprefix type-prefix)) (insert (format "struct _%s%sEventCode { gint code; };\n\n" capprefix type-prefix)) (insert (format "typedef struct _%s%sEvent %s%sEvent;\n" capprefix type-prefix capprefix type-prefix)) (insert (format "struct _%s%sEvent { gint code; const char* srcfile; guint srcline;%s%s };\n\n" capprefix type-prefix (event-struct-entries event) (event-struct-sys-entries event))) ) (insert (format "void %s_generate_%s_event_internal (%s%sEventCode code, const char* srcfile, gint srcline%s);\n" *output-prefix* (downcase-string type-prefix) capprefix type-prefix (event-uargs-plist uargs t) )) (insert (format "#define %s_generate_%s_event(ecode%s) %s_generate_%s_event_internal((ecode),__FILE__,__LINE__%s)\n\n" *output-prefix* (downcase-string type-prefix) (event-uargs-alist uargs t) *output-prefix* (downcase-string type-prefix) (event-uargs-mlist uargs t))) (output-source-file "_edsio") (insert (format "void\n%s_generate_%s_event_internal (%s%sEventCode _code, const char* _srcfile, gint _srcline%s)\n" *output-prefix* (downcase-string type-prefix) capprefix type-prefix (event-uargs-plist uargs t) )) (insert (format "{\n")) (insert (format " %s%sEvent *_e = g_new0 (%s%sEvent, 1);\n" capprefix type-prefix capprefix type-prefix)) (insert (format " _e->code = _code.code;\n _e->srcline = _srcline;\n _e->srcfile = _srcfile;\n")) (insert (event-uargs-copy "_e" event)) (insert (event-sargs-copy "_e" event)) (insert (format " eventdelivery_event_deliver ((GenericEvent*) _e);\n")) (insert (format "}\n\n")) ;; Field to string def (unless (equal type-prefix "Void") (save-excursion (goto-char *source-top-marker*) (insert (format "static const char* %s_%s_event_field_to_string (GenericEvent* ev, gint field);\n" capprefix type-prefix)) ) (insert (format "const char*\n%s_%s_event_field_to_string (GenericEvent* ev, gint field)\n" capprefix type-prefix)) (insert (format "{\n")) (unless (equal type-prefix (intern "Ssl")) (insert (format " %s%sEvent* it = (%s%sEvent*) ev;\n" capprefix type-prefix capprefix type-prefix))) (insert (format " switch (field)\n")) (insert (format " {\n")) (let ((uargs (event-uargs-get event)) (i 0)) (while uargs (let ((uarg (car uargs))) (insert (format " case %d: return eventdelivery_%s_to_string (it->%s);\n" i (cadr uarg) (car uarg))) ) (setq i (+ i 1)) (setq uargs (cdr uargs)) ) ) (if (< 1 (length (event-sargs-get event))) (error "unhandled case, too many sargs")) (when (event-sargs-get event) (let ((sarg (car (event-sargs-get event)))) (insert (format " case %d: " (length (event-uargs-get event)))) (if (not (member sarg '(ssl errno))) (error "what type of sarg is %s" sarg)) (if (eq sarg 'errno) (insert (format "return g_strdup (g_strerror (it->ev_errno));\n"))) (if (eq sarg 'ssl) (insert (format "return eventdelivery_ssl_errors_to_string ();\n"))) ) ) (insert (format " default: abort ();\n")) (insert (format " }\n")) (insert (format "}\n\n")) ) ) (output-header-file "_edsio") (insert (format "extern const %s%sEventCode EC_%s%s;\n" capprefix type-prefix capprefix (event-name-get event))) (insert (format "#define EC_%s%sValue ((%d<%s = %s;\n" name (car x) (car x)))) (event-uargs-get event))) ) (defun event-sargs-copy (name event) (if (member 'errno (event-sargs-get event)) (format " %s->ev_errno = errno;\n" name) "") ) (defun event-type-to-ctype (etype) (let ((it (obj-name-eq etype *all-etype-defs*))) (if (not it) (message "no ctype for %s" etype)) (etype-ctype-get it) ) ) (defun event-uargs-plist(uargs need_first) (concat (if (and need_first uargs) ", " "") (format-comlist (function (lambda (x) (format "%s %s" (event-type-to-ctype (cadr x)) (car x)))) uargs)) ) (defun event-uargs-alist(uargs need_first) (concat (if (and need_first uargs) ", " "") (format-comlist (function (lambda (x) (format "%s" (car x)))) uargs)) ) (defun event-uargs-mlist(uargs need_first) (concat (if (and need_first uargs) ", " "") (format-comlist (function (lambda (x) (format "(%s)" (car x)))) uargs)) ) (defun fixup-oneline (event oneline) (let ((work (get-buffer-create "*string-tmp2*"))) (save-excursion (set-buffer work) (erase-buffer) (insert oneline) (beginning-of-buffer) (while (re-search-forward "${\\(\\w+\\)}" nil t) (let* ((it (intern (downcase-string (match-string 1)))) (uargs (event-uargs-get event)) (i 0) (repl nil)) (while uargs (if (eq (car (car uargs)) it) (setq repl (format "${%d}" i))) (setq uargs (cdr uargs)) (setq i (+ i 1)) ) (when (eq it 'strerror) (if repl (error "No wildcards named STRERROR")) (setq repl (format "${%d}" i)) ) (when (eq it 'ssl) (if repl (error "No wildcards named SSL")) (setq repl (format "${%d}" i)) ) (if (not repl) (error "Illegal wildcard %s in %s" it oneline)) (replace-match repl nil nil) ) ) (buffer-string) ) ) ) ;; Properties (defun generate-properties () (let ((cap-prefix (capitalize1 *output-prefix*)) (unique-types nil)) (output-header-file "_edsio") (insert (format "/* Property definitions */\n\n")) ;; Types (output-source-file "_edsio") (mapcar (function (lambda (pht) (let ((type (prophosttype-type-get pht))) (unless (member type unique-types) (setq unique-types (cons type unique-types)) (save-excursion (goto-char *source-init-marker*) ;(message "%s -> %s %s" type (type-free-func type) (member type (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*))) (insert (format " edsio_initialize_property_type (\"%s\", %s, %s, %s, %s, %s);\n" type (type-free-func type) (type-gs-func type "getter") (type-gs-func type "setter") (type-serialize-func type) (type-unserialize-func type))) ) ) ) ) ) *prophosttype-defs* ) ;; Host reg (mapcar (function (lambda (prophost) (save-excursion (goto-char *source-init-marker*) (insert (format " edsio_initialize_host_type (\"%s\", %s, %s, %s, %s, %s);\n" (prophost-name-get prophost) (format "(PropertyTableFunc) & edsio_%s_property_table" (downcase-string (prophost-name-get prophost))) (prophost-persist prophost "source") (prophost-persist prophost "sink") (prophost-persist prophost "isset") (prophost-persist prophost "unset") )) ) ) ) *prophost-defs*) ;; Compute each distinct (host type) x (prop type) (mapcar (function (lambda (prophost) (mapcar (function (lambda (prophosttype) (when (equal (prophosttype-host-get prophosttype) (prophost-name-get prophost)) (when (not (member (prophosttype-type-get prophosttype) (prophost-proptypes-get prophost))) (prophost-proptypes-set prophost (cons (prophosttype-type-get prophosttype) (prophost-proptypes-get prophost))) ) ))) *prophosttype-defs* ) ;; Output the get/set functions for each property type (mapcar (function (lambda (type) (let ((it (property-code-typename type prophost))) ;; Header (output-header-file "_edsio") (insert (format "/* Property get/set for %s/%s\n */\n\n" (prophost-name-get prophost) type)) (insert (format "typedef struct _%s %s;\n" it it)) (insert (format "struct _%s { guint32 code; };\n\n" it)) (insert (format "gboolean edsio_new_%s_%s_property (const char* name, guint32 flags, %s* prop);\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) it )) (insert (format "gboolean %s_get_%s (%s obj, %s prop%s);\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) (prophost-ctype-get prophost) it (prop-type-to-get-fps type))) (insert (format "gboolean %s_set_%s (%s obj, %s prop%s);\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) (prophost-ctype-get prophost) it (prop-type-to-set-fps type))) (insert (format "gboolean %s_unset_%s (%s obj, %s prop);\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) (prophost-ctype-get prophost) it)) (insert (format "gboolean %s_isset_%s (%s obj, %s prop);\n\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) (prophost-ctype-get prophost) it)) ;; Source (output-source-file "_edsio") (insert (format "gboolean edsio_new_%s_%s_property (const char* name, guint32 flags, %s* prop)\n{\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) it )) (insert (format " return edsio_new_property (name, \"%s\", \"%s\", flags, (EdsioGenericProperty*) prop);\n" (prophost-name-get prophost) type)) (insert (format "}\n\n")) (insert (format "gboolean\n%s_get_%s (%s obj, %s prop%s)\n{\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) (prophost-ctype-get prophost) it (prop-type-to-get-fps type))) (insert (format " EdsioProperty* ep;\n")) (insert (format " g_return_val_if_fail (obj, FALSE);\n")) (insert (format " return (* edsio_property_getter (\"%s\", \"%s\", prop.code, & ep)) (obj, ep%s);\n" (prophost-name-get prophost) type (prop-type-to-args type) )) (insert (format "}\n\n")) (insert (format "gboolean\n%s_set_%s (%s obj, %s prop%s)\n{\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) (prophost-ctype-get prophost) it (prop-type-to-set-fps type))) (insert (format " EdsioProperty* ep;\n")) (insert (format " g_return_val_if_fail (obj, FALSE);\n")) (insert (format " return (* edsio_property_setter (\"%s\", \"%s\", prop.code, & ep)) (obj, ep%s);\n" (prophost-name-get prophost) type (prop-type-to-args type) )) (insert (format "}\n\n")) (insert (format "gboolean\n%s_unset_%s (%s obj, %s prop)\n{\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) (prophost-ctype-get prophost) it)) (insert (format " g_return_val_if_fail (obj, FALSE);\n")) (insert (format " return edsio_property_unset (\"%s\", \"%s\", prop.code, obj);\n" (prophost-name-get prophost) type "" )) (insert (format "}\n\n")) (insert (format "gboolean\n%s_isset_%s (%s obj, %s prop)\n{\n" (downcase-string (prophost-name-get prophost)) (type-canon-name type) (prophost-ctype-get prophost) it)) (insert (format " g_return_val_if_fail (obj, FALSE);\n")) (insert (format " return edsio_property_isset (\"%s\", \"%s\", prop.code, obj);\n" (prophost-name-get prophost) type )) (insert (format "}\n\n")) ) ) ) (prophost-proptypes-get prophost) ) ) ) *all-prophost-defs* ) ) ) (defun property-code-typename(type prophost) (format "%s%s%sProperty" (capitalize1 *output-prefix*) (prophost-name-get prophost) (capitalize1 type)) ) (defun prop-typename-ctypes (type) (cond ((equal type 'string) (list (list 'arg "const gchar*"))) ((equal type 'uint) (list (list 'arg "guint32"))) ((equal type 'uint32) (list (list 'arg "guint32"))) ((equal type 'uint16) (list (list 'arg "guint16"))) ((equal type 'uint8) (list (list 'arg "guint8"))) ((equal type 'boolean) (list (list 'arg "gboolean"))) ((equal type 'bytes) (list (list 'arg "const guint8*") (list 'arg_len "guint32"))) ((equal type 'object) (list (list 'arg "void*") (list 'arg_type "guint32"))) ((member type (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (list (list 'arg (format "Serial%s*" type)))) ((equal (car type) 'bytes) (list (list 'arg "const guint8*"))) ((equal (car type) 'array) (list (list 'arg (format "%s*" (cadr (car (prop-typename-ctypes (cadr type)))))) (list 'arg_len "guint32"))) ((equal (car type) 'ptr) (list (list 'arg (format "%s*" (cadr (car (prop-typename-ctypes (cadr type)))))))) (t (error "unrecognized field type: %s" type))) ) (defun prop-type-to-get-fps (type) (concat ", " (format-comlist (function (lambda (pair) (format "%s* %s" (cadr pair) (car pair)) ) ) (prop-typename-ctypes type)) ) ) (defun prop-type-to-set-fps (type) (concat ", " (format-comlist (function (lambda (pair) (format "%s %s" (cadr pair) (car pair)) ) ) (prop-typename-ctypes type)) ) ) (defun prop-type-to-args (type) (concat ", " (format-comlist (function (lambda (pair) (format "%s" (car pair)) ) ) (prop-typename-ctypes type)) ) ) (defun type-canon-name (type) ; @@@ does not work for (array ...), etc (downcase-string type)) (defun type-serialize-func (type) (format "serialize_%s_obj" (downcase-string type)) ) (defun type-unserialize-func (type) (format "unserialize_%s" (downcase-string type)) ) (defun type-gs-func (type name) (if (member type (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (format "& edsio_property_vptr_%s" name) (format "& edsio_property_%s_%s" type name))) (defun type-free-func (type) (if (member type (mapcar (lambda (x) (sertype-name-get x)) *all-sertype-defs*)) (format "& edsio_property_vptr_free") (format "& edsio_property_%s_free" type))) (defun prophost-persist (prophost func) (if (prophost-persist-get prophost) (format "(Persist%sFunc) & %s_persist_%s_%s" (capitalize1 func) *output-prefix* (downcase-string (prophost-name-get prophost)) func) "NULL")) xdelta-1.1.3/libedsio/edsio.ser0000644006517700017500000000703707311304631012110 ;; -*- Emacs-Lisp -*- (defmodule edsio 6 "edsio.h" nil) (defsertype EdsioUint 1 ((val uint)) () ) (defsertype EdsioBytes 2 ((val bytes)) () ) (defsertype EdsioString 3 ((val string)) () ) (defsertype GenericTime 4 ((seconds uint) (nanos uint) ) () ) (defetype source "SerialSource*") (defetype sink "SerialSink*") (defetype int "int") (defetype string "const char*") (defevent GetTimeOfDayFailure Error () (errno) "Gettimeofday failed: ${STRERROR}") (defevent TimeFailure Error () (errno) "Time failed: ${STRERROR}") (defevent UnregisteredType Error ((library int) (number int)) () "Unregistered serial type: library=${LIBRARY} number=${NUMBER}") (defevent UnexpectedLibraryType Error ((expected int) (received int)) () "Unexpected serial library type: expected ${EXPECTED}, received ${RECEIVED}") (defevent UnexpectedType Error () () "Unexpected serial type") (defevent OutputBufferShort Error () () "Output buffer is too short") (defevent InvalidBase64Encoding Error () () "Invalid base64 encoding") (defevent MissingChecksum Error () () "Missing embedded checksum in base64 encoding") (defevent InvalidChecksum Error () () "Checksum verification failed") (defevent SourceEof Error ((source source)) () "${SOURCE}: Unexpected EOF") (defevent IncorrectAllocation Error ((source source)) () "${SOURCE}: Incorrect allocation") (defevent InvalidIntegerString Error ((msg string) (arg string)) () "${MSG}: not an integer: ${ARG}") (defevent IntegerOutOfRange Error ((msg string) (arg string)) () "${MSG}: integer out of range: ${ARG}") (defevent InvalidIntegerSign Error ((msg string) (arg string)) () "${MSG}: expected an unsigned integer: ${ARG}") (defevent DuplicatePropertyTypeRegistered Error ((name string)) () "Property type registered twice: ${NAME}") (defevent DuplicateHostTypeRegistered Error ((name string)) () "Property host registered twice: ${NAME}") (defevent DuplicatePropertyNameRegistered Warning ((name string)) () "Property name registered twice (ignored): ${NAME}") (defevent NoSuchProperty Error ((num int)) () "Unregistered property: ${NUM}") (defevent NoSuchPropertyType Error ((name string)) () "Unregistered property type: ${NAME}") (defevent NoSuchHostType Error ((name string)) () "Unregistered host type: ${NAME}") (defevent WrongHostType Error ((name string) (recv string) (expect string)) () "Wrong property host type: received ${RECV}, expected ${EXPECT}") (defevent WrongDataType Error ((name string) (recv string) (expect string)) () "Wrong property data type: received ${RECV}, expected ${EXPECT}") (defevent PropertyNotSet Error ((name string)) () "${NAME} property not set") (defevent PersistenceUnavailable Error ((name string) (host string)) () "Persistence is unavailable in host ${HOST} for property ${NAME}") (defevent InvalidStreamChecksum Error () () "Incorrect stream checksum") (defevent InvalidHexDigit Error ((bad string) (ctx string)) () "Invalid hex digit ${BAD} in context: ${CTX}") (defevent MD5StringShort Error ((short string)) () "MD5 string too short: ${SHORT}") (defevent MD5StringLong Error ((long string)) () "MD5 string too long: ${LONG}") (defevent UnregisteredLibrary Error ((number int)) () "Unregistered library: ${NUMBER}") (defevent GModuleError Error ((file string) (msg string)) () "GModule: ${FILE}: ${MSG}") ;; properties (defprophost PropTest "P" "PropTest*" t) (defprophosttype PropTest uint) (defprophosttype PropTest bytes) (defprophosttype PropTest string) (defprophosttype PropTest EdsioUint) xdelta-1.1.3/libedsio/edsio.prj0000644006517700017500000000267107311304631012111 ;; -*- Prcs -*- (Created-By-Prcs-Version 1 2 16) (Project-Description "") (Project-Version edsio xdelta11-maint 1) (Parent-Version edsio 0 47) (Version-Log "") (New-Version-Log "") (Checkin-Time "Mon, 11 Jun 2001 01:56:01 -0700") (Checkin-Login jmacd) (Populate-Ignore (".libs" ".deps" "\\.lo$" "\\.o$" "\\.la$" "edsiotest$" "\\.elc$" "CVS" "edsio_edsio\\." "edsio-comp$" "dead.code" "stamp-ser" "Makefile.in" "Makefile")) (Project-Keywords) (Files (Makefile.am (edsio/0_Makefile.a 1.9 644)) (edsio.el (edsio/1_edsio.el 1.16 644)) (edsio-comp.in (edsio/2_edsio-comp 1.2 644)) (edsio.ser (edsio/3_edsio.ser 1.9 644)) (edsio.h (edsio/7_serializei 1.15.1.1 644)) (edsio.c (edsio/8_serializei 1.24.1.1 644)) (sha.c (edsio/9_sha.c 1.2 644)) (md5c.c (edsio/10_md5c.c 1.1 644)) (edsiotest.c (edsio/11_edsiotest. 1.6 644)) (base64.c (edsio/12_base64.c 1.14 644)) (simple.c (edsio/13_simple.c 1.6 644)) (default.c (edsio/14_default.c 1.5 644)) (generic.c (edsio/15_generic.c 1.3 644)) (fh.c (edsio/16_fh.c 1.3 644)) (library.c (edsio/21_library.c 1.1 644)) ;; Sources obtained from RCS, primarily for parsing date formats. (partime.c (edsio/17_partime.c 1.1 644)) (maketime.c (edsio/18_maketime.c 1.1 644)) (maketime.h (edsio/19_maketime.h 1.1 644)) (partime.h (edsio/20_partime.h 1.1 644)) ;; Not used (modtest.c (edsio/22_modtest.c 1.1 644)) (modtest.ser (edsio/23_modtest.se 1.1 644)) ) (Merge-Parents) (New-Merge-Parents) xdelta-1.1.3/libedsio/stamp-ser10000644006517700017500000000000007311305144012170 xdelta-1.1.3/test/0000777006517700007640000000000007353555420007552 5xdelta-1.1.3/test/Makefile.in0000644006517700007640000001722307353555420011540 # Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ AS = @AS@ CC = @CC@ CPP = @CPP@ DLLTOOL = @DLLTOOL@ EMACS = @EMACS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ LD = @LD@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NM = @NM@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ top_srcdir_absolute = @top_srcdir_absolute@ EXTRA_DIST = xdeltatest.c README.test INCLUDES = -I$(top_srcdir)/libedsio $(GLIB_CFLAGS) noinst_PROGRAMS = xdeltatest xdeltatest_SOURCES = xdeltatest.c xdeltatest_LDADD = $(top_srcdir)/libxdelta.la $(top_srcdir)/libedsio/libedsio.la -lz $(GLIB_LIBS) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ xdeltatest_OBJECTS = xdeltatest.o xdeltatest_DEPENDENCIES = $(top_srcdir)/libxdelta.la \ $(top_srcdir)/libedsio/libedsio.la xdeltatest_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best SOURCES = $(xdeltatest_SOURCES) OBJECTS = $(xdeltatest_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .lo .o .s $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-noinstPROGRAMS: clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) distclean-noinstPROGRAMS: maintainer-clean-noinstPROGRAMS: .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: .c.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .s.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< .S.lo: $(LIBTOOL) --mode=compile $(COMPILE) -c $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: maintainer-clean-libtool: xdeltatest: $(xdeltatest_OBJECTS) $(xdeltatest_DEPENDENCIES) @rm -f xdeltatest $(LINK) $(xdeltatest_LDFLAGS) $(xdeltatest_OBJECTS) $(xdeltatest_LDADD) $(LIBS) tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ here=`pwd` && cd $(srcdir) \ && mkid -f$$here/ID $$unique $(LISP) TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS)'; \ unique=`for i in $$list; do echo $$i; done | \ awk ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) mostlyclean-tags: clean-tags: distclean-tags: -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = test distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done xdeltatest.o: xdeltatest.c ../getopt.h ../config.h ../xdelta.h \ ../xd_edsio.h ../libedsio/edsio.h ../libedsio/edsio_edsio.h info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-exec: install-exec-am install-data-am: install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall: uninstall-am all-am: Makefile $(PROGRAMS) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ mostlyclean-libtool mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \ clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-noinstPROGRAMS distclean-compile \ distclean-libtool distclean-tags distclean-generic \ clean-am -rm -f libtool distclean: distclean-am maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ maintainer-clean-compile maintainer-clean-libtool \ maintainer-clean-tags maintainer-clean-generic \ distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile mostlyclean-libtool distclean-libtool \ clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ install-exec install-data-am install-data install-am install \ uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xdelta-1.1.3/test/Makefile.am0000644006517700017500000000043207315315112011503 EXTRA_DIST = xdeltatest.c README.test INCLUDES = -I$(top_srcdir)/libedsio $(GLIB_CFLAGS) noinst_PROGRAMS = xdeltatest xdeltatest_SOURCES = xdeltatest.c xdeltatest_LDADD = $(top_srcdir)/libxdelta.la \ $(top_srcdir)/libedsio/libedsio.la \ -lz \ $(GLIB_LIBS) xdelta-1.1.3/test/xdeltatest.c0000644006517700017500000003302707353554706012022 /* -*- Mode: C;-*- * * This file is part of XDelta - A binary delta generator. * * Copyright (C) 1997, 1998, 2001 Josh MacDonald * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author: Josh MacDonald * * $Id: xdeltatest.c 1.6 Fri, 29 Jun 2001 06:01:08 -0700 jmacd $ */ #include #include #include #include "config.h" #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include #include #include #include #include #include #include "xdelta.h" ////////////////////////////////////////////////////////////////////// // Configure these parameters // @@@ Of course, a real test wouldn't require this configuration, // fix that! ////////////////////////////////////////////////////////////////////// const char* cmd_data_source = "/scratch/jmacd/source-code-data"; guint cmd_size = 1<<20; guint cmd_warmups = 2; guint cmd_reps = 20; guint cmd_changes = 1000; guint cmd_deletion_length = 30; guint cmd_insertion_length = 15; ////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////// #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) #define TEST_PREFIX "/tmp/xdeltatest" #define TEST_IS_GZIP 1 #define TEST_IS_XDELTA 2 typedef struct _File File; typedef struct _Patch Patch; typedef struct _TestProfile TestProfile; typedef struct _Instruction Instruction; struct _Instruction { guint32 offset; guint32 length; Instruction* next; }; struct _File { char name[MAXPATHLEN]; }; struct _Patch { guint8 *data; guint32 length; }; struct _TestProfile { const char *name; const char *progname; int flags; }; #undef BUFSIZ #define BUFSIZ (1<<24) guint8 __tmp_buffer[BUFSIZ]; // Note: Of course you should be able to set all this up on the // command line. TestProfile cmd_profiles[] = { { "xdelta -qn ", "../xdelta", TEST_IS_XDELTA }, { "diff --rcs -a", "/usr/bin/diff", 0 }, { "gzip ", "/bin/gzip", TEST_IS_GZIP }, }; int cmd_slevels[] = { 16, 32, 64 }; int cmd_zlevels[] = { 0, 1, 3, 6, 9 }; guint16 cmd_seed[3] = { 47384, 8594, 27489 }; FILE* data_source_handle; guint data_source_length; File* data_source_file; long current_to_size; long current_from_size; double __total_time; off_t __dsize; void reset_stats () { __total_time = 0; __dsize = -1; } void add_tv (GTimer *timer) { __total_time += g_timer_elapsed (timer, NULL); } void report (TestProfile *tp, int zlevel, int slevel) { static gboolean once = TRUE; double t = __total_time / (double) cmd_reps; double s; const char *u; char slevel_str[16]; if (tp->flags & TEST_IS_XDELTA) { sprintf (slevel_str, "%d", slevel); } else { slevel_str[0] = 0; } if (tp->flags & TEST_IS_GZIP) { s = __dsize / (double) current_to_size; u = "total size"; } else { s = __dsize / (double) (cmd_changes * cmd_insertion_length); u = "insertion size"; } if (once) { once = FALSE; g_print ("Program\t\tzlevel\tslevel\tSeconds\tNormalized\n\t\t\t\t\tcompression\n"); } g_print ("%s\t%d\t%s\t%0.3f\t%0.3f (of %s)\n", tp->name, zlevel, slevel_str, t, s, u); } guint32 random_offset (guint len) { return lrand48 () % (data_source_length - len); } void fail () { g_warning ("FAILURE\n"); abort (); } gboolean starts_with (const char* s, const char *start) { return strncmp (s, start, strlen (start)) == 0; } Patch* read_patch (File *file, struct stat *sbuf) { Patch *p = g_new0 (Patch,1); FILE *f = fopen (file->name, "r"); p->length = (int)sbuf->st_size; p->data = g_malloc (p->length); if (! f || fread (p->data, 1, p->length, f) != p->length) { perror ("fread"); fail (); } fclose (f); return p; } File* empty_file () { static gint count = 0; File *file = g_new0 (File, 1); sprintf (file->name, "%s.%d.%d", TEST_PREFIX, getpid (), count++); return file; } void compare_files (File* fromfile, File* tofile) { gint pos = 0; FILE* toh; FILE* fromh; guint8 buf1[1024], buf2[1024]; toh = fopen (tofile->name, "r"); fromh = fopen (fromfile->name, "r"); if (!toh || !fromh) fail (); for (;;) { gint readf = fread (buf1, 1, 1024, fromh); gint readt = fread (buf2, 1, 1024, toh); gint i, m = MIN(readf, readt); if (readf < 0 || readt < 0) fail (); for (i = 0; i < m; i += 1, pos += 1) { if (buf1[i] != buf2[i]) fail (); } if (m != 1024) { if (readt == readf) { fclose (toh); fclose (fromh); return; } fail (); } } } int write_file (File* file, Instruction* inst) { FILE* h; int ret; int size = 0; if (! (h = fopen (file->name, "w"))) { perror (file->name); fail (); } for (; inst; inst = inst->next) { g_assert (inst->length <= BUFSIZ); if ((ret = fseek (data_source_handle, inst->offset, SEEK_SET))) { perror ("fseek"); fail (); } if ((ret = fread (__tmp_buffer, 1, inst->length, data_source_handle)) != inst->length) { perror ("fread"); fail (); } if ((ret = fwrite (__tmp_buffer, 1, inst->length, h)) != inst->length) { perror ("fwrite"); fail (); } size += inst->length; } if ((ret = fclose (h))) { perror ("fclose"); fail (); } return size; } Instruction* perform_change_rec (Instruction* inst, guint32 change_off, guint* total_len) { if (change_off < inst->length) { guint32 to_delete = cmd_deletion_length; guint32 avail = inst->length; guint32 this_delete = MIN (to_delete, avail); Instruction* new_inst; // One delete inst->length -= this_delete; to_delete -= this_delete; while (to_delete > 0 && inst->next->length < to_delete) { to_delete -= inst->next->length; inst->next = inst->next->next; } if (to_delete > 0) inst->next->offset += to_delete; // One insert new_inst = g_new0 (Instruction, 1); new_inst->offset = random_offset (cmd_insertion_length); new_inst->length = cmd_insertion_length; new_inst->next = inst->next; inst->next = new_inst; (* total_len) += cmd_insertion_length - cmd_deletion_length; return inst; } else { inst->next = perform_change_rec (inst->next, change_off - inst->length, total_len); return inst; } } Instruction* perform_change (Instruction* inst, guint* len) { return perform_change_rec (inst, lrand48() % ((* len) - cmd_deletion_length), len); } gboolean xdelta_verify (TestProfile *tp, int zlevel, int slevel, File* from, File* to, File* out, File *re) { int pid, status; if ((pid = vfork()) < 0) return FALSE; if (pid == 0) { execl (tp->progname, tp->progname, "patch", out->name, from->name, re->name, NULL); perror ("execl failed"); _exit (127); } if (waitpid (pid, &status, 0) != pid) { perror ("wait failed"); fail (); } // Note: program is expected to return 0, 1 meaning diff or no diff, // > 1 indicates failure if (! WIFEXITED (status) || WEXITSTATUS (status) > 1) { g_warning ("patch command failed\n"); fail (); } compare_files (to, re); return TRUE; } gboolean run_command (TestProfile *tp, int zlevel, int slevel, File* from, File* to, File* out, File *re, gboolean accounting) { int pid, status, outfd; struct stat sbuf; char xdelta_args[16]; char xdelta_args2[16]; char diff_gzargs[16]; char gzip_args[16]; GTimer *timer = g_timer_new (); sprintf (xdelta_args, "-qn%d", zlevel); sprintf (xdelta_args2, "-s%d", slevel); sprintf (diff_gzargs, "wb%d", zlevel); sprintf (gzip_args, "-c%d", zlevel); unlink (out->name); g_timer_start (timer); if ((pid = vfork()) < 0) return FALSE; if (pid == 0) { if (starts_with (tp->name, "xdelta")) { execl (tp->progname, tp->progname, "delta", xdelta_args, xdelta_args2, from->name, to->name, out->name, NULL); } else { outfd = open (out->name, O_CREAT | O_TRUNC | O_WRONLY, 0777); if (outfd < 0) { perror ("open"); fail (); } dup2(outfd, STDOUT_FILENO); if (close (outfd)) { perror ("close"); fail (); } if (starts_with (tp->name, "diff")) execl (tp->progname, tp->progname, "--rcs", "-a", from->name, to->name, NULL); else if (starts_with (tp->name, "gzip")) execl (tp->progname, tp->progname, gzip_args, to->name, NULL); else abort (); } perror ("execl failed"); _exit (127); } if (waitpid (pid, &status, 0) != pid) { perror ("wait failed"); fail (); } // Note: program is expected to return 0, 1 meaning diff or no diff, // > 1 indicates failure if (! WIFEXITED (status) || WEXITSTATUS (status) > 1) { g_warning ("delta command failed\n"); fail (); } if (stat (out->name, & sbuf)) { perror ("stat"); fail (); } // Do zlib compression on behalf of diff if (zlevel > 0 && starts_with (tp->name, "diff")) { Patch *patch = read_patch (out, & sbuf); gzFile *rewrite = gzopen (out->name, diff_gzargs); if (! rewrite) fail (); if (gzwrite (rewrite, patch->data, patch->length) == 0) { perror ("gzwrite"); fail (); } if (gzclose (rewrite) != Z_OK) { perror ("gzclose"); fail (); } if (stat (out->name, & sbuf)) { perror ("stat"); fail (); } } g_timer_stop (timer); if (accounting) { add_tv (timer); } if (__dsize < 0) { __dsize = sbuf.st_size; // Verify only once if (starts_with (tp->name, "xdelta")) { if (! xdelta_verify (tp, zlevel, slevel, from, to, out, re)) { g_warning ("verify failed"); fail (); } } } else { if (__dsize != sbuf.st_size) { g_warning ("%s -%d: delta command produced different size deltas: %d and %d", tp->progname, zlevel, (int)__dsize, (int)sbuf.st_size); fail (); } } g_timer_destroy (timer); return TRUE; } void test1 (TestProfile *test_profile, File *from_file, File *to_file, File *out_file, File *re_file) { int ret; guint i, change, current_size = cmd_size; guint end_size = (cmd_changes * cmd_insertion_length) + cmd_size; Instruction* inst; struct stat sbuf; int zlevel_i, slevel_i; seed48 (cmd_seed); if ((ret = stat (cmd_data_source, & sbuf))) { perror (cmd_data_source); fail (); } if (! (data_source_handle = fopen (cmd_data_source, "r"))) { perror (cmd_data_source); fail (); } data_source_length = sbuf.st_size; /* arbitrary checks */ if (data_source_length < (1.5 * end_size)) g_warning ("data source should be longer\n"); if ((cmd_changes * cmd_deletion_length) > cmd_size) { g_warning ("no copies are expected\n"); fail (); } inst = g_new0 (Instruction, 1); inst->offset = random_offset (cmd_size); inst->length = cmd_size; current_from_size = write_file (from_file, inst); for (change = 0; change < cmd_changes; change += 1) inst = perform_change (inst, & current_size); current_to_size = write_file (to_file, inst); for (slevel_i = 0; slevel_i < ARRAY_LENGTH(cmd_slevels); slevel_i += 1) { int slevel = cmd_slevels[slevel_i]; if ((test_profile->flags & TEST_IS_XDELTA) == 0 && slevel_i != 0) { continue; } for (zlevel_i = 0; zlevel_i < ARRAY_LENGTH(cmd_zlevels); zlevel_i += 1) { int zlevel = cmd_zlevels[zlevel_i]; if (test_profile->flags & TEST_IS_GZIP) { if (zlevel != 1 && zlevel != 9) continue; } reset_stats (); for (i = 0; i < cmd_warmups + cmd_reps; i += 1) { if (! run_command (test_profile, zlevel, slevel, from_file, to_file, out_file, re_file, (i >= cmd_warmups) /* true => accounting */)) { fail (); } } report (test_profile, zlevel, slevel); } g_print ("\n"); } } int main (gint argc, gchar** argv) { int profile_i; File *from_file; File *to_file; File *out_file; File *re_file; system ("rm -rf " TEST_PREFIX "*"); from_file = empty_file (); to_file = empty_file (); out_file = empty_file (); re_file = empty_file (); for (profile_i = 0; profile_i < ARRAY_LENGTH(cmd_profiles); profile_i += 1) { test1 (& cmd_profiles[profile_i], from_file, to_file, out_file, re_file); system ("rm -rf " TEST_PREFIX "*"); } return 0; } xdelta-1.1.3/test/README.test0000644006517700017500000000075507317062445011327 The code in this directory produces a test for Xdelta. To run it you have to edit the hard-coded constants at the top of the file, which include "cmd_data_source", which should be the name of a big file containing source data that the test uses to construct sample inputs. This allows you to test on whatever kind of data you want, but the synthetic edits are still hardcoded. Have a look. Of course, a better test would let you run it without any configuration, but this is not that test. xdelta-1.1.3/doc/0000777006517700007640000000000007353555420007340 5xdelta-1.1.3/doc/Makefile.in0000644006517700007640000001341507353555420011325 # Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ AS = @AS@ CC = @CC@ CPP = @CPP@ DLLTOOL = @DLLTOOL@ EMACS = @EMACS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ LD = @LD@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NM = @NM@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ top_srcdir_absolute = @top_srcdir_absolute@ man_MANS = xdelta.1 EXTRA_DIST = xdelta.1 xdelta.cat mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = man1dir = $(mandir)/man1 MANS = $(man_MANS) NROFF = nroff DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status install-man1: $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done install-man: $(MANS) @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-man1 uninstall-man: @$(NORMAL_UNINSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 tags: TAGS TAGS: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = doc distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-exec: install-exec-am install-data-am: install-man install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall-man uninstall: uninstall-am all-am: Makefile $(MANS) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-generic clean-am -rm -f libtool distclean: distclean-am maintainer-clean-am: maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: install-man1 uninstall-man1 install-man uninstall-man tags \ distdir info-am info dvi-am dvi check check-am installcheck-am \ installcheck install-exec-am install-exec install-data-am install-data \ install-am install uninstall-am uninstall all-redirect all-am all \ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xdelta-1.1.3/doc/Makefile.am0000644006517700017500000000006607315312416011300 man_MANS = xdelta.1 EXTRA_DIST = xdelta.1 xdelta.cat xdelta-1.1.3/doc/xdelta.10000644006517700017500000001200307353554706010615 .ds p \&\s-1Xdelta\s0 .if n .ds - \%-- .if t .ds - \(em .if !\n(.g \{\ . if !\w|\*(lq| \{\ . ds lq `` . if \w'\(lq' .ds lq "\(lq . \} . if !\w|\*(rq| \{\ . ds rq '' . if \w'\(rq' .ds rq "\(rq . \} .\} .de PE .sp \\n()Pu .ne 2 .nf .IP .. .de EP .fi .PP .sp \\n()Pu .. .TH Xdelta 1 .SH NAME xdelta \- Invoke Xdelta .SH SYNOPSIS .B xdelta .I subcommand [ .IR option ".\|.\|. ] [ .IR operand .\|.\|. ] .SH DESCRIPTION Xdelta provides the ability to generate deltas between a pair of files and later apply those deltas. It operates similar to the .B diff and .B patch commands, but works on binary files and does not produce a human readable output. .PP Xdelta has three subcommands, delta, patch, and info. Delta accepts two file versions and produces a delta, while patch accepts the original file version and delta and produces the second version. The info command prints useful information about a delta. Each subcommand will be detailed seperately. .SS Gzip processing Attempting to compute a delta between compressed input files usually results in poor compression. This is because small differences between the original contents causes changes in the compression of whole blocks of data. To simplify things, Xdelta implements a special case for .IR gzip (1) compressed files. If any version input to the delta command is recognized as having gzip compression, it will be automatically decompressed into a temporary location prior to comparison. This temporary location is either the value of the .IR TMPDIR environment variable, if set, otherwise "/tmp". The Xdelta patch header contains a flag indicating that the reconstructed version should be recompressed after applying the patch. In general, this allows Xdelta to operate transparently on gzip compressed inputs. There is one potential problem when automatically processing gzip compressed files, which is that the recompressed content does not always match byte-for-byte with the original compressed content. The uncompressed content still matches, but if there is an external integrity check such as cryptographic signature verification, it may fail. To prevent this from happening, the --pristine option disables automatic gzip processing. .SS MD5 integrity check By default, Xdelta always verifies the MD5 checksum of the files it reconstructs. This prevents you from supplying an incorrect input during patch, which would result in corrupt output. Because of this feature, you can feel confident that patch has produced valid results. The --noverify option disables MD5 verification, but this is only recommended for performance testing. .SS Compressed patch format Xdelta uses a fairly simple encoding for its delta, then applies zlib compression to the result. You should not have to post-compress an Xdelta delta. .SS Delta The delta subcommand has the following synopsis: .B xdelta .I delta [ .IR option ".\|.\|. ] .IR fromfile .IR tofile .IR patchout Computes a delta from .IR fromfile to .IR tofile and writes it to .IR patchout .SS Patch The patch subcommand has the following synopsis: .B xdelta .I patch [ .IR option ".\|.\|. ] .IR patchin [ .IR fromfile [ .IR tofile ]] Applies .IR patchin to .IR fromfile and produces a reconstructed version of .IR tofile. If fromfile was omitted, Xdelta attempts to use the original fromfile name, which is stored in the delta. The from file must be identical to the one used to create the delta. If its length or MD5 checksum differs, patch will abort with an error message. If tofile was omitted, Xdelta attempts to use the original tofile name, which is also stored in the delta. If the original tofile name already exists, a unique filename extension will be added to avoid destroying any existing data. .SS Info The info subcommand has the following synopsis: .B xdelta .I info .IR patchinfo Prints information about .IR patchinfo and the version it reconstructs, including file names, lengths, and MD5 checksums. .SS Options .IP -0..9 Set the zlib compression level. Zero indicates no compression. Nine indicates maximum compression. .IP "-h, --help" Print a short help message and exit. .IP "-q, --quiet" Quiet. Surpresses several warning messages. .IP "-v, --version" Print the Xdelta version number and exit. .IP "-V, --verbose" Verbose. Prints a bit of extra information. .IP "-n, --noverify" No verify. Turns off MD5 checksum verification of the input and output files. .IP "-m=SIZE, --maxmem=SIZE" Set an upper bound on the size of an in-memory page cache. For example, --maxmem=32M will use a 32 megabyte page cache. .IP "-s=BLOCK_SIZE" Set the block size, unless it was hard coded (20% speed improvement). Should be a power of 2. .IP "-p, --pristine" Disable the automatic decompression of gzipped inputs, to prevent unexpected differences in the re-compressed content. .SH IDENTIFICATION Author: Joshua P. MacDonald, jmacd@cs.berkeley.edu .br .\" $Format: "Manual Page Revision: $Revision$; Release Date: $ProjectDate$."$ Manual Page Revision: 1.5; Release Date: Fri, 29 Jun 2001 06:01:08 -0700. .br Copyright \(co 1997, 1998, 1999, 2000, 2001 xdelta-1.1.3/doc/xdelta.cat0000644006517700017500000001234407317064006011221 Xdelta(1) Xdelta(1) NAME xdelta - Invoke Xdelta SYNOPSIS xdelta subcommand [ option... ] [ operand... ] DESCRIPTION Xdelta provides the ability to generate deltas between a pair of files and later apply those deltas. It operates similar to the diff and patch commands, but works on binary files and does not produce a human readable output. Xdelta has three subcommands, delta, patch, and info. Delta accepts two file versions and produces a delta, while patch accepts the original file version and delta and produces the second version. The info command prints useful information about a delta. Each subcommand will be detailed seperately. Gzip processing Attempting to compute a delta between compressed input files usually results in poor compression. This is because small differences between the original contents causes changes in the compression of whole blocks of data. To simplify things, Xdelta implements a special case for gzip(1) compressed files. If any version input to the delta command is recognized as having gzip compression, it will be automatically decompressed into a temporary location prior to comparison. This temporary location is either the value of the TMPDIR environment variable, if set, otherwise "/tmp". The Xdelta patch header contains a flag indicating that the reconstructed version should be recompressed after applying the patch. In general, this allows Xdelta to operate transparently on gzip compressed inputs. There is one potential problem when automatically processing gzip compressed files, which is that the recompressed content does not always match byte-for-byte with the original compressed content. The uncompressed content still matches, but if there is an external integrity check such as cryptographic signature verification, it may fail. To prevent this from happening, the --pristine option disables automatic gzip processing. MD5 integrity check By default, Xdelta always verifies the MD5 checksum of the files it reconstructs. This prevents you from supplying an incorrect input during patch, which would result in corrupt output. Because of this feature, you can feel confident that patch has produced valid results. The --noverify option disables MD5 verification, but this is only recommended for performance testing. Compressed patch format Xdelta uses a fairly simple encoding for its delta, then applies zlib compression to the result. You should not have to post-compress an Xdelta delta. Delta The delta subcommand has the following synopsis: xdelta delta [ option... ] fromfile tofile patchout Computes a delta from fromfile to tofile and writes it to patchout Patch The patch subcommand has the following synopsis: xdelta patch [ option... ] patchin [ fromfile [ tofile ]] Applies patchin to fromfile and produces a reconstructed version of tofile. If fromfile was omitted, Xdelta attempts to use the original fromfile name, which is stored in the delta. The from file must be identical to the one used to create the delta. If its length or MD5 checksum differs, patch will abort with an error message. If tofile was omitted, Xdelta attempts to use the original tofile name, which is also stored in the delta. If the original tofile name already exists, a unique filename extension will be added to avoid destroying any existing data. Info The info subcommand has the following synopsis: xdelta info patchinfo Prints information about patchinfo and the version it reconstructs, including file names, lengths, and MD5 checksums. Options -0..9 Set the zlib compression level. Zero indicates no compression. Nine indicates maximum compression. -h, --help Print a short help message and exit. -q, --quiet Quiet. Surpresses several warning messages. -v, --version Print the Xdelta version number and exit. -V, --verbose Verbose. Prints a bit of extra information. -n, --noverify No verify. Turns off MD5 checksum verification of the input and output files. -m=SIZE, --maxmem=SIZE Set an upper bound on the size of an in-memory page cache. For example, --maxmem=32M will use a 32 megabyte page cache. -s=BLOCK_SIZE Set the block size, unless it was hard coded (20% speed improvement). Should be a power of 2. -p, --pristine Disable the automatic decompression of gzipped inputs, to prevent unexpected differences in the re-compressed content. IDENTIFICATION Author: Joshua P. MacDonald, jmacd@cs.berkeley.edu Manual Page Revision: 1.2; Release Date: Mon, 11 Jun 2001 03:39:53 -0700. Copyright © 1997, 1998, 1999, 2000, 2001 xdelta-1.1.3/djgpp/0000777006517700007640000000000007353555420007677 5xdelta-1.1.3/djgpp/Makefile.in0000644006517700007640000001071207353555420011661 # Makefile.in generated automatically by automake 1.4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = @host_alias@ host_triplet = @host@ AS = @AS@ CC = @CC@ CPP = @CPP@ DLLTOOL = @DLLTOOL@ EMACS = @EMACS@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ LD = @LD@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NM = @NM@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ top_srcdir_absolute = @top_srcdir_absolute@ EXTRA_DIST = readme.djg announce.djg mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best all: all-redirect .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps djgpp/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status tags: TAGS TAGS: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = djgpp distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-exec: install-exec-am install-data-am: install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall: uninstall-am all-am: Makefile all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: mostlyclean-am: mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-generic clean-am -rm -f libtool distclean: distclean-am maintainer-clean-am: maintainer-clean-generic distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." maintainer-clean: maintainer-clean-am .PHONY: tags distdir info-am info dvi-am dvi check check-am \ installcheck-am installcheck install-exec-am install-exec \ install-data-am install-data install-am install uninstall-am uninstall \ all-redirect all-am all installdirs mostlyclean-generic \ distclean-generic clean-generic maintainer-clean-generic clean \ mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xdelta-1.1.3/djgpp/Makefile.am0000644006517700017500000000004607311216573011640 EXTRA_DIST = readme.djg announce.djg xdelta-1.1.3/djgpp/readme.djg0000644006517700017500000001223207311215267011526 DJGPP Port of XDelta 1.1.1 - Release 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Installing the Binary Package ----------------------------- Unzip the distribution preserving the directory structure - use PKUNZIP's -d option; use an equivalent option with other unzippers. Unzip into the top DJGPP installation directory, e.g. c:\djgpp. XDelta should now be ready for use. A man page for XDelta is provided - use: man xdelta to view it. You will need to have installed the man program from the v2apps/ directory of the DJGPP archive for this to work. Installing the Source Package ----------------------------- You should only install the source package if you want to rebuild XDelta from the sources. To build the port, I used the following packages: . DJGPP 2.03 . GNU bash 2.04 . GNU gcc 2.95.2 . GNU binutils 2.9.5.1 beta . GNU sed 3.02 . GNU awk 3.03 . GNU fileutils 3.16 . GNU shellutils 1.12 . glib 1.2.6 . zlib 1.1.2 It may be possible to build XDelta with other versions of each package, but this has not been tested. Unzip the distribution preserving the directory structure - use PKUNZIP's -d option; use an equivalent option with other unzippers. Unzip into the top DJGPP installation directory, e.g. c:\djgpp. A few changes were made to XDelta to make it work with DJGPP. The file contrib/xdlt111/djgpp/xdmain-c.diff was applied to xdmain.c. The source distribution has this patch applied, so no action is required to apply it. Before building XDelta, it must be configured. This is done from bash in the source directory using: ./configure --prefix=/dev/env/DJDIR Once this has compelted, build using: make Run the tests using: make check If these compelte successfully, XDelta and its libraries can be installed using: make install Some notes on using XDelta -------------------------- * XDelta is fairly simple - to see what options are available, use: xdelta --help * The '-p' or '--pristine' option prevents XDelta from using gzip compression, this avoids creating temporary files. This option is presented because gzip does not support exact re-compression, since there is no way to save the configuration used to produce a particular gzip file. Bugs fixed since Release 1 -------------------------- * Temporary filenames are now generated to fit into the MS-DOS 8+3 filename convention. * Temporary files should now be removed, when XDelta has finised. Previously, XDelta tried to remove them before they had been closed. On MS-DOS this can cause filesystem corruption; on Windows this just leaves the temporary files lying around. * XDelta's buffers are now sized by default according to the amount of free physical memory. It defaults to using 87.5% (7/8) of the available memory. Previously, XDelta would try to entire files into memory, to patch them. This included decompressing gzip files. Hence, it was quite easy for XDelta to exhaust available memory, resulting in XDelta crashing. * The '-m' or '--maxmem' switches, which set the maximum memory usage by XDelta, are now honoured. XDelta will use up to the specified size. NB: XDelta will not check the amount specified - be careful. If you give it too little memory, it will take a long time. If you give it more memory than is actually available, it will crash. Previously, XDelta would take the maximum of the specified size or 8MB. Since XDelta may be running on computers with 8MB or less, this was unsatisfactory. To see XDelta's maximum memory usage, run in verbose mode, e.g.: xdelta patch -V It will display a message like: xdelta: using 4096 kilobytes of buffer space * A couple of error messages were modified to include the file name, to make it clearer what the error is. * The info manual is now omitted from the distribution, since it does not contain any useful information about XDelta. * A formatted man page is now included. libxdelta and libedsio ---------------------- XDelta is actually just a front-end for two libraries - libxdelta and libedsio. libxdelta is a library for handling XDelta-format deltas. libedsio is a library for handling serialised I/O. Both these libraries are included in the port and can be used in your own programs. Unfortunately, there is no documentation for these libraries - the only reference is the source code. If you are interested in libxdelta and libedsio, please download the source distribution. Please note that I am not familiar with these libraries and I will not be able to answer any queries on them. libxdelta and libedsio come with *-config files, which return compilation and linking parameters. They are similar to glib-config. Example: bash-2.04$ xdelta-config --cflags -I/dev/env/DJDIR/lib/glib/include -I/dev/env/DJDIR/include bash-2.04$ $DJDIR/bin/xdelta-config --libs -L/dev/env/DJDIR/lib -lxdelta -ledsio -lglib Finally ------- If you have any comments or problems with this port, please feel free to e-mail me. I hope this port is useful. Thanks, bye, Richard Dawe 2001-03-31 xdelta-1.1.3/djgpp/announce.djg0000644006517700017500000000753607311215267012112 From: Richard Dawe (rich@phekda.freeserve.co.uk) Subject: ANNOUNCE: Release 2 of DJGPP port of XDelta 1.1.1 Newsgroups: comp.os.msdos.djgpp Date: 2001-04-05 13:42:13 PST Hello. I've updated the port of XDelta 1.1.1 to DJGPP. If you used the previous release, PLEASE UPGRADE. This release fixes a bug that could cause data loss. Several other minor bugfixes should make the port much more usable. See below for a list of bugfixes. The DJGPP readme has also been updated to include a little more information on XDelta, since the XDelta documentation is not very helpful. Here is a description of XDelta, from its 'readme' file: "XDelta is a library interface and application program designed to compute changes between files. These changes (deltas) are similar to the output of the "diff" program in that they may be used to store and transmit only the changes between files. However, unlike diff, the output of XDelta is not expressed in a human-readable format--XDelta can also also apply these deltas to a copy of the original file(s). XDelta uses a fast, linear algorithm and performs well on both binary and text files. XDelta typically outperforms GNU diff in both time and generated-delta-size, even for plain text files. XDelta also includes a simple implementation of the Rsync algorithm and several advanced features for implementing RCS-like file-archival with." XDelta is distributed under the GNU General Public License. The port is available from the DJGPP archive on SimTel.NET: ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2apps/xdlt111b.zip ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2apps/xdlt111s.zip These are binary and source distributions respectively. If you only want to use XDelta, please download the binary distribution. If you would like to rebuild XDelta, please download the source distribution. Minor changes were required to port XDelta to DJGPP - the diffs are included in the source distribution. Bugs fixed since Release 1 -------------------------- * Temporary filenames are now generated to fit into the MS-DOS 8+3 filename convention. * Temporary files should now be removed, when XDelta has finised. Previously, XDelta tried to remove them before they had been closed. On MS-DOS this can cause filesystem corruption; on Windows this just leaves the temporary files lying around. * XDelta's buffers are now sized by default according to the amount of free physical memory. It defaults to using 87.5% (7/8) of the available memory. Previously, XDelta would try to entire files into memory, to patch them. This included decompressing gzip files. Hence, it was quite easy for XDelta to exhaust available memory, resulting in XDelta crashing. * The '-m' or '--maxmem' switches, which set the maximum memory usage by XDelta, are now honoured. XDelta will use up to the specified size. NB: XDelta will not check the amount specified - be careful. If you give it too little memory, it will take a long time. If you give it more memory than is actually available, it will crash. Previously, XDelta would take the maximum of the specified size or 8MB. Since XDelta may be running on computers with 8MB or less, this was unsatisfactory. To see XDelta's maximum memory usage, run in verbose mode, e.g.: xdelta patch -V It will display a message like: xdelta: using 4096 kilobytes of buffer space * A couple of error messages were modified to include the file name, to make it clearer what the error is. * The info manual is now omitted from the distribution, since it does not contain any useful information about XDelta. * A formatted man page is now included. Thanks to Eli Zaretskii for his detailed bug reports, suggestions and testing! If you have any problems, suggestions, etc. about the port, please mail me. Bye, -- Richard Dawe http://www.bigfoot.com/~richdawe/