diff options
author | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-08-15 09:31:11 +0100 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-08-15 09:31:11 +0100 |
commit | d0dc3f5c30ca0b8350b48ba032a65681bfa20bdb (patch) | |
tree | 17ada9ef2482441523576855dce14785e40d96a3 /autoconf | |
download | pv-d0dc3f5c30ca0b8350b48ba032a65681bfa20bdb.tar.gz |
Tarball conversion
Diffstat (limited to 'autoconf')
-rw-r--r-- | autoconf/Makefile.in | 14 | ||||
-rw-r--r-- | autoconf/configure.in | 181 | ||||
-rw-r--r-- | autoconf/header.in | 82 | ||||
-rw-r--r-- | autoconf/make/depend.mk~ | 18 | ||||
-rw-r--r-- | autoconf/make/filelist.mk~ | 53 | ||||
-rw-r--r-- | autoconf/make/link.mk | 11 | ||||
-rw-r--r-- | autoconf/make/modules.mk~ | 14 | ||||
-rw-r--r-- | autoconf/make/package.mk | 17 | ||||
-rw-r--r-- | autoconf/make/rules.mk | 43 | ||||
-rw-r--r-- | autoconf/make/unreal.mk | 213 | ||||
-rw-r--r-- | autoconf/make/vars.mk | 47 | ||||
-rwxr-xr-x | autoconf/scripts/benchmark.sh | 39 | ||||
-rwxr-xr-x | autoconf/scripts/depend.sh | 30 | ||||
-rwxr-xr-x | autoconf/scripts/index.sh | 171 | ||||
-rwxr-xr-x | autoconf/scripts/install.sh | 250 | ||||
-rwxr-xr-x | autoconf/scripts/makemake.sh | 113 | ||||
-rwxr-xr-x | autoconf/scripts/mkinstalldirs | 33 | ||||
-rwxr-xr-x | autoconf/scripts/po2table.sh | 65 | ||||
-rwxr-xr-x | autoconf/scripts/run-test.sh | 48 |
19 files changed, 1442 insertions, 0 deletions
diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in new file mode 100644 index 0000000..aee4384 --- /dev/null +++ b/autoconf/Makefile.in @@ -0,0 +1,14 @@ +# +# Files from which this is generated (inside directory `autoconf/make'): +# +# package.mk # package name and distribution details +# vars.mk # compilation, shell and linking variables +# filelist.mk~ # lists of files +# unreal.mk # phony targets +# modules.mk~ # module linking rules +# rules.mk # compilation rules +# link.mk # real top-level targets +# depend.mk~ # dependencies +# +# + diff --git a/autoconf/configure.in b/autoconf/configure.in new file mode 100644 index 0000000..b82ff6a --- /dev/null +++ b/autoconf/configure.in @@ -0,0 +1,181 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(src/main/version.c) + +dnl We're using C. +dnl +AC_LANG_C + +dnl Output a header file. +dnl +AC_CONFIG_HEADER(src/include/config.h:autoconf/header.in) + +dnl Set directory to check for Configure scripts in. +dnl +AC_CONFIG_AUX_DIR(autoconf/scripts) + +dnl Read in package details. +dnl +PACKAGE=`cat $srcdir/doc/PACKAGE` +VERSION=`cat $srcdir/doc/VERSION` +UCPACKAGE=`tr a-z A-Z < $srcdir/doc/PACKAGE` +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) +AC_SUBST(UCPACKAGE) +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +AC_DEFINE_UNQUOTED(PROGRAM_NAME, "$PACKAGE") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION") + +dnl Check for compile-time options. +dnl +AC_ARG_ENABLE(debugging, + [ --enable-debugging compile with debugging symbols], + if test "$enable_debugging" = "yes"; then + CFLAGS="-g -Wall" + fi +) +AC_ARG_ENABLE(profiling, + [ --enable-profiling compile with profiling support], + if test "$enable_profiling" = "yes"; then + CFLAGS="-pg $CFLAGS" + fi +) +LFS_SUPPORT="no" +AC_ARG_ENABLE(lfs, [ --disable-lfs disable LFS support], + if test "$enable_lfs" = "yes"; then + LFS_SUPPORT="yes" + fi, + LFS_SUPPORT="yes" +) +STATIC_NLS="no" +AC_ARG_ENABLE(static-nls, [ --enable-static-nls hardcode NLS with no support files], + if test "$enable_static_nls" = "yes"; then + STATIC_NLS="yes" + fi, + STATIC_NLS="no" +) +NLS_SUPPORT="no" +AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], + if test "$enable_nls" = "yes"; then + NLS_SUPPORT="yes" + fi, + NLS_SUPPORT="yes" +) +SPLICE_SUPPORT="no" +AC_ARG_ENABLE(splice, [ --disable-splice do not use splice system call], + if test "$enable_splice" = "yes"; then + SPLICE_SUPPORT="yes" + fi, + SPLICE_SUPPORT="yes" +) + +dnl Check for various programs. +dnl +CFLAGS=${CFLAGS:-"-O"} +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_CHECK_PROG(DO_GZIP, gzip, gzip -f9, touch) + +dnl NLS stuff. +dnl +ALL_LINGUAS="de fr pl pt" +if test "$NLS_SUPPORT" = "yes"; then + AC_DEFINE(ENABLE_NLS) + AC_PATH_PROG(MSGFMT, msgfmt, NOMSGFMT) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AC_PATH_PROG(XGETTEXT, xgettext, xgettext) + if test "x$MSGFMT" = "xNOMSGFMT"; then + MSGFMT="" + STATIC_NLS="yes" + fi + if test "$STATIC_NLS" = "yes"; then + CATALOGS="" + NLSOBJ="src/nls/table.o" + else + AC_CHECK_LIB(intl, main) + AC_CHECK_LIB(i, main) + fi + CATOBJEXT=.mo + INSTOBJEXT=.mo + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES \$(srcdir)/src/nls/$lang.po" + CATALOGS="$CATALOGS src/nls/$lang$CATOBJEXT"; + done + if test "$STATIC_NLS" = "yes"; then + CATALOGS="" + else + AC_CHECK_FUNC(gettext, + [AC_DEFINE(HAVE_GETTEXT) + NLSOBJ="" + ], [CATALOGS=""; NLSOBJ="src/nls/table.o" + ] + ) + fi +fi +AC_CHECK_HEADERS(libintl.h) +AC_CHECK_HEADERS(locale.h) +AC_SUBST(MSGFMT) +AC_SUBST(GMSGFMT) +AC_SUBST(XGETTEXT) +AC_SUBST(CATOBJEXT) +AC_SUBST(INSTOBJEXT) +AC_SUBST(GMOFILES) +AC_SUBST(POFILES) +AC_SUBST(CATALOGS) +AC_SUBST(NLSOBJ) + +dnl Getopt checks. +dnl +AC_CHECK_FUNCS(getopt_long getopt) +AC_CHECK_HEADERS(getopt.h) + +dnl LFS checks. +dnl +if test "$LFS_SUPPORT" = "yes"; then + AC_CHECK_FUNCS(open64, AC_DEFINE(ENABLE_LARGEFILE)) +fi + +dnl Check for various header files and set various other macros. +dnl +AC_DEFINE(HAVE_CONFIG_H) +AC_HEADER_STDC +AC_CHECK_FUNCS(memcpy basename snprintf stat64) +AC_CHECK_HEADERS(limits.h sys/ipc.h sys/param.h libgen.h) + +if test "$SPLICE_SUPPORT" = "yes"; then + AC_CHECK_FUNCS(splice) +fi + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +AC_SUBST(INSTALL_DATA) + +dnl Fudging for separate build directories. +dnl +subdirs="" +for i in `find $srcdir/src -type d -print | sed s,$srcdir/,,`; do + subdirs="$subdirs $i" +done + +dnl Stitch together the Makefile fragments. +dnl +mk_segments="autoconf/Makefile.in" +for i in vars.mk package.mk filelist.mk~ unreal.mk modules.mk~ \ + rules.mk link.mk depend.mk~; do + mk_segments="$mk_segments:autoconf/make/$i" +done + +dnl Output files (and create build directory structure too). +dnl +AC_OUTPUT(Makefile:$mk_segments doc/lsm:doc/lsm.in + doc/quickref.1:doc/quickref.1.in + doc/$PACKAGE.spec:doc/spec.in + src/.dummy:doc/NEWS, + rm -f src/.dummy + for i in $subdirs; do + test -d $i || mkdir $i + done +, subdirs="$subdirs") + +dnl EOF diff --git a/autoconf/header.in b/autoconf/header.in new file mode 100644 index 0000000..6aad148 --- /dev/null +++ b/autoconf/header.in @@ -0,0 +1,82 @@ +/*!NOINDEX*/ +/* Define if you have standard C headers. */ +#undef STDC_HEADERS + +/* Define if you have "config.h" (yes, you have). */ +#undef HAVE_CONFIG_H + +/* Various other header files. */ +#undef HAVE_GETOPT_H +#undef HAVE_LIMITS_H +#undef HAVE_SYS_IPC_H +#undef HAVE_SYS_PARAM_H +#undef HAVE_LIBGEN_H + +/* Functions. */ +#undef HAVE_GETOPT +#undef HAVE_GETOPT_LONG +#undef HAVE_MEMCPY +#undef HAVE_BASENAME +#undef HAVE_SNPRINTF +#undef HAVE_STAT64 + +/* NLS stuff. */ +#undef ENABLE_NLS +#undef HAVE_LIBINTL_H +#undef HAVE_LOCALE_H +#undef HAVE_GETTEXT +#ifdef ENABLE_NLS +# include "library/gettext.h" +#else +# define _(String) (String) +# define N_(String) (String) +#endif + +#undef HAVE_SPLICE + +/* The name of the program. */ +#define PROGRAM_NAME "progname" + +/* The name of the package. */ +#define PACKAGE "" + +/* The current package version. */ +#define VERSION "0.0.0" + +/* Various identification and legal stuff. */ +#define COPYRIGHT_YEAR _("2012") +#define COPYRIGHT_HOLDER _("Andrew Wood <andrew.wood@ivarch.com>") +#define PROJECT_HOMEPAGE "http://www.ivarch.com/programs/" PROGRAM_NAME ".shtml" +#define BUG_REPORTS_TO _("Andrew Wood <andrew.wood@ivarch.com>") + +/* LFS support. */ +#undef ENABLE_LARGEFILE +#ifdef ENABLE_LARGEFILE +# define __USE_LARGEFILE64 1 +# define _LARGEFILE64_SOURCE 1 +#else +/* + * Some Macs have stat64 despite not having open64 while others don't have + * either, so here even if we don't have open64 or LFS is disabled, we have + * to check whether stat64 exists and only redefine it if it doesn't + * otherwise some Macs fail to compile. + */ +# ifdef __APPLE__ +# ifndef HAVE_STAT64 +# define stat64 stat +# define fstat64 fstat +# endif +# else +# define stat64 stat +# define fstat64 fstat +# endif +# define open64 open +# define lseek64 lseek +#endif + +#undef HAVE_IPC +#ifdef HAVE_SYS_IPC_H +#define HAVE_IPC 1 +#endif + +/* EOF */ diff --git a/autoconf/make/depend.mk~ b/autoconf/make/depend.mk~ new file mode 100644 index 0000000..d20ff3e --- /dev/null +++ b/autoconf/make/depend.mk~ @@ -0,0 +1,18 @@ +# +# Dependencies. +# + +src/pv/number.d src/pv/number.o: src/pv/number.c src/include/config.h src/include/library/gettext.h +src/pv/file.d src/pv/file.o: src/pv/file.c src/include/options.h src/include/config.h src/include/library/gettext.h +src/pv/display.d src/pv/display.o: src/pv/display.c src/include/config.h src/include/library/gettext.h src/include/options.h src/include/pv.h +src/pv/signal.d src/pv/signal.o: src/pv/signal.c src/include/pv.h src/include/config.h src/include/library/gettext.h +src/pv/loop.d src/pv/loop.o: src/pv/loop.c src/include/options.h src/include/pv.h src/include/config.h src/include/library/gettext.h +src/pv/cursor.d src/pv/cursor.o: src/pv/cursor.c src/include/options.h src/include/pv.h src/include/config.h src/include/library/gettext.h +src/pv/transfer.d src/pv/transfer.o: src/pv/transfer.c src/include/options.h src/include/config.h src/include/library/gettext.h +src/main/help.d src/main/help.o: src/main/help.c src/include/config.h src/include/library/gettext.h +src/main/options.d src/main/options.o: src/main/options.c src/include/config.h src/include/library/gettext.h src/include/options.h src/include/library/getopt.h src/include/pv.h +src/main/main.d src/main/main.o: src/main/main.c src/include/config.h src/include/library/gettext.h src/include/options.h src/include/pv.h +src/main/remote.d src/main/remote.o: src/main/remote.c src/include/config.h src/include/library/gettext.h src/include/options.h src/include/pv.h +src/main/version.d src/main/version.o: src/main/version.c src/include/config.h src/include/library/gettext.h +src/library/getopt.d src/library/getopt.o: src/library/getopt.c src/include/config.h src/include/library/gettext.h +src/library/gettext.d src/library/gettext.o: src/library/gettext.c src/include/config.h src/include/library/gettext.h diff --git a/autoconf/make/filelist.mk~ b/autoconf/make/filelist.mk~ new file mode 100644 index 0000000..d0e0d11 --- /dev/null +++ b/autoconf/make/filelist.mk~ @@ -0,0 +1,53 @@ +# Automatically generated file listings +# +# Creation time: Wed Jun 27 11:40:36 BST 2012 + +allsrc = src/pv/number.c \ +src/pv/file.c \ +src/pv/display.c \ +src/pv/signal.c \ +src/pv/loop.c \ +src/pv/cursor.c \ +src/pv/transfer.c \ +src/main/help.c \ +src/main/options.c \ +src/main/main.c \ +src/main/remote.c \ +src/main/version.c \ +src/library/getopt.c \ +src/library/gettext.c + +allobj = src/pv/number.o \ +src/pv/file.o \ +src/pv/display.o \ +src/pv/signal.o \ +src/pv/loop.o \ +src/pv/cursor.o \ +src/pv/transfer.o \ +src/main/help.o \ +src/main/options.o \ +src/main/main.o \ +src/main/remote.o \ +src/main/version.o \ +src/library/getopt.o \ +src/library/gettext.o \ +src/pv.o \ +src/nls.o \ +src/main.o \ +src/library.o + +alldep = src/pv/number.d \ +src/pv/file.d \ +src/pv/display.d \ +src/pv/signal.d \ +src/pv/loop.d \ +src/pv/cursor.d \ +src/pv/transfer.d \ +src/main/help.d \ +src/main/options.d \ +src/main/main.d \ +src/main/remote.d \ +src/main/version.d \ +src/library/getopt.d \ +src/library/gettext.d + diff --git a/autoconf/make/link.mk b/autoconf/make/link.mk new file mode 100644 index 0000000..9f861cd --- /dev/null +++ b/autoconf/make/link.mk @@ -0,0 +1,11 @@ +# +# Targets. +# + +$(package): src/main.o src/library.o src/pv.o @NLSOBJ@ + $(CC) $(LINKFLAGS) $(CFLAGS) -o $@ src/main.o src/library.o src/pv.o @NLSOBJ@ $(LIBS) + +$(package)-static: src/main.o src/library.o src/pv.o @NLSOBJ@ + $(CC) $(LINKFLAGS) $(CFLAGS) -static -o $@ src/main.o src/library.o src/pv.o @NLSOBJ@ $(LIBS) + +# EOF diff --git a/autoconf/make/modules.mk~ b/autoconf/make/modules.mk~ new file mode 100644 index 0000000..951772e --- /dev/null +++ b/autoconf/make/modules.mk~ @@ -0,0 +1,14 @@ +# Automatically generated module linking rules +# +# Creation time: Wed Jun 27 11:40:36 BST 2012 + +src/pv.o: src/pv/cursor.o src/pv/display.o src/pv/file.o src/pv/loop.o src/pv/number.o src/pv/signal.o src/pv/transfer.o + $(LD) $(LDFLAGS) -o $@ src/pv/cursor.o src/pv/display.o src/pv/file.o src/pv/loop.o src/pv/number.o src/pv/signal.o src/pv/transfer.o + +src/main.o: src/main/help.o src/main/main.o src/main/options.o src/main/remote.o src/main/version.o + $(LD) $(LDFLAGS) -o $@ src/main/help.o src/main/main.o src/main/options.o src/main/remote.o src/main/version.o + +src/library.o: src/library/getopt.o src/library/gettext.o + $(LD) $(LDFLAGS) -o $@ src/library/getopt.o src/library/gettext.o + + diff --git a/autoconf/make/package.mk b/autoconf/make/package.mk new file mode 100644 index 0000000..82036de --- /dev/null +++ b/autoconf/make/package.mk @@ -0,0 +1,17 @@ +# +# Package name, version, and distribution files. +# + +package = @PACKAGE@ +version = @VERSION@ +PACKAGE = @PACKAGE@ + +distfiles = \ +$(srcdir)/README \ +$(srcdir)/autoconf \ +$(srcdir)/configure \ +$(srcdir)/doc \ +$(srcdir)/src \ +$(srcdir)/tests + +# EOF diff --git a/autoconf/make/rules.mk b/autoconf/make/rules.mk new file mode 100644 index 0000000..96ed511 --- /dev/null +++ b/autoconf/make/rules.mk @@ -0,0 +1,43 @@ +# +# Compilation rules. +# + +.SUFFIXES: .c .d .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.c.d: + sh $(srcdir)/autoconf/scripts/depend.sh \ + $(CC) $< $(<:%.c=%) $(srcdir) $(CFLAGS) $(CPPFLAGS) > $@ + +# +# NLS stuff +# + +%.mo: %.po + $(MSGFMT) -o $@ $< + @touch $@ + @chmod 644 $@ + +%.gmo: %.po + rm -f $@ + $(GMSGFMT) -o $@ $< + @touch $@ + @chmod 644 $@ + +$(srcdir)/src/nls/$(PACKAGE).pot: $(allsrc) + $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(srcdir) \ + --add-comments --keyword=_ --keyword=N_ \ + $(allsrc) + if cmp -s $(PACKAGE).po $@; then \ + rm -f $(PACKAGE).po; \ + else \ + rm -f $@; \ + mv $(PACKAGE).po $@; \ + chmod 644 $@; \ + fi + +src/nls/table.c: $(POFILES) + sh $(srcdir)/autoconf/scripts/po2table.sh $(POFILES) > src/nls/table.c + diff --git a/autoconf/make/unreal.mk b/autoconf/make/unreal.mk new file mode 100644 index 0000000..3bb51c2 --- /dev/null +++ b/autoconf/make/unreal.mk @@ -0,0 +1,213 @@ +# +# Rules for all phony targets. +# + +.PHONY: all help make dep depend test check \ + clean depclean indentclean distclean cvsclean svnclean \ + index manhtml indent update-po \ + doc dist release \ + install uninstall \ + rpmbuild rpm srpm + +all: $(alltarg) $(CATALOGS) + +help: + @echo 'This Makefile has the following utility targets:' + @echo + @echo ' all build all binary targets' + @echo ' install install compiled package and manual' + @echo ' uninstall uninstall the package' + @echo ' check / test run standardised tests on the compiled binary' + @echo + @echo 'Developer targets:' + @echo + @echo ' make rebuild the Makefile (after adding new files)' + @echo ' dep / depend rebuild .d (dependency) files' + @echo ' clean remove .o (object) and .c~ (backup) files' + @echo ' depclean remove .d (dependency) files' + @echo ' indentclean remove files left over from "make indent"' + @echo ' distclean remove everything not distributed' + @echo ' cvsclean remove everything not in CVS/SVN' + @echo + @echo ' index generate an HTML index of source code' + @echo ' manhtml output HTML man page to stdout' + @echo ' indent reformat all source files with "indent"' + @echo ' update-po update the .po files' + @echo + @echo ' dist create a source tarball for distribution' + @echo ' rpm build a binary RPM (passes $$RPMFLAGS to RPM)' + @echo ' srpm build a source RPM (passes $$RPMFLAGS to RPM)' + @echo ' release dist+rpm+srpm' + @echo + +make: + echo > $(srcdir)/autoconf/make/filelist.mk~ + echo > $(srcdir)/autoconf/make/modules.mk~ + cd $(srcdir); \ + bash autoconf/scripts/makemake.sh \ + autoconf/make/filelist.mk~ \ + autoconf/make/modules.mk~ + sh ./config.status + +dep depend: $(alldep) + echo '#' > $(srcdir)/autoconf/make/depend.mk~ + echo '# Dependencies.' >> $(srcdir)/autoconf/make/depend.mk~ + echo '#' >> $(srcdir)/autoconf/make/depend.mk~ + echo >> $(srcdir)/autoconf/make/depend.mk~ + cat $(alldep) >> $(srcdir)/autoconf/make/depend.mk~ + sh ./config.status + +clean: + rm -f $(allobj) + +depclean: + rm -f $(alldep) + +indentclean: + cd $(srcdir) && for FILE in $(allsrc); do rm -f ./$${FILE}~; done + +update-po: $(srcdir)/src/nls/$(PACKAGE).pot + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + lang=$(srcdir)/`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \ + mv $$lang.po $$lang.old.po; \ + if $(MSGMERGE) $$lang.old.po $(srcdir)/src/nls/$(PACKAGE).pot > $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$cat failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + chmod 644 $$lang.po; \ + fi; \ + done + +distclean: clean depclean + rm -f $(alltarg) src/include/config.h + rm -rf $(package)-$(version).tar* $(package)-$(version) + rm -f *.html config.* + rm Makefile + +cvsclean svnclean: distclean + rm -f doc/lsm + rm -f doc/$(package).spec + rm -f doc/quickref.1 + rm -f configure + rm -f src/nls/*.gmo src/nls/*.mo + echo > $(srcdir)/autoconf/make/depend.mk~ + echo > $(srcdir)/autoconf/make/filelist.mk~ + echo > $(srcdir)/autoconf/make/modules.mk~ + +doc: + : + +index: + (cd $(srcdir); sh autoconf/scripts/index.sh $(srcdir)) > index.html + +manhtml: + @man2html ./doc/quickref.1 \ + | sed -e '1,/<BODY/d' -e '/<\/BODY/,$$d' \ + -e 's|<A [^>]*> </A>||ig' \ + -e 's|<A [^>]*>\([^<]*\)</A>|\1|ig' \ + -e '/<H1/d' -e 's|\(</H[0-9]>\)|\1<P>|ig' \ + -e 's/<DL COMPACT>/<DL>/ig' \ + -e 's/<[0-9A-Za-z_.-]\+@[0-9A-Za-z_.-]\+>//g' \ + -e 's|<I>\(http://.*\)</I>|<A HREF="\1">\1</A>|ig' \ + | sed -e '1,/<HR/d' -e '/<H2>Index/,/<HR/d' \ + +indent: + cd $(srcdir) && indent -npro -kr -i8 -cd42 -c45 $(allsrc) + +dist: doc update-po + rm -rf $(package)-$(version) + mkdir $(package)-$(version) + cp -dprf Makefile $(distfiles) $(package)-$(version) + cd $(package)-$(version); $(MAKE) distclean + cp -dpf doc/lsm $(package)-$(version)/doc/ + cp -dpf doc/$(package).spec $(package)-$(version)/doc/ + chmod 644 `find $(package)-$(version) -type f -print` + chmod 755 `find $(package)-$(version) -type d -print` + chmod 755 `find $(package)-$(version)/autoconf/scripts` + chmod 755 $(package)-$(version)/configure + rm -rf DUMMY `find $(package)-$(version) -type d -name CVS` + rm -rf DUMMY `find $(package)-$(version) -type d -name .svn` + tar cf $(package)-$(version).tar $(package)-$(version) + rm -rf $(package)-$(version) + $(DO_GZIP) $(package)-$(version).tar + +check test: $(alltarg) + sh $(srcdir)/autoconf/scripts/run-test.sh ./$(package) $(srcdir) + +install: all doc + $(srcdir)/autoconf/scripts/mkinstalldirs \ + "$(DESTDIR)$(bindir)" + $(srcdir)/autoconf/scripts/mkinstalldirs \ + "$(DESTDIR)$(mandir)/man1" + $(INSTALL) -m 755 $(package) \ + "$(DESTDIR)$(bindir)/$(package)" + $(INSTALL) -m 644 doc/quickref.1 \ + "$(DESTDIR)$(mandir)/man1/$(package).1" + -$(DO_GZIP) "$(DESTDIR)$(mandir)/man1/$(package).1" + if test -n "$(CATALOGS)"; then \ + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + name=`echo $$cat | sed 's,^.*/,,g'`; \ + if test "`echo $$name | sed 's/.*\(\..*\)/\1/'`" = ".gmo"; then \ + destdir=$(gnulocaledir); \ + else \ + destdir=$(localedir); \ + fi; \ + lang=`echo $$name | sed 's/$(CATOBJEXT)$$//'`; \ + dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ + $(srcdir)/autoconf/scripts/mkinstalldirs $$dir; \ + $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + done; \ + fi + +uninstall: + -$(UNINSTALL) "$(DESTDIR)$(bindir)/$(package)" + -$(UNINSTALL) "$(DESTDIR)$(mandir)/man1/$(package).1" + -$(UNINSTALL) "$(DESTDIR)$(mandir)/man1/$(package).1.gz" + -if test -n "$(CATALOGS)"; then \ + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + name=`echo $$cat | sed 's,^.*/,,g'`; \ + if test "`echo $$name | sed 's/.*\(\..*\)/\1/'`" = ".gmo"; then \ + destdir=$(gnulocaledir); \ + else \ + destdir=$(localedir); \ + fi; \ + lang=`echo $$name | sed 's/$(CATOBJEXT)$$//'`; \ + dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ + $(UNINSTALL) $$dir/$(PACKAGE)$(INSTOBJEXT); \ + done; \ + fi + +rpmbuild: + echo macrofiles: `rpm --showrc \ + | grep ^macrofiles \ + | cut -d : -f 2- \ + | sed 's,^[^/]*/,/,'`:`pwd`/rpmmacros > rpmrc + echo %_topdir `pwd`/rpm > rpmmacros + rm -rf rpm + mkdir rpm + mkdir rpm/SPECS rpm/BUILD rpm/SOURCES rpm/RPMS rpm/SRPMS + -cat /usr/lib/rpm/rpmrc /etc/rpmrc $$HOME/.rpmrc \ + | grep -hsv ^macrofiles \ + >> rpmrc + +rpm: + test -e $(package)-$(version).tar.gz || $(MAKE) dist + test -e rpmrc || $(MAKE) rpmbuild + rpmbuild $(RPMFLAGS) --rcfile=rpmrc -tb $(package)-$(version).tar.gz + mv rpm/RPMS/*/$(package)-*.rpm . + rm -rf rpm rpmmacros rpmrc + +srpm: + test -e $(package)-$(version).tar.gz || $(MAKE) dist + test -e rpmrc || $(MAKE) rpmbuild + rpmbuild $(RPMFLAGS) --rcfile=rpmrc -ts $(package)-$(version).tar.gz + mv rpm/SRPMS/*$(package)-*.rpm . + rm -rf rpm rpmmacros rpmrc + +release: dist rpm srpm + zcat $(package)-$(version).tar.gz | bzip2 > $(package)-$(version).tar.bz2 diff --git a/autoconf/make/vars.mk b/autoconf/make/vars.mk new file mode 100644 index 0000000..1a74541 --- /dev/null +++ b/autoconf/make/vars.mk @@ -0,0 +1,47 @@ +# +# Variables for Make. +# + +srcdir = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +infodir = @infodir@ +mandir = @mandir@ +etcdir = @prefix@/etc +datadir = @datadir@ +sbindir = @sbindir@ + +VPATH = $(srcdir) + +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale + +CATALOGS = @CATALOGS@ +POFILES = @POFILES@ +GMSGFMT = @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = @XGETTEXT@ +MSGMERGE = msgmerge +CATOBJEXT = @CATOBJEXT@ +INSTOBJEXT = @INSTOBJEXT@ + +@SET_MAKE@ +SHELL = /bin/sh +CC = @CC@ +DO_GZIP = @DO_GZIP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +UNINSTALL = rm -f + +LDFLAGS = -r +LINKFLAGS = @LDFLAGS@ +DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/src/include -Isrc/include $(DEFS) +LIBS = @LIBS@ + +alltarg = @PACKAGE@ + +# EOF diff --git a/autoconf/scripts/benchmark.sh b/autoconf/scripts/benchmark.sh new file mode 100755 index 0000000..37ef35d --- /dev/null +++ b/autoconf/scripts/benchmark.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Benchmark the read/write performance of pv by looking at the number of +# read() and write() calls and the average amount of data transferred each +# time, as suggested by Ville Herva <Ville.Herva@iki.fi>. +# + +test_input=`mktemp /tmp/pvbench1XXXXXX` +strace_output=`mktemp /tmp/pvbench2XXXXXX` + +trap "rm -f ${test_input} ${strace_output}" 0 + +pv=${pv:-./pv} +test -x ${pv} || pv=pv + +dd if=/dev/zero of=${test_input} bs=1k count=1k >/dev/null 2>&1 + +echo -e "Buf(k)\tRate(k)\tReads\tRsize\tWrites\tWsize" + +for ((buffer=100; buffer<=1000; buffer+=100)); do + for ((rate=0; rate<=1000; rate+=100)); do + rateparm="-L ${rate}k" + test ${rate} -eq 0 && rateparm="" + strace -tt -o ${strace_output} \ + ${pv} ${rateparm} -B ${buffer}k \ + -f < ${test_input} > /dev/null 2>&1 + rdata=$( + awk '$2~/^read\(0,/{c++;t+=$NF}END{print c "\t" t/c}' \ + ${strace_output} + ) + wdata=$( + awk '$2~/^write\(1,/{c++;t+=$NF}END{print c "\t" t/c}' \ + ${strace_output} + ) + echo -e "${buffer}\t${rate}\t${rdata}\t${wdata}" + done +done + +# EOF diff --git a/autoconf/scripts/depend.sh b/autoconf/scripts/depend.sh new file mode 100755 index 0000000..f17f81e --- /dev/null +++ b/autoconf/scripts/depend.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Generate dependencies for a C source file. +# + +CC=$1 +shift +file=$1 +shift +stem=$1 +shift +srcdir=$1 +abssrc=`echo $srcdir | sed ':1 +s,^\./,,g +t1'` +shift + +abssrc=`echo "$abssrc" | sed 's,\\.,\\\\.,g'` +srcdir=`echo "$srcdir" | sed 's,\\.,\\\\.,g'` + +$CC -M -MG $* $file \ +| sed -e 's, /[^ ]*,,g' -e "s,^.*\.o:,${stem}.d ${stem}.o:," \ + -e '/^ \\$/d' -e 's/ \\$//' \ + -e 's,'"$srcdir"'/,,g' -e 's,'"$abssrc"'/,,g' \ +| tr '\n' ' ' \ +| tr -s ' ' + +echo + +# EOF diff --git a/autoconf/scripts/index.sh b/autoconf/scripts/index.sh new file mode 100755 index 0000000..e0a0c07 --- /dev/null +++ b/autoconf/scripts/index.sh @@ -0,0 +1,171 @@ +#!/bin/ash +# +# Script to generate an HTML index of all C code from the current directory +# downwards (skipping directories ending in ~). The header comment in each +# file is listed, and each function's prototype and comment are given. A +# list of "TODO:" comments is also generated. +# +# Outputs the HTML on standard output. +# +# If a parameter is given, it is the prefix to put before any "view file" +# links, eg ".." to link to "../dir/file.c" instead of "dir/file.c". +# +# Skips any files containing the string !NOINDEX. +# +# Requires ctags and cproto. +# + +OFFS=$1 + + +# Convert the given string to HTML-escaped values (<, >, & escaped) on +# stdout. +# +html_safe () { + echo "$*" \ + | sed -e 's|&|\&|g;s|<|\<|g;s|>|\>|g' +} + + +# Convert the given string to HTML-escaped values (<, >, & escaped) on +# stdout, also adding a <BR> to the end of each line. +# +html_safebr () { + echo "$*" \ + | sed -e 's|&|\&|g;s|<|\<|g;s|>|\>|g;s/$/<BR>/' +} + +ALLFILES=`find . -name '*~' -prune -o -type f -name '*.c' \ + -exec grep -FL '!NOINDEX' /dev/null '{}' ';'` + +CTAGDATA=`echo "$ALLFILES" \ + | ctags -nRf- -L- --c-types=f \ + | sed 's/ .\// /;s/;" .*$//'` + +FILELIST=`echo "$CTAGDATA" | cut -d ' ' -f 2 | sort | uniq` + +echo '<HTML><HEAD>' +echo '<TITLE>Source Code Index</TITLE>' +echo '</HEAD><BODY>' +echo '<H1><A NAME="top">Source Code Index</A></H1>' +echo '<P><UL>' +echo '<LI><A HREF="#files">File Listing</A></LI>' +echo '<LI><A HREF="#funcs">Function Listing</A></LI>' +echo '<LI><A HREF="#todo">To-Do Listing</A></LI>' +echo '</UL></P>' + +echo '<H2><A NAME="files">File Listing</A></H2>' +echo '<P><UL>' +echo "$FILELIST" \ +| sed -e \ + 's|^.*$|<LI><CODE CLASS="filename"><A HREF="#file-\0">\0</A></CODE></LI>|' +echo '</UL></P>' + +for FILE in $FILELIST; do + + DIR=`dirname $FILE` + FUNCDEFS=`cproto -f1 -I. -Isrc/include -I$DIR $FILE 2>/dev/null \ + | sed -n 's/^.*[ *]\([^ *(]*\)(.*$/\1/p'` + FILEHEAD="`sed -n -e \ + '1,/\*\//{/\/\*/,/\*\//{s/^[\/ *]//;s/^\*[\/]*//;p;};}' \ + < $FILE`" + FILESHORTDESC=`echo "$FILEHEAD" | sed -n '1,/^ *$/{/^ *[^ ]*/p;}'` + FILELONGDESC=`echo "$FILEHEAD" | sed '1,/^ *$/d'` + + echo '<P><HR WIDTH="100%"></P>' + echo '<P><TABLE BORDER="0"><TR>' + echo '<TD VALIGN="TOP"><CODE CLASS="filename">' + echo '<A NAME="file-'"$FILE"'">'"$FILE"'</A></CODE></TD>' + echo '<TD VALIGN="TOP"> - </TD>' + echo '<TD VALIGN="TOP">'`html_safe "$FILESHORTDESC"`'</TD>' + echo '</TR></TABLE></P>' + echo '<P><SMALL>[<A HREF="'"$OFFS/$FILE"'">View File</A>]</SMALL></P>' + echo '<P><BLOCKQUOTE>' + echo "`html_safebr "$FILELONGDESC"`" + echo '</BLOCKQUOTE></P>' + + if [ -n "$FUNCDEFS" ]; then + echo '<P>Functions defined:</P>' + echo '<P><UL>' + echo "$FUNCDEFS" \ + | sed 's|^.*$|<A HREF="#func-\0---'"$FILE"'">\0</A>|' \ + | sed 's/^/<LI><CODE CLASS="funcname">/;s|$|</CODE></LI>|' + echo '</UL></P>' + fi + + echo '<P ALIGN="RIGHT"><SMALL CLASS="navbar">[' + echo '<A HREF="#top">Top</A> |' + echo '<A HREF="#todo">To Do</A> |' + echo '<A HREF="#funcs">Functions</A> ]</SMALL></P>' +done + +echo '<H2><A NAME="funcs">Function Listing</A></H2>' +echo '<P><UL>' +echo "$CTAGDATA" | while read FUNC FILE LINENUM REST; do + echo -n '<LI><CODE CLASS="funcname">' + echo -n '<A HREF="#func-'"$FUNC"'---'"$FILE"'">'"$FUNC"'</A></CODE> ' + echo '[<CODE CLASS="filename">'"$FILE"'</CODE>]</LI>' +done +echo '</UL></P>' + +echo "$CTAGDATA" | while read FUNC FILE LINENUM REST; do + + FUNCDEF=`sed -n "$LINENUM,/{/p" < $FILE \ + | tr '\n' ' ' \ + | tr -d '{'` + + LASTCOMLINE=`sed -n '1,'"$LINENUM"'{/\/\*/=;}' < $FILE | sed -n '$p'` + [ -z "$LASTCOMLINE" ] && LASTCOMLINE=1 + LASTENDFUNCLINE=`sed -n '1,'"$LINENUM"'{/}/=;}' < $FILE | sed -n '$p'` + [ -z "$LASTENDFUNCLINE" ] && LASTENDFUNCLINE=1 + FUNCHEAD="`sed -n -e \ + "$LASTCOMLINE,"'/\*\//{h;s/^[\/ *]//;s/^\*[\/]*//;p;x;/\*\//q;}' \ + < $FILE`" + [ "$LASTCOMLINE" -le "$LASTENDFUNCLINE" ] && FUNCHEAD="" + + echo '<P><HR WIDTH="100%"></P>' + echo '<P ALIGN="LEFT">' + echo -n '<CODE CLASS="funcname"><A NAME="func-'"$FUNC"'---'"$FILE"'">' + echo -n "$FUNC"'</A></CODE> ' + echo -n '[<CODE CLASS="filename"><A HREF="#file-'"$FILE"'">' + echo "$FILE"'</A></CODE>]' + echo '</P>' + + echo '<P><CODE CLASS="funcdef">'"`html_safe "$FUNCDEF"`"'</CODE></P>' + + echo '<P><BLOCKQUOTE>' + echo "`html_safebr "$FUNCHEAD"`" + echo '</BLOCKQUOTE></P>' + + echo '<P ALIGN="RIGHT"><SMALL CLASS="navbar">[' + echo '<A HREF="#top">Top</A> |' + echo '<A HREF="#todo">To Do</A> |' + echo '<A HREF="#files">Files</A> ]</SMALL></P>' +done + +echo '<H2><A NAME="todo">To Do Listing</A></H2>' +echo '<P><UL>' +for FILE in $FILELIST; do + + TODOLINES=`sed -n \ + -e '/\/\*.*\*\//!{/\/\*/,/\*\//{/TODO:/{=;};};}' \ + -e '/\/\*.*\*\//{/TODO:/{=;};}' \ + < $FILE` + + [ -z "$TODOLINES" ] && continue + + echo -n '<LI><CODE CLASS="filename">' + echo '<A HREF="#file-'"$FILE"'">'"$FILE"'</A></CODE>' + echo '<UL>' + + for NUM in $TODOLINES; do + TODO=`sed -n "$NUM"'{s/^.*TODO://;s/\*\/.*$//;p;}' < $FILE` + echo "<LI>[<B>$NUM</B>] `html_safe "$TODO"`</LI>" + done + + echo '</UL></LI>' +done + +echo '</BODY></HTML>' + +# EOF diff --git a/autoconf/scripts/install.sh b/autoconf/scripts/install.sh new file mode 100755 index 0000000..ebc6691 --- /dev/null +++ b/autoconf/scripts/install.sh @@ -0,0 +1,250 @@ +#! /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=: + 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 diff --git a/autoconf/scripts/makemake.sh b/autoconf/scripts/makemake.sh new file mode 100755 index 0000000..3eca6c6 --- /dev/null +++ b/autoconf/scripts/makemake.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# +# Generate Makefile dependencies inclusion and module target file "depend.mk~" +# by scanning the directory "src" for files ending in ".c" and ".d", and for +# subdirectories not starting with "_". +# +# Modules live inside subdirectories called [^_]* - i.e. a directory "foo" will +# have a rule created which links all code inside it to "foo.o". +# +# The directory "src/include" is never scanned; neither are CVS or SVN +# directories. +# + +outlist=$1 +outlink=$2 + +FIND=find +GREP=grep +which gfind 2>/dev/null | grep /gfind >/dev/null && FIND=gfind +which ggrep 2>/dev/null | grep /ggrep >/dev/null && GREP=ggrep + +echo '# Automatically generated file listings' > $outlist +echo '#' >> $outlist +echo "# Creation time: `date`" >> $outlist +echo >> $outlist + +echo '# Automatically generated module linking rules' > $outlink +echo '#' >> $outlink +echo "# Creation time: `date`" >> $outlink +echo >> $outlink + +echo -n "Scanning for source files: " + +allsrc=`$FIND src -type f -name "*.c" -print` +allobj=`echo $allsrc | tr ' ' '\n' | sed 's/\.c$/.o/'` +alldep=`echo $allsrc | tr ' ' '\n' | sed 's/\.c$/.d/'` + +echo `echo $allsrc | wc -w | tr -d ' '` found + +echo -n "Scanning for modules: " + +modules=`$FIND src -type d -print \ + | $GREP -v '^src$' \ + | $GREP -v '/_' \ + | $GREP -v '^src/include' \ + | $GREP -v 'CVS' \ + | $GREP -v '.svn' \ + | while read DIR; do \ + CONTENT=\$(/bin/ls -d \$DIR/* \ + | $GREP -v '.po$' \ + | $GREP -v '.gmo$' \ + | $GREP -v '.mo$' \ + | $GREP -v '.h$' \ + | sed -n '$p'); \ + [ -n "\$CONTENT" ] || continue; \ + echo \$DIR; \ + done + ` + +echo up to `echo $modules | wc -w | tr -d ' '` found + +echo "Writing module linking rules" + +echo -n [ +for i in $modules; do echo -n ' '; done +echo -n -e ']\r[' + +for i in $modules; do + echo -n '.' + allobj="$allobj $i.o" + deps="" + for j in $i/*.c; do + [ -f $j ] || continue + newobj=`echo $j | sed -e 's@\.c$@.o@'` + deps="$deps $newobj" + done + for j in $i/*; do + [ -d "$j" ] || continue + [ `basename $j` = "CVS" ] && continue + [ `basename $j` = ".svn" ] && continue + CONTENT=`/bin/ls -d $j/* \ + | $GREP -v '.po$' \ + | $GREP -v '.gmo$' \ + | $GREP -v '.mo$' \ + | $GREP -v '.h$' \ + | sed -n '$p'` + [ -n "$CONTENT" ] || continue + deps="$deps $j.o" + done + [ -n "$deps" ] || continue + echo "$i.o: $deps" >> $outlink + echo ' $(LD) $(LDFLAGS) -o $@' "$deps" >> $outlink + echo >> $outlink +done + +echo ']' + +echo "Listing source, object and dependency files" + +echo -n "allsrc = " >> $outlist +echo $allsrc | sed 's,src/nls/cat-id-tbl.c,,' | sed -e 's/ / \\!/g'\ +| tr '!' '\n' >> $outlist +echo >> $outlist +echo -n "allobj = " >> $outlist +echo $allobj | sed -e 's/ / \\!/g' | tr '!' '\n' >> $outlist +echo >> $outlist +echo -n "alldep = " >> $outlist +echo $alldep | sed -e 's/ / \\!/g' | tr '!' '\n' >> $outlist + +echo >> $outlist +echo >> $outlink + +# EOF diff --git a/autoconf/scripts/mkinstalldirs b/autoconf/scripts/mkinstalldirs new file mode 100755 index 0000000..ff059dd --- /dev/null +++ b/autoconf/scripts/mkinstalldirs @@ -0,0 +1,33 @@ +#!/bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" || errstatus=$? + chmod 755 $pathcomp 2>/dev/null + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/autoconf/scripts/po2table.sh b/autoconf/scripts/po2table.sh new file mode 100755 index 0000000..aca396e --- /dev/null +++ b/autoconf/scripts/po2table.sh @@ -0,0 +1,65 @@ +#!/bin/sh +# +# Messy script to convert all of the given .po files to a single C file on +# stdout. + +cat <<EOF +/* + * Translation table - automatically generated by po2table.sh. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <string.h> + +struct msgtable_s { + char *msgid; + char *msgstr; +}; + + +struct msgtable_s *minigettext__gettable(char *lang) +{ + if (lang == 0) + return 0; + +EOF + +for POFILE; do + LANG=`basename "$POFILE" | sed 's/.po$//'` + echo " if (strncmp(lang, \"$LANG\", 2) == 0) {" + echo " static struct msgtable_s data[] = {"; + + awk 'BEGIN{i=0;s=0;} + /^msgid[ ]+/ { + if (s) print " }, "; + print " {"; + print " " substr($0,7); + i=1; + s=0; + } + /^msgstr[ ]+/ { + print " ,"; + i=0;s=1; + print " " substr($0,8); + } + /^[ ]*"/ { + if (i||s) print " " $0; + } + END {if (i||s) print " }\n";} + ' < "$POFILE" + echo ' , { 0, 0 } };' + echo " return data;" + echo " }" +done + +cat <<EOF + + return 0; +} + +/* EOF */ +EOF + +# EOF diff --git a/autoconf/scripts/run-test.sh b/autoconf/scripts/run-test.sh new file mode 100755 index 0000000..a384a21 --- /dev/null +++ b/autoconf/scripts/run-test.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Run a test. Parameters are program name and source directory; if +# additional parameters are given, they are the tests to run, otherwise all +# tests are run. +# + +PROG="$1" +SRCDIR="$2" +shift +shift +TESTS="$*" + +# Temporary working files +# +TMP1=.tmp1 +TMP2=.tmp2 + +if which mktemp >/dev/null 2>&1; then + TMP1=`mktemp` + TMP2=`mktemp` +fi + +export PROG TMP1 TMP2 # variables used by test scripts + +FAIL=0 + +test -n "$TESTS" || TESTS=`ls "$SRCDIR/tests" | sort -n` + +for SCRIPT in $TESTS; do + test -f "$SCRIPT" || SCRIPT="$SRCDIR/tests/$SCRIPT" + test -f "$SCRIPT" || SCRIPT=`ls "$SRCDIR/tests/$SCRIPT"*` + test -f "$SCRIPT" || continue + + echo `basename "$SCRIPT"`: " " | cut -b1-20 | sed 's/-/ - /' | tr "\n" ' ' + + STATUS=0 + sh -e "$SCRIPT" || STATUS=1 + test $STATUS -eq 1 && FAIL=1 + + test $STATUS -eq 1 && echo "FAILED" || echo "OK" +done + +rm -f $TMP1 $TMP2 + +exit $FAIL + +# EOF |